| 1 | // Generated by gmmproc 2.50.1 -- DO NOT MODIFY! |
| 2 | |
| 3 | |
| 4 | #include <glibmm.h> |
| 5 | |
| 6 | #include <gstreamermm/navigation.h> |
| 7 | #include <gstreamermm/private/navigation_p.h> |
| 8 | |
| 9 | |
| 10 | /* gstreamermm - a C++ wrapper for gstreamer |
| 11 | * |
| 12 | * Copyright 2008-2016 The gstreamermm Development Team |
| 13 | * |
| 14 | * This library is free software; you can redistribute it and/or |
| 15 | * modify it under the terms of the GNU Lesser General Public |
| 16 | * License as published by the Free Software Foundation; either |
| 17 | * version 2.1 of the License, or (at your option) any later version. |
| 18 | * |
| 19 | * This library is distributed in the hope that it will be useful, |
| 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 22 | * Lesser General Public License for more details. |
| 23 | * |
| 24 | * You should have received a copy of the GNU Lesser General Public |
| 25 | * License along with this library; if not, write to the Free |
| 26 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 27 | */ |
| 28 | |
| 29 | #include <gstreamermm/structure.h> |
| 30 | #include <gst/video/video-enumtypes.h> |
| 31 | |
| 32 | namespace Gst |
| 33 | { |
| 34 | |
| 35 | void Navigation_Class::send_event_vfunc_callback(GstNavigation* self, GstStructure* structure) |
| 36 | { |
| 37 | Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>( |
| 38 | Glib::ObjectBase::_get_current_wrapper((GObject*)self)); |
| 39 | |
| 40 | // Non-gtkmmproc-generated custom classes implicitly call the default |
| 41 | // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- |
| 42 | // generated classes can use this optimisation, which avoids the unnecessary |
| 43 | // parameter conversions if there is no possibility of the virtual function |
| 44 | // being overridden: |
| 45 | if(obj_base && obj_base->is_derived_()) |
| 46 | { |
| 47 | CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base); |
| 48 | if(obj) // This can be NULL during destruction. |
| 49 | { |
| 50 | try // Trap C++ exceptions which would normally be lost because this is a C callback. |
| 51 | { |
| 52 | // Call the virtual member method, which derived classes might override. |
| 53 | obj->send_event_vfunc(Gst::Structure(structure)); |
| 54 | return; |
| 55 | } |
| 56 | catch(...) |
| 57 | { |
| 58 | Glib::exception_handlers_invoke(); |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | BaseClassType *const base = static_cast<BaseClassType*>( |
| 64 | g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). |
| 65 | g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. |
| 66 | ) ); |
| 67 | |
| 68 | // Call the original underlying C function: |
| 69 | if(base && base->send_event) |
| 70 | (*base->send_event)(self, structure); |
| 71 | |
| 72 | } |
| 73 | void Gst::Navigation::send_event_vfunc(Gst::Structure&& structure) |
| 74 | { |
| 75 | BaseClassType *const base = static_cast<BaseClassType*>( |
| 76 | g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). |
| 77 | g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. |
| 78 | ) ); |
| 79 | |
| 80 | if(base && base->send_event) |
| 81 | (*base->send_event)(gobj(), structure ? structure.release() : nullptr); |
| 82 | } |
| 83 | |
| 84 | } // namespace Gst |
| 85 | |
| 86 | namespace |
| 87 | { |
| 88 | } // anonymous namespace |
| 89 | |
| 90 | // static |
| 91 | GType Glib::Value<Gst::NavigationCommand>::value_type() |
| 92 | { |
| 93 | return gst_navigation_command_get_type(); |
| 94 | } |
| 95 | |
| 96 | // static |
| 97 | GType Glib::Value<Gst::NavigationEventType>::value_type() |
| 98 | { |
| 99 | return gst_navigation_event_type_get_type(); |
| 100 | } |
| 101 | |
| 102 | // static |
| 103 | GType Glib::Value<Gst::NavigationMessageType>::value_type() |
| 104 | { |
| 105 | return gst_navigation_message_type_get_type(); |
| 106 | } |
| 107 | |
| 108 | // static |
| 109 | GType Glib::Value<Gst::NavigationQueryType>::value_type() |
| 110 | { |
| 111 | return gst_navigation_query_type_get_type(); |
| 112 | } |
| 113 | |
| 114 | |
| 115 | namespace Glib |
| 116 | { |
| 117 | |
| 118 | Glib::RefPtr<Gst::Navigation> wrap(GstNavigation* object, bool take_copy) |
| 119 | { |
| 120 | return Glib::RefPtr<Gst::Navigation>( dynamic_cast<Gst::Navigation*> (Glib::wrap_auto_interface<Gst::Navigation> ((GObject*)(object), take_copy)) ); |
| 121 | //We use dynamic_cast<> in case of multiple inheritance. |
| 122 | } |
| 123 | |
| 124 | } // namespace Glib |
| 125 | |
| 126 | |
| 127 | namespace Gst |
| 128 | { |
| 129 | |
| 130 | |
| 131 | /* The *_Class implementation: */ |
| 132 | |
| 133 | const Glib::Interface_Class& Navigation_Class::init() |
| 134 | { |
| 135 | if(!gtype_) // create the GType if necessary |
| 136 | { |
| 137 | // Glib::Interface_Class has to know the interface init function |
| 138 | // in order to add interfaces to implementing types. |
| 139 | class_init_func_ = &Navigation_Class::iface_init_function; |
| 140 | |
| 141 | // We can not derive from another interface, and it is not necessary anyway. |
| 142 | gtype_ = gst_navigation_get_type(); |
| 143 | } |
| 144 | |
| 145 | return *this; |
| 146 | } |
| 147 | |
| 148 | void Navigation_Class::iface_init_function(void* g_iface, void*) |
| 149 | { |
| 150 | const auto klass = static_cast<BaseClassType*>(g_iface); |
| 151 | |
| 152 | //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect. |
| 153 | //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc |
| 154 | g_assert(klass != nullptr); |
| 155 | |
| 156 | klass->send_event = &send_event_vfunc_callback; |
| 157 | |
| 158 | } |
| 159 | |
| 160 | |
| 161 | Glib::ObjectBase* Navigation_Class::wrap_new(GObject* object) |
| 162 | { |
| 163 | return new Navigation((GstNavigation*)(object)); |
| 164 | } |
| 165 | |
| 166 | |
| 167 | /* The implementation: */ |
| 168 | |
| 169 | Navigation::Navigation() |
| 170 | : |
| 171 | Glib::Interface(navigation_class_.init()) |
| 172 | {} |
| 173 | |
| 174 | Navigation::Navigation(GstNavigation* castitem) |
| 175 | : |
| 176 | Glib::Interface((GObject*)(castitem)) |
| 177 | {} |
| 178 | |
| 179 | Navigation::Navigation(const Glib::Interface_Class& interface_class) |
| 180 | : Glib::Interface(interface_class) |
| 181 | { |
| 182 | } |
| 183 | |
| 184 | Navigation::Navigation(Navigation&& src) noexcept |
| 185 | : Glib::Interface(std::move(src)) |
| 186 | {} |
| 187 | |
| 188 | Navigation& Navigation::operator=(Navigation&& src) noexcept |
| 189 | { |
| 190 | Glib::Interface::operator=(std::move(src)); |
| 191 | return *this; |
| 192 | } |
| 193 | |
| 194 | Navigation::~Navigation() noexcept |
| 195 | {} |
| 196 | |
| 197 | // static |
| 198 | void Navigation::add_interface(GType gtype_implementer) |
| 199 | { |
| 200 | navigation_class_.init().add_interface(gtype_implementer); |
| 201 | } |
| 202 | |
| 203 | Navigation::CppClassType Navigation::navigation_class_; // initialize static member |
| 204 | |
| 205 | GType Navigation::get_type() |
| 206 | { |
| 207 | return navigation_class_.init().get_type(); |
| 208 | } |
| 209 | |
| 210 | |
| 211 | GType Navigation::get_base_type() |
| 212 | { |
| 213 | return gst_navigation_get_type(); |
| 214 | } |
| 215 | |
| 216 | |
| 217 | void Navigation::send_event(Gst::Structure& structure) |
| 218 | { |
| 219 | gst_navigation_send_event(gobj(), structure.gobj()); |
| 220 | } |
| 221 | |
| 222 | void Navigation::send_key_event(const Glib::ustring& event, const Glib::ustring& key) |
| 223 | { |
| 224 | gst_navigation_send_key_event(gobj(), event.c_str(), key.c_str()); |
| 225 | } |
| 226 | |
| 227 | void Navigation::send_mouse_event(const Glib::ustring& event, int button, double x, double y) |
| 228 | { |
| 229 | gst_navigation_send_mouse_event(gobj(), event.c_str(), button, x, y); |
| 230 | } |
| 231 | |
| 232 | void Navigation::send_command(Gst::NavigationCommand command) |
| 233 | { |
| 234 | gst_navigation_send_command(gobj(), ((GstNavigationCommand)(command))); |
| 235 | } |
| 236 | |
| 237 | |
| 238 | } // namespace Gst |
| 239 | |
| 240 |