1 // Generated by gmmproc 2.64.2 -- DO NOT MODIFY!
2 
3 
4 #include <glibmm.h>
5 
6 #include <giomm/simpleaction.h>
7 #include <giomm/private/simpleaction_p.h>
8 
9 
10 /* Copyright (C) 2011 The giomm Development Team
11  *
12  * This library is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Lesser General Public
14  * License as published by the Free Software Foundation; either
15  * version 2.1 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  * Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public
23  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
24  */
25 
26 #include <gio/gio.h>
27 #include <glibmm/exceptionhandler.h>
28 #include <glibmm/variant.h>
29 
30 namespace Gio
31 {
32 
SimpleAction(const Glib::ustring & name)33 SimpleAction::SimpleAction(const Glib::ustring& name) : // Mark this class as non-derived to allow C++ vfuncs to be skipped.
34   Glib::ObjectBase(nullptr),
35   Glib::Object(Glib::ConstructParams(simpleaction_class_.init(), "name",name.c_str(), nullptr))
36 {
37 }
38 
SimpleAction(const Glib::ustring & name,const Glib::VariantBase & state)39 SimpleAction::SimpleAction(const Glib::ustring& name, const Glib::VariantBase& state)
40 : // Mark this class as non-derived to allow C++ vfuncs to be skipped.
41   Glib::ObjectBase(nullptr),
42   Glib::Object(Glib::ConstructParams(simpleaction_class_.init(), "name",name.c_str(),"state",const_cast<GVariant*>((state).gobj()), nullptr))
43 {
44 }
45 
46 Glib::RefPtr<SimpleAction>
create_bool(const Glib::ustring & name,bool state)47 SimpleAction::create_bool(const Glib::ustring& name, bool state)
48 {
49   // We must provide some initial state, as a way to specify the type of the state.
50   return create(name, Glib::Variant<bool>::create(state));
51 }
52 
53 Glib::RefPtr<SimpleAction>
create_radio_string(const Glib::ustring & name,const Glib::ustring & initial_state)54 SimpleAction::create_radio_string(const Glib::ustring& name, const Glib::ustring& initial_state)
55 {
56   // See
57   // https://developer.gnome.org/glib/stable/gvariant-format-strings.html#gvariant-format-strings-strings
58   return create(
59     name, Glib::VARIANT_TYPE_STRING, Glib::Variant<Glib::ustring>::create(initial_state));
60 }
61 
62 Glib::RefPtr<SimpleAction>
create_radio_integer(const Glib::ustring & name,gint32 initial_state)63 SimpleAction::create_radio_integer(const Glib::ustring& name, gint32 initial_state)
64 {
65   // See
66   // https://developer.gnome.org/glib/stable/gvariant-format-strings.html#gvariant-format-strings-numeric-types
67   return create(name, Glib::VARIANT_TYPE_INT32, Glib::Variant<gint32>::create(initial_state));
68 }
69 
70 } // namespace Gio
71 
72 namespace
73 {
74 
75 
SimpleAction_signal_activate_callback(GSimpleAction * self,GVariant * p0,void * data)76 static void SimpleAction_signal_activate_callback(GSimpleAction* self, GVariant* p0,void* data)
77 {
78   using namespace Gio;
79   using SlotType = sigc::slot< void,const Glib::VariantBase& >;
80 
81   auto obj = dynamic_cast<SimpleAction*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
82   // Do not try to call a signal on a disassociated wrapper.
83   if(obj)
84   {
85     try
86     {
87       if(const auto slot = Glib::SignalProxyNormal::data_to_slot(data))
88         (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
89 );
90     }
91     catch(...)
92     {
93        Glib::exception_handlers_invoke();
94     }
95   }
96 }
97 
98 static const Glib::SignalProxyInfo SimpleAction_signal_activate_info =
99 {
100   "activate",
101   (GCallback) &SimpleAction_signal_activate_callback,
102   (GCallback) &SimpleAction_signal_activate_callback
103 };
104 
105 
SimpleAction_signal_change_state_callback(GSimpleAction * self,GVariant * p0,void * data)106 static void SimpleAction_signal_change_state_callback(GSimpleAction* self, GVariant* p0,void* data)
107 {
108   using namespace Gio;
109   using SlotType = sigc::slot< void,const Glib::VariantBase& >;
110 
111   auto obj = dynamic_cast<SimpleAction*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
112   // Do not try to call a signal on a disassociated wrapper.
113   if(obj)
114   {
115     try
116     {
117       if(const auto slot = Glib::SignalProxyNormal::data_to_slot(data))
118         (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
119 );
120     }
121     catch(...)
122     {
123        Glib::exception_handlers_invoke();
124     }
125   }
126 }
127 
128 static const Glib::SignalProxyInfo SimpleAction_signal_change_state_info =
129 {
130   "change-state",
131   (GCallback) &SimpleAction_signal_change_state_callback,
132   (GCallback) &SimpleAction_signal_change_state_callback
133 };
134 
135 
136 } // anonymous namespace
137 
138 
139 namespace Glib
140 {
141 
wrap(GSimpleAction * object,bool take_copy)142 Glib::RefPtr<Gio::SimpleAction> wrap(GSimpleAction* object, bool take_copy)
143 {
144   return Glib::RefPtr<Gio::SimpleAction>( dynamic_cast<Gio::SimpleAction*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
145   //We use dynamic_cast<> in case of multiple inheritance.
146 }
147 
148 } /* namespace Glib */
149 
150 
151 namespace Gio
152 {
153 
154 
155 /* The *_Class implementation: */
156 
init()157 const Glib::Class& SimpleAction_Class::init()
158 {
159   if(!gtype_) // create the GType if necessary
160   {
161     // Glib::Class has to know the class init function to clone custom types.
162     class_init_func_ = &SimpleAction_Class::class_init_function;
163 
164     // This is actually just optimized away, apparently with no harm.
165     // Make sure that the parent type has been created.
166     //CppClassParent::CppObjectType::get_type();
167 
168     // Create the wrapper type, with the same class/instance size as the base type.
169     register_derived_type(g_simple_action_get_type());
170 
171     // Add derived versions of interfaces, if the C type implements any interfaces:
172   Action::add_interface(get_type());
173 
174   }
175 
176   return *this;
177 }
178 
179 
class_init_function(void * g_class,void * class_data)180 void SimpleAction_Class::class_init_function(void* g_class, void* class_data)
181 {
182   const auto klass = static_cast<BaseClassType*>(g_class);
183   CppClassParent::class_init_function(klass, class_data);
184 
185 
186 }
187 
188 
wrap_new(GObject * object)189 Glib::ObjectBase* SimpleAction_Class::wrap_new(GObject* object)
190 {
191   return new SimpleAction((GSimpleAction*)object);
192 }
193 
194 
195 /* The implementation: */
196 
gobj_copy()197 GSimpleAction* SimpleAction::gobj_copy()
198 {
199   reference();
200   return gobj();
201 }
202 
SimpleAction(const Glib::ConstructParams & construct_params)203 SimpleAction::SimpleAction(const Glib::ConstructParams& construct_params)
204 :
205   Glib::Object(construct_params)
206 {
207 
208 }
209 
SimpleAction(GSimpleAction * castitem)210 SimpleAction::SimpleAction(GSimpleAction* castitem)
211 :
212   Glib::Object((GObject*)(castitem))
213 {}
214 
215 
SimpleAction(SimpleAction && src)216 SimpleAction::SimpleAction(SimpleAction&& src) noexcept
217 : Glib::Object(std::move(src))
218   , Action(std::move(src))
219 {}
220 
operator =(SimpleAction && src)221 SimpleAction& SimpleAction::operator=(SimpleAction&& src) noexcept
222 {
223   Glib::Object::operator=(std::move(src));
224   Action::operator=(std::move(src));
225   return *this;
226 }
227 
228 
~SimpleAction()229 SimpleAction::~SimpleAction() noexcept
230 {}
231 
232 
233 SimpleAction::CppClassType SimpleAction::simpleaction_class_; // initialize static member
234 
get_type()235 GType SimpleAction::get_type()
236 {
237   return simpleaction_class_.init().get_type();
238 }
239 
240 
get_base_type()241 GType SimpleAction::get_base_type()
242 {
243   return g_simple_action_get_type();
244 }
245 
246 
SimpleAction(const Glib::ustring & name,const Glib::VariantType & parameter_type)247 SimpleAction::SimpleAction(const Glib::ustring& name, const Glib::VariantType& parameter_type)
248 :
249   // Mark this class as non-derived to allow C++ vfuncs to be skipped.
250   Glib::ObjectBase(nullptr),
251   Glib::Object(Glib::ConstructParams(simpleaction_class_.init(), "name", name.c_str(), "parameter_type", parameter_type.gobj(), nullptr))
252 {
253 
254 
255 }
256 
SimpleAction(const Glib::ustring & name,const Glib::VariantType & parameter_type,const Glib::VariantBase & state)257 SimpleAction::SimpleAction(const Glib::ustring& name, const Glib::VariantType& parameter_type, const Glib::VariantBase& state)
258 :
259   // Mark this class as non-derived to allow C++ vfuncs to be skipped.
260   Glib::ObjectBase(nullptr),
261   Glib::Object(Glib::ConstructParams(simpleaction_class_.init(), "name", name.c_str(), "parameter_type", parameter_type.gobj(), "state", const_cast<GVariant*>((state).gobj()), nullptr))
262 {
263 
264 
265 }
266 
create(const Glib::ustring & name)267 Glib::RefPtr<SimpleAction> SimpleAction::create(const Glib::ustring& name)
268 {
269   return Glib::RefPtr<SimpleAction>( new SimpleAction(name) );
270 }
271 
create(const Glib::ustring & name,const Glib::VariantType & parameter_type)272 Glib::RefPtr<SimpleAction> SimpleAction::create(const Glib::ustring& name, const Glib::VariantType& parameter_type)
273 {
274   return Glib::RefPtr<SimpleAction>( new SimpleAction(name, parameter_type) );
275 }
276 
create(const Glib::ustring & name,const Glib::VariantType & parameter_type,const Glib::VariantBase & state)277 Glib::RefPtr<SimpleAction> SimpleAction::create(const Glib::ustring& name, const Glib::VariantType& parameter_type, const Glib::VariantBase& state)
278 {
279   return Glib::RefPtr<SimpleAction>( new SimpleAction(name, parameter_type, state) );
280 }
281 
create(const Glib::ustring & name,const Glib::VariantBase & state)282 Glib::RefPtr<SimpleAction> SimpleAction::create(const Glib::ustring& name, const Glib::VariantBase& state)
283 {
284   return Glib::RefPtr<SimpleAction>( new SimpleAction(name, state) );
285 }
286 
set_enabled(bool enabled)287 void SimpleAction::set_enabled(bool enabled)
288 {
289   g_simple_action_set_enabled(gobj(), static_cast<int>(enabled));
290 }
291 
set_state(const Glib::VariantBase & value)292 void SimpleAction::set_state(const Glib::VariantBase& value)
293 {
294   g_simple_action_set_state(gobj(), const_cast<GVariant*>((value).gobj()));
295 }
296 
set_state_hint(const Glib::VariantBase & state_hint)297 void SimpleAction::set_state_hint(const Glib::VariantBase& state_hint)
298 {
299   g_simple_action_set_state_hint(gobj(), const_cast<GVariant*>((state_hint).gobj()));
300 }
301 
302 
signal_activate()303 Glib::SignalProxy< void,const Glib::VariantBase& > SimpleAction::signal_activate()
304 {
305   return Glib::SignalProxy< void,const Glib::VariantBase& >(this, &SimpleAction_signal_activate_info);
306 }
307 
308 
signal_change_state()309 Glib::SignalProxy< void,const Glib::VariantBase& > SimpleAction::signal_change_state()
310 {
311   return Glib::SignalProxy< void,const Glib::VariantBase& >(this, &SimpleAction_signal_change_state_info);
312 }
313 
314 
property_enabled()315 Glib::PropertyProxy< bool > SimpleAction::property_enabled()
316 {
317   return Glib::PropertyProxy< bool >(this, "enabled");
318 }
319 
property_enabled() const320 Glib::PropertyProxy_ReadOnly< bool > SimpleAction::property_enabled() const
321 {
322   return Glib::PropertyProxy_ReadOnly< bool >(this, "enabled");
323 }
324 
property_name() const325 Glib::PropertyProxy_ReadOnly< Glib::ustring > SimpleAction::property_name() const
326 {
327   return Glib::PropertyProxy_ReadOnly< Glib::ustring >(this, "name");
328 }
329 
property_parameter_type() const330 Glib::PropertyProxy_ReadOnly< Glib::VariantType > SimpleAction::property_parameter_type() const
331 {
332   return Glib::PropertyProxy_ReadOnly< Glib::VariantType >(this, "parameter-type");
333 }
334 
property_state()335 Glib::PropertyProxy< Glib::VariantBase > SimpleAction::property_state()
336 {
337   return Glib::PropertyProxy< Glib::VariantBase >(this, "state");
338 }
339 
property_state() const340 Glib::PropertyProxy_ReadOnly< Glib::VariantBase > SimpleAction::property_state() const
341 {
342   return Glib::PropertyProxy_ReadOnly< Glib::VariantBase >(this, "state");
343 }
344 
property_state_type() const345 Glib::PropertyProxy_ReadOnly< Glib::VariantType > SimpleAction::property_state_type() const
346 {
347   return Glib::PropertyProxy_ReadOnly< Glib::VariantType >(this, "state-type");
348 }
349 
350 
351 } // namespace Gio
352 
353 
354