Simple Graphics Library
0.9.5
SGL API
|
#include <sgl.h>
Public Member Functions | |
CompositeObject () | |
void | paint () const override |
void | move_to (double x, double y) override |
void | internal_add (GraphicalObject *obj) |
template<typename T , typename... Args> | |
T * | add (Args &&... args) |
![]() | |
GraphicalObject (double left, double bottom, double width, double height) | |
GraphicalObject (const GraphicalObject &other) | |
GraphicalObject & | operator= (const GraphicalObject &other) |
virtual | ~GraphicalObject () |
virtual double | get_left () const |
virtual double | get_bottom () const |
virtual double | get_width () const |
virtual double | get_height () const |
virtual void | set (double x, double y, double width, double height) |
virtual void | mouse_pressed (double x, double y, MouseButton button) |
virtual void | mouse_released (double x, double y, MouseButton button) |
virtual void | mouse_moved (double x, double y) |
virtual void | mouse_dragged (double x, double y) |
virtual void | key_pressed (int k, double x, double y) |
virtual bool | hit (double x, double y) |
virtual Window * | set_window (ObjectWindow *win) |
virtual Window * | get_window () const |
virtual void | set_mouse_over (bool flag) |
virtual CursorShape | set_cursor (CursorShape cursor) |
virtual CursorShape | get_cursor () |
Protected Attributes | |
std::vector< GraphicalObject * > | objects |
![]() | |
ObjectWindow * | window |
double | x_hit_offset |
double | y_hit_offset |
double | left |
double | bottom |
double | width |
double | height |
CursorShape | cursor |
bool | mouse_over |
Additional Inherited Members | |
![]() | |
const unsigned | id |
A composite object aggregates a collection of graphical objects (even other composite objects into a single graphical object.
sgl::CompositeObject::CompositeObject | ( | ) |
The constructor makes an initially empty container.
|
inline |
Creates and adds a graphical object to the composite object. Clients specify the exact type of the graphical object as the template parameter and pass any arguments required by that object's constructor in the parameter list.
T | the type of graphical object to add to this composite object |
args | forwards the method parameters to the graphical object's constructor |
void sgl::CompositeObject::internal_add | ( | GraphicalObject * | obj | ) |
Adds a graphical object to this container. Adjusts the container's size accordingly.
obj | a pointer to the graphical object to add. |
Adds a graphical object to this container. Adjusts the container's size accordingly. Clients ordinarily call add method instead; the add method allocates space for the added object and relieves the client of memory management.
obj | a pointer to the graphical object to add. |
|
overridevirtual |
Repositions the lower-left corner of the composite object's boundng box to (x,y). The positions of the contained graphical objects are updated accordingly.
Reimplemented from sgl::GraphicalObject.
|
overridevirtual |
Draws each object that makes up the composite object.
Implements sgl::GraphicalObject.
|
protected |
The collection of contained graphical objects.