Guitarix
regler.cc
Go to the documentation of this file.
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2 
3 
4 #include <glibmm.h>
5 
6 #include <gxwmm/regler.h>
7 #include <gxwmm/private/regler_p.h>
8 
9 
10 /*
11  * Copyright (C) 2009, 2010 Hermann Meyer, James Warden, Andreas Degert
12  *
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 2 of the License, or
16  * (at your option) any later version.
17  *
18  * This program 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
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26  */
27 
28 #include <gxw/GxRegler.h>
29 #include <string.h> // needed by some compiler because of generated strlen()
30 
31 namespace
32 {
33 
34 
35 static gboolean Regler_signal_value_entry_callback(GxRegler* self, GdkRectangle* p0,GdkEventButton* p1,void* data)
36 {
37  using namespace Gxw;
38  typedef sigc::slot< bool,const Gdk::Rectangle&,GdkEventButton* > SlotType;
39 
40  // Do not try to call a signal on a disassociated wrapper.
41  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
42  {
43  #ifdef GLIBMM_EXCEPTIONS_ENABLED
44  try
45  {
46  #endif //GLIBMM_EXCEPTIONS_ENABLED
47  if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
48  return static_cast<int>((*static_cast<SlotType*>(slot))(Glib::wrap(p0)
49 , p1));
50  #ifdef GLIBMM_EXCEPTIONS_ENABLED
51  }
52  catch(...)
53  {
54  Glib::exception_handlers_invoke();
55  }
56  #endif //GLIBMM_EXCEPTIONS_ENABLED
57  }
58 
59  typedef gboolean RType;
60  return RType();
61 }
62 
63 static gboolean Regler_signal_value_entry_notify_callback(GxRegler* self, GdkRectangle* p0,GdkEventButton* p1, void* data)
64 {
65  using namespace Gxw;
66  typedef sigc::slot< void,const Gdk::Rectangle&,GdkEventButton* > 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  #ifdef GLIBMM_EXCEPTIONS_ENABLED
72  try
73  {
74  #endif //GLIBMM_EXCEPTIONS_ENABLED
75  if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
76  (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
77 , p1);
78  #ifdef GLIBMM_EXCEPTIONS_ENABLED
79  }
80  catch(...)
81  {
82  Glib::exception_handlers_invoke();
83  }
84  #endif //GLIBMM_EXCEPTIONS_ENABLED
85  }
86 
87  typedef gboolean RType;
88  return RType();
89 }
90 
91 static const Glib::SignalProxyInfo Regler_signal_value_entry_info =
92 {
93  "value-entry",
94  (GCallback) &Regler_signal_value_entry_callback,
95  (GCallback) &Regler_signal_value_entry_notify_callback
96 };
97 
98 
99 static gint Regler_signal_input_value_callback(GxRegler* self, gpointer p0,gpointer p1,void* data)
100 {
101  using namespace Gxw;
102  typedef sigc::slot< int,void *,void * > SlotType;
103 
104  // Do not try to call a signal on a disassociated wrapper.
105  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
106  {
107  #ifdef GLIBMM_EXCEPTIONS_ENABLED
108  try
109  {
110  #endif //GLIBMM_EXCEPTIONS_ENABLED
111  if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
112  return (*static_cast<SlotType*>(slot))(p0
113 , p1
114 );
115  #ifdef GLIBMM_EXCEPTIONS_ENABLED
116  }
117  catch(...)
118  {
119  Glib::exception_handlers_invoke();
120  }
121  #endif //GLIBMM_EXCEPTIONS_ENABLED
122  }
123 
124  typedef gint RType;
125  return RType();
126 }
127 
128 static gint Regler_signal_input_value_notify_callback(GxRegler* self, gpointer p0,gpointer p1, void* data)
129 {
130  using namespace Gxw;
131  typedef sigc::slot< void,void *,void * > SlotType;
132 
133  // Do not try to call a signal on a disassociated wrapper.
134  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
135  {
136  #ifdef GLIBMM_EXCEPTIONS_ENABLED
137  try
138  {
139  #endif //GLIBMM_EXCEPTIONS_ENABLED
140  if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
141  (*static_cast<SlotType*>(slot))(p0
142 , p1
143 );
144  #ifdef GLIBMM_EXCEPTIONS_ENABLED
145  }
146  catch(...)
147  {
148  Glib::exception_handlers_invoke();
149  }
150  #endif //GLIBMM_EXCEPTIONS_ENABLED
151  }
152 
153  typedef gint RType;
154  return RType();
155 }
156 
157 static const Glib::SignalProxyInfo Regler_signal_input_value_info =
158 {
159  "input-value",
160  (GCallback) &Regler_signal_input_value_callback,
161  (GCallback) &Regler_signal_input_value_notify_callback
162 };
163 
164 
165 static gchar* Regler_signal_format_value_callback(GxRegler* self, gdouble p0,void* data)
166 {
167  using namespace Gxw;
168  typedef sigc::slot< Glib::ustring,double > SlotType;
169 
170  // Do not try to call a signal on a disassociated wrapper.
171  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
172  {
173  #ifdef GLIBMM_EXCEPTIONS_ENABLED
174  try
175  {
176  #endif //GLIBMM_EXCEPTIONS_ENABLED
177  if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
178  return (strlen((*static_cast<SlotType*>(slot))(p0
179 ).c_str()) ? g_strdup((*static_cast<SlotType*>(slot))(p0
180 ).c_str()) : 0);
181  #ifdef GLIBMM_EXCEPTIONS_ENABLED
182  }
183  catch(...)
184  {
185  Glib::exception_handlers_invoke();
186  }
187  #endif //GLIBMM_EXCEPTIONS_ENABLED
188  }
189 
190  typedef gchar* RType;
191  return RType();
192 }
193 
194 static gchar* Regler_signal_format_value_notify_callback(GxRegler* self, gdouble p0, void* data)
195 {
196  using namespace Gxw;
197  typedef sigc::slot< void,double > SlotType;
198 
199  // Do not try to call a signal on a disassociated wrapper.
200  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
201  {
202  #ifdef GLIBMM_EXCEPTIONS_ENABLED
203  try
204  {
205  #endif //GLIBMM_EXCEPTIONS_ENABLED
206  if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
207  (*static_cast<SlotType*>(slot))(p0
208 );
209  #ifdef GLIBMM_EXCEPTIONS_ENABLED
210  }
211  catch(...)
212  {
213  Glib::exception_handlers_invoke();
214  }
215  #endif //GLIBMM_EXCEPTIONS_ENABLED
216  }
217 
218  typedef gchar* RType;
219  return RType();
220 }
221 
222 static const Glib::SignalProxyInfo Regler_signal_format_value_info =
223 {
224  "format_value",
225  (GCallback) &Regler_signal_format_value_callback,
226  (GCallback) &Regler_signal_format_value_notify_callback
227 };
228 
229 
230 } // anonymous namespace
231 
232 
233 namespace Glib
234 {
235 
236 Gxw::Regler* wrap(GxRegler* object, bool take_copy)
237 {
238  return dynamic_cast<Gxw::Regler *> (Glib::wrap_auto ((GObject*)(object), take_copy));
239 }
240 
241 } /* namespace Glib */
242 
243 namespace Gxw
244 {
245 
246 
247 /* The *_Class implementation: */
248 
249 const Glib::Class& Regler_Class::init()
250 {
251  if(!gtype_) // create the GType if necessary
252  {
253  // Glib::Class has to know the class init function to clone custom types.
254  class_init_func_ = &Regler_Class::class_init_function;
255 
256  // This is actually just optimized away, apparently with no harm.
257  // Make sure that the parent type has been created.
258  //CppClassParent::CppObjectType::get_type();
259 
260  // Create the wrapper type, with the same class/instance size as the base type.
261  register_derived_type(gx_regler_get_type());
262 
263  // Add derived versions of interfaces, if the C type implements any interfaces:
265 
266  }
267 
268  return *this;
269 }
270 
271 
272 void Regler_Class::class_init_function(void* g_class, void* class_data)
273 {
274  BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
275  CppClassParent::class_init_function(klass, class_data);
276 
277 
278  klass->value_entry = &value_entry_callback;
279  klass->input_value = &input_value_callback;
280  klass->format_value = &format_value_callback;
281 }
282 
283 
284 gboolean Regler_Class::value_entry_callback(GxRegler* self, GdkRectangle* p0, GdkEventButton* p1)
285 {
286  Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
287  Glib::ObjectBase::_get_current_wrapper((GObject*)self));
288 
289  // Non-gtkmmproc-generated custom classes implicitly call the default
290  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
291  // generated classes can use this optimisation, which avoids the unnecessary
292  // parameter conversions if there is no possibility of the virtual function
293  // being overridden:
294  if(obj_base && obj_base->is_derived_())
295  {
296  CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
297  if(obj) // This can be NULL during destruction.
298  {
299  #ifdef GLIBMM_EXCEPTIONS_ENABLED
300  try // Trap C++ exceptions which would normally be lost because this is a C callback.
301  {
302  #endif //GLIBMM_EXCEPTIONS_ENABLED
303  // Call the virtual member method, which derived classes might override.
304  return static_cast<int>(obj->on_value_entry(Glib::wrap(p0)
305 , p1));
306  #ifdef GLIBMM_EXCEPTIONS_ENABLED
307  }
308  catch(...)
309  {
310  Glib::exception_handlers_invoke();
311  }
312  #endif //GLIBMM_EXCEPTIONS_ENABLED
313  }
314  }
315 
316  BaseClassType *const base = static_cast<BaseClassType*>(
317  g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
318  );
319 
320  // Call the original underlying C function:
321  if(base && base->value_entry)
322  return (*base->value_entry)(self, p0, p1);
323 
324  typedef gboolean RType;
325  return RType();
326 }
327 gint Regler_Class::input_value_callback(GxRegler* self, gpointer p0, gpointer p1)
328 {
329  Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
330  Glib::ObjectBase::_get_current_wrapper((GObject*)self));
331 
332  // Non-gtkmmproc-generated custom classes implicitly call the default
333  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
334  // generated classes can use this optimisation, which avoids the unnecessary
335  // parameter conversions if there is no possibility of the virtual function
336  // being overridden:
337  if(obj_base && obj_base->is_derived_())
338  {
339  CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
340  if(obj) // This can be NULL during destruction.
341  {
342  #ifdef GLIBMM_EXCEPTIONS_ENABLED
343  try // Trap C++ exceptions which would normally be lost because this is a C callback.
344  {
345  #endif //GLIBMM_EXCEPTIONS_ENABLED
346  // Call the virtual member method, which derived classes might override.
347  return obj->on_input_value(p0
348 , p1
349 );
350  #ifdef GLIBMM_EXCEPTIONS_ENABLED
351  }
352  catch(...)
353  {
354  Glib::exception_handlers_invoke();
355  }
356  #endif //GLIBMM_EXCEPTIONS_ENABLED
357  }
358  }
359 
360  BaseClassType *const base = static_cast<BaseClassType*>(
361  g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
362  );
363 
364  // Call the original underlying C function:
365  if(base && base->input_value)
366  return (*base->input_value)(self, p0, p1);
367 
368  typedef gint RType;
369  return RType();
370 }
371 gchar* Regler_Class::format_value_callback(GxRegler* self, gdouble p0)
372 {
373  Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
374  Glib::ObjectBase::_get_current_wrapper((GObject*)self));
375 
376  // Non-gtkmmproc-generated custom classes implicitly call the default
377  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
378  // generated classes can use this optimisation, which avoids the unnecessary
379  // parameter conversions if there is no possibility of the virtual function
380  // being overridden:
381  if(obj_base && obj_base->is_derived_())
382  {
383  CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
384  if(obj) // This can be NULL during destruction.
385  {
386  #ifdef GLIBMM_EXCEPTIONS_ENABLED
387  try // Trap C++ exceptions which would normally be lost because this is a C callback.
388  {
389  #endif //GLIBMM_EXCEPTIONS_ENABLED
390  // Call the virtual member method, which derived classes might override.
391  return (strlen(obj->on_format_value(p0
392 ).c_str()) ? g_strdup(obj->on_format_value(p0
393 ).c_str()) : 0);
394  #ifdef GLIBMM_EXCEPTIONS_ENABLED
395  }
396  catch(...)
397  {
398  Glib::exception_handlers_invoke();
399  }
400  #endif //GLIBMM_EXCEPTIONS_ENABLED
401  }
402  }
403 
404  BaseClassType *const base = static_cast<BaseClassType*>(
405  g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
406  );
407 
408  // Call the original underlying C function:
409  if(base && base->format_value)
410  return (*base->format_value)(self, p0);
411 
412  typedef gchar* RType;
413  return RType();
414 }
415 
416 
417 Glib::ObjectBase* Regler_Class::wrap_new(GObject* o)
418 {
419  return manage(new Regler((GxRegler*)(o)));
420 
421 }
422 
423 
424 /* The implementation: */
425 
426 Regler::Regler(const Glib::ConstructParams& construct_params)
427 :
428  Gtk::Range(construct_params)
429 {
430  }
431 
433 :
434  Gtk::Range((GtkRange*)(castitem))
435 {
436  }
437 
439 {
440  destroy_();
441 }
442 
443 Regler::CppClassType Regler::regler_class_; // initialize static member
444 
446 {
447  return regler_class_.init().get_type();
448 }
449 
450 
452 {
453  return gx_regler_get_type();
454 }
455 
456 
457 void Regler::set_label_ref(Gtk::Label* p1)
458 {
459  gx_regler_set_label_ref(gobj(), (GtkLabel*)Glib::unwrap(p1));
460 }
461 
463 {
464  return Glib::wrap(gx_regler_get_label_ref(gobj()));
465 }
466 
468 {
469  gx_regler_set_show_value(gobj(), static_cast<int>(p1));
470 }
471 
473 {
474  return gx_regler_get_show_value(gobj());
475 }
476 
477 void Regler::set_value_position(Gtk::PositionType p1)
478 {
479  gx_regler_set_value_position(gobj(), ((GtkPositionType)(p1)));
480 }
481 
482 Gtk::PositionType Regler::get_value_position()
483 {
484  return ((Gtk::PositionType)(gx_regler_get_value_position(gobj())));
485 }
486 
488 :
489  // Mark this class as non-derived to allow C++ vfuncs to be skipped.
490  Glib::ObjectBase(0),
491  Gtk::Range(Glib::ConstructParams(regler_class_.init()))
492 {
493 
494 
495 }
496 
497 
498 Glib::SignalProxy2< bool,const Gdk::Rectangle&,GdkEventButton* > Regler::signal_value_entry()
499 {
500  return Glib::SignalProxy2< bool,const Gdk::Rectangle&,GdkEventButton* >(this, &Regler_signal_value_entry_info);
501 }
502 
503 
504 Glib::SignalProxy2< int,void *,void * > Regler::signal_input_value()
505 {
506  return Glib::SignalProxy2< int,void *,void * >(this, &Regler_signal_input_value_info);
507 }
508 
509 
510 Glib::SignalProxy1< Glib::ustring,double > Regler::signal_format_value()
511 {
512  return Glib::SignalProxy1< Glib::ustring,double >(this, &Regler_signal_format_value_info);
513 }
514 
515 
516 #ifdef GLIBMM_PROPERTIES_ENABLED
517 Glib::PropertyProxy< Gtk::Label > Regler::property_label_ref()
518 {
519  return Glib::PropertyProxy< Gtk::Label >(this, "label-ref");
520 }
521 #endif //GLIBMM_PROPERTIES_ENABLED
522 
523 #ifdef GLIBMM_PROPERTIES_ENABLED
524 Glib::PropertyProxy_ReadOnly< Gtk::Label > Regler::property_label_ref() const
525 {
526  return Glib::PropertyProxy_ReadOnly< Gtk::Label >(this, "label-ref");
527 }
528 #endif //GLIBMM_PROPERTIES_ENABLED
529 
530 #ifdef GLIBMM_PROPERTIES_ENABLED
531 Glib::PropertyProxy< bool > Regler::property_show_value()
532 {
533  return Glib::PropertyProxy< bool >(this, "show-value");
534 }
535 #endif //GLIBMM_PROPERTIES_ENABLED
536 
537 #ifdef GLIBMM_PROPERTIES_ENABLED
538 Glib::PropertyProxy_ReadOnly< bool > Regler::property_show_value() const
539 {
540  return Glib::PropertyProxy_ReadOnly< bool >(this, "show-value");
541 }
542 #endif //GLIBMM_PROPERTIES_ENABLED
543 
544 #ifdef GLIBMM_PROPERTIES_ENABLED
545 Glib::PropertyProxy< double > Regler::property_value_xalign()
546 {
547  return Glib::PropertyProxy< double >(this, "value-xalign");
548 }
549 #endif //GLIBMM_PROPERTIES_ENABLED
550 
551 #ifdef GLIBMM_PROPERTIES_ENABLED
552 Glib::PropertyProxy_ReadOnly< double > Regler::property_value_xalign() const
553 {
554  return Glib::PropertyProxy_ReadOnly< double >(this, "value-xalign");
555 }
556 #endif //GLIBMM_PROPERTIES_ENABLED
557 
558 #ifdef GLIBMM_PROPERTIES_ENABLED
559 Glib::PropertyProxy_ReadOnly< int > Regler::property_digits() const
560 {
561  return Glib::PropertyProxy_ReadOnly< int >(this, "digits");
562 }
563 #endif //GLIBMM_PROPERTIES_ENABLED
564 
565 #ifdef GLIBMM_PROPERTIES_ENABLED
566 Glib::PropertyProxy< Gtk::PositionType > Regler::property_value_position()
567 {
568  return Glib::PropertyProxy< Gtk::PositionType >(this, "value-position");
569 }
570 #endif //GLIBMM_PROPERTIES_ENABLED
571 
572 #ifdef GLIBMM_PROPERTIES_ENABLED
573 Glib::PropertyProxy_ReadOnly< Gtk::PositionType > Regler::property_value_position() const
574 {
575  return Glib::PropertyProxy_ReadOnly< Gtk::PositionType >(this, "value-position");
576 }
577 #endif //GLIBMM_PROPERTIES_ENABLED
578 
579 
580 bool Gxw::Regler::on_value_entry(const Gdk::Rectangle& p1, GdkEventButton* p2)
581 {
582  BaseClassType *const base = static_cast<BaseClassType*>(
583  g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
584  );
585 
586  if(base && base->value_entry)
587  return (*base->value_entry)(gobj(),const_cast<GdkRectangle*>(p1.gobj()),p2);
588 
589  typedef bool RType;
590  return RType();
591 }
592 int Gxw::Regler::on_input_value(void * spin, void * new_val)
593 {
594  BaseClassType *const base = static_cast<BaseClassType*>(
595  g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
596  );
597 
598  if(base && base->input_value)
599  return (*base->input_value)(gobj(),spin,new_val);
600 
601  typedef int RType;
602  return RType();
603 }
604 Glib::ustring Gxw::Regler::on_format_value(double value)
605 {
606  BaseClassType *const base = static_cast<BaseClassType*>(
607  g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
608  );
609 
610  if(base && base->format_value)
611  return Glib::convert_const_gchar_ptr_to_ustring((*base->format_value)(gobj(),value));
612 
613  typedef Glib::ustring RType;
614  return RType();
615 }
616 
617 
618 } // namespace Gxw
619 
620 
Gxw::Regler * wrap(GxRegler *object, bool take_copy)
Definition: regler.cc:236
virtual int on_input_value(void *spin, void *new_val)
This is a default handler for the signal signal_input_value().
Definition: regler.cc:592
void init(int samplingFreq)
static Glib::ObjectBase * wrap_new(GObject *)
Definition: regler.cc:417
Glib::SignalProxy2< int, void *, void *> signal_input_value()
Definition: regler.cc:504
GType gx_regler_get_type(void)
static GType get_type() G_GNUC_CONST
Definition: regler.cc:445
static void add_interface(GType gtype_implementer)
void set_show_value(bool p1)
Definition: regler.cc:467
virtual bool on_value_entry(const Gdk::Rectangle &p1, GdkEventButton *p2)
This is a default handler for the signal signal_value_entry().
Definition: regler.cc:580
Gtk::PositionType get_value_position()
Definition: regler.cc:482
void set_label_ref(Gtk::Label *p1)
Definition: regler.cc:457
Glib::SignalProxy2< bool, const Gdk::Rectangle &, GdkEventButton *> signal_value_entry()
Definition: regler.cc:498
Definition: bigknob.cc:51
virtual Glib::ustring on_format_value(double value)
This is a default handler for the signal signal_format_value().
Definition: regler.cc:604
void set_value_position(Gtk::PositionType p1)
Definition: regler.cc:477
virtual ~Regler()
Definition: regler.cc:438
Glib::SignalProxy1< Glib::ustring, double > signal_format_value()
Definition: regler.cc:510
GxRegler * gobj()
Provides access to the underlying C GtkObject.
Definition: regler.h:81
Gxw::BigKnob * wrap(GxBigKnob *object, bool take_copy)
Definition: bigknob.cc:44
Definition: bigknob.cc:41
bool get_show_value()
Definition: regler.cc:472
static GType get_base_type() G_GNUC_CONST
Definition: regler.cc:451
GxControlParameterIface BaseClassType
struct _GxRegler GxRegler
Definition: regler.h:35
Gtk::Label * get_label_ref()
Definition: regler.cc:462