Iridescence 1.00
Embedded Graphic Framework
Loading...
Searching...
No Matches
ds_keyboard.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_KEYBOARD_H
8#define _DS_KEYBOARD_H
9
10#include <ds_view.h>
11
12
13class DsKeyboardKey;
14
15
20class DsKeyboard: public DsView
21{
22public:
28 void setExtension(bool enabled);
29
30
39 DsKeyboard& setNumericMode(bool allow_negative = true, bool allow_decimal = true, bool allow_backspace = true);
40
41
48 DsKeyboard& setAlphaMode(bool latching_shift = false);
49
50
59 DsKeyboard& setCornerRadius(float tl, float tr, float bl, float br);
60
61
68
69
75 DsKeyboard& setKeySize(uint32_t size);
76
77
85 DsKeyboard& setKeyColors(DsColor key_color, DsColor key_color_highlight, DsColor text_color);
86
87
94
95
96private:
97 friend class DsScreen;
98
99 DsAlignment mAlignment;
100
101 int32_t mCornerRadiusTL;
102 int32_t mCornerRadiusTR;
103 int32_t mCornerRadiusBL;
104 int32_t mCornerRadiusBR;
105
106 bool mIsExtensionEnabled;
107
108 uint32_t mKeySize;
109 uint32_t mKeyPadding;
110
111 DsColor mKeyboardColor;
112
113 bool mLatchingShift;
114 bool mShiftActive;
115 bool mSymbolMode;
116
117 bool mNumericMode;
118 bool mAllowNegative;
119 bool mAllowDecimal;
120 bool mAllowBackspace;
121
122 DsKeyboardKey* mKeys[28];
123 DsKeyboardKey* mKey_Sym;
124 DsKeyboardKey* mKey_Done;
125 DsKeyboardKey* mKey_Shift;
126 DsKeyboardKey* mKey_Delete;
127 DsKeyboardKey* mKey_Enter;
128 DsKeyboardKey* mKey_Space;
129
130 DsView* mRow1Stack;
131 DsView* mRow2Stack;
132 DsView* mRow3Stack;
133 DsView* mRow4Stack;
134 DsView* mRow5Stack;
135
136 DsView* mAlignedView;
137 DsPoint mAlignedViewPos;
138
139 DsKeyboard(DsScreen* screen, const ds_bitmap_font_t* font);
140
141 void layout(void);
142 void updateKeyLabel(void);
143
144 void onPaint(DsRenderer &renderer) override final;
145 void onShow(void) override final;
146 void onHide(void) override final;
147};
148
149
150#endif
DsAlignment is a class representing both horizontal and vertical alignment type.
Definition ds_types.h:130
DsColor is a class that represents a 4 channel color (Alpha, Red, Green, Blue).
Definition ds_color.h:53
Definition ds_keyboard.h:21
DsKeyboard & setCornerRadius(float tl, float tr, float bl, float br)
Sets the corner radius for all 4 corners.
DsKeyboard & setNumericMode(bool allow_negative=true, bool allow_decimal=true, bool allow_backspace=true)
Configures the keyboard in numeric mode.
DsKeyboard & setAlphaMode(bool latching_shift=false)
Configures the keyboard in alphanumeric mode.
void setExtension(bool enabled)
Enables the keyboard extension. The keyboard can be extended to cover the entire available space.
DsKeyboard & setKeySize(uint32_t size)
Sets the key size.
DsKeyboard & setKeyboardColor(DsColor color)
Sets the keyboard color.
DsKeyboard & setAlignedView(DsView *aligned_view)
Sets an optional view which will be aligned with the keyboard.
DsKeyboard & setKeyColors(DsColor key_color, DsColor key_color_highlight, DsColor text_color)
Sets the key colors.
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
DsScreen is class of type DsView (inherits from DsView) that implements a physical screen.
Definition ds_screen.h:29
DsView is a base class that represents any view on the screen.
Definition ds_view.h:40
Definition ds_font.h:45