X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1169a91932273bc84c23ed9dbd0a2da064d59d66..a83b5b74c365705144f9359d4527e4b2d073f569:/src/msw/checkbox.cpp diff --git a/src/msw/checkbox.cpp b/src/msw/checkbox.cpp index 4c6927632a..3955dba064 100644 --- a/src/msw/checkbox.cpp +++ b/src/msw/checkbox.cpp @@ -67,7 +67,7 @@ wxBEGIN_FLAGS( wxCheckBoxStyle ) wxFLAGS_MEMBER(wxBORDER_RAISED) wxFLAGS_MEMBER(wxBORDER_STATIC) wxFLAGS_MEMBER(wxBORDER_NONE) - + // old style border flags wxFLAGS_MEMBER(wxSIMPLE_BORDER) wxFLAGS_MEMBER(wxSUNKEN_BORDER) @@ -91,18 +91,18 @@ wxEND_FLAGS( wxCheckBoxStyle ) IMPLEMENT_DYNAMIC_CLASS_XTI(wxCheckBox, wxControl,"wx/checkbox.h") wxBEGIN_PROPERTIES_TABLE(wxCheckBox) - wxEVENT_PROPERTY( Click , wxEVT_COMMAND_CHECKBOX_CLICKED , wxCommandEvent ) + wxEVENT_PROPERTY( Click , wxEVT_COMMAND_CHECKBOX_CLICKED , wxCommandEvent ) - wxPROPERTY( Font , wxFont , SetFont , GetFont , , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) - wxPROPERTY( Label,wxString, SetLabel, GetLabel, wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) - wxPROPERTY( Value ,bool, SetValue, GetValue, , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) - wxPROPERTY_FLAGS( WindowStyle , wxCheckBoxStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style + wxPROPERTY( Font , wxFont , SetFont , GetFont , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( Label,wxString, SetLabel, GetLabel, wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( Value ,bool, SetValue, GetValue, EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY_FLAGS( WindowStyle , wxCheckBoxStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style wxEND_PROPERTIES_TABLE() wxBEGIN_HANDLERS_TABLE(wxCheckBox) wxEND_HANDLERS_TABLE() -wxCONSTRUCTOR_6( wxCheckBox , wxWindow* , Parent , wxWindowID , Id , wxString , Label , wxPoint , Position , wxSize , Size , long , WindowStyle ) +wxCONSTRUCTOR_6( wxCheckBox , wxWindow* , Parent , wxWindowID , Id , wxString , Label , wxPoint , Position , wxSize , Size , long , WindowStyle ) #else IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl) #endif @@ -112,10 +112,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl) // wxCheckBox // ---------------------------------------------------------------------------- -wxCheckBoxBase::wxCheckBoxBase() -{ -} - bool wxCheckBox::MSWCommand(WXUINT WXUNUSED(param), WXWORD WXUNUSED(id)) { wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, m_windowId); @@ -133,7 +129,7 @@ bool wxCheckBox::MSWCommand(WXUINT WXUNUSED(param), WXWORD WXUNUSED(id)) event.SetEventObject(this); ProcessCommand(event); - return TRUE; + return true; } bool wxCheckBox::Create(wxWindow *parent, @@ -145,7 +141,7 @@ bool wxCheckBox::Create(wxWindow *parent, const wxString& name) { if ( !CreateControl(parent, id, pos, size, style, validator, name) ) - return FALSE; + return false; long msStyle = WS_TABSTOP; @@ -163,16 +159,12 @@ bool wxCheckBox::Create(wxWindow *parent, if ( style & wxALIGN_RIGHT ) { - msStyle |= BS_LEFTTEXT; + msStyle |= BS_LEFTTEXT | BS_RIGHT; } return MSWCreateControl(wxT("BUTTON"), msStyle, pos, size, label, 0); } -void wxCheckBox::SetLabel(const wxString& label) -{ - SetWindowText(GetHwnd(), label); -} wxSize wxCheckBox::DoGetBestSize() const { @@ -202,25 +194,21 @@ wxSize wxCheckBox::DoGetBestSize() const wCheckbox = s_checkSize; hCheckbox = s_checkSize; } +#ifdef __WXWINCE__ + hCheckbox += 1; +#endif return wxSize(wCheckbox, hCheckbox); } void wxCheckBox::SetValue(bool val) { - if (val) - { - Set3StateValue(wxCHK_CHECKED); - } - else - { - Set3StateValue(wxCHK_UNCHECKED); - } + Set3StateValue(val ? wxCHK_CHECKED : wxCHK_UNCHECKED); } bool wxCheckBox::GetValue() const { - return (Get3StateValue() != 0); + return Get3StateValue() != wxCHK_UNCHECKED; } void wxCheckBox::Command(wxCommandEvent& event) @@ -245,13 +233,7 @@ void wxCheckBox::DoSet3StateValue(wxCheckBoxState state) wxCheckBoxState wxCheckBox::DoGet3StateValue() const { -#ifdef __WIN32__ return (wxCheckBoxState) ::SendMessage(GetHwnd(), BM_GETCHECK, 0, 0); -#else - return (wxCheckBoxState) ((::SendMessage(GetHwnd(), BM_GETCHECK, 0, 0) - & 0x001) == 0x001); -#endif - } #endif // wxUSE_CHECKBOX