comparison win/dw.c @ 1730:3828f3faec8c

Had to move uxtheme/SetWindowTheme out of the AERO #ifdefs to get it to function on Windows XP.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 15 May 2012 07:09:29 +0000
parents 570a03dabdc2
children f7a41d057a50
comparison
equal deleted inserted replaced
1729:570a03dabdc2 1730:3828f3faec8c
211 HPAINTBUFFER (WINAPI *_BeginBufferedPaint)(HDC hdcTarget, const RECT *prcTarget, BP_BUFFERFORMAT dwFormat, BP_PAINTPARAMS *pPaintParams, HDC *phdc) = 0; 211 HPAINTBUFFER (WINAPI *_BeginBufferedPaint)(HDC hdcTarget, const RECT *prcTarget, BP_BUFFERFORMAT dwFormat, BP_PAINTPARAMS *pPaintParams, HDC *phdc) = 0;
212 HRESULT (WINAPI *_BufferedPaintSetAlpha)(HPAINTBUFFER hBufferedPaint, const RECT *prc, BYTE alpha) = 0; 212 HRESULT (WINAPI *_BufferedPaintSetAlpha)(HPAINTBUFFER hBufferedPaint, const RECT *prc, BYTE alpha) = 0;
213 HRESULT (WINAPI *_DrawThemeTextEx)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwFlags, LPRECT pRect, const DTTOPTS *pOptions) = 0; 213 HRESULT (WINAPI *_DrawThemeTextEx)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwFlags, LPRECT pRect, const DTTOPTS *pOptions) = 0;
214 HRESULT (WINAPI *_EndBufferedPaint)(HPAINTBUFFER hBufferedPaint, BOOL fUpdateTarget) = 0; 214 HRESULT (WINAPI *_EndBufferedPaint)(HPAINTBUFFER hBufferedPaint, BOOL fUpdateTarget) = 0;
215 HRESULT (WINAPI *_CloseThemeData)(HTHEME hTheme) = 0; 215 HRESULT (WINAPI *_CloseThemeData)(HTHEME hTheme) = 0;
216 HRESULT (WINAPI *_SetWindowTheme)(HWND hwnd, LPCWSTR pszSubAppName, LPCWSTR pszSubIdList) = 0;
217 BOOL _dw_composition = FALSE; 216 BOOL _dw_composition = FALSE;
218 COLORREF _dw_transparencykey = RGB(200,201,202); 217 COLORREF _dw_transparencykey = RGB(200,201,202);
219 HANDLE hdwm = 0, huxtheme = 0; 218 HANDLE hdwm = 0;
220 #endif 219 #endif
221 220 /* Aero related but separate functions and handles */
221 HRESULT (WINAPI *_SetWindowTheme)(HWND hwnd, LPCWSTR pszSubAppName, LPCWSTR pszSubIdList) = 0;
222 HANDLE huxtheme = 0;
223
222 /* Needed for Rich Edit controls */ 224 /* Needed for Rich Edit controls */
223 HANDLE hrichedit = 0; 225 HANDLE hrichedit = 0;
224 226
225 /* 227 /*
226 * MinGW Is missing a bunch of definitions 228 * MinGW Is missing a bunch of definitions
4069 #endif 4071 #endif
4070 4072
4071 /* GDI+ Needs to be initialized before calling _init_thread(); */ 4073 /* GDI+ Needs to be initialized before calling _init_thread(); */
4072 _init_thread(); 4074 _init_thread();
4073 4075
4076 if((huxtheme = LoadLibrary(TEXT("uxtheme"))))
4077 _SetWindowTheme = (HRESULT (WINAPI *)(HWND, LPCWSTR, LPCWSTR ))GetProcAddress(huxtheme, "SetWindowTheme");
4074 #ifdef AEROGLASS 4078 #ifdef AEROGLASS
4075 /* Attempt to load the Desktop Window Manager and Theme library */ 4079 /* Attempt to load the Desktop Window Manager and Theme library */
4076 if((hdwm = LoadLibrary(TEXT("dwmapi"))) && (huxtheme = LoadLibrary(TEXT("uxtheme")))) 4080 if(huxtheme && (hdwm = LoadLibrary(TEXT("dwmapi"))))
4077 { 4081 {
4078 _DwmExtendFrameIntoClientArea = (HRESULT (WINAPI *)(HWND, const MARGINS *))GetProcAddress(hdwm, "DwmExtendFrameIntoClientArea"); 4082 _DwmExtendFrameIntoClientArea = (HRESULT (WINAPI *)(HWND, const MARGINS *))GetProcAddress(hdwm, "DwmExtendFrameIntoClientArea");
4079 if((_DwmIsCompositionEnabled = (HRESULT (WINAPI *)(BOOL *))GetProcAddress(hdwm, "DwmIsCompositionEnabled"))) 4083 if((_DwmIsCompositionEnabled = (HRESULT (WINAPI *)(BOOL *))GetProcAddress(hdwm, "DwmIsCompositionEnabled")))
4080 _DwmIsCompositionEnabled(&_dw_composition); 4084 _DwmIsCompositionEnabled(&_dw_composition);
4081 _OpenThemeData = (HTHEME (WINAPI *)(HWND, LPCWSTR))GetProcAddress(huxtheme, "OpenThemeData"); 4085 _OpenThemeData = (HTHEME (WINAPI *)(HWND, LPCWSTR))GetProcAddress(huxtheme, "OpenThemeData");
4082 _BeginBufferedPaint = (HPAINTBUFFER (WINAPI *)(HDC, const RECT *, BP_BUFFERFORMAT, BP_PAINTPARAMS *, HDC *))GetProcAddress(huxtheme, "BeginBufferedPaint"); 4086 _BeginBufferedPaint = (HPAINTBUFFER (WINAPI *)(HDC, const RECT *, BP_BUFFERFORMAT, BP_PAINTPARAMS *, HDC *))GetProcAddress(huxtheme, "BeginBufferedPaint");
4083 _BufferedPaintSetAlpha = (HRESULT (WINAPI *)(HPAINTBUFFER, const RECT *, BYTE))GetProcAddress(huxtheme, "BufferedPaintSetAlpha"); 4087 _BufferedPaintSetAlpha = (HRESULT (WINAPI *)(HPAINTBUFFER, const RECT *, BYTE))GetProcAddress(huxtheme, "BufferedPaintSetAlpha");
4084 _DrawThemeTextEx = (HRESULT (WINAPI *)(HTHEME, HDC, int, int, LPCWSTR, int, DWORD, LPRECT, const DTTOPTS *))GetProcAddress(huxtheme, "DrawThemeTextEx"); 4088 _DrawThemeTextEx = (HRESULT (WINAPI *)(HTHEME, HDC, int, int, LPCWSTR, int, DWORD, LPRECT, const DTTOPTS *))GetProcAddress(huxtheme, "DrawThemeTextEx");
4085 _EndBufferedPaint = (HRESULT (WINAPI *)(HPAINTBUFFER, BOOL))GetProcAddress(huxtheme, "EndBufferedPaint"); 4089 _EndBufferedPaint = (HRESULT (WINAPI *)(HPAINTBUFFER, BOOL))GetProcAddress(huxtheme, "EndBufferedPaint");
4086 _CloseThemeData = (HRESULT (WINAPI *)(HTHEME))GetProcAddress(huxtheme, "CloseThemeData"); 4090 _CloseThemeData = (HRESULT (WINAPI *)(HTHEME))GetProcAddress(huxtheme, "CloseThemeData");
4087 _SetWindowTheme = (HRESULT (WINAPI *)(HWND, LPCWSTR, LPCWSTR ))GetProcAddress(huxtheme, "SetWindowTheme");
4088 } 4091 }
4089 /* In case of error close the library if needed */ 4092 /* In case of error close the library if needed */
4090 else if(hdwm) 4093 else if(hdwm)
4091 { 4094 {
4092 FreeLibrary(hdwm); 4095 FreeLibrary(hdwm);
6253 6256
6254 /* Create the toolbar */ 6257 /* Create the toolbar */
6255 tmp = CreateWindowEx(0L, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | TBSTYLE_AUTOSIZE | CCS_NORESIZE | 6258 tmp = CreateWindowEx(0L, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | TBSTYLE_AUTOSIZE | CCS_NORESIZE |
6256 CCS_NOPARENTALIGN | CCS_NODIVIDER, 0, 0, 100, 30, DW_HWND_OBJECT, (HMENU)id, DWInstance, NULL); 6259 CCS_NOPARENTALIGN | CCS_NODIVIDER, 0, 0, 100, 30, DW_HWND_OBJECT, (HMENU)id, DWInstance, NULL);
6257 6260
6258 #ifdef AEROGLASS
6259 /* Disable visual styles by default */ 6261 /* Disable visual styles by default */
6260 if(_SetWindowTheme) 6262 if(_SetWindowTheme)
6261 _SetWindowTheme(tmp, TEXT(""), TEXT("")); 6263 _SetWindowTheme(tmp, TEXT(""), TEXT(""));
6262 #endif
6263 6264
6264 /* Insert the single bitmap and button into the toolbar */ 6265 /* Insert the single bitmap and button into the toolbar */
6265 SendMessage(tmp, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); 6266 SendMessage(tmp, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
6266 SendMessage(tmp, TB_SETBUTTONSIZE, 0, MAKELPARAM(bmi.bmWidth, bmi.bmHeight)); 6267 SendMessage(tmp, TB_SETBUTTONSIZE, 0, MAKELPARAM(bmi.bmWidth, bmi.bmHeight));
6267 SendMessage(tmp, TB_SETPADDING, 0, 0); 6268 SendMessage(tmp, TB_SETPADDING, 0, 0);
7635 7636
7636 if(mask & DW_BS_NOBORDER) 7637 if(mask & DW_BS_NOBORDER)
7637 { 7638 {
7638 SetWindowLong(handle, GWL_STYLE, (style & DW_BS_NOBORDER) ? (currentstyle | thisstyle) : (currentstyle & ~thisstyle)); 7639 SetWindowLong(handle, GWL_STYLE, (style & DW_BS_NOBORDER) ? (currentstyle | thisstyle) : (currentstyle & ~thisstyle));
7639 7640
7640 #ifdef AEROGLASS
7641 /* Enable or disable visual themese */ 7641 /* Enable or disable visual themese */
7642 if(_SetWindowTheme) 7642 if(_SetWindowTheme)
7643 _SetWindowTheme(handle, (style & DW_BS_NOBORDER) ? NULL : TEXT(""), (style & DW_BS_NOBORDER) ? NULL : TEXT("")); 7643 _SetWindowTheme(handle, (style & DW_BS_NOBORDER) ? NULL : TEXT(""), (style & DW_BS_NOBORDER) ? NULL : TEXT(""));
7644 #endif 7644
7645 return; 7645 return;
7646 } 7646 }
7647 } 7647 }
7648 #endif 7648 #endif
7649 7649
11340 { 11340 {
11341 OleUninitialize(); 11341 OleUninitialize();
11342 #ifdef AEROGLASS 11342 #ifdef AEROGLASS
11343 /* Free any in use libraries */ 11343 /* Free any in use libraries */
11344 FreeLibrary(hdwm); 11344 FreeLibrary(hdwm);
11345 #endif
11345 FreeLibrary(huxtheme); 11346 FreeLibrary(huxtheme);
11346 #endif
11347 exit(exitcode); 11347 exit(exitcode);
11348 } 11348 }
11349 11349
11350 /* 11350 /*
11351 * Creates a splitbar window (widget) with given parameters. 11351 * Creates a splitbar window (widget) with given parameters.