50
50
51
51
Index of this file:
52
52
53
- // [SECTION] Forward Declarations, Helpers
53
+ // [SECTION] Forward Declarations
54
+ // [SECTION] Helpers
54
55
// [SECTION] Demo Window / ShowDemoWindow()
56
+ // - ShowDemoWindow()
55
57
// - sub section: ShowDemoWindowWidgets()
56
58
// - sub section: ShowDemoWindowLayout()
57
59
// - sub section: ShowDemoWindowPopups()
58
60
// - sub section: ShowDemoWindowTables()
59
61
// - sub section: ShowDemoWindowInputs()
60
62
// [SECTION] About Window / ShowAboutWindow()
61
63
// [SECTION] Style Editor / ShowStyleEditor()
64
+ // [SECTION] User Guide / ShowUserGuide()
62
65
// [SECTION] Example App: Main Menu Bar / ShowExampleAppMainMenuBar()
63
66
// [SECTION] Example App: Debug Console / ShowExampleAppConsole()
64
67
// [SECTION] Example App: Debug Log / ShowExampleAppLog()
@@ -190,6 +193,19 @@ static void ShowExampleAppWindowTitles(bool* p_open);
190
193
static void ShowExampleAppCustomRendering (bool * p_open);
191
194
static void ShowExampleMenuFile ();
192
195
196
+ // We split the contents of the big ShowDemoWindow() function into smaller functions
197
+ // (because the link time of very large functions grow non-linearly)
198
+ static void ShowDemoWindowWidgets ();
199
+ static void ShowDemoWindowLayout ();
200
+ static void ShowDemoWindowPopups ();
201
+ static void ShowDemoWindowTables ();
202
+ static void ShowDemoWindowColumns ();
203
+ static void ShowDemoWindowInputs ();
204
+
205
+ // -----------------------------------------------------------------------------
206
+ // [SECTION] Helpers
207
+ // -----------------------------------------------------------------------------
208
+
193
209
// Helper to display a little (?) mark which shows a tooltip when hovered.
194
210
// In your own code you may want to display an actual icon if you are using a merged icon fonts (see docs/FONTS.md)
195
211
static void HelpMarker (const char * desc)
@@ -207,46 +223,16 @@ static void HelpMarker(const char* desc)
207
223
208
224
// Helper to wire demo markers located in code to an interactive browser
209
225
typedef void (*ImGuiDemoMarkerCallback)(const char * file, int line, const char * section, void * user_data);
210
- extern ImGuiDemoMarkerCallback GImGuiDemoMarkerCallback;
211
- extern void * GImGuiDemoMarkerCallbackUserData;
212
- ImGuiDemoMarkerCallback GImGuiDemoMarkerCallback = NULL ;
213
- void * GImGuiDemoMarkerCallbackUserData = NULL ;
226
+ extern ImGuiDemoMarkerCallback GImGuiDemoMarkerCallback;
227
+ extern void * GImGuiDemoMarkerCallbackUserData;
228
+ ImGuiDemoMarkerCallback GImGuiDemoMarkerCallback = NULL ;
229
+ void * GImGuiDemoMarkerCallbackUserData = NULL ;
214
230
#define IMGUI_DEMO_MARKER (section ) do { if (GImGuiDemoMarkerCallback != NULL ) GImGuiDemoMarkerCallback (__FILE__, __LINE__, section, GImGuiDemoMarkerCallbackUserData); } while (0 )
215
231
216
- // Helper to display basic user controls.
217
- void ImGui::ShowUserGuide ()
218
- {
219
- ImGuiIO& io = ImGui::GetIO ();
220
- ImGui::BulletText (" Double-click on title bar to collapse window." );
221
- ImGui::BulletText (
222
- " Click and drag on lower corner to resize window\n "
223
- " (double-click to auto fit window to its contents)." );
224
- ImGui::BulletText (" CTRL+Click on a slider or drag box to input value as text." );
225
- ImGui::BulletText (" TAB/SHIFT+TAB to cycle through keyboard editable fields." );
226
- ImGui::BulletText (" CTRL+Tab to select a window." );
227
- if (io.FontAllowUserScaling )
228
- ImGui::BulletText (" CTRL+Mouse Wheel to zoom window contents." );
229
- ImGui::BulletText (" While inputing text:\n " );
230
- ImGui::Indent ();
231
- ImGui::BulletText (" CTRL+Left/Right to word jump." );
232
- ImGui::BulletText (" CTRL+A or double-click to select all." );
233
- ImGui::BulletText (" CTRL+X/C/V to use clipboard cut/copy/paste." );
234
- ImGui::BulletText (" CTRL+Z,CTRL+Y to undo/redo." );
235
- ImGui::BulletText (" ESCAPE to revert." );
236
- ImGui::Unindent ();
237
- ImGui::BulletText (" With keyboard navigation enabled:" );
238
- ImGui::Indent ();
239
- ImGui::BulletText (" Arrow keys to navigate." );
240
- ImGui::BulletText (" Space to activate a widget." );
241
- ImGui::BulletText (" Return to input text into a widget." );
242
- ImGui::BulletText (" Escape to deactivate a widget, close popup, exit child window." );
243
- ImGui::BulletText (" Alt to jump to the menu layer of a window." );
244
- ImGui::Unindent ();
245
- }
246
-
247
232
// -----------------------------------------------------------------------------
248
233
// [SECTION] Demo Window / ShowDemoWindow()
249
234
// -----------------------------------------------------------------------------
235
+ // - ShowDemoWindow()
250
236
// - ShowDemoWindowWidgets()
251
237
// - ShowDemoWindowLayout()
252
238
// - ShowDemoWindowPopups()
@@ -255,28 +241,18 @@ void ImGui::ShowUserGuide()
255
241
// - ShowDemoWindowInputs()
256
242
// -----------------------------------------------------------------------------
257
243
258
- // We split the contents of the big ShowDemoWindow() function into smaller functions
259
- // (because the link time of very large functions grow non-linearly)
260
- static void ShowDemoWindowWidgets ();
261
- static void ShowDemoWindowLayout ();
262
- static void ShowDemoWindowPopups ();
263
- static void ShowDemoWindowTables ();
264
- static void ShowDemoWindowColumns ();
265
- static void ShowDemoWindowInputs ();
266
-
267
244
// Demonstrate most Dear ImGui features (this is big function!)
268
245
// You may execute this function to experiment with the UI and understand what it does.
269
246
// You may then search for keywords in the code when you are interested by a specific feature.
270
247
void ImGui::ShowDemoWindow (bool * p_open)
271
248
{
272
249
// Exceptionally add an extra assert here for people confused about initial Dear ImGui setup
273
- // Most ImGui functions would normally just crash if the context is missing.
250
+ // Most functions would normally just crash if the context is missing.
274
251
IM_ASSERT (ImGui::GetCurrentContext () != NULL && " Missing dear imgui context. Refer to examples app!" );
275
252
276
253
// Examples Apps (accessible from the "Examples" menu)
277
254
static bool show_app_main_menu_bar = false ;
278
255
static bool show_app_documents = false ;
279
-
280
256
static bool show_app_console = false ;
281
257
static bool show_app_log = false ;
282
258
static bool show_app_layout = false ;
@@ -291,7 +267,6 @@ void ImGui::ShowDemoWindow(bool* p_open)
291
267
292
268
if (show_app_main_menu_bar) ShowExampleAppMainMenuBar ();
293
269
if (show_app_documents) ShowExampleAppDocuments (&show_app_documents);
294
-
295
270
if (show_app_console) ShowExampleAppConsole (&show_app_console);
296
271
if (show_app_log) ShowExampleAppLog (&show_app_log);
297
272
if (show_app_layout) ShowExampleAppLayout (&show_app_layout);
@@ -304,7 +279,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
304
279
if (show_app_window_titles) ShowExampleAppWindowTitles (&show_app_window_titles);
305
280
if (show_app_custom_rendering) ShowExampleAppCustomRendering (&show_app_custom_rendering);
306
281
307
- // Dear ImGui Apps (accessible from the "Tools" menu)
282
+ // Dear ImGui Tools/ Apps (accessible from the "Tools" menu)
308
283
static bool show_app_metrics = false ;
309
284
static bool show_app_debug_log = false ;
310
285
static bool show_app_stack_tool = false ;
@@ -367,10 +342,8 @@ void ImGui::ShowDemoWindow(bool* p_open)
367
342
}
368
343
369
344
// Most "big" widgets share a common width settings by default. See 'Demo->Layout->Widgets Width' for details.
370
-
371
345
// e.g. Use 2/3 of the space for widgets and 1/3 for labels (right align)
372
346
// ImGui::PushItemWidth(-ImGui::GetWindowWidth() * 0.35f);
373
-
374
347
// e.g. Leave a fixed amount of width for labels (by passing a negative value), the rest goes to widgets.
375
348
ImGui::PushItemWidth (ImGui::GetFontSize () * -12 );
376
349
@@ -6423,6 +6396,40 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
6423
6396
ImGui::PopItemWidth ();
6424
6397
}
6425
6398
6399
+ // -----------------------------------------------------------------------------
6400
+ // [SECTION] User Guide / ShowUserGuide()
6401
+ // -----------------------------------------------------------------------------
6402
+
6403
+ void ImGui::ShowUserGuide ()
6404
+ {
6405
+ ImGuiIO& io = ImGui::GetIO ();
6406
+ ImGui::BulletText (" Double-click on title bar to collapse window." );
6407
+ ImGui::BulletText (
6408
+ " Click and drag on lower corner to resize window\n "
6409
+ " (double-click to auto fit window to its contents)." );
6410
+ ImGui::BulletText (" CTRL+Click on a slider or drag box to input value as text." );
6411
+ ImGui::BulletText (" TAB/SHIFT+TAB to cycle through keyboard editable fields." );
6412
+ ImGui::BulletText (" CTRL+Tab to select a window." );
6413
+ if (io.FontAllowUserScaling )
6414
+ ImGui::BulletText (" CTRL+Mouse Wheel to zoom window contents." );
6415
+ ImGui::BulletText (" While inputing text:\n " );
6416
+ ImGui::Indent ();
6417
+ ImGui::BulletText (" CTRL+Left/Right to word jump." );
6418
+ ImGui::BulletText (" CTRL+A or double-click to select all." );
6419
+ ImGui::BulletText (" CTRL+X/C/V to use clipboard cut/copy/paste." );
6420
+ ImGui::BulletText (" CTRL+Z,CTRL+Y to undo/redo." );
6421
+ ImGui::BulletText (" ESCAPE to revert." );
6422
+ ImGui::Unindent ();
6423
+ ImGui::BulletText (" With keyboard navigation enabled:" );
6424
+ ImGui::Indent ();
6425
+ ImGui::BulletText (" Arrow keys to navigate." );
6426
+ ImGui::BulletText (" Space to activate a widget." );
6427
+ ImGui::BulletText (" Return to input text into a widget." );
6428
+ ImGui::BulletText (" Escape to deactivate a widget, close popup, exit child window." );
6429
+ ImGui::BulletText (" Alt to jump to the menu layer of a window." );
6430
+ ImGui::Unindent ();
6431
+ }
6432
+
6426
6433
// -----------------------------------------------------------------------------
6427
6434
// [SECTION] Example App: Main Menu Bar / ShowExampleAppMainMenuBar()
6428
6435
// -----------------------------------------------------------------------------
0 commit comments