示例#1
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();
        }
示例#2
0
        //----------------------------------------------------------------------
        public clsXWCommandPopup(IMenuManager _manager)
            : base(_manager)
        {
            TitleLabel = new Label(Screen, "", Anchor.Start);
            TitleLabel.Font = Screen.Style.MediumFont;
            TitleLabel.AnchoredRect = AnchoredRect.CreateTopAnchored(0, 0, 0, Screen.Style.DefaultButtonHeight);

            AddChild(TitleLabel);

            {
                ContentGroup = new Group(Screen);
                ContentGroup.AnchoredRect = AnchoredRect.CreateFull(0, 60, 0, 80);
                AddChild(ContentGroup);

                MessageLabel = new Label(Screen, "MessageLabel", Anchor.Start);
                MessageLabel.WrapText = true;
                MessageLabel.Font = Screen.Style.SmallFont;

                // Actions
                mActionsGroup = new BoxGroup(Screen, Orientation.Horizontal, 0, Anchor.End);
                mActionsGroup.AnchoredRect = AnchoredRect.CreateBottomAnchored(0, 0, 0, Screen.Style.DefaultButtonHeight);

                AddChild(mActionsGroup);

                // Close / Cancel
                mCloseButton = new Button(Screen, NuclearWinter.i18n.Common.Close);
                mCloseButton.ClickHandler = delegate { Dismiss(); };
                mCloseButton.BindPadButton(Buttons.A); //*/
            }
        }
示例#3
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();
        }
示例#4
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();
        }
示例#5
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();
        }
示例#6
0
        //----------------------------------------------------------------------
        public TreeViewNode( TreeView _treeView, string _strText, Texture2D _icon = null, object _tag = null )
            : base(_treeView.Screen)
        {
            mTreeView   = _treeView;
            Indicators = new List<TreeViewIndicator>();

            Children    = new ObservableList<TreeViewNode>();
            Children.ListChanged += OnChildrenListChanged;
            Children.ListCleared += OnChildrenListCleared;

            mstrText = _strText;
            mLabel      = new Label( Screen, _strText, Anchor.Start, Screen.Style.DefaultTextColor );
            mImage      = new Image( Screen );
            mImage.Padding = new Box( 0, 5, 0, 10 );

            Icon = _icon;
            Tag = _tag;

            UpdateContentSize();
        }
示例#7
0
        public void Refresh()
        {
            mActionsGroup.Clear();

            TitleLabel.Text = m_aktUnit.strBez + " ID " + m_aktUnit.Id;

            ContentGroup.Clear();

            List<clsSubUnit> lisSubUnits = m_aktUnit.lisSubUnits;
            m_gridSubUnitRooster = new GridGroup(Manager.MenuScreen, 5, lisSubUnits.Count, false, 0);
            ContentGroup.AddChild(m_gridSubUnitRooster);

            for (int i = 0; i < lisSubUnits.Count; i++)
            {
                Image imgBtn = new Image(Manager.MenuScreen, base.Manager.Content.Load<Texture2D>("Sprites/" + lisSubUnits[i].objUnitType.strIconName));
                m_gridSubUnitRooster.AddChildAt(imgBtn, 0, i);

                Label subLabel = new Label(Manager.MenuScreen);
                subLabel.Font = Screen.Style.SmallFont;
                subLabel.Text = lisSubUnits[i].objUnitType.strBez;
                m_gridSubUnitRooster.AddChildAt(subLabel, 1, i);

                subLabel = new Label(Manager.MenuScreen);
                subLabel.Font = Screen.Style.SmallFont;
                subLabel.Text = "Move: " + lisSubUnits[i].objUnitType.intMovement.ToString();
                m_gridSubUnitRooster.AddChildAt(subLabel, 2, i);

                subLabel = new Label(Manager.MenuScreen);
                subLabel.Font = Screen.Style.SmallFont;
                subLabel.Text = "See: " + lisSubUnits[i].objUnitType.intSichtweite.ToString();
                m_gridSubUnitRooster.AddChildAt(subLabel, 3, i);

                BoxGroup testGroup = new BoxGroup(Screen, Orientation.Vertical, 0, Anchor.Center);
                m_gridSubUnitRooster.AddChildAt(testGroup, 4, i);

                //add Roosterrow
                Button mCommandButton = new Button(Screen);
                mCommandButton.Text = "Destroy " + lisSubUnits[i].ID.ToString();
                mCommandButton.Tag = lisSubUnits[i];
                mCommandButton.ClickHandler = new Action<Button>(entfernen_ClickHandler);
                testGroup.AddChild(mCommandButton, false);

            }

            mCloseButton.Text = "Schließen";

            foreach (ICommand aktCommandType in m_objCommandCollection.listRawCommands)
            {
                Button mCommandButton = new Button(Screen);
                mCommandButton.Text = aktCommandType.strTypeName;
                mCommandButton.Tag = aktCommandType;
                mCommandButton.ClickHandler = new Action<Button>(imgCommandIcon_ClickHandler);
                mActionsGroup.AddChild(mCommandButton);
            }

            mActionsGroup.AddChild(mCloseButton);
        }
示例#8
0
        //----------------------------------------------------------------------
        public NotebookTab( Notebook _notebook, string _strText, Texture2D _iconTex )
            : base(_notebook.Screen)
        {
            mNotebook       = _notebook;
            Parent          = _notebook;

            mLabel          = new Label( Screen, "", Anchor.Start, Screen.Style.DefaultTextColor );
            mIcon           = new Image( Screen, _iconTex );

            mTooltip        = new Tooltip( Screen, "" );

            mCloseButton    = new Button( Screen, new Button.ButtonStyle( 5, null, null, Screen.Style.NotebookTabCloseHover, Screen.Style.NotebookTabCloseDown, null, 0, 0 ), "", Screen.Style.NotebookTabClose, Anchor.Center );
            mCloseButton.Parent = this;
            mCloseButton.Padding = new Box(0);
            mCloseButton.ClickHandler = delegate {
                mNotebook.Tabs.Remove( this );

                Screen.Focus( mNotebook );

                if( mNotebook.TabClosedHandler != null )
                {
                    mNotebook.TabClosedHandler( this );
                }
            };

            Text            = _strText;

            PageGroup       = new Group( Screen );
            PageGroup.Parent = this;
        }
示例#9
0
 //----------------------------------------------------------------------
 public DropDownItem( Screen _screen, string _strText, object _tag=null )
 {
     mLabel = new Label( _screen, _strText, Anchor.Start );
     Tag     = _tag;
 }