Wt  3.3.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
Public Member Functions | Related Functions
Wt::WBrush Class Reference

A value class that defines the style for filling a path. More...

#include <Wt/WBrush>

Inheritance diagram for Wt::WBrush:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 WBrush ()
 Creates a brush.
 WBrush (BrushStyle style)
 Creates a brush with the given style.
 WBrush (const WColor &color)
 Creates a solid brush of a given color.
 WBrush (GlobalColor color)
 Creates a solid brush with a standard color.
 WBrush (const WGradient &gradient)
 Creates a gradient brush.
bool operator== (const WBrush &other) const
 Comparison operator.
bool operator!= (const WBrush &other) const
 Comparison operator.
void setStyle (BrushStyle style)
 Sets the brush style.
BrushStyle style () const
 Returns the fill style.
void setColor (const WColor &color)
 Sets the brush color.
const WColorcolor () const
 Returns the brush color.
void setGradient (const WGradient &gradient)
 Sets the brush gradient.
const WGradientgradient () const
 Returns the brush gradient.
virtual std::string jsValue () const WT_CXX11ONLY(override)
 Returns a JavaScript representation of the value of this object.

Related Functions

(Note that these are not member functions.)

enum  BrushStyle { NoBrush, SolidPattern, GradientPattern }
 Enumeration that indicates a fill style. More...

Detailed Description

A value class that defines the style for filling a path.

A brush defines the properties of how areas (the interior of shapes) are filled. A brush is defined either as a solid color or a gradient.

JavaScript exposability

A WBrush is JavaScript exposable. If a WBrush is JavaScript bound, it can be accessed in your custom JavaScript code through its handle's jsRef(). At the moment, only the color() property is exposed, e.g. a brush with the color WColor(10,20,30,255) will be represented in JavaScript as:

 {
   color: [10,20,30,255]
 }
Warning:
A WBrush that is JavaScript exposed should be modified only through its handle. Any attempt at modifying it will cause an exception to be thrown.
See also:
WPainter::setBrush(), WPen, WPaintedWidget::createJSBrush()

Constructor & Destructor Documentation

Creates a brush.

Creates a brush with a NoBrush fill style.

Wt::WBrush::WBrush ( const WColor color)

Creates a solid brush of a given color.

Creates a solid brush with the indicated color.

Creates a solid brush with a standard color.

Creates a solid brush with the indicated color.


Member Function Documentation

const WColor& Wt::WBrush::color ( ) const

Returns the brush color.

See also:
color()
std::string Wt::WBrush::jsValue ( ) const [override, virtual]

Returns a JavaScript representation of the value of this object.

Note:
The value returned will reflect the current server side value of the object. If this object is JavaScript bound, this value may not reflect the actual client side value. If you need access to the client side value, use jsRef() intead.

Implements Wt::WJavaScriptExposableObject.

bool Wt::WBrush::operator!= ( const WBrush other) const

Comparison operator.

Returns true if the brushes are different.

bool Wt::WBrush::operator== ( const WBrush other) const

Comparison operator.

Returns true if the brushes are exactly the same.

void Wt::WBrush::setColor ( const WColor color)

Sets the brush color.

If the current style is a gradient style, then it is reset to SolidPattern.

Exceptions:
WExceptionif the brush is JavaScript bound
See also:
color()
void Wt::WBrush::setGradient ( const WGradient gradient)

Sets the brush gradient.

This also sets the style to GradientPattern.

Exceptions:
WExceptionif the brush is JavaScript bound

Sets the brush style.

Exceptions:
WExceptionif the brush is JavaScript bound
See also:
style()

Returns the fill style.

See also:
setStyle(BrushStyle)
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator

Generated on Tue Mar 22 2016 for the C++ Web Toolkit (Wt) by doxygen 1.7.6.1