]>
Commit | Line | Data |
---|---|---|
147b8a4a VZ |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: src/univ/themes/mono.cpp | |
3 | // Purpose: wxUniversal theme for monochrome displays | |
4 | // Author: Vadim Zeitlin | |
5 | // Modified by: | |
6 | // Created: 2006-08-27 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 2006 REA Elektronik GmbH | |
9 | // Licence: wxWindows licence | |
10 | /////////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | // =========================================================================== | |
13 | // declarations | |
14 | // =========================================================================== | |
15 | ||
16 | // --------------------------------------------------------------------------- | |
17 | // headers | |
18 | // --------------------------------------------------------------------------- | |
19 | ||
20 | // for compilers that support precompilation, includes "wx.h". | |
21 | #include "wx/wxprec.h" | |
22 | ||
23 | #ifdef __BORLANDC__ | |
24 | #pragma hdrstop | |
25 | #endif | |
26 | ||
27 | #ifndef WX_PRECOMP | |
28 | #endif // WX_PRECOMP | |
29 | ||
3a01afec VZ |
30 | #include "wx/artprov.h" |
31 | #include "wx/univ/stdrend.h" | |
147b8a4a VZ |
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 | ||
147b8a4a VZ |
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 | ||
147b8a4a VZ |
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 | ||
147b8a4a VZ |
78 | virtual void DrawArrow(wxDC& dc, |
79 | wxDirection dir, | |
80 | const wxRect& rect, | |
81 | int flags = 0); | |
147b8a4a VZ |
82 | virtual void DrawScrollbarThumb(wxDC& dc, |
83 | wxOrientation orient, | |
84 | const wxRect& rect, | |
85 | int flags = 0); | |
147b8a4a VZ |
86 | virtual void DrawScrollbarShaft(wxDC& dc, |
87 | wxOrientation orient, | |
88 | const wxRect& rect, | |
89 | int flags = 0); | |
90 | ||
147b8a4a VZ |
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 | ||
147b8a4a VZ |
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 | |
147b8a4a VZ |
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 | #if wxUSE_STATUSBAR | |
159 | virtual void DrawStatusField(wxDC& dc, | |
160 | const wxRect& rect, | |
161 | const wxString& label, | |
162 | int flags = 0, int style = 0); | |
163 | #endif // wxUSE_STATUSBAR | |
164 | ||
165 | virtual void DrawFrameTitleBar(wxDC& dc, | |
166 | const wxRect& rect, | |
167 | const wxString& title, | |
168 | const wxIcon& icon, | |
169 | int flags, | |
170 | int specialButton = 0, | |
171 | int specialButtonFlags = 0); | |
172 | ||
173 | virtual void DrawFrameBorder(wxDC& dc, | |
174 | const wxRect& rect, | |
175 | int flags); | |
176 | ||
177 | virtual void DrawFrameBackground(wxDC& dc, | |
178 | const wxRect& rect, | |
179 | int flags); | |
180 | ||
181 | virtual void DrawFrameTitle(wxDC& dc, | |
182 | const wxRect& rect, | |
183 | const wxString& title, | |
184 | int flags); | |
185 | ||
186 | virtual void DrawFrameIcon(wxDC& dc, | |
187 | const wxRect& rect, | |
188 | const wxIcon& icon, | |
189 | int flags); | |
190 | ||
191 | virtual void DrawFrameButton(wxDC& dc, | |
192 | wxCoord x, wxCoord y, | |
193 | int button, | |
194 | int flags = 0); | |
195 | ||
196 | ||
3a01afec | 197 | #if wxUSE_COMBOBOX |
147b8a4a VZ |
198 | virtual void GetComboBitmaps(wxBitmap *bmpNormal, |
199 | wxBitmap *bmpFocus, | |
200 | wxBitmap *bmpPressed, | |
201 | wxBitmap *bmpDisabled); | |
3a01afec | 202 | #endif // wxUSE_COMBOBOX |
147b8a4a VZ |
203 | |
204 | ||
205 | virtual wxRect GetBorderDimensions(wxBorder border) const; | |
206 | ||
207 | virtual bool AreScrollbarsInsideBorder() const; | |
208 | ||
147b8a4a | 209 | #if wxUSE_SCROLLBAR |
3a01afec | 210 | virtual wxSize GetScrollbarArrowSize() const { return GetStdBmpSize(); } |
147b8a4a VZ |
211 | #endif // wxUSE_SCROLLBAR |
212 | ||
213 | virtual wxCoord GetListboxItemHeight(wxCoord fontHeight); | |
214 | ||
3a01afec VZ |
215 | virtual wxSize GetCheckBitmapSize() const { return GetStdBmpSize(); } |
216 | virtual wxSize GetRadioBitmapSize() const { return GetStdBmpSize(); } | |
147b8a4a VZ |
217 | |
218 | virtual wxSize GetToolBarButtonSize(wxCoord *separator) const; | |
219 | ||
220 | virtual wxSize GetToolBarMargin() const; | |
221 | ||
147b8a4a VZ |
222 | #if wxUSE_NOTEBOOK |
223 | virtual wxSize GetTabIndent() const; | |
224 | ||
225 | virtual wxSize GetTabPadding() const; | |
226 | #endif // wxUSE_NOTEBOOK | |
227 | ||
228 | #if wxUSE_SLIDER | |
229 | virtual wxCoord GetSliderDim() const; | |
230 | ||
231 | virtual wxCoord GetSliderTickLen() const; | |
232 | ||
233 | virtual wxRect GetSliderShaftRect(const wxRect& rect, | |
234 | int lenThumb, | |
235 | wxOrientation orient, | |
236 | long style = 0) const; | |
237 | ||
238 | virtual wxSize GetSliderThumbSize(const wxRect& rect, | |
239 | int lenThumb, | |
240 | wxOrientation orient) const; | |
241 | #endif // wxUSE_SLIDER | |
242 | ||
243 | virtual wxSize GetProgressBarStep() const; | |
244 | ||
245 | #if wxUSE_MENUS | |
246 | virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const; | |
247 | ||
248 | virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win, | |
249 | const wxMenu& menu) const; | |
250 | #endif // wxUSE_MENUS | |
251 | ||
252 | #if wxUSE_STATUSBAR | |
253 | virtual wxSize GetStatusBarBorders(wxCoord *borderBetweenFields) const; | |
254 | #endif // wxUSE_STATUSBAR | |
255 | ||
256 | virtual wxRect GetFrameClientArea(const wxRect& rect, int flags) const; | |
257 | ||
258 | virtual wxSize GetFrameTotalSize(const wxSize& clientSize, int flags) const; | |
259 | ||
260 | virtual wxSize GetFrameMinSize(int flags) const; | |
261 | ||
262 | virtual wxSize GetFrameIconSize() const; | |
263 | ||
264 | virtual int HitTestFrame(const wxRect& rect, | |
265 | const wxPoint& pt, | |
266 | int flags = 0) const; | |
267 | ||
268 | protected: | |
3a01afec VZ |
269 | // override base class border drawing routines: we always draw just a |
270 | // single simple border | |
271 | void DrawSimpleBorder(wxDC& dc, wxRect *rect) | |
272 | { DrawRect(dc, rect, m_penFg); } | |
273 | ||
274 | virtual void DrawRaisedBorder(wxDC& dc, wxRect *rect) | |
275 | { DrawSimpleBorder(dc, rect); } | |
276 | virtual void DrawSunkenBorder(wxDC& dc, wxRect *rect) | |
277 | { DrawSimpleBorder(dc, rect); } | |
278 | virtual void DrawAntiSunkenBorder(wxDC& dc, wxRect *rect) | |
279 | { DrawSimpleBorder(dc, rect); } | |
280 | virtual void DrawFrameBorder(wxDC& dc, wxRect *rect) | |
281 | { DrawSimpleBorder(dc, rect); } | |
282 | ||
283 | // all our XPMs are of this size | |
284 | static wxSize GetStdBmpSize() { return wxSize(8, 8); } | |
285 | ||
286 | wxBitmap GetIndicator(IndicatorType indType, int flags); | |
287 | virtual wxBitmap GetCheckBitmap(int flags) | |
288 | { return GetIndicator(IndicatorType_Check, flags); } | |
289 | virtual wxBitmap GetRadioBitmap(int flags) | |
290 | { return GetIndicator(IndicatorType_Radio, flags); } | |
147b8a4a | 291 | |
3a01afec VZ |
292 | private: |
293 | // the bitmaps returned by GetIndicator() | |
294 | wxBitmap m_bmpIndicators[IndicatorType_MaxCtrl] | |
295 | [IndicatorState_MaxCtrl] | |
296 | [IndicatorStatus_Max]; | |
147b8a4a | 297 | |
3a01afec VZ |
298 | static const char **ms_xpmIndicators[IndicatorType_MaxCtrl] |
299 | [IndicatorState_MaxCtrl] | |
300 | [IndicatorStatus_Max]; | |
147b8a4a | 301 | |
3a01afec VZ |
302 | // the arrow bitmaps used by DrawArrow() |
303 | wxBitmap m_bmpArrows[Arrow_Max]; | |
147b8a4a | 304 | |
3a01afec | 305 | static const char **ms_xpmArrows[Arrow_Max]; |
147b8a4a | 306 | |
3a01afec VZ |
307 | // pen used for foreground drawing |
308 | wxPen m_penFg; | |
309 | }; | |
147b8a4a | 310 | |
3a01afec VZ |
311 | // ---------------------------------------------------------------------------- |
312 | // standard bitmaps | |
313 | // ---------------------------------------------------------------------------- | |
147b8a4a | 314 | |
3a01afec VZ |
315 | static const char *xpmUnchecked[] = { |
316 | /* columns rows colors chars-per-pixel */ | |
317 | "8 8 2 1", | |
318 | " c white", | |
319 | "X c black", | |
320 | /* pixels */ | |
321 | "XXXXXXXX", | |
322 | "X X", | |
323 | "X X", | |
324 | "X X", | |
325 | "X X", | |
326 | "X X", | |
327 | "X X", | |
328 | "XXXXXXXX", | |
329 | }; | |
147b8a4a | 330 | |
3a01afec VZ |
331 | static const char *xpmChecked[] = { |
332 | /* columns rows colors chars-per-pixel */ | |
333 | "8 8 2 1", | |
334 | " c white", | |
335 | "X c black", | |
336 | /* pixels */ | |
337 | "XXXXXXXX", | |
338 | "X X", | |
339 | "X X X X", | |
340 | "X XX X", | |
341 | "X XX X", | |
342 | "X X X X", | |
343 | "X X", | |
344 | "XXXXXXXX", | |
345 | }; | |
147b8a4a | 346 | |
3a01afec VZ |
347 | static const char *xpmUndeterminate[] = { |
348 | /* columns rows colors chars-per-pixel */ | |
349 | "8 8 2 1", | |
350 | " c white", | |
351 | "X c black", | |
352 | /* pixels */ | |
353 | "XXXXXXXX", | |
354 | "X X X XX", | |
355 | "XX X X X", | |
356 | "X X X XX", | |
357 | "XX X X X", | |
358 | "X X X XX", | |
359 | "XX X X X", | |
360 | "XXXXXXXX", | |
361 | }; | |
147b8a4a | 362 | |
3a01afec VZ |
363 | static const char *xpmRadioUnchecked[] = { |
364 | /* columns rows colors chars-per-pixel */ | |
365 | "8 8 2 1", | |
366 | " c white", | |
367 | "X c black", | |
368 | /* pixels */ | |
369 | "XXXXXXXX", | |
370 | "X X", | |
371 | "X XX X", | |
372 | "X X X X", | |
373 | "X X X X", | |
374 | "X XX X", | |
375 | "X X", | |
376 | "XXXXXXXX", | |
377 | }; | |
147b8a4a | 378 | |
3a01afec VZ |
379 | static const char *xpmRadioChecked[] = { |
380 | /* columns rows colors chars-per-pixel */ | |
381 | "8 8 2 1", | |
382 | " c white", | |
383 | "X c black", | |
384 | /* pixels */ | |
385 | "XXXXXXXX", | |
386 | "X X", | |
387 | "X XX X", | |
388 | "X XXXX X", | |
389 | "X XXXX X", | |
390 | "X XX X", | |
391 | "X X", | |
392 | "XXXXXXXX", | |
393 | }; | |
394 | ||
395 | const char **wxMonoRenderer::ms_xpmIndicators[IndicatorType_MaxCtrl] | |
396 | [IndicatorState_MaxCtrl] | |
397 | [IndicatorStatus_Max] = | |
398 | { | |
399 | // checkboxes first | |
147b8a4a | 400 | { |
3a01afec VZ |
401 | // normal state |
402 | { xpmChecked, xpmUnchecked, xpmUndeterminate }, | |
403 | ||
404 | // pressed state | |
405 | { xpmUndeterminate, xpmUndeterminate, xpmUndeterminate }, | |
406 | ||
407 | // disabled state | |
408 | { xpmUndeterminate, xpmUndeterminate, xpmUndeterminate }, | |
409 | }, | |
410 | ||
411 | // radio | |
412 | { | |
413 | // normal state | |
414 | { xpmRadioChecked, xpmRadioUnchecked, xpmUndeterminate }, | |
415 | ||
416 | // pressed state | |
417 | { xpmUndeterminate, xpmUndeterminate, xpmUndeterminate }, | |
418 | ||
419 | // disabled state | |
420 | { xpmUndeterminate, xpmUndeterminate, xpmUndeterminate }, | |
421 | }, | |
147b8a4a VZ |
422 | }; |
423 | ||
3a01afec VZ |
424 | static const char *xpmLeftArrow[] = { |
425 | /* columns rows colors chars-per-pixel */ | |
426 | "8 8 2 1", | |
427 | " c white", | |
428 | "X c black", | |
429 | /* pixels */ | |
430 | " X ", | |
431 | " XX ", | |
432 | " XXX ", | |
433 | "XXXX ", | |
434 | "XXXX ", | |
435 | " XXX ", | |
436 | " XX ", | |
437 | " X ", | |
438 | }; | |
147b8a4a | 439 | |
3a01afec VZ |
440 | static const char *xpmRightArrow[] = { |
441 | /* columns rows colors chars-per-pixel */ | |
442 | "8 8 2 1", | |
443 | " c white", | |
444 | "X c black", | |
445 | /* pixels */ | |
446 | " X ", | |
447 | " XX ", | |
448 | " XXX ", | |
449 | " XXXX", | |
450 | " XXXX", | |
451 | " XXX ", | |
452 | " XX ", | |
453 | " X ", | |
454 | }; | |
147b8a4a | 455 | |
3a01afec VZ |
456 | static const char *xpmUpArrow[] = { |
457 | /* columns rows colors chars-per-pixel */ | |
458 | "8 8 2 1", | |
459 | " c white", | |
460 | "X c black", | |
461 | /* pixels */ | |
462 | " ", | |
463 | " XX ", | |
464 | " XXXX ", | |
465 | " XXXXXX ", | |
466 | "XXXXXXXX", | |
467 | " ", | |
468 | " ", | |
469 | " ", | |
470 | }; | |
147b8a4a | 471 | |
3a01afec VZ |
472 | static const char *xpmDownArrow[] = { |
473 | /* columns rows colors chars-per-pixel */ | |
474 | "8 8 2 1", | |
475 | " c white", | |
476 | "X c black", | |
477 | /* pixels */ | |
478 | " ", | |
479 | " ", | |
480 | " ", | |
481 | "XXXXXXXX", | |
482 | " XXXXXX ", | |
483 | " XXXX ", | |
484 | " XX ", | |
485 | " ", | |
486 | }; | |
487 | ||
488 | const char **wxMonoRenderer::ms_xpmArrows[Arrow_Max] = | |
489 | { | |
490 | xpmLeftArrow, xpmRightArrow, xpmUpArrow, xpmDownArrow, | |
147b8a4a VZ |
491 | }; |
492 | ||
493 | // ---------------------------------------------------------------------------- | |
494 | // wxMonoColourScheme: uses just white and black | |
495 | // ---------------------------------------------------------------------------- | |
496 | ||
497 | class wxMonoColourScheme : public wxColourScheme | |
498 | { | |
499 | public: | |
500 | // we use only 2 colours, white and black, but we avoid referring to them | |
501 | // like this, instead use the functions below | |
502 | wxColour GetFg() const { return wxMONO_FG_COL; } | |
503 | wxColour GetBg() const { return wxMONO_BG_COL; } | |
504 | ||
505 | // implement base class pure virtuals | |
506 | virtual wxColour Get(StdColour col) const; | |
507 | virtual wxColour GetBackground(wxWindow *win) const; | |
508 | }; | |
509 | ||
510 | // ---------------------------------------------------------------------------- | |
511 | // wxMonoArtProvider | |
512 | // ---------------------------------------------------------------------------- | |
513 | ||
514 | class wxMonoArtProvider : public wxArtProvider | |
515 | { | |
516 | protected: | |
517 | virtual wxBitmap CreateBitmap(const wxArtID& id, | |
518 | const wxArtClient& client, | |
519 | const wxSize& size); | |
520 | }; | |
521 | ||
522 | // ---------------------------------------------------------------------------- | |
523 | // wxMonoTheme | |
524 | // ---------------------------------------------------------------------------- | |
525 | ||
147b8a4a VZ |
526 | class wxMonoTheme : public wxTheme |
527 | { | |
528 | public: | |
529 | wxMonoTheme(); | |
530 | virtual ~wxMonoTheme(); | |
531 | ||
532 | virtual wxRenderer *GetRenderer(); | |
533 | virtual wxArtProvider *GetArtProvider(); | |
3a01afec VZ |
534 | virtual wxInputHandler *GetInputHandler(const wxString& control, |
535 | wxInputConsumer *consumer); | |
147b8a4a VZ |
536 | virtual wxColourScheme *GetColourScheme(); |
537 | ||
538 | private: | |
539 | wxMonoRenderer *m_renderer; | |
540 | wxMonoArtProvider *m_artProvider; | |
541 | wxMonoColourScheme *m_scheme; | |
542 | ||
3a01afec | 543 | WX_DECLARE_THEME(mono) |
147b8a4a VZ |
544 | }; |
545 | ||
546 | // ============================================================================ | |
547 | // implementation | |
548 | // ============================================================================ | |
549 | ||
550 | WX_IMPLEMENT_THEME(wxMonoTheme, mono, wxTRANSLATE("Simple monochrome theme")); | |
551 | ||
552 | // ---------------------------------------------------------------------------- | |
553 | // wxMonoTheme | |
554 | // ---------------------------------------------------------------------------- | |
555 | ||
556 | wxMonoTheme::wxMonoTheme() | |
557 | { | |
558 | m_scheme = NULL; | |
559 | m_renderer = NULL; | |
560 | m_artProvider = NULL; | |
561 | } | |
562 | ||
563 | wxMonoTheme::~wxMonoTheme() | |
564 | { | |
565 | delete m_renderer; | |
566 | delete m_scheme; | |
567 | wxArtProvider::RemoveProvider(m_artProvider); | |
568 | } | |
569 | ||
570 | wxRenderer *wxMonoTheme::GetRenderer() | |
571 | { | |
572 | if ( !m_renderer ) | |
573 | { | |
574 | m_renderer = new wxMonoRenderer(GetColourScheme()); | |
575 | } | |
576 | ||
577 | return m_renderer; | |
578 | } | |
579 | ||
580 | wxArtProvider *wxMonoTheme::GetArtProvider() | |
581 | { | |
582 | if ( !m_artProvider ) | |
583 | { | |
584 | m_artProvider = new wxMonoArtProvider; | |
585 | } | |
586 | ||
587 | return m_artProvider; | |
588 | } | |
589 | ||
590 | wxColourScheme *wxMonoTheme::GetColourScheme() | |
591 | { | |
592 | if ( !m_scheme ) | |
593 | { | |
594 | m_scheme = new wxMonoColourScheme; | |
595 | } | |
596 | ||
597 | return m_scheme; | |
598 | } | |
599 | ||
600 | wxInputHandler *wxMonoTheme::GetInputHandler(const wxString& WXUNUSED(control), | |
601 | wxInputConsumer *consumer) | |
602 | { | |
603 | // no special input handlers so far | |
604 | return consumer->DoGetStdInputHandler(NULL); | |
605 | } | |
606 | ||
607 | // ============================================================================ | |
608 | // wxMonoColourScheme | |
609 | // ============================================================================ | |
610 | ||
611 | wxColour wxMonoColourScheme::GetBackground(wxWindow *win) const | |
612 | { | |
613 | wxColour col; | |
614 | if ( win->UseBgCol() ) | |
615 | { | |
616 | // use the user specified colour | |
617 | col = win->GetBackgroundColour(); | |
618 | } | |
619 | ||
620 | // doesn't depend on the state | |
621 | if ( !col.Ok() ) | |
622 | { | |
623 | col = GetBg(); | |
624 | } | |
3a01afec VZ |
625 | |
626 | return col; | |
147b8a4a VZ |
627 | } |
628 | ||
629 | wxColour wxMonoColourScheme::Get(wxMonoColourScheme::StdColour col) const | |
630 | { | |
631 | switch ( col ) | |
632 | { | |
633 | case WINDOW: | |
634 | case CONTROL: | |
635 | case CONTROL_PRESSED: | |
636 | case CONTROL_CURRENT: | |
637 | case SCROLLBAR: | |
638 | case SCROLLBAR_PRESSED: | |
639 | case GAUGE: | |
640 | case HIGHLIGHT: | |
641 | case TITLEBAR: | |
642 | case TITLEBAR_ACTIVE: | |
643 | case DESKTOP: | |
644 | return GetBg(); | |
645 | ||
646 | case MAX: | |
647 | default: | |
648 | wxFAIL_MSG(_T("invalid standard colour")); | |
649 | // fall through | |
650 | ||
651 | case SHADOW_DARK: | |
652 | case SHADOW_HIGHLIGHT: | |
653 | case SHADOW_IN: | |
654 | case SHADOW_OUT: | |
655 | case CONTROL_TEXT: | |
656 | case CONTROL_TEXT_DISABLED: | |
657 | case CONTROL_TEXT_DISABLED_SHADOW: | |
658 | case HIGHLIGHT_TEXT: | |
659 | case TITLEBAR_TEXT: | |
660 | case TITLEBAR_ACTIVE_TEXT: | |
661 | return GetFg(); | |
662 | ||
663 | } | |
664 | } | |
665 | ||
666 | // ============================================================================ | |
667 | // wxMonoRenderer | |
668 | // ============================================================================ | |
669 | ||
670 | // ---------------------------------------------------------------------------- | |
671 | // construction | |
672 | // ---------------------------------------------------------------------------- | |
673 | ||
674 | wxMonoRenderer::wxMonoRenderer(const wxColourScheme *scheme) | |
675 | : wxStdRenderer(scheme) | |
676 | { | |
3a01afec | 677 | m_penFg = wxPen(wxMONO_FG_COL); |
147b8a4a VZ |
678 | } |
679 | ||
680 | // ---------------------------------------------------------------------------- | |
3a01afec | 681 | // borders |
147b8a4a VZ |
682 | // ---------------------------------------------------------------------------- |
683 | ||
3a01afec VZ |
684 | void wxMonoRenderer::DrawBorder(wxDC& dc, |
685 | wxBorder border, | |
686 | const wxRect& rectTotal, | |
687 | int WXUNUSED(flags), | |
688 | wxRect *rectIn) | |
147b8a4a | 689 | { |
3a01afec VZ |
690 | wxRect rect = rectTotal; |
691 | ||
692 | switch ( border ) | |
693 | { | |
694 | case wxBORDER_DOUBLE: | |
695 | DrawSimpleBorder(dc, &rect); | |
696 | // fall through | |
697 | ||
698 | case wxBORDER_SUNKEN: | |
699 | case wxBORDER_STATIC: | |
700 | case wxBORDER_RAISED: | |
701 | case wxBORDER_SIMPLE: | |
702 | DrawSimpleBorder(dc, &rect); | |
703 | break; | |
704 | ||
705 | default: | |
706 | wxFAIL_MSG(_T("unknown border type")); | |
707 | // fall through | |
708 | ||
709 | case wxBORDER_DEFAULT: | |
710 | case wxBORDER_NONE: | |
711 | break; | |
712 | } | |
713 | ||
714 | if ( rectIn ) | |
715 | *rectIn = rect; | |
147b8a4a VZ |
716 | } |
717 | ||
718 | void wxMonoRenderer::DrawButtonBorder(wxDC& dc, | |
3a01afec | 719 | const wxRect& rect, |
147b8a4a VZ |
720 | int flags, |
721 | wxRect *rectIn) | |
722 | { | |
3a01afec | 723 | DrawBorder(dc, wxBORDER_SIMPLE, rect, flags, rectIn); |
147b8a4a VZ |
724 | } |
725 | ||
726 | // ---------------------------------------------------------------------------- | |
727 | // lines and frames | |
728 | // ---------------------------------------------------------------------------- | |
729 | ||
730 | void | |
731 | wxMonoRenderer::DrawHorizontalLine(wxDC& dc, wxCoord y, wxCoord x1, wxCoord x2) | |
732 | { | |
733 | dc.SetPen(m_penFg); | |
734 | dc.DrawLine(x1, y, x2 + 1, y); | |
735 | } | |
736 | ||
737 | void | |
738 | wxMonoRenderer::DrawVerticalLine(wxDC& dc, wxCoord x, wxCoord y1, wxCoord y2) | |
739 | { | |
740 | dc.SetPen(m_penFg); | |
741 | dc.DrawLine(x, y1, x, y2 + 1); | |
742 | } | |
743 | ||
147b8a4a VZ |
744 | // ---------------------------------------------------------------------------- |
745 | // label | |
746 | // ---------------------------------------------------------------------------- | |
747 | ||
147b8a4a | 748 | void wxMonoRenderer::DrawButtonLabel(wxDC& dc, |
3a01afec VZ |
749 | const wxString& label, |
750 | const wxBitmap& image, | |
751 | const wxRect& rect, | |
752 | int flags, | |
753 | int alignment, | |
754 | int indexAccel, | |
755 | wxRect *rectBounds) | |
147b8a4a | 756 | { |
3a01afec | 757 | dc.SetTextForeground(m_penFg.GetColour()); |
147b8a4a VZ |
758 | dc.DrawLabel(label, image, rect, alignment, indexAccel, rectBounds); |
759 | ||
760 | if ( flags & wxCONTROL_DISABLED ) | |
761 | { | |
762 | // this is ugly but I don't know how to show disabled button visually | |
3a01afec | 763 | // in monochrome theme otherwise, so cross it out |
147b8a4a VZ |
764 | dc.SetPen(m_penFg); |
765 | dc.DrawLine(rect.GetTopLeft(), rect.GetBottomRight()); | |
766 | dc.DrawLine(rect.GetTopRight(), rect.GetBottomLeft()); | |
767 | } | |
768 | } | |
769 | ||
147b8a4a VZ |
770 | // ---------------------------------------------------------------------------- |
771 | // check/radion buttons | |
772 | // ---------------------------------------------------------------------------- | |
773 | ||
3a01afec | 774 | wxBitmap wxMonoRenderer::GetIndicator(IndicatorType indType, int flags) |
147b8a4a | 775 | { |
3a01afec VZ |
776 | IndicatorState indState; |
777 | IndicatorStatus indStatus; | |
778 | GetIndicatorsFromFlags(flags, indState, indStatus); | |
147b8a4a | 779 | |
3a01afec VZ |
780 | wxBitmap& bmp = m_bmpIndicators[indType][indState][indStatus]; |
781 | if ( !bmp.Ok() ) | |
147b8a4a | 782 | { |
3a01afec VZ |
783 | const char **xpm = ms_xpmIndicators[indType][indState][indStatus]; |
784 | if ( xpm ) | |
147b8a4a | 785 | { |
3a01afec VZ |
786 | // create and cache it |
787 | bmp = wxBitmap(xpm); | |
147b8a4a | 788 | } |
147b8a4a VZ |
789 | } |
790 | ||
3a01afec | 791 | return bmp; |
147b8a4a VZ |
792 | } |
793 | ||
3a01afec VZ |
794 | // ---------------------------------------------------------------------------- |
795 | // toolbar | |
796 | // ---------------------------------------------------------------------------- | |
147b8a4a VZ |
797 | |
798 | #if wxUSE_TOOLBAR | |
3a01afec | 799 | |
147b8a4a | 800 | void wxMonoRenderer::DrawToolBarButton(wxDC& dc, |
3a01afec VZ |
801 | const wxString& label, |
802 | const wxBitmap& bitmap, | |
803 | const wxRect& rect, | |
804 | int flags, | |
805 | long style, | |
806 | int tbarStyle) | |
147b8a4a | 807 | { |
3a01afec | 808 | wxFAIL_MSG(_T("TODO")); |
147b8a4a | 809 | } |
3a01afec | 810 | |
147b8a4a VZ |
811 | #endif // wxUSE_TOOLBAR |
812 | ||
813 | // ---------------------------------------------------------------------------- | |
3a01afec | 814 | // notebook |
147b8a4a VZ |
815 | // ---------------------------------------------------------------------------- |
816 | ||
3a01afec | 817 | #if wxUSE_NOTEBOOK |
147b8a4a | 818 | |
3a01afec VZ |
819 | void wxMonoRenderer::DrawTab(wxDC& dc, |
820 | const wxRect& rect, | |
821 | wxDirection dir, | |
822 | const wxString& label, | |
823 | const wxBitmap& bitmap, | |
824 | int flags, | |
825 | int indexAccel) | |
147b8a4a | 826 | { |
3a01afec | 827 | wxFAIL_MSG(_T("TODO")); |
147b8a4a VZ |
828 | } |
829 | ||
3a01afec | 830 | #endif // wxUSE_NOTEBOOK |
147b8a4a VZ |
831 | |
832 | // ---------------------------------------------------------------------------- | |
833 | // combobox | |
834 | // ---------------------------------------------------------------------------- | |
835 | ||
836 | #if wxUSE_COMBOBOX | |
837 | ||
147b8a4a VZ |
838 | void wxMonoRenderer::GetComboBitmaps(wxBitmap *bmpNormal, |
839 | wxBitmap *bmpFocus, | |
840 | wxBitmap *bmpPressed, | |
841 | wxBitmap *bmpDisabled) | |
842 | { | |
3a01afec | 843 | wxFAIL_MSG(_T("TODO")); |
147b8a4a VZ |
844 | } |
845 | ||
846 | #endif // wxUSE_COMBOBOX | |
847 | ||
147b8a4a VZ |
848 | // ---------------------------------------------------------------------------- |
849 | // scrollbar | |
850 | // ---------------------------------------------------------------------------- | |
851 | ||
147b8a4a | 852 | void wxMonoRenderer::DrawArrow(wxDC& dc, |
3a01afec VZ |
853 | wxDirection dir, |
854 | const wxRect& rect, | |
855 | int WXUNUSED(flags)) | |
147b8a4a | 856 | { |
3a01afec VZ |
857 | ArrowDirection arrowDir = GetArrowDirection(dir); |
858 | wxCHECK_RET( arrowDir != Arrow_Max, _T("invalid arrow direction") ); | |
147b8a4a | 859 | |
3a01afec VZ |
860 | wxBitmap& bmp = m_bmpArrows[arrowDir]; |
861 | if ( !bmp.Ok() ) | |
147b8a4a | 862 | { |
3a01afec | 863 | bmp = wxBitmap(ms_xpmArrows[arrowDir]); |
147b8a4a | 864 | } |
147b8a4a | 865 | |
3a01afec VZ |
866 | wxRect rectArrow(0, 0, bmp.GetWidth(), bmp.GetHeight()); |
867 | dc.DrawBitmap(bmp, rectArrow.CentreIn(rect).GetPosition(), true /* use mask */); | |
147b8a4a VZ |
868 | } |
869 | ||
870 | void wxMonoRenderer::DrawScrollbarThumb(wxDC& dc, | |
3a01afec VZ |
871 | wxOrientation WXUNUSED(orient), |
872 | const wxRect& rect, | |
873 | int WXUNUSED(flags)) | |
147b8a4a | 874 | { |
3a01afec | 875 | DrawSolidRect(dc, wxMONO_FG_COL, rect); |
147b8a4a VZ |
876 | } |
877 | ||
878 | void wxMonoRenderer::DrawScrollbarShaft(wxDC& dc, | |
3a01afec VZ |
879 | wxOrientation WXUNUSED(orient), |
880 | const wxRect& rect, | |
881 | int WXUNUSED(flags)) | |
147b8a4a | 882 | { |
3a01afec | 883 | DrawSolidRect(dc, wxMONO_BG_COL, rect); |
147b8a4a VZ |
884 | } |
885 | ||
886 | // ---------------------------------------------------------------------------- | |
887 | // top level windows | |
888 | // ---------------------------------------------------------------------------- | |
889 | ||
890 | void wxMonoRenderer::DrawFrameTitleBar(wxDC& WXUNUSED(dc), | |
891 | const wxRect& WXUNUSED(rect), | |
892 | const wxString& WXUNUSED(title), | |
893 | const wxIcon& WXUNUSED(icon), | |
894 | int WXUNUSED(flags), | |
895 | int WXUNUSED(specialButton), | |
896 | int WXUNUSED(specialButtonFlag)) | |
897 | { | |
898 | } | |
899 | ||
900 | void wxMonoRenderer::DrawFrameBorder(wxDC& WXUNUSED(dc), | |
901 | const wxRect& WXUNUSED(rect), | |
902 | int WXUNUSED(flags)) | |
903 | { | |
904 | } | |
905 | ||
906 | void wxMonoRenderer::DrawFrameBackground(wxDC& WXUNUSED(dc), | |
907 | const wxRect& WXUNUSED(rect), | |
908 | int WXUNUSED(flags)) | |
909 | { | |
910 | } | |
911 | ||
912 | void wxMonoRenderer::DrawFrameTitle(wxDC& WXUNUSED(dc), | |
913 | const wxRect& WXUNUSED(rect), | |
914 | const wxString& WXUNUSED(title), | |
915 | int WXUNUSED(flags)) | |
916 | { | |
917 | } | |
918 | ||
919 | void wxMonoRenderer::DrawFrameIcon(wxDC& WXUNUSED(dc), | |
920 | const wxRect& WXUNUSED(rect), | |
921 | const wxIcon& WXUNUSED(icon), | |
922 | int WXUNUSED(flags)) | |
923 | { | |
924 | } | |
925 | ||
926 | void wxMonoRenderer::DrawFrameButton(wxDC& WXUNUSED(dc), | |
927 | wxCoord WXUNUSED(x), | |
928 | wxCoord WXUNUSED(y), | |
929 | int WXUNUSED(button), | |
930 | int WXUNUSED(flags)) | |
931 | { | |
932 | } | |
933 | ||
934 | wxRect | |
935 | wxMonoRenderer::GetFrameClientArea(const wxRect& rect, | |
936 | int WXUNUSED(flags)) const | |
937 | { | |
938 | return rect; | |
939 | } | |
940 | ||
941 | wxSize | |
942 | wxMonoRenderer::GetFrameTotalSize(const wxSize& clientSize, | |
943 | int WXUNUSED(flags)) const | |
944 | { | |
945 | return clientSize; | |
946 | } | |
947 | ||
948 | wxSize wxMonoRenderer::GetFrameMinSize(int WXUNUSED(flags)) const | |
949 | { | |
950 | return wxSize(0,0); | |
951 | } | |
952 | ||
953 | wxSize wxMonoRenderer::GetFrameIconSize() const | |
954 | { | |
955 | return wxSize(wxDefaultCoord, wxDefaultCoord); | |
956 | } | |
957 | ||
958 | int | |
959 | wxMonoRenderer::HitTestFrame(const wxRect& WXUNUSED(rect), | |
960 | const wxPoint& WXUNUSED(pt), | |
961 | int WXUNUSED(flags)) const | |
962 | { | |
963 | return wxHT_TOPLEVEL_CLIENT_AREA; | |
964 | } | |
965 | ||
966 | ||
967 | // ---------------------------------------------------------------------------- | |
3a01afec | 968 | // wxMonoArtProvider |
147b8a4a VZ |
969 | // ---------------------------------------------------------------------------- |
970 | ||
3a01afec VZ |
971 | wxBitmap wxMonoArtProvider::CreateBitmap(const wxArtID& WXUNUSED(id), |
972 | const wxArtClient& WXUNUSED(client), | |
973 | const wxSize& WXUNUSED(size)) | |
147b8a4a | 974 | { |
147b8a4a VZ |
975 | return wxNullBitmap; |
976 | } | |
977 |