Changeset 47:6940f8be58ba
- Timestamp:
- 02/02/08 18:59:28
(1 year ago)
- Author:
- Frank Benoit <benoit@tionex.de>
- branch:
- default
- Message:
ExpandBar?
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r2 |
r47 |
|
| 1 | | Dwt-win shares some modules with the Dwt-linux port. For now, the revision and changeset of the dwt-linux port will be listed here for future reference, in case there are updates to the linux port. |
|---|
| | 1 | Dwt-win shares some modules with the Dwt-linux port. For now, the revision and changeset of the dwt-linux port will be listed here for future reference, in case there are updates to the linux port. |
|---|
| 2 | 2 | |
|---|
| 3 | 3 | This is the revision that the Dwt-win modules are based on: |
|---|
| … | … | |
| 20 | 20 | dwt/internal/SerializableCompatibility.d |
|---|
| 21 | 21 | |
|---|
| | 22 | - Verify getCodePage accesses |
|---|
| | 23 | - OS.CallWindowProc was removed in various places. It turned out, they are need. So revert those changeset |
|---|
| | 24 | - OS.MoveMemory, use it and make the ported code more like the original |
|---|
| 22 | 25 | |
|---|
| | 26 | Left out widgets: |
|---|
| | 27 | DateTime |
|---|
| | 28 | DirectoryDialog |
|---|
| | 29 | |
|---|
| | 30 | |
|---|
| | 31 | |
|---|
| | 32 | |
|---|
| r45 |
r47 |
|
| 869 | 869 | public static const int IDC_ARROW = 0x7f00; |
|---|
| 870 | 870 | public static const int IDC_CROSS = 0x7f03; |
|---|
| 871 | | public static const int IDC_HAND = 0x7f89; |
|---|
| | 871 | public static const TCHAR* IDC_HAND = cast(TCHAR*) 0x7f89; |
|---|
| 872 | 872 | public static const int IDC_HELP = 0x7f8b; |
|---|
| 873 | 873 | public static const int IDC_IBEAM = 0x7f01; |
|---|
| r31 |
r47 |
|
| 13 | 13 | module dwt.widgets.ExpandBar; |
|---|
| 14 | 14 | |
|---|
| 15 | | import dwt.widgets.Composite; |
|---|
| 16 | | class ExpandBar : Composite { |
|---|
| 17 | | } |
|---|
| 18 | | /++ |
|---|
| | 15 | |
|---|
| 19 | 16 | import dwt.DWT; |
|---|
| 20 | 17 | import dwt.DWTException; |
|---|
| … | … | |
| 27 | 24 | import dwt.graphics.Point; |
|---|
| 28 | 25 | import dwt.graphics.Rectangle; |
|---|
| 29 | | import dwt.internal.win32.LOGFONT; |
|---|
| 30 | | import dwt.internal.win32.LRESULT; |
|---|
| 31 | | import dwt.internal.win32.NONCLIENTMETRICS; |
|---|
| 32 | | import dwt.internal.win32.NONCLIENTMETRICSA; |
|---|
| 33 | | import dwt.internal.win32.NONCLIENTMETRICSW; |
|---|
| | 26 | import dwt.graphics.Drawable; |
|---|
| 34 | 27 | import dwt.internal.win32.OS; |
|---|
| 35 | | import dwt.internal.win32.PAINTSTRUCT; |
|---|
| 36 | | import dwt.internal.win32.RECT; |
|---|
| 37 | | import dwt.internal.win32.SCROLLINFO; |
|---|
| 38 | | import dwt.internal.win32.TCHAR; |
|---|
| 39 | | import dwt.internal.win32.TEXTMETRIC; |
|---|
| 40 | | import dwt.internal.win32.TEXTMETRICA; |
|---|
| 41 | | import dwt.internal.win32.TEXTMETRICW; |
|---|
| | 28 | |
|---|
| | 29 | import dwt.widgets.Composite; |
|---|
| | 30 | import dwt.widgets.Control; |
|---|
| | 31 | import dwt.widgets.ExpandItem; |
|---|
| | 32 | import dwt.widgets.ScrollBar; |
|---|
| | 33 | import dwt.widgets.ExpandItem; |
|---|
| | 34 | import dwt.widgets.TypedListener; |
|---|
| | 35 | import dwt.widgets.Event; |
|---|
| | 36 | |
|---|
| | 37 | import dwt.dwthelper.utils; |
|---|
| 42 | 38 | |
|---|
| 43 | 39 | /** |
|---|
| … | … | |
| 65 | 61 | * @since 3.2 |
|---|
| 66 | 62 | */ |
|---|
| 67 | | public class ExpandBar extends Composite { |
|---|
| | 63 | public class ExpandBar : Composite { |
|---|
| 68 | 64 | ExpandItem[] items; |
|---|
| 69 | 65 | int itemCount; |
|---|
| … | … | |
| 71 | 67 | int spacing = 4; |
|---|
| 72 | 68 | int yCurrentScroll; |
|---|
| 73 | | int hFont; |
|---|
| | 69 | HFONT hFont; |
|---|
| 74 | 70 | |
|---|
| 75 | 71 | |
|---|
| … | … | |
| 101 | 97 | * @see Widget#getStyle |
|---|
| 102 | 98 | */ |
|---|
| 103 | | public ExpandBar (Composite parent, int style) { |
|---|
| | 99 | public this (Composite parent, int style) { |
|---|
| 104 | 100 | super (parent, checkStyle (style)); |
|---|
| 105 | 101 | } |
|---|
| … | … | |
| 132 | 128 | } |
|---|
| 133 | 129 | |
|---|
| 134 | | int callWindowProc (int hwnd, int msg, int wParam, int lParam) { |
|---|
| 135 | | if (handle is 0) return 0; |
|---|
| 136 | | return OS.DefWindowProc (hwnd, msg, wParam, lParam); |
|---|
| | 130 | LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) { |
|---|
| | 131 | if (handle is null) return LRESULT.ZERO; |
|---|
| | 132 | return cast(LRESULT) OS.DefWindowProc (hwnd, msg, wParam, lParam); |
|---|
| 137 | 133 | } |
|---|
| 138 | 134 | |
|---|
| … | … | |
| 151 | 147 | if (wHint is DWT.DEFAULT || hHint is DWT.DEFAULT) { |
|---|
| 152 | 148 | if (itemCount > 0) { |
|---|
| 153 | | int hDC = OS.GetDC (handle); |
|---|
| 154 | | int hTheme = 0; |
|---|
| | 149 | auto hDC = OS.GetDC (handle); |
|---|
| | 150 | HTHEME hTheme; |
|---|
| 155 | 151 | if (isAppThemed ()) { |
|---|
| 156 | 152 | hTheme = display.hExplorerBarTheme (); |
|---|
| 157 | 153 | } |
|---|
| 158 | | int hCurrentFont = 0, oldFont = 0; |
|---|
| 159 | | if (hTheme is 0) { |
|---|
| 160 | | if (hFont !is 0) { |
|---|
| | 154 | HFONT hCurrentFont, oldFont; |
|---|
| | 155 | if (hTheme is null) { |
|---|
| | 156 | if (hFont !is null) { |
|---|
| 161 | 157 | hCurrentFont = hFont; |
|---|
| 162 | 158 | } else { |
|---|
| 163 | 159 | if (!OS.IsWinCE) { |
|---|
| 164 | | NONCLIENTMETRICS info = OS.IsUnicode ? (NONCLIENTMETRICS) new NONCLIENTMETRICSW () : new NONCLIENTMETRICSA (); |
|---|
| | 160 | NONCLIENTMETRICS info; |
|---|
| 165 | 161 | info.cbSize = NONCLIENTMETRICS.sizeof; |
|---|
| 166 | | if (OS.SystemParametersInfo (OS.SPI_GETNONCLIENTMETRICS, 0, info, 0)) { |
|---|
| 167 | | LOGFONT logFont = OS.IsUnicode ? (LOGFONT) ((NONCLIENTMETRICSW)info).lfCaptionFont : ((NONCLIENTMETRICSA)info).lfCaptionFont; |
|---|
| | 162 | if (OS.SystemParametersInfo (OS.SPI_GETNONCLIENTMETRICS, 0, &info, 0)) { |
|---|
| | 163 | LOGFONT* logFont = &info.lfCaptionFont; |
|---|
| 168 | 164 | hCurrentFont = OS.CreateFontIndirect (logFont); |
|---|
| 169 | 165 | } |
|---|
| 170 | 166 | } |
|---|
| 171 | 167 | } |
|---|
| 172 | | if (hCurrentFont !is 0) { |
|---|
| | 168 | if (hCurrentFont !is null) { |
|---|
| 173 | 169 | oldFont = OS.SelectObject (hDC, hCurrentFont); |
|---|
| 174 | 170 | } |
|---|
| … | … | |
| 182 | 178 | width = Math.max (width, item.getPreferredWidth (hTheme, hDC)); |
|---|
| 183 | 179 | } |
|---|
| 184 | | if (hCurrentFont !is 0) { |
|---|
| | 180 | if (hCurrentFont !is null) { |
|---|
| 185 | 181 | OS.SelectObject (hDC, oldFont); |
|---|
| 186 | 182 | if (hCurrentFont !is hFont) OS.DeleteObject (hCurrentFont); |
|---|
| … | … | |
| 215 | 211 | if (focusItem is null) focusItem = item; |
|---|
| 216 | 212 | |
|---|
| 217 | | RECT rect = new RECT (); |
|---|
| 218 | | OS.GetWindowRect (handle, rect); |
|---|
| | 213 | RECT rect; |
|---|
| | 214 | OS.GetWindowRect (handle, &rect); |
|---|
| 219 | 215 | item.width = Math.max (0, rect.right - rect.left - spacing * 2); |
|---|
| 220 | 216 | layoutItems (index, true); |
|---|
| … | … | |
| 258 | 254 | } |
|---|
| 259 | 255 | |
|---|
| 260 | | void drawThemeBackground (int hDC, int hwnd, RECT rect) { |
|---|
| 261 | | RECT rect2 = new RECT (); |
|---|
| 262 | | OS.GetClientRect (handle, rect2); |
|---|
| 263 | | OS.MapWindowPoints (handle, hwnd, rect2, 2); |
|---|
| 264 | | OS.DrawThemeBackground (display.hExplorerBarTheme (), hDC, OS.EBP_NORMALGROUPBACKGROUND, 0, rect2, null); |
|---|
| 265 | | } |
|---|
| 266 | | |
|---|
| 267 | | void drawWidget (GC gc, RECT clipRect) { |
|---|
| 268 | | int hTheme = 0; |
|---|
| | 256 | void drawThemeBackground (HDC hDC, HWND hwnd, RECT* rect) { |
|---|
| | 257 | RECT rect2; |
|---|
| | 258 | OS.GetClientRect (handle, &rect2); |
|---|
| | 259 | OS.MapWindowPoints (handle, hwnd, cast(POINT*) &rect2, 2); |
|---|
| | 260 | OS.DrawThemeBackground (display.hExplorerBarTheme (), hDC, OS.EBP_NORMALGROUPBACKGROUND, 0, &rect2, null); |
|---|
| | 261 | } |
|---|
| | 262 | |
|---|
| | 263 | void drawWidget (GC gc, RECT* clipRect) { |
|---|
| | 264 | HTHEME hTheme; |
|---|
| 269 | 265 | if (isAppThemed ()) { |
|---|
| 270 | 266 | hTheme = display.hExplorerBarTheme (); |
|---|
| 271 | 267 | } |
|---|
| 272 | | if (hTheme !is 0) { |
|---|
| 273 | | RECT rect = new RECT (); |
|---|
| 274 | | OS.GetClientRect (handle, rect); |
|---|
| 275 | | OS.DrawThemeBackground (hTheme, gc.handle, OS.EBP_HEADERBACKGROUND, 0, rect, clipRect); |
|---|
| | 268 | if (hTheme !is null) { |
|---|
| | 269 | RECT rect; |
|---|
| | 270 | OS.GetClientRect (handle, &rect); |
|---|
| | 271 | OS.DrawThemeBackground (hTheme, gc.handle, OS.EBP_HEADERBACKGROUND, 0, &rect, clipRect); |
|---|
| 276 | 272 | } else { |
|---|
| 277 | 273 | drawBackground (gc.handle); |
|---|
| … | … | |
| 282 | 278 | drawFocus = (uiState & OS.UISF_HIDEFOCUS) is 0; |
|---|
| 283 | 279 | } |
|---|
| 284 | | int hCaptionFont = 0, oldFont = 0; |
|---|
| 285 | | if (hTheme is 0) { |
|---|
| 286 | | if (!OS.IsWinCE && hFont is 0) { |
|---|
| 287 | | NONCLIENTMETRICS info = OS.IsUnicode ? (NONCLIENTMETRICS) new NONCLIENTMETRICSW () : new NONCLIENTMETRICSA (); |
|---|
| | 280 | HFONT hCaptionFont, oldFont; |
|---|
| | 281 | if (hTheme is null) { |
|---|
| | 282 | if (!OS.IsWinCE && hFont is null) { |
|---|
| | 283 | NONCLIENTMETRICS info; |
|---|
| 288 | 284 | info.cbSize = NONCLIENTMETRICS.sizeof; |
|---|
| 289 | | if (OS.SystemParametersInfo (OS.SPI_GETNONCLIENTMETRICS, 0, info, 0)) { |
|---|
| 290 | | LOGFONT logFont = OS.IsUnicode ? (LOGFONT) ((NONCLIENTMETRICSW)info).lfCaptionFont : ((NONCLIENTMETRICSA)info).lfCaptionFont; |
|---|
| | 285 | if (OS.SystemParametersInfo (OS.SPI_GETNONCLIENTMETRICS, 0, &info, 0)) { |
|---|
| | 286 | LOGFONT* logFont = &info.lfCaptionFont; |
|---|
| 291 | 287 | hCaptionFont = OS.CreateFontIndirect (logFont); |
|---|
| 292 | 288 | oldFont = OS.SelectObject (gc.handle, hCaptionFont); |
|---|
| … | … | |
| 298 | 294 | item.drawItem (gc, hTheme, clipRect, item is focusItem && drawFocus); |
|---|
| 299 | 295 | } |
|---|
| 300 | | if (hCaptionFont !is 0) { |
|---|
| | 296 | if (hCaptionFont !is null) { |
|---|
| 301 | 297 | OS.SelectObject (gc.handle, oldFont); |
|---|
| 302 | 298 | OS.DeleteObject (hCaptionFont); |
|---|
| … | … | |
| 317 | 313 | |
|---|
| 318 | 314 | int getBandHeight () { |
|---|
| 319 | | if (hFont is 0) return ExpandItem.CHEVRON_SIZE; |
|---|
| 320 | | int hDC = OS.GetDC (handle); |
|---|
| 321 | | int oldHFont = OS.SelectObject (hDC, hFont); |
|---|
| 322 | | TEXTMETRIC lptm = OS.IsUnicode ? (TEXTMETRIC)new TEXTMETRICW() : new TEXTMETRICA(); |
|---|
| 323 | | OS.GetTextMetrics (hDC, lptm); |
|---|
| | 315 | if (hFont is null) return ExpandItem.CHEVRON_SIZE; |
|---|
| | 316 | auto hDC = OS.GetDC (handle); |
|---|
| | 317 | auto oldHFont = OS.SelectObject (hDC, hFont); |
|---|
| | 318 | TEXTMETRIC lptm; |
|---|
| | 319 | OS.GetTextMetrics (hDC, &lptm); |
|---|
| 324 | 320 | OS.SelectObject (hDC, oldHFont); |
|---|
| 325 | 321 | OS.ReleaseDC (handle, hDC); |
|---|
| … | … | |
| 431 | 427 | if (background !is -1) return false; |
|---|
| 432 | 428 | if (foreground !is -1) return false; |
|---|
| 433 | | if (hFont !is 0) return false; |
|---|
| | 429 | if (hFont !is null) return false; |
|---|
| 434 | 430 | return OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed (); |
|---|
| 435 | 431 | } |
|---|
| 436 | 432 | |
|---|
| 437 | | void layoutItems (int index, bool setScrollbar) { |
|---|
| | 433 | void layoutItems (int index, bool setScrollbar_) { |
|---|
| 438 | 434 | if (index < itemCount) { |
|---|
| 439 | 435 | int y = spacing - yCurrentScroll; |
|---|
| … | … | |
| 450 | 446 | } |
|---|
| 451 | 447 | } |
|---|
| 452 | | if (setScrollbar) setScrollbar (); |
|---|
| | 448 | if (setScrollbar_) setScrollbar (); |
|---|
| 453 | 449 | } |
|---|
| 454 | 450 | |
|---|
| … | … | |
| 496 | 492 | if (!OS.IsWinCE) { |
|---|
| 497 | 493 | int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN; |
|---|
| 498 | | OS.RedrawWindow (handle, null, 0, flags); |
|---|
| | 494 | OS.RedrawWindow (handle, null, null, flags); |
|---|
| 499 | 495 | } |
|---|
| 500 | 496 | } |
|---|
| … | … | |
| 502 | 498 | public void setFont (Font font) { |
|---|
| 503 | 499 | super.setFont (font); |
|---|
| 504 | | hFont = font !is null ? font.handle : 0; |
|---|
| | 500 | hFont = font !is null ? font.handle : null; |
|---|
| 505 | 501 | layoutItems (0, true); |
|---|
| 506 | 502 | } |
|---|
| … | … | |
| 510 | 506 | if (!OS.IsWinCE) { |
|---|
| 511 | 507 | int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN; |
|---|
| 512 | | OS.RedrawWindow (handle, null, 0, flags); |
|---|
| | 508 | OS.RedrawWindow (handle, null, null, flags); |
|---|
| 513 | 509 | } |
|---|
| 514 | 510 | } |
|---|
| … | … | |
| 517 | 513 | if (itemCount is 0) return; |
|---|
| 518 | 514 | if ((style & DWT.V_SCROLL) is 0) return; |
|---|
| 519 | | RECT rect = new RECT(); |
|---|
| 520 | | OS.GetClientRect (handle, rect); |
|---|
| | 515 | RECT rect; |
|---|
| | 516 | OS.GetClientRect (handle, &rect); |
|---|
| 521 | 517 | int height = rect.bottom - rect.top; |
|---|
| 522 | 518 | ExpandItem item = items [itemCount - 1]; |
|---|
| … | … | |
| 531 | 527 | maxHeight += yCurrentScroll; |
|---|
| 532 | 528 | |
|---|
| 533 | | SCROLLINFO info = new SCROLLINFO (); |
|---|
| | 529 | SCROLLINFO info; |
|---|
| 534 | 530 | info.cbSize = SCROLLINFO.sizeof; |
|---|
| 535 | 531 | info.fMask = OS.SIF_RANGE | OS.SIF_PAGE | OS.SIF_POS; |
|---|
| … | … | |
| 539 | 535 | info.nPos = Math.min (yCurrentScroll, info.nMax); |
|---|
| 540 | 536 | if (info.nPage !is 0) info.nPage++; |
|---|
| 541 | | OS.SetScrollInfo (handle, OS.SB_VERT, info, true); |
|---|
| | 537 | OS.SetScrollInfo (handle, OS.SB_VERT, &info, true); |
|---|
| 542 | 538 | } |
|---|
| 543 | 539 | |
|---|
| … | … | |
| 556 | 552 | if (spacing is this.spacing) return; |
|---|
| 557 | 553 | this.spacing = spacing; |
|---|
| 558 | | RECT rect = new RECT (); |
|---|
| 559 | | OS.GetClientRect (handle, rect); |
|---|
| | 554 | RECT rect; |
|---|
| | 555 | OS.GetClientRect (handle, &rect); |
|---|
| 560 | 556 | int width = Math.max (0, (rect.right - rect.left) - spacing * 2); |
|---|
| 561 | 557 | for (int i = 0; i < itemCount; i++) { |
|---|
| … | … | |
| 577 | 573 | } |
|---|
| 578 | 574 | |
|---|
| 579 | | TCHAR windowClass () { |
|---|
| 580 | | return display.windowClass; |
|---|
| | 575 | char[] windowClass () { |
|---|
| | 576 | return display.windowClass(); |
|---|
| 581 | 577 | } |
|---|
| 582 | 578 | |
|---|
| 583 | 579 | int windowProc () { |
|---|
| 584 | | return display.windowProc; |
|---|
| | 580 | return cast(int) display.windowProc; |
|---|
| 585 | 581 | } |
|---|
| 586 | 582 | |
|---|
| 587 | 583 | LRESULT WM_KEYDOWN (int wParam, int lParam) { |
|---|
| 588 | 584 | LRESULT result = super.WM_KEYDOWN (wParam, lParam); |
|---|
| 589 | | if (result !is null) return result; |
|---|
| | 585 | if (result !is LRESULT.NULL) return result; |
|---|
| 590 | 586 | if (focusItem is null) return result; |
|---|
| 591 | 587 | switch (wParam) { |
|---|
| … | … | |
| 631 | 627 | LRESULT result = super.WM_LBUTTONDOWN (wParam, lParam); |
|---|
| 632 | 628 | if (result is LRESULT.ZERO) return result; |
|---|
| 633 | | int x = (short) (lParam & 0xFFFF); |
|---|
| 634 | | int y = (short) (lParam >> 16); |
|---|
| | 629 | int x = cast(short) (lParam & 0xFFFF); |
|---|
| | 630 | int y = cast(short) (lParam >> 16); |
|---|
| 635 | 631 | for (int i = 0; i < itemCount; i++) { |
|---|
| 636 | 632 | ExpandItem item = items[i]; |
|---|
| … | … | |
| 651 | 647 | if (result is LRESULT.ZERO) return result; |
|---|
| 652 | 648 | if (focusItem is null) return result; |
|---|
| 653 | | int x = (short) (lParam & 0xFFFF); |
|---|
| 654 | | int y = (short) (lParam >> 16); |
|---|
| | 649 | int x = cast(short) (lParam & 0xFFFF); |
|---|
| | 650 | int y = cast(short) (lParam >> 16); |
|---|
| 655 | 651 | bool hover = focusItem.isHover (x, y); |
|---|
| 656 | 652 | if (hover) { |
|---|
| … | … | |
| 666 | 662 | LRESULT WM_MOUSELEAVE (int wParam, int lParam) { |
|---|
| 667 | 663 | LRESULT result = super.WM_MOUSELEAVE (wParam, lParam); |
|---|
| 668 | | if (result !is null) return result; |
|---|
| | 664 | if (result !is LRESULT.NULL) return result; |
|---|
| 669 | 665 | for (int i = 0; i < itemCount; i++) { |
|---|
| 670 | 666 | ExpandItem item = items [i]; |
|---|
| … | … | |
| 681 | 677 | LRESULT result = super.WM_MOUSEMOVE (wParam, lParam); |
|---|
| 682 | 678 | if (result is LRESULT.ZERO) return result; |
|---|
| 683 | | int x = (short) (lParam & 0xFFFF); |
|---|
| 684 | | int y = (short) (lParam >> 16); |
|---|
| | 679 | int x = cast(short) (lParam & 0xFFFF); |
|---|
| | 680 | int y = cast(short) (lParam >> 16); |
|---|
| 685 | 681 | for (int i = 0; i < itemCount; i++) { |
|---|
| 686 | 682 | ExpandItem item = items [i]; |
|---|
| … | … | |
| 695 | 691 | |
|---|
| 696 | 692 | LRESULT WM_PAINT (int wParam, int lParam) { |
|---|
| 697 | | PAINTSTRUCT ps = new PAINTSTRUCT (); |
|---|
| | 693 | PAINTSTRUCT ps; |
|---|
| 698 | 694 | GCData data = new GCData (); |
|---|
| 699 | | data.ps = ps; |
|---|
| | 695 | data.ps = &ps; |
|---|
| 700 | 696 | data.hwnd = handle; |
|---|
| 701 | 697 | GC gc = new_GC (data); |
|---|
| 702 | 698 | if (gc !is null) { |
|---|
| 703 | | int width = ps.right - ps.left; |
|---|
| 704 | | int height = ps.bottom - ps.top; |
|---|
| | 699 | int width = ps.rcPaint.right - ps.rcPaint.left; |
|---|
| | 700 | int height = ps.rcPaint.bottom - ps.rcPaint.top; |
|---|
| 705 | 701 | if (width !is 0 && height !is 0) { |
|---|
| 706 | | RECT rect = new RECT (); |
|---|
| 707 | | OS.SetRect (rect, ps.left, ps.top, ps.right, ps.bottom); |
|---|
| 708 | | drawWidget (gc, rect); |
|---|
| | 702 | RECT rect; |
|---|
| | 703 | OS.SetRect (&rect, ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom); |
|---|
| | 704 | drawWidget (gc, &rect); |
|---|
| 709 | 705 | if (hooks (DWT.Paint) || filters (DWT.Paint)) { |
|---|
| 710 | 706 | Event event = new Event (); |
|---|
| … | … | |
| 725 | 721 | LRESULT WM_PRINTCLIENT (int wParam, int lParam) { |
|---|
| 726 | 722 | LRESULT result = super.WM_PRINTCLIENT (wParam, lParam); |
|---|
| 727 | | RECT rect = new RECT (); |
|---|
| 728 | | OS.GetClientRect (handle, rect); |
|---|
| | 723 | RECT rect; |
|---|
| | 724 | OS.GetClientRect (handle, &rect); |
|---|
| 729 | 725 | GCData data = new GCData (); |
|---|
| 730 | 726 | data.device = display; |
|---|
| 731 | 727 | data.foreground = getForegroundPixel (); |
|---|
| 732 | | GC gc = GC.win32_new (wParam, data); |
|---|
| 733 | | drawWidget (gc, rect); |
|---|
| | 728 | GC gc = GC.win32_new ( cast(Drawable)cast(void*)wParam, data); |
|---|
| | 729 | drawWidget (gc, &rect); |
|---|
| 734 | 730 | gc.dispose (); |
|---|
| 735 | 731 | return result; |
|---|
| … | … | |
| 738 | 734 | LRESULT WM_SETCURSOR (int wParam, int lParam) { |
|---|
| 739 | 735 | LRESULT result = super.WM_SETCURSOR (wParam, lParam); |
|---|
| 740 | | if (result !is null) return result; |
|---|
| | 736 | if (result !is LRESULT.NULL) return result; |
|---|
| 741 | 737 | int hitTest = lParam & 0xFFFF; |
|---|
| 742 | 738 | if (hitTest is OS.HTCLIENT) { |
|---|
| … | … | |
| 744 | 740 | ExpandItem item = items [i]; |
|---|
| 745 | 741 | if (item.hover) { |
|---|
| 746 | | int hCursor = OS.LoadCursor (0, OS.IDC_HAND); |
|---|
| | 742 | auto hCursor = OS.LoadCursor (null, OS.IDC_HAND); |
|---|
| 747 | 743 | OS.SetCursor (hCursor); |
|---|
| 748 | 744 | return LRESULT.ONE; |
|---|
| … | … | |
| 761 | 757 | LRESULT WM_SIZE (int wParam, int lParam) { |
|---|
| 762 | 758 | LRESULT result = super.WM_SIZE (wParam, lParam); |
|---|
| 763 | | RECT rect = new RECT (); |
|---|
| 764 | | OS.GetClientRect (handle, rect); |
|---|
| | 759 | RECT rect; |
|---|
| | 760 | OS.GetClientRect (handle, &rect); |
|---|
| 765 | 761 | int width = Math.max (0, (rect.right - rect.left) - spacing * 2); |
|---|
| 766 | 762 | for (int i = 0; i < itemCount; i++) { |
|---|
| … | … | |
| 773 | 769 | } |
|---|
| 774 | 770 | |
|---|
| 775 | | LRESULT wmScroll (ScrollBar bar, bool update, int hwnd, int msg, int wParam, int lParam) { |
|---|
| | 771 | LRESULT wmScroll (ScrollBar bar, bool update, HWND hwnd, int msg, int wParam, int lParam) { |
|---|
| 776 | 772 | LRESULT result = super.wmScroll (bar, true, hwnd, msg, wParam, lParam); |
|---|
| 777 | | SCROLLINFO info = new SCROLLINFO (); |
|---|
| | 773 | SCROLLINFO info; |
|---|
| 778 | 774 | info.cbSize = SCROLLINFO.sizeof; |
|---|
| 779 | 775 | info.fMask = OS.SIF_POS; |
|---|
| 780 | | OS.GetScrollInfo (handle, OS.SB_VERT, info); |
|---|
| | 776 | OS.GetScrollInfo (handle, OS.SB_VERT, &info); |
|---|
| 781 | 777 | int updateY = yCurrentScroll - info.nPos; |
|---|
| 782 | | OS.ScrollWindowEx (handle, 0, updateY, null, null, 0, null, OS.SW_SCROLLCHILDREN | OS.SW_INVALIDATE); |
|---|
| | 778 | OS.ScrollWindowEx (handle, 0, updateY, null, null, null, null, OS.SW_SCROLLCHILDREN | OS.SW_INVALIDATE); |
|---|
| 783 | 779 | yCurrentScroll = info.nPos; |
|---|
| 784 | 780 | if (updateY !is 0) { |
|---|
| … | … | |
| 790 | 786 | } |
|---|
| 791 | 787 | } |
|---|
| 792 | | ++/ |
|---|
| | 788 | |
|---|
| r45 |
r47 |
|
| 32 | 32 | bool getExpanded(); |
|---|
| 33 | 33 | void setControl(Control); |
|---|
| 34 | | void drawItem(GC, int, RECT, bool); |
|---|
| | 34 | void drawItem(GC, HTHEME, RECT*, bool); |
|---|
| 35 | 35 | bool isHover(int, int); |
|---|
| 36 | 36 | void setExpanded(bool); |
|---|
| … | … | |
| 42 | 42 | void setHeight(int); |
|---|
| 43 | 43 | override void setImage(Image); |
|---|
| 44 | | int getPreferredWidth(int, int); |
|---|
| | 44 | int getPreferredWidth(HTHEME, HDC); |
|---|
| 45 | 45 | int getHeaderHeight(); |
|---|
| 46 | 46 | ExpandBar parent; |
|---|
| … | … | |
| 227 | 227 | } |
|---|
| 228 | 228 | |
|---|
| 229 | | void drawItem (GC gc, int hTheme, RECT clipRect, bool drawFocus) { |
|---|
| | 229 | void drawItem (GC gc, HTHEME hTheme, RECT* clipRect, bool drawFocus) { |
|---|
| 230 | 230 | int hDC = gc.handle; |
|---|
| 231 | 231 | int headerHeight = parent.getBandHeight (); |
|---|
| … | … | |
| 372 | 372 | } |
|---|
| 373 | 373 | |
|---|
| 374 | | int getPreferredWidth (int hTheme, int hDC) { |
|---|
| | 374 | int getPreferredWidth (HTHEME hTheme, HDC hDC) { |
|---|
| 375 | 375 | int width = ExpandItem.TEXT_INSET * 2 + ExpandItem.CHEVRON_SIZE; |
|---|
| 376 | 376 | if (image !is null) { |
|---|