Skip to content

Commit 531d0ce

Browse files
committed
Moving tooltips and popup chunks of imgui.h below widgets (#219)
1 parent 0201fe6 commit 531d0ce

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

imgui.h

+24-24
Original file line numberDiff line numberDiff line change
@@ -162,22 +162,6 @@ namespace ImGui
162162
IMGUI_API void PushButtonRepeat(bool repeat); // in 'repeat' mode, Button*() functions return true multiple times as you hold them (uses io.KeyRepeatDelay/io.KeyRepeatRate for now)
163163
IMGUI_API void PopButtonRepeat();
164164

165-
// Tooltip
166-
IMGUI_API void SetTooltip(const char* fmt, ...); // set tooltip under mouse-cursor, typically use with ImGui::IsHovered(). last call wins
167-
IMGUI_API void SetTooltipV(const char* fmt, va_list args);
168-
IMGUI_API void BeginTooltip(); // use to create full-featured tooltip windows that aren't just text
169-
IMGUI_API void EndTooltip();
170-
171-
// Popup
172-
IMGUI_API void OpenPopup(const char* str_id); // mark popup as open. popup identifiers are relative to the current ID-stack (so OpenPopup and BeginPopup needs to be at the same level). close childs popups if any. will close popup when user click outside, or activate a pressable item, or CloseCurrentPopup() is called within a BeginPopup()/EndPopup() block.
173-
IMGUI_API bool BeginPopup(const char* str_id); // return true if popup if opened and start outputting to it. only call EndPopup() if BeginPopup() returned true!
174-
IMGUI_API bool BeginPopupModal(const char* name, bool* p_opened = NULL, ImGuiWindowFlags extra_flags = 0); // modal dialog (can't close them by clicking outside)
175-
IMGUI_API bool BeginPopupContextItem(const char* str_id, int mouse_button = 1); // helper to open and begin popup when clicked on last item
176-
IMGUI_API bool BeginPopupContextWindow(bool also_over_items = true, const char* str_id = NULL, int mouse_button = 1); // helper to open and begin popup when clicked on current window
177-
IMGUI_API bool BeginPopupContextVoid(const char* str_id = NULL, int mouse_button = 1); // helper to open and begin popup when clicked in void (no window)
178-
IMGUI_API void EndPopup();
179-
IMGUI_API void CloseCurrentPopup(); // close the popup we have begin-ed into. clicking on a MenuItem or Selectable automatically close the current popup.
180-
181165
// Cursor / Layout
182166
IMGUI_API void BeginGroup(); // once closing a group it is seen as a single item (so you can use IsItemHovered() on a group, SameLine() between groups, etc.
183167
IMGUI_API void EndGroup();
@@ -312,7 +296,21 @@ namespace ImGui
312296
IMGUI_API bool ListBoxHeader(const char* label, int items_count, int height_in_items = -1); // "
313297
IMGUI_API void ListBoxFooter(); // terminate the scrolling region
314298

315-
// Widgets: Menus
299+
// Widgets: Value() Helpers. Output single value in "name: value" format (tip: freely declare more in your code to handle your types. you can add functions to the ImGui namespace)
300+
IMGUI_API void Value(const char* prefix, bool b);
301+
IMGUI_API void Value(const char* prefix, int v);
302+
IMGUI_API void Value(const char* prefix, unsigned int v);
303+
IMGUI_API void Value(const char* prefix, float v, const char* float_format = NULL);
304+
IMGUI_API void Color(const char* prefix, const ImVec4& v);
305+
IMGUI_API void Color(const char* prefix, unsigned int v);
306+
307+
// Tooltip
308+
IMGUI_API void SetTooltip(const char* fmt, ...); // set tooltip under mouse-cursor, typically use with ImGui::IsHovered(). last call wins
309+
IMGUI_API void SetTooltipV(const char* fmt, va_list args);
310+
IMGUI_API void BeginTooltip(); // use to create full-featured tooltip windows that aren't just text
311+
IMGUI_API void EndTooltip();
312+
313+
// Menus
316314
IMGUI_API bool BeginMainMenuBar(); // create and append to a full screen menu-bar. only call EndMainMenuBar() if this returns true!
317315
IMGUI_API void EndMainMenuBar();
318316
IMGUI_API bool BeginMenuBar(); // append to menu-bar of current window (requires ImGuiWindowFlags_MenuBar flag set). only call EndMenuBar() if this returns true!
@@ -322,13 +320,15 @@ namespace ImGui
322320
IMGUI_API bool MenuItem(const char* label, const char* shortcut = NULL, bool selected = false, bool enabled = true); // return true when activated. shortcuts are displayed for convenience but not processed by ImGui at the moment
323321
IMGUI_API bool MenuItem(const char* label, const char* shortcut, bool* p_selected, bool enabled = true); // return true when activated + toggle (*p_selected) if p_selected != NULL
324322

325-
// Widgets: Value() Helpers. Output single value in "name: value" format (tip: freely declare more in your code to handle your types. you can add functions to the ImGui namespace)
326-
IMGUI_API void Value(const char* prefix, bool b);
327-
IMGUI_API void Value(const char* prefix, int v);
328-
IMGUI_API void Value(const char* prefix, unsigned int v);
329-
IMGUI_API void Value(const char* prefix, float v, const char* float_format = NULL);
330-
IMGUI_API void Color(const char* prefix, const ImVec4& v);
331-
IMGUI_API void Color(const char* prefix, unsigned int v);
323+
// Popup
324+
IMGUI_API void OpenPopup(const char* str_id); // mark popup as open. popup identifiers are relative to the current ID-stack (so OpenPopup and BeginPopup needs to be at the same level). close childs popups if any. will close popup when user click outside, or activate a pressable item, or CloseCurrentPopup() is called within a BeginPopup()/EndPopup() block.
325+
IMGUI_API bool BeginPopup(const char* str_id); // return true if popup if opened and start outputting to it. only call EndPopup() if BeginPopup() returned true!
326+
IMGUI_API bool BeginPopupModal(const char* name, bool* p_opened = NULL, ImGuiWindowFlags extra_flags = 0); // modal dialog (can't close them by clicking outside)
327+
IMGUI_API bool BeginPopupContextItem(const char* str_id, int mouse_button = 1); // helper to open and begin popup when clicked on last item
328+
IMGUI_API bool BeginPopupContextWindow(bool also_over_items = true, const char* str_id = NULL, int mouse_button = 1); // helper to open and begin popup when clicked on current window
329+
IMGUI_API bool BeginPopupContextVoid(const char* str_id = NULL, int mouse_button = 1); // helper to open and begin popup when clicked in void (no window)
330+
IMGUI_API void EndPopup();
331+
IMGUI_API void CloseCurrentPopup(); // close the popup we have begin-ed into. clicking on a MenuItem or Selectable automatically close the current popup.
332332

333333
// Logging: all text output from interface is redirected to tty/file/clipboard. Tree nodes are automatically opened.
334334
IMGUI_API void LogToTTY(int max_depth = -1); // start logging to tty

0 commit comments

Comments
 (0)