void wxHeaderCtrl::DoSetCount(unsigned int count) { unsigned n; // first delete all old columns const unsigned countOld = GetShownColumnsCount(); for ( n = 0; n < countOld; n++ ) { if ( !Header_DeleteItem(GetHwnd(), 0) ) { wxLogLastError(wxT("Header_DeleteItem")); } } // update the column indices order array before changing m_numColumns DoResizeColumnIndices(m_colIndices, count); // and add the new ones m_numColumns = count; m_isHidden.resize(m_numColumns); for ( n = 0; n < count; n++ ) { const wxHeaderColumn& col = GetColumn(n); if ( col.IsShown() ) { m_isHidden[n] = false; DoInsertItem(col, n); } else // hidden initially { m_isHidden[n] = true; } } }
wxDataViewItem TreeListModel::InsertItem(const wxDataViewItem& insertBeforeMe, const wxVector<wxVariant>& data, wxClientData *clientData) { wxDataViewItem ch = DoInsertItem(insertBeforeMe, data, false, clientData); if ( ch.IsOk() ) { TreeListModel_Item* node = reinterpret_cast<TreeListModel_Item*>(ch.GetID()); ItemAdded(wxDataViewItem(node->GetParent()), ch); } return ch; }
void wxHeaderCtrl::DoUpdate(unsigned int idx) { // the native control does provide Header_SetItem() but it's inconvenient // to use it because it sends HDN_ITEMCHANGING messages and we'd have to // arrange not to block setting the width from there and the logic would be // more complicated as we'd have to reset the old values as well as setting // the new ones -- so instead just recreate the column const wxHeaderColumn& col = GetColumn(idx); if ( col.IsHidden() ) { // column is hidden now if ( !m_isHidden[idx] ) { // but it wasn't hidden before, so remove it if ( !Header_DeleteItem(GetHwnd(), MSWToNativeIdx(idx)) ) wxLogLastError(wxS("Header_DeleteItem()")); m_isHidden[idx] = true; } //else: nothing to do, updating hidden column doesn't have any effect } else // column is shown now { if ( m_isHidden[idx] ) { m_isHidden[idx] = false; } else // and it was shown before as well { // we need to remove the old column if ( !Header_DeleteItem(GetHwnd(), MSWToNativeIdx(idx)) ) wxLogLastError(wxS("Header_DeleteItem()")); } DoInsertItem(col, idx); } }