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 gobject.ObjectG;
29 private import gtkc.gio;
30 public  import gtkc.giotypes;
31 
32 
33 /**
34  * #GStaticResource is an opaque data structure and can only be accessed
35  * using the following functions.
36  */
37 public class StaticResource
38 {
39 	/** the main Gtk struct */
40 	protected GStaticResource* gStaticResource;
41 	protected bool ownedRef;
42 
43 	/** Get the main Gtk struct */
44 	public GStaticResource* getStaticResourceStruct(bool transferOwnership = false)
45 	{
46 		if (transferOwnership)
47 			ownedRef = false;
48 		return gStaticResource;
49 	}
50 
51 	/** the main Gtk struct as a void* */
52 	protected void* getStruct()
53 	{
54 		return cast(void*)gStaticResource;
55 	}
56 
57 	/**
58 	 * Sets our main struct and passes it to the parent class.
59 	 */
60 	public this (GStaticResource* gStaticResource, bool ownedRef = false)
61 	{
62 		this.gStaticResource = gStaticResource;
63 		this.ownedRef = ownedRef;
64 	}
65 
66 
67 	/**
68 	 * Finalized a GResource initialized by g_static_resource_init().
69 	 *
70 	 * This is normally used by code generated by
71 	 * [glib-compile-resources][glib-compile-resources]
72 	 * and is not typically used by other code.
73 	 *
74 	 * Since: 2.32
75 	 */
76 	public void fini()
77 	{
78 		g_static_resource_fini(gStaticResource);
79 	}
80 
81 	/**
82 	 * Gets the GResource that was registered by a call to g_static_resource_init().
83 	 *
84 	 * This is normally used by code generated by
85 	 * [glib-compile-resources][glib-compile-resources]
86 	 * and is not typically used by other code.
87 	 *
88 	 * Returns: a #GResource
89 	 *
90 	 * Since: 2.32
91 	 */
92 	public Resource getResource()
93 	{
94 		auto p = g_static_resource_get_resource(gStaticResource);
95 		
96 		if(p is null)
97 		{
98 			return null;
99 		}
100 		
101 		return ObjectG.getDObject!(Resource)(cast(GResource*) p);
102 	}
103 
104 	/**
105 	 * Initializes a GResource from static data using a
106 	 * GStaticResource.
107 	 *
108 	 * This is normally used by code generated by
109 	 * [glib-compile-resources][glib-compile-resources]
110 	 * and is not typically used by other code.
111 	 *
112 	 * Since: 2.32
113 	 */
114 	public void init()
115 	{
116 		g_static_resource_init(gStaticResource);
117 	}
118 }