|
@@ -1533,10 +1533,26 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|
ImGui::PopItemWidth();
|
|
ImGui::PopItemWidth();
|
|
|
|
|
|
// Dummy
|
|
// Dummy
|
|
- ImVec2 sz(30,30);
|
|
|
|
- ImGui::Button("A", sz); ImGui::SameLine();
|
|
|
|
- ImGui::Dummy(sz); ImGui::SameLine();
|
|
|
|
- ImGui::Button("B", sz);
|
|
|
|
|
|
+ ImVec2 button_sz(40,40);
|
|
|
|
+ ImGui::Button("A", button_sz); ImGui::SameLine();
|
|
|
|
+ ImGui::Dummy(button_sz); ImGui::SameLine();
|
|
|
|
+ ImGui::Button("B", button_sz);
|
|
|
|
+
|
|
|
|
+ // Manually wrapping (we should eventually provide this as an automatic layout feature, but for now you can do it manually)
|
|
|
|
+ ImGui::Text("Manually wrapping:");
|
|
|
|
+ ImGuiStyle& style = ImGui::GetStyle();
|
|
|
|
+ int buttons_count = 20;
|
|
|
|
+ float window_visible_x2 = ImGui::GetWindowPos().x + ImGui::GetWindowContentRegionMax().x;
|
|
|
|
+ for (int n = 0; n < buttons_count; n++)
|
|
|
|
+ {
|
|
|
|
+ ImGui::PushID(n);
|
|
|
|
+ ImGui::Button("Box", button_sz);
|
|
|
|
+ float last_button_x2 = ImGui::GetItemRectMax().x;
|
|
|
|
+ float next_button_x2 = last_button_x2 + style.ItemSpacing.x + button_sz.x; // Expected position if next button was on same line
|
|
|
|
+ if (n + 1 < buttons_count && next_button_x2 < window_visible_x2)
|
|
|
|
+ ImGui::SameLine();
|
|
|
|
+ ImGui::PopID();
|
|
|
|
+ }
|
|
|
|
|
|
ImGui::TreePop();
|
|
ImGui::TreePop();
|
|
}
|
|
}
|