mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-13 16:29:54 +02:00
Merge branch 'master' into docking
# Conflicts: # backends/imgui_impl_opengl3.cpp # imgui.cpp # imgui.h # imgui_demo.cpp
This commit is contained in:
@ -332,6 +332,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
static bool no_background = false;
|
||||
static bool no_bring_to_front = false;
|
||||
static bool no_docking = false;
|
||||
static bool unsaved_document = false;
|
||||
|
||||
ImGuiWindowFlags window_flags = 0;
|
||||
if (no_titlebar) window_flags |= ImGuiWindowFlags_NoTitleBar;
|
||||
@ -344,6 +345,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
if (no_background) window_flags |= ImGuiWindowFlags_NoBackground;
|
||||
if (no_bring_to_front) window_flags |= ImGuiWindowFlags_NoBringToFrontOnFocus;
|
||||
if (no_docking) window_flags |= ImGuiWindowFlags_NoDocking;
|
||||
if (unsaved_document) window_flags |= ImGuiWindowFlags_UnsavedDocument;
|
||||
if (no_close) p_open = NULL; // Don't pass our bool* to Begin
|
||||
|
||||
// We specify a default position/size in case there's no data in the .ini file.
|
||||
@ -561,6 +563,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
ImGui::TableNextColumn(); ImGui::Checkbox("No background", &no_background);
|
||||
ImGui::TableNextColumn(); ImGui::Checkbox("No bring to front", &no_bring_to_front);
|
||||
ImGui::TableNextColumn(); ImGui::Checkbox("No docking", &no_docking);
|
||||
ImGui::TableNextColumn(); ImGui::Checkbox("Unsaved document", &unsaved_document);
|
||||
ImGui::EndTable();
|
||||
}
|
||||
}
|
||||
@ -1078,8 +1081,8 @@ static void ShowDemoWindowWidgets()
|
||||
// stored in the object itself, etc.)
|
||||
const char* items[] = { "AAAA", "BBBB", "CCCC", "DDDD", "EEEE", "FFFF", "GGGG", "HHHH", "IIII", "JJJJ", "KKKK", "LLLLLLL", "MMMM", "OOOOOOO" };
|
||||
static int item_current_idx = 0; // Here we store our selection data as an index.
|
||||
const char* combo_label = items[item_current_idx]; // Label to preview before opening the combo (technically it could be anything)
|
||||
if (ImGui::BeginCombo("combo 1", combo_label, flags))
|
||||
const char* combo_preview_value = items[item_current_idx]; // Pass in the preview value visible before opening the combo (it could be anything)
|
||||
if (ImGui::BeginCombo("combo 1", combo_preview_value, flags))
|
||||
{
|
||||
for (int n = 0; n < IM_ARRAYSIZE(items); n++)
|
||||
{
|
||||
@ -1095,10 +1098,12 @@ static void ShowDemoWindowWidgets()
|
||||
}
|
||||
|
||||
// Simplified one-liner Combo() API, using values packed in a single constant string
|
||||
// This is a convenience for when the selection set is small and known at compile-time.
|
||||
static int item_current_2 = 0;
|
||||
ImGui::Combo("combo 2 (one-liner)", &item_current_2, "aaaa\0bbbb\0cccc\0dddd\0eeee\0\0");
|
||||
|
||||
// Simplified one-liner Combo() using an array of const char*
|
||||
// This is not very useful (may obsolete): prefer using BeginCombo()/EndCombo() for full control.
|
||||
static int item_current_3 = -1; // If the selection isn't within 0..count, Combo won't display a preview
|
||||
ImGui::Combo("combo 3 (array)", &item_current_3, items, IM_ARRAYSIZE(items));
|
||||
|
||||
@ -1165,7 +1170,7 @@ static void ShowDemoWindowWidgets()
|
||||
static bool selection[5] = { false, true, false, false, false };
|
||||
ImGui::Selectable("1. I am selectable", &selection[0]);
|
||||
ImGui::Selectable("2. I am selectable", &selection[1]);
|
||||
ImGui::Text("3. I am not selectable");
|
||||
ImGui::Text("(I am not selectable)");
|
||||
ImGui::Selectable("4. I am selectable", &selection[3]);
|
||||
if (ImGui::Selectable("5. I am double clickable", selection[4], ImGuiSelectableFlags_AllowDoubleClick))
|
||||
if (ImGui::IsMouseDoubleClicked(0))
|
||||
@ -6775,6 +6780,7 @@ static void ShowExampleAppLayout(bool* p_open)
|
||||
ImGui::BeginChild("left pane", ImVec2(150, 0), true);
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
// FIXME: Good candidate to use ImGuiSelectableFlags_SelectOnNav
|
||||
char label[128];
|
||||
sprintf(label, "MyObject %d", i);
|
||||
if (ImGui::Selectable(label, selected == i))
|
||||
@ -7694,6 +7700,16 @@ void ShowExampleAppDocuments(bool* p_open)
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
// About the ImGuiWindowFlags_UnsavedDocument / ImGuiTabItemFlags_UnsavedDocument flags.
|
||||
// They have multiple effects:
|
||||
// - Display a dot next to the title.
|
||||
// - Tab is selected when clicking the X close button.
|
||||
// - Closure is not assumed (will wait for user to stop submitting the tab).
|
||||
// Otherwise closure is assumed when pressing the X, so if you keep submitting the tab may reappear at end of tab bar.
|
||||
// We need to assume closure by default otherwise waiting for "lack of submission" on the next frame would leave an empty
|
||||
// hole for one-frame, both in the tab-bar and in tab-contents when closing a tab/window.
|
||||
// The rarely used SetTabItemClosed() function is a way to notify of programmatic closure to avoid the one-frame hole.
|
||||
|
||||
// Tabs
|
||||
if (opt_target == Target_Tab)
|
||||
{
|
||||
|
Reference in New Issue
Block a user