source: appstream-generator/build/girepo/gobject/TypeInterface.d @ 4841

Last change on this file since 4841 was 4841, checked in by Juanma, 2 years ago

Initial release

File size: 4.9 KB
Line 
1/*
2 * Licensed under the GNU Lesser General Public License Version 3
3 *
4 * This library is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the license, or
7 * (at your option) any later version.
8 *
9 * This software is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
16 */
17
18// generated automatically - do not change
19
20
21module gobject.TypeInterface;
22
23private import gi.gobject;
24public  import gi.gobjecttypes;
25private import gobject.ObjectG;
26private import gobject.TypeClass;
27private import gobject.TypePlugin;
28private import gobject.TypePluginIF;
29
30
31/**
32 * An opaque structure used as the base of all interface types.
33 */
34public class TypeInterface
35{
36        /** the main Gtk struct */
37        protected GTypeInterface* gTypeInterface;
38        protected bool ownedRef;
39
40        /** Get the main Gtk struct */
41        public GTypeInterface* getTypeInterfaceStruct()
42        {
43                return gTypeInterface;
44        }
45
46        /** the main Gtk struct as a void* */
47        protected void* getStruct()
48        {
49                return cast(void*)gTypeInterface;
50        }
51
52        /**
53         * Sets our main struct and passes it to the parent class.
54         */
55        public this (GTypeInterface* gTypeInterface, bool ownedRef = false)
56        {
57                this.gTypeInterface = gTypeInterface;
58                this.ownedRef = ownedRef;
59        }
60
61
62        /**
63         * Returns the corresponding #GTypeInterface structure of the parent type
64         * of the instance type to which @g_iface belongs. This is useful when
65         * deriving the implementation of an interface from the parent type and
66         * then possibly overriding some methods.
67         *
68         * Returns: the
69         *     corresponding #GTypeInterface structure of the parent type of the
70         *     instance type to which @g_iface belongs, or %NULL if the parent
71         *     type doesn't conform to the interface
72         */
73        public TypeInterface peekParent()
74        {
75                auto p = g_type_interface_peek_parent(gTypeInterface);
76               
77                if(p is null)
78                {
79                        return null;
80                }
81               
82                return ObjectG.getDObject!(TypeInterface)(cast(GTypeInterface*) p);
83        }
84
85        /**
86         * Adds @prerequisite_type to the list of prerequisites of @interface_type.
87         * This means that any type implementing @interface_type must also implement
88         * @prerequisite_type. Prerequisites can be thought of as an alternative to
89         * interface derivation (which GType doesn't support). An interface can have
90         * at most one instantiatable prerequisite type.
91         *
92         * Params:
93         *     interfaceType = #GType value of an interface type
94         *     prerequisiteType = #GType value of an interface or instantiatable type
95         */
96        public static void addPrerequisite(GType interfaceType, GType prerequisiteType)
97        {
98                g_type_interface_add_prerequisite(interfaceType, prerequisiteType);
99        }
100
101        /**
102         * Returns the #GTypePlugin structure for the dynamic interface
103         * @interface_type which has been added to @instance_type, or %NULL
104         * if @interface_type has not been added to @instance_type or does
105         * not have a #GTypePlugin structure. See g_type_add_interface_dynamic().
106         *
107         * Params:
108         *     instanceType = #GType of an instantiatable type
109         *     interfaceType = #GType of an interface type
110         *
111         * Returns: the #GTypePlugin for the dynamic
112         *     interface @interface_type of @instance_type
113         */
114        public static TypePluginIF getPlugin(GType instanceType, GType interfaceType)
115        {
116                auto p = g_type_interface_get_plugin(instanceType, interfaceType);
117               
118                if(p is null)
119                {
120                        return null;
121                }
122               
123                return ObjectG.getDObject!(TypePlugin, TypePluginIF)(cast(GTypePlugin*) p);
124        }
125
126        /**
127         * Returns the #GTypeInterface structure of an interface to which the
128         * passed in class conforms.
129         *
130         * Params:
131         *     instanceClass = a #GTypeClass structure
132         *     ifaceType = an interface ID which this class conforms to
133         *
134         * Returns: the #GTypeInterface
135         *     structure of @iface_type if implemented by @instance_class, %NULL
136         *     otherwise
137         */
138        public static TypeInterface peek(TypeClass instanceClass, GType ifaceType)
139        {
140                auto p = g_type_interface_peek((instanceClass is null) ? null : instanceClass.getTypeClassStruct(), ifaceType);
141               
142                if(p is null)
143                {
144                        return null;
145                }
146               
147                return ObjectG.getDObject!(TypeInterface)(cast(GTypeInterface*) p);
148        }
149
150        /**
151         * Returns the prerequisites of an interfaces type.
152         *
153         * Params:
154         *     interfaceType = an interface type
155         *
156         * Returns: a
157         *     newly-allocated zero-terminated array of #GType containing
158         *     the prerequisites of @interface_type
159         *
160         * Since: 2.2
161         */
162        public static GType[] prerequisites(GType interfaceType)
163        {
164                uint nPrerequisites;
165               
166                auto p = g_type_interface_prerequisites(interfaceType, &nPrerequisites);
167               
168                return p[0 .. nPrerequisites];
169        }
170}
Note: See TracBrowser for help on using the repository browser.