You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-11 13:10:58 +00:00
make popup emit index when id is not defined
This commit is contained in:
@@ -495,9 +495,6 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
|
|||||||
VCALL_LOCALMEM2(ByteArray,set);
|
VCALL_LOCALMEM2(ByteArray,set);
|
||||||
VCALL_LOCALMEM1R(ByteArray,get);
|
VCALL_LOCALMEM1R(ByteArray,get);
|
||||||
VCALL_LOCALMEM1(ByteArray,push_back);
|
VCALL_LOCALMEM1(ByteArray,push_back);
|
||||||
VCALL_LOCALMEM1(ByteArray,push_front);
|
|
||||||
VCALL_LOCALMEM0(ByteArray,pop_back);
|
|
||||||
VCALL_LOCALMEM0(ByteArray,pop_front);
|
|
||||||
VCALL_LOCALMEM1(ByteArray,resize);
|
VCALL_LOCALMEM1(ByteArray,resize);
|
||||||
VCALL_LOCALMEM1(ByteArray,append);
|
VCALL_LOCALMEM1(ByteArray,append);
|
||||||
VCALL_LOCALMEM1(ByteArray,append_array);
|
VCALL_LOCALMEM1(ByteArray,append_array);
|
||||||
@@ -1432,12 +1429,15 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
|
|||||||
ADDFUNC0(ARRAY,NIL,Array,clear,varray());
|
ADDFUNC0(ARRAY,NIL,Array,clear,varray());
|
||||||
ADDFUNC0(ARRAY,INT,Array,hash,varray());
|
ADDFUNC0(ARRAY,INT,Array,hash,varray());
|
||||||
ADDFUNC1(ARRAY,NIL,Array,push_back,NIL,"value",varray());
|
ADDFUNC1(ARRAY,NIL,Array,push_back,NIL,"value",varray());
|
||||||
|
ADDFUNC1(ARRAY,NIL,Array,push_front,NIL,"value",varray());
|
||||||
ADDFUNC1(ARRAY,NIL,Array,append,NIL,"value",varray());
|
ADDFUNC1(ARRAY,NIL,Array,append,NIL,"value",varray());
|
||||||
ADDFUNC1(ARRAY,NIL,Array,resize,INT,"pos",varray());
|
ADDFUNC1(ARRAY,NIL,Array,resize,INT,"pos",varray());
|
||||||
ADDFUNC2(ARRAY,NIL,Array,insert,INT,"pos",NIL,"value",varray());
|
ADDFUNC2(ARRAY,NIL,Array,insert,INT,"pos",NIL,"value",varray());
|
||||||
ADDFUNC1(ARRAY,NIL,Array,remove,INT,"pos",varray());
|
ADDFUNC1(ARRAY,NIL,Array,remove,INT,"pos",varray());
|
||||||
ADDFUNC1(ARRAY,NIL,Array,erase,NIL,"value",varray());
|
ADDFUNC1(ARRAY,NIL,Array,erase,NIL,"value",varray());
|
||||||
ADDFUNC1(ARRAY,INT,Array,find,NIL,"value",varray());
|
ADDFUNC1(ARRAY,INT,Array,find,NIL,"value",varray());
|
||||||
|
ADDFUNC0(ARRAY,NIL,Array,pop_back,varray());
|
||||||
|
ADDFUNC0(ARRAY,NIL,Array,pop_front,varray());
|
||||||
ADDFUNC0(ARRAY,NIL,Array,sort,varray());
|
ADDFUNC0(ARRAY,NIL,Array,sort,varray());
|
||||||
ADDFUNC2(ARRAY,NIL,Array,sort_custom,OBJECT,"obj",STRING,"func",varray());
|
ADDFUNC2(ARRAY,NIL,Array,sort_custom,OBJECT,"obj",STRING,"func",varray());
|
||||||
ADDFUNC0(ARRAY,NIL,Array,invert,varray());
|
ADDFUNC0(ARRAY,NIL,Array,invert,varray());
|
||||||
|
|||||||
@@ -524,7 +524,7 @@ void PopupMenu::add_icon_item(const Ref<Texture>& p_icon,const String& p_label,i
|
|||||||
item.icon=p_icon;
|
item.icon=p_icon;
|
||||||
item.text=p_label;
|
item.text=p_label;
|
||||||
item.accel=p_accel;
|
item.accel=p_accel;
|
||||||
item.ID=(p_ID<0)?idcount++:p_ID;
|
item.ID=p_ID;
|
||||||
items.push_back(item);
|
items.push_back(item);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
@@ -533,7 +533,7 @@ void PopupMenu::add_item(const String& p_label,int p_ID,uint32_t p_accel) {
|
|||||||
Item item;
|
Item item;
|
||||||
item.text=XL_MESSAGE(p_label);
|
item.text=XL_MESSAGE(p_label);
|
||||||
item.accel=p_accel;
|
item.accel=p_accel;
|
||||||
item.ID=(p_ID<0)?idcount++:p_ID;
|
item.ID=p_ID;
|
||||||
items.push_back(item);
|
items.push_back(item);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
@@ -542,7 +542,7 @@ void PopupMenu::add_submenu_item(const String& p_label, const String& p_submenu,
|
|||||||
|
|
||||||
Item item;
|
Item item;
|
||||||
item.text=XL_MESSAGE(p_label);
|
item.text=XL_MESSAGE(p_label);
|
||||||
item.ID=(p_ID<0)?idcount++:p_ID;
|
item.ID=p_ID;
|
||||||
item.submenu=p_submenu;
|
item.submenu=p_submenu;
|
||||||
items.push_back(item);
|
items.push_back(item);
|
||||||
update();
|
update();
|
||||||
@@ -554,7 +554,7 @@ void PopupMenu::add_icon_check_item(const Ref<Texture>& p_icon,const String& p_l
|
|||||||
item.icon=p_icon;
|
item.icon=p_icon;
|
||||||
item.text=XL_MESSAGE(p_label);
|
item.text=XL_MESSAGE(p_label);
|
||||||
item.accel=p_accel;
|
item.accel=p_accel;
|
||||||
item.ID=(p_ID<0)?idcount++:p_ID;
|
item.ID=p_ID;
|
||||||
item.checkable=true;
|
item.checkable=true;
|
||||||
items.push_back(item);
|
items.push_back(item);
|
||||||
update();
|
update();
|
||||||
@@ -564,7 +564,7 @@ void PopupMenu::add_check_item(const String& p_label,int p_ID,uint32_t p_accel)
|
|||||||
Item item;
|
Item item;
|
||||||
item.text=XL_MESSAGE(p_label);
|
item.text=XL_MESSAGE(p_label);
|
||||||
item.accel=p_accel;
|
item.accel=p_accel;
|
||||||
item.ID=(p_ID<0)?idcount++:p_ID;
|
item.ID=p_ID;
|
||||||
item.checkable=true;
|
item.checkable=true;
|
||||||
items.push_back(item);
|
items.push_back(item);
|
||||||
update();
|
update();
|
||||||
@@ -755,7 +755,8 @@ void PopupMenu::activate_item(int p_item) {
|
|||||||
|
|
||||||
ERR_FAIL_INDEX(p_item,items.size());
|
ERR_FAIL_INDEX(p_item,items.size());
|
||||||
ERR_FAIL_COND(items[p_item].separator);
|
ERR_FAIL_COND(items[p_item].separator);
|
||||||
emit_signal("item_pressed",items[p_item].ID);
|
int id = items[p_item].ID>=0?items[p_item].ID:p_item;
|
||||||
|
emit_signal("item_pressed",id);
|
||||||
|
|
||||||
//hide all parent PopupMenue's
|
//hide all parent PopupMenue's
|
||||||
Node *next = get_parent();
|
Node *next = get_parent();
|
||||||
@@ -789,7 +790,7 @@ void PopupMenu::clear() {
|
|||||||
items.clear();
|
items.clear();
|
||||||
mouse_over=-1;
|
mouse_over=-1;
|
||||||
update();
|
update();
|
||||||
idcount=0;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -937,7 +938,7 @@ void PopupMenu::set_invalidate_click_until_motion() {
|
|||||||
|
|
||||||
PopupMenu::PopupMenu() {
|
PopupMenu::PopupMenu() {
|
||||||
|
|
||||||
idcount=0;
|
|
||||||
mouse_over=-1;
|
mouse_over=-1;
|
||||||
|
|
||||||
set_focus_mode(FOCUS_ALL);
|
set_focus_mode(FOCUS_ALL);
|
||||||
|
|||||||
@@ -59,7 +59,6 @@ class PopupMenu : public Popup {
|
|||||||
Timer *submenu_timer;
|
Timer *submenu_timer;
|
||||||
List<Rect2> autohide_areas;
|
List<Rect2> autohide_areas;
|
||||||
Vector<Item> items;
|
Vector<Item> items;
|
||||||
int idcount;
|
|
||||||
int mouse_over;
|
int mouse_over;
|
||||||
int submenu_over;
|
int submenu_over;
|
||||||
Rect2 parent_rect;
|
Rect2 parent_rect;
|
||||||
|
|||||||
Reference in New Issue
Block a user