Iridescence 1.00
Embedded Graphic Framework
Loading...
Searching...
No Matches
ds_dialog_base.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_DIALOG_BASE_H
8#define _DS_DIALOG_BASE_H
9
10
11#include <ds_view.h>
12#include <ds_label.h>
13#include <ds_button.h>
14#include <ds_divider.h>
15
16
23class DsDialogBase: public DsView
24{
25public:
33 DsDialogBase(DsView* parent, DsColor dialog_color, uint32_t corner_radius);
34
35
47
48
56
57
65
66
74
75
83
84
92
93
101
102
109 DsDialogBase& setTitle(const char* title);
110
111
119 DsDialogBase& setButtonFonts(const ds_bitmap_font_t* positive_font, const ds_bitmap_font_t* negative_font);
120
121
129 DsDialogBase& setButtonColors(DsColor positive_color, DsColor negative_color);
130
131
140 DsDialogBase& setButtons(const char* positive, const char* negative, const lambda<void(bool)> &cb);
141
142
143protected:
149
155
161
162
163private:
164 class Dialog: public DsView
165 {
166 public:
167 Dialog(DsView* parent, DsColor dialog_color, uint32_t corner_radius);
168
169 private:
170 friend class DsDialogBase;
171
172 DsColor mDialogColor;
173 uint32_t mCornerRadius;
174 lambda<void(bool)> mCallback;
175
176 DsLabel* mTitleLabel;
177 DsView* mBodyView;
178
179 DsDivider* mDivider;
180
181 DsButton* mPositiveButton;
182 DsButton* mNegativeButton;
183
184 bool onTouch(const DsTouchEvent &event) override final;
185 void onShow(void) override final;
186 };
187
188 DsColor mMaskColor;
189 Dialog* mDialog;
190
191 void onPaint(DsRenderer &renderer) override final;
192 bool onTouch(const DsTouchEvent &event) override final;
193};
194
195
196#endif
DsButton is a class representing a standard, 2D, rounded corner button.
Definition ds_button.h:20
DsColor is a class that represents a 4 channel color (Alpha, Red, Green, Blue).
Definition ds_color.h:53
DsDialogBase is a class that implements a generic dialog base class.
Definition ds_dialog_base.h:24
DsDialogBase & setTitleColor(DsColor color)
Sets the color used to render the dialog title.
DsDialogBase & setDialogColor(DsColor color)
Sets the color used to render the dialog panel.
void enablePositiveButton(bool enable)
Enable or disable the positive button (for validating the input)
DsView * getInnerDialogView(void)
Get a pointer to the inner dialog view.
DsDialogBase & setDialogBorderThickness(uint8_t thickness)
Sets the thickness of the dialog panel border.
DsDialogBase & setDialogCornerRadius(uint16_t radius)
Sets the corner radius of the dialog panel.
DsDialogBase & setTitleFont(const ds_bitmap_font_t *font)
Sets the font used to render the dialog title.
DsView * getBodyView(void)
Get a pointer to the body view.
DsDialogBase & setButtonColors(DsColor positive_color, DsColor negative_color)
Sets the colors used to render the dialog buttons.
DsDialogBase & setButtonFonts(const ds_bitmap_font_t *positive_font, const ds_bitmap_font_t *negative_font)
Sets the fonts used to render the text of the dialog buttons.
DsDialogBase & setButtons(const char *positive, const char *negative, const lambda< void(bool)> &cb)
Sets the text of the buttons and the callback used to pass the result back.
DsDialogBase & setMaskColor(DsColor color)
Sets the dimming mask color.
DsDialogBase & setDialogBorderColor(DsColor color)
Sets the color used to render the dialog panel border.
DsDialogBase & setTitle(const char *title)
Sets the dialog title.
DsDialogBase(DsView *parent, DsColor dialog_color, uint32_t corner_radius)
Creates a DsDialogBase view.
DsDivider is a class representing a simple line divider.
Definition ds_divider.h:17
DsLabel is a class that represents a text label view.
Definition ds_label.h:21
DsRenderer is a class that implements all the drawing operations.
Definition ds_renderer.h:42
DsView is a base class that represents any view on the screen.
Definition ds_view.h:40
void enable(bool state)
Enables or disables the view.
Definition ds_types_lambda.h:24
This structure implements a touch event.
Definition ds_event.h:25
Definition ds_font.h:45