]> git.saurik.com Git - wxWidgets.git/blame - include/wx/renderer.h
added precomp-headers-exclude (DSP files only so far) and fixed dependencies for...
[wxWidgets.git] / include / wx / renderer.h
CommitLineData
9c7f49f5
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/renderer.h
3// Purpose: wxRendererNative class declaration
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 20.07.2003
7// RCS-ID: $Id$
8// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
9// Licence: wxWindows licence
10///////////////////////////////////////////////////////////////////////////////
11
12/*
13 Renderers are used in wxWindows for two similar but different things:
14 (a) wxUniversal uses them to draw everything, i.e. all the control
15 (b) all the native ports use them to draw generic controls only
16
17 wxUniversal needs more functionality than what is included in the base class
18 as it needs to draw stuff like scrollbars which are never going to be
19 generic. So we put the bare minimum needed by the native ports here and the
20 full wxRenderer class is declared in wx/univ/renderer.h and is only used by
21 wxUniveral (although note that native ports can load wxRenderer objects from
22 theme DLLs and use them as wxRendererNative ones, of course).
23 */
24
25#ifndef _WX_RENDERER_H_
26#define _WX_RENDERER_H_
27
38c4cb6a 28class WXDLLEXPORT wxDC;
38c4cb6a
VZ
29class WXDLLEXPORT wxWindow;
30
7df07b10
MB
31#include "wx/gdicmn.h" // for wxPoint
32
9c7f49f5
VZ
33// ----------------------------------------------------------------------------
34// constants
35// ----------------------------------------------------------------------------
36
37// control state flags used in wxRenderer and wxColourScheme
38enum
39{
40 wxCONTROL_DISABLED = 0x00000001, // control is disabled
41 wxCONTROL_FOCUSED = 0x00000002, // currently has keyboard focus
42 wxCONTROL_PRESSED = 0x00000004, // (button) is pressed
43 wxCONTROL_ISDEFAULT = 0x00000008, // only applies to the buttons
44 wxCONTROL_ISSUBMENU = wxCONTROL_ISDEFAULT, // only for menu items
45 wxCONTROL_EXPANDED = wxCONTROL_ISDEFAULT, // only for the tree items
46 wxCONTROL_CURRENT = 0x00000010, // mouse is currently over the control
47 wxCONTROL_SELECTED = 0x00000020, // selected item in e.g. listbox
48 wxCONTROL_CHECKED = 0x00000040, // (check/radio button) is checked
49 wxCONTROL_CHECKABLE = 0x00000080, // (menu) item can be checked
50
51 wxCONTROL_FLAGS_MASK = 0x000000ff,
52
53 // this is a pseudo flag not used directly by wxRenderer but rather by some
54 // controls internally
55 wxCONTROL_DIRTY = 0x80000000
56};
57
58// ----------------------------------------------------------------------------
59// wxRendererNative: abstracts drawing methods needed by the native controls
60// ----------------------------------------------------------------------------
61
62class WXDLLEXPORT wxRendererNative
63{
64public:
7df07b10
MB
65 virtual ~wxRendererNative() { } // stop GCC warning
66
9c7f49f5
VZ
67 // drawing functions
68 // -----------------
69
70 // draw the header control button (used by wxListCtrl)
71 virtual void DrawHeaderButton(wxWindow *win,
72 wxDC& dc,
73 const wxRect& rect,
74 int flags = 0) = 0;
75
76 // draw the expanded/collapsed icon for a tree control item
77 virtual void DrawTreeItemButton(wxWindow *win,
78 wxDC& dc,
79 const wxRect& rect,
80 int flags = 0) = 0;
81
b3208e11
VZ
82 // draw the border for sash window: this border must be such that the sash
83 // drawn by DrawSash() blends into it well
84 virtual void DrawSplitterBorder(wxWindow *win,
85 wxDC& dc,
86 const wxRect& rect) = 0;
87
88 // draw a (vertical) sash
89 virtual void DrawSplitterSash(wxWindow *win,
90 wxDC& dc,
91 const wxSize& size,
62dc9cb4
VZ
92 wxCoord position,
93 wxOrientation orient) = 0;
b3208e11
VZ
94
95
96 // geometry functions
97 // ------------------
98
99 // get the splitter parameters: the x field of the returned point is the
100 // sash width and the y field is the border width
101 virtual wxPoint GetSplitterSashAndBorder(const wxWindow *win) = 0;
102
9c7f49f5
VZ
103
104 // pseudo constructors
105 // -------------------
106
107 // return the currently used renderer
108 static wxRendererNative& Get();
109
110 // return the generic implementation of the renderer
111 static wxRendererNative& GetGeneric();
112};
113
114// ----------------------------------------------------------------------------
115// wxDelegateRendererNative: allows reuse of renderers code
116// ----------------------------------------------------------------------------
117
118class WXDLLEXPORT wxDelegateRendererNative : public wxRendererNative
119{
120public:
121 wxDelegateRendererNative()
122 : m_rendererNative(GetGeneric()) { }
123
124 wxDelegateRendererNative(wxRendererNative& rendererNative)
125 : m_rendererNative(rendererNative) { }
126
127
128 virtual void DrawHeaderButton(wxWindow *win,
129 wxDC& dc,
130 const wxRect& rect,
131 int flags = 0)
132 { m_rendererNative.DrawHeaderButton(win, dc, rect, flags); }
b3208e11 133
9c7f49f5
VZ
134 virtual void DrawTreeItemButton(wxWindow *win,
135 wxDC& dc,
136 const wxRect& rect,
137 int flags = 0)
138 { m_rendererNative.DrawTreeItemButton(win, dc, rect, flags); }
139
b3208e11
VZ
140 virtual void DrawSplitterBorder(wxWindow *win,
141 wxDC& dc,
142 const wxRect& rect)
143 { m_rendererNative.DrawSplitterBorder(win, dc, rect); }
144
145 virtual void DrawSplitterSash(wxWindow *win,
146 wxDC& dc,
147 const wxSize& size,
62dc9cb4
VZ
148 wxCoord position,
149 wxOrientation orient)
150 { m_rendererNative.DrawSplitterSash(win, dc, size, position, orient); }
b3208e11
VZ
151
152
153 virtual wxPoint GetSplitterSashAndBorder(const wxWindow *win)
154 { return m_rendererNative.GetSplitterSashAndBorder(win); }
155
9c7f49f5
VZ
156protected:
157 wxRendererNative& m_rendererNative;
fc7a2a60
VZ
158
159 DECLARE_NO_COPY_CLASS(wxDelegateRendererNative)
9c7f49f5
VZ
160};
161
162#endif // _WX_RENDERER_H_
163