1 //////////////////////////////////////////////////////////////////////////////
2 // Name:        wx/aui/tabart.h
3 // Purpose:     wxaui: wx advanced user interface - notebook
4 // Author:      Benjamin I. Williams
5 // Modified by: Jens Lody (extracted from wx/aui/auibook.h)
6 // Created:     2012-03-21
7 // Copyright:   (C) Copyright 2006, Kirix Corporation, All Rights Reserved.
8 // Licence:     wxWindows Library Licence, Version 3.1
9 ///////////////////////////////////////////////////////////////////////////////
10 
11 
12 #ifndef _WX_AUI_TABART_H_
13 #define _WX_AUI_TABART_H_
14 
15 // ----------------------------------------------------------------------------
16 // headers
17 // ----------------------------------------------------------------------------
18 
19 #include "wx/defs.h"
20 
21 #if wxUSE_AUI
22 
23 #include "wx/colour.h"
24 #include "wx/gdicmn.h"
25 #include "wx/font.h"
26 #include "wx/pen.h"
27 #include "wx/brush.h"
28 #include "wx/bitmap.h"
29 
30 
31 class wxAuiNotebookPage;
32 class wxAuiNotebookPageArray;
33 class wxWindow;
34 class wxDC;
35 
36 
37 // tab art class
38 
39 class WXDLLIMPEXP_AUI wxAuiTabArt
40 {
41 public:
42 
wxAuiTabArt()43     wxAuiTabArt() { }
~wxAuiTabArt()44     virtual ~wxAuiTabArt() { }
45 
46     virtual wxAuiTabArt* Clone() = 0;
47     virtual void SetFlags(unsigned int flags) = 0;
48 
49     virtual void SetSizingInfo(const wxSize& tabCtrlSize,
50                                size_t tabCount) = 0;
51 
52     virtual void SetNormalFont(const wxFont& font) = 0;
53     virtual void SetSelectedFont(const wxFont& font) = 0;
54     virtual void SetMeasuringFont(const wxFont& font) = 0;
55     virtual void SetColour(const wxColour& colour) = 0;
56     virtual void SetActiveColour(const wxColour& colour) = 0;
57 
58     virtual void DrawBorder(
59                  wxDC& dc,
60                  wxWindow* wnd,
61                  const wxRect& rect) = 0;
62 
63     virtual void DrawBackground(
64                          wxDC& dc,
65                          wxWindow* wnd,
66                          const wxRect& rect) = 0;
67 
68     virtual void DrawTab(wxDC& dc,
69                          wxWindow* wnd,
70                          const wxAuiNotebookPage& pane,
71                          const wxRect& inRect,
72                          int closeButtonState,
73                          wxRect* outTabRect,
74                          wxRect* outButtonRect,
75                          int* xExtent) = 0;
76 
77     virtual void DrawButton(
78                          wxDC& dc,
79                          wxWindow* wnd,
80                          const wxRect& inRect,
81                          int bitmapId,
82                          int buttonState,
83                          int orientation,
84                          wxRect* outRect) = 0;
85 
86     virtual wxSize GetTabSize(
87                          wxDC& dc,
88                          wxWindow* wnd,
89                          const wxString& caption,
90                          const wxBitmap& bitmap,
91                          bool active,
92                          int closeButtonState,
93                          int* xExtent) = 0;
94 
95     virtual int ShowDropDown(
96                          wxWindow* wnd,
97                          const wxAuiNotebookPageArray& items,
98                          int activeIdx) = 0;
99 
100     virtual int GetIndentSize() = 0;
101 
102     virtual int GetBorderWidth(
103                          wxWindow* wnd) = 0;
104 
105     virtual int GetAdditionalBorderSpace(
106                          wxWindow* wnd) = 0;
107 
108     virtual int GetBestTabCtrlSize(
109                          wxWindow* wnd,
110                          const wxAuiNotebookPageArray& pages,
111                          const wxSize& requiredBmpSize) = 0;
112 
113     // Provide opportunity for subclasses to recalculate colours
UpdateColoursFromSystem()114     virtual void UpdateColoursFromSystem() {}
115 };
116 
117 
118 class WXDLLIMPEXP_AUI wxAuiGenericTabArt : public wxAuiTabArt
119 {
120 
121 public:
122 
123     wxAuiGenericTabArt();
124     virtual ~wxAuiGenericTabArt();
125 
126     wxAuiTabArt* Clone() wxOVERRIDE;
127     void SetFlags(unsigned int flags) wxOVERRIDE;
128     void SetSizingInfo(const wxSize& tabCtrlSize,
129                        size_t tabCount) wxOVERRIDE;
130 
131     void SetNormalFont(const wxFont& font) wxOVERRIDE;
132     void SetSelectedFont(const wxFont& font) wxOVERRIDE;
133     void SetMeasuringFont(const wxFont& font) wxOVERRIDE;
134     void SetColour(const wxColour& colour) wxOVERRIDE;
135     void SetActiveColour(const wxColour& colour) wxOVERRIDE;
136 
137     void DrawBorder(
138                  wxDC& dc,
139                  wxWindow* wnd,
140                  const wxRect& rect) wxOVERRIDE;
141 
142     void DrawBackground(
143                  wxDC& dc,
144                  wxWindow* wnd,
145                  const wxRect& rect) wxOVERRIDE;
146 
147     void DrawTab(wxDC& dc,
148                  wxWindow* wnd,
149                  const wxAuiNotebookPage& pane,
150                  const wxRect& inRect,
151                  int closeButtonState,
152                  wxRect* outTabRect,
153                  wxRect* outButtonRect,
154                  int* xExtent) wxOVERRIDE;
155 
156     void DrawButton(
157                  wxDC& dc,
158                  wxWindow* wnd,
159                  const wxRect& inRect,
160                  int bitmapId,
161                  int buttonState,
162                  int orientation,
163                  wxRect* outRect) wxOVERRIDE;
164 
165     int GetIndentSize() wxOVERRIDE;
166 
167     int GetBorderWidth(
168                  wxWindow* wnd) wxOVERRIDE;
169 
170     int GetAdditionalBorderSpace(
171                  wxWindow* wnd) wxOVERRIDE;
172 
173     wxSize GetTabSize(
174                  wxDC& dc,
175                  wxWindow* wnd,
176                  const wxString& caption,
177                  const wxBitmap& bitmap,
178                  bool active,
179                  int closeButtonState,
180                  int* xExtent) wxOVERRIDE;
181 
182     int ShowDropDown(
183                  wxWindow* wnd,
184                  const wxAuiNotebookPageArray& items,
185                  int activeIdx) wxOVERRIDE;
186 
187     int GetBestTabCtrlSize(wxWindow* wnd,
188                  const wxAuiNotebookPageArray& pages,
189                  const wxSize& requiredBmpSize) wxOVERRIDE;
190 
191     // Provide opportunity for subclasses to recalculate colours
192     virtual void UpdateColoursFromSystem() wxOVERRIDE;
193 
194 protected:
195 
196     wxFont m_normalFont;
197     wxFont m_selectedFont;
198     wxFont m_measuringFont;
199     wxColour m_baseColour;
200     wxPen m_baseColourPen;
201     wxPen m_borderPen;
202     wxBrush m_baseColourBrush;
203     wxColour m_activeColour;
204     wxBitmap m_activeCloseBmp;
205     wxBitmap m_disabledCloseBmp;
206     wxBitmap m_activeLeftBmp;
207     wxBitmap m_disabledLeftBmp;
208     wxBitmap m_activeRightBmp;
209     wxBitmap m_disabledRightBmp;
210     wxBitmap m_activeWindowListBmp;
211     wxBitmap m_disabledWindowListBmp;
212 
213     int m_fixedTabWidth;
214     int m_tabCtrlHeight;
215     unsigned int m_flags;
216 };
217 
218 
219 class WXDLLIMPEXP_AUI wxAuiSimpleTabArt : public wxAuiTabArt
220 {
221 
222 public:
223 
224     wxAuiSimpleTabArt();
225     virtual ~wxAuiSimpleTabArt();
226 
227     wxAuiTabArt* Clone() wxOVERRIDE;
228     void SetFlags(unsigned int flags) wxOVERRIDE;
229 
230     void SetSizingInfo(const wxSize& tabCtrlSize,
231                        size_t tabCount) wxOVERRIDE;
232 
233     void SetNormalFont(const wxFont& font) wxOVERRIDE;
234     void SetSelectedFont(const wxFont& font) wxOVERRIDE;
235     void SetMeasuringFont(const wxFont& font) wxOVERRIDE;
236     void SetColour(const wxColour& colour) wxOVERRIDE;
237     void SetActiveColour(const wxColour& colour) wxOVERRIDE;
238 
239     void DrawBorder(
240                  wxDC& dc,
241                  wxWindow* wnd,
242                  const wxRect& rect) wxOVERRIDE;
243 
244     void DrawBackground(
245                  wxDC& dc,
246                  wxWindow* wnd,
247                  const wxRect& rect) wxOVERRIDE;
248 
249     void DrawTab(wxDC& dc,
250                  wxWindow* wnd,
251                  const wxAuiNotebookPage& pane,
252                  const wxRect& inRect,
253                  int closeButtonState,
254                  wxRect* outTabRect,
255                  wxRect* outButtonRect,
256                  int* xExtent) wxOVERRIDE;
257 
258     void DrawButton(
259                  wxDC& dc,
260                  wxWindow* wnd,
261                  const wxRect& inRect,
262                  int bitmapId,
263                  int buttonState,
264                  int orientation,
265                  wxRect* outRect) wxOVERRIDE;
266 
267     int GetIndentSize() wxOVERRIDE;
268 
269     int GetBorderWidth(
270                  wxWindow* wnd) wxOVERRIDE;
271 
272     int GetAdditionalBorderSpace(
273                  wxWindow* wnd) wxOVERRIDE;
274 
275     wxSize GetTabSize(
276                  wxDC& dc,
277                  wxWindow* wnd,
278                  const wxString& caption,
279                  const wxBitmap& bitmap,
280                  bool active,
281                  int closeButtonState,
282                  int* xExtent) wxOVERRIDE;
283 
284     int ShowDropDown(
285                  wxWindow* wnd,
286                  const wxAuiNotebookPageArray& items,
287                  int activeIdx) wxOVERRIDE;
288 
289     int GetBestTabCtrlSize(wxWindow* wnd,
290                  const wxAuiNotebookPageArray& pages,
291                  const wxSize& requiredBmpSize) wxOVERRIDE;
292 
293 protected:
294 
295     wxFont m_normalFont;
296     wxFont m_selectedFont;
297     wxFont m_measuringFont;
298     wxPen m_normalBkPen;
299     wxPen m_selectedBkPen;
300     wxBrush m_normalBkBrush;
301     wxBrush m_selectedBkBrush;
302     wxBrush m_bkBrush;
303     wxBitmap m_activeCloseBmp;
304     wxBitmap m_disabledCloseBmp;
305     wxBitmap m_activeLeftBmp;
306     wxBitmap m_disabledLeftBmp;
307     wxBitmap m_activeRightBmp;
308     wxBitmap m_disabledRightBmp;
309     wxBitmap m_activeWindowListBmp;
310     wxBitmap m_disabledWindowListBmp;
311 
312     int m_fixedTabWidth;
313     unsigned int m_flags;
314 };
315 
316 #ifndef __WXUNIVERSAL__
317     #if defined(__WXGTK20__) && !defined(__WXGTK3__)
318         #define wxHAS_NATIVE_TABART
319         #include "wx/aui/tabartgtk.h"
320         #define wxAuiDefaultTabArt wxAuiGtkTabArt
321     #elif defined(__WXMSW__) && wxUSE_UXTHEME
322         #define wxHAS_NATIVE_TABART
323         #include "wx/aui/tabartmsw.h"
324         #define wxAuiDefaultTabArt wxAuiMSWTabArt
325     #endif
326 #endif // !__WXUNIVERSAL__
327 
328 #ifndef wxHAS_NATIVE_TABART
329     #define wxAuiDefaultTabArt wxAuiGenericTabArt
330 #endif
331 
332 #endif  // wxUSE_AUI
333 
334 #endif  // _WX_AUI_TABART_H_
335