Re: gtk2 textview widget popup
- From: Evan Martin <martine cs washington edu>
- To: Havoc Pennington <hp redhat com>
- Cc: Olivier Sessink <olivier lx student wau nl>, gtk-app-devel-list gnome org
- Subject: Re: gtk2 textview widget popup
- Date: Fri, 3 May 2002 17:10:45 -0700
On Fri, May 03, 2002 at 06:52:02PM -0400, Havoc Pennington wrote:
2- In the gtk1 version of the app I'm working on (the Bluefish html
editor) I already had a popup, so I guess the best thing to do is to
extend the already existing popup. But how can I do this? How to interact
with the build in text-view popup?
You can override what the "popup_menu" signal does, and also intercept
button_press_event with button == 3 in order to replace the stock
popup.
There should be a way to merge with the stock popup, but we didn't do
that for 2.0. I think we had some idea that the new menu stuff in 2.4
would provide a sane way to do it.
(As a hack you could probably connect_after to popup_menu and
button_press_event and append to text_view->popup_menu, or something
like that... I guess you can't connect_after to event signals, would
have to use the "event_after" signal or whatever it's called.)
What I use for GtkSpell (see a screenshot of the menu at
http://gtkspell.sf.net) is
g_signal_connect(G_OBJECT(view), "populate-popup",
G_CALLBACK(populate_popup), spell);
This function looks like:
static void
populate_popup(GtkTextView *textview, GtkMenu *menu, GtkSpell *spell) {
and I prepend to the menu.
(You'd think this signal was designed to support this functionality or
something! :P)
--
Evan Martin
martine cs washington edu
http://neugierig.org
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]