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