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