Install ardour as a binary, a script and a set of shared
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / entry.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3 #include <gtkmm/entry.h>
4 #include <gtkmm/private/entry_p.h>
5
6 // -*- c++ -*-
7 /* $Id$ */
8
9 /* 
10  *
11  * Copyright 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 Library General Public
15  * License as published by the Free Software Foundation; either
16  * version 2 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  * Library General Public License for more details.
22  *
23  * You should have received a copy of the GNU Library 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 <gtk/gtkentry.h>
29
30
31 namespace
32 {
33
34 void Entry_signal_populate_popup_callback(GtkEntry* self, GtkMenu* p0,void* data)
35 {
36   using namespace Gtk;
37   typedef sigc::slot< void,Menu* > SlotType;
38
39   // Do not try to call a signal on a disassociated wrapper.
40   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
41   {
42     try
43     {
44       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
45         (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
46 );
47     }
48     catch(...)
49     {
50       Glib::exception_handlers_invoke();
51     }
52   }
53 }
54
55 const Glib::SignalProxyInfo Entry_signal_populate_popup_info =
56 {
57   "populate_popup",
58   (GCallback) &Entry_signal_populate_popup_callback,
59   (GCallback) &Entry_signal_populate_popup_callback
60 };
61
62
63 void Entry_signal_insert_at_cursor_callback(GtkEntry* self, const gchar* p0,void* data)
64 {
65   using namespace Gtk;
66   typedef sigc::slot< void,const Glib::ustring& > SlotType;
67
68   // Do not try to call a signal on a disassociated wrapper.
69   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
70   {
71     try
72     {
73       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
74         (*static_cast<SlotType*>(slot))(Glib::convert_const_gchar_ptr_to_ustring(p0)
75 );
76     }
77     catch(...)
78     {
79       Glib::exception_handlers_invoke();
80     }
81   }
82 }
83
84 const Glib::SignalProxyInfo Entry_signal_insert_at_cursor_info =
85 {
86   "insert_at_cursor",
87   (GCallback) &Entry_signal_insert_at_cursor_callback,
88   (GCallback) &Entry_signal_insert_at_cursor_callback
89 };
90
91
92 const Glib::SignalProxyInfo Entry_signal_activate_info =
93 {
94   "activate",
95   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
96   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
97 };
98
99 } // anonymous namespace
100
101
102 namespace Glib
103 {
104
105 Gtk::Entry* wrap(GtkEntry* object, bool take_copy)
106 {
107   return dynamic_cast<Gtk::Entry *> (Glib::wrap_auto ((GObject*)(object), take_copy));
108 }
109
110 } /* namespace Glib */
111
112 namespace Gtk
113 {
114
115
116 /* The *_Class implementation: */
117
118 const Glib::Class& Entry_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_ = &Entry_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(gtk_entry_get_type());
131
132     // Add derived versions of interfaces, if the C type implements any interfaces:
133   Editable::add_interface(get_type());
134   CellEditable::add_interface(get_type());
135   }
136
137   return *this;
138 }
139
140 void Entry_Class::class_init_function(void* g_class, void* class_data)
141 {
142   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
143   CppClassParent::class_init_function(klass, class_data);
144
145   klass->populate_popup = &populate_popup_callback;
146   klass->insert_at_cursor = &insert_at_cursor_callback;
147   klass->activate = &activate_callback;
148 }
149
150
151 void Entry_Class::populate_popup_callback(GtkEntry* self, GtkMenu* p0)
152 {
153   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
154       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
155
156   // Non-gtkmmproc-generated custom classes implicitly call the default
157   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
158   // generated classes can use this optimisation, which avoids the unnecessary
159   // parameter conversions if there is no possibility of the virtual function
160   // being overridden:
161   if(obj && obj->is_derived_())
162   {
163     try // Trap C++ exceptions which would normally be lost because this is a C callback.
164     {
165       // Call the virtual member method, which derived classes might override.
166       obj->on_populate_popup(Glib::wrap(p0)
167 );
168     }
169     catch(...)
170     {
171       Glib::exception_handlers_invoke();
172     }
173   }
174   else
175   {
176     BaseClassType *const base = static_cast<BaseClassType*>(
177         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
178     );
179
180     // Call the original underlying C function:
181     if(base && base->populate_popup)
182       (*base->populate_popup)(self, p0);
183   }
184 }
185
186 void Entry_Class::insert_at_cursor_callback(GtkEntry* self, const gchar* p0)
187 {
188   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
189       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
190
191   // Non-gtkmmproc-generated custom classes implicitly call the default
192   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
193   // generated classes can use this optimisation, which avoids the unnecessary
194   // parameter conversions if there is no possibility of the virtual function
195   // being overridden:
196   if(obj && obj->is_derived_())
197   {
198     try // Trap C++ exceptions which would normally be lost because this is a C callback.
199     {
200       // Call the virtual member method, which derived classes might override.
201       obj->on_insert_at_cursor(Glib::convert_const_gchar_ptr_to_ustring(p0)
202 );
203     }
204     catch(...)
205     {
206       Glib::exception_handlers_invoke();
207     }
208   }
209   else
210   {
211     BaseClassType *const base = static_cast<BaseClassType*>(
212         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
213     );
214
215     // Call the original underlying C function:
216     if(base && base->insert_at_cursor)
217       (*base->insert_at_cursor)(self, p0);
218   }
219 }
220
221 void Entry_Class::activate_callback(GtkEntry* self)
222 {
223   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
224       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
225
226   // Non-gtkmmproc-generated custom classes implicitly call the default
227   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
228   // generated classes can use this optimisation, which avoids the unnecessary
229   // parameter conversions if there is no possibility of the virtual function
230   // being overridden:
231   if(obj && obj->is_derived_())
232   {
233     try // Trap C++ exceptions which would normally be lost because this is a C callback.
234     {
235       // Call the virtual member method, which derived classes might override.
236       obj->on_activate();
237     }
238     catch(...)
239     {
240       Glib::exception_handlers_invoke();
241     }
242   }
243   else
244   {
245     BaseClassType *const base = static_cast<BaseClassType*>(
246         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
247     );
248
249     // Call the original underlying C function:
250     if(base && base->activate)
251       (*base->activate)(self);
252   }
253 }
254
255
256 Glib::ObjectBase* Entry_Class::wrap_new(GObject* o)
257 {
258   return manage(new Entry((GtkEntry*)(o)));
259
260 }
261
262
263 /* The implementation: */
264
265 Entry::Entry(const Glib::ConstructParams& construct_params)
266 :
267   Gtk::Widget(construct_params)
268 {
269   }
270
271 Entry::Entry(GtkEntry* castitem)
272 :
273   Gtk::Widget((GtkWidget*)(castitem))
274 {
275   }
276
277 Entry::~Entry()
278 {
279   destroy_();
280 }
281
282 Entry::CppClassType Entry::entry_class_; // initialize static member
283
284 GType Entry::get_type()
285 {
286   return entry_class_.init().get_type();
287 }
288
289 GType Entry::get_base_type()
290 {
291   return gtk_entry_get_type();
292 }
293
294
295 Entry::Entry()
296 :
297   Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
298   Gtk::Widget(Glib::ConstructParams(entry_class_.init()))
299 {
300   }
301
302 void Entry::set_visibility(bool visible)
303 {
304   gtk_entry_set_visibility(gobj(), static_cast<int>(visible));
305 }
306
307 bool Entry::get_visibility() const
308 {
309   return gtk_entry_get_visibility(const_cast<GtkEntry*>(gobj()));
310 }
311
312 void Entry::set_invisible_char(gunichar ch)
313 {
314   gtk_entry_set_invisible_char(gobj(), ch);
315 }
316
317 gunichar Entry::get_invisible_char() const
318 {
319   return gtk_entry_get_invisible_char(const_cast<GtkEntry*>(gobj()));
320 }
321
322 void Entry::set_has_frame(bool setting)
323 {
324   gtk_entry_set_has_frame(gobj(), static_cast<int>(setting));
325 }
326
327 bool Entry::get_has_frame() const
328 {
329   return gtk_entry_get_has_frame(const_cast<GtkEntry*>(gobj()));
330 }
331
332 void Entry::set_max_length(int max)
333 {
334   gtk_entry_set_max_length(gobj(), max);
335 }
336
337 int Entry::get_max_length() const
338 {
339   return gtk_entry_get_max_length(const_cast<GtkEntry*>(gobj()));
340 }
341
342 void Entry::set_activates_default(bool setting)
343 {
344   gtk_entry_set_activates_default(gobj(), static_cast<int>(setting));
345 }
346
347 gboolean Entry::get_activates_default() const
348 {
349   return gtk_entry_get_activates_default(const_cast<GtkEntry*>(gobj()));
350 }
351
352 void Entry::set_width_chars(int n_chars)
353 {
354   gtk_entry_set_width_chars(gobj(), n_chars);
355 }
356
357 int Entry::get_width_chars() const
358 {
359   return gtk_entry_get_width_chars(const_cast<GtkEntry*>(gobj()));
360 }
361
362 void Entry::set_text(const Glib::ustring & text)
363 {
364   gtk_entry_set_text(gobj(), text.c_str());
365 }
366
367 Glib::ustring Entry::get_text() const
368 {
369   return Glib::convert_const_gchar_ptr_to_ustring(gtk_entry_get_text(const_cast<GtkEntry*>(gobj())));
370 }
371
372 Glib::RefPtr<Pango::Layout> Entry::get_layout()
373 {
374
375   Glib::RefPtr<Pango::Layout> retvalue = Glib::wrap(gtk_entry_get_layout(gobj()));
376
377   if(retvalue)
378     retvalue->reference(); //The function does not do a ref for us.
379   return retvalue;
380 }
381
382 Glib::RefPtr<const Pango::Layout> Entry::get_layout() const
383 {
384
385   Glib::RefPtr<const Pango::Layout> retvalue = Glib::wrap(gtk_entry_get_layout(const_cast<GtkEntry*>(gobj())));
386
387   if(retvalue)
388     retvalue->reference(); //The function does not do a ref for us.
389   return retvalue;
390 }
391
392 void Entry::get_layout_offsets(int& x, int& y)
393 {
394   gtk_entry_get_layout_offsets(gobj(), &x, &y);
395 }
396
397 int Entry::layout_index_to_text_index(int layout_index) const
398 {
399   return gtk_entry_layout_index_to_text_index(const_cast<GtkEntry*>(gobj()), layout_index);
400 }
401
402 int Entry::text_index_to_layout_index(int text_index) const
403 {
404   return gtk_entry_text_index_to_layout_index(const_cast<GtkEntry*>(gobj()), text_index);
405 }
406
407 void Entry::set_alignment(float xalign)
408 {
409   gtk_entry_set_alignment(gobj(), xalign);
410 }
411
412 void Entry::set_alignment(AlignmentEnum xalign)
413 {
414   gtk_entry_set_alignment(gobj(), _gtkmm_align_float_from_enum(xalign));
415 }
416
417 float Entry::get_alignment() const
418 {
419   return gtk_entry_get_alignment(const_cast<GtkEntry*>(gobj()));
420 }
421
422 void Entry::set_completion(const Glib::RefPtr<EntryCompletion>& completion)
423 {
424   gtk_entry_set_completion(gobj(), Glib::unwrap(completion));
425 }
426
427 Glib::RefPtr<EntryCompletion> Entry::get_completion()
428 {
429
430   Glib::RefPtr<EntryCompletion> retvalue = Glib::wrap(gtk_entry_get_completion(gobj()));
431
432   if(retvalue)
433     retvalue->reference(); //The function does not do a ref for us.
434   return retvalue;
435 }
436
437 Glib::RefPtr<const EntryCompletion> Entry::get_completion() const
438 {
439
440   Glib::RefPtr<const EntryCompletion> retvalue = Glib::wrap(gtk_entry_get_completion(const_cast<GtkEntry*>(gobj())));
441
442   if(retvalue)
443     retvalue->reference(); //The function does not do a ref for us.
444   return retvalue;
445 }
446
447 guint16 Entry::get_text_length() const
448 {
449   return gobj()->text_length;
450 }
451
452
453 Glib::SignalProxy1< void,Menu* > Entry::signal_populate_popup()
454 {
455   return Glib::SignalProxy1< void,Menu* >(this, &Entry_signal_populate_popup_info);
456 }
457
458 Glib::SignalProxy1< void,const Glib::ustring& > Entry::signal_insert_at_cursor()
459 {
460   return Glib::SignalProxy1< void,const Glib::ustring& >(this, &Entry_signal_insert_at_cursor_info);
461 }
462
463 Glib::SignalProxy0< void > Entry::signal_activate()
464 {
465   return Glib::SignalProxy0< void >(this, &Entry_signal_activate_info);
466 }
467
468
469 Glib::PropertyProxy_ReadOnly<int> Entry::property_cursor_position() const
470 {
471   return Glib::PropertyProxy_ReadOnly<int>(this, "cursor-position");
472 }
473
474 Glib::PropertyProxy_ReadOnly<int> Entry::property_selection_bound() const
475 {
476   return Glib::PropertyProxy_ReadOnly<int>(this, "selection-bound");
477 }
478
479 Glib::PropertyProxy<bool> Entry::property_editable() 
480 {
481   return Glib::PropertyProxy<bool>(this, "editable");
482 }
483
484 Glib::PropertyProxy_ReadOnly<bool> Entry::property_editable() const
485 {
486   return Glib::PropertyProxy_ReadOnly<bool>(this, "editable");
487 }
488
489 Glib::PropertyProxy<int> Entry::property_max_length() 
490 {
491   return Glib::PropertyProxy<int>(this, "max-length");
492 }
493
494 Glib::PropertyProxy_ReadOnly<int> Entry::property_max_length() const
495 {
496   return Glib::PropertyProxy_ReadOnly<int>(this, "max-length");
497 }
498
499 Glib::PropertyProxy<bool> Entry::property_visibility() 
500 {
501   return Glib::PropertyProxy<bool>(this, "visibility");
502 }
503
504 Glib::PropertyProxy_ReadOnly<bool> Entry::property_visibility() const
505 {
506   return Glib::PropertyProxy_ReadOnly<bool>(this, "visibility");
507 }
508
509 Glib::PropertyProxy<bool> Entry::property_has_frame() 
510 {
511   return Glib::PropertyProxy<bool>(this, "has-frame");
512 }
513
514 Glib::PropertyProxy_ReadOnly<bool> Entry::property_has_frame() const
515 {
516   return Glib::PropertyProxy_ReadOnly<bool>(this, "has-frame");
517 }
518
519 Glib::PropertyProxy<gunichar> Entry::property_invisible_char() 
520 {
521   return Glib::PropertyProxy<gunichar>(this, "invisible-char");
522 }
523
524 Glib::PropertyProxy_ReadOnly<gunichar> Entry::property_invisible_char() const
525 {
526   return Glib::PropertyProxy_ReadOnly<gunichar>(this, "invisible-char");
527 }
528
529 Glib::PropertyProxy<bool> Entry::property_activates_default() 
530 {
531   return Glib::PropertyProxy<bool>(this, "activates-default");
532 }
533
534 Glib::PropertyProxy_ReadOnly<bool> Entry::property_activates_default() const
535 {
536   return Glib::PropertyProxy_ReadOnly<bool>(this, "activates-default");
537 }
538
539 Glib::PropertyProxy<int> Entry::property_width_chars() 
540 {
541   return Glib::PropertyProxy<int>(this, "width-chars");
542 }
543
544 Glib::PropertyProxy_ReadOnly<int> Entry::property_width_chars() const
545 {
546   return Glib::PropertyProxy_ReadOnly<int>(this, "width-chars");
547 }
548
549 Glib::PropertyProxy_ReadOnly<int> Entry::property_scroll_offset() const
550 {
551   return Glib::PropertyProxy_ReadOnly<int>(this, "scroll-offset");
552 }
553
554 Glib::PropertyProxy<Glib::ustring> Entry::property_text() 
555 {
556   return Glib::PropertyProxy<Glib::ustring>(this, "text");
557 }
558
559 Glib::PropertyProxy_ReadOnly<Glib::ustring> Entry::property_text() const
560 {
561   return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "text");
562 }
563
564
565 void Gtk::Entry::on_populate_popup(Menu* menu)
566 {
567   BaseClassType *const base = static_cast<BaseClassType*>(
568       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
569   );
570
571   if(base && base->populate_popup)
572     (*base->populate_popup)(gobj(),(GtkMenu*)Glib::unwrap(menu));
573 }
574
575 void Gtk::Entry::on_insert_at_cursor(const Glib::ustring& str)
576 {
577   BaseClassType *const base = static_cast<BaseClassType*>(
578       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
579   );
580
581   if(base && base->insert_at_cursor)
582     (*base->insert_at_cursor)(gobj(),str.c_str());
583 }
584
585 void Gtk::Entry::on_activate()
586 {
587   BaseClassType *const base = static_cast<BaseClassType*>(
588       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
589   );
590
591   if(base && base->activate)
592     (*base->activate)(gobj());
593 }
594
595
596 } // namespace Gtk
597
598