Merged revisions 6293,6296-6306,6308 via svnmerge from
[ardour.git] / libs / gtkmm2 / gdk / gdkmm / image.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3
4 #include <gdkmm/image.h>
5 #include <gdkmm/private/image_p.h>
6
7 #include <gdk/gdkenumtypes.h>
8 // -*- c++ -*-
9 /* $Id$ */
10
11 /*
12  *
13  * Copyright 1998-2002 The gtkmm Development Team
14  *
15  * This library is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU Library General Public
17  * License as published by the Free Software Foundation; either
18  * version 2 of the License, or (at your option) any later version.
19  *
20  * This library is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23  * Library General Public License for more details.
24  *
25  * You should have received a copy of the GNU Library General Public
26  * License along with this library; if not, write to the Free
27  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28  */
29
30 namespace Gdk
31 {
32
33 Image::Image(ImageType type, const Glib::RefPtr<Visual>& visual, int width, int height)
34 :
35   Object( G_OBJECT( gdk_image_new((GdkImageType)type, visual->gobj(), width, height) ) )
36 {}
37
38 } /* namespace Gdk */
39
40
41 namespace
42 {
43 } // anonymous namespace
44
45 // static
46 GType Glib::Value<Gdk::ImageType>::value_type()
47 {
48   return gdk_image_type_get_type();
49 }
50
51
52 namespace Glib
53 {
54
55 Glib::RefPtr<Gdk::Image> wrap(GdkImage* object, bool take_copy)
56 {
57   return Glib::RefPtr<Gdk::Image>( dynamic_cast<Gdk::Image*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
58   //We use dynamic_cast<> in case of multiple inheritance.
59 }
60
61 } /* namespace Glib */
62
63
64 namespace Gdk
65 {
66
67
68 /* The *_Class implementation: */
69
70 const Glib::Class& Image_Class::init()
71 {
72   if(!gtype_) // create the GType if necessary
73   {
74     // Glib::Class has to know the class init function to clone custom types.
75     class_init_func_ = &Image_Class::class_init_function;
76
77     // This is actually just optimized away, apparently with no harm.
78     // Make sure that the parent type has been created.
79     //CppClassParent::CppObjectType::get_type();
80
81     // Create the wrapper type, with the same class/instance size as the base type.
82     register_derived_type(gdk_image_get_type());
83
84     // Add derived versions of interfaces, if the C type implements any interfaces:
85   }
86
87   return *this;
88 }
89
90 void Image_Class::class_init_function(void* g_class, void* class_data)
91 {
92   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
93   CppClassParent::class_init_function(klass, class_data);
94
95 #ifdef GLIBMM_VFUNCS_ENABLED
96 #endif //GLIBMM_VFUNCS_ENABLED
97
98 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
99 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
100 }
101
102 #ifdef GLIBMM_VFUNCS_ENABLED
103 #endif //GLIBMM_VFUNCS_ENABLED
104
105 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
106 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
107
108
109 Glib::ObjectBase* Image_Class::wrap_new(GObject* object)
110 {
111   return new Image((GdkImage*)object);
112 }
113
114
115 /* The implementation: */
116
117 GdkImage* Image::gobj_copy()
118 {
119   reference();
120   return gobj();
121 }
122
123 Image::Image(const Glib::ConstructParams& construct_params)
124 :
125   Glib::Object(construct_params)
126 {}
127
128 Image::Image(GdkImage* castitem)
129 :
130   Glib::Object((GObject*)(castitem))
131 {}
132
133 Image::~Image()
134 {}
135
136
137 Image::CppClassType Image::image_class_; // initialize static member
138
139 GType Image::get_type()
140 {
141   return image_class_.init().get_type();
142 }
143
144 GType Image::get_base_type()
145 {
146   return gdk_image_get_type();
147 }
148
149
150 Glib::RefPtr<Image> Image::create(ImageType type, const Glib::RefPtr<Visual>& visual, int width, int height)
151 {
152   return Glib::RefPtr<Image>( new Image(type, visual, width, height) );
153 }
154 void Image::put_pixel(int x, int y, guint32 pixel)
155 {
156 gdk_image_put_pixel(gobj(), x, y, pixel); 
157 }
158
159 guint32 Image::get_pixel(int x, int y) const
160 {
161   return gdk_image_get_pixel(const_cast<GdkImage*>(gobj()), x, y);
162 }
163
164 void Image::set_colormap(const Glib::RefPtr<Colormap>& colormap)
165 {
166 gdk_image_set_colormap(gobj(), Glib::unwrap(colormap)); 
167 }
168
169 Glib::RefPtr<Colormap> Image::get_colormap()
170 {
171
172   Glib::RefPtr<Colormap> retvalue = Glib::wrap(gdk_image_get_colormap(gobj()));
173   if(retvalue)
174     retvalue->reference(); //The function does not do a ref for us.
175   return retvalue;
176
177 }
178
179 Glib::RefPtr<const Colormap> Image::get_colormap() const
180 {
181   return const_cast<Image*>(this)->get_colormap();
182 }
183
184  ImageType Image::get_image_type() const
185 {
186   return ((ImageType)(gobj()->type));
187 }
188  
189  Glib::RefPtr<Visual> Image::get_visual()
190 {
191   Glib::RefPtr<Visual> ref_ptr(Glib::wrap(gobj()->visual));
192
193   if(ref_ptr)
194     ref_ptr->reference();
195
196   return ref_ptr;
197 }
198
199 Glib::RefPtr<const Visual> Image::get_visual() const
200 {
201   Glib::RefPtr<const Visual> ref_ptr(Glib::wrap(gobj()->visual));
202
203   if(ref_ptr)
204     ref_ptr->reference();
205
206   return ref_ptr;
207 }
208  
209  ByteOrder Image::get_byte_order() const
210 {
211   return ((ByteOrder)(gobj()->byte_order));
212 }
213  
214  int Image::get_width() const
215 {
216   return gobj()->width;
217 }
218  
219  int Image::get_height() const
220 {
221   return gobj()->height;
222 }
223  
224  guint16 Image::get_bpp() const
225 {
226   return gobj()->bpp;
227 }
228  
229  guint16 Image::get_bpl() const
230 {
231   return gobj()->bpl;
232 }
233  
234  guint16 Image::get_bits_per_pixel() const
235 {
236   return gobj()->bits_per_pixel;
237 }
238  
239  void* Image::get_mem()
240 {
241   return gobj()->mem;
242 }
243
244 const void* Image::get_mem() const
245 {
246   return (const void*)(gobj()->mem);
247 }
248  
249  void* Image::get_windowing_data() const
250 {
251   return gobj()->windowing_data;
252 }
253  
254
255 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
256 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
257
258 #ifdef GLIBMM_VFUNCS_ENABLED
259 #endif //GLIBMM_VFUNCS_ENABLED
260
261
262 } // namespace Gdk
263
264