summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-01-17 20:03:57 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-01-17 20:03:57 -0300
commit74a48a0140262ebd3a818a75b7d102cf0fe2eeae (patch)
tree6789b64b2df5bbf81d519a4d4d70d1e9f0c35655 /scene/gui
parent72fcb8a35beab251d01864bc67da3e3a8e75aed6 (diff)
-Massive editor dialog cleanup
-Added a bottom menu list
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/control.cpp2
-rw-r--r--scene/gui/split_container.cpp33
-rw-r--r--scene/gui/split_container.h15
3 files changed, 30 insertions, 20 deletions
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index c7b4c1f6c1..1af3f4c9e8 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -387,7 +387,7 @@ void Control::_notification(int p_notification) {
data.parent_canvas_item->disconnect("item_rect_changed",this,"_size_changed");
data.parent_canvas_item=NULL;
- } else {
+ } else if (!is_set_as_toplevel()) {
//disconnect viewport
get_viewport()->disconnect("size_changed",this,"_size_changed");
diff --git a/scene/gui/split_container.cpp b/scene/gui/split_container.cpp
index b0d089fcf3..d22f6a0229 100644
--- a/scene/gui/split_container.cpp
+++ b/scene/gui/split_container.cpp
@@ -109,7 +109,7 @@ void SplitContainer::_resort() {
int sep=get_constant("separation");
Ref<Texture> g = get_icon("grabber");
- if (collapsed || !dragger_visible) {
+ if (dragger_visibility==DRAGGER_HIDDEN_COLLAPSED) {
sep=0;
} else {
sep=MAX(sep,vertical?g->get_height():g->get_width());
@@ -221,7 +221,7 @@ Size2 SplitContainer::get_minimum_size() const {
Size2i minimum;
int sep=get_constant("separation");
Ref<Texture> g = get_icon("grabber");
- sep=dragger_visible?MAX(sep,vertical?g->get_height():g->get_width()):0;
+ sep=(dragger_visibility!=DRAGGER_HIDDEN_COLLAPSED)?MAX(sep,vertical?g->get_height():g->get_width()):0;
for(int i=0;i<2;i++) {
@@ -278,19 +278,19 @@ void SplitContainer::_notification(int p_what) {
if (collapsed || (!mouse_inside && get_constant("autohide")))
return;
- int sep=dragger_visible?get_constant("separation"):0;
+ int sep=dragger_visibility!=DRAGGER_HIDDEN_COLLAPSED?get_constant("separation"):0;
Ref<Texture> tex = get_icon("grabber");
Size2 size=get_size();
if (vertical) {
//draw_style_box( get_stylebox("bg"), Rect2(0,middle_sep,get_size().width,sep));
- if (dragger_visible)
+ if (dragger_visibility==DRAGGER_VISIBLE)
draw_texture(tex,Point2i((size.x-tex->get_width())/2,middle_sep+(sep-tex->get_height())/2));
} else {
//draw_style_box( get_stylebox("bg"), Rect2(middle_sep,0,sep,get_size().height));
- if (dragger_visible)
+ if (dragger_visibility==DRAGGER_VISIBLE)
draw_texture(tex,Point2i(middle_sep+(sep-tex->get_width())/2,(size.y-tex->get_height())/2));
}
@@ -301,7 +301,7 @@ void SplitContainer::_notification(int p_what) {
void SplitContainer::_input_event(const InputEvent& p_event) {
- if (collapsed || !_getch(0) || !_getch(1) || !dragger_visible)
+ if (collapsed || !_getch(0) || !_getch(1) || dragger_visibility!=DRAGGER_VISIBLE)
return;
if (p_event.type==InputEvent::MOUSE_BUTTON) {
@@ -400,19 +400,19 @@ void SplitContainer::set_collapsed(bool p_collapsed) {
}
-void SplitContainer::set_dragger_visible(bool p_true) {
+void SplitContainer::set_dragger_visibility(DraggerVisibility p_visibility) {
- dragger_visible=p_true;
+ dragger_visibility=p_visibility;
queue_sort();
update();
}
-bool SplitContainer::is_dragger_visible() const{
+SplitContainer::DraggerVisibility SplitContainer::get_dragger_visibility() const {
-
- return dragger_visible;
+ return dragger_visibility;
}
+
bool SplitContainer::is_collapsed() const {
@@ -429,15 +429,18 @@ void SplitContainer::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_collapsed","collapsed"),&SplitContainer::set_collapsed);
ObjectTypeDB::bind_method(_MD("is_collapsed"),&SplitContainer::is_collapsed);
- ObjectTypeDB::bind_method(_MD("set_dragger_visible","visible"),&SplitContainer::set_dragger_visible);
- ObjectTypeDB::bind_method(_MD("is_dragger_visible"),&SplitContainer::is_dragger_visible);
+ ObjectTypeDB::bind_method(_MD("set_dragger_visibility","mode"),&SplitContainer::set_dragger_visibility);
+ ObjectTypeDB::bind_method(_MD("get_dragger_visibility"),&SplitContainer::get_dragger_visibility);
ADD_SIGNAL( MethodInfo("dragged",PropertyInfo(Variant::INT,"offset")));
ADD_PROPERTY( PropertyInfo(Variant::INT,"split/offset"),_SCS("set_split_offset"),_SCS("get_split_offset"));
ADD_PROPERTY( PropertyInfo(Variant::BOOL,"split/collapsed"),_SCS("set_collapsed"),_SCS("is_collapsed"));
- ADD_PROPERTY( PropertyInfo(Variant::BOOL,"split/dragger_visible"),_SCS("set_dragger_visible"),_SCS("is_dragger_visible"));
+ ADD_PROPERTY( PropertyInfo(Variant::INT,"split/dragger_visibility",PROPERTY_HINT_ENUM,"Visible,Hidden,Hidden & Collapsed"),_SCS("set_dragger_visibility"),_SCS("get_dragger_visibility"));
+ BIND_CONSTANT( DRAGGER_VISIBLE );
+ BIND_CONSTANT( DRAGGER_HIDDEN );
+ BIND_CONSTANT( DRAGGER_HIDDEN_COLLAPSED );
}
@@ -450,7 +453,7 @@ SplitContainer::SplitContainer(bool p_vertical) {
vertical=p_vertical;
dragging=false;
collapsed=false;
- dragger_visible=true;
+ dragger_visibility=DRAGGER_VISIBLE;
}
diff --git a/scene/gui/split_container.h b/scene/gui/split_container.h
index c8cfa3d69b..f721d16310 100644
--- a/scene/gui/split_container.h
+++ b/scene/gui/split_container.h
@@ -35,7 +35,13 @@
class SplitContainer : public Container {
OBJ_TYPE(SplitContainer,Container);
-
+public:
+ enum DraggerVisibility {
+ DRAGGER_VISIBLE,
+ DRAGGER_HIDDEN,
+ DRAGGER_HIDDEN_COLLAPSED
+ };
+private:
bool vertical;
int expand_ofs;
int middle_sep;
@@ -43,7 +49,7 @@ class SplitContainer : public Container {
int drag_from;
int drag_ofs;
bool collapsed;
- bool dragger_visible;
+ DraggerVisibility dragger_visibility;
bool mouse_inside;
@@ -66,8 +72,8 @@ public:
void set_collapsed(bool p_collapsed);
bool is_collapsed() const;
- void set_dragger_visible(bool p_true);
- bool is_dragger_visible() const;
+ void set_dragger_visibility(DraggerVisibility p_visibility);
+ DraggerVisibility get_dragger_visibility() const;
virtual CursorShape get_cursor_shape(const Point2& p_pos=Point2i());
@@ -76,6 +82,7 @@ public:
SplitContainer(bool p_vertical=false);
};
+VARIANT_ENUM_CAST(SplitContainer::DraggerVisibility);
class HSplitContainer : public SplitContainer {