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

Re: Emitting a keypress event



Kent Schumacher <kent@structural-wood.com> writes: 
> OK, this is good.  Any thoughts on how to have different types of activate?
> 
> My widgets minimally need to be able to bring up an assistant and force an update
> to dependent widgets.  Both of these actions need to be invokable via menu-item,
> toolbar-button, and keypress.
> 

You'll need to implement this yourself, GTK doesn't support it. There
are several ways you could do it. The focus widget is stored in
GtkWindow::focus_widget, I don't know that that field is public, but
it probably won't kill anyone if you use it.

Once you have the focus widget, you can either switch on its type
(easiest, I think) or you could add a "user signal"
(gtk_object_class_user_signal_new()) to each object, and emit that
signal by name in order to activate the widget. 

For example you could add a user signal to GtkButtonClass,
GtkMenuItemClass, etc. called "show_assistant" and then you would 
connect to show_assistant on each instance of these object types and 
show the assistant in your signal handler. 

User signals are sort of a cheapo subclassing-on-the-fly technique,
you could also do a full-blown subclass of these widgets that adds
your functionality.

Havoc



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