GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Wed Nov 25, 2015 4:15 am

All times are UTC

Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: gtk_menu_item_right_justify(GTK_MENU_ITEM(file));
PostPosted: Wed Oct 24, 2007 3:34 am 
Familiar Face

Joined: Fri Sep 28, 2007 10:59 am
Posts: 46
I want to transfer my program menus to the right hand . I used this function gtk_menu_item_right_justify(GTK_MENU_ITEM(file)); .but just one of them transferd to the right hand . what is the problem?
#include <gtk/gtk.h>

int main (int argc,

char *argv[])


GtkWidget *window, *menubar, *file, *edit, *help, *filemenu, *editmenu, *helpmenu;

GtkWidget *new1, *open, *cut, *copy, *paste, *contents, *about;

GtkAccelGroup *group;

gtk_init (&argc, &argv);

window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

gtk_window_set_title (GTK_WINDOW (window), "Menu Bars");

gtk_widget_set_size_request (window, 250, -1);

group = gtk_accel_group_new ();

menubar = gtk_menu_bar_new ();

file = gtk_menu_item_new_with_label ("File");

edit = gtk_menu_item_new_with_label ("Edit");

help = gtk_menu_item_new_with_label ("Help");

filemenu = gtk_menu_new ();

editmenu = gtk_menu_new ();

helpmenu = gtk_menu_new ();

gtk_menu_item_set_submenu (GTK_MENU_ITEM (file), filemenu);

gtk_menu_item_set_submenu (GTK_MENU_ITEM (edit), editmenu);

gtk_menu_item_set_submenu (GTK_MENU_ITEM (help), helpmenu);




gtk_menu_shell_append (GTK_MENU_SHELL (menubar), file);

gtk_menu_shell_append (GTK_MENU_SHELL (menubar), edit);

gtk_menu_shell_append (GTK_MENU_SHELL (menubar), help);

/* Create the File menu content. */

new1 = gtk_image_menu_item_new_from_stock (GTK_STOCK_NEW, group);

open = gtk_image_menu_item_new_from_stock (GTK_STOCK_OPEN, group);

gtk_menu_shell_append (GTK_MENU_SHELL (filemenu), new1);

gtk_menu_shell_append (GTK_MENU_SHELL (filemenu), open);

/* Create the Edit menu content. */

cut = gtk_image_menu_item_new_from_stock (GTK_STOCK_CUT, group);

copy = gtk_image_menu_item_new_from_stock (GTK_STOCK_COPY, group);

paste = gtk_image_menu_item_new_from_stock (GTK_STOCK_PASTE, group);

gtk_menu_shell_append (GTK_MENU_SHELL (editmenu), cut);

gtk_menu_shell_append (GTK_MENU_SHELL (editmenu), copy);

gtk_menu_shell_append (GTK_MENU_SHELL (editmenu), paste);

/* Create the Help menu content. */

contents = gtk_image_menu_item_new_from_stock (GTK_STOCK_HELP, group);

about = gtk_image_menu_item_new_from_stock (GTK_STOCK_ABOUT, group);

gtk_menu_shell_append (GTK_MENU_SHELL (helpmenu), contents);

gtk_menu_shell_append (GTK_MENU_SHELL (helpmenu), about);

gtk_container_add (GTK_CONTAINER (window), menubar);

gtk_window_add_accel_group (GTK_WINDOW (window), group);

gtk_widget_show_all (window);

gtk_main ();

return 0;


Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 4 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group