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