ResizeToFit() public method

Resize to list size to fit specified item count. If list layout is single column or flow horizontally, the height will change to fit. If list layout is single row or flow vertically, the width will change to fit.
public ResizeToFit ( int itemCount ) : void
itemCount int Item count
return void
示例#1
0
 static public int ResizeToFit(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 2)
         {
             FairyGUI.GList self = (FairyGUI.GList)checkSelf(l);
             System.Int32   a1;
             checkType(l, 2, out a1);
             self.ResizeToFit(a1);
             pushValue(l, true);
             return(1);
         }
         else if (argc == 3)
         {
             FairyGUI.GList self = (FairyGUI.GList)checkSelf(l);
             System.Int32   a1;
             checkType(l, 2, out a1);
             System.Int32 a2;
             checkType(l, 3, out a2);
             self.ResizeToFit(a1, a2);
             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));
     }
 }
    static int ResizeToFit(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(FairyGUI.GList), typeof(int)))
            {
                FairyGUI.GList obj  = (FairyGUI.GList)ToLua.ToObject(L, 1);
                int            arg0 = (int)LuaDLL.lua_tonumber(L, 2);
                obj.ResizeToFit(arg0);
                return(0);
            }
            else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(FairyGUI.GList), typeof(int), typeof(int)))
            {
                FairyGUI.GList obj  = (FairyGUI.GList)ToLua.ToObject(L, 1);
                int            arg0 = (int)LuaDLL.lua_tonumber(L, 2);
                int            arg1 = (int)LuaDLL.lua_tonumber(L, 3);
                obj.ResizeToFit(arg0, arg1);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: FairyGUI.GList.ResizeToFit"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
示例#3
0
    static int ResizeToFit(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2)
            {
                FairyGUI.GList obj  = (FairyGUI.GList)ToLua.CheckObject <FairyGUI.GList>(L, 1);
                int            arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
                obj.ResizeToFit(arg0);
                return(0);
            }
            else if (count == 3)
            {
                FairyGUI.GList obj  = (FairyGUI.GList)ToLua.CheckObject <FairyGUI.GList>(L, 1);
                int            arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
                int            arg1 = (int)LuaDLL.luaL_checknumber(L, 3);
                obj.ResizeToFit(arg0, arg1);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: FairyGUI.GList.ResizeToFit"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
示例#4
0
        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);
            }
        }
示例#5
0
 public void UpdateDropdownList()
 {
     if (_itemsUpdated)
     {
         _itemsUpdated = false;
         RenderDropdownList();
         _list.ResizeToFit(visibleItemCount);
     }
 }
        protected void ShowDropdown()
        {
            if (_itemsUpdated)
            {
                _itemsUpdated = false;
                RenderDropdownList();
                _list.ResizeToFit(visibleItemCount);
            }
            _list.selectedIndex = -1;
            dropdown.width      = this.width;

            this.root.TogglePopup(dropdown, this, _popupDirection == "up" ? (object)false : (_popupDirection == "auto" ? null : (object)true));
            if (dropdown.parent != null)
            {
                dropdown.displayObject.onRemovedFromStage.Add(__popupWinClosed);
                SetState(GButton.DOWN);
            }
        }
示例#7
0
        void __addedToStage()
        {
            DispatchEvent("onPopup", null);

            if (autoSize)
            {
                _list.EnsureBoundsCorrect();
                int   cnt      = _list.numChildren;
                float maxDelta = -1000;
                for (int i = 0; i < cnt; i++)
                {
                    GButton obj = _list.GetChildAt(i).asButton;
                    if (obj == null)
                    {
                        continue;
                    }
                    GTextField tf = obj.GetTextField();
                    if (tf != null)
                    {
                        float v = tf.textWidth - tf.width;
                        if (v > maxDelta)
                        {
                            maxDelta = v;
                        }
                    }
                }

                if (contentPane.width + maxDelta > contentPane.initWidth)
                {
                    contentPane.width += maxDelta;
                }
                else
                {
                    contentPane.width = contentPane.initWidth;
                }
            }

            _list.selectedIndex = -1;
            _list.ResizeToFit(visibleItemCount > 0 ? visibleItemCount : int.MaxValue, 10);
        }
示例#8
0
 private void __addedToStage()
 {
     _list.selectedIndex = -1;
     _list.ResizeToFit(int.MaxValue, 10);
 }