fixed create_absolute_pidl()

svn path=/trunk/; revision=5802
This commit is contained in:
Martin Fuchs 2003-08-23 19:48:37 +00:00
parent 20228bbf5d
commit ffa80e7e36
8 changed files with 29 additions and 34 deletions

View file

@ -105,10 +105,9 @@ bool ShellDirectory::fill_w32fdata_shell(LPCITEMIDLIST pidl, SFGAOF attribs, WIN
LPITEMIDLIST ShellEntry::create_absolute_pidl(HWND hwnd)
{
if (_up/* && _up->_etype==ET_SHELL*/) {
LPITEMIDLIST pidl = _pidl.create_absolute_pidl(static_cast<ShellDirectory*>(_up)->_folder, hwnd);
ShellDirectory* dir = static_cast<ShellDirectory*>(_up);
if (pidl)
return pidl;
return _pidl.create_absolute_pidl(dir->_pidl, hwnd);
}
return &*_pidl;
@ -147,7 +146,7 @@ BOOL ShellEntry::launch_entry(HWND hwnd, UINT nCmdShow)
SHELLEXECUTEINFO shexinfo;
shexinfo.cbSize = sizeof(SHELLEXECUTEINFO);
shexinfo.fMask = SEE_MASK_INVOKEIDLIST;//@@SEE_MASK_IDLIST;
shexinfo.fMask = SEE_MASK_INVOKEIDLIST; // SEE_MASK_IDLIST is also possible.
shexinfo.hwnd = hwnd;
shexinfo.lpVerb = NULL;
shexinfo.lpFile = NULL;

View file

@ -171,7 +171,7 @@ LRESULT StartMenu::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
// close start menu when activating another application
if (!wparam)
CloseStartMenu();
goto def;
break; // don't call super::WndProc in case "this" has been deleted
case WM_CANCELMODE:
CloseStartMenu();

View file

@ -151,13 +151,19 @@ int TaskBar::Notify(int id, NMHDR* pnmh)
if (pnmh->hwndFrom == _htoolbar)
switch(pnmh->code) {
case NM_RCLICK: {
TBBUTTONINFO btninfo;
TaskBarMap::iterator it;
Point pt(GetMessagePos());
ScreenToClient(_htoolbar, &pt);
btninfo.cbSize = sizeof(TBBUTTONINFO);
btninfo.dwMask = TBIF_BYINDEX|TBIF_COMMAND;
int idx = SendMessage(_htoolbar, TB_HITTEST, 0, (LPARAM)&pt);
if (idx>=0 && (it=_map.find_by_idx(idx))!=_map.end()) {
if (idx>=0 &&
SendMessage(_htoolbar, TB_GETBUTTONINFO, idx, (LPARAM)&btninfo)!=-1 &&
(it=_map.find_id(btninfo.idCommand))!=_map.end()) {
TaskBarEntry& entry = it->second;
ActivateApp(it, false);
@ -391,12 +397,3 @@ TaskBarMap::iterator TaskBarMap::find_id(int id)
return end();
}
TaskBarMap::iterator TaskBarMap::find_by_idx(int idx)
{
for(iterator it=begin(); it!=end(); ++it)
if (it->second._btn_idx == idx)
return it;
return end();
}

View file

@ -62,7 +62,6 @@ struct TaskBarMap : public map<HWND, TaskBarEntry>
~TaskBarMap();
iterator find_id(int id);
iterator find_by_idx(int idx);
};

View file

@ -240,7 +240,7 @@ protected:
}
T* _p;
ShellMalloc _malloc; // IMalloc memory management object
mutable ShellMalloc _malloc; // IMalloc memory management object
private:
// disallow copying of SShellPtr objects
@ -599,23 +599,18 @@ struct ShellPath : public SShellPtr<ITEMIDLIST>
// convert an item id list from relative to absolute (=relative to the desktop) format
LPITEMIDLIST create_absolute_pidl(IShellFolder* parent_folder, HWND hwnd) const
LPITEMIDLIST create_absolute_pidl(LPCITEMIDLIST parent_pidl, HWND hwnd) const
{
WCHAR buffer[MAX_PATH];
// create a new item id list with _p append behind parent_pidl
int l1 = _malloc->GetSize((void*)parent_pidl) - sizeof(USHORT/*SHITEMID::cb*/);
int l2 = _malloc->GetSize(_p);
HRESULT hr = path_from_pidlW(parent_folder, _p, buffer, MAX_PATH);
LPITEMIDLIST p = (LPITEMIDLIST) _malloc->Alloc(l1+l2);
if (SUCCEEDED(hr)) {
LPITEMIDLIST pidl;
ULONG len;
memcpy(p, parent_pidl, l1);
memcpy((LPBYTE)p+l1, _p, l2);
hr = Desktop()->ParseDisplayName(hwnd, NULL, buffer, &len, &pidl, NULL);
if (SUCCEEDED(hr))
return pidl;
}
return NULL;
return p;
}
};

View file

@ -46,12 +46,15 @@
#ifndef BTNS_BUTTON
#define BTNS_BUTTON TBSTYLE_BUTTON //TODO: should be in mingw headers
#define BTNS_BUTTON TBSTYLE_BUTTON //missing in old mingw headers
#define BTNS_SEP TBSTYLE_SEP
#endif
#ifndef TB_HITTEST //missing in mingw headers
#define TB_HITTEST (WM_USER+69)
#endif
#ifndef TB_GETBUTTONINFO //missing in mingw headers
#define TB_GETBUTTONINFO (WM_USER+65)
#endif
#ifdef __cplusplus

View file

@ -186,12 +186,14 @@ LRESULT CALLBACK Window::WindowWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPAR
LRESULT Window::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
{
HWND hwnd = _hwnd;
// close startup menu and other popup menus
// This functionality is for tray notification icons missing in MS Windows.
if (nmsg == WM_SETFOCUS)
CancelModes((HWND)wparam);
return DefWindowProc(_hwnd, nmsg, wparam, lparam);
return DefWindowProc(hwnd, nmsg, wparam, lparam);
}
int Window::Command(int id, int code)

View file

@ -373,12 +373,12 @@ template<typename BASE> struct OwnerDrawParent : public BASE
{
switch(nmsg) {
case WM_DRAWITEM:
if (wparam) { // ein Control?
if (wparam) { // should there be drawn a control?
HWND hctl = GetDlgItem(_hwnd, wparam);
if (hctl)
return SendMessage(hctl, PM_DISPATCH_DRAWITEM, wparam, lparam);
} /*else // oder ein Menüeintrag?
} /*else // or is it a menu entry?
; */
return 0;