[EXPLORER-NEW]

* Make use of the CToolbar<T> class to implement a CTaskToolbar.
* Change the CTaskSwitchWnd class to use CTaskToolbar instead of managing the HWND directly.
* Silence logspam in CTrayBandSite.
* Fix CNotifyToolbar to properly.
* Move the call to SetMetrics to be called only on initialization, instead of every time an icon changes.
* Make the start button a CContainedWindowT instead of a raw HWND. TODO: Make a CStartButton class to manage it.

[include/reactos/rosctrls.h]
* Some improvements needed by the taskbar.

svn path=/branches/shell-experiments/; revision=65274
This commit is contained in:
David Quintana 2014-11-05 22:58:53 +00:00
parent 2c30ae43b0
commit a2cc12f3e7
6 changed files with 520 additions and 654 deletions

View file

@ -218,7 +218,7 @@ _tWinMain(IN HINSTANCE hInstance,
#if !WIN7_COMPAT_MODE #if !WIN7_COMPAT_MODE
BOOL CreateShellDesktop = FALSE; BOOL CreateShellDesktop = FALSE;
DbgPrint("Explorer starting... Commandline: %S\n", lpCmdLine); TRACE("Explorer starting... Commandline: %S\n", lpCmdLine);
/* /*
* Set our shutdown parameters: we want to shutdown the very last, * Set our shutdown parameters: we want to shutdown the very last,

File diff suppressed because it is too large Load diff

View file

@ -262,13 +262,10 @@ public:
return E_FAIL; return E_FAIL;
/*TRACE("Calling IWinEventHandler::ProcessMessage(0x%p, 0x%x, 0x%p, 0x%p, 0x%p) hWndRebar=0x%p\n", hWnd, uMsg, wParam, lParam, plResult, hWndRebar);*/ /*TRACE("Calling IWinEventHandler::ProcessMessage(0x%p, 0x%x, 0x%p, 0x%p, 0x%p) hWndRebar=0x%p\n", hWnd, uMsg, wParam, lParam, plResult, hWndRebar);*/
hRet = WindowEventHandler->OnWinEvent( hRet = WindowEventHandler->OnWinEvent(hWnd, uMsg, wParam, lParam, plResult);
hWnd,
uMsg, #if 0
wParam, if (FAILED(hRet))
lParam,
plResult);
if (FAILED_UNEXPECTEDLY(hRet))
{ {
if (uMsg == WM_NOTIFY) if (uMsg == WM_NOTIFY)
{ {
@ -280,6 +277,7 @@ public:
ERR("ITrayBandSite->IWinEventHandler::ProcessMessage(0x%p,0x%x,0x%p,0x%p,0x%p->0x%p) returned: 0x%x\n", hWnd, uMsg, wParam, lParam, plResult, *plResult, hRet); ERR("ITrayBandSite->IWinEventHandler::ProcessMessage(0x%p,0x%x,0x%p,0x%p,0x%p->0x%p) returned: 0x%x\n", hWnd, uMsg, wParam, lParam, plResult, *plResult, hRet);
} }
} }
#endif
return hRet; return hRet;
} }

View file

@ -19,7 +19,9 @@
*/ */
#include "precomp.h" #include "precomp.h"
//#include <docobj.h>
#define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
#define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
/* /*
* SysPagerWnd * SysPagerWnd
@ -86,6 +88,13 @@ public:
NOTIFYICONDATA * notifyItem; NOTIFYICONDATA * notifyItem;
WCHAR text [] = TEXT(""); WCHAR text [] = TEXT("");
int index = FindItemByIconData(iconData, &notifyItem);
if (index >= 0)
{
UpdateButton(iconData);
return;
}
notifyItem = new NOTIFYICONDATA(); notifyItem = new NOTIFYICONDATA();
ZeroMemory(notifyItem, sizeof(*notifyItem)); ZeroMemory(notifyItem, sizeof(*notifyItem));
@ -203,7 +212,7 @@ public:
delete notifyItem; delete notifyItem;
} }
VOID GetTooltip(int index, LPTSTR szTip, DWORD cchTip) VOID GetTooltipText(int index, LPTSTR szTip, DWORD cchTip)
{ {
NOTIFYICONDATA * notifyItem; NOTIFYICONDATA * notifyItem;
notifyItem = GetItemData(index); notifyItem = GetItemData(index);
@ -242,7 +251,7 @@ private:
if (uMsg >= WM_MOUSEFIRST && uMsg <= WM_MOUSELAST) if (uMsg >= WM_MOUSEFIRST && uMsg <= WM_MOUSELAST)
{ {
DbgPrint("Sending message %S from button %d to %p (msg=%x, w=%x, l=%x)...\n", TRACE("Sending message %S from button %d to %p (msg=%x, w=%x, l=%x)...\n",
eventNames[uMsg - WM_MOUSEFIRST], wIndex, eventNames[uMsg - WM_MOUSEFIRST], wIndex,
notifyItem->hWnd, notifyItem->uCallbackMessage, notifyItem->uID, uMsg); notifyItem->hWnd, notifyItem->uCallbackMessage, notifyItem->uID, uMsg);
} }
@ -269,13 +278,9 @@ private:
LRESULT OnMouseEvent(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) LRESULT OnMouseEvent(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{ {
POINT pt; POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
INT iBtn;
pt.x = LOWORD(lParam); INT iBtn = HitTest(&pt);
pt.y = HIWORD(lParam);
iBtn = (INT) SendMessageW(TB_HITTEST, 0, (LPARAM) &pt);
if (iBtn >= 0) if (iBtn >= 0)
{ {
@ -286,9 +291,64 @@ private:
return FALSE; return FALSE;
} }
LRESULT OnTooltipShow(INT uCode, LPNMHDR hdr, BOOL& bHandled)
{
RECT rcTip, rcItem;
GetWindowRect(hdr->hwndFrom, &rcTip);
SIZE szTip = { rcTip.right - rcTip.left, rcTip.bottom - rcTip.top };
INT iBtn = GetHotItem();
if (iBtn >= 0)
{
MONITORINFO monInfo = { 0 };
HMONITOR hMon = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
monInfo.cbSize = sizeof(monInfo);
if (hMon)
GetMonitorInfo(hMon, &monInfo);
else
GetWindowRect(GetDesktopWindow(), &monInfo.rcMonitor);
GetItemRect(iBtn, &rcItem);
POINT ptItem = { rcItem.left, rcItem.top };
SIZE szItem = { rcItem.right - rcItem.left, rcItem.bottom - rcItem.top };
ClientToScreen(m_hWnd, &ptItem);
ptItem.x += szItem.cx / 2;
ptItem.y -= szTip.cy;
if (ptItem.x + szTip.cx > monInfo.rcMonitor.right)
ptItem.x = monInfo.rcMonitor.right - szTip.cx;
if (ptItem.y + szTip.cy > monInfo.rcMonitor.bottom)
ptItem.y = monInfo.rcMonitor.bottom - szTip.cy;
if (ptItem.x < monInfo.rcMonitor.left)
ptItem.x = monInfo.rcMonitor.left;
if (ptItem.y < monInfo.rcMonitor.top)
ptItem.y = monInfo.rcMonitor.top;
TRACE("ptItem { %d, %d }\n", ptItem.x, ptItem.y);
::SetWindowPos(hdr->hwndFrom, NULL, ptItem.x, ptItem.y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
return TRUE;
}
bHandled = FALSE;
return 0;
}
public: public:
BEGIN_MSG_MAP(CNotifyToolbar) BEGIN_MSG_MAP(CNotifyToolbar)
MESSAGE_RANGE_HANDLER(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseEvent) MESSAGE_RANGE_HANDLER(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseEvent)
NOTIFY_CODE_HANDLER(TTN_SHOW, OnTooltipShow)
END_MSG_MAP() END_MSG_MAP()
void Initialize(HWND hWndParent) void Initialize(HWND hWndParent)
@ -298,7 +358,7 @@ public:
TBSTYLE_FLAT | TBSTYLE_TOOLTIPS | TBSTYLE_WRAPABLE | TBSTYLE_TRANSPARENT | TBSTYLE_FLAT | TBSTYLE_TOOLTIPS | TBSTYLE_WRAPABLE | TBSTYLE_TRANSPARENT |
CCS_TOP | CCS_NORESIZE | CCS_NOPARENTALIGN | CCS_NODIVIDER; CCS_TOP | CCS_NORESIZE | CCS_NOPARENTALIGN | CCS_NODIVIDER;
Create(hWndParent, styles); SubclassWindow(Create(hWndParent, styles));
SetWindowTheme(m_hWnd, L"TrayNotify", NULL); SetWindowTheme(m_hWnd, L"TrayNotify", NULL);
@ -398,7 +458,6 @@ public:
void GetSize(IN WPARAM wParam, IN PSIZE size) void GetSize(IN WPARAM wParam, IN PSIZE size)
{ {
INT rows = 0; INT rows = 0;
TBMETRICS tbm;
int VisibleButtonCount = Toolbar.GetVisibleButtonCount(); int VisibleButtonCount = Toolbar.GetVisibleButtonCount();
if (wParam) /* horizontal */ if (wParam) /* horizontal */
@ -415,20 +474,12 @@ public:
rows++; rows++;
size->cy = (VisibleButtonCount + rows - 1) / rows * 24; size->cy = (VisibleButtonCount + rows - 1) / rows * 24;
} }
tbm.cbSize = sizeof(tbm);
tbm.dwMask = TBMF_BARPAD | TBMF_BUTTONSPACING;
tbm.cxBarPad = tbm.cyBarPad = 0;
tbm.cxButtonSpacing = 0;
tbm.cyButtonSpacing = 0;
Toolbar.SetMetrics(&tbm);
} }
LRESULT OnGetInfoTip(INT uCode, LPNMHDR hdr, BOOL& bHandled) LRESULT OnGetInfoTip(INT uCode, LPNMHDR hdr, BOOL& bHandled)
{ {
NMTBGETINFOTIPW * nmtip = (NMTBGETINFOTIPW *) hdr; NMTBGETINFOTIPW * nmtip = (NMTBGETINFOTIPW *) hdr;
Toolbar.GetTooltip(nmtip->iItem, nmtip->pszText, nmtip->cchTextMax); Toolbar.GetTooltipText(nmtip->iItem, nmtip->pszText, nmtip->cchTextMax);
return TRUE; return TRUE;
} }
@ -457,6 +508,15 @@ public:
if (Toolbar) if (Toolbar)
{ {
TBMETRICS tbm;
tbm.cbSize = sizeof(tbm);
tbm.dwMask = TBMF_BARPAD | TBMF_BUTTONSPACING;
tbm.cxBarPad = tbm.cyBarPad = 0;
tbm.cxButtonSpacing = 0;
tbm.cyButtonSpacing = 0;
Toolbar.SetMetrics(&tbm);
Toolbar.SetWindowPos(NULL, 0, 0, szClient.cx, szClient.cy, SWP_NOZORDER); Toolbar.SetWindowPos(NULL, 0, 0, szClient.cx, szClient.cy, SWP_NOZORDER);
Toolbar.AutoSize(); Toolbar.AutoSize();

View file

@ -60,11 +60,11 @@ class CTrayWindow :
public ITrayWindow, public ITrayWindow,
public IShellDesktopTray public IShellDesktopTray
{ {
CContainedWindow StartButton;
HTHEME TaskbarTheme; HTHEME TaskbarTheme;
HWND hWndDesktop; HWND hWndDesktop;
HWND hwndStart;
IImageList * himlStartBtn; IImageList * himlStartBtn;
SIZE StartBtnSize; SIZE StartBtnSize;
HFONT hStartBtnFont; HFONT hStartBtnFont;
@ -120,9 +120,9 @@ class CTrayWindow :
public: public:
CTrayWindow() : CTrayWindow() :
StartButton(this, 1),
TaskbarTheme(NULL), TaskbarTheme(NULL),
hWndDesktop(NULL), hWndDesktop(NULL),
hwndStart(NULL),
himlStartBtn(NULL), himlStartBtn(NULL),
hStartBtnFont(NULL), hStartBtnFont(NULL),
hCaptionFont(NULL), hCaptionFont(NULL),
@ -815,8 +815,7 @@ ChangePos:
ResizeWorkArea(); ResizeWorkArea();
ApplyClipping( ApplyClipping(TRUE);
TRUE);
} }
typedef struct _TW_STUCKRECTS2 typedef struct _TW_STUCKRECTS2
@ -1058,20 +1057,14 @@ ChangePos:
SIZE Size = { 0, 0 }; SIZE Size = { 0, 0 };
if (himlStartBtn == NULL || if (himlStartBtn == NULL ||
!SendMessage(hwndStart, !StartButton.SendMessage(BCM_GETIDEALSIZE, 0, (LPARAM) &Size))
BCM_GETIDEALSIZE,
0,
(LPARAM) &Size))
{ {
Size.cx = GetSystemMetrics(SM_CXEDGE); Size.cx = GetSystemMetrics(SM_CXEDGE);
Size.cy = GetSystemMetrics(SM_CYEDGE); Size.cy = GetSystemMetrics(SM_CYEDGE);
if (hbmStart == NULL) if (hbmStart == NULL)
{ {
hbmStart = (HBITMAP) SendMessage(hwndStart, hbmStart = (HBITMAP) StartButton.SendMessage(BM_GETIMAGE, IMAGE_BITMAP, 0);
BM_GETIMAGE,
IMAGE_BITMAP,
0);
} }
if (hbmStart != NULL) if (hbmStart != NULL)
@ -1139,11 +1132,11 @@ DefSize:
if (StartSize.cx > rcClient.right) if (StartSize.cx > rcClient.right)
StartSize.cx = rcClient.right; StartSize.cx = rcClient.right;
if (hwndStart != NULL) if (StartButton.m_hWnd != NULL)
{ {
/* Resize and reposition the button */ /* Resize and reposition the button */
dwp = DeferWindowPos(dwp, dwp = DeferWindowPos(dwp,
hwndStart, StartButton.m_hWnd,
NULL, NULL,
0, 0,
0, 0,
@ -1407,6 +1400,15 @@ Cleanup:
else else
TaskbarTheme = NULL; TaskbarTheme = NULL;
if (TaskbarTheme)
{
SetWindowStyle(m_hWnd, WS_THICKFRAME | WS_BORDER, 0);
}
else
{
SetWindowStyle(m_hWnd, WS_THICKFRAME | WS_BORDER, WS_THICKFRAME | WS_BORDER);
}
return TRUE; return TRUE;
} }
@ -1461,7 +1463,8 @@ Cleanup:
} }
/* Create the Start button */ /* Create the Start button */
hwndStart = CreateWindowEx(0, StartButton.SubclassWindow(CreateWindowEx(
0,
WC_BUTTON, WC_BUTTON,
szStartCaption, szStartCaption,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
@ -1473,14 +1476,11 @@ Cleanup:
m_hWnd, m_hWnd,
(HMENU) IDC_STARTBTN, (HMENU) IDC_STARTBTN,
hExplorerInstance, hExplorerInstance,
NULL); NULL));
if (hwndStart) if (StartButton.m_hWnd)
{ {
SetWindowTheme(hwndStart, L"Start", NULL); SetWindowTheme(StartButton.m_hWnd, L"Start", NULL);
SendMessage(hwndStart, StartButton.SendMessage(WM_SETFONT, (WPARAM) hStartBtnFont, FALSE);
WM_SETFONT,
(WPARAM) hStartBtnFont,
FALSE);
if (CreateStartBtnImageList()) if (CreateStartBtnImageList())
{ {
@ -1493,10 +1493,7 @@ Cleanup:
bil.margin.top = bil.margin.bottom = 1; bil.margin.top = bil.margin.bottom = 1;
bil.uAlign = BUTTON_IMAGELIST_ALIGN_LEFT; bil.uAlign = BUTTON_IMAGELIST_ALIGN_LEFT;
if (!SendMessage(hwndStart, if (!StartButton.SendMessage(BCM_SETIMAGELIST, 0, (LPARAM) &bil))
BCM_SETIMAGELIST,
0,
(LPARAM) &bil))
{ {
/* Fall back to the deprecated method on older systems that don't /* Fall back to the deprecated method on older systems that don't
support Common Controls 6.0 */ support Common Controls 6.0 */
@ -1508,12 +1505,9 @@ Cleanup:
/* We're using the image list, remove the BS_BITMAP style and /* We're using the image list, remove the BS_BITMAP style and
don't center it horizontally */ don't center it horizontally */
SetWindowStyle(hwndStart, SetWindowStyle(StartButton.m_hWnd, BS_BITMAP | BS_RIGHT, 0);
BS_BITMAP | BS_RIGHT,
0);
UpdateStartButton( UpdateStartButton(NULL);
NULL);
} }
else else
{ {
@ -1523,13 +1517,9 @@ SetStartBtnImage:
hbmStart = CreateStartButtonBitmap(); hbmStart = CreateStartButtonBitmap();
if (hbmStart != NULL) if (hbmStart != NULL)
{ {
UpdateStartButton( UpdateStartButton(hbmStart);
hbmStart);
hbmOld = (HBITMAP) SendMessage(hwndStart, hbmOld = (HBITMAP) StartButton.SendMessage(BM_SETIMAGE, IMAGE_BITMAP, (LPARAM) hbmStart);
BM_SETIMAGE,
IMAGE_BITMAP,
(LPARAM) hbmStart);
if (hbmOld != NULL) if (hbmOld != NULL)
DeleteObject(hbmOld); DeleteObject(hbmOld);
@ -1657,7 +1647,7 @@ SetStartBtnImage:
HWND hwnd; HWND hwnd;
RECT posRect; RECT posRect;
GetWindowRect(hwndStart, &posRect); GetWindowRect(StartButton.m_hWnd, &posRect);
hwnd = CreateWindowEx(0, hwnd = CreateWindowEx(0,
WC_STATIC, WC_STATIC,
NULL, NULL,
@ -1920,7 +1910,7 @@ SetStartBtnImage:
HWND hwnd; HWND hwnd;
RECT posRect; RECT posRect;
GetWindowRect(hwndStart, &posRect); GetWindowRect(StartButton.m_hWnd, &posRect);
hwnd = CreateWindowEx(0, hwnd = CreateWindowEx(0,
WC_STATIC, WC_STATIC,
@ -1979,8 +1969,7 @@ SetStartBtnImage:
RECTL rcExclude; RECTL rcExclude;
DWORD dwFlags = 0; DWORD dwFlags = 0;
if (GetWindowRect(hwndStart, if (GetWindowRect(StartButton.m_hWnd, (RECT*) &rcExclude))
(RECT*) &rcExclude))
{ {
switch (Position) switch (Position)
{ {
@ -2007,7 +1996,7 @@ SetStartBtnImage:
&rcExclude, &rcExclude,
dwFlags); dwFlags);
SendMessageW(hwndStart, BM_SETSTATE, TRUE, 0); StartButton.SendMessageW(BM_SETSTATE, TRUE, 0);
} }
} }
} }
@ -2023,7 +2012,7 @@ SetStartBtnImage:
GetWindowRect(m_hWnd, &rcCurrent); GetWindowRect(m_hWnd, &rcCurrent);
over = PtInRect(&rcCurrent, pt); over = PtInRect(&rcCurrent, pt);
if (SendMessage(hwndStart, BM_GETSTATE, 0, 0) != BST_UNCHECKED) if (StartButton.SendMessage( BM_GETSTATE, 0, 0) != BST_UNCHECKED)
{ {
over = TRUE; over = TRUE;
} }
@ -2434,7 +2423,7 @@ SetStartBtnImage:
uId = TrackMenu( uId = TrackMenu(
hSysMenu, hSysMenu,
NULL, NULL,
hwndStart, StartButton.m_hWnd,
Position != ABE_TOP, Position != ABE_TOP,
FALSE); FALSE);
if (uId != 0) if (uId != 0)
@ -2483,16 +2472,13 @@ SetStartBtnImage:
if (pt.x != -1 || pt.y != -1) if (pt.x != -1 || pt.y != -1)
ppt = &pt; ppt = &pt;
else else
hWndExclude = hwndStart; hWndExclude = StartButton.m_hWnd;
if ((HWND) wParam == hwndStart) if ((HWND) wParam == StartButton.m_hWnd)
{ {
/* Make sure we can't track the context menu if the start /* Make sure we can't track the context menu if the start
menu is currently being shown */ menu is currently being shown */
if (!(SendMessage(hwndStart, if (!(StartButton.SendMessage(BM_GETSTATE, 0, 0) & BST_PUSHED))
BM_GETSTATE,
0,
0) & BST_PUSHED))
{ {
TrackCtxMenu( TrackCtxMenu(
&StartMenuBtnCtxMenu, &StartMenuBtnCtxMenu,
@ -2511,27 +2497,18 @@ SetStartBtnImage:
POINT ptClient = *ppt; POINT ptClient = *ppt;
/* Convert the coordinates to client-coordinates */ /* Convert the coordinates to client-coordinates */
MapWindowPoints(NULL, MapWindowPoints(NULL, m_hWnd, &ptClient, 1);
m_hWnd,
&ptClient,
1);
hWndAtPt = ChildWindowFromPoint(m_hWnd, hWndAtPt = ChildWindowFromPoint(m_hWnd, ptClient);
ptClient);
if (hWndAtPt != NULL && if (hWndAtPt != NULL &&
(hWndAtPt == hwndRebar || IsChild(hwndRebar, (hWndAtPt == hwndRebar || IsChild(hwndRebar,
hWndAtPt))) hWndAtPt)))
{ {
/* Check if the user clicked on the task switch window */ /* Check if the user clicked on the task switch window */
ptClient = *ppt; ptClient = *ppt;
MapWindowPoints(NULL, MapWindowPoints(NULL, hwndRebar, &ptClient, 1);
hwndRebar,
&ptClient,
1);
hWndAtPt = ChildWindowFromPointEx(hwndRebar, hWndAtPt = ChildWindowFromPointEx(hwndRebar, ptClient, CWP_SKIPINVISIBLE | CWP_SKIPDISABLED);
ptClient,
CWP_SKIPINVISIBLE | CWP_SKIPDISABLED);
if (hWndAtPt == hwndTaskSwitch) if (hWndAtPt == hwndTaskSwitch)
goto HandleTrayContextMenu; goto HandleTrayContextMenu;
@ -2572,7 +2549,7 @@ HandleTrayContextMenu:
return Ret; return Ret;
} }
if (TrayBandSite == NULL || FAILED_UNEXPECTEDLY(hr)) if (TrayBandSite == NULL || FAILED(hr))
{ {
const NMHDR *nmh = (const NMHDR *) lParam; const NMHDR *nmh = (const NMHDR *) lParam;
@ -2628,7 +2605,7 @@ HandleTrayContextMenu:
} }
else else
{ {
SendMessage(m_hWnd, WM_COMMAND, MAKEWPARAM(BN_CLICKED, IDC_STARTBTN), reinterpret_cast<LPARAM>(hwndStart)); PopupStartMenu();
} }
return TRUE; return TRUE;
@ -2638,7 +2615,7 @@ HandleTrayContextMenu:
{ {
LRESULT Ret = FALSE; LRESULT Ret = FALSE;
if ((HWND) lParam == hwndStart) if ((HWND) lParam == StartButton.m_hWnd)
{ {
PopupStartMenu(); PopupStartMenu();
return FALSE; return FALSE;
@ -2801,9 +2778,7 @@ HandleTrayContextMenu:
Msg.wParam = wParam; Msg.wParam = wParam;
Msg.lParam = lParam; Msg.lParam = lParam;
if (StartMenuBand->TranslateMenuMessage( if (StartMenuBand->TranslateMenuMessage(&Msg, &lRet) == S_OK)
&Msg,
&lRet) == S_OK)
{ {
return lRet; return lRet;
} }
@ -2838,6 +2813,7 @@ HandleTrayContextMenu:
MESSAGE_HANDLER(WM_NCMOUSEMOVE, OnMouseMove) MESSAGE_HANDLER(WM_NCMOUSEMOVE, OnMouseMove)
MESSAGE_HANDLER(WM_APP_TRAYDESTROY, OnAppTrayDestroy) MESSAGE_HANDLER(WM_APP_TRAYDESTROY, OnAppTrayDestroy)
MESSAGE_HANDLER(TWM_OPENSTARTMENU, OnOpenStartMenu) MESSAGE_HANDLER(TWM_OPENSTARTMENU, OnOpenStartMenu)
ALT_MSG_MAP(1)
END_MSG_MAP() END_MSG_MAP()
/* /*
@ -2959,10 +2935,7 @@ HandleTrayContextMenu:
while (1) while (1)
{ {
Ret = GetMessage(&Msg, Ret = GetMessage(&Msg, NULL, 0, 0);
NULL,
0,
0);
if (!Ret || Ret == -1) if (!Ret || Ret == -1)
break; break;
@ -3026,7 +2999,7 @@ HandleTrayContextMenu:
virtual HRESULT RaiseStartButton() virtual HRESULT RaiseStartButton()
{ {
SendMessageW(hwndStart, BM_SETSTATE, FALSE, 0); StartButton.SendMessageW(BM_SETSTATE, FALSE, 0);
return S_OK; return S_OK;
} }

View file

@ -197,9 +197,9 @@ public:
}; };
template<typename TItemData> template<typename TItemData = DWORD_PTR>
class CToolbar : class CToolbar :
public CWindow public CWindowImplBaseT<CWindow>
{ {
public: // Configuration methods public: // Configuration methods
@ -215,15 +215,11 @@ public: // Configuration methods
dwExStyles = WS_EX_TOOLWINDOW; dwExStyles = WS_EX_TOOLWINDOW;
} }
m_hWnd = CreateWindowEx(dwExStyles, m_hWnd = CreateWindowExW(dwExStyles,
TOOLBARCLASSNAME, TOOLBARCLASSNAME,
NULL, NULL,
dwStyles, dwStyles,
0, 0, 0, 0, 0, hWndParent,
0,
0,
0,
hWndParent,
NULL, NULL,
_AtlBaseModule.GetModuleInstance(), _AtlBaseModule.GetModuleInstance(),
NULL); NULL);
@ -242,6 +238,21 @@ public: // Configuration methods
return SendMessageW(TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); return SendMessageW(TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
} }
HWND GetTooltip()
{
return (HWND)SendMessageW(TB_GETTOOLTIPS);
}
DWORD SetTooltip(HWND hWndTooltip)
{
return SendMessageW(TB_SETTOOLTIPS, hWndTooltip, 0);
}
INT GetHotItem()
{
return SendMessageW(TB_GETHOTITEM);
}
public: // Button list management methods public: // Button list management methods
int GetButtonCount() int GetButtonCount()
{ {
@ -299,15 +310,36 @@ public: // Layout management methods
return SendMessageW(TB_AUTOSIZE); return SendMessageW(TB_AUTOSIZE);
} }
DWORD GetMetrics(TBMETRICS * tbm)
{
return SendMessageW(TB_GETMETRICS, 0, (LPARAM) tbm);
}
DWORD SetMetrics(TBMETRICS * tbm)
{
return SendMessageW(TB_SETMETRICS, 0, (LPARAM) tbm);
}
DWORD GetItemRect(int index, LPRECT prcItem)
{
return SendMessageW(TB_GETITEMRECT, index, (LPARAM) prcItem);
}
DWORD SetRedraw(BOOL bEnable)
{
return SendMessageW(WM_SETREDRAW, bEnable);
}
public: // Image list management methods public: // Image list management methods
DWORD SetImageList(HIMAGELIST himl) DWORD SetImageList(HIMAGELIST himl)
{ {
return SendMessageW(TB_SETIMAGELIST, 0, (LPARAM) himl); return SendMessageW(TB_SETIMAGELIST, 0, (LPARAM) himl);
} }
DWORD SetMetrics(TBMETRICS * tbm) public: // Other methods
INT HitTest(PPOINT ppt)
{ {
return SendMessageW(TB_SETMETRICS, 0, (LPARAM) tbm); return (INT) SendMessageW(TB_HITTEST, 0, (LPARAM) ppt);
} }
public: // Utility methods public: // Utility methods