1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: gtk/renderer.cpp
3 // Purpose: implementation of wxRendererNative for wxGTK
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
9 // License: wxWindows license
10 ///////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // for compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
31 #include "wx/gtk/win_gtk.h"
33 #include "wx/window.h"
35 #include "wx/renderer.h"
38 #include "wx/settings.h"
41 // ----------------------------------------------------------------------------
42 // wxRendererGTK: our wxRendererNative implementation
43 // ----------------------------------------------------------------------------
45 class WXDLLEXPORT wxRendererGTK
: public wxDelegateRendererNative
48 // draw the header control button (used by wxListCtrl)
49 virtual void DrawHeaderButton(wxWindow
*win
,
55 // draw the expanded/collapsed icon for a tree control item
56 virtual void DrawTreeItemButton(wxWindow
*win
,
62 // draw a (vertical) sash
64 // VZ: doesn't work -- nothing is shown on screen, why?
66 virtual void DrawSplitterSash(wxWindow
*win
,
73 // ============================================================================
75 // ============================================================================
78 wxRendererNative
& wxRendererNative::Get()
80 static wxRendererGTK s_rendererGTK
;
86 wxRendererGTK::DrawHeaderButton(wxWindow
*win
,
93 win
->m_wxwindow
->style
,
94 GTK_PIZZA(win
->m_wxwindow
)->bin_window
,
95 flags
& wxCONTROL_DISABLED
? GTK_STATE_INSENSITIVE
: GTK_STATE_NORMAL
,
99 (char *)"button", // const_cast
100 dc
.XLOG2DEV(rect
.x
) - 1, rect
.y
- 1, rect
.width
+ 2, rect
.height
+ 2
106 // draw a ">" or "v" button
108 // TODO: isn't there a GTK function to draw it?
110 wxRendererGTK::DrawTreeItemButton(wxWindow
* WXUNUSED(win
),
111 wxDC
& dc
, const wxRect
& rect
, int flags
)
113 dc
.SetBrush(wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT
),
115 dc
.SetPen(*wxBLACK_PEN
);
118 const wxCoord xMiddle
= rect
.x
+ rect
.width
/2;
119 const wxCoord yMiddle
= rect
.y
+ rect
.height
/2;
121 if ( flags
& wxCONTROL_EXPANDED
)
123 button
[0].x
= rect
.GetLeft();
124 button
[0].y
= yMiddle
- 2;
125 button
[1].x
= rect
.GetRight();
126 button
[1].y
= yMiddle
- 2;
127 button
[2].x
= xMiddle
;
128 button
[2].y
= yMiddle
+ 3;
132 button
[0].y
= rect
.GetBottom();
133 button
[0].x
= xMiddle
- 2;
134 button
[1].y
= rect
.GetTop();
135 button
[1].x
= xMiddle
- 2;
136 button
[2].y
= yMiddle
;
137 button
[2].x
= xMiddle
+ 3;
140 dc
.DrawPolygon(3, button
);
147 // draw a (vertical) sash
149 wxRendererGTK::DrawSplitterSash(wxWindow
*win
,
154 if ( !win
->m_wxwindow
->window
)
156 // VZ: this happens on startup -- why?
162 win
->m_wxwindow
->style
,
163 win
->m_wxwindow
->window
,
165 (GdkRectangle
*)NULL
,
167 (char *)"vpaned", // const_cast
168 0, size
.y
, position
+ 3
173 win
->m_wxwindow
->style
,
174 win
->m_wxwindow
->window
,
177 (GdkRectangle
*)NULL
,
179 (char *)"paned", // const_cast