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 = GtkNumerableIcon.html 27 * outPack = gtk 28 * outFile = NumerableIcon 29 * strct = GtkNumerableIcon 30 * realStrct= 31 * ctorStrct= 32 * clss = NumerableIcon 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = GioEmblemedIcon 38 * implements: 39 * prefixes: 40 * - gtk_numerable_icon_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - glib.Str 47 * - gio.EmblemedIcon : GioEmblemedIcon = EmblemedIcon 48 * - gio.Icon 49 * - gio.IconIF 50 * - gtk.StyleContext 51 * structWrap: 52 * - GIcon* -> IconIF 53 * - GtkStyleContext* -> StyleContext 54 * module aliases: 55 * local aliases: 56 * overrides: 57 */ 58 59 module gtk.NumerableIcon; 60 61 public import gtkc.gtktypes; 62 63 private import gtkc.gtk; 64 private import glib.ConstructionException; 65 private import gobject.ObjectG; 66 67 private import glib.Str; 68 private import gio.EmblemedIcon : GioEmblemedIcon = EmblemedIcon; 69 private import gio.Icon; 70 private import gio.IconIF; 71 private import gtk.StyleContext; 72 73 74 75 /** 76 * GtkNumerableIcon is a subclass of GEmblemedIcon that can 77 * show a number or short string as an emblem. The number can 78 * be overlayed on top of another emblem, if desired. 79 * 80 * It supports theming by taking font and color information 81 * from a provided GtkStyleContext; see 82 * gtk_numerable_icon_set_style_context(). 83 * 84 * $(DDOC_COMMENT example) 85 */ 86 public class NumerableIcon : GioEmblemedIcon 87 { 88 89 /** the main Gtk struct */ 90 protected GtkNumerableIcon* gtkNumerableIcon; 91 92 93 /** Get the main Gtk struct */ 94 public GtkNumerableIcon* getNumerableIconStruct() 95 { 96 return gtkNumerableIcon; 97 } 98 99 100 /** the main Gtk struct as a void* */ 101 protected override void* getStruct() 102 { 103 return cast(void*)gtkNumerableIcon; 104 } 105 106 /** 107 * Sets our main struct and passes it to the parent class 108 */ 109 public this (GtkNumerableIcon* gtkNumerableIcon) 110 { 111 super(cast(GEmblemedIcon*)gtkNumerableIcon); 112 this.gtkNumerableIcon = gtkNumerableIcon; 113 } 114 115 protected override void setStruct(GObject* obj) 116 { 117 super.setStruct(obj); 118 gtkNumerableIcon = cast(GtkNumerableIcon*)obj; 119 } 120 121 /** 122 */ 123 124 /** 125 * Creates a new unthemed GtkNumerableIcon. 126 * Params: 127 * baseIcon = a GIcon to overlay on 128 * Returns: a new GIcon. [transfer full] Since 3.0 129 */ 130 public static IconIF newNumerableIcon(IconIF baseIcon) 131 { 132 // GIcon * gtk_numerable_icon_new (GIcon *base_icon); 133 auto p = gtk_numerable_icon_new((baseIcon is null) ? null : baseIcon.getIconTStruct()); 134 135 if(p is null) 136 { 137 return null; 138 } 139 140 return ObjectG.getDObject!(Icon, IconIF)(cast(GIcon*) p); 141 } 142 143 /** 144 * Creates a new GtkNumerableIcon which will themed according 145 * to the passed GtkStyleContext. This is a convenience constructor 146 * that calls gtk_numerable_icon_set_style_context() internally. 147 * Params: 148 * baseIcon = a GIcon to overlay on 149 * context = a GtkStyleContext 150 * Returns: a new GIcon. [transfer full] Since 3.0 151 */ 152 public static IconIF newWithStyleContext(IconIF baseIcon, StyleContext context) 153 { 154 // GIcon * gtk_numerable_icon_new_with_style_context (GIcon *base_icon, GtkStyleContext *context); 155 auto p = gtk_numerable_icon_new_with_style_context((baseIcon is null) ? null : baseIcon.getIconTStruct(), (context is null) ? null : context.getStyleContextStruct()); 156 157 if(p is null) 158 { 159 return null; 160 } 161 162 return ObjectG.getDObject!(Icon, IconIF)(cast(GIcon*) p); 163 } 164 165 /** 166 * Returns the GIcon that was set as the base background image, or 167 * NULL if there's none. The caller of this function does not own 168 * a reference to the returned GIcon. 169 * Returns: a GIcon, or NULL. [transfer none] Since 3.0 170 */ 171 public IconIF getBackgroundGicon() 172 { 173 // GIcon * gtk_numerable_icon_get_background_gicon (GtkNumerableIcon *self); 174 auto p = gtk_numerable_icon_get_background_gicon(gtkNumerableIcon); 175 176 if(p is null) 177 { 178 return null; 179 } 180 181 return ObjectG.getDObject!(Icon, IconIF)(cast(GIcon*) p); 182 } 183 184 /** 185 * Updates the icon to use icon as the base background image. 186 * If icon is NULL, self will go back using style information 187 * or default theming for its background image. 188 * If this method is called and an icon name was already set as 189 * background for the icon, icon will be used, i.e. the last method 190 * called between gtk_numerable_icon_set_background_gicon() and 191 * gtk_numerable_icon_set_background_icon_name() has always priority. 192 * Params: 193 * icon = a GIcon, or NULL. [allow-none] 194 * Since 3.0 195 */ 196 public void setBackgroundGicon(IconIF icon) 197 { 198 // void gtk_numerable_icon_set_background_gicon (GtkNumerableIcon *self, GIcon *icon); 199 gtk_numerable_icon_set_background_gicon(gtkNumerableIcon, (icon is null) ? null : icon.getIconTStruct()); 200 } 201 202 /** 203 * Returns the icon name used as the base background image, 204 * or NULL if there's none. 205 * Returns: an icon name, or NULL Since 3.0 206 */ 207 public string getBackgroundIconName() 208 { 209 // const gchar * gtk_numerable_icon_get_background_icon_name (GtkNumerableIcon *self); 210 return Str.toString(gtk_numerable_icon_get_background_icon_name(gtkNumerableIcon)); 211 } 212 213 /** 214 * Updates the icon to use the icon named icon_name from the 215 * current icon theme as the base background image. If icon_name 216 * is NULL, self will go back using style information or default 217 * theming for its background image. 218 * If this method is called and a GIcon was already set as 219 * background for the icon, icon_name will be used, i.e. the 220 * last method called between gtk_numerable_icon_set_background_icon_name() 221 * and gtk_numerable_icon_set_background_gicon() has always priority. 222 * Params: 223 * iconName = an icon name, or NULL. [allow-none] 224 * Since 3.0 225 */ 226 public void setBackgroundIconName(string iconName) 227 { 228 // void gtk_numerable_icon_set_background_icon_name (GtkNumerableIcon *self, const gchar *icon_name); 229 gtk_numerable_icon_set_background_icon_name(gtkNumerableIcon, Str.toStringz(iconName)); 230 } 231 232 /** 233 * Returns the value currently displayed by self. 234 * Returns: the currently displayed value Since 3.0 235 */ 236 public int getCount() 237 { 238 // gint gtk_numerable_icon_get_count (GtkNumerableIcon *self); 239 return gtk_numerable_icon_get_count(gtkNumerableIcon); 240 } 241 242 /** 243 * Sets the currently displayed value of self to count. 244 * The numeric value is always clamped to make it two digits, i.e. 245 * between -99 and 99. Setting a count of zero removes the emblem. 246 * If this method is called, and a label was already set on the icon, 247 * it will automatically be reset to NULL before rendering the number, 248 * i.e. the last method called between gtk_numerable_icon_set_count() 249 * and gtk_numerable_icon_set_label() has always priority. 250 * Params: 251 * count = a number between -99 and 99 252 * Since 3.0 253 */ 254 public void setCount(int count) 255 { 256 // void gtk_numerable_icon_set_count (GtkNumerableIcon *self, gint count); 257 gtk_numerable_icon_set_count(gtkNumerableIcon, count); 258 } 259 260 /** 261 * Returns the currently displayed label of the icon, or NULL. 262 * Returns: the currently displayed label Since 3.0 263 */ 264 public string getLabel() 265 { 266 // const gchar * gtk_numerable_icon_get_label (GtkNumerableIcon *self); 267 return Str.toString(gtk_numerable_icon_get_label(gtkNumerableIcon)); 268 } 269 270 /** 271 * Sets the currently displayed value of self to the string 272 * in label. Setting an empty label removes the emblem. 273 * Note that this is meant for displaying short labels, such as 274 * roman numbers, or single letters. For roman numbers, consider 275 * using the Unicode characters U+2160 - U+217F. Strings longer 276 * than two characters will likely not be rendered very well. 277 * If this method is called, and a number was already set on the 278 * icon, it will automatically be reset to zero before rendering 279 * the label, i.e. the last method called between 280 * gtk_numerable_icon_set_label() and gtk_numerable_icon_set_count() 281 * has always priority. 282 * Params: 283 * label = a short label, or NULL. [allow-none] 284 * Since 3.0 285 */ 286 public void setLabel(string label) 287 { 288 // void gtk_numerable_icon_set_label (GtkNumerableIcon *self, const gchar *label); 289 gtk_numerable_icon_set_label(gtkNumerableIcon, Str.toStringz(label)); 290 } 291 292 /** 293 * Returns the GtkStyleContext used by the icon for theming, 294 * or NULL if there's none. 295 * Returns: a GtkStyleContext, or NULL. This object is internal to GTK+ and should not be unreffed. Use g_object_ref() if you want to keep it around. [transfer none] Since 3.0 296 */ 297 public StyleContext getStyleContext() 298 { 299 // GtkStyleContext * gtk_numerable_icon_get_style_context (GtkNumerableIcon *self); 300 auto p = gtk_numerable_icon_get_style_context(gtkNumerableIcon); 301 302 if(p is null) 303 { 304 return null; 305 } 306 307 return ObjectG.getDObject!(StyleContext)(cast(GtkStyleContext*) p); 308 } 309 310 /** 311 * Updates the icon to fetch theme information from the 312 * given GtkStyleContext. 313 * Params: 314 * style = a GtkStyleContext 315 * Since 3.0 316 */ 317 public void setStyleContext(StyleContext style) 318 { 319 // void gtk_numerable_icon_set_style_context (GtkNumerableIcon *self, GtkStyleContext *style); 320 gtk_numerable_icon_set_style_context(gtkNumerableIcon, (style is null) ? null : style.getStyleContextStruct()); 321 } 322 }