Index: source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Object/Object.h =================================================================== --- source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Object/Object.h +++ source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Object/Object.h @@ -35,7 +35,7 @@ void OnToggleViewer(wxCommandEvent& evt); void OnSelectType(wxCommandEvent& evt); void OnSelectFilter(wxCommandEvent& evt); - void OnSelectObject(wxCommandEvent& evt); + void OnSelectObject(wxListEvent& evt); ObjectSidebarImpl* m_Impl; Index: source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Object/Object.cpp =================================================================== --- source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Object/Object.cpp +++ source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Object/Object.cpp @@ -98,14 +98,14 @@ struct ObjectSidebarImpl { ObjectSidebarImpl(ScenarioEditor& scenarioEditor) : - m_ObjectListBox(NULL), m_ActorViewerActive(false), + m_ObjectListView(NULL), m_ActorViewerActive(false), m_ActorViewerEntity(L"actor|structures/fndn_1x1.xml"), m_ActorViewerAnimation("idle"), m_ActorViewerSpeed(0.f), m_ObjectSettings(scenarioEditor.GetObjectSettings()) { } - wxListBox* m_ObjectListBox; + wxListView* m_ObjectListView; std::vector m_Objects; ObservableScopedConnection m_ToolConn; @@ -159,8 +159,9 @@ // ------------------------------------------------------------------------------------------ - m_Impl->m_ObjectListBox = new wxListBox(scrolledWindow, ID_SelectObject, wxDefaultPosition, wxDefaultSize, 0, nullptr, wxLB_SINGLE|wxLB_HSCROLL); - scrollSizer->Add(m_Impl->m_ObjectListBox, wxSizerFlags().Proportion(1).Expand()); + m_Impl->m_ObjectListView = new wxListView(scrolledWindow, ID_SelectObject, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_SINGLE_SEL); + m_Impl->m_ObjectListView->AppendColumn(_("Template Name"), wxLIST_FORMAT_LEFT, wxLIST_AUTOSIZE); + scrollSizer->Add(m_Impl->m_ObjectListView, wxSizerFlags().Proportion(1).Expand()); scrollSizer->AddSpacer(3); // ------------------------------------------------------------------------------------------ @@ -220,8 +221,10 @@ int filterType = wxDynamicCast(FindWindow(ID_ObjectType), wxChoice)->GetSelection(); wxString filterName = wxDynamicCast(FindWindow(ID_ObjectFilter), wxTextCtrl)->GetValue(); - m_Impl->m_ObjectListBox->Freeze(); - m_Impl->m_ObjectListBox->Clear(); + m_Impl->m_ObjectListView->Freeze(); + m_Impl->m_ObjectListView->DeleteAllItems(); + + int itemIdListView = 0; for (std::vector::iterator it = m_Impl->m_Objects.begin(); it != m_Impl->m_Objects.end(); ++it) { if (it->type == filterType) @@ -231,11 +234,18 @@ if (name.Lower().Find(filterName.Lower()) != wxNOT_FOUND) { - m_Impl->m_ObjectListBox->Append(name, new wxStringClientData(id)); + wxListItem item; + item.SetColumn(0); + item.SetText(name); + item.SetId(++itemIdListView); + item.SetWidth(wxLIST_AUTOSIZE); + item.SetData(new wxStringClientData(id)); + m_Impl->m_ObjectListView->InsertItem(item); } } } - m_Impl->m_ObjectListBox->Thaw(); + m_Impl->m_ObjectListView->SetColumnWidth(0, wxLIST_AUTOSIZE); + m_Impl->m_ObjectListView->Thaw(); } void ObjectSidebar::OnToggleViewer(wxCommandEvent& WXUNUSED(evt)) @@ -255,12 +265,12 @@ FilterObjects(); } -void ObjectSidebar::OnSelectObject(wxCommandEvent& evt) +void ObjectSidebar::OnSelectObject(wxListEvent& evt) { if (evt.GetInt() < 0) return; - wxString id = static_cast(evt.GetClientObject())->GetData(); + wxString id = reinterpret_cast(evt.GetData())->GetData(); // Always update the actor viewer's state even if it's inactive, // so it will be correct when first enabled @@ -285,7 +295,7 @@ BEGIN_EVENT_TABLE(ObjectSidebar, Sidebar) EVT_CHOICE(ID_ObjectType, ObjectSidebar::OnSelectType) EVT_TEXT(ID_ObjectFilter, ObjectSidebar::OnSelectFilter) - EVT_LISTBOX(ID_SelectObject, ObjectSidebar::OnSelectObject) + EVT_LIST_ITEM_SELECTED(ID_SelectObject, ObjectSidebar::OnSelectObject) EVT_BUTTON(ID_ToggleViewer, ObjectSidebar::OnToggleViewer) END_EVENT_TABLE();