]> git.saurik.com Git - wxWidgets.git/blob - src/univ/themes/mono.cpp
Fix discrepancy between different ways of measuring text extents under Mac.
[wxWidgets.git] / src / univ / themes / mono.cpp
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 #include "wx/univ/theme.h"
28
29 #if wxUSE_THEME_MONO
30
31 #ifndef WX_PRECOMP
32 #include "wx/window.h"
33 #include "wx/dc.h"
34 #endif // WX_PRECOMP
35
36 #include "wx/artprov.h"
37 #include "wx/univ/stdrend.h"
38 #include "wx/univ/inphand.h"
39 #include "wx/univ/colschem.h"
40
41 class 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
52 class wxMonoRenderer : public wxStdRenderer
53 {
54 public:
55 wxMonoRenderer(const wxColourScheme *scheme);
56
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);
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
73 virtual void DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, int flags = 0);
74
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
86 virtual void DrawArrow(wxDC& dc,
87 wxDirection dir,
88 const wxRect& rect,
89 int flags = 0);
90 virtual void DrawScrollbarThumb(wxDC& dc,
91 wxOrientation orient,
92 const wxRect& rect,
93 int flags = 0);
94 virtual void DrawScrollbarShaft(wxDC& dc,
95 wxOrientation orient,
96 const wxRect& rect,
97 int flags = 0);
98
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
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
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
166 #if wxUSE_COMBOBOX
167 virtual void GetComboBitmaps(wxBitmap *bmpNormal,
168 wxBitmap *bmpFocus,
169 wxBitmap *bmpPressed,
170 wxBitmap *bmpDisabled);
171 #endif // wxUSE_COMBOBOX
172
173
174 virtual wxRect GetBorderDimensions(wxBorder border) const;
175
176 #if wxUSE_SCROLLBAR
177 virtual wxSize GetScrollbarArrowSize() const { return GetStdBmpSize(); }
178 #endif // wxUSE_SCROLLBAR
179
180 virtual wxSize GetCheckBitmapSize() const { return GetStdBmpSize(); }
181 virtual wxSize GetRadioBitmapSize() const { return GetStdBmpSize(); }
182
183 #if wxUSE_TOOLBAR
184 virtual wxSize GetToolBarButtonSize(wxCoord *separator) const;
185
186 virtual wxSize GetToolBarMargin() const;
187 #endif // wxUSE_TOOLBAR
188
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
219 #if wxUSE_STATUSBAR
220 virtual wxCoord GetStatusBarBorderBetweenFields() const;
221
222 virtual wxSize GetStatusBarFieldMargins() const;
223 #endif // wxUSE_STATUSBAR
224
225 protected:
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); }
237 virtual void DrawBoxBorder(wxDC& dc, wxRect *rect)
238 { DrawSimpleBorder(dc, rect); }
239 virtual void DrawStaticBorder(wxDC& dc, wxRect *rect)
240 { DrawSimpleBorder(dc, rect); }
241 virtual void DrawExtraBorder(wxDC& WXUNUSED(dc), wxRect * WXUNUSED(rect))
242 { /* no extra borders for us */ }
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); }
252
253 virtual wxBitmap GetFrameButtonBitmap(FrameButtonType type);
254 virtual int GetFrameBorderWidth(int flags) const;
255
256 private:
257 // the bitmaps returned by GetIndicator()
258 wxBitmap m_bmpIndicators[IndicatorType_MaxCtrl]
259 [IndicatorState_MaxCtrl]
260 [IndicatorStatus_Max];
261
262 static const char **ms_xpmIndicators[IndicatorType_MaxCtrl]
263 [IndicatorState_MaxCtrl]
264 [IndicatorStatus_Max];
265
266 // the arrow bitmaps used by DrawArrow()
267 wxBitmap m_bmpArrows[Arrow_Max];
268
269 static const char **ms_xpmArrows[Arrow_Max];
270
271 // the close bitmap for the frame for GetFrameButtonBitmap()
272 wxBitmap m_bmpFrameClose;
273
274 // pen used for foreground drawing
275 wxPen m_penFg;
276 };
277
278 // ----------------------------------------------------------------------------
279 // standard bitmaps
280 // ----------------------------------------------------------------------------
281
282 static 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 };
297
298 static 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 };
313
314 static 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 };
329
330 static 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 };
345
346 static 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
362 const char **wxMonoRenderer::ms_xpmIndicators[IndicatorType_MaxCtrl]
363 [IndicatorState_MaxCtrl]
364 [IndicatorStatus_Max] =
365 {
366 // checkboxes first
367 {
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 },
389 };
390
391 static 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 };
406
407 static 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 };
422
423 static 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 };
438
439 static 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
455 const char **wxMonoRenderer::ms_xpmArrows[Arrow_Max] =
456 {
457 xpmLeftArrow, xpmRightArrow, xpmUpArrow, xpmDownArrow,
458 };
459
460 // ----------------------------------------------------------------------------
461 // wxMonoColourScheme: uses just white and black
462 // ----------------------------------------------------------------------------
463
464 class wxMonoColourScheme : public wxColourScheme
465 {
466 public:
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
481 class wxMonoArtProvider : public wxArtProvider
482 {
483 protected:
484 virtual wxBitmap CreateBitmap(const wxArtID& id,
485 const wxArtClient& client,
486 const wxSize& size);
487 };
488
489 // ----------------------------------------------------------------------------
490 // wxMonoTheme
491 // ----------------------------------------------------------------------------
492
493 class wxMonoTheme : public wxTheme
494 {
495 public:
496 wxMonoTheme();
497 virtual ~wxMonoTheme();
498
499 virtual wxRenderer *GetRenderer();
500 virtual wxArtProvider *GetArtProvider();
501 virtual wxInputHandler *GetInputHandler(const wxString& control,
502 wxInputConsumer *consumer);
503 virtual wxColourScheme *GetColourScheme();
504
505 private:
506 wxMonoRenderer *m_renderer;
507 wxMonoArtProvider *m_artProvider;
508 wxMonoColourScheme *m_scheme;
509
510 WX_DECLARE_THEME(mono)
511 };
512
513 // ============================================================================
514 // implementation
515 // ============================================================================
516
517 WX_IMPLEMENT_THEME(wxMonoTheme, mono, wxTRANSLATE("Simple monochrome theme"));
518
519 // ----------------------------------------------------------------------------
520 // wxMonoTheme
521 // ----------------------------------------------------------------------------
522
523 wxMonoTheme::wxMonoTheme()
524 {
525 m_scheme = NULL;
526 m_renderer = NULL;
527 m_artProvider = NULL;
528 }
529
530 wxMonoTheme::~wxMonoTheme()
531 {
532 delete m_renderer;
533 delete m_scheme;
534 delete m_artProvider;
535 }
536
537 wxRenderer *wxMonoTheme::GetRenderer()
538 {
539 if ( !m_renderer )
540 {
541 m_renderer = new wxMonoRenderer(GetColourScheme());
542 }
543
544 return m_renderer;
545 }
546
547 wxArtProvider *wxMonoTheme::GetArtProvider()
548 {
549 if ( !m_artProvider )
550 {
551 m_artProvider = new wxMonoArtProvider;
552 }
553
554 return m_artProvider;
555 }
556
557 wxColourScheme *wxMonoTheme::GetColourScheme()
558 {
559 if ( !m_scheme )
560 {
561 m_scheme = new wxMonoColourScheme;
562 }
563
564 return m_scheme;
565 }
566
567 wxInputHandler *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
578 wxColour 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 }
592
593 return col;
594 }
595
596 wxColour 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:
607 case TITLEBAR:
608 case TITLEBAR_ACTIVE:
609 case HIGHLIGHT_TEXT:
610 case DESKTOP:
611 case FRAME:
612 return GetBg();
613
614 case MAX:
615 default:
616 wxFAIL_MSG(wxT("invalid standard colour"));
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:
626 case TITLEBAR_TEXT:
627 case TITLEBAR_ACTIVE_TEXT:
628 case HIGHLIGHT:
629 return GetFg();
630
631 }
632 }
633
634 // ============================================================================
635 // wxMonoRenderer
636 // ============================================================================
637
638 // ----------------------------------------------------------------------------
639 // construction
640 // ----------------------------------------------------------------------------
641
642 wxMonoRenderer::wxMonoRenderer(const wxColourScheme *scheme)
643 : wxStdRenderer(scheme)
644 {
645 m_penFg = wxPen(wxMONO_FG_COL);
646 }
647
648 // ----------------------------------------------------------------------------
649 // borders
650 // ----------------------------------------------------------------------------
651
652 wxRect 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:
661 case wxBORDER_THEME:
662 width = 1;
663 break;
664 /*
665 case wxBORDER_DOUBLE:
666 width = 2;
667 break;
668 */
669 default:
670 wxFAIL_MSG(wxT("unknown border type"));
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
688 void wxMonoRenderer::DrawButtonBorder(wxDC& dc,
689 const wxRect& rect,
690 int flags,
691 wxRect *rectIn)
692 {
693 DrawBorder(dc, wxBORDER_SIMPLE, rect, flags, rectIn);
694 }
695
696 // ----------------------------------------------------------------------------
697 // lines and frames
698 // ----------------------------------------------------------------------------
699
700 void
701 wxMonoRenderer::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
707 void
708 wxMonoRenderer::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
714 void wxMonoRenderer::DrawFocusRect(wxWindow* WXUNUSED(win), wxDC& dc, const wxRect& rect, int flags)
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
726 // ----------------------------------------------------------------------------
727 // label
728 // ----------------------------------------------------------------------------
729
730 void 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
741 void wxMonoRenderer::DrawButtonLabel(wxDC& dc,
742 const wxString& label,
743 const wxBitmap& image,
744 const wxRect& rect,
745 int flags,
746 int alignment,
747 int indexAccel,
748 wxRect *rectBounds)
749 {
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
755 // in monochrome theme otherwise, so cross it out
756 dc.SetPen(m_penFg);
757 dc.DrawLine(rect.GetTopLeft(), rect.GetBottomRight());
758 dc.DrawLine(rect.GetTopRight(), rect.GetBottomLeft());
759 }
760 }
761
762 // ----------------------------------------------------------------------------
763 // bitmaps
764 // ----------------------------------------------------------------------------
765
766 wxBitmap wxMonoRenderer::GetIndicator(IndicatorType indType, int flags)
767 {
768 IndicatorState indState;
769 IndicatorStatus indStatus;
770 GetIndicatorsFromFlags(flags, indState, indStatus);
771
772 wxBitmap& bmp = m_bmpIndicators[indType][indState][indStatus];
773 if ( !bmp.Ok() )
774 {
775 const char **xpm = ms_xpmIndicators[indType][indState][indStatus];
776 if ( xpm )
777 {
778 // create and cache it
779 bmp = wxBitmap(xpm);
780 }
781 }
782
783 return bmp;
784 }
785
786 wxBitmap 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
818 // ----------------------------------------------------------------------------
819 // toolbar
820 // ----------------------------------------------------------------------------
821
822 #if wxUSE_TOOLBAR
823
824 void 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))
831 {
832 wxFAIL_MSG(wxT("TODO"));
833 }
834
835 wxSize wxMonoRenderer::GetToolBarButtonSize(wxCoord *WXUNUSED(separator)) const
836 {
837 wxFAIL_MSG(wxT("TODO"));
838
839 return wxSize();
840 }
841
842 wxSize wxMonoRenderer::GetToolBarMargin() const
843 {
844 wxFAIL_MSG(wxT("TODO"));
845
846 return wxSize();
847 }
848
849 #endif // wxUSE_TOOLBAR
850
851 // ----------------------------------------------------------------------------
852 // notebook
853 // ----------------------------------------------------------------------------
854
855 #if wxUSE_NOTEBOOK
856
857 void 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))
864 {
865 wxFAIL_MSG(wxT("TODO"));
866 }
867
868 wxSize wxMonoRenderer::GetTabIndent() const
869 {
870 wxFAIL_MSG(wxT("TODO"));
871
872 return wxSize();
873 }
874
875 wxSize wxMonoRenderer::GetTabPadding() const
876 {
877 wxFAIL_MSG(wxT("TODO"));
878
879 return wxSize();
880 }
881
882 #endif // wxUSE_NOTEBOOK
883
884 // ----------------------------------------------------------------------------
885 // combobox
886 // ----------------------------------------------------------------------------
887
888 #if wxUSE_COMBOBOX
889
890 void wxMonoRenderer::GetComboBitmaps(wxBitmap *WXUNUSED(bmpNormal),
891 wxBitmap *WXUNUSED(bmpFocus),
892 wxBitmap *WXUNUSED(bmpPressed),
893 wxBitmap *WXUNUSED(bmpDisabled))
894 {
895 wxFAIL_MSG(wxT("TODO"));
896 }
897
898 #endif // wxUSE_COMBOBOX
899
900 // ----------------------------------------------------------------------------
901 // menus
902 // ----------------------------------------------------------------------------
903
904 #if wxUSE_MENUS
905
906 void wxMonoRenderer::DrawMenuBarItem(wxDC& WXUNUSED(dc),
907 const wxRect& WXUNUSED(rect),
908 const wxString& WXUNUSED(label),
909 int WXUNUSED(flags),
910 int WXUNUSED(indexAccel))
911 {
912 wxFAIL_MSG(wxT("TODO"));
913 }
914
915 void 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))
923 {
924 wxFAIL_MSG(wxT("TODO"));
925 }
926
927 void wxMonoRenderer::DrawMenuSeparator(wxDC& WXUNUSED(dc),
928 wxCoord WXUNUSED(y),
929 const wxMenuGeometryInfo& WXUNUSED(geomInfo))
930 {
931 wxFAIL_MSG(wxT("TODO"));
932 }
933
934 wxSize wxMonoRenderer::GetMenuBarItemSize(const wxSize& WXUNUSED(sizeText)) const
935 {
936 wxFAIL_MSG(wxT("TODO"));
937
938 return wxSize();
939 }
940
941 wxMenuGeometryInfo *wxMonoRenderer::GetMenuGeometry(wxWindow *WXUNUSED(win),
942 const wxMenu& WXUNUSED(menu)) const
943 {
944 wxFAIL_MSG(wxT("TODO"));
945
946 return NULL;
947 }
948
949 #endif // wxUSE_MENUS
950
951 // ----------------------------------------------------------------------------
952 // slider
953 // ----------------------------------------------------------------------------
954
955 #if wxUSE_SLIDER
956
957 void 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))
964 {
965 wxFAIL_MSG(wxT("TODO"));
966 }
967
968
969 void wxMonoRenderer::DrawSliderThumb(wxDC& WXUNUSED(dc),
970 const wxRect& WXUNUSED(rect),
971 wxOrientation WXUNUSED(orient),
972 int WXUNUSED(flags),
973 long WXUNUSED(style))
974 {
975 wxFAIL_MSG(wxT("TODO"));
976 }
977
978 void 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))
987 {
988 wxFAIL_MSG(wxT("TODO"));
989 }
990
991 wxCoord wxMonoRenderer::GetSliderDim() const
992 {
993 wxFAIL_MSG(wxT("TODO"));
994
995 return 0;
996 }
997
998 wxCoord wxMonoRenderer::GetSliderTickLen() const
999 {
1000 wxFAIL_MSG(wxT("TODO"));
1001
1002 return 0;
1003 }
1004
1005
1006 wxRect wxMonoRenderer::GetSliderShaftRect(const wxRect& WXUNUSED(rect),
1007 int WXUNUSED(lenThumb),
1008 wxOrientation WXUNUSED(orient),
1009 long WXUNUSED(style)) const
1010 {
1011 wxFAIL_MSG(wxT("TODO"));
1012
1013 return wxRect();
1014 }
1015
1016 wxSize wxMonoRenderer::GetSliderThumbSize(const wxRect& WXUNUSED(rect),
1017 int WXUNUSED(lenThumb),
1018 wxOrientation WXUNUSED(orient)) const
1019 {
1020 wxFAIL_MSG(wxT("TODO"));
1021
1022 return wxSize();
1023 }
1024
1025 #endif // wxUSE_SLIDER
1026
1027 wxSize wxMonoRenderer::GetProgressBarStep() const
1028 {
1029 wxFAIL_MSG(wxT("TODO"));
1030
1031 return wxSize();
1032 }
1033
1034
1035 // ----------------------------------------------------------------------------
1036 // scrollbar
1037 // ----------------------------------------------------------------------------
1038
1039 void wxMonoRenderer::DrawArrow(wxDC& dc,
1040 wxDirection dir,
1041 const wxRect& rect,
1042 int WXUNUSED(flags))
1043 {
1044 ArrowDirection arrowDir = GetArrowDirection(dir);
1045 wxCHECK_RET( arrowDir != Arrow_Max, wxT("invalid arrow direction") );
1046
1047 wxBitmap& bmp = m_bmpArrows[arrowDir];
1048 if ( !bmp.Ok() )
1049 {
1050 bmp = wxBitmap(ms_xpmArrows[arrowDir]);
1051 }
1052
1053 wxRect rectArrow(0, 0, bmp.GetWidth(), bmp.GetHeight());
1054 dc.DrawBitmap(bmp, rectArrow.CentreIn(rect).GetPosition(), true /* use mask */);
1055 }
1056
1057 void wxMonoRenderer::DrawScrollbarThumb(wxDC& dc,
1058 wxOrientation WXUNUSED(orient),
1059 const wxRect& rect,
1060 int WXUNUSED(flags))
1061 {
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 }
1074 }
1075
1076 void wxMonoRenderer::DrawScrollbarShaft(wxDC& dc,
1077 wxOrientation WXUNUSED(orient),
1078 const wxRect& rect,
1079 int WXUNUSED(flags))
1080 {
1081 DrawSolidRect(dc, wxMONO_BG_COL, rect);
1082 }
1083
1084 // ----------------------------------------------------------------------------
1085 // status bar
1086 // ----------------------------------------------------------------------------
1087
1088 #if wxUSE_STATUSBAR
1089
1090 wxCoord wxMonoRenderer::GetStatusBarBorderBetweenFields() const
1091 {
1092 return 1;
1093 }
1094
1095 wxSize wxMonoRenderer::GetStatusBarFieldMargins() const
1096 {
1097 return wxSize(1, 1);
1098 }
1099
1100 #endif // wxUSE_STATUSBAR
1101
1102 // ----------------------------------------------------------------------------
1103 // top level windows
1104 // ----------------------------------------------------------------------------
1105
1106 int wxMonoRenderer::GetFrameBorderWidth(int WXUNUSED(flags)) const
1107 {
1108 // all our borders are simple
1109 return 1;
1110 }
1111
1112 // ----------------------------------------------------------------------------
1113 // wxMonoArtProvider
1114 // ----------------------------------------------------------------------------
1115
1116 wxBitmap wxMonoArtProvider::CreateBitmap(const wxArtID& WXUNUSED(id),
1117 const wxArtClient& WXUNUSED(client),
1118 const wxSize& WXUNUSED(size))
1119 {
1120 return wxNullBitmap;
1121 }
1122
1123 #endif // wxUSE_THEME_MONO