Skip to content

Commit 5d11f88

Browse files
committed
Active CollectionBox list displays multiple levels
1 parent 0bd7c05 commit 5d11f88

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

Editor/GUIEditorApp.cpp

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ namespace RTEGUI {
125125
m_RightColumn->SetDrawColor(makecol(23, 23, 23));
126126
m_RightColumn->SetDrawType(GUICollectionBox::Color);
127127

128-
m_ActiveCollectionBoxList.reset(dynamic_cast<GUIListBox *>(m_EditorManager->AddControl("ActiveCollectionBoxes", "LISTBOX", m_RightColumn.get(), 15, 5, 270, 200)));
129-
m_ControlsInActiveCollectionBoxList.reset(dynamic_cast<GUIListBox *>(m_EditorManager->AddControl("ControlsInActiveCollectionBox", "LISTBOX", m_RightColumn.get(), 15, m_ActiveCollectionBoxList->GetRelYPos() + 210, 270, 380)));
128+
m_ActiveCollectionBoxList.reset(dynamic_cast<GUIListBox *>(m_EditorManager->AddControl("ActiveCollectionBoxes", "LISTBOX", m_RightColumn.get(), 15, 5, 270, 230)));
129+
m_ControlsInActiveCollectionBoxList.reset(dynamic_cast<GUIListBox *>(m_EditorManager->AddControl("ControlsInActiveCollectionBox", "LISTBOX", m_RightColumn.get(), 15, m_ActiveCollectionBoxList->GetRelYPos() + 240, 270, 350)));
130130

131131
// Add an area showing the editing box
132132
GUICollectionBox *workspace = dynamic_cast<GUICollectionBox *>(m_EditorManager->AddControl("Workspace", "COLLECTIONBOX", m_EditorBase.get(), m_WorkspacePosX, m_WorkspacePosY, m_WorkspaceWidth, m_WorkspaceHeight));
@@ -211,7 +211,19 @@ namespace RTEGUI {
211211

212212
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
213213

214-
void GUIEditorApp::PopulateActiveBoxList() const {
214+
void GUIEditorApp::AddItemToActiveCollectionBoxList(GUIControl *control, const std::string &indent) const {
215+
m_ActiveCollectionBoxList->AddItem(indent + control->GetName());
216+
217+
for (GUIControl *childControl : *control->GetChildren()) {
218+
if ((control = dynamic_cast<GUICollectionBox *>(childControl))) {
219+
AddItemToActiveCollectionBoxList(control, indent + "\t");
220+
}
221+
}
222+
}
223+
224+
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
225+
226+
void GUIEditorApp::PopulateActiveCollectionBoxList() const {
215227
m_ActiveCollectionBoxList->ClearList();
216228
GUICollectionBox *collectionBox = nullptr;
217229

@@ -220,6 +232,12 @@ namespace RTEGUI {
220232
// Look for CollectionBoxes with the root control as parent
221233
if ((collectionBox = dynamic_cast<GUICollectionBox *>(control)) && collectionBox->GetParent() == m_RootControl) {
222234
m_ActiveCollectionBoxList->AddItem(collectionBox->GetName());
235+
236+
for (GUIControl *childControl : *collectionBox->GetChildren()) {
237+
if ((collectionBox = dynamic_cast<GUICollectionBox *>(childControl))) {
238+
AddItemToActiveCollectionBoxList(collectionBox, "\t");
239+
}
240+
}
223241
// Check if this is selected in the editor, and if so, select it in the list too
224242
if (m_SelectionInfo.Control == collectionBox) {
225243
m_ActiveCollectionBoxList->SetSelectedIndex(m_ActiveCollectionBoxList->GetItemList()->size() - 1);
@@ -409,7 +427,7 @@ namespace RTEGUI {
409427

410428
if (parent) { m_ControlManager->AddControl(name, controlClass, parent, 0, 0, -1, -1); }
411429

412-
PopulateActiveBoxList();
430+
PopulateActiveCollectionBoxList();
413431
}
414432

415433
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -734,7 +752,7 @@ namespace RTEGUI {
734752
m_PropertyPage->ClearValues();
735753
m_UnsavedChanges = false;
736754

737-
PopulateActiveBoxList();
755+
PopulateActiveCollectionBoxList();
738756
}
739757
}
740758

Editor/GUIEditorApp.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,12 @@ namespace RTEGUI {
156156
/// <summary>
157157
///
158158
/// </summary>
159-
void PopulateActiveBoxList() const;
159+
void AddItemToActiveCollectionBoxList(GUIControl *control, const std::string &indent) const;
160+
161+
/// <summary>
162+
///
163+
/// </summary>
164+
void PopulateActiveCollectionBoxList() const;
160165

161166
/// <summary>
162167
///

0 commit comments

Comments
 (0)