Add implementation of native DrawCheckBox for Mac. (patch #1786282.)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@49361 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -135,6 +135,20 @@ public:
|
|||||||
|
|
||||||
wxRendererNative::Get().DrawHeaderButton(this, dc,
|
wxRendererNative::Get().DrawHeaderButton(this, dc,
|
||||||
wxRect(20, 70, 100, 60));
|
wxRect(20, 70, 100, 60));
|
||||||
|
|
||||||
|
// Draw some check boxes in various states
|
||||||
|
dc.SetBrush(*wxBLACK_BRUSH);
|
||||||
|
dc.SetTextForeground(*wxBLACK);
|
||||||
|
dc.DrawText(_T("Checkbox Drawn with native renderer"), 10, 150);
|
||||||
|
// Checked
|
||||||
|
wxRendererNative::Get().DrawCheckBox(this, dc, wxRect(20, 170, 16, 16), wxCONTROL_CHECKED);
|
||||||
|
// Undetermined
|
||||||
|
wxRendererNative::Get().DrawCheckBox(this, dc, wxRect(40, 170, 16, 16), wxCONTROL_CHECKABLE);
|
||||||
|
// Unchecked
|
||||||
|
wxRendererNative::Get().DrawCheckBox(this, dc, wxRect(60, 170, 16, 16), 0);
|
||||||
|
// Checked and Disabled
|
||||||
|
wxRendererNative::Get().DrawCheckBox(this, dc, wxRect(80, 170, 16, 16), wxCONTROL_CHECKED | wxCONTROL_DISABLED);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
@@ -57,6 +57,11 @@ public:
|
|||||||
wxOrientation orient,
|
wxOrientation orient,
|
||||||
int flags = 0 );
|
int flags = 0 );
|
||||||
|
|
||||||
|
virtual void DrawCheckBox(wxWindow *win,
|
||||||
|
wxDC& dc,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags = 0);
|
||||||
|
|
||||||
virtual void DrawComboBoxDropButton(wxWindow *win,
|
virtual void DrawComboBoxDropButton(wxWindow *win,
|
||||||
wxDC& dc,
|
wxDC& dc,
|
||||||
const wxRect& rect,
|
const wxRect& rect,
|
||||||
@@ -459,6 +464,8 @@ wxRendererMac::DrawMacThemeButton(wxWindow *win,
|
|||||||
drawInfo.kind = kind;
|
drawInfo.kind = kind;
|
||||||
drawInfo.state = (flags & wxCONTROL_DISABLED) ? kThemeStateInactive : kThemeStateActive;
|
drawInfo.state = (flags & wxCONTROL_DISABLED) ? kThemeStateInactive : kThemeStateActive;
|
||||||
drawInfo.value = (flags & wxCONTROL_SELECTED) ? kThemeButtonOn : kThemeButtonOff;
|
drawInfo.value = (flags & wxCONTROL_SELECTED) ? kThemeButtonOn : kThemeButtonOff;
|
||||||
|
if (flags & wxCONTROL_UNDETERMINED)
|
||||||
|
drawInfo.value = kThemeButtonMixed;
|
||||||
drawInfo.adornment = adornment;
|
drawInfo.adornment = adornment;
|
||||||
|
|
||||||
HIThemeDrawButton( &headerRect, &drawInfo, cgContext, kHIThemeOrientationNormal, &labelRect );
|
HIThemeDrawButton( &headerRect, &drawInfo, cgContext, kHIThemeOrientationNormal, &labelRect );
|
||||||
@@ -471,6 +478,18 @@ wxRendererMac::DrawMacThemeButton(wxWindow *win,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
wxRendererMac::DrawCheckBox(wxWindow *win,
|
||||||
|
wxDC& dc,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags)
|
||||||
|
{
|
||||||
|
if (flags & wxCONTROL_CHECKED)
|
||||||
|
flags |= wxCONTROL_SELECTED;
|
||||||
|
|
||||||
|
DrawMacThemeButton(win, dc, rect, flags,
|
||||||
|
kThemeCheckBox, kThemeAdornmentNone);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
wxRendererMac::DrawComboBoxDropButton(wxWindow *win,
|
wxRendererMac::DrawComboBoxDropButton(wxWindow *win,
|
||||||
|
Reference in New Issue
Block a user