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