1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gio.StaticResource;
26 
27 private import gio.Resource;
28 private import gio.c.functions;
29 public  import gio.c.types;
30 private import gobject.ObjectG;
31 public  import gtkc.giotypes;
32 
33 
34 /**
35  * #GStaticResource is an opaque data structure and can only be accessed
36  * using the following functions.
37  */
38 public class StaticResource
39 {
40 	/** the main Gtk struct */
41 	protected GStaticResource* gStaticResource;
42 	protected bool ownedRef;
43 
44 	/** Get the main Gtk struct */
45 	public GStaticResource* getStaticResourceStruct(bool transferOwnership = false)
46 	{
47 		if (transferOwnership)
48 			ownedRef = false;
49 		return gStaticResource;
50 	}
51 
52 	/** the main Gtk struct as a void* */
53 	protected void* getStruct()
54 	{
55 		return cast(void*)gStaticResource;
56 	}
57 
58 	/**
59 	 * Sets our main struct and passes it to the parent class.
60 	 */
61 	public this (GStaticResource* gStaticResource, bool ownedRef = false)
62 	{
63 		this.gStaticResource = gStaticResource;
64 		this.ownedRef = ownedRef;
65 	}
66 
67 
68 	/**
69 	 * Finalized a GResource initialized by g_static_resource_init().
70 	 *
71 	 * This is normally used by code generated by
72 	 * [glib-compile-resources][glib-compile-resources]
73 	 * and is not typically used by other code.
74 	 *
75 	 * Since: 2.32
76 	 */
77 	public void fini()
78 	{
79 		g_static_resource_fini(gStaticResource);
80 	}
81 
82 	/**
83 	 * Gets the GResource that was registered by a call to g_static_resource_init().
84 	 *
85 	 * This is normally used by code generated by
86 	 * [glib-compile-resources][glib-compile-resources]
87 	 * and is not typically used by other code.
88 	 *
89 	 * Returns: a #GResource
90 	 *
91 	 * Since: 2.32
92 	 */
93 	public Resource getResource()
94 	{
95 		auto p = g_static_resource_get_resource(gStaticResource);
96 
97 		if(p is null)
98 		{
99 			return null;
100 		}
101 
102 		return ObjectG.getDObject!(Resource)(cast(GResource*) p);
103 	}
104 
105 	/**
106 	 * Initializes a GResource from static data using a
107 	 * GStaticResource.
108 	 *
109 	 * This is normally used by code generated by
110 	 * [glib-compile-resources][glib-compile-resources]
111 	 * and is not typically used by other code.
112 	 *
113 	 * Since: 2.32
114 	 */
115 	public void init()
116 	{
117 		g_static_resource_init(gStaticResource);
118 	}
119 }