/**************************************************************************/ /* tree.h */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ /* https://godotengine.org */ /**************************************************************************/ /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ /* "Software"), to deal in the Software without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of the Software, and to */ /* permit persons to whom the Software is furnished to do so, subject to */ /* the following conditions: */ /* */ /* The above copyright notice and this permission notice shall be */ /* included in all copies or substantial portions of the Software. */ /* */ /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ #ifndef TREE_H #define TREE_H #include "scene/gui/control.h" #include "scene/gui/line_edit.h" #include "scene/gui/popup_menu.h" #include "scene/gui/scroll_bar.h" #include "scene/gui/slider.h" #include "scene/resources/text_paragraph.h" class TextEdit; class Tree; class TreeItem : public Object { GDCLASS(TreeItem, Object); public: enum TreeCellMode { CELL_MODE_STRING, ///< just a string CELL_MODE_CHECK, ///< string + check CELL_MODE_RANGE, ///< Contains a range CELL_MODE_ICON, ///< Contains an icon, not editable CELL_MODE_CUSTOM, ///< Contains a custom value, show a string, and an edit button }; private: friend class Tree; struct Cell { TreeCellMode mode = TreeItem::CELL_MODE_STRING; Ref icon; Rect2i icon_region; String text; bool edit_multiline = false; String suffix; Ref text_buf; String language; TextServer::StructuredTextParser st_parser = TextServer::STRUCTURED_TEXT_DEFAULT; Array st_args; Control::TextDirection text_direction = Control::TEXT_DIRECTION_INHERITED; TextServer::AutowrapMode autowrap_mode = TextServer::AUTOWRAP_OFF; bool dirty = true; double min = 0.0; double max = 100.0; double step = 1.0; double val = 0.0; int icon_max_w = 0; bool expr = false; bool checked = false; bool indeterminate = false; bool editable = false; bool selected = false; bool selectable = true; bool custom_color = false; Color color; bool custom_bg_color = false; bool custom_bg_outline = false; Color bg_color; bool custom_button = false; bool expand_right = false; Color icon_color = Color(1, 1, 1); Size2i cached_minimum_size; bool cached_minimum_size_dirty = true; HorizontalAlignment text_alignment = HORIZONTAL_ALIGNMENT_LEFT; Variant meta; String tooltip; ObjectID custom_draw_obj; StringName custom_draw_callback; struct Button { int id = 0; bool disabled = false; Ref texture; Color color = Color(1, 1, 1, 1); String tooltip; }; Vector