1/* gtkcellrenderer.h
2 * Copyright (C) 2000 Red Hat, Inc., Jonathan Blandford <[email protected]>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
18 */
19
20#ifndef __GTK_CELL_RENDERER_H__
21#define __GTK_CELL_RENDERER_H__
22
23#if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
24#error "Only <gtk/gtk.h> can be included directly."
25#endif
26
27#include <gtk/gtkcelleditable.h>
28
29G_BEGIN_DECLS
30
31typedef enum
32{
33 GTK_CELL_RENDERER_SELECTED = 1 << 0,
34 GTK_CELL_RENDERER_PRELIT = 1 << 1,
35 GTK_CELL_RENDERER_INSENSITIVE = 1 << 2,
36 /* this flag means the cell is in the sort column/row */
37 GTK_CELL_RENDERER_SORTED = 1 << 3,
38 GTK_CELL_RENDERER_FOCUSED = 1 << 4
39} GtkCellRendererState;
40
41typedef enum
42{
43 GTK_CELL_RENDERER_MODE_INERT,
44 GTK_CELL_RENDERER_MODE_ACTIVATABLE,
45 GTK_CELL_RENDERER_MODE_EDITABLE
46} GtkCellRendererMode;
47
48#define GTK_TYPE_CELL_RENDERER (gtk_cell_renderer_get_type ())
49#define GTK_CELL_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CELL_RENDERER, GtkCellRenderer))
50#define GTK_CELL_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CELL_RENDERER, GtkCellRendererClass))
51#define GTK_IS_CELL_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CELL_RENDERER))
52#define GTK_IS_CELL_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CELL_RENDERER))
53#define GTK_CELL_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CELL_RENDERER, GtkCellRendererClass))
54
55typedef struct _GtkCellRenderer GtkCellRenderer;
56typedef struct _GtkCellRendererClass GtkCellRendererClass;
57
58struct _GtkCellRenderer
59{
60 GtkObject parent;
61
62 gfloat GSEAL (xalign);
63 gfloat GSEAL (yalign);
64
65 gint GSEAL (width);
66 gint GSEAL (height);
67
68 guint16 GSEAL (xpad);
69 guint16 GSEAL (ypad);
70
71 guint GSEAL (mode) : 2;
72 guint GSEAL (visible) : 1;
73 guint GSEAL (is_expander) : 1;
74 guint GSEAL (is_expanded) : 1;
75 guint GSEAL (cell_background_set) : 1;
76 guint GSEAL (sensitive) : 1;
77 guint GSEAL (editing) : 1;
78};
79
80struct _GtkCellRendererClass
81{
82 GtkObjectClass parent_class;
83
84 /* vtable - not signals */
85 void (* get_size) (GtkCellRenderer *cell,
86 GtkWidget *widget,
87 GdkRectangle *cell_area,
88 gint *x_offset,
89 gint *y_offset,
90 gint *width,
91 gint *height);
92 void (* render) (GtkCellRenderer *cell,
93 GdkDrawable *window,
94 GtkWidget *widget,
95 GdkRectangle *background_area,
96 GdkRectangle *cell_area,
97 GdkRectangle *expose_area,
98 GtkCellRendererState flags);
99 gboolean (* activate) (GtkCellRenderer *cell,
100 GdkEvent *event,
101 GtkWidget *widget,
102 const gchar *path,
103 GdkRectangle *background_area,
104 GdkRectangle *cell_area,
105 GtkCellRendererState flags);
106 GtkCellEditable *(* start_editing) (GtkCellRenderer *cell,
107 GdkEvent *event,
108 GtkWidget *widget,
109 const gchar *path,
110 GdkRectangle *background_area,
111 GdkRectangle *cell_area,
112 GtkCellRendererState flags);
113
114 /* Signals */
115 void (* editing_canceled) (GtkCellRenderer *cell);
116 void (* editing_started) (GtkCellRenderer *cell,
117 GtkCellEditable *editable,
118 const gchar *path);
119
120 /* Padding for future expansion */
121 void (*_gtk_reserved1) (void);
122 void (*_gtk_reserved2) (void);
123};
124
125GType gtk_cell_renderer_get_type (void) G_GNUC_CONST;
126
127void gtk_cell_renderer_get_size (GtkCellRenderer *cell,
128 GtkWidget *widget,
129 const GdkRectangle *cell_area,
130 gint *x_offset,
131 gint *y_offset,
132 gint *width,
133 gint *height);
134void gtk_cell_renderer_render (GtkCellRenderer *cell,
135 GdkWindow *window,
136 GtkWidget *widget,
137 const GdkRectangle *background_area,
138 const GdkRectangle *cell_area,
139 const GdkRectangle *expose_area,
140 GtkCellRendererState flags);
141gboolean gtk_cell_renderer_activate (GtkCellRenderer *cell,
142 GdkEvent *event,
143 GtkWidget *widget,
144 const gchar *path,
145 const GdkRectangle *background_area,
146 const GdkRectangle *cell_area,
147 GtkCellRendererState flags);
148GtkCellEditable *gtk_cell_renderer_start_editing (GtkCellRenderer *cell,
149 GdkEvent *event,
150 GtkWidget *widget,
151 const gchar *path,
152 const GdkRectangle *background_area,
153 const GdkRectangle *cell_area,
154 GtkCellRendererState flags);
155
156void gtk_cell_renderer_set_fixed_size (GtkCellRenderer *cell,
157 gint width,
158 gint height);
159void gtk_cell_renderer_get_fixed_size (GtkCellRenderer *cell,
160 gint *width,
161 gint *height);
162
163void gtk_cell_renderer_set_alignment (GtkCellRenderer *cell,
164 gfloat xalign,
165 gfloat yalign);
166void gtk_cell_renderer_get_alignment (GtkCellRenderer *cell,
167 gfloat *xalign,
168 gfloat *yalign);
169
170void gtk_cell_renderer_set_padding (GtkCellRenderer *cell,
171 gint xpad,
172 gint ypad);
173void gtk_cell_renderer_get_padding (GtkCellRenderer *cell,
174 gint *xpad,
175 gint *ypad);
176
177void gtk_cell_renderer_set_visible (GtkCellRenderer *cell,
178 gboolean visible);
179gboolean gtk_cell_renderer_get_visible (GtkCellRenderer *cell);
180
181void gtk_cell_renderer_set_sensitive (GtkCellRenderer *cell,
182 gboolean sensitive);
183gboolean gtk_cell_renderer_get_sensitive (GtkCellRenderer *cell);
184
185/* For use by cell renderer implementations only */
186#ifndef GTK_DISABLE_DEPRECATED
187void gtk_cell_renderer_editing_canceled (GtkCellRenderer *cell);
188#endif
189void gtk_cell_renderer_stop_editing (GtkCellRenderer *cell,
190 gboolean canceled);
191
192
193G_END_DECLS
194
195#endif /* __GTK_CELL_RENDERER_H__ */
196