@@ -125,8 +125,8 @@ namespace RTEGUI {
125
125
m_RightColumn->SetDrawColor (makecol (23 , 23 , 23 ));
126
126
m_RightColumn->SetDrawType (GUICollectionBox::Color);
127
127
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 )));
128
+ m_CollectionBoxList .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_CollectionBoxList ->GetRelYPos () + 240 , 270 , 350 )));
130
130
131
131
// Add an area showing the editing box
132
132
GUICollectionBox *workspace = dynamic_cast <GUICollectionBox *>(m_EditorManager->AddControl (" Workspace" , " COLLECTIONBOX" , m_EditorBase.get (), m_WorkspacePosX, m_WorkspacePosY, m_WorkspaceWidth, m_WorkspaceHeight));
@@ -187,8 +187,9 @@ namespace RTEGUI {
187
187
188
188
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
189
189
190
- void GUIEditorApp::UpdateActiveBoxList () {
191
- const GUIListPanel::Item *item = m_ActiveCollectionBoxList->GetSelected ();
190
+ void GUIEditorApp::UpdateCollectionBoxList () {
191
+ const GUIListPanel::Item *item = m_CollectionBoxList->GetSelected ();
192
+
192
193
if (item) {
193
194
// Try to find the box of that name, and select it
194
195
GUIControl *boxControl = m_ControlManager->GetControl (item->m_Name );
@@ -197,7 +198,7 @@ namespace RTEGUI {
197
198
m_SelectionInfo.GrabbedHandle = false ;
198
199
m_SelectionInfo.Control = boxControl;
199
200
200
- PopulateControlsInActiveCollectionBoxList (dynamic_cast <GUICollectionBox *>(boxControl));
201
+ PopulateCollectionBoxChildrenList (dynamic_cast <GUICollectionBox *>(boxControl));
201
202
}
202
203
} else {
203
204
// Deselection if clicked on no list item
@@ -211,52 +212,51 @@ namespace RTEGUI {
211
212
212
213
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
213
214
214
- void GUIEditorApp::AddItemToActiveCollectionBoxList (GUIControl *control, const std::string &indent) const {
215
- m_ActiveCollectionBoxList->AddItem (indent + control->GetName ());
216
-
215
+ void GUIEditorApp::AddItemToCollectionBoxList (GUIControl *control, const std::string &indent) const {
216
+ m_CollectionBoxList->AddItem (indent + control->GetName ());
217
217
for (GUIControl *childControl : *control->GetChildren ()) {
218
218
if ((control = dynamic_cast <GUICollectionBox *>(childControl))) {
219
- AddItemToActiveCollectionBoxList (control, indent + " \t " );
219
+ AddItemToCollectionBoxList (control, indent + " \t " );
220
220
}
221
221
}
222
222
}
223
223
224
224
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
225
225
226
- void GUIEditorApp::PopulateActiveCollectionBoxList () const {
227
- m_ActiveCollectionBoxList ->ClearList ();
226
+ void GUIEditorApp::PopulateCollectionBoxList () const {
227
+ m_CollectionBoxList ->ClearList ();
228
228
GUICollectionBox *collectionBox = nullptr ;
229
229
230
230
// Go through all the top-level (directly under root) controls and add only the CollectionBoxes to the list here
231
231
for (GUIControl *control : *m_ControlManager->GetControlList ()) {
232
232
// Look for CollectionBoxes with the root control as parent
233
233
if ((collectionBox = dynamic_cast <GUICollectionBox *>(control)) && collectionBox->GetParent () == m_RootControl) {
234
- m_ActiveCollectionBoxList ->AddItem (collectionBox->GetName ());
234
+ m_CollectionBoxList ->AddItem (collectionBox->GetName ());
235
235
236
236
for (GUIControl *childControl : *collectionBox->GetChildren ()) {
237
237
if ((collectionBox = dynamic_cast <GUICollectionBox *>(childControl))) {
238
- AddItemToActiveCollectionBoxList (collectionBox, " \t " );
238
+ AddItemToCollectionBoxList (collectionBox, " \t " );
239
239
}
240
240
}
241
241
// Check if this is selected in the editor, and if so, select it in the list too
242
242
if (m_SelectionInfo.Control == collectionBox) {
243
- m_ActiveCollectionBoxList ->SetSelectedIndex (m_ActiveCollectionBoxList ->GetItemList ()->size () - 1 );
244
- PopulateControlsInActiveCollectionBoxList (collectionBox);
243
+ m_CollectionBoxList ->SetSelectedIndex (m_CollectionBoxList ->GetItemList ()->size () - 1 );
244
+ PopulateCollectionBoxChildrenList (collectionBox);
245
245
}
246
246
}
247
247
}
248
248
}
249
249
250
250
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
251
251
252
- void GUIEditorApp::PopulateControlsInActiveCollectionBoxList (GUICollectionBox *collectionBox) const {
252
+ void GUIEditorApp::PopulateCollectionBoxChildrenList (GUICollectionBox *collectionBox) const {
253
253
m_ControlsInActiveCollectionBoxList->ClearList ();
254
254
255
255
// Go through all the top-level (directly under root) controls and add only the CollectionBoxes to the list here
256
256
for (GUIControl *control : *collectionBox->GetChildren ()) {
257
257
m_ControlsInActiveCollectionBoxList->AddItem (control->GetName ());
258
258
// Check if this is selected in the editor, and if so, select it in the list too
259
- if (collectionBox == m_SelectionInfo.Control ) { m_ControlsInActiveCollectionBoxList->SetSelectedIndex (m_ActiveCollectionBoxList ->GetItemList ()->size () - 1 ); }
259
+ if (collectionBox == m_SelectionInfo.Control ) { m_ControlsInActiveCollectionBoxList->SetSelectedIndex (m_CollectionBoxList ->GetItemList ()->size () - 1 ); }
260
260
}
261
261
}
262
262
@@ -427,7 +427,11 @@ namespace RTEGUI {
427
427
428
428
if (parent) { m_ControlManager->AddControl (name, controlClass, parent, 0 , 0 , -1 , -1 ); }
429
429
430
- PopulateActiveCollectionBoxList ();
430
+ if (controlClass == " COLLECTIONBOX" ) {
431
+ PopulateCollectionBoxList ();
432
+ } else {
433
+ PopulateCollectionBoxChildrenList (dynamic_cast <GUICollectionBox *>(parent));
434
+ }
431
435
}
432
436
433
437
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -477,7 +481,7 @@ namespace RTEGUI {
477
481
break ;
478
482
case GUIEvent::Notification:
479
483
if (editorEvent.GetControl ()->GetName () == " ActiveCollectionBoxes" && editorEvent.GetMsg () == GUIListBox::MouseDown) {
480
- UpdateActiveBoxList ();
484
+ UpdateCollectionBoxList ();
481
485
} else if (editorEvent.GetControl ()->GetName () == " PropertyPage" ) {
482
486
UpdatePropertyPage (editorEvent);
483
487
} else if (editorEvent.GetControl ()->GetName () == " GridSizeTextBox" && editorEvent.GetMsg () == GUITextBox::Enter) {
@@ -752,7 +756,7 @@ namespace RTEGUI {
752
756
m_PropertyPage->ClearValues ();
753
757
m_UnsavedChanges = false ;
754
758
755
- PopulateActiveCollectionBoxList ();
759
+ PopulateCollectionBoxList ();
756
760
}
757
761
}
758
762
@@ -792,7 +796,7 @@ namespace RTEGUI {
792
796
m_LeftColumn->Resize (m_LeftColumn->GetWidth (), resizeInfo->new_h );
793
797
m_RightColumn->Resize (m_RightColumn->GetWidth (), resizeInfo->new_h );
794
798
m_RightColumn->Move (resizeInfo->new_w - m_RightColumn->GetWidth (), 0 );
795
- m_ControlsInActiveCollectionBoxList->Resize (m_ActiveCollectionBoxList ->GetWidth (), resizeInfo->new_h - m_ControlsInActiveCollectionBoxList->GetRelYPos () - 5 );
799
+ m_ControlsInActiveCollectionBoxList->Resize (m_CollectionBoxList ->GetWidth (), resizeInfo->new_h - m_ControlsInActiveCollectionBoxList->GetRelYPos () - 5 );
796
800
m_WindowResized = true ;
797
801
}
798
802
}
0 commit comments