X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b9b8a2b5d79c50af78720589dc96cd7e16cde26e..6726a6b09748c707351987da56226ac0316d1a00:/src/msw/combobox.cpp diff --git a/src/msw/combobox.cpp b/src/msw/combobox.cpp index 2e6715a7e0..cc082448e1 100644 --- a/src/msw/combobox.cpp +++ b/src/msw/combobox.cpp @@ -98,11 +98,11 @@ wxBEGIN_PROPERTIES_TABLE(wxComboBox) wxEVENT_PROPERTY( TextEnter , wxEVT_COMMAND_TEXT_ENTER , wxCommandEvent ) // TODO DELEGATES - wxPROPERTY( Font , wxFont , SetFont , GetFont , , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( Font , wxFont , SetFont , GetFont , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) wxPROPERTY_COLLECTION( Choices , wxArrayString , wxString , AppendString , GetStrings , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) - wxPROPERTY( Value ,wxString, SetValue, GetValue, , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) - wxPROPERTY( Selection ,int, SetSelection, GetSelection, , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) - wxPROPERTY_FLAGS( WindowStyle , wxComboBoxStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style + wxPROPERTY( Value ,wxString, SetValue, GetValue, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( Selection ,int, SetSelection, GetSelection, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY_FLAGS( WindowStyle , wxComboBoxStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style wxEND_PROPERTIES_TABLE() wxBEGIN_HANDLERS_TABLE(wxComboBox) @@ -127,7 +127,7 @@ LRESULT APIENTRY _EXPORT wxComboEditWndProc(HWND hWnd, // --------------------------------------------------------------------------- // the pointer to standard radio button wnd proc -static WXFARPROC gs_wndprocEdit = (WXFARPROC)NULL; +static WNDPROC gs_wndprocEdit = (WNDPROC)NULL; // ============================================================================ // implementation @@ -238,7 +238,7 @@ WXHBRUSH wxComboBox::OnCtlColor(WXHDC pDC, // wxComboBox callbacks // ---------------------------------------------------------------------------- -long wxComboBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) +WXLRESULT wxComboBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) { // handle WM_CTLCOLOR messages from our EDIT control to be able to set its // colour correctly (to be the same as our own one) @@ -253,7 +253,7 @@ long wxComboBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) WXHWND hwnd; UnpackCtlColor(wParam, lParam, &nCtlColor, &hdc, &hwnd); - return OnCtlColor(hdc, hwnd, nCtlColor, nMsg, wParam, lParam); + return (WXLRESULT)OnCtlColor(hdc, hwnd, nCtlColor, nMsg, wParam, lParam); } return wxChoice::MSWWindowProc(nMsg, wParam, lParam); @@ -399,9 +399,10 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, validator, name) ) return FALSE; - // we shouldn't call SetValue() for an empty read only combobox as it would - // (correctly) thro an assert and is otherwise useless anyhow - if ( n || !HasFlag(wxCB_READONLY) ) + // we shouldn't call SetValue() for an empty string because this would + // (correctly) result in an assert with a read only combobox and is useless + // for the other ones anyhow + if ( !value.empty() ) SetValue(value); // a (not read only) combobox is, in fact, 2 controls: the combobox itself @@ -409,12 +410,8 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, // edit control, we must subclass it as well if ( !(style & wxCB_READONLY) ) { - gs_wndprocEdit = (WXFARPROC)::SetWindowLong - ( - (HWND)GetEditHWND(), - GWL_WNDPROC, - (LPARAM)wxComboEditWndProc - ); + gs_wndprocEdit = wxSetWindowProc((HWND)GetEditHWND(), + wxComboEditWndProc); } // and finally, show the control @@ -576,7 +573,7 @@ void wxComboBox::SetSelection(long from, long to) long fromChar = from; long toChar = to; // if from and to are both -1, it means - // (in wxWindows) that all text should be selected. + // (in wxWidgets) that all text should be selected. // This translates into Windows convention if ((from == -1) && (to == -1)) { @@ -584,13 +581,7 @@ void wxComboBox::SetSelection(long from, long to) toChar = -1; } - if ( -#ifdef __WIN32__ - SendMessage(hWnd, CB_SETEDITSEL, (WPARAM)0, (LPARAM)MAKELONG(fromChar, toChar)) -#else // Win16 - SendMessage(hWnd, CB_SETEDITSEL, (WPARAM)fromChar, (LPARAM)toChar) -#endif - == CB_ERR ) + if ( SendMessage(hWnd, CB_SETEDITSEL, (WPARAM)0, (LPARAM)MAKELONG(fromChar, toChar)) == CB_ERR ) { wxLogDebug(_T("CB_SETEDITSEL failed")); }