StatusIndicatorView¶
- class
Indicate a boolean status, true/false, on/off or red/green.
The status indicator displays a circular LED like widget, that is red and green by default. (Green is true, red is false)
You use the method setState to change the current state of the indicator. This you change the state, the view automatically repaints itself on the screen.
Example
// Initialize the view (you should make it a class member) mono::ui::StatusIndicatorView indicate(mono::geo::Rect(10,10,20,20), false); // Change the default off color from red to to white indicator.setOnStateColor(mono::display::WhiteColor); // set the state to be On indicator.setState(true); // make the view visible indicator.show();
Public Functions
-
StatusIndicatorView::
StatusIndicatorView
()¶ contruct a StatusIndicator with default parameters
this view will be initialized in an empty viewRect, that is (0,0,0,0)
-
StatusIndicatorView::
StatusIndicatorView
(geo::Rect vRct)¶ Construct a Indicator and provide a View rect.
This create a view rect the exists in the provided Rect and has the default state
false
Note: You need to call show before the view can be rendered
- Parameters
vRct
-The bounding view rectangle, where the indicator is displayed
-
StatusIndicatorView::
StatusIndicatorView
(geo::Rect vRct, bool status)¶ Construct a Indicator and provide a View rect and a initial state.
This create a view rect the exists in the provided Rect
Note: You need to call show before the view can be rendered
- Parameters
vRct
-The bounding view rectangle, where the indicator is displayed
status
-The initial state of the indicator
-
void
StatusIndicatorView::
setOnStateColor
(display::Color col)¶ Sets the on state color.
If you change the color, you must call scheduleRepaint to make the change have effect.
- Parameters
col
-The color of the indicator when it is on
-
void
StatusIndicatorView::
setOffStateColor
(display::Color col)¶ Sets the off state color.
MARK: SETTERS.
If you change the color, you must call scheduleRepaint to make the change have effect.
- Parameters
col
-The color of the indicator when it is off
-
void
StatusIndicatorView::
setState
(bool newState)¶ Sets a new on/off state.
Note that the view repaints itself if the new state differs from the old.
- Parameters
newState
-The value of the new state (
true
is on)
-
bool
StatusIndicatorView::
State
()¶
const Gets the state of the indicator.
MARK: GETTERS.
- Return
true
if the state if on,false
otherwise.
Protected Functions
-
void
StatusIndicatorView::
initializer
()¶ MARK: Constructors.
-
virtual void
StatusIndicatorView::
repaint
()¶ Repaint the view content, using the View::painter.
Re-paint the view content. This method should be called when the view content has changed. You can call this method directly, but it might cause graphics artifacts because the display is not double buffered. Instead you should schedule a repaint by calling the scheduleRepaint() method. This method will schedule the repaint, right after the next display update.
The display system will not schedule any repaints automatically. The view does not contain any state information, so you or other classes utilizing view must schedule repaints.
In subclasses of View, this method must be overwritten.
-