ButtonStyler Class Reference

#include <Pt/Forms/ButtonStyler.h>

Button styler.

Inherits Styler.

Public Member Functions

 ButtonStyler ()
 Constructs an unbound button styler.
 
const Gfx::Brushforeground () const
 Returns the effective foreground brush.
 
void setForeground (const Gfx::Brush &brush)
 Sets the widget-local foreground brush to brush.
 
const Gfx::Pencontour () const
 Returns the effective contour pen.
 
void setContour (const Gfx::Pen &pen)
 Sets the widget-local contour pen to pen.
 
const Gfx::ColoraccentColor () const
 Returns the effective accent color.
 
void setAccentColor (const Gfx::Color &color)
 Sets the widget-local accent color to color.
 
const Gfx::ColorhighlightColor () const
 Returns the effective highlight color.
 
void setHighlightColor (const Gfx::Color &color)
 Sets the widget-local highlight color to color.
 
const Gfx::ColortextColor () const
 Returns the effective text color.
 
void setTextColor (const Gfx::Color &color)
 Sets the widget-local text color to color.
 
Gfx::Font font () const
 Returns the effective font.
 
void setFont (const Gfx::Font &font)
 Sets the widget-local font to font.
 
void setFontSize (std::size_t size)
 Sets the widget-local font size to size.
 
void setFontWeight (Gfx::Font::Weight weight)
 Sets the widget-local font weight to weight.
 
void setFontSlant (Gfx::Font::Slant slant)
 Sets the widget-local font slant to slant.
 
bool prepareIcon (const Gfx::Image &icon, Pixmap &picture, const ButtonState &state) const
 Prepares picture from icon for state. More...
 
void measureText (PaintSurface &surface, const String &text, Gfx::TextMetrics &textMetrics, Gfx::FontMetrics &fontMetrics) const
 Measures text and stores its metrics for surface.
 
Gfx::SizeF measureContent (PaintSurface &surface, Direction direction, const Gfx::SizeF &iconSize, const Gfx::SizeF &textSize) const
 Measures icon and text content arranged by direction.
 
Gfx::SizeF measureFrame (PaintSurface &surface, const Gfx::SizeF &contentSize) const
 Measures the frame enclosing contentSize.
 
Gfx::RectF layoutFrame (PaintSurface &surface, const Gfx::RectF &frameRect) const
 Returns the frame content rectangle within frameRect.
 
void layoutContent (PaintSurface &surface, const Gfx::RectF &contentRect, Direction direction, const Gfx::SizeF &iconSize, const Gfx::SizeF &textSize, Gfx::RectF &iconRect, Gfx::RectF &textRect) const
 Lays out icon and text rectangles within contentRect.
 
Gfx::RectF layoutMnemonic (PaintSurface &surface, const String &text, const Gfx::PointF &textPos, const Gfx::FontMetrics &fontMetrics, String::size_type mnemonicIndex) const
 Returns the mnemonic underline rectangle for mnemonicIndex.
 
void renderBackground (PaintContext &context, const Gfx::RectF &rect, const ButtonState &state) const
 Renders the button background within rect for state.
 
void renderChrome (PaintContext &context, const Gfx::RectF &rect, const ButtonState &state) const
 Renders the button chrome within rect for state.
 
void renderText (PaintContext &context, const Gfx::RectF &rect, const String &text, const Gfx::PointF &pos, const ButtonState &state) const
 Renders text at pos within rect for state.
 
void renderMnemonic (PaintContext &context, const Gfx::RectF &rect, const Gfx::RectF &mnemonic, const ButtonState &state) const
 Renders the mnemonic underline within mnemonic for state.
 
void renderIcon (PaintContext &context, const Gfx::RectF &rect, const Pixmap &picture, const Gfx::PointF &pos, const ButtonState &state) const
 Renders picture at pos within rect for state.
 
void setRenderer (ButtonRenderer *renderer=0)
 Assigns a specific button renderer.
 
StyleOptionsoptions ()
 Returns the bound effective button options. More...
 
const StyleOptionsoptions () const
 Returns the bound effective button options.
 
bool bind (const Style &style, const StyleOptions &styleOptions)
 Binds or rebinds to a style and global style options.
 
bool isBound () const
 Returns true if bound.
 

Protected Member Functions

virtual StyleOptionsonBindOptions (const StyleOptions &styleOptions)
 Returns the specific style options.
 
virtual RendereronStyleRenderer (const Style &style)
 Resolves the shared style renderer for the current style.
 
virtual RendereronCreateRenderer (const Style &style)
 Creates an independant style renderer.
 
void init (Renderer *renderer)
 Initializes with a specific renderer.
 

Member Function Documentation

◆ prepareIcon()

bool prepareIcon ( const Gfx::Image icon,
Pixmap picture,
const ButtonState state 
) const

Returns true when a bound renderer prepared picture.

◆ options()

StyleOptions& options ( )

Use StyleOptions::findLocal() to query an explicit widget-local token.