31 #ifndef Pt_Forms_Style_h
32 #define Pt_Forms_Style_h
34 #include <Pt/Forms/Api.h>
35 #include <Pt/Forms/Spacing.h>
36 #include <Pt/Forms/PaintSurface.h>
37 #include <Pt/Gfx/Painter.h>
38 #include <Pt/Gfx/Color.h>
39 #include <Pt/Gfx/Brush.h>
40 #include <Pt/Gfx/Pen.h>
41 #include <Pt/Gfx/Rect.h>
42 #include <Pt/Gfx/Font.h>
43 #include <Pt/Gfx/TextMetrics.h>
44 #include <Pt/TypeInfo.h>
45 #include <Pt/NonCopyable.h>
81 FacetPtr(T* facet = 0)
88 FacetPtr(
const FacetPtr& ptr)
99 if( 0 == _facet->unref() )
104 FacetPtr& operator=(
const FacetPtr& ptr)
111 if( 0 == _facet->unref() )
122 void reset(T* facet = 0)
129 if( 0 == _facet->unref() )
138 T* operator->()
const
144 bool operator! ()
const
145 {
return _facet == 0; }
147 operator bool ()
const
148 {
return _facet != 0; }
160 class PT_FORMS_API Style
163 class Facet :
private NonCopyable
166 explicit Facet(
const std::type_info& ti, std::size_t refs = 0)
174 const std::type_info& typeId()
const
190 const std::type_info* _typeId;
197 Style(
const Style& style);
201 Style& operator=(
const Style& style);
203 void assign(
const Style& style);
205 void combine(
const Style& style);
207 void set(Facet* facet);
209 template <
typename FacetT>
212 Facet* facet = find(
typeid(FacetT) );
213 return static_cast<FacetT*
>(facet);
217 Facet* find(
const std::type_info& ti)
const;
220 typedef std::map<TypeInfo, Facet*> FacetMap;
225 class PT_FORMS_API ButtonRenderer :
public Style::Facet
228 ButtonRenderer(std::size_t refs = 0);
230 virtual ~ButtonRenderer();
232 void prepare(
const PushButton& button,
233 const StyleOptions& options,
237 Gfx::Pen& textPen)
const;
239 void prepareIcon(
const PushButton& button,
240 const StyleOptions& options,
241 const Gfx::Image& icon,
242 Pixmap& picture)
const;
244 void renderBackground(
const PushButton& button,
245 const StyleOptions& options,
246 Gfx::Painter& painter,
247 const Gfx::RectF& rect,
248 const Gfx::Brush& brush,
249 const Gfx::Pen& pen)
const;
251 void renderText(
const PushButton& button,
252 const StyleOptions& options,
253 Gfx::Painter& painter,
254 const Gfx::RectF& rect,
256 const Gfx::PointF& textPos,
257 const Gfx::Font& font,
258 const Gfx::Pen& textPen,
259 const Gfx::RectF& mnemonic)
const;
262 virtual void onPrepare(
const PushButton& button,
263 const StyleOptions& options,
267 Gfx::Pen& textPen)
const = 0;
269 virtual void onPrepareIcon(
const PushButton& button,
270 const StyleOptions& options,
271 const Gfx::Image& icon,
272 Pixmap& picture)
const = 0;
274 virtual void onRenderBackground(
const PushButton& button,
275 const StyleOptions& options,
276 Gfx::Painter& painter,
277 const Gfx::RectF& rect,
278 const Gfx::Brush& brush,
279 const Gfx::Pen& pen)
const = 0;
281 virtual void onRenderText(
const PushButton& button,
282 const StyleOptions& options,
283 Gfx::Painter& painter,
284 const Gfx::RectF& rect,
286 const Gfx::PointF& textPos,
287 const Gfx::Font& font,
288 const Gfx::Pen& textPen,
289 const Gfx::RectF& mnemonic)
const = 0;
293 class PT_FORMS_API CheckBoxRenderer :
public Style::Facet
296 CheckBoxRenderer(std::size_t refs = 0);
298 virtual ~CheckBoxRenderer();
300 void prepare(
const CheckBox& cb,
301 const StyleOptions& options,
306 Gfx::SizeF& boxSize)
const;
308 void renderBox(
const CheckBox& cb,
309 const StyleOptions& options,
310 Gfx::Painter& painter,
311 const Gfx::RectF& rect,
312 const Gfx::RectF& boxRect,
313 const Gfx::Brush& brush,
314 const Gfx::Pen& pen)
const;
316 void renderText(
const CheckBox& cb,
317 const StyleOptions& options,
318 Gfx::Painter& painter,
319 const Gfx::RectF& rect,
321 const Gfx::PointF& textPos,
322 const Gfx::TextMetrics& textMetric,
323 const Gfx::Font& font,
324 const Gfx::Pen& textPen,
325 const Gfx::RectF& mnemonic)
const;
328 virtual void onPrepare(
const CheckBox& cb,
329 const StyleOptions& options,
334 Gfx::SizeF& boxSize)
const = 0;
336 virtual void onRenderBox(
const CheckBox& cb,
337 const StyleOptions& options,
338 Gfx::Painter& painter,
339 const Gfx::RectF& rect,
340 const Gfx::RectF& boxRect,
341 const Gfx::Brush& brush,
342 const Gfx::Pen& pen)
const = 0;
344 virtual void onRenderText(
const CheckBox& cb,
345 const StyleOptions& options,
346 Gfx::Painter& painter,
347 const Gfx::RectF& rect,
349 const Gfx::PointF& textPos,
350 const Gfx::TextMetrics& textMetric,
351 const Gfx::Font& font,
352 const Gfx::Pen& textPen,
353 const Gfx::RectF& mnemonic)
const = 0;
357 class PT_FORMS_API PanelRenderer :
public Style::Facet
360 PanelRenderer(std::size_t refs = 0);
362 virtual ~PanelRenderer();
364 void renderBackground(
const Panel& p,
365 const StyleOptions& options,
366 Gfx::Painter& painter,
367 const Gfx::RectF& rect,
368 const Gfx::Brush& brush)
const;
370 void renderFrame(
const Panel& p,
371 const StyleOptions& options,
372 Gfx::Painter& painter,
373 const Gfx::RectF& rect,
374 const Gfx::Pen& pen)
const;
377 virtual void onRenderBackground(
const Panel& p,
378 const StyleOptions& options,
379 Gfx::Painter& painter,
380 const Gfx::RectF& rect,
381 const Gfx::Brush& brush)
const = 0;
383 virtual void onRenderFrame(
const Panel& p,
384 const StyleOptions& options,
385 Gfx::Painter& painter,
386 const Gfx::RectF& rect,
387 const Gfx::Pen& pen)
const = 0;
391 class PT_FORMS_API LabelRenderer :
public Style::Facet
394 LabelRenderer(std::size_t refs = 0);
396 virtual ~LabelRenderer();
398 void prepare(
const Label& l,
399 const StyleOptions& options,
402 Gfx::Pen& textPen)
const;
404 void renderBackground(
const Label& l,
405 const StyleOptions& options,
407 const Gfx::RectF& rect,
408 const Gfx::Brush& brush)
const;
410 void renderFrame(
const Label& l,
411 const StyleOptions& options,
413 const Gfx::RectF& rect,
414 const Gfx::Pen& contour)
const;
416 void renderText(
const Label& l,
417 const StyleOptions& options,
419 const Gfx::RectF& rect,
421 const Gfx::PointF& textPos,
422 const Gfx::Font& font,
423 const Gfx::Pen& textPen)
const;
426 virtual void onPrepare(
const Label& l,
427 const StyleOptions& options,
430 Gfx::Pen& textPen)
const = 0;
432 virtual void onRenderBackground(
const Label& l,
433 const StyleOptions& options,
435 const Gfx::RectF& rect,
436 const Gfx::Brush& brush)
const = 0;
438 virtual void onRenderFrame(
const Label& l,
439 const StyleOptions& options,
441 const Gfx::RectF& rect,
442 const Gfx::Pen& contour)
const = 0;
444 virtual void onRenderText(
const Label& l,
445 const StyleOptions& options,
447 const Gfx::RectF& rect,
449 const Gfx::PointF& textPos,
450 const Gfx::Font& font,
451 const Gfx::Pen& textPen)
const = 0;
454 class PT_FORMS_API LineEditRenderer :
public Style::Facet
457 LineEditRenderer(std::size_t refs = 0);
459 virtual ~LineEditRenderer();
461 void prepare(
const LineEdit& le,
462 const StyleOptions& options,
466 Gfx::Pen& textPen)
const;
468 void renderBackground(
const LineEdit& le,
469 const StyleOptions& options,
470 Gfx::Painter& painter,
471 const Gfx::RectF& rect,
472 const Gfx::Pen& contour,
473 const Gfx::Brush& brush)
const;
475 void renderText(
const LineEdit& le,
476 const StyleOptions& options,
477 Gfx::Painter& painter,
478 const Gfx::RectF& rect,
480 const Gfx::PointF& textPos,
481 const Gfx::Font& font,
482 const Gfx::Pen& textPen)
const;
484 void renderCursor(
const LineEdit& le,
485 const StyleOptions& options,
486 Gfx::Painter& painter,
487 const Gfx::RectF& rect,
488 const Gfx::RectF& cursorRect )
const;
491 virtual void onPrepare(
const LineEdit& le,
492 const StyleOptions& options,
496 Gfx::Pen& textPen)
const = 0;
498 virtual void onRenderBackground(
const LineEdit& le,
499 const StyleOptions& options,
500 Gfx::Painter& painter,
501 const Gfx::RectF& rect,
502 const Gfx::Pen& contour,
503 const Gfx::Brush& brush)
const = 0;
505 virtual void onRenderText(
const LineEdit& le,
506 const StyleOptions& options,
507 Gfx::Painter& painter,
508 const Gfx::RectF& rect,
510 const Gfx::PointF& textPos,
511 const Gfx::Font& font,
512 const Gfx::Pen& textPen)
const = 0;
514 virtual void onRenderCursor(
const LineEdit& le,
515 const StyleOptions& options,
516 Gfx::Painter& painter,
517 const Gfx::RectF& rect,
518 const Gfx::RectF& cursorRect )
const = 0;
521 class PT_FORMS_API MenuRenderer :
public Style::Facet
524 MenuRenderer(std::size_t refs = 0);
526 virtual ~MenuRenderer();
528 void prepare(
const Menu& m,
529 const StyleOptions& options,
531 Gfx::Pen& contour)
const;
533 void prepareItem(
const MenuItem& m,
534 const StyleOptions& options,
535 const Gfx::Image& icon,
540 Gfx::Pen& textPen)
const;
542 void renderBackground(
const Menu& m,
543 const StyleOptions& options,
544 Gfx::Painter& painter,
545 const Gfx::RectF& rect,
546 const Gfx::Brush& brush,
547 const Gfx::Pen& contour)
const;
549 void renderItem(
const MenuItem& m,
550 const StyleOptions& options,
551 Gfx::Painter& painter,
552 const Gfx::RectF& rect,
554 Gfx::Pen& contour)
const;
556 void renderIndicator(
const MenuItem& m,
557 const StyleOptions& options,
558 Gfx::Painter& painter,
559 const Gfx::RectF& rect)
const;
562 virtual void onPrepare(
const Menu& m,
563 const StyleOptions& options,
565 Gfx::Pen& contour)
const = 0;
567 virtual void onPrepareItem(
const MenuItem& m,
568 const StyleOptions& options,
569 const Gfx::Image& icon,
574 Gfx::Pen& textPen)
const = 0;
576 virtual void onRenderBackground(
const Menu& m,
577 const StyleOptions& options,
578 Gfx::Painter& painter,
579 const Gfx::RectF& rect,
580 const Gfx::Brush& brush,
581 const Gfx::Pen& contour)
const = 0;
583 virtual void onRenderItem(
const MenuItem& m,
584 const StyleOptions& options,
585 Gfx::Painter& painter,
586 const Gfx::RectF& rect,
588 Gfx::Pen& contour)
const = 0;
590 virtual void onRenderIndicator(
const MenuItem& m,
591 const StyleOptions& options,
592 Gfx::Painter& painter,
593 const Gfx::RectF& rect)
const = 0;
596 class PT_FORMS_API MenuBarRenderer :
public Style::Facet
599 MenuBarRenderer(std::size_t refs = 0);
601 virtual ~MenuBarRenderer();
603 void prepare(
const MenuBar& m,
604 const StyleOptions& options,
606 Gfx::Pen& contour)
const;
608 void renderBackground(
const MenuBar& m,
609 const StyleOptions& options,
610 Gfx::Painter& painter,
611 const Gfx::RectF& rect,
612 const Gfx::Brush& brush,
613 const Gfx::Pen& contour)
const;
615 void prepareItem(
const MenuBarItem& m,
616 const StyleOptions& options,
620 Gfx::Pen& textPen)
const;
622 void renderItem(
const MenuBarItem& m,
623 const StyleOptions& options,
624 Gfx::Painter& painter,
625 const Gfx::RectF& rect,
626 const Gfx::Brush& brush,
627 const Gfx::Pen& contour)
const;
629 void renderItemText(
const MenuBarItem& m,
630 const StyleOptions& options,
631 Gfx::Painter& painter,
632 const Gfx::RectF& rect,
634 const Gfx::PointF& textPos,
635 const Gfx::Font& font,
636 const Gfx::Pen& textPen,
637 const Gfx::RectF& mnemonic)
const;
640 virtual void onPrepare(
const MenuBar& m,
641 const StyleOptions& options,
643 Gfx::Pen& contour)
const = 0;
645 virtual void onRenderBackground(
const MenuBar& m,
646 const StyleOptions& options,
647 Gfx::Painter& painter,
648 const Gfx::RectF& rect,
649 const Gfx::Brush& brush,
650 const Gfx::Pen& contour)
const = 0;
652 virtual void onPrepareItem(
const MenuBarItem& m,
653 const StyleOptions& options,
657 Gfx::Pen& textPen)
const = 0;
659 virtual void onRenderItem(
const MenuBarItem& m,
660 const StyleOptions& options,
661 Gfx::Painter& painter,
662 const Gfx::RectF& rect,
663 const Gfx::Brush& brush,
664 const Gfx::Pen& contour)
const = 0;
666 virtual void onRenderItemText(
const MenuBarItem& m,
667 const StyleOptions& options,
668 Gfx::Painter& painter,
669 const Gfx::RectF& rect,
671 const Gfx::PointF& textPos,
672 const Gfx::Font& font,
673 const Gfx::Pen& textPen,
674 const Gfx::RectF& mnemonic)
const = 0;
678 class PT_FORMS_API ScrollBarRenderer :
public Style::Facet
681 ScrollBarRenderer(std::size_t refs = 0);
683 virtual ~ScrollBarRenderer();
685 void prepare(
const ScrollBar& s,
686 const StyleOptions& options,
687 Gfx::Brush& background,
688 Gfx::Brush& foreground,
689 Gfx::Pen& contour)
const;
691 void render(
const ScrollBar& s,
692 const StyleOptions& options,
693 Gfx::Painter& painter,
694 const Gfx::RectF& rect,
695 const Gfx::RectF& handleRect,
696 const Gfx::Brush& background,
697 const Gfx::Brush& foreground,
698 const Gfx::Pen& contour)
const;
701 virtual void onPrepare(
const ScrollBar& s,
702 const StyleOptions& options,
703 Gfx::Brush& background,
704 Gfx::Brush& foreground,
705 Gfx::Pen& contour)
const = 0;
707 virtual void onRender(
const ScrollBar& s,
708 const StyleOptions& options,
709 Gfx::Painter& painter,
710 const Gfx::RectF& rect,
711 const Gfx::RectF& handleRect,
712 const Gfx::Brush& background,
713 const Gfx::Brush& foreground,
714 const Gfx::Pen& contour)
const = 0;
718 class PT_FORMS_API ProgressBarRenderer :
public Style::Facet
721 ProgressBarRenderer(std::size_t refs = 0);
723 virtual ~ProgressBarRenderer();
725 void prepare(
const ProgressBar& p,
726 const StyleOptions& options,
727 Gfx::Brush& background,
728 Gfx::Brush& foreground,
734 void render(
const ProgressBar& p,
735 const StyleOptions& options,
736 Gfx::Painter& painter,
737 const Gfx::RectF& rect,
738 const Gfx::Brush& background,
739 const Gfx::Brush& foreground,
740 const Gfx::Pen& contour,
741 const Gfx::Pen& textPen,
742 const Gfx::Font& font
746 virtual void onPrepare(
const ProgressBar& p,
747 const StyleOptions& options,
748 Gfx::Brush& background,
749 Gfx::Brush& foreground,
755 virtual void onRender(
const ProgressBar& p,
756 const StyleOptions& options,
757 Gfx::Painter& painter,
758 const Gfx::RectF& rect,
759 const Gfx::Brush& background,
760 const Gfx::Brush& foreground,
761 const Gfx::Pen& contour,
762 const Gfx::Pen& textPen,
763 const Gfx::Font& font
768 class PT_FORMS_API SliderRenderer :
public Style::Facet
771 SliderRenderer(std::size_t refs = 0);
773 virtual ~SliderRenderer();
775 void prepare(
const Slider& s,
776 const StyleOptions& options,
777 Gfx::Brush& background,
778 Gfx::Brush& foreground,
784 void render(
const Slider& s,
785 const StyleOptions& options,
786 Gfx::Painter& painter,
787 const Gfx::RectF& rect,
788 const Gfx::Brush& background,
789 const Gfx::Brush& foreground,
790 const Gfx::Pen& contour,
791 const Gfx::Pen& textPen,
792 const Gfx::Font& font
796 virtual void onPrepare(
const Slider& s,
797 const StyleOptions& options,
798 Gfx::Brush& background,
799 Gfx::Brush& foreground,
805 virtual void onRender(
const Slider& s,
806 const StyleOptions& options,
807 Gfx::Painter& painter,
808 const Gfx::RectF& rect,
809 const Gfx::Brush& background,
810 const Gfx::Brush& foreground,
811 const Gfx::Pen& contour,
812 const Gfx::Pen& textPen,
813 const Gfx::Font& font
818 class PT_FORMS_API ListBoxRenderer :
public Style::Facet
821 ListBoxRenderer(std::size_t refs = 0);
823 virtual ~ListBoxRenderer();
825 void prepareLayout(Spacing& frameSize);
827 void renderBackground(
const ListBox& lb,
828 const StyleOptions& options,
829 Gfx::Painter& painter,
830 const Gfx::RectF& rect,
831 const Gfx::Brush& brush)
const;
833 void renderFrame(
const ListBox& lb,
834 const StyleOptions& options,
835 Gfx::Painter& painter,
836 const Gfx::RectF& rect,
837 const Gfx::Pen& pen)
const;
839 void prepareItem(
const ListBoxItem& item,
840 const StyleOptions& options,
844 Gfx::Pen& textPen)
const;
846 void renderItem(
const ListBoxItem& item,
847 const StyleOptions& options,
848 Gfx::Painter& painter,
849 const Gfx::RectF& rect,
851 Gfx::Pen& contour)
const;
854 virtual void onPrepareLayout(Spacing& frameSize) = 0;
856 virtual void onRenderBackground(
const ListBox& lb,
857 const StyleOptions& options,
858 Gfx::Painter& painter,
859 const Gfx::RectF& rect,
860 const Gfx::Brush& brush)
const = 0;
862 virtual void onRenderFrame(
const ListBox& lb,
863 const StyleOptions& options,
864 Gfx::Painter& painter,
865 const Gfx::RectF& rect,
866 const Gfx::Pen& pen)
const = 0;
868 virtual void onPrepareItem(
const ListBoxItem& item,
869 const StyleOptions& options,
873 Gfx::Pen& textPen)
const = 0;
875 virtual void onRenderItem(
const ListBoxItem& item,
876 const StyleOptions& options,
877 Gfx::Painter& painter,
878 const Gfx::RectF& rect,
880 Gfx::Pen& contour)
const = 0;
884 class PT_FORMS_API ComboBoxRenderer :
public Style::Facet
887 ComboBoxRenderer(std::size_t refs = 0);
889 virtual ~ComboBoxRenderer();
891 void prepare(
const ComboBox& cb,
892 const StyleOptions& options,
893 Gfx::Brush& background,
894 Gfx::Brush& foreground,
897 Gfx::Pen& textPen)
const;
899 void prepareLayout(
const ComboBox& cb,
900 Gfx::SizeF& buttonSize)
const;
902 void renderBackground(
const ComboBox& cb,
903 const StyleOptions& options,
904 Gfx::Painter& painter,
905 const Gfx::RectF& rect,
906 const Gfx::Pen& contour,
907 const Gfx::Brush& brush)
const;
909 void renderButton(
const ComboBox& cb,
910 const StyleOptions& options,
911 Gfx::Painter& painter,
912 const Gfx::RectF& rect,
913 const Gfx::Pen& contour,
914 const Gfx::Brush& foreground)
const;
916 void renderText(
const ComboBox& cb,
917 const StyleOptions& options,
918 Gfx::Painter& painter,
919 const Gfx::RectF& rect,
921 const Gfx::PointF& textPos,
922 const Gfx::Font& font,
923 const Gfx::Pen& textPen,
924 const Gfx::RectF& cursor)
const;
927 virtual void onPrepare(
const ComboBox& cb,
928 const StyleOptions& options,
929 Gfx::Brush& background,
930 Gfx::Brush& foreground,
933 Gfx::Pen& textPen)
const = 0;
935 virtual void onPrepareLayout(
const ComboBox& cb,
936 Gfx::SizeF& buttonSize)
const = 0;
938 virtual void onRenderBackground(
const ComboBox& cb,
939 const StyleOptions& options,
940 Gfx::Painter& painter,
941 const Gfx::RectF& rect,
942 const Gfx::Pen& contour,
943 const Gfx::Brush& brush)
const = 0;
945 virtual void onRenderButton(
const ComboBox& cb,
946 const StyleOptions& options,
947 Gfx::Painter& painter,
948 const Gfx::RectF& rect,
949 const Gfx::Pen& contour,
950 const Gfx::Brush& foreground)
const = 0;
952 virtual void onRenderText(
const ComboBox& cb,
953 const StyleOptions& options,
954 Gfx::Painter& painter,
955 const Gfx::RectF& rect,
957 const Gfx::PointF& textPos,
958 const Gfx::Font& font,
959 const Gfx::Pen& textPen,
960 const Gfx::RectF& cursor)
const = 0;
964 class PT_FORMS_API SpinBoxRenderer :
public Style::Facet
967 SpinBoxRenderer(std::size_t refs = 0);
969 virtual ~SpinBoxRenderer();
971 void prepare(
const SpinBox& sb,
972 const StyleOptions& options,
973 Gfx::Brush& background,
976 Gfx::Pen& textPen)
const;
978 void prepareButton(
const SpinBoxButton& sb,
979 const StyleOptions& options,
980 Gfx::Brush& foreground,
981 Gfx::Pen& contour)
const;
983 void layout(
const SpinBox& sb,
984 Gfx::RectF& downButton,
985 Gfx::RectF& upButton,
986 Gfx::RectF& textBox)
const;
988 void renderBackground(
const SpinBox& sb,
989 const StyleOptions& options,
990 Gfx::Painter& painter,
991 const Gfx::RectF& rect,
992 const Gfx::Pen& contour,
993 const Gfx::Brush& brush)
const;
995 void renderButton(
const SpinBoxButton& sb,
996 const StyleOptions& options,
997 Gfx::Painter& painter,
998 const Gfx::RectF& rect,
999 const Gfx::Brush& foreground,
1000 const Gfx::Pen& contour)
const;
1002 void renderText(
const SpinBox& sb,
1003 const StyleOptions& options,
1004 Gfx::Painter& painter,
1005 const Gfx::RectF& rect,
1007 const Gfx::PointF& textPos,
1008 const Gfx::Font& font,
1009 const Gfx::Pen& textPen,
1010 const Gfx::RectF& cursor)
const;
1013 virtual void onPrepare(
const SpinBox& sb,
1014 const StyleOptions& options,
1015 Gfx::Brush& background,
1018 Gfx::Pen& textPen)
const = 0;
1020 virtual void onPrepareButton(
const SpinBoxButton& sb,
1021 const StyleOptions& options,
1022 Gfx::Brush& foreground,
1023 Gfx::Pen& contour)
const = 0;
1025 virtual void onLayout(
const SpinBox& sb,
1026 Gfx::RectF& downButton,
1027 Gfx::RectF& upButton,
1028 Gfx::RectF& textBox)
const = 0;
1030 virtual void onRenderBackground(
const SpinBox& sb,
1031 const StyleOptions& options,
1032 Gfx::Painter& painter,
1033 const Gfx::RectF& rect,
1034 const Gfx::Pen& contour,
1035 const Gfx::Brush& brush)
const = 0;
1037 virtual void onRenderButton(
const SpinBoxButton& sb,
1038 const StyleOptions& options,
1039 Gfx::Painter& painter,
1040 const Gfx::RectF& rect,
1041 const Gfx::Brush& foreground,
1042 const Gfx::Pen& contour)
const = 0;
1044 virtual void onRenderText(
const SpinBox& sb,
1045 const StyleOptions& options,
1046 Gfx::Painter& painter,
1047 const Gfx::RectF& rect,
1049 const Gfx::PointF& textPos,
1050 const Gfx::Font& font,
1051 const Gfx::Pen& textPen,
1052 const Gfx::RectF& cursor)
const = 0;
1056 class PT_FORMS_API TabViewRenderer :
public Style::Facet
1059 TabViewRenderer(std::size_t refs = 0);
1061 virtual ~TabViewRenderer();
1063 void prepare(
const TabView& tv,
1064 const StyleOptions& options,
1065 Gfx::Brush& background,
1066 Gfx::Brush& foreground,
1067 Gfx::Pen& contour)
const;
1069 void render(
const TabView& tv,
1070 const StyleOptions& options,
1071 Gfx::Painter& painter,
1072 const Gfx::RectF& rect,
1073 const Gfx::Brush& background,
1074 const Gfx::Brush& foreground,
1075 const Gfx::Pen& contour)
const;
1077 Gfx::SizeF measureTabs(PaintSurface& surface,
1078 const std::vector<TabItem>& tabs,
1079 const Gfx::Font& font)
const;
1081 void layoutTabs(PaintSurface& surface,
1082 std::vector<TabItem>& tabs,
1083 const Gfx::RectF& rect,
1084 const Gfx::Font& font)
const;
1086 void prepareTabs(
const TabBar& tabs,
1087 const StyleOptions& options,
1088 const Gfx::Brush& background,
1089 const Gfx::Brush& foreground,
1090 const Gfx::Pen& contour,
1091 const Gfx::Font& font,
1092 const Gfx::Pen& textPen)
const;
1094 void renderTabs(
const std::vector<TabItem>& tabs,
1095 const StyleOptions& options,
1096 Gfx::Painter& painter,
1097 const Gfx::RectF& rect,
1098 const Gfx::Brush& background,
1099 const Gfx::Brush& foreground,
1100 const Gfx::Pen& contour,
1101 const Gfx::Font& font,
1102 const Gfx::Pen& textPen)
const;
1105 virtual void onPrepare(
const TabView& tv,
1106 const StyleOptions& options,
1107 Gfx::Brush& background,
1108 Gfx::Brush& foreground,
1109 Gfx::Pen& contour)
const = 0;
1111 virtual void onRender(
const TabView& tv,
1112 const StyleOptions& options,
1113 Gfx::Painter& painter,
1114 const Gfx::RectF& rect,
1115 const Gfx::Brush& background,
1116 const Gfx::Brush& foreground,
1117 const Gfx::Pen& contour)
const = 0;
1119 virtual Gfx::SizeF onMeasureTabs(PaintSurface& surface,
1120 const std::vector<TabItem>& tabs,
1121 const Gfx::Font& font)
const = 0;
1123 virtual void onLayoutTabs(PaintSurface& surface,
1124 std::vector<TabItem>& tabs,
1125 const Gfx::RectF& rect,
1126 const Gfx::Font& font)
const = 0;
1128 virtual void onPrepareTabs(
const TabBar& tabs,
1129 const StyleOptions& options,
1130 const Gfx::Brush& background,
1131 const Gfx::Brush& foreground,
1132 const Gfx::Pen& contour,
1133 const Gfx::Font& font,
1134 const Gfx::Pen& textPen)
const = 0;
1136 virtual void onRenderTabs(
const std::vector<TabItem>& tabs,
1137 const StyleOptions& options,
1138 Gfx::Painter& painter,
1139 const Gfx::RectF& rect,
1140 const Gfx::Brush& background,
1141 const Gfx::Brush& foreground,
1142 const Gfx::Pen& contour,
1143 const Gfx::Font& font,
1144 const Gfx::Pen& textPen)
const = 0;