add new sigc++2 directory
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / menutoolbutton.cc
index 718dfdfb6ae34212d65394dedba9c75ff7ae492b..76a1dbe59c76dfa0bb2176752c3a9e7e1f4cf56a 100644 (file)
@@ -118,7 +118,7 @@ void MenuToolButton_Class::class_init_function(void* g_class, void* class_data)
 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
 void MenuToolButton_Class::show_menu_callback(GtkMenuToolButton* self)
 {
-  CppObjectType *const obj = dynamic_cast<CppObjectType*>(
+  Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
 
   // Non-gtkmmproc-generated custom classes implicitly call the default
@@ -126,32 +126,35 @@ void MenuToolButton_Class::show_menu_callback(GtkMenuToolButton* self)
   // generated classes can use this optimisation, which avoids the unnecessary
   // parameter conversions if there is no possibility of the virtual function
   // being overridden:
-  if(obj && obj->is_derived_())
+  if(obj_base && obj_base->is_derived_())
   {
-    #ifdef GLIBMM_EXCEPTIONS_ENABLED
-    try // Trap C++ exceptions which would normally be lost because this is a C callback.
+    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
+    if(obj) // This can be NULL during destruction.
     {
-    #endif //GLIBMM_EXCEPTIONS_ENABLED
-      // Call the virtual member method, which derived classes might override.
-      obj->on_show_menu();
-    #ifdef GLIBMM_EXCEPTIONS_ENABLED
+      #ifdef GLIBMM_EXCEPTIONS_ENABLED
+      try // Trap C++ exceptions which would normally be lost because this is a C callback.
+      {
+      #endif //GLIBMM_EXCEPTIONS_ENABLED
+        // Call the virtual member method, which derived classes might override.
+        obj->on_show_menu();
+        return;
+      #ifdef GLIBMM_EXCEPTIONS_ENABLED
+      }
+      catch(...)
+      {
+        Glib::exception_handlers_invoke();
+      }
+      #endif //GLIBMM_EXCEPTIONS_ENABLED
     }
-    catch(...)
-    {
-      Glib::exception_handlers_invoke();
-    }
-    #endif //GLIBMM_EXCEPTIONS_ENABLED
   }
-  else
-  {
-    BaseClassType *const base = static_cast<BaseClassType*>(
+  
+  BaseClassType *const base = static_cast<BaseClassType*>(
         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
     );
 
-    // Call the original underlying C function:
-    if(base && base->show_menu)
-      (*base->show_menu)(self);
-  }
+  // Call the original underlying C function:
+  if(base && base->show_menu)
+    (*base->show_menu)(self);
 }
 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
 
@@ -197,15 +200,17 @@ GType MenuToolButton::get_base_type()
 
 MenuToolButton::MenuToolButton()
 :
-  Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
+  // Mark this class as non-derived to allow C++ vfuncs to be skipped.
+  Glib::ObjectBase(0),
   Gtk::ToolButton(Glib::ConstructParams(menutoolbutton_class_.init()))
 {
   }
 
 MenuToolButton::MenuToolButton(const Gtk::StockID& stock_id)
 :
-  Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
-  Gtk::ToolButton(Glib::ConstructParams(menutoolbutton_class_.init(), "stock_id", (stock_id).get_c_str(), (char*) 0))
+  // Mark this class as non-derived to allow C++ vfuncs to be skipped.
+  Glib::ObjectBase(0),
+  Gtk::ToolButton(Glib::ConstructParams(menutoolbutton_class_.init(), "stock_id", (stock_id).get_c_str(), static_cast<char*>(0)))
 {
   }
 
@@ -224,11 +229,25 @@ const Menu* MenuToolButton::get_menu() const
   return const_cast<MenuToolButton*>(this)->get_menu();
 }
 
+#ifndef GTKMM_DISABLE_DEPRECATED
+
 void MenuToolButton::set_arrow_tooltip(Tooltips& tooltips, const Glib::ustring& tip_text, const Glib::ustring& tip_private)
 {
 gtk_menu_tool_button_set_arrow_tooltip(gobj(), (tooltips).gobj(), tip_text.c_str(), tip_private.c_str()); 
 }
 
+#endif // GTKMM_DISABLE_DEPRECATED
+
+void MenuToolButton::set_arrow_tooltip_text(const Glib::ustring& text)
+{
+gtk_menu_tool_button_set_arrow_tooltip_text(gobj(), text.c_str()); 
+}
+
+void MenuToolButton::set_arrow_tooltip_markup(const Glib::ustring& markup)
+{
+gtk_menu_tool_button_set_arrow_tooltip_markup(gobj(), markup.c_str()); 
+}
+
 
 Glib::SignalProxy0< void > MenuToolButton::signal_show_menu()
 {