本文整理汇总了C++中GTK_ICON_VIEW函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_ICON_VIEW函数的具体用法?C++ GTK_ICON_VIEW怎么用?C++ GTK_ICON_VIEW使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTK_ICON_VIEW函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ok_button_clicked_cb
static void
ok_button_clicked_cb (GtkWidget *widget,
DialogData *data)
{
GList *list;
list = gtk_icon_view_get_selected_items (GTK_ICON_VIEW (data->icon_view));
if (list != NULL) {
GtkTreePath *path;
GtkTreeModel *model;
GtkTreeIter iter;
path = list->data;
model = gtk_icon_view_get_model (GTK_ICON_VIEW (data->icon_view));
if (gtk_tree_model_get_iter (model, &iter, path)) {
GdkPixbuf *image;
gtk_tree_model_get (model, &iter, IMAGE_COLUMN, &image, -1);
goo_window_set_cover_image_from_pixbuf (data->window, image);
g_object_unref (image);
}
g_list_foreach (list, (GFunc) gtk_tree_path_free, NULL);
g_list_free (list);
}
}
示例2: wp_button_press_cb
static gboolean
wp_button_press_cb (GtkWidget *widget,
GdkEventButton *event,
AppearanceData *data)
{
GtkCellRenderer *cell;
GdkEventButton *button_event = (GdkEventButton *) event;
if (event->type != GDK_BUTTON_PRESS)
return FALSE;
if (gtk_icon_view_get_item_at_pos (GTK_ICON_VIEW (widget),
button_event->x, button_event->y,
NULL, &cell)) {
if (g_object_get_data (G_OBJECT (cell), "buttons")) {
gint w, h;
GtkCellRenderer *cell2 = NULL;
gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &w, &h);
if (gtk_icon_view_get_item_at_pos (GTK_ICON_VIEW (widget),
button_event->x + w, button_event->y,
NULL, &cell2) && cell == cell2)
next_frame (data, cell, -1);
else
next_frame (data, cell, 1);
return TRUE;
}
}
return FALSE;
}
示例3: gsb_select_icon_selection_changed
/**
* callback pour traiter les changements de sélection dans le GtkIconView
*
* \param le GtkIconView appellant
*
* \return
*
* */
void gsb_select_icon_selection_changed ( GtkIconView *icon_view,
gpointer user_data )
{
GList * liste;
GtkTreePath *path;
GtkTreeModel *model;
GtkTreeIter iter;
gchar *name_icon = NULL;
liste = gtk_icon_view_get_selected_items ( GTK_ICON_VIEW ( icon_view ) );
/* Could happen if selection is unset, exiting then. */
if ( ! liste )
return;
path = liste -> data;
model = gtk_icon_view_get_model ( GTK_ICON_VIEW ( icon_view ) );
if (gtk_tree_model_get_iter ( GTK_TREE_MODEL (model), &iter, path ))
gtk_tree_model_get (model, &iter, TEXT_COLUMN, &name_icon, -1);
name_icon = my_strdelimit ( name_icon, "\n", "" );
devel_debug ( name_icon );
if ( name_icon && strlen ( name_icon ) > 0 )
{
new_icon = g_strconcat ( path_icon, G_DIR_SEPARATOR_S,
name_icon, NULL );
gtk_entry_set_text ( GTK_ENTRY (GTK_BIN (entry_text)->child ),
new_icon );
gtk_widget_set_sensitive (bouton_OK, TRUE );
}
}
示例4: hcp_app_view_set_n_columns
static void
hcp_app_view_set_n_columns (GtkWidget *widget,
gpointer data)
{
gint n_columns;
/* 4px is the HCP_GRID_X_PADDING */
#define PORTRAIT_WIDTH 480 - 3 * HILDON_MARGIN_DOUBLE
#define LANDSCAPE_WIDTH (800 / 2) - 2 * HILDON_MARGIN_DOUBLE
if (! HCP_IS_GRID (widget))
return;
n_columns = GPOINTER_TO_INT (data);
/*
* g_debug ("WIDTH = %d", (n_columns == 1) ? PORTRAIT_WIDTH : LANDSCAPE_WIDTH);
*/
/* grid view, set proper no. of colunms */
gtk_icon_view_set_columns (GTK_ICON_VIEW (widget), n_columns);
gtk_icon_view_set_item_width (GTK_ICON_VIEW (widget),
(n_columns == 1) ?
PORTRAIT_WIDTH :
LANDSCAPE_WIDTH);
hcp_grid_refresh_icons (HCP_GRID (widget));
}
示例5: mud_connections_show_icon_dialog
// Iconview Dialog
static void
mud_connections_show_icon_dialog(MudConnections *conn)
{
GladeXML *glade;
gint result;
glade = glade_xml_new(GLADEDIR "/muds.glade", "iconselect", NULL);
conn->priv->icon_dialog = glade_xml_get_widget(glade, "iconselect");
conn->priv->icon_dialog_view = glade_xml_get_widget(glade, "view");
conn->priv->icon_dialog_chooser =
glade_xml_get_widget(glade, "chooser");
g_object_unref(glade);
conn->priv->icon_dialog_view_model =
GTK_TREE_MODEL(gtk_list_store_new(MODEL_COLUMN_N,
G_TYPE_STRING,
GDK_TYPE_PIXBUF));
gtk_icon_view_set_model(GTK_ICON_VIEW(conn->priv->icon_dialog_view),
conn->priv->icon_dialog_view_model);
gtk_icon_view_set_text_column(
GTK_ICON_VIEW(conn->priv->icon_dialog_view),
MODEL_COLUMN_STRING);
gtk_icon_view_set_pixbuf_column(
GTK_ICON_VIEW(conn->priv->icon_dialog_view),
MODEL_COLUMN_PIXBUF);
if(conn->priv->icon_current != NULL)
g_free(conn->priv->icon_current);
conn->priv->icon_current = NULL;
g_signal_connect(
conn->priv->icon_dialog_chooser, "current-folder-changed",
G_CALLBACK(mud_connections_icon_fileset_cb),
conn);
g_signal_connect(conn->priv->icon_dialog_view, "selection-changed",
G_CALLBACK(mud_connections_icon_select_cb),
conn);
g_object_set(conn->priv->icon_dialog_view, "item-width", 64, NULL);
gtk_file_chooser_set_current_folder(
GTK_FILE_CHOOSER(conn->priv->icon_dialog_chooser),
"/usr/share/icons");
result = gtk_dialog_run(GTK_DIALOG(conn->priv->icon_dialog));
gtk_widget_destroy(conn->priv->icon_dialog);
if(result == GTK_RESPONSE_OK)
{
if(conn->priv->icon_current == NULL)
return;
GdkPixbuf *icon = gdk_pixbuf_new_from_file_at_size(
conn->priv->icon_current, 48, 48, NULL);
gtk_image_set_from_pixbuf(GTK_IMAGE(conn->priv->icon_image),
icon);
g_object_unref(icon);
}
}
示例6: load_themes
static void
load_themes (DialogData *data)
{
GFile *style_dir;
GFile *data_dir;
char *default_theme;
GtkTreeModel *model;
GtkTreeIter iter;
/* local themes */
style_dir = gth_user_dir_get_file_for_read (GTH_DIR_DATA, PIX_DIR, "albumthemes", NULL);
add_themes_from_dir (data, style_dir);
g_object_unref (style_dir);
/* system themes */
data_dir = g_file_new_for_path (WEBALBUM_DATADIR);
style_dir = _g_file_get_child (data_dir, "albumthemes", NULL);
add_themes_from_dir (data, style_dir);
g_object_unref (style_dir);
g_object_unref (data_dir);
/**/
gtk_widget_set_size_request (GET_WIDGET ("theme_iconview"), (150 * 3), 140);
gtk_widget_realize (GET_WIDGET ("theme_iconview"));
default_theme = g_settings_get_string (data->settings, PREF_WEBALBUMS_THEME);
model = GTK_TREE_MODEL (GET_WIDGET ("theme_liststore"));
if (gtk_tree_model_get_iter_first (model, &iter)) {
do {
char *name;
gtk_tree_model_get(model, &iter, THEME_COLUMN_ID, &name, -1);
if (g_strcmp0 (name, default_theme) == 0) {
GtkTreePath *path;
path = gtk_tree_model_get_path (model, &iter);
gtk_icon_view_select_path (GTK_ICON_VIEW (GET_WIDGET ("theme_iconview")), path);
gtk_icon_view_scroll_to_path (GTK_ICON_VIEW (GET_WIDGET ("theme_iconview")), path, TRUE, 0.5, 0.5);
gtk_tree_path_free (path);
g_free (name);
break;
}
g_free (name);
}
while (gtk_tree_model_iter_next (model, &iter));
}
g_free (default_theme);
}
示例7: addGroup
void addGroup (const gchar *name, const gchar *icon_path,
const gchar *nick, const gchar *sort_key)
{
// calculate position
int pos;
{
std::list <std::string>::iterator it;
for (it = sort_keys.begin(), pos = 0; it != sort_keys.end(); it++, pos++)
if (strcmp (it->c_str(), sort_key) >= 0)
break;
sort_keys.insert (it, sort_key);
}
// label widget
GtkWidget *tab_label, *image, *label;
GdkPixbuf *icon = NULL;
if (icon_path) {
GError *error = 0;
std::string path = ICONS + std::string (icon_path) + ".png";
icon = gdk_pixbuf_new_from_file (path.c_str(), &error);
if (!icon)
g_warning ("Could not load icon: %s.\nReason: %s", icon_path, error->message);
}
tab_label = gtk_hbox_new (FALSE, 0);
label = gtk_label_new (name);
if (icon)
image = gtk_image_new_from_pixbuf (icon);
if (icon)
gtk_box_pack_start (GTK_BOX (tab_label), image, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (tab_label), label, TRUE, TRUE, icon ? 6 : 0);
// page widget
GtkListStore *store = gtk_list_store_new (3, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_STRING);
m_stores [nick] = store;
GtkWidget *icons_view;
icons_view = gtk_icon_view_new_with_model (GTK_TREE_MODEL (store));
gtk_icon_view_set_text_column (GTK_ICON_VIEW (icons_view), 0);
gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (icons_view), 1);
g_signal_connect(G_OBJECT (icons_view), "item-activated",
G_CALLBACK (executeCommand), this);
GtkWidget *page;
page = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (page),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (page), GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (page), icons_view);
// add those to the notebook
gtk_widget_show_all (tab_label);
gtk_notebook_insert_page_menu (GTK_NOTEBOOK (m_widget), page, tab_label, NULL, pos);
}
示例8: fcitx_main_window_init
static void
fcitx_main_window_init(FcitxMainWindow* self)
{
GtkWidget* vbox = gtk_vbox_new(FALSE, 0);
GtkWidget* hbox = gtk_hbox_new(FALSE, 0);
self->pagestore = _fcitx_main_window_create_model();
self->pageview = gtk_icon_view_new_with_model(GTK_TREE_MODEL(self->pagestore));
gtk_icon_view_set_pixbuf_column(GTK_ICON_VIEW(self->pageview), PAGE_LIST_ICON);
gtk_icon_view_set_text_column(GTK_ICON_VIEW(self->pageview), PAGE_LIST_NAME);
#if GTK_CHECK_VERSION(2, 22, 0)
gtk_icon_view_set_item_orientation(GTK_ICON_VIEW(self->pageview), GTK_ORIENTATION_VERTICAL);
#endif
_fcitx_main_window_add_im_page(self);
_fcitx_main_window_add_config_file_page(self);
_fcitx_main_window_add_addon_page(self);
gtk_widget_set_size_request(GTK_WIDGET(self), -1, 500);
self->vbox = gtk_vbox_new(FALSE, 0);
self->pagelabel = gtk_label_new("");
gtk_label_set_use_markup(GTK_LABEL(self->pagelabel), true);
gtk_misc_set_alignment(GTK_MISC(self->pagelabel), 0, 0.5);
gtk_box_pack_start(GTK_BOX(self->vbox), self->pagelabel, FALSE, FALSE, 14);
GtkWidget* scrolledwindow = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow), GTK_POLICY_NEVER, GTK_POLICY_NEVER);
gtk_container_add(GTK_CONTAINER(scrolledwindow), self->pageview);
gtk_box_pack_start(GTK_BOX(hbox), scrolledwindow, FALSE, TRUE, 4);
gtk_box_pack_start(GTK_BOX(hbox), self->vbox, TRUE, TRUE, 8);
gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 8);
gtk_container_add(GTK_CONTAINER(self), vbox);
gtk_icon_view_set_selection_mode(GTK_ICON_VIEW(self->pageview), GTK_SELECTION_SINGLE);
gtk_icon_view_set_item_padding(GTK_ICON_VIEW(self->pageview), 0);
gtk_icon_view_set_margin(GTK_ICON_VIEW(self->pageview), 0);
gtk_icon_view_set_column_spacing(GTK_ICON_VIEW(self->pageview), 0);
gtk_icon_view_set_row_spacing(GTK_ICON_VIEW(self->pageview), 0);
gtk_icon_view_set_item_width(GTK_ICON_VIEW(self->pageview), 96);
g_signal_connect_swapped(G_OBJECT(self), "destroy", G_CALLBACK(gtk_main_quit), NULL);
g_signal_connect(G_OBJECT(self->pageview), "selection-changed",
G_CALLBACK(_fcitx_main_window_selection_changed_cb), self);
GtkTreePath* path = gtk_tree_model_get_path(GTK_TREE_MODEL(self->pagestore), &self->impage->iter);
gtk_icon_view_select_path(GTK_ICON_VIEW(self->pageview), path);
gtk_tree_path_free(path);
gtk_window_set_icon_name(GTK_WINDOW(self), "fcitx-configtool");
gtk_window_set_title(GTK_WINDOW(self), _("Fcitx Config"));
}
示例9: cheese_thumb_view_constructed
static void
cheese_thumb_view_constructed (GObject *object)
{
CheeseThumbView *thumb_view = CHEESE_THUMB_VIEW (object);
CheeseThumbViewPrivate *priv = cheese_thumb_view_get_instance_private (thumb_view);
G_OBJECT_CLASS (cheese_thumb_view_parent_class)->constructed (object);
gtk_icon_view_set_model (GTK_ICON_VIEW (thumb_view), GTK_TREE_MODEL (priv->store));
gtk_widget_set_size_request (GTK_WIDGET (thumb_view),
THUMB_VIEW_MINIMUM_WIDTH,
THUMB_VIEW_MINIMUM_HEIGHT);
gtk_icon_view_set_margin (GTK_ICON_VIEW (thumb_view), 0);
gtk_icon_view_set_row_spacing (GTK_ICON_VIEW (thumb_view), 0);
gtk_icon_view_set_column_spacing (GTK_ICON_VIEW (thumb_view), 0);
gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (thumb_view), 0);
gtk_icon_view_set_columns (GTK_ICON_VIEW (thumb_view), -1);
gtk_icon_view_enable_model_drag_source (GTK_ICON_VIEW (thumb_view), GDK_BUTTON1_MASK,
target_table, G_N_ELEMENTS (target_table),
GDK_ACTION_COPY);
gtk_icon_view_set_selection_mode (GTK_ICON_VIEW (thumb_view), GTK_SELECTION_MULTIPLE);
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (priv->store),
THUMBNAIL_BASENAME_URL_COLUMN, GTK_SORT_ASCENDING);
cheese_thumb_view_fill (thumb_view);
cheese_thumb_view_set_vertical (thumb_view, FALSE);
}
示例10: gsb_select_icon_create_icon_view
/**
* Crée le GtkIconView
*
* \param nom de l'icône
*
* \return le GtkIconView rempli avec l'icône sélectionnée au premier plan
*
* */
GtkWidget * gsb_select_icon_create_icon_view ( gchar * name_icon )
{
GtkTreePath * tree_path;
/* construct the GtkIconView */
icon_view = gtk_icon_view_new ();
gtk_icon_view_set_margin ( GTK_ICON_VIEW ( icon_view ), 0 );
gtk_icon_view_set_spacing (GTK_ICON_VIEW ( icon_view ), 0 );
gtk_icon_view_set_selection_mode (GTK_ICON_VIEW ( icon_view ),
GTK_SELECTION_SINGLE );
gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW ( icon_view ), PIXBUF_COLUMN);
gtk_icon_view_set_text_column (GTK_ICON_VIEW ( icon_view ), TEXT_COLUMN);
/* remplissage et positionnement initial du curseur dans le GtkIconView */
tree_path = gsb_select_icon_fill_icon_view ( name_icon );
gtk_icon_view_select_path ( GTK_ICON_VIEW ( icon_view ), tree_path );
gtk_icon_view_set_cursor (GTK_ICON_VIEW ( icon_view ), tree_path,
NULL, TRUE);
gtk_icon_view_scroll_to_path (GTK_ICON_VIEW ( icon_view ),
tree_path, TRUE, 0.5, 0 );
return icon_view;
}
示例11: cheese_thumb_view_set_vertical
void
cheese_thumb_view_set_vertical (CheeseThumbView *thumb_view, gboolean vertical)
{
CheeseThumbViewPrivate *priv = cheese_thumb_view_get_instance_private (thumb_view);
priv->vertical = vertical;
if (!priv->vertical && priv->n_items)
gtk_icon_view_set_columns(GTK_ICON_VIEW (thumb_view), priv->n_items);
else
gtk_icon_view_set_columns(GTK_ICON_VIEW (thumb_view), 1);
gtk_widget_set_hexpand (GTK_WIDGET (thumb_view), !vertical);
gtk_widget_set_vexpand (GTK_WIDGET (thumb_view), vertical);
}
示例12: gtk_icon_view_item_accessible_get_image_position
static void
gtk_icon_view_item_accessible_get_image_position (AtkImage *image,
gint *x,
gint *y,
AtkCoordType coord_type)
{
GtkIconViewItemAccessible *item;
GdkRectangle box;
item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (image);
if (!GTK_IS_ICON_VIEW (item->widget))
return;
if (atk_state_set_contains_state (item->state_set, ATK_STATE_DEFUNCT))
return;
atk_component_get_position (ATK_COMPONENT (image), x, y, coord_type);
if (get_pixbuf_box (GTK_ICON_VIEW (item->widget), item->item, &box))
{
*x+= box.x - item->item->cell_area.x;
*y+= box.y - item->item->cell_area.y;
}
}
示例13: gtk_icon_view_item_accessible_get_image_size
static void
gtk_icon_view_item_accessible_get_image_size (AtkImage *image,
gint *width,
gint *height)
{
GtkIconViewItemAccessible *item;
GdkRectangle box;
item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (image);
if (!GTK_IS_ICON_VIEW (item->widget))
return;
if (atk_state_set_contains_state (item->state_set, ATK_STATE_DEFUNCT))
return;
*width = 0;
*height = 0;
if (get_pixbuf_box (GTK_ICON_VIEW (item->widget), item->item, &box))
{
*width = box.width;
*height = box.height;
}
}
示例14: gtk_icon_view_accessible_remove_selection
static gboolean
gtk_icon_view_accessible_remove_selection (AtkSelection *selection,
gint i)
{
GtkWidget *widget;
GtkIconView *icon_view;
GtkIconViewItem *item;
GList *l;
gint count;
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
if (widget == NULL)
return FALSE;
icon_view = GTK_ICON_VIEW (widget);
l = icon_view->priv->items;
count = 0;
while (l)
{
item = l->data;
if (item->selected)
{
if (count == i)
{
_gtk_icon_view_unselect_item (icon_view, item);
return TRUE;
}
count++;
}
l = l->next;
}
return FALSE;
}
示例15: gtk_icon_view_accessible_get_selection_count
static gint
gtk_icon_view_accessible_get_selection_count (AtkSelection *selection)
{
GtkWidget *widget;
GtkIconView *icon_view;
GtkIconViewItem *item;
GList *l;
gint count;
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
if (widget == NULL)
return 0;
icon_view = GTK_ICON_VIEW (widget);
l = icon_view->priv->items;
count = 0;
while (l)
{
item = l->data;
if (item->selected)
count++;
l = l->next;
}
return count;
}