FabGL
ESP32 Display Controller and Graphics Library
fabui.h
Go to the documentation of this file.
1 /*
2  Created by Fabrizio Di Vittorio (fdivitto2013@gmail.com) - <http://www.fabgl.com>
3  Copyright (c) 2019-2021 Fabrizio Di Vittorio.
4  All rights reserved.
5 
6 
7 * Please contact fdivitto2013@gmail.com if you need a commercial license.
8 
9 
10 * This library and related software is available under GPL v3. Feel free to use FabGL in free software and hardware:
11 
12  FabGL is free software: you can redistribute it and/or modify
13  it under the terms of the GNU General Public License as published by
14  the Free Software Foundation, either version 3 of the License, or
15  (at your option) any later version.
16 
17  FabGL is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  GNU General Public License for more details.
21 
22  You should have received a copy of the GNU General Public License
23  along with FabGL. If not, see <http://www.gnu.org/licenses/>.
24  */
25 
26 
27 #pragma once
28 
29 
38 #include <stdint.h>
39 #include <stddef.h>
40 
41 #include <list>
42 
43 #include "freertos/FreeRTOS.h"
44 #include "freertos/queue.h"
45 #include "freertos/timers.h"
46 
47 #include "fabglconf.h"
48 #include "fabutils.h"
49 #include "displaycontroller.h"
50 #include "canvas.h"
51 #include "fabfonts.h"
52 #include "codepages.h"
53 
54 
55 
56 /*
57 
58  *uiObject
59  *uiEvtHandler
60  *uiApp
61  *uiWindow
62  *uiFrame
63  *uiControl
64  *uiButton
65  *uiLabel
66  *uiImage
67  *uiPanel
68  *uiTextEdit
69  *uiScrollableControl
70  *uiPaintBox
71  *uiCustomListBox
72  *uiListBox
73  *uiColorListBox
74  *uiFileBrowser
75  uiMemoEdit
76  *uiCheckBox
77  *uiCustomComboBox
78  *uiComboBox
79  *uiColorComboBox
80  uiMenu
81  uiGauge
82  *uiSlider
83  uiSpinButton
84  *uiColorBox
85  *uiProgressBar
86 
87 */
88 
89 
90 namespace fabgl {
91 
92 
93 
94 // increase in case of garbage between windows!
95 #define FABGLIB_UI_EVENTS_QUEUE_SIZE 300
96 
97 
98 using std::list;
99 using std::pair;
100 
101 
103 // uiEvent
104 
105 enum uiEventID {
106  UIEVT_NULL,
107  UIEVT_DEBUGMSG,
108  UIEVT_APPINIT,
109  UIEVT_GENPAINTEVENTS,
110  UIEVT_PAINT,
111  UIEVT_ACTIVATE,
112  UIEVT_DEACTIVATE,
113  UIEVT_MOUSEMOVE,
114  UIEVT_MOUSEWHEEL,
115  UIEVT_MOUSEBUTTONDOWN,
116  UIEVT_MOUSEBUTTONUP,
117  UIEVT_SETPOS,
118  UIEVT_SETSIZE,
119  UIEVT_RESHAPEWINDOW,
120  UIEVT_MOUSEENTER,
121  UIEVT_MOUSELEAVE,
122  UIEVT_MAXIMIZE, // Request for maximize
123  UIEVT_MINIMIZE, // Request for minimize
124  UIEVT_RESTORE, // Restore from UIEVT_MAXIMIZE or UIEVT_MINIMIZE
125  UIEVT_SHOW,
126  UIEVT_HIDE,
127  UIEVT_SETFOCUS,
128  UIEVT_KILLFOCUS,
129  UIEVT_KEYDOWN,
130  UIEVT_KEYUP,
131  UIEVT_TIMER,
132  UIEVT_CLICK,
133  UIEVT_DBLCLICK,
134  UIEVT_EXITMODAL,
135  UIEVT_DESTROY,
136  UIEVT_CLOSE, // Request to close (frame Close button)
137  UIEVT_QUIT, // Quit the application
138  UIEVT_CREATE,
139  UIEVT_CHILDSETFOCUS, // a UIEVT_SETFOCUS has been sent to a child
140  UIEVT_CHILDKILLFOCUS, // a UIEVT_KILLFOCUS has been sent to a child
141 };
142 
143 
144 class uiEvtHandler;
145 class uiApp;
146 class uiWindow;
147 
148 
149 typedef void * uiTimerHandle;
150 
151 
155  uint8_t ASCII;
156  uint8_t LALT : 1;
157  uint8_t RALT : 1;
158  uint8_t CTRL : 1;
159  uint8_t SHIFT : 1;
160  uint8_t GUI : 1;
161 };
162 
163 
167  uint8_t changedButton;
168 };
169 
170 
171 struct uiFocusInfo {
172  uiWindow * oldFocused;
173  uiWindow * newFocused;
174 };
175 
176 
177 struct uiEvent {
178  uiEvtHandler * dest;
179  uiEventID id;
180 
181  union uiEventParams {
182  // event: UIEVT_MOUSEMOVE, UIEVT_MOUSEWHEEL, UIEVT_MOUSEBUTTONDOWN, UIEVT_MOUSEBUTTONUP, UIEVT_CLICK, UIEVT_DBLCLICK
183  uiMouseEventInfo mouse;
184  // event: UIEVT_PAINT, UIEVT_GENPAINTEVENTS, UIEVT_RESHAPEWINDOW
185  Rect rect;
186  // event: UIEVT_SETPOS
187  Point pos;
188  // event: UIEVT_SETSIZE
189  Size size;
190  // event: UIEVT_DEBUGMSG
191  char const * debugMsg;
192  // event: UIEVT_KEYDOWN, UIEVT_KEYUP
193  uiKeyEventInfo key;
194  // event: UIEVT_TIMER
195  uiTimerHandle timerHandle;
196  // event: UIEVT_EXITMODAL
197  int modalResult;
198  // event: UIEVT_QUIT
199  int exitCode;
200  // event: UIEVT_SETFOCUS, UIEVT_KILLFOCUS, UIEVT_CHILDKILLFOCUS, UIEVT_CHILDSETFOCUS
201  uiFocusInfo focusInfo;
202 
203  uiEventParams() { }
204  } params;
205 
206  uiEvent() : dest(nullptr), id(UIEVT_NULL) { }
207  uiEvent(uiEvent const & e) { dest = e.dest; id = e.id; params = e.params; }
208  uiEvent(uiEvtHandler * dest_, uiEventID id_) : dest(dest_), id(id_) { }
209 };
210 
211 
212 
216 enum class uiOrientation {
217  Vertical,
218  Horizontal,
219 };
220 
221 
225 enum class uiHAlign {
226  Left,
227  Right,
228  Center,
229 };
230 
231 
232 
234 // uiObject
235 
236 
238 struct uiObjectType {
239  uint32_t uiApp : 1;
240  uint32_t uiEvtHandler : 1;
241  uint32_t uiWindow : 1;
242  uint32_t uiFrame : 1;
243  uint32_t uiControl : 1;
244  uint32_t uiScrollableControl : 1;
245  uint32_t uiButton : 1;
246  uint32_t uiTextEdit : 1;
247  uint32_t uiLabel : 1;
248  uint32_t uiImage : 1;
249  uint32_t uiPanel : 1;
250  uint32_t uiPaintBox : 1;
251  uint32_t uiCustomListBox : 1;
252  uint32_t uiListBox : 1;
253  uint32_t uiFileBrowser : 1;
254  uint32_t uiComboBox : 1;
255  uint32_t uiCheckBox : 1;
256  uint32_t uiSlider : 1;
257  uint32_t uiColorListBox : 1;
258  uint32_t uiCustomComboBox : 1;
259  uint32_t uiColorBox : 1;
260  uint32_t uiColorComboBox : 1;
261  uint32_t uiProgressBar : 1;
262 
266  { }
267 };
268 
269 
271 class uiObject {
272 
273 public:
274 
275  uiObject();
276 
277  virtual ~uiObject();
278 
284  uiObjectType & objectType() { return m_objectType; }
285 
286 private:
287  uiObjectType m_objectType;
288 };
289 
290 
291 
293 // uiEvtHandler
294 
295 
297 class uiEvtHandler : public uiObject {
298 
299 public:
300 
302 
303  virtual ~uiEvtHandler();
304 
305  virtual void processEvent(uiEvent * event);
306 
312  uiApp * app() { return m_app; }
313 
314 
315 protected:
316 
317  void setApp(uiApp * value) { m_app = value; }
318 
319 
320 private:
321 
322  uiApp * m_app;
323 };
324 
325 
326 
328 // uiWindow
329 
333 enum class uiOrigin {
334  Screen,
335  Parent,
336  Window,
337 };
338 
339 
342  uint8_t visible : 1;
343  uint8_t maximized : 1;
344  uint8_t minimized : 1;
345  uint8_t active : 1;
346 };
347 
348 
351  uint8_t activable : 1;
352  uint8_t focusable : 1;
354  uiWindowProps() :
355  activable(true),
356  focusable(false)
357  { }
358 };
359 
360 
364  RGB888 borderColor = RGB888(128, 128, 128);
365  RGB888 activeBorderColor = RGB888(128, 128, 255);
367  uint8_t borderSize = 3;
368  uint8_t focusedBorderSize = 1;
369 };
370 
371 
373 struct uiAnchors {
374  uint8_t left : 1;
375  uint8_t top : 1;
376  uint8_t right : 1;
377  uint8_t bottom : 1;
379  uiAnchors() : left(true), top(true), right(false), bottom(false) { }
380 };
381 
382 
383 #define UIWINDOW_PARENTCENTER Point(-1000, -1000)
384 
385 
387 class uiWindow : public uiEvtHandler {
388 
389 friend class uiApp;
390 
391 public:
392 
402  uiWindow(uiWindow * parent, const Point & pos, const Size & size, bool visible, uint32_t styleClassID = 0);
403 
404  virtual ~uiWindow();
405 
406  virtual void processEvent(uiEvent * event);
407 
408  void setCanvas(Canvas * canvas) { m_canvas = canvas; }
409 
417  uiWindow * next() { return m_next; }
418 
426  uiWindow * prev() { return m_prev; }
427 
433  uiWindow * firstChild() { return m_firstChild; }
434 
440  uiWindow * lastChild() { return m_lastChild; }
441 
447  bool hasChildren() { return m_firstChild != nullptr; }
448 
452  void bringOnTop();
453 
459  void bringAfter(uiWindow * insertionPoint);
460 
468  Point pos() { return m_pos; }
469 
475  Point clientPos();
476 
484  Size size() { return m_size; }
485 
491  Size clientSize();
492 
502  Rect rect(uiOrigin origin);
503 
511  virtual Rect clientRect(uiOrigin origin);
512 
520  uiWindowState state() { return m_state; }
521 
527  uiWindowProps & windowProps() { return m_windowProps; }
528 
534  uiWindowStyle & windowStyle() { return m_windowStyle; }
535 
541  uiWindow * parent() { return m_parent; }
542 
548  uiWindow * parentFrame();
549 
555  Point mouseDownPos() { return m_mouseDownPos; }
556 
565  Rect transformRect(Rect const & rect, uiWindow * baseWindow);
566 
572  void repaint(Rect const & rect);
573 
577  void repaint();
578 
586  bool isMouseOver() { return m_isMouseOver; }
587 
595  void exitModal(int modalResult);
596 
604  bool hasFocus();
605 
611  uiAnchors & anchors() { return m_anchors; }
612 
618  void setFocusIndex(int value) { m_focusIndex = value; }
619 
627  int focusIndex() { return m_focusIndex; }
628 
629  Canvas * canvas() { return m_canvas; }
630 
636  void setStyleClassID(uint32_t value) { m_styleClassID = value; }
637 
643  uint32_t styleClassID() { return m_styleClassID; }
644 
652  void setParentProcessKbdEvents(bool value) { m_parentProcessKbdEvents = value; }
653 
654 
655  // Delegates
656 
662  Delegate<> onClick;
663 
670  Delegate<> onDblClick;
671 
672 
673 protected:
674 
675  void addChild(uiWindow * child);
676  void insertAfter(uiWindow * child, uiWindow * underlyingChild);
677  void freeChildren();
678  void removeChild(uiWindow * child, bool freeChild = true);
679  void moveChildOnTop(uiWindow * child);
680  void moveAfter(uiWindow * child, uiWindow * underlyingChild);
681  bool isChild(uiWindow * window);
682 
683  Size sizeAtMouseDown() { return m_sizeAtMouseDown; }
684  Point posAtMouseDown() { return m_posAtMouseDown; }
685 
686  virtual Size minWindowSize() { return Size(0, 0); }
687 
688  void beginPaint(uiEvent * paintEvent, Rect const & clippingRect);
689 
690  void generatePaintEvents(Rect const & paintRect);
691  void reshape(Rect const & r);
692 
693  bool isFocusable();
694 
695 private:
696 
697  void paintWindow();
698 
699  uiWindow * findChildWithFocusIndex(int focusIndex, int * maxIndex);
700 
701 
702  uiWindow * m_parent;
703 
704  Canvas * m_canvas;
705 
706  Point m_pos;
707  Size m_size;
708 
709  // saved screen rect before Maximize or Minimize
710  Rect m_savedScreenRect;
711 
712  uiWindowState m_state;
713 
714  uiWindowProps m_windowProps;
715 
716  uiWindowStyle m_windowStyle;
717 
718  Point m_mouseDownPos; // mouse position when mouse down event has been received
719 
720  Point m_posAtMouseDown; // used to resize
721  Size m_sizeAtMouseDown; // used to resize
722 
723  bool m_isMouseOver; // true after mouse entered, false after mouse left
724 
725  uiAnchors m_anchors;
726 
727  int16_t m_focusIndex; // -1 = doesn't partecipate to focus trip
728 
729  // double linked list, order is: bottom (first items) -> up (last items)
730  uiWindow * m_next;
731  uiWindow * m_prev;
732  uiWindow * m_firstChild;
733  uiWindow * m_lastChild;
734 
735  uint32_t m_styleClassID;
736 
737  // if true parent processes keyboard events
738  bool m_parentProcessKbdEvents;
739 };
740 
741 
742 
744 // uiFrame
745 
746 
750 struct uiFrameStyle {
751  RGB888 backgroundColor = RGB888(255, 255, 255);
752  RGB888 titleBackgroundColor = RGB888(128, 128, 128);
754  RGB888 titleColor = RGB888(0, 0, 0);
755  RGB888 activeTitleColor = RGB888(255, 255, 255);
756  FontInfo const * titleFont = &FONT_std_12;
757  RGB888 buttonColor = RGB888(64, 64, 64);
758  RGB888 activeButtonColor = RGB888(255, 255, 255);
760  RGB888 mouseOverButtonColor = RGB888(255, 255, 255);
761 };
762 
763 
767 struct uiFrameProps {
768  uint8_t resizeable : 1;
769  uint8_t moveable : 1;
770  uint8_t hasCloseButton : 1;
771  uint8_t hasMaximizeButton : 1;
772  uint8_t hasMinimizeButton : 1;
773  uint8_t fillBackground : 1;
775  uiFrameProps() :
776  resizeable(true),
777  moveable(true),
778  hasCloseButton(true),
779  hasMaximizeButton(true),
780  hasMinimizeButton(true),
781  fillBackground(true)
782  { }
783 };
784 
785 
789 enum class uiFrameItem : uint8_t {
790  None,
791  MoveArea,
792  TopLeftResize,
793  TopCenterResize,
794  TopRightResize,
795  CenterLeftResize,
796  CenterRightResize,
797  BottomLeftResize,
798  BottomCenterResize,
799  BottomRightResize,
800  CloseButton,
801  MaximizeButton,
802  MinimizeButton,
803 };
804 
805 
811 class uiFrame : public uiWindow {
812 
813 public:
814 
825  uiFrame(uiWindow * parent, char const * title, const Point & pos, const Size & size, bool visible = true, uint32_t styleClassID = 0);
826 
827  virtual ~uiFrame();
828 
829  virtual void processEvent(uiEvent * event);
830 
836  char const * title() { return m_title; }
837 
845  void setTitle(char const * value);
846 
854  void setTitleFmt(const char *format, ...);
855 
861  uiFrameStyle & frameStyle() { return m_frameStyle; }
862 
868  uiFrameProps & frameProps() { return m_frameProps; }
869 
870  Rect clientRect(uiOrigin origin);
871 
872  int getNextFreeFocusIndex() { return m_nextFreeFocusIndex++; }
873 
874 
875  // Delegates
876 
882  Delegate<> onShow;
883 
889  Delegate<> onHide;
890 
896  Delegate<> onResize;
897 
904  Delegate<uiTimerHandle> onTimer;
905 
909  Delegate<uiKeyEventInfo> onKeyDown;
910 
914  Delegate<uiKeyEventInfo> onKeyUp;
915 
919  Delegate<> onPaint;
920 
921 
922 protected:
923 
924  Size minWindowSize();
925  int titleBarHeight();
926  Rect titleBarRect();
927 
928 private:
929 
930  void paintFrame();
931  int paintButtons(Rect const & bkgRect);
932  void movingCapturedMouse(int mouseX, int mouseY, bool mouseIsDown);
933  void movingFreeMouse(int mouseX, int mouseY);
934  uiFrameItem getFrameItemAt(int x, int y);
935  Rect getBtnRect(int buttonIndex);
936  void handleButtonsClick(int x, int y, bool doubleClick);
937  void drawTextWithEllipsis(FontInfo const * fontInfo, int X, int Y, char const * text, int maxX);
938  void drawReshapingBox(Rect boxRect);
939 
940 
941  static constexpr int CORNERSENSE = 10;
942 
943 
944  uiFrameStyle m_frameStyle;
945 
946  uiFrameProps m_frameProps;
947 
948  char * m_title;
949  int m_titleLength;
950 
951  uiFrameItem m_mouseDownFrameItem; // frame item on mouse down
952  uiFrameItem m_mouseMoveFrameItem; // frame item on mouse move
953 
954  Rect m_lastReshapingBox; // last reshaping box painted by drawReshapingBox(), (0,0,0,0) if there isn't any
955 
956  int m_nextFreeFocusIndex;
957 
958 };
959 
960 
961 
963 // uiControl
964 
965 
969 class uiControl : public uiWindow {
970 
971 public:
972 
982  uiControl(uiWindow * parent, const Point & pos, const Size & size, bool visible, uint32_t styleClassID = 0);
983 
984  virtual ~uiControl();
985 
986  virtual void processEvent(uiEvent * event);
987 };
988 
989 
990 
992 // uiScrollableControl
993 
994 
1000  uint8_t scrollBarSize = 11;
1001 };
1002 
1003 
1007 enum class uiScrollBarItem {
1008  None,
1009  LeftButton,
1010  RightButton,
1011  TopButton,
1012  BottomButton,
1013  HBar,
1014  VBar,
1015  PageUp,
1016  PageDown,
1017  PageLeft,
1018  PageRight,
1019 };
1020 
1021 
1026 
1027 public:
1028 
1038  uiScrollableControl(uiWindow * parent, const Point & pos, const Size & size, bool visible = true, uint32_t styleClassID = 0);
1039 
1040  virtual ~uiScrollableControl();
1041 
1042  virtual void processEvent(uiEvent * event);
1043 
1044  Rect clientRect(uiOrigin origin);
1045 
1051  uiScrollableControlStyle & scrollableControlStyle() { return m_scrollableControlStyle; }
1052 
1061  int HScrollBarPos() { return m_HScrollBarPosition; }
1062 
1070  int HScrollBarVisible() { return m_HScrollBarVisible; }
1071 
1080  int HScrollBarRange() { return m_HScrollBarRange; }
1081 
1090  int VScrollBarPos() { return m_VScrollBarPosition; }
1091 
1099  int VScrollBarVisible() { return m_VScrollBarVisible; }
1100 
1109  int VScrollBarRange() { return m_VScrollBarRange; }
1110 
1111 
1112  // Delegates
1113 
1118 
1123 
1124 
1125 protected:
1126 
1136  virtual void setScrollBar(uiOrientation orientation, int position, int visible, int range, bool repaintScrollbar = true);
1137 
1138 
1139 private:
1140 
1141  void paintScrollableControl();
1142  void paintScrollBars();
1143  Rect getVScrollBarRects(Rect * topButton = nullptr, Rect * bottonButton = nullptr, Rect * bar = nullptr);
1144  Rect getHScrollBarRects(Rect * leftButton = nullptr, Rect * rightButton = nullptr, Rect * bar = nullptr);
1145  uiScrollBarItem getItemAt(int x, int y);
1146  void repaintScrollBar(uiOrientation orientation);
1147  void handleFreeMouseMove(int mouseX, int mouseY);
1148  void handleCapturedMouseMove(int mouseX, int mouseY);
1149  void handleButtonsScroll();
1150  void handlePageScroll();
1151 
1152  uiScrollableControlStyle m_scrollableControlStyle;
1153 
1154  int16_t m_HScrollBarPosition;
1155  int16_t m_HScrollBarVisible; // it means the "visible" area (how big is the bar)
1156  int16_t m_HScrollBarRange;
1157  int16_t m_VScrollBarPosition;
1158  int16_t m_VScrollBarVisible; // it means the "visible" area (how big is the bar)
1159  int16_t m_VScrollBarRange;
1160 
1161  // values updated by getVScrollBarRects() and getHScrollBarRects()
1162  int16_t m_HBarArea;
1163  int16_t m_VBarArea;
1164 
1165  int16_t m_mouseDownHScrollBarPosition;
1166  int16_t m_mouseDownVScrollBarPosition;
1167 
1168  uiScrollBarItem m_mouseOverItem;
1169 
1170  // a timer is active while mouse is down and the mouse is over a button
1171  uiTimerHandle m_scrollTimer;
1172 };
1173 
1174 
1175 
1177 // uiButton
1178 
1179 
1182  RGB888 backgroundColor = RGB888(128, 128, 128);
1183  RGB888 downBackgroundColor = RGB888(255, 255, 255);
1186  RGB888 textColor = RGB888(0, 0, 0);
1187  FontInfo const * textFont = &FONT_std_14;
1188  uint8_t bitmapTextSpace = 4;
1189  Bitmap const * bitmap = nullptr;
1190  Bitmap const * downBitmap = nullptr;
1191 };
1192 
1193 
1197 enum class uiButtonKind {
1198  Button,
1199  Switch,
1200 };
1201 
1202 
1204 class uiButton : public uiControl {
1205 
1206 public:
1207 
1219  uiButton(uiWindow * parent, char const * text, const Point & pos, const Size & size, uiButtonKind kind = uiButtonKind::Button, bool visible = true, uint32_t styleClassID = 0);
1220 
1221  virtual ~uiButton();
1222 
1223  virtual void processEvent(uiEvent * event);
1224 
1232  void setText(char const * value);
1233 
1239  char const * text() { return m_text; }
1240 
1246  uiButtonStyle & buttonStyle() { return m_buttonStyle; }
1247 
1255  bool down() { return m_down; }
1256 
1264  void setDown(bool value);
1265 
1266 
1267  // Delegates
1268 
1274  Delegate<> onChange;
1275 
1276 
1277 private:
1278 
1279  void paintButton();
1280  void paintContent(Rect const & rect);
1281 
1282  void trigger();
1283 
1284 
1285  uiButtonStyle m_buttonStyle;
1286 
1287  char * m_text;
1288  int m_textExtent; // calculated by setText(). TODO: changing font doesn't update m_textExtent!
1289 
1290  bool m_down;
1291 
1292  uiButtonKind m_kind;
1293 
1294 };
1295 
1296 
1297 
1299 // uiTextEdit
1300 // single line text edit
1301 
1302 
1309  RGB888 backgroundColor = RGB888(128, 128, 128);
1312  RGB888 textColor = RGB888(0, 0, 0);
1313  FontInfo const * textFont = &FONT_std_14;
1314 };
1315 
1316 
1321  uint8_t hasCaret : 1;
1322  uint8_t allowEdit : 1;
1323  uint8_t passwordMode : 1;
1325  uiTextEditProps()
1326  : hasCaret(true),
1327  allowEdit(true),
1328  passwordMode(false)
1329  {
1330  }
1331 };
1332 
1333 
1339 class uiTextEdit : public uiControl {
1340 
1341 public:
1342 
1353  uiTextEdit(uiWindow * parent, char const * text, const Point & pos, const Size & size, bool visible = true, uint32_t styleClassID = 0);
1354 
1355  virtual ~uiTextEdit();
1356 
1357  virtual void processEvent(uiEvent * event);
1358 
1364  uiTextEditStyle & textEditStyle() { return m_textEditStyle; }
1365 
1371  uiTextEditProps & textEditProps() { return m_textEditProps; }
1372 
1380  void setText(char const * value);
1381 
1387  char const * text() { return m_text; }
1388 
1389 
1390  // Delegates
1391 
1395  Delegate<> onChange;
1396 
1397 
1398 protected:
1399 
1400  virtual Rect getEditRect();
1401 
1402 private:
1403 
1404  void paintTextEdit();
1405  void paintContent();
1406 
1407  uint8_t const * getCharInfo(char ch, int * width);
1408  int charColumnToWindowX(int col);
1409  void updateCaret();
1410  void moveCursor(int col, int selCol);
1411  int getColFromMouseX(int mouseX);
1412  void handleKeyDown(uiKeyEventInfo const & key);
1413  void checkAllocatedSpace(int requiredLength);
1414  void insert(char c);
1415  void removeSel();
1416  int getWordPosAtLeft();
1417  int getWordPosAtRight();
1418  void selectWordAt(int mouseX);
1419  int keyToASCII(uiKeyEventInfo const & key);
1420 
1421 
1422  uiTextEditStyle m_textEditStyle;
1423  uiTextEditProps m_textEditProps;
1424 
1425  char * m_text;
1426  int m_textLength; // text length NOT including ending zero
1427  int m_textSpace; // actual space allocated including ending zero
1428 
1429  // rectangle where text will be painted (this is also the text clipping rect)
1430  Rect m_contentRect; // updated on painting
1431 
1432  // where text starts to be painted. Values less than m_contentRect.X1 are used to show characters which do not fit in m_contentRect
1433  int m_viewX;
1434 
1435  // character index of cursor position (0 = at first char)
1436  int m_cursorCol;
1437 
1438  // character index at start of selection (not included if < m_cursorCol, included if > m_cursorCol)
1439  int m_selCursorCol;
1440 
1441  CodePage const * m_codepage;
1442 
1443 };
1444 
1445 
1446 
1448 // uiLabel
1449 
1450 
1453  FontInfo const * textFont = &FONT_std_14;
1454  RGB888 backgroundColor = RGB888(255, 255, 255);
1455  RGB888 textColor = RGB888(0, 0, 0);
1457 };
1458 
1459 
1461 class uiLabel : public uiControl {
1462 
1463 public:
1464 
1475  uiLabel(uiWindow * parent, char const * text, const Point & pos, const Size & size = Size(0, 0), bool visible = true, uint32_t styleClassID = 0);
1476 
1477  virtual ~uiLabel();
1478 
1479  virtual void processEvent(uiEvent * event);
1480 
1488  void setText(char const * value);
1489 
1497  void setTextFmt(const char *format, ...);
1498 
1504  char const * text() { return m_text; }
1505 
1511  uiLabelStyle & labelStyle() { return m_labelStyle; }
1512 
1518  void update();
1519 
1520 
1521 private:
1522 
1523  void paintLabel();
1524 
1525 
1526  char * m_text;
1527 
1528  uiLabelStyle m_labelStyle;
1529 
1530  uint16_t m_textExtent; // calculated by setText()
1531 
1532  uint8_t m_autoSize;
1533 
1534 };
1535 
1536 
1537 
1539 // uiImage
1540 
1541 
1544  RGB888 backgroundColor = RGB888(255, 255, 255);
1545 };
1546 
1547 
1549 class uiImage : public uiControl {
1550 
1551 public:
1552 
1563  uiImage(uiWindow * parent, Bitmap const * bitmap, const Point & pos, const Size & size = Size(0, 0), bool visible = true, uint32_t styleClassID = 0);
1564 
1565  virtual ~uiImage();
1566 
1567  virtual void processEvent(uiEvent * event);
1568 
1576  void setBitmap(Bitmap const * bitmap);
1577 
1583  Bitmap const * bitmap() { return m_bitmap; }
1584 
1590  uiImageStyle & imageStyle() { return m_imageStyle; }
1591 
1592 
1593 private:
1594 
1595  void paintImage();
1596 
1597 
1598  Bitmap const * m_bitmap;
1599 
1600  uiImageStyle m_imageStyle;
1601 
1602  bool m_autoSize;
1603 
1604 };
1605 
1606 
1607 
1609 // uiPanel
1610 
1611 
1614  RGB888 backgroundColor = RGB888(128, 128, 128);
1615 };
1616 
1617 
1619 class uiPanel : public uiControl {
1620 
1621 public:
1622 
1632  uiPanel(uiWindow * parent, const Point & pos, const Size & size, bool visible = true, uint32_t styleClassID = 0);
1633 
1634  virtual ~uiPanel();
1635 
1636  virtual void processEvent(uiEvent * event);
1637 
1643  uiPanelStyle & panelStyle() { return m_panelStyle; }
1644 
1645 
1646 private:
1647 
1648  void paintPanel();
1649 
1650 
1651  uiPanelStyle m_panelStyle;
1652 };
1653 
1654 
1655 
1657 // uiPaintBox
1658 
1659 
1662  RGB888 backgroundColor = RGB888(128, 128, 128);
1663 };
1664 
1665 
1668 
1669 public:
1670 
1680  uiPaintBox(uiWindow * parent, const Point & pos, const Size & size, bool visible = true, uint32_t styleClassID = 0);
1681 
1682  virtual ~uiPaintBox();
1683 
1684  virtual void processEvent(uiEvent * event);
1685 
1691  uiPaintBoxStyle & paintBoxStyle() { return m_paintBoxStyle; }
1692 
1694 
1695  // Delegates
1696 
1702  Delegate<Rect> onPaint;
1703 
1704 
1705 private:
1706 
1707  void paintPaintBox();
1708 
1709 
1710  uiPaintBoxStyle m_paintBoxStyle;
1711 };
1712 
1713 
1714 
1716 // uiColorBox
1717 
1719 class uiColorBox : public uiControl {
1720 
1721 public:
1722 
1733  uiColorBox(uiWindow * parent, const Point & pos, const Size & size, Color color = Color::BrightWhite, bool visible = true, uint32_t styleClassID = 0);
1734 
1735  virtual ~uiColorBox();
1736 
1737  virtual void processEvent(uiEvent * event);
1738 
1744  Color color() { return m_color; }
1745 
1751  void setColor(Color value);
1752 
1753 private:
1754 
1755  void paintColorBox();
1756 
1757 
1758  Color m_color;
1759 };
1760 
1761 
1762 
1764 // uiCustomListBox
1765 
1766 
1769  RGB888 backgroundColor = RGB888(128, 128, 128);
1773  int itemHeight = 16;
1774  FontInfo const * textFont = &FONT_std_14;
1775  RGB888 textColor = RGB888(0, 0, 0);
1776  RGB888 selectedTextColor = RGB888(255, 255, 255);
1777 };
1778 
1779 
1784  uint8_t allowMultiSelect : 1;
1785  uint8_t selectOnMouseOver : 1;
1787  uiListBoxProps()
1788  : allowMultiSelect(true),
1789  selectOnMouseOver(false)
1790  {
1791  }
1792 };
1793 
1794 
1797 
1798 public:
1799 
1809  uiCustomListBox(uiWindow * parent, const Point & pos, const Size & size, bool visible = true, uint32_t styleClassID = 0);
1810 
1811  virtual ~uiCustomListBox();
1812 
1813  virtual void processEvent(uiEvent * event);
1814 
1820  uiListBoxStyle & listBoxStyle() { return m_listBoxStyle; }
1821 
1827  uiListBoxProps & listBoxProps() { return m_listBoxProps; }
1828 
1834  int firstSelectedItem();
1835 
1841  int lastSelectedItem();
1842 
1850  void selectItem(int index, bool add = false, bool range = false);
1851 
1855  void deselectAll();
1856 
1857 
1858  // Delegates
1859 
1865  Delegate<> onChange;
1866 
1870  Delegate<> onKillFocus;
1871 
1875  Delegate<uiKeyEventInfo> onKeyUp;
1876 
1877 
1878 protected:
1879 
1880  void setScrollBar(uiOrientation orientation, int position, int visible, int range, bool repaintScrollbar);
1881 
1882  // must be implemented by inherited class
1883  virtual int items_getCount() = 0;
1884  virtual void items_deselectAll() = 0;
1885  virtual void items_select(int index, bool select) = 0;
1886  virtual bool items_selected(int index) = 0;
1887  virtual void items_draw(int index, const Rect & itemRect) = 0;
1888 
1889 private:
1890 
1891  void paintListBox();
1892  int getItemAtMousePos(int mouseX, int mouseY);
1893  void mouseDownSelect(int mouseX, int mouseY);
1894  void mouseMoveSelect(int mouseX, int mouseY);
1895  void handleKeyDown(uiKeyEventInfo key);
1896  void makeItemVisible(int index);
1897 
1898 
1899  uiListBoxStyle m_listBoxStyle;
1900  uiListBoxProps m_listBoxProps;
1901  int m_firstVisibleItem; // the item on the top
1902 };
1903 
1904 
1905 
1907 // uiListBox
1908 
1909 
1911 class uiListBox : public uiCustomListBox {
1912 
1913 public:
1914 
1924  uiListBox(uiWindow * parent, const Point & pos, const Size & size, bool visible = true, uint32_t styleClassID = 0);
1925 
1934  StringList & items() { return m_items; }
1935 
1936 protected:
1937 
1938  virtual int items_getCount() { return m_items.count(); }
1939  virtual void items_deselectAll() { m_items.deselectAll(); }
1940  virtual void items_select(int index, bool select) { m_items.select(index, select); }
1941  virtual bool items_selected(int index) { return m_items.selected(index); }
1942  virtual void items_draw(int index, const Rect & itemRect);
1943 
1944 
1945 private:
1946 
1947  StringList m_items;
1948 };
1949 
1950 
1952 // uiFileBrowser
1953 
1956 
1957 public:
1958 
1968  uiFileBrowser(uiWindow * parent, const Point & pos, const Size & size, bool visible = true, uint32_t styleClassID = 0);
1969 
1977  void setDirectory(char const * path);
1978 
1986  void changeDirectory(char const * path);
1987 
1993  char const * directory() { return m_dir.directory(); }
1994 
2000  int count() { return m_dir.count(); }
2001 
2007  char const * filename();
2008 
2014  bool isDirectory();
2015 
2016  void processEvent(uiEvent * event);
2017 
2021  void update();
2022 
2028  FileBrowser & content() { return m_dir; }
2029 
2030 
2031 protected:
2032 
2033  virtual int items_getCount() { return m_dir.count(); }
2034  virtual void items_deselectAll() { m_selected = -1; }
2035  virtual void items_select(int index, bool select);
2036  virtual bool items_selected(int index) { return index == m_selected; }
2037  virtual void items_draw(int index, const Rect & itemRect);
2038 
2039 private:
2040 
2041  void enterSubDir();
2042 
2043  FileBrowser m_dir;
2044  int m_selected; // -1 = no sel
2045 
2046 };
2047 
2048 
2050 // uiColorListBox
2051 
2054 
2055 public:
2056 
2066  uiColorListBox(uiWindow * parent, const Point & pos, const Size & size, bool visible = true, uint32_t styleClassID = 0);
2067 
2073  Color color();
2074 
2075 
2076 protected:
2077 
2078  virtual int items_getCount() { return 16; }
2079  virtual void items_deselectAll() { }
2080  virtual void items_select(int index, bool select) { if (select) m_selectedColor = (Color)index; }
2081  virtual bool items_selected(int index) { return index == (int)m_selectedColor; }
2082  virtual void items_draw(int index, const Rect & itemRect);
2083 
2084 
2085 private:
2086 
2087  Color m_selectedColor;
2088 };
2089 
2090 
2091 
2093 // uiCustomComboBox
2094 
2095 
2099  RGB888 buttonColor = RGB888(128, 128, 128);
2100 };
2101 
2102 
2105  uint8_t openOnFocus : 1;
2107  uiComboBoxProps()
2108  : openOnFocus(true)
2109  {
2110  }
2111 };
2112 
2113 
2116 {
2117 
2118 public:
2119 
2130  uiCustomComboBox(uiWindow * parent, const Point & pos, const Size & size, int listHeight, bool visible, uint32_t styleClassID);
2131 
2132  ~uiCustomComboBox();
2133 
2134  virtual void processEvent(uiEvent * event);
2135 
2141  uiComboBoxStyle & comboBoxStyle() { return m_comboBoxStyle; }
2142 
2148  uiListBoxStyle & listBoxStyle() { return listbox()->listBoxStyle(); }
2149 
2155  uiComboBoxProps & comboBoxProps() { return m_comboBoxProps; }
2156 
2162  int selectedItem() { return listbox()->firstSelectedItem(); }
2163 
2169  void selectItem(int index);
2170 
2171 
2172  // Delegates
2173 
2179  Delegate<> onChange;
2180 
2181 
2182 protected:
2183 
2184  virtual uiCustomListBox * listbox() = 0;
2185  virtual uiControl * editcontrol() = 0;
2186  virtual void updateEditControl() = 0;
2187 
2188  Size getEditControlSize();
2189 
2190 private:
2191 
2192  void paintComboBox();
2193  Rect getButtonRect();
2194  void openListBox();
2195  void closeListBox();
2196  void switchListBox();
2197  int buttonWidth();
2198 
2199 
2200  int m_listHeight;
2201  uiComboBoxStyle m_comboBoxStyle;
2202  uiComboBoxProps m_comboBoxProps;
2203 };
2204 
2205 
2206 
2207 
2209 // uiComboBox
2210 
2211 
2214 {
2215 
2216 public:
2217 
2228  uiComboBox(uiWindow * parent, const Point & pos, const Size & size, int listHeight, bool visible = true, uint32_t styleClassID = 0);
2229 
2230  ~uiComboBox();
2231 
2239  StringList & items() { return m_listBox->items(); }
2240 
2246  uiTextEditStyle & textEditStyle() { return m_textEdit->textEditStyle(); }
2247 
2253  uiTextEditProps & textEditProps() { return m_textEdit->textEditProps(); }
2254 
2262  void setText(char const * value) { m_textEdit->setText(value); }
2263 
2269  char const * text() { return m_textEdit->text(); }
2270 
2271 
2272 protected:
2273 
2274  uiCustomListBox * listbox() { return m_listBox; }
2275  uiControl * editcontrol() { return m_textEdit; }
2276  void updateEditControl();
2277 
2278 private:
2279  uiTextEdit * m_textEdit;
2280  uiListBox * m_listBox;
2281 
2282 };
2283 
2284 
2285 
2287 // uiColorComboBox
2288 
2289 
2292 {
2293 
2294 public:
2295 
2306  uiColorComboBox(uiWindow * parent, const Point & pos, const Size & size, int listHeight, bool visible = true, uint32_t styleClassID = 0);
2307 
2308  ~uiColorComboBox();
2309 
2315  void selectColor(Color value) { selectItem((int)value); }
2316 
2323 
2324 
2325 protected:
2326 
2327  uiCustomListBox * listbox() { return m_colorListBox; }
2328  uiControl * editcontrol() { return m_colorBox; }
2329  void updateEditControl();
2330 
2331 private:
2332  uiColorBox * m_colorBox;
2333  uiColorListBox * m_colorListBox;
2334 
2335 };
2336 
2337 
2338 
2340 // uiCheckBox
2341 
2342 
2345  RGB888 backgroundColor = RGB888(128, 128, 128);
2349 };
2350 
2351 
2355 enum class uiCheckBoxKind : int8_t {
2356  CheckBox,
2357  RadioButton,
2358 };
2359 
2360 
2367 class uiCheckBox : public uiControl {
2368 
2369 public:
2370 
2381  uiCheckBox(uiWindow * parent, const Point & pos, const Size & size, uiCheckBoxKind kind = uiCheckBoxKind::CheckBox, bool visible = true, uint32_t styleClassID = 0);
2382 
2383  virtual ~uiCheckBox();
2384 
2385  virtual void processEvent(uiEvent * event);
2386 
2392  uiCheckBoxStyle & checkBoxStyle() { return m_checkBoxStyle; }
2393 
2399  bool checked() { return m_checked; }
2400 
2408  void setChecked(bool value);
2409 
2415  int groupIndex() { return m_groupIndex; }
2416 
2422  void setGroupIndex(int value) { m_groupIndex = value; }
2423 
2424 
2425  // Delegates
2426 
2432  Delegate<> onChange;
2433 
2434 
2435 private:
2436 
2437  void paintCheckBox();
2438  void trigger();
2439  void unCheckGroup();
2440 
2441 
2442  uiCheckBoxStyle m_checkBoxStyle;
2443  bool m_checked;
2444  uiCheckBoxKind m_kind;
2445  int16_t m_groupIndex; // -1 = no group
2446 
2447 };
2448 
2449 
2450 
2452 // uiSlider
2453 
2454 
2457  RGB888 backgroundColor = RGB888(255, 255, 255);
2458  RGB888 slideColor = RGB888(0, 128, 128);
2459  RGB888 rangeColor = RGB888(0, 128, 255);
2460  RGB888 gripColor = RGB888(0, 0, 255);
2461  RGB888 ticksColor = RGB888(255, 255, 255);
2462 };
2463 
2464 
2466 class uiSlider : public uiControl {
2467 
2468 public:
2469 
2480  uiSlider(uiWindow * parent, const Point & pos, const Size & size, uiOrientation orientation, bool visible = true, uint32_t styleClassID = 0);
2481 
2482  virtual ~uiSlider();
2483 
2484  virtual void processEvent(uiEvent * event);
2485 
2491  uiSliderStyle & sliderStyle() { return m_sliderStyle; }
2492 
2498  int position() { return m_position; }
2499 
2505  void setPosition(int value);
2506 
2512  int min() { return m_min; }
2513 
2519  int max() { return m_max; }
2520 
2528  void setup(int min, int max, int ticksFrequency);
2529 
2530 
2536  Delegate<> onChange;
2537 
2538 
2539 private:
2540 
2541  void paintSlider();
2542  Rect getGripRect();
2543  void moveGripTo(int x, int y);
2544  void handleKeyDown(uiKeyEventInfo key);
2545 
2546 
2547  uiSliderStyle m_sliderStyle;
2548  uiOrientation m_orientation;
2549 
2550  int16_t m_position;
2551  int16_t m_min;
2552  int16_t m_max;
2553  int16_t m_ticksFrequency;
2554 };
2555 
2556 
2557 
2559 // uiProgressBar
2560 
2561 
2564  RGB888 backgroundColor = RGB888(128, 128, 128);
2565  RGB888 foregroundColor = RGB888(64, 128, 64);
2566  FontInfo const * textFont = &FONT_std_14;
2567  RGB888 textColor = RGB888(255, 255, 255);
2568 };
2569 
2570 
2573  uint8_t showPercentage : 1;
2576  : showPercentage(true)
2577  {
2578  }
2579 };
2580 
2581 
2583 class uiProgressBar : public uiControl {
2584 
2585 public:
2586 
2596  uiProgressBar(uiWindow * parent, const Point & pos, const Size & size, bool visible = true, uint32_t styleClassID = 0);
2597 
2598  virtual ~uiProgressBar();
2599 
2600  virtual void processEvent(uiEvent * event);
2601 
2607  uiProgressBarStyle & progressBarStyle() { return m_progressBarStyle; }
2608 
2614  uiProgressBarProps & progressBarProps() { return m_progressBarProps; }
2615 
2621  void setPercentage(int value);
2622 
2623 
2624 private:
2625 
2626  void paintProgressBar();
2627 
2628 
2629  uiProgressBarStyle m_progressBarStyle;
2630  uiProgressBarProps m_progressBarProps;
2631 
2632  int m_percentage;
2633 };
2634 
2635 
2636 
2638 // uiStyle
2639 
2640 struct uiStyle {
2641  virtual void setStyle(uiObject * object, uint32_t styleClassID) = 0;
2642 };
2643 
2644 
2645 
2647 // uiApp
2648 
2649 
2651 struct uiAppProps {
2652  uint16_t caretBlinkingTime = 500;
2653  uint16_t doubleClickTime = 250;
2654  bool realtimeReshaping = false;
2655 };
2656 
2657 
2662  Cancel,
2663  Button1,
2664  Button2,
2665  Button3,
2666 };
2667 
2668 
2672 enum class uiMessageBoxIcon {
2673  None,
2674  Question,
2675  Info,
2676  Warning,
2677  Error,
2678 };
2679 
2680 
2681 struct ModalWindowState {
2682  uiWindow * window;
2683  uiWindow * prevFocusedWindow;
2684  uiWindow * prevActiveWindow;
2685  uiWindow * prevModal;
2686  int modalResult;
2687 };
2688 
2689 
2690 typedef pair<uiEvtHandler *, TimerHandle_t> uiTimerAssoc;
2691 
2692 
2693 class Keyboard;
2694 class Mouse;
2695 
2696 
2703 class uiApp : public uiEvtHandler {
2704 
2705 public:
2706 
2707  uiApp();
2708 
2709  virtual ~uiApp();
2710 
2720  int run(BitmappedDisplayController * displayController, Keyboard * keyboard = nullptr, Mouse * mouse = nullptr);
2721 
2732  void runAsync(BitmappedDisplayController * displayController, int taskStack = 3000, Keyboard * keyboard = nullptr, Mouse * mouse = nullptr);
2733 
2739  void quit(int exitCode);
2740 
2748  bool postEvent(uiEvent const * event);
2749 
2757  bool insertEvent(uiEvent const * event);
2758 
2759  void postDebugMsg(char const * msg);
2760 
2761  virtual void processEvent(uiEvent * event);
2762 
2768  void processEvents();
2769 
2778  uiFrame * rootWindow() { return m_rootWindow; }
2779 
2788  uiWindow * activeWindow() { return m_activeWindow; }
2789 
2799  uiWindow * setActiveWindow(uiWindow * value);
2800 
2813  uiWindow * focusedWindow() { return m_focusedWindow; }
2814 
2825  uiWindow * setFocusedWindow(uiWindow * value);
2826 
2837  uiWindow * moveFocus(int delta);
2838 
2839  void captureMouse(uiWindow * window);
2840 
2848  uiWindow * capturedMouseWindow() { return m_capturedMouseWindow; }
2849 
2855  void repaintWindow(uiWindow * window);
2856 
2862  void repaintRect(Rect const & rect);
2863 
2871  void moveWindow(uiWindow * window, int x, int y);
2872 
2880  void resizeWindow(uiWindow * window, int width, int height);
2881 
2888  void resizeWindow(uiWindow * window, Size size);
2889 
2896  void reshapeWindow(uiWindow * window, Rect const & rect);
2897 
2905  uiWindow * screenToWindow(Point & point);
2906 
2913  void showWindow(uiWindow * window, bool value);
2914 
2926  int showModalWindow(uiWindow * window);
2927 
2937  ModalWindowState * initModalWindow(uiWindow * window);
2938 
2949  bool processModalWindowEvents(ModalWindowState * state, int timeout);
2950 
2961  int endModalWindow(ModalWindowState * state);
2962 
2969  void maximizeWindow(uiWindow * window, bool value);
2970 
2977  void minimizeWindow(uiWindow * window, bool value);
2978 
2979  void combineMouseMoveEvents(bool value) { m_combineMouseMoveEvents = value; }
2980 
2981  void showCaret(uiWindow * window);
2982 
2983  void setCaret(bool value);
2984 
2985  void setCaret(Point const & pos);
2986 
2987  void setCaret(Rect const & rect);
2988 
3000  uiTimerHandle setTimer(uiEvtHandler * dest, int periodMS);
3001 
3009  void killTimer(uiTimerHandle handle);
3010 
3011  void killEvtHandlerTimers(uiEvtHandler * dest);
3012 
3018  uiAppProps & appProps() { return m_appProps; }
3019 
3025  void destroyWindow(uiWindow * window);
3026 
3027  void cleanWindowReferences(uiWindow * window);
3028 
3036  void enableKeyboardAndMouseEvents(bool value);
3037 
3050  uiMessageBoxResult messageBox(char const * title, char const * text, char const * button1Text, char const * button2Text = nullptr, char const * button3Text = nullptr, uiMessageBoxIcon icon = uiMessageBoxIcon::Question);
3051 
3067  uiMessageBoxResult inputBox(char const * title, char const * text, char * inOutString, int maxLength, char const * button1Text, char const * button2Text = nullptr);
3068 
3072  virtual void init();
3073 
3079  void setStyle(uiStyle * value) { m_style = value; }
3080 
3086  uiStyle * style() { return m_style; }
3087 
3088  Keyboard * keyboard() { return m_keyboard; }
3089 
3090  Mouse * mouse() { return m_mouse; }
3091 
3092  BitmappedDisplayController * displayController() { return m_displayController; }
3093 
3094  Canvas * canvas() { return m_canvas; }
3095 
3101  int lastUserActionTime() { return m_lastUserActionTimeMS; }
3102 
3103 
3104  // delegates
3105 
3112  Delegate<uiTimerHandle> onTimer;
3113 
3114 
3115 protected:
3116 
3117  bool getEvent(uiEvent * event, int timeOutMS);
3118  bool peekEvent(uiEvent * event, int timeOutMS);
3119 
3120 
3121 private:
3122 
3123  void preprocessEvent(uiEvent * event);
3124  void preprocessMouseEvent(uiEvent * event);
3125  void preprocessKeyboardEvent(uiEvent * event);
3126  void filterModalEvent(uiEvent * event);
3127 
3128  static void timerFunc(TimerHandle_t xTimer);
3129 
3130  static void asyncRunTask(void * arg);
3131 
3132  void blinkCaret(bool forceOFF = false);
3133  void suspendCaret(bool value);
3134 
3135 
3136  BitmappedDisplayController * m_displayController;
3137 
3138  Canvas * m_canvas;
3139 
3140  Keyboard * m_keyboard;
3141 
3142  Mouse * m_mouse;
3143 
3144  uiAppProps m_appProps;
3145 
3146  QueueHandle_t m_eventsQueue;
3147 
3148  uiFrame * m_rootWindow;
3149 
3150  uiWindow * m_activeWindow; // foreground window. Also gets keyboard events (other than focused window)
3151 
3152  uiWindow * m_focusedWindow; // window that captures keyboard events (other than active window)
3153 
3154  uiWindow * m_capturedMouseWindow; // window that has captured mouse
3155 
3156  uiWindow * m_freeMouseWindow; // window where mouse is over
3157 
3158  uiWindow * m_modalWindow; // current modal window
3159 
3160  bool m_combineMouseMoveEvents;
3161 
3162  uiWindow * m_caretWindow; // nullptr = caret is not visible
3163  Rect m_caretRect; // caret rect relative to m_caretWindow
3164  uiTimerHandle m_caretTimer;
3165  int m_caretInvertState; // -1 = suspended, 1 = rect reversed (cat visible), 0 = rect not reversed (caret invisible)
3166 
3167  int m_lastMouseUpTimeMS; // time (MS) at mouse up. Used to measure double clicks
3168  Point m_lastMouseUpPos; // screen position of last mouse up
3169 
3170  uiStyle * m_style;
3171 
3172  int m_lastUserActionTimeMS; // time when last user action (mouse/keyboard) has been received, measured in milliseconds since boot
3173 
3174  // associates event handler with FreeRTOS timer
3175  list<uiTimerAssoc> m_timers;
3176 };
3177 
3178 
3179 
3180 
3181 } // end of namespace
3182 
3183 
3184 
Represents a 24 bit RGB color.
uiLabelStyle & labelStyle()
Sets or gets label style.
Definition: fabui.h:1511
uiWindow * setActiveWindow(uiWindow *value)
Sets the active window.
Definition: fabui.cpp:589
uiWindowStyle & windowStyle()
Sets or gets window style.
Definition: fabui.h:534
RGB888 selectedTextColor
Definition: fabui.h:1776
void selectItem(int index, bool add=false, bool range=false)
Selects a listbox item.
Definition: fabui.cpp:3783
Delegate onChange
Change event delegate.
Definition: fabui.h:2179
uiTextEditStyle & textEditStyle()
Sets or gets text edit style.
Definition: fabui.h:2246
bool down()
Determines whether the switch button is down or up.
Definition: fabui.h:1255
int selectedItem()
Represents currently selected item.
Definition: fabui.h:2162
A class with a set of drawing methods.
Definition: canvas.h:70
uiComboBoxStyle & comboBoxStyle()
Sets or gets combobox style.
Definition: fabui.h:2141
Delegate onDblClick
Mouse double click event delegate.
Definition: fabui.h:670
Shows a list of 16 colors, one selectable.
Definition: fabui.h:2053
Delegate onChangeVScrollBar
Vertical scrollbar change event delegate.
Definition: fabui.h:1122
uint8_t borderSize
Definition: fabui.h:367
A frame is a window with a title bar, maximize/minimize/close buttons and that is resizeable or movea...
Definition: fabui.h:811
uint8_t left
Definition: fabui.h:374
int lastSelectedItem()
Gets the last selected item.
Definition: fabui.cpp:3891
Contains details about the key event.
Definition: fabui.h:153
Rect rect(uiOrigin origin)
Determines the window bounding box.
Definition: fabui.cpp:1403
ModalWindowState * initModalWindow(uiWindow *window)
Begins modal window processing.
Definition: fabui.cpp:755
uiTextEditStyle & textEditStyle()
Sets or gets text edit style.
Definition: fabui.h:1364
uiTextEdit(uiWindow *parent, char const *text, const Point &pos, const Size &size, bool visible=true, uint32_t styleClassID=0)
Creates an instance of the object.
Definition: fabui.cpp:2515
Bitmap const * bitmap
Definition: fabui.h:1189
uiOrientation
Item direction/orientation.
Definition: fabui.h:216
void setScrollBar(uiOrientation orientation, int position, int visible, int range, bool repaintScrollbar)
Sets scrollbar position, visible portion and range.
Definition: fabui.cpp:3900
int firstSelectedItem()
Gets the first selected item.
Definition: fabui.cpp:3881
Represents the whole application base class.
Definition: fabui.h:2703
char const * text()
Determines button text.
Definition: fabui.h:1239
uiMessageBoxResult messageBox(char const *title, char const *text, char const *button1Text, char const *button2Text=nullptr, char const *button3Text=nullptr, uiMessageBoxIcon icon=uiMessageBoxIcon::Question)
Displays a modal dialog box with an icon, text and some buttons.
Definition: fabui.cpp:993
bool insertEvent(uiEvent const *event)
Inserts (first position) an event in the event queue and returns without waiting for the receiver to ...
Definition: fabui.cpp:542
RGB888 downBackgroundColor
Definition: fabui.h:1183
uint8_t activable
Definition: fabui.h:351
This is a combination of a listbox and another component, base of all combobox components.
Definition: fabui.h:2115
uiStyle * style()
Gets current application controls style.
Definition: fabui.h:3086
A scrollable control is a control with optionally vertical and/or horizontal scrollbars.
Definition: fabui.h:1025
void setText(char const *value)
Sets label text.
Definition: fabui.cpp:3001
int lastUserActionTime()
Returns time when last user action (mouse/keyboard) has been received, measured in milliseconds since...
Definition: fabui.h:3101
char const * text()
Gets current content of the text edit.
Definition: fabui.h:1387
VirtualKey VK
Definition: fabui.h:154
void selectItem(int index)
Selects an item.
Definition: fabui.cpp:4173
Base class for all visible UI elements (Frames and Controls)
Definition: fabui.h:387
void update()
Reloads current directory content and repaints.
Definition: fabui.cpp:4105
FileBrowser & content()
Contains current directory representation.
Definition: fabui.h:2028
int run(BitmappedDisplayController *displayController, Keyboard *keyboard=nullptr, Mouse *mouse=nullptr)
Initializes application and executes the main event loop.
Definition: fabui.cpp:200
char const * directory()
Determines current directory.
Definition: fabui.h:1993
void setup(int min, int max, int ticksFrequency)
Sets minimum, maximum position and ticks frequency.
Definition: fabui.cpp:4598
A color box is a control that shows a single color.
Definition: fabui.h:1719
void setParentProcessKbdEvents(bool value)
Enables a child window to send keyboard events to its parent.
Definition: fabui.h:652
uiColorBox(uiWindow *parent, const Point &pos, const Size &size, Color color=Color::BrightWhite, bool visible=true, uint32_t styleClassID=0)
Creates an instance of the object.
Definition: fabui.cpp:3271
RGB888 mouseOverScrollBarForegroundColor
Definition: fabui.h:999
uiColorComboBox(uiWindow *parent, const Point &pos, const Size &size, int listHeight, bool visible=true, uint32_t styleClassID=0)
Creates an instance of the object.
Definition: fabui.cpp:4380
FontInfo const * textFont
Definition: fabui.h:1774
Shows a list of selectable string items.
Definition: fabui.h:1911
uiListBoxProps & listBoxProps()
Sets or gets list box properties.
Definition: fabui.h:1827
Bitmap const * bitmap()
Gets image bitmap.
Definition: fabui.h:1583
int16_t Y
void bringAfter(uiWindow *insertionPoint)
Brings this window after another one.
Definition: fabui.cpp:1364
RGB888 mouseDownBackgroundColor
Definition: fabui.h:1185
Size size()
Determines the window size.
Definition: fabui.h:484
RGB888 mouseOverBackgroundButtonColor
Definition: fabui.h:759
uiPanelStyle & panelStyle()
Sets or gets panel style.
Definition: fabui.h:1643
virtual void init()
Method to inherit to implement an application.
Definition: fabui.cpp:531
Contains the listbox style.
Definition: fabui.h:1768
RGB888 buttonColor
Definition: fabui.h:757
Contains the slider style.
Definition: fabui.h:2456
uiWindow * parent()
Determines the parent window.
Definition: fabui.h:541
uint16_t doubleClickTime
Definition: fabui.h:2653
void setFocusIndex(int value)
Sets the focus index (aka tab-index)
Definition: fabui.h:618
int count()
Determines number of files in current directory.
Definition: fabui.h:2000
uint8_t visible
Definition: fabui.h:342
uiAppProps & appProps()
Sets or gets application properties.
Definition: fabui.h:3018
uiImage(uiWindow *parent, Bitmap const *bitmap, const Point &pos, const Size &size=Size(0, 0), bool visible=true, uint32_t styleClassID=0)
Creates an instance of the object.
Definition: fabui.cpp:3089
RGB888 mouseOverBackgroundColor
Definition: fabui.h:1184
This file contains fabgl::BitmappedDisplayController definition.
Base class of all UI elements that can receive events.
Definition: fabui.h:297
Sets or gets text edit style.
Definition: fabui.h:1308
void quit(int exitCode)
Terminates application and free resources.
Definition: fabui.cpp:339
uint8_t active
Definition: fabui.h:345
Contains the paintbox style.
Definition: fabui.h:1661
Color
This enum defines named colors.
uiLabel(uiWindow *parent, char const *text, const Point &pos, const Size &size=Size(0, 0), bool visible=true, uint32_t styleClassID=0)
Creates an instance of the object.
Definition: fabui.cpp:2976
FontInfo const * textFont
Definition: fabui.h:1187
uiButton(uiWindow *parent, char const *text, const Point &pos, const Size &size, uiButtonKind kind=uiButtonKind::Button, bool visible=true, uint32_t styleClassID=0)
Creates an instance of the object.
Definition: fabui.cpp:2366
uiColorListBox(uiWindow *parent, const Point &pos, const Size &size, bool visible=true, uint32_t styleClassID=0)
Creates an instance of the object.
Definition: fabui.cpp:4000
int showModalWindow(uiWindow *window)
Makes a window visible and handles it has a modal window.
Definition: fabui.cpp:815
Properties of the combobox.
Definition: fabui.h:2104
int position()
Determines slider position.
Definition: fabui.h:2498
uiProgressBarProps & progressBarProps()
Sets or gets progress bar properties.
Definition: fabui.h:2614
The PS2 Keyboard controller class.
Definition: keyboard.h:77
Represents the base abstract class for bitmapped display controllers.
Delegate onClick
Mouse click event delegate.
Definition: fabui.h:662
Color color()
Currently selected color.
This file contains fabgl::Canvas definition.
Size clientSize()
Determines the client area size.
Definition: fabui.cpp:1426
uiWindow * lastChild()
Gets last child.
Definition: fabui.h:440
A panel is used to contain and to group some controls.
Definition: fabui.h:1619
RGB888 backgroundColor
Definition: fabui.h:1662
Represents a checkbox or a radiobutton.
Definition: fabui.h:2367
VirtualKey
Represents each possible real or derived (SHIFT + real) key.
Definition: fabutils.h:1016
void moveWindow(uiWindow *window, int x, int y)
Moves a window.
Definition: fabui.cpp:720
void destroyWindow(uiWindow *window)
Destroys a window.
Definition: fabui.cpp:954
uint16_t caretBlinkingTime
Definition: fabui.h:2652
Delegate onResize
Resize window event delegate.
Definition: fabui.h:896
Contains the progress bar style.
Definition: fabui.h:2563
uiButtonStyle & buttonStyle()
Sets or gets button style.
Definition: fabui.h:1246
uiCheckBoxKind
Specifies the combobox behaviour.
Definition: fabui.h:2355
uint8_t bottom
Definition: fabui.h:377
void setTitleFmt(const char *format,...)
Sets window title as formatted text.
Definition: fabui.cpp:1812
Delegate onChangeHScrollBar
Horizontal scrollbar change event delegate.
Definition: fabui.h:1117
Color selectedColor()
Determines current selected color.
Definition: fabui.h:2322
void update()
Updates the label content.
Definition: fabui.cpp:3026
void setColor(Color value)
Sets current colorbox color.
Definition: fabui.cpp:3291
uiWindowProps & windowProps()
Sets or gets window properties.
Definition: fabui.h:527
Properties of the application.
Definition: fabui.h:2651
int VScrollBarRange()
Determines vertical scrollbar range.
Definition: fabui.h:1109
void setTextFmt(const char *format,...)
Sets label formatted text.
Definition: fabui.cpp:3010
Contains the scrollable control style.
Definition: fabui.h:996
uiCustomComboBox(uiWindow *parent, const Point &pos, const Size &size, int listHeight, bool visible, uint32_t styleClassID)
Creates an instance of the object.
Definition: fabui.cpp:4152
RGB888 backgroundColor
Definition: fabui.h:1614
Represents a button control. A button can have text and optionally a bitmap.
Definition: fabui.h:1204
uint8_t moveable
Definition: fabui.h:769
void setStyle(uiStyle *value)
Sets application controls style.
Definition: fabui.h:3079
Point mouseDownPos()
Determines mouse position when left button was down.
Definition: fabui.h:555
bool processModalWindowEvents(ModalWindowState *state, int timeout)
Processes all messages from modal window.
Definition: fabui.cpp:773
RGB888 focusedSelectedBackgroundColor
Definition: fabui.h:1772
int VScrollBarVisible()
Determines vertical scrollbar visible portion (aka thumb size) of the scrollable content.
Definition: fabui.h:1099
This file contains codepages declarations.
uiButtonKind
Specifies the button kind.
Definition: fabui.h:1197
Delegate< Rect > onPaint
Paint event delegate.
Definition: fabui.h:1702
uiWindow * parentFrame()
Determines the parent frame.
Definition: fabui.cpp:1764
Contains the label style.
Definition: fabui.h:1452
uiMessageBoxResult inputBox(char const *title, char const *text, char *inOutString, int maxLength, char const *button1Text, char const *button2Text=nullptr)
Displays a modal dialog box with a text, a text edit and up to two buttons.
Definition: fabui.cpp:1092
Describes mouse absolute position, scroll wheel delta and buttons status.
Definition: fabutils.h:276
void deselectAll()
Deselects all selected items.
Definition: fabui.cpp:3823
uiFrameProps & frameProps()
Sets or gets frame properties.
Definition: fabui.h:868
Delegate onChange
Change event delegate.
Definition: fabui.h:1865
uiCustomListBox(uiWindow *parent, const Point &pos, const Size &size, bool visible=true, uint32_t styleClassID=0)
Creates an instance of the object.
Definition: fabui.cpp:3679
uint8_t focusable
Definition: fabui.h:352
uiTextEditProps & textEditProps()
Sets or gets text edit properties.
Definition: fabui.h:2253
RGB888 buttonBackgroundColor
Definition: fabui.h:2098
int groupIndex()
Determines radiobutton group index.
Definition: fabui.h:2415
uiFrameStyle & frameStyle()
Sets or gets frame style.
Definition: fabui.h:861
uiListBoxStyle & listBoxStyle()
Sets or gets listbox style.
Definition: fabui.h:2148
RGB888 activeBorderColor
Definition: fabui.h:365
Represents the coordinate of a point.
Definition: fabutils.h:190
Represents an image.
uiAnchors & anchors()
Allows to switch on or off anchors.
Definition: fabui.h:611
Contains the window style.
Definition: fabui.h:362
Properties of the frame.
Definition: fabui.h:767
void setPosition(int value)
Sets the slider position.
Definition: fabui.cpp:4588
This is a combination of a color listbox and a colorbox.
Definition: fabui.h:2291
This file contains some utility classes and functions.
uint8_t right
Definition: fabui.h:376
Delegate< uiTimerHandle > onTimer
Timer event delegate.
Definition: fabui.h:904
RGB888 mouseOverBackgroundColor
Definition: fabui.h:2347
uiSliderStyle & sliderStyle()
Sets or gets slider style.
Definition: fabui.h:2491
uiSlider(uiWindow *parent, const Point &pos, const Size &size, uiOrientation orientation, bool visible=true, uint32_t styleClassID=0)
Creates an instance of the object.
Definition: fabui.cpp:4562
uiPaintBoxStyle & paintBoxStyle()
Sets or gets paintbox style.
Definition: fabui.h:1691
uiFrame(uiWindow *parent, char const *title, const Point &pos, const Size &size, bool visible=true, uint32_t styleClassID=0)
Creates an instance of the object.
Definition: fabui.cpp:1782
Definition: canvas.cpp:36
uiControl(uiWindow *parent, const Point &pos, const Size &size, bool visible, uint32_t styleClassID=0)
Creates an instance of the object.
Definition: fabui.cpp:2334
uiOrigin
Specifies window rectangle origin.
Definition: fabui.h:333
uint8_t top
Definition: fabui.h:375
Rect transformRect(Rect const &rect, uiWindow *baseWindow)
Transforms rectangle origins from current window to another one.
Definition: fabui.cpp:1381
Rect clientRect(uiOrigin origin)
Determines the client area bounding box.
Definition: fabui.cpp:3660
Specifies the object type.
Definition: fabui.h:238
MouseStatus status
Definition: fabui.h:166
Contains some window options.
Definition: fabui.h:350
uint8_t minimized
Definition: fabui.h:344
Color color()
Gets current colorbox color.
Definition: fabui.h:1744
uiScrollableControlStyle & scrollableControlStyle()
Sets or gets control style.
Definition: fabui.h:1051
CursorName defaultCursor
Definition: fabui.h:363
uiPaintBox(uiWindow *parent, const Point &pos, const Size &size, bool visible=true, uint32_t styleClassID=0)
Creates an instance of the object.
Definition: fabui.cpp:3214
Contains the button style.
Definition: fabui.h:1181
void setDown(bool value)
Sets button state of a switch button.
Definition: fabui.cpp:2495
char const * filename()
Currently selected filename.
Definition: fabui.cpp:4079
uiMessageBoxResult
Return values from uiApp.messageBox() method.
Definition: fabui.h:2661
Represents a rectangle.
Definition: fabutils.h:225
uiWindow * screenToWindow(Point &point)
Determines which window a point belongs to.
Definition: fabui.cpp:512
uint8_t focusedBorderSize
Definition: fabui.h:368
RGB888 activeButtonColor
Definition: fabui.h:758
void maximizeWindow(uiWindow *window, bool value)
Maximizes or restores a window.
Definition: fabui.cpp:824
Delegate< uiTimerHandle > onTimer
Timer event delegate.
Definition: fabui.h:3112
RGB888 titleColor
Definition: fabui.h:754
uiHAlign
Text horizontal alignment.
Definition: fabui.h:225
int HScrollBarPos()
Determines position of the horizontal scrollbar thumb.
Definition: fabui.h:1061
Represents a text edit control.
Definition: fabui.h:1339
void minimizeWindow(uiWindow *window, bool value)
Minimizes or restores a window.
Definition: fabui.cpp:831
uiWindow * prev()
Gets previous sibling.
Definition: fabui.h:426
uint8_t passwordMode
Definition: fabui.h:1323
void repaintWindow(uiWindow *window)
Repaints a window.
Definition: fabui.cpp:705
uiTextEditProps & textEditProps()
Sets or gets text edit properties.
Definition: fabui.h:1371
bool realtimeReshaping
Definition: fabui.h:2654
Contains details about the mouse event.
Definition: fabui.h:165
RGB888 backgroundColor
Definition: fabui.h:2345
RGB888 mouseOverButtonColor
Definition: fabui.h:760
CursorName
This enum defines a set of predefined mouse cursors.
int focusIndex()
Determines the focus index (aka tab-index)
Definition: fabui.h:627
RGB888 mouseOverBackgroundColor
Definition: fabui.h:1310
FontInfo const * textFont
Definition: fabui.h:1453
uiWindow * firstChild()
Gets first child.
Definition: fabui.h:433
void setPercentage(int value)
Sets percentage.
Definition: fabui.cpp:4842
Bitmap const * downBitmap
Definition: fabui.h:1190
uiCheckBoxStyle & checkBoxStyle()
Sets or gets checkbox style.
Definition: fabui.h:2392
char const * directory()
Determines absolute path of current directory.
Definition: fabutils.h:565
uint8_t hasMaximizeButton
Definition: fabui.h:771
void reshapeWindow(uiWindow *window, Rect const &rect)
Reshapes a window.
Definition: fabui.cpp:739
FontInfo const * titleFont
Definition: fabui.h:756
StringList & items()
A list of strings representing items of the combobox.
Definition: fabui.h:2239
RGB888 activeTitleBackgroundColor
Definition: fabui.h:753
uiWindow * setFocusedWindow(uiWindow *value)
Sets the focused window (control)
Definition: fabui.cpp:632
This file contains FabGL library configuration settings, like number of supported colors...
uiHAlign textAlign
Definition: fabui.h:1456
RGB888 backgroundColor
Definition: fabui.h:1544
Base class of all UI elements like windows and controls.
Definition: fabui.h:271
int16_t X
void setBitmap(Bitmap const *bitmap)
Sets image bitmap.
Definition: fabui.cpp:3112
A paintbox control allows applications to perform custom drawings providing uiPaintBox.onPaint delegate. A paintbox can have horizontal and vertical scrollbars.
Definition: fabui.h:1667
RGB888 foregroundColor
Definition: fabui.h:2348
StringList & items()
A list of strings representing the listbox content.
Definition: fabui.h:1934
Point pos()
Determines the window position relative to parent window.
Definition: fabui.h:468
virtual Rect clientRect(uiOrigin origin)
Determines the client area bounding box.
Definition: fabui.cpp:1419
void setChecked(bool value)
Sets current checkbox or radiobutton checked status.
Definition: fabui.cpp:4526
Represents a bidimensional size.
Definition: fabutils.h:208
uiCheckBox(uiWindow *parent, const Point &pos, const Size &size, uiCheckBoxKind kind=uiCheckBoxKind::CheckBox, bool visible=true, uint32_t styleClassID=0)
Creates an instance of the object.
Definition: fabui.cpp:4416
Delegate onKillFocus
Kill focus event delegate.
Definition: fabui.h:1870
RGB888 backgroundColor
Definition: fabui.h:1309
uiComboBoxProps & comboBoxProps()
Sets or gets combobox properties.
Definition: fabui.h:2155
int VScrollBarPos()
Determines position of the vertical scrollbar thumb.
Definition: fabui.h:1090
RGB888 textColor
Definition: fabui.h:1455
uint8_t fillBackground
Definition: fabui.h:773
uiObjectType & objectType()
Determines the object type.
Definition: fabui.h:284
bool hasChildren()
Determines whether this window has children.
Definition: fabui.h:447
Delegate< uiKeyEventInfo > onKeyUp
Key-up event delegate.
Definition: fabui.h:914
RGB888 focusedBorderColor
Definition: fabui.h:366
Delegate onShow
Show window event delegate.
Definition: fabui.h:882
uiTimerHandle setTimer(uiEvtHandler *dest, int periodMS)
Setups a timer.
Definition: fabui.cpp:848
bool isDirectory()
Determines whether currently selected item is a directory.
Definition: fabui.cpp:4085
int max()
Gets maximum position.
Definition: fabui.h:2519
RGB888 backgroundColor
Definition: fabui.h:1182
uiApp * app()
Determines the app that owns this object.
Definition: fabui.h:312
Contains the listbox style.
Definition: fabui.h:2097
FontInfo const * textFont
Definition: fabui.h:1313
void resizeWindow(uiWindow *window, int width, int height)
Resizes a window.
Definition: fabui.cpp:726
int endModalWindow(ModalWindowState *state)
Ends modal window processing.
Definition: fabui.cpp:803
bool postEvent(uiEvent const *event)
Places an event in the event queue and returns without waiting for the receiver to process the event...
Definition: fabui.cpp:536
uint32_t styleClassID()
Determines current style class for this UI element.
Definition: fabui.h:643
uiScrollableControl(uiWindow *parent, const Point &pos, const Size &size, bool visible=true, uint32_t styleClassID=0)
Creates an instance of the object.
Definition: fabui.cpp:3333
A label is a static text UI element.
Definition: fabui.h:1461
void processEvents()
Processes all events in queue.
Definition: fabui.cpp:326
uiProgressBar(uiWindow *parent, const Point &pos, const Size &size, bool visible=true, uint32_t styleClassID=0)
Creates an instance of the object.
Definition: fabui.cpp:4778
Properties of the text edit.
Definition: fabui.h:1320
uiComboBox(uiWindow *parent, const Point &pos, const Size &size, int listHeight, bool visible=true, uint32_t styleClassID=0)
Creates an instance of the object.
Definition: fabui.cpp:4339
uiListBox(uiWindow *parent, const Point &pos, const Size &size, bool visible=true, uint32_t styleClassID=0)
Creates an instance of the object.
Definition: fabui.cpp:3973
virtual void setScrollBar(uiOrientation orientation, int position, int visible, int range, bool repaintScrollbar=true)
Sets scrollbar position, visible portion and range.
Definition: fabui.cpp:3361
uint8_t hasCloseButton
Definition: fabui.h:770
void bringOnTop()
Brings this window on top.
Definition: fabui.cpp:1358
uint8_t changedButton
Definition: fabui.h:167
Contains the image style.
Definition: fabui.h:1543
uiWindowState state()
Determines the window state.
Definition: fabui.h:520
uiPanel(uiWindow *parent, const Point &pos, const Size &size, bool visible=true, uint32_t styleClassID=0)
Creates an instance of the object.
Definition: fabui.cpp:3160
void setGroupIndex(int value)
Sets radiobutton group index.
Definition: fabui.h:2422
Rect clientRect(uiOrigin origin)
Determines the client area bounding box.
Definition: fabui.cpp:1842
RGB888 borderColor
Definition: fabui.h:364
uiWindow * moveFocus(int delta)
Move focus to a control with current focus index plus a delta.
Definition: fabui.cpp:682
RGB888 checkedBackgroundColor
Definition: fabui.h:2346
void repaintRect(Rect const &rect)
Repaints a screen area.
Definition: fabui.cpp:711
This is the base class for all controls. A control can have focus and is not activable.
Definition: fabui.h:969
RGB888 titleBackgroundColor
Definition: fabui.h:752
Properties of the progress bar.
Definition: fabui.h:2572
bool hasFocus()
Determines whether this window or control has focus.
Definition: fabui.cpp:1731
uiWindow * capturedMouseWindow()
Determines which window is capturing mouse.
Definition: fabui.h:2848
Properties of the list box.
Definition: fabui.h:1783
uint8_t selectOnMouseOver
Definition: fabui.h:1785
int HScrollBarRange()
Determines horizontal scrollbar range.
Definition: fabui.h:1080
RGB888 activeTitleColor
Definition: fabui.h:755
char const * text()
Gets current content of the text edit.
Definition: fabui.h:2269
void repaint()
Repaints this window.
Definition: fabui.cpp:1397
uiFileBrowser(uiWindow *parent, const Point &pos, const Size &size, bool visible=true, uint32_t styleClassID=0)
Creates an instance of the object.
Definition: fabui.cpp:4030
Contains anchors enable/disable switches.
Definition: fabui.h:373
uiProgressBarStyle & progressBarStyle()
Sets or gets progress bar style.
Definition: fabui.h:2607
char const * title()
Determines the window title.
Definition: fabui.h:836
RGB888 selectedBackgroundColor
Definition: fabui.h:1771
RGB888 backgroundColor
Definition: fabui.h:1454
Delegate onPaint
Paint event delegate.
Definition: fabui.h:919
RGB888 focusedBackgroundColor
Definition: fabui.h:1311
Shows generic a list of selectable items.
Definition: fabui.h:1796
uiWindow * next()
Gets next sibling.
Definition: fabui.h:417
Delegate onHide
Hide window event delegate.
Definition: fabui.h:889
void setDirectory(char const *path)
Sets current directory as absolute path.
Definition: fabui.cpp:4063
uiListBoxStyle & listBoxStyle()
Sets or gets listbox style.
Definition: fabui.h:1820
uint8_t height
A progress bar shows progress percentage using a colored bar.
Definition: fabui.h:2583
Delegate onChange
Button changed event delegate.
Definition: fabui.h:1274
Delegate onChange
Change event delegate.
Definition: fabui.h:2432
RGB888 backgroundColor
Definition: fabui.h:1769
void setStyleClassID(uint32_t value)
Sets style class for this UI element.
Definition: fabui.h:636
RGB888 backgroundColor
Definition: fabui.h:2457
Delegate< uiKeyEventInfo > onKeyUp
Key-up event delegate.
Definition: fabui.h:1875
void setText(char const *value)
Replaces current text.
Definition: fabui.cpp:2546
void selectColor(Color value)
Sets current selected color.
Definition: fabui.h:2315
uiWindow * activeWindow()
Gets a pointer to the currently active window.
Definition: fabui.h:2788
Delegate< uiKeyEventInfo > onKeyDown
Key-down event delegate.
Definition: fabui.h:909
A slider or track bar is a graphical control element with which a user may set a value by moving an i...
Definition: fabui.h:2466
Point clientPos()
Determines position of the client area.
Definition: fabui.cpp:1432
uiWindow(uiWindow *parent, const Point &pos, const Size &size, bool visible, uint32_t styleClassID=0)
Creates an instance of the object.
Definition: fabui.cpp:1210
uiFrame * rootWindow()
Gets a pointer to the root window.
Definition: fabui.h:2778
Specifies current window state.
Definition: fabui.h:341
void runAsync(BitmappedDisplayController *displayController, int taskStack=3000, Keyboard *keyboard=nullptr, Mouse *mouse=nullptr)
Initializes application and executes asynchronously the main event loop.
Definition: fabui.cpp:313
RGB888 backgroundColor
Definition: fabui.h:751
void setText(char const *value)
Replaces current text.
Definition: fabui.h:2262
This is a combination of a listbox and a single-line editable textbox.
Definition: fabui.h:2213
Shows and navigates Virtual Filesystem content.
Definition: fabui.h:1955
The PS2 Mouse controller class.
Definition: mouse.h:111
uint8_t maximized
Definition: fabui.h:343
uiImageStyle & imageStyle()
Sets or gets image style.
Definition: fabui.h:1590
int count()
Determines number of files in current directory.
Definition: fabutils.h:572
Contains the checkbox style.
Definition: fabui.h:2344
Delegate onChange
Text edit event delegate.
Definition: fabui.h:1395
bool isMouseOver()
Determines whether the mouse is over this window.
Definition: fabui.h:586
uint8_t allowMultiSelect
Definition: fabui.h:1784
int HScrollBarVisible()
Determines horizontal scrollbar visible portion (aka thumb size) of the scrollable content...
Definition: fabui.h:1070
void showWindow(uiWindow *window, bool value)
Makes a window visible or invisible.
Definition: fabui.cpp:747
uint8_t hasMinimizeButton
Definition: fabui.h:772
RGB888 focusedBackgroundColor
Definition: fabui.h:1770
void exitModal(int modalResult)
Exits from a modal window.
Definition: fabui.cpp:1723
Contains the panel style.
Definition: fabui.h:1613
uint8_t width
uiWindow * focusedWindow()
Gets the focused window (control)
Definition: fabui.h:2813
void changeDirectory(char const *path)
Changes current directory as relative path.
Definition: fabui.cpp:4071
uint8_t bitmapTextSpace
Definition: fabui.h:1188
void setText(char const *value)
Sets button text.
Definition: fabui.cpp:2395
char const * text()
Determines label text.
Definition: fabui.h:1504
uint8_t resizeable
Definition: fabui.h:768
void setTitle(char const *value)
Sets window title.
Definition: fabui.cpp:1804
uiMessageBoxIcon
Icon displayed by the uiApp.messageBox() method.
Definition: fabui.h:2672
FontInfo const * textFont
Definition: fabui.h:2566
void enableKeyboardAndMouseEvents(bool value)
Enables or disables mouse and keyboard events.
Definition: fabui.cpp:1181
bool checked()
Determines whether the checkbox or radiobutton is checked.
Definition: fabui.h:2399
int min()
Gets minimum position.
Definition: fabui.h:2512
Image control to display a static bitmap.
Definition: fabui.h:1549
void killTimer(uiTimerHandle handle)
Kills a timer.
Definition: fabui.cpp:857
FileBrowser allows basic file system operations (dir, mkdir, remove and rename)
Definition: fabutils.h:531
Delegate onChange
Slider changed event delegate.
Definition: fabui.h:2536