31#ifndef Pt_Forms_StyleOptions_h
32#define Pt_Forms_StyleOptions_h
34#include <Pt/Forms/Api.h>
35#include <Pt/Gfx/Pen.h>
36#include <Pt/Gfx/Brush.h>
37#include <Pt/Gfx/Font.h>
38#include <Pt/Gfx/Color.h>
39#include <Pt/SmartPtr.h>
75 virtual const std::type_info&
typeId()
const = 0;
79 virtual const char*
name()
const = 0;
97 explicit BackgroundOption(
const Gfx::Color& color)
101 explicit BackgroundOption(
const Gfx::Brush& brush)
109 {
return new BackgroundOption(*
this); }
111 virtual const std::type_info&
typeId()
const
112 {
return typeid(BackgroundOption); }
114 virtual const char*
name()
const override
115 {
return "background"; }
128 explicit ForegroundOption(
const Gfx::Color& color)
132 explicit ForegroundOption(
const Gfx::Brush& brush)
140 {
return new ForegroundOption(*
this); }
142 virtual const std::type_info&
typeId()
const
143 {
return typeid(ForegroundOption); }
145 virtual const char*
name()
const override
146 {
return "foreground"; }
159 explicit ContourOption(
const Gfx::Color& color)
163 explicit ContourOption(
const Gfx::Pen& pen)
171 {
return new ContourOption(*
this); }
173 virtual const std::type_info&
typeId()
const
174 {
return typeid(ContourOption); }
176 virtual const char*
name()
const override
177 {
return "contour"; }
190 explicit AccentColorOption(
const Gfx::Color& color)
198 {
return new AccentColorOption(*
this); }
200 virtual const std::type_info&
typeId()
const
201 {
return typeid(AccentColorOption); }
203 virtual const char*
name()
const override
204 {
return "accentColor"; }
217 explicit ViewBackgroundOption(
const Gfx::Color& color)
221 explicit ViewBackgroundOption(
const Gfx::Brush& brush)
229 {
return new ViewBackgroundOption(*
this); }
231 virtual const std::type_info&
typeId()
const
232 {
return typeid(ViewBackgroundOption); }
234 virtual const char*
name()
const override
235 {
return "viewBackground"; }
248 explicit HighlightColorOption(
const Gfx::Color& color)
256 {
return new HighlightColorOption(*
this); }
258 virtual const std::type_info&
typeId()
const
259 {
return typeid(HighlightColorOption); }
261 virtual const char*
name()
const override
262 {
return "highlightColor"; }
275 explicit HoverBackgroundOption(
const Gfx::Color& color)
279 explicit HoverBackgroundOption(
const Gfx::Brush& brush)
287 {
return new HoverBackgroundOption(*
this); }
289 virtual const std::type_info&
typeId()
const
290 {
return typeid(HoverBackgroundOption); }
292 virtual const char*
name()
const override
293 {
return "hoverBackground"; }
306 explicit TextBackgroundOption(
const Gfx::Color& color)
310 explicit TextBackgroundOption(
const Gfx::Brush& brush)
318 {
return new TextBackgroundOption(*
this); }
320 virtual const std::type_info&
typeId()
const
321 {
return typeid(TextBackgroundOption); }
323 virtual const char*
name()
const override
324 {
return "textBackground"; }
337 explicit TextColorOption(
const Gfx::Color& color)
345 {
return new TextColorOption(*
this); }
347 virtual const std::type_info&
typeId()
const
348 {
return typeid(TextColorOption); }
350 virtual const char*
name()
const override
351 {
return "textColor"; }
364 explicit PlaceholderTextColorOption(
const Gfx::Color& color)
372 {
return new PlaceholderTextColorOption(*
this); }
374 virtual const std::type_info&
typeId()
const
375 {
return typeid(PlaceholderTextColorOption); }
377 virtual const char*
name()
const override
378 {
return "placeholderTextColor"; }
391 explicit HighlightedTextColorOption(
const Gfx::Color& color)
399 {
return new HighlightedTextColorOption(*
this); }
401 virtual const std::type_info&
typeId()
const
402 {
return typeid(HighlightedTextColorOption); }
404 virtual const char*
name()
const override
405 {
return "highlightedTextColor"; }
418 explicit AlternateViewBackgroundOption(
const Gfx::Color& color)
422 explicit AlternateViewBackgroundOption(
const Gfx::Brush& brush)
430 {
return new AlternateViewBackgroundOption(*
this); }
432 virtual const std::type_info&
typeId()
const
433 {
return typeid(AlternateViewBackgroundOption); }
435 virtual const char*
name()
const override
436 {
return "alternateViewBackground"; }
449 explicit PopupBackgroundOption(
const Gfx::Color& color)
453 explicit PopupBackgroundOption(
const Gfx::Brush& brush)
461 {
return new PopupBackgroundOption(*
this); }
463 virtual const std::type_info&
typeId()
const
464 {
return typeid(PopupBackgroundOption); }
466 virtual const char*
name()
const override
467 {
return "popupBackground"; }
480 explicit PopupTextColorOption(
const Gfx::Color& color)
488 {
return new PopupTextColorOption(*
this); }
490 virtual const std::type_info&
typeId()
const
491 {
return typeid(PopupTextColorOption); }
493 virtual const char*
name()
const override
494 {
return "popupTextColor"; }
532 virtual const std::type_info&
typeId()
const;
536 virtual const char*
name()
const override
701 template <
typename T>
706 template <
typename T>
707 const T*
find()
const;
713 template <
typename T>
714 const T&
get()
const;
718 template <
typename T>
719 void set(
const T& option);
723 template <
typename T>
727 bool hasLocalOptions()
const;
729 StyleOption* findOption(
const std::type_info& ti)
const;
733 void removeOption(
const std::type_info& ti);
738 std::size_t _generation;
739 std::size_t _boundGeneration;
741 std::vector<StyleOption*> _options;
748 return static_cast<const T*
>( findOption(
typeid(T)) );
760 return _parent->find<T>();
773 throw std::logic_error(
"invalid style option");
781 localOption->
bind(_parent);
782 replaceOption(localOption);
789 removeOption(
typeid(T));
Policy based Auto pointer.
Definition SmartPtr.h:291
virtual const std::type_info & typeId() const
Returns the option class used as the lookup key.
Definition StyleOptions.h:401
virtual const char * name() const override
Returns the option name.
Definition StyleOptions.h:404
virtual StyleOption * clone() const
Returns a copy of this option.
Definition StyleOptions.h:398
virtual const std::type_info & typeId() const
Returns the option class used as the lookup key.
Definition StyleOptions.h:374
virtual const char * name() const override
Returns the option name.
Definition StyleOptions.h:377
virtual StyleOption * clone() const
Returns a copy of this option.
Definition StyleOptions.h:371
virtual const std::type_info & typeId() const
Returns the option class used as the lookup key.
Definition StyleOptions.h:320
virtual const char * name() const override
Returns the option name.
Definition StyleOptions.h:323
virtual StyleOption * clone() const
Returns a copy of this option.
Definition StyleOptions.h:317
virtual const std::type_info & typeId() const
Returns the option class used as the lookup key.
Definition StyleOptions.h:347
virtual const char * name() const override
Returns the option name.
Definition StyleOptions.h:350
virtual StyleOption * clone() const
Returns a copy of this option.
Definition StyleOptions.h:344
Fill color, gradient or texture.
Definition Brush.h:151
8-bit ARGB color.
Definition Color.h:65
Font family, size and style.
Definition Font.h:63
Slant
Describes the requested font slant.
Definition Font.h:83
Weight
Describes the requested font weight.
Definition Font.h:68
Outline color, width and style.
Definition Pen.h:59
Core module.
Definition Allocator.h:33