Article View: pl.comp.os.linux.programowanie
Article #72398Re: Jak umieścić Stock Item w gtk_tree_view _
From: Badman
Date: Thu, 08 Dec 2011 08:19
Date: Thu, 08 Dec 2011 08:19
49 lines
2606 bytes
2606 bytes
W końcu udało mi się :) Poniżej przykład, ponieważ to co jest w gtk-demo wykorzystuje rejestracje nowego typu składającego się z kilku elementów: 1) Wykorzystanie atrybutu stock-id w GtkCellRendererPixbuf: GtkWidget *listview; GtkTreeViewColumn *kol; GtkCellRendererPixbuf *komorka; GtkListStore *lista; GtkTreeIter iter; listview = gtk_tree_view_new (); kol = gtk_tree_view_column_new (); gtk_tree_view_column_set_title ( kol, "Stock Item" ); komorka = gtk_cell_renderer_pixbuf_new (); gtk_tree_view_column_pack_start (kol, komorka, TRUE); /* UWAGA: ważne jest dodanie atrybutu za gtk_tree_view_column_pack_start, kiedy będzię przed nie działa */ gtk_tree_view_column_add_attribute(kol, GTK_CELL_RENDERER(komorka), "stock-id", 1); komorka = gtk_cell_renderer_text_new (); gtk_tree_view_column_pack_start (kol, komorka, TRUE); gtk_tree_view_append_column ( GTK_TREE_VIEW(listview), kol ); lista = gtk_list_store_new ( 2, GDK_TYPE_PIXBUF, G_TYPE_STRING ); gtk_list_store_append ( lista, &iter ); /* Dodaje elemtu stock na podstawie stock-id, w tym przypadku GTK_STOCK_APPLY */ gtk_list_store_set ( lista, &iter, 1, GTK_STOCK_APPLY, -1); gtk_tree_view_set_model ( GTK_TREE_VIEW(listview), GTK_TREE_MODEL(lista) ); -- Pozdrawiam Badman
Technical Details
Message-ID:
<ab5f6110-47a4-4cb5-a63c-94dfbc897598@h5g2000yqk.googlegroups.com>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!fu-berlin.de!postnews.google.com!h5g2000yqk.googlegroups.com!not-for-mailReferences:
<8c7652ad-4bf8-4c66-8ae8-2c7e63fb7ad1@u5g2000vbd.googlegroups.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!fu-berlin.de!postnews.google.com!h5g2000yqk.googlegroups.com!not-for-mail From: Badman <tomasz.gutewicz@gmail.com> Newsgroups: pl.comp.os.linux.programowanie Subject: Re: Jak umieścić Stock Item w gtk_tree_view _ Date: Thu, 8 Dec 2011 00:19:43 -0800 (PST) Organization: http://groups.google.com Lines: 49 Message-ID: <ab5f6110-47a4-4cb5-a63c-94dfbc897598@h5g2000yqk.googlegroups.com> References: <8c7652ad-4bf8-4c66-8ae8-2c7e63fb7ad1@u5g2000vbd.googlegroups.com> NNTP-Posting-Host: 80.50.142.34 Mime-Version: 1.0 X-Trace: posting.google.com 1323332383 27329 127.0.0.1 (8 Dec 2011 08:19:43 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 8 Dec 2011 08:19:43 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: h5g2000yqk.googlegroups.com; posting-host=80.50.142.34; posting-account=LRlyMAoAAAB5PUSE0WgNTC0mFNT33qAa User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: ARLUEHNKC X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729),gzip(gfe) Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit