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