Mercurial > projects > dwt-win
diff dwt/widgets/Combo.d @ 80:1801ddeb8f32
removed static ctors
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Wed, 06 Feb 2008 12:09:44 +0100 |
parents | 0f25be5cbe6f |
children | 43c42c637c9c |
line wrap: on
line diff
--- a/dwt/widgets/Combo.d Wed Feb 06 11:08:01 2008 +0100 +++ b/dwt/widgets/Combo.d Wed Feb 06 12:09:44 2008 +0100 @@ -77,7 +77,6 @@ alias Composite.setBounds setBounds; alias Composite.setToolTipText setToolTipText; - alias extern(Windows) int function( HWND, uint, uint, int ) TWindowProc; private static Combo pThis; bool noSelection, ignoreDefaultSelection, ignoreCharacter, ignoreModify; HHOOK cbtHook; @@ -110,15 +109,25 @@ */ static const int CBID_LIST = 1000; static const int CBID_EDIT = 1001; - static /*final*/ TWindowProc EditProc, ListProc; + static /*final*/ WNDPROC EditProc, ListProc; - static const TWindowProc ComboProc; + static /+const+/ WNDPROC ComboProc; static const TCHAR* ComboClass = "COMBOBOX\0"; - static this() { - WNDCLASS lpWndClass; - OS.GetClassInfo (null, ComboClass, &lpWndClass); - ComboProc = lpWndClass.lpfnWndProc; + private static bool static_this_completed = false; + private static void static_this() { + if( static_this_completed ){ + return; + } + synchronized { + if( static_this_completed ){ + return; + } + WNDCLASS lpWndClass; + OS.GetClassInfo (null, ComboClass, &lpWndClass); + ComboProc = lpWndClass.lpfnWndProc; + static_this_completed = true; + } } @@ -153,6 +162,7 @@ * @see Widget#getStyle */ public this (Composite parent, int style) { + static_this(); super (parent, checkStyle (style)); /* This code is intentionally commented */ //if ((style & DWT.H_SCROLL) !is 0) this.style |= DWT.H_SCROLL; @@ -527,11 +537,11 @@ /* Get the text and list window procs */ auto hwndText = OS.GetDlgItem (handle, CBID_EDIT); if (hwndText !is null && EditProc is null) { - EditProc = cast(TWindowProc) OS.GetWindowLong (hwndText, OS.GWL_WNDPROC); + EditProc = cast(WNDPROC) OS.GetWindowLong (hwndText, OS.GWL_WNDPROC); } auto hwndList = OS.GetDlgItem (handle, CBID_LIST); if (hwndList !is null && ListProc is null) { - ListProc = cast(TWindowProc) OS.GetWindowLong (hwndList, OS.GWL_WNDPROC); + ListProc = cast(WNDPROC) OS.GetWindowLong (hwndList, OS.GWL_WNDPROC); } /*