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