~ubuntu-branches/ubuntu/hoary/gimp/hoary

« back to all changes in this revision

Viewing changes to app/core/gimpcontext.h

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2005-04-04 14:51:23 UTC
  • Revision ID: james.westby@ubuntu.com-20050404145123-9py049eeelfymur8
Tags: upstream-2.2.2
ImportĀ upstreamĀ versionĀ 2.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* The GIMP -- an image manipulation program
 
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 
3
 *
 
4
 * gimpcontext.h
 
5
 * Copyright (C) 1999-2001 Michael Natterer
 
6
 *
 
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.
 
11
 *
 
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.
 
16
 *
 
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.
 
20
 */
 
21
 
 
22
#ifndef __GIMP_CONTEXT_H__
 
23
#define __GIMP_CONTEXT_H__
 
24
 
 
25
 
 
26
#include "gimpobject.h"
 
27
 
 
28
 
 
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))
 
35
 
 
36
 
 
37
typedef struct _GimpContextClass GimpContextClass;
 
38
 
 
39
struct _GimpContext
 
40
{
 
41
  GimpObject            parent_instance;
 
42
 
 
43
  Gimp                 *gimp;
 
44
 
 
45
  GimpContext          *parent;
 
46
 
 
47
  guint32               defined_props;
 
48
  guint32               serialize_props;
 
49
 
 
50
  GimpImage            *image;
 
51
  gpointer              display;
 
52
 
 
53
  GimpToolInfo         *tool_info;
 
54
  gchar                *tool_name;
 
55
 
 
56
  GimpRGB               foreground;
 
57
  GimpRGB               background;
 
58
 
 
59
  gdouble               opacity;
 
60
  GimpLayerModeEffects  paint_mode;
 
61
 
 
62
  GimpBrush            *brush;
 
63
  gchar                *brush_name;
 
64
 
 
65
  GimpPattern          *pattern;
 
66
  gchar                *pattern_name;
 
67
 
 
68
  GimpGradient         *gradient;
 
69
  gchar                *gradient_name;
 
70
 
 
71
  GimpPalette          *palette;
 
72
  gchar                *palette_name;
 
73
 
 
74
  GimpFont             *font;
 
75
  gchar                *font_name;
 
76
 
 
77
  GimpBuffer           *buffer;
 
78
  gchar                *buffer_name;
 
79
 
 
80
  GimpImagefile        *imagefile;
 
81
  gchar                *imagefile_name;
 
82
 
 
83
  GimpTemplate         *template;
 
84
  gchar                *template_name;
 
85
};
 
86
 
 
87
struct _GimpContextClass
 
88
{
 
89
  GimpObjectClass  parent_class;
 
90
 
 
91
  void (* image_changed)      (GimpContext          *context,
 
92
                               GimpImage            *image);
 
93
  void (* display_changed)    (GimpContext          *context,
 
94
                               gpointer              display);
 
95
 
 
96
  void (* tool_changed)       (GimpContext          *context,
 
97
                               GimpToolInfo         *tool_info);
 
98
 
 
99
  void (* foreground_changed) (GimpContext          *context,
 
100
                               GimpRGB              *color);
 
101
  void (* background_changed) (GimpContext          *context,
 
102
                               GimpRGB              *color);
 
103
  void (* opacity_changed)    (GimpContext          *context,
 
104
                               gdouble               opacity);
 
105
  void (* paint_mode_changed) (GimpContext          *context,
 
106
                               GimpLayerModeEffects  paint_mode);
 
107
  void (* brush_changed)      (GimpContext          *context,
 
108
                               GimpBrush            *brush);
 
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,
 
116
                               GimpFont             *font);
 
117
  void (* buffer_changed)     (GimpContext          *context,
 
118
                               GimpBuffer           *buffer);
 
119
  void (* imagefile_changed)  (GimpContext          *context,
 
120
                               GimpImagefile        *imagefile);
 
121
  void (* template_changed)   (GimpContext          *context,
 
122
                               GimpTemplate         *template);
 
123
};
 
124
 
 
125
 
 
126
GType         gimp_context_get_type          (void) G_GNUC_CONST;
 
127
 
 
128
GimpContext * gimp_context_new               (Gimp              *gimp,
 
129
                                              const gchar       *name,
 
130
                                              GimpContext       *template);
 
131
 
 
132
const gchar * gimp_context_get_name          (const GimpContext *context);
 
133
void          gimp_context_set_name          (GimpContext       *context,
 
134
                                              const gchar       *name);
 
135
 
 
136
GimpContext * gimp_context_get_parent        (const GimpContext *context);
 
137
void          gimp_context_set_parent        (GimpContext       *context,
 
138
                                              GimpContext       *parent);
 
139
 
 
140
/*  define / undefinine context properties
 
141
 *
 
142
 *  the value of an undefined property will be taken from the parent context.
 
143
 */
 
144
void          gimp_context_define_property   (GimpContext         *context,
 
145
                                              GimpContextPropType  prop,
 
146
                                              gboolean             defined);
 
147
 
 
148
gboolean      gimp_context_property_defined  (GimpContext         *context,
 
149
                                              GimpContextPropType  prop);
 
150
 
 
151
void          gimp_context_define_properties (GimpContext         *context,
 
152
                                              GimpContextPropMask  props_mask,
 
153
                                              gboolean             defined);
 
154
 
 
155
 
 
156
/*  specify which context properties will be serialized
 
157
 */
 
158
void   gimp_context_set_serialize_properties (GimpContext         *context,
 
159
                                              GimpContextPropMask  props_mask);
 
160
 
 
161
GimpContextPropMask
 
162
       gimp_context_get_serialize_properties (GimpContext         *context);
 
163
 
 
164
 
 
165
/*  copying context properties
 
166
 */
 
167
void          gimp_context_copy_property     (GimpContext         *src,
 
168
                                              GimpContext         *dest,
 
169
                                              GimpContextPropType  prop);
 
170
 
 
171
void          gimp_context_copy_properties   (GimpContext         *src,
 
172
                                              GimpContext         *dest,
 
173
                                              GimpContextPropMask  props_mask);
 
174
 
 
175
 
 
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);
 
180
 
 
181
GimpObject    * gimp_context_get_by_type        (GimpContext     *context,
 
182
                                                 GType            type);
 
183
void            gimp_context_set_by_type        (GimpContext     *context,
 
184
                                                 GType            type,
 
185
                                                 GimpObject      *object);
 
186
void            gimp_context_changed_by_type    (GimpContext     *context,
 
187
                                                 GType            type);
 
188
 
 
189
 
 
190
/*  image  */
 
191
GimpImage     * gimp_context_get_image          (GimpContext     *context);
 
192
void            gimp_context_set_image          (GimpContext     *context,
 
193
                                                 GimpImage       *image);
 
194
void            gimp_context_image_changed      (GimpContext     *context);
 
195
 
 
196
 
 
197
/*  display  */
 
198
gpointer        gimp_context_get_display        (GimpContext     *context);
 
199
void            gimp_context_set_display        (GimpContext     *context,
 
200
                                                 gpointer         display);
 
201
void            gimp_context_display_changed    (GimpContext     *context);
 
202
 
 
203
 
 
204
/*  tool  */
 
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);
 
209
 
 
210
 
 
211
/*  foreground color  */
 
212
void            gimp_context_get_foreground     (GimpContext     *context,
 
213
                                                 GimpRGB         *color);
 
214
void            gimp_context_set_foreground     (GimpContext     *context,
 
215
                                                 const GimpRGB   *color);
 
216
void            gimp_context_foreground_changed (GimpContext     *context);
 
217
 
 
218
 
 
219
/*  background color  */
 
220
void            gimp_context_get_background     (GimpContext     *context,
 
221
                                                 GimpRGB         *color);
 
222
void            gimp_context_set_background     (GimpContext     *context,
 
223
                                                 const GimpRGB   *color);
 
224
void            gimp_context_background_changed (GimpContext     *context);
 
225
 
 
226
 
 
227
/*  color utility functions  */
 
228
void            gimp_context_set_default_colors (GimpContext     *context);
 
229
void            gimp_context_swap_colors        (GimpContext     *context);
 
230
 
 
231
 
 
232
/*  opacity  */
 
233
gdouble         gimp_context_get_opacity        (GimpContext     *context);
 
234
void            gimp_context_set_opacity        (GimpContext     *context,
 
235
                                                 gdouble          opacity);
 
236
void            gimp_context_opacity_changed    (GimpContext     *context);
 
237
 
 
238
 
 
239
/*  paint mode  */
 
240
GimpLayerModeEffects
 
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);
 
245
 
 
246
 
 
247
/*  brush  */
 
248
GimpBrush     * gimp_context_get_brush          (GimpContext     *context);
 
249
void            gimp_context_set_brush          (GimpContext     *context,
 
250
                                                 GimpBrush       *brush);
 
251
void            gimp_context_brush_changed      (GimpContext     *context);
 
252
 
 
253
 
 
254
/*  pattern  */
 
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);
 
259
 
 
260
 
 
261
/*  gradient  */
 
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);
 
266
 
 
267
 
 
268
/*  palette  */
 
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);
 
273
 
 
274
 
 
275
/*  font  */
 
276
GimpFont      * gimp_context_get_font           (GimpContext     *context);
 
277
void            gimp_context_set_font           (GimpContext     *context,
 
278
                                                 GimpFont        *font);
 
279
const gchar   * gimp_context_get_font_name      (GimpContext     *context);
 
280
void            gimp_context_set_font_name      (GimpContext     *context,
 
281
                                                 const gchar     *name);
 
282
void            gimp_context_font_changed       (GimpContext     *context);
 
283
 
 
284
 
 
285
/*  buffer  */
 
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);
 
290
 
 
291
 
 
292
/*  imagefile  */
 
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);
 
297
 
 
298
 
 
299
/*  template  */
 
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);
 
304
 
 
305
 
 
306
#endif /* __GIMP_CONTEXT_H__ */