aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/e-table/e-cell.c
blob: 8a8897c22aba31a70d389b02a75468c0efe969e2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*
 * e-cell.c: base class for cell renderers in e-table
 *
 * Author:
 *   Miguel de Icaza (miguel@kernel.org)
 *
 * (C) 1999 Helix Code, Inc
 */
#include <config.h>
#include "e-cell.h"
#include "e-util.h"

#define PARENT_TYPE gtk_object_get_type()

static ECellView *
ec_realize (ECell *e_cell, GnomeCanvas *canvas)
{
    return NULL;
}

static void
ec_unrealize (ECellView *e_cell)
{
}

static void
ec_draw (ECellView *ecell_view, GdkDrawable *drawable, int col, int row, int x1, int y1, int x2, int y2)
{
    g_warning ("e-cell-draw invoked\n");
}

static gint
ec_event (ECellView *ecell_view, GdkEvent *event, int col, int row)
{
    g_warning ("e-cell-event invoked\n");
}

static gint
ec_height (ECellView *ecell_view, int col, int row)
{
    g_warning ("e-cell-event invoked\n");
    return 0;
}

static void
ec_focus (ECellView *ecell_view, int col, int row, int x1, int y1, int x2, int y2)
{
    ecell_view->focus_col = col;
    ecell_view->focus_row = row;
    ecell_view->focus_x1 = x1;
    ecell_view->focus_y1 = y1;
    ecell_view->focus_x2 = x2;
    ecell_view->focus_y2 = y2;
}

static void
ec_unfocus (ECellView *ecell_view)
{
    ecell_view->focus_col = -1;
    ecell_view->focus_row = -1;
    ecell_view->focus_x1 = -1;
    ecell_view->focus_y1 = -1;
    ecell_view->focus_x2 = -1;
    ecell_view->focus_y2 = -1;
}

static void
e_cell_class_init (GtkObjectClass *object_class)
{
    ECellClass *ecc = (ECellClass *) object_class;

    ecc->realize = ec_realize;
    ecc->unrealize = ec_unrealize;
    ecc->draw = ec_draw;
    ecc->event = ec_event;
    ecc->focus = ec_focus;
    ecc->unfocus = ec_unfocus;
    ecc->height = ec_height;
}

static void
e_cell_init (GtkObject *object)
{
    ECell *e_cell = E_CELL (object);
}

E_MAKE_TYPE(e_cell, "ECell", ECell, e_cell_class_init, e_cell_init, PARENT_TYPE);

    
void
e_cell_event (ECellView *ecell_view, GdkEvent *event, int col, int row)
{
    E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->event (
        ecell_view, event, col, row);
}

ECellView *
e_cell_realize (ECell *ecell, GnomeCanvas *canvas)
{
    return E_CELL_CLASS (GTK_OBJECT (ecell)->klass)->realize (
        ecell, canvas);
}

void
e_cell_unrealize (ECellView *ecell_view)
{
    E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->unrealize (ecell_view);
}
    
void
e_cell_draw (ECellView *ecell_view, GdkDrawable *drawable,
         int col, int row, int x1, int y1, int x2, int y2)
{
    E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->draw (
        ecell_view, drawable, col, row, x1, y1, x2, y2);
}

int
e_cell_height (ECellView *ecell_view, int col, int row)
{
    return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->height (
        ecell_view, col, row);
}