dynamically creating and destroying menus



Hi all,

I am currently using the following code to dynamically create a menu :

void
CREATE_HOST_ALPHA_MENUS( int start_char_num )
{
   GtkAccelGroup *host_file_name_a_accels;
   gchar name[15];
   int c;

      c = start_char_num - 32;

      sprintf(name, "          %c", c);

      CC_GLBL->host_file_name_a = gtk_menu_item_new_with_label
(_(name));
      gtk_widget_ref (CC_GLBL->host_file_name_a);
      gtk_object_set_data_full (GTK_OBJECT (CC_GLBL->control_window),
                         "CC_GLBL->host_file_name_a",
CC_GLBL->host_file_name_a,
                         (GtkDestroyNotify) gtk_widget_unref);
      gtk_widget_show (CC_GLBL->host_file_name_a);
      gtk_container_add (GTK_CONTAINER (CC_GLBL->host_files_menu),
CC_GLBL->host_file_name_a);

      CC_GLBL->host_file_name_a_menu = gtk_menu_new ();
      gtk_widget_ref (CC_GLBL->host_file_name_a);
      gtk_object_set_data_full (GTK_OBJECT (CC_GLBL->control_window),
                         "CC_GLBL->host_file_name_a",
CC_GLBL->host_file_name_a,
                         (GtkDestroyNotify) gtk_widget_unref);
      gtk_menu_item_set_submenu (GTK_MENU_ITEM
(CC_GLBL->host_file_name_a),

CC_GLBL->host_file_name_a_menu);
      host_file_name_a_accels = gtk_menu_ensure_uline_accel_group
(GTK_MENU

(CC_GLBL->host_file_name_a_menu));
}

Is there a way to "destroy" the menu, or empty its contents so that it can be updated? And is there a way to 
change the colour of the menu items to highlight certain entries?

Thanks.

--
Marco Quezada
Aerospaceo Engineero
NLX Corporation
22626 Sally Ride Dr.
Sterling, VA, 20164
703-234-2100 x1028







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