Re: [gtkmm] Drop down menu from a tollbar item?
- From: <kickvb touva be>
- To: "S. Myles Prather" <charliedontsurf austin rr com>, <gtkmm-list gnome org>
- Subject: Re: [gtkmm] Drop down menu from a tollbar item?
- Date: Wed, 24 Sep 2003 10:04:36 -0000
> As nasty as it is, I suppose I could pull all that off *IF* I only new
> where to place the popup menu. I'm not sure how to get the lower left
> coordinates of the toggle button. I don't want the menu popping up at
> the mouse pointer. I tried reading the gedit source, but couldn't find
> the code that builds the toolbar.<br>
I dont't know any way to inherit drop-down behavior from Gtk::Menu, although
I'm interested in it.
But I know how to position a window up to a button. This piece of code move a
Gtk::Window (ffchoice) up to a button (font_b). If there is not enough place
up to the button, it is placed down to it.
Glib::RefPtr<Gdk::Window> choicewin = ffchoice->get_window();
int cw, ch;
choicewin->get_size(cw, ch);
Glib::RefPtr<Gdk::Window> mywin = font_b->get_window();
int wx, wy;
mywin->get_origin(wx, wy);
GtkAllocation alloc = font_b->get_allocation();
int myx, myy, myw, myh;
myx = alloc.x + wx;
myy = alloc.y + wy;
myw = alloc.width;
myh = alloc.height;
int x = myx + myw - cw;
int y = myy - ch;
if (y < 0) y = myy + myh;
choicewin->move(x, y);
ffchoice->show_now();
Hope this helps
Christian Van Brusssel
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]