yet more corrections to drop down button drawing: don't draw a border around the arrow

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32231 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2005-02-20 01:06:42 +00:00
parent 9d9e32a07a
commit e1befae3d2
2 changed files with 40 additions and 60 deletions

View File

@ -49,10 +49,6 @@
class WXDLLEXPORT wxRendererGTK : public wxDelegateRendererNative class WXDLLEXPORT wxRendererGTK : public wxDelegateRendererNative
{ {
public: public:
// used by DrawHeaderButton and DrawComboBoxDropButton
void PrepareButtonDraw();
// draw the header control button (used by wxListCtrl) // draw the header control button (used by wxListCtrl)
virtual void DrawHeaderButton(wxWindow *win, virtual void DrawHeaderButton(wxWindow *win,
wxDC& dc, wxDC& dc,
@ -65,7 +61,7 @@ public:
wxDC& dc, wxDC& dc,
const wxRect& rect, const wxRect& rect,
int flags = 0); int flags = 0);
#endif // GTK 2.0 #endif // GTK+ 2.0
virtual void DrawSplitterBorder(wxWindow *win, virtual void DrawSplitterBorder(wxWindow *win,
wxDC& dc, wxDC& dc,
@ -84,6 +80,10 @@ public:
int flags = 0); int flags = 0);
virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win); virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win);
private:
// used by DrawHeaderButton and DrawComboBoxDropButton
void PrepareButtonDraw();
}; };
// ============================================================================ // ============================================================================
@ -197,7 +197,7 @@ wxRendererGTK::DrawTreeItemButton(wxWindow* win,
gdk_draw_polygon( pizza->bin_window, style->fg_gc[GTK_STATE_NORMAL], FALSE, points, 3 ); gdk_draw_polygon( pizza->bin_window, style->fg_gc[GTK_STATE_NORMAL], FALSE, points, 3 );
} }
#endif // GTK 2.0 #endif // __WXGTK20__
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// splitter sash drawing // splitter sash drawing
@ -382,15 +382,14 @@ void wxRendererGTK::DrawComboBoxDropButton(wxWindow *win,
// only doing debug-time checking here (it should probably be enough) // only doing debug-time checking here (it should probably be enough)
wxASSERT ( wdc.IsKindOf(CLASSINFO(wxWindowDC)) ); wxASSERT ( wdc.IsKindOf(CLASSINFO(wxWindowDC)) );
GtkStateType state = GTK_STATE_NORMAL; GtkStateType state;
GtkShadowType shadow = GTK_SHADOW_OUT;
if ( flags & wxCONTROL_PRESSED ) if ( flags & wxCONTROL_CURRENT )
shadow = GTK_SHADOW_IN;
else if ( flags & wxCONTROL_CURRENT )
state = GTK_STATE_PRELIGHT; state = GTK_STATE_PRELIGHT;
else if ( flags & wxCONTROL_DISABLED ) else if ( flags & wxCONTROL_DISABLED )
state = GTK_STATE_INSENSITIVE; state = GTK_STATE_INSENSITIVE;
else
state = GTK_STATE_NORMAL;
gtk_paint_box gtk_paint_box
( (
@ -398,36 +397,27 @@ void wxRendererGTK::DrawComboBoxDropButton(wxWindow *win,
//GTK_PIZZA(wdc->m_window)->bin_window, //GTK_PIZZA(wdc->m_window)->bin_window,
wdc.m_window, wdc.m_window,
state, state,
shadow, GTK_SHADOW_NONE,
NULL, NULL,
gs_button, gs_button,
"button", "button",
dc.XLOG2DEV(rect.x), rect.y, rect.width, rect.height rect.x, rect.y, rect.width, rect.height
); );
// draw arrow on button // draw arrow on button
int arr_wid = rect.width/2;
int arr_hei = rect.height/2;
arr_wid += arr_wid & 1;
arr_hei += arr_hei & 1;
gtk_paint_arrow gtk_paint_arrow
( (
gs_button->style, gs_button->style,
//GTK_PIZZA(wdc->m_window)->bin_window, //GTK_PIZZA(wdc->m_window)->bin_window,
wdc.m_window, wdc.m_window,
state, state,
shadow, flags & wxCONTROL_PRESSED ? GTK_SHADOW_IN : GTK_SHADOW_OUT,
NULL, NULL,
gs_button, gs_button,
"arrow", "arrow",
GTK_ARROW_DOWN, GTK_ARROW_DOWN,
TRUE, TRUE,
dc.XLOG2DEV(rect.x) + (rect.width/2-arr_wid/2) + 1, rect.x + 1, rect.y + 1, rect.width - 2, rect.height - 2
rect.y + (rect.height/2-arr_hei/2) + 1,
arr_wid,
arr_hei
); );
} }

View File

@ -49,10 +49,6 @@
class WXDLLEXPORT wxRendererGTK : public wxDelegateRendererNative class WXDLLEXPORT wxRendererGTK : public wxDelegateRendererNative
{ {
public: public:
// used by DrawHeaderButton and DrawComboBoxDropButton
void PrepareButtonDraw();
// draw the header control button (used by wxListCtrl) // draw the header control button (used by wxListCtrl)
virtual void DrawHeaderButton(wxWindow *win, virtual void DrawHeaderButton(wxWindow *win,
wxDC& dc, wxDC& dc,
@ -65,7 +61,7 @@ public:
wxDC& dc, wxDC& dc,
const wxRect& rect, const wxRect& rect,
int flags = 0); int flags = 0);
#endif // GTK 2.0 #endif // GTK+ 2.0
virtual void DrawSplitterBorder(wxWindow *win, virtual void DrawSplitterBorder(wxWindow *win,
wxDC& dc, wxDC& dc,
@ -84,6 +80,10 @@ public:
int flags = 0); int flags = 0);
virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win); virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win);
private:
// used by DrawHeaderButton and DrawComboBoxDropButton
void PrepareButtonDraw();
}; };
// ============================================================================ // ============================================================================
@ -197,7 +197,7 @@ wxRendererGTK::DrawTreeItemButton(wxWindow* win,
gdk_draw_polygon( pizza->bin_window, style->fg_gc[GTK_STATE_NORMAL], FALSE, points, 3 ); gdk_draw_polygon( pizza->bin_window, style->fg_gc[GTK_STATE_NORMAL], FALSE, points, 3 );
} }
#endif // GTK 2.0 #endif // __WXGTK20__
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// splitter sash drawing // splitter sash drawing
@ -382,15 +382,14 @@ void wxRendererGTK::DrawComboBoxDropButton(wxWindow *win,
// only doing debug-time checking here (it should probably be enough) // only doing debug-time checking here (it should probably be enough)
wxASSERT ( wdc.IsKindOf(CLASSINFO(wxWindowDC)) ); wxASSERT ( wdc.IsKindOf(CLASSINFO(wxWindowDC)) );
GtkStateType state = GTK_STATE_NORMAL; GtkStateType state;
GtkShadowType shadow = GTK_SHADOW_OUT;
if ( flags & wxCONTROL_PRESSED ) if ( flags & wxCONTROL_CURRENT )
shadow = GTK_SHADOW_IN;
else if ( flags & wxCONTROL_CURRENT )
state = GTK_STATE_PRELIGHT; state = GTK_STATE_PRELIGHT;
else if ( flags & wxCONTROL_DISABLED ) else if ( flags & wxCONTROL_DISABLED )
state = GTK_STATE_INSENSITIVE; state = GTK_STATE_INSENSITIVE;
else
state = GTK_STATE_NORMAL;
gtk_paint_box gtk_paint_box
( (
@ -398,36 +397,27 @@ void wxRendererGTK::DrawComboBoxDropButton(wxWindow *win,
//GTK_PIZZA(wdc->m_window)->bin_window, //GTK_PIZZA(wdc->m_window)->bin_window,
wdc.m_window, wdc.m_window,
state, state,
shadow, GTK_SHADOW_NONE,
NULL, NULL,
gs_button, gs_button,
"button", "button",
dc.XLOG2DEV(rect.x), rect.y, rect.width, rect.height rect.x, rect.y, rect.width, rect.height
); );
// draw arrow on button // draw arrow on button
int arr_wid = rect.width/2;
int arr_hei = rect.height/2;
arr_wid += arr_wid & 1;
arr_hei += arr_hei & 1;
gtk_paint_arrow gtk_paint_arrow
( (
gs_button->style, gs_button->style,
//GTK_PIZZA(wdc->m_window)->bin_window, //GTK_PIZZA(wdc->m_window)->bin_window,
wdc.m_window, wdc.m_window,
state, state,
shadow, flags & wxCONTROL_PRESSED ? GTK_SHADOW_IN : GTK_SHADOW_OUT,
NULL, NULL,
gs_button, gs_button,
"arrow", "arrow",
GTK_ARROW_DOWN, GTK_ARROW_DOWN,
TRUE, TRUE,
dc.XLOG2DEV(rect.x) + (rect.width/2-arr_wid/2) + 1, rect.x + 1, rect.y + 1, rect.width - 2, rect.height - 2
rect.y + (rect.height/2-arr_hei/2) + 1,
arr_wid,
arr_hei
); );
} }