Re: [gtk-list] menu, menubar....



Ricardo Saul Rugerio Gutierrez wrote:
> 
>         Hi, list...
> 
>         which is the diference of menu and menubar

The GtkMenuBar is the bar across the top of a window which contains the
toplevel GtkMenuItem widgets, e.g. "File", "Edit", "View".

A GtkMenu is a window which pops up to show a list of GtkMenuItem widgets.
So, for example, when you select the "File" item in the menubar, a GtkMenu
pops up containing the GtkMenuItems "Open", "Save", "Save As..." etc.
Submenus are also GtkMenu widgets.

Note that neither GtkMenuBar or GtkMenu display any text. They are only
containers which handle popping up of submenus (in fact they are both derived
from GtkMenuShell which contains the code for a lot of this).


>         this is why on the menu example from gtk there are more than one
>         widgets called menu... (menu, root_menu, menu_bar, why this?)

I don't think the menu example is very good. It's creating a few things at
once and in a rather odd order. I had trouble understanding it as well.

It creates a menubar, "menu_bar", and adds one item to it, "root_menu".

It creates a popup menu, "menu" which contains three items labeled
"test-undermenu-X". gtk_menu_item_set_submenu() is used to make the menu
popup when the "root_menu" item on the menubar is selected.

The confusing thing is it also creates a button, and connects a handler to
popup a menu when the button is clicked. It uses the same menu as was added
to the menubar above. And the code to do this is mixed in with the menubar
code (which is in a funny order).


>         and how I can add menu items (other menus) to a menubar from glade
> 
>         this is:
> 
>         I have on a menubar:
> 
>         File    Help
> 
>         and under File I want
>                         - New
>                         - Open
>                         - etc.
> 
>         and so.
> 
>         my question is : how I can add them on glade? or no could be?

You can do this with the menu editor in Glade.

Click on the "File" item. Select "Add" to add a new item beneath it.
Then click on the right arrow button to indent it beneath "File".

Thus you should end up with something like:

  File
    New
    Open
    Save
  Help


(Glade-specific questions should probably be sent to the glade-devel
mailing list, by the way.)

Damon

PS. I don't think the menu editor in Glade is perfect, though. I'd prefer
an in-place editor like you get in Delphi. But the GTK+ menu widgets
aren't flexible enough to support this, so I'd have to create my own.
I've had a quick go at this, but its quite difficult.




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