X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5701b057fb4b5bf672da2fb19230d179f7f3e251..6b0eebc537c0f96eab28295b4ae2c4e978a435a5:/src/msw/checkbox.cpp?ds=sidebyside diff --git a/src/msw/checkbox.cpp b/src/msw/checkbox.cpp index bb95665069..3e8f804185 100644 --- a/src/msw/checkbox.cpp +++ b/src/msw/checkbox.cpp @@ -39,10 +39,8 @@ // macros // ---------------------------------------------------------------------------- -#if !USE_SHARED_LIBRARY - IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl) - IMPLEMENT_DYNAMIC_CLASS(wxBitmapCheckBox, wxCheckBox) -#endif +IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl) +IMPLEMENT_DYNAMIC_CLASS(wxBitmapCheckBox, wxCheckBox) // ============================================================================ // implementation @@ -62,14 +60,18 @@ bool wxCheckBox::MSWCommand(WXUINT WXUNUSED(param), WXWORD WXUNUSED(id)) } // Single check box item -bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label, - const wxPoint& pos, - const wxSize& size, long style, - const wxValidator& validator, - const wxString& name) +bool wxCheckBox::Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos, + const wxSize& size, long style, + const wxValidator& validator, + const wxString& name) { SetName(name); +#if wxUSE_VALIDATORS SetValidator(validator); +#endif // wxUSE_VALIDATORS if (parent) parent->AddChild(this); SetBackgroundColour(parent->GetBackgroundColour()) ; @@ -78,8 +80,8 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label, m_windowStyle = style; wxString Label = label; - if (Label == _T("")) - Label = _T(" "); // Apparently needed or checkbox won't show + if (Label == wxT("")) + Label = wxT(" "); // Apparently needed or checkbox won't show if ( id == -1 ) m_windowId = NewControlId(); @@ -109,7 +111,7 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label, msStyle |= WS_BORDER; */ - m_hWnd = (WXHWND)CreateWindowEx(exStyle, _T("BUTTON"), Label, + m_hWnd = (WXHWND)CreateWindowEx(exStyle, wxT("BUTTON"), Label, msStyle, 0, 0, 0, 0, (HWND)parent->GetHWND(), (HMENU)m_windowId, @@ -138,7 +140,7 @@ void wxCheckBox::SetLabel(const wxString& label) SetWindowText(GetHwnd(), label); } -wxSize wxCheckBox::DoGetBestSize() +wxSize wxCheckBox::DoGetBestSize() const { int wCheckbox, hCheckbox; @@ -179,34 +181,6 @@ bool wxCheckBox::GetValue() const #endif } -WXHBRUSH wxCheckBox::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam) -{ -#if wxUSE_CTL3D - if ( m_useCtl3D ) - { - HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam); - - return (WXHBRUSH) hbrush; - } -#endif - - if (GetParent()->GetTransparentBackground()) - SetBkMode((HDC) pDC, TRANSPARENT); - else - SetBkMode((HDC) pDC, OPAQUE); - - ::SetBkColor((HDC) pDC, RGB(GetBackgroundColour().Red(), GetBackgroundColour().Green(), GetBackgroundColour().Blue())); - ::SetTextColor((HDC) pDC, RGB(GetForegroundColour().Red(), GetForegroundColour().Green(), GetForegroundColour().Blue())); - - wxBrush *backgroundBrush = wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(), wxSOLID); - - // Note that this will be cleaned up in wxApp::OnIdle, if backgroundBrush - // has a zero usage count. -// backgroundBrush->RealizeResource(); - return (WXHBRUSH) backgroundBrush->GetResourceHandle(); -} - void wxCheckBox::Command (wxCommandEvent & event) { SetValue ((event.GetInt() != 0)); @@ -224,7 +198,9 @@ bool wxBitmapCheckBox::Create(wxWindow *parent, wxWindowID id, const wxBitmap *l const wxString& name) { SetName(name); +#if wxUSE_VALIDATORS SetValidator(validator); +#endif // wxUSE_VALIDATORS if (parent) parent->AddChild(this); SetBackgroundColour(parent->GetBackgroundColour()) ; @@ -245,7 +221,7 @@ bool wxBitmapCheckBox::Create(wxWindow *parent, wxWindowID id, const wxBitmap *l checkHeight = -1 ; long msStyle = CHECK_FLAGS; - HWND wx_button = CreateWindowEx(MakeExtendedStyle(m_windowStyle), CHECK_CLASS, _T("toggle"), + HWND wx_button = CreateWindowEx(MakeExtendedStyle(m_windowStyle), CHECK_CLASS, wxT("toggle"), msStyle, 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId, wxGetInstance(), NULL); @@ -272,5 +248,5 @@ bool wxBitmapCheckBox::Create(wxWindow *parent, wxWindowID id, const wxBitmap *l void wxBitmapCheckBox::SetLabel(const wxBitmap& bitmap) { - wxFAIL_MSG(_T("not implemented")); + wxFAIL_MSG(wxT("not implemented")); }