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