[Gtk::TreeModel]How to extends Gtk::TreeModel::Row



Hello :-)

I try to create my own Gtk::TreeModel::Row

In the example of the documentation, it says how to use it:
https://git.gnome.org/browse/gtkmm-documentation/tree/examples/book/treeview/list/examplewindow.cc

/ / Create the Tree model:
m_refTreeModel = Gtk :: ListStore :: create (m_Columns);
/ / Fill the TreeView's model
Gtk :: TreeModel :: Row row = * (m_refTreeModel-> append ());
row [m_Columns.m_col_id] = 1;
/ / -------------

Instead, I wish I could write directly: row.setId (1) instead of row[m_Columns.m_col_id] = 1;




Thus, deriving a few classes, I first got this code:

m_refTreeModel = My :: ListStore :: create (m_Columns);
/ / How to implement the append TreeView's model ?
// My::TreeModel::Row row = * (m_refTreeModel-> append ());
// row.setId (1);


I do not know how to implement the
function My::TreeStore::append(), which you can see below, so as to ensure that the function My::TreeStore::append() returns me an iterator over My::TreeModel::Row (with my getter and setter)

My namespace {
/ / ...
Gtk :: TreeModel :: iterator TreeStore :: append ()
{
     Gtk::TreeModel::iterator it = Gtk :: TreeStore :: append ();
     Gtk::TreeModel::Row row = * it;
     My::TreeModel::Row my_Row = static_cast <My::TreeModel::Row> (row);// ok

    ///
    /// HOW RETURN MY CUSTOME ITERATOR
    ///
     return it;
}
/ / ...
} / / Namespace My

Someone to help me?



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]