| 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 |
* Conversion parameters: |
|---|
| 26 |
* inFile = GEmblem.html |
|---|
| 27 |
* outPack = gio |
|---|
| 28 |
* outFile = Emblem |
|---|
| 29 |
* strct = GEmblem |
|---|
| 30 |
* realStrct= |
|---|
| 31 |
* ctorStrct= |
|---|
| 32 |
* clss = Emblem |
|---|
| 33 |
* interf = |
|---|
| 34 |
* class Code: Yes |
|---|
| 35 |
* interface Code: No |
|---|
| 36 |
* template for: |
|---|
| 37 |
* extend = |
|---|
| 38 |
* implements: |
|---|
| 39 |
* - IconIF |
|---|
| 40 |
* prefixes: |
|---|
| 41 |
* - g_emblem_ |
|---|
| 42 |
* omit structs: |
|---|
| 43 |
* omit prefixes: |
|---|
| 44 |
* omit code: |
|---|
| 45 |
* omit signals: |
|---|
| 46 |
* imports: |
|---|
| 47 |
* - gio.Icon |
|---|
| 48 |
* - gio.IconIF |
|---|
| 49 |
* - gio.IconT |
|---|
| 50 |
* structWrap: |
|---|
| 51 |
* - GIcon* -> IconIF |
|---|
| 52 |
* module aliases: |
|---|
| 53 |
* local aliases: |
|---|
| 54 |
* overrides: |
|---|
| 55 |
*/ |
|---|
| 56 |
|
|---|
| 57 |
module gio.Emblem; |
|---|
| 58 |
|
|---|
| 59 |
public import gtkc.giotypes; |
|---|
| 60 |
|
|---|
| 61 |
private import gtkc.gio; |
|---|
| 62 |
private import glib.ConstructionException; |
|---|
| 63 |
|
|---|
| 64 |
|
|---|
| 65 |
private import gio.Icon; |
|---|
| 66 |
private import gio.IconIF; |
|---|
| 67 |
private import gio.IconT; |
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 |
private import gobject.ObjectG; |
|---|
| 72 |
|
|---|
| 73 |
/** |
|---|
| 74 |
* Description |
|---|
| 75 |
* GEmblem is an implementation of GIcon that supports |
|---|
| 76 |
* having an emblem, which is an icon with additional properties. |
|---|
| 77 |
* It can than be added to a GEmblemedIcon. |
|---|
| 78 |
* Currently, only metainformation about the emblem's origin is |
|---|
| 79 |
* supported. More may be added in the future. |
|---|
| 80 |
*/ |
|---|
| 81 |
public class Emblem : ObjectG, IconIF |
|---|
| 82 |
{ |
|---|
| 83 |
|
|---|
| 84 |
/** the main Gtk struct */ |
|---|
| 85 |
protected GEmblem* gEmblem; |
|---|
| 86 |
|
|---|
| 87 |
|
|---|
| 88 |
public GEmblem* getEmblemStruct() |
|---|
| 89 |
{ |
|---|
| 90 |
return gEmblem; |
|---|
| 91 |
} |
|---|
| 92 |
|
|---|
| 93 |
|
|---|
| 94 |
/** the main Gtk struct as a void* */ |
|---|
| 95 |
protected override void* getStruct() |
|---|
| 96 |
{ |
|---|
| 97 |
return cast(void*)gEmblem; |
|---|
| 98 |
} |
|---|
| 99 |
|
|---|
| 100 |
/** |
|---|
| 101 |
* Sets our main struct and passes it to the parent class |
|---|
| 102 |
*/ |
|---|
| 103 |
public this (GEmblem* gEmblem) |
|---|
| 104 |
{ |
|---|
| 105 |
if(gEmblem is null) |
|---|
| 106 |
{ |
|---|
| 107 |
this = null; |
|---|
| 108 |
return; |
|---|
| 109 |
} |
|---|
| 110 |
//Check if there already is a D object for this gtk struct |
|---|
| 111 |
void* ptr = getDObject(cast(GObject*)gEmblem); |
|---|
| 112 |
if( ptr !is null ) |
|---|
| 113 |
{ |
|---|
| 114 |
this = cast(Emblem)ptr; |
|---|
| 115 |
return; |
|---|
| 116 |
} |
|---|
| 117 |
super(cast(GObject*)gEmblem); |
|---|
| 118 |
this.gEmblem = gEmblem; |
|---|
| 119 |
} |
|---|
| 120 |
|
|---|
| 121 |
protected override void setStruct(GObject* obj) |
|---|
| 122 |
{ |
|---|
| 123 |
super.setStruct(obj); |
|---|
| 124 |
gEmblem = cast(GEmblem*)obj; |
|---|
| 125 |
} |
|---|
| 126 |
|
|---|
| 127 |
// add the Icon capabilities |
|---|
| 128 |
mixin IconT!(GEmblem); |
|---|
| 129 |
|
|---|
| 130 |
/** |
|---|
| 131 |
*/ |
|---|
| 132 |
|
|---|
| 133 |
/** |
|---|
| 134 |
* Creates a new emblem for icon. |
|---|
| 135 |
* Since 2.18 |
|---|
| 136 |
* Params: |
|---|
| 137 |
* icon = a GIcon containing the icon. |
|---|
| 138 |
* Throws: ConstructionException GTK+ fails to create the object. |
|---|
| 139 |
*/ |
|---|
| 140 |
public this (IconIF icon) |
|---|
| 141 |
{ |
|---|
| 142 |
// GEmblem * g_emblem_new (GIcon *icon); |
|---|
| 143 |
auto p = g_emblem_new((icon is null) ? null : icon.getIconTStruct()); |
|---|
| 144 |
if(p is null) |
|---|
| 145 |
{ |
|---|
| 146 |
throw new ConstructionException("null returned by g_emblem_new((icon is null) ? null : icon.getIconTStruct())"); |
|---|
| 147 |
} |
|---|
| 148 |
this(cast(GEmblem*) p); |
|---|
| 149 |
} |
|---|
| 150 |
|
|---|
| 151 |
/** |
|---|
| 152 |
* Creates a new emblem for icon. |
|---|
| 153 |
* Since 2.18 |
|---|
| 154 |
* Params: |
|---|
| 155 |
* icon = a GIcon containing the icon. |
|---|
| 156 |
* origin = a GEmblemOrigin enum defining the emblem's origin |
|---|
| 157 |
* Throws: ConstructionException GTK+ fails to create the object. |
|---|
| 158 |
*/ |
|---|
| 159 |
public this (IconIF icon, GEmblemOrigin origin) |
|---|
| 160 |
{ |
|---|
| 161 |
// GEmblem * g_emblem_new_with_origin (GIcon *icon, GEmblemOrigin origin); |
|---|
| 162 |
auto p = g_emblem_new_with_origin((icon is null) ? null : icon.getIconTStruct(), origin); |
|---|
| 163 |
if(p is null) |
|---|
| 164 |
{ |
|---|
| 165 |
throw new ConstructionException("null returned by g_emblem_new_with_origin((icon is null) ? null : icon.getIconTStruct(), origin)"); |
|---|
| 166 |
} |
|---|
| 167 |
this(cast(GEmblem*) p); |
|---|
| 168 |
} |
|---|
| 169 |
|
|---|
| 170 |
/** |
|---|
| 171 |
* Gives back the icon from emblem. |
|---|
| 172 |
* Since 2.18 |
|---|
| 173 |
* Returns: a GIcon. The returned object belongs to the emblem and should not be modified or freed. [transfer none] |
|---|
| 174 |
*/ |
|---|
| 175 |
public IconIF getIcon() |
|---|
| 176 |
{ |
|---|
| 177 |
// GIcon * g_emblem_get_icon (GEmblem *emblem); |
|---|
| 178 |
auto p = g_emblem_get_icon(gEmblem); |
|---|
| 179 |
if(p is null) |
|---|
| 180 |
{ |
|---|
| 181 |
return null; |
|---|
| 182 |
} |
|---|
| 183 |
return new Icon(cast(GIcon*) p); |
|---|
| 184 |
} |
|---|
| 185 |
|
|---|
| 186 |
/** |
|---|
| 187 |
* Gets the origin of the emblem. |
|---|
| 188 |
* Since 2.18 |
|---|
| 189 |
* Returns: the origin of the emblem. [transfer none] |
|---|
| 190 |
*/ |
|---|
| 191 |
public GEmblemOrigin getOrigin() |
|---|
| 192 |
{ |
|---|
| 193 |
// GEmblemOrigin g_emblem_get_origin (GEmblem *emblem); |
|---|
| 194 |
return g_emblem_get_origin(gEmblem); |
|---|
| 195 |
} |
|---|
| 196 |
} |
|---|