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

A model that holds an integer value that can be incremented or decremented within a defined range. More...

#include <rtos_ui_core.h>

Collaboration diagram for core_IncrementControlledModel:
Collaboration graph

Public Member Functions

 core_IncrementControlledModel (int min_value=0, int max_value=10, bool is_wrappable=false, int increment=1)
 Construct a new UIControlledIncrementalValue object.
 
virtual bool increment_value ()
 Increment the current value by the increment amount.
 
virtual bool decrement_value ()
 Decrement the current value by the increment amount.
 
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 current value.
 
int get_min_value ()
 Get the min value object.
 
int get_max_value ()
 Get the max value object.
 

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.
 

Detailed Description

A model that holds an integer value that can be incremented or decremented within a defined range.

Constructor & Destructor Documentation

◆ core_IncrementControlledModel()

core_IncrementControlledModel::core_IncrementControlledModel ( 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.

Member Function Documentation

◆ decrement_value()

bool core_IncrementControlledModel::decrement_value ( )
virtual

Decrement the current value by the increment amount.

Returns
true if value changed, false if clipped and no change

◆ get_max_value()

int core_IncrementControlledModel::get_max_value ( )

Get the max value object.

Returns
int

◆ get_min_value()

int core_IncrementControlledModel::get_min_value ( )

Get the min value object.

Returns
int

◆ get_value()

int core_IncrementControlledModel::get_value ( )

Get the current value.

Returns
The current value

◆ increment_value()

bool core_IncrementControlledModel::increment_value ( )
virtual

Increment the current value by the increment amount.

Returns
true if value changed, false if clipped and no change

◆ set_clipped_value()

bool core_IncrementControlledModel::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 value changed, false if clipped and no change

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