PlatinumStyle.h
1 /* Copyright (C) 2016 Laurentiu-Gheorghe Crisan
2  Copyright (C) 2016 Marc Boris Duerner
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Lesser General Public
6  License as published by the Free Software Foundation; either
7  version 2.1 of the License, or (at your option) any later version.
8 
9  As a special exception, you may use this file as part of a free
10  software library without restriction. Specifically, if other files
11  instantiate templates or use macros or inline functions from this
12  file, or you compile this file and link it with other files to
13  produce an executable, this file does not by itself cause the
14  resulting executable to be covered by the GNU General Public
15  License. This exception does not however invalidate any other
16  reasons why the executable file might be covered by the GNU Library
17  General Public License.
18 
19  This library is distributed in the hope that it will be useful,
20  but WITHOUT ANY WARRANTY; without even the implied warranty of
21  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22  Lesser General Public License for more details.
23 
24  You should have received a copy of the GNU Lesser General Public
25  License along with this library; if not, write to the Free Software
26  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
27  MA 02110-1301 USA
28 */
29 
30 #ifndef Pt_Forms_PlatinumStyle_h
31 #define Pt_Forms_PlatinumStyle_h
32 
33 #include <Pt/Forms/Api.h>
34 #include <Pt/Forms/Style.h>
35 #include <Pt/Forms/ButtonStyler.h>
36 #include <Pt/Forms/PanelStyler.h>
37 #include <Pt/Forms/CheckBoxStyler.h>
38 #include <Pt/Forms/SpinBoxStyler.h>
39 #include <Pt/Forms/SliderStyler.h>
40 #include <Pt/Forms/ScrollBarStyler.h>
41 #include <Pt/Forms/ProgressBarStyler.h>
42 #include <Pt/Forms/LineEditStyler.h>
43 #include <Pt/Forms/ComboBoxStyler.h>
44 #include <Pt/Forms/ListBoxStyler.h>
45 #include <Pt/Forms/TabViewStyler.h>
46 #include <Pt/Forms/Painter.h>
47 #include <Pt/Gfx/Color.h>
48 #include <Pt/Gfx/Font.h>
49 #include <Pt/Gfx/Rect.h>
50 #include <Pt/Gfx/Point.h>
51 #include <Pt/Gfx/Size.h>
52 #include <Pt/Gfx/Path.h>
53 #include <Pt/String.h>
54 
55 #include <cstddef>
56 
57 namespace Pt {
58 
59 namespace Forms {
60 
61 class PlatinumRendererBase : public Style::Facet
62 {
63  public:
64  PlatinumRendererBase(std::size_t refs = 0);
65 
66  virtual ~PlatinumRendererBase();
67 
68  void renderChrome(Painter& painter,
69  const Gfx::RectF& rect,
70  const Gfx::Pen& pen,
71  double corner) const;
72 
73  void renderChrome(Painter& painter,
74  const Gfx::RectF& rect,
75  double penSize,
76  double corner) const;
77 
78  void renderPlane(Painter& painter,
79  const Gfx::RectF& rect,
80  const Gfx::Brush& brush,
81  double corner) const;
82 
83  void renderPlane(Painter& painter,
84  const Gfx::RectF& rect,
85  double corner) const;
86 
87  private:
88  static Gfx::Polygon getPolygon(const Gfx::RectF& rect, double inset, double corner);
89 };
90 
91 
92 class PT_FORMS_API PlatinumPanelRenderer : public PanelRenderer
93 {
94  public:
95  PlatinumPanelRenderer(FacetPtr<PlatinumRendererBase> base,
96  std::size_t refs = 0);
97 
98  virtual ~PlatinumPanelRenderer();
99 
100  protected:
101  virtual PanelRenderer* onCreate() const;
102 
103  virtual void onReset(const StyleOptions& options);
104 
105  virtual Gfx::SizeF onMeasureFrame(PaintSurface& surface,
106  const Gfx::SizeF& contentSize);
107 
108  virtual Gfx::RectF onLayoutFrame(PaintSurface& surface,
109  const Gfx::RectF& rect);
110 
111  virtual const Painter& onGetTextPainter(PaintSurface& surface);
112 
113  virtual void onRenderBackground(PaintContext& context,
114  const Gfx::RectF& rect,
115  const PanelState& state);
116 
117  virtual void onRenderFrame(PaintContext& context,
118  const Gfx::RectF& rect,
119  const PanelState& state);
120 
121  virtual void onRenderText(PaintContext& context,
122  const Gfx::RectF& rect,
123  const String& text,
124  const Gfx::PointF& pos,
125  const PanelState& state);
126 
127  virtual void onRenderIcon(PaintContext& context,
128  const Gfx::RectF& rect,
129  const Pixmap& picture,
130  const Gfx::PointF& pos,
131  const PanelState& state);
132 
133  private:
134  FacetPtr<PlatinumRendererBase> _base;
135  Painter _bgPainter;
136  Painter _framePainter;
137  Painter _textPainter;
138  Painter _iconPainter;
139  double _cornerRadius;
140 };
141 
142 
143 class PT_FORMS_API PlatinumButtonRenderer : public ButtonRenderer
144 {
145  public:
146  PlatinumButtonRenderer(FacetPtr<PlatinumRendererBase> base,
147  std::size_t refs = 0);
148 
149  virtual ~PlatinumButtonRenderer();
150 
151  protected:
152  virtual ButtonRenderer* onCreate() const;
153 
154  virtual void onReset(const StyleOptions& options);
155 
156  virtual Gfx::SizeF onMeasureFrame(PaintSurface& surface,
157  const Gfx::SizeF& contentSize);
158 
159  virtual Gfx::SizeF onMeasureContent(PaintSurface& surface,
160  Direction direction,
161  const Gfx::SizeF& iconSize,
162  const Gfx::SizeF& textSize);
163 
164  virtual Gfx::RectF onLayoutFrame(PaintSurface& surface,
165  const Gfx::RectF& rect);
166 
167  virtual Gfx::RectF onLayoutMnemonic(PaintSurface& surface,
168  const String& text,
169  const Gfx::PointF& textPos,
170  const Gfx::FontMetrics& fontMetrics,
171  String::size_type mnemonicIndex);
172 
173  virtual const Painter& onGetTextPainter(PaintSurface& surface);
174 
175  virtual void onLayoutContent(PaintSurface& surface,
176  const Gfx::RectF& contentRect,
177  Direction direction,
178  const Gfx::SizeF& iconSize,
179  const Gfx::SizeF& textSize,
180  Gfx::RectF& iconRect,
181  Gfx::RectF& textRect);
182 
183  virtual void onRenderBackground(PaintContext& context,
184  const Gfx::RectF& rect,
185  const ButtonState& state);
186 
187  virtual void onPrepareIcon(const Gfx::Image& icon,
188  Pixmap& picture,
189  const ButtonState& state) const;
190 
191  virtual void onRenderChrome(PaintContext& context,
192  const Gfx::RectF& rect,
193  const ButtonState& state);
194 
195  virtual void onRenderText(PaintContext& context,
196  const Gfx::RectF& rect,
197  const String& text,
198  const Gfx::PointF& pos,
199  const ButtonState& state);
200 
201  virtual void onRenderMnemonic(PaintContext& context,
202  const Gfx::RectF& rect,
203  const Gfx::RectF& mnemonic,
204  const ButtonState& state);
205 
206  virtual void onRenderIcon(PaintContext& context,
207  const Gfx::RectF& rect,
208  const Pixmap& picture,
209  const Gfx::PointF& pos,
210  const ButtonState& state);
211 
212  private:
213  FacetPtr<PlatinumRendererBase> _base;
214  Gfx::Color _accentColor;
215  Gfx::Color _textColor;
216  Painter _normalPainter;
217  Painter _pressedPainter;
218  Painter _highlightPainter;
219  Painter _textPainter;
220  Painter _iconPainter;
221 };
222 
223 
224 class PT_FORMS_API PlatinumCheckBoxRenderer : public CheckBoxRenderer
225 {
226  public:
227  PlatinumCheckBoxRenderer(std::size_t refs = 0);
228 
229  virtual ~PlatinumCheckBoxRenderer();
230 
231  protected:
232  virtual CheckBoxRenderer* onCreate() const;
233 
234  virtual void onReset(const StyleOptions& options);
235 
236  virtual Gfx::SizeF onMeasureIndicator(PaintSurface& surface);
237 
238  virtual Gfx::SizeF onMeasureContent(PaintSurface& surface,
239  const Gfx::SizeF& indicatorSize,
240  const Gfx::SizeF& textSize);
241 
242  virtual Gfx::SizeF onMeasureFrame(PaintSurface& surface,
243  const Gfx::SizeF& contentSize);
244 
245  virtual Gfx::RectF onLayoutFrame(PaintSurface& surface,
246  const Gfx::RectF& rect);
247 
248  virtual void onLayoutContent(PaintSurface& surface,
249  const Gfx::RectF& contentRect,
250  const Gfx::SizeF& indicatorSize,
251  const Gfx::SizeF& textSize,
252  Gfx::RectF& indicatorRect,
253  Gfx::RectF& textRect);
254 
255  virtual Gfx::RectF onLayoutMnemonic(PaintSurface& surface,
256  const String& text,
257  const Gfx::PointF& textPos,
258  const Gfx::FontMetrics& fontMetrics,
259  String::size_type mnemonicIndex);
260 
261  virtual const Painter& onGetTextPainter(PaintSurface& surface);
262 
263  virtual void onRenderChrome(PaintContext& context,
264  const Gfx::RectF& rect,
265  const Gfx::RectF& boxRect,
266  const CheckBoxState& state);
267 
268  virtual void onRenderText(PaintContext& context,
269  const Gfx::RectF& textRect,
270  const String& text,
271  const Gfx::PointF& pos,
272  const CheckBoxState& state);
273 
274  virtual void onRenderMnemonic(PaintContext& context,
275  const Gfx::RectF& rect,
276  const Gfx::RectF& mnemonic,
277  const CheckBoxState& state);
278 
279  private:
280  Painter _boxPainter;
281  Painter _textPainter;
282  Gfx::Color _checkColor;
283 };
284 
285 
286 class PT_FORMS_API PlatinumSpinBoxRenderer : public SpinBoxRenderer
287 {
288  public:
289  PlatinumSpinBoxRenderer(std::size_t refs = 0);
290 
291  virtual ~PlatinumSpinBoxRenderer();
292 
293  protected:
294  virtual SpinBoxRenderer* onCreate() const;
295 
298  virtual void onReset(const StyleOptions& options);
299 
300  virtual Gfx::SizeF onMeasureFrame(PaintSurface& surface,
301  const Gfx::SizeF& contentSize);
302 
303  virtual Gfx::SizeF onMeasureEntry(PaintSurface& surface,
304  const Gfx::SizeF& contentSize);
305 
306  virtual Gfx::SizeF onMeasureIndicator(PaintSurface& surface);
307 
308  virtual void onLayoutChrome(PaintSurface& surface,
309  const Gfx::RectF& rect,
310  Gfx::RectF& entryRect,
311  Gfx::RectF& upButtonRect,
312  Gfx::RectF& downButtonRect,
313  Gfx::RectF& textRect);
314 
315  virtual Gfx::RectF onLayoutEntry(PaintSurface& surface,
316  const Gfx::RectF& entryRect);
317 
318  virtual const Painter& onGetTextPainter(PaintSurface& surface);
319 
320  virtual void onRenderChrome(PaintContext& context,
321  const Gfx::RectF& rect,
322  const Gfx::RectF& entryRect,
323  const Gfx::RectF& upButtonRect,
324  const Gfx::RectF& downButtonRect,
325  const SpinBoxState& state);
326 
327  virtual void onRenderEntry(PaintContext& context,
328  const Gfx::RectF& entryRect,
329  const SpinBoxState& state);
330 
331  virtual void onRenderUpButton(PaintContext& context,
332  const Gfx::RectF& buttonRect,
333  const SpinBoxState& state);
334 
335  virtual void onRenderDownButton(PaintContext& context,
336  const Gfx::RectF& buttonRect,
337  const SpinBoxState& state);
338 
339  virtual void onRenderText(PaintContext& context,
340  const Gfx::RectF& textRect,
341  const String& text,
342  const Gfx::PointF& textPos,
343  const Gfx::RectF& cursor,
344  const SpinBoxState& state);
345 
346  private:
347  void renderIndicator(Painter& painter,
348  const Gfx::RectF& rect,
349  bool up,
350  bool hovered);
351 
352  Gfx::Brush _background;
353  Gfx::Pen _contour;
354  Gfx::Brush _foreground;
355  Gfx::Font _font;
356  Gfx::Color _textColor;
357  Gfx::Color _accentColor;
358  Painter _bgPainter;
359  Painter _buttonPainter;
360  Painter _textPainter;
361  double _inset;
362 };
363 
364 
365 class PT_FORMS_API PlatinumLineEditRenderer : public LineEditRenderer
366 {
367  public:
368  PlatinumLineEditRenderer(std::size_t refs = 0);
369 
370  virtual ~PlatinumLineEditRenderer();
371 
372  protected:
373  virtual LineEditRenderer* onCreate() const;
374 
375  virtual void onReset(const StyleOptions& options);
376 
377  virtual Gfx::SizeF onMeasureFrame(PaintSurface& surface,
378  const Gfx::SizeF& contentSize);
379 
380  virtual Gfx::RectF onLayoutFrame(PaintSurface& surface,
381  const Gfx::RectF& rect);
382 
383  virtual const Painter& onGetTextPainter(PaintSurface& surface);
384 
385  virtual void onRenderEntry(PaintContext& context,
386  const Gfx::RectF& rect,
387  const LineEditState& state);
388 
389  virtual void onRenderSelection(PaintContext& context,
390  const Gfx::RectF& textRect,
391  const Gfx::RectF& selection,
392  const LineEditState& state);
393 
394  virtual void onRenderText(PaintContext& context,
395  const Gfx::RectF& textRect,
396  const String& text,
397  const Gfx::PointF& textPos,
398  const LineEditState& state);
399 
400  virtual void onRenderCursor(PaintContext& context,
401  const Gfx::RectF& textRect,
402  const Gfx::RectF& cursor,
403  const LineEditState& state);
404 
405  private:
406  Painter _bgPainter;
407  Painter _selectionPainter;
408  Painter _textPainter;
409  double _inset;
410 
411  Gfx::Brush _background;
412  Gfx::Pen _contour;
413  Gfx::Font _font;
414  Gfx::Color _textColor;
415  Gfx::Color _accentColor;
416  Gfx::Color _selectionBackground;
417  Gfx::Color _selectionTextColor;
418 };
419 
420 
421 class PT_FORMS_API PlatinumProgressBarRenderer : public ProgressBarRenderer
422 {
423  public:
424  PlatinumProgressBarRenderer(std::size_t refs = 0);
425 
426  virtual ~PlatinumProgressBarRenderer();
427 
428  protected:
429  virtual ProgressBarRenderer* onCreate() const;
430 
431  virtual void onReset(const StyleOptions& options);
432 
433  virtual Gfx::SizeF onMeasureFrame(PaintSurface& surface,
434  const Gfx::SizeF& contentSize);
435 
436  virtual Gfx::SizeF onMeasureBar(PaintSurface& surface);
437 
438  virtual void onLayoutChrome(PaintSurface& surface,
439  const Gfx::RectF& rect,
440  const Gfx::SizeF& barSize,
441  const Gfx::SizeF& textSize,
442  Gfx::RectF& barRect,
443  Gfx::RectF& textRect);
444 
445  virtual void onLayoutBar(PaintSurface& surface,
446  const Gfx::RectF& barRect,
447  float progressRatio,
448  Gfx::RectF& trackRect,
449  Gfx::RectF& chunkRect);
450 
451  virtual const Painter& onGetTextPainter(PaintSurface& surface);
452 
453  virtual void onRenderTrack(PaintContext& context,
454  const Gfx::RectF& trackRect,
455  const ProgressBarState& state);
456 
457  virtual void onRenderChunk(PaintContext& context,
458  const Gfx::RectF& chunkRect,
459  const ProgressBarState& state);
460 
461  virtual void onRenderText(PaintContext& context,
462  const Gfx::RectF& textRect,
463  const Gfx::RectF& chunkRect,
464  const String& text,
465  const Gfx::PointF& textPos,
466  const ProgressBarState& state);
467 
468  private:
469  //Gfx::Brush _foreground;
470  Gfx::Color _textBackground;
471  Painter _trackPainter;
472  Painter _chunkPainter;
473  Painter _textPainter;
474  Painter _invertTextPainter;
475 };
476 
477 class PT_FORMS_API PlatinumSliderRenderer : public SliderRenderer
478 {
479  public:
480  PlatinumSliderRenderer(std::size_t refs = 0);
481 
482  virtual ~PlatinumSliderRenderer();
483 
484  protected:
485  virtual SliderRenderer* onCreate() const;
486 
489  virtual void onReset(const StyleOptions& options);
490 
491  virtual Gfx::SizeF onMeasureFrame(PaintSurface& surface,
492  const Gfx::SizeF& contentSize);
493 
494  virtual Gfx::SizeF onMeasureTrack(PaintSurface& surface);
495 
496  virtual Gfx::SizeF onMeasureHandle(PaintSurface& surface);
497 
498  virtual void onLayoutChrome(PaintSurface& surface,
499  const Gfx::RectF& rect,
500  const Gfx::SizeF& trackSize,
501  const Gfx::SizeF& handleSize,
502  Gfx::RectF& trackRect,
503  Gfx::RectF& handleRect);
504 
505  virtual void onLayoutHandle(PaintSurface& surface,
506  const Gfx::RectF& trackRect,
507  float fraction,
508  Gfx::RectF& handleRect);
509 
510  virtual void onRenderTrack(PaintContext& context,
511  const Gfx::RectF& trackRect,
512  const SliderState& state);
513 
514  virtual void onRenderHandle(PaintContext& context,
515  const Gfx::RectF& handleRect,
516  const SliderState& state);
517 
518  private:
519  Gfx::Brush _hoverBrush;
520  Gfx::Brush _contourBrush;
521  Painter _trackPainter;
522  Painter _handlePainter;
523 };
524 
525 
526 class PT_FORMS_API PlatinumScrollBarRenderer : public ScrollBarRenderer
527 {
528  public:
529  PlatinumScrollBarRenderer(std::size_t refs = 0);
530 
531  virtual ~PlatinumScrollBarRenderer();
532 
533  protected:
534  virtual ScrollBarRenderer* onCreate() const;
535 
538  virtual void onReset(const StyleOptions& options);
539 
540  virtual Gfx::SizeF onMeasureFrame(PaintSurface& surface,
541  const Gfx::SizeF& contentSize,
542  Direction direction);
543 
544  virtual Gfx::SizeF onMeasureTrack(PaintSurface& surface,
545  Direction direction);
546 
547  virtual Gfx::SizeF onMeasureHandle(PaintSurface& surface,
548  Direction direction);
549 
550  virtual Gfx::SizeF onMeasureButton(PaintSurface& surface,
551  Direction direction);
552 
553  virtual void onLayoutChrome(PaintSurface& surface,
554  const Gfx::RectF& rect,
555  Direction direction,
556  const Gfx::SizeF& buttonSize,
557  Gfx::RectF& trackRect,
558  Gfx::RectF& decreaseRect,
559  Gfx::RectF& increaseRect);
560 
561  virtual void onLayoutHandle(PaintSurface& surface,
562  const Gfx::RectF& trackRect,
563  Direction direction,
564  float fraction,
565  float viewProportion,
566  Gfx::RectF& handleRect);
567 
568  virtual void onRenderTrack(PaintContext& context,
569  const Gfx::RectF& trackRect,
570  Direction direction,
571  const ScrollBarState& state);
572 
573  virtual void onRenderHandle(PaintContext& context,
574  const Gfx::RectF& handleRect,
575  Direction direction,
576  const ScrollBarState& state);
577 
578  virtual void onRenderDecreaseButton(PaintContext& context,
579  const Gfx::RectF& buttonRect,
580  Direction direction,
581  const ScrollBarState& state);
582 
583  virtual void onRenderIncreaseButton(PaintContext& context,
584  const Gfx::RectF& buttonRect,
585  Direction direction,
586  const ScrollBarState& state);
587 
588  private:
589  Gfx::Brush _background;
590  Gfx::Pen _contour;
591  Gfx::Color _accentColor;
592  Painter _trackPainter;
593  Painter _handlePainter;
594  Painter _buttonPainter;
595 };
596 
597 
598 class PT_FORMS_API PlatinumListBoxRenderer : public ListBoxRenderer
599 {
600  public:
601  PlatinumListBoxRenderer(std::size_t refs = 0);
602 
603  virtual ~PlatinumListBoxRenderer();
604 
605  protected:
606  virtual ListBoxRenderer* onCreate() const;
607 
608  virtual void onReset(const StyleOptions& options);
609 
610  virtual Gfx::SizeF onMeasureFrame(PaintSurface& surface,
611  const Gfx::SizeF& contentSize);
612 
613  virtual Gfx::RectF onLayoutFrame(PaintSurface& surface,
614  const Gfx::RectF& rect);
615 
616  virtual void onRenderBackground(PaintContext& context,
617  const Gfx::RectF& rect,
618  const ListBoxState& state);
619 
620  virtual void onRenderChrome(PaintContext& context,
621  const Gfx::RectF& rect,
622  const ListBoxState& state);
623 
624  private:
625  Gfx::Brush _viewBackground;
626  Gfx::Pen _contour;
627  Painter _bgPainter;
628  Painter _framePainter;
629 };
630 
631 
632 class PT_FORMS_API PlatinumListItemRenderer : public ListItemRenderer
633 {
634  public:
635  PlatinumListItemRenderer(std::size_t refs = 0);
636 
637  virtual ~PlatinumListItemRenderer();
638 
639  protected:
640  virtual ListItemRenderer* onCreate() const;
641 
644  virtual void onReset(const StyleOptions& options);
645 
646  virtual Gfx::SizeF onMeasureContent(PaintSurface& surface,
647  const Gfx::SizeF& iconSize,
648  const Gfx::SizeF& textSize);
649 
650  virtual Gfx::SizeF onMeasureFrame(PaintSurface& surface,
651  const Gfx::SizeF& contentSize);
652 
653  virtual const Painter& onGetTextPainter(PaintSurface& surface);
654 
655  virtual Gfx::RectF onLayoutFrame(PaintSurface& surface,
656  const Gfx::RectF& rect);
657 
658  virtual void onLayoutContent(PaintSurface& surface,
659  const Gfx::RectF& contentRect,
660  const Gfx::SizeF& iconSize,
661  const Gfx::SizeF& textSize,
662  Gfx::RectF& iconRect,
663  Gfx::RectF& textRect);
664 
665  virtual void onRenderBackground(PaintContext& context,
666  const Gfx::RectF& rect,
667  const ListItemState& state);
668 
669  virtual void onRenderHighlight(PaintContext& context,
670  const Gfx::RectF& rect,
671  const ListItemState& state);
672 
673  virtual void onRenderText(PaintContext& context,
674  const Gfx::RectF& textRect,
675  const String& text,
676  const Gfx::PointF& pos,
677  const ListItemState& state);
678 
679  virtual void onRenderIcon(PaintContext& context,
680  const Gfx::RectF& iconRect,
681  const Pixmap& picture,
682  const Gfx::PointF& pos,
683  const ListItemState& state);
684 
685  private:
686  Gfx::Brush _background;
687  Gfx::Font _font;
688  Gfx::Color _textColor;
689  Gfx::Brush _highlightBrush;
690  Gfx::Color _highlightedTextColor;
691  Painter _bgPainter;
692  Painter _iconPainter;
693  Painter _textPainter;
694 };
695 
696 
697 class PT_FORMS_API PlatinumComboBoxRenderer : public ComboBoxRenderer
698 {
699  public:
700  PlatinumComboBoxRenderer(std::size_t refs = 0);
701 
702  virtual ~PlatinumComboBoxRenderer();
703 
704  protected:
705  virtual ComboBoxRenderer* onCreate() const;
706 
709  virtual void onReset(const StyleOptions& options);
710 
711  virtual Gfx::SizeF onMeasureFrame(PaintSurface& surface,
712  const Gfx::SizeF& contentSize);
713 
714  virtual Gfx::SizeF onMeasureButton(PaintSurface& surface);
715 
716  virtual void onLayoutChrome(PaintSurface& surface,
717  const Gfx::RectF& rect,
718  Gfx::RectF& entryRect,
719  Gfx::RectF& buttonRect,
720  Gfx::RectF& textRect);
721 
722  virtual const Painter& onGetTextPainter(PaintSurface& surface);
723 
724  virtual void onRenderChrome(PaintContext& context,
725  const Gfx::RectF& rect,
726  const Gfx::RectF& entryRect,
727  const Gfx::RectF& buttonRect,
728  const ComboBoxState& state,
729  const ComboBoxButtonState& buttonState);
730 
731  virtual void onRenderEntry(PaintContext& context,
732  const Gfx::RectF& entryRect,
733  const ComboBoxState& state);
734 
735  virtual void onRenderButton(PaintContext& context,
736  const Gfx::RectF& buttonRect,
737  const ComboBoxState& state,
738  const ComboBoxButtonState& buttonState);
739 
740  virtual void onRenderText(PaintContext& context,
741  const Gfx::RectF& textRect,
742  const String& text,
743  const Gfx::PointF& textPos,
744  const Gfx::RectF& cursor,
745  const ComboBoxState& state);
746 
747  private:
748  Gfx::Brush _background;
749  Gfx::Pen _contour;
750  Gfx::Brush _foreground;
751  Gfx::Font _font;
752  Gfx::Color _textColor;
753  Gfx::Color _accentColor;
754  double _inset;
755  Painter _bgPainter;
756  Painter _buttonPainter;
757  Painter _textPainter;
758 };
759 
760 
761 class PT_FORMS_API PlatinumTabViewRenderer : public TabViewRenderer
762 {
763  public:
764  PlatinumTabViewRenderer(std::size_t refs = 0);
765 
766  virtual ~PlatinumTabViewRenderer();
767 
768  protected:
769  virtual TabViewRenderer* onCreate() const;
770 
773  virtual void onReset(const StyleOptions& options);
774 
775  virtual Gfx::SizeF onMeasureTab(PaintSurface& surface,
776  const Pt::String& text);
777 
778  virtual Gfx::RectF onLayoutTab(PaintSurface& surface,
779  const Gfx::RectF& tabRect);
780 
781  virtual const Painter& onGetTextPainter(PaintSurface& surface);
782 
783  virtual void onRenderBackground(PaintContext& context,
784  const Gfx::RectF& contentRect,
785  const TabViewState& state);
786 
787  virtual void onRenderChrome(PaintContext& context,
788  const Gfx::RectF& contentRect,
789  const Gfx::RectF& activeTabRect,
790  const TabViewState& state);
791 
792  virtual void onRenderTab(PaintContext& context,
793  const Gfx::RectF& tabRect,
794  const Pt::String& text,
795  const Gfx::PointF& textPos,
796  const TabViewItemState& state);
797 
798  private:
799  Gfx::Brush _background;
800  Gfx::Pen _contour;
801  Gfx::Font _font;
802  Gfx::Color _textColor;
803  Gfx::Color _accentColor;
804  double _inset;
805  Painter _bgPainter;
806  Painter _framePainter;
807  Painter _textPainter;
808  Painter _activeTextPainter;
809 };
810 
811 
820 class PT_FORMS_API PlatinumStyle : public Style
821 {
822  public:
826 
830 };
831 
832 } // namespace
833 
834 } // namespace
835 
836 #endif
Core module.
Definition: Allocator.h:33
PlatinumStyle()
Constructor.
Stores renderer facets for the active theme.
Definition: Style.h:203
Provides the built-in default Style.
Definition: PlatinumStyle.h:821
~PlatinumStyle()
Destructor.
Unicode capable basic_string.
Definition: Api-String.h:44