SDOM - Simple SDL Document Object Model
A lightweight, extensible Document Object Model for SDL-based applications.
|
#include <SDOM_IDisplayObject.hpp>
Classes | |
struct | InitStruct |
struct | ListenerEntry |
Public Types | |
enum class | OrphanRetentionPolicy : int { RetainUntilManual , AutoDestroy , GracePeriod } |
Public Member Functions | |
OrphanRetentionPolicy | getOrphanRetentionPolicy () const |
IDisplayObject & | setOrphanRetentionPolicy (OrphanRetentionPolicy policy) |
std::chrono::milliseconds | getOrphanGrace () const |
IDisplayObject & | setOrphanGrace (std::chrono::milliseconds grace) |
bool | operator== (const IDisplayObject &other) const |
bool | operator< (const IDisplayObject &other) const |
bool | operator!= (const IDisplayObject &other) const |
bool | operator> (const IDisplayObject &other) const |
bool | operator<= (const IDisplayObject &other) const |
bool | operator>= (const IDisplayObject &other) const |
virtual | ~IDisplayObject () |
virtual bool | onInit () override |
virtual void | onQuit () override |
virtual void | onUpdate (float fElapsedTime) |
virtual void | onEvent (const Event &event) |
virtual void | onRender ()=0 |
virtual bool | onUnitTest () |
Runs unit tests for this object. | |
void | cleanAll () |
bool | getDirty () const |
IDisplayObject & | setDirty () |
IDisplayObject & | setDirty (bool grime) |
bool | isDirty () const |
void | printTree (int depth=0, bool isLast=true, const std::vector< bool > &hasMoreSiblings={}) const |
void | addEventListener (EventType &type, std::function< void(Event &)> listener, bool useCapture=false, int priority=0) |
void | removeEventListener (EventType &type, std::function< void(Event &)> listener, bool useCapture=false) |
void | triggerEventListeners (Event &event, bool useCapture) |
bool | hasEventListeners (const EventType &type, bool useCapture) const |
void | queue_event (const EventType &type, std::function< void(Event &)> init_payload) |
void | addChild (DisplayHandle child, bool useWorld=false, int worldX=0, int worldY=0) |
DisplayHandle | getChild (std::string name) const |
bool | removeChild (DisplayHandle child) |
bool | removeChild (const std::string &name) |
const std::vector< DisplayHandle > & | getChildren () const |
DisplayHandle | getParent () const |
IDisplayObject & | setParent (const DisplayHandle &parent) |
bool | hasChild (DisplayHandle child) const |
bool | isAncestorOf (DisplayHandle descendant) const |
bool | isAncestorOf (const std::string &name) const |
bool | isDescendantOf (DisplayHandle ancestor) const |
bool | isDescendantOf (const std::string &name) const |
bool | removeFromParent () |
bool | removeDescendant (DisplayHandle descendant) |
bool | removeDescendant (const std::string &descendantName) |
std::string | getType () const |
IDisplayObject & | setType (const std::string &newType) |
Bounds | getBounds () const |
IDisplayObject & | setBounds (const Bounds &b) |
SDL_Color | getColor () const |
IDisplayObject & | setColor (const SDL_Color &color) |
int | getMaxPriority () const |
int | getMinPriority () const |
int | getPriority () const |
IDisplayObject & | setToHighestPriority () |
IDisplayObject & | setToLowestPriority () |
IDisplayObject & | sortChildrenByPriority () |
IDisplayObject & | setPriority (int priority) |
std::vector< int > | getChildrenPriorities () const |
IDisplayObject & | moveToTop () |
int | getZOrder () const |
IDisplayObject & | setZOrder (int z_order) |
void | setKeyboardFocus () |
bool | isKeyboardFocused () const |
bool | isMouseHovered () const |
bool | isClickable () const |
IDisplayObject & | setClickable (bool clickable) |
bool | isEnabled () const |
IDisplayObject & | setEnabled (bool enabled) |
bool | isHidden () const |
IDisplayObject & | setHidden (bool hidden) |
bool | isVisible () const |
IDisplayObject & | setVisible (bool visible) |
int | getTabPriority () const |
IDisplayObject & | setTabPriority (int index) |
bool | isTabEnabled () const |
IDisplayObject & | setTabEnabled (bool enabled) |
int | getX () const |
int | getY () const |
int | getWidth () const |
int | getHeight () const |
IDisplayObject & | setX (int p_x) |
IDisplayObject & | setY (int p_y) |
IDisplayObject & | setWidth (int width) |
IDisplayObject & | setHeight (int height) |
AnchorPoint | getAnchorTop () const |
AnchorPoint | getAnchorLeft () const |
AnchorPoint | getAnchorBottom () const |
AnchorPoint | getAnchorRight () const |
void | setAnchorTop (AnchorPoint ap) |
void | setAnchorLeft (AnchorPoint ap) |
void | setAnchorBottom (AnchorPoint ap) |
void | setAnchorRight (AnchorPoint ap) |
float | getLeft () const |
float | getRight () const |
float | getTop () const |
float | getBottom () const |
IDisplayObject & | setLeft (float p_left) |
IDisplayObject & | setRight (float p_right) |
IDisplayObject & | setTop (float p_top) |
IDisplayObject & | setBottom (float p_bottom) |
float | getLocalX () const |
float | getLocalY () const |
float | getLocalWidth () const |
float | getLocalHeight () const |
float | getLocalLeft () const |
float | getLocalRight () const |
float | getLocalTop () const |
float | getLocalBottom () const |
IDisplayObject & | setLocalLeft (float value) |
IDisplayObject & | setLocalRight (float value) |
IDisplayObject & | setLocalTop (float value) |
IDisplayObject & | setLocalBottom (float value) |
std::string | getName () const |
void | setName (const std::string &newName) |
void | registerLuaBindings (const std::string &typeName, sol::state_view lua) |
Static Public Member Functions | |
template<typename T > | |
static T | lua_value_case_insensitive (const sol::table &tbl, const std::string &key, const T &default_value) |
Static Public Attributes | |
static constexpr const char * | TypeName = "IDisplayObject" |
Protected Member Functions | |
IDisplayObject (const InitStruct &init) | |
IDisplayObject (const sol::table &config) | |
IDisplayObject () | |
IDisplayObject (const IDisplayObject &other)=delete | |
void | attachChild_ (DisplayHandle child, DisplayHandle parent, bool useWorld=false, int worldX=0, int worldY=0) |
void | removeOrphan_ (const DisplayHandle &orphan) |
virtual void | _registerLuaBindings (const std::string &typeName, sol::state_view lua) |
Friends | |
class | Factory |
|
strong |
|
protected |
|
protected |
|
protected |
|
virtual |
|
protecteddelete |
|
protectedvirtual |
Reimplemented from SDOM::IDataObject.
Reimplemented in SDOM::Button, SDOM::Checkbox, SDOM::Frame, SDOM::Group, SDOM::IconButton, SDOM::IPanelObject, SDOM::Label, SDOM::Radiobox, SDOM::Stage, SDOM::TristateButton, and SDOM::TriStateCheckbox.
void SDOM::IDisplayObject::addChild | ( | DisplayHandle | child, |
bool | useWorld = false , |
||
int | worldX = 0 , |
||
int | worldY = 0 |
||
) |
void SDOM::IDisplayObject::addEventListener | ( | EventType & | type, |
std::function< void(Event &)> | listener, | ||
bool | useCapture = false , |
||
int | priority = 0 |
||
) |
|
protected |
void SDOM::IDisplayObject::cleanAll | ( | ) |
|
inline |
|
inline |
|
inline |
|
inline |
float SDOM::IDisplayObject::getBottom | ( | ) | const |
|
inline |
DisplayHandle SDOM::IDisplayObject::getChild | ( | std::string | name | ) | const |
const std::vector< DisplayHandle > & SDOM::IDisplayObject::getChildren | ( | ) | const |
std::vector< int > SDOM::IDisplayObject::getChildrenPriorities | ( | ) | const |
|
inline |
|
inline |
int SDOM::IDisplayObject::getHeight | ( | ) | const |
float SDOM::IDisplayObject::getLeft | ( | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
int SDOM::IDisplayObject::getMaxPriority | ( | ) | const |
int SDOM::IDisplayObject::getMinPriority | ( | ) | const |
|
inlineinherited |
|
inline |
|
inline |
DisplayHandle SDOM::IDisplayObject::getParent | ( | ) | const |
|
inline |
float SDOM::IDisplayObject::getRight | ( | ) | const |
int SDOM::IDisplayObject::getTabPriority | ( | ) | const |
float SDOM::IDisplayObject::getTop | ( | ) | const |
|
inline |
int SDOM::IDisplayObject::getWidth | ( | ) | const |
int SDOM::IDisplayObject::getX | ( | ) | const |
int SDOM::IDisplayObject::getY | ( | ) | const |
|
inline |
bool SDOM::IDisplayObject::hasChild | ( | DisplayHandle | child | ) | const |
bool SDOM::IDisplayObject::hasEventListeners | ( | const EventType & | type, |
bool | useCapture | ||
) | const |
bool SDOM::IDisplayObject::isAncestorOf | ( | const std::string & | name | ) | const |
bool SDOM::IDisplayObject::isAncestorOf | ( | DisplayHandle | descendant | ) | const |
|
inline |
bool SDOM::IDisplayObject::isDescendantOf | ( | const std::string & | name | ) | const |
bool SDOM::IDisplayObject::isDescendantOf | ( | DisplayHandle | ancestor | ) | const |
|
inline |
|
inline |
|
inline |
bool SDOM::IDisplayObject::isKeyboardFocused | ( | ) | const |
bool SDOM::IDisplayObject::isMouseHovered | ( | ) | const |
bool SDOM::IDisplayObject::isTabEnabled | ( | ) | const |
|
inline |
|
inlinestaticinherited |
IDisplayObject & SDOM::IDisplayObject::moveToTop | ( | ) |
|
virtual |
Reimplemented in SDOM::Button, SDOM::Checkbox, SDOM::Frame, SDOM::Group, SDOM::IconButton, SDOM::Label, SDOM::Radiobox, SDOM::Stage, SDOM::TristateButton, SDOM::TriStateCheckbox, and SDOM::IPanelObject.
|
overridevirtual |
Implements SDOM::IDataObject.
Reimplemented in SDOM::Button, SDOM::Checkbox, SDOM::Frame, SDOM::Group, SDOM::IconButton, SDOM::IPanelObject, SDOM::Label, SDOM::Radiobox, SDOM::Stage, SDOM::TristateButton, and SDOM::TriStateCheckbox.
|
overridevirtual |
Implements SDOM::IDataObject.
Reimplemented in SDOM::Button, SDOM::Checkbox, SDOM::Frame, SDOM::Group, SDOM::IconButton, SDOM::IPanelObject, SDOM::Label, SDOM::Radiobox, SDOM::Stage, SDOM::TristateButton, and SDOM::TriStateCheckbox.
|
pure virtual |
Implemented in SDOM::Button, SDOM::Checkbox, SDOM::Frame, SDOM::Group, SDOM::IconButton, SDOM::IPanelObject, SDOM::Label, SDOM::Radiobox, SDOM::Stage, SDOM::TristateButton, and SDOM::TriStateCheckbox.
|
inlinevirtual |
Runs unit tests for this object.
Reimplemented from SDOM::IDataObject.
Reimplemented in SDOM::Label, SDOM::Stage, and SDOM::TristateButton.
|
virtual |
Reimplemented in SDOM::Button, SDOM::Checkbox, SDOM::Frame, SDOM::Group, SDOM::IconButton, SDOM::Label, SDOM::Radiobox, SDOM::Stage, SDOM::TristateButton, SDOM::TriStateCheckbox, and SDOM::IPanelObject.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void SDOM::IDisplayObject::printTree | ( | int | depth = 0 , |
bool | isLast = true , |
||
const std::vector< bool > & | hasMoreSiblings = {} |
||
) | const |
void SDOM::IDisplayObject::queue_event | ( | const EventType & | type, |
std::function< void(Event &)> | init_payload | ||
) |
|
inlineinherited |
bool SDOM::IDisplayObject::removeChild | ( | const std::string & | name | ) |
bool SDOM::IDisplayObject::removeChild | ( | DisplayHandle | child | ) |
bool SDOM::IDisplayObject::removeDescendant | ( | const std::string & | descendantName | ) |
bool SDOM::IDisplayObject::removeDescendant | ( | DisplayHandle | descendant | ) |
void SDOM::IDisplayObject::removeEventListener | ( | EventType & | type, |
std::function< void(Event &)> | listener, | ||
bool | useCapture = false |
||
) |
bool SDOM::IDisplayObject::removeFromParent | ( | ) |
|
protected |
void SDOM::IDisplayObject::setAnchorBottom | ( | AnchorPoint | ap | ) |
void SDOM::IDisplayObject::setAnchorLeft | ( | AnchorPoint | ap | ) |
void SDOM::IDisplayObject::setAnchorRight | ( | AnchorPoint | ap | ) |
void SDOM::IDisplayObject::setAnchorTop | ( | AnchorPoint | ap | ) |
IDisplayObject & SDOM::IDisplayObject::setBottom | ( | float | p_bottom | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
IDisplayObject & SDOM::IDisplayObject::setHeight | ( | int | height | ) |
|
inline |
void SDOM::IDisplayObject::setKeyboardFocus | ( | ) |
IDisplayObject & SDOM::IDisplayObject::setLeft | ( | float | p_left | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineinherited |
|
inline |
|
inline |
IDisplayObject & SDOM::IDisplayObject::setParent | ( | const DisplayHandle & | parent | ) |
IDisplayObject & SDOM::IDisplayObject::setPriority | ( | int | priority | ) |
IDisplayObject & SDOM::IDisplayObject::setRight | ( | float | p_right | ) |
IDisplayObject & SDOM::IDisplayObject::setTabEnabled | ( | bool | enabled | ) |
IDisplayObject & SDOM::IDisplayObject::setTabPriority | ( | int | index | ) |
IDisplayObject & SDOM::IDisplayObject::setToHighestPriority | ( | ) |
IDisplayObject & SDOM::IDisplayObject::setToLowestPriority | ( | ) |
IDisplayObject & SDOM::IDisplayObject::setTop | ( | float | p_top | ) |
|
inline |
|
inline |
IDisplayObject & SDOM::IDisplayObject::setWidth | ( | int | width | ) |
IDisplayObject & SDOM::IDisplayObject::setX | ( | int | p_x | ) |
IDisplayObject & SDOM::IDisplayObject::setY | ( | int | p_y | ) |
|
inline |
IDisplayObject & SDOM::IDisplayObject::sortChildrenByPriority | ( | ) |
void SDOM::IDisplayObject::triggerEventListeners | ( | Event & | event, |
bool | useCapture | ||
) |
|
friend |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protectedinherited |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticconstexpr |
|
protected |