/*************************************************************************/ /* tree.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* 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" 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 }; enum TextAlign { ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT }; private: friend class Tree; struct Cell { TreeCellMode mode; Ref icon; Rect2i icon_region; String text; String suffix; double min, max, step, val; int icon_max_w; bool expr; bool checked; bool editable; bool selected; bool selectable; bool custom_color; Color color; bool custom_bg_color; bool custom_bg_outline; Color bg_color; bool custom_button; bool expand_right; Color icon_color; TextAlign text_align; Variant meta; String tooltip; ObjectID custom_draw_obj; StringName custom_draw_callback; struct Button { int id; bool disabled; Ref texture; Color color; String tooltip; Button() { id = 0; disabled = false; color = Color(1, 1, 1, 1); tooltip = ""; } }; Vector