mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
parent
4006fb77bc
commit
a500c0daf7
@ -91,7 +91,7 @@ void ImGui::ShowUserGuide()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Demonstrate most ImGui features (big function!)
|
// Demonstrate most ImGui features (big function!)
|
||||||
void ImGui::ShowTestWindow(bool* opened)
|
void ImGui::ShowTestWindow(bool* p_opened)
|
||||||
{
|
{
|
||||||
// Examples apps
|
// Examples apps
|
||||||
static bool show_app_metrics = false;
|
static bool show_app_metrics = false;
|
||||||
@ -145,7 +145,7 @@ void ImGui::ShowTestWindow(bool* opened)
|
|||||||
if (no_scrollbar) window_flags |= ImGuiWindowFlags_NoScrollbar;
|
if (no_scrollbar) window_flags |= ImGuiWindowFlags_NoScrollbar;
|
||||||
if (no_collapse) window_flags |= ImGuiWindowFlags_NoCollapse;
|
if (no_collapse) window_flags |= ImGuiWindowFlags_NoCollapse;
|
||||||
if (!no_menu) window_flags |= ImGuiWindowFlags_MenuBar;
|
if (!no_menu) window_flags |= ImGuiWindowFlags_MenuBar;
|
||||||
if (!ImGui::Begin("ImGui Demo", opened, ImVec2(550,680), bg_alpha, window_flags))
|
if (!ImGui::Begin("ImGui Demo", p_opened, ImVec2(550,680), bg_alpha, window_flags))
|
||||||
{
|
{
|
||||||
// Early out if the window is collapsed, as an optimization.
|
// Early out if the window is collapsed, as an optimization.
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
@ -779,7 +779,7 @@ void ImGui::ShowTestWindow(bool* opened)
|
|||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::TreeNode("Widgets Alignment"))
|
if (ImGui::TreeNode("Widgets Width"))
|
||||||
{
|
{
|
||||||
static float f = 0.0f;
|
static float f = 0.0f;
|
||||||
ImGui::Text("PushItemWidth(100)");
|
ImGui::Text("PushItemWidth(100)");
|
||||||
@ -950,6 +950,17 @@ void ImGui::ShowTestWindow(bool* opened)
|
|||||||
ImGui::Text("Widget"); ImGui::SameLine();
|
ImGui::Text("Widget"); ImGui::SameLine();
|
||||||
ImGui::SmallButton("Widget");
|
ImGui::SmallButton("Widget");
|
||||||
|
|
||||||
|
// Tree
|
||||||
|
const float spacing = ImGui::GetStyle().ItemInnerSpacing.x;
|
||||||
|
ImGui::Button("Button##1");
|
||||||
|
ImGui::SameLine(0.0f, spacing);
|
||||||
|
if (ImGui::TreeNode("Node##1")) { for (int i = 0; i < 6; i++) ImGui::BulletText("Item %d..", i); ImGui::TreePop(); } // Dummy tree data
|
||||||
|
|
||||||
|
ImGui::AlignFirstTextHeightToWidgets(); // Vertically align text node a bit lower so it'll be vertically centered with upcoming widget. Otherwise you can use SmallButton (smaller fit).
|
||||||
|
bool tree_opened = ImGui::TreeNode("Node##2"); // Common mistake to avoid: if we want to SameLine after TreeNode we need to do it before we add child content.
|
||||||
|
ImGui::SameLine(0.0f, spacing); ImGui::Button("Button##2");
|
||||||
|
if (tree_opened) { for (int i = 0; i < 6; i++) ImGui::BulletText("Item %d..", i); ImGui::TreePop(); } // Dummy tree data
|
||||||
|
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user