Widget2D class reference
The widget interface, the lowest level used by complex high-level widgets. It essentially implements only the basic Set and Get methods.
Functions
Functions documentation
Widget2D
();
Test constructor.
Widget2D
(
Window
* parent, const
Widget2DProps
& props);
Default constructor.
~
Widget2D
();
Destructor.
virtual
Widget2D
* Clone() const = 0;
Clones the object (usefull while making copy of object that is casted to its base). The function must be implemented in the inheriting class.
virtual void SetPosition(Point<int> newPosition) = 0;
Sets the widget in a specific position. The function must be implemented in the inheriting class.
virtual void ChangePosition(Point<int> positionChange) = 0;
Changes the position of the widget relative to the current one. The function must be implemented in an inheriting class.
virtual void SetVisibility(bool mode) = 0;
Sets the visibility of the widget. The function must be implemented in an inheriting class.
virtual bool GetVisibility() const = 0;
Returns the visibility of the widget. The function must be implemented in an inheriting class.
virtual void EnableWidget() = 0;
Activates the widget's operation by registering for specific events to the parent window. The function must be implemented in an inheriting class.
virtual void DisableWidget() = 0;
Deactivates the widget by unregistering from the parent window. Note - re-registration may change the z-order of the widget on rendering stack. The function must be implemented in an inheriting class.
virtual void Render() = 0;
Renders the widget. The function must be implemented in an inheriting class.
virtual void UnregisterEvent(
EventType
eventType);
Allows to unregister the widget from a specific event in the parent window.
void ChangeParent(
Window
* newParent);
Reconnects the widget to another parent window.
virtual void SetWidgetId(int id);
Sets the Id for the widget.
virtual int GetWidgetId() const;
Returns the widget Id.
virtual void SetFlags(int newFlags);
Sets the widget flags.
int GetFlags() const;
Returns the widget flags.
WidgetType
GetWidgetType();
Returns the widget type.
Window
* GetParentWindow() const;
Returns the widget parent. If the parent is the top-level window, then returns nullptr.
virtual const
Dimension
<size_t> GetDimension() const;
Returns the widget current dimentions.
virtual const Point<int> GetPosition() const;
Returns the widget current position.
virtual const
Widget2DProps
& GetWidget2DProps() const;
Returns the widget information as an Widget2DProps reference.
void AlterCoords(Point<int> & point);
It reduces the position of the point relative to the position of the widget. This allows to check if the external point is inside the widget.
bool CheckCoords(Point<int> & point);
Checks if the point is in the widget's space.
Variables documentation
Widget2DProps
m_Widget2DProps;
Stores basic data about the widget.
WidgetType
m_WidgetType;
Stores the widget type.
Window
* m_ParentWindow;
Stores the pointer on the parent.
std::list<BindListIterator> m_Bindings;
Stores iterators for registered events.