Re: Two warnings when creating a TreeStore
- From: José Alburquerque <jaalburquerque cox net>
- To: paul linuxaudiosystems com
- Cc: gtkmm-list gnome org
- Subject: Re: Two warnings when creating a TreeStore
- Date: Tue, 11 Sep 2007 17:42:38 -0400
Paul Davis wrote:
On Tue, 2007-09-11 at 17:03 -0400, Jos�lburquerque wrote:
Any ideas? Thanks so much.
What is an "Element" ? Gtkmm can't handle arbitary types as column
template args. It can handle pointers and all built-in scalar types, as
well as std::string and Glib::ustring, plus a few others.
--p
I see. An Element is a base class I use for the rest of the "objects"
in the project. The objects override the "getName()" method. I'm
trying to "reflect" a certain structure where nodes are arranged in a
parent/children hierarchy. For more detail, see the first thread I
posted on this:
http://mail.gnome.org/archives/gtkmm-list/2007-September/msg00055.html
What I did is to create a TreeView (in the MainWindow class constructor)
that has a TreeView::Column containing the "Elements" and
"set_cell_data_func()" for the column like so:
----------------------------MainWindow.h-.------------------------------------
class MainWindow : public Window {
public:
MainWindow();
void setProject(DVDProject& p);
private:
....
TreeView outlineTreeView;
void renderElement(CellRenderer* cell,
const TreeModel::iterator& iter);
...
};
-----------------------------------------.------------------------------------
---------------------------MainWindow.cxx-------------------------------------
MainWindow::MainWindow() {
...
TreeView::Column* outlineColumn = manage(new TreeView::Column("Outline",
DVDProject::columns.element));
CellRenderer* renderer = outlineColumn->get_first_cell_renderer();
outlineColumn->set_cell_data_func(*renderer,
sigc::mem_fun(*this, &MainWindow::renderElement));
outlineTreeView.append_column(*outlineColumn);
...
show_all_children();
}
void MainWindow::renderElement(CellRenderer* renderer,
const TreeModel::iterator& iter) {
CellRendererText* textRenderer =
dynamic_cast<CellRendererText*>(renderer);
const Element& e = (*iter)[DVDProject::columns.element];
textRenderer->property_text() = e.getName();
}
-----------------------------------------.------------------------------------
-Jose
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]