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 gtk.ToolItemGroup; 26 27 private import glib.ConstructionException; 28 private import glib.Str; 29 private import gobject.ObjectG; 30 private import gtk.Container; 31 private import gtk.ToolItem; 32 private import gtk.ToolShellIF; 33 private import gtk.ToolShellT; 34 private import gtk.Widget; 35 private import gtk.c.functions; 36 public import gtk.c.types; 37 public import gtkc.gtktypes; 38 39 40 /** 41 * A #GtkToolItemGroup is used together with #GtkToolPalette to add 42 * #GtkToolItems to a palette like container with different 43 * categories and drag and drop support. 44 * 45 * # CSS nodes 46 * 47 * GtkToolItemGroup has a single CSS node named toolitemgroup. 48 */ 49 public class ToolItemGroup : Container, ToolShellIF 50 { 51 /** the main Gtk struct */ 52 protected GtkToolItemGroup* gtkToolItemGroup; 53 54 /** Get the main Gtk struct */ 55 public GtkToolItemGroup* getToolItemGroupStruct(bool transferOwnership = false) 56 { 57 if (transferOwnership) 58 ownedRef = false; 59 return gtkToolItemGroup; 60 } 61 62 /** the main Gtk struct as a void* */ 63 protected override void* getStruct() 64 { 65 return cast(void*)gtkToolItemGroup; 66 } 67 68 /** 69 * Sets our main struct and passes it to the parent class. 70 */ 71 public this (GtkToolItemGroup* gtkToolItemGroup, bool ownedRef = false) 72 { 73 this.gtkToolItemGroup = gtkToolItemGroup; 74 super(cast(GtkContainer*)gtkToolItemGroup, ownedRef); 75 } 76 77 // add the ToolShell capabilities 78 mixin ToolShellT!(GtkToolItemGroup); 79 80 /** 81 * Retrieves the current orientation for the tool shell. Tool items must not 82 * call this function directly, but rely on gtk_tool_item_get_orientation() 83 * instead. 84 * Since 2.14 85 * Returns: the current orientation of shell 86 */ 87 public GtkOrientation getOrientation() 88 { 89 return gtk_tool_shell_get_orientation(getToolShellStruct()); 90 } 91 92 /** 93 */ 94 95 /** */ 96 public static GType getType() 97 { 98 return gtk_tool_item_group_get_type(); 99 } 100 101 /** 102 * Creates a new tool item group with label @label. 103 * 104 * Params: 105 * label = the label of the new group 106 * 107 * Returns: a new #GtkToolItemGroup. 108 * 109 * Since: 2.20 110 * 111 * Throws: ConstructionException GTK+ fails to create the object. 112 */ 113 public this(string label) 114 { 115 auto p = gtk_tool_item_group_new(Str.toStringz(label)); 116 117 if(p is null) 118 { 119 throw new ConstructionException("null returned by new"); 120 } 121 122 this(cast(GtkToolItemGroup*) p); 123 } 124 125 /** 126 * Gets whether @group is collapsed or expanded. 127 * 128 * Returns: %TRUE if @group is collapsed, %FALSE if it is expanded 129 * 130 * Since: 2.20 131 */ 132 public bool getCollapsed() 133 { 134 return gtk_tool_item_group_get_collapsed(gtkToolItemGroup) != 0; 135 } 136 137 /** 138 * Gets the tool item at position (x, y). 139 * 140 * Params: 141 * x = the x position 142 * y = the y position 143 * 144 * Returns: the #GtkToolItem at position (x, y) 145 * 146 * Since: 2.20 147 */ 148 public ToolItem getDropItem(int x, int y) 149 { 150 auto p = gtk_tool_item_group_get_drop_item(gtkToolItemGroup, x, y); 151 152 if(p is null) 153 { 154 return null; 155 } 156 157 return ObjectG.getDObject!(ToolItem)(cast(GtkToolItem*) p); 158 } 159 160 /** 161 * Gets the ellipsization mode of @group. 162 * 163 * Returns: the #PangoEllipsizeMode of @group 164 * 165 * Since: 2.20 166 */ 167 public PangoEllipsizeMode getEllipsize() 168 { 169 return gtk_tool_item_group_get_ellipsize(gtkToolItemGroup); 170 } 171 172 /** 173 * Gets the relief mode of the header button of @group. 174 * 175 * Returns: the #GtkReliefStyle 176 * 177 * Since: 2.20 178 */ 179 public GtkReliefStyle getHeaderRelief() 180 { 181 return gtk_tool_item_group_get_header_relief(gtkToolItemGroup); 182 } 183 184 /** 185 * Gets the position of @item in @group as index. 186 * 187 * Params: 188 * item = a #GtkToolItem 189 * 190 * Returns: the index of @item in @group or -1 if @item is no child of @group 191 * 192 * Since: 2.20 193 */ 194 public int getItemPosition(ToolItem item) 195 { 196 return gtk_tool_item_group_get_item_position(gtkToolItemGroup, (item is null) ? null : item.getToolItemStruct()); 197 } 198 199 /** 200 * Gets the label of @group. 201 * 202 * Returns: the label of @group. The label is an internal string of @group 203 * and must not be modified. Note that %NULL is returned if a custom 204 * label has been set with gtk_tool_item_group_set_label_widget() 205 * 206 * Since: 2.20 207 */ 208 public string getLabel() 209 { 210 return Str.toString(gtk_tool_item_group_get_label(gtkToolItemGroup)); 211 } 212 213 /** 214 * Gets the label widget of @group. 215 * See gtk_tool_item_group_set_label_widget(). 216 * 217 * Returns: the label widget of @group 218 * 219 * Since: 2.20 220 */ 221 public Widget getLabelWidget() 222 { 223 auto p = gtk_tool_item_group_get_label_widget(gtkToolItemGroup); 224 225 if(p is null) 226 { 227 return null; 228 } 229 230 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 231 } 232 233 /** 234 * Gets the number of tool items in @group. 235 * 236 * Returns: the number of tool items in @group 237 * 238 * Since: 2.20 239 */ 240 public uint getNItems() 241 { 242 return gtk_tool_item_group_get_n_items(gtkToolItemGroup); 243 } 244 245 /** 246 * Gets the tool item at @index in group. 247 * 248 * Params: 249 * index = the index 250 * 251 * Returns: the #GtkToolItem at index 252 * 253 * Since: 2.20 254 */ 255 public ToolItem getNthItem(uint index) 256 { 257 auto p = gtk_tool_item_group_get_nth_item(gtkToolItemGroup, index); 258 259 if(p is null) 260 { 261 return null; 262 } 263 264 return ObjectG.getDObject!(ToolItem)(cast(GtkToolItem*) p); 265 } 266 267 /** 268 * Inserts @item at @position in the list of children of @group. 269 * 270 * Params: 271 * item = the #GtkToolItem to insert into @group 272 * position = the position of @item in @group, starting with 0. 273 * The position -1 means end of list. 274 * 275 * Since: 2.20 276 */ 277 public void insert(ToolItem item, int position) 278 { 279 gtk_tool_item_group_insert(gtkToolItemGroup, (item is null) ? null : item.getToolItemStruct(), position); 280 } 281 282 /** 283 * Sets whether the @group should be collapsed or expanded. 284 * 285 * Params: 286 * collapsed = whether the @group should be collapsed or expanded 287 * 288 * Since: 2.20 289 */ 290 public void setCollapsed(bool collapsed) 291 { 292 gtk_tool_item_group_set_collapsed(gtkToolItemGroup, collapsed); 293 } 294 295 /** 296 * Sets the ellipsization mode which should be used by labels in @group. 297 * 298 * Params: 299 * ellipsize = the #PangoEllipsizeMode labels in @group should use 300 * 301 * Since: 2.20 302 */ 303 public void setEllipsize(PangoEllipsizeMode ellipsize) 304 { 305 gtk_tool_item_group_set_ellipsize(gtkToolItemGroup, ellipsize); 306 } 307 308 /** 309 * Set the button relief of the group header. 310 * See gtk_button_set_relief() for details. 311 * 312 * Params: 313 * style = the #GtkReliefStyle 314 * 315 * Since: 2.20 316 */ 317 public void setHeaderRelief(GtkReliefStyle style) 318 { 319 gtk_tool_item_group_set_header_relief(gtkToolItemGroup, style); 320 } 321 322 /** 323 * Sets the position of @item in the list of children of @group. 324 * 325 * Params: 326 * item = the #GtkToolItem to move to a new position, should 327 * be a child of @group. 328 * position = the new position of @item in @group, starting with 0. 329 * The position -1 means end of list. 330 * 331 * Since: 2.20 332 */ 333 public void setItemPosition(ToolItem item, int position) 334 { 335 gtk_tool_item_group_set_item_position(gtkToolItemGroup, (item is null) ? null : item.getToolItemStruct(), position); 336 } 337 338 /** 339 * Sets the label of the tool item group. The label is displayed in the header 340 * of the group. 341 * 342 * Params: 343 * label = the new human-readable label of of the group 344 * 345 * Since: 2.20 346 */ 347 public void setLabel(string label) 348 { 349 gtk_tool_item_group_set_label(gtkToolItemGroup, Str.toStringz(label)); 350 } 351 352 /** 353 * Sets the label of the tool item group. 354 * The label widget is displayed in the header of the group, in place 355 * of the usual label. 356 * 357 * Params: 358 * labelWidget = the widget to be displayed in place of the usual label 359 * 360 * Since: 2.20 361 */ 362 public void setLabelWidget(Widget labelWidget) 363 { 364 gtk_tool_item_group_set_label_widget(gtkToolItemGroup, (labelWidget is null) ? null : labelWidget.getWidgetStruct()); 365 } 366 }