Beispiel #1
0
 public void Clear()
 {
     Items.Clear();
     MyIDs.Clear();
     if (scrollbar != null)
         scrollbar = null;
     selectedIndex = -1;
     selectedItem = string.Empty;
     startIndex = 0;
     endIndex = 0;
 }
Beispiel #2
0
        public void RemoveItem( int index )
        {
            Items.RemoveAt( index );
            MyIDs.RemoveAt(index);
            if (Items.Count <= visibleItems && scrollbar != null)
                scrollbar = null;
            if (selectedIndex == index)
            {
                selectedIndex = -1;
                selectedItem = string.Empty;
            }
            if (scrollbar != null)
                scrollbar.max = Items.Count - visibleItems;

            if (Items.Count < visibleItems)
                endIndex = Items.Count;
            else
                endIndex = startIndex + visibleItems;
        }
Beispiel #3
0
 private void InitScrollbar()
 {
     scrollbar = new Scrollbar( name + "scrollbar", position + new Vector2( size.X, 0f ), Scrollbar.Axis.Vertical, null, size.Y, Items.Count - 1, 0 );//, Style.Default);
     scrollbar.OnValueChange += new EventHandler( scrollbar_onChangeValue );
 }
Beispiel #4
0
        public void RemoveItem( string item )
        {
            MyIDs.Remove(IndexOf(item));
            Items.Remove( item );
            if (Items.Count <= visibleItems && scrollbar != null)
                scrollbar = null;
            if (selectedItem == item)
            {
                selectedIndex = -1;
                selectedItem = string.Empty;
            }
            if (scrollbar != null)
                scrollbar.max = Items.Count - visibleItems;

            if (Items.Count < visibleItems)
                endIndex = Items.Count;
            else
                endIndex = startIndex + visibleItems;
        }
Beispiel #5
0
 private void InitScrollbar()
 {
     scrollbar = new Scrollbar(name + "scrollbar", position + new Vector2(size.X, 0f), Scrollbar.Axis.Vertical, null, size.Y, Items.Count - 1, 0);    //, Style.Default);
     scrollbar.OnValueChange += new EventHandler(scrollbar_onChangeValue);
 }