Changeset 50:2146ed8ff33c
- Timestamp:
- 02/02/08 21:05:19
(1 year ago)
- Author:
- Frank Benoit <benoit@tionex.de>
- branch:
- default
- Message:
Group
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r31 |
r50 |
|
| 13 | 13 | module dwt.widgets.Group; |
|---|
| 14 | 14 | |
|---|
| 15 | | import dwt.widgets.Composite; |
|---|
| 16 | | class Group : Composite { |
|---|
| 17 | | } |
|---|
| 18 | | /++ |
|---|
| | 15 | |
|---|
| 19 | 16 | import dwt.DWT; |
|---|
| 20 | 17 | import dwt.DWTException; |
|---|
| … | … | |
| 22 | 19 | import dwt.graphics.Point; |
|---|
| 23 | 20 | import dwt.graphics.Rectangle; |
|---|
| 24 | | import dwt.internal.win32.LRESULT; |
|---|
| 25 | 21 | import dwt.internal.win32.OS; |
|---|
| 26 | | import dwt.internal.win32.RECT; |
|---|
| 27 | | import dwt.internal.win32.TCHAR; |
|---|
| 28 | | import dwt.internal.win32.TEXTMETRIC; |
|---|
| 29 | | import dwt.internal.win32.TEXTMETRICA; |
|---|
| 30 | | import dwt.internal.win32.TEXTMETRICW; |
|---|
| 31 | | import dwt.internal.win32.WINDOWPOS; |
|---|
| 32 | | import dwt.internal.win32.WNDCLASS; |
|---|
| | 22 | import dwt.widgets.Composite; |
|---|
| | 23 | |
|---|
| | 24 | import dwt.dwthelper.utils; |
|---|
| 33 | 25 | |
|---|
| 34 | 26 | /** |
|---|
| … | … | |
| 53 | 45 | */ |
|---|
| 54 | 46 | |
|---|
| 55 | | public class Group extends Composite { |
|---|
| 56 | | String text = ""; |
|---|
| 57 | | static final int CLIENT_INSET = 3; |
|---|
| 58 | | static final int GroupProc; |
|---|
| 59 | | static final TCHAR GroupClass = new TCHAR (0, OS.IsWinCE ? "BUTTON" : "SWT_GROUP", true); |
|---|
| 60 | | static { |
|---|
| | 47 | public class Group : Composite { |
|---|
| | 48 | char[] text = ""; |
|---|
| | 49 | static const int CLIENT_INSET = 3; |
|---|
| | 50 | static const WNDPROC GroupProc; |
|---|
| | 51 | static if( OS.IsWinCE ){ |
|---|
| | 52 | static const TCHAR[] GroupClass = "BUTTON\0"; |
|---|
| | 53 | } |
|---|
| | 54 | else{ |
|---|
| | 55 | static const TCHAR[] GroupClass = "SWT_GROUP\0"; |
|---|
| | 56 | } |
|---|
| | 57 | static this() { |
|---|
| 61 | 58 | /* |
|---|
| 62 | 59 | * Feature in Windows. The group box window class |
|---|
| … | … | |
| 72 | 69 | * the class Button directly. |
|---|
| 73 | 70 | */ |
|---|
| 74 | | WNDCLASS lpWndClass = new WNDCLASS (); |
|---|
| | 71 | WNDCLASS lpWndClass; |
|---|
| 75 | 72 | if (OS.IsWinCE) { |
|---|
| 76 | | OS.GetClassInfo (0, GroupClass, lpWndClass); |
|---|
| | 73 | OS.GetClassInfo (null, GroupClass.ptr, &lpWndClass); |
|---|
| 77 | 74 | GroupProc = lpWndClass.lpfnWndProc; |
|---|
| 78 | 75 | } else { |
|---|
| 79 | | TCHAR WC_BUTTON = new TCHAR (0, "BUTTON", true); |
|---|
| 80 | | OS.GetClassInfo (0, WC_BUTTON, lpWndClass); |
|---|
| | 76 | TCHAR[] WC_BUTTON = "BUTTON\0"; |
|---|
| | 77 | OS.GetClassInfo (null, WC_BUTTON.ptr, &lpWndClass); |
|---|
| 81 | 78 | GroupProc = lpWndClass.lpfnWndProc; |
|---|
| 82 | | int hInstance = OS.GetModuleHandle (null); |
|---|
| 83 | | if (!OS.GetClassInfo (hInstance, GroupClass, lpWndClass)) { |
|---|
| 84 | | int hHeap = OS.GetProcessHeap (); |
|---|
| | 79 | auto hInstance = OS.GetModuleHandle (null); |
|---|
| | 80 | if (!OS.GetClassInfo (hInstance, GroupClass.ptr, &lpWndClass)) { |
|---|
| | 81 | auto hHeap = OS.GetProcessHeap (); |
|---|
| 85 | 82 | lpWndClass.hInstance = hInstance; |
|---|
| 86 | 83 | lpWndClass.style &= ~(OS.CS_HREDRAW | OS.CS_VREDRAW); |
|---|
| 87 | | int byteCount = GroupClass.length () * TCHAR.sizeof; |
|---|
| 88 | | int lpszClassName = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); |
|---|
| 89 | | OS.MoveMemory (lpszClassName, GroupClass, byteCount); |
|---|
| | 84 | int byteCount = GroupClass.length * TCHAR.sizeof; |
|---|
| | 85 | auto lpszClassName = cast(TCHAR*)OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); |
|---|
| | 86 | OS.MoveMemory (lpszClassName, GroupClass.ptr, byteCount); |
|---|
| 90 | 87 | lpWndClass.lpszClassName = lpszClassName; |
|---|
| 91 | | OS.RegisterClass (lpWndClass); |
|---|
| | 88 | OS.RegisterClass (&lpWndClass); |
|---|
| 92 | 89 | OS.HeapFree (hHeap, 0, lpszClassName); |
|---|
| 93 | 90 | } |
|---|
| … | … | |
| 127 | 124 | * @see Widget#getStyle |
|---|
| 128 | 125 | */ |
|---|
| 129 | | public Group (Composite parent, int style) { |
|---|
| | 126 | public this (Composite parent, int style) { |
|---|
| 130 | 127 | super (parent, checkStyle (style)); |
|---|
| 131 | 128 | } |
|---|
| 132 | 129 | |
|---|
| 133 | | int callWindowProc (int hwnd, int msg, int wParam, int lParam) { |
|---|
| 134 | | if (handle is 0) return 0; |
|---|
| | 130 | LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) { |
|---|
| | 131 | if (handle is null) return LRESULT.NULL; |
|---|
| 135 | 132 | /* |
|---|
| 136 | 133 | * Feature in Windows. When the user clicks on the group |
|---|
| … | … | |
| 141 | 138 | case OS.WM_LBUTTONDOWN: |
|---|
| 142 | 139 | case OS.WM_LBUTTONDBLCLK: |
|---|
| 143 | | return OS.DefWindowProc (hwnd, msg, wParam, lParam); |
|---|
| 144 | | } |
|---|
| 145 | | return OS.CallWindowProc (GroupProc, hwnd, msg, wParam, lParam); |
|---|
| | 140 | return cast(LRESULT) OS.DefWindowProc (hwnd, msg, wParam, lParam); |
|---|
| | 141 | } |
|---|
| | 142 | return cast(LRESULT) OS.CallWindowProc (GroupProc, hwnd, msg, wParam, lParam); |
|---|
| 146 | 143 | } |
|---|
| 147 | 144 | |
|---|
| … | … | |
| 165 | 162 | checkWidget (); |
|---|
| 166 | 163 | Point size = super.computeSize (wHint, hHint, changed); |
|---|
| 167 | | int length = text.length (); |
|---|
| | 164 | int length = text.length; |
|---|
| 168 | 165 | if (length !is 0) { |
|---|
| 169 | 166 | /* |
|---|
| … | … | |
| 174 | 171 | * size from changing when a group is enabled and disabled. |
|---|
| 175 | 172 | */ |
|---|
| 176 | | String string = text; |
|---|
| | 173 | char[] string = text; |
|---|
| 177 | 174 | if ((style & DWT.RIGHT_TO_LEFT) !is 0) { |
|---|
| 178 | 175 | if (OS.COMCTL32_MAJOR < 6 || !OS.IsAppThemed ()) { |
|---|
| 179 | | string = " " + string + " "; |
|---|
| | 176 | string = " " ~ string ~ " "; |
|---|
| 180 | 177 | } |
|---|
| 181 | 178 | } |
|---|
| … | … | |
| 184 | 181 | * client area, pad the width so the text is not clipped. |
|---|
| 185 | 182 | */ |
|---|
| 186 | | TCHAR buffer = new TCHAR (getCodePage (), string, true); |
|---|
| 187 | | int newFont, oldFont = 0; |
|---|
| 188 | | int hDC = OS.GetDC (handle); |
|---|
| 189 | | newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); |
|---|
| 190 | | if (newFont !is 0) oldFont = OS.SelectObject (hDC, newFont); |
|---|
| 191 | | RECT rect = new RECT (); |
|---|
| | 183 | TCHAR* buffer = StrToTCHARz (/+getCodePage (),+/ string); |
|---|
| | 184 | HFONT newFont, oldFont; |
|---|
| | 185 | auto hDC = OS.GetDC (handle); |
|---|
| | 186 | newFont = cast(HFONT) OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); |
|---|
| | 187 | if (newFont !is null) oldFont = OS.SelectObject (hDC, newFont); |
|---|
| | 188 | RECT rect; |
|---|
| 192 | 189 | int flags = OS.DT_CALCRECT | OS.DT_SINGLELINE; |
|---|
| 193 | | OS.DrawText (hDC, buffer, -1, rect, flags); |
|---|
| 194 | | if (newFont !is 0) OS.SelectObject (hDC, oldFont); |
|---|
| | 190 | OS.DrawText (hDC, buffer, -1, &rect, flags); |
|---|
| | 191 | if (newFont !is null) OS.SelectObject (hDC, oldFont); |
|---|
| 195 | 192 | OS.ReleaseDC (handle, hDC); |
|---|
| 196 | 193 | size.x = Math.max (size.x, rect.right - rect.left + CLIENT_INSET * 6); |
|---|
| … | … | |
| 202 | 199 | checkWidget (); |
|---|
| 203 | 200 | Rectangle trim = super.computeTrim (x, y, width, height); |
|---|
| 204 | | int newFont, oldFont = 0; |
|---|
| 205 | | int hDC = OS.GetDC (handle); |
|---|
| 206 | | newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); |
|---|
| 207 | | if (newFont !is 0) oldFont = OS.SelectObject (hDC, newFont); |
|---|
| 208 | | TEXTMETRIC tm = OS.IsUnicode ? (TEXTMETRIC) new TEXTMETRICW () : new TEXTMETRICA (); |
|---|
| 209 | | OS.GetTextMetrics (hDC, tm); |
|---|
| 210 | | if (newFont !is 0) OS.SelectObject (hDC, oldFont); |
|---|
| | 201 | HFONT newFont, oldFont; |
|---|
| | 202 | auto hDC = OS.GetDC (handle); |
|---|
| | 203 | newFont = cast(HFONT) OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); |
|---|
| | 204 | if (newFont !is null) oldFont = OS.SelectObject (hDC, newFont); |
|---|
| | 205 | TEXTMETRIC tm; |
|---|
| | 206 | OS.GetTextMetrics (hDC, &tm); |
|---|
| | 207 | if (newFont !is null) OS.SelectObject (hDC, oldFont); |
|---|
| 211 | 208 | OS.ReleaseDC (handle, hDC); |
|---|
| 212 | 209 | trim.x -= CLIENT_INSET; |
|---|
| … | … | |
| 232 | 229 | if ((style & DWT.RIGHT_TO_LEFT) !is 0) { |
|---|
| 233 | 230 | if (OS.COMCTL32_MAJOR < 6 || !OS.IsAppThemed ()) { |
|---|
| 234 | | String string = enabled || text.length() is 0 ? text : " " + text + " "; |
|---|
| 235 | | TCHAR buffer = new TCHAR (getCodePage (), string, true); |
|---|
| | 231 | char[] string = enabled || text.length is 0 ? text : " " ~ text ~ " "; |
|---|
| | 232 | TCHAR* buffer = StrToTCHARz (/+getCodePage (),+/ string); |
|---|
| 236 | 233 | OS.SetWindowText (handle, buffer); |
|---|
| 237 | 234 | } |
|---|
| … | … | |
| 242 | 239 | checkWidget (); |
|---|
| 243 | 240 | forceResize (); |
|---|
| 244 | | RECT rect = new RECT (); |
|---|
| 245 | | OS.GetClientRect (handle, rect); |
|---|
| 246 | | int newFont, oldFont = 0; |
|---|
| 247 | | int hDC = OS.GetDC (handle); |
|---|
| 248 | | newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); |
|---|
| 249 | | if (newFont !is 0) oldFont = OS.SelectObject (hDC, newFont); |
|---|
| 250 | | TEXTMETRIC tm = OS.IsUnicode ? (TEXTMETRIC) new TEXTMETRICW () : new TEXTMETRICA (); |
|---|
| 251 | | OS.GetTextMetrics (hDC, tm); |
|---|
| 252 | | if (newFont !is 0) OS.SelectObject (hDC, oldFont); |
|---|
| | 241 | RECT rect; |
|---|
| | 242 | OS.GetClientRect (handle, &rect); |
|---|
| | 243 | HFONT newFont, oldFont; |
|---|
| | 244 | auto hDC = OS.GetDC (handle); |
|---|
| | 245 | newFont = cast(HFONT) OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); |
|---|
| | 246 | if (newFont !is null) oldFont = OS.SelectObject (hDC, newFont); |
|---|
| | 247 | TEXTMETRIC tm; |
|---|
| | 248 | OS.GetTextMetrics (hDC, &tm); |
|---|
| | 249 | if (newFont !is null) OS.SelectObject (hDC, oldFont); |
|---|
| 253 | 250 | OS.ReleaseDC (handle, hDC); |
|---|
| 254 | 251 | int x = CLIENT_INSET, y = tm.tmHeight; |
|---|
| … | … | |
| 258 | 255 | } |
|---|
| 259 | 256 | |
|---|
| 260 | | String getNameText () { |
|---|
| | 257 | char[] getNameText () { |
|---|
| 261 | 258 | return getText (); |
|---|
| 262 | 259 | } |
|---|
| … | … | |
| 274 | 271 | * </ul> |
|---|
| 275 | 272 | */ |
|---|
| 276 | | public String getText () { |
|---|
| | 273 | public char[] getText () { |
|---|
| 277 | 274 | checkWidget (); |
|---|
| 278 | 275 | return text; |
|---|
| 279 | 276 | } |
|---|
| 280 | 277 | |
|---|
| 281 | | bool mnemonicHit (char key) { |
|---|
| | 278 | bool mnemonicHit (wchar key) { |
|---|
| 282 | 279 | return setFocus (); |
|---|
| 283 | 280 | } |
|---|
| 284 | 281 | |
|---|
| 285 | | bool mnemonicMatch (char key) { |
|---|
| 286 | | char mnemonic = findMnemonic (getText ()); |
|---|
| | 282 | bool mnemonicMatch (wchar key) { |
|---|
| | 283 | wchar mnemonic = findMnemonic (getText ()); |
|---|
| 287 | 284 | if (mnemonic is '\0') return false; |
|---|
| 288 | | return Character.toUpperCase (key) is Character.toUpperCase (mnemonic); |
|---|
| | 285 | return CharacterToUpper (key) is CharacterToUpper (mnemonic); |
|---|
| 289 | 286 | } |
|---|
| 290 | 287 | |
|---|
| … | … | |
| 299 | 296 | super.setFont (font); |
|---|
| 300 | 297 | Rectangle newRect = getClientArea (); |
|---|
| 301 | | if (!oldRect.equals (newRect)) sendResize (); |
|---|
| | 298 | if (oldRect!=newRect) sendResize (); |
|---|
| 302 | 299 | } |
|---|
| 303 | 300 | |
|---|
| … | … | |
| 326 | 323 | * </ul> |
|---|
| 327 | 324 | */ |
|---|
| 328 | | public void setText (String string) { |
|---|
| | 325 | public void setText (char[] string) { |
|---|
| 329 | 326 | checkWidget (); |
|---|
| 330 | 327 | if (string is null) error (DWT.ERROR_NULL_ARGUMENT); |
|---|
| … | … | |
| 338 | 335 | if (OS.COMCTL32_MAJOR < 6 || !OS.IsAppThemed ()) { |
|---|
| 339 | 336 | if (!OS.IsWindowEnabled (handle)) { |
|---|
| 340 | | if (string.length() !is 0) string = " " + string + " "; |
|---|
| | 337 | if (string.length !is 0) string = " " ~ string ~ " "; |
|---|
| 341 | 338 | } |
|---|
| 342 | 339 | } |
|---|
| 343 | 340 | } |
|---|
| 344 | | TCHAR buffer = new TCHAR (getCodePage (), string, true); |
|---|
| | 341 | TCHAR* buffer = StrToTCHARz(/+getCodePage (),+/ string); |
|---|
| 345 | 342 | OS.SetWindowText (handle, buffer); |
|---|
| 346 | 343 | } |
|---|
| … | … | |
| 361 | 358 | } |
|---|
| 362 | 359 | |
|---|
| 363 | | TCHAR windowClass () { |
|---|
| 364 | | return GroupClass; |
|---|
| | 360 | char[] windowClass () { |
|---|
| | 361 | return TCHARsToStr( GroupClass ); |
|---|
| 365 | 362 | } |
|---|
| 366 | 363 | |
|---|
| 367 | 364 | int windowProc () { |
|---|
| 368 | | return GroupProc; |
|---|
| | 365 | return cast(int) GroupProc; |
|---|
| 369 | 366 | } |
|---|
| 370 | 367 | |
|---|
| 371 | 368 | LRESULT WM_ERASEBKGND (int wParam, int lParam) { |
|---|
| 372 | 369 | LRESULT result = super.WM_ERASEBKGND (wParam, lParam); |
|---|
| 373 | | if (result !is null) return result; |
|---|
| | 370 | if (result !is LRESULT.NULL) return result; |
|---|
| 374 | 371 | /* |
|---|
| 375 | 372 | * Feature in Windows. Group boxes do not erase |
|---|
| … | … | |
| 377 | 374 | * fill the background. |
|---|
| 378 | 375 | */ |
|---|
| 379 | | drawBackground (wParam); |
|---|
| | 376 | drawBackground (cast(HANDLE) wParam); |
|---|
| 380 | 377 | return LRESULT.ONE; |
|---|
| 381 | 378 | } |
|---|
| … | … | |
| 383 | 380 | LRESULT WM_NCHITTEST (int wParam, int lParam) { |
|---|
| 384 | 381 | LRESULT result = super.WM_NCHITTEST (wParam, lParam); |
|---|
| 385 | | if (result !is null) return result; |
|---|
| | 382 | if (result !is LRESULT.NULL) return result; |
|---|
| 386 | 383 | /* |
|---|
| 387 | 384 | * Feature in Windows. The window proc for the group box |
|---|
| … | … | |
| 395 | 392 | int code = callWindowProc (handle, OS.WM_NCHITTEST, wParam, lParam); |
|---|
| 396 | 393 | if (code is OS.HTTRANSPARENT) code = OS.HTCLIENT; |
|---|
| 397 | | return new LRESULT (code); |
|---|
| | 394 | return cast(LRESULT) (code); |
|---|
| 398 | 395 | } |
|---|
| 399 | 396 | |
|---|
| 400 | 397 | LRESULT WM_MOUSEMOVE (int wParam, int lParam) { |
|---|
| 401 | 398 | LRESULT result = super.WM_MOUSEMOVE (wParam, lParam); |
|---|
| 402 | | if (result !is null) return result; |
|---|
| | 399 | if (result !is LRESULT.NULL) return result; |
|---|
| 403 | 400 | /* |
|---|
| 404 | 401 | * Feature in Windows. In version 6.00 of COMCTL32.DLL, |
|---|
| … | … | |
| 412 | 409 | LRESULT WM_PRINTCLIENT (int wParam, int lParam) { |
|---|
| 413 | 410 | LRESULT result = super.WM_PRINTCLIENT (wParam, lParam); |
|---|
| 414 | | if (result !is null) return result; |
|---|
| | 411 | if (result !is LRESULT.NULL) return result; |
|---|
| 415 | 412 | /* |
|---|
| 416 | 413 | * Feature in Windows. In version 6.00 of COMCTL32.DLL, |
|---|
| … | … | |
| 424 | 421 | */ |
|---|
| 425 | 422 | if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) { |
|---|
| 426 | | int nSavedDC = OS.SaveDC (wParam); |
|---|
| | 423 | auto nSavedDC = OS.SaveDC (cast(HDC)wParam); |
|---|
| 427 | 424 | int code = callWindowProc (handle, OS.WM_PRINTCLIENT, wParam, lParam); |
|---|
| 428 | | OS.RestoreDC (wParam, nSavedDC); |
|---|
| 429 | | return new LRESULT (code); |
|---|
| | 425 | OS.RestoreDC (cast(HDC)wParam, nSavedDC); |
|---|
| | 426 | return cast(LRESULT) (code); |
|---|
| 430 | 427 | } |
|---|
| 431 | 428 | return result; |
|---|
| … | … | |
| 434 | 431 | LRESULT WM_UPDATEUISTATE (int wParam, int lParam) { |
|---|
| 435 | 432 | LRESULT result = super.WM_UPDATEUISTATE (wParam, lParam); |
|---|
| 436 | | if (result !is null) return result; |
|---|
| | 433 | if (result !is LRESULT.NULL) return result; |
|---|
| 437 | 434 | /* |
|---|
| 438 | 435 | * Feature in Windows. When WM_UPDATEUISTATE is sent to |
|---|
| … | … | |
| 455 | 452 | OS.InvalidateRect (handle, null, false); |
|---|
| 456 | 453 | int code = OS.DefWindowProc (handle, OS.WM_UPDATEUISTATE, wParam, lParam); |
|---|
| 457 | | return new LRESULT (code); |
|---|
| | 454 | return cast(LRESULT) (code); |
|---|
| 458 | 455 | } |
|---|
| 459 | 456 | return result; |
|---|
| … | … | |
| 462 | 459 | LRESULT WM_WINDOWPOSCHANGING (int wParam, int lParam) { |
|---|
| 463 | 460 | LRESULT result = super.WM_WINDOWPOSCHANGING (wParam, lParam); |
|---|
| 464 | | if (result !is null) return result; |
|---|
| | 461 | if (result !is LRESULT.NULL) return result; |
|---|
| 465 | 462 | /* |
|---|
| 466 | 463 | * Invalidate the portion of the group widget that needs to |
|---|
| … | … | |
| 471 | 468 | if (OS.IsWinCE) return result; |
|---|
| 472 | 469 | if (!OS.IsWindowVisible (handle)) return result; |
|---|
| 473 | | WINDOWPOS lpwp = new WINDOWPOS (); |
|---|
| 474 | | OS.MoveMemory (lpwp, lParam, WINDOWPOS.sizeof); |
|---|
| | 470 | WINDOWPOS* lpwp = cast(WINDOWPOS*)lParam; |
|---|
| | 471 | //OS.MoveMemory (lpwp, lParam, WINDOWPOS.sizeof); |
|---|
| 475 | 472 | if ((lpwp.flags & (OS.SWP_NOSIZE | OS.SWP_NOREDRAW)) !is 0) { |
|---|
| 476 | 473 | return result; |
|---|
| 477 | 474 | } |
|---|
| 478 | | RECT rect = new RECT (); |
|---|
| 479 | | OS.SetRect (rect, 0, 0, lpwp.cx, lpwp.cy); |
|---|
| 480 | | OS.SendMessage (handle, OS.WM_NCCALCSIZE, 0, rect); |
|---|
| | 475 | RECT rect; |
|---|
| | 476 | OS.SetRect (&rect, 0, 0, lpwp.cx, lpwp.cy); |
|---|
| | 477 | OS.SendMessage (handle, OS.WM_NCCALCSIZE, 0, &rect); |
|---|
| 481 | 478 | int newWidth = rect.right - rect.left; |
|---|
| 482 | 479 | int newHeight = rect.bottom - rect.top; |
|---|
| 483 | | OS.GetClientRect (handle, rect); |
|---|
| | 480 | OS.GetClientRect (handle, &rect); |
|---|
| 484 | 481 | int oldWidth = rect.right - rect.left; |
|---|
| 485 | 482 | int oldHeight = rect.bottom - rect.top; |
|---|
| … | … | |
| 490 | 487 | int left = oldWidth; |
|---|
| 491 | 488 | if (newWidth < oldWidth) left = newWidth; |
|---|
| 492 | | OS.SetRect (rect, left - CLIENT_INSET, 0, newWidth, newHeight); |
|---|
| 493 | | OS.InvalidateRect (handle, rect, true); |
|---|
| | 489 | OS.SetRect (&rect, left - CLIENT_INSET, 0, newWidth, newHeight); |
|---|
| | 490 | OS.InvalidateRect (handle, &rect, true); |
|---|
| 494 | 491 | } |
|---|
| 495 | 492 | if (newHeight !is oldHeight) { |
|---|
| … | … | |
| 497 | 494 | if (newHeight < oldHeight) bottom = newHeight; |
|---|
| 498 | 495 | if (newWidth < oldWidth) oldWidth -= CLIENT_INSET; |
|---|
| 499 | | OS.SetRect (rect, 0, bottom - CLIENT_INSET, oldWidth, newHeight); |
|---|
| 500 | | OS.InvalidateRect (handle, rect, true); |
|---|
| | 496 | OS.SetRect (&rect, 0, bottom - CLIENT_INSET, oldWidth, newHeight); |
|---|
| | 497 | OS.InvalidateRect (handle, &rect, true); |
|---|
| 501 | 498 | } |
|---|
| 502 | 499 | return result; |
|---|
| 503 | 500 | } |
|---|
| 504 | 501 | } |
|---|
| 505 | | ++/ |
|---|