Esempio n. 1
0
 public SelectBoxStyle(BitmapFont font, Color fontColor, ISceneDrawable background, ScrollPaneStyle scrollStyle, ListStyle listStyle)
 {
     Font        = font;
     FontColor   = fontColor;
     Background  = background;
     ScrollStyle = scrollStyle;
     ListStyle   = listStyle;
 }
Esempio n. 2
0
 public ScrollPaneStyle(ScrollPaneStyle style)
 {
     Background  = style.Background;
     HScroll     = style.HScroll;
     HScrollKnob = style.HScrollKnob;
     VScroll     = style.VScroll;
     VScrollKnob = style.VScrollKnob;
 }
Esempio n. 3
0
        public void SetItems(object[] objects)
        {
            if (objects == null)
            {
                throw new ArgumentNullException("objects");
            }

            _items = objects;
            if (!(objects is string[]))
            {
                string[] strings = new string[objects.Length];
                for (int i = 0, n = objects.Length; i < n; i++)
                {
                    strings[i] = objects[i].ToString();
                }
                _itemsText = strings;
            }
            else
            {
                _itemsText = objects as string[];
            }

            _selectionIndex = 0;

            ISceneDrawable bg   = _style.Background;
            BitmapFont     font = _style.Font;

            _prefHeight = Math.Max(bg.TopHeight + bg.BottomHeight + font.CapHeight - font.Descent * 2, bg.MinHeight);

            float maxItemWIdth = 0;

            for (int i = 0; i < _items.Length; i++)
            {
                maxItemWIdth = Math.Max(font.GetBounds(_itemsText[i]).Width, maxItemWIdth);
            }

            _prefWidth = bg.LeftWidth + bg.RightWidth + maxItemWIdth;

            ListStyle       listStyle   = _style.ListStyle;
            ScrollPaneStyle scrollStyle = _style.ScrollStyle;

            _prefWidth = Math.Max(_prefWidth, maxItemWIdth + scrollStyle.Background.LeftWidth + scrollStyle.Background.RightWidth
                                  + listStyle.Selection.LeftWidth + listStyle.Selection.RightWidth
                                  + Math.Max(_style.ScrollStyle.VScroll != null ? _style.ScrollStyle.VScroll.MinWidth : 0,
                                             _style.ScrollStyle.VScrollKnob != null ? _style.ScrollStyle.VScrollKnob.MinWidth : 0));

            if (_items.Length > 0)
            {
                // TODO: Event for change of items

                //ChangeEvent changeEvent = Pools<ChangeEvent>.Obtain();
                //Fire(changeEvent);
                //Pools<ChangeEvent>.Release(changeEvent);
            }

            InvalidateHierarchy();
        }
Esempio n. 4
0
        public ScrollPane(Actor widget, ScrollPaneStyle style)
            : this()
        {
            if (style == null)
            {
                throw new ArgumentNullException("style");
            }
            _style = style;

            Widget = widget;
            Width  = 150;
            Height = 150;
        }
Esempio n. 5
0
        public ScrollPane(Actor widget, ScrollPaneStyle style)
            : this()
        {
            if (style == null)
                throw new ArgumentNullException("style");
            _style = style;

            Widget = widget;
            Width = 150;
            Height = 150;
        }
Esempio n. 6
0
 public ScrollPaneStyle(ScrollPaneStyle style)
 {
     Background = style.Background;
     HScroll = style.HScroll;
     HScrollKnob = style.HScrollKnob;
     VScroll = style.VScroll;
     VScrollKnob = style.VScrollKnob;
 }
Esempio n. 7
0
 public SelectBoxStyle(BitmapFont font, Color fontColor, ISceneDrawable background, ScrollPaneStyle scrollStyle, ListStyle listStyle)
 {
     Font = font;
     FontColor = fontColor;
     Background = background;
     ScrollStyle = scrollStyle;
     ListStyle = listStyle;
 }