diff options
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/dialogs.cpp | 4 | ||||
-rw-r--r-- | scene/gui/popup_menu.cpp | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index 0c0f924f52..efda8a66e1 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -308,7 +308,9 @@ void AcceptDialog::_bind_methods() { ADD_SIGNAL( MethodInfo("confirmed") ); ADD_SIGNAL( MethodInfo("custom_action",PropertyInfo(Variant::STRING,"action")) ); - + ADD_PROPERTYNZ( PropertyInfo(Variant::STRING,"dialog/text",PROPERTY_HINT_MULTILINE_TEXT,"",PROPERTY_USAGE_DEFAULT_INTL),_SCS("set_text"),_SCS("get_text")); + ADD_PROPERTY( PropertyInfo(Variant::BOOL, "dialog/hide_on_ok"),_SCS("set_hide_on_ok"),_SCS("get_hide_on_ok") ); + } diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index 99663fb2e2..20f28ecf10 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -170,7 +170,14 @@ void PopupMenu::_activate_submenu(int over) { Point2 p = get_global_pos(); Rect2 pr(p,get_size()); Ref<StyleBox> style = get_stylebox("panel"); - pm->set_pos(p+Point2(get_size().width,items[over]._ofs_cache-style->get_offset().y)); + + Point2 pos = p+Point2(get_size().width,items[over]._ofs_cache-style->get_offset().y); + Size2 size = pm->get_size(); + // fix pos + if (pos.x+size.width > get_viewport_rect().size.width) + pos.x=p.x-size.width; + + pm->set_pos(pos); pm->popup(); PopupMenu *pum = pm->cast_to<PopupMenu>(); |