C++ DevKit
C++ set of OOP library
Loading...
Searching...
No Matches
UIControlledIncrementalValue Class Reference

The UIControlledIncrementalValue is a kind of Model that have special feature such as a value that can be incremented or decremented. This value runs between a min_value and a max_value. More...

#include <ui_core.h>

Inheritance diagram for UIControlledIncrementalValue:
Inheritance graph
Collaboration diagram for UIControlledIncrementalValue:
Collaboration graph

Public Member Functions

 UIControlledIncrementalValue (int min_value=0, int max_value=10, bool is_wrappable=false, int increment=1)
 Construct a new UIControlledIncrementalValue object.
 
 ~UIControlledIncrementalValue ()
 Destroy the UIControlledIncrementalValue object.
 
virtual bool increment_value ()
 Add "increment" to the current value.
 
virtual bool decrement_value ()
 Substract "increment" to the current value.
 
bool set_clipped_value (int _new_value)
 Set value to _new_value, and clip the result to min or max value if needed.
 
int get_value ()
 Get the value object.
 
int get_min_value ()
 Get the min value object.
 
int get_max_value ()
 Get the max value object.
 
- Public Member Functions inherited from UIControlledModel
bool update_status (ControlledObjectStatus _new_status)
 update the status of the model object.
 
void update_current_controller (UIController *_new_controller)
 if _new_controller is different from the current controller, change the current controller associated to the Model. the new controller has is member current_controlled_model also changed.
 
ControlledObjectStatus get_status ()
 Get the status object.
 
UIControllerget_current_controller ()
 Get the current controller object.
 
virtual void process_control_event (struct_ControlEventData control_event)=0
 pure virtual function that process a control event
 
- Public Member Functions inherited from Model
 Model ()
 Construct the Model object.
 
 ~Model ()
 Destroy the Model object.
 
void update_attached_widgets (Widget *new_widget)
 add a new widget to the set of attached_widgets
 
int get_number_of_attached_widget ()
 get the number of attached widgets
 
bool has_changed ()
 get the change flag status
 
void set_change_flag ()
 Set the change flag object to true.
 
void draw_widget_done ()
 Set the change flag object to false.
 
uint32_t get_time_since_last_change ()
 compute time since the last status change
 
virtual void draw_refresh_all_attached_widgets ()
 update drawing for each attached widgets
 

Protected Attributes

int value
 The internal value incremented or decremented by action on the controller.
 
int max_value
 The maximum value that can be reached. Can be either negative or positive.
 
int min_value
 The minimum value that can be reached. Can be either negative or positive.
 
int increment
 The number that is added or substracted to the current value. Default to 1.
 
bool is_wrappable
 If true, once the max (resp. min) value is reached, the next one wraps to min (resp*; max) value. If false values are clipped on min and max values.
 
- Protected Attributes inherited from Model
std::set< Widget * > attached_widgets
 the set of widgets that are in charge of viewing this model.
 

Detailed Description

The UIControlledIncrementalValue is a kind of Model that have special feature such as a value that can be incremented or decremented. This value runs between a min_value and a max_value.

The increment value is configurable. A is_wrappable flag indicates how the value behaves once min or max values are reached.

Constructor & Destructor Documentation

◆ UIControlledIncrementalValue()

UIControlledIncrementalValue::UIControlledIncrementalValue ( int min_value = 0,
int max_value = 10,
bool is_wrappable = false,
int increment = 1 )

Construct a new UIControlledIncrementalValue object.

Parameters
min_valueThe minimum value that can be reached. Can be either negative or positive.
max_valueThe maximum value that can be reached. Can be either negative or positive.
is_wrappableIf true, once the max (resp. min) value is reached, the next one wraps to min (resp*; max) value. If false values are clipped on min and max values.
incrementThe number that is added or substracted to the current value. Default to 1.
Here is the caller graph for this function:

Member Function Documentation

◆ decrement_value()

bool UIControlledIncrementalValue::decrement_value ( )
virtual

Substract "increment" to the current value.

Returns
true if the value was changed
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_max_value()

int UIControlledIncrementalValue::get_max_value ( )

Get the max value object.

Returns
int

◆ get_min_value()

int UIControlledIncrementalValue::get_min_value ( )

Get the min value object.

Returns
int

◆ get_value()

int UIControlledIncrementalValue::get_value ( )

Get the value object.

Returns
int

◆ increment_value()

bool UIControlledIncrementalValue::increment_value ( )
virtual

Add "increment" to the current value.

Returns
true if the value was changed
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_clipped_value()

bool UIControlledIncrementalValue::set_clipped_value ( int _new_value)

Set value to _new_value, and clip the result to min or max value if needed.

Parameters
_new_value
Returns
true if the value was changed
Here is the call graph for this function:

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