Reference for the Mosaic class WidgetSet::VerticalValueBar
This class implements a 'vertical value bar' (bar gauge) instrument intended to display a value as a needle that moves vertically along a track. The areas below and above the needle can appear as filled bars. The position of the needle corresponds to the value specified in the property CurrentValue, which lies in range determined by the properties MinValue and MaxValue.
Alternatively the property Outlet can refer to any other 'int32' property the widget should remain synchronized with. When the referred property is modified by another one, the widget is automatically notified to remain in sync with the property.
This approach follows the Model-View-Controller (MVC) programming paradigm. Here the value bar widget represents the 'View' and the property referred via 'Outlet' can be seen as a part of the 'Model'.
The exact look and feel of the value bar widget is determined by the 'Vertical Value Bar Configuration' object assigned to the property Appearance. The configuration object provides bitmaps, colors and other configuration parameters needed to construct and display the value bar widget. Usually, you will manage in your project your own configuration objects and customize the value bar widgets according to your design expectations. Depending on the information provided in the associated configuration object, the value bar widget will be composed of following views:
The value bar widget implements a 'swing' animation effect to move the needle smoothly. You can configure the duration and the timing of this effect in the configuration object. Value bar widgets are not intended to be controlled by the user. The widget ignores all touch and keyboard events and it can't be focused.
The value bar widget provides an additional set of methods useful to query the actual position of the needle and its possible movement range (GetNeedleMaxPosition(), GetNeedleMinPosition(), GetNeedlePosition()). These methods can be invoked from a slot method assigned to the property OnUpdate. In this manner you can automatically arrange and updated additional decoration according to the actual state of the value bar widget. For example, you can arrange a Views::Text view to follow the needle and to display the actual value of the widget (CurrentValue).
For more details regarding the customization of the value bar widget see the description of WidgetSet::VerticalValueBarConfig class.
property WidgetSet::VerticalValueBarConfig Appearance = null;
The property 'Appearance' refers to a 'Vertical Value Bar Config' object containing bitmaps, colors and further configuration attributes to customize this widget. By assigning a configuration object to the property 'Appearance', the widget automatically assumes the look and feel as determined in the properties of the configuration object.
If there is no configuration object associated to the widget (the property 'Appearance' is 'null') the widget appears empty (transparent).
Please note, configuration objects can be shared among multiple value bar widgets. When the properties of the configuration object change, all value bar widgets (connected actually to it) are notified and updated to assume the new appearance.
property int32 CurrentValue = 50;
The property 'CurrentValue' stores the momentary value of the widget. This value corresponds to the vertical position of the needle (or the height of the displayed bars) and it is limited to be always within the range specified in the properties MinValue and MaxValue.
method point GetNeedleMaxPosition();
The method GetNeedleMaxPosition() returns the topmost possible position of the needle center (upper end of the needle movement range). The position is expressed in pixel relative to the top-left corner of the Owner component this value bar widget belongs to. Knowing this position you can simply arrange other views as decoration for the widget. See also the property OnUpdate.
method point GetNeedleMinPosition();
The method GetNeedleMinPosition() returns the bottommost possible position of the needle center (lower end of the needle movement range). The position is expressed in pixel relative to the top-left corner of the Owner component this value bar widget belongs to. Knowing this position you can simply arrange other views as decoration for the widget. See also the property OnUpdate.
method point GetNeedlePosition();
The method GetNeedlePosition() returns the actual position of the needle center expressed in pixel relative to the top-left corner of the Owner component this value bar widget belongs to. Knowing this position you can simply arrange other views as decoration for the widget. See also the property OnUpdate.
property int32 MaxValue = 100;
The property 'MaxValue' determines the boundary for CurrentValue when the needle is moved to the top edge of the widget. 'MaxValue' together with MinValue limit the range for CurrentValue.
property int32 MinValue = 0;
The property 'MinValue' determines the boundary for CurrentValue when the needle is moved to the bottom edge of the widget. 'MinValue' together with MaxValue limit the range for CurrentValue.
property slot OnUpdate = null;
The property 'OnUpdate' can refer to a slot method, which should be invoked by the widget when its CurrentValue or Bounds changes (more generally, when the needle moves). This method is intended to update decorations associated to this value bar widget.
From the implementation of the slot method you can invoke the methods GetNeedlePosition(), GetNeedleMinPosition() and GetNeedleMaxPosition() to get the diverse positions of the needle.
property ^int32 Outlet = null;
The property 'Outlet' can refer to any other 'int32' property the widget should remain synchronized with. When the referred property is modified, the widget is automatically notified to remain in sync with the property (the property CurrentValue is updated to the value of the property referred in Outlet).
This approach follows the Model-View-Controller (MVC) programming paradigm. Here the value bar widget represents the 'View' and the property referred via 'Outlet' can be seen as a part of the 'Model'.