@@ -34,43 +34,50 @@ namespace Tetragrama::Components
3434
3535 ImGui::Begin (Name.c_str (), (CanBeClosed ? &CanBeClosed : NULL ), ImGuiWindowFlags_NoCollapse);
3636
37- ImGui::BeginChild (" Left Pane" , ImVec2 (ImGui::GetContentRegionAvail ().x * 0 .15f , 0 ), true );
38- RenderTreeBrowser ();
39- ImGui::EndChild ();
37+ ImGui::PushStyleVar (ImGuiStyleVar_FramePadding, ImVec2 (2 , 2 ));
38+ ImVec2 current_win_size = ImGui::GetContentRegionAvail ();
39+ if (ImGui::BeginTable (" #AssetBrowserArea" , 2 , ImGuiTableFlags_Resizable, current_win_size))
40+ {
41+ /* Left Pane*/
42+ ImGui::TableNextRow ();
43+ ImGui::TableSetColumnIndex (0 );
44+ RenderTreeBrowser ();
45+
46+ /* Right Pane*/
47+ ImGui::TableSetColumnIndex (1 );
48+ if (ImGui::IsWindowHovered () && ImGui::IsMouseClicked (ImGuiMouseButton_Right))
49+ {
50+ ImGui::OpenPopup (" ContextMenu" );
51+ }
52+ if (ImGui::BeginPopup (" ContextMenu" ))
53+ {
54+ RenderContextMenu (ContextMenuType::RightPane, m_current_directory);
55+ ImGui::EndPopup ();
56+ }
57+ RenderPopUpMenu ();
4058
41- ImGui::SameLine ();
42- ImGui::GetWindowDrawList ()->AddLine (ImGui::GetCursorScreenPos (), ImVec2 (ImGui::GetCursorScreenPos ().x , ImGui::GetCursorScreenPos ().y + ImGui::GetContentRegionAvail ().y ), ImGui::GetColorU32 (ImGuiCol_Separator), 0 .5f );
59+ RenderBackButton ();
60+ ImGui::SameLine ();
61+ ImGui::InputTextWithHint (" ##Search" , " Search ..." , m_search_buffer, IM_ARRAYSIZE (m_search_buffer));
62+ ImGui::SameLine ();
4363
44- ImGui::BeginChild ( " Right Pane " , ImVec2 ( 0 , 0 ), true );
45- if ( ImGui::IsWindowHovered () && ImGui::IsMouseClicked (ImGuiMouseButton_Right))
46- {
47- ImGui::OpenPopup ( " ContextMenu " );
48- }
49- if ( ImGui::BeginPopup ( " ContextMenu " ))
50- {
51- RenderContextMenu (ContextMenuType::RightPane, m_current_directory);
52- ImGui::EndPopup ();
64+ ImGui::PushFont ( ImGui::GetIO (). Fonts -> Fonts [ 0 ] );
65+ auto relative_path = MakeRelative (m_current_directory, m_assets_directory. parent_path ());
66+ ImGui::Text (relative_path. string (). c_str ());
67+ ImGui::PopFont ( );
68+ ImGui::Separator ();
69+
70+ RenderContentBrowser (renderer);
71+
72+ ImGui::EndTable ();
5373 }
54- RenderPopUpMenu ();
55- RenderContentBrowser (renderer);
56- ImGui::EndChild ();
74+ ImGui::PopStyleVar ();
5775
5876 ImGui::End ();
5977 }
6078
6179 void ProjectViewUIComponent::RenderContentBrowser (ZEngine::Rendering::Renderers::GraphicRenderer* const renderer)
6280 {
63-
64- RenderBackButton ();
65- ImGui::SameLine ();
66- ImGui::InputTextWithHint (" ##Search" , " Search ..." , m_search_buffer, IM_ARRAYSIZE (m_search_buffer));
67- ImGui::SameLine ();
68- ImGui::PushFont (ImGui::GetIO ().Fonts ->Fonts [0 ]);
69- auto relative_path = MakeRelative (m_current_directory, m_assets_directory.parent_path ());
70- ImGui::Text (relative_path.string ().c_str ());
71- ImGui::PopFont ();
72- ImGui::Separator ();
73-
7481 const float padding = 16 .0f ;
7582 const float cellSize = m_thumbnail_size + padding;
7683 const float panelWidth = ImGui::GetContentRegionAvail ().x ;
@@ -110,7 +117,7 @@ namespace Tetragrama::Components
110117 ImGui::SetCursorPos (ImVec2 (cursorPos.x + margin, cursorPos.y + margin));
111118
112119 ImGui::PushStyleColor (ImGuiCol_Button, ImVec4 (0 , 0 , 0 , 0 ));
113- ImGui::ImageButton (icon, {m_thumbnail_size, m_thumbnail_size}, {0 , 1 }, {1 , 0 });
120+ ImGui::ImageButton (" #image " , icon, {m_thumbnail_size, m_thumbnail_size}, {0 , 1 }, {1 , 0 });
114121 ImGui::PopStyleColor ();
115122 ImGui::SetCursorPos (ImVec2 (cursorPos.x , cursorPos.y + m_thumbnail_size + margin));
116123
@@ -564,37 +571,25 @@ namespace Tetragrama::Components
564571
565572 void ProjectViewUIComponent::RenderBackButton ()
566573 {
567- ImGui::SameLine ();
568- static constexpr float ButtonSize = 20 .0f ;
569- static constexpr float TriangleSize = 8 .0f ;
570- const ImU32 DefaultColor = IM_COL32 (150 , 150 , 150 , 255 );
571- const ImU32 HoverColor = IM_COL32 (200 , 200 , 200 , 255 );
572- const ImU32 DisabledColor = IM_COL32 (100 , 100 , 100 , 128 );
573- ImDrawList* drawList = ImGui::GetWindowDrawList ();
574- ImVec2 cursorPos = ImGui::GetCursorScreenPos ();
575- // Calculate positions
576- ImVec2 buttonSize (ButtonSize, ButtonSize);
577- ImVec2 center = {cursorPos.x + ButtonSize / 2 , cursorPos.y + ButtonSize / 2 };
578- // Calculate triangle vertices
579- ImVec2 triangleLeft = {center.x - TriangleSize, center.y };
580- ImVec2 triangleTopRight = {center.x + TriangleSize, center.y - TriangleSize};
581- ImVec2 triangleBottomRight = {center.x + TriangleSize, center.y + TriangleSize};
582- bool canGoBack = (m_current_directory != m_assets_directory);
583- ImU32 triangleColor = DefaultColor;
574+ bool canGoBack = (m_current_directory != m_assets_directory);
584575 if (canGoBack)
585576 {
586- if (ImGui::Button (" ##BackButton " , buttonSize ))
577+ if (ImGui::ArrowButton (" ##left " , ImGuiDir_Left ))
587578 {
588579 m_current_directory = m_current_directory.parent_path ();
589580 }
590- triangleColor = ImGui::IsItemHovered () ? HoverColor : DefaultColor;
591581 }
592582 else
593583 {
594- ImGui::Dummy (buttonSize);
595- triangleColor = DisabledColor;
584+ ImVec4 color = {0 .2f , 0 .2f , 0 .2f , .2f };
585+ ImGui::PushStyleColor (ImGuiCol_Button, color); // Grayed out color
586+ ImGui::PushStyleColor (ImGuiCol_ButtonHovered, color);
587+ ImGui::PushStyleColor (ImGuiCol_ButtonActive, color);
588+
589+ ImGui::ArrowButton (" ##left" , ImGuiDir_Left);
590+
591+ ImGui::PopStyleColor (3 );
596592 }
597- drawList->AddTriangleFilled (triangleLeft, triangleTopRight, triangleBottomRight, triangleColor);
598593 }
599594
600595 void ProjectViewUIComponent::RenderContextMenu (ContextMenuType type, const std::filesystem::path& targetPath)
0 commit comments