aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table
diff options
context:
space:
mode:
authorChris Toshok <toshok@helixcode.com>2000-06-11 13:07:13 +0800
committerChris Toshok <toshok@src.gnome.org>2000-06-11 13:07:13 +0800
commitab8f482b2143943ff8d33bd1b6f986e7636d0056 (patch)
tree890fb5bc02ee9e790ccd37799494ee51f42a9a8d /widgets/table
parent57067e5c76ea8a96d05201711c83236bbdc240d7 (diff)
downloadgsoc2013-evolution-ab8f482b2143943ff8d33bd1b6f986e7636d0056.tar.gz
gsoc2013-evolution-ab8f482b2143943ff8d33bd1b6f986e7636d0056.tar.zst
gsoc2013-evolution-ab8f482b2143943ff8d33bd1b6f986e7636d0056.zip
supply the pixbufs here.
2000-06-10 Chris Toshok <toshok@helixcode.com> * e-tree-example-1.c (create_tree): supply the pixbufs here. * e-cell-tree.h: change pixbuf names to open_pixbuf/closed_pixbuf. * e-cell-tree.c (e_cell_tree_construct): take open/closed pixbuf parameters, and don't #include the .xpm files directly here. (e_cell_tree_new): same. (ect_draw): use the pixbufs from the ECellTree. svn path=/trunk/; revision=3522
Diffstat (limited to 'widgets/table')
-rw-r--r--widgets/table/e-cell-tree.c23
-rw-r--r--widgets/table/e-cell-tree.h14
-rw-r--r--widgets/table/e-tree-example-1.c16
3 files changed, 34 insertions, 19 deletions
diff --git a/widgets/table/e-cell-tree.c b/widgets/table/e-cell-tree.c
index 893cae4f4c..28de6ff5bb 100644
--- a/widgets/table/e-cell-tree.c
+++ b/widgets/table/e-cell-tree.c
@@ -31,9 +31,6 @@
#include <ctype.h>
#include <math.h>
-#include "tree-expanded.xpm"
-#include "tree-unexpanded.xpm"
-
#define PARENT_TYPE e_cell_get_type ()
typedef struct {
@@ -47,8 +44,6 @@ typedef struct {
static ECellClass *parent_class;
-static GdkPixbuf *tree_expanded_pixbuf, *tree_unexpanded_pixbuf;
-
#define INDENT_AMOUNT 16
static int
@@ -249,7 +244,9 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
/* now draw our icon if we're expandable */
if (expandable) {
- GdkPixbuf *image = expanded ? tree_expanded_pixbuf : tree_unexpanded_pixbuf;
+ GdkPixbuf *image = (expanded
+ ? E_CELL_TREE(tree_view->cell_view.ecell)->open_pixbuf
+ : E_CELL_TREE(tree_view->cell_view.ecell)->closed_pixbuf);
int width, height;
width = gdk_pixbuf_get_width(image);
@@ -390,34 +387,34 @@ e_cell_tree_class_init (GtkObjectClass *object_class)
ecc->leave_edit = ect_leave_edit;
parent_class = gtk_type_class (PARENT_TYPE);
-
- /*
- * Create our pixbuf for expanding/unexpanding
- */
- tree_expanded_pixbuf = gdk_pixbuf_new_from_xpm_data(tree_expanded_xpm);
- tree_unexpanded_pixbuf = gdk_pixbuf_new_from_xpm_data(tree_unexpanded_xpm);
}
E_MAKE_TYPE(e_cell_tree, "ECellTree", ECellTree, e_cell_tree_class_init, NULL, PARENT_TYPE);
void
e_cell_tree_construct (ECellTree *ect,
+ GdkPixbuf *open_pixbuf,
+ GdkPixbuf *closed_pixbuf,
gboolean draw_lines,
ECell *subcell)
{
ect->subcell = subcell;
+ ect->open_pixbuf = open_pixbuf;
+ ect->closed_pixbuf = closed_pixbuf;
ect->draw_lines = draw_lines;
}
ECell *
e_cell_tree_new (ETableModel *etm,
+ GdkPixbuf *open_pixbuf,
+ GdkPixbuf *closed_pixbuf,
gboolean draw_lines,
ECell *subcell)
{
ECellTree *ect = gtk_type_new (e_cell_tree_get_type ());
- e_cell_tree_construct (ect, draw_lines, subcell);
+ e_cell_tree_construct (ect, open_pixbuf, closed_pixbuf, draw_lines, subcell);
return (ECell *) ect;
}
diff --git a/widgets/table/e-cell-tree.h b/widgets/table/e-cell-tree.h
index 6bd842b39e..ef6babeda4 100644
--- a/widgets/table/e-cell-tree.h
+++ b/widgets/table/e-cell-tree.h
@@ -21,8 +21,8 @@ typedef struct {
gboolean draw_lines;
- GdkPixbuf *expanded_image;
- GdkPixbuf *unexpanded_image;
+ GdkPixbuf *open_pixbuf;
+ GdkPixbuf *closed_pixbuf;
ECell *subcell;
} ECellTree;
@@ -32,9 +32,15 @@ typedef struct {
} ECellTreeClass;
GtkType e_cell_tree_get_type (void);
-ECell *e_cell_tree_new (ETableModel *model, gboolean draw_lines,
+ECell *e_cell_tree_new (ETableModel *model,
+ GdkPixbuf *open_pixbuf,
+ GdkPixbuf *closed_pixbuf,
+ gboolean draw_lines,
ECell *subcell);
-void e_cell_tree_construct (ECellTree *ect, gboolean draw_lines,
+void e_cell_tree_construct (ECellTree *ect,
+ GdkPixbuf *open_pixbuf,
+ GdkPixbuf *closed_pixbuf,
+ gboolean draw_lines,
ECell *subcell);
#endif /* _E_CELL_TREE_H_ */
diff --git a/widgets/table/e-tree-example-1.c b/widgets/table/e-tree-example-1.c
index c598e33ea4..e2ba566a99 100644
--- a/widgets/table/e-tree-example-1.c
+++ b/widgets/table/e-tree-example-1.c
@@ -15,7 +15,10 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
-#define ROWS 10
+#include "tree-expanded.xpm"
+#include "tree-unexpanded.xpm"
+
+
#define COLS 4
#define IMPORTANCE_COLUMN 4
@@ -218,6 +221,7 @@ static void
create_tree (void)
{
GtkWidget *window, *frame, *button, *vbox;
+ GdkPixbuf *tree_expanded_pixbuf, *tree_unexpanded_pixbuf;
ECell *cell_left_just;
ECell *cell_tree;
ETableHeader *e_table_header;
@@ -265,13 +269,21 @@ create_tree (void)
* each column.
*/
cell_left_just = e_cell_text_new (E_TABLE_MODEL(e_tree_model), NULL, GTK_JUSTIFY_LEFT);
+
+ /*
+ * Create our pixbuf for expanding/unexpanding
+ */
+ tree_expanded_pixbuf = gdk_pixbuf_new_from_xpm_data(tree_expanded_xpm);
+ tree_unexpanded_pixbuf = gdk_pixbuf_new_from_xpm_data(tree_unexpanded_xpm);
/*
* This renderer is used for the tree column (the leftmost one), and
* has as its subcell renderer the text renderer. this means that
* text is displayed to the right of the tree pipes.
*/
- cell_tree = e_cell_tree_new (E_TABLE_MODEL(e_tree_model), TRUE, cell_left_just);
+ cell_tree = e_cell_tree_new (E_TABLE_MODEL(e_tree_model),
+ tree_expanded_pixbuf, tree_unexpanded_pixbuf,
+ TRUE, cell_left_just);
/*
* Next we create a column object for each view column and add