All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Stylish::CSSBoxModel Class Reference

Implements the basic framework for doing CSS-style box layout. More...

#include <Stylish/CSSBoxModel.hpp>

Inheritance diagram for Stylish::CSSBoxModel:
Stylish::Styleable Valuable::Node Valuable::Attribute Patterns::NotCopyable Valuable::Serializable MultiWidgets::Widget Extensions::Circles::CircleMenuLauncher Extensions::Circles::CirclePlugin Extensions::Circles::Circles Extensions::Circles::CircleWidget Extensions::Draw::BasicDrawWidget Extensions::Draw::RGBSelector Extensions::Draw::Stroke Extensions::Effects::BlobsWidget Extensions::Effects::Champagne Extensions::Effects::Divisions Extensions::Effects::FluidWidget Extensions::Effects::Rectangles Extensions::Effects::ShaderEffect Extensions::LaunchList::LaunchList Extensions::LaunchStack::LaunchStack Extensions::LightBeings::Attractor Extensions::LightBeings::Beings Extensions::LightBeings::ColorPlace Extensions::LightBeings::Snake Extensions::MissileCmd::Entity Extensions::MissileCmd::GameWidget Extensions::MissileCmd::HighScore Extensions::MissileCmd::ScoreWidget Extensions::MissileCmd::Sky Extensions::MissileCmd::Turret Extensions::SpringField::Field Extensions::TimeLine::KeyPointList Extensions::TimeLine::MainWidget Extensions::TimeLine::TimeLineWidget Extensions::TimeLine::WheelItemWidget MultiWidgets::BaseMediaWidget MultiWidgets::BookWidget MultiWidgets::BrowserFrameWidget MultiWidgets::BrowserWidget MultiWidgets::CloudWidget MultiWidgets::DropShadowWidget MultiWidgets::FlippingWidget MultiWidgets::FrameBufferWidget MultiWidgets::ImageTileWidget MultiWidgets::InputVisualizerWidget MultiWidgets::ItemFlowWidget MultiWidgets::JavaScriptWidget MultiWidgets::KeyboardInterfaceWidget MultiWidgets::LayerWidget MultiWidgets::MarkerLauncherWidget MultiWidgets::RippleOverlayWidget MultiWidgets::ScrollAreaWidget MultiWidgets::SliderWidget MultiWidgets::TimerDialWidget MultiWidgets::VideoControlWidget MultiWidgets::ViewWidget MultiWidgets::WheelWidget WebBrowserCef::AddressBarWidget WebBrowserCef::BrowserFrameWidget WebBrowserCef::BrowserWidget WebBrowserCef::WebPageWidget

Valuable Attributes

Nimble::Vector2 location = Nimble::Vector2f(0.F, 0.F)
 The location of this object in pixels in its parent's coordinate system. More...
 
Nimble::Frame4f margin = Nimble::Vector4(0, 0, 0, 0)
 Size of the margin. More...
 
Nimble::Frame4f padding = Nimble::Vector4(0, 0, 0, 0)
 Size of the padding. More...
 
Nimble::SizeF size = Nimble::SizeF(100.F, 100.F)
 Box size in pixels. More...
 
- Valuable Attributes inherited from Stylish::Styleable
QString css-class = ""
 Get the CSS classes of the Styleable as a space separated string. More...
 
QString css-id = ""
 Get the CSS id of the Styleable. More...
 
- Valuable Attributes inherited from Valuable::Node
Node::Uuid id = generateId()
 Returns the unique id. More...
 

Public Member Functions

AttributeBackgroundbackground ()
 
const AttributeBackgroundbackground () const
  More...
 
Nimble::Rectf backgroundBox () const
 Background painting area, depends on background-clip value. More...
 
Radiant::Color backgroundColor () const
 
AttributeBorderborder ()
 
const AttributeBorderborder () const
  More...
 
Stylish::Border borderBottom () const
 Gets the bottom border that contains the width, style and color. More...
 
Nimble::Rectf borderBox () const
 Border box, rectangle that includes content, padding and border. More...
 
Nimble::Frame4f borderFrame () const
 Size of the border. More...
 
Stylish::Border borderLeft () const
 Gets the left border that contains the width, style and color. More...
 
Stylish::Border borderRight () const
 Gets the right border that contains the width, style and color. More...
 
Stylish::Border borderTop () const
 Gets the top border that contains the width, style and color. More...
 
float bottom () const
 Get the y coordinate of the bottom of the box.
 
Nimble::SizeF boxSize () const
 Calculates total amount of screen estate taken by the box by adding size, padding, border and margin together. More...
 
Nimble::Rectf contentBox () const
 Content box, rectangle that includes only the content area. More...
 
float height () const
 Height of this box in pixels.
 
virtual float heightForWidth (float width) const
 Given the width of the content area for this box, what would be the height of the content area? This should be overridden in derived classes. More...
 
Nimble::Vector2 location () const
 The location of this object in pixels in its parent's coordinate system. More...
 
Nimble::Frame4f margin () const
 Size of the margin. More...
 
Nimble::Rectf marginBox () const
 Margin box, rectangle that includes content, padding, border and margin. More...
 
Nimble::Frame4f padding () const
 Size of the padding. More...
 
Nimble::Rectf paddingBox () const
 Padding box, rectangle that includes content and padding but excludes border area. More...
 
void setBackgroundColor (Radiant::Color color)
 
void setBackgroundColor (float red, float green, float blue, float alpha)
 
virtual void setBorderColor (const Radiant::Color &c)
 Sets the color for all borders.
 
void setBorderColor (float r, float g, float b, float a)
 
virtual void setBorderFrame (const Nimble::Frame4f &border)
 Sets the width for all borders. More...
 
void setBorderStyle (Border::Style style)
 Sets the style for all borders.
 
void setBorderWidth (float width)
 Sets the width for all borders.
 
void setHeight (float height, ValueUnit unit=VU_PXS)
 Set the height of the box.
 
void setLocation (Nimble::Vector2 location)
 Setter for attribute location. More...
 
void setLocation (Nimble::Vector2 location, ValueUnit unit)
 Set the location of this object. More...
 
void setLocation (float x, float y)
 Set the location of this object. More...
 
void setLocation (float x, float y, ValueUnit unit)
 Set the location of this object. More...
 
void setMargin (const Nimble::Frame4f &margin)
 Setter for attribute margin. More...
 
void setMargin (float one_side_margin)
 Set the size of the margin for all sides to be equal.
 
virtual void setPadding (const Nimble::Frame4f &padding)
 Setter for attribute padding. More...
 
void setPadding (float oneSidePadding)
 Set the size of the padding for all sides to be equal. More...
 
void setSize (Nimble::SizeF size)
 Setter for attribute size. More...
 
void setSize (float width, float height, ValueUnit unit=VU_PXS)
 Set box size. More...
 
void setSize (Nimble::SizeF size, ValueUnit widthUnit, ValueUnit heightUnit)
 Set box size. More...
 
void setWidth (float width, ValueUnit unit=VU_PXS)
 Set the width of the box.
 
void setX (float x, ValueUnit unit=VU_PXS)
 Set the x component of the location of this box.
 
void setY (float y, ValueUnit unit=VU_PXS)
 Set the y component of the location of this box.
 
Nimble::SizeF size () const
 Box size in pixels. More...
 
float width () const
 Width of this box in pixels.
 
float x () const
 Get the x component of the location of this box in pixels.
 
float y () const
 Get the y component of the location of this box in pixels.
 
- Public Member Functions inherited from Stylish::Styleable
void addCSSClass (const QString &s)
 Adds the Styleable to CSS class s. More...
 
void addCSSClasses (const QStringList &classes)
 Adds the Styleable to given CSS classes. More...
 
QString attributeSource (const QByteArray &name) const
 Gets CSS declaration source location based on the attribute name For example if this object has "size" attribute that is set from a CSS file, attributeSource("size") would return "filename.css:line". More...
 
const Style & childStyle () const
 Cached style that should be applied to all children of this object.
 
const Radiant::ArraySet
< QByteArray > & 
cssClasses () const
 Get the CSS classes of the Styleable in lowercase.
 
const QString & cssClassStr () const
 Get the CSS classes of the Styleable as a space separated string. More...
 
QString cssId () const
 Get the CSS id of the Styleable. More...
 
const QByteArray & cssType () const
 Get the CSS type of the Styleable.
 
bool hasCSSClass (const QByteArray &s) const
 Does the Styleable belong to given CSS class. More...
 
bool match (const SimpleSelector &ss, int *specificityOut=nullptr) const
 Checks if SimpleSelector matches this object. More...
 
bool pseudoClass (const QByteArray &name) const
 Query if the Styleable has pseudo class called name.
 
void removeCSSClass (const QString &s)
 Remove the Styleable from CSS class s. More...
 
void setCSSClasses (const QString &s)
 Set the CSS classes as a space separated list You almost always want to use addCSSClass instead of this one. More...
 
void setCSSId (const QString &s)
 Set the CSS id of the Styleable. More...
 
void setCSSType (const QByteArray &s)
 Set the CSS type of the Styleable.
 
virtual bool setProperty (Valuable::Attribute &var, const Valuable::StyleValue &value, Layer layer)
 Converts the given Stylish::Value to Valuable::Attribute.
 
void setPseudoClass (const QByteArray &name, bool state)
 Disable or enable pseudo class.
 
virtual bool setStyle (const Style &style)
 Applies a style to the object. More...
 
QString simpleSelector (bool includePseudoClasses=true) const
 Returns a CSS simple selector that matches this Styleable.
 
const Style & style () const
 Returns the style for this object.
 
 Styleable (const QByteArray &name="Styleable")
 Constructor for Styleable. More...
 
- Public Member Functions inherited from Valuable::Node
bool acceptsEvent (const QByteArray &messageId) const
 Returns true if this object accepts event 'id' in eventProcess.
 
bool addAttribute (Attribute *const attribute)
 Adds a new Attribute to the list of attribute objects. More...
 
bool addAttribute (const QByteArray &name, Attribute *const attribute)
 Adds a new Attribute to the list of attribute objects.
 
template<typename Widget >
bool addAttribute (const QByteArray &name, const Radiant::IntrusivePtr< Widget > &attribute)
 Adds a new Attribute to the list of attribute objects. More...
 
long addListener (const QByteArray &attribute, v8::Persistent< v8::Function > func, int role=Attribute::CHANGE_ROLE)
 Add a JavaScript attribute listener to attribute belonging this Node. More...
 
virtual Attributeattribute (const QByteArray &name) const
 Gets an Attribute with the given name. More...
 
template<typename T >
AttributeT< T > * attribute (const QByteArray &name) const
 Gets an Attribute with the given name. More...
 
const containerattributes () const
 
void clearValues (Layer layer)
 Clears all Attribute values of the given layer. More...
 
void debugDump ()
 Prints the contents of this Attribute to the terminal.
 
virtual bool deserialize (const ArchiveElement &element)
 De-serializes this object (and its children) from a DOM node.
 
void eventAddDeprecated (const QByteArray &deprecatedId, const QByteArray &newId)
 Register a deprecated event that is automatically converted to new event id and a warning is issued when it is used. More...
 
void eventAddIn (const QByteArray &messageId)
 Registers a new event that this class handles in eventProcess.
 
template<typename Widget >
long eventAddListener (const QByteArray &eventId, const QByteArray &messageId, Radiant::IntrusivePtr< Widget > &listener, ListenerType listenerType=DIRECT, const Radiant::BinaryData *defaultData=0)
 Add an event listener to this object. More...
 
long eventAddListener (const QByteArray &eventId, const QByteArray &messageId, Valuable::Node *listener, ListenerType listenerType=DIRECT, const Radiant::BinaryData *defaultData=0)
 Add an event listener to this object. More...
 
long eventAddListener (const QByteArray &eventId, ListenerFuncVoid func, ListenerType listenerType=DIRECT)
 Add an event listener to this object. More...
 
long eventAddListener (const QByteArray &eventId, Node *dstNode, ListenerFuncVoid func, ListenerType listenerType=DIRECT)
 
long eventAddListenerBd (const QByteArray &eventId, Node *dstNode, ListenerFuncBd func, ListenerType listenerType=DIRECT)
 
long eventAddListenerBd (const QByteArray &eventId, ListenerFuncBd func, ListenerType listenerType=DIRECT)
 Add an event listener to this object. More...
 
void eventAddOut (const QByteArray &eventId)
 Registers a new event this class can send with eventSend.
 
const QSet< QByteArray > & eventInNames () const
 Returns set of all registered IN events.
 
unsigned eventListenerCount () const
 Returns the number of event listeners.
 
const QSet< QByteArray > & eventOutNames () const
 Returns set of all registered OUT events.
 
void eventPassingEnable (bool enable)
 Control whether events are passed.
 
template<typename Widget >
int eventRemoveListener (Radiant::IntrusivePtr< Widget > &listener)
 Removes all events from this object to given listener. More...
 
template<typename Widget >
int eventRemoveListener (const QByteArray &eventId=QByteArray(), const QByteArray &messageId=QByteArray(), Radiant::IntrusivePtr< Widget > &listener=Radiant::IntrusivePtr< Widget >())
 Removes events from this object that match the parameters. More...
 
int eventRemoveListener (const QByteArray &eventId=QByteArray(), const QByteArray &messageId=QByteArray(), Valuable::Node *listener=0)
 Removes event listeners from this object. More...
 
int eventRemoveListener (Valuable::Node *listener)
 Removes all events from this object to given listener. More...
 
bool eventRemoveListener (long listenerId)
 Removes event listener with given id. More...
 
void eventSend (const QByteArray &eventId, Radiant::BinaryData &bd)
 Sends an event and bd to all listeners on this eventId.
 
void eventSend (const QByteArray &eventId)
 Sends an event to all listeners on this eventId.
 
template<typename P1 >
void eventSend (const QByteArray &eventId, const P1 &p1)
 Sends an event to all listeners on this eventId. More...
 
template<typename P1 , typename P2 >
void eventSend (const QByteArray &eventId, const P1 &p1, const P2 &p2)
 Sends an event to all listeners on this eventId. More...
 
template<typename P1 , typename P2 , typename P3 >
void eventSend (const QByteArray &eventId, const P1 &p1, const P2 &p2, const P3 &p3)
 Sends an event to all listeners on this eventId. More...
 
template<typename P1 , typename P2 , typename P3 , typename P4 >
void eventSend (const QByteArray &eventId, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4)
 Sends an event to all listeners on this eventId. More...
 
template<typename P1 , typename P2 , typename P3 , typename P4 , typename P5 >
void eventSend (const QByteArray &eventId, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5)
 Sends an event to all listeners on this eventId. More...
 
unsigned eventSourceCount () const
 Returns the number of event sources.
 
Uuid id () const
 Returns the unique id.
 
bool isBeingDestroyed () const
 Returns true if we are about to delete this object. More...
 
bool loadFromFileXML (const QString &filename)
 Reads this object (and its children) from an XML file.
 
bool loadFromMemoryXML (const QByteArray &buffer)
 Reads this object (and its children) from a memory buffer.
 
 Node (Node *host, const QByteArray &name="", bool transit=false)
 Constructs a new Node and adds it under the given host. More...
 
 Node (Node &&node)
 Moves a node, including all its attributes, events etc. More...
 
Nodeoperator= (Node &&node)
 Moves a node, replacing this. More...
 
virtual bool readElement (const ArchiveElement &element)
 Handles a serialization element that lacks automatic handlers. More...
 
void removeAttribute (Attribute *const attribute)
 Removes an Attribute from the list of attribute objects.
 
bool saveToFileXML (const QString &filename, unsigned int opts=SerializationOptions::DEFAULTS) const
 Saves this object (and its children) to an XML file.
 
bool saveToMemoryXML (QByteArray &buffer, unsigned int opts=SerializationOptions::DEFAULTS) const
 Saves this object (and its children) to binary data buffer.
 
virtual ArchiveElement serialize (Archive &doc) const
 Serializes this object (and its children) to a DOM node.
 
virtual void setAsDefaults ()
 Sets the current USER attribute value as the default value and clears the USER value. More...
 
void setId (Uuid newId)
 Sets the unique id. More...
 
template<class T >
bool setValue (const QByteArray &name, const T &v)
 Uses a query string to find a Attribute, and sets a new value to that if found. More...
 
bool setValue (const QByteArray &name, v8::Handle< v8::Value > v)
 Set attribute value from JavaScript. More...
 
- Public Member Functions inherited from Valuable::Attribute
long addListener (ListenerFunc func, int role=CHANGE_ROLE)
 Adds a listener that is invoked whenever the value is changed. More...
 
long addListener (Node *listener, ListenerFunc func, int role=CHANGE_ROLE)
 Adds a listener that is invoked whenever the value is changed. More...
 
long addListener (v8::Persistent< v8::Function > func, int role=CHANGE_ROLE)
 Adds a JavaScript listener that is invoked whenever the value is changed. More...
 
virtual float asFloat (bool *const ok=0, Layer layer=LAYER_CURRENT) const
 Converts the value object in a floating point number. More...
 
virtual int asInt (bool *const ok=0, Layer layer=LAYER_CURRENT) const
 Converts the value object in an integer. More...
 
virtual QString asString (bool *const ok=0, Layer layer=LAYER_CURRENT) const
 Converts the value object to a string. More...
 
 Attribute (const Attribute &o)
 Create a copy of the given Attribute WITHOUT the link to host, listeners, or the attribute name. More...
 
 Attribute (Node *host, const QByteArray &name, bool transit=false)
 Constructs a new value object and attaches it to its host. More...
 
virtual void clearValue (Layer layer)
 Unsets the value from a specific layer. More...
 
virtual void emitChange ()
 Invokes the change valueChanged function of all listeners.
 
virtual void eventProcess (const QByteArray &id, Radiant::BinaryData &data)
 Process a message. More...
 
void eventProcessFloat (const char *id, float v)
 Utility function for sending a float message to the object.
 
void eventProcessInt (const char *id, int v)
 Utility function for sending an int message to the object.
 
void eventProcessString (const char *id, const QString &str)
 Utility function for sending string message to the object.
 
void eventProcessString (const char *id, const char *str)
 Utility function for sending string message to the object.
 
void eventProcessVector2 (const char *id, Nimble::Vector2)
 Utility function for sending a Nimble::Vector2f message to the object.
 
void eventProcessVector3 (const char *id, Nimble::Vector3)
 Utility function for sending a Vector3 message to the object.
 
void eventProcessVector4 (const char *id, Nimble::Vector4)
 Utility function for sending a Vector4 message to the object.
 
virtual bool handleShorthand (const Valuable::StyleValue &value, Radiant::ArrayMap< Valuable::Attribute *, Valuable::StyleValue > &expanded)
 If attribute supports shorthand properties, this should be used to parse those. More...
 
Nodehost () const
 The host object of the value object (is any). More...
 
virtual bool isChanged () const
 
virtual bool isValueDefinedOnLayer (Layer layer) const
 Check if the given layer defines a value. More...
 
bool layerForSerialization (SerializationOptions flags, Layer &layer) const
 
const QByteArray & name () const
 Returns the name of the object.
 
const Attributeoperator= (const Attribute &)
 Create a copy of the given Attribute WITHOUT the link to host, listeners, or the attribute name. More...
 
AttributeownerShorthand () const
 
QByteArray path () const
 Returns the path (separated by '/'s) from the root.
 
void removeHost ()
 Sets the host pointer to zero and removes this object from the host. More...
 
bool removeListener (Node *listener, int role=ALL_ROLES)
 Removes a listener from the listener list. More...
 
bool removeListener (long id)
 Removes a listener from the listener list. More...
 
void removeListeners (int role=ALL_ROLES)
 Removes listeners from the listener list.
 
virtual bool set (float v, Layer layer=USER, ValueUnit unit=VU_UNKNOWN)
 Sets the value of the object.
 
virtual bool set (int v, Layer layer=USER, ValueUnit unit=VU_UNKNOWN)
 Sets the value of the object.
 
virtual bool set (const QString &v, Layer layer=USER, ValueUnit unit=VU_UNKNOWN)
 Sets the value of the object.
 
virtual bool set (const Nimble::Vector2f &v, Layer layer=USER, QList< ValueUnit > units=QList< ValueUnit >())
 Sets the value of the object.
 
virtual bool set (const Nimble::Vector3f &v, Layer layer=USER, QList< ValueUnit > units=QList< ValueUnit >())
 Sets the value of the object.
 
virtual bool set (const Nimble::Vector4f &v, Layer layer=USER, QList< ValueUnit > units=QList< ValueUnit >())
 Sets the value of the object.
 
virtual bool set (const StyleValue &value, Layer layer=USER)
 Sets the value of the object.
 
void setName (const QByteArray &s)
 Sets the name of the object.
 
void setOwnerShorthand (Attribute *owner)
 
virtual QByteArray type () const
 Get the type id of the attribute. More...
 
- Public Member Functions inherited from Valuable::Serializable
virtual bool deserializeXML (const DOMElement &element)
 Deserializes (reads) this object from an XML element. More...
 
bool isSerializable () const
 
void setSerializable (bool v)
 

Protected Attributes

AttributeBackground m_background
 Background for this box.
 
AttributeBorder m_cssBorder
 Borders for this box.
 
Valuable::AttributeFrame m_cssMargin
 Size of the margin for this box (top, right, bottom, left)
 
Valuable::AttributeFrame m_cssPadding
 Size of the padding (top, right, bottom, left)
 
Valuable::AttributeLocation2f m_location
 Location of the upper-left corner.
 
Valuable::AttributeSizeF m_size
 Size of the content-box of the widget.
 
- Protected Attributes inherited from Stylish::Styleable
Style m_childStyle
 Cached style that should be applied to all children of this object.
 
Valuable::AttributeString m_cssClass
 CSS class of the object as a space separated list.
 
Valuable::AttributeString m_cssId
 CSS id of the object.
 
QByteArray m_cssType
 CSS type of the object.
 
Style m_style
 Currently applied style.
 

Additional Inherited Members

- Public Types inherited from Valuable::Node
typedef container::const_iterator const_iterator
 
typedef Radiant::ArrayMap
< QByteArray, Attribute * > 
container
 Container for attributes, key is the attribute name.
 
typedef container::iterator iterator
 Iterator for the container.
 
typedef std::function< void(Radiant::BinaryData &)> ListenerFuncBd
 Listener function type that takes a BinaryData reference as a parameter, similar to eventProcess.
 
typedef std::function< void()> ListenerFuncVoid
 Default listener function type.
 
enum  ListenerType { DIRECT =1, AFTER_UPDATE =2, AFTER_UPDATE_ONCE =4 }
 Types of event listeners. More...
 
typedef int64_t Uuid
 Unique identifier type.
 
- Node Events inherited from Stylish::Styleable
[OUT] pseudo-class-changed (QString name, bool state)
 Pseudo class name was added (state == true) or removed (state == false)
 
- Static Public Member Functions inherited from Valuable::Node
static bool copyValues (const Node &from, Node &to)
 Copies attribute values from one node to another. More...
 
static void disableQueue ()
 Disables all AFTER_UPDATE event processing, no new events will be accepted and the current queue will be cleared. More...
 
static Uuid generateId ()
 Generates a unique identifier. More...
 
static void invokeAfterUpdate (ListenerFuncVoid function)
 Queue function to be called in the main thread after the next update() More...
 
static int processQueue ()
 Triggers any pending AFTER_UPDATE-events. More...
 
static void reEnableQueue ()
 Enables queue after calling disableQueue. More...
 
static void setFatalOnEventMismatch (bool haltApplication)
 Controls what to do when an event mismatch is detected The default behavior is to output a warning to the terminal (haltApplication = false). More...
 
- Protected Member Functions inherited from Stylish::Styleable
virtual void attributeAdded (Attribute *attribute)
 This is called when new attribute is added to Node. More...
 
virtual void attributeRemoved (Attribute *attribute)
 This is called when attribute is removed from Node. More...
 
virtual void updateStyle ()
 Set the style for this object.
 

Detailed Description

Implements the basic framework for doing CSS-style box layout.

Member Function Documentation

AttributeBackground& Stylish::CSSBoxModel::background ( )
Returns
Background style used in this object
const AttributeBackground& Stylish::CSSBoxModel::background ( ) const

Returns
Background style used in this object
Nimble::Rectf Stylish::CSSBoxModel::backgroundBox ( ) const

Background painting area, depends on background-clip value.

Returns
area where background should be clipped
See Also
http://www.w3.org/TR/css3-background/#the-background-clip
Radiant::Color Stylish::CSSBoxModel::backgroundColor ( ) const
Returns
background color
AttributeBorder& Stylish::CSSBoxModel::border ( )
inline
Returns
the border attribute
const AttributeBorder& Stylish::CSSBoxModel::border ( ) const
inline

Returns
the border attribute
Stylish::Border Stylish::CSSBoxModel::borderBottom ( ) const
inline

Gets the bottom border that contains the width, style and color.

Returns
bottom border
Nimble::Rectf Stylish::CSSBoxModel::borderBox ( ) const

Border box, rectangle that includes content, padding and border.

Returns
border box size
See Also
http://www.w3.org/TR/css3-background/#the-background-clip
Nimble::Frame4f Stylish::CSSBoxModel::borderFrame ( ) const
inline

Size of the border.

Frame contains the computed widths of the borders in (top,right,bottom,left) order. Computed width: absolute value or '0' if the border style is 'none' or 'hidden'

Returns
border size
Stylish::Border Stylish::CSSBoxModel::borderLeft ( ) const
inline

Gets the left border that contains the width, style and color.

Returns
left border
Stylish::Border Stylish::CSSBoxModel::borderRight ( ) const
inline

Gets the right border that contains the width, style and color.

Returns
right border
Stylish::Border Stylish::CSSBoxModel::borderTop ( ) const
inline

Gets the top border that contains the width, style and color.

Returns
top border
Nimble::SizeF Stylish::CSSBoxModel::boxSize ( ) const
inline

Calculates total amount of screen estate taken by the box by adding size, padding, border and margin together.

Returns
Vector containing the total size. The vector x component contains width and the y component contains height.
Nimble::Rectf Stylish::CSSBoxModel::contentBox ( ) const

Content box, rectangle that includes only the content area.

Returns
content box size
See Also
http://www.w3.org/TR/css3-background/#the-background-clip
virtual float Stylish::CSSBoxModel::heightForWidth ( float  width) const
virtual

Given the width of the content area for this box, what would be the height of the content area? This should be overridden in derived classes.

Parameters
widthThe desired width of the widget.
Returns
The height for desired given width.

Reimplemented in MultiWidgets::Widget, MultiWidgets::TextWidget, and MultiWidgets::VideoControlWidget.

Nimble::Vector2 Stylish::CSSBoxModel::location ( ) const
inline

The location of this object in pixels in its parent's coordinate system.

See Also
setLocation
Nimble::Frame4f Stylish::CSSBoxModel::margin ( ) const
inline

Size of the margin.

The four vector Nimble::Frame4f contains margins in (top,right,bottom,left) order.

Returns
margin size
Nimble::Rectf Stylish::CSSBoxModel::marginBox ( ) const

Margin box, rectangle that includes content, padding, border and margin.

Returns
margin box size
See Also
http://www.w3.org/TR/CSS2/box.html
Nimble::Frame4f Stylish::CSSBoxModel::padding ( ) const
inline

Size of the padding.

The four vector Nimble::Frame4f contains paddings in (top,right,bottom,left) order.

Returns
padding size
Nimble::Rectf Stylish::CSSBoxModel::paddingBox ( ) const

Padding box, rectangle that includes content and padding but excludes border area.

Returns
padding box size
See Also
http://www.w3.org/TR/css3-background/#the-background-clip
void Stylish::CSSBoxModel::setBackgroundColor ( Radiant::Color  color)
Parameters
colornew background color
Examples:
PluginExample.cpp, and PositionalSoundsExample.cpp.
void Stylish::CSSBoxModel::setBackgroundColor ( float  red,
float  green,
float  blue,
float  alpha 
)
inline
Parameters
red,green,blue,alphanew background color
void Stylish::CSSBoxModel::setBorderColor ( float  r,
float  g,
float  b,
float  a 
)
inline
See Also
setBorderColor()
Parameters
r,g,b,aRGBA-values for the border color
virtual void Stylish::CSSBoxModel::setBorderFrame ( const Nimble::Frame4f border)
inlinevirtual

Sets the width for all borders.

Parameters
borderBorder frame with individual widths (top,right,bottom,left)
void Stylish::CSSBoxModel::setLocation ( Nimble::Vector2  location)
inline

Setter for attribute location.

See Also
location
Parameters
locationnew attribute value
void Stylish::CSSBoxModel::setLocation ( Nimble::Vector2  location,
ValueUnit  unit 
)
inline

Set the location of this object.

Parameters
locationlocation in parent coordinate system
unitunit of location parameter
void Stylish::CSSBoxModel::setLocation ( float  x,
float  y 
)
inline

Set the location of this object.

Parameters
x,ylocation in pixels in parent coordinate system
void Stylish::CSSBoxModel::setLocation ( float  x,
float  y,
ValueUnit  unit 
)
inline

Set the location of this object.

Parameters
x,ylocation in parent coordinate system
unitunit of location parameter
void Stylish::CSSBoxModel::setMargin ( const Nimble::Frame4f margin)
inline

Setter for attribute margin.

See Also
margin()
Parameters
marginnew box margins
marginnew attribute value
void Stylish::CSSBoxModel::setPadding ( const Nimble::Frame4f padding)
inlinevirtual

Setter for attribute padding.

See Also
padding()
Parameters
paddingnew padding values
paddingnew attribute value
void Stylish::CSSBoxModel::setPadding ( float  oneSidePadding)
inline

Set the size of the padding for all sides to be equal.

Parameters
oneSidePaddingpadding on one side, in pixels
void Stylish::CSSBoxModel::setSize ( Nimble::SizeF  size)
inline

Setter for attribute size.

See Also
size
Parameters
sizenew attribute value
void Stylish::CSSBoxModel::setSize ( float  width,
float  height,
ValueUnit  unit = VU_PXS 
)
inline

Set box size.

Parameters
width,heightbox size
unitunit used in both width and height
See Also
size()
void Stylish::CSSBoxModel::setSize ( Nimble::SizeF  size,
ValueUnit  widthUnit,
ValueUnit  heightUnit 
)
inline

Set box size.

Parameters
sizebox size
widthUnitunit used in width
heightUnitunit used in height
See Also
size()
Nimble::SizeF Stylish::CSSBoxModel::size ( ) const
inline

Box size in pixels.

See Also
setSize