Free Electron
ImguiHandler.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __imgui_ImguiHandler_h__
8 #define __imgui_ImguiHandler_h__
9 
10 namespace fe
11 {
12 namespace ext
13 {
14 
15 /**************************************************************************//**
16  @brief Dear Imgui draw and event handler
17 
18  @ingroup imgui
19 *//***************************************************************************/
20 class FE_DL_EXPORT ImguiHandler:
21  virtual public HandlerI,
22  public CastableAs<ImguiHandler>
23 {
24  public:
25  ImguiHandler(void);
26 virtual ~ImguiHandler(void);
27 
28 virtual void handle(Record& render);
29 
30  protected:
31 
32 virtual void updateGUI(void) {}
33 virtual void drawOverlay(void) {}
34 
35  sp<DrawI> m_spDrawI;
36 
37  Vector2 m_pixelScale;
38  Vector2i m_windowPosition;
39  Vector2i m_windowSize;
40 
41  private:
42  AsViewer m_asViewer;
43  WindowEvent m_event;
44 
45 
46  I32 m_mouseX;
47  I32 m_mouseY;
48  WindowEvent::MouseButtons m_mouseButtons;
49 };
50 
51 } /* namespace ext */
52 } /* namespace fe */
53 
54 //* see <imgui>/misc/cpp/imgui_stdlib.h
55 namespace ImGui
56 {
57 
58 // ImGui::InputText() with fe::String
59 // Because text input needs dynamic resizing,
60 // we need to setup a callback to grow the capacity
61 IMGUI_API bool InputText(const char* label,
62  fe::String* str,
63  ImGuiInputTextFlags flags = 0,
64  ImGuiInputTextCallback callback = NULL,
65  void* user_data = NULL);
66 IMGUI_API bool InputTextMultiline(const char* label,
67  fe::String* str,
68  const ImVec2& size = ImVec2(0, 0),
69  ImGuiInputTextFlags flags = 0,
70  ImGuiInputTextCallback callback = NULL,
71  void* user_data = NULL);
72 IMGUI_API bool InputTextWithHint(const char* label,
73  const char* hint,
74  fe::String* str,
75  ImGuiInputTextFlags flags = 0,
76  ImGuiInputTextCallback callback = NULL,
77  void* user_data = NULL);
78 
79 } // namespace ImGui
80 
81 #endif /* __imgui_ImguiHandler_h__ */
MouseButtons
State of the mouse buttons during an event.
Definition: WindowEvent.h:214
kernel
Definition: namespace.dox:3
Dear Imgui draw and event handler.
Definition: ImguiHandler.h:20
Interface to handle signals from an SignalerI.
Definition: HandlerI.h:22
Generalized windowing event.
Definition: WindowEvent.h:43
Automatically reference-counted string container.
Definition: String.h:128
Reference to an instance of a Layout.
Definition: RecordSB.h:35
Definition: ImguiHandler.h:55
SignalerViewerI attributes.
Definition: SignalerViewerI.h:37
Per-class participation non-RTTI fallback dynamic casting mechanism.
Definition: Castable.h:192