GNOME Bugzilla – Bug 108484
lowl-level GDK methods for Widget from scratch
Last modified: 2004-12-22 21:47:04 UTC
to build Widgets from scratch the two protected functions set_window (to set the Gdk::Window of a new created widget) and set allocation (to set size and position) are needed. Patch to correct this is attachted
Created attachment 15047 [details] [review] enable building gtkmm Widgets from scratch
"protected"? So these already exist somewhere? So why would we add? Could you give me an example of how these are used to implement GTK+ widgets, by giving me a line number in a GTK+ source file, or a URL? Do you some way to deref/deallocate the existing allocationa and GdkWindow?
Oh, I guess you mean that they should be added as protected.
yes, that's what i ment, they shall be protected, caus you only need them in subclasses of Gtk::Widget. the simples example is (i think) the gtkruler. here you set in gtk_ruler_realize (GtkWidget *widget) with widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask); the new created GdkWindow to GtkWidget->window. Caus per default Widget->window == NULL you don't have to unref an old window. in gtk_ruler_size_allocate (GtkWidget *widget, GtkAllocation *allocation) you set the widgets allocation to the parameter *allocation widget->allocation = *allocation; i _think_ we don't have to deref here something, caus the poniter points to a GtkAllocation, that is created and destroyed with the instances of the subclasses of the widget. In the Gtk+ sources this Allocation is never freed.
GdkWindow: OK. _MEMBER_SET_GOBJECT() seems to take care of ref-ing and unrefing for us, so I didn't need to worry. Allocation: Yes, this seems to be a simple copy-by-value struct. This should be applied to gtkmm 2.4, with a ChangeLog entry.
Applied. Detlef, if you could patch the ChangeLog too next time, it would make the process a little less tedious for random persons like me who are applying patches on behalf of Murray. :-)
Thanks Ole.