88
99#include " imgui.h"
1010
11+ #include " osd_core.hpp"
12+
1113#ifdef USE_STD_FILESYSTEM
1214#include < filesystem>
1315namespace fs = std::filesystem;
@@ -224,7 +226,7 @@ OsdExplorer::Draw()
224226
225227 ImGui::SetNextWindowPos (ImGui::GetMainViewport ()->GetCenter (), ImGuiCond_Always, ImVec2 (0 .5f , 0 .5f ));
226228
227- ImGui::SetNextWindowSize (ImVec2 (560 , 380 ), ImGuiCond_Always);
229+ ImGui::SetNextWindowSize (ImVec2 (osd_core_scaled ( 560 . 0f ), osd_core_scaled ( 380 . 0f ) ), ImGuiCond_Always);
228230
229231 const bool enter = ImGui::IsKeyPressed (ImGuiKey_Enter, false )
230232 || ImGui::IsKeyPressed (ImGuiKey_KeypadEnter, false );
@@ -233,19 +235,23 @@ OsdExplorer::Draw()
233235 ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize |
234236 ImGuiWindowFlags_NoMove);
235237
236- const float label_column_width = 96 .0f ;
238+ ImGui::BeginTable (" ##inputs" , 2 , ImGuiTableFlags_SizingStretchSame);
239+ ImGui::TableSetupColumn (" Label" , ImGuiTableColumnFlags_WidthFixed);
240+ ImGui::TableSetupColumn (" Input" , ImGuiTableColumnFlags_WidthStretch);
237241
242+ ImGui::TableNextRow ();
243+ ImGui::TableNextColumn ();
238244 ImGui::AlignTextToFramePadding ();
239245 ImGui::TextUnformatted (" Filename" );
240- ImGui::SameLine ();
241- ImGui::SetCursorPosX (ImGui::GetCursorPosX () + (label_column_width - ImGui::CalcTextSize (" Filename" ).x ));
246+ ImGui::TableNextColumn ();
242247 ImGui::SetNextItemWidth (-FLT_MIN );
243248 if (focus_filename_input_ && focused_slot_ == FocusSlot::Filename) {
244249 ImGui::SetKeyboardFocusHere ();
245250 focus_filename_input_ = false ;
246251 }
247252 if (ImGui::InputText (" ##filename" , filename_input_.data (), filename_input_.size (), ImGuiInputTextFlags_EnterReturnsTrue)) {
248253 if (TryHandleFilenameInput (&result)) {
254+ ImGui::EndTable ();
249255 ImGui::End ();
250256 return result;
251257 }
@@ -269,10 +275,11 @@ OsdExplorer::Draw()
269275 else
270276 snprintf (current_path_text.data (), current_path_text.size (), " %s" , current_path_.string ().c_str ());
271277
278+ ImGui::TableNextRow ();
279+ ImGui::TableNextColumn ();
272280 ImGui::AlignTextToFramePadding ();
273281 ImGui::TextUnformatted (" Current path" );
274- ImGui::SameLine ();
275- ImGui::SetCursorPosX (ImGui::GetCursorPosX () + (label_column_width - ImGui::CalcTextSize (" Current path" ).x ));
282+ ImGui::TableNextColumn ();
276283 ImGui::SetNextItemWidth (-FLT_MIN );
277284 if (focus_current_path_input_ && focused_slot_ == FocusSlot::CurrentPath) {
278285 ImGui::SetKeyboardFocusHere ();
@@ -282,6 +289,8 @@ OsdExplorer::Draw()
282289 if (!tab && ImGui::IsItemFocused ())
283290 focused_slot_ = FocusSlot::CurrentPath;
284291
292+ ImGui::EndTable ();
293+
285294 if (has_show_all_files_checkbox) {
286295 if (focus_show_all_files_ && focused_slot_ == FocusSlot::ShowAllFiles) {
287296 ImGui::SetKeyboardFocusHere ();
0 commit comments