void MultiViewSelectionDialog::ButtonClick( Button& sender, bool checked ) { if ( sender == SelectAll_PushButton ) { for ( int i = 0, n = Views_TreeBox.NumberOfChildren(); i < n; ++i ) { TreeBox::Node* node = Views_TreeBox[i]; if ( node != nullptr ) node->Check(); } } else if ( sender == UnselectAll_PushButton ) { for ( int i = 0, n = Views_TreeBox.NumberOfChildren(); i < n; ++i ) { TreeBox::Node* node = Views_TreeBox[i]; if ( node != nullptr ) node->Uncheck(); } } else if ( sender == OK_PushButton ) { m_selectedViews.Clear(); for ( int i = 0, n = Views_TreeBox.NumberOfChildren(); i < n; ++i ) { const TreeBox::Node* node = Views_TreeBox[i]; if ( node != nullptr && node->IsChecked() ) { View view = View::ViewById( node->Text( 0 ) ); if ( !view.IsNull() ) m_selectedViews.Add( view ); } } Ok(); } else if ( sender == Cancel_PushButton ) { m_selectedViews.Clear(); Cancel(); } }
void MultiViewSelectionDialog::Regenerate() { Views_TreeBox.Clear(); Array<View> views = View::AllViews(); bool includeMainViews = !m_allowPreviews || IncludeMainViews_CheckBox.IsChecked(); bool includePreviews = m_allowPreviews && IncludePreviews_CheckBox.IsChecked(); for ( Array<View>::const_iterator i = views.Begin(); i != views.End(); ++i ) { bool isPreview = i->IsPreview(); if ( isPreview ? includePreviews : includeMainViews ) { TreeBox::Node* node = new TreeBox::Node( Views_TreeBox ); node->SetCheckable(); node->Uncheck(); node->SetText( 0, i->FullId() ); } } Views_TreeBox.AdjustColumnWidthToContents( 0 ); }