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;
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;
// 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();
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);
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();
-}
~TaskBarMap();
iterator find_id(int id);
- iterator find_by_idx(int idx);
};
}
T* _p;
- ShellMalloc _malloc; // IMalloc memory management object
+ mutable ShellMalloc _malloc; // IMalloc memory management object
private:
// disallow copying of SShellPtr objects
// 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;
}
};
#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
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)
{
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;