Re: [gtkmm] Custom types in a Gtk::TreeView
- From: Murray Cumming <murrayc murrayc com>
- To: Roger Leigh <roger whinlatter uklinux net>
- Cc: gtkmm-list <gtkmm-list gnome org>
- Subject: Re: [gtkmm] Custom types in a Gtk::TreeView
- Date: Tue, 13 Apr 2004 14:24:46 +0200
On Tue, 2004-04-13 at 14:12, Roger Leigh wrote:
> >From what I've read in the sources, this should do the trick (from
> treeviewcolumn.h):
>
> namespace Gtk
> {
> namespace TreeViewColumn_CellRendererGeneration
> {
> template<>
> CellRenderer* generate_cell_renderer<numeric>(bool editable)
> {
> CellRendererNumeric* pCellRenderer = new CellRendererNumeric();
> pCellRenderer->property_editable() = editable;
> return pCellRenderer;
> }
> }
> }
>
> Is adding support for my own types into your namespace OK?
It's a template specialization, so I guess you have no choice. Just
don't export the symbol in any library that you distribute widely.
> My question here: I need a property_numeric() property, so I can set
> the number being rendered. If I derive from CellRendererText, I can
> then set property_text() as a side effect. However, I assume that due
> to being a wrapper, I need to actually set a property ("numeric") in
> the underlying GObject, with g_object_install_property(), and wrap
> that with a PropertyProxy. Since I have a C++ type (numeric), I'm not
> sure how to do that (GValue?), since I need to somehow create a
> GParamSpec to install as a property (I didn't see this wrapped).
>
> Is this correct? Or is there an easier way?
If you just add a PropertyProxy(), it should do that for you. It's
magic. See for instance, MyCellRendererToggle in the examples.
--
Murray Cumming
www.murrayc.com
murrayc murrayc com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]