DIALOG_BOM_EDITOR::DIALOG_BOM_EDITOR( SCH_EDIT_FRAME* parent ) : DIALOG_BOM_EDITOR_BASE( parent ), m_parent( parent ) { m_bom = BOM_TABLE_MODEL::Create(); m_columnListCtrl->DeleteAllItems(); m_columnListCtrl->ClearColumns(); auto nameColumn = m_columnListCtrl->AppendTextColumn( _( "Field" ) ); auto showColumn = m_columnListCtrl->AppendToggleColumn( _( "Show" ), wxDATAVIEW_CELL_ACTIVATABLE, 100 ); // Resize the columns appropriately m_columnListCtrl->Update(); showColumn->SetWidth( wxCOL_WIDTH_AUTOSIZE ); showColumn->SetMinWidth( showColumn->GetWidth() ); showColumn->SetResizeable( false ); m_columnListCtrl->Update(); nameColumn->SetWidth( wxCOL_WIDTH_AUTOSIZE ); nameColumn->SetResizeable( true ); // Read all components LoadComponents(); LoadColumnNames(); ReloadColumns(); m_bom->ReloadTable(); Update(); m_bomView->Update(); // Set default column widths for( unsigned int ii = 0; ii < m_bomView->GetColumnCount(); ii++ ) { auto col = m_bomView->GetColumn( ii ); if( !col ) continue; col->SetWidth( wxCOL_WIDTH_AUTOSIZE ); col->SetResizeable( true ); } Layout(); GetSizer()->SetSizeHints( this ); Centre(); }
void wxSettableHeaderColumn::SetIndividualFlags(int flags) { SetResizeable((flags & wxCOL_RESIZABLE) != 0); SetSortable((flags & wxCOL_SORTABLE) != 0); SetReorderable((flags & wxCOL_REORDERABLE) != 0); SetHidden((flags & wxCOL_HIDDEN) != 0); }
GUIinfoSelection::GUIinfoSelection(int x, int y, int w, int h):GUIpane(x, y, w, h) { SetFrame(false); SetResizeable(true); minW=220; minH=h; }
GUIallyResourceBar::GUIallyResourceBar(int x, int y, int w, int h):GUIpane(x, y, w, h) { SetFrame(false); SetResizeable(true); downInBar=false; minW=220; minH=h; }
wxDataViewColumn* BOM_TABLE_MODEL::AddColumn( BOM_COLUMN* aColumn, int aPosition ) { static const unsigned int flags = wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_SORTABLE; if( !m_widget || !aColumn || !aColumn->IsVisible() ) return nullptr; wxDataViewCellMode editFlag = aColumn->IsReadOnly() ? wxDATAVIEW_CELL_INERT : wxDATAVIEW_CELL_EDITABLE; auto renderer = new wxDataViewTextRenderer( "string" , editFlag ); auto column = new wxDataViewColumn( aColumn->Title(), renderer, aColumn->Id(), 150, //TODO - variable default width? wxAlignment( wxALIGN_LEFT ), flags ); // Work out where to insert the column std::set<unsigned int> columnsBefore; for( auto testCol : ColumnList.Columns ) { if( testCol->Id() == aColumn->Id() ) { break; } else { columnsBefore.insert( testCol->Id() ); } } bool found = false; for( unsigned int ii=0; ii<m_widget->GetColumnCount(); ii++ ) { auto col = m_widget->GetColumn( ii ); if( !col ) continue; // If the new column is already in the view, escape if( col->GetModelColumn() == aColumn->Id() ) { return col; } // If we should insert the new column BEFORE this one if( columnsBefore.count( col->GetModelColumn() ) == 0 ) { found = true; m_widget->InsertColumn( ii, column ); break; } } if( !found ) m_widget->AppendColumn( column ); column->SetResizeable( true ); return column; }