comparison win/dw.c @ 1515:a26edf086082

Windows Aero work towards making it enabled on the fly... also attempt at making controls opaque.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 29 Dec 2011 07:07:51 +0000
parents f33dca736917
children 03c0eca3aaba
comparison
equal deleted inserted replaced
1514:f33dca736917 1515:a26edf086082
104 ULONG_PTR gdiplusToken; 104 ULONG_PTR gdiplusToken;
105 #endif 105 #endif
106 106
107 #ifdef AEROGLASS 107 #ifdef AEROGLASS
108 HRESULT (WINAPI *_DwmExtendFrameIntoClientArea)(HWND hWnd, const MARGINS *pMarInset) = 0; 108 HRESULT (WINAPI *_DwmExtendFrameIntoClientArea)(HWND hWnd, const MARGINS *pMarInset) = 0;
109 HRESULT (WINAPI *_DwmIsCompositionEnabled)(BOOL *pfEnabled) = 0;
110 BOOL _dw_composition = FALSE;
109 #endif 111 #endif
110 112
111 /* 113 /*
112 * MinGW Is missing a bunch of definitions 114 * MinGW Is missing a bunch of definitions
113 * so #define them here... 115 * so #define them here...
2076 } 2078 }
2077 2079
2078 /* Now that any handlers are done... do normal processing */ 2080 /* Now that any handlers are done... do normal processing */
2079 switch( msg ) 2081 switch( msg )
2080 { 2082 {
2083 #ifdef AEROGLASS
2084 case WM_DWMCOMPOSITIONCHANGED:
2085 if(_DwmIsCompositionEnabled)
2086 _DwmIsCompositionEnabled(&_dw_composition);
2087 break;
2088 case WM_ERASEBKGND:
2089 if(_dw_composition)
2090 {
2091 static HBRUSH hbrush = 0;
2092 RECT rect;
2093
2094 if(!hbrush)
2095 hbrush = CreateSolidBrush(RGB(0,0,0));
2096
2097 GetClientRect(hWnd, &rect);
2098 FillRect((HDC)mp1, &rect, hbrush);
2099 }
2100 return TRUE;
2101 #endif
2081 case WM_PAINT: 2102 case WM_PAINT:
2082 { 2103 {
2083 PAINTSTRUCT ps; 2104 PAINTSTRUCT ps;
2084 2105
2085 BeginPaint(hWnd, &ps); 2106 BeginPaint(hWnd, &ps);
2295 case WM_COMMAND: 2316 case WM_COMMAND:
2296 case WM_NOTIFY: 2317 case WM_NOTIFY:
2297 case WM_MOUSEMOVE: 2318 case WM_MOUSEMOVE:
2298 _wndproc(hWnd, msg, mp1, mp2); 2319 _wndproc(hWnd, msg, mp1, mp2);
2299 break; 2320 break;
2321 #ifdef AEROGLASS
2322 case WM_ERASEBKGND:
2323 if(_dw_composition)
2324 {
2325 static HBRUSH hbrush = 0;
2326 RECT rect;
2327
2328 if(!hbrush)
2329 hbrush = CreateSolidBrush(RGB(0,0,0));
2330
2331 GetClientRect(hWnd, &rect);
2332 FillRect((HDC)mp1, &rect, hbrush);
2333 }
2334 return TRUE;
2335 #endif
2300 case WM_PAINT: 2336 case WM_PAINT:
2301 { 2337 {
2302 ColorInfo *thiscinfo = (ColorInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA); 2338 ColorInfo *thiscinfo = (ColorInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA);
2303 2339
2304 if(thiscinfo && thiscinfo->fore != -1 && thiscinfo->back != -1) 2340 if(thiscinfo && thiscinfo->fore != -1 && thiscinfo->back != -1)
3577 memset(&wc, 0, sizeof(WNDCLASS)); 3613 memset(&wc, 0, sizeof(WNDCLASS));
3578 wc.style = CS_DBLCLKS; 3614 wc.style = CS_DBLCLKS;
3579 wc.lpfnWndProc = (WNDPROC)_wndproc; 3615 wc.lpfnWndProc = (WNDPROC)_wndproc;
3580 wc.cbClsExtra = 0; 3616 wc.cbClsExtra = 0;
3581 wc.cbWndExtra = 32; 3617 wc.cbWndExtra = 32;
3582 #ifdef AEROGLASS
3583 wc.hbrBackground = CreateSolidBrush(RGB(0,0,0));
3584 #else
3585 wc.hbrBackground = NULL; 3618 wc.hbrBackground = NULL;
3586 #endif
3587 wc.lpszMenuName = NULL; 3619 wc.lpszMenuName = NULL;
3588 wc.lpszClassName = ClassName; 3620 wc.lpszClassName = ClassName;
3589 3621
3590 RegisterClass(&wc); 3622 RegisterClass(&wc);
3591 3623
3617 memset(&wc, 0, sizeof(WNDCLASS)); 3649 memset(&wc, 0, sizeof(WNDCLASS));
3618 wc.style = CS_DBLCLKS; 3650 wc.style = CS_DBLCLKS;
3619 wc.lpfnWndProc = (WNDPROC)_framewndproc; 3651 wc.lpfnWndProc = (WNDPROC)_framewndproc;
3620 wc.cbClsExtra = 0; 3652 wc.cbClsExtra = 0;
3621 wc.cbWndExtra = 32; 3653 wc.cbWndExtra = 32;
3622 #ifdef AEROGLASS
3623 wc.hbrBackground = CreateSolidBrush(RGB(0,0,0));
3624 #else
3625 wc.hbrBackground = (HBRUSH)GetSysColorBrush(COLOR_3DFACE); 3654 wc.hbrBackground = (HBRUSH)GetSysColorBrush(COLOR_3DFACE);
3626 #endif
3627 wc.hCursor = LoadCursor(NULL, IDC_ARROW); 3655 wc.hCursor = LoadCursor(NULL, IDC_ARROW);
3628 wc.lpszMenuName = NULL; 3656 wc.lpszMenuName = NULL;
3629 wc.lpszClassName = FRAMECLASSNAME; 3657 wc.lpszClassName = FRAMECLASSNAME;
3630 3658
3631 RegisterClass(&wc); 3659 RegisterClass(&wc);
3723 #endif 3751 #endif
3724 3752
3725 #ifdef AEROGLASS 3753 #ifdef AEROGLASS
3726 /* Attempt to load the Desktop Window Manager library */ 3754 /* Attempt to load the Desktop Window Manager library */
3727 if((hdwm = LoadLibrary("dwmapi"))) 3755 if((hdwm = LoadLibrary("dwmapi")))
3756 {
3728 _DwmExtendFrameIntoClientArea = (HRESULT (WINAPI *)(HWND, const MARGINS *))GetProcAddress(hdwm, "DwmExtendFrameIntoClientArea"); 3757 _DwmExtendFrameIntoClientArea = (HRESULT (WINAPI *)(HWND, const MARGINS *))GetProcAddress(hdwm, "DwmExtendFrameIntoClientArea");
3758 if((_DwmIsCompositionEnabled = (HRESULT (WINAPI *)(BOOL *))GetProcAddress(hdwm, "DwmIsCompositionEnabled")))
3759 _DwmIsCompositionEnabled(&_dw_composition);
3760
3761 }
3729 3762
3730 #endif 3763 #endif
3731 return 0; 3764 return 0;
3732 } 3765 }
3733 3766
6482 if(hsize && !width) 6515 if(hsize && !width)
6483 width = 1; 6516 width = 1;
6484 6517
6485 if(strnicmp(tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1)==0) 6518 if(strnicmp(tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1)==0)
6486 tmpitem[index].type = TYPEBOX; 6519 tmpitem[index].type = TYPEBOX;
6487 else if(strnicmp(tmpbuf, "SysMonthCal32", 13)==0)
6488 {
6489 RECT rc;
6490 MonthCal_GetMinReqRect(item, &rc);
6491 width = 1 + rc.right - rc.left;
6492 height = 1 + rc.bottom - rc.top;
6493 tmpitem[index].type = TYPEITEM;
6494 }
6495 else 6520 else
6496 { 6521 {
6497 if ( width == 0 && hsize == FALSE ) 6522 if(strnicmp(tmpbuf, "SysMonthCal32", 13)==0)
6498 dw_messagebox(funcname, DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item); 6523 {
6499 if ( height == 0 && vsize == FALSE ) 6524 RECT rc;
6500 dw_messagebox(funcname, DW_MB_OK|DW_MB_ERROR, "Height and expand Vertical both unset for box: %x item: %x",box,item); 6525 MonthCal_GetMinReqRect(item, &rc);
6501 6526 width = 1 + rc.right - rc.left;
6502 tmpitem[index].type = TYPEITEM; 6527 height = 1 + rc.bottom - rc.top;
6528 tmpitem[index].type = TYPEITEM;
6529 }
6530 else
6531 {
6532 if ( width == 0 && hsize == FALSE )
6533 dw_messagebox(funcname, DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item);
6534 if ( height == 0 && vsize == FALSE )
6535 dw_messagebox(funcname, DW_MB_OK|DW_MB_ERROR, "Height and expand Vertical both unset for box: %x item: %x",box,item);
6536
6537 tmpitem[index].type = TYPEITEM;
6538 }
6539 #ifdef AEROGLASS
6540 if(_dw_composition)
6541 SetLayeredWindowAttributes(item, 0, 255, LWA_ALPHA);
6542 #endif
6503 } 6543 }
6504 6544
6505 tmpitem[index].hwnd = item; 6545 tmpitem[index].hwnd = item;
6506 tmpitem[index].origwidth = tmpitem[index].width = width; 6546 tmpitem[index].origwidth = tmpitem[index].width = width;
6507 tmpitem[index].origheight = tmpitem[index].height = height; 6547 tmpitem[index].origheight = tmpitem[index].height = height;