1 From 7dcacc25f9586f9e05abb9ba611a582a8a650cb7 Mon Sep 17 00:00:00 2001
2 From: Vincent Povirk <vincent@codeweavers.com>
3 Date: Thu, 18 Sep 2008 13:56:10 -0500
4 Subject: [PATCH] taskbar: make the start menu user-drawn
7 programs/explorer/taskbar.c | 55 +++++++++++++++++++++++++++++++++++++++---
8 1 files changed, 51 insertions(+), 4 deletions(-)
10 diff --git a/programs/explorer/taskbar.c b/programs/explorer/taskbar.c
11 index f79a4c9..cae25a0 100644
12 --- a/programs/explorer/taskbar.c
13 +++ b/programs/explorer/taskbar.c
14 @@ -129,7 +129,54 @@ static LRESULT WINAPI taskbar_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM
18 - /* forward menu notifications to start menu */
22 + /* draw start button */
23 + DRAWITEMSTRUCT* dis=(DRAWITEMSTRUCT*)lparam;
27 + HFONT font, oldFont;
28 + int cxsmicon, cysmicon;
31 + pushed = SendMessageW(dis->hwndItem, BM_GETSTATE, 0, 0) & BST_PUSHED;
33 + /* draw button frame */
34 + DrawFrameControl(dis->hDC, &dis->rcItem, DFC_BUTTON, DFCS_BUTTONPUSH|(pushed?DFCS_PUSHED:0));
36 + /* calculate rect of face */
39 + InflateRect(&rc, -3, -3);
41 + OffsetRect(&rc, 1, 1);
44 + icon = LoadIconW(NULL, (LPCWSTR)IDI_WINLOGO);
45 + cxsmicon = GetSystemMetrics(SM_CXSMICON);
46 + cysmicon = GetSystemMetrics(SM_CYSMICON);
47 + DrawIconEx(dis->hDC, rc.left, rc.top, icon, cxsmicon, cysmicon, 0, NULL, DI_NORMAL);
48 + rc.left += cxsmicon+2;
52 + ZeroMemory(&lf, sizeof(lf));
54 + lf.lfWeight = FW_NORMAL;
55 + lf.lfPitchAndFamily = DEFAULT_PITCH|FF_SWISS;
56 + strcpy(lf.lfFaceName, "Arial");
57 + font = CreateFontIndirectA(&lf);
59 + oldFont = SelectObject(dis->hDC, font);
60 + DrawTextA(dis->hDC, "Start", -1, &rc, DT_LEFT|DT_TOP|DT_SINGLELINE|DT_WORD_ELLIPSIS);
61 + SelectObject(dis->hDC, oldFont);
66 + /* else fall-through */
68 case WM_INITMENUPOPUP:
70 @@ -141,7 +188,7 @@ static LRESULT WINAPI taskbar_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM
71 case WM_UNINITMENUPOPUP:
75 + /* forward menu notifications to start menu */
76 return handle_menu(hwnd, msg, wparam, lparam);
79 @@ -204,8 +251,8 @@ void initialize_taskbar(void)
80 InitCommonControlsEx(&initcomctl);
82 /* FIXME: make the caption translateable */
83 - startbutton = CreateWindowA( "Button", "Start", WS_CHILD|BS_PUSHBUTTON, 0, 1, 72, 24,
84 - taskbar_window, 0, 0, 0);
85 + startbutton = CreateWindowA( "Button", "Start", WS_CHILD|BS_PUSHBUTTON|BS_OWNERDRAW, 0, 1, 72, 24,
86 + taskbar_window, (HMENU)1, 0, 0);
88 tasklist_window = initialize_tasklist(taskbar_window);