本文整理汇总了C++中GTK_GRID函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_GRID函数的具体用法?C++ GTK_GRID怎么用?C++ GTK_GRID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTK_GRID函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}