What to subclass - CellRenderer or TreeModel
- From: Todor Todorov <ttodorov gmx net>
- To: gtkmm-list gnome org
- Subject: What to subclass - CellRenderer or TreeModel
- Date: Thu, 07 Feb 2008 01:25:43 +0100
Hello list,
I´m new to gtk development and find myself in some need of advice. What
I´d like to accomplish is the following:
I have a custom C++ class - which is not a widget - with 3 properties
I´m interested in: name (Glib::ustring), date of creation (Glib::Date),
and count of contained items (int). For all of them there´s a getter
function implemented. That´s all pretty straightforward. What I want is
to be able to represent a list of such custom class instances to the
user in a Gtk::TreeView, where all 3 properties are in the same cell,
probably in two lines. There won´t be any children elements to a
top-level entry in the tree view. Here some ascii art for further
clarification.
__________________________________________________________________________________
|
| |
| column 0 | HERE THE VALUE OF CustomClassInst1.get_name() IN BIGGER
FONT |
| contains a
| |
| icon | Created on: MyCustomClassInst1.get_date() Items:
get_count()|
|_____________|__________________________________________________________________|
|
| |
| column 0 | HERE THE VALUE OF CustomClassInst2.get_name() IN BIGGER
FONT |
| contains a
| |
| icon | Created on: MyCustomClassInst2.get_date() Items:
get_count()|
|_____________|__________________________________________________________________|
and so on.
I´d like to declare the second column in my TreeModel as
Gtk::TreeModelColumn<MyCustomClass> m_column1. Further more at a later
point I would need to be able to change the sorting of the TreeView from
name to date or item count.
So the question to the experts is: what do I need to implement -
CellRenderer, TreeModel, or both? (None of the values in the view will
be editable by hand, ever.) And next, how do I go about it? I´ve looked
at the treemodelcustom example from the gtkmmm distribution but that´s
really far off from what I need.
If anyone knows of an application which does something similar, please
just point me to the source; I´ll figure it out from there.
Advice will be highly appreciated.
Kind regards,
T.Todorov
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]