comparison win/dw.c @ 1556:4a9c574d5c17

Fixed on Windows showing themed static text on colored boxes when the window is glass. Fixed off by one in scrollbox scroller bars on Windows. Moved class name defines out of the main header and into the Windows source file. Updated copyright dates to 2012.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 15 Jan 2012 22:36:41 +0000
parents 78a2e6a51285
children 46e34bd92336
comparison
equal deleted inserted replaced
1555:5b5da6d21f08 1556:4a9c574d5c17
1 /* 1 /*
2 * Dynamic Windows: 2 * Dynamic Windows:
3 * A GTK like implementation of the Win32 GUI 3 * A GTK like implementation of the Win32 GUI
4 * 4 *
5 * (C) 2000-2011 Brian Smith <brian@dbsoft.org> 5 * (C) 2000-2012 Brian Smith <brian@dbsoft.org>
6 * (C) 2003-2011 Mark Hessling <mark@rexx.org> 6 * (C) 2003-2011 Mark Hessling <mark@rexx.org>
7 * 7 *
8 */ 8 */
9 #define _WIN32_IE 0x0500 9 #define _WIN32_IE 0x0500
10 #define WINVER 0x500 10 #define WINVER 0x500
28 #endif 28 #endif
29 #ifdef AEROGLASS 29 #ifdef AEROGLASS
30 #include <uxtheme.h> 30 #include <uxtheme.h>
31 #endif 31 #endif
32 #include <richedit.h> 32 #include <richedit.h>
33
34 #define STATICCLASSNAME "STATIC"
35 #define COMBOBOXCLASSNAME "COMBOBOX"
36 #define LISTBOXCLASSNAME "LISTBOX"
37 #define BUTTONCLASSNAME "BUTTON"
38 #define POPUPMENUCLASSNAME "POPUPMENU"
39 #define EDITCLASSNAME "EDIT"
40 #define FRAMECLASSNAME "FRAME"
41 #define SCROLLBARCLASSNAME "SCROLLBAR"
42
43 #define ClassName "dynamicwindows"
44 #define SplitbarClassName "dwsplitbar"
45 #define ObjectClassName "dwobjectclass"
46 #define BrowserClassName "dwbrowserclass"
47 #define ScrollClassName "dwscrollclass"
48 #define StatusbarClassName "dwstatusbar"
49 #define DefaultFont NULL
33 50
34 #ifdef GDIPLUS 51 #ifdef GDIPLUS
35 /* GDI+ Headers are not C compatible... so define what we need here instead */ 52 /* GDI+ Headers are not C compatible... so define what we need here instead */
36 struct GdiplusStartupInput 53 struct GdiplusStartupInput
37 { 54 {
1408 /* Position the scrolled box */ 1425 /* Position the scrolled box */
1409 vsi.fMask = hsi.fMask = SIF_POS | SIF_RANGE | SIF_PAGE | SIF_DISABLENOSCROLL; 1426 vsi.fMask = hsi.fMask = SIF_POS | SIF_RANGE | SIF_PAGE | SIF_DISABLENOSCROLL;
1410 vsi.nMin = hsi.nMin = vsi.nMax = hsi.nMax = 0; 1427 vsi.nMin = hsi.nMin = vsi.nMax = hsi.nMax = 0;
1411 if(rect.bottom < thisbox->minheight) 1428 if(rect.bottom < thisbox->minheight)
1412 { 1429 {
1413 vsi.nMax = thisbox->minheight; 1430 vsi.nMax = thisbox->minheight - 1;
1414 vsi.nPage = rect.bottom; 1431 vsi.nPage = rect.bottom;
1415 if(vsi.nPos > vsi.nMax) 1432 if(vsi.nPos > vsi.nMax)
1416 { 1433 {
1417 vsi.nPos = vsi.nMax; 1434 vsi.nPos = vsi.nMax;
1418 } 1435 }
1419 } 1436 }
1420 if(rect.right < thisbox->minwidth) 1437 if(rect.right < thisbox->minwidth)
1421 { 1438 {
1422 hsi.nMax = thisbox->minwidth; 1439 hsi.nMax = thisbox->minwidth - 1;
1423 hsi.nPage = rect.right; 1440 hsi.nPage = rect.right;
1424 if(hsi.nPos > hsi.nMax) 1441 if(hsi.nPos > hsi.nMax)
1425 { 1442 {
1426 hsi.nPos = hsi.nMax; 1443 hsi.nPos = hsi.nMax;
1427 } 1444 }
3278 3295
3279 #ifdef AEROGLASS 3296 #ifdef AEROGLASS
3280 /* Window procedure to handle drawing themed text when in composited mode */ 3297 /* Window procedure to handle drawing themed text when in composited mode */
3281 BOOL CALLBACK _staticwndproc(HWND hwnd, ULONG msg, WPARAM mp1, LPARAM mp2) 3298 BOOL CALLBACK _staticwndproc(HWND hwnd, ULONG msg, WPARAM mp1, LPARAM mp2)
3282 { 3299 {
3283 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA); 3300 ColorInfo *parentcinfo, *cinfo = (ColorInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
3284 WNDPROC pOldProc; 3301 WNDPROC pOldProc;
3285 3302
3286 if (!cinfo) 3303 if (!cinfo)
3287 return DefWindowProc(hwnd, msg, mp1, mp2); 3304 return DefWindowProc(hwnd, msg, mp1, mp2);
3288 3305
3306 /* Need the parent to do the check completely */
3307 parentcinfo = (ColorInfo *)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
3308
3289 /* If we don't require themed drawing */ 3309 /* If we don't require themed drawing */
3290 if(cinfo->back != -1 && !_dw_composition || !(GetWindowLongPtr(_toplevel_window(hwnd), GWL_EXSTYLE) & WS_EX_LAYERED)) 3310 if(((cinfo->back != -1 && cinfo->back != DW_RGB_TRANSPARENT) || (parentcinfo && parentcinfo->back != -1))
3311 || !_dw_composition || !(GetWindowLongPtr(_toplevel_window(hwnd), GWL_EXSTYLE) & WS_EX_LAYERED))
3291 return _colorwndproc(hwnd, msg, mp1, mp2); 3312 return _colorwndproc(hwnd, msg, mp1, mp2);
3292 3313
3314 dw_debug("Parentcinfo %x parentcinfo->back %d\n", (int)parentcinfo, parentcinfo->back);
3315
3293 pOldProc = cinfo->pOldProc; 3316 pOldProc = cinfo->pOldProc;
3294 3317
3295 switch(msg) 3318 switch(msg)
3296 { 3319 {
3297 case WM_PAINT: 3320 case WM_PAINT:
4404 4427
4405 /* Internal function to calculate the widget's required size.. 4428 /* Internal function to calculate the widget's required size..
4406 * These are the general rules for widget sizes: 4429 * These are the general rules for widget sizes:
4407 * 4430 *
4408 * Render/Unspecified: 1x1 4431 * Render/Unspecified: 1x1
4409 * Scrolled(Container,Tree,MLE): 500x200 4432 * Scrolled(Container,Tree,MLE): Guessed size clamped to min and max in dw.h
4410 * Entryfield/Combobox/Spinbutton: 150x(maxfontheight) 4433 * Entryfield/Combobox/Spinbutton: 150x(maxfontheight)
4411 * Spinbutton: 50x(maxfontheight) 4434 * Spinbutton: 50x(maxfontheight)
4412 * Text/Status: (textwidth)x(textheight) 4435 * Text/Status: (textwidth)x(textheight)
4413 * Ranged: 100x14 or 14x100 for vertical. 4436 * Ranged: 100x14 or 14x100 for vertical.
4414 * Buttons/Bitmaps: Size of text or image and border. 4437 * Buttons/Bitmaps: Size of text or image and border.