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

C++ GTK_GRID函数代码示例

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

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



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

示例1: pgd_annot_view_set_annot_markup

static void
pgd_annot_view_set_annot_markup (GtkWidget          *table,
                                 PopplerAnnotMarkup *markup,
                                 gint               *row)
{
    gchar *text;
    PopplerRectangle rect;

    text = poppler_annot_markup_get_label (markup);
    pgd_table_add_property (GTK_GRID (table), "<b>Label:</b>", text, row);
    g_free (text);

    if (poppler_annot_markup_has_popup (markup)) {
	    pgd_table_add_property (GTK_GRID (table), "<b>Popup is open:</b>",
				    poppler_annot_markup_get_popup_is_open (markup) ? "Yes" : "No", row);

	    poppler_annot_markup_get_popup_rectangle (markup, &rect);
	    text = g_strdup_printf ("X1: %.2f, Y1: %.2f, X2: %.2f, Y2: %.2f",
				    rect.x1, rect.y1, rect.x2, rect.y2);
	    pgd_table_add_property (GTK_GRID (table), "<b>Popup Rectangle:</b>", text, row);
	    g_free (text);
    }

    text = g_strdup_printf ("%f", poppler_annot_markup_get_opacity (markup));
    pgd_table_add_property (GTK_GRID (table), "<b>Opacity:</b>", text, row);
    g_free (text);

    text = get_markup_date (markup);
    pgd_table_add_property (GTK_GRID (table), "<b>Date:</b>", text, row);
    g_free (text);

    text = poppler_annot_markup_get_subject (markup);
    pgd_table_add_property (GTK_GRID (table), "<b>Subject:</b>", text, row);
    g_free (text);

    pgd_table_add_property (GTK_GRID (table), "<b>Reply To:</b>", get_markup_reply_to (markup), row);

    pgd_table_add_property (GTK_GRID (table), "<b>External Data:</b>", get_markup_external_data (markup), row);
}
开发者ID:BlueBrain,项目名称:Poppler,代码行数:39,代码来源:annots.c


示例2: pref_create_label

static void
pref_create_label (GOConfNode *node, GtkWidget *grid,
		   gint row, gchar const *default_label, GtkWidget *w)
{
	GtkWidget *label;

	if (NULL == default_label) {
		const char *desc = gnm_conf_get_short_desc (node);
		label = gtk_label_new (desc);
	} else
		label = gtk_label_new_with_mnemonic (default_label);

	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
	gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
	gtk_widget_set_hexpand (label, TRUE);
	gtk_grid_attach (GTK_GRID (grid), label, 0, row, 1, 1);

	gtk_label_set_mnemonic_widget (GTK_LABEL (label), w);
	go_atk_setup_label (label, w);
}
开发者ID:UIKit0,项目名称:gnumeric,代码行数:20,代码来源:dialog-preferences.c


示例3: photos_dlna_renderers_dialog_add_renderer

static void
photos_dlna_renderers_dialog_add_renderer (PhotosDlnaRenderersDialog *self, PhotosDlnaRenderer *renderer)
{
  GIcon *icon;
  GtkWidget *row;
  GtkWidget *row_grid;
  GtkWidget *image;
  GtkWidget *label;
  const gchar *name;

  row = gtk_list_box_row_new ();
  gtk_container_add (GTK_CONTAINER (self->listbox), row);

  row_grid = gtk_grid_new ();
  gtk_container_set_border_width (GTK_CONTAINER (row_grid), 12);
  gtk_orientable_set_orientation (GTK_ORIENTABLE (row_grid), GTK_ORIENTATION_HORIZONTAL);
  gtk_grid_set_column_spacing (GTK_GRID (row_grid), 12);
  gtk_container_add (GTK_CONTAINER (row), row_grid);

  g_object_set_data_full (G_OBJECT (row), "renderer", g_object_ref (renderer), g_object_unref);

  name = photos_dlna_renderer_get_friendly_name (renderer);

  icon = g_themed_icon_new_with_default_fallbacks (PHOTOS_ICON_VIDEO_DISPLAY_SYMBOLIC);
  image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_DIALOG);

  g_object_ref (image); /* keep a ref for the following async call and release it in the callback */
  photos_dlna_renderer_get_icon (renderer,
                                 "",
                                 "",
                                 GTK_ICON_SIZE_DIALOG,
                                 NULL,
                                 photos_dlna_renderers_dialog_set_icon_cb,
                                 image);

  gtk_container_add (GTK_CONTAINER (row_grid), image);

  label = gtk_label_new (NULL);
  gtk_label_set_text (GTK_LABEL (label), name);
  gtk_container_add (GTK_CONTAINER (row_grid), label);
}
开发者ID:kleopatra999,项目名称:gnome-photos,代码行数:41,代码来源:photos-dlna-renderers-dialog.c


示例4: gtk_grid_new

static GtkWidget *grid2x2(GtkWidget *top_left, GtkWidget *top_right,
			 GtkWidget *bottom_left, GtkWidget *bottom_right)
{
	GtkWidget *grid = gtk_grid_new();
	gtk_grid_set_column_spacing(GTK_GRID(grid), 12);
	gtk_grid_set_row_spacing(GTK_GRID(grid), 6);
	gtk_container_set_border_width(GTK_CONTAINER(grid), 12);

	gtk_grid_attach(GTK_GRID(grid), top_left, 0, 0, 1, 1);
	gtk_grid_attach(GTK_GRID(grid), top_right, 1, 0, 1, 1);
	gtk_grid_attach(GTK_GRID(grid), bottom_left, 0, 1, 1, 1);
	gtk_grid_attach(GTK_GRID(grid), bottom_right, 1, 1, 1, 1);
	gtk_widget_show(grid);
	return grid;
}
开发者ID:ncopa,项目名称:xfce-polkit,代码行数:15,代码来源:xfce-polkit-listener.c


示例5: autoar_gtk_chooser_advanced_get

/**
 * autoar_gtk_chooser_advanced_get:
 * @advanced: a #GtkGrid returned by autoar_gtk_chooser_advanced_new()
 * @format: the place to store the #AutoarFormat selected by the user
 * @filter: the place to store the #AutoarFilter selected by the user
 *
 * Gets the selected archive format of the widget created by
 * autoar_gtk_chooser_advanced_new().
 *
 * Returns: %TRUE if @format and @filter are set. %FALSE if there is no
 * selected item on @advanced, so @format and @filter are not modified.
 **/
gboolean
autoar_gtk_chooser_advanced_get (GtkWidget *advanced,
                                 int *format,
                                 int *filter)
{
  GtkGrid *grid;
  GtkTreeIter format_iter, filter_iter;
  GtkTreeView *format_view, *filter_view;
  GtkTreePath *format_path, *filter_path;
  GtkTreeModel *format_model, *filter_model;

  grid = GTK_GRID (advanced);
  format_view = GTK_TREE_VIEW (gtk_grid_get_child_at (grid, 0, 0));
  filter_view = GTK_TREE_VIEW (gtk_grid_get_child_at (grid, 1, 0));

  gtk_tree_view_get_cursor (format_view, &format_path, NULL);
  gtk_tree_view_get_cursor (filter_view, &filter_path, NULL);
  if (format_path == NULL || filter_path == NULL) {
    gtk_tree_path_free (format_path);
    gtk_tree_path_free (filter_path);
    return FALSE;
  }

  format_model = gtk_tree_view_get_model (format_view);
  filter_model = gtk_tree_view_get_model (filter_view);
  if (!gtk_tree_model_get_iter (format_model, &format_iter, format_path) ||
      !gtk_tree_model_get_iter (filter_model, &filter_iter, filter_path)) {
    gtk_tree_path_free (format_path);
    gtk_tree_path_free (filter_path);
    return FALSE;
  }
  gtk_tree_path_free (format_path);
  gtk_tree_path_free (filter_path);

  gtk_tree_model_get (format_model, &format_iter,
                      ADVANCED_FORMAT_COL_FORMAT, format, -1);
  gtk_tree_model_get (filter_model, &filter_iter,
                      ADVANCED_FILTER_COL_FILTER, filter, -1);

  return TRUE;
}
开发者ID:lantw44,项目名称:gsoc2013-libgnome-autoar,代码行数:53,代码来源:autoar-gtk-chooser.c


示例6: gtk_button_new_with_label

GtkWidget *createButton (GtkWidget *table, char *szLabel, int row, int column) {
    GtkWidget *button;

    /* --- Create the button --- */
    button = gtk_button_new_with_label (szLabel);

    /* --- We care if the button is clicked --- */
    g_signal_connect (G_OBJECT (button), "clicked",
                        G_CALLBACK (button_clicked), szLabel);

    /* --- Put the button in the table in the right place. --- */
    gtk_grid_attach (GTK_GRID (table), button, 
            column, row,
            1, 1);

    /* --- Make the button visible --- */
    gtk_widget_show (button);

    /* --- return the button. --- */
    return (button);
}
开发者ID:DirkyJerky,项目名称:Study-C4,代码行数:21,代码来源:p001.c


示例7: init_entry

static GnmExprEntry *
init_entry (GnmDialogSOList *state, GtkBuilder *gui, int col, int row,
	    GnmExprTop const *texpr)
{
	GnmExprEntry *gee = gnm_expr_entry_new (state->wbcg, TRUE);
	GtkWidget *w = GTK_WIDGET (gee);
	GtkGrid *grid = GTK_GRID (gtk_builder_get_object (gui, "main-grid"));
	Sheet *sheet = sheet_object_get_sheet (state->so);
	GnmParsePos pp;

	g_return_val_if_fail (w != NULL, NULL);

	gtk_grid_attach (grid, w, col, row, 1, 1);
	gnm_expr_entry_set_flags (gee, GNM_EE_FORCE_ABS_REF |
				  GNM_EE_SHEET_OPTIONAL |
				  GNM_EE_SINGLE_RANGE, GNM_EE_MASK);

	parse_pos_init_sheet (&pp, sheet);
	gnm_expr_entry_load_from_expr (gee, texpr, &pp);
	return gee;
}
开发者ID:GNOME,项目名称:gnumeric,代码行数:21,代码来源:dialog-so-list.c


示例8: g_paste_settings_ui_panel_add_range_setting

/**
 * g_paste_settings_ui_panel_add_range_setting:
 * @self: a #GPasteSettingsUiPanel instance
 * @label: the label to display
 * @value: the deafault value
 * @min: the minimal authorized value
 * @max: the maximal authorized value
 * @step: the step between proposed values
 * @on_value_changed: (closure user_data) (scope notified): the callback to call when the value changes
 *
 * Add a new boolean settings to the current pane
 *
 * Returns: (transfer none): the #GtkSpinButton we just added
 */
G_PASTE_VISIBLE GtkSpinButton *
g_paste_settings_ui_panel_add_range_setting (GPasteSettingsUiPanel *self,
        const gchar           *label,
        gdouble                value,
        gdouble                min,
        gdouble                max,
        gdouble                step,
        GPasteRangeCallback    on_value_changed,
        gpointer               user_data)
{
    GtkLabel *button_label = g_paste_settings_ui_panel_add_label (self, label);
    GtkWidget *button = gtk_spin_button_new_with_range (min, max, step);
    GtkSpinButton *b = GTK_SPIN_BUTTON (button);
    CALLBACK_DATA_DEFAULT (button)

    gtk_spin_button_set_value (b, value);
    _data->signal = g_signal_connect (button, "value-changed", G_CALLBACK (range_wrapper), data);
    gtk_grid_attach_next_to (GTK_GRID (self), button, GTK_WIDGET (button_label), GTK_POS_RIGHT, 1, 1);

    return b;
}
开发者ID:renataogarcia,项目名称:GPaste,代码行数:35,代码来源:gpaste-settings-ui-panel.c


示例9: activate

static void
activate (GtkApplication *app,
          gpointer        user_data)
{
  GMenu *submenu;
  GtkWidget *grid;
  GMenu *menumodel;
  GtkWidget *window;
  GtkWidget *menubutton;
  GSimpleAction *about_action;

  window = gtk_application_window_new (app);
  grid = gtk_grid_new ();

  gtk_window_set_title (GTK_WINDOW (window), "MenuButton Example");
  gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);

  menubutton = gtk_menu_button_new ();
  gtk_widget_set_size_request (menubutton, 80, 35);

  gtk_grid_attach (GTK_GRID (grid), menubutton, 0, 0, 1, 1);
  gtk_container_add (GTK_CONTAINER (window), grid);

  menumodel = g_menu_new ();
  g_menu_append (menumodel, "New", "app.new");
  g_menu_append (menumodel, "About", "win.about");

  submenu = g_menu_new ();
  g_menu_append_submenu (menumodel, "Other", G_MENU_MODEL (submenu));
  g_menu_append (submenu, "Quit", "app.quit");
  gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (menubutton), G_MENU_MODEL (menumodel));

  about_action = g_simple_action_new ("about", NULL);
  g_signal_connect (about_action, "activate", G_CALLBACK (about_callback),
                    GTK_WINDOW (window));
  g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (about_action));

  gtk_widget_show_all (window);
}
开发者ID:GNOME,项目名称:gnome-devel-docs,代码行数:39,代码来源:menubottun_0.c


示例10: bool_pref_create_widget

static void
bool_pref_create_widget (GOConfNode *node, GtkWidget *grid,
			 gint row, gboolean_conf_setter_t setter,
			 gboolean_conf_getter_t getter,
			 char const *default_label)
{
	const char *desc = gnm_conf_get_short_desc (node);
	GtkWidget *item = gtk_check_button_new_with_label (
		(desc != NULL) ? desc : default_label);

	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item), getter ());

	g_object_set_data (G_OBJECT (item), "getter", getter);
	g_signal_connect (G_OBJECT (item), "toggled",
			  G_CALLBACK (bool_pref_widget_to_conf),
			  (gpointer) setter);
	gtk_grid_attach (GTK_GRID (grid), item, 0, row, 2, 1);

	connect_notification (node, (GOConfMonitorFunc)bool_pref_conf_to_widget,
			      item, grid);
	set_tip (node, item);
}
开发者ID:UIKit0,项目名称:gnumeric,代码行数:22,代码来源:dialog-preferences.c


示例11: gth_window_attach

void
gth_window_attach (GthWindow     *window,
		   GtkWidget     *child,
		   GthWindowArea  area)
{
	int position;

	g_return_if_fail (window != NULL);
	g_return_if_fail (GTH_IS_WINDOW (window));
	g_return_if_fail (child != NULL);
	g_return_if_fail (GTK_IS_WIDGET (child));

	switch (area) {
	case GTH_WINDOW_MENUBAR:
		window->priv->menubar = child;
		position = 0;
		break;
	case GTH_WINDOW_TOOLBAR:
		window->priv->toolbar = child;
		position = 1;
		break;
	case GTH_WINDOW_INFOBAR:
		window->priv->infobar = child;
		position = 4;
		break;
	case GTH_WINDOW_STATUSBAR:
		window->priv->statusbar = child;
		position = 3;
		break;
	default:
		return;
	}

	gtk_widget_set_vexpand (child, FALSE);
	gtk_grid_attach (GTK_GRID (window->priv->grid),
			  child,
			  0, position,
			  1, 1);
}
开发者ID:cormac-w,项目名称:gthumb,代码行数:39,代码来源:gth-window.c


示例12: add_grid_rows

static void
add_grid_rows (VpnPasswordDialog *dialog)
{
	VpnPasswordDialogPrivate *priv = VPN_PASSWORD_DIALOG_GET_PRIVATE (dialog);
	int row;
	int offset = 0;

       gtk_alignment_set_padding (GTK_ALIGNMENT (priv->grid_alignment), 0, 0, offset, 0);

	/* This will not kill the entries, since they are ref:ed */
       gtk_container_foreach (GTK_CONTAINER (priv->grid), (GtkCallback) remove_child, priv->grid);
	
	row = 0;
	if (priv->show_password)
               add_row (priv->grid, row++, priv->primary_password_label, priv->password_entry);
	if (priv->show_password_secondary)
               add_row (priv->grid, row++, priv->secondary_password_label,  priv->password_entry_secondary);

       gtk_grid_attach (GTK_GRID (priv->grid), priv->show_passwords_checkbox, 1, row, 1, 1);

       gtk_widget_show_all (priv->grid);
}
开发者ID:RoboMod,项目名称:network-manager-ipop,代码行数:22,代码来源:vpn-password-dialog.c


示例13: photos_properties_dialog_location_reverse_resolve

static void
photos_properties_dialog_location_reverse_resolve (GObject *source_object, GAsyncResult *res, gpointer user_data)
{
  PhotosPropertiesDialog *self;
  g_autoptr (GeocodePlace) place = NULL;
  GeocodeReverse *reverse = GEOCODE_REVERSE (source_object);
  GtkWidget *location_data;
  const gchar *location_area;
  const gchar *location_country;
  const gchar *location_town;
  g_autofree gchar *location_str = NULL;

  {
    g_autoptr (GError) error = NULL;

    place = geocode_reverse_resolve_finish (reverse, res, &error);
    if (error != NULL)
      {
        if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
          g_warning ("Unable to resolve latitude and longitude: %s", error->message);
        goto out;
      }
  }

  self = PHOTOS_PROPERTIES_DIALOG (user_data);

  location_area = geocode_place_get_area (place);
  location_town = geocode_place_get_town (place);
  location_country =  geocode_place_get_country (place);
  location_str = g_strdup_printf ("%s, %s, %s", location_area, location_town, location_country);

  location_data = gtk_label_new (location_str);
  gtk_widget_set_halign (location_data, GTK_ALIGN_START);
  gtk_grid_attach_next_to (GTK_GRID (self->grid), location_data, self->location_w, GTK_POS_RIGHT, 2, 1);
  gtk_widget_show (location_data);

 out:
  return;
}
开发者ID:GNOME,项目名称:gnome-photos,代码行数:39,代码来源:photos-properties-dialog.c


示例14: ssh_createdialog

void ssh_createdialog(GtkWidget *widget) {
	GtkWidget *vbox;
	GtkWidget *tbl;
	GtkWidget *l1, *l2;

	vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
	gtk_container_set_border_width(GTK_CONTAINER(vbox), 10);
	gtk_container_add(GTK_CONTAINER(widget), vbox);
	gtk_widget_show(vbox);

	check_enablessh = gtk_check_button_new_with_label(
		_("Enable SSH tunneling"));
	gtk_box_pack_start(GTK_BOX(vbox), check_enablessh, FALSE, FALSE, 0);
	g_signal_connect(G_OBJECT(GTK_CHECK_BUTTON(check_enablessh)), "toggled",
	                 G_CALLBACK(sig_enablessh), NULL);
	gtk_widget_show(check_enablessh);

	tbl = gtk_grid_new();
	gtk_container_set_border_width(GTK_CONTAINER(tbl), 10);
	gtk_grid_set_row_spacing(GTK_GRID(tbl), 5);
	gtk_grid_set_column_spacing(GTK_GRID(tbl), 10);
	gtk_box_pack_start(GTK_BOX(vbox), tbl, TRUE, TRUE, 5);
	gtk_widget_show(tbl);

	l1 = gtk_label_new(_("Username:"));
	gtk_grid_attach(GTK_GRID(tbl), l1, 0, 0, 1, 1);
	gtk_widget_show(l1);

	input_user = gtk_entry_new();
	gtk_entry_set_max_length(GTK_ENTRY(input_user), 255);
	g_signal_connect(G_OBJECT(GTK_ENTRY(input_user)), "changed", 
	                 G_CALLBACK(sig_sshuser), NULL);
	gtk_grid_attach(GTK_GRID(tbl), input_user, 1, 0, 1, 1);
	gtk_widget_show(input_user);

	l2 = gtk_label_new(_("Hostname:"));
	gtk_grid_attach(GTK_GRID(tbl), l2, 0, 1, 1, 1);
	gtk_widget_show(l2);

	input_host = gtk_entry_new();
	gtk_entry_set_max_length(GTK_ENTRY(input_host), 255);
	g_signal_connect(G_OBJECT(GTK_ENTRY(input_host)), "changed",
	                 G_CALLBACK(sig_sshhost), NULL);
	gtk_grid_attach(GTK_GRID(tbl), input_host, 1, 1, 1, 1);
	gtk_widget_show(input_host);
}
开发者ID:AKMergl,项目名称:gRDesktop,代码行数:46,代码来源:sshbox.c


示例15: gog_trend_line_populate_editor

static void
gog_trend_line_populate_editor (GogObject *gobj,
				GOEditor *editor,
				GogDataAllocator *dalloc,
				GOCmdContext *cc)
{
	GtkWidget *w, *box;
	GogTrendLine *line = GOG_TREND_LINE (gobj);

	box = go_editor_get_page (editor, _("Properties"));
	if (!box)
		box = go_editor_get_page (editor, _("Details"));
	if (!box) {
		box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
		gtk_container_set_border_width (GTK_CONTAINER (box), 12);
		gtk_widget_show_all (box);
		go_editor_add_page (editor, box, _("Legend"));
	}
	w = gtk_check_button_new_with_mnemonic (_("_Show in Legend"));
	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w),
		gog_trend_line_has_legend (line));
	g_signal_connect (G_OBJECT (w),
		"toggled",
		G_CALLBACK (cb_show_in_legend), gobj);
	if (GTK_IS_BOX (box))
		gtk_box_pack_start (GTK_BOX (box), w, FALSE, FALSE, 0);
	else if (GTK_IS_GRID (box)) {
		GtkGrid *grid = GTK_GRID (box);
		gtk_grid_insert_row (grid, 1);
		gtk_grid_attach (grid, w, 0, 1, 2, 1);
	} else if (GTK_IS_CONTAINER (box))
		gtk_container_add (GTK_CONTAINER (box), w);
	else
		g_warning ("Unsupported container");
	gtk_widget_show (w);

	(GOG_OBJECT_CLASS (trend_line_parent_klass)->populate_editor) (gobj, editor, dalloc, cc);
}
开发者ID:UIKit0,项目名称:goffice,代码行数:38,代码来源:gog-trend-line.c


示例16: load_finished

static void
load_finished (NemoImagePropertiesPage *page)
{
	GtkWidget *label;

	label = gtk_grid_get_child_at (GTK_GRID (page->details->grid), 0, 0);
	gtk_container_remove (GTK_CONTAINER (page->details->grid), label);

	if (page->details->loader != NULL) {
		gdk_pixbuf_loader_close (page->details->loader, NULL);
	}

	if (page->details->got_size) {
		append_basic_info (page);
		append_options_info (page);
		append_exif_info (page);
		append_xmp_info (page);
	} else {
		append_item (page, _("Failed to load image information"), NULL);
	}

	if (page->details->loader != NULL) {
		g_object_unref (page->details->loader);
		page->details->loader = NULL;
	}
#ifdef HAVE_EXIF
	if (page->details->exifldr != NULL) {
		exif_loader_unref (page->details->exifldr);
		page->details->exifldr = NULL;
	}
#endif /*HAVE_EXIF*/
#ifdef HAVE_EXEMPI
	if (page->details->xmp != NULL) {
		xmp_free (page->details->xmp);
		page->details->xmp = NULL;
	}
#endif
}
开发者ID:JosephMcc,项目名称:nemo,代码行数:38,代码来源:nemo-image-properties-page.c


示例17: printer_driver_widget_update

/** \brief  Update the printer driver widget
 *
 * \param[in]   widget  printer driver widget
 * \param[in]   driver  driver name
 */
void printer_driver_widget_update(GtkWidget *widget, const char *driver)
{
    GtkWidget *radio;
    int index = 4;  /* RAW for 4/5 */
    int device;

    /* get device number from custom GObject property */
    device = GPOINTER_TO_INT(
            g_object_get_data(G_OBJECT(widget), "DeviceNumber"));

    /* this is a little silly, using string constants, but it works */
    if (device == 4 || device == 5) {
        if (strcmp(driver, "ascii") == 0) {
            index = 1;
        } else if (strcmp(driver, "mps803") == 0) {
            index = 2;
        } else if (strcmp(driver, "nl10") == 0) {
            index = 3;
        }
    } else if (device == 6) {
        if (strcmp(driver, "1520") == 0) {
            index = 1;
        } else {
            index = 2;  /* RAW */
        }
    } else {
        fprintf(stderr, "%s:%d:%s(): invalid printer device #%d\n",
                __FILE__, __LINE__, __func__, device);
        archdep_vice_exit(1);
    }

    /* now select the proper radio button */
    radio = gtk_grid_get_child_at(GTK_GRID(widget), 0, index);
    if (radio != NULL && GTK_IS_RADIO_BUTTON(radio)) {
        /* set toggle button to active, this also sets the resource */
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio), TRUE);
    }
}
开发者ID:OpenEmu,项目名称:VICE-Core,代码行数:43,代码来源:printerdriverwidget.c


示例18: gtk_window_new

/****************************************************************
  Create choice dialog
*****************************************************************/
GtkWidget *choice_dialog_start(GtkWindow *parent, const gchar *name,
                               const gchar *text)
{
  GtkWidget *dshell, *dlabel, *vbox, *bbox;

  dshell = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  setup_dialog(dshell, toplevel);
  gtk_window_set_position (GTK_WINDOW(dshell), GTK_WIN_POS_MOUSE);

  gtk_window_set_title(GTK_WINDOW(dshell), name);

  gtk_window_set_transient_for(GTK_WINDOW(dshell), parent);
  gtk_window_set_destroy_with_parent(GTK_WINDOW(dshell), TRUE);

  vbox = gtk_grid_new();
  gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox),
                                 GTK_ORIENTATION_VERTICAL);
  gtk_grid_set_row_spacing(GTK_GRID(vbox), 5);
  gtk_container_add(GTK_CONTAINER(dshell),vbox);

  gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);

  dlabel = gtk_label_new(text);
  gtk_container_add(GTK_CONTAINER(vbox), dlabel);

  bbox = gtk_button_box_new(GTK_ORIENTATION_VERTICAL);
  gtk_box_set_spacing(GTK_BOX(bbox), 2);
  gtk_container_add(GTK_CONTAINER(vbox), bbox);
  
  g_object_set_data(G_OBJECT(dshell), "bbox", bbox);
  g_object_set_data(G_OBJECT(dshell), "nbuttons", GINT_TO_POINTER(0));
  g_object_set_data(G_OBJECT(dshell), "hide", GINT_TO_POINTER(FALSE));
  
  gtk_widget_show(vbox);
  gtk_widget_show(dlabel);
  
  return dshell;
}
开发者ID:jheusala,项目名称:freeciv,代码行数:41,代码来源:choice_dialog.c


示例19: create_grid_window

static void
create_grid_window (void)
{
  GtkWidget *window;
  GtkWidget *grid;
  GtkWidget *toggle;
  GtkWidget *colorbox;

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (window), "Grid");

  grid = gtk_grid_new ();

  gtk_grid_attach (GTK_GRID (grid), gtk_label_new ("Top"), 1, 0, 1, 1);
  gtk_grid_attach (GTK_GRID (grid), gtk_label_new ("Bottom"), 1, 3, 1, 1);
  gtk_grid_attach (GTK_GRID (grid), gtk_label_new ("Left"), 0, 1, 1, 2);
  gtk_grid_attach (GTK_GRID (grid), gtk_label_new ("Right"), 2, 1, 1, 2);

  colorbox = gtk_frame_new (NULL);

  toggle = gtk_toggle_button_new_with_label ("H Expand");
  gtk_widget_set_halign (toggle, GTK_ALIGN_CENTER);
  gtk_widget_set_valign (toggle, GTK_ALIGN_CENTER);
  g_object_set (toggle, "margin", 5, NULL);
  g_signal_connect (G_OBJECT (toggle), "toggled",
                    G_CALLBACK (on_toggle_hexpand), NULL);
  gtk_container_add (GTK_CONTAINER (colorbox), toggle);

  gtk_grid_attach (GTK_GRID (grid), colorbox, 1, 1, 1, 1);

  colorbox = gtk_frame_new (NULL);

  toggle = gtk_toggle_button_new_with_label ("V Expand");
  gtk_widget_set_halign (toggle, GTK_ALIGN_CENTER);
  gtk_widget_set_valign (toggle, GTK_ALIGN_CENTER);
  g_object_set (toggle, "margin", 5, NULL);
  g_signal_connect (G_OBJECT (toggle), "toggled",
                    G_CALLBACK (on_toggle_vexpand), NULL);
  gtk_container_add (GTK_CONTAINER (colorbox), toggle);

  gtk_grid_attach (GTK_GRID (grid), colorbox, 1, 2, 1, 1); 

  gtk_container_add (GTK_CONTAINER (window), grid);
  gtk_widget_show (window);
}
开发者ID:sam-m888,项目名称:gtk,代码行数:45,代码来源:testexpand.c


示例20: void

/**
@brief add check button with optional mmemonic label to @a table

@param table table to hold the button
@param label button label which may contain mnemonic
@param group radio group, or NULL to start a group
@param state the intitial state of the button
@param callback callback function for "toggled" signal, or NULL
@param data data specified for the callback
@param left index of table column left of attachment-position
@param right index of table column right of attachment-position
@param top index of table row above attachment-position
@param bottom index of table row below attachment-position

@return the button widget
*/
GtkWidget *e2_button_add_radio_to_table (
	GtkWidget *table,
	gchar *label,
	GSList *group,
	gboolean state,
	void (*callback)(/*GtkToggleButton*,gpointer*/),
	gpointer data,
	gint left, gint right, gint top, gint bottom)
{
	GtkWidget *radio_button = gtk_radio_button_new_with_mnemonic (group, label);
	if (state)
		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio_button), TRUE);
	if (callback != NULL)
		g_signal_connect (G_OBJECT (radio_button), "toggled",
			G_CALLBACK (callback), data);
#ifdef USE_GTK3_2
	gtk_grid_attach (GTK_GRID (table), radio_button, left, top, right-left, bottom-top);
#else
	gtk_table_attach_defaults (GTK_TABLE (table), radio_button,
		                        left, right, top, bottom);
#endif
	return radio_button;
}
开发者ID:pyromaniac2k,项目名称:emelfm2,代码行数:39,代码来源:e2_button.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ GTK_HEADER_BAR函数代码示例发布时间:2022-05-30
下一篇:
C++ GTK_FONT_BUTTON函数代码示例发布时间: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