X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/11b6a93b1e078fea5bf49ed9e6628a19849c11b3..4a41c655e85ee535e3ac20ac863d219611857ef2:/src/msw/checkbox.cpp diff --git a/src/msw/checkbox.cpp b/src/msw/checkbox.cpp index 3e8f804185..24a3e7ce5b 100644 --- a/src/msw/checkbox.cpp +++ b/src/msw/checkbox.cpp @@ -31,6 +31,8 @@ #ifndef WX_PRECOMP #include "wx/checkbox.h" #include "wx/brush.h" + #include "wx/dcscreen.h" + #include "wx/settings.h" #endif #include "wx/msw/private.h" @@ -79,9 +81,14 @@ bool wxCheckBox::Create(wxWindow *parent, m_windowStyle = style; + // VZ: disabling this ugliness which completely breaks checkboxes in wxGrid + // whoever did it, please tell me where and how does the checkbox fail + // to appear +#if 0 wxString Label = label; if (Label == wxT("")) Label = wxT(" "); // Apparently needed or checkbox won't show +#endif // 0 if ( id == -1 ) m_windowId = NewControlId(); @@ -97,6 +104,9 @@ bool wxCheckBox::Create(wxWindow *parent, if ( style & wxALIGN_RIGHT ) msStyle |= BS_LEFTTEXT; + if ( style & wxCLIP_SIBLINGS ) + msStyle |= WS_CLIPSIBLINGS; + // We perhaps have different concepts of 3D here - a 3D border, // versus a 3D button. // So we only wish to give a border if this is specified @@ -111,7 +121,7 @@ bool wxCheckBox::Create(wxWindow *parent, msStyle |= WS_BORDER; */ - m_hWnd = (WXHWND)CreateWindowEx(exStyle, wxT("BUTTON"), Label, + m_hWnd = (WXHWND)CreateWindowEx(exStyle, wxT("BUTTON"), label, msStyle, 0, 0, 0, 0, (HWND)parent->GetHWND(), (HMENU)m_windowId, @@ -137,27 +147,36 @@ bool wxCheckBox::Create(wxWindow *parent, void wxCheckBox::SetLabel(const wxString& label) { - SetWindowText(GetHwnd(), label); + SetWindowText(GetHwnd(), label); } wxSize wxCheckBox::DoGetBestSize() const { - int wCheckbox, hCheckbox; + static int s_checkSize = 0; + + if ( !s_checkSize ) + { + wxScreenDC dc; + dc.SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT)); + + s_checkSize = (3*dc.GetCharHeight())/2; + } wxString str = wxGetWindowText(GetHWND()); + int wCheckbox, hCheckbox; if ( !str.IsEmpty() ) { GetTextExtent(str, &wCheckbox, &hCheckbox); - wCheckbox += RADIO_SIZE; + wCheckbox += s_checkSize + GetCharWidth(); - if ( hCheckbox < RADIO_SIZE ) - hCheckbox = RADIO_SIZE; + if ( hCheckbox < s_checkSize ) + hCheckbox = s_checkSize; } else { - wCheckbox = RADIO_SIZE; - hCheckbox = RADIO_SIZE; + wCheckbox = s_checkSize; + hCheckbox = s_checkSize; } return wxSize(wCheckbox, hCheckbox); @@ -177,7 +196,7 @@ bool wxCheckBox::GetValue() const #ifdef __WIN32__ return (SendMessage(GetHwnd(), BM_GETCHECK, 0, 0) == BST_CHECKED); #else - return ((0x003 & SendMessage(GetHwnd(), BM_GETCHECK, 0, 0)) == 0x003); + return ((0x001 & SendMessage(GetHwnd(), BM_GETCHECK, 0, 0)) == 0x001); #endif } @@ -191,7 +210,7 @@ void wxCheckBox::Command (wxCommandEvent & event) // wxBitmapCheckBox // ---------------------------------------------------------------------------- -bool wxBitmapCheckBox::Create(wxWindow *parent, wxWindowID id, const wxBitmap *label, +bool wxBitmapCheckBox::Create(wxWindow *parent, wxWindowID id, const wxBitmap *WXUNUSED(label), const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, @@ -246,7 +265,7 @@ bool wxBitmapCheckBox::Create(wxWindow *parent, wxWindowID id, const wxBitmap *l return TRUE; } -void wxBitmapCheckBox::SetLabel(const wxBitmap& bitmap) +void wxBitmapCheckBox::SetLabel(const wxBitmap& WXUNUSED(bitmap)) { wxFAIL_MSG(wxT("not implemented")); }