summaryrefslogtreecommitdiffstats
path: root/scene/gui/tree.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-11-13 20:56:44 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-11-13 20:56:44 -0300
commit8420c24f7f35cdd7adbc7d4595cb1756020ab127 (patch)
treed7d0bf1e59c92d1f743b4600266335eca8549f66 /scene/gui/tree.cpp
parent1d7e9c4ba52250db3b0b0fd732e44074252045d2 (diff)
downloadredot-engine-8420c24f7f35cdd7adbc7d4595cb1756020ab127.tar.gz
-better integration of ndee's theme
Diffstat (limited to 'scene/gui/tree.cpp')
-rw-r--r--scene/gui/tree.cpp28
1 files changed, 24 insertions, 4 deletions
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 5df6f2ced9..a27918cf52 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -962,7 +962,9 @@ int Tree::draw_item(const Point2i& p_pos,const Point2& p_draw_ofs, const Size2&
Point2i guide_space=Point2i( cache.guide_width , height );
- if (p_item->childs) { //has childs, draw the guide box
+
+
+ if (!hide_folding && p_item->childs) { //has childs, draw the guide box
Ref<Texture> arrow;
@@ -986,7 +988,7 @@ int Tree::draw_item(const Point2i& p_pos,const Point2& p_draw_ofs, const Size2&
int font_ascent=font->get_ascent();
- int ofs = p_pos.x + cache.item_margin;
+ int ofs = p_pos.x + (hide_folding?cache.hseparation:cache.item_margin);
for (int i=0;i<columns.size();i++) {
int w = get_column_width(i);
@@ -1062,7 +1064,10 @@ int Tree::draw_item(const Point2i& p_pos,const Point2& p_draw_ofs, const Size2&
if (p_item->cells[i].custom_bg_color) {
- VisualServer::get_singleton()->canvas_item_add_rect(ci,cell_rect,p_item->cells[i].bg_color);
+ Rect2 r=cell_rect;
+ r.pos.x-=cache.hseparation;
+ r.size.x+=cache.hseparation;
+ VisualServer::get_singleton()->canvas_item_add_rect(ci,r,p_item->cells[i].bg_color);
}
Color col=p_item->cells[i].custom_color?p_item->cells[i].color:get_color( p_item->cells[i].selected?"font_color_selected":"font_color");
@@ -1376,7 +1381,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos,int x_ofs,int y_ofs,bool p_
if (!skip && p_pos.y<item_h) {
// check event!
- if (p_pos.x >=x_ofs && p_pos.x < (x_ofs+cache.item_margin) ) {
+ if (!hide_folding && (p_pos.x >=x_ofs && p_pos.x < (x_ofs+cache.item_margin) )) {
if (p_item->childs)
@@ -3114,6 +3119,16 @@ bool Tree::can_cursor_exit_tree() const {
return cursor_can_exit_tree;
}
+void Tree::set_hide_folding(bool p_hide) {
+ hide_folding=p_hide;
+ update();
+}
+
+bool Tree::is_folding_hidden() const {
+
+ return hide_folding;
+}
+
void Tree::_bind_methods() {
@@ -3155,6 +3170,9 @@ void Tree::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_column_title","column"),&Tree::get_column_title);
ObjectTypeDB::bind_method(_MD("get_scroll"),&Tree::get_scroll);
+ ObjectTypeDB::bind_method(_MD("set_hide_folding","hide"),&Tree::set_hide_folding);
+ ObjectTypeDB::bind_method(_MD("is_folding_hidden"),&Tree::is_folding_hidden);
+
ADD_SIGNAL( MethodInfo("item_selected"));
ADD_SIGNAL( MethodInfo("cell_selected"));
@@ -3242,6 +3260,8 @@ Tree::Tree() {
pressing_for_editor=false;
range_drag_enabled=false;
+ hide_folding=false;
+
}