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


C++ GTK_BIN函数代码示例

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


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

示例1: switch

bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
{
    wxToolBarTool* tool = static_cast<wxToolBarTool*>(toolBase);

    GSList* radioGroup;
    switch ( tool->GetStyle() )
    {
        case wxTOOL_STYLE_BUTTON:
            switch (tool->GetKind())
            {
                case wxITEM_CHECK:
                    tool->m_item = gtk_toggle_tool_button_new();
                    g_signal_connect(tool->m_item, "toggled",
                        G_CALLBACK(item_toggled), tool);
                    break;
                case wxITEM_RADIO:
                    radioGroup = GetRadioGroup(pos);
                    if (radioGroup)
                    {
                        // this is the first button in the radio button group,
                        // it will be toggled automatically by GTK so bring the
                        // internal flag in sync
                        tool->Toggle(true);
                    }
                    tool->m_item = gtk_radio_tool_button_new(radioGroup);
                    g_signal_connect(tool->m_item, "toggled",
                        G_CALLBACK(item_toggled), tool);
                    break;
                default:
                    wxFAIL_MSG("unknown toolbar child type");
                    // fall through
                case wxITEM_DROPDOWN:
                case wxITEM_NORMAL:
                    tool->m_item = gtk_tool_button_new(NULL, "");
                    g_signal_connect(tool->m_item, "clicked",
                        G_CALLBACK(item_clicked), tool);
                    break;
            }
            if (!HasFlag(wxTB_NOICONS))
            {
                GtkWidget* image = gtk_image_new();
                gtk_tool_button_set_icon_widget(
                    GTK_TOOL_BUTTON(tool->m_item), image);
                tool->SetImage();
                gtk_widget_show(image);
                g_signal_connect(image, "expose_event",
                    G_CALLBACK(image_expose_event), tool);
            }
            if (!tool->GetLabel().empty())
            {
                gtk_tool_button_set_label(
                    GTK_TOOL_BUTTON(tool->m_item), wxGTK_CONV(tool->GetLabel()));
                // needed for labels in horizontal toolbar with wxTB_HORZ_LAYOUT
                gtk_tool_item_set_is_important(tool->m_item, true);
            }
            if (!HasFlag(wxTB_NO_TOOLTIPS) && !tool->GetShortHelp().empty())
            {
                gtk_tool_item_set_tooltip(tool->m_item,
                    m_tooltips, wxGTK_CONV(tool->GetShortHelp()), "");
            }
            g_signal_connect(GTK_BIN(tool->m_item)->child, "button_press_event",
                G_CALLBACK(button_press_event), tool);
            g_signal_connect(tool->m_item, "enter_notify_event",
                G_CALLBACK(enter_notify_event), tool);
            g_signal_connect(tool->m_item, "leave_notify_event",
                G_CALLBACK(enter_notify_event), tool);

            if (tool->GetKind() == wxITEM_DROPDOWN)
                tool->CreateDropDown();
            gtk_toolbar_insert(m_toolbar, tool->m_item, int(pos));
            break;

        case wxTOOL_STYLE_SEPARATOR:
            tool->m_item = gtk_separator_tool_item_new();
            if ( tool->IsStretchable() )
            {
                gtk_separator_tool_item_set_draw
                (
                    GTK_SEPARATOR_TOOL_ITEM(tool->m_item),
                    FALSE
                );
                gtk_tool_item_set_expand(tool->m_item, TRUE);
            }
            gtk_toolbar_insert(m_toolbar, tool->m_item, int(pos));
            break;

        case wxTOOL_STYLE_CONTROL:
            wxWindow* control = tool->GetControl();
            if (control->m_widget->parent == NULL)
                AddChildGTK(control);
            tool->m_item = GTK_TOOL_ITEM(control->m_widget->parent->parent);
            if (gtk_toolbar_get_item_index(m_toolbar, tool->m_item) != int(pos))
            {
                g_object_ref(tool->m_item);
                gtk_container_remove(
                    GTK_CONTAINER(m_toolbar), GTK_WIDGET(tool->m_item));
                gtk_toolbar_insert(m_toolbar, tool->m_item, int(pos));
                g_object_unref(tool->m_item);
            }
            // Inserted items "slide" into place using an animated effect that
//.........这里部分代码省略.........
开发者ID:BloodRedd,项目名称:gamekit,代码行数:101,代码来源:toolbar.cpp

示例2: spamassassin_create_widget_func


//.........这里部分代码省略.........
	SET_TOGGLE_SENSITIVITY(enable_sa_checkbtn, frame_transport);
	SET_TOGGLE_SENSITIVITY(enable_sa_checkbtn, hbox_max_size);
	SET_TOGGLE_SENSITIVITY(enable_sa_checkbtn, hbox_timeout);
	SET_TOGGLE_SENSITIVITY(enable_sa_checkbtn, hbox_save_spam);
	SET_TOGGLE_SENSITIVITY(save_spam_checkbtn, save_spam_folder_entry);
	SET_TOGGLE_SENSITIVITY(save_spam_checkbtn, save_spam_folder_select);
	SET_TOGGLE_SENSITIVITY(enable_sa_checkbtn, hbox_process_emails);
	SET_TOGGLE_SENSITIVITY(save_spam_checkbtn, mark_as_read_checkbtn);
	SET_TOGGLE_SENSITIVITY(whitelist_ab_checkbtn, whitelist_ab_folder_combo);
#ifndef USE_ALT_ADDRBOOK
	SET_TOGGLE_SENSITIVITY(whitelist_ab_checkbtn, whitelist_ab_select_btn);
#endif
	config = spamassassin_get_config();

	g_signal_connect(G_OBJECT(save_spam_folder_select), "clicked",
			G_CALLBACK(foldersel_cb), page);
#ifndef USE_ALT_ADDRBOOK
	g_signal_connect(G_OBJECT (whitelist_ab_select_btn), "clicked",
			 G_CALLBACK(spamassassin_whitelist_ab_select_cb), page);
#else
	gtk_widget_set_sensitive(GTK_WIDGET(whitelist_ab_select_btn), FALSE);
#endif

	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(enable_sa_checkbtn), config->enable);
	if (config->username != NULL)
		gtk_entry_set_text(GTK_ENTRY(user_entry), config->username);
	if (config->hostname != NULL)
		gtk_entry_set_text(GTK_ENTRY(spamd_hostname_entry), config->hostname);
	if (config->socket != NULL)
		gtk_entry_set_text(GTK_ENTRY(spamd_socket_entry), config->socket);
	if (config->whitelist_ab_folder != NULL) {
		/* translate "Any" (stored UNtranslated) */
		if (strcasecmp(config->whitelist_ab_folder, "Any") == 0)
			gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN((whitelist_ab_folder_combo)))),
					config->whitelist_ab_folder);
		else
		/* backward compatibility (when translated "Any" was stored) */
		if (g_utf8_collate(config->whitelist_ab_folder, _("Any")) == 0)
			gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN((whitelist_ab_folder_combo)))),
					config->whitelist_ab_folder);
		else
			gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN((whitelist_ab_folder_combo)))),
					config->whitelist_ab_folder);
	}
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(spamd_port_spinbtn), (float) config->port);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(max_size_spinbtn), (float) config->max_size);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(timeout_spinbtn), (float) config->timeout);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(process_emails_checkbtn), config->process_emails);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(save_spam_checkbtn), config->receive_spam);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(whitelist_ab_checkbtn), config->whitelist_ab);
	if (config->save_folder != NULL)
		gtk_entry_set_text(GTK_ENTRY(save_spam_folder_entry), config->save_folder);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mark_as_read_checkbtn), config->mark_as_read);

	page->enable_sa_checkbtn = enable_sa_checkbtn;
	page->transport_label = transport_label;
	page->transport_optmenu = transport_optmenu;
	page->username = user_entry;
	page->hostname = spamd_hostname_entry;
	page->colon = spamd_colon_label;
	page->port = spamd_port_spinbtn;
	page->socket = spamd_socket_entry;
	page->max_size = max_size_spinbtn;
	page->timeout = timeout_spinbtn;
	page->process_emails = process_emails_checkbtn;
	page->receive_spam = save_spam_checkbtn;
开发者ID:twolife,项目名称:claws,代码行数:67,代码来源:spamassassin_gtk.c

示例3: _camera_import_dialog_new

static void _camera_import_dialog_new(_camera_import_dialog_t *data)
{
  data->dialog = gtk_dialog_new_with_buttons(_("import images from camera"), NULL, GTK_DIALOG_MODAL,
                                             _("cancel"), GTK_RESPONSE_NONE, C_("camera import", "import"),
                                             GTK_RESPONSE_ACCEPT, NULL);
  gtk_window_set_default_size(GTK_WINDOW(data->dialog), 100, 600);
  gtk_window_set_transient_for(GTK_WINDOW(data->dialog), GTK_WINDOW(dt_ui_main_window(darktable.gui->ui)));
  GtkWidget *content = gtk_dialog_get_content_area(GTK_DIALOG(data->dialog));

  // List - setup store
  data->store = gtk_list_store_new(2, GDK_TYPE_PIXBUF, G_TYPE_STRING);

  // IMPORT PAGE
  data->import.page = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
  gtk_container_set_border_width(GTK_CONTAINER(data->import.page), 5);

  // Top info
  data->import.info = gtk_label_new(_("please wait while prefetching thumbnails of images from camera..."));
  gtk_label_set_single_line_mode(GTK_LABEL(data->import.info), FALSE);
  gtk_widget_set_halign(data->import.info, GTK_ALIGN_START);
  gtk_box_pack_start(GTK_BOX(data->import.page), data->import.info, FALSE, FALSE, 0);

  // jobcode
  data->import.jobname
      = _camera_import_gconf_widget(data, _("jobcode"), "plugins/capture/camera/import/jobcode");
  gtk_box_pack_start(GTK_BOX(data->import.page), GTK_WIDGET(data->import.jobname->widget), FALSE, FALSE, 0);


  // Create the treview with list model data store
  data->import.treeview = gtk_scrolled_window_new(NULL, NULL);
  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(data->import.treeview), GTK_POLICY_NEVER,
                                 GTK_POLICY_ALWAYS);

  gtk_container_add(GTK_CONTAINER(data->import.treeview), gtk_tree_view_new());
  GtkTreeView *treeview = GTK_TREE_VIEW(gtk_bin_get_child(GTK_BIN(data->import.treeview)));

  GtkCellRenderer *renderer = gtk_cell_renderer_pixbuf_new();
  GtkTreeViewColumn *column
      = gtk_tree_view_column_new_with_attributes(_("thumbnail"), renderer, "pixbuf", 0, (char *)NULL);
  gtk_tree_view_append_column(treeview, column);

  renderer = gtk_cell_renderer_text_new();
  column = gtk_tree_view_column_new_with_attributes(_("storage file"), renderer, "text", 1, (char *)NULL);
  gtk_tree_view_append_column(treeview, column);
  gtk_tree_view_column_set_expand(column, TRUE);


  GtkTreeSelection *selection = gtk_tree_view_get_selection(treeview);
  gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);

  gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(data->store));
  gtk_tree_view_set_headers_visible(treeview, FALSE);

  gtk_box_pack_start(GTK_BOX(data->import.page), data->import.treeview, TRUE, TRUE, 0);


  // SETTINGS PAGE
  data->settings.page = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
  gtk_container_set_border_width(GTK_CONTAINER(data->settings.page), 5);

  // general settings
  gtk_box_pack_start(GTK_BOX(data->settings.page), gtk_label_new(_("general")), FALSE, FALSE, 0);

  // ignoring of jpegs. hack while we don't handle raw+jpeg in the same directories.
  data->settings.general.ignore_jpeg = gtk_check_button_new_with_label(_("ignore JPEG files"));
  gtk_widget_set_tooltip_text(data->settings.general.ignore_jpeg,
               _("do not load files with an extension of .jpg or .jpeg. this can be useful when there are "
                 "raw+JPEG in a directory."));
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data->settings.general.ignore_jpeg),
                               dt_conf_get_bool("ui_last/import_ignore_jpegs"));
  gtk_box_pack_start(GTK_BOX(data->settings.page), data->settings.general.ignore_jpeg, FALSE, FALSE, 0);
  g_signal_connect(G_OBJECT(data->settings.general.ignore_jpeg), "clicked",
                   G_CALLBACK(_check_button_callback), data);

  GtkWidget *hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
  data->settings.general.date_override = gtk_check_button_new_with_label(_("override today's date"));
  gtk_box_pack_start(GTK_BOX(hbox), data->settings.general.date_override, FALSE, FALSE, 0);
  gtk_widget_set_tooltip_text(data->settings.general.date_override,
               _("check this, if you want to override the timestamp used when expanding variables:\n$(YEAR), "
                 "$(MONTH), $(DAY),\n$(HOUR), $(MINUTE), $(SECONDS)"));

  data->settings.general.date_entry = gtk_entry_new();
  gtk_widget_set_sensitive(data->settings.general.date_entry, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
                                                                  data->settings.general.date_override)));
  gtk_box_pack_start(GTK_BOX(hbox), data->settings.general.date_entry, TRUE, TRUE, 0);

  g_signal_connect(G_OBJECT(data->settings.general.date_override), "clicked",
                   G_CALLBACK(_check_button_callback), data);

  gtk_box_pack_start(GTK_BOX(data->settings.page), hbox, FALSE, FALSE, 0);


  // THE NOTEBOOK
  data->notebook = gtk_notebook_new();
  gtk_notebook_append_page(GTK_NOTEBOOK(data->notebook), data->import.page, gtk_label_new(_("images")));
  gtk_notebook_append_page(GTK_NOTEBOOK(data->notebook), data->settings.page, gtk_label_new(_("settings")));

  // end
  gtk_box_pack_start(GTK_BOX(content), data->notebook, TRUE, TRUE, 0);
  // gtk_widget_set_size_request(content, DT_PIXEL_APPLY_DPI(400), DT_PIXEL_APPLY_DPI(400));
//.........这里部分代码省略.........
开发者ID:AdamMajer,项目名称:darktable,代码行数:101,代码来源:camera_import_dialog.c

示例4: zoom_options_init

static void
zoom_options_init (ZoomOptions *self)
{
  ZoomOptionsPrivate *priv;
  GtkWidget *w;
  PangoAttrList *pango_attrs;
  PangoAttribute *attr;
  GError *err = NULL;

  priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, ZOOM_TYPE_OPTIONS, ZoomOptionsPrivate);

  priv->builder = gtk_builder_new ();
  gtk_builder_set_translation_domain (priv->builder, GETTEXT_PACKAGE);
  gtk_builder_add_from_file (priv->builder,
                             SAGARMATHACC_UI_DIR "/zoom-options.ui",
                             &err);
  if (err)
    {
      g_warning ("Could not load interface file: %s", err->message);
      g_error_free (err);

      g_object_unref (priv->builder);
      priv->builder = NULL;

      return;
    }

  priv->settings = g_settings_new ("org.sagarmatha.desktop.a11y.magnifier");
  priv->application_settings = g_settings_new ("org.sagarmatha.desktop.a11y.applications");

  pango_attrs = pango_attr_list_new ();
  attr = pango_attr_scale_new (FONT_SCALE);
  pango_attr_list_insert (pango_attrs, attr);

  /* Zoom switch */
  g_settings_bind (priv->application_settings, "screen-magnifier-enabled",
                   WID ("seeing_zoom_switch"), "active",
                   G_SETTINGS_BIND_DEFAULT);

  /* Magnification factor */
  w = WID ("magFactorSpinButton");
  g_settings_bind (priv->settings, "mag-factor",
                   gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (w)),
                   "value", G_SETTINGS_BIND_DEFAULT);

  /* Screen position combo */
  w = WID ("screen_position_combo_box");
  screen_position_notify_cb (priv->settings, "screen-position", self);
  g_signal_connect (G_OBJECT (priv->settings), "changed::screen-position",
                    G_CALLBACK (screen_position_notify_cb), self);
  g_signal_connect (G_OBJECT (w), "changed",
                    G_CALLBACK (screen_position_combo_changed_cb), self);

  /* Screen part section */
  init_screen_part_section (priv, pango_attrs);

  /* Cross hairs: show/hide ... */
  w = WID ("xhairsEnabledSwitch");
  g_settings_bind (priv->settings, "show-cross-hairs", w, "active",
                   G_SETTINGS_BIND_DEFAULT);

  /* ... Cross hairs: color and opacity */
  w = WID ("xHairsPicker");
  init_xhairs_color_opacity (GTK_COLOR_BUTTON (w), priv->settings);
  g_signal_connect (G_OBJECT (priv->settings), "changed::cross-hairs-color",
                    G_CALLBACK (xhairs_color_notify_cb), w);
  g_signal_connect (G_OBJECT (priv->settings), "changed::cross-hairs-opacity",
                    G_CALLBACK (xhairs_opacity_notify_cb), w);
  g_signal_connect (G_OBJECT (w), "color-set",
                    G_CALLBACK (xhairs_color_opacity_changed),
                    priv);

  /* ... Cross hairs: thickness ... */
  w = WID ("xHairsThicknessSlider");
  g_settings_bind (priv->settings, "cross-hairs-thickness",
                   gtk_range_get_adjustment (GTK_RANGE (w)), "value",
                   G_SETTINGS_BIND_DEFAULT);

  /* ... Cross hairs: clip ... */
  w = WID ("xHairsClipCheckbox");
  scale_label (GTK_BIN(w), pango_attrs);
  g_settings_bind (priv->settings, "cross-hairs-clip", w, "active",
                   G_SETTINGS_BIND_INVERT_BOOLEAN);

  /* ... Cross hairs: length ... */
  w = WID ("xHairsLengthSlider");
  xhairs_length_add_marks (GTK_SCALE (w));
  g_settings_bind (priv->settings, "cross-hairs-length",
                   gtk_range_get_adjustment (GTK_RANGE (w)), "value",
                   G_SETTINGS_BIND_DEFAULT);

  /* ... Color effects ... */
  w = WID ("inverseEnabledSwitch");
  g_settings_bind (priv->settings, "invert-lightness", w, "active",
                   G_SETTINGS_BIND_DEFAULT);

  w = WID ("brightnessSlider");
  priv->brightness_slider = w;
  init_effects_slider (GTK_RANGE(w), priv, brightness_keys,
                       G_CALLBACK (brightness_slider_notify_cb));
//.........这里部分代码省略.........
开发者ID:chitwanix,项目名称:sagarmatha-control-center,代码行数:101,代码来源:zoom-options.c

示例5: uim_cand_win_horizontal_gtk_set_index

void
uim_cand_win_horizontal_gtk_set_index(UIMCandWinHorizontalGtk *horizontal_cwin, gint index)
{
  gint new_page, prev_index;
  UIMCandWinGtk *cwin;

  g_return_if_fail(UIM_IS_CAND_WIN_HORIZONTAL_GTK(horizontal_cwin));
  cwin = UIM_CAND_WIN_GTK(horizontal_cwin);

  prev_index = cwin->candidate_index;
  if (index >= (gint) cwin->nr_candidates)
    cwin->candidate_index = 0;
  else
    cwin->candidate_index = index;

  if (cwin->candidate_index >= 0 && cwin->display_limit)
    new_page = cwin->candidate_index / cwin->display_limit;
  else
    new_page = cwin->page_index;

  if (cwin->page_index != new_page)
    uim_cand_win_gtk_set_page(cwin, new_page);

  if (cwin->candidate_index >= 0) {
    gint pos;
    struct index_button *idxbutton, *prev_selected;
    GtkWidget *label;

    if (cwin->display_limit)
      pos = cwin->candidate_index % cwin->display_limit;
    else
      pos = cwin->candidate_index;

    idxbutton = g_ptr_array_index(horizontal_cwin->buttons, pos);
    prev_selected = (gpointer)horizontal_cwin->selected;
    if (prev_selected && prev_index != cwin->candidate_index) {
      label = gtk_bin_get_child(GTK_BIN(prev_selected->button));
      gtk_widget_queue_draw(label);
    }
    label = gtk_bin_get_child(GTK_BIN(idxbutton->button));
    gtk_widget_queue_draw(label);
    horizontal_cwin->selected = idxbutton;

    /* show subwin */
    if (cwin->stores->pdata[new_page]) {
      char *annotation = NULL;
      GtkTreeModel *model = GTK_TREE_MODEL(cwin->stores->pdata[new_page]);
      GtkTreeIter iter;

      gtk_tree_model_iter_nth_child(model, &iter, NULL, pos);
      gtk_tree_model_get(model, &iter, COLUMN_ANNOTATION, &annotation, -1);

      if (annotation && *annotation) {
	if (!cwin->sub_window.window)
          uim_cand_win_gtk_create_sub_window(cwin);
	gtk_text_buffer_set_text(gtk_text_view_get_buffer(GTK_TEXT_VIEW(cwin->sub_window.text_view)), annotation, -1);
	uim_cand_win_gtk_layout_sub_window(cwin);
	gtk_widget_show(cwin->sub_window.window);
	cwin->sub_window.active = TRUE;
      } else {
        if (cwin->sub_window.window) {
          gtk_widget_hide(cwin->sub_window.window);
          cwin->sub_window.active = FALSE;
	}
      }
      free(annotation);
    }
  } else {
    horizontal_cwin->selected = NULL;
    if (cwin->sub_window.window) {
      gtk_widget_hide(cwin->sub_window.window);
      cwin->sub_window.active = FALSE;
    }
  }

  uim_cand_win_gtk_update_label(cwin);
}
开发者ID:NgoHuy,项目名称:uim,代码行数:77,代码来源:uim-cand-win-horizontal-gtk.c

示例6: gtk_widget_modify_style

void wxButton::DoApplyWidgetStyle(GtkRcStyle *style)
{
    gtk_widget_modify_style(m_widget, style);
    gtk_widget_modify_style(GTK_BIN(m_widget)->child, style);
}
开发者ID:EdgarTx,项目名称:wx,代码行数:5,代码来源:button.cpp

示例7: GTK_EDITABLE

GtkEditable *wxComboBox::GetEditable() const
{
    return GTK_EDITABLE(gtk_bin_get_child(GTK_BIN(m_widget)));
}
开发者ID:vdm113,项目名称:wxWidgets-ICC-patch,代码行数:4,代码来源:combobox.cpp

示例8: set_string_combo

void set_string_combo(SettingItem * item, gchar * s)
{
    gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(item->widget))),s);
}
开发者ID:Jubei-Mitsuyoshi,项目名称:aaa-emerald,代码行数:4,代码来源:themer.c

示例9: prefs_filtering_action_create


//.........这里部分代码省略.........
	gtk_table_attach(GTK_TABLE(table), hbox1, 1, 2, 1, 2, 
			 GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0);

#if !GTK_CHECK_VERSION(2, 24, 0)
	account_combo = gtk_combo_box_new_text ();
#else
	account_combo = gtk_combo_box_text_new ();
#endif
	gtk_size_group_add_widget(size_action, account_combo);

	for (accounts = account_get_list() ; accounts != NULL;
	     accounts = accounts->next) {
		PrefsAccount *ac = (PrefsAccount *)accounts->data;
		gchar *name = g_strdup(ac->account_name);
#if !GTK_CHECK_VERSION(2, 24, 0)
		gtk_combo_box_append_text(GTK_COMBO_BOX(account_combo), (gpointer) name);
#else
		gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(account_combo), (gpointer) name);
#endif
		g_free(name);
	}

	prefs_filtering_action_check_widget_width(account_combo);
	gtk_combo_box_set_active(GTK_COMBO_BOX(account_combo), 0);
	gtk_box_pack_start (GTK_BOX (hbox1), account_combo,
			    FALSE, FALSE, 0);

	/* header */

	header_combo = combobox_text_new(TRUE, "From", "To", "Cc", "Reply-To", "Sender", NULL);
	gtk_size_group_add_widget(size_action, header_combo);
	gtk_box_pack_start (GTK_BOX (hbox1), header_combo,
			    FALSE, FALSE, 0);
	header_entry = gtk_bin_get_child(GTK_BIN((header_combo)));

	/* destination */

	hbox1 = gtk_hbox_new (FALSE, 0);
	gtk_table_attach(GTK_TABLE(table), hbox1, 1, 2, 2, 3, 
			GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0);

	dest_entry = gtk_entry_new ();
	gtk_box_pack_start (GTK_BOX (hbox1), dest_entry, TRUE, TRUE, 0);
	
	score_entry = gtk_spin_button_new_with_range(-1000, 1000, 1);
	gtk_box_pack_start(GTK_BOX(hbox1), score_entry, FALSE, FALSE, 0);
	
#if !GTK_CHECK_VERSION(3, 0, 0)
	color_optmenu = gtk_cmoption_menu_new();
	gtk_size_group_add_widget(size_action, color_optmenu);
	gtk_cmoption_menu_set_menu(GTK_CMOPTION_MENU(color_optmenu),
				 colorlabel_create_color_menu());
	prefs_filtering_action_check_widget_width(color_optmenu);
	gtk_box_pack_start(GTK_BOX(hbox1), color_optmenu, FALSE, FALSE, 0);
#endif

#if !GTK_CHECK_VERSION(2, 24, 0)
	tags_combo = gtk_combo_box_new_text ();
#else
	tags_combo = gtk_combo_box_text_new ();
#endif
	gtk_size_group_add_widget(size_action, tags_combo);

	for (tmp = tags = tags_get_list() ; tmp != NULL;
	     tmp = tmp->next) {
		gchar *name = g_strdup(tags_get_tag(GPOINTER_TO_INT(tmp->data)));
开发者ID:SpOOnman,项目名称:claws,代码行数:67,代码来源:prefs_filtering_action.c

示例10: register_setting

SettingItem * register_setting(GtkWidget * widget, SettingType type, gchar * section, gchar * key)
{
    SettingItem * item;
    item = malloc(sizeof(SettingItem));
    item->type = type;
    item->key = g_strdup(key);
    item->section = g_strdup(section);
    item->widget = widget;
    item->fvalue = g_strdup("");
    SettingList = g_slist_append(SettingList,item);
    switch(item->type)
    {
        case ST_BOOL:
        case ST_SFILE_BOOL:
            g_signal_connect(widget,"toggled",
                    G_CALLBACK(cb_apply_setting),
                    item);
            break;
        case ST_INT:
        case ST_SFILE_INT:
            g_signal_connect(widget,"value-changed",
                    G_CALLBACK(cb_apply_setting),
                    item);
            break;
        case ST_FLOAT:
            g_signal_connect(widget,"value-changed",
                    G_CALLBACK(cb_apply_setting),
                    item);
            break;
        case ST_COLOR:
            g_signal_connect(widget,"color-set",
                    G_CALLBACK(cb_apply_setting),
                    item);
            break;
        case ST_FONT:
            g_signal_connect(widget,"font-set",
                    G_CALLBACK(cb_apply_setting),
                    item);
            break;
        case ST_IMG_FILE:
            g_signal_connect(widget,"selection-changed",
                    G_CALLBACK(cb_apply_setting),
                    item);
            break;
        case ST_STRING_COMBO:
            g_signal_connect(gtk_bin_get_child(GTK_BIN(widget)),"changed",
                    G_CALLBACK(cb_apply_setting),
                    item);
            break;
        case ST_SFILE_INT_COMBO:
            g_signal_connect(widget,"changed",
                    G_CALLBACK(cb_apply_setting),
                    item);
            break;
        case ST_ENGINE_COMBO:
            g_signal_connect(widget,"changed",
                    G_CALLBACK(cb_apply_setting),
                    item);
        default:
            break;
            //unconnected types
    }
    return item;
}
开发者ID:Jubei-Mitsuyoshi,项目名称:aaa-emerald,代码行数:64,代码来源:themer.c

示例11: ms2_output_combo_setup


//.........这里部分代码省略.........
		if (DATA_GET(object,"fromecu_complex"))
			continue;
		if (DATA_GET(object,"special"))
			continue;
		internal_names = (gchar *) DATA_GET(object,"internal_names");
		if (!find_in_list(rtv_map->raw_list,internal_names))
			continue;

		temp_dep = (GBOOLEAN)DATA_GET(object,"temp_dep");
		size = (DataSize)(GINT)DATA_GET(object,"size");
		multiplier = (gfloat *)DATA_GET(object,"fromecu_mult");
		adder = (gfloat *)DATA_GET(object,"fromecu_add");
		precision = (GINT) DATA_GET(object,"precision");
		bitval = (GINT) DATA_GET(object,"offset");
		if (DATA_GET(object,"real_lower"))
		{
			lower = (gchar *)DATA_GET(object,"real_lower");
			real_lower = g_strtod(lower,NULL);
			raw_lower = calc_value_f(real_lower,multiplier,adder,TOECU);
		}
		else
			raw_lower = get_extreme_from_size_f(size,LOWER);
		if (DATA_GET(object,"real_upper"))
		{
			upper = (gchar *)DATA_GET(object,"real_upper");
			real_upper = g_strtod(upper,NULL);
			raw_upper = calc_value_f(real_upper,multiplier,adder,TOECU);
		}
		else
			raw_upper = get_extreme_from_size_f(size,UPPER);

		range = g_strdup_printf("Valid Range: %.1f <-> %.1f",real_lower,real_upper);
		if (temp_dep)
		{
			tempc_range = g_strdup_printf("Valid Range: %.1f\302\260C <-> %.1f\302\260C",f_to_c_f(real_lower),f_to_c_f(real_upper));
			tempf_range = g_strdup_printf("Valid Range: %.1f\302\260F <-> %.1f\302\260F",real_lower,real_upper);
			tempk_range = g_strdup_printf("Valid Range: %.1f\302\260K <-> %.1f\302\260K",f_to_k_f(real_lower),f_to_k_f(real_upper));
		}
		else
		{
			tempc_range = g_strdup(range);
			tempf_range = g_strdup(range);
			tempk_range = g_strdup(range);
		}
		raw_lower_str = g_strdup_printf("%i",raw_lower);
		raw_upper_str = g_strdup_printf("%i",raw_upper);

		gtk_list_store_append(store,&iter);
		gtk_list_store_set(store,&iter,
				UO_CHOICE_COL,name,
				UO_BITVAL_COL,bitval,
				UO_FROMECU_MULT_COL,multiplier,
				UO_FROMECU_ADD_COL,adder,
				UO_RAW_LOWER_COL,raw_lower_str,
				UO_RAW_UPPER_COL,raw_upper_str,
				UO_RANGE_COL,range,
				UO_RANGE_TEMPC_COL,tempc_range,
				UO_RANGE_TEMPF_COL,tempf_range,
				UO_RANGE_TEMPK_COL,tempk_range,
				UO_SIZE_COL,size,
				UO_PRECISION_COL,precision,
				UO_TEMP_DEP_COL,temp_dep,
				-1);
		g_free(raw_lower_str);
		g_free(raw_upper_str);
		g_free(range);
		g_free(tempc_range);
		g_free(tempf_range);
		g_free(tempk_range);
	}
	if (GTK_IS_COMBO_BOX_ENTRY(widget))
	{
		gtk_combo_box_entry_set_text_column(GTK_COMBO_BOX_ENTRY(widget),UO_CHOICE_COL);
		gtk_combo_box_set_model(GTK_COMBO_BOX(widget),GTK_TREE_MODEL(store));
		g_object_unref(store);
		entry = gtk_bin_get_child(GTK_BIN(widget));
		/* Nasty hack, but otherwise the entry is an obnoxious size.. */
		if ((width = (GINT)OBJ_GET((GtkWidget *)widget,"max_chars")) > 0)
			gtk_entry_set_width_chars(GTK_ENTRY(entry),width);
		else
			gtk_entry_set_width_chars(GTK_ENTRY(entry),12);

		gtk_widget_set_size_request(GTK_WIDGET(widget),-1,(3*(GINT)DATA_GET(global_data,"font_size")));

		//		gtk_container_remove (GTK_CONTAINER (widget), gtk_bin_get_child(GTK_BIN(widget)));
		//		gtk_container_add (GTK_CONTAINER (widget), entry);

		completion = gtk_entry_completion_new();
		gtk_entry_set_completion(GTK_ENTRY(entry),completion);
		g_object_unref(completion);
		gtk_entry_completion_set_model(completion,GTK_TREE_MODEL(store));
		gtk_entry_completion_set_text_column(completion,UO_CHOICE_COL);
		gtk_entry_completion_set_inline_completion(completion,TRUE);
		gtk_entry_completion_set_inline_selection(completion,TRUE);
		gtk_entry_completion_set_popup_single_match(completion,FALSE);
		OBJ_SET(widget,"arrow-size",GINT_TO_POINTER(1));
	}
	EXIT();
	return;
}
开发者ID:JacobD10,项目名称:MegaTunix,代码行数:101,代码来源:user_outputs.c

示例12: gtk_dialog_new_with_buttons


//.........这里部分代码省略.........
            mUserField = gtk_entry_new();

            if (!mUser.IsEmpty())
                gtk_entry_set_text(GTK_ENTRY(mUserField), mUser.get());

            gtk_entry_set_activates_default(GTK_ENTRY(mUserField), TRUE);

            gtk_box_pack_start(GTK_BOX(userPassFields), mUserField, FALSE,
                               FALSE, 0);
        }
        if (widgetFlags & INCLUDE_PASSWORD) {
            GtkWidget* passLabel = gtk_label_new("Password:");
            gtk_box_pack_start(GTK_BOX(userPassLabels), passLabel, FALSE,
                               FALSE, 0);

            mPassField = gtk_entry_new();

            if (!mPass.IsEmpty())
                gtk_entry_set_text(GTK_ENTRY(mPassField), mPass.get());

            gtk_entry_set_visibility(GTK_ENTRY(mPassField), FALSE);
            gtk_entry_set_activates_default(GTK_ENTRY(mPassField), TRUE);

            gtk_box_pack_start(GTK_BOX(userPassFields), mPassField, FALSE,
                               FALSE, 0);
        }

        gtk_box_pack_start(GTK_BOX(userPassHBox), userPassLabels, FALSE,
                           FALSE, 0);
        gtk_box_pack_start(GTK_BOX(userPassHBox), userPassFields, FALSE,
                           FALSE, 0);
        gtk_box_pack_start(GTK_BOX(contentsVBox), userPassHBox, FALSE, FALSE, 0);
    }

    if (aType == TYPE_PROMPT) {
        mTextField = gtk_entry_new();

        if (!mTextValue.IsEmpty())
            gtk_entry_set_text(GTK_ENTRY(mTextField), mTextValue.get());

        gtk_entry_set_activates_default(GTK_ENTRY(mTextField), TRUE);

        gtk_box_pack_start(GTK_BOX(contentsVBox), mTextField, FALSE, FALSE, 0);
    }

    // Add a checkbox
    if ((widgetFlags & INCLUDE_CHECKBOX) && !mCheckMessage.IsEmpty()) {
        mCheckBox = gtk_check_button_new_with_label(mCheckMessage.get());

        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mCheckBox),
                                     mCheckValue);
        gtk_label_set_line_wrap(GTK_LABEL(gtk_bin_get_child(GTK_BIN(mCheckBox))),
				TRUE);

        gtk_box_pack_start(GTK_BOX(contentsVBox), mCheckBox, FALSE, FALSE, 0);
    }

    // Add a dropdown menu
    if (aType == TYPE_SELECT) {
        // Build up a GtkMenu containing the items
        GtkWidget* menu = gtk_menu_new();
        for (PRUint32 i = 0; i < mItemCount; ++i) {
            GtkWidget* item = gtk_menu_item_new_with_label(mItemList[i].get());
            gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
        }

        // Now create an OptionMenu and set this as the menu
        mOptionMenu = gtk_option_menu_new();

        gtk_option_menu_set_menu(GTK_OPTION_MENU(mOptionMenu), menu);
        gtk_box_pack_start(GTK_BOX(contentsVBox), mOptionMenu, FALSE, FALSE, 0);
    }

    if (aType == TYPE_UNIVERSAL) {
        // Create buttons based on the flags passed in.
        for (int i = EMBED_MAX_BUTTONS; i >= 0; --i) {
            if (!mButtonLabels[i].IsEmpty())
                gtk_dialog_add_button(GTK_DIALOG(mWindow),
                                      mButtonLabels[i].get(), i);
        }
        gtk_dialog_set_default_response(GTK_DIALOG(mWindow), 0);
    } else {
        // Create standard ok and cancel buttons
        if (widgetFlags & INCLUDE_CANCEL)
            gtk_dialog_add_button(GTK_DIALOG(mWindow), GTK_STOCK_CANCEL,
                                  GTK_RESPONSE_CANCEL);

        GtkWidget* okButton = gtk_dialog_add_button(GTK_DIALOG(mWindow),
                                                    GTK_STOCK_OK,
                                                    GTK_RESPONSE_ACCEPT);
        gtk_widget_grab_default(okButton);
    }

    // Pack the contentsVBox into the dialogHBox and the dialog.
    gtk_box_pack_start(GTK_BOX(dialogHBox), contentsVBox, FALSE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(mWindow)->vbox), dialogHBox, FALSE,
                       FALSE, 0);

    return NS_OK;
}
开发者ID:EdgarChen,项目名称:mozilla-cvs-history,代码行数:101,代码来源:EmbedPrompter.cpp

示例13: update_editor_sheet

static void
update_editor_sheet (EggToolbarEditor *editor)
{
  GList *l;
  GList *to_drag;
  int x, y, height, width;
  GtkWidget *table;
  GtkWidget *viewport;
  GtkWidget *item;
  GtkWidget *icon;

  g_return_if_fail (EGG_IS_TOOLBAR_EDITOR (editor));

  viewport = GTK_BIN (editor->priv->scrolled_window)->child;
  if (viewport)
    {
      table = GTK_BIN (viewport)->child;
      gtk_container_remove (GTK_CONTAINER (viewport), table);
    }
  table = gtk_table_new (0, 0, TRUE);
  editor->priv->table = table;
  gtk_container_set_border_width (GTK_CONTAINER (table), 12);
  gtk_widget_show (table);
  gtk_scrolled_window_add_with_viewport
    (GTK_SCROLLED_WINDOW (editor->priv->scrolled_window), table);
  gtk_drag_dest_set (table, GTK_DEST_DEFAULT_ALL,
		     dest_drag_types, n_dest_drag_types, GDK_ACTION_MOVE);
  g_signal_connect (table, "drag_data_received",
		    G_CALLBACK (editor_drag_data_received_cb), editor);

  to_drag = editor->priv->actions_list;

  x = y = 0;
  width = 4;
  height = (g_list_length (to_drag)) / width + 1;
  gtk_table_resize (GTK_TABLE (editor->priv->table), height, width);

  for (l = to_drag; l != NULL; l = l->next)
    {
      GtkAction *action = (l->data);
      const char *stock_id, *short_label;
      GValue value = { 0, };

      g_value_init (&value, G_TYPE_STRING);
      g_object_get_property (G_OBJECT (action), "stock_id", &value);
      stock_id = g_value_get_string (&value);
      icon = gtk_image_new_from_stock
		(stock_id ? stock_id : GTK_STOCK_DND,
		 GTK_ICON_SIZE_LARGE_TOOLBAR);
      g_value_unset (&value);

      g_value_init (&value, G_TYPE_STRING);
      g_object_get_property (G_OBJECT (action), "short_label", &value);
      short_label = g_value_get_string (&value);
      item = editor_create_item (editor, GTK_IMAGE (icon),
				 short_label, GDK_ACTION_MOVE);
      g_value_unset (&value);
      g_object_set_data (G_OBJECT (item), "egg-action", action);
      gtk_table_attach_defaults (GTK_TABLE (editor->priv->table),
		                 item, x, x + 1, y, y + 1);

      x++;
      if (x >= width)
	{
	  x = 0;
	  y++;
	}
    }

  icon = _egg_editable_toolbar_new_separator_image ();
  item = editor_create_item (editor, GTK_IMAGE (icon), _("Separator"),
			     GDK_ACTION_COPY);
  gtk_table_attach_defaults (GTK_TABLE (editor->priv->table),
		             item, x, x + 1, y, y + 1);
}
开发者ID:GNOME,项目名称:galeon,代码行数:75,代码来源:egg-toolbar-editor.c

示例14: g_new0

RendererFuncs *renderer_clutter_new(PixbufRenderer *pr)
{
	RendererClutter *rc = g_new0(RendererClutter, 1);

	rc->pr = pr;

	rc->f.area_changed = rc_area_changed;
	rc->f.update_pixbuf = rc_update_pixbuf;
	rc->f.free = rc_free;
	rc->f.update_zoom = rc_update_zoom;
	rc->f.invalidate_region = rc_invalidate_region;
	rc->f.scroll = rc_scroll;
	rc->f.update_viewport = rc_update_viewport;


	rc->f.overlay_add = rc_overlay_add;
	rc->f.overlay_set = rc_overlay_set;
	rc->f.overlay_get = rc_overlay_get;

	rc->f.stereo_set = rc_stereo_set;


	rc->stereo_mode = 0;
	rc->stereo_off_x = 0;
	rc->stereo_off_y = 0;

	rc->idle_update = 0;
	rc->pending_updates = NULL;

	rc->widget = gtk_bin_get_child(GTK_BIN(rc->pr));

	if (rc->widget)
		{
		if (!GTK_CLUTTER_IS_EMBED(rc->widget))
			{
			g_free(rc);
			DEBUG_3("pixbuf renderer has a child of other type than gtk_clutter_embed");
			return NULL;
			}
		}
	else
		{
		rc->widget = gtk_clutter_embed_new();
		gtk_container_add(GTK_CONTAINER(rc->pr), rc->widget);
		}

	gtk_event_box_set_above_child (GTK_EVENT_BOX(rc->pr), TRUE);
	rc->stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (rc->widget));

	rc->group = clutter_group_new();
	clutter_container_add_actor(CLUTTER_CONTAINER(rc->stage), rc->group);
	clutter_actor_set_clip_to_allocation(CLUTTER_ACTOR(rc->group), TRUE);

	rc->texture = clutter_texture_new ();
	clutter_container_add_actor(CLUTTER_CONTAINER(rc->group), rc->texture);

	renderer_clutter_init_checker_shader(rc);
	g_object_ref(G_OBJECT(rc->widget));

	gtk_widget_show(rc->widget);
	return (RendererFuncs *) rc;
}
开发者ID:BestImageViewer,项目名称:geeqie,代码行数:62,代码来源:renderer-clutter.c

示例15: _lib_backgroundjobs_set_cancellable

static void _lib_backgroundjobs_set_cancellable(dt_lib_module_t *self, const guint *key, struct dt_job_t *job)
{
  if(!darktable.control->running) return;
  gboolean i_own_lock = dt_control_gdk_lock();

  dt_lib_backgroundjobs_t *d = (dt_lib_backgroundjobs_t*)self->data;

  dt_bgjob_t *j = (dt_bgjob_t*)g_hash_table_lookup(d->jobs, key);
  if (j)
  {
    GtkWidget *w=j->widget;
    GtkBox *hbox = GTK_BOX (g_list_nth_data (gtk_container_get_children (GTK_CONTAINER ( gtk_bin_get_child (GTK_BIN (w) ) ) ), 0));
    GtkWidget *button = dtgtk_button_new(dtgtk_cairo_paint_cancel,CPF_STYLE_FLAT);
    gtk_widget_set_size_request(button,17,17);
    g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (_lib_backgroundjobs_cancel_callback), (gpointer)job);
    gtk_box_pack_start (hbox, GTK_WIDGET(button), FALSE, FALSE, 0);
    gtk_widget_show_all(button);
  }

  if(i_own_lock) dt_control_gdk_unlock();
}
开发者ID:hauva69,项目名称:darktable,代码行数:21,代码来源:backgroundjobs.c


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