Ejemplo n.º 1
0
        //-----------------------------------------------------------------------
        // NOTE: Splitter is using a Direction instead of an Orientation so
        // it know from which side the offset is computed
        public Splitter( Screen _screen, Direction _direction )
            : base(_screen)
        {
            mDirection = _direction;

            mCollapseAnim = new Animation.SmoothValue( 0f, 1f, 0.2f );
        }
Ejemplo n.º 2
0
        //----------------------------------------------------------------------
        public Button( Screen _screen, ButtonStyle _style, string _strText = "", Texture2D _iconTex = null, Anchor _anchor = Anchor.Center, string _strTooltipText="", object _tag=null )
            : base(_screen)
        {
            Style = _style;

            mPadding    = new Box(5, 0);
            mMargin     = new Box(0);

            mLabel          = new Label( _screen );

            mIcon           = new Image( _screen );
            mIcon.Texture   = _iconTex;
            mIcon.Padding   = new Box( Style.VerticalPadding, 0, Style.VerticalPadding, Style.HorizontalPadding );

            Text            = _strText;
            TextColor       = Screen.Style.DefaultTextColor;

            Anchor          = _anchor;

            mPressedAnim    = new SmoothValue( 1f, 0f, 0.2f );
            mPressedAnim.SetTime( mPressedAnim.Duration );

            mTooltip        = new Tooltip( Screen, "" );

            TooltipText     = _strTooltipText;
            Tag             = _tag;

            UpdateContentSize();
        }
Ejemplo n.º 3
0
 //----------------------------------------------------------------------
 public Image( Screen _screen, Texture2D _texture = null, bool _bStretch = false )
     : base(_screen)
 {
     mTexture = _texture;
     mbStretch = _bStretch;
     UpdateContentSize();
 }
Ejemplo n.º 4
0
        //----------------------------------------------------------------------
        public RadioButtonSet( Screen _screen, List<Button> _lButtons, int _iInitialButtonIndex, bool _bExpand = false )
            : base(_screen)
        {
            mlButtons = _lButtons;

            Style = new RadioButtonSetStyle(
                Screen.Style.RadioButtonCornerSize,
                Screen.Style.RadioButtonFrameOffset,

                Color.White * 0.6f,
                Color.White,
                Screen.Style.ButtonFrameLeft,
                Screen.Style.ButtonFrameMiddle,
                Screen.Style.ButtonFrameRight,

                Screen.Style.ButtonFrameLeftDown,
                Screen.Style.ButtonFrameMiddleDown,
                Screen.Style.ButtonFrameRightDown
            );

            SelectedButtonIndex = _iInitialButtonIndex;
            Expand = _bExpand;

            UpdateContentSize();
        }
Ejemplo n.º 5
0
        //----------------------------------------------------------------------
        public KeyBox( Screen _screen, Keys _key )
            : base(_screen)
        {
            mKey        = _key;
            mFont       = _screen.Style.MediumFont;
            mPadding    = new Box( 15 );

            UpdateContentSize();
        }
Ejemplo n.º 6
0
        int miSpacing; // FIXME: Not taken into account

        #endregion Fields

        #region Constructors

        //----------------------------------------------------------------------
        public GridGroup( Screen _screen, int _iCols, int _iRows, bool _bExpand, int _iSpacing )
            : base(_screen)
        {
            mbExpand    = _bExpand;
            miSpacing   = _iSpacing;

            maTiles = new Widget[ _iCols, _iRows ];
            maWidgetLocations = new Dictionary<Widget,Point>();
        }
Ejemplo n.º 7
0
        //----------------------------------------------------------------------
        public BoxGroup( Screen _screen, Orientation _orientation, int _iSpacing, Anchor _contentAnchor = Anchor.Center )
            : base(_screen)
        {
            mlExpandedChildren = new List<bool>();

            mOrientation    = _orientation;
            miSpacing       = _iSpacing;
            mContentAnchor = _contentAnchor;
        }
Ejemplo n.º 8
0
        //----------------------------------------------------------------------
        public Panel( Screen _screen, Texture2D _texture, int _iCornerSize )
            : base(_screen)
        {
            Texture     = _texture;
            CornerSize  = _iCornerSize;
            Padding     = new Box( CornerSize );

            Scrollbar   = new Scrollbar( _screen );
            Scrollbar.Parent = this;
        }
Ejemplo n.º 9
0
        //----------------------------------------------------------------------
        public ListView( Screen _screen )
            : base(_screen)
        {
            Columns = new List<ListViewColumn>();

            Rows    = new ObservableList<ListViewRow>();

            Rows.ListCleared += delegate {
                SelectedRow         = null;
                HoveredRow          = null;
                FocusedRow          = null;

                mHoveredActionButton = null;
                mbIsHoveredActionButtonDown = false;
            };

            Rows.ListChanged += delegate( object _source, ObservableList<ListViewRow>.ListChangedEventArgs _args )
            {
                if( ! _args.Added )
                {
                    if( _args.Item == SelectedRow )
                    {
                        SelectedRow = null;
                    }

                    if( _args.Item == HoveredRow )
                    {
                        UpdateHoveredRow();
                    }

                    if( _args.Item == FocusedRow )
                    {
                        FocusedRow = null;
                        IsDragging = false;
                    }
                }
            };

            SelectedRow     = null;
            FocusedRow      = null;
            HoveredRow      = null;
            TextColor = Screen.Style.DefaultTextColor;

            Style.ListFrame             = Screen.Style.ListFrame;
            Style.FrameSelected         = Screen.Style.GridBoxFrameSelected;
            Style.FrameSelectedHover    = Screen.Style.GridBoxFrameSelectedHover;
            Style.FrameSelectedFocus    = Screen.Style.GridBoxFrameSelectedFocus;

            Scrollbar = new Scrollbar( _screen );
            Scrollbar.Parent = this;

            ActionButtons = new List<Button>();

            UpdateContentSize();
        }
Ejemplo n.º 10
0
        //----------------------------------------------------------------------
        public CheckBox( Screen _screen, string _strText )
            : base(_screen)
        {
            Frame = Screen.Style.CheckBoxFrame;
            FrameCornerSize = Screen.Style.CheckBoxFrameCornerSize;

            mLabel = new Label( Screen, _strText, Anchor.Start );
            mLabel.Padding = new Box( 10, 10, 10, 0 );

            UpdateContentSize();
        }
Ejemplo n.º 11
0
        //----------------------------------------------------------------------
        public RadioButtonSet( Screen _screen, RadioButtonSetStyle _style, List<Button> _lButtons, int _iInitialButtonIndex )
            : base(_screen)
        {
            mlButtons = _lButtons;

            Style = _style;

            SelectedButtonIndex = _iInitialButtonIndex;

            UpdateContentSize();
        }
Ejemplo n.º 12
0
        //----------------------------------------------------------------------
        public DropDownBox( Screen _screen, List<DropDownItem> _lItems, int _iInitialValueIndex )
            : base(_screen)
        {
            mCurrentItemLabel = new Label( Screen, _anchor: Anchor.Start );

            Items = new ObservableList<DropDownItem>( _lItems );

            Items.ListChanged += delegate( object _source, ObservableList<DropDownItem>.ListChangedEventArgs _args )
            {
                if( _args.Added )
                {
                    _args.Item.DropDownBox = this;
                }

                if( SelectedItemIndex == -1 )
                {
                    if( _args.Added )
                    {
                        SelectedItemIndex = _args.Index;
                    }
                }
                else
                if( _args.Index <= SelectedItemIndex )
                {
                    SelectedItemIndex = Math.Min( Items.Count - 1, Math.Max( 0, SelectedItemIndex + ( _args.Added ? 1 : -1 ) ) );
                }
            };

            Items.ListCleared += delegate( object _source, EventArgs _args )
            {
                SelectedItemIndex = -1;
            };

            SelectedItemIndex = _iInitialValueIndex;
            mScrollbar = new Scrollbar( _screen );
            mScrollbar.Parent = this;

            ScrollItemOffset = Math.Max( 0, Math.Min( SelectedItemIndex, Items.Count - siMaxLineDisplayed ) );
            mScrollbar.LerpOffset = mScrollbar.Offset;

            Padding = new Box( 10 );
            TextPadding = new Box( 5 );

            mPressedAnim    = new SmoothValue( 1f, 0f, 0.2f );
            mPressedAnim.SetTime( mPressedAnim.Duration );

            ButtonFrame         = Screen.Style.ButtonFrame;
            ButtonFrameDown     = Screen.Style.ButtonFrameDown;
            ButtonFrameHover    = Screen.Style.ButtonHover;
            ButtonFramePressed  = Screen.Style.ButtonPress;

            UpdateContentSize();
        }
Ejemplo n.º 13
0
 //----------------------------------------------------------------------
 public Button( Screen _screen, string _strText = "", Texture2D _iconTex = null, Anchor _anchor = Anchor.Center, string _strTooltipText="", object _tag=null )
     : this(_screen, new ButtonStyle(
         _screen.Style.ButtonCornerSize,
         _screen.Style.ButtonFrame,
         _screen.Style.ButtonFrameDown,
         _screen.Style.ButtonHover,
         _screen.Style.ButtonPress,
         _screen.Style.ButtonFocus,
         _screen.Style.ButtonVerticalPadding,
         _screen.Style.ButtonHorizontalPadding
     ), _strText, _iconTex, _anchor, _strTooltipText, _tag)
 {
 }
Ejemplo n.º 14
0
        //----------------------------------------------------------------------
        public EditBox( Screen _screen, string _strText = "", Func<char,bool> _textEnteredHandler = null )
            : base(_screen)
        {
            mstrText    = _strText;
            mFont       = _screen.Style.MediumFont;
            mPadding    = new Box( 15 );
            TextEnteredHandler = _textEnteredHandler;

            Frame               = Screen.Style.EditBoxFrame;
            FrameCornerSize     = Screen.Style.EditBoxCornerSize;

            UpdateContentSize();
        }
Ejemplo n.º 15
0
        //----------------------------------------------------------------------
        public Slider( Screen _screen, int _iMin, int _iMax, int _iInitialValue, int _iStep )
            : base(_screen)
        {
            Debug.Assert( _iMin < _iMax );

            mTooltip    = new Tooltip( Screen, "" );

            MinValue    = _iMin;
            MaxValue    = _iMax;
            Value       = _iInitialValue;
            Step        = _iStep;

            UpdateContentSize();
        }
Ejemplo n.º 16
0
        //----------------------------------------------------------------------
        public Label( Screen _screen, string _strText, Anchor _anchor, Color _color )
            : base(_screen)
        {
            mstrText            = _strText;
            mstrDisplayedText   = mstrText;
            mFont               = _screen.Style.MediumFont;
            mPadding            = new Box( 10 );
            mAnchor             = _anchor;

            Color               = _color;
            OutlineRadius       = Screen.Style.BlurRadius;
            OutlineColor        = _color * 0.5f;

            UpdateContentSize();
        }
Ejemplo n.º 17
0
        //----------------------------------------------------------------------
        public TreeView( Screen _screen )
            : base(_screen)
        {
            Nodes = new ObservableList<TreeViewNode>();

            Nodes.ListCleared += delegate {
                SelectedNode = null;
                HoveredNode = null;
                FocusedNode = null;
                mHoveredActionButton = null;
                mbIsHoveredActionButtonDown = false;
            };

            Nodes.ListChanged += delegate( object _source, ObservableList<TreeViewNode>.ListChangedEventArgs _args )
            {
                if( ! _args.Added )
                {
                    if( _args.Item == SelectedNode )
                    {
                        SelectedNode = null;
                    }

                    if( _args.Item == HoveredNode )
                    {
                        UpdateHoveredNode();
                    }

                    if( _args.Item == FocusedNode )
                    {
                        FocusedNode = null;
                        IsDragging = false;
                    }
                }
            };

            Scrollbar = new UI.Scrollbar( _screen );
            Scrollbar.Parent = this;

            ActionButtons = new List<Button>();
        }
Ejemplo n.º 18
0
        //----------------------------------------------------------------------
        public Notebook( Screen _screen )
            : base(_screen)
        {
            Style = new NotebookStyle(
                Screen.Style.NotebookTabCornerSize,
                Screen.Style.NotebookTab,
                Screen.Style.NotebookTabFocus,
                Screen.Style.NotebookActiveTab,
                Screen.Style.NotebookActiveTabFocus,
                Screen.Style.NotebookUnreadTabMarker
            );

            mPanel = new Panel( Screen, Screen.Style.Panel, Screen.Style.PanelCornerSize );

            Tabs = new ObservableList<NotebookTab>();

            Tabs.ListChanged += delegate( object _source, ObservableList<NotebookTab>.ListChangedEventArgs _args ) {
                if( ! _args.Added )
                {
                    if( DraggedTab == _args.Item )
                    {
                        DraggedTab = null;
                    }

                    if( HoveredTab == _args.Item )
                    {
                        HoveredTab = null;
                    }
                }

                if( Tabs.Count > 0 )
                {
                    ActiveTabIndex = Math.Min( Tabs.Count - 1, ActiveTabIndex );
                    Tabs[ActiveTabIndex].IsUnread = false;
                }
            };
        }
Ejemplo n.º 19
0
        //----------------------------------------------------------------------
        public TreeViewIndicator( Screen _screen, string _strText, Texture2D _iconTex=null, object _tag=null )
            : base(_screen)
        {
            mLabel = new Label( Screen, _strText );
            mLabel.Font = Screen.Style.SmallFont;
            mLabel.Parent = this;

            mImage = new Image( _screen, _iconTex );

            UpdatePaddings();

            Tag = _tag;

            UpdateContentSize();
        }
Ejemplo n.º 20
0
 public RadioButtonSet( Screen _screen, List<Button> _lButtons, bool _bExpand = false )
     : this(_screen, _lButtons, 0, _bExpand)
 {
 }
Ejemplo n.º 21
0
 //----------------------------------------------------------------------
 public ProgressBar( Screen _screen, int _iValue=0, int _iMax=100 )
     : base(_screen)
 {
     Value   = _iValue;
     Max     = _iMax;
 }
Ejemplo n.º 22
0
 //----------------------------------------------------------------------
 public SpinningWheel( Screen _screen, Texture2D _texture )
     : base(_screen, _texture)
 {
 }
Ejemplo n.º 23
0
 //----------------------------------------------------------------------
 public Group( Screen _screen )
     : base(_screen)
 {
     mlChildren = new List<Widget>();
 }
Ejemplo n.º 24
0
 public MyCustomViewport(NuclearUI.Screen _screen)
     : base(_screen)
 {
     mEffect = new BasicEffect(Screen.Game.GraphicsDevice);
     mEffect.VertexColorEnabled = true;
 }
Ejemplo n.º 25
0
 public RadioButtonSet( Screen _screen, RadioButtonSetStyle _style, List<Button> _lButtons )
     : this(_screen, _style, _lButtons, 0)
 {
 }
Ejemplo n.º 26
0
        //----------------------------------------------------------------------
        public RichTextArea( Screen _screen )
        : base( _screen )
        {
            Caret           = new RichTextCaret( this );
            TextBlocks       = new List<TextBlock>();
            TextBlocks.Add( new TextBlock( this, "" ) );

            RemoteCaretsById = new Dictionary<UInt16,RemoteRichTextCaret>();

            Padding         = new Box(20);

            Scrollbar       = new Scrollbar( _screen );
            Scrollbar.Parent = this;

            PanelTex        = Screen.Style.ListFrame;
        }
Ejemplo n.º 27
0
 public Label( Screen _screen, string _strText, Color _color )
     : this(_screen, _strText, Anchor.Center, _color)
 {
 }
Ejemplo n.º 28
0
 //----------------------------------------------------------------------
 public Widget( Screen _screen, AnchoredRect _anchoredRect )
 {
     Screen = _screen;
     AnchoredRect = _anchoredRect;
 }
Ejemplo n.º 29
0
 //----------------------------------------------------------------------
 public CustomViewport( Screen _screen )
     : base(_screen)
 {
 }
Ejemplo n.º 30
0
 public Widget( Screen _screen )
     : this(_screen, AnchoredRect.Full)
 {
 }
Ejemplo n.º 31
0
 public Label( Screen _screen, string _strText = "", Anchor _anchor = Anchor.Center )
     : this(_screen, _strText, _anchor, _screen.Style.DefaultTextColor)
 {
 }