Changeset 61
- Timestamp:
- 04/07/08 08:20:34 (6 months ago)
- Files:
-
- trunk/win32/dfl/control.d (modified) (1 diff)
- trunk/win32/dfl/drawing.d (modified) (1 diff)
- trunk/win32/dfl/form.d (modified) (1 diff)
- trunk/win32/dfl/groupbox.d (modified) (2 diffs)
- trunk/win32/dfl/internal/winapi.d (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/win32/dfl/control.d
r56 r61 1543 1543 { 1544 1544 Font result; 1545 result = _createOldFont(); 1546 1547 OSVERSIONINFOA osi; 1548 osi.dwOSVersionInfoSize = osi.sizeof; 1549 if(GetVersionExA(&osi) && osi.dwMajorVersion >= 5) 1550 { 1551 // "MS Shell Dlg" / "MS Shell Dlg 2" not always supported. 1552 result = new Font("MS Shell Dlg 2", result.getSize(GraphicsUnit.POINT), GraphicsUnit.POINT); 1553 } 1545 //result = _createOldFont(); 1546 1547 try 1548 { 1549 OSVERSIONINFOA osi; 1550 osi.dwOSVersionInfoSize = osi.sizeof; 1551 if(GetVersionExA(&osi) && osi.dwMajorVersion >= 5) 1552 { 1553 // "MS Shell Dlg" / "MS Shell Dlg 2" not always supported. 1554 result = new Font("MS Shell Dlg 2", result.getSize(GraphicsUnit.POINT), GraphicsUnit.POINT); 1555 } 1556 } 1557 catch 1558 { 1559 } 1560 1561 if(!result) 1562 result = _createOldFont(); 1554 1563 1555 1564 return result; trunk/win32/dfl/drawing.d
r54 r61 2088 2088 fillRectangle(color, r.x, r.y, r.width, r.height); 2089 2089 } 2090 2091 2090 2092 2091 /// ditto trunk/win32/dfl/form.d
r54 r61 1994 1994 if(visible) 1995 1995 { 1996 debug 1997 { 1998 throw new DflException("Unable to show dialog because it is already visible"); 1999 } 2000 goto no_show; 1996 if(!wmodal && owner && sowner == owner.handle) 1997 { 1998 } 1999 else 2000 { 2001 debug 2002 { 2003 throw new DflException("Unable to show dialog because it is already visible"); 2004 } 2005 goto no_show; 2006 } 2001 2007 } 2002 2008 trunk/win32/dfl/groupbox.d
r16 r61 52 52 if(DEFTEXTHEIGHT_INIT == _defTextHeight) 53 53 { 54 _recalcTextHeight(defaultFont); 54 //_recalcTextHeight(defaultFont); 55 _recalcTextHeight(font); 55 56 _defTextHeight = _textHeight; 56 57 } … … 117 118 //msg.result = CallWindowProcA(buttonPrevWndProc, msg.hWnd, msg.msg, msg.wParam, msg.lParam); 118 119 msg.result = dfl.internal.utf.callWindowProc(buttonPrevWndProc, msg.hWnd, msg.msg, msg.wParam, msg.lParam); 120 121 // Work around a Windows issue... 122 if(WM_PAINT == msg.msg) 123 { 124 auto hmuxt = GetModuleHandleA("uxtheme.dll"); 125 if(hmuxt) 126 { 127 auto isAppThemed = cast(typeof(&IsAppThemed))GetProcAddress(hmuxt, "IsAppThemed"); 128 if(isAppThemed && isAppThemed()) 129 { 130 char[] txt = text; 131 if(txt.length) 132 { 133 auto openThemeData = cast(typeof(&OpenThemeData))GetProcAddress(hmuxt, "OpenThemeData"); 134 HTHEME htd; 135 if(openThemeData 136 && HTHEME.init != (htd = openThemeData(msg.hWnd, "Button"))) 137 { 138 HDC hdc = cast(HDC)msg.wParam; 139 //PAINTSTRUCT ps; 140 bool gotdc = false; 141 if(!hdc) 142 { 143 //hdc = BeginPaint(msg.hWnd, &ps); 144 gotdc = true; 145 hdc = GetDC(msg.hWnd); 146 } 147 try 148 { 149 scope g = new Graphics(hdc, false); // Not owned. 150 auto f = font; 151 scope tfmt = new TextFormat(TextFormatFlags.SINGLE_LINE); 152 153 Color c; 154 COLORREF cr; 155 auto getThemeColor = cast(typeof(&GetThemeColor))GetProcAddress(hmuxt, "GetThemeColor"); 156 if(getThemeColor 157 && 0 == getThemeColor(htd, 4 /*BP_GROUPBOX*/, 1 /*PBS_NORMAL*/, 3803 /*TMT_TEXTCOLOR*/, &cr)) 158 c = Color.fromRgb(cr); 159 else 160 c = foreColor; 161 162 Size tsz = g.measureText(txt, f, tfmt); 163 164 g.fillRectangle(backColor, 8, 0, 2 + tsz.width + 2, tsz.height + 2); 165 g.drawText(txt, f, c, Rect(8 + 2, 0, tsz.width, tsz.height), tfmt); 166 } 167 finally 168 { 169 //if(ps.hdc) 170 // EndPaint(msg.hWnd, &ps); 171 if(gotdc) 172 ReleaseDC(msg.hWnd, hdc); 173 174 auto closeThemeData = cast(typeof(&CloseThemeData))GetProcAddress(hmuxt, "CloseThemeData"); 175 assert(closeThemeData !is null); 176 closeThemeData(htd); 177 } 178 } 179 } 180 } 181 } 182 } 119 183 } 120 184 trunk/win32/dfl/internal/winapi.d
r60 r61 2951 2951 DWORD GetThemeAppProperties(); 2952 2952 BOOL IsAppThemed(); 2953 HTHEME OpenThemeData(HWND hwnd, LPCWSTR pszClassList); 2954 HRESULT CloseThemeData(HTHEME hTheme); 2955 HRESULT GetThemeColor(HTHEME hTheme, int iPartId, int iStateId, int iPropId, COLORREF *pColor); 2953 2956 HIMAGELIST ImageList_Create(int cx, int cy, UINT flags, int cInitial, int cGrow); 2954 2957 BOOL ImageList_Destroy(HIMAGELIST himl);
