Re: AW: Attach invisible data to a TreeRow?
- From: Marco <mscholtn xs4all nl>
- To: "Daniel Kraft" <d daniel-kraft net>
- Cc: gtkmm general discussion <gtkmm-list gnome org>
- Subject: Re: AW: Attach invisible data to a TreeRow?
- Date: Fri, 16 Dec 2005 22:38:23 +0100
On Fri, 16 Dec 2005 22:26:18 +0100, Daniel Kraft <d daniel-kraft net>
wrote:
Hi!
I thought about a solution like that for one of my projects some time
ago:
Just add a column to your modelcolumns but don't append a column for
that
to your treeview.
Here are some code fragments where i do this in my project.
//Tree model columns:
class PageListModelColumns : public Gtk::TreeModel::ColumnRecord
{
public:
PageListModelColumns()
{ add(m_col_name); add(m_col_page); }
Gtk::TreeModelColumn<Glib::ustring> m_col_name;
Gtk::TreeModelColumn<DialogPage*> m_col_page;
};
PageListModelColumns m_PageListColumns;
//Add the TreeView's view columns:
m_pPagelist->append_column("Name", m_PageListColumns.m_col_name);
//m_pPagelist is a treeview
But I was wondering how to delete the DialogPage-objects when the row is
deleted. Do I have to keep track of when the row is deleted at my own or
are
there ways to do such a clean-up, for instance, like if it was done in
the
TreeRow's destructor? So can I define some code to clean up which is
automatically called whenever the TreeRow is destructed?
Yours,
Daniel Kraft
You can use a smart pointer for that, like Glib::RefPtr .
http://www.gtkmm.org/docs/glibmm-2.4/docs/reference/html/classGlib_1_1RefPtr.html
http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/ch18s02.html
--
Marco
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]