[Glade-users] Viewing custom widget sub-widgets in Glade tree-view
- From: tvb at gnome.org (Tristan Van Berkom)
- Subject: [Glade-users] Viewing custom widget sub-widgets in Glade tree-view
- Date: Tue, 5 Oct 2010 01:20:24 +0900
On Tue, Oct 5, 2010 at 12:18 AM, Klaim <mjklaim at gmail.com> wrote:
Hi,
as disscussed there :?http://www.gtkforums.com/viewtopic.php?p=18030#18030
I've managed to make my sub-widgets appear where I wanted, in the treeview.
However, the treeview content will not be updated when I'll add new
seb-widget to my custom widget, or remove some from it.
I've been analzing and trying to reproduce some techniques that are used in
gtk widgets plugin code that we can find here :
http://git.gnome.org/browse/glade3/tree/plugins/gtk+/glade-gtk.c
I've been trying for several days but couldn't update the tree view.
I've implemented a plugin for glade, it provide (wired in the xml file) :
?? ?post-create-function
?? ?set-property-function
?? ?get-internal-child-function
?? ?get-children-function
I see that the get-internal-child-function is not even called by glade (then
I don't undersand when it should be called) but at the moment I implemented
get-children-function I started to see the subwidgets in the glade
tree-view.
I've been following advices given there
:?http://www.mail-archive.com/gtk-app-devel-list at gnome.org/msg12349.html
I think I'm missing something simple as the gtk glade plugin code don't seem
too complicated but I can't find how it makes the sub-children updated in
the treeview.
When I load a gui built with glade and saved with modified number of
sub-widgets in my custom widget, I get the right count of sub-widgets in the
tree-view. Only modifying it will not update the tree-view.
My custom widget have two properties with widgets counts that will add or
remove widgets from the custom widget (in the widget code).
So in the plugin I've only added in post-create-function and
set-property-functino some way to call
glade_widget_adaptor_create_internal() on new digets added to the custom
widget.
It's the same function that is called in the two functions but it seem to
work only with post-create-function.
Any suggestion?
I'm not sure if that question is clear enough, but tell me if it's not.
I'm a little confused about what exactly is not working for you.
If you have a custom widget that is a GtkContainer, so long as
it works like an ordinary container you should not need to implement
anything custom along the lines of get-children or any of that.
(take the GtkBox implementation for reference in this case; it
uses a virtual 'size' property to decide how many placeholders
to expose in the Glade workspace).
Note that get-internal-child is for indirect children of composite
widgets. Thats what lets a GtkDialog configure properties and
add children to its internal 'vbox' or 'action-area' (I think thats
out of context for you, I think you just have a normal container).
What you need to do when implementing a normal container
is usually add placeholders to it if and when appropriate; then
you need to implement add-child-function/remove-child-function
and replace-child-function (replace-child will be called if your
plugin uses GladePlaceholder ... the Glade core will replace
the placeholder with a widget from the palette; giving it the
initial packing properties of the placeholder).
So, generally you should just start with add-child and remove-child
functions... you should not need to call glade_widget_adaptor_create_internal()
unless you are exposing an internal child of a complex composite
You dont need to implement get-children-function either unless you need
to add something to the generic child list already returned by your
container's implementation of GtkContainerClass->forall().
Does that help ?
Please let me know in more detail what is the nature of your container
so I can better help you, is it a basic container widget that only lays out
it's children in a custom way ?
Cheers,
-Tristan
Thanks for reading
Joel Lamotte.
_______________________________________________
Glade-users maillist ?- ?Glade-users at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/glade-users
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]