1 /** 2 Control for a single item inside a $(D Tree). 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.treeitem; 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.texture; 24 /** 25 Control for a single item inside a $(D Tree). 26 27 May have child $(D TreeItem)s and be styled as well as contain buttons. 28 You can remove a $(D TreeItem) by using $(D GodotObject.free). 29 */ 30 @GodotBaseClass struct TreeItem 31 { 32 package(godot) enum string _GODOT_internal_name = "TreeItem"; 33 public: 34 @nogc nothrow: 35 union { /** */ godot_object _godot_object; /** */ GodotObject _GODOT_base; } 36 alias _GODOT_base this; 37 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 38 package(godot) __gshared bool _classBindingInitialized = false; 39 package(godot) static struct GDNativeClassBinding 40 { 41 __gshared: 42 @GodotName("add_button") GodotMethod!(void, long, Texture, long, bool, String) addButton; 43 @GodotName("call_recursive") GodotMethod!(Variant, String, GodotVarArgs) callRecursive; 44 @GodotName("clear_custom_bg_color") GodotMethod!(void, long) clearCustomBgColor; 45 @GodotName("clear_custom_color") GodotMethod!(void, long) clearCustomColor; 46 @GodotName("deselect") GodotMethod!(void, long) deselect; 47 @GodotName("erase_button") GodotMethod!(void, long, long) eraseButton; 48 @GodotName("get_button") GodotMethod!(Texture, long, long) getButton; 49 @GodotName("get_button_count") GodotMethod!(long, long) getButtonCount; 50 @GodotName("get_button_tooltip") GodotMethod!(String, long, long) getButtonTooltip; 51 @GodotName("get_cell_mode") GodotMethod!(TreeItem.TreeCellMode, long) getCellMode; 52 @GodotName("get_children") GodotMethod!(TreeItem) getChildren; 53 @GodotName("get_custom_bg_color") GodotMethod!(Color, long) getCustomBgColor; 54 @GodotName("get_custom_color") GodotMethod!(Color, long) getCustomColor; 55 @GodotName("get_custom_minimum_height") GodotMethod!(long) getCustomMinimumHeight; 56 @GodotName("get_expand_right") GodotMethod!(bool, long) getExpandRight; 57 @GodotName("get_icon") GodotMethod!(Texture, long) getIcon; 58 @GodotName("get_icon_max_width") GodotMethod!(long, long) getIconMaxWidth; 59 @GodotName("get_icon_modulate") GodotMethod!(Color, long) getIconModulate; 60 @GodotName("get_icon_region") GodotMethod!(Rect2, long) getIconRegion; 61 @GodotName("get_metadata") GodotMethod!(Variant, long) getMetadata; 62 @GodotName("get_next") GodotMethod!(TreeItem) getNext; 63 @GodotName("get_next_visible") GodotMethod!(TreeItem, bool) getNextVisible; 64 @GodotName("get_parent") GodotMethod!(TreeItem) getParent; 65 @GodotName("get_prev") GodotMethod!(TreeItem) getPrev; 66 @GodotName("get_prev_visible") GodotMethod!(TreeItem, bool) getPrevVisible; 67 @GodotName("get_range") GodotMethod!(double, long) getRange; 68 @GodotName("get_range_config") GodotMethod!(Dictionary, long) getRangeConfig; 69 @GodotName("get_suffix") GodotMethod!(String, long) getSuffix; 70 @GodotName("get_text") GodotMethod!(String, long) getText; 71 @GodotName("get_text_align") GodotMethod!(TreeItem.TextAlign, long) getTextAlign; 72 @GodotName("get_tooltip") GodotMethod!(String, long) getTooltip; 73 @GodotName("is_button_disabled") GodotMethod!(bool, long, long) isButtonDisabled; 74 @GodotName("is_checked") GodotMethod!(bool, long) isChecked; 75 @GodotName("is_collapsed") GodotMethod!(bool) isCollapsed; 76 @GodotName("is_custom_set_as_button") GodotMethod!(bool, long) isCustomSetAsButton; 77 @GodotName("is_editable") GodotMethod!(bool, long) isEditable; 78 @GodotName("is_folding_disabled") GodotMethod!(bool) isFoldingDisabled; 79 @GodotName("is_selectable") GodotMethod!(bool, long) isSelectable; 80 @GodotName("is_selected") GodotMethod!(bool, long) isSelected; 81 @GodotName("move_to_bottom") GodotMethod!(void) moveToBottom; 82 @GodotName("move_to_top") GodotMethod!(void) moveToTop; 83 @GodotName("remove_child") GodotMethod!(void, GodotObject) removeChild; 84 @GodotName("select") GodotMethod!(void, long) select; 85 @GodotName("set_button") GodotMethod!(void, long, long, Texture) setButton; 86 @GodotName("set_button_disabled") GodotMethod!(void, long, long, bool) setButtonDisabled; 87 @GodotName("set_cell_mode") GodotMethod!(void, long, long) setCellMode; 88 @GodotName("set_checked") GodotMethod!(void, long, bool) setChecked; 89 @GodotName("set_collapsed") GodotMethod!(void, bool) setCollapsed; 90 @GodotName("set_custom_as_button") GodotMethod!(void, long, bool) setCustomAsButton; 91 @GodotName("set_custom_bg_color") GodotMethod!(void, long, Color, bool) setCustomBgColor; 92 @GodotName("set_custom_color") GodotMethod!(void, long, Color) setCustomColor; 93 @GodotName("set_custom_draw") GodotMethod!(void, long, GodotObject, String) setCustomDraw; 94 @GodotName("set_custom_minimum_height") GodotMethod!(void, long) setCustomMinimumHeight; 95 @GodotName("set_disable_folding") GodotMethod!(void, bool) setDisableFolding; 96 @GodotName("set_editable") GodotMethod!(void, long, bool) setEditable; 97 @GodotName("set_expand_right") GodotMethod!(void, long, bool) setExpandRight; 98 @GodotName("set_icon") GodotMethod!(void, long, Texture) setIcon; 99 @GodotName("set_icon_max_width") GodotMethod!(void, long, long) setIconMaxWidth; 100 @GodotName("set_icon_modulate") GodotMethod!(void, long, Color) setIconModulate; 101 @GodotName("set_icon_region") GodotMethod!(void, long, Rect2) setIconRegion; 102 @GodotName("set_metadata") GodotMethod!(void, long, Variant) setMetadata; 103 @GodotName("set_range") GodotMethod!(void, long, double) setRange; 104 @GodotName("set_range_config") GodotMethod!(void, long, double, double, double, bool) setRangeConfig; 105 @GodotName("set_selectable") GodotMethod!(void, long, bool) setSelectable; 106 @GodotName("set_suffix") GodotMethod!(void, long, String) setSuffix; 107 @GodotName("set_text") GodotMethod!(void, long, String) setText; 108 @GodotName("set_text_align") GodotMethod!(void, long, long) setTextAlign; 109 @GodotName("set_tooltip") GodotMethod!(void, long, String) setTooltip; 110 } 111 /// 112 pragma(inline, true) bool opEquals(in TreeItem other) const 113 { return _godot_object.ptr is other._godot_object.ptr; } 114 /// 115 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 116 { _godot_object.ptr = n; return null; } 117 /// 118 pragma(inline, true) bool opEquals(typeof(null) n) const 119 { return _godot_object.ptr is n; } 120 /// 121 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 122 mixin baseCasts; 123 /// Construct a new instance of TreeItem. 124 /// Note: use `memnew!TreeItem` instead. 125 static TreeItem _new() 126 { 127 static godot_class_constructor constructor; 128 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("TreeItem"); 129 if(constructor is null) return typeof(this).init; 130 return cast(TreeItem)(constructor()); 131 } 132 @disable new(size_t s); 133 /// 134 enum TreeCellMode : int 135 { 136 /** 137 Cell contains a string. 138 */ 139 cellModeString = 0, 140 /** 141 Cell contains a checkbox. 142 */ 143 cellModeCheck = 1, 144 /** 145 Cell contains a range. 146 */ 147 cellModeRange = 2, 148 /** 149 Cell contains an icon. 150 */ 151 cellModeIcon = 3, 152 /** 153 154 */ 155 cellModeCustom = 4, 156 } 157 /// 158 enum TextAlign : int 159 { 160 /** 161 Align text to the left. See `set_text_align()`. 162 */ 163 alignLeft = 0, 164 /** 165 Center text. See `set_text_align()`. 166 */ 167 alignCenter = 1, 168 /** 169 Align text to the right. See `set_text_align()`. 170 */ 171 alignRight = 2, 172 } 173 /// 174 enum Constants : int 175 { 176 alignLeft = 0, 177 cellModeString = 0, 178 alignCenter = 1, 179 cellModeCheck = 1, 180 alignRight = 2, 181 cellModeRange = 2, 182 cellModeIcon = 3, 183 cellModeCustom = 4, 184 } 185 /** 186 Adds a button with $(D Texture) `button` at column `column`. The `button_idx` index is used to identify the button when calling other methods. If not specified, the next available index is used, which may be retrieved by calling $(D getButtonCount) immediately after this method. Optionally, the button can be `disabled` and have a `tooltip`. 187 */ 188 void addButton(in long column, Texture button, in long button_idx = -1, in bool disabled = false, in String tooltip = gs!"") 189 { 190 checkClassBinding!(typeof(this))(); 191 ptrcall!(void)(GDNativeClassBinding.addButton, _godot_object, column, button, button_idx, disabled, tooltip); 192 } 193 /** 194 Calls the `method` on the actual TreeItem and its children recursively. Pass parameters as a comma separated list. 195 */ 196 Variant callRecursive(VarArgs...)(in String method, VarArgs varArgs) 197 { 198 Array _GODOT_args = Array.make(); 199 _GODOT_args.append(method); 200 foreach(vai, VA; VarArgs) 201 { 202 _GODOT_args.append(varArgs[vai]); 203 } 204 String _GODOT_method_name = String("call_recursive"); 205 return this.callv(_GODOT_method_name, _GODOT_args); 206 } 207 /** 208 Resets the background color for the given column to default. 209 */ 210 void clearCustomBgColor(in long column) 211 { 212 checkClassBinding!(typeof(this))(); 213 ptrcall!(void)(GDNativeClassBinding.clearCustomBgColor, _godot_object, column); 214 } 215 /** 216 Resets the color for the given column to default. 217 */ 218 void clearCustomColor(in long column) 219 { 220 checkClassBinding!(typeof(this))(); 221 ptrcall!(void)(GDNativeClassBinding.clearCustomColor, _godot_object, column); 222 } 223 /** 224 Deselects the given column. 225 */ 226 void deselect(in long column) 227 { 228 checkClassBinding!(typeof(this))(); 229 ptrcall!(void)(GDNativeClassBinding.deselect, _godot_object, column); 230 } 231 /** 232 Removes the button at index `button_idx` in column `column`. 233 */ 234 void eraseButton(in long column, in long button_idx) 235 { 236 checkClassBinding!(typeof(this))(); 237 ptrcall!(void)(GDNativeClassBinding.eraseButton, _godot_object, column, button_idx); 238 } 239 /** 240 Returns the $(D Texture) of the button at index `button_idx` in column `column`. 241 */ 242 Ref!Texture getButton(in long column, in long button_idx) const 243 { 244 checkClassBinding!(typeof(this))(); 245 return ptrcall!(Texture)(GDNativeClassBinding.getButton, _godot_object, column, button_idx); 246 } 247 /** 248 Returns the number of buttons in column `column`. May be used to get the most recently added button's index, if no index was specified. 249 */ 250 long getButtonCount(in long column) const 251 { 252 checkClassBinding!(typeof(this))(); 253 return ptrcall!(long)(GDNativeClassBinding.getButtonCount, _godot_object, column); 254 } 255 /** 256 Returns the tooltip string for the button at index `button_idx` in column `column`. 257 */ 258 String getButtonTooltip(in long column, in long button_idx) const 259 { 260 checkClassBinding!(typeof(this))(); 261 return ptrcall!(String)(GDNativeClassBinding.getButtonTooltip, _godot_object, column, button_idx); 262 } 263 /** 264 Returns the column's cell mode. 265 */ 266 TreeItem.TreeCellMode getCellMode(in long column) const 267 { 268 checkClassBinding!(typeof(this))(); 269 return ptrcall!(TreeItem.TreeCellMode)(GDNativeClassBinding.getCellMode, _godot_object, column); 270 } 271 /** 272 Returns the TreeItem's first child item or a null object if there is none. 273 */ 274 TreeItem getChildren() 275 { 276 checkClassBinding!(typeof(this))(); 277 return ptrcall!(TreeItem)(GDNativeClassBinding.getChildren, _godot_object); 278 } 279 /** 280 Returns the custom background color of column `column`. 281 */ 282 Color getCustomBgColor(in long column) const 283 { 284 checkClassBinding!(typeof(this))(); 285 return ptrcall!(Color)(GDNativeClassBinding.getCustomBgColor, _godot_object, column); 286 } 287 /** 288 Returns the custom color of column `column`. 289 */ 290 Color getCustomColor(in long column) const 291 { 292 checkClassBinding!(typeof(this))(); 293 return ptrcall!(Color)(GDNativeClassBinding.getCustomColor, _godot_object, column); 294 } 295 /** 296 297 */ 298 long getCustomMinimumHeight() const 299 { 300 checkClassBinding!(typeof(this))(); 301 return ptrcall!(long)(GDNativeClassBinding.getCustomMinimumHeight, _godot_object); 302 } 303 /** 304 Returns `true` if `expand_right` is set. 305 */ 306 bool getExpandRight(in long column) const 307 { 308 checkClassBinding!(typeof(this))(); 309 return ptrcall!(bool)(GDNativeClassBinding.getExpandRight, _godot_object, column); 310 } 311 /** 312 Returns the given column's icon $(D Texture). Error if no icon is set. 313 */ 314 Ref!Texture getIcon(in long column) const 315 { 316 checkClassBinding!(typeof(this))(); 317 return ptrcall!(Texture)(GDNativeClassBinding.getIcon, _godot_object, column); 318 } 319 /** 320 Returns the column's icon's maximum width. 321 */ 322 long getIconMaxWidth(in long column) const 323 { 324 checkClassBinding!(typeof(this))(); 325 return ptrcall!(long)(GDNativeClassBinding.getIconMaxWidth, _godot_object, column); 326 } 327 /** 328 Returns the $(D Color) modulating the column's icon. 329 */ 330 Color getIconModulate(in long column) const 331 { 332 checkClassBinding!(typeof(this))(); 333 return ptrcall!(Color)(GDNativeClassBinding.getIconModulate, _godot_object, column); 334 } 335 /** 336 Returns the icon $(D Texture) region as $(D Rect2). 337 */ 338 Rect2 getIconRegion(in long column) const 339 { 340 checkClassBinding!(typeof(this))(); 341 return ptrcall!(Rect2)(GDNativeClassBinding.getIconRegion, _godot_object, column); 342 } 343 /** 344 Returns the metadata value that was set for the given column using $(D setMetadata). 345 */ 346 Variant getMetadata(in long column) const 347 { 348 checkClassBinding!(typeof(this))(); 349 return ptrcall!(Variant)(GDNativeClassBinding.getMetadata, _godot_object, column); 350 } 351 /** 352 Returns the next TreeItem in the tree or a null object if there is none. 353 */ 354 TreeItem getNext() 355 { 356 checkClassBinding!(typeof(this))(); 357 return ptrcall!(TreeItem)(GDNativeClassBinding.getNext, _godot_object); 358 } 359 /** 360 Returns the next visible TreeItem in the tree or a null object if there is none. 361 If `wrap` is enabled, the method will wrap around to the first visible element in the tree when called on the last visible element, otherwise it returns `null`. 362 */ 363 TreeItem getNextVisible(in bool wrap = false) 364 { 365 checkClassBinding!(typeof(this))(); 366 return ptrcall!(TreeItem)(GDNativeClassBinding.getNextVisible, _godot_object, wrap); 367 } 368 /** 369 Returns the parent TreeItem or a null object if there is none. 370 */ 371 TreeItem getParent() 372 { 373 checkClassBinding!(typeof(this))(); 374 return ptrcall!(TreeItem)(GDNativeClassBinding.getParent, _godot_object); 375 } 376 /** 377 Returns the previous TreeItem in the tree or a null object if there is none. 378 */ 379 TreeItem getPrev() 380 { 381 checkClassBinding!(typeof(this))(); 382 return ptrcall!(TreeItem)(GDNativeClassBinding.getPrev, _godot_object); 383 } 384 /** 385 Returns the previous visible TreeItem in the tree or a null object if there is none. 386 If `wrap` is enabled, the method will wrap around to the last visible element in the tree when called on the first visible element, otherwise it returns `null`. 387 */ 388 TreeItem getPrevVisible(in bool wrap = false) 389 { 390 checkClassBinding!(typeof(this))(); 391 return ptrcall!(TreeItem)(GDNativeClassBinding.getPrevVisible, _godot_object, wrap); 392 } 393 /** 394 Returns the value of a $(D constant CELL_MODE_RANGE) column. 395 */ 396 double getRange(in long column) const 397 { 398 checkClassBinding!(typeof(this))(); 399 return ptrcall!(double)(GDNativeClassBinding.getRange, _godot_object, column); 400 } 401 /** 402 Returns a dictionary containing the range parameters for a given column. The keys are "min", "max", "step", and "expr". 403 */ 404 Dictionary getRangeConfig(in long column) 405 { 406 checkClassBinding!(typeof(this))(); 407 return ptrcall!(Dictionary)(GDNativeClassBinding.getRangeConfig, _godot_object, column); 408 } 409 /** 410 Gets the suffix string shown after the column value. 411 */ 412 String getSuffix(in long column) const 413 { 414 checkClassBinding!(typeof(this))(); 415 return ptrcall!(String)(GDNativeClassBinding.getSuffix, _godot_object, column); 416 } 417 /** 418 Returns the given column's text. 419 */ 420 String getText(in long column) const 421 { 422 checkClassBinding!(typeof(this))(); 423 return ptrcall!(String)(GDNativeClassBinding.getText, _godot_object, column); 424 } 425 /** 426 Returns the given column's text alignment. 427 */ 428 TreeItem.TextAlign getTextAlign(in long column) const 429 { 430 checkClassBinding!(typeof(this))(); 431 return ptrcall!(TreeItem.TextAlign)(GDNativeClassBinding.getTextAlign, _godot_object, column); 432 } 433 /** 434 Returns the given column's tooltip. 435 */ 436 String getTooltip(in long column) const 437 { 438 checkClassBinding!(typeof(this))(); 439 return ptrcall!(String)(GDNativeClassBinding.getTooltip, _godot_object, column); 440 } 441 /** 442 Returns `true` if the button at index `button_idx` for the given column is disabled. 443 */ 444 bool isButtonDisabled(in long column, in long button_idx) const 445 { 446 checkClassBinding!(typeof(this))(); 447 return ptrcall!(bool)(GDNativeClassBinding.isButtonDisabled, _godot_object, column, button_idx); 448 } 449 /** 450 Returns `true` if the given column is checked. 451 */ 452 bool isChecked(in long column) const 453 { 454 checkClassBinding!(typeof(this))(); 455 return ptrcall!(bool)(GDNativeClassBinding.isChecked, _godot_object, column); 456 } 457 /** 458 459 */ 460 bool isCollapsed() 461 { 462 checkClassBinding!(typeof(this))(); 463 return ptrcall!(bool)(GDNativeClassBinding.isCollapsed, _godot_object); 464 } 465 /** 466 467 */ 468 bool isCustomSetAsButton(in long column) const 469 { 470 checkClassBinding!(typeof(this))(); 471 return ptrcall!(bool)(GDNativeClassBinding.isCustomSetAsButton, _godot_object, column); 472 } 473 /** 474 Returns `true` if column `column` is editable. 475 */ 476 bool isEditable(in long column) 477 { 478 checkClassBinding!(typeof(this))(); 479 return ptrcall!(bool)(GDNativeClassBinding.isEditable, _godot_object, column); 480 } 481 /** 482 483 */ 484 bool isFoldingDisabled() const 485 { 486 checkClassBinding!(typeof(this))(); 487 return ptrcall!(bool)(GDNativeClassBinding.isFoldingDisabled, _godot_object); 488 } 489 /** 490 Returns `true` if column `column` is selectable. 491 */ 492 bool isSelectable(in long column) const 493 { 494 checkClassBinding!(typeof(this))(); 495 return ptrcall!(bool)(GDNativeClassBinding.isSelectable, _godot_object, column); 496 } 497 /** 498 Returns `true` if column `column` is selected. 499 */ 500 bool isSelected(in long column) 501 { 502 checkClassBinding!(typeof(this))(); 503 return ptrcall!(bool)(GDNativeClassBinding.isSelected, _godot_object, column); 504 } 505 /** 506 Moves this TreeItem to the bottom in the $(D Tree) hierarchy. 507 */ 508 void moveToBottom() 509 { 510 checkClassBinding!(typeof(this))(); 511 ptrcall!(void)(GDNativeClassBinding.moveToBottom, _godot_object); 512 } 513 /** 514 Moves this TreeItem to the top in the $(D Tree) hierarchy. 515 */ 516 void moveToTop() 517 { 518 checkClassBinding!(typeof(this))(); 519 ptrcall!(void)(GDNativeClassBinding.moveToTop, _godot_object); 520 } 521 /** 522 Removes the given child $(D TreeItem) and all its children from the $(D Tree). Note that it doesn't free the item from memory, so it can be reused later. To completely remove a $(D TreeItem) use $(D GodotObject.free). 523 */ 524 void removeChild(GodotObject child) 525 { 526 checkClassBinding!(typeof(this))(); 527 ptrcall!(void)(GDNativeClassBinding.removeChild, _godot_object, child); 528 } 529 /** 530 Selects the column `column`. 531 */ 532 void select(in long column) 533 { 534 checkClassBinding!(typeof(this))(); 535 ptrcall!(void)(GDNativeClassBinding.select, _godot_object, column); 536 } 537 /** 538 Sets the given column's button $(D Texture) at index `button_idx` to `button`. 539 */ 540 void setButton(in long column, in long button_idx, Texture button) 541 { 542 checkClassBinding!(typeof(this))(); 543 ptrcall!(void)(GDNativeClassBinding.setButton, _godot_object, column, button_idx, button); 544 } 545 /** 546 If `true`, disables the button at index `button_idx` in column `column`. 547 */ 548 void setButtonDisabled(in long column, in long button_idx, in bool disabled) 549 { 550 checkClassBinding!(typeof(this))(); 551 ptrcall!(void)(GDNativeClassBinding.setButtonDisabled, _godot_object, column, button_idx, disabled); 552 } 553 /** 554 Sets the given column's cell mode to `mode`. See $(D treecellmode) constants. 555 */ 556 void setCellMode(in long column, in long mode) 557 { 558 checkClassBinding!(typeof(this))(); 559 ptrcall!(void)(GDNativeClassBinding.setCellMode, _godot_object, column, mode); 560 } 561 /** 562 If `true`, the column `column` is checked. 563 */ 564 void setChecked(in long column, in bool checked) 565 { 566 checkClassBinding!(typeof(this))(); 567 ptrcall!(void)(GDNativeClassBinding.setChecked, _godot_object, column, checked); 568 } 569 /** 570 571 */ 572 void setCollapsed(in bool enable) 573 { 574 checkClassBinding!(typeof(this))(); 575 ptrcall!(void)(GDNativeClassBinding.setCollapsed, _godot_object, enable); 576 } 577 /** 578 579 */ 580 void setCustomAsButton(in long column, in bool enable) 581 { 582 checkClassBinding!(typeof(this))(); 583 ptrcall!(void)(GDNativeClassBinding.setCustomAsButton, _godot_object, column, enable); 584 } 585 /** 586 Sets the given column's custom background color and whether to just use it as an outline. 587 */ 588 void setCustomBgColor(in long column, in Color color, in bool just_outline = false) 589 { 590 checkClassBinding!(typeof(this))(); 591 ptrcall!(void)(GDNativeClassBinding.setCustomBgColor, _godot_object, column, color, just_outline); 592 } 593 /** 594 Sets the given column's custom color. 595 */ 596 void setCustomColor(in long column, in Color color) 597 { 598 checkClassBinding!(typeof(this))(); 599 ptrcall!(void)(GDNativeClassBinding.setCustomColor, _godot_object, column, color); 600 } 601 /** 602 Sets the given column's custom draw callback to `callback` method on `object`. 603 The `callback` should accept two arguments: the $(D TreeItem) that is drawn and its position and size as a $(D Rect2). 604 */ 605 void setCustomDraw(in long column, GodotObject object, in String callback) 606 { 607 checkClassBinding!(typeof(this))(); 608 ptrcall!(void)(GDNativeClassBinding.setCustomDraw, _godot_object, column, object, callback); 609 } 610 /** 611 612 */ 613 void setCustomMinimumHeight(in long height) 614 { 615 checkClassBinding!(typeof(this))(); 616 ptrcall!(void)(GDNativeClassBinding.setCustomMinimumHeight, _godot_object, height); 617 } 618 /** 619 620 */ 621 void setDisableFolding(in bool disable) 622 { 623 checkClassBinding!(typeof(this))(); 624 ptrcall!(void)(GDNativeClassBinding.setDisableFolding, _godot_object, disable); 625 } 626 /** 627 If `true`, column `column` is editable. 628 */ 629 void setEditable(in long column, in bool enabled) 630 { 631 checkClassBinding!(typeof(this))(); 632 ptrcall!(void)(GDNativeClassBinding.setEditable, _godot_object, column, enabled); 633 } 634 /** 635 If `true`, column `column` is expanded to the right. 636 */ 637 void setExpandRight(in long column, in bool enable) 638 { 639 checkClassBinding!(typeof(this))(); 640 ptrcall!(void)(GDNativeClassBinding.setExpandRight, _godot_object, column, enable); 641 } 642 /** 643 Sets the given column's icon $(D Texture). 644 */ 645 void setIcon(in long column, Texture texture) 646 { 647 checkClassBinding!(typeof(this))(); 648 ptrcall!(void)(GDNativeClassBinding.setIcon, _godot_object, column, texture); 649 } 650 /** 651 Sets the given column's icon's maximum width. 652 */ 653 void setIconMaxWidth(in long column, in long width) 654 { 655 checkClassBinding!(typeof(this))(); 656 ptrcall!(void)(GDNativeClassBinding.setIconMaxWidth, _godot_object, column, width); 657 } 658 /** 659 Modulates the given column's icon with `modulate`. 660 */ 661 void setIconModulate(in long column, in Color modulate) 662 { 663 checkClassBinding!(typeof(this))(); 664 ptrcall!(void)(GDNativeClassBinding.setIconModulate, _godot_object, column, modulate); 665 } 666 /** 667 Sets the given column's icon's texture region. 668 */ 669 void setIconRegion(in long column, in Rect2 region) 670 { 671 checkClassBinding!(typeof(this))(); 672 ptrcall!(void)(GDNativeClassBinding.setIconRegion, _godot_object, column, region); 673 } 674 /** 675 Sets the metadata value for the given column, which can be retrieved later using $(D getMetadata). This can be used, for example, to store a reference to the original data. 676 */ 677 void setMetadata(VariantArg1)(in long column, in VariantArg1 meta) 678 { 679 checkClassBinding!(typeof(this))(); 680 ptrcall!(void)(GDNativeClassBinding.setMetadata, _godot_object, column, meta); 681 } 682 /** 683 Sets the value of a $(D constant CELL_MODE_RANGE) column. 684 */ 685 void setRange(in long column, in double value) 686 { 687 checkClassBinding!(typeof(this))(); 688 ptrcall!(void)(GDNativeClassBinding.setRange, _godot_object, column, value); 689 } 690 /** 691 Sets the range of accepted values for a column. The column must be in the $(D constant CELL_MODE_RANGE) mode. 692 If `expr` is `true`, the edit mode slider will use an exponential scale as with $(D Range.expEdit). 693 */ 694 void setRangeConfig(in long column, in double min, in double max, in double step, in bool expr = false) 695 { 696 checkClassBinding!(typeof(this))(); 697 ptrcall!(void)(GDNativeClassBinding.setRangeConfig, _godot_object, column, min, max, step, expr); 698 } 699 /** 700 If `true`, the given column is selectable. 701 */ 702 void setSelectable(in long column, in bool selectable) 703 { 704 checkClassBinding!(typeof(this))(); 705 ptrcall!(void)(GDNativeClassBinding.setSelectable, _godot_object, column, selectable); 706 } 707 /** 708 Sets a string to be shown after a column's value (for example, a unit abbreviation). 709 */ 710 void setSuffix(in long column, in String text) 711 { 712 checkClassBinding!(typeof(this))(); 713 ptrcall!(void)(GDNativeClassBinding.setSuffix, _godot_object, column, text); 714 } 715 /** 716 Sets the given column's text value. 717 */ 718 void setText(in long column, in String text) 719 { 720 checkClassBinding!(typeof(this))(); 721 ptrcall!(void)(GDNativeClassBinding.setText, _godot_object, column, text); 722 } 723 /** 724 Sets the given column's text alignment. See $(D textalign) for possible values. 725 */ 726 void setTextAlign(in long column, in long text_align) 727 { 728 checkClassBinding!(typeof(this))(); 729 ptrcall!(void)(GDNativeClassBinding.setTextAlign, _godot_object, column, text_align); 730 } 731 /** 732 Sets the given column's tooltip text. 733 */ 734 void setTooltip(in long column, in String tooltip) 735 { 736 checkClassBinding!(typeof(this))(); 737 ptrcall!(void)(GDNativeClassBinding.setTooltip, _godot_object, column, tooltip); 738 } 739 /** 740 If `true`, the TreeItem is collapsed. 741 */ 742 @property bool collapsed() 743 { 744 return isCollapsed(); 745 } 746 /// ditto 747 @property void collapsed(bool v) 748 { 749 setCollapsed(v); 750 } 751 /** 752 The custom minimum height. 753 */ 754 @property long customMinimumHeight() 755 { 756 return getCustomMinimumHeight(); 757 } 758 /// ditto 759 @property void customMinimumHeight(long v) 760 { 761 setCustomMinimumHeight(v); 762 } 763 /** 764 If `true`, folding is disabled for this TreeItem. 765 */ 766 @property bool disableFolding() 767 { 768 return isFoldingDisabled(); 769 } 770 /// ditto 771 @property void disableFolding(bool v) 772 { 773 setDisableFolding(v); 774 } 775 }