TGUI  v0.6.10
Public Types | Public Member Functions | List of all members
tgui::Canvas Class Reference
Inheritance diagram for tgui::Canvas:
tgui::ClickableWidget tgui::Widget tgui::Transformable tgui::CallbackManager

Public Types

- Public Types inherited from tgui::ClickableWidget
- Public Types inherited from tgui::Widget

Public Member Functions

 Canvas ()
 Default constructor. More...
 
 Canvas (const Canvas &copy)
 Copy constructor. More...
 
virtual ~Canvas ()
 Destructor. More...
 
Canvasoperator= (const Canvas &right)
 Overload of assignment operator. More...
 
virtual void setPosition (float x, float y)
 Set the position of the widget. More...
 
virtual void setSize (float width, float height)
 Changes the size of the widget. More...
 
virtual sf::Vector2f getSize () const
 Returns the size of the widget. More...
 
void clear (const sf::Color &color=sf::Color(0, 0, 0, 255))
 Clear the entire canvas with a single color. More...
 
void draw (const sf::Drawable &drawable, const sf::RenderStates &states=sf::RenderStates::Default)
 Draw a drawable object to the canvas. More...
 
void draw (const sf::Vertex *vertices, unsigned int vertexCount, sf::PrimitiveType type, const sf::RenderStates &states=sf::RenderStates::Default)
 Draw primitives defined by an array of vertices. More...
 
void display ()
 Update the contents of the canvas. More...
 
- Public Member Functions inherited from tgui::ClickableWidget
 ClickableWidget ()
 Default constructor. More...
 
 ClickableWidget (const ClickableWidget &copy)
 Copy constructor. More...
 
virtual ~ClickableWidget ()
 Destructor. More...
 
ClickableWidgetoperator= (const ClickableWidget &right)
 Overload of assignment operator. More...
 
- Public Member Functions inherited from tgui::Widget
 Widget ()
 Default constructor. More...
 
 Widget (const Widget &copy)
 Copy constructor. More...
 
virtual ~Widget ()
 Destructor. More...
 
Widgetoperator= (const Widget &right)
 Overload of assignment operator. More...
 
virtual sf::Vector2f getAbsolutePosition () const
 Get the absolute position of the widget on the screen. More...
 
virtual void show ()
 Shows the widget. More...
 
virtual void hide ()
 Hides the widget. More...
 
bool isVisible () const
 Returns true when the widget is visible. More...
 
virtual void enable ()
 Enables the widget. More...
 
virtual void disable ()
 Disables the widget. More...
 
bool isEnabled () const
 Returns true when the widget is enabled. More...
 
bool isDisabled () const
 Returns true when the widget is disabled. More...
 
bool isLoaded () const
 Returns true when the widget is loaded successfully. More...
 
virtual void focus ()
 Focus the widget. More...
 
virtual void unfocus ()
 Unfocus the widget. More...
 
bool isFocused () const
 Returns true when the widget is focused and false otherwise. More...
 
WidgetTypes getWidgetType () const
 Returns the type of the widget. More...
 
ContainergetParent () const
 Returns a pointer to the parent widget. More...
 
virtual void setTransparency (unsigned char transparency)
 Changes the transparency of the widget. More...
 
unsigned char getTransparency () const
 Returns the transparency of the widget. More...
 
virtual void moveToFront ()
 Places the widget before all other widgets. More...
 
virtual void moveToBack ()
 Places the widget behind all other widgets. More...
 
void setCallbackId (unsigned int callbackId)
 Changes the callback id of the widget. More...
 
unsigned int getCallbackId ()
 Returns the callback id of the widget. More...
 
- Public Member Functions inherited from tgui::Transformable
 Transformable ()
 Default constructor. More...
 
virtual ~Transformable ()
 Destructor. More...
 
void setPosition (const sf::Vector2f &position)
 set the position of the widget More...
 
const sf::Vector2f & getPosition () const
 get the position of the widget More...
 
void move (float offsetX, float offsetY)
 Move the widget by a given offset. More...
 
void move (const sf::Vector2f &offset)
 Move the widget by a given offset. More...
 
virtual sf::Vector2f getFullSize () const
 Returns the entire size that the widget is using. More...
 
void scale (float factorX, float factorY)
 Scale the widget. More...
 
void scale (const sf::Vector2f &factors)
 Scale the widget. More...
 
- Public Member Functions inherited from tgui::CallbackManager
void bindCallback (std::function< void()> func, unsigned int trigger)
 Bind a function to one or more specific callback trigger(s). More...
 
template<typename T >
void bindCallback (void(T::*func)(), T *const classPtr, unsigned int trigger)
 Bind a function to one or more specific callback trigger(s). More...
 
void bindCallbackEx (std::function< void(const Callback &)> func, unsigned int trigger)
 Bind a function to one or more specific callback trigger(s). More...
 
template<typename T >
void bindCallbackEx (void(T::*func)(const Callback &), T *const classPtr, unsigned int trigger)
 Bind a function to one or more specific callback trigger(s). More...
 
void bindCallback (unsigned int trigger)
 Bind one or more specific callback trigger(s) to the parent widget. More...
 
void unbindCallback (unsigned int trigger)
 Unbind all callback function bound to the given trigger. More...
 
void unbindAllCallback ()
 Unbind all callback functions bound to any callback. More...
 

Member Enumeration Documentation

Defines specific triggers to Canvas.

Enumerator
AllCanvasCallbacks 

All triggers defined in Canvas and its base classes.

Constructor & Destructor Documentation

tgui::Canvas::Canvas ( )

Default constructor.

tgui::Canvas::Canvas ( const Canvas copy)

Copy constructor.

Parameters
copyInstance to copy
virtual tgui::Canvas::~Canvas ( )
virtual

Destructor.

Member Function Documentation

void tgui::Canvas::clear ( const sf::Color &  color = sf::Color(0, 0, 0, 255))

Clear the entire canvas with a single color.

This function is usually called once every frame, to clear the previous contents of the canvas.

Parameters
colorFill color to use to clear the canvas
void tgui::Canvas::display ( )

Update the contents of the canvas.

This function updates the canvas with what has been drawn so far. Like for windows, calling this function is mandatory at the end of rendering. Not calling it may leave the texture in an undefined state.

void tgui::Canvas::draw ( const sf::Drawable &  drawable,
const sf::RenderStates &  states = sf::RenderStates::Default 
)

Draw a drawable object to the canvas.

Parameters
drawableObject to draw
statesRender states to use for drawing
void tgui::Canvas::draw ( const sf::Vertex *  vertices,
unsigned int  vertexCount,
sf::PrimitiveType  type,
const sf::RenderStates &  states = sf::RenderStates::Default 
)

Draw primitives defined by an array of vertices.

Parameters
verticesPointer to the vertices
vertexCountNumber of vertices in the array
typeType of primitives to draw
statesRender states to use for drawing
virtual sf::Vector2f tgui::Canvas::getSize ( ) const
virtual

Returns the size of the widget.

Returns
Size of the widget

Reimplemented from tgui::ClickableWidget.

Canvas& tgui::Canvas::operator= ( const Canvas right)

Overload of assignment operator.

Parameters
rightInstance to assign
Returns
Reference to itself
virtual void tgui::Canvas::setPosition ( float  x,
float  y 
)
virtual

Set the position of the widget.

This function completely overwrites the previous position. See the move function to apply an offset based on the previous position instead. The default position of a transformable widget is (0, 0).

Parameters
xX coordinate of the new position
yY coordinate of the new position
See also
move, getPosition

Reimplemented from tgui::Transformable.

virtual void tgui::Canvas::setSize ( float  width,
float  height 
)
virtual

Changes the size of the widget.

Parameters
widthThe new width of the widget
heightThe new height of the widget

Reimplemented from tgui::ClickableWidget.


The documentation for this class was generated from the following file: