Gamedev Framework (gf)  0.4.0
A C++11 framework for 2D games
UI.h
1 /*
2  * Gamedev Framework (gf)
3  * Copyright (C) 2016-2017 Julien Bernard
4  *
5  * This software is provided 'as-is', without any express or implied
6  * warranty. In no event will the authors be held liable for any damages
7  * arising from the use of this software.
8  *
9  * Permission is granted to anyone to use this software for any purpose,
10  * including commercial applications, and to alter it and redistribute it
11  * freely, subject to the following restrictions:
12  *
13  * 1. The origin of this software must not be misrepresented; you must not
14  * claim that you wrote the original software. If you use this software
15  * in a product, an acknowledgment in the product documentation would be
16  * appreciated but is not required.
17  * 2. Altered source versions must be plainly marked as such, and must not be
18  * misrepresented as being the original software.
19  * 3. This notice may not be removed or altered from any source distribution.
20  */
21 #ifndef GF_UI_H
22 #define GF_UI_H
23 
24 #include <cstdint>
25 #include <memory>
26 
27 #include "ArrayRef.h"
28 #include "BufferRef.h"
29 #include "Drawable.h"
30 #include "Event.h"
31 #include "Flags.h"
32 #include "Font.h"
33 #include "Path.h"
34 #include "Portability.h"
35 #include "StringRef.h"
36 #include "Types.h"
37 #include "Vector.h"
38 
39 namespace gf {
40 #ifndef DOXYGEN_SHOULD_SKIP_THIS
41 inline namespace v1 {
42 #endif
43 
44  class Texture;
45 
46  /**
47  * @ingroup graphics
48  * @brief Properties for windows and window-like elements
49  *
50  * @sa gf::UIWindowFlags
51  */
52  enum class UIWindow : uint32_t {
53  Border = 0x0001, ///< The window has a border
54  Movable = 0x0002, ///< The window can be moved by the user
55  Scalable = 0x0004, ///< The window is scalable by the user
56  Closable = 0x0008, ///< The window can be closed with an icon in the header
57  Minimizable = 0x0010, ///< The window can be minimized with an icon in the header
58  NoScrollbar = 0x0020, ///< The window has no scrollbar
59  Title = 0x0040, ///< The window has a title in the header
60  ScrollAutoHide = 0x0080, ///< The window's scrollbar can hide automatically
61  Background = 0x0100, ///< The window is in the background
62  };
63 
64  /**
65  * @ingroup graphics
66  * @brief Flags composed of window properties
67  *
68  * @sa gf::UIWindow
69  */
70  using UIWindowFlags = Flags<UIWindow>;
71 
72  /**
73  * @ingroup graphics
74  * @brief Collapse property of a tree
75  */
76  enum class UICollapse : bool {
77  Minimized = false, ///< The tree is minimized
78  Maximized = true, ///< The tree is maximized
79  };
80 
81  /**
82  * @ingroup graphics
83  * @brief Layout property for rows
84  */
85  enum class UILayout {
86  Dynamic = 0, ///< The row has a dynamic layout
87  Static = 1, ///< The row has a static layout
88  };
89 
90  /**
91  * @ingroup graphics
92  * @brief The type of tree
93  */
94  enum class UITree {
95  Node = 0, ///< The tree is a node, generally an internal node of the tree
96  Tab = 1, ///< The tree is a tabulation, generally the root of the tree
97  };
98 
99  /**
100  * @ingroup graphics
101  * @brief The alignment of the text
102  *
103  * @sa gf::Alignment
104  */
105  enum class UIAlignment {
106  Left = 0x10 | 0x01, ///< Left alignment
107  Center = 0x10 | 0x02, ///< Centered alignment
108  Right = 0x10 | 0x04, ///< Right alignment
109  };
110 
111  /**
112  * @ingroup graphics
113  * @brief State for scrollbar in groups
114  */
115  using UIScroll = Vector<unsigned short, 2>;
116 
117  /**
118  * @ingroup graphics
119  * @brief Behavior for buttons
120  */
121  enum class UIButtonBehavior {
122  Default = 0, ///< The button is active once
123  Repeater = 1, ///< The button is active as long as it is pressed
124  };
125 
126  /**
127  * @ingroup graphics
128  * @brief State of the progress bar
129  */
130  enum class UIProgress : bool {
131  Fixed = false, ///< The progress bar is fixed
132  Modifyable = true, ///< The progress bar can be modified
133  };
134 
135  /**
136  * @ingroup graphics
137  * @brief A representative symbol
138  */
139  enum class UISymbol {
140  None, ///< No symbol
141  X, ///< X symbol
142  Underscore, ///< Underscore
143  CircleSolid, ///< Solid circle
144  CircleOutline, ///< Outline circle
145  RectSolid, ///< Solid rectangle
146  RectOutline, ///< Outline rectangle
147  TriangleUp, ///< Triangle up
148  TriangleDown, ///< Triangle down
149  TriangleLeft, ///< Triangle left
150  TriangleRight, ///< Triangle right
151  Plus, ///< Plus
152  Minus, ///< Minus
153  };
154 
155  /**
156  * @ingroup graphics
157  * @brief Properties for edit widgets
158  */
159  enum class UIEdit : uint32_t {
160  Default = 0x0000,
161  ReadOnly = 0x0001,
162  AutoSelect = 0x0002,
163  SigEnter = 0x0004,
164  AllowTab = 0x0008,
165  NoCursor = 0x0010,
166  Selectable = 0x0020,
167  Clipboard = 0x0040,
168  CtrlEnterNewline = 0x0080,
169  NoHorizontalScroll = 0x0100,
170  AlwaysInsertMode = 0x0200,
171  // no 0x0400
172  Multiline = 0x0800,
173  GotoEndOnActivate = 0x1000,
174  };
175 
176  /**
177  * @ingroup graphics
178  * @brief Flags composed of edit properties
179  *
180  * @sa gf::UIEdit
181  */
182  using UIEditFlags = Flags<UIEdit>;
183 
184  /**
185  * @ingroup graphics
186  * @brief Predefined flags for edit
187  */
189  static const UIEditFlags Simple;
190  static const UIEditFlags Field;
191  static const UIEditFlags Box;
192  static const UIEditFlags Editor;
193  };
194 
195  /**
196  * @ingroup graphics
197  * @brief Properties for edit events
198  */
199  enum class UIEditEvent : uint32_t {
200  Active = 0x0001, ///< Edit widget is currently being modified
201  Inactive = 0x0002, ///< Edit widget is not active and is not being modified
202  Activated = 0x0004, ///< Edit widget went from state inactive to state active
203  Deactivated = 0x0008, ///< Edit widget went from state active to state inactive
204  Commited = 0x0010, ///< Edit widget has received an enter and lost focus
205  };
206 
207  /**
208  * @ingroup graphics
209  * @brief Flags composed of edit events properties
210  *
211  * @sa gf::UIEditEvent
212  */
213  using UIEditEventFlags = Flags<UIEditEvent>;
214 
215  /**
216  * @ingroup graphics
217  * @brief Filters for edit
218  */
219  enum class UIEditFilter {
220  Default,
221  Ascii,
222  Float,
223  Decimal,
224  Hex,
225  Oct,
226  Binary,
227  };
228 
229  /**
230  * @ingroup graphics
231  * @brief Data for file selector
232  *
233  * @sa gf::UI::fileSelector()
234  */
235  struct UIBrowser {
236  Path currentPath; ///< The current path for searching
237  Path selectedPath; ///< The selected path
238  };
239 
240  /**
241  * @ingroup graphics
242  * @brief Type of popup
243  */
244  enum class UIPopup {
245  Static = 0, ///< The popup is static
246  Dynamic = 1, ///< The popup is dynamic
247  };
248 
249  /**
250  * @ingroup graphics
251  * @brief A predefined style
252  */
253  enum class UIPredefinedStyle {
254  Default, ///< The default style
255  White, ///< A light gray style
256  Red, ///< A red and gray style
257  Blue, ///< A blue and light gray style
258  Dark, ///< A dark gray and dark blue style
259  };
260 
261  /**
262  * @ingroup graphics
263  * @brief Context for an immediate mode graphical interface
264  *
265  * When building a graphical interfaces, you have basically two choices:
266  * either the retained mode where you build a hierarchy of widgets, or the
267  * immediate mode where widgets are built from function calls. Choosing the
268  * best mode between these two may be
269  * [controversial](http://gamedev.stackexchange.com/questions/24103/immediate-gui-yae-or-nay).
270  * gf offers an immediate mode graphical interface through this class.
271  *
272  * The immediate mode graphical interface (or imgui) of gf is based on
273  * [Nuklear](https://github.com/vurtun/nuklear), a C library with the same
274  * purpose. gf does not provide (yet?) all the features of Nuklear, but a
275  * fair amount of the main features. Nuklear is totally abstracted in gf so
276  * you won't see any interface from Nuklear and you won't be able to
277  * interact directly with Nuklear. If you need a feature that is not
278  * implemented yet, just ask.
279  *
280  * This imgui library can be used to create tools for the game developpers.
281  * It's easy and quick to build a functional interface with an imgui
282  * library. You can see some examples in gf itself. You can also use this
283  * library to build in-game interfaces, even if it's not its primary
284  * purpose. If your game is heavily based on a graphical interface, it
285  * may be a good option.
286  *
287  *
288  * # Creating a context
289  *
290  * An instance of gf::UI is a context for all the windows that will be
291  * created. You must provide a font and a character size that will be
292  * used in the interface. Generally, you create the instance of gf::UI
293  * at the beginning of your application and then you use this instance
294  * throughout your application.
295  *
296  * @snippet snippets/doc_class_ui.cc context
297  *
298  * By default, the character size is 13.
299  *
300  *
301  * # Managing events
302  *
303  * The imgui needs to know the input events that occurred in the frame time.
304  * So when polling the events in your main loop, you must pass the events
305  * to the context so that it can be updated and take the good decision. For
306  * example, if you press on a button, the mouse event will be transmitted
307  * and the library will know that you pressed a button and act accordingly.
308  *
309  * @snippet snippets/doc_class_ui.cc events
310  *
311  *
312  * # Creating a window
313  *
314  * Then, you have to create a window. The window has a title that may appear
315  * in the titlebar. It also identifies the window so two windows must have
316  * two different titles. The window also has bounds, i.e. a position and a
317  * size, that indicates where to put the window in the screen. There is no
318  * automatic placement of windows. Finally, the window can have many
319  * properties (see gf::UIWindow) that modify the interaction with the window.
320  * They are defined at the window creation.
321  *
322  * @snippet snippets/doc_class_ui.cc window
323  *
324  * For each begin(), you have to call end() to finish the window.
325  * You can create as many windows as you want as long as they have different
326  * titles.
327  *
328  *
329  * # Determining a layout
330  *
331  * Before drawing any widget, you have to define a layout. Think of it as a
332  * sort of specification for how to organize the following widgets. There
333  * are three types of layouts: rows, groups, trees.
334  *
335  * ## Rows
336  *
337  * Rows are the most common type of layout. The row layout is very flexible.
338  *
339  * A row can be either static (it does not adapt to the width of the window)
340  * of dynamic (it adapts to the width of the window). It can be fixed (all
341  * columns have the same width) or custom (columns' widths are specified,
342  * either relatively or absolutely), and in the latter case the
343  * specification can be global or in immediate mode. Here is a summary of
344  * the functions to use in each case:
345  *
346  * - dynamic row
347  * - fixed column layout: layoutRowDynamic()
348  * - custom column layout
349  * - array-based: layoutRow() with gf::UILayout::Dynamic
350  * - immediate-mode: layoutRowBegin() with gf::UILayout::Dynamic, layoutRowPush(), layoutRowEnd()
351  * - static row
352  * - fixed column layout: layoutRowStatic()
353  * - custom column layout
354  * - array-based: layoutRow() with gf::UILayout::Static
355  * - immediate-mode: layoutRowBegin() with gf::UILayout::Static, layoutRowPush(), layoutRowEnd()
356  *
357  * ## Trees
358  *
359  * A tree is a tree-like layout. It can be collapsed to hide its content
360  * except its title. There are two types of trees: tabs and nodes (see
361  * gf::UITree). A tab tree is generally put at the root of the tree, it is
362  * represented with a border around the title. A node tree is generally the
363  * son of a tab tree or another node tree. It is represented without any
364  * border.
365  *
366  * In both cases, you need a variable of type gf::UICollapse to handle the
367  * current state of the tree: minimized or maximized.
368  *
369  * @snippet snippets/doc_class_ui.cc tree
370  *
371  * ## Groups
372  *
373  * A group is a kind of window inside a window. It can have a title, a
374  * border and a scrollbar. However, a group needs to be put in a row.
375  * See groupBegin() and groupEnd().
376  *
377  * @snippet snippets/doc_class_ui.cc group
378  *
379  *
380  * # Adding widgets and more
381  *
382  * The library offers common kinds of widgets:
383  * - [labels](https://en.wikipedia.org/wiki/Label_%28control%29): label(), selectableLabel()
384  * - [buttons](https://en.wikipedia.org/wiki/Button_%28computing%29): buttonLabel(), buttonColor(), buttonSymbol(), buttonSymbolLabel()
385  * - [checkboxes](https://en.wikipedia.org/wiki/Checkbox): checkbox(), checkboxFlags()
386  * - [radio buttons](https://en.wikipedia.org/wiki/Radio_button): option(), radio()
387  * - [sliders](https://en.wikipedia.org/wiki/Slider_%28computing%29): sliderFloat(), sliderInt()
388  * - [progress bars](https://en.wikipedia.org/wiki/Progress_bar): progress()
389  * - [color pickers](https://en.wikipedia.org/wiki/Color_tool): colorPicker()
390  *
391  * Widgets often manipulate a reference to a user-provided variable that
392  * represents the state of the widget. This way, you can pass directly your
393  * model variables to the graphical interface without duplicating the data.
394  * Some widgets return a boolean that indicates a state change. For example,
395  * a button returns true if it has been pressed.
396  *
397  * The library also offers common graphical interface elements:
398  * - [popups](https://en.wikipedia.org/wiki/Popover_%28GUI%29): popupBegin(), popupEnd()
399  * - [combo boxes](https://en.wikipedia.org/wiki/Combo_box): combobox(), comboboxSeparator()
400  * - [contextuals](https://en.wikipedia.org/wiki/Context_menu): contextualBegin(), contextualEnd()
401  * - [tooltips](https://en.wikipedia.org/wiki/Tooltip): tooltip()
402  * - [menus](https://en.wikipedia.org/wiki/Menu_28computing%29): menubarBegin(), menubarEnd()
403  *
404  * Many of these elements have a begin/end API. The end part must be called
405  * if the begin part succeeded, i.e. returned true. Some elements offer a
406  * simplified version without begin/end for common cases.
407  *
408  */
409  class GF_API UI : public Drawable {
410  public:
411  /**
412  * @brief The default size for the font
413  */
414  static constexpr unsigned DefaultCharacterSize = 13;
415 
416  /**
417  * @brief Constructor
418  *
419  * @param font The font used in the interface
420  * @param characterSize The size of the font used in the interface
421  */
422  UI(Font& font, unsigned characterSize = DefaultCharacterSize);
423 
424  /**
425  * @brief Destructor
426  */
427  ~UI();
428 
429  /**
430  * @brief Deleted copy constructor
431  */
432  UI(const UI&) = delete;
433 
434  /**
435  * @brief Deleted copy assignment
436  */
437  UI& operator=(const UI&) = delete;
438 
439  /**
440  * @brief Move constructor
441  */
442  UI(UI&& other);
443 
444  /**
445  * @brief Move assignment
446  */
447  UI& operator=(UI&& other);
448 
449  /**
450  * @brief Update the internal state with an event
451  *
452  * This function must be called for every event that occur in a frame.
453  *
454  * @param event An event
455  */
456  void processEvent(const Event& event);
457 
458  /**
459  * @name Window
460  * @{
461  */
462 
463  /**
464  * @brief Create a window
465  *
466  * @snippet snippets/doc_class_ui.cc window
467  *
468  * @param title The title of the window
469  * @param bounds The area of the window
470  * @param flags The properties of the window
471  * @returns True is the content of the window is visible
472  *
473  * @sa end(), gf::UIWindow
474  */
475  bool begin(const std::string& title, const RectF& bounds, UIWindowFlags flags = None);
476 
477  /**
478  * @brief Finish a window
479  *
480  * @snippet snippets/doc_class_ui.cc window
481  *
482  * @sa begin()
483  */
484  void end();
485 
486  void windowSetBounds(const RectF& bounds);
487  RectF windowGetBounds();
488 
489  /**
490  * @}
491  */
492 
493  /**
494  * @name Layout
495  * @{
496  */
497 
498  /**
499  * @brief Dynamic row with fixed column layout
500  *
501  * @param height The height of the row
502  * @param cols The number of columns in the row
503  *
504  * @sa layoutRowStatic()
505  */
506  void layoutRowDynamic(float height, int cols);
507 
508  /**
509  * @brief Static row with fixed column layout
510  *
511  * @param height The height of the row
512  * @param itemWidth The width of each item in the row
513  * @param cols The number of columns in the row
514  *
515  * @sa layoutRowDynamic()
516  */
517  void layoutRowStatic(float height, int itemWidth, int cols);
518 
519  /**
520  * @brief Start an immediate mode custom column layout
521  *
522  * @param format The format of the row: static or dynamic
523  * @param height The height of the row
524  * @param cols The number of columns in the row
525  *
526  * @sa layoutRowPush(), layoutRowEnd()
527  */
528  void layoutRowBegin(UILayout format, float height, int cols);
529 
530  /**
531  * @brief Specify the width of the next column
532  *
533  * @param width The width of the next column
534  *
535  * @sa layoutRowBegin(), layoutRowEnd()
536  */
537  void layoutRowPush(float width);
538 
539  /**
540  * @brief Finish an immediate mode custom column layout
541  *
542  * @sa layoutRowBegin(), layoutRowPush()
543  */
544  void layoutRowEnd();
545 
546  /**
547  * @brief Array-based custom column layout
548  *
549  * @param format The format of the row: static or dynamic
550  * @param height The height of the row
551  * @param ratio A reference to an array of ratios for the columns
552  */
553  void layoutRow(UILayout format, float height, ArrayRef<float> ratio);
554 
555  /**
556  * @brief An empty separator
557  *
558  * This function creates an empty row so you have to specify a new row.
559  *
560  * @param height The height of the row
561  */
562  void separator(float height);
563 
564  /**
565  * @}
566  */
567 
568  /**
569  * @name Layout: Group
570  * @{
571  */
572 
573  /**
574  * @brief Start a group
575  *
576  * The only allowed flags are UIWindow::Title, UIWindow::Border,
577  * UIWindow::NoScrollbar.
578  *
579  * @snippet snippets/doc_class_ui.cc group
580  *
581  * @param title The title of the group
582  * @param flags The properties of the group
583  * @returns True if the group is visible
584  *
585  * @sa groupEnd()
586  */
587  bool groupBegin(const std::string& title, UIWindowFlags flags = None);
588 
589  /**
590  * @brief Finish a group
591  *
592  * @snippet snippets/doc_class_ui.cc group
593  *
594  * @sa groupBegin()
595  */
596  void groupEnd();
597 
598  /**
599  * @brief Start a scrolled group
600  *
601  * The only allowed flags are UIWindow::Title, UIWindow::Border,
602  * UIWindow::NoScrollbar.
603  *
604  * @param scroll A state for representing the scroll
605  * @param title The title of the group
606  * @param flags The properties of the group
607  * @returns True if the group is visible
608  *
609  * @sa groupScrolledEnd()
610  */
611  bool groupScrolledBegin(UIScroll& scroll, const std::string& title, UIWindowFlags flags = None);
612 
613  /**
614  * @brief Finish a scrolled group
615  *
616  * @sa groupScrolledBegin()
617  */
618  void groupScrolledEnd();
619 
620  /**
621  * @}
622  */
623 
624  /**
625  * @name Layout: Tree
626  * @{
627  */
628 
629  /**
630  * @brief Start a tree layout
631  *
632  * @snippet snippets/doc_class_ui.cc tree
633  *
634  * @param type The type of tree: tab or node
635  * @param title The title of the tree
636  * @param state The collapse state
637  * @returns True if the tree is maximized
638  *
639  * @sa treePop()
640  */
641  bool treePush(UITree type, const std::string& title, UICollapse& state);
642 
643  /**
644  * @brief Finish a tree layout
645  *
646  * @snippet snippets/doc_class_ui.cc tree
647  *
648  * @sa treePush()
649  */
650  void treePop();
651 
652  /**
653  * @}
654  */
655 
656  /**
657  * @name Widgets: Labels
658  * @{
659  */
660 
661  /**
662  * @brief A simple label with text
663  *
664  * @param title The title of the label
665  * @param align The alignment of the text in the label
666  *
667  * @sa labelColored()
668  */
669  void label(StringRef title, UIAlignment align = UIAlignment::Left);
670 
671  /**
672  * @brief A label with colored text
673  *
674  * @param color The color of the text
675  * @param title The title of the label
676  * @param align The alignment of the text in the label
677  *
678  * @sa label()
679  */
680  void labelColored(const Color4f& color, StringRef title, UIAlignment align = UIAlignment::Left);
681 
682  /**
683  * @brief A simple label that can wrap
684  *
685  * @param title The title of the label
686  *
687  * @sa labelWrapColored()
688  */
689  void labelWrap(StringRef title);
690 
691  /**
692  * @brief A label with colored text that can wrap
693  *
694  * @param color The color of the text
695  * @param title The title of the label
696  *
697  * @sa labelWrap()
698  */
699  void labelWrapColored(const Color4f& color, StringRef title);
700 
701  /**
702  * @brief An image
703  *
704  * @param texture A texture
705  * @param textureRect A sub-rectangle of the texture to show
706  */
707  void image(const Texture& texture, const RectF& textureRect);
708 
709  /**
710  * @}
711  */
712 
713  /**
714  * @name Widgets: Buttons
715  * @{
716  */
717 
718  /**
719  * @brief Change the behavior of buttons
720  *
721  * @param behavior The new behavior of buttons
722  *
723  * @sa buttonPushBehavior(), buttonPopBehavior()
724  */
725  void buttonSetBehavior(UIButtonBehavior behavior);
726 
727  /**
728  * @brief Push a new behavior of buttons
729  *
730  * @param behavior The new behavior of buttons
731  *
732  * @sa buttonSetBehavior(), buttonPopBehavior()
733  */
734  bool buttonPushBehavior(UIButtonBehavior behavior);
735 
736  /**
737  * @brief Pop the previous behavior of buttons
738  *
739  * @sa buttonSetBehavior(), buttonPushBehavior()
740  */
741  bool buttonPopBehavior();
742 
743  /**
744  * @brief A button with a centered label
745  *
746  * @param title The title of the button
747  * @returns True if the button was pressed
748  *
749  * @sa buttonColor(), buttonSymbol(), buttonSymbolLabel()
750  */
751  bool buttonLabel(StringRef title);
752 
753  /**
754  * @brief A button with a color
755  *
756  * @param color The color of the button
757  * @returns True if the button was pressed
758  *
759  * @sa buttonLabel(), buttonSymbol(), buttonSymbolLabel()
760  */
761  bool buttonColor(const Color4f& color);
762 
763  /**
764  * @brief A button with a symbol
765  *
766  * @param symbol A symbol
767  * @returns True if the button was pressed
768  *
769  * @sa buttonLabel(), buttonColor(), buttonSymbolLabel()
770  */
771  bool buttonSymbol(UISymbol symbol);
772 
773  /**
774  * @brief A button with a symbol and a centered label
775  *
776  * @param symbol A symbol
777  * @param title The title of the button
778  * @param align The alignment of the symbol
779  * @returns True if the button was pressed
780  *
781  * @sa buttonLabel(), buttonColor(), buttonSymbol()
782  */
784 
785  /**
786  * @}
787  */
788 
789  /**
790  * @name Widgets: Checkbox
791  * @{
792  */
793 
794  /**
795  * @brief A checkbox with a title
796  *
797  * @param title The title of the checkbox
798  * @param active A reference to a boolean that indicates the state of the checkbox
799  * @returns True if the checkbox has changed its state
800  *
801  * @sa checkboxFlags()
802  */
803  bool checkbox(StringRef title, bool& active);
804 
805  /**
806  * @brief A checkbox with a title for flags
807  *
808  * @param title The title of the checkbox
809  * @param flags A reference to the state of flags
810  * @param value The flag value for this checkbox
811  * @returns True if the checkbox has changed its state
812  *
813  * @sa checkbox()
814  */
815  bool checkboxFlags(StringRef title, unsigned& flags, unsigned value);
816 
817  /**
818  * @}
819  */
820 
821  /**
822  * @name Widgets: Radio
823  * @{
824  */
825 
826  /**
827  * @brief A radio button without state
828  *
829  * @param title The title of the radio button
830  * @param active A boolean that indicates if the radio is chosen
831  * @returns True if the radio is pressed
832  *
833  * @sa radio()
834  */
835  bool option(StringRef title, bool active);
836 
837  /**
838  * @brief A radio button with a reference state
839  *
840  * @param title The title of the radio button
841  * @param active A reference to the state of the radio
842  * @returns True if the radio is pressed
843  *
844  * @sa option()
845  */
846  bool radio(StringRef title, bool& active);
847 
848  /**
849  * @}
850  */
851 
852  /**
853  * @name Widgets: Selectable
854  * @{
855  */
856 
857  /**
858  * @brief A selectable label
859  *
860  * @param title The title of the label
861  * @param align The alignment of the text in the label
862  * @param value A reference to the state of the selection
863  * @returns True if the state has changed
864  *
865  * @sa label()
866  */
867  bool selectableLabel(StringRef title, UIAlignment align, bool& value);
868 
869  /**
870  * @}
871  */
872 
873  /**
874  * @name Widgets: Slider
875  * @{
876  */
877 
878  /**
879  * @brief A slider for a float value
880  *
881  * @param min The minimum for the value
882  * @param val A reference to the value
883  * @param max The maximum for the value
884  * @param step A step when changing the value
885  * @returns True if the slider has changed
886  *
887  * @sa sliderInt()
888  */
889  bool sliderFloat(float min, float& val, float max, float step);
890 
891  /**
892  * @brief A slider for an int value
893  *
894  * @param min The minimum for the value
895  * @param val A reference to the value
896  * @param max The maximum for the value
897  * @param step A step when changing the value
898  * @returns True if the slider has changed
899  *
900  * @sa sliderFloat()
901  */
902  bool sliderInt(int min, int& val, int max, int step);
903 
904  /**
905  * @}
906  */
907 
908  /**
909  * @name Widgets: Progressbar
910  * @{
911  */
912 
913  /**
914  * @brief A progress bar
915  *
916  * @param current A reference to the state of the progress bar
917  * @param max The maximum of the progress bar (the minimum is zero)
918  * @param modifyable A property to indicate if the progress bar can be modified by the user or not
919  * @returns True if the progress bar has changed
920  */
921  bool progress(std::size_t& current, std::size_t max, UIProgress modifyable = UIProgress::Modifyable);
922 
923  /**
924  * @}
925  */
926 
927  /**
928  * @name Widgets: Color picker
929  * @{
930  */
931 
932  /**
933  * @brief A color picker
934  *
935  * @param color A reference to the state of the color picker, i.e. the current color
936  * @returns True if the color has changed
937  */
938  bool colorPicker(Color4f& color);
939 
940  /**
941  * @}
942  */
943 
944  /**
945  * @name Widgets: Property
946  * @{
947  */
948 
949  /**
950  * @brief A property for an integer
951  *
952  * @param name The name of the property
953  * @param min The minimum for the value
954  * @param val A reference to the value
955  * @param max The maximum for the value
956  * @param step A step when changing the value
957  * @param incPerPixel A step when modifying the value with the mouse
958  *
959  * @sa propertyFloat(), propertyDouble()
960  */
961  void propertyInt(const std::string& name, int min, int& val, int max, int step, float incPerPixel);
962 
963  /**
964  * @brief A property for a float
965  *
966  * @param name The name of the property
967  * @param min The minimum for the value
968  * @param val A reference to the value
969  * @param max The maximum for the value
970  * @param step A step when changing the value
971  * @param incPerPixel A step when modifying the value with the mouse
972  *
973  * @sa propertyInt(), propertyDouble()
974  */
975  void propertyFloat(const std::string& name, float min, float& val, float max, float step, float incPerPixel);
976 
977  /**
978  * @brief A property for a double
979  *
980  * @param name The name of the property
981  * @param min The minimum for the value
982  * @param val A reference to the value
983  * @param max The maximum for the value
984  * @param step A step when changing the value
985  * @param incPerPixel A step when modifying the value with the mouse
986  *
987  * @sa propertyInt(), propertyFloat()
988  */
989  void propertyDouble(const std::string& name, double min, double& val, double max, double step, float incPerPixel);
990 
991  /**
992  * @}
993  */
994 
995  /**
996  * @name Widgets: TextEdit
997  * @{
998  */
999 
1000  UIEditEventFlags edit(UIEditFlags flags, BufferRef<char> buffer, std::size_t& length, UIEditFilter filter = UIEditFilter::Default);
1001 
1002  /**
1003  * @}
1004  */
1005 
1006  /**
1007  * @name Dialogs
1008  * @{
1009  */
1010 
1011  /**
1012  * @brief File selector
1013  *
1014  * @param browser State of the file selector
1015  * @param title The title of the file selector
1016  * @param bounds The area of the file selector
1017  * @returns True if the file selector is open
1018  */
1019  bool fileSelector(UIBrowser& browser, const std::string& title, const RectF& bounds);
1020 
1021  /**
1022  * @}
1023  */
1024 
1025  /**
1026  * @name Popups
1027  * @{
1028  */
1029 
1030  /**
1031  * @brief Start a popup window
1032  *
1033  * @param type The type of popup (static or dynamic)
1034  * @param title The title of the popup
1035  * @param flags The properties of the popup window
1036  * @param bounds The area of the popup window
1037  * @returns True if the popup is open
1038  *
1039  * @sa popupClose(), popupEnd()
1040  */
1041  bool popupBegin(UIPopup type, const std::string& title, UIWindowFlags flags, const RectF& bounds);
1042 
1043  /**
1044  * @brief Close a popup window
1045  *
1046  * @sa popupBegin(), popupEnd()
1047  */
1048  void popupClose();
1049 
1050  /**
1051  * @brief Finish a popup window
1052  *
1053  * @sa popupBegin(), popupClose()
1054  */
1055  void popupEnd();
1056 
1057  /**
1058  * @}
1059  */
1060 
1061  /**
1062  * @name Combo box
1063  * @{
1064  */
1065 
1066  /**
1067  * @brief A simple combo box with a list of item
1068  *
1069  * @param items The list of items in the combo box
1070  * @param selected A reference to the selected item in the combo box
1071  * @param itemHeight The height of the items in the list
1072  * @param size The size of the combo box
1073  *
1074  * @sa comboboxSeparator()
1075  */
1076  void combobox(const std::vector<std::string>& items, int& selected, int itemHeight, Vector2f size);
1077 
1078  /**
1079  * @brief A simple combo box with a string and a separator
1080  *
1081  * @param itemsSeparatedBySeparator A string with all the items separated by a separator
1082  * @param separator The separator used in the string
1083  * @param selected A reference to the selected item in the combo box
1084  * @param itemHeight The height of the items in the list
1085  * @param size The size of the combo box
1086  *
1087  * @sa combobox()
1088  */
1089  void comboboxSeparator(const std::string& itemsSeparatedBySeparator, char separator, int& selected, int itemHeight, Vector2f size);
1090 
1091  /**
1092  * @brief Start a combo box with a label
1093  *
1094  * @param selected The selected item that appears in the combo box
1095  * @param size The size of the combo box
1096  * @returns True if the combo box is open
1097  *
1098  * @sa comboClose(), comboEnd()
1099  */
1100  bool comboBeginLabel(StringRef selected, Vector2f size);
1101 
1102  /**
1103  * @brief Start a combo box with a color
1104  *
1105  * @param color The color that appears in the combo box
1106  * @param size The size of the combo box
1107  * @returns True if the combo box is open
1108  *
1109  * @sa comboClose(), comboEnd()
1110  */
1111  bool comboBeginColor(const Color4f& color, Vector2f size);
1112 
1113  /**
1114  * @brief Start a combo box with a symbol
1115  *
1116  * @param symbol The symbol that appears in the combo box
1117  * @param size The size of the combo box
1118  * @returns True if the combo box is open
1119  *
1120  * @sa comboClose(), comboEnd()
1121  */
1122  bool comboBeginSymbol(UISymbol symbol, Vector2f size);
1123 
1124  /**
1125  * @brief Start a combo box with a symbol and a label
1126  *
1127  * @param symbol The symbol that appears in the combo box
1128  * @param selected The selected item that appears in the combo box
1129  * @param size The size of the combo box
1130  * @returns True if the combo box is open
1131  *
1132  * @sa comboClose(), comboEnd()
1133  */
1134  bool comboBeginSymbolLabel(UISymbol symbol, StringRef selected, Vector2f size);
1135 
1136  /**
1137  * @brief A label inside the combo box
1138  *
1139  * @param title The title of the label
1140  * @param align The alignment of the text in the label
1141  * @returns True if the item is selected
1142  */
1144 
1145  /**
1146  * @brief A symbol and a label inside the combo box
1147  *
1148  * @param symbol The symbol of the item
1149  * @param title The title of the label
1150  * @param align The alignment of the text in the label
1151  * @returns True if the item is selected
1152  */
1154 
1155  /**
1156  * @brief Close a combo box
1157  *
1158  * @sa comboEnd()
1159  */
1160  void comboClose();
1161 
1162  /**
1163  * @brief Finish a combo box
1164  *
1165  * @sa comboBeginLabel(), comboBeginColor(), comboBeginSymbol(), comboBeginSymbolLabel()
1166  */
1167  void comboEnd();
1168 
1169  /**
1170  * @}
1171  */
1172 
1173  /**
1174  * @name Contextual
1175  * @{
1176  */
1177 
1178  /**
1179  * @brief Start a contextual window
1180  *
1181  * @param flags The properties of the contextual window
1182  * @param size The size of the contextual window
1183  * @param triggerBounds The bounds when the contextual should appear
1184  * @returns True if the contextual is open
1185  *
1186  * @sa contextualClose(), contextualEnd()
1187  */
1188  bool contextualBegin(UIWindowFlags flags, Vector2f size, const RectF& triggerBounds);
1189 
1190  /**
1191  * @brief A label inside the contextual window
1192  *
1193  * @param title The title of the label
1194  * @param align The alignment of the text in the label
1195  * @returns True if the item is selected
1196  */
1198 
1199  /**
1200  * @brief A symbol and a label inside the contextual window
1201  *
1202  * @param symbol The symbol of the item
1203  * @param title The title of the label
1204  * @param align The alignment of the text in the label
1205  * @returns True if the item is selected
1206  */
1208 
1209  /**
1210  * @brief Close the contextual window
1211  *
1212  * @sa contextualBegin(), contextualEnd()
1213  */
1214  void contextualClose();
1215 
1216  /**
1217  * @brief Finish the contextual window
1218  *
1219  * @sa contextualBegin(), contextualClose()
1220  */
1221  void contextualEnd();
1222 
1223  /**
1224  * @}
1225  */
1226 
1227  /**
1228  * @name Tooltip
1229  * @{
1230  */
1231 
1232  /**
1233  * @brief A simple tooltip with a text
1234  *
1235  * @param text The text of the tooltip
1236  */
1237  void tooltip(const std::string& text);
1238 
1239  /**
1240  * @brief Start a tooltip
1241  *
1242  * @param width The with of the tooltip
1243  * @returns True if the tooltip is open
1244  *
1245  * @sa tooltipEnd()
1246  */
1247  bool tooltipBegin(float width);
1248 
1249  /**
1250  * @brief Finish a tooltip
1251  *
1252  * @sa tooltipBegin()
1253  */
1254  void tooltipEnd();
1255 
1256  /**
1257  * @}
1258  */
1259 
1260  /**
1261  * @name Menu
1262  * @{
1263  */
1264 
1265  /**
1266  * @brief Start a menu bar
1267  *
1268  * @sa menubarEnd()
1269  */
1270  void menubarBegin();
1271 
1272  /**
1273  * @brief Finish a menu bar
1274  *
1275  * @sa menubarBegin()
1276  */
1277  void menubarEnd();
1278 
1279  /**
1280  * @brief Start a menu with a label
1281  *
1282  * @param title The title of the label
1283  * @param align The alignment of the text in the label
1284  * @param size The size of the menu
1285  * @returns True if the menu is open
1286  *
1287  * @sa menuClose(), menuEnd()
1288  */
1289  bool menuBeginLabel(StringRef title, UIAlignment align, Vector2f size);
1290 
1291  /**
1292  * @brief Start a menu with a symbol
1293  *
1294  * @param id A unique identifier for the menu
1295  * @param symbol A symbol for the menu
1296  * @param size The size of the menu
1297  * @returns True if the menu is open
1298  *
1299  * @sa menuClose(), menuEnd()
1300  */
1301  bool menuBeginSymbol(const std::string& id, UISymbol symbol, Vector2f size);
1302 
1303  /**
1304  * @brief Start a menu with a symbol and a label
1305  *
1306  * @param symbol A symbol for the menu
1307  * @param title The title of the label
1308  * @param align The alignment of the text in the label
1309  * @param size The size of the menu
1310  * @returns True if the menu is open
1311  *
1312  * @sa menuClose(), menuEnd()
1313  */
1314  bool menuBeginSymbolLabel(UISymbol symbol, StringRef title, UIAlignment align, Vector2f size);
1315 
1316  /**
1317  * @brief A label inside the menu
1318  *
1319  * @param title The title of the label
1320  * @param align The alignment of the text in the label
1321  * @returns True if the item is selected
1322  */
1324 
1325  /**
1326  * @brief A symbol and a label inside the menu
1327  *
1328  * @param symbol The symbol of the item
1329  * @param title The title of the label
1330  * @param align The alignment of the text in the label
1331  * @returns True if the item is selected
1332  */
1334 
1335  /**
1336  * @brief Close a menu
1337  *
1338  * @sa menuEnd()
1339  */
1340  void menuClose();
1341 
1342  /**
1343  * @brief Finish a menu
1344  *
1345  * @sa menuClose(), menuBeginLabel(), menuBeginSymbol(), menuBeginSymbolLabel()
1346  */
1347  void menuEnd();
1348 
1349  /**
1350  * @}
1351  */
1352 
1353  /**
1354  * @name Utilities
1355  * @{
1356  */
1357 
1358  /**
1359  * @brief Get the current widget bounds
1360  *
1361  * @returns The bounds of the widget
1362  */
1363  RectF getWidgetBounds();
1364 
1365  /**
1366  * @brief Check if the widget is hovered by the mouse
1367  *
1368  * You must do this check just after the layout specification
1369  *
1370  * @returns True if the mouse hovers the widget
1371  */
1372  bool isWidgetHovered();
1373 
1374  /**
1375  * @}
1376  */
1377 
1378  /**
1379  * @name Style
1380  * @{
1381  */
1382 
1383  /**
1384  * @brief Set a predefined style for all the windows and the widgets
1385  *
1386  * @param style The predefined style
1387  *
1388  * @sa gf::UIPredefinedStyle
1389  */
1391 
1392  /**
1393  * @}
1394  */
1395 
1396  virtual void draw(RenderTarget &target, RenderStates states) override;
1397 
1398  private:
1399  enum class State {
1400  Start,
1401  Input,
1402  Setup,
1403  Draw,
1404  };
1405 
1406  void setState(State state);
1407 
1408  private:
1409  struct UIImpl;
1410 
1411  std::unique_ptr<UIImpl> m_impl;
1412  };
1413 
1414 
1415 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1416 }
1417 #endif
1418 
1419 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1420 template<>
1421 struct EnableBitmaskOperators<UIWindow> {
1422  static constexpr bool value = true;
1423 };
1424 
1425 template<>
1426 struct EnableBitmaskOperators<UIEdit> {
1427  static constexpr bool value = true;
1428 };
1429 
1430 template<>
1431 struct EnableBitmaskOperators<UIEditEvent> {
1432  static constexpr bool value = true;
1433 };
1434 #endif
1435 
1436 }
1437 
1438 #endif // GF_UI_H
The window's scrollbar can hide automatically.
void setPredefinedStyle(UIPredefinedStyle style)
Set a predefined style for all the windows and the widgets.
void popupClose()
Close a popup window.
The window can be moved by the user.
The row has a dynamic layout.
UI(const UI &)=delete
Deleted copy constructor.
The tree is a node, generally an internal node of the tree.
The row has a static layout.
void labelColored(const Color4f &color, StringRef title, UIAlignment align=UIAlignment::Left)
A label with colored text.
bool isWidgetHovered()
Check if the widget is hovered by the mouse.
UILayout
Layout property for rows.
Definition: UI.h:85
bool fileSelector(UIBrowser &browser, const std::string &title, const RectF &bounds)
File selector.
void tooltipEnd()
Finish a tooltip.
Edit widget is not active and is not being modified.
void comboEnd()
Finish a combo box.
The button is active once.
bool groupScrolledBegin(UIScroll &scroll, const std::string &title, UIWindowFlags flags=None)
Start a scrolled group.
void label(StringRef title, UIAlignment align=UIAlignment::Left)
A simple label with text.
static constexpr unsigned DefaultCharacterSize
The default size for the font.
Definition: UI.h:414
Edit widget is currently being modified.
bool menuBeginSymbolLabel(UISymbol symbol, StringRef title, UIAlignment align, Vector2f size)
Start a menu with a symbol and a label.
bool comboBeginSymbol(UISymbol symbol, Vector2f size)
Start a combo box with a symbol.
UIEditEvent
Properties for edit events.
Definition: UI.h:199
void image(const Texture &texture, const RectF &textureRect)
An image.
Base class for all render targets (window, texture, ...)
Definition: RenderTarget.h:65
~UI()
Destructor.
UIPopup
Type of popup.
Definition: UI.h:244
bool contextualBegin(UIWindowFlags flags, Vector2f size, const RectF &triggerBounds)
Start a contextual window.
Define the states used for drawing to a RenderTarget.
Definition: RenderStates.h:82
void menubarBegin()
Start a menu bar.
Bitfield relying on an enumeration.
Definition: Flags.h:68
UIEditFilter
Filters for edit.
Definition: UI.h:219
UIProgress
State of the progress bar.
Definition: UI.h:130
bool buttonLabel(StringRef title)
A button with a centered label.
static const UIEditFlags Field
Definition: UI.h:190
The button is active as long as it is pressed.
RectF windowGetBounds()
The tree is maximized.
The popup is static.
UI(Font &font, unsigned characterSize=DefaultCharacterSize)
Constructor.
UIPredefinedStyle
A predefined style.
Definition: UI.h:253
void menuEnd()
Finish a menu.
Context for an immediate mode graphical interface.
Definition: UI.h:409
bool buttonColor(const Color4f &color)
A button with a color.
void processEvent(const Event &event)
Update the internal state with an event.
void layoutRow(UILayout format, float height, ArrayRef< float > ratio)
Array-based custom column layout.
bool buttonSymbol(UISymbol symbol)
A button with a symbol.
bool checkbox(StringRef title, bool &active)
A checkbox with a title.
Path currentPath
The current path for searching.
Definition: UI.h:236
The window is scalable by the user.
bool menuItemLabel(StringRef title, UIAlignment align=UIAlignment::Left)
A label inside the menu.
bool popupBegin(UIPopup type, const std::string &title, UIWindowFlags flags, const RectF &bounds)
Start a popup window.
void combobox(const std::vector< std::string > &items, int &selected, int itemHeight, Vector2f size)
A simple combo box with a list of item.
void buttonSetBehavior(UIButtonBehavior behavior)
Change the behavior of buttons.
Centered alignment.
bool colorPicker(Color4f &color)
A color picker.
bool radio(StringRef title, bool &active)
A radio button with a reference state.
The popup is dynamic.
void layoutRowStatic(float height, int itemWidth, int cols)
Static row with fixed column layout.
A reference to a modifiable buffer and its size.
Definition: BufferRef.h:43
bool comboBeginLabel(StringRef selected, Vector2f size)
Start a combo box with a label.
Abstract base class for objects that can be drawn to a render window.
Definition: Drawable.h:79
void groupEnd()
Finish a group.
bool contextualItemLabel(StringRef title, UIAlignment align=UIAlignment::Left)
A label inside the contextual window.
bool sliderInt(int min, int &val, int max, int step)
A slider for an int value.
void labelWrapColored(const Color4f &color, StringRef title)
A label with colored text that can wrap.
The tree is a tabulation, generally the root of the tree.
bool comboBeginColor(const Color4f &color, Vector2f size)
Start a combo box with a color.
The window has a border.
A red and gray style.
Edit widget has received an enter and lost focus.
Solid rectangle.
void separator(float height)
An empty separator.
UIAlignment
The alignment of the text.
Definition: UI.h:105
A texture for colored images.
Definition: Texture.h:339
void contextualEnd()
Finish the contextual window.
UI & operator=(const UI &)=delete
Deleted copy assignment.
void menubarEnd()
Finish a menu bar.
void comboClose()
Close a combo box.
static const UIEditFlags Box
Definition: UI.h:191
bool progress(std::size_t &current, std::size_t max, UIProgress modifyable=UIProgress::Modifyable)
A progress bar.
UIButtonBehavior
Behavior for buttons.
Definition: UI.h:121
bool treePush(UITree type, const std::string &title, UICollapse &state)
Start a tree layout.
bool groupBegin(const std::string &title, UIWindowFlags flags=None)
Start a group.
bool buttonSymbolLabel(UISymbol symbol, StringRef title, UIAlignment align=UIAlignment::Left)
A button with a symbol and a centered label.
Data for file selector.
Definition: UI.h:235
The window can be closed with an icon in the header.
void layoutRowBegin(UILayout format, float height, int cols)
Start an immediate mode custom column layout.
The namespace for gf classes.
Definition: Action.h:34
void propertyFloat(const std::string &name, float min, float &val, float max, float step, float incPerPixel)
A property for a float.
A blue and light gray style.
X symbol.
A constant reference to an array and its size.
Definition: ArrayRef.h:42
bool menuBeginSymbol(const std::string &id, UISymbol symbol, Vector2f size)
Start a menu with a symbol.
A character font.
Definition: Font.h:130
virtual void draw(RenderTarget &target, RenderStates states) override
Draw the object to a render target.
Outline rectangle.
The progress bar can be modified.
static const UIEditFlags Simple
Definition: UI.h:189
Right alignment.
static const UIEditFlags Editor
Definition: UI.h:192
void menuClose()
Close a menu.
bool menuItemSymbolLabel(UISymbol symbol, StringRef title, UIAlignment align=UIAlignment::Left)
A symbol and a label inside the menu.
bool comboItemSymbolLabel(UISymbol symbol, StringRef title, UIAlignment align=UIAlignment::Left)
A symbol and a label inside the combo box.
UIEditEventFlags edit(UIEditFlags flags, BufferRef< char > buffer, std::size_t &length, UIEditFilter filter=UIEditFilter::Default)
UI & operator=(UI &&other)
Move assignment.
RectF getWidgetBounds()
Get the current widget bounds.
void labelWrap(StringRef title)
A simple label that can wrap.
void propertyDouble(const std::string &name, double min, double &val, double max, double step, float incPerPixel)
A property for a double.
void groupScrolledEnd()
Finish a scrolled group.
The tree is minimized.
UICollapse
Collapse property of a tree.
Definition: UI.h:76
void layoutRowPush(float width)
Specify the width of the next column.
void layoutRowEnd()
Finish an immediate mode custom column layout.
A light gray style.
UIEdit
Properties for edit widgets.
Definition: UI.h:159
UI(UI &&other)
Move constructor.
bool menuBeginLabel(StringRef title, UIAlignment align, Vector2f size)
Start a menu with a label.
Edit widget went from state inactive to state active.
bool sliderFloat(float min, float &val, float max, float step)
A slider for a float value.
The progress bar is fixed.
void comboboxSeparator(const std::string &itemsSeparatedBySeparator, char separator, int &selected, int itemHeight, Vector2f size)
A simple combo box with a string and a separator.
Predefined flags for edit.
Definition: UI.h:188
bool comboBeginSymbolLabel(UISymbol symbol, StringRef selected, Vector2f size)
Start a combo box with a symbol and a label.
bool buttonPushBehavior(UIButtonBehavior behavior)
Push a new behavior of buttons.
A constant reference to a string and its size.
Definition: StringRef.h:41
UISymbol
A representative symbol.
Definition: UI.h:139
Left alignment.
The window is in the background.
constexpr NoneType None
Constant to represent "none".
Definition: Types.h:45
The window has no scrollbar.
bool buttonPopBehavior()
Pop the previous behavior of buttons.
void popupEnd()
Finish a popup window.
void treePop()
Finish a tree layout.
UITree
The type of tree.
Definition: UI.h:94
bool tooltipBegin(float width)
Start a tooltip.
void layoutRowDynamic(float height, int cols)
Dynamic row with fixed column layout.
bool selectableLabel(StringRef title, UIAlignment align, bool &value)
A selectable label.
bool begin(const std::string &title, const RectF &bounds, UIWindowFlags flags=None)
Create a window.
void contextualClose()
Close the contextual window.
Defines a system event and its parameters.
Definition: Event.h:118
#define GF_API
Definition: Portability.h:35
void windowSetBounds(const RectF &bounds)
General purpose math vector.
Definition: Vector.h:60
void tooltip(const std::string &text)
A simple tooltip with a text.
UIWindow
Properties for windows and window-like elements.
Definition: UI.h:52
A dark gray and dark blue style.
bool checkboxFlags(StringRef title, unsigned &flags, unsigned value)
A checkbox with a title for flags.
bool comboItemLabel(StringRef title, UIAlignment align=UIAlignment::Left)
A label inside the combo box.
The window can be minimized with an icon in the header.
void end()
Finish a window.
void propertyInt(const std::string &name, int min, int &val, int max, int step, float incPerPixel)
A property for an integer.
bool contextualItemSymbolLabel(UISymbol symbol, StringRef title, UIAlignment align=UIAlignment::Left)
A symbol and a label inside the contextual window.
Edit widget went from state active to state inactive.
Path selectedPath
The selected path.
Definition: UI.h:237
The window has a title in the header.
bool option(StringRef title, bool active)
A radio button without state.