当前位置: 首页>>代码示例>>C++>>正文


C++ GTK_CHECK_MENU_ITEM函数代码示例

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


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

示例1: seach_entry_populate_popup

static void
seach_entry_populate_popup (GtkEntry *entry, PraghaPreferences *preferences)
{
	GtkWidget *popup_menu, *item;
	gboolean instant_search, approximate_search;

	popup_menu = gtk_menu_new ();

	/* Instant search. */

	item = gtk_check_menu_item_new_with_label (_("Refine the search while writing"));
	gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item);

	instant_search = pragha_preferences_get_instant_search(preferences);
	gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), instant_search);
	g_signal_connect (G_OBJECT (item), "toggled",
				G_CALLBACK (search_entry_instant_option_toggled), preferences);
	gtk_widget_show (item);

	/* Aproximate search. */

	item = gtk_check_menu_item_new_with_label (_("Search approximate words"));
	gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item);

	approximate_search = pragha_preferences_get_approximate_search(preferences);
	gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), approximate_search);
	g_signal_connect (G_OBJECT (item), "toggled",
				G_CALLBACK (search_entry_approximate_option_toggled), preferences);
	gtk_widget_show (item);

	gtk_menu_attach_to_widget(GTK_MENU(popup_menu), GTK_WIDGET(entry), NULL);

	gtk_menu_popup(GTK_MENU(popup_menu), NULL, NULL,
			(GtkMenuPositionFunc) menu_position, entry,
			0, gtk_get_current_event_time());
}
开发者ID:pingax,项目名称:pragha,代码行数:36,代码来源:widgets.c

示例2: _e2_option_sel_activated_cb

static void _e2_option_sel_activated_cb (GtkMenuItem *menu_item, E2_OptionSet *set)
{
	GtkWidget *controller = g_object_get_data (G_OBJECT (menu_item),
		"e2-controller-widget");
	if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (controller),
		"e2-controller-blocked")))
			return;
	if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (menu_item)))
		return;
//	NEEDCLOSEBGL
	GSList *group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_item));
//	NEEDOPENBGL
	gint index = 2 - g_slist_index (group, menu_item);
	e2_option_sel_set_direct (set, index);
}
开发者ID:pyromaniac2k,项目名称:emelfm2,代码行数:15,代码来源:e2_option_sel.c

示例3: add_popup_menu_items

static void
add_popup_menu_items (GtkWidget      *menu,
                      GeditViewFrame *frame)
{
	GtkWidget *menu_item;

	/* create "Wrap Around" menu item. */
	menu_item = gtk_check_menu_item_new_with_mnemonic (_("_Wrap Around"));
	g_signal_connect (G_OBJECT (menu_item), "toggled",
			  G_CALLBACK (wrap_around_menu_item_toggled),
			  frame);
	gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item);
	gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item),
					frame->priv->wrap_around);
	gtk_widget_show (menu_item);

	/* create "Match Entire Word Only" menu item. */
	menu_item = gtk_check_menu_item_new_with_mnemonic (_("Match _Entire Word Only"));
	g_signal_connect (G_OBJECT (menu_item), "toggled",
			  G_CALLBACK (match_entire_word_menu_item_toggled),
			  frame);
	gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item);
	gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item),
					GEDIT_SEARCH_IS_ENTIRE_WORD (frame->priv->search_flags));
	gtk_widget_show (menu_item);

	/* create "Match Case" menu item. */
	menu_item = gtk_check_menu_item_new_with_mnemonic (_("_Match Case"));
	g_signal_connect (G_OBJECT (menu_item), "toggled",
			  G_CALLBACK (match_case_menu_item_toggled),
			  frame);
	gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item);
	gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item),
					GEDIT_SEARCH_IS_CASE_SENSITIVE (frame->priv->search_flags));
	gtk_widget_show (menu_item);
}
开发者ID:dtrebbien,项目名称:gedit,代码行数:36,代码来源:gedit-view-frame.c

示例4: activate_cb

static void
activate_cb(GtkWidget *w, JamDoc *doc) {
	const gchar *user;
	JamAccount *acc = jam_doc_get_account(doc);

	if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)))
		return;

	user = gtk_label_get_text(GTK_LABEL(GTK_BIN(w)->child));

	if (g_ascii_strcasecmp(user, jam_account_get_username(acc)) == 0)
		user = NULL; /* post as normal user. */

	jam_doc_set_usejournal(doc, user);
}
开发者ID:andy-shev,项目名称:LogJam,代码行数:15,代码来源:usejournal.c

示例5: toggle_chat_window

void toggle_chat_window(gpointer data, guint action, GtkWidget * w)
{
	ChatWidgets *list;

	for (list = chats; list; list = list->next) {
		if (!list->container)
			continue;

		if (GTK_CHECK_MENU_ITEM(w)->active) {
			gtk_widget_show(list->container);
		} else {
			gtk_widget_hide(list->container);
		}
	}
}
开发者ID:ralight,项目名称:ggz,代码行数:15,代码来源:dlg_chat.c

示例6: theme_get_current

static GtkWidget *build_port_menu(void)
{
	gint i;
	GtkWidget *item;
	GdkPixmap *pixmap;
	GtkWidget *image;
	GtkWidget *menu;
	MapTheme *theme = theme_get_current();

	menu = gtk_menu_new();

	for (i = 0; i <= ANY_RESOURCE; i++) {
		item =
		    gtk_image_menu_item_new_with_mnemonic(gettext
							  (port_names[i]));

		gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
		g_signal_connect(G_OBJECT(item), "activate",
				 G_CALLBACK(select_port_resource_cb),
				 GINT_TO_POINTER(i));

		pixmap = theme->port_tiles[i];
		if (i >= NO_RESOURCE || pixmap == NULL)
			continue;

		image = gtk_image_new_from_pixmap(pixmap, NULL);
		gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item),
					      image);
	}
	gtk_menu_shell_append(GTK_MENU_SHELL(menu),
			      gtk_separator_menu_item_new());
	for (i = 0; i < 6; i++) {
		item =
		    gtk_check_menu_item_new_with_label(Q_
						       (port_direction_names
							[i]));
		gtk_check_menu_item_set_draw_as_radio(GTK_CHECK_MENU_ITEM
						      (item), TRUE);
		gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
		g_signal_connect(G_OBJECT(item), "toggled",
				 G_CALLBACK(select_port_direction_cb),
				 GINT_TO_POINTER(i));
		port_directions[i] = item;
	}
	gtk_widget_show_all(menu);

	return menu;
}
开发者ID:jquick,项目名称:pioneers,代码行数:48,代码来源:editor.c

示例7: show_popup_menu

/* Create and show the popup menu */
static void show_popup_menu(TilemDisasmView *dv, GdkEventButton *event)
{
	GtkWidget *menu, *item;
	dword curpos;

	if (dv->popup_menu)
		gtk_widget_destroy(dv->popup_menu);
	dv->popup_menu = menu = gtk_menu_new();

	/* Enable/disable breakpoint */

	item = gtk_check_menu_item_new_with_mnemonic(_("_Breakpoint Here"));

	get_cursor_line(dv, &curpos, NULL);
	if (curpos == (dword) -1)
		gtk_widget_set_sensitive(item, FALSE);
	else if (find_line_bp(dv, curpos))
		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE);

	g_signal_connect(item, "toggled",
	                 G_CALLBACK(toggle_bp), dv);

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

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

	/* Jump to address */

	item = gtk_menu_item_new_with_mnemonic(_("_Go to Address..."));
	g_signal_connect(item, "activate", G_CALLBACK(prompt_go_to), dv);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
	gtk_widget_show(item);

	item = gtk_menu_item_new_with_mnemonic(_("Go to P_C"));
	g_signal_connect(item, "activate", G_CALLBACK(go_to_pc), dv);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
	gtk_widget_show(item);

	if (event)
		gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
		               event->button, event->time);
	else
		gtk_menu_popup(GTK_MENU(menu), NULL, NULL, &place_menu, dv,
		               0, gtk_get_current_event_time());
}
开发者ID:TI8XEmulator,项目名称:graph89,代码行数:49,代码来源:disasmview.c

示例8: check_rotation_menu_item

static void check_rotation_menu_item(struct screen_info *info,
        xcb_randr_rotation_t rotation, gboolean is_active)
{
    GtkWidget *item = info->rotation_menu_items[rotation];

    if (!item) {
        g_warning("Unknown rotation item\n");
        return;
    }

    g_signal_handlers_block_by_func(G_OBJECT(item), G_CALLBACK(menu_on_item),
            (gpointer)info);
    gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), is_active);
    g_signal_handlers_unblock_by_func(G_OBJECT(item), G_CALLBACK(menu_on_item),
            (gpointer)info);
}
开发者ID:clehner,项目名称:display-rotation-menu-gtk,代码行数:16,代码来源:main.c

示例9: GTK_CHECK_MENU_ITEM

void      explorer_force_pause           (Explorer *self)
{
    /* Force rendering to pause now, but keep note of its original state
     * so that explorer_restore_pause() can undo this as necessary.
     */
    GtkCheckMenuItem *paused = GTK_CHECK_MENU_ITEM(glade_xml_get_widget(self->xml, "pause_menu"));
    gboolean original_state = gtk_check_menu_item_get_active(paused);
    gtk_check_menu_item_set_active(paused, TRUE);

    /* Now, on_pause_rendering_toggle just disabled unpause_on_restore since
     * typically only a user changes the pause_menu state. We want to turn
     * that back on if we just paused it and originally it was unpaused,
     * so that explorer_restore_pause() does the Right Thing (tm).
     */
    self->unpause_on_restore = !original_state;
}
开发者ID:ain101,项目名称:Fyre,代码行数:16,代码来源:explorer.c

示例10: gnc_split_reg2_double_line_cb

void
gnc_split_reg2_double_line_cb (GtkWidget *w, gpointer data)
{
    GNCSplitReg2 *gsr = data;
    GncTreeModelSplitReg *model = gnc_ledger_display2_get_split_model_register (gsr->ledger);
    gboolean use_double_line;

    use_double_line = gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (w));
    if (use_double_line == model->use_double_line)
        return;

    gnc_tree_model_split_reg_config (model, model->type, model->style, use_double_line);

    // This will re-display the view.
    gnc_tree_view_split_reg_set_format (gnc_ledger_display2_get_split_view_register (gsr->ledger));
}
开发者ID:Gnucash,项目名称:gnucash,代码行数:16,代码来源:gnc-split-reg2.c

示例11: on_show_range1_activate

void on_show_range1_activate(GtkMenuItem * menuitem, gpointer user_data)
{
	GtkTreeViewColumn *col;

	show_range = GTK_CHECK_MENU_ITEM(menuitem)->active;
	col = gtk_tree_view_get_column(GTK_TREE_VIEW(tree2_w), COL_NO);
	if (col)
		gtk_tree_view_column_set_visible(col, show_range);
	col = gtk_tree_view_get_column(GTK_TREE_VIEW(tree2_w), COL_MOD);
	if (col)
		gtk_tree_view_column_set_visible(col, show_range);
	col = gtk_tree_view_get_column(GTK_TREE_VIEW(tree2_w), COL_YES);
	if (col)
		gtk_tree_view_column_set_visible(col, show_range);

}
开发者ID:OpenHMR,项目名称:Open-HMR600,代码行数:16,代码来源:gconf.c

示例12: on_winMain_delete_event

G_MODULE_EXPORT gboolean
on_winMain_delete_event(void)
{
	/* return false to allow destroy */
	if(
#ifdef CFG_USE_RADIO
			gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chkTray))
#else
			gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(chkTray))
#endif
			){
		tray_toggle();
		return TRUE;
	}
	return FALSE;
}
开发者ID:bobrippling,项目名称:comm,代码行数:16,代码来源:gft.c

示例13: main

int main(int argc,char *argv[])
{
    GtkWidget *window;
    GtkWidget *vbox;

    GtkWidget *menubar;
    GtkWidget *viewmenu;
    GtkWidget *view;
    GtkWidget *tog_stat;
    GtkWidget *statusbar;

    gtk_init(&argc,&argv);

    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_position(GTK_WINDOW(window),GTK_WIN_POS_CENTER);
    gtk_window_set_default_size(GTK_WINDOW(window),250,200);
    gtk_window_set_title(GTK_WINDOW(window),"view statusbar");

    vbox = gtk_vbox_new(FALSE,0);
    gtk_container_add(GTK_CONTAINER(window),vbox);

    menubar = gtk_menu_bar_new();
    viewmenu = gtk_menu_new();

    view = gtk_menu_item_new_with_label("View");
    tog_stat = gtk_check_menu_item_new_with_label("View Statusbar");
    gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(tog_stat),TRUE);

    gtk_menu_item_set_submenu(GTK_MENU_ITEM(view),viewmenu);
    gtk_menu_shell_append(GTK_MENU_SHELL(viewmenu),tog_stat);
    gtk_menu_shell_append(GTK_MENU_SHELL(menubar),view);

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

    statusbar = gtk_statusbar_new();
    gtk_box_pack_end(GTK_BOX(vbox),statusbar,FALSE,TRUE,1);

    g_signal_connect_swapped(G_OBJECT(window),"destroy",G_CALLBACK(gtk_main_quit),NULL);

    g_signal_connect(G_OBJECT(tog_stat),"activate",G_CALLBACK(toggle_statusbar),statusbar);

    gtk_widget_show_all(window);

    gtk_main();

    return 0;
}
开发者ID:hongbochen,项目名称:GTKGame,代码行数:47,代码来源:main.c

示例14: convert_menu

static
GtkWidget *
convert_menu(const struct PP_Flash_Menu *pp_menu)
{
    GtkWidget *menu = gtk_menu_new();

    for (uintptr_t k = 0; k < pp_menu->count; k ++) {
        const struct PP_Flash_MenuItem pp_mi = pp_menu->items[k];
        GtkWidget *mi = NULL;

        switch (pp_mi.type) {
        case PP_FLASH_MENUITEM_TYPE_NORMAL:
            mi = gtk_menu_item_new_with_label(pp_mi.name);
            break;
        case PP_FLASH_MENUITEM_TYPE_CHECKBOX:
            mi = gtk_check_menu_item_new_with_label(pp_mi.name);
            gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mi), pp_mi.checked != PP_FALSE);
            break;
        case PP_FLASH_MENUITEM_TYPE_SEPARATOR:
            mi = gtk_separator_menu_item_new();
            break;
        case PP_FLASH_MENUITEM_TYPE_SUBMENU:
            mi = gtk_menu_item_new_with_label(pp_mi.name);
            break;
        }

        if (!mi)
            continue;

        gtk_widget_set_sensitive(mi, pp_mi.enabled != PP_FALSE);
        gtk_widget_show(mi);
        gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);

        if (pp_mi.type == PP_FLASH_MENUITEM_TYPE_SUBMENU) {
            gtk_menu_item_set_submenu(GTK_MENU_ITEM(mi), convert_menu(pp_mi.submenu));
        } else {
            // each menu item have specific id associated
            g_signal_connect(G_OBJECT(mi), "activate", G_CALLBACK(menu_item_activated),
                             (void*)(size_t)pp_mi.id);
            // connect "button-press-event" to workaround submenu "activate" signal missing issue
            g_signal_connect(G_OBJECT(mi), "button-press-event", G_CALLBACK(menu_item_button_press),
                             (void*)(size_t)pp_mi.id);
        }
    }

    return menu;
}
开发者ID:eltictacdicta,项目名称:freshplayerplugin,代码行数:47,代码来源:ppb_flash_menu.c

示例15: termit_on_switch_page

void termit_on_switch_page(GtkNotebook *notebook, gpointer arg, guint page, gpointer user_data)
{
    TERMIT_GET_TAB_BY_INDEX(pTab, page);
    TRACE("%s page=%d vte=%p", __FUNCTION__, page, pTab->vte);
    // it seems that set_active eventually calls toggle callback
    /*((GtkCheckMenuItem*)termit.mi_show_scrollbar)->active = pTab->scrollbar_is_shown;*/
    gpointer pHandlerId = g_object_get_data(G_OBJECT(termit.mi_show_scrollbar), "handlerId");
    if (pHandlerId) {
        g_signal_handler_disconnect(G_OBJECT(termit.mi_show_scrollbar), *((gulong*)pHandlerId));
    }
    gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(termit.mi_show_scrollbar), pTab->scrollbar_is_shown);
    termit_set_show_scrollbar_signal(termit.mi_show_scrollbar, pHandlerId);

    termit_set_statusbar_message(page);
    if (configs.allow_changing_title)
        termit_set_window_title(pTab->title);
}
开发者ID:juanmasg,项目名称:termit,代码行数:17,代码来源:callbacks.c


注:本文中的GTK_CHECK_MENU_ITEM函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。