VScroller class reference
Basic interactive widget - after connecting other widgets to it - it moves them according to specific rules to a different place and takes control over their Render() function. Displays all connected widgets in the specified area and the rest of the widgets are cuts out. Provides a graphical bar which allows to move the attached widgets. It needs to have a connected AreaWidget widget to works (see ConnectArea() function).
Functions
Functions documentation
VScroller(Window* window, constWidget2DProps& scrollerProps,VScrollerThemetheme,AreaWidget* area = nullptr );
Default constructor.
VScroller(Window* window, constWidget2DProps& scrollerProps,Themetheme,AreaWidget* area = nullptr );
Delegating constructor with theme application.
virtual ~VScroller();
Destructor. Warning: it does NOT destroy connected widgets.
VScroller* Clone() const override;
Clones the object (usefull while making copy of object that is casted to its base).
void ConnectArea(AreaWidget* area);
Attaches an AreaWidget widget that specifies the space where new connected widgets will be moved. Please check appropriate guide for VScroller widget.
void DisconnectArea();Resets the area to nullptr. (VScroller will no longer work until new area is set)
void Clear();Removes all connected widgets from internal list and destroys them.
void PushBack(Widget2D* widget);
Adds (connects) widget to the VScroller.
void Remove(Widget2D* widget);
Removes widget with specific address (does not delete it).
void SetInsertOffsets(Point<int> offset = { 0,0 });Sets the margins between successive widgets.
void RecalculatePositions(size_t difference = 0);Recalculates the positions of all connected widgets.
void SetCallback(Callback function);Sets a callback that is executed every time an event is processed (inside button object).
void ResetCallback();Resets the callback to nullptr.
void SetOffset(float offset);Sets the scroller value (and shifts connected widgets position).
float GetOffset();Returns the scroller value.
void SetForegroundColor(WidgetMouseStateforState,Colorcolor);
Sets the foreground (slider) color for a given widget state.
Sets the foreground (slider) color for all widget states.
void SetBackgroundColor(Colorcolor);
Sets the widget background color.
void SetFlags(int newFlags) override;Sets the widget flags.
constColorGetForegroundColor(WidgetMouseStateforState) const;
Returns the foreground (slider) color for a given widget state.
constColorGetBackgroundColor() const;
Returns the widget background color.
size_t GetSize() const;Returns amount of connected widgets.
void CalcAnchorOffsets();Converts the location of the widget depending on the flags set (Anchor).
void UpdateScrollerDim();Updates the size of the slider.
void CalculateAnchorFix();Calculates the position change in the Y axis to fix some calculation problems. (depends on Anchor flags)
Point<int> CalculateAreaAnchor();Helps to calculate the real position of the AreaWidget widget depending on its Anchor flags.
Variables documentation
int m_SmartXPlace;Stores the X location for the new widget (if SmartPlacement flag is present).
int m_Rows;Stores information about the number of rows added. (needed to calculate new Y position)
Point<int> m_InsertOffs;Stores data set by SetInsertOffsets function. (margins to each widget)
Point<int> m_AnchorOffsets;Stores precalculated (depending on Anchor flags) offsets.
int m_iAnchorFix;Check CalculateAnchorFix() function.
Background* m_Background;
Represents the background of the widget.
SimpleButton<Background>* m_Button;
Represents the slider.
std::list<BindListIterator> m_Bindings;Stores additional internal bindings to the parent window.
Callback m_Callback;Stores callback function.
VScrollerThemem_Theme;
Stores widget theme.
AreaWidget* m_Area;
Stores pointer to the AreaWidget.
Point<int> m_iBtnSave;Helper variable that stores the initial position of the slider.
Point<int> m_DragData[3];Helper variables that represents the mouse click position while dragging slider.
std::list<ConnectedWidget> m_ConnectedWidgets;Stores connected objects/widgets.
int m_iContentHeight;Stores the actual height of the connected objects.
int m_iDisplayLine, m_iDisplayLineBackup;Represents the real position for first line to be drown. (based on m_iContentHeight)