]> git.saurik.com Git - wxWidgets.git/blob - src/univ/themes/mono.cpp
9f77284de3804074a4702eb94431187563c78a2f
[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 #ifndef WX_PRECOMP
28 #endif // WX_PRECOMP
29
30 #include "wx/artprov.h"
31 #include "wx/univ/stdrend.h"
32 #include "wx/univ/inphand.h"
33 #include "wx/univ/colschem.h"
34 #include "wx/univ/theme.h"
35
36 class 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
47 class wxMonoRenderer : public wxStdRenderer
48 {
49 public:
50 wxMonoRenderer(const wxColourScheme *scheme);
51
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
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
78 virtual void DrawArrow(wxDC& dc,
79 wxDirection dir,
80 const wxRect& rect,
81 int flags = 0);
82 virtual void DrawScrollbarThumb(wxDC& dc,
83 wxOrientation orient,
84 const wxRect& rect,
85 int flags = 0);
86 virtual void DrawScrollbarShaft(wxDC& dc,
87 wxOrientation orient,
88 const wxRect& rect,
89 int flags = 0);
90
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
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
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
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
190 #if wxUSE_COMBOBOX
191 virtual void GetComboBitmaps(wxBitmap *bmpNormal,
192 wxBitmap *bmpFocus,
193 wxBitmap *bmpPressed,
194 wxBitmap *bmpDisabled);
195 #endif // wxUSE_COMBOBOX
196
197
198 virtual wxRect GetBorderDimensions(wxBorder border) const;
199
200 #if wxUSE_SCROLLBAR
201 virtual wxSize GetScrollbarArrowSize() const { return GetStdBmpSize(); }
202 #endif // wxUSE_SCROLLBAR
203
204 virtual wxSize GetCheckBitmapSize() const { return GetStdBmpSize(); }
205 virtual wxSize GetRadioBitmapSize() const { return GetStdBmpSize(); }
206
207 #if wxUSE_TOOLBAR
208 virtual wxSize GetToolBarButtonSize(wxCoord *separator) const;
209
210 virtual wxSize GetToolBarMargin() const;
211 #endif // wxUSE_TOOLBAR
212
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
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
255 protected:
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); }
278
279 virtual wxBitmap GetFrameButtonBitmap(FrameButtonType type);
280
281 private:
282 // the bitmaps returned by GetIndicator()
283 wxBitmap m_bmpIndicators[IndicatorType_MaxCtrl]
284 [IndicatorState_MaxCtrl]
285 [IndicatorStatus_Max];
286
287 static const char **ms_xpmIndicators[IndicatorType_MaxCtrl]
288 [IndicatorState_MaxCtrl]
289 [IndicatorStatus_Max];
290
291 // the arrow bitmaps used by DrawArrow()
292 wxBitmap m_bmpArrows[Arrow_Max];
293
294 static const char **ms_xpmArrows[Arrow_Max];
295
296 // the close bitmap for the frame for GetFrameButtonBitmap()
297 wxBitmap m_bmpFrameClose;
298
299 // pen used for foreground drawing
300 wxPen m_penFg;
301 };
302
303 // ----------------------------------------------------------------------------
304 // standard bitmaps
305 // ----------------------------------------------------------------------------
306
307 static const char *xpmUnchecked[] = {
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",
315 "X X",
316 "X X",
317 "X X",
318 "X X",
319 "X X",
320 "XXXXXXXX",
321 };
322
323 static const char *xpmChecked[] = {
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 X X X",
332 "X XX X",
333 "X XX X",
334 "X X X X",
335 "X X",
336 "XXXXXXXX",
337 };
338
339 static const char *xpmUndeterminate[] = {
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 X XX",
347 "XX X X X",
348 "X X X XX",
349 "XX X X X",
350 "X X X XX",
351 "XX X X X",
352 "XXXXXXXX",
353 };
354
355 static const char *xpmRadioUnchecked[] = {
356 /* columns rows colors chars-per-pixel */
357 "8 8 2 1",
358 " c white",
359 "X c black",
360 /* pixels */
361 "XXXXXXXX",
362 "X X",
363 "X XX X",
364 "X X X X",
365 "X X X X",
366 "X XX X",
367 "X X",
368 "XXXXXXXX",
369 };
370
371 static const char *xpmRadioChecked[] = {
372 /* columns rows colors chars-per-pixel */
373 "8 8 2 1",
374 " c white",
375 "X c black",
376 /* pixels */
377 "XXXXXXXX",
378 "X X",
379 "X XX X",
380 "X XXXX X",
381 "X XXXX X",
382 "X XX X",
383 "X X",
384 "XXXXXXXX",
385 };
386
387 const char **wxMonoRenderer::ms_xpmIndicators[IndicatorType_MaxCtrl]
388 [IndicatorState_MaxCtrl]
389 [IndicatorStatus_Max] =
390 {
391 // checkboxes first
392 {
393 // normal state
394 { xpmChecked, xpmUnchecked, xpmUndeterminate },
395
396 // pressed state
397 { xpmUndeterminate, xpmUndeterminate, xpmUndeterminate },
398
399 // disabled state
400 { xpmUndeterminate, xpmUndeterminate, xpmUndeterminate },
401 },
402
403 // radio
404 {
405 // normal state
406 { xpmRadioChecked, xpmRadioUnchecked, xpmUndeterminate },
407
408 // pressed state
409 { xpmUndeterminate, xpmUndeterminate, xpmUndeterminate },
410
411 // disabled state
412 { xpmUndeterminate, xpmUndeterminate, xpmUndeterminate },
413 },
414 };
415
416 static const char *xpmLeftArrow[] = {
417 /* columns rows colors chars-per-pixel */
418 "8 8 2 1",
419 " c white",
420 "X c black",
421 /* pixels */
422 " X ",
423 " XX ",
424 " XXX ",
425 "XXXX ",
426 "XXXX ",
427 " XXX ",
428 " XX ",
429 " X ",
430 };
431
432 static const char *xpmRightArrow[] = {
433 /* columns rows colors chars-per-pixel */
434 "8 8 2 1",
435 " c white",
436 "X c black",
437 /* pixels */
438 " X ",
439 " XX ",
440 " XXX ",
441 " XXXX",
442 " XXXX",
443 " XXX ",
444 " XX ",
445 " X ",
446 };
447
448 static const char *xpmUpArrow[] = {
449 /* columns rows colors chars-per-pixel */
450 "8 8 2 1",
451 " c white",
452 "X c black",
453 /* pixels */
454 " ",
455 " XX ",
456 " XXXX ",
457 " XXXXXX ",
458 "XXXXXXXX",
459 " ",
460 " ",
461 " ",
462 };
463
464 static const char *xpmDownArrow[] = {
465 /* columns rows colors chars-per-pixel */
466 "8 8 2 1",
467 " c white",
468 "X c black",
469 /* pixels */
470 " ",
471 " ",
472 " ",
473 "XXXXXXXX",
474 " XXXXXX ",
475 " XXXX ",
476 " XX ",
477 " ",
478 };
479
480 const char **wxMonoRenderer::ms_xpmArrows[Arrow_Max] =
481 {
482 xpmLeftArrow, xpmRightArrow, xpmUpArrow, xpmDownArrow,
483 };
484
485 // ----------------------------------------------------------------------------
486 // wxMonoColourScheme: uses just white and black
487 // ----------------------------------------------------------------------------
488
489 class wxMonoColourScheme : public wxColourScheme
490 {
491 public:
492 // we use only 2 colours, white and black, but we avoid referring to them
493 // like this, instead use the functions below
494 wxColour GetFg() const { return wxMONO_FG_COL; }
495 wxColour GetBg() const { return wxMONO_BG_COL; }
496
497 // implement base class pure virtuals
498 virtual wxColour Get(StdColour col) const;
499 virtual wxColour GetBackground(wxWindow *win) const;
500 };
501
502 // ----------------------------------------------------------------------------
503 // wxMonoArtProvider
504 // ----------------------------------------------------------------------------
505
506 class wxMonoArtProvider : public wxArtProvider
507 {
508 protected:
509 virtual wxBitmap CreateBitmap(const wxArtID& id,
510 const wxArtClient& client,
511 const wxSize& size);
512 };
513
514 // ----------------------------------------------------------------------------
515 // wxMonoTheme
516 // ----------------------------------------------------------------------------
517
518 class wxMonoTheme : public wxTheme
519 {
520 public:
521 wxMonoTheme();
522 virtual ~wxMonoTheme();
523
524 virtual wxRenderer *GetRenderer();
525 virtual wxArtProvider *GetArtProvider();
526 virtual wxInputHandler *GetInputHandler(const wxString& control,
527 wxInputConsumer *consumer);
528 virtual wxColourScheme *GetColourScheme();
529
530 private:
531 wxMonoRenderer *m_renderer;
532 wxMonoArtProvider *m_artProvider;
533 wxMonoColourScheme *m_scheme;
534
535 WX_DECLARE_THEME(mono)
536 };
537
538 // ============================================================================
539 // implementation
540 // ============================================================================
541
542 WX_IMPLEMENT_THEME(wxMonoTheme, mono, wxTRANSLATE("Simple monochrome theme"));
543
544 // ----------------------------------------------------------------------------
545 // wxMonoTheme
546 // ----------------------------------------------------------------------------
547
548 wxMonoTheme::wxMonoTheme()
549 {
550 m_scheme = NULL;
551 m_renderer = NULL;
552 m_artProvider = NULL;
553 }
554
555 wxMonoTheme::~wxMonoTheme()
556 {
557 delete m_renderer;
558 delete m_scheme;
559 wxArtProvider::RemoveProvider(m_artProvider);
560 }
561
562 wxRenderer *wxMonoTheme::GetRenderer()
563 {
564 if ( !m_renderer )
565 {
566 m_renderer = new wxMonoRenderer(GetColourScheme());
567 }
568
569 return m_renderer;
570 }
571
572 wxArtProvider *wxMonoTheme::GetArtProvider()
573 {
574 if ( !m_artProvider )
575 {
576 m_artProvider = new wxMonoArtProvider;
577 }
578
579 return m_artProvider;
580 }
581
582 wxColourScheme *wxMonoTheme::GetColourScheme()
583 {
584 if ( !m_scheme )
585 {
586 m_scheme = new wxMonoColourScheme;
587 }
588
589 return m_scheme;
590 }
591
592 wxInputHandler *wxMonoTheme::GetInputHandler(const wxString& WXUNUSED(control),
593 wxInputConsumer *consumer)
594 {
595 // no special input handlers so far
596 return consumer->DoGetStdInputHandler(NULL);
597 }
598
599 // ============================================================================
600 // wxMonoColourScheme
601 // ============================================================================
602
603 wxColour wxMonoColourScheme::GetBackground(wxWindow *win) const
604 {
605 wxColour col;
606 if ( win->UseBgCol() )
607 {
608 // use the user specified colour
609 col = win->GetBackgroundColour();
610 }
611
612 // doesn't depend on the state
613 if ( !col.Ok() )
614 {
615 col = GetBg();
616 }
617
618 return col;
619 }
620
621 wxColour wxMonoColourScheme::Get(wxMonoColourScheme::StdColour col) const
622 {
623 switch ( col )
624 {
625 case WINDOW:
626 case CONTROL:
627 case CONTROL_PRESSED:
628 case CONTROL_CURRENT:
629 case SCROLLBAR:
630 case SCROLLBAR_PRESSED:
631 case GAUGE:
632 case HIGHLIGHT:
633 case TITLEBAR:
634 case TITLEBAR_ACTIVE:
635 case DESKTOP:
636 return GetBg();
637
638 case MAX:
639 default:
640 wxFAIL_MSG(_T("invalid standard colour"));
641 // fall through
642
643 case SHADOW_DARK:
644 case SHADOW_HIGHLIGHT:
645 case SHADOW_IN:
646 case SHADOW_OUT:
647 case CONTROL_TEXT:
648 case CONTROL_TEXT_DISABLED:
649 case CONTROL_TEXT_DISABLED_SHADOW:
650 case HIGHLIGHT_TEXT:
651 case TITLEBAR_TEXT:
652 case TITLEBAR_ACTIVE_TEXT:
653 return GetFg();
654
655 }
656 }
657
658 // ============================================================================
659 // wxMonoRenderer
660 // ============================================================================
661
662 // ----------------------------------------------------------------------------
663 // construction
664 // ----------------------------------------------------------------------------
665
666 wxMonoRenderer::wxMonoRenderer(const wxColourScheme *scheme)
667 : wxStdRenderer(scheme)
668 {
669 m_penFg = wxPen(wxMONO_FG_COL);
670 }
671
672 // ----------------------------------------------------------------------------
673 // borders
674 // ----------------------------------------------------------------------------
675
676 wxRect wxMonoRenderer::GetBorderDimensions(wxBorder border) const
677 {
678 wxCoord width;
679 switch ( border )
680 {
681 case wxBORDER_SIMPLE:
682 case wxBORDER_STATIC:
683 case wxBORDER_RAISED:
684 case wxBORDER_SUNKEN:
685 width = 1;
686 break;
687
688 case wxBORDER_DOUBLE:
689 width = 2;
690 break;
691
692 default:
693 wxFAIL_MSG(_T("unknown border type"));
694 // fall through
695
696 case wxBORDER_DEFAULT:
697 case wxBORDER_NONE:
698 width = 0;
699 break;
700 }
701
702 wxRect rect;
703 rect.x =
704 rect.y =
705 rect.width =
706 rect.height = width;
707
708 return rect;
709 }
710
711 void wxMonoRenderer::DrawBorder(wxDC& dc,
712 wxBorder border,
713 const wxRect& rectTotal,
714 int WXUNUSED(flags),
715 wxRect *rectIn)
716 {
717 wxRect rect = rectTotal;
718
719 switch ( border )
720 {
721 case wxBORDER_DOUBLE:
722 DrawSimpleBorder(dc, &rect);
723 // fall through
724
725 case wxBORDER_SUNKEN:
726 case wxBORDER_STATIC:
727 case wxBORDER_RAISED:
728 case wxBORDER_SIMPLE:
729 DrawSimpleBorder(dc, &rect);
730 break;
731
732 default:
733 wxFAIL_MSG(_T("unknown border type"));
734 // fall through
735
736 case wxBORDER_DEFAULT:
737 case wxBORDER_NONE:
738 break;
739 }
740
741 if ( rectIn )
742 *rectIn = rect;
743 }
744
745 void wxMonoRenderer::DrawButtonBorder(wxDC& dc,
746 const wxRect& rect,
747 int flags,
748 wxRect *rectIn)
749 {
750 DrawBorder(dc, wxBORDER_SIMPLE, rect, flags, rectIn);
751 }
752
753 // ----------------------------------------------------------------------------
754 // lines and frames
755 // ----------------------------------------------------------------------------
756
757 void
758 wxMonoRenderer::DrawHorizontalLine(wxDC& dc, wxCoord y, wxCoord x1, wxCoord x2)
759 {
760 dc.SetPen(m_penFg);
761 dc.DrawLine(x1, y, x2 + 1, y);
762 }
763
764 void
765 wxMonoRenderer::DrawVerticalLine(wxDC& dc, wxCoord x, wxCoord y1, wxCoord y2)
766 {
767 dc.SetPen(m_penFg);
768 dc.DrawLine(x, y1, x, y2 + 1);
769 }
770
771 // ----------------------------------------------------------------------------
772 // label
773 // ----------------------------------------------------------------------------
774
775 void wxMonoRenderer::DrawButtonLabel(wxDC& dc,
776 const wxString& label,
777 const wxBitmap& image,
778 const wxRect& rect,
779 int flags,
780 int alignment,
781 int indexAccel,
782 wxRect *rectBounds)
783 {
784 dc.SetTextForeground(m_penFg.GetColour());
785 dc.DrawLabel(label, image, rect, alignment, indexAccel, rectBounds);
786
787 if ( flags & wxCONTROL_DISABLED )
788 {
789 // this is ugly but I don't know how to show disabled button visually
790 // in monochrome theme otherwise, so cross it out
791 dc.SetPen(m_penFg);
792 dc.DrawLine(rect.GetTopLeft(), rect.GetBottomRight());
793 dc.DrawLine(rect.GetTopRight(), rect.GetBottomLeft());
794 }
795 }
796
797 // ----------------------------------------------------------------------------
798 // bitmaps
799 // ----------------------------------------------------------------------------
800
801 wxBitmap wxMonoRenderer::GetIndicator(IndicatorType indType, int flags)
802 {
803 IndicatorState indState;
804 IndicatorStatus indStatus;
805 GetIndicatorsFromFlags(flags, indState, indStatus);
806
807 wxBitmap& bmp = m_bmpIndicators[indType][indState][indStatus];
808 if ( !bmp.Ok() )
809 {
810 const char **xpm = ms_xpmIndicators[indType][indState][indStatus];
811 if ( xpm )
812 {
813 // create and cache it
814 bmp = wxBitmap(xpm);
815 }
816 }
817
818 return bmp;
819 }
820
821 wxBitmap wxMonoRenderer::GetFrameButtonBitmap(FrameButtonType type)
822 {
823 if ( type == FrameButton_Close )
824 {
825 if ( !m_bmpFrameClose.Ok() )
826 {
827 static const char *xpmFrameClose[] = {
828 /* columns rows colors chars-per-pixel */
829 "8 8 2 1",
830 " c white",
831 "X c black",
832 /* pixels */
833 " ",
834 " XX XX ",
835 " X X ",
836 " XX ",
837 " XX ",
838 " X X ",
839 " XX XX ",
840 " ",
841 };
842
843 m_bmpFrameClose = wxBitmap(xpmFrameClose);
844 }
845
846 return m_bmpFrameClose;
847 }
848
849 // we don't show any other buttons than close
850 return wxNullBitmap;
851 }
852
853 // ----------------------------------------------------------------------------
854 // toolbar
855 // ----------------------------------------------------------------------------
856
857 #if wxUSE_TOOLBAR
858
859 void wxMonoRenderer::DrawToolBarButton(wxDC& dc,
860 const wxString& label,
861 const wxBitmap& bitmap,
862 const wxRect& rect,
863 int flags,
864 long style,
865 int tbarStyle)
866 {
867 wxFAIL_MSG(_T("TODO"));
868 }
869
870 wxSize wxMonoRenderer::GetToolBarButtonSize(wxCoord *separator) const
871 {
872 wxFAIL_MSG(_T("TODO"));
873
874 return wxSize();
875 }
876
877 wxSize wxMonoRenderer::GetToolBarMargin() const
878 {
879 wxFAIL_MSG(_T("TODO"));
880
881 return wxSize();
882 }
883
884 #endif // wxUSE_TOOLBAR
885
886 // ----------------------------------------------------------------------------
887 // notebook
888 // ----------------------------------------------------------------------------
889
890 #if wxUSE_NOTEBOOK
891
892 void wxMonoRenderer::DrawTab(wxDC& dc,
893 const wxRect& rect,
894 wxDirection dir,
895 const wxString& label,
896 const wxBitmap& bitmap,
897 int flags,
898 int indexAccel)
899 {
900 wxFAIL_MSG(_T("TODO"));
901 }
902
903 wxSize wxMonoRenderer::GetTabIndent() const
904 {
905 wxFAIL_MSG(_T("TODO"));
906
907 return wxSize();
908 }
909
910 wxSize wxMonoRenderer::GetTabPadding() const
911 {
912 wxFAIL_MSG(_T("TODO"));
913
914 return wxSize();
915 }
916
917 #endif // wxUSE_NOTEBOOK
918
919 // ----------------------------------------------------------------------------
920 // combobox
921 // ----------------------------------------------------------------------------
922
923 #if wxUSE_COMBOBOX
924
925 void wxMonoRenderer::GetComboBitmaps(wxBitmap *bmpNormal,
926 wxBitmap *bmpFocus,
927 wxBitmap *bmpPressed,
928 wxBitmap *bmpDisabled)
929 {
930 wxFAIL_MSG(_T("TODO"));
931 }
932
933 #endif // wxUSE_COMBOBOX
934
935 // ----------------------------------------------------------------------------
936 // menus
937 // ----------------------------------------------------------------------------
938
939 #if wxUSE_MENUS
940
941 void wxMonoRenderer::DrawMenuBarItem(wxDC& dc,
942 const wxRect& rect,
943 const wxString& label,
944 int flags,
945 int indexAccel)
946 {
947 wxFAIL_MSG(_T("TODO"));
948 }
949
950 void wxMonoRenderer::DrawMenuItem(wxDC& dc,
951 wxCoord y,
952 const wxMenuGeometryInfo& geometryInfo,
953 const wxString& label,
954 const wxString& accel,
955 const wxBitmap& bitmap,
956 int flags,
957 int indexAccel)
958 {
959 wxFAIL_MSG(_T("TODO"));
960 }
961
962 void wxMonoRenderer::DrawMenuSeparator(wxDC& dc,
963 wxCoord y,
964 const wxMenuGeometryInfo& geomInfo)
965 {
966 wxFAIL_MSG(_T("TODO"));
967 }
968
969 wxSize wxMonoRenderer::GetMenuBarItemSize(const wxSize& sizeText) const
970 {
971 wxFAIL_MSG(_T("TODO"));
972
973 return wxSize();
974 }
975
976 wxMenuGeometryInfo *wxMonoRenderer::GetMenuGeometry(wxWindow *win,
977 const wxMenu& menu) const
978 {
979 wxFAIL_MSG(_T("TODO"));
980
981 return NULL;
982 }
983
984 #endif // wxUSE_MENUS
985
986 // ----------------------------------------------------------------------------
987 // slider
988 // ----------------------------------------------------------------------------
989
990 #if wxUSE_SLIDER
991
992 void wxMonoRenderer::DrawSliderShaft(wxDC& dc,
993 const wxRect& rect,
994 int lenThumb,
995 wxOrientation orient,
996 int flags,
997 long style,
998 wxRect *rectShaft)
999 {
1000 wxFAIL_MSG(_T("TODO"));
1001 }
1002
1003
1004 void wxMonoRenderer::DrawSliderThumb(wxDC& dc,
1005 const wxRect& rect,
1006 wxOrientation orient,
1007 int flags,
1008 long style)
1009 {
1010 wxFAIL_MSG(_T("TODO"));
1011 }
1012
1013 void wxMonoRenderer::DrawSliderTicks(wxDC& dc,
1014 const wxRect& rect,
1015 int lenThumb,
1016 wxOrientation orient,
1017 int start,
1018 int end,
1019 int step,
1020 int flags,
1021 long style)
1022 {
1023 wxFAIL_MSG(_T("TODO"));
1024 }
1025
1026 wxCoord wxMonoRenderer::GetSliderDim() const
1027 {
1028 wxFAIL_MSG(_T("TODO"));
1029
1030 return 0;
1031 }
1032
1033 wxCoord wxMonoRenderer::GetSliderTickLen() const
1034 {
1035 wxFAIL_MSG(_T("TODO"));
1036
1037 return 0;
1038 }
1039
1040
1041 wxRect wxMonoRenderer::GetSliderShaftRect(const wxRect& rect,
1042 int lenThumb,
1043 wxOrientation orient,
1044 long style) const
1045 {
1046 wxFAIL_MSG(_T("TODO"));
1047
1048 return wxRect();
1049 }
1050
1051 wxSize wxMonoRenderer::GetSliderThumbSize(const wxRect& rect,
1052 int lenThumb,
1053 wxOrientation orient) const
1054 {
1055 wxFAIL_MSG(_T("TODO"));
1056
1057 return wxSize();
1058 }
1059
1060 #endif // wxUSE_SLIDER
1061
1062 wxSize wxMonoRenderer::GetProgressBarStep() const
1063 {
1064 wxFAIL_MSG(_T("TODO"));
1065
1066 return wxSize();
1067 }
1068
1069
1070 // ----------------------------------------------------------------------------
1071 // scrollbar
1072 // ----------------------------------------------------------------------------
1073
1074 void wxMonoRenderer::DrawArrow(wxDC& dc,
1075 wxDirection dir,
1076 const wxRect& rect,
1077 int WXUNUSED(flags))
1078 {
1079 ArrowDirection arrowDir = GetArrowDirection(dir);
1080 wxCHECK_RET( arrowDir != Arrow_Max, _T("invalid arrow direction") );
1081
1082 wxBitmap& bmp = m_bmpArrows[arrowDir];
1083 if ( !bmp.Ok() )
1084 {
1085 bmp = wxBitmap(ms_xpmArrows[arrowDir]);
1086 }
1087
1088 wxRect rectArrow(0, 0, bmp.GetWidth(), bmp.GetHeight());
1089 dc.DrawBitmap(bmp, rectArrow.CentreIn(rect).GetPosition(), true /* use mask */);
1090 }
1091
1092 void wxMonoRenderer::DrawScrollbarThumb(wxDC& dc,
1093 wxOrientation WXUNUSED(orient),
1094 const wxRect& rect,
1095 int WXUNUSED(flags))
1096 {
1097 DrawSolidRect(dc, wxMONO_FG_COL, rect);
1098 }
1099
1100 void wxMonoRenderer::DrawScrollbarShaft(wxDC& dc,
1101 wxOrientation WXUNUSED(orient),
1102 const wxRect& rect,
1103 int WXUNUSED(flags))
1104 {
1105 DrawSolidRect(dc, wxMONO_BG_COL, rect);
1106 }
1107
1108 // ----------------------------------------------------------------------------
1109 // top level windows
1110 // ----------------------------------------------------------------------------
1111
1112 void wxMonoRenderer::DrawFrameTitleBar(wxDC& WXUNUSED(dc),
1113 const wxRect& WXUNUSED(rect),
1114 const wxString& WXUNUSED(title),
1115 const wxIcon& WXUNUSED(icon),
1116 int WXUNUSED(flags),
1117 int WXUNUSED(specialButton),
1118 int WXUNUSED(specialButtonFlag))
1119 {
1120 }
1121
1122 void wxMonoRenderer::DrawFrameBorder(wxDC& WXUNUSED(dc),
1123 const wxRect& WXUNUSED(rect),
1124 int WXUNUSED(flags))
1125 {
1126 }
1127
1128 void wxMonoRenderer::DrawFrameBackground(wxDC& WXUNUSED(dc),
1129 const wxRect& WXUNUSED(rect),
1130 int WXUNUSED(flags))
1131 {
1132 }
1133
1134 void wxMonoRenderer::DrawFrameTitle(wxDC& WXUNUSED(dc),
1135 const wxRect& WXUNUSED(rect),
1136 const wxString& WXUNUSED(title),
1137 int WXUNUSED(flags))
1138 {
1139 }
1140
1141 void wxMonoRenderer::DrawFrameIcon(wxDC& WXUNUSED(dc),
1142 const wxRect& WXUNUSED(rect),
1143 const wxIcon& WXUNUSED(icon),
1144 int WXUNUSED(flags))
1145 {
1146 }
1147
1148 void wxMonoRenderer::DrawFrameButton(wxDC& WXUNUSED(dc),
1149 wxCoord WXUNUSED(x),
1150 wxCoord WXUNUSED(y),
1151 int WXUNUSED(button),
1152 int WXUNUSED(flags))
1153 {
1154 }
1155
1156 wxRect
1157 wxMonoRenderer::GetFrameClientArea(const wxRect& rect,
1158 int WXUNUSED(flags)) const
1159 {
1160 return rect;
1161 }
1162
1163 wxSize
1164 wxMonoRenderer::GetFrameTotalSize(const wxSize& clientSize,
1165 int WXUNUSED(flags)) const
1166 {
1167 return clientSize;
1168 }
1169
1170 wxSize wxMonoRenderer::GetFrameMinSize(int WXUNUSED(flags)) const
1171 {
1172 return wxSize(0,0);
1173 }
1174
1175 wxSize wxMonoRenderer::GetFrameIconSize() const
1176 {
1177 return wxSize(wxDefaultCoord, wxDefaultCoord);
1178 }
1179
1180 int
1181 wxMonoRenderer::HitTestFrame(const wxRect& WXUNUSED(rect),
1182 const wxPoint& WXUNUSED(pt),
1183 int WXUNUSED(flags)) const
1184 {
1185 return wxHT_TOPLEVEL_CLIENT_AREA;
1186 }
1187
1188
1189 // ----------------------------------------------------------------------------
1190 // wxMonoArtProvider
1191 // ----------------------------------------------------------------------------
1192
1193 wxBitmap wxMonoArtProvider::CreateBitmap(const wxArtID& WXUNUSED(id),
1194 const wxArtClient& WXUNUSED(client),
1195 const wxSize& WXUNUSED(size))
1196 {
1197 return wxNullBitmap;
1198 }
1199