source: appstream-generator/build/girepo/gio/Emblem.d @ 4841

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

Initial release

File size: 3.5 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 gio.Emblem;
22
23private import gi.gio;
24public  import gi.giotypes;
25private import gio.Icon;
26private import gio.IconIF;
27private import gio.IconT;
28private import glib.ConstructionException;
29private import gobject.ObjectG;
30
31
32/**
33 * #GEmblem is an implementation of #GIcon that supports
34 * having an emblem, which is an icon with additional properties.
35 * It can than be added to a #GEmblemedIcon.
36 *
37 * Currently, only metainformation about the emblem's origin is
38 * supported. More may be added in the future.
39 */
40public class Emblem : ObjectG, IconIF
41{
42        /** the main Gtk struct */
43        protected GEmblem* gEmblem;
44
45        /** Get the main Gtk struct */
46        public GEmblem* getEmblemStruct()
47        {
48                return gEmblem;
49        }
50
51        /** the main Gtk struct as a void* */
52        protected override void* getStruct()
53        {
54                return cast(void*)gEmblem;
55        }
56
57        protected override void setStruct(GObject* obj)
58        {
59                gEmblem = cast(GEmblem*)obj;
60                super.setStruct(obj);
61        }
62
63        /**
64         * Sets our main struct and passes it to the parent class.
65         */
66        public this (GEmblem* gEmblem, bool ownedRef = false)
67        {
68                this.gEmblem = gEmblem;
69                super(cast(GObject*)gEmblem, ownedRef);
70        }
71
72        // add the Icon capabilities
73        mixin IconT!(GEmblem);
74
75
76        /** */
77        public static GType getType()
78        {
79                return g_emblem_get_type();
80        }
81
82        /**
83         * Creates a new emblem for @icon.
84         *
85         * Params:
86         *     icon = a GIcon containing the icon.
87         *
88         * Returns: a new #GEmblem.
89         *
90         * Since: 2.18
91         *
92         * Throws: ConstructionException GTK+ fails to create the object.
93         */
94        public this(IconIF icon)
95        {
96                auto p = g_emblem_new((icon is null) ? null : icon.getIconStruct());
97               
98                if(p is null)
99                {
100                        throw new ConstructionException("null returned by new");
101                }
102               
103                this(cast(GEmblem*) p, true);
104        }
105
106        /**
107         * Creates a new emblem for @icon.
108         *
109         * Params:
110         *     icon = a GIcon containing the icon.
111         *     origin = a GEmblemOrigin enum defining the emblem's origin
112         *
113         * Returns: a new #GEmblem.
114         *
115         * Since: 2.18
116         *
117         * Throws: ConstructionException GTK+ fails to create the object.
118         */
119        public this(IconIF icon, GEmblemOrigin origin)
120        {
121                auto p = g_emblem_new_with_origin((icon is null) ? null : icon.getIconStruct(), origin);
122               
123                if(p is null)
124                {
125                        throw new ConstructionException("null returned by new_with_origin");
126                }
127               
128                this(cast(GEmblem*) p, true);
129        }
130
131        /**
132         * Gives back the icon from @emblem.
133         *
134         * Returns: a #GIcon. The returned object belongs to
135         *     the emblem and should not be modified or freed.
136         *
137         * Since: 2.18
138         */
139        public IconIF getIcon()
140        {
141                auto p = g_emblem_get_icon(gEmblem);
142               
143                if(p is null)
144                {
145                        return null;
146                }
147               
148                return ObjectG.getDObject!(Icon, IconIF)(cast(GIcon*) p);
149        }
150
151        /**
152         * Gets the origin of the emblem.
153         *
154         * Returns: the origin of the emblem
155         *
156         * Since: 2.18
157         */
158        public GEmblemOrigin getOrigin()
159        {
160                return g_emblem_get_origin(gEmblem);
161        }
162}
Note: See TracBrowser for help on using the repository browser.