Gorgon Game Engine
SliderBase< T_, DIV_, VAL_, P_, interactive, valuemapping > Class Template Referenceabstract

This is an internal basis for slider. More...

Inheritance diagram for SliderBase< T_, DIV_, VAL_, P_, interactive, valuemapping >:
[legend]

Public Types

using PropType = P_< UI::internal::prophelper< SliderBase< T_, DIV_, VAL_, P_, interactive, valuemapping >, T_ >, T_, &UI::internal::prophelper< SliderBase< T_, DIV_, VAL_, P_, interactive, valuemapping >, T_ >::get_, &UI::internal::prophelper< SliderBase< T_, DIV_, VAL_, P_, interactive, valuemapping >, T_ >::set_ >
 
using Type = T_
 
- Public Types inherited from NumericProperty< UI::internal::prophelper< SliderBase< int, FloatDivider< int >, FloatToValue< int >, Gorgon::NumericProperty, internal::SliderInteractivity::None, internal::SliderValueMapping::OneValue >, int >, int, &UI::internal::prophelper< SliderBase< int, FloatDivider< int >, FloatToValue< int >, Gorgon::NumericProperty, internal::SliderInteractivity::None, internal::SliderValueMapping::OneValue >, int >::get_, &UI::internal::prophelper< SliderBase< int, FloatDivider< int >, FloatToValue< int >, Gorgon::NumericProperty, internal::SliderInteractivity::None, internal::SliderValueMapping::OneValue >, int >::set_ >
using Type = int
 
- Public Types inherited from Property< UI::internal::prophelper< SliderBase< int, FloatDivider< int >, FloatToValue< int >, Gorgon::NumericProperty, internal::SliderInteractivity::None, internal::SliderValueMapping::OneValue >, int >, int, Getter_, Setter_ >
using Type = int
 

Public Member Functions

 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< int, FloatDivider< int >, FloatToValue< int >, Gorgon::NumericProperty, internal::SliderInteractivity::None, internal::SliderValueMapping::OneValue >, int >, int, &UI::internal::prophelper< SliderBase< int, FloatDivider< int >, FloatToValue< int >, Gorgon::NumericProperty, internal::SliderInteractivity::None, internal::SliderValueMapping::OneValue >, int >::get_, &UI::internal::prophelper< SliderBase< int, FloatDivider< int >, FloatToValue< int >, Gorgon::NumericProperty, internal::SliderInteractivity::None, internal::SliderValueMapping::OneValue >, int >::set_ >
 NumericProperty (NumericProperty &&)=default
 
 NumericProperty (UI::internal::prophelper< SliderBase< int, FloatDivider< int >, FloatToValue< int >, Gorgon::NumericProperty, internal::SliderInteractivity::None, internal::SliderValueMapping::OneValue >, int > &Object)
 
 NumericProperty (UI::internal::prophelper< SliderBase< int, FloatDivider< int >, FloatToValue< int >, Gorgon::NumericProperty, internal::SliderInteractivity::None, internal::SliderValueMapping::OneValue >, int > *Object)
 
int operator* (const int &v) const
 
int operator*= (const O_ &v)
 
int operator+ (const int &v) const
 
int operator++ ()
 
int operator++ (int)
 
int operator+= (const int &v)
 
int operator- (const int &v) const
 
int operator-- ()
 
int operator-- (int)
 
int operator-= (const int &v)
 
int operator/ (const int &v) const
 
int operator/= (const O_ &v)
 
bool operator< (const int &v) const
 
bool operator<= (const int &v) const
 
NumericPropertyoperator= (const int &value)
 
NumericPropertyoperator= (const NumericProperty &other)
 
NumericPropertyoperator= (const Property< AC_, O_, G_, S_ > &prop)
 
NumericPropertyoperator= (NumericProperty &&)=default
 
bool operator> (const int &v) const
 
bool operator>= (const int &v) const
 
- Public Member Functions inherited from Property< UI::internal::prophelper< SliderBase< int, FloatDivider< int >, FloatToValue< int >, Gorgon::NumericProperty, internal::SliderInteractivity::None, internal::SliderValueMapping::OneValue >, int >, int, Getter_, Setter_ >
 Property (const Property &)=delete
 
 Property (Property &&)=default
 
 Property (UI::internal::prophelper< SliderBase< int, FloatDivider< int >, FloatToValue< int >, Gorgon::NumericProperty, internal::SliderInteractivity::None, internal::SliderValueMapping::OneValue >, int > &Object)
 
 Property (UI::internal::prophelper< SliderBase< int, FloatDivider< int >, FloatToValue< int >, Gorgon::NumericProperty, internal::SliderInteractivity::None, internal::SliderValueMapping::OneValue >, int > *Object)
 
int Get () const
 
 operator const int () const
 
 operator int ()
 
bool operator!= (const int &v) const
 
int operator* () const
 
Propertyoperator= (const int &value)
 
Propertyoperator= (const O_ &value)
 
Propertyoperator= (const Property &)=delete
 
Propertyoperator= (const Property< AC_, int, G_, S_ > &prop)
 
Propertyoperator= (Property &&)=default
 
bool operator== (const int &v) const
 
void Set (const int &value)
 

Protected Member Functions

virtual bool Activate () override
 Activates the widget. More...
 
template<internal::SliderValueMapping vm = valuemapping>
std::enable_if< vm==internal::SliderValueMapping::ValueAndRange, T_ >::type actualmax ()
 
template<internal::SliderValueMapping vm = valuemapping>
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...
 
virtual void valuechanged (T_)=0
 
- 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...
 

Protected Attributes

float changespeed
 
Geometry::Point downlocation
 
float downvalue
 
internal::SliderInteractivity grab
 
NumericProperty< SliderBase, T_, &SliderBase::GetLargeChange, &SliderBase::SetLargeChangeLargeChange
 Controls the amount of change on a large change action. More...
 
T_ largechange
 
T_ max
 
NumericProperty< SliderBase, T_, &SliderBase::GetMaximum, &SliderBase::SetMaximumMaximum
 This property controls the maximum value that the slider can have. More...
 
T_ min
 
NumericProperty< SliderBase, T_, &SliderBase::GetMinimum, &SliderBase::SetMinimumMinimum
 This property controls the minimum value that the slider can have. More...
 
NumericProperty< SliderBase, T_, &SliderBase::GetRange, &SliderBase::SetRangeRange
 This is used to show how much more the scroller can be scrolled. More...
 
T_ range
 
NumericProperty< SliderBase, T_, &SliderBase::GetSmallChange, &SliderBase::SetSmallChangeSmallChange
 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< int, FloatDivider< int >, FloatToValue< int >, Gorgon::NumericProperty, internal::SliderInteractivity::None, internal::SliderValueMapping::OneValue >, int >, int, Getter_, Setter_ >
UI::internal::prophelper< SliderBase< int, FloatDivider< int >, FloatToValue< int >, Gorgon::NumericProperty, internal::SliderInteractivity::None, internal::SliderValueMapping::OneValue >, int > & Object
 

Additional Inherited Members

- 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
 

Detailed Description

template<class T_ = int, 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, internal::SliderInteractivity interactive = internal::SliderInteractivity::None, internal::SliderValueMapping valuemapping = internal::SliderValueMapping::OneValue>
class Gorgon::Widgets::SliderBase< T_, DIV_, VAL_, P_, interactive, valuemapping >

This is an internal basis for slider.

It is not very useful by its own as many of its functions are protected. It is used as a base for Slider, Progressbar (not yet), and Scrollbar widgets.

Member Typedef Documentation

◆ PropType

using PropType = P_< UI::internal::prophelper<SliderBase<T_, DIV_, VAL_, P_, interactive, valuemapping>, T_>, T_, &UI::internal::prophelper<SliderBase<T_, DIV_, VAL_, P_, interactive, valuemapping>, T_>::get_, &UI::internal::prophelper<SliderBase<T_, DIV_, VAL_, P_, interactive, valuemapping>, T_>::set_ >

◆ Type

using Type = T_

Constructor & Destructor Documentation

◆ SliderBase() [1/5]

SliderBase ( const SliderBase< T_, DIV_, VAL_, P_, interactive, valuemapping > &  )
delete

◆ SliderBase() [2/5]

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

◆ SliderBase() [3/5]

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

◆ SliderBase() [4/5]

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

◆ SliderBase() [5/5]

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

Member Function Documentation

◆ Activate()

virtual bool Activate ( )
overrideprotectedvirtual

Activates the widget.

This might perform the action if the widget is a button, forward the focus if it is a label or focus if it is an input field.

Implements Widget.

◆ actualmax() [1/2]

std::enable_if<vm == internal::SliderValueMapping::ValueAndRange, T_>::type actualmax ( )
protected

◆ actualmax() [2/2]

std::enable_if<vm != internal::SliderValueMapping::ValueAndRange, T_>::type actualmax ( )
protected

◆ allowfocus()

virtual bool allowfocus ( ) const
overrideprotectedvirtual

Should return true if the widget can be focused.

Reimplemented from Widget.

◆ DisableSmoothChange()

void DisableSmoothChange ( )
protected

Disables smooth change.

◆ get()

T_ get ( ) const
protected

Returns the value in the box.

◆ GetLargeChange()

T_ GetLargeChange ( ) const
protected

Returns the amount of change on a large change action.

This action could be click of arrow buttons, keyboard keys or mouse scroll.

◆ GetMaximum()

T_ GetMaximum ( ) const
protected

Returns the current maximum value.

◆ GetMinimum()

T_ GetMinimum ( ) const
protected

Returns the current minimum value.

◆ GetRange()

T_ GetRange ( ) const
protected

Returns the range the container can display.

This is used to show how much more the scroller can be scrolled.

◆ GetSmallChange()

T_ GetSmallChange ( ) const
protected

Returns the amount of change on a small change action.

This action could be click of bar or keyboard keys (page up/down)

◆ GetSmoothChangeSpeed()

T_ GetSmoothChangeSpeed ( ) const
protected

Returns the smooth change speed.

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

◆ GetSmoothChangeSpeedRatio()

float GetSmoothChangeSpeedRatio ( ) const
protected

Returns the smooth change in ratio to the maximum.

1 means full progress will be done in 1 second.

◆ GetValue()

T_ GetValue ( ) const
protected

Gets the current value of the slider.

◆ IsSmoothChangeEnabled()

bool IsSmoothChangeEnabled ( ) const
protected

Returns if the smooth change is enabled.

◆ operator T_()

operator T_ ( ) const
protected

Returns the current value of the slider.

◆ operator=()

SliderBase& operator= ( T_  value)
protected

Sets the current value of the slider.

◆ refreshvalue()

virtual void refreshvalue ( bool  instant = false)
protectedvirtual

◆ set()

void set ( const T_ &  val)
protected

Changes the value in the box.

◆ SetLargeChange()

void SetLargeChange ( const T_ &  value)
protected

Sets the amount of change on a large change action.

This action could be click of bar or keyboard keys (page up/down).

◆ SetLimits()

void SetLimits ( T_  min,
T_  max,
bool  exchange = true 
)
protected

Sets minimum and maximum limits.

If minimum is equal to maximum, progress will display 0. SliderBase will always keep the value between minimum and maximum. If maximum is less than minimum, this function will automatically exchange these values if exchange is set. If exchange is not set, they will both be set to T_{}, effectively locking progress at 0. Do not use this function if your type is not a regular numeric type

◆ SetMaximum()

void SetMaximum ( const T_ &  value)
protected

Sets the maximum value that this slider reaches up to.

If equal to minimum, progress will display 0.

◆ SetMinimum()

void SetMinimum ( const T_ &  value)
protected

Sets the minimum value that this slider reaches up to.

If equal to maximum, progress will display 0.

◆ SetRange()

void SetRange ( const T_ &  value)
protected

Sets the range the container can display.

This is used to show how much more the scroller can be scrolled.

◆ SetSmallChange()

void SetSmallChange ( const T_ &  value)
protected

Sets the amount of change on a small change action.

This action could be click of arrow buttons, keyboard keys or mouse scroll.

◆ SetSmoothChangeSpeed()

void SetSmoothChangeSpeed ( T_  value)
protected

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 ( float  value)
protected

Adjusts the smooth change speed.

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

◆ setval()

bool setval ( T_  val,
bool  instant = false 
)
protected

◆ SetValue()

void SetValue ( const T_ &  value,
bool  instant = false 
)
protected

Sets the current value of the slider.

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

◆ valuechanged()

virtual void valuechanged ( T_  )
protectedpure virtual

Member Data Documentation

◆ changespeed

float changespeed
protected

◆ downlocation

Geometry::Point downlocation
protected

◆ downvalue

float downvalue
protected

◆ grab

internal::SliderInteractivity grab
protected

◆ LargeChange

Controls the amount of change on a large change action.

This action could be click of bar or keyboard keys (page up/down).

◆ largechange

T_ largechange
protected

◆ max

T_ max
protected

◆ Maximum

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

◆ min

T_ min
protected

◆ Minimum

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

◆ Range

This is used to show how much more the scroller can be scrolled.

◆ range

T_ range
protected

◆ SmallChange

Controls the amount of change on a small change action.

This action could be click of arrow buttons, keyboard keys or mouse scroll.

◆ smallchange

T_ smallchange
protected

◆ value

T_ value
protected

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