OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
iconview.c File Reference
#include <stdlib.h>
#include "mape/iconview.h"
Include dependency graph for iconview.c:

Go to the source code of this file.

Functions

MapeIconViewmape_icon_view_new (GError **error)
 
void mape_icon_view_destroy (MapeIconView *view)
 
void mape_icon_view_clear (MapeIconView *view)
 
void mape_icon_view_add (MapeIconView *view, GdkPixbuf *icon, const char *name)
 

Function Documentation

void mape_icon_view_add ( MapeIconView view,
GdkPixbuf *  icon,
const char *  name 
)

Definition at line 113 of file iconview.c.

References MapeIconView_::list_store, MAPE_ICON_VIEW_COLUMN_ICON, and MAPE_ICON_VIEW_COLUMN_NAME.

Referenced by mape_mat_tex_view_reload().

116 {
117  GtkTreeIter iter;
118 
119  gtk_list_store_append(
120  GTK_LIST_STORE(view->list_store),
121  &iter
122  );
123 
124  gtk_list_store_set(
125  GTK_LIST_STORE(view->list_store),
126  &iter,
128  icon,
130  name,
131  -1
132  );
133 }
GtkTreeModel * list_store
Definition: iconview.h:33

Here is the caller graph for this function:

void mape_icon_view_clear ( MapeIconView view)

Definition at line 108 of file iconview.c.

References MapeIconView_::list_store.

Referenced by mape_mat_tex_view_reload().

109 {
110  gtk_list_store_clear(GTK_LIST_STORE(view->list_store) );
111 }
GtkTreeModel * list_store
Definition: iconview.h:33

Here is the caller graph for this function:

void mape_icon_view_destroy ( MapeIconView view)

Definition at line 102 of file iconview.c.

Referenced by mape_mat_tex_view_destroy(), and mape_mat_tex_view_new().

103 {
104  /* TODO: unref cell renderers? */
105  free(view);
106 }

Here is the caller graph for this function:

MapeIconView* mape_icon_view_new ( GError **  error)

Definition at line 19 of file iconview.c.

References MapeIconView_::list_store, MAPE_ICON_VIEW_COLUMN_COUNT, MAPE_ICON_VIEW_COLUMN_ICON, MAPE_ICON_VIEW_COLUMN_NAME, MapeIconView_::renderer_icon, MapeIconView_::renderer_name, MapeIconView_::view, and MapeIconView_::window.

Referenced by mape_mat_tex_view_new().

20 {
21  MapeIconView* view;
22  view = malloc(sizeof(MapeIconView) );
23 
24  view->list_store = GTK_TREE_MODEL(
25  gtk_list_store_new(
27  GDK_TYPE_PIXBUF,
28  G_TYPE_STRING
29  )
30  );
31 
32  view->view = gtk_icon_view_new_with_model(view->list_store);
33  g_object_unref(view->list_store);
34 
35  gtk_icon_view_set_item_orientation(
36  GTK_ICON_VIEW(view->view),
37  GTK_ORIENTATION_HORIZONTAL
38  );
39 
40  view->renderer_icon = gtk_cell_renderer_pixbuf_new();
41  gtk_cell_layout_pack_start(
42  GTK_CELL_LAYOUT(view->view),
43  view->renderer_icon,
44  FALSE
45  );
46 
47  gtk_cell_layout_set_attributes(
48  GTK_CELL_LAYOUT(view->view),
49  view->renderer_icon,
51  NULL
52  );
53 
54  view->renderer_name = gtk_cell_renderer_text_new();
55  gtk_cell_layout_pack_start(
56  GTK_CELL_LAYOUT(view->view),
57  view->renderer_name,
58  TRUE
59  );
60 
61  gtk_cell_layout_set_attributes(
62  GTK_CELL_LAYOUT(view->view),
63  view->renderer_name,
65  NULL
66  );
67 
68  gtk_icon_view_set_selection_mode(
69  GTK_ICON_VIEW(view->view),
70  GTK_SELECTION_NONE
71  );
72 
73  gtk_tree_sortable_set_sort_column_id(
74  GTK_TREE_SORTABLE(view->list_store),
76  GTK_SORT_ASCENDING
77  );
78 
79  gtk_widget_show(view->view);
80 
81  view->window = gtk_scrolled_window_new(NULL, NULL);
82  gtk_container_add(
83  GTK_CONTAINER(view->window),
84  view->view
85  );
86 
87  gtk_scrolled_window_set_policy(
88  GTK_SCROLLED_WINDOW(view->window),
89  GTK_POLICY_AUTOMATIC,
90  GTK_POLICY_AUTOMATIC
91  );
92 
93  gtk_scrolled_window_set_shadow_type(
94  GTK_SCROLLED_WINDOW(view->window),
95  GTK_SHADOW_IN
96  );
97 
98  gtk_widget_show(view->window);
99  return view;
100 }
GtkWidget * window
Definition: iconview.h:30
GtkCellRenderer * renderer_icon
Definition: iconview.h:35
GtkCellRenderer * renderer_name
Definition: iconview.h:36
GtkTreeModel * list_store
Definition: iconview.h:33
GtkWidget * view
Definition: iconview.h:31

Here is the caller graph for this function: