Skip to content

Commit 0bd7c05

Browse files
committed
Display CollectionBox children in a separate list
1 parent 628c68a commit 0bd7c05

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

Editor/GUIEditorApp.cpp

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,16 @@ namespace RTEGUI {
196196
m_SelectionInfo.GrabbedControl = false;
197197
m_SelectionInfo.GrabbedHandle = false;
198198
m_SelectionInfo.Control = boxControl;
199+
200+
PopulateControlsInActiveCollectionBoxList(dynamic_cast<GUICollectionBox *>(boxControl));
199201
}
200202
} else {
201203
// Deselection if clicked on no list item
202204
m_SelectionInfo.GrabbedControl = false;
203205
m_SelectionInfo.GrabbedHandle = false;
204206
m_SelectionInfo.Control = nullptr;
207+
208+
m_ControlsInActiveCollectionBoxList->ClearList();
205209
}
206210
}
207211

@@ -217,11 +221,27 @@ namespace RTEGUI {
217221
if ((collectionBox = dynamic_cast<GUICollectionBox *>(control)) && collectionBox->GetParent() == m_RootControl) {
218222
m_ActiveCollectionBoxList->AddItem(collectionBox->GetName());
219223
// Check if this is selected in the editor, and if so, select it in the list too
220-
if (collectionBox == m_SelectionInfo.Control) { m_ActiveCollectionBoxList->SetSelectedIndex(m_ActiveCollectionBoxList->GetItemList()->size() - 1); }
224+
if (m_SelectionInfo.Control == collectionBox) {
225+
m_ActiveCollectionBoxList->SetSelectedIndex(m_ActiveCollectionBoxList->GetItemList()->size() - 1);
226+
PopulateControlsInActiveCollectionBoxList(collectionBox);
227+
}
221228
}
222229
}
223230
}
224231

232+
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
233+
234+
void GUIEditorApp::PopulateControlsInActiveCollectionBoxList(GUICollectionBox *collectionBox) const {
235+
m_ControlsInActiveCollectionBoxList->ClearList();
236+
237+
// Go through all the top-level (directly under root) controls and add only the CollectionBoxes to the list here
238+
for (GUIControl *control : *collectionBox->GetChildren()) {
239+
m_ControlsInActiveCollectionBoxList->AddItem(control->GetName());
240+
// Check if this is selected in the editor, and if so, select it in the list too
241+
if (collectionBox == m_SelectionInfo.Control) { m_ControlsInActiveCollectionBoxList->SetSelectedIndex(m_ActiveCollectionBoxList->GetItemList()->size() - 1); }
242+
}
243+
}
244+
225245
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
226246

227247
GUIControl * GUIEditorApp::ControlUnderMouse(GUIControl *parent, int mousePosX, int mousePosY) {

Editor/GUIEditorApp.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,11 @@ namespace RTEGUI {
158158
/// </summary>
159159
void PopulateActiveBoxList() const;
160160

161+
/// <summary>
162+
///
163+
/// </summary>
164+
void PopulateControlsInActiveCollectionBoxList(GUICollectionBox *collectionBox) const;
165+
161166
/// <summary>
162167
/// Checks if a control is under the mouse point.
163168
/// </summary>

0 commit comments

Comments
 (0)