Re: Menuitem



On Tue, 2003-08-05 at 16:42, Hyrum Wright wrote:
On Tue, 2003-08-05 at 08:21, Leandro A. F. Pereira wrote:
Quoted by a cadre of crazed rats
For `mquezada nlxcorp com' 
On Tuesday, 05 August 2003 (10:33):


in gtk+ 1.2.xx and without using the itemfactory, how does one go about
inerting a separator line/item into a menu?


    Just create an empty GtkMenuItem:

Actually, that will only create a empty line in the menu, to create an
actual separator:

GtkWidget *menu;
GtkWidget *menu_item;

menu = gtk_menu_new();

(...)

menu_item = gtk_separator_menu_item_new();
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
gtk_widget_show (help_menu_item);

(...)

Best of luck.

Take a look at the GtkSeparatorMenuItem implementation some day;
there's only one line it other than the GObject boilerplate
for derivation. (Only widget that fits on the back of a T-Shirt
in a readable font.)

The reason that GtkSeparatorMenuItem was added in 2.x was that 
nobody ever figured out that creating an empty menu item was
the right way to do a separator.

But, yes, if you are using 2.x (the original person asking the
question), you should use a GtkSeparatorMenuItem rather than
an empty menu item for style reasons.

Regards,
                                        Owen





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