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


C++ GTK_OPTION_MENU函数代码示例

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


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

示例1: on_romaji_theme_menu_changed

static void
on_romaji_theme_menu_changed (GtkOptionMenu *omenu, gpointer user_data)
{
    bool success;

    if (__widget_romaji_theme_menu != GTK_WIDGET (omenu)) {
        g_signal_handlers_block_by_func (
            G_OBJECT (__widget_romaji_theme_menu),
            (gpointer) (on_romaji_theme_menu_changed),
            NULL);
        gtk_option_menu_set_history (
            GTK_OPTION_MENU (__widget_romaji_theme_menu),
            gtk_option_menu_get_history (omenu));
        g_signal_handlers_unblock_by_func (
            G_OBJECT (__widget_romaji_theme_menu),
            (gpointer) (on_romaji_theme_menu_changed),
            NULL);

        success = load_romaji_theme ();

        setup_romaji_window_value (SCIM_ANTHY_TABLE_EDITOR (user_data));
    } else {
        success = load_romaji_theme ();
    }

    if (success) {
        // sync widgets
        __style_changed  = true;
        __config_changed = true;
    }
}
开发者ID:tzhuan,项目名称:scim-anthy,代码行数:31,代码来源:scim_anthy_setup_romaji.cpp

示例2: sp_fill_style_widget_new

GtkWidget *
sp_fill_style_widget_new (void)
{
	GtkWidget *spw, *vb, *psel, *hb, *l, *om, *m, *mi;

	spw = sp_widget_new_global (INKSCAPE);

	vb = gtk_vbox_new (FALSE, 0);
	gtk_widget_show (vb);
	gtk_container_add (GTK_CONTAINER (spw), vb);

	psel = sp_paint_selector_new ();
	gtk_widget_show (psel);
	gtk_box_pack_start (GTK_BOX (vb), psel, TRUE, TRUE, 0);
	g_object_set_data (G_OBJECT (spw), "paint-selector", psel);

	g_signal_connect (G_OBJECT (psel), "mode_changed", G_CALLBACK (sp_fill_style_widget_paint_mode_changed), spw);
	g_signal_connect (G_OBJECT (psel), "dragged", G_CALLBACK (sp_fill_style_widget_paint_dragged), spw);
	g_signal_connect (G_OBJECT (psel), "changed", G_CALLBACK (sp_fill_style_widget_paint_changed), spw);

	hb = gtk_hbox_new (FALSE, 4);
	gtk_widget_show (hb);
	gtk_box_pack_start (GTK_BOX (vb), hb, FALSE, FALSE, 0);

	l = gtk_label_new (_("Fill Rule"));
	gtk_widget_show (l);
	gtk_misc_set_alignment (GTK_MISC (l), 1.0, 0.5);
	gtk_box_pack_start (GTK_BOX (hb), l, TRUE, TRUE, 0);

	om = gtk_option_menu_new ();
	gtk_widget_show (om);
	gtk_box_pack_start (GTK_BOX (hb), om, FALSE, FALSE, 0);
	g_object_set_data (G_OBJECT (spw), "fill-rule", om);

	/* 0 - nonzero 1 - evenodd */
	m = gtk_menu_new ();
	gtk_widget_show (m);

	mi = gtk_menu_item_new_with_label (_("nonzero"));
	gtk_widget_show (mi);
	gtk_menu_append (GTK_MENU (m), mi);
	g_object_set_data (G_OBJECT (mi), "fill-rule", (void *)"nonzero");
	g_signal_connect (G_OBJECT (mi), "activate", G_CALLBACK (sp_fill_style_widget_fill_rule_activate), spw);
	mi = gtk_menu_item_new_with_label (_("evenodd"));
	gtk_widget_show (mi);
	gtk_menu_append (GTK_MENU (m), mi);
	g_object_set_data (G_OBJECT (mi), "fill-rule", (void *)"evenodd");
	g_signal_connect (G_OBJECT (mi), "activate", G_CALLBACK (sp_fill_style_widget_fill_rule_activate), spw);

	gtk_option_menu_set_menu (GTK_OPTION_MENU (om), m);

	g_signal_connect (G_OBJECT (spw), "construct", G_CALLBACK (sp_fill_style_widget_construct), psel);
	g_signal_connect (G_OBJECT (spw), "modify_selection", G_CALLBACK (sp_fill_style_widget_modify_selection), psel);
	g_signal_connect (G_OBJECT (spw), "change_selection", G_CALLBACK (sp_fill_style_widget_change_selection), psel);
	g_signal_connect (G_OBJECT (spw), "attr_changed", G_CALLBACK (sp_fill_style_widget_attr_changed), psel);

	sp_fill_style_widget_update (SP_WIDGET (spw), SP_ACTIVE_DESKTOP ? SP_DT_SELECTION (SP_ACTIVE_DESKTOP) : NULL);

	return spw;
}
开发者ID:benjohnson2001,项目名称:base,代码行数:60,代码来源:fill-style.c

示例3: ACDProcCopy4to8

void ACDProcCopy4to8(bool cw)
{
  GtkWidget *opt = cw ? optAC2 : optAC3;

  GtkWidget *menu, *active_item;
  menu = GTK_OPTION_MENU(opt)->menu;
  active_item = gtk_menu_get_active(GTK_MENU(menu));
  int noact = g_list_index(GTK_MENU_SHELL(menu)->children, active_item);
  int numact = actor->GetNumAction() - noact * 8;
  if (numact < 8) {
    GtkWidget *mes;
    mes = gtk_message_dialog_new(GTK_WINDOW(window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR,
            GTK_BUTTONS_OK, _("This act doesn't have 8 actions."));
    gtk_dialog_run(GTK_DIALOG(mes));
    gtk_widget_destroy(mes);
    return;
  }

  int baseact = noact * 8;
  for (int i=0; i<4; i++) {
    if (cw) {
      actor->CopyAction(baseact+i*2+1, baseact+i*2);
    } else {
      actor->CopyAction(baseact+i*2, baseact+i*2+1);
    }
  }
}
开发者ID:CairoLee,项目名称:Ragnarok.Tools,代码行数:27,代码来源:act_copy.cpp

示例4: add_menuitem_to_source

static void
add_menuitem_to_source (GtkWidget * widget,
			GbWriteMenuItemSourceData * write_data)
{
  gchar *label_text;
  GtkWidget *menuitem, *child = GTK_BIN (widget)->child;

  menuitem = GTK_OPTION_MENU (write_data->option_menu)->menu_item;
  if (child == NULL && menuitem == widget)
    {
      child = GTK_BUTTON (write_data->option_menu)->child;
      write_data->selected_index = write_data->index;
    }

  if (child && GTK_IS_LABEL (child))
    {
      gtk_label_get (GTK_LABEL (child), &label_text);

      source_add (write_data->data,
		  "  glade_menuitem = gtk_menu_item_new_with_label (%s);\n"
		  "  gtk_widget_show (glade_menuitem);\n"
		  "  gtk_menu_append (GTK_MENU (%s_menu), glade_menuitem);\n",
		  source_make_string (label_text,
				      write_data->data->use_gettext),
		  write_data->data->real_wname);
    }

  write_data->index++;
}
开发者ID:cooljeanius,项目名称:glade0-0.6.4,代码行数:29,代码来源:gboptionmenu.c

示例5: get_requested_time

static time_t
get_requested_time (DialogData *data, 
		    const char *filename)
{
	int idx  = gtk_option_menu_get_history (GTK_OPTION_MENU (data->date_optionmenu));
	time_t t = (time_t)0;

	switch (idx) {
	case NO_DATE:
		break;
	case FOLLOWING_DATE:
		t = gnome_date_edit_get_time (GNOME_DATE_EDIT (data->date_dateedit));
		break;
	case CURRENT_DATE:
		t = time (NULL);
		break;
	case EXIF_DATE:
		t = get_metadata_time (NULL, filename);
		break;
	case LAST_MODIFIED_DATE:
		t = get_file_mtime (filename);
		break;
	case IMAGE_CREATION_DATE:
		t = get_file_ctime (filename);
		break;
	}

	return t;
}
开发者ID:ChingezKhan,项目名称:gthumb,代码行数:29,代码来源:dlg-comment.c

示例6: load_romaji_theme

static bool
load_romaji_theme (void)
{
    GtkOptionMenu *omenu = GTK_OPTION_MENU (__widget_romaji_theme_menu);
    gint idx = gtk_option_menu_get_history (omenu);
    GtkWidget *menu = gtk_option_menu_get_menu (omenu);
    GList *list = gtk_container_get_children (GTK_CONTAINER (menu));
    GtkWidget *menuitem = GTK_WIDGET (g_list_nth_data (list, idx));

    if (!menuitem)
        return false;

    gint theme_idx = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (menuitem),
                                                         INDEX_KEY));

    // set new romaji table
    if (idx == ROMAJI_THEME_INDEX_USER_DEFINED) {
        // User defined table
        __config_romaji_theme_file = __user_style_file.get_file_name ();
        StyleLines lines;
        bool success = __user_style_file.get_entry_list
                           (lines, __romaji_fund_table);
        if (!success || lines.empty ())
            setup_default_romaji_table ();

        return true;

    } else if (idx == ROMAJI_THEME_INDEX_DEFAULT) {
        // Default table
        __config_romaji_theme_file = "";
        setup_default_romaji_table ();

        return true;

    } else if (theme_idx >= 0 && theme_idx < (int) __style_list.size ()) {
        // Tables defined in system theme files
        __config_romaji_theme_file = __style_list[theme_idx].get_file_name ();
        __user_style_file.delete_section (__romaji_fund_table);

        std::vector<String> keys;
        bool success = __style_list[theme_idx].get_key_list
                           (keys, __romaji_fund_table);
        if (success) {
            std::vector<String>::iterator it;
            for (it = keys.begin (); it != keys.end (); it++) {
                std::vector<WideString> value;
                __style_list[theme_idx].get_string_array
                    (value, __romaji_fund_table, *it);
                __user_style_file.set_string_array (__romaji_fund_table,
                                                    *it, value);
            }
        }
        return true;

    } else {
        // error
        return false;
    }
}
开发者ID:tzhuan,项目名称:scim-anthy,代码行数:59,代码来源:scim_anthy_setup_romaji.cpp

示例7: util_option_fwd_cb

static void
util_option_fwd_cb(GtkOptionMenu * opt_menu, gpointer callback)
{
	((util_option_changed_cb)callback)(
		gtk_option_menu_get_history(GTK_OPTION_MENU(opt_menu)),
		g_object_get_data(G_OBJECT(opt_menu), "changed_userdata")
	);
}
开发者ID:razzmatazz,项目名称:quickchat-and-vypress-chat-code,代码行数:8,代码来源:gui_misc.c

示例8: change_toolbar_style

static void
change_toolbar_style (GtkWidget *option_menu, GtkWidget *toolbar)
{
  GtkToolbarStyle style;

  style = gtk_option_menu_get_history (GTK_OPTION_MENU (option_menu));
  gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), style);
}
开发者ID:Aridna,项目名称:gtk2,代码行数:8,代码来源:testtoolbar.c

示例9: gtk_option_menu_get_history

void KeyOptionView::onValueChange() {
	if (!myCurrentKey.empty()) {
		((ZLKeyOptionEntry*)myOption)->onValueChange(
			myCurrentKey,
			gtk_option_menu_get_history(GTK_OPTION_MENU(myComboBox))
		);
	}
}
开发者ID:xufooo,项目名称:fbreader-e2-test,代码行数:8,代码来源:GtkOptionView.cpp

示例10: comments_load

static void
comments_load(JamView *view) {
	LJCommentsType type = jam_doc_get_comments(view->doc);
	if (type != LJ_COMMENTS_DEFAULT)
		show_meta(view, JAM_VIEW_COMMENTS);
	if (comments_visible(view))
		gtk_option_menu_set_history(GTK_OPTION_MENU(view->comments), type);
}
开发者ID:nightmorph,项目名称:LogJam,代码行数:8,代码来源:jamview.c

示例11: sp_fill_style_widget_update_repr

static void
sp_fill_style_widget_update_repr (SPWidget *spw, SPRepr *repr)
{
	SPPaintSelector *psel;
	GtkWidget *fillrule;
	SPPaintSelectorMode pselmode;
	SPStyle *style;
	gfloat c[5];

	if (g_object_get_data (G_OBJECT (spw), "update")) return;

	g_object_set_data (G_OBJECT (spw), "update", GINT_TO_POINTER (TRUE));

#ifdef SP_FS_VERBOSE
	g_print ("FillStyleWidget: Set update flag\n");
#endif
	psel = SP_PAINT_SELECTOR(g_object_get_data (G_OBJECT (spw), "paint-selector"));

	style = sp_style_new ();
	sp_style_read_from_repr (style, repr);

	pselmode = sp_fill_style_determine_paint_selector_mode (style);
#ifdef SP_FS_VERBOSE
	g_print ("FillStyleWidget: paint selector mode %d\n", pselmode);
#endif
	switch (pselmode) {
	case SP_PAINT_SELECTOR_MODE_NONE:
		/* No paint at all */
		sp_paint_selector_set_mode (psel, SP_PAINT_SELECTOR_MODE_NONE);
		break;
	case SP_PAINT_SELECTOR_MODE_COLOR_RGB:
		sp_paint_selector_set_mode (psel, SP_PAINT_SELECTOR_MODE_COLOR_RGB);
		sp_color_get_rgb_floatv (&style->fill.value.color, c);
		c[3] = SP_SCALE24_TO_FLOAT (style->fill_opacity.value);
		sp_paint_selector_set_color_rgba_floatv (psel, c);
		break;
	case SP_PAINT_SELECTOR_MODE_COLOR_CMYK:
		sp_paint_selector_set_mode (psel, SP_PAINT_SELECTOR_MODE_COLOR_CMYK);
		sp_color_get_cmyk_floatv (&style->fill.value.color, c);
		c[4] = SP_SCALE24_TO_FLOAT (style->fill_opacity.value);
		sp_paint_selector_set_color_cmyka_floatv (psel, c);
		break;
	case SP_PAINT_SELECTOR_MODE_GRADIENT_LINEAR:
		break;
	default:
		break;
	}

	fillrule = GTK_WIDGET(g_object_get_data (G_OBJECT (spw), "fill-rule"));
	gtk_option_menu_set_history (GTK_OPTION_MENU (fillrule), (style->fill_rule.computed == ART_WIND_RULE_NONZERO) ? 0 : 1);

	sp_style_unref (style);

	g_object_set_data (G_OBJECT (spw), "update", GINT_TO_POINTER (FALSE));
#ifdef SP_FS_VERBOSE
	g_print ("FillStyleWidget: Cleared update flag\n");
#endif
}
开发者ID:benjohnson2001,项目名称:base,代码行数:58,代码来源:fill-style.c

示例12: command_make

static GtkWidget*
command_make(SettingsWidget *sw) {
    CommandList *cmds = sw->data;
    GtkWidget *vbox, *menu;
    GtkSizeGroup *sg;
    char *cmd = *((char**)sw->conf);
    int cur = -1;
    int i;

    menu = gtk_menu_new();
    for (i = 0; cmds[i].label; i++) {
        char *curcmd = cmds[i].command;
        gtk_menu_shell_append(GTK_MENU_SHELL(menu),
                              gtk_menu_item_new_with_label(_(cmds[i].label)));
        if (cur == -1 &&
                ((cmd == curcmd) ||
                 (cmd && curcmd && (strcmp(cmd, curcmd) == 0))))
            cur = i;
    }
    gtk_menu_shell_append(GTK_MENU_SHELL(menu),
                          gtk_menu_item_new_with_label(_("Custom Command")));
    if (cur == -1) cur = i;

    sw->widget = gtk_option_menu_new();
    gtk_option_menu_set_menu(GTK_OPTION_MENU(sw->widget), menu);
    gtk_option_menu_set_history(GTK_OPTION_MENU(sw->widget), cur);

    sw->subwidget = gtk_entry_new();
    tie_text(GTK_ENTRY(sw->subwidget), (char**)sw->conf);

    g_signal_connect(G_OBJECT(sw->widget), "changed",
                     G_CALLBACK(command_changed_cb), sw);
    jam_widget_set_visible(sw->subwidget, cur == i);

    sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
    vbox = gtk_vbox_new(FALSE, 3);
    gtk_box_pack_start(GTK_BOX(vbox),
                       labelled_box_new_sg(_(sw->caption), sw->widget, sg),
                       FALSE, FALSE, 0);
    sw->data2 = labelled_box_new_sg(NULL, sw->subwidget, sg);  /* ugh. */
    gtk_box_pack_start(GTK_BOX(vbox),
                       sw->data2,
                       FALSE, FALSE, 0);
    return vbox;
}
开发者ID:nightmorph,项目名称:LogJam,代码行数:45,代码来源:settings.c

示例13: export_html_fill_fields

/**
 * Populate fields from control data.
 * \param ctl Export control data.
 */
static void export_html_fill_fields( ExportHtmlCtl *ctl ) {
	gtk_entry_set_text( GTK_ENTRY(exphtml_dlg.entryHtml), "" );
	if( ctl->path ) {
		gtk_entry_set_text( GTK_ENTRY(exphtml_dlg.entryHtml),
			ctl->path );
	}

	gtk_option_menu_set_history(
		GTK_OPTION_MENU( exphtml_dlg.optmenuCSS ), ctl->stylesheet );
	gtk_option_menu_set_history(
		GTK_OPTION_MENU( exphtml_dlg.optmenuName ), ctl->nameFormat );
	gtk_toggle_button_set_active(
		GTK_TOGGLE_BUTTON( exphtml_dlg.checkBanding ), ctl->banding );
	gtk_toggle_button_set_active(
		GTK_TOGGLE_BUTTON( exphtml_dlg.checkLinkEMail ), ctl->linkEMail );
	gtk_toggle_button_set_active(
		GTK_TOGGLE_BUTTON( exphtml_dlg.checkAttributes ), ctl->showAttribs );
}
开发者ID:moreorless,项目名称:claws-mail,代码行数:22,代码来源:exphtmldlg.c

示例14: select_polsarpro_classification_lut

void select_polsarpro_classification_lut(const char *lut_basename)
{
  int which = GPOINTER_TO_INT(
                  g_hash_table_lookup(g_polsarpro_classification_optionmenu_ht,
                                      lut_basename));
  GtkWidget *option_menu;
  option_menu = get_widget_checked("browse_select_colormap_optionmenu");
  gtk_option_menu_set_history(GTK_OPTION_MENU(option_menu), which);
}
开发者ID:DavinSimmons,项目名称:ASF_MapReady,代码行数:9,代码来源:asf_convert_gui.c

示例15: menu_select_cb

int
menu_select_cb(GtkMenuItem * menuitem, GtkWidget * menu)
{
    const char *label = menuitem_get_label(menuitem);

//      printf( "menuitem = %s(%p), menu = %s(%p)\n", G_OBJECT_TYPE_NAME(menuitem), menuitem, G_OBJECT_TYPE_NAME(menu), menu );

    if(label[0] == '<')
    {
        GtkWidget *selection = menu_get_first_menuitem(GTK_MENU(menu));
        gtk_widget_hide(selection);
    }
    else
    {
        char *str = g_strdup(label);

        GtkWidget *parent;

        for (;;)
        {
            GtkMenuItem *parentitem;
            const char *label2;
            char *temp;

            parent = gtk_widget_get_parent(GTK_WIDGET(menuitem));
//                      printf( "parent = %s(%p)\n", G_OBJECT_TYPE_NAME(parent), parent);
            if(menu == parent)
                break;

            parentitem = GTK_MENU_ITEM(gtk_menu_get_attach_widget(GTK_MENU(parent)));
//                      printf( "parentitem = %s(%p)\n", G_OBJECT_TYPE_NAME(parentitem), parentitem);
            label2 = menuitem_get_label(parentitem);
            if(strcmp(label2, MORE_STRING) != 0)
            {
                temp = g_strconcat(label2, "/", str, NULL);
                g_free(str);
                str = temp;
            }

            menuitem = parentitem;
        }
        {
            GtkLabel *label;

            GtkWidget *selection = menu_get_first_menuitem(GTK_MENU(menu));
            GtkOptionMenu *optionmenu = GTK_OPTION_MENU(gtk_menu_get_attach_widget(GTK_MENU(menu)));

            label = GTK_LABEL(gtk_bin_get_child(GTK_BIN(selection)));

            gtk_label_set_text(label, str);
            gtk_widget_show(GTK_WIDGET(selection));
            gtk_option_menu_set_history(optionmenu, 0);
            g_free(str);
        }
    }
    return 0;
}
开发者ID:Javran,项目名称:purple-plugin-pack,代码行数:57,代码来源:gtktimezonetest.c


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