TogglePopup() public method

If a popup is showing, then close it; otherwise, open it.
public TogglePopup ( GObject popup ) : void
popup GObject
return void
Example #1
0
        private void __mousedown()
        {
            _down = true;
            Stage.inst.onMouseUp.Add(__mouseup);

            if (_mode == ButtonMode.Common)
            {
                SetState(DOWN);
            }

            if (linkedPopup != null)
            {
                if (linkedPopup is Window)
                {
                    ((Window)linkedPopup).ToggleStatus();
                }
                else
                {
                    GRoot r = this.root;
                    if (r != null)
                    {
                        r.TogglePopup(linkedPopup, this);
                    }
                }
            }
        }
        protected void ShowDropdown()
        {
            if (_itemsUpdated)
            {
                _itemsUpdated = false;

                _list.RemoveChildrenToPool();
                int cnt = _items.Length;
                for (int i = 0; i < cnt; i++)
                {
                    GObject item = _list.AddItemFromPool();
                    item.text = _items[i];
                    item.name = i < _values.Length ? _values[i] : string.Empty;
                }
                _list.ResizeToFit(visibleItemCount);
            }
            _list.selectedIndex   = -1;
            _dropdownObject.width = this.width;

            GRoot r = this.root;

            if (r != null)
            {
                r.TogglePopup(_dropdownObject, this, true);
            }
            if (_dropdownObject.parent != null)
            {
                _dropdownObject.displayObject.onRemovedFromStage.Add(__popupWinClosed);
                SetState(GButton.DOWN);
            }
        }
Example #3
0
    static int TogglePopup(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2)
            {
                FairyGUI.GRoot   obj  = (FairyGUI.GRoot)ToLua.CheckObject <FairyGUI.GRoot>(L, 1);
                FairyGUI.GObject arg0 = (FairyGUI.GObject)ToLua.CheckObject <FairyGUI.GObject>(L, 2);
                obj.TogglePopup(arg0);
                return(0);
            }
            else if (count == 3)
            {
                FairyGUI.GRoot   obj  = (FairyGUI.GRoot)ToLua.CheckObject <FairyGUI.GRoot>(L, 1);
                FairyGUI.GObject arg0 = (FairyGUI.GObject)ToLua.CheckObject <FairyGUI.GObject>(L, 2);
                FairyGUI.GObject arg1 = (FairyGUI.GObject)ToLua.CheckObject <FairyGUI.GObject>(L, 3);
                obj.TogglePopup(arg0, arg1);
                return(0);
            }
            else if (count == 4)
            {
                FairyGUI.GRoot          obj  = (FairyGUI.GRoot)ToLua.CheckObject <FairyGUI.GRoot>(L, 1);
                FairyGUI.GObject        arg0 = (FairyGUI.GObject)ToLua.CheckObject <FairyGUI.GObject>(L, 2);
                FairyGUI.GObject        arg1 = (FairyGUI.GObject)ToLua.CheckObject <FairyGUI.GObject>(L, 3);
                FairyGUI.PopupDirection arg2 = (FairyGUI.PopupDirection)ToLua.CheckObject(L, 4, typeof(FairyGUI.PopupDirection));
                obj.TogglePopup(arg0, arg1, arg2);
                return(0);
            }
            else if (count == 5)
            {
                FairyGUI.GRoot          obj  = (FairyGUI.GRoot)ToLua.CheckObject <FairyGUI.GRoot>(L, 1);
                FairyGUI.GObject        arg0 = (FairyGUI.GObject)ToLua.CheckObject <FairyGUI.GObject>(L, 2);
                FairyGUI.GObject        arg1 = (FairyGUI.GObject)ToLua.CheckObject <FairyGUI.GObject>(L, 3);
                FairyGUI.PopupDirection arg2 = (FairyGUI.PopupDirection)ToLua.CheckObject(L, 4, typeof(FairyGUI.PopupDirection));
                bool arg3 = LuaDLL.luaL_checkboolean(L, 5);
                obj.TogglePopup(arg0, arg1, arg2, arg3);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: FairyGUI.GRoot.TogglePopup"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
 static public int TogglePopup(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 2)
         {
             FairyGUI.GRoot   self = (FairyGUI.GRoot)checkSelf(l);
             FairyGUI.GObject a1;
             checkType(l, 2, out a1);
             self.TogglePopup(a1);
             pushValue(l, true);
             return(1);
         }
         else if (argc == 3)
         {
             FairyGUI.GRoot   self = (FairyGUI.GRoot)checkSelf(l);
             FairyGUI.GObject a1;
             checkType(l, 2, out a1);
             FairyGUI.GObject a2;
             checkType(l, 3, out a2);
             self.TogglePopup(a1, a2);
             pushValue(l, true);
             return(1);
         }
         else if (argc == 4)
         {
             FairyGUI.GRoot   self = (FairyGUI.GRoot)checkSelf(l);
             FairyGUI.GObject a1;
             checkType(l, 2, out a1);
             FairyGUI.GObject a2;
             checkType(l, 3, out a2);
             System.Object a3;
             checkType(l, 4, out a3);
             self.TogglePopup(a1, a2, a3);
             pushValue(l, true);
             return(1);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #5
0
    static int TogglePopup(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(FairyGUI.GRoot), typeof(FairyGUI.GObject)))
            {
                FairyGUI.GRoot   obj  = (FairyGUI.GRoot)ToLua.ToObject(L, 1);
                FairyGUI.GObject arg0 = (FairyGUI.GObject)ToLua.ToObject(L, 2);
                obj.TogglePopup(arg0);
                return(0);
            }
            else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(FairyGUI.GRoot), typeof(FairyGUI.GObject), typeof(FairyGUI.GObject)))
            {
                FairyGUI.GRoot   obj  = (FairyGUI.GRoot)ToLua.ToObject(L, 1);
                FairyGUI.GObject arg0 = (FairyGUI.GObject)ToLua.ToObject(L, 2);
                FairyGUI.GObject arg1 = (FairyGUI.GObject)ToLua.ToObject(L, 3);
                obj.TogglePopup(arg0, arg1);
                return(0);
            }
            else if (count == 4 && TypeChecker.CheckTypes(L, 1, typeof(FairyGUI.GRoot), typeof(FairyGUI.GObject), typeof(FairyGUI.GObject), typeof(object)))
            {
                FairyGUI.GRoot   obj  = (FairyGUI.GRoot)ToLua.ToObject(L, 1);
                FairyGUI.GObject arg0 = (FairyGUI.GObject)ToLua.ToObject(L, 2);
                FairyGUI.GObject arg1 = (FairyGUI.GObject)ToLua.ToObject(L, 3);
                object           arg2 = ToLua.ToVarObject(L, 4);
                obj.TogglePopup(arg0, arg1, arg2);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: FairyGUI.GRoot.TogglePopup"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }