Mercurial > projects > dwt-win
diff dwt/widgets/Button.d @ 48:9a64a7781bab
Added override and alias, first chunk. Thanks torhu for doing this patch.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 03 Feb 2008 01:14:54 +0100 |
parents | f871c501e610 |
children | 1801ddeb8f32 |
line wrap: on
line diff
--- a/dwt/widgets/Button.d Sun Feb 03 00:59:28 2008 +0100 +++ b/dwt/widgets/Button.d Sun Feb 03 01:14:54 2008 +0100 @@ -57,6 +57,10 @@ */ public class Button : Control { + + alias Control.computeSize computeSize; + alias Control.windowProc windowProc; + alias extern(Windows) int function( HWND, uint, uint, int ) TWindowProc; char[] text = "", message = ""; Image image, image2, disabledImage; @@ -398,7 +402,7 @@ return margin; } -public Point computeSize (int wHint, int hHint, bool changed) { +override public Point computeSize (int wHint, int hHint, bool changed) { checkWidget (); int width = 0, height = 0, border = getBorderWidth (); if ((style & DWT.ARROW) !is 0) { @@ -487,7 +491,7 @@ return new Point (width, height); } -void createHandle () { +override void createHandle () { super.createHandle (); if ((style & DWT.PUSH) is 0) state |= THEME_BACKGROUND; /* @@ -507,18 +511,18 @@ } } -int defaultBackground () { +override int defaultBackground () { if ((style & (DWT.PUSH | DWT.TOGGLE)) !is 0) { return OS.GetSysColor (OS.COLOR_BTNFACE); } return super.defaultBackground (); } -int defaultForeground () { +override int defaultForeground () { return OS.GetSysColor (OS.COLOR_BTNTEXT); } -void enableWidget (bool enabled) { +override void enableWidget (bool enabled) { super.enableWidget (enabled); /* * Bug in Windows. When a button control is right-to-left and @@ -643,7 +647,7 @@ return message; } -char[] getNameText () { +override char[] getNameText () { return getText (); } @@ -688,13 +692,13 @@ return text; } -bool isTabItem () { +override bool isTabItem () { //TEMPORARY CODE //if ((style & DWT.PUSH) !is 0) return true; return super.isTabItem (); } -bool mnemonicHit (wchar ch) { +override bool mnemonicHit (wchar ch) { if (!setFocus ()) return false; /* * Feature in Windows. When a radio button gets focus, @@ -706,13 +710,13 @@ return true; } -bool mnemonicMatch (wchar key) { +override bool mnemonicMatch (wchar key) { wchar mnemonic = findMnemonic (getText ()); if (mnemonic is '\0') return false; return CharacterToUpper (key) is CharacterToUpper (mnemonic); } -void releaseWidget () { +override void releaseWidget () { super.releaseWidget (); if (imageList !is null) imageList.dispose (); imageList = null; @@ -845,7 +849,7 @@ OS.SendMessage (handle, OS.BM_SETSTYLE, bits, 1); } -bool setFixedFocus () { +override bool setFixedFocus () { /* * Feature in Windows. When a radio button gets focus, * it selects the button in WM_SETFOCUS. The fix is to @@ -917,12 +921,12 @@ } } -bool setRadioFocus () { +override bool setRadioFocus () { if ((style & DWT.RADIO) is 0 || !getSelection ()) return false; return setFocus (); } -bool setRadioSelection (bool value) { +override bool setRadioSelection (bool value) { if ((style & DWT.RADIO) is 0) return false; if (getSelection () !is value) { setSelection (value); @@ -931,7 +935,7 @@ return true; } -bool setSavedFocus () { +override bool setSavedFocus () { /* * Feature in Windows. When a radio button gets focus, * it selects the button in WM_SETFOCUS. If the previous @@ -1022,7 +1026,7 @@ _setText (string); } -int widgetStyle () { +override int widgetStyle () { int bits = super.widgetStyle (); if ((style & DWT.FLAT) !is 0) bits |= OS.BS_FLAT; if ((style & DWT.ARROW) !is 0) return bits | OS.BS_OWNERDRAW; @@ -1037,16 +1041,16 @@ return bits | OS.BS_PUSHBUTTON | OS.WS_TABSTOP; } -char[] windowClass () { +override char[] windowClass () { return TCHARzToStr( ButtonClass.ptr ); } -int windowProc () { +override int windowProc () { return cast(int) ButtonProc; } -LRESULT WM_ERASEBKGND (int wParam, int lParam) { +override LRESULT WM_ERASEBKGND (int wParam, int lParam) { LRESULT result = super.WM_ERASEBKGND (wParam, lParam); if (result !is LRESULT.NULL) return result; /* @@ -1068,7 +1072,7 @@ return result; } -LRESULT WM_GETDLGCODE (int wParam, int lParam) { +override LRESULT WM_GETDLGCODE (int wParam, int lParam) { LRESULT result = super.WM_GETDLGCODE (wParam, lParam); if (result !is LRESULT.NULL) return result; if ((style & DWT.ARROW) !is 0) { @@ -1077,7 +1081,7 @@ return result; } -LRESULT WM_KILLFOCUS (int wParam, int lParam) { +override LRESULT WM_KILLFOCUS (int wParam, int lParam) { LRESULT result = super.WM_KILLFOCUS (wParam, lParam); if ((style & DWT.PUSH) !is 0 && getDefault ()) { menuShell ().setDefaultButton (null, false); @@ -1085,17 +1089,17 @@ return result; } -LRESULT WM_LBUTTONDOWN (int wParam, int lParam) { +override LRESULT WM_LBUTTONDOWN (int wParam, int lParam) { if (ignoreMouse) return LRESULT.NULL; return super.WM_LBUTTONDOWN (wParam, lParam); } -LRESULT WM_LBUTTONUP (int wParam, int lParam) { +override LRESULT WM_LBUTTONUP (int wParam, int lParam) { if (ignoreMouse) return LRESULT.NULL; return super.WM_LBUTTONUP (wParam, lParam); } -LRESULT WM_SETFOCUS (int wParam, int lParam) { +override LRESULT WM_SETFOCUS (int wParam, int lParam) { /* * Feature in Windows. When Windows sets focus to * a radio button, it sets the WM_TABSTOP style. @@ -1116,7 +1120,7 @@ return result; } -LRESULT WM_SIZE (int wParam, int lParam) { +override LRESULT WM_SIZE (int wParam, int lParam) { LRESULT result = super.WM_SIZE (wParam, lParam); if (result !is LRESULT.NULL) return result; if (OS.COMCTL32_MAJOR >= 6) { @@ -1134,14 +1138,14 @@ return result; } -LRESULT WM_SYSCOLORCHANGE (int wParam, int lParam) { +override LRESULT WM_SYSCOLORCHANGE (int wParam, int lParam) { LRESULT result = super.WM_SYSCOLORCHANGE (wParam, lParam); if (result !is LRESULT.NULL) return result; if (image2 !is null) _setImage (image); return result; } -LRESULT WM_UPDATEUISTATE (int wParam, int lParam) { +override LRESULT WM_UPDATEUISTATE (int wParam, int lParam) { LRESULT result = super.WM_UPDATEUISTATE (wParam, lParam); if (result !is LRESULT.NULL) return result; /* @@ -1176,7 +1180,7 @@ return result; } -LRESULT wmCommandChild (int wParam, int lParam) { +override LRESULT wmCommandChild (int wParam, int lParam) { int code = wParam >> 16; switch (code) { case OS.BN_CLICKED: @@ -1197,7 +1201,7 @@ return super.wmCommandChild (wParam, lParam); } -LRESULT wmColorChild (int wParam, int lParam) { +override LRESULT wmColorChild (int wParam, int lParam) { /* * Bug in Windows. For some reason, the HBRUSH that * is returned from WM_CTRLCOLOR is misaligned when @@ -1218,7 +1222,7 @@ return result; } -LRESULT wmDrawChild (int wParam, int lParam) { +override LRESULT wmDrawChild (int wParam, int lParam) { if ((style & DWT.ARROW) is 0) return super.wmDrawChild (wParam, lParam); auto struct_ = cast(DRAWITEMSTRUCT*)lParam; //OS.MoveMemory (struct_, lParam, DRAWITEMSTRUCT.sizeof);