From 99c4be680622f58a48a04dfe0835b59d2c41afea Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 28 Jan 2009 13:55:51 +0000 Subject: [PATCH] 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 --- include/wx/renderer.h | 58 ++++++++++++++++++++++-------- src/generic/renderg.cpp | 8 ++--- src/gtk/renderer.cpp | 72 ++++++++++++++++++------------------- src/osx/carbon/renderer.cpp | 16 ++++----- 4 files changed, 92 insertions(+), 62 deletions(-) diff --git a/include/wx/renderer.h b/include/wx/renderer.h index 1c54983345..b2bb8e2eb7 100644 --- a/include/wx/renderer.h +++ b/include/wx/renderer.h @@ -254,19 +254,34 @@ public: // draw the focus rectangle around the label contained in the given rect // // 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 - 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 - 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 - 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) - 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 // ------------------ @@ -386,7 +401,7 @@ public: virtual void DrawCheckBox(wxWindow *win, wxDC& dc, const wxRect& rect, - int flags = 0 ) + int flags = 0) { m_rendererNative.DrawCheckBox( win, dc, rect, flags ); } virtual wxSize GetCheckBoxSize(wxWindow *win) @@ -395,29 +410,44 @@ public: virtual void DrawPushButton(wxWindow *win, wxDC& dc, const wxRect& rect, - int flags = 0 ) + int flags = 0) { m_rendererNative.DrawPushButton( win, dc, rect, flags ); } virtual void DrawItemSelectionRect(wxWindow *win, wxDC& dc, const wxRect& rect, - int flags = 0 ) + int flags = 0) { 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 ); } - 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); } - 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); } - 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); } - virtual void DrawRadioButton(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0) - { m_rendererNative.DrawRadioButton( win, dc, rect, flags); } + virtual void DrawOptionButton(wxWindow* win, + wxDC& dc, + const wxRect& rect, + int flags = 0) + { m_rendererNative.DrawOptionButton( win, dc, rect, flags); } virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win) { return m_rendererNative.GetSplitterParams(win); } diff --git a/src/generic/renderg.cpp b/src/generic/renderg.cpp index 2834305083..e55d87bb71 100644 --- a/src/generic/renderg.cpp +++ b/src/generic/renderg.cpp @@ -118,7 +118,7 @@ public: 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); @@ -339,7 +339,7 @@ wxRendererGeneric::DrawHeaderButtonContents(wxWindow *win, x = margin + rect.x; y = rect.y + wxMax(1, (rect.height - h) / 2); - + if (params->m_labelText.empty()) { // use the alignment flags @@ -359,7 +359,7 @@ wxRendererGeneric::DrawHeaderButtonContents(wxWindow *win, } dc.DrawBitmap(params->m_labelBitmap, x, y, true); } - + // Draw a label if one is given if ( params && !params->m_labelText.empty() ) { @@ -743,7 +743,7 @@ void wxRendererGeneric::DrawComboBox(wxWindow* WXUNUSED(win), wxDC& WXUNUSED(dc) // 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)) { // FIXME: Implement diff --git a/src/gtk/renderer.cpp b/src/gtk/renderer.cpp index 86855f31d5..2411e870ad 100644 --- a/src/gtk/renderer.cpp +++ b/src/gtk/renderer.cpp @@ -99,24 +99,24 @@ public: const wxRect& rect, int flags = 0); - virtual void DrawChoice(wxWindow* win, - wxDC& dc, - const wxRect& rect, + virtual void DrawChoice(wxWindow* win, + wxDC& dc, + const wxRect& rect, int flags=0); - virtual void DrawComboBox(wxWindow* win, - wxDC& dc, - const wxRect& rect, + virtual void DrawComboBox(wxWindow* win, + wxDC& dc, + const wxRect& rect, int flags=0); - virtual void DrawTextCtrl(wxWindow* win, - wxDC& dc, - const wxRect& rect, + virtual void DrawTextCtrl(wxWindow* win, + wxDC& dc, + const wxRect& rect, int flags=0); - virtual void DrawRadioButton(wxWindow* win, - wxDC& dc, - const wxRect& rect, + virtual void DrawOptionButton(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) { GdkWindow* gdk_window = NULL; - + #if wxUSE_GRAPHICS_CONTEXT if ( dc.IsKindOf( CLASSINFO(wxGCDC) ) ) gdk_window = win->GTKGetDrawingWindow(); @@ -212,17 +212,17 @@ wxRendererGTK::DrawHeaderButton(wxWindow *win, "button", dc.LogicalToDeviceX(rect.x) - x_diff, rect.y, rect.width, rect.height ); - + return DrawHeaderButtonContents(win, dc, rect, flags, sortArrow, params); } int wxRendererGTK::GetHeaderButtonHeight(wxWindow *WXUNUSED(win)) { GtkWidget *button = wxGTKPrivate::GetHeaderButtonWidget(); - + GtkRequisition req; GTK_WIDGET_GET_CLASS(button)->size_request(button, &req); - + return req.height; } @@ -517,9 +517,9 @@ wxRendererGTK::DrawPushButton(wxWindow* win, NULL, button, "button", - dc.LogicalToDeviceX(rect.x), - dc.LogicalToDeviceY(rect.y), - rect.width, + dc.LogicalToDeviceX(rect.x), + dc.LogicalToDeviceY(rect.y), + rect.width, rect.height ); } @@ -531,7 +531,7 @@ wxRendererGTK::DrawItemSelectionRect(wxWindow* win, int flags ) { GtkWidget *tree = wxGTKPrivate::GetTreeWidget(); - + GdkWindow* gdk_window = wxGetGdkWindowForDC(win, dc); wxASSERT_MSG( gdk_window, wxT("cannot use wxRendererNative on wxDC of this type") ); @@ -541,7 +541,7 @@ wxRendererGTK::DrawItemSelectionRect(wxWindow* win, x_diff = rect.width; GtkStateType state = GTK_STATE_NORMAL; - + if (flags & wxCONTROL_SELECTED) { // the wxCONTROL_FOCUSED state is deduced @@ -569,7 +569,7 @@ wxRendererGTK::DrawItemSelectionRect(wxWindow* win, { if (flags & wxCONTROL_SELECTED) state = GTK_STATE_SELECTED; - + gtk_paint_focus( tree->style, gdk_window, state, @@ -622,7 +622,7 @@ void wxRendererGTK::DrawTextCtrl(wxWindow* win, wxDC& dc, const wxRect& rect, in GtkStateType state = GTK_STATE_NORMAL; if ( flags & wxCONTROL_DISABLED ) state = GTK_STATE_INSENSITIVE; - + if (flags & wxCONTROL_CURRENT ) GTK_WIDGET_SET_FLAGS( entry, GTK_HAS_FOCUS ); else @@ -630,7 +630,7 @@ void wxRendererGTK::DrawTextCtrl(wxWindow* win, wxDC& dc, const wxRect& rect, in gtk_paint_shadow ( - entry->style, + entry->style, gdk_window, state, GTK_SHADOW_OUT, @@ -640,7 +640,7 @@ void wxRendererGTK::DrawTextCtrl(wxWindow* win, wxDC& dc, const wxRect& rect, in dc.LogicalToDeviceX(rect.x), dc.LogicalToDeviceY(rect.y), 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; if ( flags & wxCONTROL_DISABLED ) state = GTK_STATE_INSENSITIVE; - + if (flags & wxCONTROL_CURRENT ) GTK_WIDGET_SET_FLAGS( combo, GTK_HAS_FOCUS ); else @@ -662,7 +662,7 @@ void wxRendererGTK::DrawComboBox(wxWindow* win, wxDC& dc, const wxRect& rect, in gtk_paint_shadow ( - combo->style, + combo->style, gdk_window, state, GTK_SHADOW_OUT, @@ -672,7 +672,7 @@ void wxRendererGTK::DrawComboBox(wxWindow* win, wxDC& dc, const wxRect& rect, in dc.LogicalToDeviceX(rect.x), dc.LogicalToDeviceY(rect.y), rect.width, - rect.height + rect.height ); wxRect r = rect; @@ -684,7 +684,7 @@ void wxRendererGTK::DrawComboBox(wxWindow* win, wxDC& dc, const wxRect& rect, in gtk_paint_arrow ( - combo->style, + combo->style, gdk_window, state, GTK_SHADOW_OUT, @@ -705,7 +705,7 @@ void wxRendererGTK::DrawComboBox(wxWindow* win, wxDC& dc, const wxRect& rect, in gtk_paint_box ( - combo->style, + combo->style, gdk_window, state, GTK_SHADOW_ETCHED_OUT, @@ -726,20 +726,20 @@ void wxRendererGTK::DrawChoice(wxWindow* win, wxDC& dc, DrawComboBox( win, dc, rect, flags ); } - + // 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(); GdkWindow* gdk_window = wxGetGdkWindowForDC(win, dc); - + GtkShadowType shadow_type = GTK_SHADOW_OUT; if ( flags & wxCONTROL_CHECKED ) shadow_type = GTK_SHADOW_IN; else if ( flags & wxCONTROL_UNDETERMINED ) shadow_type = GTK_SHADOW_ETCHED_IN; - + GtkStateType state = GTK_STATE_NORMAL; if ( flags & wxCONTROL_DISABLED ) state = GTK_STATE_INSENSITIVE; @@ -759,8 +759,8 @@ void wxRendererGTK::DrawRadioButton(wxWindow* win, wxDC& dc, const wxRect& rect, NULL, button, "radiobutton", - dc.LogicalToDeviceX(rect.x), - dc.LogicalToDeviceY(rect.y), + dc.LogicalToDeviceX(rect.x), + dc.LogicalToDeviceY(rect.y), rect.width, rect.height ); } diff --git a/src/osx/carbon/renderer.cpp b/src/osx/carbon/renderer.cpp index 3f8c1a95e6..cc98ee5651 100644 --- a/src/osx/carbon/renderer.cpp +++ b/src/osx/carbon/renderer.cpp @@ -100,7 +100,7 @@ public: 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: void DrawMacThemeButton(wxWindow *win, @@ -351,7 +351,7 @@ wxRendererMac::DrawMacThemeButton(wxWindow *win, drawInfo.adornment = adornment; if (flags & wxCONTROL_FOCUSED) drawInfo.adornment |= kThemeAdornmentFocus; - + HIThemeDrawButton( &headerRect, &drawInfo, cgContext, kHIThemeOrientationNormal, &labelRect ); } } @@ -366,7 +366,7 @@ wxRendererMac::DrawCheckBox(wxWindow *win, flags |= wxCONTROL_SELECTED; int kind; - + if (win->GetWindowVariant() == wxWINDOW_VARIANT_SMALL || (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_SMALL)) kind = kThemeCheckBoxSmall; @@ -469,7 +469,7 @@ void wxRendererMac::DrawChoice(wxWindow* win, wxDC& dc, const wxRect& rect, int flags) { int kind; - + if (win->GetWindowVariant() == wxWINDOW_VARIANT_SMALL || (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_SMALL)) kind = kThemePopupButtonSmall; @@ -487,7 +487,7 @@ void wxRendererMac::DrawComboBox(wxWindow* win, wxDC& dc, const wxRect& rect, int flags) { int kind; - + if (win->GetWindowVariant() == wxWINDOW_VARIANT_SMALL || (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_SMALL)) kind = kThemeComboBoxSmall; @@ -500,11 +500,11 @@ void wxRendererMac::DrawComboBox(wxWindow* win, wxDC& dc, 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) { int kind; - + if (win->GetWindowVariant() == wxWINDOW_VARIANT_SMALL || (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_SMALL)) kind = kThemeRadioButtonSmall; @@ -532,7 +532,7 @@ void wxRendererMac::DrawTextCtrl(wxWindow* win, wxDC& dc, dc.SetBrush( *wxWHITE_BRUSH ); dc.SetPen( *wxTRANSPARENT_PEN ); dc.DrawRectangle(rect); - + dc.SetBrush( *wxTRANSPARENT_BRUSH ); HIRect hiRect = CGRectMake( x, y, w, h ); -- 2.45.2