diff options
Diffstat (limited to 'scene/gui/tree.h')
-rw-r--r-- | scene/gui/tree.h | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/scene/gui/tree.h b/scene/gui/tree.h index e5c95b4d66..421cfc47bc 100644 --- a/scene/gui/tree.h +++ b/scene/gui/tree.h @@ -46,22 +46,22 @@ class TreeItem : public Object { OBJ_TYPE(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 a 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; Ref<Texture> icon; @@ -92,9 +92,9 @@ friend class Tree; }; Vector< Button > buttons; - + Cell() { - + custom_draw_obj=0; mode=TreeItem::CELL_MODE_STRING; min=0; @@ -116,30 +116,30 @@ friend class Tree; void draw_icon(const RID& p_where, const Point2& p_pos, const Size2& p_size=Size2()) const; }; - + Vector<Cell> cells; - + bool collapsed; // wont show childs - + TreeItem *parent; // parent item TreeItem *next; // next in list TreeItem *childs; //child items Tree *tree; //tree (for reference) - + TreeItem(Tree *p_tree); - + void _changed_notify(int p_cell); void _changed_notify(); void _cell_selected(int p_cell); void _cell_deselected(int p_cell); protected: - + static void _bind_methods(); //bind helpers - Dictionary _get_range_config( int p_column ) { + Dictionary _get_range_config( int p_column ) { Dictionary d; double min,max,step; get_range_config(p_column,min,max,step); @@ -152,18 +152,18 @@ protected: } void _remove_child(Object *p_child) { remove_child( p_child->cast_to<TreeItem>() ); } public: - + /* cell mode */ void set_cell_mode( int p_column, TreeCellMode p_mode ); TreeCellMode get_cell_mode( int p_column ) const; - + /* check mode */ void set_checked(int p_column,bool p_checked); bool is_checked(int p_column) const; - + void set_text(int p_column,String p_text); String get_text(int p_column) const; - + void set_icon(int p_column,const Ref<Texture>& p_icon); Ref<Texture> get_icon(int p_column) const; @@ -183,22 +183,22 @@ public: void set_button(int p_column,int p_idx,const Ref<Texture>& p_button); /* range works for mode number or mode combo */ - + void set_range(int p_column,double p_value); double get_range(int p_column) const; - + 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; bool is_range_exponential(int p_column) const; - + void set_metadata(int p_column,const Variant& p_meta); Variant get_metadata(int p_column) const; - + void set_custom_draw(int p_column,Object *p_object,const StringName& p_callback); - + void set_collapsed(bool p_collapsed); bool is_collapsed(); - + TreeItem *get_prev(); TreeItem *get_next(); TreeItem *get_parent(); @@ -206,20 +206,20 @@ public: TreeItem *get_prev_visible(); TreeItem *get_next_visible(); - + void remove_child(TreeItem *p_item); - + void set_selectable(int p_column,bool p_selectable); bool is_selectable(int p_column) const; - + bool is_selected(int p_column); void select(int p_column); void deselect(int p_column); void set_as_cursor(int p_column); - + void set_editable(int p_column,bool p_editable); bool is_editable(int p_column); - + void set_custom_color(int p_column,const Color& p_color); void clear_custom_color(int p_column); @@ -237,7 +237,7 @@ public: void move_to_bottom(); ~TreeItem(); - + }; @@ -245,18 +245,18 @@ VARIANT_ENUM_CAST( TreeItem::TreeCellMode ); class Tree : public Control { - + OBJ_TYPE( Tree, Control ); -public: +public: enum SelectMode { SELECT_SINGLE, SELECT_ROW, SELECT_MULTI }; - -private: -friend class TreeItem; - + +private: +friend class TreeItem; + TreeItem *root; TreeItem *popup_edited_item; TreeItem *selected_item; @@ -287,7 +287,7 @@ friend class TreeItem; int blocked; struct ColumnInfo { - + int min_width; bool expand; String title; @@ -320,21 +320,21 @@ friend class TreeItem; void value_editor_changed(double p_value); void popup_select(int p_option); - + void _input_event(InputEvent p_event); void _notification(int p_what); - + Size2 get_minimum_size() const; - + void item_edited(int p_column,TreeItem *p_item); 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); - + void propagate_set_columns(TreeItem *p_item); - + struct Cache { - + Ref<Font> font; Ref<Font> tb_font; Ref<StyleBox> bg; @@ -354,14 +354,14 @@ friend class TreeItem; Ref<Texture> arrow; Ref<Texture> select_arrow; Ref<Texture> updown; - + Color font_color; Color font_color_selected; Color guide_color; int hseparation; int vseparation; int item_margin; - int guide_width; + int guide_width; int button_margin; Point2 offset; @@ -381,14 +381,14 @@ friend class TreeItem; int hover_index; } cache; - - + + int _get_title_button_height() const; void _scroll_moved(float p_value); HScrollBar *h_scroll; VScrollBar *v_scroll; - + Size2 get_internal_min_size() const; void update_cache(); void update_scrollbars(); @@ -423,10 +423,10 @@ friend class TreeItem; protected: static void _bind_methods(); - + //bind helpers Object* _create_item(Object *p_parent) { return create_item(p_parent->cast_to<TreeItem>() ); } - TreeItem *_get_next_selected(Object *p_item) { return get_next_selected(p_item->cast_to<TreeItem>() ); } + TreeItem *_get_next_selected(Object *p_item) { return get_next_selected(p_item->cast_to<TreeItem>() ); } Rect2 _get_item_rect(Object *p_item,int p_column) const { return get_item_rect(p_item->cast_to<TreeItem>(),p_column ); } public: @@ -434,21 +434,21 @@ public: void clear(); - TreeItem* create_item(TreeItem *p_parent=0); + TreeItem* create_item(TreeItem *p_parent=0); TreeItem* get_root(); TreeItem* get_last_item(); void set_column_min_width(int p_column,int p_min_width); - void set_column_expand(int p_column,bool p_expand); + void set_column_expand(int p_column,bool p_expand); int get_column_width(int p_column) const; - + void set_hide_root(bool p_eanbled); TreeItem *get_next_selected( TreeItem* p_item); TreeItem *get_selected() const; int get_selected_column() const; int get_pressed_button() const; void set_select_mode(SelectMode p_mode); - + void set_columns(int p_columns); int get_columns() const; @@ -462,11 +462,11 @@ public: int get_edited_column() const; void ensure_cursor_is_visible(); - + 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; + Rect2 get_item_rect(TreeItem *p_item,int p_column=-1) const; bool edit_selected(); TreeItem* search_item_text(const String& p_find,int *r_col=NULL,bool p_selectable=false); @@ -484,7 +484,7 @@ public: Tree(); - ~Tree(); + ~Tree(); }; |