Gorgon Game Engine
Progressor< T_, DIV_, VAL_, P_ > Class Template Reference

This widget displays a progress bar to track progress of an on going process. More...

Inheritance diagram for Progressor< T_, DIV_, VAL_, P_ >:
[legend]

Public Member Functions

 Progressor (const Progressor &)=delete
 
 Progressor (const UI::Template &temp, T_ cur, T_ max)
 
 Progressor (const UI::Template &temp, T_ cur=T_{})
 
 Progressor (T_ cur, T_ max, Registry::TemplateType type=Registry::Progress_Regular)
 
 Progressor (T_ cur=T_{}, Registry::TemplateType type=Registry::Progress_Regular)
 
void DisableSmoothChange ()
 Disables smooth change. More...
 
T_ GetMaximum () const
 Returns the current maximum value. More...
 
T_ GetSmoothChangeSpeed () const
 Returns the smooth change speed. More...
 
float GetSmoothChangeSpeedRatio () const
 Returns the smooth change in ratio to the maximum. More...
 
T_ GetValue () const
 Gets the current value of the slider. More...
 
bool IsSmoothChangeEnabled () const
 Returns if the smooth change is enabled. More...
 
void SetMaximum (const T_ &value)
 Sets the maximum value that this slider reaches up to. More...
 
void SetSmoothChangeSpeed (T_ value)
 Adjusts the smooth change speed. More...
 
void SetSmoothChangeSpeedRatio (float value)
 Adjusts the smooth change speed. More...
 
void SetValue (const T_ &value, bool instant=false)
 Sets the current value of the slider. More...
 
- Public Member Functions inherited from SliderBase< T_, FloatDivider< T_ >, FloatToValue< T_ >, Gorgon::NumericProperty, internal::SliderInteractivity::None, internal::SliderValueMapping::OneValue >
 SliderBase (const SliderBase &)=delete
 
 SliderBase (const UI::Template &temp, T_ cur, T_ max)
 
 SliderBase (const UI::Template &temp, T_ cur=T_{})
 
 SliderBase (T_ cur, T_ max, Registry::TemplateType type=Registry::Progress_Regular)
 
 SliderBase (T_ cur=T_{}, Registry::TemplateType type=Registry::Progress_Regular)
 
- Public Member Functions inherited from ComponentStackWidget
 ComponentStackWidget (ComponentStackWidget &&)=default
 
 ComponentStackWidget (const Template &temp, std::map< ComponentTemplate::Tag, std::function< Widget *(const Template &)>> generators={})
 
virtual ~ComponentStackWidget ()
 
virtual Geometry::Point GetLocation () const override
 Returns the location of the widget. More...
 
virtual Geometry::Size GetSize () const override
 Returns the size of the widget. More...
 
virtual bool IsEnabled () const override
 Returns whether the widget is enabled. More...
 
virtual void Move (const Geometry::Point &location) override
 Moves this widget to the given position. More...
 
virtual void Move (const Geometry::Point &location)=0
 Moves this widget to the given position. More...
 
void Move (int x, int y)
 Moves this widget to the given position. More...
 
virtual void Resize (const Geometry::Size &size) override
 Changes the size of the widget. More...
 
virtual void Resize (const Geometry::Size &size)=0
 Changes the size of the widget. More...
 
virtual void Resize (int w, int h)
 Changes the size of the widget. More...
 
virtual void SetEnabled (bool value) override
 Sets the enabled state of the widget. More...
 
- Public Member Functions inherited from Widget
 Widget ()
 
 Widget (Widget &&)=default
 
virtual ~Widget ()
 
bool AllowFocus () const
 If this widget can be focused currently. More...
 
virtual bool CharacterEvent (Char)
 This function should be called whenever a character is received from operating system. More...
 
bool Defocus ()
 Removes the focus from this widget if this widget is focused. More...
 
void Disable ()
 Disables the widget so that the user cannot interact with it. More...
 
virtual bool Done ()
 For widgets that supports it, this will trigger finalization the user interaction. More...
 
void Enable ()
 Enables the widget so that the user can interact with it. More...
 
bool EnsureVisible () const
 Ensures this widget is visible in its container by scrolling it into view. More...
 
bool Focus ()
 Transfers the focus to this widget. More...
 
Geometry::Bounds GetBounds () const
 Returns the bounds of the widget. More...
 
int GetHeight () const
 Returns the height of the widget. More...
 
WidgetContainerGetParent () const
 Returns the parent of this widget, throws if it does not have a parent. More...
 
int GetWidth () const
 Returns the width of the widget. More...
 
bool HasParent () const
 Returns if this widget has a parent. More...
 
void Hide ()
 Hides this widget, when hidden, widgets cannot gain focus. More...
 
bool IsFloating () const
 Returns floating status of this widget. More...
 
bool IsFocused () const
 Returns if this widget is focused. More...
 
bool IsVisible () const
 Returns if the widget is visible. More...
 
virtual bool KeyEvent (Input::Key, float)
 This function should be called whenever a key is pressed or released. More...
 
void Move (int x, int y)
 Moves this widget to the given position. More...
 
bool Remove ()
 Removes the widget from its parent. More...
 
virtual void Resize (int w, int h)
 Changes the size of the widget. More...
 
void SetHeight (int height)
 Sets the height of the widget. More...
 
virtual void SetIsFloating (bool value)
 Sets floating status of this widget. More...
 
void setname (std::string value)
 This is a debug feature. More...
 
void SetVisible (bool value)
 Changes the visibility of the widget. More...
 
void SetWidth (int width)
 Sets the width of the widget. More...
 
void Show ()
 Shows this widget, widgets are visible by default. More...
 
void ToggleEnabled ()
 Toggles enabled state of the widget. More...
 
void ToggleVisible ()
 Toggles the visibility state of the widget. More...
 
- Public Member Functions inherited from NumericProperty< UI::internal::prophelper< SliderBase< T_, DIV_, VAL_, Gorgon::NumericProperty, interactive, valuemapping >, T_ >, T_, &UI::internal::prophelper< SliderBase< T_, DIV_, VAL_, Gorgon::NumericProperty, interactive, valuemapping >, T_ >::get_, &UI::internal::prophelper< SliderBase< T_, DIV_, VAL_, Gorgon::NumericProperty, interactive, valuemapping >, T_ >::set_ >
 NumericProperty (NumericProperty &&)=default
 
 NumericProperty (UI::internal::prophelper< SliderBase< T_, DIV_, VAL_, Gorgon::NumericProperty, interactive, valuemapping >, T_ > &Object)
 
 NumericProperty (UI::internal::prophelper< SliderBase< T_, DIV_, VAL_, Gorgon::NumericProperty, interactive, valuemapping >, T_ > *Object)
 
T_ operator* (const T_ &v) const
 
T_ operator*= (const O_ &v)
 
T_ operator+ (const T_ &v) const
 
T_ operator++ ()
 
T_ operator++ (int)
 
T_ operator+= (const T_ &v)
 
T_ operator- (const T_ &v) const
 
T_ operator-- ()
 
T_ operator-- (int)
 
T_ operator-= (const T_ &v)
 
T_ operator/ (const T_ &v) const
 
T_ operator/= (const O_ &v)
 
bool operator< (const T_ &v) const
 
bool operator<= (const T_ &v) const
 
NumericPropertyoperator= (const NumericProperty &other)
 
NumericPropertyoperator= (const Property< AC_, O_, G_, S_ > &prop)
 
NumericPropertyoperator= (const T_ &value)
 
NumericPropertyoperator= (NumericProperty &&)=default
 
bool operator> (const T_ &v) const
 
bool operator>= (const T_ &v) const
 
- Public Member Functions inherited from Property< UI::internal::prophelper< SliderBase< T_, DIV_, VAL_, Gorgon::NumericProperty, interactive, valuemapping >, T_ >, T_, Getter_, Setter_ >
 Property (const Property &)=delete
 
 Property (Property &&)=default
 
 Property (UI::internal::prophelper< SliderBase< T_, DIV_, VAL_, Gorgon::NumericProperty, interactive, valuemapping >, T_ > &Object)
 
 Property (UI::internal::prophelper< SliderBase< T_, DIV_, VAL_, Gorgon::NumericProperty, interactive, valuemapping >, T_ > *Object)
 
T_ Get () const
 
 operator const T_ () const
 
 operator T_ ()
 
bool operator!= (const T_ &v) const
 
T_ operator* () const
 
Propertyoperator= (const O_ &value)
 
Propertyoperator= (const Property &)=delete
 
Propertyoperator= (const Property< AC_, T_, G_, S_ > &prop)
 
Propertyoperator= (const T_ &value)
 
Propertyoperator= (Property &&)=default
 
bool operator== (const T_ &v) const
 
void Set (const T_ &value)
 

Public Attributes

NumericProperty< SliderBase, T_, &SliderBase::GetMaximum, &SliderBase::SetMaximumMaximum
 This property controls the maximum value that the slider can have. More...
 
Event< Progressor, T_ > ValueChanged
 This event is fired when the scroll is changed. More...
 
- Public Attributes inherited from Widget
Event< WidgetBoundsChangedEvent
 This event will be fired when the area that the widget occupies on its container is changed. More...
 
std::string dbgname
 
Event< WidgetFocusEvent
 This event will be fired when the widget receives or looses focus. More...
 
Geometry::PointProperty< Widget, &Widget::getlocation, &Widget::move > Location
 
Geometry::SizeProperty< Widget, &Widget::getsize, &Widget::resize > Size
 

Protected Member Functions

virtual bool allowfocus () const override
 Should return true if the widget can be focused. More...
 
virtual void valuechanged (T_ value) override
 
- Protected Member Functions inherited from SliderBase< T_, FloatDivider< T_ >, FloatToValue< T_ >, Gorgon::NumericProperty, internal::SliderInteractivity::None, internal::SliderValueMapping::OneValue >
virtual bool Activate () override
 Activates the widget. More...
 
std::enable_if< vm==internal::SliderValueMapping::ValueAndRange, T_ >::type actualmax ()
 
std::enable_if< vm !=internal::SliderValueMapping::ValueAndRange, T_ >::type actualmax ()
 
virtual bool allowfocus () const override
 Should return true if the widget can be focused. More...
 
void DisableSmoothChange ()
 Disables smooth change. More...
 
T_ get () const
 Returns the value in the box. More...
 
T_ GetLargeChange () const
 Returns the amount of change on a large change action. More...
 
T_ GetMaximum () const
 Returns the current maximum value. More...
 
T_ GetMinimum () const
 Returns the current minimum value. More...
 
T_ GetRange () const
 Returns the range the container can display. More...
 
T_ GetSmallChange () const
 Returns the amount of change on a small change action. More...
 
T_ GetSmoothChangeSpeed () const
 Returns the smooth change speed. More...
 
float GetSmoothChangeSpeedRatio () const
 Returns the smooth change in ratio to the maximum. More...
 
T_ GetValue () const
 Gets the current value of the slider. More...
 
bool IsSmoothChangeEnabled () const
 Returns if the smooth change is enabled. More...
 
 operator T_ () const
 Returns the current value of the slider. More...
 
SliderBaseoperator= (T_ value)
 Sets the current value of the slider. More...
 
virtual void refreshvalue (bool instant=false)
 
void set (const T_ &val)
 Changes the value in the box. More...
 
void SetLargeChange (const T_ &value)
 Sets the amount of change on a large change action. More...
 
void SetLimits (T_ min, T_ max, bool exchange=true)
 Sets minimum and maximum limits. More...
 
void SetMaximum (const T_ &value)
 Sets the maximum value that this slider reaches up to. More...
 
void SetMinimum (const T_ &value)
 Sets the minimum value that this slider reaches up to. More...
 
void SetRange (const T_ &value)
 Sets the range the container can display. More...
 
void SetSmallChange (const T_ &value)
 Sets the amount of change on a small change action. More...
 
void SetSmoothChangeSpeed (T_ value)
 Adjusts the smooth change speed. More...
 
void SetSmoothChangeSpeedRatio (float value)
 Adjusts the smooth change speed. More...
 
bool setval (T_ val, bool instant=false)
 
void SetValue (const T_ &value, bool instant=false)
 Sets the current value of the slider. More...
 
- Protected Member Functions inherited from ComponentStackWidget
virtual void addto (Layer &layer) override
 When called, widget should locate itself on to this layer. More...
 
virtual void focused () override
 This is called after the focus is transferred to this widget. More...
 
virtual void focuslost () override
 This is called after the focus is lost. More...
 
virtual void parentenabledchanged (bool state) override
 This function is called when the parent's enabled state changes. More...
 
virtual void removed () override
 Called after this widget is removed from its parent. More...
 
virtual void removefrom (Layer &layer) override
 When called, widget should remove itself from the given layer. More...
 
virtual void setlayerorder (Layer &, int order) override
 When called, widget should reorder itself in layer hierarchy. More...
 
- Protected Member Functions inherited from Widget
virtual void addedto (WidgetContainer &container)
 Called when this widget added to the given container. More...
 
virtual bool addingto (WidgetContainer &)
 Called when it is about to be added to the given container. More...
 
virtual void boundschanged ()
 Call this function when the widget bounds is changed. More...
 
virtual bool canloosefocus () const
 Should return true if the widget can loose the focus right now. More...
 
virtual void displaced ()
 Call this function when the widget container causes it to be displaced. More...
 
virtual bool removingfrom ()
 Called before this widget is removed from its parent. More...
 

Additional Inherited Members

- Public Types inherited from SliderBase< T_, FloatDivider< T_ >, FloatToValue< T_ >, Gorgon::NumericProperty, internal::SliderInteractivity::None, internal::SliderValueMapping::OneValue >
using PropType = Gorgon::NumericProperty< UI::internal::prophelper< SliderBase< T_, DIV_, VAL_, Gorgon::NumericProperty, interactive, valuemapping >, T_ >, T_, &UI::internal::prophelper< SliderBase< T_, DIV_, VAL_, Gorgon::NumericProperty, interactive, valuemapping >, T_ >::get_, &UI::internal::prophelper< SliderBase< T_, DIV_, VAL_, Gorgon::NumericProperty, interactive, valuemapping >, T_ >::set_ >
 
using Type = T_
 
- Public Types inherited from NumericProperty< UI::internal::prophelper< SliderBase< T_, DIV_, VAL_, Gorgon::NumericProperty, interactive, valuemapping >, T_ >, T_, &UI::internal::prophelper< SliderBase< T_, DIV_, VAL_, Gorgon::NumericProperty, interactive, valuemapping >, T_ >::get_, &UI::internal::prophelper< SliderBase< T_, DIV_, VAL_, Gorgon::NumericProperty, interactive, valuemapping >, T_ >::set_ >
using Type = T_
 
- Public Types inherited from Property< UI::internal::prophelper< SliderBase< T_, DIV_, VAL_, Gorgon::NumericProperty, interactive, valuemapping >, T_ >, T_, Getter_, Setter_ >
using Type = T_
 
- Protected Attributes inherited from SliderBase< T_, FloatDivider< T_ >, FloatToValue< T_ >, Gorgon::NumericProperty, internal::SliderInteractivity::None, internal::SliderValueMapping::OneValue >
float changespeed
 
Geometry::Point downlocation
 
float downvalue
 
internal::SliderInteractivity grab
 
NumericProperty< SliderBase, T_, &SliderBase::GetLargeChange, &SliderBase::SetLargeChange > LargeChange
 Controls the amount of change on a large change action. More...
 
T_ largechange
 
T_ max
 
NumericProperty< SliderBase, T_, &SliderBase::GetMaximum, &SliderBase::SetMaximum > Maximum
 This property controls the maximum value that the slider can have. More...
 
T_ min
 
NumericProperty< SliderBase, T_, &SliderBase::GetMinimum, &SliderBase::SetMinimum > Minimum
 This property controls the minimum value that the slider can have. More...
 
NumericProperty< SliderBase, T_, &SliderBase::GetRange, &SliderBase::SetRange > Range
 This is used to show how much more the scroller can be scrolled. More...
 
T_ range
 
NumericProperty< SliderBase, T_, &SliderBase::GetSmallChange, &SliderBase::SetSmallChange > SmallChange
 Controls the amount of change on a small change action. More...
 
T_ smallchange
 
T_ value
 
- Protected Attributes inherited from ComponentStackWidget
bool enabled
 
bool parentenabled
 
ComponentStackstack
 
- Protected Attributes inherited from Property< UI::internal::prophelper< SliderBase< T_, DIV_, VAL_, Gorgon::NumericProperty, interactive, valuemapping >, T_ >, T_, Getter_, Setter_ >
UI::internal::prophelper< SliderBase< T_, DIV_, VAL_, Gorgon::NumericProperty, interactive, valuemapping >, T_ > & Object
 

Detailed Description

template<class T_, float(*)(T_, T_, T_) DIV_ = FloatDivider<T_>, T_(*)(float, T_, T_) VAL_ = FloatToValue<T_>, template< class C_, class PT_, PT_(C_::*Getter_)() const, void(C_::*Setter_)(const PT_ &)> class P_ = Gorgon::NumericProperty>
class Gorgon::Widgets::Progressor< T_, DIV_, VAL_, P_ >

This widget displays a progress bar to track progress of an on going process.

For regular integer based progressor use Progressbar. This is the base widget that can be used with any type, including types that are not inherintly numeric. The completion is calculated using DIV_ function which takes current, minimum and maximum values and should return the progress between 0 and 1. Property type should be adjusted if numeric operators does not exist for the given type.

If the type is numeric, using NumericProperty will allow you to use the widget as a regular numeric variable with operators like =, +=, ++, –.

Constructor & Destructor Documentation

◆ Progressor() [1/5]

Progressor ( const Progressor< T_, DIV_, VAL_, P_ > &  )
delete

◆ Progressor() [2/5]

Progressor ( T_  cur,
T_  max,
Registry::TemplateType  type = Registry::Progress_Regular 
)
explicit

◆ Progressor() [3/5]

Progressor ( T_  cur = T_{},
Registry::TemplateType  type = Registry::Progress_Regular 
)
explicit

◆ Progressor() [4/5]

Progressor ( const UI::Template temp,
T_  cur = T_{} 
)
explicit

◆ Progressor() [5/5]

Progressor ( const UI::Template temp,
T_  cur,
T_  max 
)

Member Function Documentation

◆ allowfocus()

virtual bool allowfocus ( ) const
overrideprotectedvirtual

Should return true if the widget can be focused.

Reimplemented from Widget.

◆ DisableSmoothChange()

void DisableSmoothChange

Disables smooth change.

◆ GetMaximum()

T_ GetMaximum

Returns the current maximum value.

◆ GetSmoothChangeSpeed()

T_ GetSmoothChangeSpeed

Returns the smooth change speed.

If smooth change is disabled, this value will be 0.

◆ GetSmoothChangeSpeedRatio()

float GetSmoothChangeSpeedRatio

Returns the smooth change in ratio to the maximum.

1 means full progress will be done in 1 second.

◆ GetValue()

T_ GetValue

Gets the current value of the slider.

◆ IsSmoothChangeEnabled()

bool IsSmoothChangeEnabled

Returns if the smooth change is enabled.

◆ SetMaximum()

void SetMaximum

Sets the maximum value that this slider reaches up to.

If equal to minimum, progress will display 0.

◆ SetSmoothChangeSpeed()

void SetSmoothChangeSpeed

Adjusts the smooth change speed.

Given value is in values per second, default value is max and will be sync to the maximum value.

◆ SetSmoothChangeSpeedRatio()

void SetSmoothChangeSpeedRatio

Adjusts the smooth change speed.

Given value is in values per second, default value is 1 and will be sync to the maximum value.

◆ SetValue()

void SetValue

Sets the current value of the slider.

If instant is set to true, the value will be set instantly without any animations.

◆ valuechanged()

Member Data Documentation

◆ Maximum

This property controls the maximum value that the slider can have.

◆ ValueChanged

Event<Progressor, T_> ValueChanged

This event is fired when the scroll is changed.


The documentation for this class was generated from the following file: