1
/* The GIMP -- an image manipulation program
2
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
5
* Copyright (C) 1999-2001 Michael Natterer
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2 of the License, or
10
* (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
#ifndef __GIMP_CONTEXT_H__
23
#define __GIMP_CONTEXT_H__
26
#include "gimpobject.h"
29
#define GIMP_TYPE_CONTEXT (gimp_context_get_type ())
30
#define GIMP_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_CONTEXT, GimpContext))
31
#define GIMP_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST (klass, GIMP_TYPE_CONTEXT, GimpContextClass))
32
#define GIMP_IS_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_CONTEXT))
33
#define GIMP_IS_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CONTEXT))
34
#define GIMP_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS (obj, GIMP_TYPE_CONTEXT, GimpContextClass))
37
typedef struct _GimpContextClass GimpContextClass;
41
GimpObject parent_instance;
47
guint32 defined_props;
48
guint32 serialize_props;
53
GimpToolInfo *tool_info;
60
GimpLayerModeEffects paint_mode;
68
GimpGradient *gradient;
80
GimpImagefile *imagefile;
81
gchar *imagefile_name;
83
GimpTemplate *template;
87
struct _GimpContextClass
89
GimpObjectClass parent_class;
91
void (* image_changed) (GimpContext *context,
93
void (* display_changed) (GimpContext *context,
96
void (* tool_changed) (GimpContext *context,
97
GimpToolInfo *tool_info);
99
void (* foreground_changed) (GimpContext *context,
101
void (* background_changed) (GimpContext *context,
103
void (* opacity_changed) (GimpContext *context,
105
void (* paint_mode_changed) (GimpContext *context,
106
GimpLayerModeEffects paint_mode);
107
void (* brush_changed) (GimpContext *context,
109
void (* pattern_changed) (GimpContext *context,
110
GimpPattern *pattern);
111
void (* gradient_changed) (GimpContext *context,
112
GimpGradient *gradient);
113
void (* palette_changed) (GimpContext *context,
114
GimpPalette *palette);
115
void (* font_changed) (GimpContext *context,
117
void (* buffer_changed) (GimpContext *context,
119
void (* imagefile_changed) (GimpContext *context,
120
GimpImagefile *imagefile);
121
void (* template_changed) (GimpContext *context,
122
GimpTemplate *template);
126
GType gimp_context_get_type (void) G_GNUC_CONST;
128
GimpContext * gimp_context_new (Gimp *gimp,
130
GimpContext *template);
132
const gchar * gimp_context_get_name (const GimpContext *context);
133
void gimp_context_set_name (GimpContext *context,
136
GimpContext * gimp_context_get_parent (const GimpContext *context);
137
void gimp_context_set_parent (GimpContext *context,
138
GimpContext *parent);
140
/* define / undefinine context properties
142
* the value of an undefined property will be taken from the parent context.
144
void gimp_context_define_property (GimpContext *context,
145
GimpContextPropType prop,
148
gboolean gimp_context_property_defined (GimpContext *context,
149
GimpContextPropType prop);
151
void gimp_context_define_properties (GimpContext *context,
152
GimpContextPropMask props_mask,
156
/* specify which context properties will be serialized
158
void gimp_context_set_serialize_properties (GimpContext *context,
159
GimpContextPropMask props_mask);
162
gimp_context_get_serialize_properties (GimpContext *context);
165
/* copying context properties
167
void gimp_context_copy_property (GimpContext *src,
169
GimpContextPropType prop);
171
void gimp_context_copy_properties (GimpContext *src,
173
GimpContextPropMask props_mask);
176
/* manipulate by GType */
177
GimpContextPropType gimp_context_type_to_property (GType type);
178
const gchar * gimp_context_type_to_prop_name (GType type);
179
const gchar * gimp_context_type_to_signal_name (GType type);
181
GimpObject * gimp_context_get_by_type (GimpContext *context,
183
void gimp_context_set_by_type (GimpContext *context,
186
void gimp_context_changed_by_type (GimpContext *context,
191
GimpImage * gimp_context_get_image (GimpContext *context);
192
void gimp_context_set_image (GimpContext *context,
194
void gimp_context_image_changed (GimpContext *context);
198
gpointer gimp_context_get_display (GimpContext *context);
199
void gimp_context_set_display (GimpContext *context,
201
void gimp_context_display_changed (GimpContext *context);
205
GimpToolInfo * gimp_context_get_tool (GimpContext *context);
206
void gimp_context_set_tool (GimpContext *context,
207
GimpToolInfo *tool_info);
208
void gimp_context_tool_changed (GimpContext *context);
211
/* foreground color */
212
void gimp_context_get_foreground (GimpContext *context,
214
void gimp_context_set_foreground (GimpContext *context,
215
const GimpRGB *color);
216
void gimp_context_foreground_changed (GimpContext *context);
219
/* background color */
220
void gimp_context_get_background (GimpContext *context,
222
void gimp_context_set_background (GimpContext *context,
223
const GimpRGB *color);
224
void gimp_context_background_changed (GimpContext *context);
227
/* color utility functions */
228
void gimp_context_set_default_colors (GimpContext *context);
229
void gimp_context_swap_colors (GimpContext *context);
233
gdouble gimp_context_get_opacity (GimpContext *context);
234
void gimp_context_set_opacity (GimpContext *context,
236
void gimp_context_opacity_changed (GimpContext *context);
241
gimp_context_get_paint_mode (GimpContext *context);
242
void gimp_context_set_paint_mode (GimpContext *context,
243
GimpLayerModeEffects paint_mode);
244
void gimp_context_paint_mode_changed (GimpContext *context);
248
GimpBrush * gimp_context_get_brush (GimpContext *context);
249
void gimp_context_set_brush (GimpContext *context,
251
void gimp_context_brush_changed (GimpContext *context);
255
GimpPattern * gimp_context_get_pattern (GimpContext *context);
256
void gimp_context_set_pattern (GimpContext *context,
257
GimpPattern *pattern);
258
void gimp_context_pattern_changed (GimpContext *context);
262
GimpGradient * gimp_context_get_gradient (GimpContext *context);
263
void gimp_context_set_gradient (GimpContext *context,
264
GimpGradient *gradient);
265
void gimp_context_gradient_changed (GimpContext *context);
269
GimpPalette * gimp_context_get_palette (GimpContext *context);
270
void gimp_context_set_palette (GimpContext *context,
271
GimpPalette *palette);
272
void gimp_context_palette_changed (GimpContext *context);
276
GimpFont * gimp_context_get_font (GimpContext *context);
277
void gimp_context_set_font (GimpContext *context,
279
const gchar * gimp_context_get_font_name (GimpContext *context);
280
void gimp_context_set_font_name (GimpContext *context,
282
void gimp_context_font_changed (GimpContext *context);
286
GimpBuffer * gimp_context_get_buffer (GimpContext *context);
287
void gimp_context_set_buffer (GimpContext *context,
288
GimpBuffer *palette);
289
void gimp_context_buffer_changed (GimpContext *context);
293
GimpImagefile * gimp_context_get_imagefile (GimpContext *context);
294
void gimp_context_set_imagefile (GimpContext *context,
295
GimpImagefile *imagefile);
296
void gimp_context_imagefile_changed (GimpContext *context);
300
GimpTemplate * gimp_context_get_template (GimpContext *context);
301
void gimp_context_set_template (GimpContext *context,
302
GimpTemplate *template);
303
void gimp_context_template_changed (GimpContext *context);
306
#endif /* __GIMP_CONTEXT_H__ */