1 /** 2 Control that provides a list of selectable items (and/or icons) in a single column, or optionally in multiple columns. 3 4 Copyright: 5 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. 6 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) 7 Copyright (c) 2017-2018 Godot-D contributors 8 9 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License) 10 11 12 */ 13 module godot.itemlist; 14 import std.meta : AliasSeq, staticIndexOf; 15 import std.traits : Unqual; 16 import godot.d.traits; 17 import godot.core; 18 import godot.c; 19 import godot.d.bind; 20 import godot.d.reference; 21 import godot.globalenums; 22 import godot.object; 23 import godot.classdb; 24 import godot.control; 25 import godot.canvasitem; 26 import godot.node; 27 import godot.inputevent; 28 import godot.texture; 29 import godot.vscrollbar; 30 /** 31 Control that provides a list of selectable items (and/or icons) in a single column, or optionally in multiple columns. 32 33 This control provides a selectable list of items that may be in a single (or multiple columns) with option of text, icons, or both text and icon. Tooltips are supported and may be different for every item in the list. 34 Selectable items in the list may be selected or deselected and multiple selection may be enabled. Selection with right mouse button may also be enabled to allow use of popup context menus. Items may also be "activated" by double-clicking them or by pressing Enter. 35 Item text only supports single-line strings, newline characters (e.g. `\n`) in the string won't produce a newline. Text wrapping is enabled in $(D constant ICON_MODE_TOP) mode, but column's width is adjusted to fully fit its content by default. You need to set $(D fixedColumnWidth) greater than zero to wrap the text. 36 */ 37 @GodotBaseClass struct ItemList 38 { 39 package(godot) enum string _GODOT_internal_name = "ItemList"; 40 public: 41 @nogc nothrow: 42 union { /** */ godot_object _godot_object; /** */ Control _GODOT_base; } 43 alias _GODOT_base this; 44 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 45 package(godot) __gshared bool _classBindingInitialized = false; 46 package(godot) static struct GDNativeClassBinding 47 { 48 __gshared: 49 @GodotName("_get_items") GodotMethod!(Array) _getItems; 50 @GodotName("_gui_input") GodotMethod!(void, InputEvent) _guiInput; 51 @GodotName("_scroll_changed") GodotMethod!(void, double) _scrollChanged; 52 @GodotName("_set_items") GodotMethod!(void, Array) _setItems; 53 @GodotName("add_icon_item") GodotMethod!(void, Texture, bool) addIconItem; 54 @GodotName("add_item") GodotMethod!(void, String, Texture, bool) addItem; 55 @GodotName("clear") GodotMethod!(void) clear; 56 @GodotName("ensure_current_is_visible") GodotMethod!(void) ensureCurrentIsVisible; 57 @GodotName("get_allow_reselect") GodotMethod!(bool) getAllowReselect; 58 @GodotName("get_allow_rmb_select") GodotMethod!(bool) getAllowRmbSelect; 59 @GodotName("get_fixed_column_width") GodotMethod!(long) getFixedColumnWidth; 60 @GodotName("get_fixed_icon_size") GodotMethod!(Vector2) getFixedIconSize; 61 @GodotName("get_icon_mode") GodotMethod!(ItemList.IconMode) getIconMode; 62 @GodotName("get_icon_scale") GodotMethod!(double) getIconScale; 63 @GodotName("get_item_at_position") GodotMethod!(long, Vector2, bool) getItemAtPosition; 64 @GodotName("get_item_count") GodotMethod!(long) getItemCount; 65 @GodotName("get_item_custom_bg_color") GodotMethod!(Color, long) getItemCustomBgColor; 66 @GodotName("get_item_custom_fg_color") GodotMethod!(Color, long) getItemCustomFgColor; 67 @GodotName("get_item_icon") GodotMethod!(Texture, long) getItemIcon; 68 @GodotName("get_item_icon_modulate") GodotMethod!(Color, long) getItemIconModulate; 69 @GodotName("get_item_icon_region") GodotMethod!(Rect2, long) getItemIconRegion; 70 @GodotName("get_item_metadata") GodotMethod!(Variant, long) getItemMetadata; 71 @GodotName("get_item_text") GodotMethod!(String, long) getItemText; 72 @GodotName("get_item_tooltip") GodotMethod!(String, long) getItemTooltip; 73 @GodotName("get_max_columns") GodotMethod!(long) getMaxColumns; 74 @GodotName("get_max_text_lines") GodotMethod!(long) getMaxTextLines; 75 @GodotName("get_select_mode") GodotMethod!(ItemList.SelectMode) getSelectMode; 76 @GodotName("get_selected_items") GodotMethod!(PoolIntArray) getSelectedItems; 77 @GodotName("get_v_scroll") GodotMethod!(VScrollBar) getVScroll; 78 @GodotName("has_auto_height") GodotMethod!(bool) hasAutoHeight; 79 @GodotName("is_anything_selected") GodotMethod!(bool) isAnythingSelected; 80 @GodotName("is_item_disabled") GodotMethod!(bool, long) isItemDisabled; 81 @GodotName("is_item_icon_transposed") GodotMethod!(bool, long) isItemIconTransposed; 82 @GodotName("is_item_selectable") GodotMethod!(bool, long) isItemSelectable; 83 @GodotName("is_item_tooltip_enabled") GodotMethod!(bool, long) isItemTooltipEnabled; 84 @GodotName("is_same_column_width") GodotMethod!(bool) isSameColumnWidth; 85 @GodotName("is_selected") GodotMethod!(bool, long) isSelected; 86 @GodotName("move_item") GodotMethod!(void, long, long) moveItem; 87 @GodotName("remove_item") GodotMethod!(void, long) removeItem; 88 @GodotName("select") GodotMethod!(void, long, bool) select; 89 @GodotName("set_allow_reselect") GodotMethod!(void, bool) setAllowReselect; 90 @GodotName("set_allow_rmb_select") GodotMethod!(void, bool) setAllowRmbSelect; 91 @GodotName("set_auto_height") GodotMethod!(void, bool) setAutoHeight; 92 @GodotName("set_fixed_column_width") GodotMethod!(void, long) setFixedColumnWidth; 93 @GodotName("set_fixed_icon_size") GodotMethod!(void, Vector2) setFixedIconSize; 94 @GodotName("set_icon_mode") GodotMethod!(void, long) setIconMode; 95 @GodotName("set_icon_scale") GodotMethod!(void, double) setIconScale; 96 @GodotName("set_item_custom_bg_color") GodotMethod!(void, long, Color) setItemCustomBgColor; 97 @GodotName("set_item_custom_fg_color") GodotMethod!(void, long, Color) setItemCustomFgColor; 98 @GodotName("set_item_disabled") GodotMethod!(void, long, bool) setItemDisabled; 99 @GodotName("set_item_icon") GodotMethod!(void, long, Texture) setItemIcon; 100 @GodotName("set_item_icon_modulate") GodotMethod!(void, long, Color) setItemIconModulate; 101 @GodotName("set_item_icon_region") GodotMethod!(void, long, Rect2) setItemIconRegion; 102 @GodotName("set_item_icon_transposed") GodotMethod!(void, long, bool) setItemIconTransposed; 103 @GodotName("set_item_metadata") GodotMethod!(void, long, Variant) setItemMetadata; 104 @GodotName("set_item_selectable") GodotMethod!(void, long, bool) setItemSelectable; 105 @GodotName("set_item_text") GodotMethod!(void, long, String) setItemText; 106 @GodotName("set_item_tooltip") GodotMethod!(void, long, String) setItemTooltip; 107 @GodotName("set_item_tooltip_enabled") GodotMethod!(void, long, bool) setItemTooltipEnabled; 108 @GodotName("set_max_columns") GodotMethod!(void, long) setMaxColumns; 109 @GodotName("set_max_text_lines") GodotMethod!(void, long) setMaxTextLines; 110 @GodotName("set_same_column_width") GodotMethod!(void, bool) setSameColumnWidth; 111 @GodotName("set_select_mode") GodotMethod!(void, long) setSelectMode; 112 @GodotName("sort_items_by_text") GodotMethod!(void) sortItemsByText; 113 @GodotName("unselect") GodotMethod!(void, long) unselect; 114 @GodotName("unselect_all") GodotMethod!(void) unselectAll; 115 } 116 /// 117 pragma(inline, true) bool opEquals(in ItemList other) const 118 { return _godot_object.ptr is other._godot_object.ptr; } 119 /// 120 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 121 { _godot_object.ptr = n; return null; } 122 /// 123 pragma(inline, true) bool opEquals(typeof(null) n) const 124 { return _godot_object.ptr is n; } 125 /// 126 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 127 mixin baseCasts; 128 /// Construct a new instance of ItemList. 129 /// Note: use `memnew!ItemList` instead. 130 static ItemList _new() 131 { 132 static godot_class_constructor constructor; 133 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("ItemList"); 134 if(constructor is null) return typeof(this).init; 135 return cast(ItemList)(constructor()); 136 } 137 @disable new(size_t s); 138 /// 139 enum SelectMode : int 140 { 141 /** 142 Only allow selecting a single item. 143 */ 144 selectSingle = 0, 145 /** 146 Allows selecting multiple items by holding Ctrl or Shift. 147 */ 148 selectMulti = 1, 149 } 150 /// 151 enum IconMode : int 152 { 153 /** 154 Icon is drawn above the text. 155 */ 156 iconModeTop = 0, 157 /** 158 Icon is drawn to the left of the text. 159 */ 160 iconModeLeft = 1, 161 } 162 /// 163 enum Constants : int 164 { 165 selectSingle = 0, 166 iconModeTop = 0, 167 iconModeLeft = 1, 168 selectMulti = 1, 169 } 170 /** 171 172 */ 173 Array _getItems() const 174 { 175 Array _GODOT_args = Array.make(); 176 String _GODOT_method_name = String("_get_items"); 177 return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!Array); 178 } 179 /** 180 181 */ 182 void _guiInput(InputEvent arg0) 183 { 184 Array _GODOT_args = Array.make(); 185 _GODOT_args.append(arg0); 186 String _GODOT_method_name = String("_gui_input"); 187 this.callv(_GODOT_method_name, _GODOT_args); 188 } 189 /** 190 191 */ 192 void _scrollChanged(in double arg0) 193 { 194 Array _GODOT_args = Array.make(); 195 _GODOT_args.append(arg0); 196 String _GODOT_method_name = String("_scroll_changed"); 197 this.callv(_GODOT_method_name, _GODOT_args); 198 } 199 /** 200 201 */ 202 void _setItems(in Array arg0) 203 { 204 Array _GODOT_args = Array.make(); 205 _GODOT_args.append(arg0); 206 String _GODOT_method_name = String("_set_items"); 207 this.callv(_GODOT_method_name, _GODOT_args); 208 } 209 /** 210 Adds an item to the item list with no text, only an icon. 211 */ 212 void addIconItem(Texture icon, in bool selectable = true) 213 { 214 checkClassBinding!(typeof(this))(); 215 ptrcall!(void)(GDNativeClassBinding.addIconItem, _godot_object, icon, selectable); 216 } 217 /** 218 Adds an item to the item list with specified text. Specify an `icon`, or use `null` as the `icon` for a list item with no icon. 219 If selectable is `true`, the list item will be selectable. 220 */ 221 void addItem(in String text, Texture icon = Texture.init, in bool selectable = true) 222 { 223 checkClassBinding!(typeof(this))(); 224 ptrcall!(void)(GDNativeClassBinding.addItem, _godot_object, text, icon, selectable); 225 } 226 /** 227 Removes all items from the list. 228 */ 229 void clear() 230 { 231 checkClassBinding!(typeof(this))(); 232 ptrcall!(void)(GDNativeClassBinding.clear, _godot_object); 233 } 234 /** 235 Ensure current selection is visible, adjusting the scroll position as necessary. 236 */ 237 void ensureCurrentIsVisible() 238 { 239 checkClassBinding!(typeof(this))(); 240 ptrcall!(void)(GDNativeClassBinding.ensureCurrentIsVisible, _godot_object); 241 } 242 /** 243 244 */ 245 bool getAllowReselect() const 246 { 247 checkClassBinding!(typeof(this))(); 248 return ptrcall!(bool)(GDNativeClassBinding.getAllowReselect, _godot_object); 249 } 250 /** 251 252 */ 253 bool getAllowRmbSelect() const 254 { 255 checkClassBinding!(typeof(this))(); 256 return ptrcall!(bool)(GDNativeClassBinding.getAllowRmbSelect, _godot_object); 257 } 258 /** 259 260 */ 261 long getFixedColumnWidth() const 262 { 263 checkClassBinding!(typeof(this))(); 264 return ptrcall!(long)(GDNativeClassBinding.getFixedColumnWidth, _godot_object); 265 } 266 /** 267 268 */ 269 Vector2 getFixedIconSize() const 270 { 271 checkClassBinding!(typeof(this))(); 272 return ptrcall!(Vector2)(GDNativeClassBinding.getFixedIconSize, _godot_object); 273 } 274 /** 275 276 */ 277 ItemList.IconMode getIconMode() const 278 { 279 checkClassBinding!(typeof(this))(); 280 return ptrcall!(ItemList.IconMode)(GDNativeClassBinding.getIconMode, _godot_object); 281 } 282 /** 283 284 */ 285 double getIconScale() const 286 { 287 checkClassBinding!(typeof(this))(); 288 return ptrcall!(double)(GDNativeClassBinding.getIconScale, _godot_object); 289 } 290 /** 291 Returns the item index at the given `position`. 292 When there is no item at that point, -1 will be returned if `exact` is `true`, and the closest item index will be returned otherwise. 293 */ 294 long getItemAtPosition(in Vector2 position, in bool exact = false) const 295 { 296 checkClassBinding!(typeof(this))(); 297 return ptrcall!(long)(GDNativeClassBinding.getItemAtPosition, _godot_object, position, exact); 298 } 299 /** 300 Returns the number of items currently in the list. 301 */ 302 long getItemCount() const 303 { 304 checkClassBinding!(typeof(this))(); 305 return ptrcall!(long)(GDNativeClassBinding.getItemCount, _godot_object); 306 } 307 /** 308 Returns the custom background color of the item specified by `idx` index. 309 */ 310 Color getItemCustomBgColor(in long idx) const 311 { 312 checkClassBinding!(typeof(this))(); 313 return ptrcall!(Color)(GDNativeClassBinding.getItemCustomBgColor, _godot_object, idx); 314 } 315 /** 316 Returns the custom foreground color of the item specified by `idx` index. 317 */ 318 Color getItemCustomFgColor(in long idx) const 319 { 320 checkClassBinding!(typeof(this))(); 321 return ptrcall!(Color)(GDNativeClassBinding.getItemCustomFgColor, _godot_object, idx); 322 } 323 /** 324 Returns the icon associated with the specified index. 325 */ 326 Ref!Texture getItemIcon(in long idx) const 327 { 328 checkClassBinding!(typeof(this))(); 329 return ptrcall!(Texture)(GDNativeClassBinding.getItemIcon, _godot_object, idx); 330 } 331 /** 332 Returns a $(D Color) modulating item's icon at the specified index. 333 */ 334 Color getItemIconModulate(in long idx) const 335 { 336 checkClassBinding!(typeof(this))(); 337 return ptrcall!(Color)(GDNativeClassBinding.getItemIconModulate, _godot_object, idx); 338 } 339 /** 340 Returns the region of item's icon used. The whole icon will be used if the region has no area. 341 */ 342 Rect2 getItemIconRegion(in long idx) const 343 { 344 checkClassBinding!(typeof(this))(); 345 return ptrcall!(Rect2)(GDNativeClassBinding.getItemIconRegion, _godot_object, idx); 346 } 347 /** 348 Returns the metadata value of the specified index. 349 */ 350 Variant getItemMetadata(in long idx) const 351 { 352 checkClassBinding!(typeof(this))(); 353 return ptrcall!(Variant)(GDNativeClassBinding.getItemMetadata, _godot_object, idx); 354 } 355 /** 356 Returns the text associated with the specified index. 357 */ 358 String getItemText(in long idx) const 359 { 360 checkClassBinding!(typeof(this))(); 361 return ptrcall!(String)(GDNativeClassBinding.getItemText, _godot_object, idx); 362 } 363 /** 364 Returns the tooltip hint associated with the specified index. 365 */ 366 String getItemTooltip(in long idx) const 367 { 368 checkClassBinding!(typeof(this))(); 369 return ptrcall!(String)(GDNativeClassBinding.getItemTooltip, _godot_object, idx); 370 } 371 /** 372 373 */ 374 long getMaxColumns() const 375 { 376 checkClassBinding!(typeof(this))(); 377 return ptrcall!(long)(GDNativeClassBinding.getMaxColumns, _godot_object); 378 } 379 /** 380 381 */ 382 long getMaxTextLines() const 383 { 384 checkClassBinding!(typeof(this))(); 385 return ptrcall!(long)(GDNativeClassBinding.getMaxTextLines, _godot_object); 386 } 387 /** 388 389 */ 390 ItemList.SelectMode getSelectMode() const 391 { 392 checkClassBinding!(typeof(this))(); 393 return ptrcall!(ItemList.SelectMode)(GDNativeClassBinding.getSelectMode, _godot_object); 394 } 395 /** 396 Returns an array with the indexes of the selected items. 397 */ 398 PoolIntArray getSelectedItems() 399 { 400 checkClassBinding!(typeof(this))(); 401 return ptrcall!(PoolIntArray)(GDNativeClassBinding.getSelectedItems, _godot_object); 402 } 403 /** 404 Returns the $(D GodotObject) ID associated with the list. 405 */ 406 VScrollBar getVScroll() 407 { 408 checkClassBinding!(typeof(this))(); 409 return ptrcall!(VScrollBar)(GDNativeClassBinding.getVScroll, _godot_object); 410 } 411 /** 412 413 */ 414 bool hasAutoHeight() const 415 { 416 checkClassBinding!(typeof(this))(); 417 return ptrcall!(bool)(GDNativeClassBinding.hasAutoHeight, _godot_object); 418 } 419 /** 420 Returns `true` if one or more items are selected. 421 */ 422 bool isAnythingSelected() 423 { 424 checkClassBinding!(typeof(this))(); 425 return ptrcall!(bool)(GDNativeClassBinding.isAnythingSelected, _godot_object); 426 } 427 /** 428 Returns `true` if the item at the specified index is disabled. 429 */ 430 bool isItemDisabled(in long idx) const 431 { 432 checkClassBinding!(typeof(this))(); 433 return ptrcall!(bool)(GDNativeClassBinding.isItemDisabled, _godot_object, idx); 434 } 435 /** 436 Returns `true` if the item icon will be drawn transposed, i.e. the X and Y axes are swapped. 437 */ 438 bool isItemIconTransposed(in long idx) const 439 { 440 checkClassBinding!(typeof(this))(); 441 return ptrcall!(bool)(GDNativeClassBinding.isItemIconTransposed, _godot_object, idx); 442 } 443 /** 444 Returns `true` if the item at the specified index is selectable. 445 */ 446 bool isItemSelectable(in long idx) const 447 { 448 checkClassBinding!(typeof(this))(); 449 return ptrcall!(bool)(GDNativeClassBinding.isItemSelectable, _godot_object, idx); 450 } 451 /** 452 Returns `true` if the tooltip is enabled for specified item index. 453 */ 454 bool isItemTooltipEnabled(in long idx) const 455 { 456 checkClassBinding!(typeof(this))(); 457 return ptrcall!(bool)(GDNativeClassBinding.isItemTooltipEnabled, _godot_object, idx); 458 } 459 /** 460 461 */ 462 bool isSameColumnWidth() const 463 { 464 checkClassBinding!(typeof(this))(); 465 return ptrcall!(bool)(GDNativeClassBinding.isSameColumnWidth, _godot_object); 466 } 467 /** 468 Returns `true` if the item at the specified index is currently selected. 469 */ 470 bool isSelected(in long idx) const 471 { 472 checkClassBinding!(typeof(this))(); 473 return ptrcall!(bool)(GDNativeClassBinding.isSelected, _godot_object, idx); 474 } 475 /** 476 Moves item from index `from_idx` to `to_idx`. 477 */ 478 void moveItem(in long from_idx, in long to_idx) 479 { 480 checkClassBinding!(typeof(this))(); 481 ptrcall!(void)(GDNativeClassBinding.moveItem, _godot_object, from_idx, to_idx); 482 } 483 /** 484 Removes the item specified by `idx` index from the list. 485 */ 486 void removeItem(in long idx) 487 { 488 checkClassBinding!(typeof(this))(); 489 ptrcall!(void)(GDNativeClassBinding.removeItem, _godot_object, idx); 490 } 491 /** 492 Select the item at the specified index. 493 $(B Note:) This method does not trigger the item selection signal. 494 */ 495 void select(in long idx, in bool single = true) 496 { 497 checkClassBinding!(typeof(this))(); 498 ptrcall!(void)(GDNativeClassBinding.select, _godot_object, idx, single); 499 } 500 /** 501 502 */ 503 void setAllowReselect(in bool allow) 504 { 505 checkClassBinding!(typeof(this))(); 506 ptrcall!(void)(GDNativeClassBinding.setAllowReselect, _godot_object, allow); 507 } 508 /** 509 510 */ 511 void setAllowRmbSelect(in bool allow) 512 { 513 checkClassBinding!(typeof(this))(); 514 ptrcall!(void)(GDNativeClassBinding.setAllowRmbSelect, _godot_object, allow); 515 } 516 /** 517 518 */ 519 void setAutoHeight(in bool enable) 520 { 521 checkClassBinding!(typeof(this))(); 522 ptrcall!(void)(GDNativeClassBinding.setAutoHeight, _godot_object, enable); 523 } 524 /** 525 526 */ 527 void setFixedColumnWidth(in long width) 528 { 529 checkClassBinding!(typeof(this))(); 530 ptrcall!(void)(GDNativeClassBinding.setFixedColumnWidth, _godot_object, width); 531 } 532 /** 533 534 */ 535 void setFixedIconSize(in Vector2 size) 536 { 537 checkClassBinding!(typeof(this))(); 538 ptrcall!(void)(GDNativeClassBinding.setFixedIconSize, _godot_object, size); 539 } 540 /** 541 542 */ 543 void setIconMode(in long mode) 544 { 545 checkClassBinding!(typeof(this))(); 546 ptrcall!(void)(GDNativeClassBinding.setIconMode, _godot_object, mode); 547 } 548 /** 549 550 */ 551 void setIconScale(in double scale) 552 { 553 checkClassBinding!(typeof(this))(); 554 ptrcall!(void)(GDNativeClassBinding.setIconScale, _godot_object, scale); 555 } 556 /** 557 Sets the background color of the item specified by `idx` index to the specified $(D Color). 558 */ 559 void setItemCustomBgColor(in long idx, in Color custom_bg_color) 560 { 561 checkClassBinding!(typeof(this))(); 562 ptrcall!(void)(GDNativeClassBinding.setItemCustomBgColor, _godot_object, idx, custom_bg_color); 563 } 564 /** 565 Sets the foreground color of the item specified by `idx` index to the specified $(D Color). 566 */ 567 void setItemCustomFgColor(in long idx, in Color custom_fg_color) 568 { 569 checkClassBinding!(typeof(this))(); 570 ptrcall!(void)(GDNativeClassBinding.setItemCustomFgColor, _godot_object, idx, custom_fg_color); 571 } 572 /** 573 Disables (or enables) the item at the specified index. 574 Disabled items cannot be selected and do not trigger activation signals (when double-clicking or pressing Enter). 575 */ 576 void setItemDisabled(in long idx, in bool disabled) 577 { 578 checkClassBinding!(typeof(this))(); 579 ptrcall!(void)(GDNativeClassBinding.setItemDisabled, _godot_object, idx, disabled); 580 } 581 /** 582 Sets (or replaces) the icon's $(D Texture) associated with the specified index. 583 */ 584 void setItemIcon(in long idx, Texture icon) 585 { 586 checkClassBinding!(typeof(this))(); 587 ptrcall!(void)(GDNativeClassBinding.setItemIcon, _godot_object, idx, icon); 588 } 589 /** 590 Sets a modulating $(D Color) of the item associated with the specified index. 591 */ 592 void setItemIconModulate(in long idx, in Color modulate) 593 { 594 checkClassBinding!(typeof(this))(); 595 ptrcall!(void)(GDNativeClassBinding.setItemIconModulate, _godot_object, idx, modulate); 596 } 597 /** 598 Sets the region of item's icon used. The whole icon will be used if the region has no area. 599 */ 600 void setItemIconRegion(in long idx, in Rect2 rect) 601 { 602 checkClassBinding!(typeof(this))(); 603 ptrcall!(void)(GDNativeClassBinding.setItemIconRegion, _godot_object, idx, rect); 604 } 605 /** 606 Sets whether the item icon will be drawn transposed. 607 */ 608 void setItemIconTransposed(in long idx, in bool transposed) 609 { 610 checkClassBinding!(typeof(this))(); 611 ptrcall!(void)(GDNativeClassBinding.setItemIconTransposed, _godot_object, idx, transposed); 612 } 613 /** 614 Sets a value (of any type) to be stored with the item associated with the specified index. 615 */ 616 void setItemMetadata(VariantArg1)(in long idx, in VariantArg1 metadata) 617 { 618 checkClassBinding!(typeof(this))(); 619 ptrcall!(void)(GDNativeClassBinding.setItemMetadata, _godot_object, idx, metadata); 620 } 621 /** 622 Allows or disallows selection of the item associated with the specified index. 623 */ 624 void setItemSelectable(in long idx, in bool selectable) 625 { 626 checkClassBinding!(typeof(this))(); 627 ptrcall!(void)(GDNativeClassBinding.setItemSelectable, _godot_object, idx, selectable); 628 } 629 /** 630 Sets text of the item associated with the specified index. 631 */ 632 void setItemText(in long idx, in String text) 633 { 634 checkClassBinding!(typeof(this))(); 635 ptrcall!(void)(GDNativeClassBinding.setItemText, _godot_object, idx, text); 636 } 637 /** 638 Sets the tooltip hint for the item associated with the specified index. 639 */ 640 void setItemTooltip(in long idx, in String tooltip) 641 { 642 checkClassBinding!(typeof(this))(); 643 ptrcall!(void)(GDNativeClassBinding.setItemTooltip, _godot_object, idx, tooltip); 644 } 645 /** 646 Sets whether the tooltip hint is enabled for specified item index. 647 */ 648 void setItemTooltipEnabled(in long idx, in bool enable) 649 { 650 checkClassBinding!(typeof(this))(); 651 ptrcall!(void)(GDNativeClassBinding.setItemTooltipEnabled, _godot_object, idx, enable); 652 } 653 /** 654 655 */ 656 void setMaxColumns(in long amount) 657 { 658 checkClassBinding!(typeof(this))(); 659 ptrcall!(void)(GDNativeClassBinding.setMaxColumns, _godot_object, amount); 660 } 661 /** 662 663 */ 664 void setMaxTextLines(in long lines) 665 { 666 checkClassBinding!(typeof(this))(); 667 ptrcall!(void)(GDNativeClassBinding.setMaxTextLines, _godot_object, lines); 668 } 669 /** 670 671 */ 672 void setSameColumnWidth(in bool enable) 673 { 674 checkClassBinding!(typeof(this))(); 675 ptrcall!(void)(GDNativeClassBinding.setSameColumnWidth, _godot_object, enable); 676 } 677 /** 678 679 */ 680 void setSelectMode(in long mode) 681 { 682 checkClassBinding!(typeof(this))(); 683 ptrcall!(void)(GDNativeClassBinding.setSelectMode, _godot_object, mode); 684 } 685 /** 686 Sorts items in the list by their text. 687 */ 688 void sortItemsByText() 689 { 690 checkClassBinding!(typeof(this))(); 691 ptrcall!(void)(GDNativeClassBinding.sortItemsByText, _godot_object); 692 } 693 /** 694 Ensures the item associated with the specified index is not selected. 695 */ 696 void unselect(in long idx) 697 { 698 checkClassBinding!(typeof(this))(); 699 ptrcall!(void)(GDNativeClassBinding.unselect, _godot_object, idx); 700 } 701 /** 702 Ensures there are no items selected. 703 */ 704 void unselectAll() 705 { 706 checkClassBinding!(typeof(this))(); 707 ptrcall!(void)(GDNativeClassBinding.unselectAll, _godot_object); 708 } 709 /** 710 If `true`, the currently selected item can be selected again. 711 */ 712 @property bool allowReselect() 713 { 714 return getAllowReselect(); 715 } 716 /// ditto 717 @property void allowReselect(bool v) 718 { 719 setAllowReselect(v); 720 } 721 /** 722 If `true`, right mouse button click can select items. 723 */ 724 @property bool allowRmbSelect() 725 { 726 return getAllowRmbSelect(); 727 } 728 /// ditto 729 @property void allowRmbSelect(bool v) 730 { 731 setAllowRmbSelect(v); 732 } 733 /** 734 If `true`, the control will automatically resize the height to fit its content. 735 */ 736 @property bool autoHeight() 737 { 738 return hasAutoHeight(); 739 } 740 /// ditto 741 @property void autoHeight(bool v) 742 { 743 setAutoHeight(v); 744 } 745 /** 746 The width all columns will be adjusted to. 747 A value of zero disables the adjustment, each item will have a width equal to the width of its content and the columns will have an uneven width. 748 */ 749 @property long fixedColumnWidth() 750 { 751 return getFixedColumnWidth(); 752 } 753 /// ditto 754 @property void fixedColumnWidth(long v) 755 { 756 setFixedColumnWidth(v); 757 } 758 /** 759 The size all icons will be adjusted to. 760 If either X or Y component is not greater than zero, icon size won't be affected. 761 */ 762 @property Vector2 fixedIconSize() 763 { 764 return getFixedIconSize(); 765 } 766 /// ditto 767 @property void fixedIconSize(Vector2 v) 768 { 769 setFixedIconSize(v); 770 } 771 /** 772 The icon position, whether above or to the left of the text. See the $(D iconmode) constants. 773 */ 774 @property ItemList.IconMode iconMode() 775 { 776 return getIconMode(); 777 } 778 /// ditto 779 @property void iconMode(long v) 780 { 781 setIconMode(v); 782 } 783 /** 784 The scale of icon applied after $(D fixedIconSize) and transposing takes effect. 785 */ 786 @property double iconScale() 787 { 788 return getIconScale(); 789 } 790 /// ditto 791 @property void iconScale(double v) 792 { 793 setIconScale(v); 794 } 795 /** 796 797 */ 798 @property Array items() 799 { 800 return _getItems(); 801 } 802 /// ditto 803 @property void items(Array v) 804 { 805 _setItems(v); 806 } 807 /** 808 Maximum columns the list will have. 809 If greater than zero, the content will be split among the specified columns. 810 A value of zero means unlimited columns, i.e. all items will be put in the same row. 811 */ 812 @property long maxColumns() 813 { 814 return getMaxColumns(); 815 } 816 /// ditto 817 @property void maxColumns(long v) 818 { 819 setMaxColumns(v); 820 } 821 /** 822 Maximum lines of text allowed in each item. Space will be reserved even when there is not enough lines of text to display. 823 $(B Note:) This property takes effect only when $(D iconMode) is $(D constant ICON_MODE_TOP). To make the text wrap, $(D fixedColumnWidth) should be greater than zero. 824 */ 825 @property long maxTextLines() 826 { 827 return getMaxTextLines(); 828 } 829 /// ditto 830 @property void maxTextLines(long v) 831 { 832 setMaxTextLines(v); 833 } 834 /** 835 Whether all columns will have the same width. 836 If `true`, the width is equal to the largest column width of all columns. 837 */ 838 @property bool sameColumnWidth() 839 { 840 return isSameColumnWidth(); 841 } 842 /// ditto 843 @property void sameColumnWidth(bool v) 844 { 845 setSameColumnWidth(v); 846 } 847 /** 848 Allows single or multiple item selection. See the $(D selectmode) constants. 849 */ 850 @property ItemList.SelectMode selectMode() 851 { 852 return getSelectMode(); 853 } 854 /// ditto 855 @property void selectMode(long v) 856 { 857 setSelectMode(v); 858 } 859 }