TGUI  0.9-dev
Signal.hpp
1 //
3 // TGUI - Texus' Graphical User Interface
4 // Copyright (C) 2012-2020 Bruno Van de Velde (vdv_b@tgui.eu)
5 //
6 // This software is provided 'as-is', without any express or implied warranty.
7 // In no event will the authors be held liable for any damages 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 freely,
11 // subject to the following restrictions:
12 //
13 // 1. The origin of this software must not be misrepresented;
14 // you must not claim that you wrote the original software.
15 // If you use this software in a product, an acknowledgment
16 // in the product documentation would be appreciated but is not required.
17 //
18 // 2. Altered source versions must be plainly marked as such,
19 // and must not be misrepresented as being the original software.
20 //
21 // 3. This notice may not be removed or altered from any source distribution.
22 //
24 
25 
26 #ifndef TGUI_SIGNAL_HPP
27 #define TGUI_SIGNAL_HPP
28 
30 
31 #include <TGUI/Global.hpp>
32 #include <TGUI/String.hpp>
33 #include <TGUI/Vector2.hpp>
34 #include <TGUI/Animation.hpp>
35 #include <type_traits>
36 #include <functional>
37 #include <typeindex>
38 #include <memory>
39 #include <vector>
40 #include <deque>
41 #include <map>
42 
44 
45 namespace tgui
46 {
47  class Widget;
48  class ChildWindow;
49 
51  namespace Signals
52  {
53  struct Widget
54  {
55  static constexpr const char* const PositionChanged = "PositionChanged";
56  static constexpr const char* const SizeChanged = "SizeChanged";
57  static constexpr const char* const Focused = "Focused";
58  static constexpr const char* const Unfocused = "Unfocused";
59  static constexpr const char* const MouseEntered = "MouseEntered";
60  static constexpr const char* const MouseLeft = "MouseLeft";
61  static constexpr const char* const AnimationFinished = "AnimationFinished";
62  };
63 
64  struct ClickableWidget : public Widget
65  {
66  static constexpr const char* const MousePressed = "MousePressed";
67  static constexpr const char* const MouseReleased = "MouseReleased";
68  static constexpr const char* const Clicked = "Clicked";
69  static constexpr const char* const RightMousePressed = "RightMousePressed";
70  static constexpr const char* const RightMouseReleased = "RightMouseReleased";
71  static constexpr const char* const RightClicked = "RightClicked";
72  };
73 
74  struct Button : public ClickableWidget
75  {
76  static constexpr const char* const Pressed = "Pressed";
77  };
78 
79  struct ChildWindow : public Widget
80  {
81  static constexpr const char* const MousePressed = "MousePressed";
82  static constexpr const char* const Closed = "Closed";
83  static constexpr const char* const Minimized = "Minimized";
84  static constexpr const char* const Maximized = "Maximized";
85  static constexpr const char* const EscapeKeyPressed = "EscapeKeyPressed";
86  };
87 
88  struct ComboBox : public Widget
89  {
90  static constexpr const char* const ItemSelected = "ItemSelected";
91  };
92 
93  struct EditBox : public ClickableWidget
94  {
95  static constexpr const char* const TextChanged = "TextChanged";
96  static constexpr const char* const ReturnKeyPressed = "ReturnKeyPressed";
97  static constexpr const char* const ReturnOrUnfocused = "ReturnOrUnfocused";
98  };
99 
100  struct Knob : public Widget
101  {
102  static constexpr const char* const ValueChanged = "ValueChanged";
103  };
104 
105  struct Label : public ClickableWidget
106  {
107  static constexpr const char* const DoubleClicked = "DoubleClicked";
108  };
109 
110  struct ListBox : public Widget
111  {
112  static constexpr const char* const ItemSelected = "ItemSelected";
113  static constexpr const char* const MousePressed = "MousePressed";
114  static constexpr const char* const MouseReleased = "MouseReleased";
115  static constexpr const char* const DoubleClicked = "DoubleClicked";
116  };
117 
118  struct ListView : public Widget
119  {
120  static constexpr const char* const ItemSelected = "ItemSelected";
121  static constexpr const char* const DoubleClicked = "DoubleClicked";
122  static constexpr const char* const RightClicked = "RightClicked";
123  static constexpr const char* const HeaderClicked = "HeaderClicked";
124  };
125 
126  struct MenuBar : public Widget
127  {
132  static constexpr const char* const MenuItemClicked = "MenuItemClicked";
133  };
134 
135  struct MessageBox : public ChildWindow
136  {
137  static constexpr const char* const ButtonPressed = "ButtonPressed";
138  };
139 
140  struct Panel : public Widget
141  {
142  static constexpr const char* const MousePressed = "MousePressed";
143  static constexpr const char* const MouseReleased = "MouseReleased";
144  static constexpr const char* const Clicked = "Clicked";
145  static constexpr const char* const RightMousePressed = "RightMousePressed";
146  static constexpr const char* const RightMouseReleased = "RightMouseReleased";
147  static constexpr const char* const RightClicked = "RightClicked";
148  };
149 
150  struct Picture : public ClickableWidget
151  {
152  static constexpr const char* const DoubleClicked = "DoubleClicked";
153  };
154 
155  struct ProgressBar : public ClickableWidget
156  {
157  static constexpr const char* const ValueChanged = "ValueChanged";
158  static constexpr const char* const Full = "Full";
159  };
160 
161  struct RadioButton : public ClickableWidget
162  {
163  static constexpr const char* const Checked = "Checked";
164  static constexpr const char* const Unchecked = "Unchecked";
165  static constexpr const char* const Changed = "Changed";
166  };
167 
168  struct RangeSlider : public Widget
169  {
170  static constexpr const char* const RangeChanged = "RangeChanged";
171  };
172 
173  struct Scrollbar : public Widget
174  {
175  static constexpr const char* const ValueChanged = "ValueChanged";
176  };
177 
178  struct Slider : public Widget
179  {
180  static constexpr const char* const ValueChanged = "ValueChanged";
181  };
182 
183  struct SpinButton : public ClickableWidget
184  {
185  static constexpr const char* const ValueChanged = "ValueChanged";
186  };
187 
188  struct Tabs : public Widget
189  {
190  static constexpr const char* const TabSelected = "TabSelected";
191  };
192 
193  struct TextBox : public Widget
194  {
195  static constexpr const char* const TextChanged = "TextChanged";
196  static constexpr const char* const SelectionChanged = "SelectionChanged";
197  };
198 
199  struct TreeView : public Widget
200  {
201  static constexpr const char* const ItemSelected = "ItemSelected";
202  static constexpr const char* const DoubleClicked = "DoubleClicked";
203  static constexpr const char* const Expanded = "Expanded";
204  static constexpr const char* const Collapsed = "Collapsed";
205  static constexpr const char* const RightClicked = "RightClicked";
206  };
207 
208  using BitmapButton = Button;
209  using CheckBox = RadioButton;
210  using ScrollablePanel = Panel;
211  }
212 
216  class TGUI_API Signal
217  {
218  public:
219 
223  virtual ~Signal() = default;
224 
225 
232  Signal(String&& name, std::size_t extraParameters = 0) :
233  m_name{std::move(name)}
234  {
235  if (1 + extraParameters > m_parameters.size())
236  m_parameters.resize(1 + extraParameters);
237  }
238 
239 
243  Signal(const Signal& other);
244 
245 
249  Signal(Signal&& other) noexcept = default;
250 
251 
255  Signal& operator=(const Signal& other);
256 
257 
261  Signal& operator=(Signal&& other) noexcept = default;
262 
263 
272  template <typename Func, typename... BoundArgs>
273  unsigned int operator()(const Func& func, const BoundArgs&... args)
274  {
275  return connect(func, args...);
276  }
277 
278 
287  template <typename Func, typename... BoundArgs, typename std::enable_if_t<std::is_convertible<Func, std::function<void(const BoundArgs&...)>>::value>* = nullptr>
288  unsigned int connect(const Func& func, const BoundArgs&... args)
289  {
290  const auto id = ++m_lastSignalId;
291 #if defined(__cpp_if_constexpr) && (__cpp_if_constexpr >= 201606L)
292  if constexpr(sizeof...(BoundArgs) == 0)
293  m_handlers[id] = func;
294  else
295 #endif
296  {
297  m_handlers[id] = [=]{ invokeFunc(func, args...); };
298  }
299 
300  return id;
301  }
302 
303 
311  template <typename Func, typename... BoundArgs, typename std::enable_if_t<std::is_convertible<Func, std::function<void(const BoundArgs&..., std::shared_ptr<Widget>, const String&)>>::value>* = nullptr>
312  unsigned int connectEx(const Func& func, const BoundArgs&... args)
313  {
314  // The name is copied so that the lambda does not depend on the 'this' pointer
315  return connect([func, name=m_name, args...](){ invokeFunc(func, args..., getWidget(), name); });
316  }
317 
318 
326  bool disconnect(unsigned int id);
327 
328 
332  void disconnectAll();
333 
334 
342  bool emit(const Widget* widget);
343 
344 
350  String getName() const
351  {
352  return m_name;
353  }
354 
355 
364  void setEnabled(bool enabled)
365  {
366  m_enabled = enabled;
367  }
368 
369 
378  bool isEnabled() const
379  {
380  return m_enabled;
381  }
382 
383 
385  protected:
386 
390  static std::shared_ptr<Widget> getWidget();
391 
392 
396  template <typename Type>
397  static const std::decay_t<Type>& dereferenceParam(std::size_t paramIndex)
398  {
399  return *static_cast<const std::decay_t<Type>*>(m_parameters[paramIndex]);
400  }
401 
402 
403 #if defined(__cpp_lib_invoke) && (__cpp_lib_invoke >= 201411L)
404  template <typename Func, typename... Args>
405  static void invokeFunc(Func&& func, Args&&... args)
406  {
407  std::invoke(std::forward<Func>(func), std::forward<Args>(args)...);
408  }
409 #else
410  // std::invoke only exists in c++17 so we use our own implementation to support c++14 compilers
411  template <typename Func, typename... Args, typename std::enable_if<std::is_member_pointer<typename std::decay<Func>::type>::value>::type* = nullptr>
412  static void invokeFunc(Func&& func, Args&&... args)
413  {
414  std::mem_fn(func)(std::forward<Args>(args)...);
415  }
416 
417  template <typename Func, typename... Args, typename std::enable_if<!std::is_member_pointer<typename std::decay<Func>::type>::value>::type* = nullptr>
418  static void invokeFunc(Func&& func, Args&&... args)
419  {
420  std::forward<Func>(func)(std::forward<Args>(args)...);
421  }
422 #endif
423 
424 
426  protected:
427 
428  bool m_enabled = true;
429  String m_name;
430  std::map<unsigned int, std::function<void()>> m_handlers;
431 
432  static unsigned int m_lastSignalId;
433  static std::deque<const void*> m_parameters;
434  };
435 
436 
443  template <typename T>
444  class SignalTyped : public Signal
445  {
446  public:
447 
451  SignalTyped(String&& name) :
452  Signal{std::move(name), 1}
453  {
454  }
455 
456 
465  template <typename Func, typename... BoundArgs>
466  unsigned int operator()(const Func& func, const BoundArgs&... args)
467  {
468  return connect(func, args...);
469  }
470 
471 
480  template <typename Func, typename... BoundArgs, typename std::enable_if_t<std::is_convertible<Func, std::function<void(const BoundArgs&...)>>::value>* = nullptr>
481  unsigned int connect(const Func& func, const BoundArgs&... args)
482  {
483  return Signal::connect(func, args...);
484  }
485 
486 
495  template <typename Func, typename... BoundArgs, typename std::enable_if_t<std::is_convertible<Func, std::function<void(const BoundArgs&..., T)>>::value>* = nullptr>
496  unsigned int connect(const Func& func, const BoundArgs&... args)
497  {
498  return Signal::connect([=]{ invokeFunc(func, args..., dereferenceParam<T>(1)); });
499  }
500 
501 
510  bool emit(const Widget* widget, T param)
511  {
512  if (m_handlers.empty())
513  return false;
514 
515  m_parameters[1] = static_cast<const void*>(&param);
516  return Signal::emit(widget);
517  }
518  };
519 
520 
527  template <typename T1, typename T2>
528  class SignalTyped2 : public Signal
529  {
530  public:
531 
536  Signal{std::move(name), 2}
537  {
538  }
539 
540 
549  template <typename Func, typename... BoundArgs>
550  unsigned int operator()(const Func& func, const BoundArgs&... args)
551  {
552  return connect(func, args...);
553  }
554 
555 
564  template <typename Func, typename... BoundArgs, typename std::enable_if_t<std::is_convertible<Func, std::function<void(const BoundArgs&...)>>::value>* = nullptr>
565  unsigned int connect(const Func& func, const BoundArgs&... args)
566  {
567  return Signal::connect(func, args...);
568  }
569 
570 
579  template <typename Func, typename... BoundArgs, typename std::enable_if_t<std::is_convertible<Func, std::function<void(const BoundArgs&..., T1, T2)>>::value>* = nullptr>
580  unsigned int connect(const Func& func, const BoundArgs&... args)
581  {
582  return Signal::connect([=]{ invokeFunc(func, args..., dereferenceParam<T1>(1), dereferenceParam<T2>(2)); });
583  }
584 
585 
595  bool emit(const Widget* widget, T1 param1, T2 param2)
596  {
597  if (m_handlers.empty())
598  return false;
599 
600  m_parameters[1] = static_cast<const void*>(&param1);
601  m_parameters[2] = static_cast<const void*>(&param2);
602  return Signal::emit(widget);
603  }
604  };
605 
613 
614 
621  class TGUI_API SignalChildWindow : public Signal
622  {
623  public:
624 
629  Signal{std::move(name), 1}
630  {
631  }
632 
633 
642  template <typename Func, typename... BoundArgs>
643  unsigned int operator()(const Func& func, const BoundArgs&... args)
644  {
645  return connect(func, args...);
646  }
647 
648 
657  template <typename Func, typename... BoundArgs, typename std::enable_if_t<std::is_convertible<Func, std::function<void(const BoundArgs&...)>>::value>* = nullptr>
658  unsigned int connect(const Func& func, const BoundArgs&... args)
659  {
660  return Signal::connect(func, args...);
661  }
662 
663 
672  template <typename Func, typename... BoundArgs, typename std::enable_if_t<std::is_convertible<Func, std::function<void(const BoundArgs&..., const std::shared_ptr<ChildWindow>&)>>::value>* = nullptr>
673  unsigned int connect(const Func& func, const BoundArgs&... args)
674  {
675  return Signal::connect([=]{ invokeFunc(func, args..., dereferenceChildWindow()); });
676  }
677 
678 
686  bool emit(ChildWindow* param);
687 
688 
690  private:
691 
695  static std::shared_ptr<ChildWindow> dereferenceChildWindow();
696 
697 
699  };
700 
701 
710  class TGUI_API SignalItem : public Signal
711  {
712  public:
713 
717  SignalItem(String&& name) :
718  Signal{std::move(name), 3}
719  {
720  }
721 
722 
731  template <typename Func, typename... BoundArgs>
732  unsigned int operator()(const Func& func, const BoundArgs&... args)
733  {
734  return connect(func, args...);
735  }
736 
737 
746  template <typename Func, typename... BoundArgs, typename std::enable_if_t<std::is_convertible<Func, std::function<void(const BoundArgs&...)>>::value>* = nullptr>
747  unsigned int connect(const Func& func, const BoundArgs&... args)
748  {
749  return Signal::connect(func, args...);
750  }
751 
752 
761  template <typename Func, typename... BoundArgs, typename std::enable_if_t<std::is_convertible<Func, std::function<void(const BoundArgs&..., int)>>::value>* = nullptr>
762  unsigned int connect(const Func& func, const BoundArgs&... args)
763  {
764  return Signal::connect([=]{ invokeFunc(func, args..., dereferenceParam<int>(1)); });
765  }
766 
767 
776  template <typename Func, typename... BoundArgs, typename std::enable_if_t<std::is_convertible<Func, std::function<void(const BoundArgs&..., const String&)>>::value>* = nullptr>
777  unsigned int connect(const Func& func, const BoundArgs&... args)
778  {
779  return Signal::connect([=]{ invokeFunc(func, args..., dereferenceParam<String>(2)); });
780  }
781 
782 
791  template <typename Func, typename... BoundArgs, typename std::enable_if_t<std::is_convertible<Func, std::function<void(const BoundArgs&..., const String&, const String&)>>::value>* = nullptr>
792  unsigned int connect(const Func& func, const BoundArgs&... args)
793  {
794  return Signal::connect([=]{ invokeFunc(func, args..., dereferenceParam<String>(2), dereferenceParam<String>(3)); });
795  }
796 
797 
808  bool emit(const Widget* widget, int index, const String& item, const String& id);
809 
810 
812  };
813 
814 
823  class TGUI_API SignalAnimation : public Signal
824  {
825  public:
826 
831  Signal{std::move(name), 2}
832  {
833  }
834 
835 
844  template <typename Func, typename... BoundArgs>
845  unsigned int operator()(const Func& func, const BoundArgs&... args)
846  {
847  return connect(func, args...);
848  }
849 
850 
859  template <typename Func, typename... BoundArgs, typename std::enable_if_t<std::is_convertible<Func, std::function<void(const BoundArgs&...)>>::value>* = nullptr>
860  unsigned int connect(const Func& func, const BoundArgs&... args)
861  {
862  return Signal::connect(func, args...);
863  }
864 
865 
874  template <typename Func, typename... BoundArgs, typename std::enable_if_t<std::is_convertible<Func, std::function<void(const BoundArgs&..., ShowAnimationType)>>::value>* = nullptr>
875  unsigned int connect(const Func& func, const BoundArgs&... args)
876  {
877  return Signal::connect([=]{ invokeFunc(func, args..., dereferenceParam<ShowAnimationType>(1)); });
878  }
879 
880 
889  template <typename Func, typename... BoundArgs, typename std::enable_if_t<std::is_convertible<Func, std::function<void(const BoundArgs&..., bool)>>::value>* = nullptr>
890  unsigned int connect(const Func& func, const BoundArgs&... args)
891  {
892  return Signal::connect([=]{ invokeFunc(func, args..., dereferenceParam<bool>(2)); });
893  }
894 
895 
904  template <typename Func, typename... BoundArgs, typename std::enable_if_t<std::is_convertible<Func, std::function<void(const BoundArgs&..., ShowAnimationType, bool)>>::value>* = nullptr>
905  unsigned int connect(const Func& func, const BoundArgs&... args)
906  {
907  return Signal::connect([=]{ invokeFunc(func, args..., dereferenceParam<ShowAnimationType>(1), dereferenceParam<bool>(2)); });
908  }
909 
910 
920  bool emit(const Widget* widget, ShowAnimationType type, bool visible);
921 
922 
924  };
925 
926 
934  class TGUI_API SignalItemHierarchy : public Signal
935  {
936  public:
937 
942  Signal{std::move(name), 2}
943  {
944  }
945 
946 
955  template <typename Func, typename... BoundArgs>
956  unsigned int operator()(const Func& func, const BoundArgs&... args)
957  {
958  return connect(func, args...);
959  }
960 
961 
970  template <typename Func, typename... BoundArgs, typename std::enable_if_t<std::is_convertible<Func, std::function<void(const BoundArgs&...)>>::value>* = nullptr>
971  unsigned int connect(const Func& func, const BoundArgs&... args)
972  {
973  return Signal::connect(func, args...);
974  }
975 
976 
985  template <typename Func, typename... BoundArgs, typename std::enable_if_t<std::is_convertible<Func, std::function<void(const BoundArgs&..., const String&)>>::value>* = nullptr>
986  unsigned int connect(const Func& func, const BoundArgs&... args)
987  {
988  return Signal::connect([=]{ invokeFunc(func, args..., dereferenceParam<String>(1)); });
989  }
990 
991 
1000  template <typename Func, typename... BoundArgs, typename std::enable_if_t<std::is_convertible<Func, std::function<void(const BoundArgs&..., const std::vector<String>&)>>::value>* = nullptr>
1001  unsigned int connect(const Func& func, const BoundArgs&... args)
1002  {
1003  return Signal::connect([=]{ invokeFunc(func, args..., dereferenceParam<std::vector<String>>(2)); });
1004  }
1005 
1006 
1016  bool emit(const Widget* widget, const String& item, const std::vector<String>& fullItem);
1017 
1018 
1020  };
1021 
1023 }
1024 
1026 
1027 #endif // TGUI_SIGNAL_HPP
static constexpr const char *const SelectionChanged
Selected text changed.
Definition: Signal.hpp:196
Definition: Signal.hpp:79
Definition: Signal.hpp:199
static constexpr const char *const ValueChanged
Value of the spin button changed. Optional parameter: new value.
Definition: Signal.hpp:185
Signal to which the user can subscribe to get callbacks from.
Definition: Signal.hpp:216
Definition: Signal.hpp:183
static constexpr const char *const Focused
The widget was focused.
Definition: Signal.hpp:57
SignalTyped2(String &&name)
Constructor.
Definition: Signal.hpp:535
unsigned int connect(const Func &func, const BoundArgs &... args)
Connects a signal handler that will be called when this signal is emitted.
Definition: Signal.hpp:673
unsigned int operator()(const Func &func, const BoundArgs &... args)
Connects a signal handler that will be called when this signal is emitted.
Definition: Signal.hpp:273
Definition: Signal.hpp:100
static const std::decay_t< Type > & dereferenceParam(std::size_t paramIndex)
Turns the void* parameters back into its original type right before calling the callback function.
Definition: Signal.hpp:397
Definition: Signal.hpp:155
Signal to which the user can subscribe to get callbacks from.
Definition: Signal.hpp:823
Definition: Signal.hpp:150
static constexpr const char *const SizeChanged
The size of the widget changed. Optional parameter: new size.
Definition: Signal.hpp:56
static constexpr const char *const RightClicked
The panel was right clicked. Optional parameter: mouse position relative to panel.
Definition: Signal.hpp:147
bool emit(const Widget *widget, T param)
Call all connected signal handlers.
Definition: Signal.hpp:510
ShowAnimationType
Type of animation to show/hide widget.
Definition: Animation.hpp:43
bool emit(const Widget *widget)
Call all connected signal handlers.
static constexpr const char *const RightMouseReleased
The right mouse button was released on top of the widget. Optional parameter: mouse position relative...
Definition: Signal.hpp:70
static constexpr const char *const DoubleClicked
A leaf node was double clicked. Optional parameter: selected node.
Definition: Signal.hpp:202
static constexpr const char *const Pressed
The button was pressed. Optional parameter: text of the button.
Definition: Signal.hpp:76
static constexpr const char *const Maximized
The window was maximized. Optional parameter: pointer to the window.
Definition: Signal.hpp:84
static constexpr const char *const Minimized
The window was minimized. Optional parameter: pointer to the window.
Definition: Signal.hpp:83
Definition: Signal.hpp:178
static constexpr const char *const TextChanged
The text was changed. Optional parameter: new text.
Definition: Signal.hpp:195
bool emit(const Widget *widget, T1 param1, T2 param2)
Call all connected signal handlers.
Definition: Signal.hpp:595
SignalItem(String &&name)
Constructor.
Definition: Signal.hpp:717
static constexpr const char *const Full
Value of the progress bar changed and he progress bar became full.
Definition: Signal.hpp:158
static constexpr const char *const Clicked
The panel was clicked. Optional parameter: mouse position relative to panel.
Definition: Signal.hpp:144
Definition: Signal.hpp:110
static constexpr const char *const ItemSelected
An item was selected in the list view. Optional parameter: selected item index (-1 when deselecting)
Definition: Signal.hpp:120
static constexpr const char *const ReturnOrUnfocused
The return key was pressed or the edit box was unfocused. Optional parameter: text in the edit box.
Definition: Signal.hpp:97
Signal to which the user can subscribe to get callbacks from.
Definition: Signal.hpp:621
SignalItemHierarchy(String &&name)
Constructor.
Definition: Signal.hpp:941
static constexpr const char *const AnimationFinished
A show or hide animation finished. Optional parameters: animation type, new widget visibility or both...
Definition: Signal.hpp:61
SignalTyped(String &&name)
Constructor.
Definition: Signal.hpp:451
Namespace that contains all TGUI functions and classes.
Definition: AbsoluteOrRelativeValue.hpp:35
unsigned int connectEx(const Func &func, const BoundArgs &... args)
Connects a signal handler that will be called when this signal is emitted.
Definition: Signal.hpp:312
Definition: Signal.hpp:193
Signal to which the user can subscribe to get callbacks from.
Definition: Signal.hpp:934
static constexpr const char *const ValueChanged
The value of the know changed. Optional parameter: new value.
Definition: Signal.hpp:102
static constexpr const char *const RightClicked
Right mouse clicked. Optional parameter: index of item below mouse (-1 when not on top of item)
Definition: Signal.hpp:122
static constexpr const char *const DoubleClicked
An item was double clicked. Optional parameter: selected item index.
Definition: Signal.hpp:121
static constexpr const char *const RightMousePressed
The right mouse button went down on the widget. Optional parameter: mouse position relative to widget...
Definition: Signal.hpp:69
static constexpr const char *const ValueChanged
Value of the scrollbar changed. Optional parameter: new value.
Definition: Signal.hpp:175
static constexpr const char *const DoubleClicked
An item was double clicked. Optional parameter: selected item or its index.
Definition: Signal.hpp:115
static constexpr const char *const DoubleClicked
The label was double clicked. Optional parameter: text of the label.
Definition: Signal.hpp:107
static constexpr const char *const Closed
The window was closed. Optional parameter: pointer to the window.
Definition: Signal.hpp:82
Definition: Signal.hpp:140
static constexpr const char *const PositionChanged
The position of the widget changed. Optional parameter: new position.
Definition: Signal.hpp:55
static constexpr const char *const RightClicked
A node was right clicked. Optional parameter: node below mouse.
Definition: Signal.hpp:205
SignalAnimation(String &&name)
Constructor.
Definition: Signal.hpp:830
static constexpr const char *const TabSelected
A tab that was selected. Optional parameter: selected item.
Definition: Signal.hpp:190
static constexpr const char *const Collapsed
A branch node was collapsed in the tree view. Optional parameter: collapsed node.
Definition: Signal.hpp:204
unsigned int connect(const Func &func, const BoundArgs &... args)
Connects a signal handler that will be called when this signal is emitted.
Definition: Signal.hpp:1001
Definition: Signal.hpp:188
Definition: Signal.hpp:168
Definition: Signal.hpp:93
unsigned int connect(const Func &func, const BoundArgs &... args)
Connects a signal handler that will be called when this signal is emitted.
Definition: Signal.hpp:288
Signal to which the user can subscribe to get callbacks from.
Definition: Signal.hpp:710
static constexpr const char *const HeaderClicked
The header was clicked. Optional parameter: column index.
Definition: Signal.hpp:123
static constexpr const char *const ItemSelected
An item was selected in the combo box. Optional parameter: selected item or its index.
Definition: Signal.hpp:90
unsigned int connect(const Func &func, const BoundArgs &... args)
Connects a signal handler that will be called when this signal is emitted.
Definition: Signal.hpp:971
static constexpr const char *const MousePressed
The mouse went down on the widget.
Definition: Signal.hpp:81
unsigned int operator()(const Func &func, const BoundArgs &... args)
Connects a signal handler that will be called when this signal is emitted.
Definition: Signal.hpp:643
void setEnabled(bool enabled)
Changes whether this signal calls the connected functions when triggered.
Definition: Signal.hpp:364
static constexpr const char *const Clicked
The widget was clicked. Optional parameter: mouse position relative to widget.
Definition: Signal.hpp:68
static constexpr const char *const ItemSelected
An item was selected in the list box. Optional parameter: selected item or its index.
Definition: Signal.hpp:112
static constexpr const char *const ValueChanged
Value of the slider changed. Optional parameter: new value.
Definition: Signal.hpp:180
String getName() const
Returns the name given to the signal.
Definition: Signal.hpp:350
static constexpr const char *const DoubleClicked
The picture was double clicked. Optional parameter: mouse position relative to picture.
Definition: Signal.hpp:152
Signal to which the user can subscribe to get callbacks from.
Definition: Signal.hpp:444
Child window widget.
Definition: ChildWindow.hpp:43
static constexpr const char *const Expanded
A branch node was expanded in the tree view. Optional parameter: expanded node.
Definition: Signal.hpp:203
static constexpr const char *const RightMousePressed
The right mouse button went down on the panel. Optional parameter: mouse position relative to panel.
Definition: Signal.hpp:145
Wrapper class to store strings.
Definition: String.hpp:70
Definition: Signal.hpp:105
static constexpr const char *const Unchecked
Radio button was unchecked. Optional parameter: bool which is always false.
Definition: Signal.hpp:164
static constexpr const char *const TextChanged
The text was changed. Optional parameter: new text.
Definition: Signal.hpp:95
static constexpr const char *const RightMouseReleased
The right mouse button was released on top of the panel. Optional parameter: mouse position relative ...
Definition: Signal.hpp:146
static constexpr const char *const MousePressed
The mouse went down on the panel. Optional parameter: mouse position relative to panel.
Definition: Signal.hpp:142
unsigned int operator()(const Func &func, const BoundArgs &... args)
Connects a signal handler that will be called when this signal is emitted.
Definition: Signal.hpp:466
static constexpr const char *const RangeChanged
Value of the slider changed. Optional parameter: new value.
Definition: Signal.hpp:170
unsigned int connect(const Func &func, const BoundArgs &... args)
Connects a signal handler that will be called when this signal is emitted.
Definition: Signal.hpp:658
Definition: Signal.hpp:173
Signal to which the user can subscribe to get callbacks from.
Definition: Signal.hpp:528
Definition: Signal.hpp:135
static constexpr const char *const EscapeKeyPressed
The escape key was pressed while the child window was focused. Optional parameter: pointer to the win...
Definition: Signal.hpp:85
The parent class for every widget.
Definition: Widget.hpp:68
Definition: Signal.hpp:118
static constexpr const char *const MouseLeft
The mouse left the widget.
Definition: Signal.hpp:60
Signal(String &&name, std::size_t extraParameters=0)
Constructor.
Definition: Signal.hpp:232
static constexpr const char *const MouseEntered
The mouse entered the widget.
Definition: Signal.hpp:59
unsigned int connect(const Func &func, const BoundArgs &... args)
Connects a signal handler that will be called when this signal is emitted.
Definition: Signal.hpp:860
static constexpr const char *const Changed
Radio button was checked or unchecked. Optional parameter: bool indicating whether it is checked.
Definition: Signal.hpp:165
unsigned int connect(const Func &func, const BoundArgs &... args)
Connects a signal handler that will be called when this signal is emitted.
Definition: Signal.hpp:481
unsigned int operator()(const Func &func, const BoundArgs &... args)
Connects a signal handler that will be called when this signal is emitted.
Definition: Signal.hpp:845
static constexpr const char *const Checked
Radio button was checked. Optional parameter: bool which is always true.
Definition: Signal.hpp:163
Definition: Signal.hpp:88
unsigned int operator()(const Func &func, const BoundArgs &... args)
Connects a signal handler that will be called when this signal is emitted.
Definition: Signal.hpp:956
Definition: Signal.hpp:53
unsigned int connect(const Func &func, const BoundArgs &... args)
Connects a signal handler that will be called when this signal is emitted.
Definition: Signal.hpp:565
static constexpr const char *const RightClicked
The widget was right clicked. Optional parameter: mouse position relative to widget.
Definition: Signal.hpp:71
static constexpr const char *const ItemSelected
An node was selected in the tree view. Optional parameter: selected node.
Definition: Signal.hpp:201
static constexpr const char *const MouseReleased
The mouse was released on top of the panel. Optional parameter: mouse position relative to panel.
Definition: Signal.hpp:143
Definition: Signal.hpp:74
static constexpr const char *const ButtonPressed
One of the buttons was pressed. Optional parameter: text of the pressed button.
Definition: Signal.hpp:137
Definition: Signal.hpp:64
static constexpr const char *const MouseReleased
The mouse was released on top of the widget. Optional parameter: mouse position relative to widget.
Definition: Signal.hpp:67
static constexpr const char *const MousePressed
The mouse went down on the widget. Optional parameter: mouse position relative to widget.
Definition: Signal.hpp:66
Definition: Signal.hpp:161
Definition: Signal.hpp:126
static constexpr const char *const MouseReleased
The mouse was released on one of the items. Optional parameter: selected item or its index.
Definition: Signal.hpp:114
static constexpr const char *const MousePressed
The mouse went down on an item. Optional parameter: selected item or its index.
Definition: Signal.hpp:113
static constexpr const char *const Unfocused
The widget was unfocused.
Definition: Signal.hpp:58
static constexpr const char *const ReturnKeyPressed
The return key was pressed. Optional parameter: text in the edit box.
Definition: Signal.hpp:96
static constexpr const char *const MenuItemClicked
Definition: Signal.hpp:132
SignalChildWindow(String &&name)
Constructor.
Definition: Signal.hpp:628
unsigned int connect(const Func &func, const BoundArgs &... args)
Connects a signal handler that will be called when this signal is emitted.
Definition: Signal.hpp:747
unsigned int operator()(const Func &func, const BoundArgs &... args)
Connects a signal handler that will be called when this signal is emitted.
Definition: Signal.hpp:550
bool isEnabled() const
Returns whether this signal calls the connected functions when triggered.
Definition: Signal.hpp:378
static constexpr const char *const ValueChanged
Value of the progress bar changed. Optional parameter: new value.
Definition: Signal.hpp:157
unsigned int operator()(const Func &func, const BoundArgs &... args)
Connects a signal handler that will be called when this signal is emitted.
Definition: Signal.hpp:732