mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-23 21:09:01 +08:00
Comments. Examples: added empty if (MenuItem()) {} statements in more places to better document the typical use cases (#126)
This commit is contained in:
parent
fdce095101
commit
0db122bc3b
10
imgui.cpp
10
imgui.cpp
@ -11374,8 +11374,8 @@ static void ShowExampleAppMainMenuBar()
|
||||
static void ShowExampleMenuFile()
|
||||
{
|
||||
ImGui::MenuItem("(dummy menu)", NULL, false, false);
|
||||
ImGui::MenuItem("New");
|
||||
ImGui::MenuItem("Open", "Ctrl+O");
|
||||
if (ImGui::MenuItem("New")) {}
|
||||
if (ImGui::MenuItem("Open", "Ctrl+O")) {}
|
||||
if (ImGui::BeginMenu("Open Recent"))
|
||||
{
|
||||
ImGui::MenuItem("fish_hat.c");
|
||||
@ -11394,8 +11394,8 @@ static void ShowExampleMenuFile()
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
ImGui::MenuItem("Save", "Ctrl+S");
|
||||
ImGui::MenuItem("Save As..");
|
||||
if (ImGui::MenuItem("Save", "Ctrl+S")) {}
|
||||
if (ImGui::MenuItem("Save As..")) {}
|
||||
ImGui::Separator();
|
||||
if (ImGui::BeginMenu("Options"))
|
||||
{
|
||||
@ -11415,7 +11415,7 @@ static void ShowExampleMenuFile()
|
||||
ImGui::MenuItem(ImGui::GetStyleColName((ImGuiCol)i));
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
ImGui::MenuItem("Quit", "Alt+F4");
|
||||
if (ImGui::MenuItem("Quit", "Alt+F4")) {}
|
||||
}
|
||||
|
||||
static void ShowExampleAppAutoResize(bool* opened)
|
||||
|
10
imgui.h
10
imgui.h
@ -300,14 +300,14 @@ namespace ImGui
|
||||
IMGUI_API void ListBoxFooter(); // terminate the scrolling region
|
||||
|
||||
// Widgets: Menus
|
||||
IMGUI_API bool BeginMainMenuBar(); // create and append to a full screen menu-bar. only call EndMainMenuBar() if this returns true!
|
||||
IMGUI_API bool BeginMainMenuBar(); // create and append to a full screen menu-bar. only call EndMainMenuBar() if this returns true!
|
||||
IMGUI_API void EndMainMenuBar();
|
||||
IMGUI_API bool BeginMenuBar(); // append to menu-bar of current window. only call EndMenuBar() if this returns true!
|
||||
IMGUI_API bool BeginMenuBar(); // append to menu-bar of current window. only call EndMenuBar() if this returns true!
|
||||
IMGUI_API void EndMenuBar();
|
||||
IMGUI_API bool BeginMenu(const char* label); // create a sub-menu entry. only call EndMenu() if this returns true!
|
||||
IMGUI_API bool BeginMenu(const char* label); // create a sub-menu entry. only call EndMenu() if this returns true!
|
||||
IMGUI_API void EndMenu();
|
||||
IMGUI_API bool MenuItem(const char* label, const char* shortcut = NULL, bool selected = false, bool enabled = true); // shortcuts are displayed for convenience but not processed by ImGui
|
||||
IMGUI_API bool MenuItem(const char* label, const char* shortcut, bool* p_selected, bool enabled = true);
|
||||
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
|
||||
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
|
||||
|
||||
// Widgets: Value() Helpers. Output single value in "name: value" format (tip: freely declare your own within the ImGui namespace!)
|
||||
IMGUI_API void Value(const char* prefix, bool b);
|
||||
|
Loading…
Reference in New Issue
Block a user