|
@@ -50,8 +50,10 @@
|
|
|
|
|
|
Index of this file:
|
|
Index of this file:
|
|
|
|
|
|
-// [SECTION] Forward Declarations, Helpers
|
|
|
|
|
|
+// [SECTION] Forward Declarations
|
|
|
|
+// [SECTION] Helpers
|
|
// [SECTION] Demo Window / ShowDemoWindow()
|
|
// [SECTION] Demo Window / ShowDemoWindow()
|
|
|
|
+// - ShowDemoWindow()
|
|
// - sub section: ShowDemoWindowWidgets()
|
|
// - sub section: ShowDemoWindowWidgets()
|
|
// - sub section: ShowDemoWindowLayout()
|
|
// - sub section: ShowDemoWindowLayout()
|
|
// - sub section: ShowDemoWindowPopups()
|
|
// - sub section: ShowDemoWindowPopups()
|
|
@@ -59,6 +61,7 @@ Index of this file:
|
|
// - sub section: ShowDemoWindowInputs()
|
|
// - sub section: ShowDemoWindowInputs()
|
|
// [SECTION] About Window / ShowAboutWindow()
|
|
// [SECTION] About Window / ShowAboutWindow()
|
|
// [SECTION] Style Editor / ShowStyleEditor()
|
|
// [SECTION] Style Editor / ShowStyleEditor()
|
|
|
|
+// [SECTION] User Guide / ShowUserGuide()
|
|
// [SECTION] Example App: Main Menu Bar / ShowExampleAppMainMenuBar()
|
|
// [SECTION] Example App: Main Menu Bar / ShowExampleAppMainMenuBar()
|
|
// [SECTION] Example App: Debug Console / ShowExampleAppConsole()
|
|
// [SECTION] Example App: Debug Console / ShowExampleAppConsole()
|
|
// [SECTION] Example App: Debug Log / ShowExampleAppLog()
|
|
// [SECTION] Example App: Debug Log / ShowExampleAppLog()
|
|
@@ -190,6 +193,19 @@ static void ShowExampleAppWindowTitles(bool* p_open);
|
|
static void ShowExampleAppCustomRendering(bool* p_open);
|
|
static void ShowExampleAppCustomRendering(bool* p_open);
|
|
static void ShowExampleMenuFile();
|
|
static void ShowExampleMenuFile();
|
|
|
|
|
|
|
|
+// We split the contents of the big ShowDemoWindow() function into smaller functions
|
|
|
|
+// (because the link time of very large functions grow non-linearly)
|
|
|
|
+static void ShowDemoWindowWidgets();
|
|
|
|
+static void ShowDemoWindowLayout();
|
|
|
|
+static void ShowDemoWindowPopups();
|
|
|
|
+static void ShowDemoWindowTables();
|
|
|
|
+static void ShowDemoWindowColumns();
|
|
|
|
+static void ShowDemoWindowInputs();
|
|
|
|
+
|
|
|
|
+//-----------------------------------------------------------------------------
|
|
|
|
+// [SECTION] Helpers
|
|
|
|
+//-----------------------------------------------------------------------------
|
|
|
|
+
|
|
// Helper to display a little (?) mark which shows a tooltip when hovered.
|
|
// Helper to display a little (?) mark which shows a tooltip when hovered.
|
|
// In your own code you may want to display an actual icon if you are using a merged icon fonts (see docs/FONTS.md)
|
|
// In your own code you may want to display an actual icon if you are using a merged icon fonts (see docs/FONTS.md)
|
|
static void HelpMarker(const char* desc)
|
|
static void HelpMarker(const char* desc)
|
|
@@ -207,46 +223,16 @@ static void HelpMarker(const char* desc)
|
|
|
|
|
|
// Helper to wire demo markers located in code to an interactive browser
|
|
// Helper to wire demo markers located in code to an interactive browser
|
|
typedef void (*ImGuiDemoMarkerCallback)(const char* file, int line, const char* section, void* user_data);
|
|
typedef void (*ImGuiDemoMarkerCallback)(const char* file, int line, const char* section, void* user_data);
|
|
-extern ImGuiDemoMarkerCallback GImGuiDemoMarkerCallback;
|
|
|
|
-extern void* GImGuiDemoMarkerCallbackUserData;
|
|
|
|
-ImGuiDemoMarkerCallback GImGuiDemoMarkerCallback = NULL;
|
|
|
|
-void* GImGuiDemoMarkerCallbackUserData = NULL;
|
|
|
|
|
|
+extern ImGuiDemoMarkerCallback GImGuiDemoMarkerCallback;
|
|
|
|
+extern void* GImGuiDemoMarkerCallbackUserData;
|
|
|
|
+ImGuiDemoMarkerCallback GImGuiDemoMarkerCallback = NULL;
|
|
|
|
+void* GImGuiDemoMarkerCallbackUserData = NULL;
|
|
#define IMGUI_DEMO_MARKER(section) do { if (GImGuiDemoMarkerCallback != NULL) GImGuiDemoMarkerCallback(__FILE__, __LINE__, section, GImGuiDemoMarkerCallbackUserData); } while (0)
|
|
#define IMGUI_DEMO_MARKER(section) do { if (GImGuiDemoMarkerCallback != NULL) GImGuiDemoMarkerCallback(__FILE__, __LINE__, section, GImGuiDemoMarkerCallbackUserData); } while (0)
|
|
|
|
|
|
-// Helper to display basic user controls.
|
|
|
|
-void ImGui::ShowUserGuide()
|
|
|
|
-{
|
|
|
|
- ImGuiIO& io = ImGui::GetIO();
|
|
|
|
- ImGui::BulletText("Double-click on title bar to collapse window.");
|
|
|
|
- ImGui::BulletText(
|
|
|
|
- "Click and drag on lower corner to resize window\n"
|
|
|
|
- "(double-click to auto fit window to its contents).");
|
|
|
|
- ImGui::BulletText("CTRL+Click on a slider or drag box to input value as text.");
|
|
|
|
- ImGui::BulletText("TAB/SHIFT+TAB to cycle through keyboard editable fields.");
|
|
|
|
- ImGui::BulletText("CTRL+Tab to select a window.");
|
|
|
|
- if (io.FontAllowUserScaling)
|
|
|
|
- ImGui::BulletText("CTRL+Mouse Wheel to zoom window contents.");
|
|
|
|
- ImGui::BulletText("While inputing text:\n");
|
|
|
|
- ImGui::Indent();
|
|
|
|
- ImGui::BulletText("CTRL+Left/Right to word jump.");
|
|
|
|
- ImGui::BulletText("CTRL+A or double-click to select all.");
|
|
|
|
- ImGui::BulletText("CTRL+X/C/V to use clipboard cut/copy/paste.");
|
|
|
|
- ImGui::BulletText("CTRL+Z,CTRL+Y to undo/redo.");
|
|
|
|
- ImGui::BulletText("ESCAPE to revert.");
|
|
|
|
- ImGui::Unindent();
|
|
|
|
- ImGui::BulletText("With keyboard navigation enabled:");
|
|
|
|
- ImGui::Indent();
|
|
|
|
- ImGui::BulletText("Arrow keys to navigate.");
|
|
|
|
- ImGui::BulletText("Space to activate a widget.");
|
|
|
|
- ImGui::BulletText("Return to input text into a widget.");
|
|
|
|
- ImGui::BulletText("Escape to deactivate a widget, close popup, exit child window.");
|
|
|
|
- ImGui::BulletText("Alt to jump to the menu layer of a window.");
|
|
|
|
- ImGui::Unindent();
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
//-----------------------------------------------------------------------------
|
|
//-----------------------------------------------------------------------------
|
|
// [SECTION] Demo Window / ShowDemoWindow()
|
|
// [SECTION] Demo Window / ShowDemoWindow()
|
|
//-----------------------------------------------------------------------------
|
|
//-----------------------------------------------------------------------------
|
|
|
|
+// - ShowDemoWindow()
|
|
// - ShowDemoWindowWidgets()
|
|
// - ShowDemoWindowWidgets()
|
|
// - ShowDemoWindowLayout()
|
|
// - ShowDemoWindowLayout()
|
|
// - ShowDemoWindowPopups()
|
|
// - ShowDemoWindowPopups()
|
|
@@ -255,28 +241,18 @@ void ImGui::ShowUserGuide()
|
|
// - ShowDemoWindowInputs()
|
|
// - ShowDemoWindowInputs()
|
|
//-----------------------------------------------------------------------------
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
-// We split the contents of the big ShowDemoWindow() function into smaller functions
|
|
|
|
-// (because the link time of very large functions grow non-linearly)
|
|
|
|
-static void ShowDemoWindowWidgets();
|
|
|
|
-static void ShowDemoWindowLayout();
|
|
|
|
-static void ShowDemoWindowPopups();
|
|
|
|
-static void ShowDemoWindowTables();
|
|
|
|
-static void ShowDemoWindowColumns();
|
|
|
|
-static void ShowDemoWindowInputs();
|
|
|
|
-
|
|
|
|
// Demonstrate most Dear ImGui features (this is big function!)
|
|
// Demonstrate most Dear ImGui features (this is big function!)
|
|
// You may execute this function to experiment with the UI and understand what it does.
|
|
// You may execute this function to experiment with the UI and understand what it does.
|
|
// You may then search for keywords in the code when you are interested by a specific feature.
|
|
// You may then search for keywords in the code when you are interested by a specific feature.
|
|
void ImGui::ShowDemoWindow(bool* p_open)
|
|
void ImGui::ShowDemoWindow(bool* p_open)
|
|
{
|
|
{
|
|
// Exceptionally add an extra assert here for people confused about initial Dear ImGui setup
|
|
// Exceptionally add an extra assert here for people confused about initial Dear ImGui setup
|
|
- // Most ImGui functions would normally just crash if the context is missing.
|
|
|
|
|
|
+ // Most functions would normally just crash if the context is missing.
|
|
IM_ASSERT(ImGui::GetCurrentContext() != NULL && "Missing dear imgui context. Refer to examples app!");
|
|
IM_ASSERT(ImGui::GetCurrentContext() != NULL && "Missing dear imgui context. Refer to examples app!");
|
|
|
|
|
|
// Examples Apps (accessible from the "Examples" menu)
|
|
// Examples Apps (accessible from the "Examples" menu)
|
|
static bool show_app_main_menu_bar = false;
|
|
static bool show_app_main_menu_bar = false;
|
|
static bool show_app_documents = false;
|
|
static bool show_app_documents = false;
|
|
-
|
|
|
|
static bool show_app_console = false;
|
|
static bool show_app_console = false;
|
|
static bool show_app_log = false;
|
|
static bool show_app_log = false;
|
|
static bool show_app_layout = false;
|
|
static bool show_app_layout = false;
|
|
@@ -291,7 +267,6 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|
|
|
|
|
if (show_app_main_menu_bar) ShowExampleAppMainMenuBar();
|
|
if (show_app_main_menu_bar) ShowExampleAppMainMenuBar();
|
|
if (show_app_documents) ShowExampleAppDocuments(&show_app_documents);
|
|
if (show_app_documents) ShowExampleAppDocuments(&show_app_documents);
|
|
-
|
|
|
|
if (show_app_console) ShowExampleAppConsole(&show_app_console);
|
|
if (show_app_console) ShowExampleAppConsole(&show_app_console);
|
|
if (show_app_log) ShowExampleAppLog(&show_app_log);
|
|
if (show_app_log) ShowExampleAppLog(&show_app_log);
|
|
if (show_app_layout) ShowExampleAppLayout(&show_app_layout);
|
|
if (show_app_layout) ShowExampleAppLayout(&show_app_layout);
|
|
@@ -304,7 +279,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|
if (show_app_window_titles) ShowExampleAppWindowTitles(&show_app_window_titles);
|
|
if (show_app_window_titles) ShowExampleAppWindowTitles(&show_app_window_titles);
|
|
if (show_app_custom_rendering) ShowExampleAppCustomRendering(&show_app_custom_rendering);
|
|
if (show_app_custom_rendering) ShowExampleAppCustomRendering(&show_app_custom_rendering);
|
|
|
|
|
|
- // Dear ImGui Apps (accessible from the "Tools" menu)
|
|
|
|
|
|
+ // Dear ImGui Tools/Apps (accessible from the "Tools" menu)
|
|
static bool show_app_metrics = false;
|
|
static bool show_app_metrics = false;
|
|
static bool show_app_debug_log = false;
|
|
static bool show_app_debug_log = false;
|
|
static bool show_app_stack_tool = false;
|
|
static bool show_app_stack_tool = false;
|
|
@@ -367,10 +342,8 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|
}
|
|
}
|
|
|
|
|
|
// Most "big" widgets share a common width settings by default. See 'Demo->Layout->Widgets Width' for details.
|
|
// Most "big" widgets share a common width settings by default. See 'Demo->Layout->Widgets Width' for details.
|
|
-
|
|
|
|
// e.g. Use 2/3 of the space for widgets and 1/3 for labels (right align)
|
|
// e.g. Use 2/3 of the space for widgets and 1/3 for labels (right align)
|
|
//ImGui::PushItemWidth(-ImGui::GetWindowWidth() * 0.35f);
|
|
//ImGui::PushItemWidth(-ImGui::GetWindowWidth() * 0.35f);
|
|
-
|
|
|
|
// e.g. Leave a fixed amount of width for labels (by passing a negative value), the rest goes to widgets.
|
|
// e.g. Leave a fixed amount of width for labels (by passing a negative value), the rest goes to widgets.
|
|
ImGui::PushItemWidth(ImGui::GetFontSize() * -12);
|
|
ImGui::PushItemWidth(ImGui::GetFontSize() * -12);
|
|
|
|
|
|
@@ -6423,6 +6396,40 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
|
ImGui::PopItemWidth();
|
|
ImGui::PopItemWidth();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+//-----------------------------------------------------------------------------
|
|
|
|
+// [SECTION] User Guide / ShowUserGuide()
|
|
|
|
+//-----------------------------------------------------------------------------
|
|
|
|
+
|
|
|
|
+void ImGui::ShowUserGuide()
|
|
|
|
+{
|
|
|
|
+ ImGuiIO& io = ImGui::GetIO();
|
|
|
|
+ ImGui::BulletText("Double-click on title bar to collapse window.");
|
|
|
|
+ ImGui::BulletText(
|
|
|
|
+ "Click and drag on lower corner to resize window\n"
|
|
|
|
+ "(double-click to auto fit window to its contents).");
|
|
|
|
+ ImGui::BulletText("CTRL+Click on a slider or drag box to input value as text.");
|
|
|
|
+ ImGui::BulletText("TAB/SHIFT+TAB to cycle through keyboard editable fields.");
|
|
|
|
+ ImGui::BulletText("CTRL+Tab to select a window.");
|
|
|
|
+ if (io.FontAllowUserScaling)
|
|
|
|
+ ImGui::BulletText("CTRL+Mouse Wheel to zoom window contents.");
|
|
|
|
+ ImGui::BulletText("While inputing text:\n");
|
|
|
|
+ ImGui::Indent();
|
|
|
|
+ ImGui::BulletText("CTRL+Left/Right to word jump.");
|
|
|
|
+ ImGui::BulletText("CTRL+A or double-click to select all.");
|
|
|
|
+ ImGui::BulletText("CTRL+X/C/V to use clipboard cut/copy/paste.");
|
|
|
|
+ ImGui::BulletText("CTRL+Z,CTRL+Y to undo/redo.");
|
|
|
|
+ ImGui::BulletText("ESCAPE to revert.");
|
|
|
|
+ ImGui::Unindent();
|
|
|
|
+ ImGui::BulletText("With keyboard navigation enabled:");
|
|
|
|
+ ImGui::Indent();
|
|
|
|
+ ImGui::BulletText("Arrow keys to navigate.");
|
|
|
|
+ ImGui::BulletText("Space to activate a widget.");
|
|
|
|
+ ImGui::BulletText("Return to input text into a widget.");
|
|
|
|
+ ImGui::BulletText("Escape to deactivate a widget, close popup, exit child window.");
|
|
|
|
+ ImGui::BulletText("Alt to jump to the menu layer of a window.");
|
|
|
|
+ ImGui::Unindent();
|
|
|
|
+}
|
|
|
|
+
|
|
//-----------------------------------------------------------------------------
|
|
//-----------------------------------------------------------------------------
|
|
// [SECTION] Example App: Main Menu Bar / ShowExampleAppMainMenuBar()
|
|
// [SECTION] Example App: Main Menu Bar / ShowExampleAppMainMenuBar()
|
|
//-----------------------------------------------------------------------------
|
|
//-----------------------------------------------------------------------------
|