• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GTK_MENU_SHELL函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GTK_MENU_SHELL函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_MENU_SHELL函数的具体用法?C++ GTK_MENU_SHELL怎么用?C++ GTK_MENU_SHELL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GTK_MENU_SHELL函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: gui_restore_after_callback

static void
gui_restore_after_callback (Gimp               *gimp,
                            GimpInitStatusFunc  status_callback)
{
  GimpGuiConfig *gui_config = GIMP_GUI_CONFIG (gimp->config);
  GimpDisplay   *display;

  if (gimp->be_verbose)
    g_print ("INIT: %s\n", G_STRFUNC);

  gimp->message_handler = GIMP_MESSAGE_BOX;

  if (gui_config->restore_accels)
    menus_restore (gimp);

  ui_configurer = g_object_new (GIMP_TYPE_UI_CONFIGURER,
                                "gimp", gimp,
                                NULL);

  image_ui_manager = gimp_menu_factory_manager_new (global_menu_factory,
                                                    "<Image>",
                                                    gimp,
                                                    gui_config->tearoff_menus);
  gimp_ui_manager_update (image_ui_manager, gimp);

#ifdef GDK_WINDOWING_QUARTZ
  {
    GtkosxApplication *osx_app;
    GtkWidget         *menu;
    GtkWidget         *item;

    osx_app = gtkosx_application_get ();

    menu = gtk_ui_manager_get_widget (GTK_UI_MANAGER (image_ui_manager),
                                      "/image-menubar");
    if (GTK_IS_MENU_ITEM (menu))
      menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (menu));

    gtkosx_application_set_menu_bar (osx_app, GTK_MENU_SHELL (menu));
    gtkosx_application_set_use_quartz_accelerators (osx_app, FALSE);

    gui_add_to_app_menu (image_ui_manager, osx_app,
                         "/image-menubar/Help/dialogs-about", 0);

#define PREFERENCES "/image-menubar/Edit/Preferences/"

    gui_add_to_app_menu (image_ui_manager, osx_app,
                         PREFERENCES "dialogs-preferences", 2);
    gui_add_to_app_menu (image_ui_manager, osx_app,
                         PREFERENCES "dialogs-input-devices", 3);
    gui_add_to_app_menu (image_ui_manager, osx_app,
                         PREFERENCES "dialogs-keyboard-shortcuts", 4);
    gui_add_to_app_menu (image_ui_manager, osx_app,
                         PREFERENCES "dialogs-module-dialog", 5);
    gui_add_to_app_menu (image_ui_manager, osx_app,
                         PREFERENCES "plug-in-unit-editor", 6);

#undef PREFERENCES

    item = gtk_separator_menu_item_new ();
    gtkosx_application_insert_app_menu_item (osx_app, item, 7);

    item = gtk_ui_manager_get_widget (GTK_UI_MANAGER (image_ui_manager),
                                      "/image-menubar/File/file-quit");
    gtk_widget_hide (item);

    g_signal_connect (osx_app, "NSApplicationBlockTermination",
                      G_CALLBACK (gui_quartz_quit_callback),
                      image_ui_manager);

    gtkosx_application_ready (osx_app);
  }
#endif /* GDK_WINDOWING_QUARTZ */

  g_signal_connect_object (gui_config, "notify::single-window-mode",
                           G_CALLBACK (gui_single_window_mode_notify),
                           ui_configurer, 0);
  g_signal_connect_object (gui_config, "notify::tearoff-menus",
                           G_CALLBACK (gui_tearoff_menus_notify),
                           image_ui_manager, 0);
  g_signal_connect (image_ui_manager, "show-tooltip",
                    G_CALLBACK (gui_menu_show_tooltip),
                    gimp);
  g_signal_connect (image_ui_manager, "hide-tooltip",
                    G_CALLBACK (gui_menu_hide_tooltip),
                    gimp);

  gimp_devices_restore (gimp);
  gimp_controllers_restore (gimp, image_ui_manager);

  if (status_callback == splash_update)
    splash_destroy ();

  color_history_restore (gimp);

  if (gimp_get_show_gui (gimp))
    {
      GimpDisplayShell *shell;

      /*  create the empty display  */
//.........这里部分代码省略.........
开发者ID:Three-DS,项目名称:gimp-2.8.10,代码行数:101,代码来源:gui.c


示例2: main


//.........这里部分代码省略.........
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (option_menu), "small toolbar");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (option_menu), "large toolbar");

  gtk_box_pack_start (GTK_BOX (hbox2), option_menu, FALSE, FALSE, 0);
  g_signal_connect (option_menu, "changed",
		    G_CALLBACK (icon_size_history_changed), toolbar);
  
  scrolled_window = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
				  GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
  gtk_widget_set_hexpand (scrolled_window, TRUE);
  gtk_widget_set_vexpand (scrolled_window, TRUE);
  gtk_grid_attach (GTK_GRID (grid), scrolled_window, 1, 3, 1, 1);

  store = create_items_list (&treeview);
  gtk_container_add (GTK_CONTAINER (scrolled_window), treeview);
  
  item = gtk_tool_button_new (NULL, NULL);
  gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "document-new");
  gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), "Custom label");
  add_item_to_list (store, item, "New");
  gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
  gdk_threads_add_timeout (3000, (GSourceFunc) timeout_cb, item);
  gtk_tool_item_set_expand (item, TRUE);

  menu = gtk_menu_new ();
  for (i = 0; i < 20; i++)
    {
      char *text;
      text = g_strdup_printf ("Menuitem %d", i);
      menuitem = gtk_menu_item_new_with_label (text);
      g_free (text);
      gtk_widget_show (menuitem);
      gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
    }

  item = gtk_menu_tool_button_new (NULL, NULL);
  gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "document-open");
  gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), "Open");
  gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (item), menu);
  add_item_to_list (store, item, "Open");
  gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
  gdk_threads_add_timeout (3000, (GSourceFunc) timeout_cb1, item);
 
  menu = gtk_menu_new ();
  for (i = 0; i < 20; i++)
    {
      char *text;
      text = g_strdup_printf ("A%d", i);
      menuitem = gtk_menu_item_new_with_label (text);
      g_free (text);
      gtk_widget_show (menuitem);
      gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
    }

  item = gtk_menu_tool_button_new (NULL, NULL);
  gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "go-previous");
  gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), "Back");
  gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (item), menu);
  add_item_to_list (store, item, "BackWithHistory");
  gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
 
  item = gtk_separator_tool_item_new ();
  add_item_to_list (store, item, "-----");    
  gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
  
开发者ID:3dfxmadscientist,项目名称:gtk,代码行数:66,代码来源:testtoolbar.c


示例3: store_populate_menu_items

static void
store_populate_menu_items (GtkListStore  *store,
                           GtkMenuShell  *menu,
                           const gchar   *parent_path)
{
  GList  *children;
  GList  *node;
  
  children = gtk_container_get_children (GTK_CONTAINER (menu));
  for (node = children; node; node = node->next) {
    if (GTK_IS_SEPARATOR_MENU_ITEM (node->data) ||
        ! gtk_widget_get_visible (node->data)) {
      /* skip that */
    } else if (GTK_IS_MENU_ITEM (node->data)) {
      GtkWidget    *submenu;
      gchar        *path;
      gchar        *item_label;
      gboolean      use_underline;
      GtkStockItem  item;
      
      if (GTK_IS_IMAGE_MENU_ITEM (node->data) &&
          gtk_image_menu_item_get_use_stock (node->data) &&
          gtk_stock_lookup (gtk_menu_item_get_label (node->data), &item)) {
        item_label = g_strdup (item.label);
        use_underline = TRUE;
      } else {
        item_label = g_strdup (gtk_menu_item_get_label (node->data));
        use_underline = gtk_menu_item_get_use_underline (node->data);
      }
      
      /* remove underlines */
      if (use_underline) {
        gchar  *p   = item_label;
        gsize   len = strlen (p);
        
        while ((p = strchr (p, '_')) != NULL) {
          len -= (gsize) (p - item_label);
          
          memmove (p, p + 1, len);
        }
      }
      
      if (parent_path) {
        path = g_strconcat (parent_path, PATH_SEPARATOR, item_label, NULL);
      } else {
        path = g_strdup (item_label);
      }
      
      submenu = gtk_menu_item_get_submenu (node->data);
      if (submenu) {
        /* go deeper in the menus... */
        store_populate_menu_items (store, GTK_MENU_SHELL (submenu), path);
      } else {
        gchar *tmp;
        gchar *tooltip;
        gchar *label = g_markup_printf_escaped ("<big>%s</big>", item_label);
        
        tooltip = gtk_widget_get_tooltip_markup (node->data);
        if (tooltip) {
          SETPTR (label, g_strconcat (label, "\n<small>", tooltip, "</small>", NULL));
          g_free (tooltip);
        }
        
        tmp = g_markup_escape_text (path, -1);
        SETPTR (label, g_strconcat (label, "\n<small><i>", tmp, "</i></small>", NULL));
        g_free (tmp);
        
        gtk_list_store_insert_with_values (store, NULL, -1,
                                           COL_LABEL, label,
                                           COL_PATH, path,
                                           COL_TYPE, COL_TYPE_MENU_ITEM,
                                           COL_WIDGET, node->data,
                                           -1);
        
        g_free (label);
      }
      
      g_free (item_label);
      g_free (path);
    } else {
      g_warning ("Unknown widget type in the menu: %s",
                 G_OBJECT_TYPE_NAME (node->data));
    }
  }
  g_list_free (children);
}
开发者ID:MirandaLv,项目名称:geany-plugins,代码行数:86,代码来源:commander-plugin.c


示例4: GetCursorPos

bool C4EditCursor::DoContextMenu(DWORD dwKeyState)
{
	bool fObjectSelected = !!Selection.ObjectCount();
#ifdef USE_WIN32_WINDOWS
	POINT point; GetCursorPos(&point);
	HMENU hContext = GetSubMenu(hMenu,0);
	SetMenuItemEnable( hContext, IDM_VIEWPORT_DELETE, fObjectSelected && Console.Editing);
	SetMenuItemEnable( hContext, IDM_VIEWPORT_DUPLICATE, fObjectSelected && Console.Editing);
	SetMenuItemEnable( hContext, IDM_VIEWPORT_CONTENTS, fObjectSelected && Selection.GetObject()->Contents.ObjectCount() && Console.Editing);
	SetMenuItemText(hContext,IDM_VIEWPORT_DELETE,LoadResStr("IDS_MNU_DELETE"));
	SetMenuItemText(hContext,IDM_VIEWPORT_DUPLICATE,LoadResStr("IDS_MNU_DUPLICATE"));
	SetMenuItemText(hContext,IDM_VIEWPORT_CONTENTS,LoadResStr("IDS_MNU_CONTENTS"));

	ObjselectDelItems();
	C4FindObjectAtPoint pFO(X,Y);
	C4ValueArray * atcursor; atcursor = pFO.FindMany(::Objects, ::Objects.Sectors); // needs freeing (single object ptr)
	int itemcount = atcursor->GetSize();
	if(itemcount > 0)
	{
		const int maxitems = 25; // Maximum displayed objects. if you raise it, also change note with IDM_VPORTDYN_FIRST in resource.h
		if(itemcount > maxitems) itemcount = maxitems+1;
		itemsObjselect.resize(itemcount+1); // +1 for a separator
		itemsObjselect[0].ItemId = IDM_VPORTDYN_FIRST;
		itemsObjselect[0].Object = NULL;
		AppendMenu(hContext, MF_SEPARATOR, IDM_VPORTDYN_FIRST, NULL);
		int i = 1;
		for(std::vector<ObjselItemDt>::iterator it = itemsObjselect.begin() + 1; it != itemsObjselect.end(); ++it, ++i)
		{
			C4Object * obj = (*atcursor)[i-1].getObj();
			assert(obj);
			it->ItemId = IDM_VPORTDYN_FIRST+i;
			it->Object = obj;
			AppendMenu(hContext, MF_STRING, it->ItemId, FormatString("%s #%i (%i/%i)", obj->GetName(), obj->Number, obj->GetX(), obj->GetY()).GetWideChar());
		}
		if(atcursor->GetSize() > maxitems)
		{
			AppendMenu(hContext, MF_GRAYED, IDM_VPORTDYN_FIRST+maxitems+1, L"...");
			itemsObjselect[maxitems+1].ItemId = IDM_VPORTDYN_FIRST+maxitems+1;
			itemsObjselect[maxitems+1].Object = NULL;
		}
	}
	delete atcursor;

	int32_t iItem = TrackPopupMenu(
	                  hContext,
	                  TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RETURNCMD | TPM_LEFTBUTTON | TPM_NONOTIFY,
	                  point.x,point.y, 0,
	                  Console.hWindow,
	                  NULL);
	switch (iItem)
	{
	case IDM_VIEWPORT_DELETE: Delete(); break;
	case IDM_VIEWPORT_DUPLICATE: Duplicate(); break;
	case IDM_VIEWPORT_CONTENTS: GrabContents(); break;
	case 0: break;
	default:
		for(std::vector<ObjselItemDt>::iterator it = itemsObjselect.begin() + 1; it != itemsObjselect.end(); ++it)
			if(it->ItemId == iItem)
			{
				DoContextObjsel(it->Object, (dwKeyState & MK_SHIFT) == 0);
				break;
			}
		break;
	}
	ObjselectDelItems();
#else
#ifdef WITH_DEVELOPER_MODE
	gtk_widget_set_sensitive(itemDelete, fObjectSelected && Console.Editing);
	gtk_widget_set_sensitive(itemDuplicate, fObjectSelected && Console.Editing);
	gtk_widget_set_sensitive(itemGrabContents, fObjectSelected && Selection.GetObject()->Contents.ObjectCount() && Console.Editing);

	ObjselectDelItems();
	C4FindObjectAtPoint pFO(X,Y);
	C4ValueArray * atcursor; atcursor = pFO.FindMany(::Objects, ::Objects.Sectors); // needs freeing
	int itemcount = atcursor->GetSize();
	if(itemcount > 0)
	{
		itemsObjselect.resize(itemcount+1); // +1 for a separator
		itemsObjselect[0].MenuItem = gtk_separator_menu_item_new();
		itemsObjselect[0].EditCursor = this;
		gtk_menu_shell_append(GTK_MENU_SHELL(menuContext), itemsObjselect[0].MenuItem);
		int i = 0;
		for(std::vector<ObjselItemDt>::iterator it = itemsObjselect.begin() + 1; it != itemsObjselect.end(); ++it, ++i)
		{
			it->EditCursor = this;
			C4Object * obj = (*atcursor)[i].getObj();
			assert(obj);
			it->Object = obj;
			GtkWidget * wdg = gtk_menu_item_new_with_label(FormatString("%s #%i (%i/%i)", obj->GetName(), obj->Number, obj->GetX(), obj->GetY()).getData());
			it->MenuItem = wdg;
			gtk_menu_shell_append(GTK_MENU_SHELL(menuContext), wdg);
			g_signal_connect(G_OBJECT(wdg), "activate", G_CALLBACK(OnObjselect), &*it);
		}
	}
	delete atcursor;
	gtk_widget_show_all(menuContext);

	gtk_menu_popup(GTK_MENU(menuContext), NULL, NULL, NULL, NULL, 3, 0);
#endif
#endif
//.........这里部分代码省略.........
开发者ID:notprathap,项目名称:openclonk-5.4.1-src,代码行数:101,代码来源:C4EditCursor.cpp


示例5: create_menuitem

static void
create_menuitem (GtkWidget          *menu,
		 GMenuTreeEntry     *entry,
		 GMenuTreeDirectory *alias_directory)
{
	GtkWidget  *menuitem;
	
	menuitem = panel_image_menu_item_new2 ();

	if (alias_directory)
		panel_load_menu_image_deferred (menuitem,
						panel_menu_icon_get_size (),
						gmenu_tree_directory_get_icon (alias_directory),
						NULL,
						NULL);
	else
		panel_load_menu_image_deferred (menuitem,
						panel_menu_icon_get_size (),
						g_app_info_get_icon (G_APP_INFO (gmenu_tree_entry_get_app_info (entry))),
						NULL, NULL);

	setup_menuitem (menuitem,
			panel_menu_icon_get_size (),
			NULL,
			alias_directory ? gmenu_tree_directory_get_name (alias_directory) :
			                  g_app_info_get_display_name (G_APP_INFO (gmenu_tree_entry_get_app_info (entry))));

	if (alias_directory &&
	    gmenu_tree_directory_get_comment (alias_directory))
		panel_util_set_tooltip_text (menuitem,
					     gmenu_tree_directory_get_comment (alias_directory));
	else if	(!alias_directory) {
		const char *description = g_app_info_get_description (G_APP_INFO (gmenu_tree_entry_get_app_info (entry)));
		if (!description)
			description = g_desktop_app_info_get_generic_name (gmenu_tree_entry_get_app_info (entry));
		if (description)
			panel_util_set_tooltip_text (menuitem,
						     description);
	}

	g_signal_connect_after (menuitem, "button_press_event",
				G_CALLBACK (menu_dummy_button_press_event), NULL);

	if (!panel_lockdown_get_panels_locked_down_s ()) {
		GIcon *icon;

		static GtkTargetEntry menu_item_targets[] = {
			{ "text/uri-list", 0, 0 }
		};

		gtk_drag_source_set (menuitem,
				     GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
				     menu_item_targets, 1,
				     GDK_ACTION_COPY);

		icon = g_app_info_get_icon (G_APP_INFO (gmenu_tree_entry_get_app_info (entry)));
		if (icon != NULL)
			gtk_drag_source_set_icon_gicon (menuitem, icon);

		g_signal_connect (G_OBJECT (menuitem), "drag_begin",
				  G_CALLBACK (drag_begin_menu_cb), NULL);
		g_signal_connect (menuitem, "drag_data_get",
				  G_CALLBACK (drag_data_get_menu_cb), entry);
		g_signal_connect (menuitem, "drag_end",
				  G_CALLBACK (drag_end_menu_cb), NULL);
	}

	gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);

	g_signal_connect (menuitem, "activate",
			  G_CALLBACK (activate_app_def), entry);

	gtk_widget_show (menuitem);
}
开发者ID:sunnynarayan,项目名称:gnome-panel,代码行数:74,代码来源:menu.c


示例6: usejournal_build_menu

GtkWidget*
usejournal_build_menu(const char *defaultjournal, const char *currentjournal,
		GSList *journals, gpointer doc) {
	GtkWidget *menu, *curmenu, *item, *label;
	GSList *group = NULL;
	GSList *l;
	char *journal;
	char *curmenuprefix = NULL;
	char prefix[30];

	curmenu = menu = gtk_menu_new(); 

	item = gtk_radio_menu_item_new_with_label(group, defaultjournal);
	group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(item));
	g_signal_connect(G_OBJECT(item), "activate",
			G_CALLBACK(activate_cb), doc);

	if (currentjournal == NULL) 
		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE);

	gtk_widget_show(item);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);

	for (l = journals; l != NULL; l = l->next) {
		journal = (char*)l->data;

		if (curmenuprefix) {
			/* try to match this item to the prefix. */
			if (sharedprefix(curmenuprefix, journal)) {
				/* match. */
			} else {
				curmenu = menu;
				curmenuprefix = NULL;
			}
		} 
		if (!curmenuprefix && l->next) {
			/* try to see if this begins a new prefix. */
			char *nextjournal = (char*)l->next->data;
			int ofs;
			ofs = sharedprefix(journal, nextjournal);
			if (ofs) {
				/* make a new submenu for these shared-prefix journals. */
				memcpy(prefix, journal, ofs);
				prefix[ofs] = 0;

				item = gtk_menu_item_new();
				label = gtk_label_new(NULL);
				gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
				gtk_label_set_markup(GTK_LABEL(label), prefix);
				gtk_container_add(GTK_CONTAINER(item), label);
				gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
				curmenu = gtk_menu_new();
				curmenuprefix = prefix;
				gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), curmenu);
				gtk_widget_show_all(item);
			}
		}
		item = gtk_radio_menu_item_new_with_label(group, journal);
		if (currentjournal && strcmp(currentjournal, journal) == 0)
			gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE);
		g_signal_connect(G_OBJECT(item), "activate",
				G_CALLBACK(activate_cb), doc);
		gtk_widget_show(item);
		gtk_menu_shell_append(GTK_MENU_SHELL(curmenu), item);

		group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(item));
	}

	return menu;
}
开发者ID:evmar,项目名称:LogJam,代码行数:70,代码来源:usejournal.c


示例7: wireless_applet_properties_dialog

static void
wireless_applet_properties_dialog (BonoboUIComponent *uic,
				  WirelessApplet *applet)
{
	static GtkWidget *global_property_box = NULL,
		*glade_property_box = NULL;
	GtkWidget *pct, *dialog, *device;

	g_return_if_fail (PANEL_IS_APPLET (PANEL_APPLET (applet)));

	if (applet->prefs != NULL)
	{
		gtk_widget_show (applet->prefs);
		gtk_window_present (GTK_WINDOW (applet->prefs));
		return;
	}

	if (global_property_box == NULL) {
		xml = glade_xml_new (glade_file, NULL, NULL);
		glade_property_box = glade_xml_get_widget (xml,"dialog1");
	}

	applet->prefs = glade_property_box;
	gtk_window_set_resizable (GTK_WINDOW (applet->prefs), FALSE);

	pct = glade_xml_get_widget (xml, "pct_check_button");
	dialog = glade_xml_get_widget (xml, "dialog_check_button");
	device = glade_xml_get_widget (xml, "device_menu");

	/* Set the show-percent thingy */
	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pct),
			applet->show_percent);
	g_signal_connect (GTK_OBJECT (pct),
			"toggled",
			GTK_SIGNAL_FUNC (wireless_applet_option_change),
			applet);
	gtk_object_set_data (GTK_OBJECT (applet->prefs),
			"show-percent-button", pct);

        /* Set the device menu */
	gtk_option_menu_remove_menu (GTK_OPTION_MENU (device));
	{
		GtkWidget *menu;
		GtkWidget *item;
		GList *d;
		int idx = 0, choice = 0;

		menu = gtk_menu_new ();

		for (d = applet->devices; d != NULL; d = g_list_next (d)) {
			item = gtk_menu_item_new_with_label ((char*)d->data);
			gtk_menu_shell_append  (GTK_MENU_SHELL (menu),item);
			gtk_object_set_data_full (GTK_OBJECT (item), 
					"device-selected",
					g_strdup (d->data),
					g_free);
			g_signal_connect (GTK_OBJECT (item),
					"activate",
					GTK_SIGNAL_FUNC (wireless_applet_option_change),
					applet);

			if ((applet->device != NULL)
					&& (d->data != NULL)
					&& strcmp (applet->device, d->data)==0)
			{
				choice = idx;
			}
			idx++;
		}
		if (applet->devices == NULL) {
			char *markup;
			GtkWidget *label;
			
			label = gtk_label_new (NULL);
			markup = g_strdup_printf ("<i>%s</i>",
					_("No Wireless Devices"));
			gtk_label_set_markup (GTK_LABEL (label), markup);
			g_free (markup);

			item = gtk_menu_item_new ();
			gtk_container_add (GTK_CONTAINER (item), label);
			gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
		}
		gtk_option_menu_set_menu (GTK_OPTION_MENU (device), menu);
		gtk_option_menu_set_history (GTK_OPTION_MENU (device), choice);
	}
	gtk_object_set_data (GTK_OBJECT (applet->prefs), "device-menu", device);

	g_signal_connect (GTK_OBJECT (applet->prefs),
			"response", 
			G_CALLBACK (prefs_response_cb),
			NULL);
	g_signal_connect (GTK_OBJECT (applet->prefs),
			"destroy",
			GTK_SIGNAL_FUNC (gtk_widget_destroy),
			NULL);

	g_object_add_weak_pointer (G_OBJECT (applet->prefs),
			(void**)&(applet->prefs));
	gtk_window_set_screen (GTK_WINDOW (applet->prefs),
//.........这里部分代码省略.........
开发者ID:snorp,项目名称:snorp.github.com,代码行数:101,代码来源:wireless-applet.c


示例8: void

GtkWidget* XNavGtk::build_menu(GtkWidget* Parent, int MenuType,
    const char* MenuTitle, void* MenuUserData,
    void (*Callback)(GtkWidget*, gpointer), void* CallbackData,
    xmenu_sMenuItem* Items, int* idx)
{
  GtkWidget *Menu, *W;
  int i;
  unsigned int Level;

  Menu = (GtkWidget*)g_object_new(GTK_TYPE_MENU, NULL);
  g_object_set_data((GObject*)Menu, "userdata", (gpointer)MenuUserData);

  Level = Items[*idx].Level;

  for (; Items[*idx].Level != 0 && Items[*idx].Level >= Level; (*idx)++) {
    switch (Items[*idx].Item) {
    case xmenu_eMenuItem_Ref: {
      if (MenuType == MENU_OPTION) {
        printf("You can't have submenus from option menu items.");
        return NULL;
      }

      i = *idx;
      GtkWidget* sub = gtk_menu_item_new_with_label(
          CoWowGtk::translate_utf8(Items[*idx].Name));
      (*idx)++;
      W = build_menu(Menu, MENU_PULLDOWN, Lng::translate(Items[i].Name),
          MenuUserData, Callback, CallbackData, Items, idx);
      (*idx)--;
      gtk_menu_item_set_submenu(GTK_MENU_ITEM(sub), GTK_WIDGET(W));
      gtk_menu_shell_append(GTK_MENU_SHELL(Menu), sub);
      gtk_widget_show(sub);
      break;
    }
    case xmenu_eMenuItem_Cascade: {
      if (MenuType == MENU_OPTION) {
        printf("You can't have submenus from option menu items.");
        return NULL;
      }

      // Check that the Cascade contains any pushbuttons
      int found = 0;
      unsigned int cascade_level = Items[*idx].Level;
      int cidx;
      for (cidx = *idx + 1;
           Items[cidx].Level != 0 && Items[cidx].Level > cascade_level;
           cidx++) {
        if (Items[cidx].Item == xmenu_eMenuItem_Ref
            || Items[cidx].Item == xmenu_eMenuItem_Button) {
          found = 1;
          break;
        }
      }
      if (found) {
        i = *idx;
        GtkWidget* sub = gtk_menu_item_new_with_label(
            CoWowGtk::translate_utf8(Items[*idx].Name));
        (*idx)++;
        W = build_menu(Menu, MENU_PULLDOWN, Lng::translate(Items[i].Name),
            MenuUserData, Callback, CallbackData, Items, idx);
        (*idx)--;
        gtk_menu_item_set_submenu(GTK_MENU_ITEM(sub), GTK_WIDGET(W));
        gtk_menu_shell_append(GTK_MENU_SHELL(Menu), sub);
        gtk_widget_show(sub);
      } else {
        *idx = cidx - 1;
      }
      break;
    }
    case xmenu_eMenuItem_Separator:
      // Separator
      W = gtk_separator_menu_item_new();
      gtk_menu_shell_append(GTK_MENU_SHELL(Menu), W);
      gtk_widget_show(W);
      break;
    case xmenu_eMenuItem_Button:
      // Pushbutton
      W = gtk_menu_item_new_with_label(
          CoWowGtk::translate_utf8(Items[*idx].Name));
      gtk_widget_set_sensitive(W, Items[*idx].Flags.f.Sensitive ? TRUE : FALSE);
      g_object_set_data((GObject*)W, "userdata", (gpointer)((long int)*idx));
      if (Callback)
        g_signal_connect(W, "activate", G_CALLBACK(Callback), CallbackData);
      gtk_menu_shell_append(GTK_MENU_SHELL(Menu), W);
      gtk_widget_show(W);
      break;
    default:;
    }
  }

  return Menu;
}
开发者ID:siamect,项目名称:proview,代码行数:92,代码来源:xtt_xnav_gtk.cpp


示例9: gtk_hbox_new

GtkWidget *create_pho_sel_area()
{
  hbox_pho_sel = gtk_hbox_new (FALSE, 0);

  int i;

  for(i=0; i < bigphoN; i++) {
    bigpho[i].opt_menu = gtk_combo_box_new_text ();
#if !GTK_CHECK_VERSION(2,4,0)
    GtkWidget *menu = gtk_menu_new ();
#endif
    gtk_box_pack_start (GTK_BOX (hbox_pho_sel), bigpho[i].opt_menu, FALSE, FALSE, 0);

    int j;
    for(j=0; j < bigpho[i].phokeysN; j++) {
      char t[128];
      char *phostr;

      if (is_gtab) {
        int tlen;
        u_int64_t key64;
        if (ph_key_sz == 4) {
          u_int32_t key32;
          cp_ph_key(bigpho[i].phokeys,j, &key32);
          key64 = key32;
        } else
          cp_ph_key(bigpho[i].phokeys,j, &key64);

        gtab_key2name(pinmd, key64, t, &tlen);
//        dbg("%d,%d] %s\n", i,j, t);
        phostr = t;
      } else {
        phokey_t k;
        cp_ph_key(bigpho[i].phokeys, j, &k);
        phostr = b_pinyin?
        phokey2pinyin(k):phokey_to_str(k);
      }

#if GTK_CHECK_VERSION(2,4,0)
      gtk_combo_box_append_text (GTK_COMBO_BOX_TEXT (bigpho[i].opt_menu), phostr);
#else
      GtkWidget *item = gtk_menu_item_new_with_label (phostr);
      gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
#endif
    }

#if GTK_CHECK_VERSION(2,4,0)
    gtk_combo_box_set_active (GTK_COMBO_BOX(bigpho[i].opt_menu), 0);
#else
    gtk_option_menu_set_menu (GTK_OPTION_MENU (bigpho[i].opt_menu), menu);
#endif

  }


  GtkWidget *button_ok = gtk_button_new_with_label("OK to add");
  gtk_box_pack_start (GTK_BOX (hbox_pho_sel), button_ok, FALSE, FALSE, 20);
  g_signal_connect (G_OBJECT (button_ok), "clicked",
     G_CALLBACK (cb_button_ok), NULL);

  GtkWidget *button_cancel = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
  gtk_box_pack_start (GTK_BOX (hbox_pho_sel), button_cancel, FALSE, FALSE, 20);
  g_signal_connect (G_OBJECT (button_cancel), "clicked",
     G_CALLBACK (cb_button_cancel), NULL);


  return hbox_pho_sel;
}
开发者ID:RJHsiao,项目名称:gcin-debian,代码行数:68,代码来源:tslearn.cpp


示例10: menu_new

GtkWidget * menu_new(GtkWindow * main_window, MapArea * map_area, Config * config)
{
	Menu * menubar = g_object_new(GOSM_TYPE_MENU, NULL);
	menubar -> main_window = main_window;
	menubar -> map_area = map_area;
	menubar -> config = config;
	/********************************************************************************************
	* the following part is autogenerated; to regenerate, type:
	* :r !./misc/menu_gen.py 2 misc/Menu.txt
	********************************************************************************************/
	GtkWidget *item_1                      = gtk_menu_item_new_with_label("File");
	GtkWidget *menu_1                      = gtk_menu_new();
	GtkWidget *item_1_1                    = gtk_menu_item_new_with_label("Quit");
	GtkWidget *item_2                      = gtk_menu_item_new_with_label("View");
	GtkWidget *menu_2                      = gtk_menu_new();
	GtkWidget *item_2_1                    = gtk_check_menu_item_new_with_label("Fullscreen");
	GtkWidget *item_2_2                    = gtk_menu_item_new_with_label("Control");
	GtkWidget *menu_2_2                    = gtk_menu_new();
	GtkWidget *item_2_2_1                  = gtk_menu_item_new_with_label("Zoom In");
	GtkWidget *item_2_2_2                  = gtk_menu_item_new_with_label("Zoom Out");
	GtkWidget *item_2_2_3                  = gtk_menu_item_new_with_label("Move Up");
	GtkWidget *item_2_2_4                  = gtk_menu_item_new_with_label("Move Down");
	GtkWidget *item_2_2_5                  = gtk_menu_item_new_with_label("Move Left");
	GtkWidget *item_2_2_6                  = gtk_menu_item_new_with_label("Move Right");
	GtkWidget *item_2_3                    = gtk_menu_item_new_with_label("Tiles");
	GtkWidget *menu_2_3                    = gtk_menu_new();
	GtkWidget *item_2_3_1                  = gtk_radio_menu_item_new_with_label(NULL, "Mapnik");
	GtkWidget *item_2_3_2                  = gtk_radio_menu_item_new_with_label(gtk_radio_menu_item_get_group((GtkRadioMenuItem*)item_2_3_1), "Osmarender");
	GtkWidget *item_2_3_3                  = gtk_radio_menu_item_new_with_label(gtk_radio_menu_item_get_group((GtkRadioMenuItem*)item_2_3_1), "OpenAerial");
	GtkWidget *item_2_3_4                  = gtk_radio_menu_item_new_with_label(gtk_radio_menu_item_get_group((GtkRadioMenuItem*)item_2_3_1), "Google");
	GtkWidget *item_2_3_5                  = gtk_radio_menu_item_new_with_label(gtk_radio_menu_item_get_group((GtkRadioMenuItem*)item_2_3_1), "Yahoo");
	GtkWidget *item_3                      = gtk_menu_item_new_with_label("Selection");
	GtkWidget *menu_3                      = gtk_menu_new();
	GtkWidget *item_3_1                    = gtk_check_menu_item_new_with_label("Snap to Map");
	GtkWidget *item_3_2                    = gtk_check_menu_item_new_with_label("Hide");
	GtkWidget *item_3_3                    = gtk_menu_item_new_with_label("Export");
	GtkWidget *item_3_4                    = gtk_menu_item_new_with_label("Download");
	GtkWidget *item_4                      = gtk_menu_item_new_with_label("Options");
	GtkWidget *menu_4                      = gtk_menu_new();
	GtkWidget *item_4_1                    = gtk_menu_item_new_with_label("Preferences");
	GtkWidget *item_5                      = gtk_menu_item_new_with_label("Help");
	GtkWidget *menu_5                      = gtk_menu_new();
	GtkWidget *item_5_1                    = gtk_menu_item_new_with_label("Manual");
	GtkWidget *item_5_2                    = gtk_menu_item_new_with_label("About GOsmView");
	GtkWidget *item_5_3                    = gtk_menu_item_new_with_label("About OpenStreetMap");
	GtkWidget *item_5_4                    = gtk_menu_item_new_with_label("About Namefinder");
	GtkWidget *item_5_5                    = gtk_menu_item_new_with_label("License");
	gtk_menu_item_set_submenu(GTK_MENU_ITEM(item_1),              menu_1);
	gtk_menu_item_set_submenu(GTK_MENU_ITEM(item_2),              menu_2);
	gtk_menu_item_set_submenu(GTK_MENU_ITEM(item_2_2),            menu_2_2);
	gtk_menu_item_set_submenu(GTK_MENU_ITEM(item_2_3),            menu_2_3);
	gtk_menu_item_set_submenu(GTK_MENU_ITEM(item_3),              menu_3);
	gtk_menu_item_set_submenu(GTK_MENU_ITEM(item_4),              menu_4);
	gtk_menu_item_set_submenu(GTK_MENU_ITEM(item_5),              menu_5);
	gtk_menu_shell_append(GTK_MENU_SHELL(menubar),            item_1);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu_1),             item_1_1);
	gtk_menu_shell_append(GTK_MENU_SHELL(menubar),            item_2);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu_2),             item_2_1);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu_2),             item_2_2);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu_2_2),           item_2_2_1);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu_2_2),           item_2_2_2);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu_2_2),           item_2_2_3);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu_2_2),           item_2_2_4);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu_2_2),           item_2_2_5);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu_2_2),           item_2_2_6);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu_2),             item_2_3);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu_2_3),           item_2_3_1);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu_2_3),           item_2_3_2);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu_2_3),           item_2_3_3);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu_2_3),           item_2_3_4);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu_2_3),           item_2_3_5);
	gtk_menu_shell_append(GTK_MENU_SHELL(menubar),            item_3);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu_3),             item_3_1);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu_3),             item_3_2);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu_3),             item_3_3);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu_3),             item_3_4);
	gtk_menu_shell_append(GTK_MENU_SHELL(menubar),            item_4);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu_4),             item_4_1);
	gtk_menu_shell_append(GTK_MENU_SHELL(menubar),            item_5);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu_5),             item_5_1);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu_5),             item_5_2);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu_5),             item_5_3);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu_5),             item_5_4);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu_5),             item_5_5);
	menubar -> menu_file_quit                 = item_1_1;
	menubar -> menu_view_fullscreen           = item_2_1;
	menubar -> menu_control_zoom_in           = item_2_2_1;
	menubar -> menu_control_zoom_out          = item_2_2_2;
	menubar -> menu_control_move_up           = item_2_2_3;
	menubar -> menu_control_move_down         = item_2_2_4;
	menubar -> menu_control_move_left         = item_2_2_5;
	menubar -> menu_control_move_right        = item_2_2_6;
	menubar -> menu_tiles_mapnik              = item_2_3_1;
	menubar -> menu_tiles_osmarender          = item_2_3_2;
	menubar -> menu_tiles_openaerial          = item_2_3_3;
	menubar -> menu_tiles_google              = item_2_3_4;
	menubar -> menu_tiles_yahoo               = item_2_3_5;
	menubar -> menu_selection_snap            = item_3_1;
	menubar -> menu_selection_show            = item_3_2;
	menubar -> menu_selection_export          = item_3_3;
//.........这里部分代码省略.........
开发者ID:DeadNumbers,项目名称:gosm,代码行数:101,代码来源:menu.c


示例11: main

int main (int argc, char *argv[])
{
  GtkWidget *win = NULL;

  GtkWidget *textarea = NULL;
  GtkWidget *vbox;
  GtkWidget *menubar;
  GtkWidget *filemenu;
  GtkWidget *file;
  GtkWidget *quit;
  GtkWidget *help;
  GtkWidget *helpmenu;
  GtkWidget *author;
  GtkWidget *website;
  GtkWidget *open;
  GtkWidget *save;
  GtkWidget *save_as;
  GtkWidget *close;
   /* Initialize GTK+ */
  g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING, (GLogFunc) gtk_false, NULL);
  gtk_init (&argc, &argv);
  g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING, g_log_default_handler, NULL);

 // Create a Window
  win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_container_set_border_width (GTK_CONTAINER (win), 8);
  gtk_window_set_title (GTK_WINDOW (win), "Ringo Text Editor");
  gtk_window_set_position (GTK_WINDOW (win), GTK_WIN_POS_CENTER);
  gtk_widget_realize (win);
  g_signal_connect (win, "destroy", gtk_main_quit, NULL);
  gtk_window_set_default_size(GTK_WINDOW(win),640,480);



   //create a text box
 vbox = gtk_vbox_new(FALSE, 0);
  gtk_container_add(GTK_CONTAINER(win), vbox);


  textarea =  gtk_text_view_new ();
  gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textarea),GTK_WRAP_WORD);
   gtk_box_pack_start (GTK_BOX (vbox), textarea, TRUE, TRUE, 0);




  menubar = gtk_menu_bar_new();
  filemenu = gtk_menu_new();
  helpmenu = gtk_menu_new();

  file = gtk_menu_item_new_with_label("File");
  open = gtk_menu_item_new_with_label("Open");
  save = gtk_menu_item_new_with_label("Save");
  close = gtk_menu_item_new_with_label("Close");
  save_as = gtk_menu_item_new_with_label("Save as..");
  quit = gtk_menu_item_new_with_label("Quit");
  help = gtk_menu_item_new_with_label("Help");
  author = gtk_menu_item_new_with_label("Authors");
  website = gtk_menu_item_new_with_label("Official Web Site");

// Меню файлов
  gtk_menu_item_set_submenu(GTK_MENU_ITEM(file), filemenu);
  gtk_menu_shell_append(GTK_MENU_SHELL(filemenu), open);
  gtk_menu_shell_append(GTK_MENU_SHELL(filemenu), close);
  gtk_menu_shell_append(GTK_MENU_SHELL(filemenu), save);
  gtk_menu_shell_append(GTK_MENU_SHELL(filemenu), save_as);
  gtk_menu_shell_append(GTK_MENU_SHELL(filemenu), quit);

  gtk_menu_shell_append(GTK_MENU_SHELL(menubar), file);
  //Help Menu


  gtk_menu_item_set_submenu(GTK_MENU_ITEM(help), helpmenu);
  gtk_menu_shell_append(GTK_MENU_SHELL(helpmenu), author);
  gtk_menu_shell_append(GTK_MENU_SHELL(helpmenu), website);
  gtk_menu_shell_append(GTK_MENU_SHELL(menubar), help);


  //Connect
  gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, FALSE, 3);

    g_signal_connect(G_OBJECT(quit), "activate",
        G_CALLBACK(gtk_main_quit), NULL);
    g_signal_connect(G_OBJECT(author), "activate",
        G_CALLBACK(authors_call), NULL);
    g_signal_connect(G_OBJECT(website), "activate",
        G_CALLBACK(open_web_site), NULL);
    g_signal_connect(G_OBJECT(open), "activate",
        G_CALLBACK(open_file),NULL);



 // Открытие файла передача в переменную
 if (opened == 1)
 {

 }


 //вроде конец
//.........这里部分代码省略.........
开发者ID:Alliace,项目名称:Ringo,代码行数:101,代码来源:main.c


示例12: fc_malloc


//.........这里部分代码省略.........
  gtk_grid_attach(GTK_GRID(table2), button, 0, 4, 1, 1);
  
  arrow = gtk_arrow_new(GTK_ARROW_RIGHT, GTK_SHADOW_IN);
  gtk_container_add(GTK_CONTAINER(button), arrow);
  g_signal_connect_swapped(button, "clicked",
                           G_CALLBACK(queue_remove), ptr);
  gtk_widget_set_sensitive(ptr->remove_cmd, FALSE);

  sw = gtk_scrolled_window_new(NULL, NULL);
  gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
				      GTK_SHADOW_ETCHED_IN);
  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
				 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
  gtk_grid_attach(GTK_GRID(table), sw, 0, 1, 2, 1);

  dst_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(dst_store));
  gtk_widget_set_hexpand(dst_view, TRUE);
  gtk_widget_set_vexpand(dst_view, TRUE);
  g_object_unref(dst_store);
  gtk_size_group_add_widget(group, dst_view);
  gtk_widget_set_name(dst_view, "small_font");

  populate_view(GTK_TREE_VIEW(dst_view), &ptr->pcity, &ptr->dst_col);
  gtk_container_add(GTK_CONTAINER(sw), dst_view);

  label = g_object_new(GTK_TYPE_LABEL,
		       "use-underline", TRUE,
		       "mnemonic-widget", dst_view,
		       "label", _("Target _Worklist:"),
		       "xalign", 0.0, "yalign", 0.5, NULL);
  gtk_grid_attach(GTK_GRID(table), label, 0, 0, 1, 1);

  /* add bottom menu and buttons. */
  bbox = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
  gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
  gtk_box_set_spacing(GTK_BOX(bbox), 10);
  gtk_container_add(GTK_CONTAINER(editor), bbox);

  menubar = gtk_aux_menu_bar_new();
  gtk_container_add(GTK_CONTAINER(bbox), menubar);
  gtk_button_box_set_child_secondary(GTK_BUTTON_BOX(bbox), menubar, TRUE);

  menu = gtk_menu_new();

  image = gtk_image_new_from_stock(GTK_STOCK_ADD, GTK_ICON_SIZE_MENU);
  item = gtk_image_menu_item_new_with_mnemonic(_("_Add Global Worklist"));
  gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), image);
  gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), menu);
  gtk_menu_shell_append(GTK_MENU_SHELL(menubar), item);
  g_signal_connect(menu, "show",
		   G_CALLBACK(popup_add_menu), ptr);
  ptr->add_cmd = item;
  gtk_widget_set_sensitive(ptr->add_cmd, FALSE);

  button = gtk_button_new_from_stock(GTK_STOCK_HELP);
  gtk_container_add(GTK_CONTAINER(bbox), button);
  g_signal_connect(button, "clicked",
		   G_CALLBACK(help_callback), ptr);
  ptr->help_cmd = button;
  gtk_widget_set_sensitive(ptr->help_cmd, FALSE);

  button = gtk_button_new_with_mnemonic(_("Change Prod_uction"));
  gtk_container_add(GTK_CONTAINER(bbox), button);
  g_signal_connect(button, "clicked",
		   G_CALLBACK(change_callback), ptr);
  ptr->change_cmd = button;
  gtk_widget_set_sensitive(ptr->change_cmd, FALSE);

  ptr->src_view = src_view;
  ptr->dst_view = dst_view;
  ptr->src_selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(src_view));
  ptr->dst_selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dst_view));
  gtk_tree_selection_set_mode(ptr->dst_selection, GTK_SELECTION_MULTIPLE);

  /* DND and other state changing callbacks. */
  gtk_tree_view_set_reorderable(GTK_TREE_VIEW(dst_view), TRUE);
  g_signal_connect(dst_view, "drag_end",
		   G_CALLBACK(dst_dnd_callback), ptr);

  g_signal_connect(src_view, "row_activated",
		   G_CALLBACK(src_row_callback), ptr);
  g_signal_connect(src_view, "key_press_event",
		   G_CALLBACK(src_key_press_callback), ptr);

  g_signal_connect(dst_view, "row_activated",
		   G_CALLBACK(dst_row_callback), ptr);
  g_signal_connect(dst_view, "key_press_event",
		   G_CALLBACK(dst_key_press_callback), ptr);

  g_signal_connect(ptr->src_selection, "changed",
      		   G_CALLBACK(src_selection_callback), ptr);
  g_signal_connect(ptr->dst_selection, "changed",
      		   G_CALLBACK(dst_selection_callback), ptr);


  gtk_widget_show_all(table);
  gtk_widget_show_all(bbox);

  return editor;
}
开发者ID:jheusala,项目名称:freeciv,代码行数:101,代码来源:wldlg.c


示例13: XAttOne

XAttOneGtk::XAttOneGtk( GtkWidget *xa_parent_wid,
			void *xa_parent_ctx, 
			pwr_sAttrRef *xa_aref,
			char *xa_title,
			unsigned int xa_priv,
			int *xa_sts) :
  XAttOne( xa_parent_ctx, xa_aref, xa_title, xa_priv, xa_sts), 
  parent_wid(xa_parent_wid)
{
  pwr_tAName   	title;

  *xa_sts = gdh_AttrrefToName( &aref, title, sizeof(title), cdh_mNName);
  if ( EVEN(*xa_sts)) return;

  toplevel = (GtkWidget *) g_object_new( GTK_TYPE_WINDOW, 
					 "default-height", 200,
					 "default-width", 500,
					 "title", CoWowGtk::convert_utf8(title),
					 NULL);

  g_signal_connect( toplevel, "delete_event", G_CALLBACK(delete_event), this);
  g_signal_connect( toplevel, "destroy", G_CALLBACK(destroy_event), this);
  g_signal_connect( toplevel, "focus-in-event", G_CALLBACK(action_inputfocus), this);

  CoWowGtk::SetWindowIcon( toplevel);

  // Menu
  // Accelerators
  GtkAccelGroup *accel_g = (GtkAccelGroup *) g_object_new(GTK_TYPE_ACCEL_GROUP, NULL);
  gtk_window_add_accel_group(GTK_WINDOW(toplevel), accel_g);

  GtkMenuBar *menu_bar = (GtkMenuBar *) g_object_new(GTK_TYPE_MENU_BAR, NULL);

  // File entry
  GtkWidget *file_close = gtk_image_menu_item_new_from_stock(GTK_STOCK_CLOSE, accel_g);
  g_signal_connect(file_close, "activate", G_CALLBACK(activate_exit), this);

  GtkMenu *file_menu = (GtkMenu *) g_object_new( GTK_TYPE_MENU, NULL);
  gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_close);

  GtkWidget *file = gtk_menu_item_new_with_mnemonic("_File");
  gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), file);
  gtk_menu_item_set_submenu(GTK_MENU_ITEM(file), GTK_WIDGET(file_menu));

  // Help entry
  GtkWidget *help_help = gtk_image_menu_item_new_from_stock(GTK_STOCK_HELP, accel_g);
  g_signal_connect(help_help, "activate", G_CALLBACK(activate_help), this);

  GtkMenu *help_menu = (GtkMenu *) g_object_new( GTK_TYPE_MENU, NULL);
  gtk_menu_shell_append(GTK_MENU_SHELL(help_menu), help_help);

  GtkWidget *help = gtk_menu_item_new_with_mnemonic("_Help");
  gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), help);
  gtk_menu_item_set_submenu(GTK_MENU_ITEM(help), GTK_WIDGET(help_menu));

  // Prompt, label, input entry
  msg_label = gtk_label_new( "");
  gtk_widget_set_size_request( msg_label, -1, 25);
  cmd_prompt = gtk_label_new( "value > ");
  gtk_widget_set_size_request( cmd_prompt, -1, 25);
  cmd_label = gtk_label_new("");
  gtk_widget_set_size_request( cmd_label, -1, 25);
  gtk_misc_set_alignment( GTK_MISC(cmd_label), 0.0, 0.5);
  cmd_entry = new CoWowEntryGtk( &value_recall);
  cmd_input = cmd_entry->widget();
  gtk_widget_set_size_request( cmd_input, -1, 25);
  g_signal_connect( cmd_input, "activate", 
		    G_CALLBACK(activate_cmd_input), this);

  // Scrolled text input
  cmd_scrolled_buffer = gtk_text_buffer_new( NULL);

  cmd_scrolledtextview = gtk_text_view_new_with_buffer( cmd_scrolled_buffer);
  GtkWidget *viewport = gtk_viewport_new( NULL, NULL);
  GtkWidget *scrolledwindow = gtk_scrolled_window_new(NULL, NULL);
  gtk_container_add( GTK_CONTAINER(viewport), cmd_scrolledtextview);
  gtk_container_add( GTK_CONTAINER(scrolledwindow), viewport);

  cmd_scrolledinput = gtk_vbox_new( FALSE, 0);
  gtk_box_pack_start( GTK_BOX(cmd_scrolledinput), scrolledwindow, TRUE, TRUE, 0);

  // Buttons
  cmd_scrolled_ok = gtk_button_new_with_label( CoWowGtk::translate_utf8("Ok"));
  gtk_widget_set_size_request( cmd_scrolled_ok, 70, 25);
  g_signal_connect( cmd_scrolled_ok, "clicked", 
 		    G_CALLBACK(activate_cmd_scrolled_ok), this);

  cmd_scrolled_ap = gtk_button_new_with_label( CoWowGtk::translate_utf8("Apply"));
  gtk 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GTK_MOZ_EMBED函数代码示例发布时间:2022-05-30
下一篇:
C++ GTK_MENU_ITEM函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap