Add ability to render checkbox in undeterminate state, fixes #12290: wxRendererGTK does not support wx.CONTROL_UNDETERMINED for checkboxes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65139 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -124,6 +124,8 @@ private:
|
|||||||
{ OnToggleDrawFlag(event, wxCONTROL_CHECKED); }
|
{ OnToggleDrawFlag(event, wxCONTROL_CHECKED); }
|
||||||
void OnDrawHot(wxCommandEvent& event)
|
void OnDrawHot(wxCommandEvent& event)
|
||||||
{ OnToggleDrawFlag(event, wxCONTROL_CURRENT); }
|
{ OnToggleDrawFlag(event, wxCONTROL_CURRENT); }
|
||||||
|
void OnDrawUndetermined(wxCommandEvent &event)
|
||||||
|
{ OnToggleDrawFlag(event, wxCONTROL_UNDETERMINED); }
|
||||||
|
|
||||||
void OnAlignLeft(wxCommandEvent& WXUNUSED(event))
|
void OnAlignLeft(wxCommandEvent& WXUNUSED(event))
|
||||||
{ OnChangeAlign(wxALIGN_LEFT); }
|
{ OnChangeAlign(wxALIGN_LEFT); }
|
||||||
@@ -195,6 +197,8 @@ private:
|
|||||||
flagsString += "wxCONTROL_CURRENT ";
|
flagsString += "wxCONTROL_CURRENT ";
|
||||||
if ( m_flags & wxCONTROL_CHECKED )
|
if ( m_flags & wxCONTROL_CHECKED )
|
||||||
flagsString += "wxCONTROL_CHECKED ";
|
flagsString += "wxCONTROL_CHECKED ";
|
||||||
|
if ( m_flags & wxCONTROL_UNDETERMINED )
|
||||||
|
flagsString += "wxCONTROL_UNDETERMINED ";
|
||||||
if ( flagsString.empty() )
|
if ( flagsString.empty() )
|
||||||
flagsString = "(none)";
|
flagsString = "(none)";
|
||||||
dc.DrawText("Using flags: " + flagsString, x1, y);
|
dc.DrawText("Using flags: " + flagsString, x1, y);
|
||||||
@@ -291,6 +295,7 @@ enum
|
|||||||
Render_DrawPressed,
|
Render_DrawPressed,
|
||||||
Render_DrawChecked,
|
Render_DrawChecked,
|
||||||
Render_DrawHot,
|
Render_DrawHot,
|
||||||
|
Render_DrawUndetermined,
|
||||||
|
|
||||||
Render_AlignLeft,
|
Render_AlignLeft,
|
||||||
Render_AlignCentre,
|
Render_AlignCentre,
|
||||||
@@ -326,7 +331,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
|||||||
EVT_MENU(Render_DrawPressed, MyFrame::OnDrawPressed)
|
EVT_MENU(Render_DrawPressed, MyFrame::OnDrawPressed)
|
||||||
EVT_MENU(Render_DrawChecked, MyFrame::OnDrawChecked)
|
EVT_MENU(Render_DrawChecked, MyFrame::OnDrawChecked)
|
||||||
EVT_MENU(Render_DrawHot, MyFrame::OnDrawHot)
|
EVT_MENU(Render_DrawHot, MyFrame::OnDrawHot)
|
||||||
|
EVT_MENU(Render_DrawUndetermined, MyFrame::OnDrawUndetermined)
|
||||||
EVT_MENU(Render_AlignLeft, MyFrame::OnAlignLeft)
|
EVT_MENU(Render_AlignLeft, MyFrame::OnAlignLeft)
|
||||||
EVT_MENU(Render_AlignCentre, MyFrame::OnAlignCentre)
|
EVT_MENU(Render_AlignCentre, MyFrame::OnAlignCentre)
|
||||||
EVT_MENU(Render_AlignRight, MyFrame::OnAlignRight)
|
EVT_MENU(Render_AlignRight, MyFrame::OnAlignRight)
|
||||||
@@ -405,6 +410,8 @@ MyFrame::MyFrame()
|
|||||||
"Draw in &checked state\tCtrl-C");
|
"Draw in &checked state\tCtrl-C");
|
||||||
menuFile->AppendCheckItem(Render_DrawHot,
|
menuFile->AppendCheckItem(Render_DrawHot,
|
||||||
"Draw in &hot state\tCtrl-H");
|
"Draw in &hot state\tCtrl-H");
|
||||||
|
menuFile->AppendCheckItem(Render_DrawUndetermined,
|
||||||
|
"Draw in unde&termined state\tCtrl-T");
|
||||||
menuFile->AppendSeparator();
|
menuFile->AppendSeparator();
|
||||||
|
|
||||||
menuFile->AppendRadioItem(Render_AlignLeft, "&Left align\tCtrl-1");
|
menuFile->AppendRadioItem(Render_AlignLeft, "&Left align\tCtrl-1");
|
||||||
|
@@ -469,12 +469,21 @@ wxRendererGTK::DrawCheckBox(wxWindow* win,
|
|||||||
else
|
else
|
||||||
state = GTK_STATE_NORMAL;
|
state = GTK_STATE_NORMAL;
|
||||||
|
|
||||||
|
GtkShadowType shadow_type;
|
||||||
|
|
||||||
|
if ( flags & wxCONTROL_UNDETERMINED )
|
||||||
|
shadow_type = GTK_SHADOW_ETCHED_IN;
|
||||||
|
else if ( flags & wxCONTROL_CHECKED )
|
||||||
|
shadow_type = GTK_SHADOW_IN;
|
||||||
|
else
|
||||||
|
shadow_type = GTK_SHADOW_OUT;
|
||||||
|
|
||||||
gtk_paint_check
|
gtk_paint_check
|
||||||
(
|
(
|
||||||
button->style,
|
button->style,
|
||||||
gdk_window,
|
gdk_window,
|
||||||
state,
|
state,
|
||||||
flags & wxCONTROL_CHECKED ? GTK_SHADOW_IN : GTK_SHADOW_OUT,
|
shadow_type,
|
||||||
NULL,
|
NULL,
|
||||||
button,
|
button,
|
||||||
"cellcheck",
|
"cellcheck",
|
||||||
|
Reference in New Issue
Block a user