~mmach/netext73/wxwidgets3.0

« back to all changes in this revision

Viewing changes to src/gtk/dataview.cpp

  • Committer: mmach
  • Date: 2020-06-26 06:45:45 UTC
  • Revision ID: netbit73@gmail.com-20200626064545-f93leu8gg98o2ojg
3.0.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
1788
1788
 
1789
1789
bool wxGtkDataViewModelNotifier::Cleared()
1790
1790
{
1791
 
    GtkWxTreeModel *wxgtk_model = m_internal->GetGtkModel();
1792
 
 
1793
 
    // There is no call to tell the model that everything
1794
 
    // has been deleted so call row_deleted() for every
1795
 
    // child of root...
1796
 
 
1797
 
    int count = m_internal->iter_n_children( NULL ); // number of children of root
1798
 
 
1799
 
    GtkTreePath *path = gtk_tree_path_new_first();  // points to root
1800
 
 
1801
 
    // It is important to avoid selection changed events being generated from
1802
 
    // here as they would reference the already deleted model items, which
1803
 
    // would result in crashes in any code attempting to handle these events.
1804
 
    m_internal->GtkDisableSelectionEvents();
1805
 
 
1806
 
    // We also need to prevent wxGtkTreeCellDataFunc from using the model items
1807
 
    // not existing any longer, so change the model stamp to indicate that it
1808
 
    // temporarily can't be used.
1809
 
    const gint stampOrig = wxgtk_model->stamp;
1810
 
    wxgtk_model->stamp = 0;
1811
 
 
1812
 
    int i;
1813
 
    for (i = 0; i < count; i++)
1814
 
        gtk_tree_model_row_deleted( GTK_TREE_MODEL(wxgtk_model), path );
1815
 
 
1816
 
    gtk_tree_path_free( path );
1817
 
 
1818
 
    wxgtk_model->stamp = stampOrig;
1819
 
 
1820
 
    m_internal->Cleared();
1821
 
 
1822
 
    m_internal->GtkEnableSelectionEvents();
1823
 
 
1824
 
    return true;
 
1791
    return BeforeReset() && AfterReset();
1825
1792
}
1826
1793
 
1827
1794
// ---------------------------------------------------------