Iridescence 1.00
Embedded Graphic Framework
Loading...
Searching...
No Matches
DsGaugeBattery Class Reference

DsGaugeBattery is a class that implements a battery style gauge. More...

#include <ds_gauge_battery.h>

Inheritance diagram for DsGaugeBattery:
[legend]

Public Types

enum  Style : uint32_t {
  STYLE_DEFAULT = 0 ,
  STYLE_AUTOMOTIVE = (1 << 0)
}
 Battery gauge style. More...
 

Public Member Functions

 DsGaugeBattery (DsView *parent, const DsPoint &pos, const DsSize &size, uint32_t style=STYLE_DEFAULT)
 Creates a DsGaugeBattery object.
 
DsGaugeBatterysetTerminalSize (const DsSize &size)
 Sets the size of the battery terminal.
 
DsGaugeBatterysetFillMargin (uint8_t margin)
 Sets the battery fill area margin.
 
DsGaugeBatterysetCornerRadius (uint16_t radius)
 Sets the corner radius.
 
DsGaugeBatterysetSecondaryTextColor (DsColor color)
 Sets the secondary value text color.
 
DsGaugeBatterysetSecondaryTextFont (const ds_bitmap_font_t *font)
 Sets the font used to render the secondary value.
 
DsGaugeBatterysetSecondaryFormat (const char *format)
 Sets the printf() style format string used to print the secondary value.
 
DsGaugeBatterysetSecondaryValue (float value)
 Sets the secondary value.
 
- Public Member Functions inherited from DsView
 DsView (DsView *parent, const DsPoint &pos=DsPoint(), const DsSize &size=DsSize())
 Creates a DsView with an optional position and size.
 
 DsView (DsView *parent, DsOrientation layout_orientation)
 Creates a DsView with the auto-layout mode active. This view can align it's children automatically.
 
void addChild (DsView *view)
 Adds a child to the current DsView.
 
void removeChild (DsView *view)
 Removes a child to the current DsView.
 
void removeAllChildren (void)
 Removes all children of the current DsView.
 
void bringFront (void)
 Brings the current view to the top of the drawing order.
 
void sendBack (void)
 Sends the current view to the bottom of the drawing order.
 
DsViewgetParent (void) const
 Returns the parent of the current view.
 
void setParent (DsView *parent)
 Sets a new parent to the view.
 
const DsPointgetPosition (void) const
 Returns the position of the view in parent coordinates.
 
DsFPoint getCenterPoint (void) const
 Returns the center point of the view in current coordinates.
 
DsPoint translatePositionInParentCoordinates (const DsView *parent, DsPoint pos) const
 Translates position (x, y) in parent coordinate system.
 
DsPoint translatePositionInParentCoordinates (uint32_t parent_level, DsPoint pos) const
 Translates position (x, y) in parent coordinate system.
 
DsPoint getPositionInParentCoordinates (const DsView *parent) const
 Returns the position in the parent's coordinate system.
 
void setPosition (const DsPoint &pos)
 Sets the position of the view in parent coordinates.
 
void setCenterPosition (const DsPoint &pos)
 Sets the position of the center of the view in parent coordinates.
 
void centerVertically (DsView *view)
 Aligns vertically the center of the current view with the center of another view.
 
void centerHorizontally (DsView *view)
 Aligns horizontally the center of the current view with the center of another view.
 
const DsSizegetParentSize (void) const
 Returns the size of the parent view.
 
const DsSizegetSize (void) const
 Returns the size of the view.
 
void setMinimumSize (const DsSize &size)
 Returns the minimum size of the view.
 
void setSize (const DsSize &size)
 Sets the size of the view.
 
void setWidth (int32_t width)
 Sets the width of the view.
 
void setHeight (int32_t height)
 Sets the height of the view.
 
DsRect getRegion (void) const
 Returns a rectangle describing the space occupied by the current view in it's own coordinate system (X and Y coordinates are 0).
 
DsRect getRegionInParentCoordinates (const DsView *parent) const
 Returns a rectangle describing the space occupied by the current view in the parent's coordinate system.
 
void alignInParent (void)
 Aligns the view relative to it's parent.
 
void alignInParent (const DsAlignment &alignment, int32_t padding_top, int32_t padding_left, int32_t padding_bottom, int32_t padding_right)
 Aligns the view relative to it's parent.
 
DsViewsetPaddingTop (int16_t padding, uint16_t proportion=0)
 Sets the top padding used by the auto-layout.
 
DsViewsetPaddingBottom (int16_t padding, uint16_t proportion=0)
 Sets the bottom padding used by the auto-layout.
 
DsViewsetPaddingLeft (int32_t padding, uint16_t proportion=0)
 Sets the left padding used by the auto-layout.
 
DsViewsetPaddingRight (int16_t padding, uint16_t proportion=0)
 Sets the right padding used by the auto-layout.
 
DsViewsetPadding (int16_t padding, uint16_t proportion=0)
 Sets the padding used by the auto-layout.
 
DsViewsetPaddingHorizontal (int16_t padding, uint16_t proportion=0)
 Sets the horizontal padding used by the auto-layout.
 
DsViewsetPaddingVertical (int16_t padding, uint16_t proportion=0)
 Sets the vertical padding used by the auto-layout.
 
DsViewsetProportion (uint32_t proportion)
 Sets the view proportion used by the auto-layout.
 
DsAlignment getParentAlignment (void) const
 Returns parent alignment mode of the view.
 
DsViewsetParentAlignment (const DsAlignment &alignment)
 Sets parent alignment mode of the view.
 
void reserveSpace (bool state)
 Configures if during auto-layout the view will reserve space even if it's hidden.
 
void setAutoLayout (DsOrientation orientation, bool enable)
 Enables or disables the auto-layout mode and sets the primary orientation.
 
virtual DsSize fitContent (void)
 Calculates the minimum size required by the view.
 
void doLayout (void)
 Runs the auto-layout algorithm.
 
void setBackgroundColor (DsColor color)
 Sets the background color of the view.
 
void setBackgroundImage (const DsSurface *surface)
 Sets the background image.
 
void setPanelColor (DsColor color)
 Sets the color of the panel.
 
void setPanelBorderColor (DsColor color)
 Sets the color of the panel border.
 
void setPanelCornerRadius (uint16_t radius)
 Sets the radius of the panel corners.
 
void setPanelBorderThickness (uint8_t thickness)
 Sets the thickness of the panel border.
 
DsScreengetScreen (void)
 Returns a reference to the screen to which this view belongs.
 
bool isFocused (void)
 Is the view focused?
 
bool getIsVisible (void) const
 Is the view visibility enabled?
 
bool isVisible (void) const
 Is the view actually visible on the screen?
 
bool isParentVisible (void) const
 Is the parent view actually visible on the screen?
 
bool show (void)
 Shortcut to setVisible(true).
 
bool hide (void)
 Shortcut to setVisible(false).
 
bool setVisible (bool is_visible)
 Changes the visibility of the view.
 
virtual void onShow (void)
 This virtual method is called when the view becomes visible on the screen.
 
virtual void onHide (void)
 This virtual method is called when the view becomes invisible (hidden) on the screen.
 
void enable (bool state)
 Enables or disables the view.
 
bool isEnabled (void) const
 Is the view enabled?
 
void enableTouch (bool state)
 Enables or disables processing of touch events.
 
bool isTouchEnabled (void) const
 Is the view enabled to process touch events?
 
void sendTap (DsPoint pos)
 Sends a tap event to the view.
 
void setOnTapCallback (const lambda< void(const DsPoint &p)> &cb)
 Sets the lambda to be executed when the user taps on the view.
 
void setOnLongTapCallback (const lambda< void(const DsPoint &p)> &cb)
 Sets the lambda to be executed when the user taps the view and holds for a specific time (set with setLongTapDetection()).
 
void setOnTouchActiveCallback (const lambda< void(const DsPoint &p)> &cb)
 Sets the lambda to be executed when the user touches the view.
 
void setOnTouchReleaseCallback (const lambda< void(void)> &cb)
 Sets the lambda to be executed when the user touch is released.
 
void setLongTapDetection (uint32_t delay_ms)
 Configures the long tap detection.
 
bool isInputInside (void) const
 Returns if there is user input (touch) inside the view.
 
const DsPointgetTouchPosition (void) const
 Returns the location of the user touch input inside the view.
 
void enableHorizontalScroll (bool state)
 Enables or disables the horizontal scroll of the view contents.
 
void enableVerticalScroll (bool state)
 Enables or disables the vertical scroll of the view contents.
 
void setScrollbarColor (DsColor color)
 Configure the color of the scroll bars.
 
virtual void invalidate (void)
 Invalidates the view.
 
virtual void invalidateRegion (DsRect region)
 Invalidates only a region of the view.
 
void addStateObserver (StateObserver *observer)
 Adds a state observer object.
 
void removeStateObserver (StateObserver *observer)
 Removes a state observer object.
 
- Public Member Functions inherited from DsGaugeBase
DsGaugeBasesetBorderColor (DsColor color)
 Sets the border color.
 
DsGaugeBasesetTrackColor (DsColor color)
 Sets the track color.
 
DsGaugeBasesetActiveColor (DsColor color)
 Sets the active color.
 
DsGaugeBasesetBorderThickness (uint8_t thickness)
 Sets the border thickness.
 
DsGaugeBasesetValueColor (DsColor color)
 Sets the value text color.
 
DsGaugeBasesetValueFont (const ds_bitmap_font_t *font)
 Sets the font used to render the value.
 
DsGaugeBasesetValueFormat (const char *format)
 Sets the printf() style format string used to print the value.
 
DsGaugeBasesetValueOffset (int16_t offset)
 Sets the vertical value offset in pixels.
 
DsGaugeBasesetTitleColor (DsColor color)
 Sets the title color.
 
DsGaugeBasesetTitleFont (const ds_bitmap_font_t *font)
 Sets the font used to render the title.
 
DsGaugeBasesetTitle (const char *title)
 Sets the title.
 
DsGaugeBasesetTitleOffset (int16_t offset)
 Sets the vertical title offset in pixels.
 
DsGaugeBasesetUnitColor (DsColor color)
 Sets the unit color.
 
DsGaugeBasesetUnitFont (const ds_bitmap_font_t *font)
 Sets the font used to render the unit.
 
DsGaugeBasesetUnit (const char *unit)
 Sets the unit.
 
DsGaugeBasesetUnitOffset (int16_t offset)
 Sets the vertical unit offset in pixels.
 
- Public Member Functions inherited from DsValueBase
void setValueRange (float min, float max)
 Sets the value range.
 
void setValue (float value)
 Sets the value.
 
float getValue (void) const
 Returns the value.
 
void setOnChangeCallback (const lambda< void(float value, bool in_motion, bool user_input)> &cb)
 

Additional Inherited Members

- Protected Member Functions inherited from DsView
virtual void onChildAdd (DsView *child)
 This virtual method will be called when a new child had been added to the view.
 
virtual void onPaintOver (DsRenderer &renderer)
 This virtual method will be called when the view needs to repaint it's content, but after the view and it's children had been painted.
 
virtual bool onTouch (const DsTouchEvent &event)
 This virtual method will be called when there is touch user input.
 
virtual void onVSync (void)
 This virtual method is be called at every vertical sync period.
 
virtual void onKeyboard (int32_t key)
 This virtual method is called when there is a keyboard event that needs to be processed.
 
void inputCapture (void)
 Captures the touch input.
 
bool isInputCaptured (void) const
 Is the input captured?
 
void skipInput (void)
 Skips receiving touch inputs until the end of the current touch event.
 
void forAllChildren (const lambda< void(DsView *child)> &lambda)
 Calls the supplied lambda for every view in the children list.
 
void forAllChildrenBackwards (const lambda< void(DsView *child)> &lambda)
 Calls the supplied lambda for every view in the children list.
 
- Protected Member Functions inherited from DsValueBase
float getNormalizedValue (float value)
 
void notifyValueChange (bool in_motion)
 
- Protected Attributes inherited from DsView
DsPoint mScrollPosition
 
DsPoint mPreviousScrollPosition
 
DsPoint mScrollPositionBase
 
DsColor mScrollbarColor
 
DsPoint mTouchPos
 
uint32_t mTouchTimestamp
 
- Protected Attributes inherited from DsGaugeBase
DsColor mBorderColor
 
DsColor mTrackColor
 
DsColor mActiveColor
 
DsColor mValueColor
 
const ds_bitmap_font_tmValueFont
 
const char * mValueFormat
 
DsRect mValueRegion
 
DsColor mTitleColor
 
const ds_bitmap_font_tmTitleFont
 
const char * mTitleText
 
DsRect mTitleRegion
 
DsColor mUnitColor
 
const ds_bitmap_font_tmUnitFont
 
const char * mUnitText
 
DsRect mUnitRegion
 
int16_t mValueOffset
 
int16_t mTitleOffset
 
int16_t mUnitOffset
 
uint8_t mBorderThickness
 
- Protected Attributes inherited from DsValueBase
float mMinValue
 
float mMaxValue
 
float mValue
 

Detailed Description

DsGaugeBattery is a class that implements a battery style gauge.

Member Enumeration Documentation

◆ Style

enum DsGaugeBattery::Style : uint32_t

Battery gauge style.

Enumerator
STYLE_DEFAULT 

Default battery gauge style.

STYLE_AUTOMOTIVE 

Automotive battery style.

Constructor & Destructor Documentation

◆ DsGaugeBattery()

DsGaugeBattery::DsGaugeBattery ( DsView parent,
const DsPoint pos,
const DsSize size,
uint32_t  style = STYLE_DEFAULT 
)

Creates a DsGaugeBattery object.

Parameters
parentThe parent view
posThe position of the view in the parent coordinate system
sizeThe size of the view

Member Function Documentation

◆ setCornerRadius()

DsGaugeBattery & DsGaugeBattery::setCornerRadius ( uint16_t  radius)

Sets the corner radius.

Parameters
radiusCorner radius in pixels

◆ setFillMargin()

DsGaugeBattery & DsGaugeBattery::setFillMargin ( uint8_t  margin)

Sets the battery fill area margin.

Parameters
marginMargin in pixels

◆ setSecondaryFormat()

DsGaugeBattery & DsGaugeBattery::setSecondaryFormat ( const char *  format)

Sets the printf() style format string used to print the secondary value.

Parameters
formatprintf() style format string. Only one float value is passed to the printf() formatting function.
Return values
Referenceto the current object. This allows daisy-chaining calls.

◆ setSecondaryTextColor()

DsGaugeBattery & DsGaugeBattery::setSecondaryTextColor ( DsColor  color)

Sets the secondary value text color.

Parameters
colorColor
Return values
Referenceto the current object. This allows daisy-chaining calls.

◆ setSecondaryTextFont()

DsGaugeBattery & DsGaugeBattery::setSecondaryTextFont ( const ds_bitmap_font_t font)

Sets the font used to render the secondary value.

Parameters
fontFont
Return values
Referenceto the current object. This allows daisy-chaining calls.

◆ setSecondaryValue()

DsGaugeBattery & DsGaugeBattery::setSecondaryValue ( float  value)

Sets the secondary value.

Parameters
valueprintf() style format string. Only one float value is passed to the printf() formatting function.
Return values
Referenceto the current object. This allows daisy-chaining calls.

◆ setTerminalSize()

DsGaugeBattery & DsGaugeBattery::setTerminalSize ( const DsSize size)

Sets the size of the battery terminal.

Parameters
sizeSize in pixels

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