// 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
}
// 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()) ;
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 == T(""))
- Label = T(" "); // Apparently needed or checkbox won't show
+ if (Label == wxT(""))
+ Label = wxT(" "); // Apparently needed or checkbox won't show
+#endif // 0
if ( id == -1 )
m_windowId = NewControlId();
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,
SetWindowText(GetHwnd(), label);
}
-wxSize wxCheckBox::DoGetBestSize()
+#define CHECK_SIZE 13
+
+wxSize wxCheckBox::DoGetBestSize() const
{
int wCheckbox, hCheckbox;
if ( !str.IsEmpty() )
{
GetTextExtent(str, &wCheckbox, &hCheckbox);
- wCheckbox += RADIO_SIZE;
+ wCheckbox += CHECK_SIZE;
- if ( hCheckbox < RADIO_SIZE )
- hCheckbox = RADIO_SIZE;
+ if ( hCheckbox < CHECK_SIZE )
+ hCheckbox = CHECK_SIZE;
}
else
{
- wCheckbox = RADIO_SIZE;
- hCheckbox = RADIO_SIZE;
+ wCheckbox = CHECK_SIZE;
+ hCheckbox = CHECK_SIZE;
}
return wxSize(wCheckbox, hCheckbox);
#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));
const wxString& name)
{
SetName(name);
+#if wxUSE_VALIDATORS
SetValidator(validator);
+#endif // wxUSE_VALIDATORS
if (parent) parent->AddChild(this);
SetBackgroundColour(parent->GetBackgroundColour()) ;
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);
void wxBitmapCheckBox::SetLabel(const wxBitmap& bitmap)
{
- wxFAIL_MSG(T("not implemented"));
+ wxFAIL_MSG(wxT("not implemented"));
}