rename wxRendererNative::DrawRadioButton() to DrawOptionButton() to avoid conflict with wxUniv function with the same name

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58481 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-01-28 13:55:51 +00:00
parent 3b7fa2069b
commit 99c4be6806
4 changed files with 92 additions and 62 deletions

View File

@@ -254,19 +254,34 @@ public:
// draw the focus rectangle around the label contained in the given rect // draw the focus rectangle around the label contained in the given rect
// //
// only wxCONTROL_SELECTED makes sense in flags here // only wxCONTROL_SELECTED makes sense in flags here
virtual void DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, int flags = 0) = 0; virtual void DrawFocusRect(wxWindow* win,
wxDC& dc,
const wxRect& rect,
int flags = 0) = 0;
// Draw a native wxChoice // Draw a native wxChoice
virtual void DrawChoice(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0) = 0; virtual void DrawChoice(wxWindow* win,
wxDC& dc,
const wxRect& rect,
int flags = 0) = 0;
// Draw a native wxComboBox // Draw a native wxComboBox
virtual void DrawComboBox(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0) = 0; virtual void DrawComboBox(wxWindow* win,
wxDC& dc,
const wxRect& rect,
int flags = 0) = 0;
// Draw a native wxTextCtrl frame // Draw a native wxTextCtrl frame
virtual void DrawTextCtrl(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0) = 0; virtual void DrawTextCtrl(wxWindow* win,
wxDC& dc,
const wxRect& rect,
int flags = 0) = 0;
// Draw a native wxRadioButton (just the graphical portion) // Draw a native wxRadioButton (just the graphical portion)
virtual void DrawRadioButton(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0) = 0; virtual void DrawOptionButton(wxWindow* win,
wxDC& dc,
const wxRect& rect,
int flags = 0) = 0;
// geometry functions // geometry functions
// ------------------ // ------------------
@@ -386,7 +401,7 @@ public:
virtual void DrawCheckBox(wxWindow *win, virtual void DrawCheckBox(wxWindow *win,
wxDC& dc, wxDC& dc,
const wxRect& rect, const wxRect& rect,
int flags = 0 ) int flags = 0)
{ m_rendererNative.DrawCheckBox( win, dc, rect, flags ); } { m_rendererNative.DrawCheckBox( win, dc, rect, flags ); }
virtual wxSize GetCheckBoxSize(wxWindow *win) virtual wxSize GetCheckBoxSize(wxWindow *win)
@@ -395,29 +410,44 @@ public:
virtual void DrawPushButton(wxWindow *win, virtual void DrawPushButton(wxWindow *win,
wxDC& dc, wxDC& dc,
const wxRect& rect, const wxRect& rect,
int flags = 0 ) int flags = 0)
{ m_rendererNative.DrawPushButton( win, dc, rect, flags ); } { m_rendererNative.DrawPushButton( win, dc, rect, flags ); }
virtual void DrawItemSelectionRect(wxWindow *win, virtual void DrawItemSelectionRect(wxWindow *win,
wxDC& dc, wxDC& dc,
const wxRect& rect, const wxRect& rect,
int flags = 0 ) int flags = 0)
{ m_rendererNative.DrawItemSelectionRect( win, dc, rect, flags ); } { m_rendererNative.DrawItemSelectionRect( win, dc, rect, flags ); }
virtual void DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, int flags = 0) virtual void DrawFocusRect(wxWindow* win,
wxDC& dc,
const wxRect& rect,
int flags = 0)
{ m_rendererNative.DrawFocusRect( win, dc, rect, flags ); } { m_rendererNative.DrawFocusRect( win, dc, rect, flags ); }
virtual void DrawChoice(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0) virtual void DrawChoice(wxWindow* win,
wxDC& dc,
const wxRect& rect,
int flags = 0)
{ m_rendererNative.DrawChoice( win, dc, rect, flags); } { m_rendererNative.DrawChoice( win, dc, rect, flags); }
virtual void DrawComboBox(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0) virtual void DrawComboBox(wxWindow* win,
wxDC& dc,
const wxRect& rect,
int flags = 0)
{ m_rendererNative.DrawComboBox( win, dc, rect, flags); } { m_rendererNative.DrawComboBox( win, dc, rect, flags); }
virtual void DrawTextCtrl(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0) virtual void DrawTextCtrl(wxWindow* win,
wxDC& dc,
const wxRect& rect,
int flags = 0)
{ m_rendererNative.DrawTextCtrl( win, dc, rect, flags); } { m_rendererNative.DrawTextCtrl( win, dc, rect, flags); }
virtual void DrawRadioButton(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0) virtual void DrawOptionButton(wxWindow* win,
{ m_rendererNative.DrawRadioButton( win, dc, rect, flags); } wxDC& dc,
const wxRect& rect,
int flags = 0)
{ m_rendererNative.DrawOptionButton( win, dc, rect, flags); }
virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win) virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win)
{ return m_rendererNative.GetSplitterParams(win); } { return m_rendererNative.GetSplitterParams(win); }

View File

@@ -118,7 +118,7 @@ public:
virtual void DrawTextCtrl(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0); virtual void DrawTextCtrl(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0);
virtual void DrawRadioButton(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0); virtual void DrawOptionButton(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0);
virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win); virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win);
@@ -339,7 +339,7 @@ wxRendererGeneric::DrawHeaderButtonContents(wxWindow *win,
x = margin + rect.x; x = margin + rect.x;
y = rect.y + wxMax(1, (rect.height - h) / 2); y = rect.y + wxMax(1, (rect.height - h) / 2);
if (params->m_labelText.empty()) if (params->m_labelText.empty())
{ {
// use the alignment flags // use the alignment flags
@@ -359,7 +359,7 @@ wxRendererGeneric::DrawHeaderButtonContents(wxWindow *win,
} }
dc.DrawBitmap(params->m_labelBitmap, x, y, true); dc.DrawBitmap(params->m_labelBitmap, x, y, true);
} }
// Draw a label if one is given // Draw a label if one is given
if ( params && !params->m_labelText.empty() ) if ( params && !params->m_labelText.empty() )
{ {
@@ -743,7 +743,7 @@ void wxRendererGeneric::DrawComboBox(wxWindow* WXUNUSED(win), wxDC& WXUNUSED(dc)
// FIXME: Implement // FIXME: Implement
} }
void wxRendererGeneric::DrawRadioButton(wxWindow* WXUNUSED(win), wxDC& WXUNUSED(dc), void wxRendererGeneric::DrawOptionButton(wxWindow* WXUNUSED(win), wxDC& WXUNUSED(dc),
const wxRect& WXUNUSED(rect), int WXUNUSED(flags)) const wxRect& WXUNUSED(rect), int WXUNUSED(flags))
{ {
// FIXME: Implement // FIXME: Implement

View File

@@ -99,24 +99,24 @@ public:
const wxRect& rect, const wxRect& rect,
int flags = 0); int flags = 0);
virtual void DrawChoice(wxWindow* win, virtual void DrawChoice(wxWindow* win,
wxDC& dc, wxDC& dc,
const wxRect& rect, const wxRect& rect,
int flags=0); int flags=0);
virtual void DrawComboBox(wxWindow* win, virtual void DrawComboBox(wxWindow* win,
wxDC& dc, wxDC& dc,
const wxRect& rect, const wxRect& rect,
int flags=0); int flags=0);
virtual void DrawTextCtrl(wxWindow* win, virtual void DrawTextCtrl(wxWindow* win,
wxDC& dc, wxDC& dc,
const wxRect& rect, const wxRect& rect,
int flags=0); int flags=0);
virtual void DrawRadioButton(wxWindow* win, virtual void DrawOptionButton(wxWindow* win,
wxDC& dc, wxDC& dc,
const wxRect& rect, const wxRect& rect,
int flags=0); int flags=0);
virtual void DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, int flags = 0); virtual void DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, int flags = 0);
@@ -141,7 +141,7 @@ wxRendererNative& wxRendererNative::GetDefault()
static GdkWindow* wxGetGdkWindowForDC(wxWindow* win, wxDC& dc) static GdkWindow* wxGetGdkWindowForDC(wxWindow* win, wxDC& dc)
{ {
GdkWindow* gdk_window = NULL; GdkWindow* gdk_window = NULL;
#if wxUSE_GRAPHICS_CONTEXT #if wxUSE_GRAPHICS_CONTEXT
if ( dc.IsKindOf( CLASSINFO(wxGCDC) ) ) if ( dc.IsKindOf( CLASSINFO(wxGCDC) ) )
gdk_window = win->GTKGetDrawingWindow(); gdk_window = win->GTKGetDrawingWindow();
@@ -212,17 +212,17 @@ wxRendererGTK::DrawHeaderButton(wxWindow *win,
"button", "button",
dc.LogicalToDeviceX(rect.x) - x_diff, rect.y, rect.width, rect.height dc.LogicalToDeviceX(rect.x) - x_diff, rect.y, rect.width, rect.height
); );
return DrawHeaderButtonContents(win, dc, rect, flags, sortArrow, params); return DrawHeaderButtonContents(win, dc, rect, flags, sortArrow, params);
} }
int wxRendererGTK::GetHeaderButtonHeight(wxWindow *WXUNUSED(win)) int wxRendererGTK::GetHeaderButtonHeight(wxWindow *WXUNUSED(win))
{ {
GtkWidget *button = wxGTKPrivate::GetHeaderButtonWidget(); GtkWidget *button = wxGTKPrivate::GetHeaderButtonWidget();
GtkRequisition req; GtkRequisition req;
GTK_WIDGET_GET_CLASS(button)->size_request(button, &req); GTK_WIDGET_GET_CLASS(button)->size_request(button, &req);
return req.height; return req.height;
} }
@@ -517,9 +517,9 @@ wxRendererGTK::DrawPushButton(wxWindow* win,
NULL, NULL,
button, button,
"button", "button",
dc.LogicalToDeviceX(rect.x), dc.LogicalToDeviceX(rect.x),
dc.LogicalToDeviceY(rect.y), dc.LogicalToDeviceY(rect.y),
rect.width, rect.width,
rect.height rect.height
); );
} }
@@ -531,7 +531,7 @@ wxRendererGTK::DrawItemSelectionRect(wxWindow* win,
int flags ) int flags )
{ {
GtkWidget *tree = wxGTKPrivate::GetTreeWidget(); GtkWidget *tree = wxGTKPrivate::GetTreeWidget();
GdkWindow* gdk_window = wxGetGdkWindowForDC(win, dc); GdkWindow* gdk_window = wxGetGdkWindowForDC(win, dc);
wxASSERT_MSG( gdk_window, wxASSERT_MSG( gdk_window,
wxT("cannot use wxRendererNative on wxDC of this type") ); wxT("cannot use wxRendererNative on wxDC of this type") );
@@ -541,7 +541,7 @@ wxRendererGTK::DrawItemSelectionRect(wxWindow* win,
x_diff = rect.width; x_diff = rect.width;
GtkStateType state = GTK_STATE_NORMAL; GtkStateType state = GTK_STATE_NORMAL;
if (flags & wxCONTROL_SELECTED) if (flags & wxCONTROL_SELECTED)
{ {
// the wxCONTROL_FOCUSED state is deduced // the wxCONTROL_FOCUSED state is deduced
@@ -569,7 +569,7 @@ wxRendererGTK::DrawItemSelectionRect(wxWindow* win,
{ {
if (flags & wxCONTROL_SELECTED) if (flags & wxCONTROL_SELECTED)
state = GTK_STATE_SELECTED; state = GTK_STATE_SELECTED;
gtk_paint_focus( tree->style, gtk_paint_focus( tree->style,
gdk_window, gdk_window,
state, state,
@@ -622,7 +622,7 @@ void wxRendererGTK::DrawTextCtrl(wxWindow* win, wxDC& dc, const wxRect& rect, in
GtkStateType state = GTK_STATE_NORMAL; GtkStateType state = GTK_STATE_NORMAL;
if ( flags & wxCONTROL_DISABLED ) if ( flags & wxCONTROL_DISABLED )
state = GTK_STATE_INSENSITIVE; state = GTK_STATE_INSENSITIVE;
if (flags & wxCONTROL_CURRENT ) if (flags & wxCONTROL_CURRENT )
GTK_WIDGET_SET_FLAGS( entry, GTK_HAS_FOCUS ); GTK_WIDGET_SET_FLAGS( entry, GTK_HAS_FOCUS );
else else
@@ -630,7 +630,7 @@ void wxRendererGTK::DrawTextCtrl(wxWindow* win, wxDC& dc, const wxRect& rect, in
gtk_paint_shadow gtk_paint_shadow
( (
entry->style, entry->style,
gdk_window, gdk_window,
state, state,
GTK_SHADOW_OUT, GTK_SHADOW_OUT,
@@ -640,7 +640,7 @@ void wxRendererGTK::DrawTextCtrl(wxWindow* win, wxDC& dc, const wxRect& rect, in
dc.LogicalToDeviceX(rect.x), dc.LogicalToDeviceX(rect.x),
dc.LogicalToDeviceY(rect.y), dc.LogicalToDeviceY(rect.y),
rect.width, rect.width,
rect.height rect.height
); );
} }
@@ -654,7 +654,7 @@ void wxRendererGTK::DrawComboBox(wxWindow* win, wxDC& dc, const wxRect& rect, in
GtkStateType state = GTK_STATE_NORMAL; GtkStateType state = GTK_STATE_NORMAL;
if ( flags & wxCONTROL_DISABLED ) if ( flags & wxCONTROL_DISABLED )
state = GTK_STATE_INSENSITIVE; state = GTK_STATE_INSENSITIVE;
if (flags & wxCONTROL_CURRENT ) if (flags & wxCONTROL_CURRENT )
GTK_WIDGET_SET_FLAGS( combo, GTK_HAS_FOCUS ); GTK_WIDGET_SET_FLAGS( combo, GTK_HAS_FOCUS );
else else
@@ -662,7 +662,7 @@ void wxRendererGTK::DrawComboBox(wxWindow* win, wxDC& dc, const wxRect& rect, in
gtk_paint_shadow gtk_paint_shadow
( (
combo->style, combo->style,
gdk_window, gdk_window,
state, state,
GTK_SHADOW_OUT, GTK_SHADOW_OUT,
@@ -672,7 +672,7 @@ void wxRendererGTK::DrawComboBox(wxWindow* win, wxDC& dc, const wxRect& rect, in
dc.LogicalToDeviceX(rect.x), dc.LogicalToDeviceX(rect.x),
dc.LogicalToDeviceY(rect.y), dc.LogicalToDeviceY(rect.y),
rect.width, rect.width,
rect.height rect.height
); );
wxRect r = rect; wxRect r = rect;
@@ -684,7 +684,7 @@ void wxRendererGTK::DrawComboBox(wxWindow* win, wxDC& dc, const wxRect& rect, in
gtk_paint_arrow gtk_paint_arrow
( (
combo->style, combo->style,
gdk_window, gdk_window,
state, state,
GTK_SHADOW_OUT, GTK_SHADOW_OUT,
@@ -705,7 +705,7 @@ void wxRendererGTK::DrawComboBox(wxWindow* win, wxDC& dc, const wxRect& rect, in
gtk_paint_box gtk_paint_box
( (
combo->style, combo->style,
gdk_window, gdk_window,
state, state,
GTK_SHADOW_ETCHED_OUT, GTK_SHADOW_ETCHED_OUT,
@@ -726,20 +726,20 @@ void wxRendererGTK::DrawChoice(wxWindow* win, wxDC& dc,
DrawComboBox( win, dc, rect, flags ); DrawComboBox( win, dc, rect, flags );
} }
// Draw a themed radio button // Draw a themed radio button
void wxRendererGTK::DrawRadioButton(wxWindow* win, wxDC& dc, const wxRect& rect, int flags) void wxRendererGTK::DrawOptionButton(wxWindow* win, wxDC& dc, const wxRect& rect, int flags)
{ {
GtkWidget *button = wxGTKPrivate::GetRadioButtonWidget(); GtkWidget *button = wxGTKPrivate::GetRadioButtonWidget();
GdkWindow* gdk_window = wxGetGdkWindowForDC(win, dc); GdkWindow* gdk_window = wxGetGdkWindowForDC(win, dc);
GtkShadowType shadow_type = GTK_SHADOW_OUT; GtkShadowType shadow_type = GTK_SHADOW_OUT;
if ( flags & wxCONTROL_CHECKED ) if ( flags & wxCONTROL_CHECKED )
shadow_type = GTK_SHADOW_IN; shadow_type = GTK_SHADOW_IN;
else if ( flags & wxCONTROL_UNDETERMINED ) else if ( flags & wxCONTROL_UNDETERMINED )
shadow_type = GTK_SHADOW_ETCHED_IN; shadow_type = GTK_SHADOW_ETCHED_IN;
GtkStateType state = GTK_STATE_NORMAL; GtkStateType state = GTK_STATE_NORMAL;
if ( flags & wxCONTROL_DISABLED ) if ( flags & wxCONTROL_DISABLED )
state = GTK_STATE_INSENSITIVE; state = GTK_STATE_INSENSITIVE;
@@ -759,8 +759,8 @@ void wxRendererGTK::DrawRadioButton(wxWindow* win, wxDC& dc, const wxRect& rect,
NULL, NULL,
button, button,
"radiobutton", "radiobutton",
dc.LogicalToDeviceX(rect.x), dc.LogicalToDeviceX(rect.x),
dc.LogicalToDeviceY(rect.y), dc.LogicalToDeviceY(rect.y),
rect.width, rect.height rect.width, rect.height
); );
} }

View File

@@ -100,7 +100,7 @@ public:
virtual void DrawTextCtrl(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0); virtual void DrawTextCtrl(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0);
virtual void DrawRadioButton(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0); virtual void DrawOptionButton(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0);
private: private:
void DrawMacThemeButton(wxWindow *win, void DrawMacThemeButton(wxWindow *win,
@@ -351,7 +351,7 @@ wxRendererMac::DrawMacThemeButton(wxWindow *win,
drawInfo.adornment = adornment; drawInfo.adornment = adornment;
if (flags & wxCONTROL_FOCUSED) if (flags & wxCONTROL_FOCUSED)
drawInfo.adornment |= kThemeAdornmentFocus; drawInfo.adornment |= kThemeAdornmentFocus;
HIThemeDrawButton( &headerRect, &drawInfo, cgContext, kHIThemeOrientationNormal, &labelRect ); HIThemeDrawButton( &headerRect, &drawInfo, cgContext, kHIThemeOrientationNormal, &labelRect );
} }
} }
@@ -366,7 +366,7 @@ wxRendererMac::DrawCheckBox(wxWindow *win,
flags |= wxCONTROL_SELECTED; flags |= wxCONTROL_SELECTED;
int kind; int kind;
if (win->GetWindowVariant() == wxWINDOW_VARIANT_SMALL || if (win->GetWindowVariant() == wxWINDOW_VARIANT_SMALL ||
(win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_SMALL)) (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_SMALL))
kind = kThemeCheckBoxSmall; kind = kThemeCheckBoxSmall;
@@ -469,7 +469,7 @@ void wxRendererMac::DrawChoice(wxWindow* win, wxDC& dc,
const wxRect& rect, int flags) const wxRect& rect, int flags)
{ {
int kind; int kind;
if (win->GetWindowVariant() == wxWINDOW_VARIANT_SMALL || if (win->GetWindowVariant() == wxWINDOW_VARIANT_SMALL ||
(win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_SMALL)) (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_SMALL))
kind = kThemePopupButtonSmall; kind = kThemePopupButtonSmall;
@@ -487,7 +487,7 @@ void wxRendererMac::DrawComboBox(wxWindow* win, wxDC& dc,
const wxRect& rect, int flags) const wxRect& rect, int flags)
{ {
int kind; int kind;
if (win->GetWindowVariant() == wxWINDOW_VARIANT_SMALL || if (win->GetWindowVariant() == wxWINDOW_VARIANT_SMALL ||
(win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_SMALL)) (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_SMALL))
kind = kThemeComboBoxSmall; kind = kThemeComboBoxSmall;
@@ -500,11 +500,11 @@ void wxRendererMac::DrawComboBox(wxWindow* win, wxDC& dc,
DrawMacThemeButton(win, dc, rect, flags, kind, kThemeAdornmentNone); DrawMacThemeButton(win, dc, rect, flags, kind, kThemeAdornmentNone);
} }
void wxRendererMac::DrawRadioButton(wxWindow* win, wxDC& dc, void wxRendererMac::DrawOptionButton(wxWindow* win, wxDC& dc,
const wxRect& rect, int flags) const wxRect& rect, int flags)
{ {
int kind; int kind;
if (win->GetWindowVariant() == wxWINDOW_VARIANT_SMALL || if (win->GetWindowVariant() == wxWINDOW_VARIANT_SMALL ||
(win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_SMALL)) (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_SMALL))
kind = kThemeRadioButtonSmall; kind = kThemeRadioButtonSmall;
@@ -532,7 +532,7 @@ void wxRendererMac::DrawTextCtrl(wxWindow* win, wxDC& dc,
dc.SetBrush( *wxWHITE_BRUSH ); dc.SetBrush( *wxWHITE_BRUSH );
dc.SetPen( *wxTRANSPARENT_PEN ); dc.SetPen( *wxTRANSPARENT_PEN );
dc.DrawRectangle(rect); dc.DrawRectangle(rect);
dc.SetBrush( *wxTRANSPARENT_BRUSH ); dc.SetBrush( *wxTRANSPARENT_BRUSH );
HIRect hiRect = CGRectMake( x, y, w, h ); HIRect hiRect = CGRectMake( x, y, w, h );