Exemple #1
0
        //internal Sort[] DefaultSorts;


        public ItemBrowser()
        {
            this.CanMove = true;
            //Height = 420;

            _expandTexture   = ModUtils.GetEmbeddedTexture("Images/ExpandIcon");
            _collapseTexture = ModUtils.GetEmbeddedTexture("Images/CollapseIcon");
            _spacerTexture   = ModUtils.GetEmbeddedTexture("Images/spacer");

            //UILabel lTitle = new UILabel("Item Browser");
            //lTitle.Scale = .6f;
            //lTitle.X = LargeSpacing;
            //lTitle.Y = LargeSpacing;
            //lTitle.OverridesMouse = false;
            //AddChild(lTitle);

            _itemView   = new ItemCollectionView();
            Height      = LargeSpacing * 2 + _itemView.Height + 32;
            _itemView.X = LargeSpacing;
            _itemView.Y = Height - LargeSpacing - _itemView.Height;
            AddChild(_itemView);

            _categoryView        = new UIScrollView();
            _categoryView.X      = _itemView.X + _itemView.Width + LargeSpacing;
            _categoryView.Y      = _itemView.Y;
            _categoryView.Width  = 45 + numberCategoryColumns * 100;
            _categoryView.Height = _itemView.Height;
            AddChild(_categoryView);

            Width = _categoryView.X + _categoryView.Width + LargeSpacing;

            _bClose              = new UIImage(GetEmbeddedTexture("Images/closeButton"));
            _bClose.Anchor       = AnchorPosition.TopRight;
            _bClose.Position     = new Vector2(Width - LargeSpacing, LargeSpacing);
            _bClose.onLeftClick += bClose_onLeftClick;
            AddChild(_bClose);

            SearchBox             = new UITextbox();
            SearchBox.Width       = 125;
            SearchBox.X           = _itemView.X + _itemView.Width - SearchBox.Width;
            SearchBox.Y           = _itemView.Y - SearchBox.Height - Spacing - 4;
            SearchBox.KeyPressed += textbox_KeyPressed;
            AddChild(SearchBox);

            _filterView          = new UIView();
            _filterView.Position = new Vector2(LargeSpacing, Spacing);
            //_filterView.onLeftClick += _bViewAllItems_onLeftClick;
            //{
            //	UIImage test = new UIImage(GetEmbeddedTexture("Images/closeButton"));
            //	test.onLeftClick += bClose_onLeftClick;
            //	_filterView.AddChild(test);
            //	UIImage test2 = new UIImage(GetEmbeddedTexture("Images/closeButton"));
            //	test2.onLeftClick += bClose_onLeftClick;
            //	test2.Position = test.Position;
            //	test2.X += test.Width;
            //	test2.ForegroundColor = Color.Azure;
            //	_filterView.AddChild(test2);
            //}
            //	_filterView.ForegroundColor = Color.Red;
            //	_filterView.BackgroundColor = Color.Pink;
            //	_filterView.Width = 100;
            _filterView.Height = 40;
            AddChild(_filterView);

            _spacer          = new UIImage(_spacerTexture);
            _spacer.Position = new Vector2(Spacing, LargeSpacing);
            _spacer.Height   = 40;
            AddChild(_spacer);

            _sortView          = new UIView();
            _sortView.Position = new Vector2(Spacing, Spacing);
            //_sortView.onLeftClick += _bViewAllItems_onLeftClick;
            //	_sortView.ForegroundColor = Color.Red;
            //	_sortView.BackgroundColor = Color.Red;
            //	_sortView.Width = 30;
            _sortView.Height = 40;
            AddChild(_sortView);

            //_trashCan = new Slot(0);
            //_trashCan.IsTrachCan = true;
            //_trashCan.X = _itemView.X;
            //_trashCan.Y = _itemView.Y - _trashCan.Height - SmallSpacing/2;
            //AddChild(_trashCan);

            _bBack              = new UIButton("Back");
            _bBack.X            = _categoryView.X;
            _bBack.Y            = _categoryView.Y - _bBack.Height - Spacing;
            _bBack.onLeftClick += _bViewAllItems_onLeftClick;
            AddChild(_bBack);

            _bCollapseCategories              = new UIImage(_collapseTexture);
            _bCollapseCategories.X            = this.Width - _bCollapseCategories.Width - LargeSpacing;
            _bCollapseCategories.Y            = _categoryView.Y - _bCollapseCategories.Height - Spacing;
            _bCollapseCategories.onLeftClick += _bCollapseCategories_onLeftClick;
            AddChild(_bCollapseCategories);

            shownWidth  = _categoryView.X + _categoryView.Width + LargeSpacing;
            hiddenWidth = _itemView.X + _itemView.Width + LargeSpacing;

            //ParseList2();
            SelectedCategory = null;
        }