Iridescence 1.00
Embedded Graphic Framework
Loading...
Searching...
No Matches
ds_selector.h
1/* Copyright (C) 2017 - 2024, Thornwave Labs Inc - All Rights Reserved.
2 * Unauthorized copying of this file, via any medium is strictly prohibited.
3 * Proprietary and confidential.
4 * Written by Razvan Turiac <razvan.turiac@thornwave.com>
5*/
6
7#ifndef _DS_SELECTOR_H
8#define _DS_SELECTOR_H
9
10
11#include <ds_view.h>
12#include <ds_selection_base.h>
13
14
22class DsSelector: public DsView, public DsSelectionBase
23{
24public:
29 {
30 public:
39 virtual const char* getSelectorLabel(DsSelector* object, uint32_t index) = 0;
40 };
41
42
53 DsSelector(DsView* parent, const DsPoint &pos, const DsSize &size, const DsOrientation &orientation, uint32_t count, const ds_bitmap_font_t* font);
54
55
61 void setListener(Listener* listener);
62
63
68 void setBorderThickness(uint8_t thickness);
69
70
76
77
83 void setTabColors(DsColor color, DsColor color_selected);
84
85
91 void setTextColors(DsColor color, DsColor color_selected);
92
93
94private:
95 uint32_t mCornerRadius;
96
97 Listener* mListener;
98
99 DsOrientation mOrientation;
100
101 const ds_bitmap_font_t* mFont;
102
103 DsColor mTabColor;
104 DsColor mSelectedTabColor;
105
106 DsColor mTextColor;
107 DsColor mSelectedTextColor;
108
109 DsColor mBorderColor;
110
111 uint32_t mTabWidth;
112 uint32_t mTotalWidth;
113
114 uint32_t mTouchTimestamp;
115 uint8_t mBorderThickness;
116 bool mIsTouchActive;
117
118 void onPaint(DsRenderer &renderer) override final;
119 bool onTouch(const DsTouchEvent &event) override final;
120 int32_t onSelectionChange(int32_t selection) override final;
121};
122
123
124#endif
DsColor is a class that represents a 4 channel color (Alpha, Red, Green, Blue).
Definition ds_color.h:53
DsOrientation is a class representing the orientation (horizontal or vertical).
Definition ds_types.h:57
DsPoint is a class that represents the X and Y 2D coordinates of a point as integer numbers.
Definition ds_geometry.h:24
DsRenderer is a class that implements all the drawing operations.
Definition ds_renderer.h:42
DsSelectionBase is a base class that contains a selection value.
Definition ds_selection_base.h:19
Listener is an interface class that receives requests from the selector view.
Definition ds_selector.h:29
virtual const char * getSelectorLabel(DsSelector *object, uint32_t index)=0
Returns the text label of the option with the specified position (0 based, left->right / top->bottom)
DsSelector is a class that represents a graphic element used to select between multiple options (typi...
Definition ds_selector.h:23
void setTabColors(DsColor color, DsColor color_selected)
Sets the option tab colors.
void setListener(Listener *listener)
Sets the DsSelector event listener.
void setBorderThickness(uint8_t thickness)
Sets the border thickness.
DsSelector(DsView *parent, const DsPoint &pos, const DsSize &size, const DsOrientation &orientation, uint32_t count, const ds_bitmap_font_t *font)
Creates a DsSelector object. No option will be selected by default.
void setTextColors(DsColor color, DsColor color_selected)
Sets the text colors.
void setBorderColor(DsColor color)
Sets the border color.
DsSize is class that represents the 2D size of a graphic object (width, height) as integer values.
Definition ds_geometry.h:780
DsView is a base class that represents any view on the screen.
Definition ds_view.h:40
This structure implements a touch event.
Definition ds_event.h:25
Definition ds_font.h:45