aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/table')
-rw-r--r--widgets/table/e-cell-text.c5
-rw-r--r--widgets/table/e-cell-toggle.c7
-rw-r--r--widgets/table/e-cell-tree.c7
-rw-r--r--widgets/table/e-cell.c6
-rw-r--r--widgets/table/e-cell.h18
-rw-r--r--widgets/table/e-table-col.c1
-rw-r--r--widgets/table/e-table-col.h2
-rw-r--r--widgets/table/e-table-item.c19
8 files changed, 54 insertions, 11 deletions
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c
index 5a7f8d514e..10e3f7b8c6 100644
--- a/widgets/table/e-cell-text.c
+++ b/widgets/table/e-cell-text.c
@@ -422,7 +422,7 @@ ect_free_color (gchar *color_spec, GdkColor *color, GdkColormap *colormap)
*/
static void
ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
- int model_col, int view_col, int row, gboolean selected,
+ int model_col, int view_col, int row, ECellFlags flags,
int x1, int y1, int x2, int y2)
{
/* New ECellText */
@@ -444,9 +444,12 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
ECellTextLineBreaks *linebreaks;
GdkColor *foreground, *cell_foreground, *cursor_color;
gchar *color_spec;
+ gboolean selected;
EFontStyle style = E_FONT_PLAIN;
+ selected = flags & E_CELL_SELECTED;
+
if (ect->bold_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->bold_column, row))
style = E_FONT_BOLD;
diff --git a/widgets/table/e-cell-toggle.c b/widgets/table/e-cell-toggle.c
index 1be01348db..f0a05b488a 100644
--- a/widgets/table/e-cell-toggle.c
+++ b/widgets/table/e-cell-toggle.c
@@ -84,18 +84,21 @@ etog_unrealize (ECellView *ecv)
*/
static void
etog_draw (ECellView *ecell_view, GdkDrawable *drawable,
- int model_col, int view_col, int row, gboolean selected,
+ int model_col, int view_col, int row, ECellFlags flags,
int x1, int y1, int x2, int y2)
{
ECellToggle *toggle = E_CELL_TOGGLE (ecell_view->ecell);
+ gboolean selected;
#if 0
ECellToggleView *toggle_view = (ECellToggleView *) ecell_view;
#endif
GdkPixbuf *image;
int x, y, width, height;
-
+
const int value = GPOINTER_TO_INT (
e_table_model_value_at (ecell_view->e_table_model, model_col, row));
+
+ selected = flags & E_CELL_SELECTED;
if (value >= toggle->n_states){
g_warning ("Value from the table model is %d, the states we support are [0..%d)\n",
diff --git a/widgets/table/e-cell-tree.c b/widgets/table/e-cell-tree.c
index d4106271e6..3cc06a73ee 100644
--- a/widgets/table/e-cell-tree.c
+++ b/widgets/table/e-cell-tree.c
@@ -151,7 +151,7 @@ ect_unrealize (ECellView *ecv)
*/
static void
ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
- int model_col, int view_col, int row, gboolean selected,
+ int model_col, int view_col, int row, ECellFlags flags,
int x1, int y1, int x2, int y2)
{
ECellTreeView *tree_view = (ECellTreeView *)ecell_view;
@@ -161,10 +161,13 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
GtkWidget *canvas = GTK_WIDGET (tree_view->canvas);
GdkGC *fg_gc = canvas->style->fg_gc[GTK_STATE_ACTIVE];
GdkColor *foreground;
+ gboolean selected;
int offset, subcell_offset;
gboolean expanded, expandable;
+ selected = flags & E_CELL_SELECTED;
+
/* only draw the tree effects if we're the active sort */
if (/* XXX */ TRUE) {
GdkPixbuf *node_image;
@@ -286,7 +289,7 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
/* Now cause our subcell to draw its contents, shifted by
subcell_offset pixels */
e_cell_draw (tree_view->subcell_view, drawable,
- model_col, view_col, row, selected,
+ model_col, view_col, row, flags,
x1 + subcell_offset, y1, x2, y2);
}
diff --git a/widgets/table/e-cell.c b/widgets/table/e-cell.c
index 75be2ce916..3212157675 100644
--- a/widgets/table/e-cell.c
+++ b/widgets/table/e-cell.c
@@ -36,7 +36,7 @@ ec_unrealize (ECellView *e_cell)
static void
ec_draw (ECellView *ecell_view, GdkDrawable *drawable,
- int model_col, int view_col, int row, gboolean selected,
+ int model_col, int view_col, int row, ECellFlags flags,
int x1, int y1, int x2, int y2)
{
g_error ("e-cell-draw invoked\n");
@@ -151,10 +151,10 @@ e_cell_unrealize (ECellView *ecell_view)
void
e_cell_draw (ECellView *ecell_view, GdkDrawable *drawable,
- int model_col, int view_col, int row, gboolean selected, int x1, int y1, int x2, int y2)
+ int model_col, int view_col, int row, ECellFlags flags, int x1, int y1, int x2, int y2)
{
E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->draw (
- ecell_view, drawable, model_col, view_col, row, selected, x1, y1, x2, y2);
+ ecell_view, drawable, model_col, view_col, row, flags, x1, y1, x2, y2);
}
void
diff --git a/widgets/table/e-cell.h b/widgets/table/e-cell.h
index 40b257f264..3b12aab1e3 100644
--- a/widgets/table/e-cell.h
+++ b/widgets/table/e-cell.h
@@ -14,6 +14,20 @@
typedef struct _ECell ECell;
typedef struct _ECellView ECellView;
+typedef enum _ECellFlags ECellFlags;
+
+enum _ECellFlags {
+ E_CELL_SELECTED = 1 << 0,
+
+ E_CELL_JUSTIFICATION = 3 << 1,
+ E_CELL_JUSTIFY_CENTER = 0 << 1,
+ E_CELL_JUSTIFY_LEFT = 1 << 1,
+ E_CELL_JUSTIFY_RIGHT = 2 << 1,
+ E_CELL_JUSTIFY_FILL = 3 << 1,
+
+ E_CELL_ALIGN_LEFT = 1 << 1,
+ E_CELL_ALIGN_RIGHT = 1 << 2,
+};
struct _ECell {
GtkObject object;
@@ -41,7 +55,7 @@ typedef struct {
void (*draw) (ECellView *ecell_view, GdkDrawable *drawable,
int model_col, int view_col, int row,
- gboolean selected, int x1, int y1, int x2, int y2);
+ ECellFlags flags, int x1, int y1, int x2, int y2);
gint (*event) (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row);
void (*focus) (ECellView *ecell_view, int model_col, int view_col,
int row, int x1, int y1, int x2, int y2);
@@ -67,7 +81,7 @@ void e_cell_realize (ECellView *ecell_view);
void e_cell_unrealize (ECellView *ecell_view);
void e_cell_draw (ECellView *ecell_view, GdkDrawable *dr,
- int model_col, int view_col, int row, gboolean selected,
+ int model_col, int view_col, int row, ECellFlags flags,
int x1, int y1, int x2, int y2);
void e_cell_print (ECellView *ecell_view, GnomePrintContext *context,
int model_col, int view_col, int row,
diff --git a/widgets/table/e-table-col.c b/widgets/table/e-table-col.c
index e767aa5567..0e7c14f748 100644
--- a/widgets/table/e-table-col.c
+++ b/widgets/table/e-table-col.c
@@ -84,6 +84,7 @@ e_table_col_init (ETableCol *etc)
etc->width = 0;
etc->sortable = 1;
etc->groupable = 1;
+ etc->justification = GTK_JUSTIFY_LEFT;
}
E_MAKE_TYPE(e_table_col, "ETableCol", ETableCol, e_table_col_class_init, e_table_col_init, PARENT_TYPE);
diff --git a/widgets/table/e-table-col.h b/widgets/table/e-table-col.h
index 39aeb26ba9..c2585f8166 100644
--- a/widgets/table/e-table-col.h
+++ b/widgets/table/e-table-col.h
@@ -40,6 +40,8 @@ struct _ETableCol {
unsigned int groupable:1;
int col_idx;
+ GtkJustification justification;
+
ETableColArrow arrow;
ECell *ecell;
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
index 0f70861f1e..afa1bb8f96 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/table/e-table-item.c
@@ -1192,6 +1192,7 @@ eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width,
ETableCol *ecol = e_table_header_get_column (eti->header, col);
ECellView *ecell_view = eti->cell_views [col];
gboolean col_selected = selected;
+ ECellFlags flags;
switch (eti->cursor_mode) {
case E_TABLE_CURSOR_SIMPLE:
if (cursor_col == ecol->col_idx && cursor_row == view_to_model_row(eti, row))
@@ -1215,7 +1216,23 @@ eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width,
gdk_draw_rectangle (drawable, eti->fill_gc, TRUE,
xd, yd, ecol->width, height);
- e_cell_draw (ecell_view, drawable, ecol->col_idx, col, row, col_selected,
+ flags = col_selected ? E_CELL_SELECTED : 0;
+ switch (ecol->justification) {
+ case GTK_JUSTIFY_LEFT:
+ flags |= E_CELL_JUSTIFY_LEFT;
+ break;
+ case GTK_JUSTIFY_RIGHT:
+ flags |= E_CELL_JUSTIFY_RIGHT;
+ break;
+ case GTK_JUSTIFY_CENTER:
+ flags |= E_CELL_JUSTIFY_CENTER;
+ break;
+ case GTK_JUSTIFY_FILL:
+ flags |= E_CELL_JUSTIFY_FILL;
+ break;
+ }
+
+ e_cell_draw (ecell_view, drawable, ecol->col_idx, col, row, flags,
xd, yd, xd + ecol->width, yd + height);
if (view_to_model_col(eti, col) == cursor_col && view_to_model_row(eti, row) == cursor_row){