CustomWidget class reference
This is the base for quickly creating new widgets. It can also be used as a shell class that emulates other widgets in runtime.
Functions
Functions documentation
CustomWidget
(
Window
* window, const
Widget2DProps
& props);
Default constructor.
CustomWidget
(const
CustomWidget
& copy);
Copy constructor
virtual ~
CustomWidget
();
Destructor. Deletes all widgets added to m_Components list (via AddComponent() function).
CustomWidget
& operator=(
CustomWidget
rhs);
Assignment operator.
friend void swap(
CustomWidget
& first,
CustomWidget
& second) noexcept;
Swap function.
virtual
CustomWidget
* Clone() const override;
Clones the object (usefull while making copy of object that is casted to its base). Warning: Please implement this function in derived classes for compatibility reasons!
bool AddComponent(int idx,
Widget2D
* widget);
Allows to easily add the widget-component to the internal list (version with explicit ID).
int AddComponent(
Widget2D
* widget);
Allows to easily add the widget-component to the internal list. The identifier is automatically assigned. If component is already present at passed ID, then addotion is canceled.
Widget2D
* GetComponent(int idx);
Returns (from m_Components list) widget associated with particular ID .
size_t ComponentAmount();
Returns widgets amount from m_Components list.
Variables documentation
std::map<int,
Widget2D
*> m_Components;
Stores widgets that are parts of implemented/target widget.
int m_LastInsertionPos;
Helper variable. Stores ID of the last added widget.