Merged revisions 6293,6296-6306,6308 via svnmerge from
[ardour.git] / libs / libgnomecanvasmm / libgnomecanvasmm / rich-text.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3 #include <libgnomecanvasmm/rich-text.h>
4 #include <libgnomecanvasmm/private/rich-text_p.h>
5
6 /* $Id$ */
7
8 /* rich-text.cc
9  *
10  * Copyright (C) 2002 The libgnomecanvasmm Development Team
11  *
12  * This library is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Library General Public
14  * License as published by the Free Software Foundation; either
15  * version 2 of the License, or (at your option) any later version.
16  *
17  * This library is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20  * Library General Public License for more details.
21  *
22  * You should have received a copy of the GNU Library General Public
23  * License along with this library; if not, write to the Free
24  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25  */
26
27
28 namespace Gnome
29 {
30
31 namespace Canvas
32 {
33
34 RichText::RichText (Group& parent,
35                     double x, double y, 
36                     const Glib::ustring& text)
37   : Item (GNOME_CANVAS_ITEM (g_object_new (get_type (), NULL)))
38 {
39   item_construct (parent);
40   set ("x", x, 
41        "y", y, 
42        "text", text.c_str (), 
43        NULL);
44 }
45
46 RichText::RichText (Group& parent)
47   : Item (GNOME_CANVAS_ITEM (g_object_new (get_type (), NULL)))
48 {
49   item_construct (parent);
50 }
51
52 RichText::iterator RichText::get_iter_at_location(int x, int y) const
53 {
54   iterator iter;
55   gnome_canvas_rich_text_get_iter_at_location(const_cast<GnomeCanvasRichText*>(gobj()), iter.gobj(), x, y);
56   return iter;
57 }
58
59
60 }
61
62 }
63
64
65 namespace
66 {
67
68 void RichText_signal_tag_changed_callback(GnomeCanvasRichText* self, GtkTextTag* tag,void* data)
69 {
70   using namespace Gnome::Canvas;
71   typedef sigc::slot< void,const Glib::RefPtr<Gtk::TextTag>& > SlotType;
72
73   // Do not try to call a signal on a disassociated wrapper.
74   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
75   {
76     try
77     {
78       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
79         (*static_cast<SlotType*>(slot))(Glib::wrap(tag, true)
80 );
81     }
82     catch(...)
83     {
84       Glib::exception_handlers_invoke();
85     }
86   }
87 }
88
89 const Glib::SignalProxyInfo RichText_signal_tag_changed_info =
90 {
91   "tag_changed",
92   (GCallback) &RichText_signal_tag_changed_callback,
93   (GCallback) &RichText_signal_tag_changed_callback
94 };
95
96 } // anonymous namespace
97
98
99 namespace Glib
100 {
101
102 Gnome::Canvas::RichText* wrap(GnomeCanvasRichText* object, bool take_copy)
103 {
104   return dynamic_cast<Gnome::Canvas::RichText *> (Glib::wrap_auto ((GObject*)(object), take_copy));
105 }
106
107 } /* namespace Glib */
108
109 namespace Gnome
110 {
111
112 namespace Canvas
113 {
114
115
116 /* The *_Class implementation: */
117
118 const Glib::Class& RichText_Class::init()
119 {
120   if(!gtype_) // create the GType if necessary
121   {
122     // Glib::Class has to know the class init function to clone custom types.
123     class_init_func_ = &RichText_Class::class_init_function;
124
125     // This is actually just optimized away, apparently with no harm.
126     // Make sure that the parent type has been created.
127     //CppClassParent::CppObjectType::get_type();
128
129     // Create the wrapper type, with the same class/instance size as the base type.
130     register_derived_type(gnome_canvas_rich_text_get_type());
131
132     // Add derived versions of interfaces, if the C type implements any interfaces:
133   }
134
135   return *this;
136 }
137
138 void RichText_Class::class_init_function(void* g_class, void* class_data)
139 {
140   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
141   CppClassParent::class_init_function(klass, class_data);
142
143   klass->tag_changed = &tag_changed_callback;
144 }
145
146
147 void RichText_Class::tag_changed_callback(GnomeCanvasRichText* self, GtkTextTag* tag)
148 {
149   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
150       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
151
152   // Non-gtkmmproc-generated custom classes implicitly call the default
153   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
154   // generated classes can use this optimisation, which avoids the unnecessary
155   // parameter conversions if there is no possibility of the virtual function
156   // being overridden:
157   if(obj && obj->is_derived_())
158   {
159     try // Trap C++ exceptions which would normally be lost because this is a C callback.
160     {
161       // Call the virtual member method, which derived classes might override.
162       obj->on_tag_changed(Glib::wrap(tag, true)
163 );
164     }
165     catch(...)
166     {
167       Glib::exception_handlers_invoke();
168     }
169   }
170   else
171   {
172     BaseClassType *const base = static_cast<BaseClassType*>(
173         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
174     );
175
176     // Call the original underlying C function:
177     if(base && base->tag_changed)
178       (*base->tag_changed)(self, tag);
179   }
180 }
181
182
183 Glib::ObjectBase* RichText_Class::wrap_new(GObject* o)
184 {
185   return manage(new RichText((GnomeCanvasRichText*)(o)));
186
187 }
188
189
190 /* The implementation: */
191
192 RichText::RichText(const Glib::ConstructParams& construct_params)
193 :
194   Item(construct_params)
195 {
196   }
197
198 RichText::RichText(GnomeCanvasRichText* castitem)
199 :
200   Item((GnomeCanvasItem*)(castitem))
201 {
202   }
203
204 RichText::~RichText()
205 {
206   destroy_();
207 }
208
209 RichText::CppClassType RichText::richtext_class_; // initialize static member
210
211 GType RichText::get_type()
212 {
213   return richtext_class_.init().get_type();
214 }
215
216 GType RichText::get_base_type()
217 {
218   return gnome_canvas_rich_text_get_type();
219 }
220
221
222 void RichText::cut_clipboard()
223 {
224   gnome_canvas_rich_text_cut_clipboard(gobj());
225 }
226
227 void RichText::copy_clipboard()
228 {
229   gnome_canvas_rich_text_copy_clipboard(gobj());
230 }
231
232 void RichText::paste_clipboard()
233 {
234   gnome_canvas_rich_text_paste_clipboard(gobj());
235 }
236
237 void RichText::set_buffer(const Glib::RefPtr<Gtk::TextBuffer>& buffer)
238 {
239   gnome_canvas_rich_text_set_buffer(gobj(), Glib::unwrap(buffer));
240 }
241
242 Glib::RefPtr<Gtk::TextBuffer> RichText::get_buffer() const
243 {
244   return Glib::wrap(gnome_canvas_rich_text_get_buffer(const_cast<GnomeCanvasRichText*>(gobj())));
245 }
246
247 void RichText::get_iter_location(const iterator& iter, Gdk::Rectangle& location) const
248 {
249   gnome_canvas_rich_text_get_iter_location(const_cast<GnomeCanvasRichText*>(gobj()), (iter).gobj(), (location).gobj());
250 }
251
252
253 Glib::SignalProxy1< void,const Glib::RefPtr<Gtk::TextTag>& > RichText::signal_tag_changed()
254 {
255   return Glib::SignalProxy1< void,const Glib::RefPtr<Gtk::TextTag>& >(this, &RichText_signal_tag_changed_info);
256 }
257
258
259 Glib::PropertyProxy<Glib::ustring> RichText::property_text() 
260 {
261   return Glib::PropertyProxy<Glib::ustring>(this, "text");
262 }
263
264 Glib::PropertyProxy_ReadOnly<Glib::ustring> RichText::property_text() const
265 {
266   return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "text");
267 }
268
269 Glib::PropertyProxy<double> RichText::property_x() 
270 {
271   return Glib::PropertyProxy<double>(this, "x");
272 }
273
274 Glib::PropertyProxy_ReadOnly<double> RichText::property_x() const
275 {
276   return Glib::PropertyProxy_ReadOnly<double>(this, "x");
277 }
278
279 Glib::PropertyProxy<double> RichText::property_y() 
280 {
281   return Glib::PropertyProxy<double>(this, "y");
282 }
283
284 Glib::PropertyProxy_ReadOnly<double> RichText::property_y() const
285 {
286   return Glib::PropertyProxy_ReadOnly<double>(this, "y");
287 }
288
289 Glib::PropertyProxy<double> RichText::property_width() 
290 {
291   return Glib::PropertyProxy<double>(this, "width");
292 }
293
294 Glib::PropertyProxy_ReadOnly<double> RichText::property_width() const
295 {
296   return Glib::PropertyProxy_ReadOnly<double>(this, "width");
297 }
298
299 Glib::PropertyProxy<double> RichText::property_height() 
300 {
301   return Glib::PropertyProxy<double>(this, "height");
302 }
303
304 Glib::PropertyProxy_ReadOnly<double> RichText::property_height() const
305 {
306   return Glib::PropertyProxy_ReadOnly<double>(this, "height");
307 }
308
309 Glib::PropertyProxy<bool> RichText::property_editable() 
310 {
311   return Glib::PropertyProxy<bool>(this, "editable");
312 }
313
314 Glib::PropertyProxy_ReadOnly<bool> RichText::property_editable() const
315 {
316   return Glib::PropertyProxy_ReadOnly<bool>(this, "editable");
317 }
318
319 Glib::PropertyProxy<bool> RichText::property_visible() 
320 {
321   return Glib::PropertyProxy<bool>(this, "visible");
322 }
323
324 Glib::PropertyProxy_ReadOnly<bool> RichText::property_visible() const
325 {
326   return Glib::PropertyProxy_ReadOnly<bool>(this, "visible");
327 }
328
329 Glib::PropertyProxy<bool> RichText::property_cursor_visible() 
330 {
331   return Glib::PropertyProxy<bool>(this, "cursor-visible");
332 }
333
334 Glib::PropertyProxy_ReadOnly<bool> RichText::property_cursor_visible() const
335 {
336   return Glib::PropertyProxy_ReadOnly<bool>(this, "cursor-visible");
337 }
338
339 Glib::PropertyProxy<bool> RichText::property_cursor_blink() 
340 {
341   return Glib::PropertyProxy<bool>(this, "cursor-blink");
342 }
343
344 Glib::PropertyProxy_ReadOnly<bool> RichText::property_cursor_blink() const
345 {
346   return Glib::PropertyProxy_ReadOnly<bool>(this, "cursor-blink");
347 }
348
349 Glib::PropertyProxy<bool> RichText::property_grow_height() 
350 {
351   return Glib::PropertyProxy<bool>(this, "grow-height");
352 }
353
354 Glib::PropertyProxy_ReadOnly<bool> RichText::property_grow_height() const
355 {
356   return Glib::PropertyProxy_ReadOnly<bool>(this, "grow-height");
357 }
358
359 Glib::PropertyProxy<Gtk::WrapMode> RichText::property_wrap_mode() 
360 {
361   return Glib::PropertyProxy<Gtk::WrapMode>(this, "wrap-mode");
362 }
363
364 Glib::PropertyProxy_ReadOnly<Gtk::WrapMode> RichText::property_wrap_mode() const
365 {
366   return Glib::PropertyProxy_ReadOnly<Gtk::WrapMode>(this, "wrap-mode");
367 }
368
369 Glib::PropertyProxy<Gtk::Justification> RichText::property_justification() 
370 {
371   return Glib::PropertyProxy<Gtk::Justification>(this, "justification");
372 }
373
374 Glib::PropertyProxy_ReadOnly<Gtk::Justification> RichText::property_justification() const
375 {
376   return Glib::PropertyProxy_ReadOnly<Gtk::Justification>(this, "justification");
377 }
378
379 Glib::PropertyProxy<Gtk::DirectionType> RichText::property_direction() 
380 {
381   return Glib::PropertyProxy<Gtk::DirectionType>(this, "direction");
382 }
383
384 Glib::PropertyProxy_ReadOnly<Gtk::DirectionType> RichText::property_direction() const
385 {
386   return Glib::PropertyProxy_ReadOnly<Gtk::DirectionType>(this, "direction");
387 }
388
389 Glib::PropertyProxy<Gtk::AnchorType> RichText::property_anchor() 
390 {
391   return Glib::PropertyProxy<Gtk::AnchorType>(this, "anchor");
392 }
393
394 Glib::PropertyProxy_ReadOnly<Gtk::AnchorType> RichText::property_anchor() const
395 {
396   return Glib::PropertyProxy_ReadOnly<Gtk::AnchorType>(this, "anchor");
397 }
398
399 Glib::PropertyProxy<int> RichText::property_pixels_above_lines() 
400 {
401   return Glib::PropertyProxy<int>(this, "pixels-above-lines");
402 }
403
404 Glib::PropertyProxy_ReadOnly<int> RichText::property_pixels_above_lines() const
405 {
406   return Glib::PropertyProxy_ReadOnly<int>(this, "pixels-above-lines");
407 }
408
409 Glib::PropertyProxy<int> RichText::property_pixels_below_lines() 
410 {
411   return Glib::PropertyProxy<int>(this, "pixels-below-lines");
412 }
413
414 Glib::PropertyProxy_ReadOnly<int> RichText::property_pixels_below_lines() const
415 {
416   return Glib::PropertyProxy_ReadOnly<int>(this, "pixels-below-lines");
417 }
418
419 Glib::PropertyProxy<int> RichText::property_pixels_inside_wrap() 
420 {
421   return Glib::PropertyProxy<int>(this, "pixels-inside-wrap");
422 }
423
424 Glib::PropertyProxy_ReadOnly<int> RichText::property_pixels_inside_wrap() const
425 {
426   return Glib::PropertyProxy_ReadOnly<int>(this, "pixels-inside-wrap");
427 }
428
429 Glib::PropertyProxy<int> RichText::property_left_margin() 
430 {
431   return Glib::PropertyProxy<int>(this, "left-margin");
432 }
433
434 Glib::PropertyProxy_ReadOnly<int> RichText::property_left_margin() const
435 {
436   return Glib::PropertyProxy_ReadOnly<int>(this, "left-margin");
437 }
438
439 Glib::PropertyProxy<int> RichText::property_right_margin() 
440 {
441   return Glib::PropertyProxy<int>(this, "right-margin");
442 }
443
444 Glib::PropertyProxy_ReadOnly<int> RichText::property_right_margin() const
445 {
446   return Glib::PropertyProxy_ReadOnly<int>(this, "right-margin");
447 }
448
449 Glib::PropertyProxy<int> RichText::property_indent() 
450 {
451   return Glib::PropertyProxy<int>(this, "indent");
452 }
453
454 Glib::PropertyProxy_ReadOnly<int> RichText::property_indent() const
455 {
456   return Glib::PropertyProxy_ReadOnly<int>(this, "indent");
457 }
458
459
460 void Gnome::Canvas::RichText::on_tag_changed(const Glib::RefPtr<Gtk::TextTag>& tag)
461 {
462   BaseClassType *const base = static_cast<BaseClassType*>(
463       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
464   );
465
466   if(base && base->tag_changed)
467     (*base->tag_changed)(gobj(),Glib::unwrap(tag));
468 }
469
470
471 } // namespace Canvas
472
473 } // namespace Gnome
474
475