Iridescence 1.00
Embedded Graphic Framework
Loading...
Searching...
No Matches
ds_droplist.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_DROPLIST_H
8#define _DS_DROPLIST_H
9
10
11#include <ds_view.h>
12#include <ds_selection_base.h>
13
14
23class DsDropList: public DsView, public DsSelectionBase
24{
25public:
30 {
31 public:
38 virtual uint32_t onDropListGetLength(DsDropList* object) = 0;
39
40
49 virtual const char* onDropListGetString(DsDropList* object, uint32_t index) = 0;
50 };
51
52
62 DsDropList(DsView* parent, const DsPoint &pos, const DsSize &size, uint32_t maximum_height, const ds_bitmap_font_t* font);
63
64
70 void setListener(Listener* listener);
71
72
78 void setListColors(DsColor color, DsColor color_selected);
79
80
86 void setTextColors(DsColor color, DsColor color_selected);
87
88
94
95
100 void setBorderThickness(uint8_t thickness);
101
102
108
109
116
117
121 void expand(void);
122
123
127 void fold(void);
128
129private:
130 uint32_t mMaximumHeight;
131 const ds_bitmap_font_t* mFont;
132
133 DsColor mScrollBarColor;
134
135 DsColor mTextColor;
136 DsColor mSelectedTextColor;
137
138 DsColor mListBackgroundColor;
139 DsColor mSelectedListBackgroundColor;
140
141 DsColor mBorderColor;
142 uint32_t mCornerRadius;
143
144 DsColor mButtonColor;
145 DsColor mPushedButtonColor;
146
147 DsPoint mButtonCenter;
148 uint32_t mButtonRadius;
149
150 uint32_t mTapIndex;
151
152 DsRect mFoldedRegion;
153 DsRect mExpandedRegion;
154
155 uint32_t mRowOffset;
156 uint32_t mRowHeight;
157 uint32_t mMaxRows;
158
159 Listener* mListener;
160
161 uint8_t mBorderThickness;
162
163 struct
164 {
165 uint8_t mIsExpanded: 1;
166 uint8_t mIsTouchActive: 1;
167 uint8_t mFoldUnfoldTap: 1;
168 };
169
170 void onPaint(DsRenderer &renderer) override final;
171 bool onTouch(const DsTouchEvent &event) override final;
172
173 void onSizeChange(void) override final;
174 int32_t onSelectionChange(int32_t selection) override final;
175 void getSelectionCount(void) override final;
176};
177
178#endif
DsColor is a class that represents a 4 channel color (Alpha, Red, Green, Blue).
Definition ds_color.h:53
Listener is an interface class that receives requests and events from the list view.
Definition ds_droplist.h:30
virtual const char * onDropListGetString(DsDropList *object, uint32_t index)=0
Called when the DsDropList view requires the text label for a specific row.
virtual uint32_t onDropListGetLength(DsDropList *object)=0
Called when the DsDropList view requires to know the number of items in the list.
DsDropList is a class that implements a drop-down list.
Definition ds_droplist.h:24
void setListColors(DsColor color, DsColor color_selected)
Sets the list row colors.
void expand(void)
Sets the drop list in the expanded state.
void setBorderColor(DsColor color)
Sets the border color.
DsDropList(DsView *parent, const DsPoint &pos, const DsSize &size, uint32_t maximum_height, const ds_bitmap_font_t *font)
Creates a DsDropList object.
void setListener(Listener *listener)
Sets the DsDropList event listener.
void fold(void)
Sets the drop list in the folded state.
void setTextColors(DsColor color, DsColor color_selected)
Sets the list text colors.
void setButtonColor(DsColor color)
Sets the expand button color.
void setScrollBarColor(DsColor color)
Sets the color of the scroll bar.
void setBorderThickness(uint8_t thickness)
Sets the border thickness.
DsPoint is a class that represents the X and Y 2D coordinates of a point as integer numbers.
Definition ds_geometry.h:24
DsRect is a class that represents a 2D rectangle (X, Y, W, H)
Definition ds_geometry.h:1507
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
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