~ubuntu-branches/ubuntu/precise/gtkmm3.0/precise

« back to all changes in this revision

Viewing changes to gdk/gdkmm/pixbufloader.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Biebl
  • Date: 2011-06-17 00:12:44 UTC
  • Revision ID: james.westby@ubuntu.com-20110617001244-9hl5an15hiaaahi6
Tags: upstream-3.0.1
ImportĀ upstreamĀ versionĀ 3.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- c++ -*-
 
2
// Generated by gtkmmproc -- DO NOT MODIFY!
 
3
#ifndef _GDKMM_PIXBUFLOADER_H
 
4
#define _GDKMM_PIXBUFLOADER_H
 
5
 
 
6
 
 
7
#include <glibmm.h>
 
8
 
 
9
/* $Id: pixbufloader.hg,v 1.13 2006/05/18 17:53:14 murrayc Exp $ */
 
10
 
 
11
/* Copyright (C) 1998-2002 The gtkmm Development Team
 
12
 *
 
13
 * This library is free software; you can redistribute it and/or
 
14
 * modify it under the terms of the GNU Lesser General Public
 
15
 * License as published by the Free Software Foundation; either
 
16
 * version 2.1 of the License, or (at your option) any later version.
 
17
 *
 
18
 * This library is distributed in the hope that it will be useful,
 
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
21
 * Lesser General Public License for more details.
 
22
 *
 
23
 * You should have received a copy of the GNU Lesser General Public
 
24
 * License along with this library; if not, write to the Free
 
25
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
26
 */
 
27
 
 
28
#include <glibmm/object.h>
 
29
#include <gdkmm/pixbuf.h>
 
30
#include <gdkmm/pixbufanimation.h>
 
31
#include <gdkmm/pixbufformat.h>
 
32
 
 
33
 
 
34
#ifndef DOXYGEN_SHOULD_SKIP_THIS
 
35
typedef struct _GdkPixbufLoader GdkPixbufLoader;
 
36
typedef struct _GdkPixbufLoaderClass GdkPixbufLoaderClass;
 
37
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
 
38
 
 
39
 
 
40
namespace Gdk
 
41
{ class PixbufLoader_Class; } // namespace Gdk
 
42
namespace Gdk
 
43
{
 
44
 
 
45
 
 
46
class PixbufLoader : public Glib::Object
 
47
{
 
48
  
 
49
#ifndef DOXYGEN_SHOULD_SKIP_THIS
 
50
 
 
51
public:
 
52
  typedef PixbufLoader CppObjectType;
 
53
  typedef PixbufLoader_Class CppClassType;
 
54
  typedef GdkPixbufLoader BaseObjectType;
 
55
  typedef GdkPixbufLoaderClass BaseClassType;
 
56
 
 
57
private:  friend class PixbufLoader_Class;
 
58
  static CppClassType pixbufloader_class_;
 
59
 
 
60
private:
 
61
  // noncopyable
 
62
  PixbufLoader(const PixbufLoader&);
 
63
  PixbufLoader& operator=(const PixbufLoader&);
 
64
 
 
65
protected:
 
66
  explicit PixbufLoader(const Glib::ConstructParams& construct_params);
 
67
  explicit PixbufLoader(GdkPixbufLoader* castitem);
 
68
 
 
69
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
 
70
 
 
71
public:
 
72
  virtual ~PixbufLoader();
 
73
 
 
74
#ifndef DOXYGEN_SHOULD_SKIP_THIS
 
75
  static GType get_type()      G_GNUC_CONST;
 
76
 
 
77
 
 
78
  static GType get_base_type() G_GNUC_CONST;
 
79
#endif
 
80
 
 
81
  ///Provides access to the underlying C GObject.
 
82
  GdkPixbufLoader*       gobj()       { return reinterpret_cast<GdkPixbufLoader*>(gobject_); }
 
83
 
 
84
  ///Provides access to the underlying C GObject.
 
85
  const GdkPixbufLoader* gobj() const { return reinterpret_cast<GdkPixbufLoader*>(gobject_); }
 
86
 
 
87
  ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
 
88
  GdkPixbufLoader* gobj_copy();
 
89
 
 
90
private:
 
91
 
 
92
protected:
 
93
 
 
94
  /** Constructs a pixbuf loader object.
 
95
   */
 
96
  PixbufLoader();
 
97
 
 
98
  /** Constructs a pixbuf loader object for a specific image type.
 
99
   * Constructs a new pixbuf loader object that always attempts to parse image
 
100
   * data as if it were an image of type @a image_type, instead of identifying
 
101
   * the type automatically. Useful if you want an error if the image isn't the
 
102
   * expected type, for loading image formats that can't be reliably identified
 
103
   * by looking at the data, or if the user manually forces a specific type.
 
104
   *
 
105
   * The image_type can be one of the types returned by Gdk::Pixbuf::get_formats(), or a MIME type.
 
106
   *
 
107
   * Common MIME Types are listed here
 
108
   * http://www.iana.org/assignments/media-types/
 
109
   * and here:
 
110
   * http://www.freedesktop.org/Software/shared-mime-info
 
111
   *
 
112
   * The list of non-mime-type image formats depends on what image loaders
 
113
   * are installed, but typically "png", "jpeg", "gif", "tiff" and 
 
114
   * "xpm" are among the supported formats. To obtain the full list of
 
115
   * supported image formats, call PixbufFormat::get_name() on each 
 
116
   * of the PixbufFormats returned by Gdk::Pixbuf::get_formats().
 
117
   *
 
118
   * @param image_type Name of the image format to be loaded with the image.
 
119
   * @param mime_type If this is true then the image_type is a MIME type.
 
120
   * @throw Gdk::PixbufError
 
121
   */
 
122
  explicit PixbufLoader(const Glib::ustring& image_type, bool mime_type = false);
 
123
 
 
124
public:
 
125
 
 
126
  /** Creates a new pixbuf loader object.
 
127
   * @return A newly-created pixbuf loader.
 
128
   */
 
129
  
 
130
  static Glib::RefPtr<PixbufLoader> create();
 
131
 
 
132
 
 
133
   /** Constructs a pixbuf loader object for a specific image type.
 
134
   * Constructs a new pixbuf loader object that always attempts to parse image
 
135
   * data as if it were an image of type @a image_type, instead of identifying
 
136
   * the type automatically. Useful if you want an error if the image isn't the
 
137
   * expected type, for loading image formats that can't be reliably identified
 
138
   * by looking at the data, or if the user manually forces a specific type.
 
139
   *
 
140
   * The image_type can be one of the types returned by Gdk::Pixbuf::get_formats(), or a MIME type.
 
141
   *
 
142
   * Common MIME Types are listed here
 
143
   * http://www.iana.org/assignments/media-types/
 
144
   * and here:
 
145
   * http://www.freedesktop.org/Software/shared-mime-info
 
146
   *
 
147
   * The list of non-mime-type image formats depends on what image loaders
 
148
   * are installed, but typically "png", "jpeg", "gif", "tiff" and 
 
149
   * "xpm" are among the supported formats. To obtain the full list of
 
150
   * supported image formats, call PixbufFormat::get_name() on each 
 
151
   * of the PixbufFormats returned by Gdk::Pixbuf::get_formats().
 
152
   *
 
153
   * @param image_type Name of the image format to be loaded with the image.
 
154
   * @param mime_type If this is true then the image_type is a MIME type.
 
155
   * @throw Gdk::PixbufError
 
156
   */
 
157
  
 
158
  static Glib::RefPtr<PixbufLoader> create(const Glib::ustring& image_type, bool mime_type =  false);
 
159
 
 
160
 
 
161
  void set_size(int width, int height);
 
162
 
 
163
 
 
164
  /** Causes the pixbuf loader to parse the next @a count bytes of an image.
 
165
   * It will return if the data was loaded successfully, and throw an exception
 
166
   * if an error occurred. In the latter case, the loader will be closed, and
 
167
   * will not accept further writes.
 
168
   * @param buf Pointer to image data.
 
169
   * @param count Length of the @a buf buffer in bytes.
 
170
   * @throw Gdk::PixbufError
 
171
   * @throw Glib::FileError
 
172
   */
 
173
  void write(const guint8* buf, gsize count);
 
174
 
 
175
  
 
176
  /** Informs a pixbuf loader that no further writes with PixbufLoader::write()
 
177
   * will occur, so that it can free its internal loading structures.  Also,
 
178
   * tries to parse any data that hasn't yet been parsed; if the remaining data
 
179
   * is partial or corrupt, an exception will be thrown. If you're just
 
180
   * cancelling a load rather than expecting it to be finished, writing an
 
181
   * empty <tt>catch()</tt> block to ignore errors is reasonable.
 
182
   * @throw Gdk::PixbufError
 
183
   * @throw Glib::FileError
 
184
   */
 
185
  void close();
 
186
 
 
187
  
 
188
  Glib::RefPtr<Gdk::Pixbuf> get_pixbuf();
 
189
  
 
190
  Glib::RefPtr<Gdk::PixbufAnimation> get_animation();
 
191
 
 
192
  
 
193
  PixbufFormat get_format() const;
 
194
 
 
195
  /** This signal is emitted when the pixbuf loader has allocated the 
 
196
   * pixbuf in the desired size.  After this signal is emitted, 
 
197
   * applications can call get_pixbuf() to fetch 
 
198
   * the partially-loaded pixbuf.
 
199
   *
 
200
   * @par Prototype:
 
201
   * <tt>void on_my_%area_prepared()</tt>
 
202
   */
 
203
 
 
204
  Glib::SignalProxy0< void > signal_area_prepared();
 
205
 
 
206
 
 
207
  /** This signal is emitted when a significant area of the image being
 
208
   * loaded has been updated.  Normally it means that a complete
 
209
   * scanline has been read in, but it could be a different area as
 
210
   * well.  Applications can use this signal to know when to repaint
 
211
   * areas of an image that is being loaded.
 
212
   *
 
213
   * @param X offset of upper-left corner of the updated area.
 
214
   * @param y Y offset of upper-left corner of the updated area.
 
215
   * @param width Width of updated area.
 
216
   * @param height Height of updated area.
 
217
   *
 
218
   * @par Prototype:
 
219
   * <tt>void on_my_%area_updated(int x, int y, int width, int height)</tt>
 
220
   */
 
221
 
 
222
  Glib::SignalProxy4< void,int,int,int,int > signal_area_updated();
 
223
 
 
224
 
 
225
  /** This signal is emitted when close() is called.
 
226
   * It can be used by different parts of an application to receive
 
227
   * notification when an image loader is closed by the code that
 
228
   * drives it.
 
229
   *
 
230
   * @par Prototype:
 
231
   * <tt>void on_my_%closed()</tt>
 
232
   */
 
233
 
 
234
  Glib::SignalProxy0< void > signal_closed();
 
235
 
 
236
 
 
237
  /** This signal is emitted when the pixbuf loader has been fed the
 
238
   * initial amount of data that is required to figure out the size
 
239
   * of the image that it will create.  Applications can call  
 
240
   * set_size() in response to this signal to set
 
241
   * the desired size to which the image should be scaled.
 
242
   *
 
243
   * @param width The original width of the image.
 
244
   * @param height The original height of the image
 
245
   *
 
246
   * @par Prototype:
 
247
   * <tt>void on_my_%size_prepared(int width, int height)</tt>
 
248
   */
 
249
 
 
250
  Glib::SignalProxy2< void,int,int > signal_size_prepared();
 
251
 
 
252
 
 
253
public:
 
254
 
 
255
public:
 
256
  //C++ methods used to invoke GTK+ virtual functions:
 
257
 
 
258
protected:
 
259
  //GTK+ Virtual Functions (override these to change behaviour):
 
260
 
 
261
  //Default Signal Handlers::
 
262
  virtual void on_area_prepared();
 
263
  virtual void on_area_updated(int x, int y, int width, int height);
 
264
  virtual void on_closed();
 
265
  virtual void on_size_prepared(int width, int height);
 
266
 
 
267
 
 
268
};
 
269
 
 
270
} // namespace Gdk
 
271
 
 
272
 
 
273
namespace Glib
 
274
{
 
275
  /** A Glib::wrap() method for this object.
 
276
   * 
 
277
   * @param object The C instance.
 
278
   * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
 
279
   * @result A C++ instance that wraps this C instance.
 
280
   *
 
281
   * @relates Gdk::PixbufLoader
 
282
   */
 
283
  Glib::RefPtr<Gdk::PixbufLoader> wrap(GdkPixbufLoader* object, bool take_copy = false);
 
284
}
 
285
 
 
286
 
 
287
#endif /* _GDKMM_PIXBUFLOADER_H */
 
288