godot/scene/gui/tree.h

642 lines
19 KiB
C++
Raw Normal View History

2014-02-10 01:10:30 +00:00
/*************************************************************************/
/* tree.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
2014-02-10 01:10:30 +00:00
/*************************************************************************/
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
2014-02-10 01:10:30 +00:00
/* */
/* 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. */
/*************************************************************************/
2014-02-10 01:10:30 +00:00
#ifndef TREE_H
#define TREE_H
#include "scene/gui/control.h"
#include "scene/gui/line_edit.h"
#include "scene/gui/popup_menu.h"
2014-02-10 01:10:30 +00:00
#include "scene/gui/scroll_bar.h"
#include "scene/gui/slider.h"
#include "scene/resources/text_line.h"
2014-02-10 01:10:30 +00:00
class Tree;
class TreeItem : public Object {
GDCLASS(TreeItem, Object);
2016-03-08 23:00:52 +00:00
public:
2014-02-10 01:10:30 +00:00
enum TreeCellMode {
CELL_MODE_STRING, ///< just a string
CELL_MODE_CHECK, ///< string + check
CELL_MODE_RANGE, ///< Contains a range
2017-09-02 14:19:06 +00:00
CELL_MODE_ICON, ///< Contains an icon, not editable
2014-02-10 01:10:30 +00:00
CELL_MODE_CUSTOM, ///< Contains a custom value, show a string, and an edit button
};
2016-03-08 23:00:52 +00:00
enum TextAlign {
ALIGN_LEFT,
ALIGN_CENTER,
ALIGN_RIGHT
};
2014-02-10 01:10:30 +00:00
private:
friend class Tree;
2016-03-08 23:00:52 +00:00
2014-02-10 01:10:30 +00:00
struct Cell {
TreeCellMode mode = TreeItem::CELL_MODE_STRING;
2014-02-10 01:10:30 +00:00
Ref<Texture2D> icon;
2014-02-10 01:10:30 +00:00
Rect2i icon_region;
String text;
String suffix;
Ref<TextLine> text_buf;
Dictionary opentype_features;
String language;
Control::StructuredTextParser st_parser = Control::STRUCTURED_TEXT_DEFAULT;
Array st_args;
Control::TextDirection text_direction = Control::TEXT_DIRECTION_INHERITED;
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 editable = false;
bool selected = false;
bool selectable = true;
bool custom_color = false;
2014-02-10 01:10:30 +00:00
Color color;
bool custom_bg_color = false;
bool custom_bg_outline = false;
2014-02-10 01:10:30 +00:00
Color bg_color;
bool custom_button = false;
bool expand_right = false;
Color icon_color = Color(1, 1, 1);
TextAlign text_align = ALIGN_LEFT;
2014-02-10 01:10:30 +00:00
Variant meta;
String tooltip;
ObjectID custom_draw_obj;
StringName custom_draw_callback;
struct Button {
int id = 0;
bool disabled = false;
Ref<Texture2D> texture;
Color color = Color(1, 1, 1, 1);
String tooltip;
2014-02-10 01:10:30 +00:00
};
Vector<Button> buttons;
2016-03-08 23:00:52 +00:00
2014-02-10 01:10:30 +00:00
Cell() {
text_buf.instance();
2014-02-10 01:10:30 +00:00
}
Size2 get_icon_size() const;
void draw_icon(const RID &p_where, const Point2 &p_pos, const Size2 &p_size = Size2(), const Color &p_color = Color()) const;
2014-02-10 01:10:30 +00:00
};
2016-03-08 23:00:52 +00:00
2014-02-10 01:10:30 +00:00
Vector<Cell> cells;
2016-03-08 23:00:52 +00:00
bool collapsed; // won't show children
bool disable_folding;
int custom_min_height;
2016-03-08 23:00:52 +00:00
2014-02-10 01:10:30 +00:00
TreeItem *parent; // parent item
TreeItem *next; // next in list
TreeItem *children; //child items
2014-02-10 01:10:30 +00:00
Tree *tree; //tree (for reference)
TreeItem(Tree *p_tree);
2016-03-08 23:00:52 +00:00
2014-02-10 01:10:30 +00:00
void _changed_notify(int p_cell);
void _changed_notify();
void _cell_selected(int p_cell);
void _cell_deselected(int p_cell);
2016-03-08 23:00:52 +00:00
protected:
2014-02-10 01:10:30 +00:00
static void _bind_methods();
//bind helpers
Dictionary _get_range_config(int p_column) {
2014-02-10 01:10:30 +00:00
Dictionary d;
double min = 0.0, max = 0.0, step = 0.0;
get_range_config(p_column, min, max, step);
d["min"] = min;
d["max"] = max;
d["step"] = step;
d["expr"] = false;
2014-02-10 01:10:30 +00:00
return d;
}
void _remove_child(Object *p_child) {
remove_child(Object::cast_to<TreeItem>(p_child));
}
2016-03-08 23:00:52 +00:00
Variant _call_recursive_bind(const Variant **p_args, int p_argcount, Callable::CallError &r_error);
2018-10-07 16:25:57 +00:00
public:
2014-02-10 01:10:30 +00:00
/* cell mode */
void set_cell_mode(int p_column, TreeCellMode p_mode);
TreeCellMode get_cell_mode(int p_column) const;
2016-03-08 23:00:52 +00:00
2014-02-10 01:10:30 +00:00
/* check mode */
void set_checked(int p_column, bool p_checked);
2014-02-10 01:10:30 +00:00
bool is_checked(int p_column) const;
2016-03-08 23:00:52 +00:00
void set_text(int p_column, String p_text);
2014-02-10 01:10:30 +00:00
String get_text(int p_column) const;
2016-03-08 23:00:52 +00:00
void set_text_direction(int p_column, Control::TextDirection p_text_direction);
Control::TextDirection get_text_direction(int p_column) const;
void set_opentype_feature(int p_column, const String &p_name, int p_value);
int get_opentype_feature(int p_column, const String &p_name) const;
void clear_opentype_features(int p_column);
void set_structured_text_bidi_override(int p_column, Control::StructuredTextParser p_parser);
Control::StructuredTextParser get_structured_text_bidi_override(int p_column) const;
void set_structured_text_bidi_override_options(int p_column, Array p_args);
Array get_structured_text_bidi_override_options(int p_column) const;
void set_language(int p_column, const String &p_language);
String get_language(int p_column) const;
void set_suffix(int p_column, String p_suffix);
String get_suffix(int p_column) const;
void set_icon(int p_column, const Ref<Texture2D> &p_icon);
Ref<Texture2D> get_icon(int p_column) const;
2014-02-10 01:10:30 +00:00
void set_icon_region(int p_column, const Rect2 &p_icon_region);
2014-02-10 01:10:30 +00:00
Rect2 get_icon_region(int p_column) const;
2019-08-24 15:13:48 +00:00
void set_icon_modulate(int p_column, const Color &p_modulate);
Color get_icon_modulate(int p_column) const;
void set_icon_max_width(int p_column, int p_max);
2014-02-10 01:10:30 +00:00
int get_icon_max_width(int p_column) const;
void add_button(int p_column, const Ref<Texture2D> &p_button, int p_id = -1, bool p_disabled = false, const String &p_tooltip = "");
2014-02-10 01:10:30 +00:00
int get_button_count(int p_column) const;
String get_button_tooltip(int p_column, int p_idx) const;
Ref<Texture2D> get_button(int p_column, int p_idx) const;
void erase_button(int p_column, int p_idx);
int get_button_by_id(int p_column, int p_id) const;
void set_button(int p_column, int p_idx, const Ref<Texture2D> &p_button);
void set_button_color(int p_column, int p_idx, const Color &p_color);
void set_button_disabled(int p_column, int p_idx, bool p_disabled);
bool is_button_disabled(int p_column, int p_idx) const;
2014-02-10 01:10:30 +00:00
/* range works for mode number or mode combo */
2016-03-08 23:00:52 +00:00
void set_range(int p_column, double p_value);
2014-02-10 01:10:30 +00:00
double get_range(int p_column) const;
2016-03-08 23:00:52 +00:00
void set_range_config(int p_column, double p_min, double p_max, double p_step, bool p_exp = false);
void get_range_config(int p_column, double &r_min, double &r_max, double &r_step) const;
2014-02-10 01:10:30 +00:00
bool is_range_exponential(int p_column) const;
2016-03-08 23:00:52 +00:00
void set_metadata(int p_column, const Variant &p_meta);
2014-02-10 01:10:30 +00:00
Variant get_metadata(int p_column) const;
2016-03-08 23:00:52 +00:00
void set_custom_draw(int p_column, Object *p_object, const StringName &p_callback);
2016-03-08 23:00:52 +00:00
2014-02-10 01:10:30 +00:00
void set_collapsed(bool p_collapsed);
bool is_collapsed();
2016-03-08 23:00:52 +00:00
void uncollapse_tree();
void set_custom_minimum_height(int p_height);
int get_custom_minimum_height() const;
2014-02-10 01:10:30 +00:00
TreeItem *get_prev();
TreeItem *get_next();
TreeItem *get_parent();
TreeItem *get_children();
2019-05-11 16:32:53 +00:00
TreeItem *get_prev_visible(bool p_wrap = false);
TreeItem *get_next_visible(bool p_wrap = false);
2016-03-08 23:00:52 +00:00
2014-02-10 01:10:30 +00:00
void remove_child(TreeItem *p_item);
2016-03-08 23:00:52 +00:00
void set_selectable(int p_column, bool p_selectable);
2014-02-10 01:10:30 +00:00
bool is_selectable(int p_column) const;
2016-03-08 23:00:52 +00:00
2014-02-10 01:10:30 +00:00
bool is_selected(int p_column);
void select(int p_column);
void deselect(int p_column);
void set_as_cursor(int p_column);
2016-03-08 23:00:52 +00:00
void set_editable(int p_column, bool p_editable);
2014-02-10 01:10:30 +00:00
bool is_editable(int p_column);
2016-03-08 23:00:52 +00:00
void set_custom_color(int p_column, const Color &p_color);
Color get_custom_color(int p_column) const;
2014-02-10 01:10:30 +00:00
void clear_custom_color(int p_column);
void set_custom_bg_color(int p_column, const Color &p_color, bool p_bg_outline = false);
2014-02-10 01:10:30 +00:00
void clear_custom_bg_color(int p_column);
Color get_custom_bg_color(int p_column) const;
void set_custom_as_button(int p_column, bool p_button);
bool is_custom_set_as_button(int p_column) const;
void set_tooltip(int p_column, const String &p_tooltip);
2014-02-10 01:10:30 +00:00
String get_tooltip(int p_column) const;
void clear_children();
void set_text_align(int p_column, TextAlign p_align);
TextAlign get_text_align(int p_column) const;
void set_expand_right(int p_column, bool p_enable);
bool get_expand_right(int p_column) const;
2014-02-10 01:10:30 +00:00
void move_to_top();
void move_to_bottom();
void set_disable_folding(bool p_disable);
bool is_folding_disabled() const;
void call_recursive(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error);
2018-10-07 16:25:57 +00:00
2014-02-10 01:10:30 +00:00
~TreeItem();
};
VARIANT_ENUM_CAST(TreeItem::TreeCellMode);
VARIANT_ENUM_CAST(TreeItem::TextAlign);
2014-02-10 01:10:30 +00:00
class VBoxContainer;
2014-02-10 01:10:30 +00:00
class Tree : public Control {
GDCLASS(Tree, Control);
2016-03-08 23:00:52 +00:00
public:
2014-02-10 01:10:30 +00:00
enum SelectMode {
SELECT_SINGLE,
SELECT_ROW,
SELECT_MULTI
2014-02-10 01:10:30 +00:00
};
2016-03-08 23:00:52 +00:00
enum DropModeFlags {
DROP_MODE_DISABLED = 0,
DROP_MODE_ON_ITEM = 1,
DROP_MODE_INBETWEEN = 2
};
2016-03-08 23:00:52 +00:00
private:
friend class TreeItem;
2016-03-08 23:00:52 +00:00
TreeItem *root = nullptr;
TreeItem *popup_edited_item = nullptr;
TreeItem *selected_item = nullptr;
TreeItem *edited_item = nullptr;
TreeItem *drop_mode_over = nullptr;
int drop_mode_section = 0;
TreeItem *single_select_defer = nullptr;
int single_select_defer_column = 0;
int pressed_button = -1;
bool pressing_for_editor = false;
String pressing_for_editor_text;
Vector2 pressing_pos;
Rect2 pressing_item_rect;
float range_drag_base = 0.0;
bool range_drag_enabled = false;
Vector2 range_drag_capture_pos;
bool propagate_mouse_activated = false;
2014-02-10 01:10:30 +00:00
//TreeItem *cursor_item;
//int cursor_column;
Rect2 custom_popup_rect;
int edited_col = -1;
int selected_col = -1;
int popup_edited_item_col = -1;
bool hide_root = false;
SelectMode select_mode = SELECT_SINGLE;
2014-02-10 01:10:30 +00:00
int blocked = 0;
2014-02-10 01:10:30 +00:00
int drop_mode_flags = 0;
2014-02-10 01:10:30 +00:00
struct ColumnInfo {
int min_width = 1;
bool expand = true;
2014-02-10 01:10:30 +00:00
String title;
Ref<TextLine> text_buf;
Dictionary opentype_features;
String language;
Control::TextDirection text_direction = Control::TEXT_DIRECTION_INHERITED;
ColumnInfo() {
text_buf.instance();
}
2014-02-10 01:10:30 +00:00
};
bool show_column_titles = false;
VBoxContainer *popup_editor_vb;
Popup *popup_editor;
LineEdit *text_editor = nullptr;
2014-02-10 01:10:30 +00:00
HSlider *value_editor;
bool updating_value_editor = false;
uint64_t focus_in_id = 0;
PopupMenu *popup_menu = nullptr;
2014-02-10 01:10:30 +00:00
Vector<ColumnInfo> columns;
Timer *range_click_timer;
TreeItem *range_item_last = nullptr;
bool range_up_last = false;
void _range_click_timeout();
2014-02-10 01:10:30 +00:00
int compute_item_height(TreeItem *p_item) const;
int get_item_height(TreeItem *p_item) const;
void _update_all();
void update_column(int p_col);
void update_item_cell(TreeItem *p_item, int p_col);
void update_item_cache(TreeItem *p_item);
//void draw_item_text(String p_text,const Ref<Texture2D>& p_icon,int p_icon_max_w,bool p_tool,Rect2i p_rect,const Color& p_color);
void draw_item_rect(TreeItem::Cell &p_cell, const Rect2i &p_rect, const Color &p_color, const Color &p_icon_color, int p_ol_size, const Color &p_ol_color);
int draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 &p_draw_size, TreeItem *p_item);
2020-04-01 23:20:12 +00:00
void select_single_item(TreeItem *p_selected, TreeItem *p_current, int p_col, TreeItem *p_prev = nullptr, bool *r_in_range = nullptr, bool p_force_deselect = false);
int propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool p_doubleclick, TreeItem *p_item, int p_button, const Ref<InputEventWithModifiers> &p_mod);
void _text_editor_enter(String p_text);
void _text_editor_modal_close();
2014-02-10 01:10:30 +00:00
void value_editor_changed(double p_value);
void popup_select(int p_option);
2016-03-08 23:00:52 +00:00
void _gui_input(Ref<InputEvent> p_event);
2014-02-10 01:10:30 +00:00
void _notification(int p_what);
2016-03-08 23:00:52 +00:00
2020-07-10 10:34:39 +00:00
Size2 get_minimum_size() const override;
2016-03-08 23:00:52 +00:00
void item_edited(int p_column, TreeItem *p_item, bool p_lmb = true);
void item_changed(int p_column, TreeItem *p_item);
void item_selected(int p_column, TreeItem *p_item);
void item_deselected(int p_column, TreeItem *p_item);
2016-03-08 23:00:52 +00:00
2014-02-10 01:10:30 +00:00
void propagate_set_columns(TreeItem *p_item);
2016-03-08 23:00:52 +00:00
2014-02-10 01:10:30 +00:00
struct Cache {
Ref<Font> font;
Ref<Font> tb_font;
int font_size = 0;
int tb_font_size = 0;
2014-02-10 01:10:30 +00:00
Ref<StyleBox> bg;
Ref<StyleBox> selected;
Ref<StyleBox> selected_focus;
Ref<StyleBox> cursor;
Ref<StyleBox> cursor_unfocus;
Ref<StyleBox> button_pressed;
Ref<StyleBox> title_button;
Ref<StyleBox> title_button_hover;
Ref<StyleBox> title_button_pressed;
Ref<StyleBox> custom_button;
Ref<StyleBox> custom_button_hover;
Ref<StyleBox> custom_button_pressed;
2014-02-10 01:10:30 +00:00
Color title_button_color;
Ref<Texture2D> checked;
Ref<Texture2D> unchecked;
Ref<Texture2D> arrow_collapsed;
Ref<Texture2D> arrow;
Ref<Texture2D> select_arrow;
Ref<Texture2D> updown;
2016-03-08 23:00:52 +00:00
2014-02-10 01:10:30 +00:00
Color font_color;
Color font_selected_color;
2014-02-10 01:10:30 +00:00
Color guide_color;
Color drop_position_color;
Color relationship_line_color;
Color custom_button_font_highlight;
int hseparation = 0;
int vseparation = 0;
int item_margin = 0;
int button_margin = 0;
2014-02-10 01:10:30 +00:00
Point2 offset;
int draw_relationship_lines = 0;
int draw_guides = 0;
int scroll_border = 0;
int scroll_speed = 0;
2014-02-10 01:10:30 +00:00
enum ClickType {
CLICK_NONE,
CLICK_TITLE,
CLICK_BUTTON,
};
ClickType click_type = Cache::CLICK_NONE;
ClickType hover_type = Cache::CLICK_NONE;
int click_index = -1;
int click_id = -1;
TreeItem *click_item = nullptr;
int click_column = 0;
int hover_index = -1;
Point2 click_pos;
2014-02-10 01:10:30 +00:00
TreeItem *hover_item = nullptr;
int hover_cell = -1;
Point2i text_editor_position;
2014-02-10 01:10:30 +00:00
} cache;
2016-03-08 23:00:52 +00:00
2014-02-10 01:10:30 +00:00
int _get_title_button_height() const;
void _scroll_moved(float p_value);
HScrollBar *h_scroll;
VScrollBar *v_scroll;
2016-03-08 23:00:52 +00:00
2014-02-10 01:10:30 +00:00
Size2 get_internal_min_size() const;
void update_cache();
void update_scrollbars();
Rect2 search_item_rect(TreeItem *p_from, TreeItem *p_item);
//Rect2 get_item_rect(TreeItem *p_item);
uint64_t last_keypress = 0;
2014-02-10 01:10:30 +00:00
String incr_search;
bool cursor_can_exit_tree = true;
void _do_incr_search(const String &p_add);
2014-02-10 01:10:30 +00:00
TreeItem *_search_item_text(TreeItem *p_at, const String &p_find, int *r_col, bool p_selectable, bool p_backwards = false);
2014-02-10 01:10:30 +00:00
TreeItem *_find_item_at_pos(TreeItem *p_item, const Point2 &p_pos, int &r_column, int &h, int &section) const;
2014-02-10 01:10:30 +00:00
/* float drag_speed;
2014-02-10 01:10:30 +00:00
float drag_accum;
float last_drag_accum;
float last_drag_time;
float time_since_motion;*/
float drag_speed = 0.0;
float drag_from = 0.0;
float drag_accum = 0.0;
2014-02-10 01:10:30 +00:00
Vector2 last_speed;
bool drag_touching = false;
bool drag_touching_deaccel = false;
bool click_handled = false;
bool allow_rmb_select = false;
bool scrolling = false;
2014-02-10 01:10:30 +00:00
bool allow_reselect = false;
bool force_edit_checkbox_only_on_checkbox = false;
bool hide_folding = false;
2015-11-13 23:56:44 +00:00
int _count_selected_items(TreeItem *p_from) const;
void _go_left();
void _go_right();
void _go_down();
void _go_up();
2014-02-10 01:10:30 +00:00
protected:
static void _bind_methods();
2016-03-08 23:00:52 +00:00
2014-02-10 01:10:30 +00:00
//bind helpers
TreeItem *_create_item(Object *p_parent, int p_idx = -1) {
2017-12-14 21:13:48 +00:00
return create_item(Object::cast_to<TreeItem>(p_parent), p_idx);
}
TreeItem *_get_next_selected(Object *p_item) {
return get_next_selected(Object::cast_to<TreeItem>(p_item));
}
Rect2 _get_item_rect(Object *p_item, int p_column) const {
return get_item_rect(Object::cast_to<TreeItem>(p_item), p_column);
}
2021-02-08 01:16:25 +00:00
void _scroll_to_item(Object *p_item) {
scroll_to_item(Object::cast_to<TreeItem>(p_item));
}
2014-02-10 01:10:30 +00:00
public:
2020-07-10 10:34:39 +00:00
virtual String get_tooltip(const Point2 &p_pos) const override;
2014-02-10 01:10:30 +00:00
TreeItem *get_item_at_position(const Point2 &p_pos) const;
int get_column_at_position(const Point2 &p_pos) const;
int get_drop_section_at_position(const Point2 &p_pos) const;
int get_button_id_at_position(const Point2 &p_pos) const;
2014-02-10 01:10:30 +00:00
void clear();
TreeItem *create_item(TreeItem *p_parent = nullptr, int p_idx = -1);
TreeItem *get_root();
TreeItem *get_last_item();
2014-02-10 01:10:30 +00:00
void set_column_min_width(int p_column, int p_min_width);
void set_column_expand(int p_column, bool p_expand);
2014-02-10 01:10:30 +00:00
int get_column_width(int p_column) const;
2016-03-08 23:00:52 +00:00
void set_hide_root(bool p_enabled);
bool is_root_hidden() const;
TreeItem *get_next_selected(TreeItem *p_item);
2014-02-10 01:10:30 +00:00
TreeItem *get_selected() const;
int get_selected_column() const;
int get_pressed_button() const;
void set_select_mode(SelectMode p_mode);
SelectMode get_select_mode() const;
void deselect_all();
bool is_anything_selected();
2016-03-08 23:00:52 +00:00
2014-02-10 01:10:30 +00:00
void set_columns(int p_columns);
int get_columns() const;
void set_column_title(int p_column, const String &p_title);
2014-02-10 01:10:30 +00:00
String get_column_title(int p_column) const;
void set_column_title_direction(int p_column, Control::TextDirection p_text_direction);
Control::TextDirection get_column_title_direction(int p_column) const;
void set_column_title_opentype_feature(int p_column, const String &p_name, int p_value);
int get_column_title_opentype_feature(int p_column, const String &p_name) const;
void clear_column_title_opentype_features(int p_column);
void set_column_title_language(int p_column, const String &p_language);
String get_column_title_language(int p_column) const;
2014-02-10 01:10:30 +00:00
void set_column_titles_visible(bool p_show);
bool are_column_titles_visible() const;
TreeItem *get_edited() const;
int get_edited_column() const;
void ensure_cursor_is_visible();
2016-03-08 23:00:52 +00:00
2014-02-10 01:10:30 +00:00
Rect2 get_custom_popup_rect() const;
int get_item_offset(TreeItem *p_item) const;
Rect2 get_item_rect(TreeItem *p_item, int p_column = -1) const;
2014-02-10 01:10:30 +00:00
bool edit_selected();
// First item that starts with the text, from the current focused item down and wraps around.
2020-04-01 23:20:12 +00:00
TreeItem *search_item_text(const String &p_find, int *r_col = nullptr, bool p_selectable = false);
// First item that matches the whole text, from the first item down.
TreeItem *get_item_with_text(const String &p_find) const;
2014-02-10 01:10:30 +00:00
Point2 get_scroll() const;
void scroll_to_item(TreeItem *p_item);
2014-02-10 01:10:30 +00:00
void set_cursor_can_exit_tree(bool p_enable);
VScrollBar *get_vscroll_bar() { return v_scroll; }
2015-11-13 23:56:44 +00:00
void set_hide_folding(bool p_hide);
bool is_folding_hidden() const;
void set_drop_mode_flags(int p_flags);
int get_drop_mode_flags() const;
void set_edit_checkbox_cell_only_when_checkbox_is_pressed(bool p_enable);
bool get_edit_checkbox_cell_only_when_checkbox_is_pressed() const;
void set_allow_rmb_select(bool p_allow);
bool get_allow_rmb_select() const;
void set_allow_reselect(bool p_allow);
bool get_allow_reselect() const;
2014-02-10 01:10:30 +00:00
Tree();
2016-03-08 23:00:52 +00:00
~Tree();
2014-02-10 01:10:30 +00:00
};
VARIANT_ENUM_CAST(Tree::SelectMode);
VARIANT_ENUM_CAST(Tree::DropModeFlags);
2014-02-10 01:10:30 +00:00
#endif