StatusIndicatorView

class mono::ui::StatusIndicatorView

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();

Inherits from mono::ui::View

Public Functions

StatusIndicatorView()

contruct a StatusIndicator with default parameters

this view will be initialized in an empty viewRect, that is (0,0,0,0)

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(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 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 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 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 State() const

Gets the state of the indicator.

MARK: GETTERS.

Return
trueif the state if on, false otherwise.

Protected Functions

void initializer()

MARK: Constructors.

void repaint()

MARK: Auxilliaries.