Re: Gtk2::Assistant: Access to Buttons



gtk-devel-list readers: are the button pointers in struct _GtkAssistant something that should be accessible to a language binding? Would a gtk_assistant_set_default_response() be useful?


On Jul 5, 2007, at 9:48 AM, Peter Daum wrote:

muppet wrote:
The first thing to come to mind is to be sure to set activates-
default on the Entries you add to your Assistant (it appears from
your code snippet that you did that already), and then set the
Forward button to be the default.

... Gtk2::Dialog has a similar structure and offers "set_default_response" for such cases; it would be a pretty normal assuption, that there must be somthing similar in Gtk2::Assistant, too (I originally had thought, that
there might be just something missing in the documentation).

GtkAssistant inherits directly from GtkWindow, not from GtkDialog, so the response stuff is not available.


But, there's no way to get to the Forward button without either walking the
widget tree [...]

How could I do that? I played around with $assistant->get_children (), but this returns only the children, that I myself put into the window, not the container
that holds the buttons.

Walking the widget tree is a last-resort option, because it means your code will be fragile. And even then, if the widget of interest is not reachable by normal methods, you're screwed. It looks like GtkAssistant places the buttons into an "action_area" box, but manages the position and size of that box by hand in size_allocate() rather than using built-in mechanisms. The action_area is reachable via gtk_container_forall(), which, interestingly, is not bound in gtk2-perl (likely because of the bit in the documentation that says "most applications should not use this").

So, it looks like the best approach is to bind these structure members in gtk2-perl, provided they are something that is not considered private. I think they are legal, but i'd like an okay from the gtk+ guys to be sure...


--
If the monkey could type one keystroke every nanosecond, the expected waiting time until the monkey types out Hamlet is so long that the estimated age of the universe is insignificant by comparison ... this is not a practical method for writing plays.
  -- Gian-Carlo Rota





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