]> git.saurik.com Git - wxWidgets.git/blame - src/univ/themes/mono.cpp
fix infinite recursion in DrawStatusField() after latest changes
[wxWidgets.git] / src / univ / themes / mono.cpp
CommitLineData
147b8a4a
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: src/univ/themes/mono.cpp
3// Purpose: wxUniversal theme for monochrome displays
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 2006-08-27
7// RCS-ID: $Id$
8// Copyright: (c) 2006 REA Elektronik GmbH
9// Licence: wxWindows licence
10///////////////////////////////////////////////////////////////////////////////
11
12// ===========================================================================
13// declarations
14// ===========================================================================
15
16// ---------------------------------------------------------------------------
17// headers
18// ---------------------------------------------------------------------------
19
20// for compilers that support precompilation, includes "wx.h".
21#include "wx/wxprec.h"
22
23#ifdef __BORLANDC__
24 #pragma hdrstop
25#endif
26
27#ifndef WX_PRECOMP
28#endif // WX_PRECOMP
29
3a01afec
VZ
30#include "wx/artprov.h"
31#include "wx/univ/stdrend.h"
147b8a4a
VZ
32#include "wx/univ/inphand.h"
33#include "wx/univ/colschem.h"
34#include "wx/univ/theme.h"
35
36class wxMonoColourScheme;
37
38#define wxMONO_BG_COL (*wxWHITE)
39#define wxMONO_FG_COL (*wxBLACK)
40
41// ----------------------------------------------------------------------------
42// wxMonoRenderer: draw the GUI elements in simplest possible way
43// ----------------------------------------------------------------------------
44
45// Warning: many of the methods here are not implemented, the code won't work
46// if any but a few wxUSE_XXXs are on
47class wxMonoRenderer : public wxStdRenderer
48{
49public:
50 wxMonoRenderer(const wxColourScheme *scheme);
51
147b8a4a
VZ
52 virtual void DrawButtonLabel(wxDC& dc,
53 const wxString& label,
54 const wxBitmap& image,
55 const wxRect& rect,
56 int flags = 0,
57 int alignment = wxALIGN_LEFT | wxALIGN_TOP,
58 int indexAccel = -1,
59 wxRect *rectBounds = NULL);
60
61 virtual void DrawBorder(wxDC& dc,
62 wxBorder border,
63 const wxRect& rect,
64 int flags = 0,
65 wxRect *rectIn = NULL);
66
147b8a4a
VZ
67 virtual void DrawButtonBorder(wxDC& dc,
68 const wxRect& rect,
69 int flags = 0,
70 wxRect *rectIn = NULL);
71
72 virtual void DrawHorizontalLine(wxDC& dc,
73 wxCoord y, wxCoord x1, wxCoord x2);
74
75 virtual void DrawVerticalLine(wxDC& dc,
76 wxCoord x, wxCoord y1, wxCoord y2);
77
147b8a4a
VZ
78 virtual void DrawArrow(wxDC& dc,
79 wxDirection dir,
80 const wxRect& rect,
81 int flags = 0);
147b8a4a
VZ
82 virtual void DrawScrollbarThumb(wxDC& dc,
83 wxOrientation orient,
84 const wxRect& rect,
85 int flags = 0);
147b8a4a
VZ
86 virtual void DrawScrollbarShaft(wxDC& dc,
87 wxOrientation orient,
88 const wxRect& rect,
89 int flags = 0);
90
147b8a4a
VZ
91#if wxUSE_TOOLBAR
92 virtual void DrawToolBarButton(wxDC& dc,
93 const wxString& label,
94 const wxBitmap& bitmap,
95 const wxRect& rect,
96 int flags = 0,
97 long style = 0,
98 int tbarStyle = 0);
99#endif // wxUSE_TOOLBAR
100
147b8a4a
VZ
101#if wxUSE_NOTEBOOK
102 virtual void DrawTab(wxDC& dc,
103 const wxRect& rect,
104 wxDirection dir,
105 const wxString& label,
106 const wxBitmap& bitmap = wxNullBitmap,
107 int flags = 0,
108 int indexAccel = -1);
109#endif // wxUSE_NOTEBOOK
110
111#if wxUSE_SLIDER
147b8a4a
VZ
112 virtual void DrawSliderShaft(wxDC& dc,
113 const wxRect& rect,
114 int lenThumb,
115 wxOrientation orient,
116 int flags = 0,
117 long style = 0,
118 wxRect *rectShaft = NULL);
119
120 virtual void DrawSliderThumb(wxDC& dc,
121 const wxRect& rect,
122 wxOrientation orient,
123 int flags = 0,
124 long style = 0);
125
126 virtual void DrawSliderTicks(wxDC& dc,
127 const wxRect& rect,
128 int lenThumb,
129 wxOrientation orient,
130 int start,
131 int end,
132 int step = 1,
133 int flags = 0,
134 long style = 0);
135#endif // wxUSE_SLIDER
136
137#if wxUSE_MENUS
138 virtual void DrawMenuBarItem(wxDC& dc,
139 const wxRect& rect,
140 const wxString& label,
141 int flags = 0,
142 int indexAccel = -1);
143
144 virtual void DrawMenuItem(wxDC& dc,
145 wxCoord y,
146 const wxMenuGeometryInfo& geometryInfo,
147 const wxString& label,
148 const wxString& accel,
149 const wxBitmap& bitmap = wxNullBitmap,
150 int flags = 0,
151 int indexAccel = -1);
152
153 virtual void DrawMenuSeparator(wxDC& dc,
154 wxCoord y,
155 const wxMenuGeometryInfo& geomInfo);
156#endif // wxUSE_MENUS
157
147b8a4a
VZ
158 virtual void DrawFrameTitleBar(wxDC& dc,
159 const wxRect& rect,
160 const wxString& title,
161 const wxIcon& icon,
162 int flags,
163 int specialButton = 0,
164 int specialButtonFlags = 0);
165
166 virtual void DrawFrameBorder(wxDC& dc,
167 const wxRect& rect,
168 int flags);
169
170 virtual void DrawFrameBackground(wxDC& dc,
171 const wxRect& rect,
172 int flags);
173
174 virtual void DrawFrameTitle(wxDC& dc,
175 const wxRect& rect,
176 const wxString& title,
177 int flags);
178
179 virtual void DrawFrameIcon(wxDC& dc,
180 const wxRect& rect,
181 const wxIcon& icon,
182 int flags);
183
184 virtual void DrawFrameButton(wxDC& dc,
185 wxCoord x, wxCoord y,
186 int button,
187 int flags = 0);
188
189
3a01afec 190#if wxUSE_COMBOBOX
147b8a4a
VZ
191 virtual void GetComboBitmaps(wxBitmap *bmpNormal,
192 wxBitmap *bmpFocus,
193 wxBitmap *bmpPressed,
194 wxBitmap *bmpDisabled);
3a01afec 195#endif // wxUSE_COMBOBOX
147b8a4a
VZ
196
197
198 virtual wxRect GetBorderDimensions(wxBorder border) const;
199
147b8a4a 200#if wxUSE_SCROLLBAR
3a01afec 201 virtual wxSize GetScrollbarArrowSize() const { return GetStdBmpSize(); }
147b8a4a
VZ
202#endif // wxUSE_SCROLLBAR
203
3a01afec
VZ
204 virtual wxSize GetCheckBitmapSize() const { return GetStdBmpSize(); }
205 virtual wxSize GetRadioBitmapSize() const { return GetStdBmpSize(); }
147b8a4a 206
2296981b 207#if wxUSE_TOOLBAR
147b8a4a
VZ
208 virtual wxSize GetToolBarButtonSize(wxCoord *separator) const;
209
210 virtual wxSize GetToolBarMargin() const;
2296981b 211#endif // wxUSE_TOOLBAR
147b8a4a 212
147b8a4a
VZ
213#if wxUSE_NOTEBOOK
214 virtual wxSize GetTabIndent() const;
215
216 virtual wxSize GetTabPadding() const;
217#endif // wxUSE_NOTEBOOK
218
219#if wxUSE_SLIDER
220 virtual wxCoord GetSliderDim() const;
221
222 virtual wxCoord GetSliderTickLen() const;
223
224 virtual wxRect GetSliderShaftRect(const wxRect& rect,
225 int lenThumb,
226 wxOrientation orient,
227 long style = 0) const;
228
229 virtual wxSize GetSliderThumbSize(const wxRect& rect,
230 int lenThumb,
231 wxOrientation orient) const;
232#endif // wxUSE_SLIDER
233
234 virtual wxSize GetProgressBarStep() const;
235
236#if wxUSE_MENUS
237 virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const;
238
239 virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win,
240 const wxMenu& menu) const;
241#endif // wxUSE_MENUS
242
147b8a4a
VZ
243 virtual wxRect GetFrameClientArea(const wxRect& rect, int flags) const;
244
245 virtual wxSize GetFrameTotalSize(const wxSize& clientSize, int flags) const;
246
247 virtual wxSize GetFrameMinSize(int flags) const;
248
249 virtual wxSize GetFrameIconSize() const;
250
251 virtual int HitTestFrame(const wxRect& rect,
252 const wxPoint& pt,
253 int flags = 0) const;
254
255protected:
3a01afec
VZ
256 // override base class border drawing routines: we always draw just a
257 // single simple border
258 void DrawSimpleBorder(wxDC& dc, wxRect *rect)
259 { DrawRect(dc, rect, m_penFg); }
260
261 virtual void DrawRaisedBorder(wxDC& dc, wxRect *rect)
262 { DrawSimpleBorder(dc, rect); }
263 virtual void DrawSunkenBorder(wxDC& dc, wxRect *rect)
264 { DrawSimpleBorder(dc, rect); }
265 virtual void DrawAntiSunkenBorder(wxDC& dc, wxRect *rect)
266 { DrawSimpleBorder(dc, rect); }
267 virtual void DrawFrameBorder(wxDC& dc, wxRect *rect)
268 { DrawSimpleBorder(dc, rect); }
269
270 // all our XPMs are of this size
271 static wxSize GetStdBmpSize() { return wxSize(8, 8); }
272
273 wxBitmap GetIndicator(IndicatorType indType, int flags);
274 virtual wxBitmap GetCheckBitmap(int flags)
275 { return GetIndicator(IndicatorType_Check, flags); }
276 virtual wxBitmap GetRadioBitmap(int flags)
277 { return GetIndicator(IndicatorType_Radio, flags); }
147b8a4a 278
3a01afec
VZ
279private:
280 // the bitmaps returned by GetIndicator()
281 wxBitmap m_bmpIndicators[IndicatorType_MaxCtrl]
282 [IndicatorState_MaxCtrl]
283 [IndicatorStatus_Max];
147b8a4a 284
3a01afec
VZ
285 static const char **ms_xpmIndicators[IndicatorType_MaxCtrl]
286 [IndicatorState_MaxCtrl]
287 [IndicatorStatus_Max];
147b8a4a 288
3a01afec
VZ
289 // the arrow bitmaps used by DrawArrow()
290 wxBitmap m_bmpArrows[Arrow_Max];
147b8a4a 291
3a01afec 292 static const char **ms_xpmArrows[Arrow_Max];
147b8a4a 293
3a01afec
VZ
294 // pen used for foreground drawing
295 wxPen m_penFg;
296};
147b8a4a 297
3a01afec
VZ
298// ----------------------------------------------------------------------------
299// standard bitmaps
300// ----------------------------------------------------------------------------
147b8a4a 301
3a01afec
VZ
302static const char *xpmUnchecked[] = {
303/* columns rows colors chars-per-pixel */
304"8 8 2 1",
305" c white",
306"X c black",
307/* pixels */
308"XXXXXXXX",
309"X X",
310"X X",
311"X X",
312"X X",
313"X X",
314"X X",
315"XXXXXXXX",
316};
147b8a4a 317
3a01afec
VZ
318static const char *xpmChecked[] = {
319/* columns rows colors chars-per-pixel */
320"8 8 2 1",
321" c white",
322"X c black",
323/* pixels */
324"XXXXXXXX",
325"X X",
326"X X X X",
327"X XX X",
328"X XX X",
329"X X X X",
330"X X",
331"XXXXXXXX",
332};
147b8a4a 333
3a01afec
VZ
334static const char *xpmUndeterminate[] = {
335/* columns rows colors chars-per-pixel */
336"8 8 2 1",
337" c white",
338"X c black",
339/* pixels */
340"XXXXXXXX",
341"X X X XX",
342"XX X X X",
343"X X X XX",
344"XX X X X",
345"X X X XX",
346"XX X X X",
347"XXXXXXXX",
348};
147b8a4a 349
3a01afec
VZ
350static const char *xpmRadioUnchecked[] = {
351/* columns rows colors chars-per-pixel */
352"8 8 2 1",
353" c white",
354"X c black",
355/* pixels */
356"XXXXXXXX",
357"X X",
358"X XX X",
359"X X X X",
360"X X X X",
361"X XX X",
362"X X",
363"XXXXXXXX",
364};
147b8a4a 365
3a01afec
VZ
366static const char *xpmRadioChecked[] = {
367/* columns rows colors chars-per-pixel */
368"8 8 2 1",
369" c white",
370"X c black",
371/* pixels */
372"XXXXXXXX",
373"X X",
374"X XX X",
375"X XXXX X",
376"X XXXX X",
377"X XX X",
378"X X",
379"XXXXXXXX",
380};
381
382const char **wxMonoRenderer::ms_xpmIndicators[IndicatorType_MaxCtrl]
383 [IndicatorState_MaxCtrl]
384 [IndicatorStatus_Max] =
385{
386 // checkboxes first
147b8a4a 387 {
3a01afec
VZ
388 // normal state
389 { xpmChecked, xpmUnchecked, xpmUndeterminate },
390
391 // pressed state
392 { xpmUndeterminate, xpmUndeterminate, xpmUndeterminate },
393
394 // disabled state
395 { xpmUndeterminate, xpmUndeterminate, xpmUndeterminate },
396 },
397
398 // radio
399 {
400 // normal state
401 { xpmRadioChecked, xpmRadioUnchecked, xpmUndeterminate },
402
403 // pressed state
404 { xpmUndeterminate, xpmUndeterminate, xpmUndeterminate },
405
406 // disabled state
407 { xpmUndeterminate, xpmUndeterminate, xpmUndeterminate },
408 },
147b8a4a
VZ
409};
410
3a01afec
VZ
411static const char *xpmLeftArrow[] = {
412/* columns rows colors chars-per-pixel */
413"8 8 2 1",
414" c white",
415"X c black",
416/* pixels */
417" X ",
418" XX ",
419" XXX ",
420"XXXX ",
421"XXXX ",
422" XXX ",
423" XX ",
424" X ",
425};
147b8a4a 426
3a01afec
VZ
427static const char *xpmRightArrow[] = {
428/* columns rows colors chars-per-pixel */
429"8 8 2 1",
430" c white",
431"X c black",
432/* pixels */
433" X ",
434" XX ",
435" XXX ",
436" XXXX",
437" XXXX",
438" XXX ",
439" XX ",
440" X ",
441};
147b8a4a 442
3a01afec
VZ
443static const char *xpmUpArrow[] = {
444/* columns rows colors chars-per-pixel */
445"8 8 2 1",
446" c white",
447"X c black",
448/* pixels */
449" ",
450" XX ",
451" XXXX ",
452" XXXXXX ",
453"XXXXXXXX",
454" ",
455" ",
456" ",
457};
147b8a4a 458
3a01afec
VZ
459static const char *xpmDownArrow[] = {
460/* columns rows colors chars-per-pixel */
461"8 8 2 1",
462" c white",
463"X c black",
464/* pixels */
465" ",
466" ",
467" ",
468"XXXXXXXX",
469" XXXXXX ",
470" XXXX ",
471" XX ",
472" ",
473};
474
475const char **wxMonoRenderer::ms_xpmArrows[Arrow_Max] =
476{
477 xpmLeftArrow, xpmRightArrow, xpmUpArrow, xpmDownArrow,
147b8a4a
VZ
478};
479
480// ----------------------------------------------------------------------------
481// wxMonoColourScheme: uses just white and black
482// ----------------------------------------------------------------------------
483
484class wxMonoColourScheme : public wxColourScheme
485{
486public:
487 // we use only 2 colours, white and black, but we avoid referring to them
488 // like this, instead use the functions below
489 wxColour GetFg() const { return wxMONO_FG_COL; }
490 wxColour GetBg() const { return wxMONO_BG_COL; }
491
492 // implement base class pure virtuals
493 virtual wxColour Get(StdColour col) const;
494 virtual wxColour GetBackground(wxWindow *win) const;
495};
496
497// ----------------------------------------------------------------------------
498// wxMonoArtProvider
499// ----------------------------------------------------------------------------
500
501class wxMonoArtProvider : public wxArtProvider
502{
503protected:
504 virtual wxBitmap CreateBitmap(const wxArtID& id,
505 const wxArtClient& client,
506 const wxSize& size);
507};
508
509// ----------------------------------------------------------------------------
510// wxMonoTheme
511// ----------------------------------------------------------------------------
512
147b8a4a
VZ
513class wxMonoTheme : public wxTheme
514{
515public:
516 wxMonoTheme();
517 virtual ~wxMonoTheme();
518
519 virtual wxRenderer *GetRenderer();
520 virtual wxArtProvider *GetArtProvider();
3a01afec
VZ
521 virtual wxInputHandler *GetInputHandler(const wxString& control,
522 wxInputConsumer *consumer);
147b8a4a
VZ
523 virtual wxColourScheme *GetColourScheme();
524
525private:
526 wxMonoRenderer *m_renderer;
527 wxMonoArtProvider *m_artProvider;
528 wxMonoColourScheme *m_scheme;
529
3a01afec 530 WX_DECLARE_THEME(mono)
147b8a4a
VZ
531};
532
533// ============================================================================
534// implementation
535// ============================================================================
536
537WX_IMPLEMENT_THEME(wxMonoTheme, mono, wxTRANSLATE("Simple monochrome theme"));
538
539// ----------------------------------------------------------------------------
540// wxMonoTheme
541// ----------------------------------------------------------------------------
542
543wxMonoTheme::wxMonoTheme()
544{
545 m_scheme = NULL;
546 m_renderer = NULL;
547 m_artProvider = NULL;
548}
549
550wxMonoTheme::~wxMonoTheme()
551{
552 delete m_renderer;
553 delete m_scheme;
554 wxArtProvider::RemoveProvider(m_artProvider);
555}
556
557wxRenderer *wxMonoTheme::GetRenderer()
558{
559 if ( !m_renderer )
560 {
561 m_renderer = new wxMonoRenderer(GetColourScheme());
562 }
563
564 return m_renderer;
565}
566
567wxArtProvider *wxMonoTheme::GetArtProvider()
568{
569 if ( !m_artProvider )
570 {
571 m_artProvider = new wxMonoArtProvider;
572 }
573
574 return m_artProvider;
575}
576
577wxColourScheme *wxMonoTheme::GetColourScheme()
578{
579 if ( !m_scheme )
580 {
581 m_scheme = new wxMonoColourScheme;
582 }
583
584 return m_scheme;
585}
586
587wxInputHandler *wxMonoTheme::GetInputHandler(const wxString& WXUNUSED(control),
588 wxInputConsumer *consumer)
589{
590 // no special input handlers so far
591 return consumer->DoGetStdInputHandler(NULL);
592}
593
594// ============================================================================
595// wxMonoColourScheme
596// ============================================================================
597
598wxColour wxMonoColourScheme::GetBackground(wxWindow *win) const
599{
600 wxColour col;
601 if ( win->UseBgCol() )
602 {
603 // use the user specified colour
604 col = win->GetBackgroundColour();
605 }
606
607 // doesn't depend on the state
608 if ( !col.Ok() )
609 {
610 col = GetBg();
611 }
3a01afec
VZ
612
613 return col;
147b8a4a
VZ
614}
615
616wxColour wxMonoColourScheme::Get(wxMonoColourScheme::StdColour col) const
617{
618 switch ( col )
619 {
620 case WINDOW:
621 case CONTROL:
622 case CONTROL_PRESSED:
623 case CONTROL_CURRENT:
624 case SCROLLBAR:
625 case SCROLLBAR_PRESSED:
626 case GAUGE:
627 case HIGHLIGHT:
628 case TITLEBAR:
629 case TITLEBAR_ACTIVE:
630 case DESKTOP:
631 return GetBg();
632
633 case MAX:
634 default:
635 wxFAIL_MSG(_T("invalid standard colour"));
636 // fall through
637
638 case SHADOW_DARK:
639 case SHADOW_HIGHLIGHT:
640 case SHADOW_IN:
641 case SHADOW_OUT:
642 case CONTROL_TEXT:
643 case CONTROL_TEXT_DISABLED:
644 case CONTROL_TEXT_DISABLED_SHADOW:
645 case HIGHLIGHT_TEXT:
646 case TITLEBAR_TEXT:
647 case TITLEBAR_ACTIVE_TEXT:
648 return GetFg();
649
650 }
651}
652
653// ============================================================================
654// wxMonoRenderer
655// ============================================================================
656
657// ----------------------------------------------------------------------------
658// construction
659// ----------------------------------------------------------------------------
660
661wxMonoRenderer::wxMonoRenderer(const wxColourScheme *scheme)
662 : wxStdRenderer(scheme)
663{
3a01afec 664 m_penFg = wxPen(wxMONO_FG_COL);
147b8a4a
VZ
665}
666
667// ----------------------------------------------------------------------------
3a01afec 668// borders
147b8a4a
VZ
669// ----------------------------------------------------------------------------
670
2296981b
VZ
671wxRect wxMonoRenderer::GetBorderDimensions(wxBorder border) const
672{
673 wxCoord width;
674 switch ( border )
675 {
676 case wxBORDER_SIMPLE:
677 case wxBORDER_STATIC:
678 case wxBORDER_RAISED:
679 case wxBORDER_SUNKEN:
680 width = 1;
681 break;
682
683 case wxBORDER_DOUBLE:
684 width = 2;
685 break;
686
687 default:
688 wxFAIL_MSG(_T("unknown border type"));
689 // fall through
690
691 case wxBORDER_DEFAULT:
692 case wxBORDER_NONE:
693 width = 0;
694 break;
695 }
696
697 wxRect rect;
698 rect.x =
699 rect.y =
700 rect.width =
701 rect.height = width;
702
703 return rect;
704}
705
3a01afec
VZ
706void wxMonoRenderer::DrawBorder(wxDC& dc,
707 wxBorder border,
708 const wxRect& rectTotal,
709 int WXUNUSED(flags),
710 wxRect *rectIn)
147b8a4a 711{
3a01afec
VZ
712 wxRect rect = rectTotal;
713
714 switch ( border )
715 {
716 case wxBORDER_DOUBLE:
717 DrawSimpleBorder(dc, &rect);
718 // fall through
719
720 case wxBORDER_SUNKEN:
721 case wxBORDER_STATIC:
722 case wxBORDER_RAISED:
723 case wxBORDER_SIMPLE:
724 DrawSimpleBorder(dc, &rect);
725 break;
726
727 default:
728 wxFAIL_MSG(_T("unknown border type"));
729 // fall through
730
731 case wxBORDER_DEFAULT:
732 case wxBORDER_NONE:
733 break;
734 }
735
736 if ( rectIn )
737 *rectIn = rect;
147b8a4a
VZ
738}
739
740void wxMonoRenderer::DrawButtonBorder(wxDC& dc,
3a01afec 741 const wxRect& rect,
147b8a4a
VZ
742 int flags,
743 wxRect *rectIn)
744{
3a01afec 745 DrawBorder(dc, wxBORDER_SIMPLE, rect, flags, rectIn);
147b8a4a
VZ
746}
747
748// ----------------------------------------------------------------------------
749// lines and frames
750// ----------------------------------------------------------------------------
751
752void
753wxMonoRenderer::DrawHorizontalLine(wxDC& dc, wxCoord y, wxCoord x1, wxCoord x2)
754{
755 dc.SetPen(m_penFg);
756 dc.DrawLine(x1, y, x2 + 1, y);
757}
758
759void
760wxMonoRenderer::DrawVerticalLine(wxDC& dc, wxCoord x, wxCoord y1, wxCoord y2)
761{
762 dc.SetPen(m_penFg);
763 dc.DrawLine(x, y1, x, y2 + 1);
764}
765
147b8a4a
VZ
766// ----------------------------------------------------------------------------
767// label
768// ----------------------------------------------------------------------------
769
147b8a4a 770void wxMonoRenderer::DrawButtonLabel(wxDC& dc,
3a01afec
VZ
771 const wxString& label,
772 const wxBitmap& image,
773 const wxRect& rect,
774 int flags,
775 int alignment,
776 int indexAccel,
777 wxRect *rectBounds)
147b8a4a 778{
3a01afec 779 dc.SetTextForeground(m_penFg.GetColour());
147b8a4a
VZ
780 dc.DrawLabel(label, image, rect, alignment, indexAccel, rectBounds);
781
782 if ( flags & wxCONTROL_DISABLED )
783 {
784 // this is ugly but I don't know how to show disabled button visually
3a01afec 785 // in monochrome theme otherwise, so cross it out
147b8a4a
VZ
786 dc.SetPen(m_penFg);
787 dc.DrawLine(rect.GetTopLeft(), rect.GetBottomRight());
788 dc.DrawLine(rect.GetTopRight(), rect.GetBottomLeft());
789 }
790}
791
147b8a4a
VZ
792// ----------------------------------------------------------------------------
793// check/radion buttons
794// ----------------------------------------------------------------------------
795
3a01afec 796wxBitmap wxMonoRenderer::GetIndicator(IndicatorType indType, int flags)
147b8a4a 797{
3a01afec
VZ
798 IndicatorState indState;
799 IndicatorStatus indStatus;
800 GetIndicatorsFromFlags(flags, indState, indStatus);
147b8a4a 801
3a01afec
VZ
802 wxBitmap& bmp = m_bmpIndicators[indType][indState][indStatus];
803 if ( !bmp.Ok() )
147b8a4a 804 {
3a01afec
VZ
805 const char **xpm = ms_xpmIndicators[indType][indState][indStatus];
806 if ( xpm )
147b8a4a 807 {
3a01afec
VZ
808 // create and cache it
809 bmp = wxBitmap(xpm);
147b8a4a 810 }
147b8a4a
VZ
811 }
812
3a01afec 813 return bmp;
147b8a4a
VZ
814}
815
3a01afec
VZ
816// ----------------------------------------------------------------------------
817// toolbar
818// ----------------------------------------------------------------------------
147b8a4a
VZ
819
820#if wxUSE_TOOLBAR
3a01afec 821
147b8a4a 822void wxMonoRenderer::DrawToolBarButton(wxDC& dc,
3a01afec
VZ
823 const wxString& label,
824 const wxBitmap& bitmap,
825 const wxRect& rect,
826 int flags,
827 long style,
828 int tbarStyle)
147b8a4a 829{
3a01afec 830 wxFAIL_MSG(_T("TODO"));
147b8a4a 831}
3a01afec 832
2296981b
VZ
833wxSize wxMonoRenderer::GetToolBarButtonSize(wxCoord *separator) const
834{
835 wxFAIL_MSG(_T("TODO"));
836
837 return wxSize();
838}
839
840wxSize wxMonoRenderer::GetToolBarMargin() const
841{
842 wxFAIL_MSG(_T("TODO"));
843
844 return wxSize();
845}
846
147b8a4a
VZ
847#endif // wxUSE_TOOLBAR
848
849// ----------------------------------------------------------------------------
3a01afec 850// notebook
147b8a4a
VZ
851// ----------------------------------------------------------------------------
852
3a01afec 853#if wxUSE_NOTEBOOK
147b8a4a 854
3a01afec
VZ
855void wxMonoRenderer::DrawTab(wxDC& dc,
856 const wxRect& rect,
857 wxDirection dir,
858 const wxString& label,
859 const wxBitmap& bitmap,
860 int flags,
861 int indexAccel)
147b8a4a 862{
3a01afec 863 wxFAIL_MSG(_T("TODO"));
147b8a4a
VZ
864}
865
2296981b
VZ
866wxSize wxMonoRenderer::GetTabIndent() const
867{
868 wxFAIL_MSG(_T("TODO"));
869
870 return wxSize();
871}
872
873wxSize wxMonoRenderer::GetTabPadding() const
874{
875 wxFAIL_MSG(_T("TODO"));
876
877 return wxSize();
878}
879
3a01afec 880#endif // wxUSE_NOTEBOOK
147b8a4a
VZ
881
882// ----------------------------------------------------------------------------
883// combobox
884// ----------------------------------------------------------------------------
885
886#if wxUSE_COMBOBOX
887
147b8a4a
VZ
888void wxMonoRenderer::GetComboBitmaps(wxBitmap *bmpNormal,
889 wxBitmap *bmpFocus,
890 wxBitmap *bmpPressed,
891 wxBitmap *bmpDisabled)
892{
3a01afec 893 wxFAIL_MSG(_T("TODO"));
147b8a4a
VZ
894}
895
896#endif // wxUSE_COMBOBOX
897
2296981b
VZ
898// ----------------------------------------------------------------------------
899// menus
900// ----------------------------------------------------------------------------
901
902#if wxUSE_MENUS
903
904void wxMonoRenderer::DrawMenuBarItem(wxDC& dc,
905 const wxRect& rect,
906 const wxString& label,
907 int flags,
908 int indexAccel)
909{
910 wxFAIL_MSG(_T("TODO"));
911}
912
913void wxMonoRenderer::DrawMenuItem(wxDC& dc,
914 wxCoord y,
915 const wxMenuGeometryInfo& geometryInfo,
916 const wxString& label,
917 const wxString& accel,
918 const wxBitmap& bitmap,
919 int flags,
920 int indexAccel)
921{
922 wxFAIL_MSG(_T("TODO"));
923}
924
925void wxMonoRenderer::DrawMenuSeparator(wxDC& dc,
926 wxCoord y,
927 const wxMenuGeometryInfo& geomInfo)
928{
929 wxFAIL_MSG(_T("TODO"));
930}
931
932wxSize wxMonoRenderer::GetMenuBarItemSize(const wxSize& sizeText) const
933{
934 wxFAIL_MSG(_T("TODO"));
935
936 return wxSize();
937}
938
939wxMenuGeometryInfo *wxMonoRenderer::GetMenuGeometry(wxWindow *win,
940 const wxMenu& menu) const
941{
942 wxFAIL_MSG(_T("TODO"));
943
944 return NULL;
945}
946
947#endif // wxUSE_MENUS
948
949// ----------------------------------------------------------------------------
950// slider
951// ----------------------------------------------------------------------------
952
953#if wxUSE_SLIDER
954
955void wxMonoRenderer::DrawSliderShaft(wxDC& dc,
956 const wxRect& rect,
957 int lenThumb,
958 wxOrientation orient,
959 int flags,
960 long style,
961 wxRect *rectShaft)
962{
963 wxFAIL_MSG(_T("TODO"));
964}
965
966
967void wxMonoRenderer::DrawSliderThumb(wxDC& dc,
968 const wxRect& rect,
969 wxOrientation orient,
970 int flags,
971 long style)
972{
973 wxFAIL_MSG(_T("TODO"));
974}
975
976void wxMonoRenderer::DrawSliderTicks(wxDC& dc,
977 const wxRect& rect,
978 int lenThumb,
979 wxOrientation orient,
980 int start,
981 int end,
982 int step,
983 int flags,
984 long style)
985{
986 wxFAIL_MSG(_T("TODO"));
987}
988
989wxCoord wxMonoRenderer::GetSliderDim() const
990{
991 wxFAIL_MSG(_T("TODO"));
992
993 return 0;
994}
995
996wxCoord wxMonoRenderer::GetSliderTickLen() const
997{
998 wxFAIL_MSG(_T("TODO"));
999
1000 return 0;
1001}
1002
1003
1004wxRect wxMonoRenderer::GetSliderShaftRect(const wxRect& rect,
1005 int lenThumb,
1006 wxOrientation orient,
1007 long style) const
1008{
1009 wxFAIL_MSG(_T("TODO"));
1010
1011 return wxRect();
1012}
1013
1014wxSize wxMonoRenderer::GetSliderThumbSize(const wxRect& rect,
1015 int lenThumb,
1016 wxOrientation orient) const
1017{
1018 wxFAIL_MSG(_T("TODO"));
1019
1020 return wxSize();
1021}
1022
1023#endif // wxUSE_SLIDER
1024
1025wxSize wxMonoRenderer::GetProgressBarStep() const
1026{
1027 wxFAIL_MSG(_T("TODO"));
1028
1029 return wxSize();
1030}
1031
1032
147b8a4a
VZ
1033// ----------------------------------------------------------------------------
1034// scrollbar
1035// ----------------------------------------------------------------------------
1036
147b8a4a 1037void wxMonoRenderer::DrawArrow(wxDC& dc,
3a01afec
VZ
1038 wxDirection dir,
1039 const wxRect& rect,
1040 int WXUNUSED(flags))
147b8a4a 1041{
3a01afec
VZ
1042 ArrowDirection arrowDir = GetArrowDirection(dir);
1043 wxCHECK_RET( arrowDir != Arrow_Max, _T("invalid arrow direction") );
147b8a4a 1044
3a01afec
VZ
1045 wxBitmap& bmp = m_bmpArrows[arrowDir];
1046 if ( !bmp.Ok() )
147b8a4a 1047 {
3a01afec 1048 bmp = wxBitmap(ms_xpmArrows[arrowDir]);
147b8a4a 1049 }
147b8a4a 1050
3a01afec
VZ
1051 wxRect rectArrow(0, 0, bmp.GetWidth(), bmp.GetHeight());
1052 dc.DrawBitmap(bmp, rectArrow.CentreIn(rect).GetPosition(), true /* use mask */);
147b8a4a
VZ
1053}
1054
1055void wxMonoRenderer::DrawScrollbarThumb(wxDC& dc,
3a01afec
VZ
1056 wxOrientation WXUNUSED(orient),
1057 const wxRect& rect,
1058 int WXUNUSED(flags))
147b8a4a 1059{
3a01afec 1060 DrawSolidRect(dc, wxMONO_FG_COL, rect);
147b8a4a
VZ
1061}
1062
1063void wxMonoRenderer::DrawScrollbarShaft(wxDC& dc,
3a01afec
VZ
1064 wxOrientation WXUNUSED(orient),
1065 const wxRect& rect,
1066 int WXUNUSED(flags))
147b8a4a 1067{
3a01afec 1068 DrawSolidRect(dc, wxMONO_BG_COL, rect);
147b8a4a
VZ
1069}
1070
1071// ----------------------------------------------------------------------------
1072// top level windows
1073// ----------------------------------------------------------------------------
1074
1075void wxMonoRenderer::DrawFrameTitleBar(wxDC& WXUNUSED(dc),
1076 const wxRect& WXUNUSED(rect),
1077 const wxString& WXUNUSED(title),
1078 const wxIcon& WXUNUSED(icon),
1079 int WXUNUSED(flags),
1080 int WXUNUSED(specialButton),
1081 int WXUNUSED(specialButtonFlag))
1082{
1083}
1084
1085void wxMonoRenderer::DrawFrameBorder(wxDC& WXUNUSED(dc),
1086 const wxRect& WXUNUSED(rect),
1087 int WXUNUSED(flags))
1088{
1089}
1090
1091void wxMonoRenderer::DrawFrameBackground(wxDC& WXUNUSED(dc),
1092 const wxRect& WXUNUSED(rect),
1093 int WXUNUSED(flags))
1094{
1095}
1096
1097void wxMonoRenderer::DrawFrameTitle(wxDC& WXUNUSED(dc),
1098 const wxRect& WXUNUSED(rect),
1099 const wxString& WXUNUSED(title),
1100 int WXUNUSED(flags))
1101{
1102}
1103
1104void wxMonoRenderer::DrawFrameIcon(wxDC& WXUNUSED(dc),
1105 const wxRect& WXUNUSED(rect),
1106 const wxIcon& WXUNUSED(icon),
1107 int WXUNUSED(flags))
1108{
1109}
1110
1111void wxMonoRenderer::DrawFrameButton(wxDC& WXUNUSED(dc),
1112 wxCoord WXUNUSED(x),
1113 wxCoord WXUNUSED(y),
1114 int WXUNUSED(button),
1115 int WXUNUSED(flags))
1116{
1117}
1118
1119wxRect
1120wxMonoRenderer::GetFrameClientArea(const wxRect& rect,
1121 int WXUNUSED(flags)) const
1122{
1123 return rect;
1124}
1125
1126wxSize
1127wxMonoRenderer::GetFrameTotalSize(const wxSize& clientSize,
1128 int WXUNUSED(flags)) const
1129{
1130 return clientSize;
1131}
1132
1133wxSize wxMonoRenderer::GetFrameMinSize(int WXUNUSED(flags)) const
1134{
1135 return wxSize(0,0);
1136}
1137
1138wxSize wxMonoRenderer::GetFrameIconSize() const
1139{
1140 return wxSize(wxDefaultCoord, wxDefaultCoord);
1141}
1142
1143int
1144wxMonoRenderer::HitTestFrame(const wxRect& WXUNUSED(rect),
1145 const wxPoint& WXUNUSED(pt),
1146 int WXUNUSED(flags)) const
1147{
1148 return wxHT_TOPLEVEL_CLIENT_AREA;
1149}
1150
1151
1152// ----------------------------------------------------------------------------
3a01afec 1153// wxMonoArtProvider
147b8a4a
VZ
1154// ----------------------------------------------------------------------------
1155
3a01afec
VZ
1156wxBitmap wxMonoArtProvider::CreateBitmap(const wxArtID& WXUNUSED(id),
1157 const wxArtClient& WXUNUSED(client),
1158 const wxSize& WXUNUSED(size))
147b8a4a 1159{
147b8a4a
VZ
1160 return wxNullBitmap;
1161}
1162