1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: gtk/renderer.cpp
3 // Purpose: implementation of wxRendererBase 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/renderer.h"
35 // ----------------------------------------------------------------------------
36 // wxRendererGTK: our wxRendererBase implementation
37 // ----------------------------------------------------------------------------
39 class WXDLLEXPORT wxRendererGTK
: public wxDelegateRendererBase
42 // draw the header control button (used by wxListCtrl)
43 virtual void DrawHeaderButton(wxWindow
*win
,
49 // draw the expanded/collapsed icon for a tree control item
50 virtual void DrawTreeItemButton(wxWindow
*win
,
58 // ============================================================================
60 // ============================================================================
63 wxRendererNative
& wxRendererGTK::Get()
65 static wxRendererGTK s_rendererGTK
;
71 wxRendererGTK::DrawHeaderButton(wxWindow
*win
,
78 win
->m_wxwindow
->style
,
79 GTK_PIZZA(win
->m_wxwindow
)->bin_window
,
80 flags
& wxCONTROL_DISABLED
? GTK_STATE_INSENSITIVE
: GTK_STATE_NORMAL
,
82 (GdkRectangle
*) NULL
, m_wxwindow
,
83 (char *)"button", // const_cast
84 dc
.XLOG2DEV(rect
.x
) - 1, rect
.y
- 1, rect
.width
+ 2, rect
.h
+ 2
90 // draw a ">" or "v" button
92 // TODO: isn't there a GTK function to draw it?
94 wxRendererGTK::DrawTreeItemButton(wxDC
& dc
, const wxRect
& rect
, int flags
)
96 dc
.SetBrush(*m_hilightBrush
);
97 dc
.SetPen(*wxBLACK_PEN
);
100 const wxCoord xMiddle
= rect
.x
+ rect
.width
/2;
101 const wxCoord yMiddle
= rect
.y
+ rect
.height
/2;
103 if ( flags
& wxCONTROL_EXPANDED
)
105 button
[0].x
= rect
.GetLeft();
106 button
[0].y
= yMiddle
- 2;
107 button
[1].x
= rect
.GetRight();
108 button
[1].y
= yMiddle
- 2;
109 button
[2].x
= xMiddle
;
110 button
[2].y
= yMiddle
+ 3;
114 button
[0].y
= rect
.GetBottom();
115 button
[0].x
= xMiddle
- 2;
116 button
[1].y
= rect
.GetTop();
117 button
[1].x
= xMiddle
- 2;
118 button
[2].y
= yMiddle
;
119 button
[2].x
= xMiddle
+ 3;
122 dc
.DrawPolygon(3, button
);