Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » GTK+
  • » how to make gtkiconview one column grid centred. [RSS Feed]

#1 Nov. 30, 2005 08:14:50

ahmad h.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

how to make gtkiconview one column grid centred.


Hi,I am making a gtkiconview in a left side of a hpanel. The code is pasted atthe end.i am facing two problems at the moment.

1. The text beneath icon is wrapped which i kinda fixed withgtk_icon_view_set_item_width (GTK_ICON_VIEW (icon_view), 100); but i want amore plausible handling way such that any lenght text is shown in one linenot wrapped. Actually it covers the icon are width and then afterwards itwraps.2. This one is not catered of at the moment.when i move the hpanel the iconview remains to the left side and the are oficonview is increased. Remember i am using one column only in gtkiconview. Iwant the column to be centred in the middle of the area.gtkiconview is in a scrolledarea. i have deleted that. I want no scrolling.
How can i make gtkiconview(one column) always centred in any resized area.

GtkWidget *
create_iconview(GtkWidget *mainWnd)
{
GtkWidget *icon_view;
GtkListStore *store;
GdkPixbuf *icon;
GError *error = NULL;
GtkTreeIter iter;

// Load up the tree view.
icon_view = lookup_widget(mainWnd, "iconview1");store = gtk_list_store_new(NUM_COLS_ICONVIEW, G_TYPE_STRING,GDK_TYPE_PIXBUF);icon = gdk_pixbuf_new_from_file("Welcome.png", &error);
if (error)
{
g_warning ("Could not load icon: %s\n", error->message);
g_error_free(error);
error = NULL;
}


gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
COL_DISPLAY_NAME, "Welcome",
COL_PIXBUF, icon,
-1);

gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
COL_DISPLAY_NAME, "BackUp",
COL_PIXBUF, icon,
-1);

gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
COL_DISPLAY_NAME, "Restore",
COL_PIXBUF, icon,
-1);

gtk_icon_view_set_model(GTK_ICON_VIEW(icon_view), GTK_TREE_MODEL
(store));
g_object_unref (store);

/* We now set which model columns that correspond to the text
* and pixbuf of each item
*/gtk_icon_view_set_text_column (GTK_ICON_VIEW (icon_view),COL_DISPLAY_NAME);gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (icon_view), COL_PIXBUF);

gtk_icon_view_set_columns(GTK_ICON_VIEW (icon_view), 1);
gtk_icon_view_set_item_width (GTK_ICON_VIEW (icon_view), 100);

gtk_widget_grab_focus (icon_view);
}

_________________________________________________________________Express yourself instantly with MSN Messenger! Download today it's FREE!http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/_______________________________________________
gtk-list mailing list
gtk-list@gnome.orghttp://mail.gnome.org/mailman/listinfo/gtk-list

Offline

  • Root
  • » GTK+
  • » how to make gtkiconview one column grid centred. [RSS Feed]

Board footer

Moderator control

Enjoy the 22nd of January
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support