Re: [gtkmm] Customise cell renderer and beyonds

On Don, 2003-01-09 at 12:53, ZHOU DX wrote:
> Hi folks,
> I am trying to write a "spin button" cell renderer for
> the tree view. My renderer is derived 
> from the CellRendererText and has an overriden
> render_vfunc method. It looks fine.
> The spin button comes up when the cell is activated. I
> can inc/dec the value by clicking or
> pressing the spin arrows. 
> But, if I click mouse a little bit quick, the cell is
> deactivated (It is not what I want). 
> I think it because the double click event has been
> triggered while the spin button has not handled that.
> Is that true? How can I get rid of this problem?
> Also, I need a spinbutton without frame to fit the
> cell of a treeview widget. 
> In GTK+, we can do things like 
> g_new_object(GTK_TYPE_XXXXXX, "has_frame", false,0);
> How can I do it in a Gtkmm way? (Atm, I just wrap the
> gtk widget) 
> How can I get the type (Clib::Class) of a widget in
> Gtkmm ? 

I think there's a set_has_frame() method.  If not, the property should
at least be wrapped as property_has_frame().

g_object_new(GTK_TYPE_XXXXXX, "has_frame", false, 0) would instantiate a
new object and set the "has_frame" property -- but there's nothing wrong
about setting it afterwards.

(BTW the trailing 0 in the varargs list is not portable since the
compiler doesn't know it's meant to be a pointer, and will just pass it
as int.  This breaks on platforms where a 0 pointer isn't represent as 0
on the machine.  Much more relevant: it'll also break on 64bit platforms
since int is still 32 bit there but pointers are 64 bit.  To be safe do
g_object_new(GTK_TYPE_XXXXXX, "has_frame", 0, static_cast<char*>(0)) or
better yet, try to avoid varargs functions whereever possible.)


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