mirror of
https://github.com/ocornut/imgui.git
synced 2024-12-04 14:29:04 +08:00
Demo: Testing return value of BeginTabBar() for consistency.
This commit is contained in:
parent
e6cc547a94
commit
8b956216b7
@ -150,7 +150,8 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
||||
- dock: C- nav: CTRL+TAB highlighting tabs shows the mismatch between focus-stack and tab-order (not visible in VS because it doesn't highlight the tabs)
|
||||
- dock: C- after a dock/undock, the Scrollbar Status update in Begin() should use an updated e.g. size_y_for_scrollbars to avoid a 1 frame scrollbar flicker.
|
||||
|
||||
- tabs: re-ordering, close buttons, context menu, persistent order (#261, #351)
|
||||
- tabs: make EndTabBar fail if users doesn't respect BeginTabBar return value, for consistency/future-proofing.
|
||||
- tabs: persistent order/focus in BeginTabBar() api (#261, #351)
|
||||
|
||||
- ext: stl-ish friendly extension (imgui_stl.h) that has wrapper for std::string, std::vector etc.
|
||||
|
||||
|
@ -1721,7 +1721,8 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
if (ImGui::TreeNode("Basic"))
|
||||
{
|
||||
ImGuiTabBarFlags tab_bar_flags = ImGuiTabBarFlags_None;
|
||||
ImGui::BeginTabBar("MyTabBar", tab_bar_flags);
|
||||
if (ImGui::BeginTabBar("MyTabBar", tab_bar_flags))
|
||||
{
|
||||
if (ImGui::BeginTabItem("Avocado"))
|
||||
{
|
||||
ImGui::Text("This is the Avocado tab!\nblah blah blah blah blah");
|
||||
@ -1738,6 +1739,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
ImGui::EndTabBar();
|
||||
}
|
||||
ImGui::Separator();
|
||||
ImGui::TreePop();
|
||||
}
|
||||
@ -1766,7 +1768,8 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
}
|
||||
|
||||
// Passing a bool* to BeginTabItem() is similar to passing one to Begin(): the underlying bool will be set to false when the tab is closed.
|
||||
ImGui::BeginTabBar("MyTabBar", tab_bar_flags);
|
||||
if (ImGui::BeginTabBar("MyTabBar", tab_bar_flags))
|
||||
{
|
||||
for (int n = 0; n < IM_ARRAYSIZE(opened); n++)
|
||||
if (opened[n] && ImGui::BeginTabItem(names[n], &opened[n]))
|
||||
{
|
||||
@ -1776,6 +1779,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
ImGui::EndTabBar();
|
||||
}
|
||||
ImGui::Separator();
|
||||
ImGui::TreePop();
|
||||
}
|
||||
@ -3952,8 +3956,8 @@ void ShowExampleAppDocuments(bool* p_open)
|
||||
if (opt_target == Target_Tab)
|
||||
{
|
||||
ImGuiTabBarFlags tab_bar_flags = (opt_fitting_flags) | (opt_reorderable ? ImGuiTabBarFlags_Reorderable : 0);
|
||||
ImGui::BeginTabBar("##tabs", tab_bar_flags);
|
||||
|
||||
if (ImGui::BeginTabBar("##tabs", tab_bar_flags))
|
||||
{
|
||||
if (opt_reorderable)
|
||||
NotifyOfDocumentsClosedElsewhere(app);
|
||||
|
||||
@ -3988,6 +3992,7 @@ void ShowExampleAppDocuments(bool* p_open)
|
||||
|
||||
ImGui::EndTabBar();
|
||||
}
|
||||
}
|
||||
else if (opt_target == Target_Window)
|
||||
{
|
||||
if (ImGui::GetIO().ConfigFlags & ImGuiConfigFlags_DockingEnable)
|
||||
|
Loading…
Reference in New Issue
Block a user