2 * Window theming support
4 * Copyright 2022 Zhiyi Zhang for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
27 #include "uxthemedll.h"
30 static void uxtheme_draw_menu_button(HTHEME theme
, HWND hwnd
, HDC hdc
, enum NONCLIENT_BUTTON_TYPE type
,
31 RECT rect
, BOOL down
, BOOL grayed
)
37 case MENU_CLOSE_BUTTON
:
38 part
= WP_MDICLOSEBUTTON
;
41 part
= WP_MDIMINBUTTON
;
43 case MENU_RESTORE_BUTTON
:
44 part
= WP_MDIRESTOREBUTTON
;
46 case MENU_HELP_BUTTON
:
47 part
= WP_MDIHELPBUTTON
;
49 /* There is no WP_MDIMAXBUTTON */
51 user_api
.pNonClientButtonDraw(hwnd
, hdc
, type
, rect
, down
, grayed
);
56 state
= MINBS_DISABLED
;
62 if (IsThemeBackgroundPartiallyTransparent(theme
, part
, state
))
63 DrawThemeParentBackground(hwnd
, hdc
, &rect
);
64 DrawThemeBackground(theme
, hdc
, part
, state
, &rect
, NULL
);
67 void WINAPI
UXTHEME_NonClientButtonDraw(HWND hwnd
, HDC hdc
, enum NONCLIENT_BUTTON_TYPE type
,
68 RECT rect
, BOOL down
, BOOL grayed
)
72 theme
= OpenThemeDataForDpi(NULL
, L
"Window", GetDpiForWindow(hwnd
));
75 user_api
.pNonClientButtonDraw(hwnd
, hdc
, type
, rect
, down
, grayed
);
81 case MENU_CLOSE_BUTTON
:
84 case MENU_RESTORE_BUTTON
:
85 case MENU_HELP_BUTTON
:
86 uxtheme_draw_menu_button(theme
, hwnd
, hdc
, type
, rect
, down
, grayed
);
90 CloseThemeData(theme
);