Esempio n. 1
0
 public PanelView(View rootView, Vector2 position)
     : base(rootView)
 {
     SelectedNinepatch = GeeUI.NinePatchPanelSelected;
     UnselectedNinepatch = GeeUI.NinePatchPanelUnselected;
     Position = position;
 }
Esempio n. 2
0
 public ImageView(View rootView, Texture2D texture)
     : base(rootView)
 {
     Texture = texture;
     Width = texture.Width;
     Height = texture.Height;
 }
Esempio n. 3
0
 public TabHost(View rootView, Vector2 position, SpriteFont font)
     : base(rootView)
 {
     Position = position;
     TabContainerView = new TabContainer(this, font);
     TabContainerView.ChildrenLayout = new HorizontalViewLayout(1, true);
 }
Esempio n. 4
0
        private void Wrap(View parentView)
        {
            Rectangle container = parentView.ContentBoundBox;
            int xDone = container.Left - parentView.X;
            int yDone = container.Top - parentView.Y;
            View tallestChild = null;
            foreach (View v in parentView.Children)
            {
                v.Position = Vector2.Zero;
                if (ExcludedChildren.Contains(v)) continue;

                if (tallestChild == null || v.BoundBox.Height > tallestChild.BoundBox.Height)
                    tallestChild = v;

                //Wrapping around has never felt so good
                if (v.BoundBox.Right + xDone > container.Right - parentView.X)
                {
                    xDone = container.Left - parentView.X;
                    yDone += tallestChild.BoundBox.Height + _paddingBetweenVertical;
                }

                v.Position = new Vector2(xDone, yDone);
                xDone += v.BoundBox.Width + _paddingBetweenHorizontal;
            }
        }
Esempio n. 5
0
		public ImageView(GeeUIMain GeeUI, View rootView, Texture2D texture)
			: base(GeeUI, rootView)
        {
            Texture = texture;
			Width.Value = texture.Width;
			Height.Value = texture.Height;
        }
Esempio n. 6
0
		public WindowView(GeeUIMain GeeUI, View rootView, Vector2 position)
			: base(GeeUI, rootView)
		{
			Position.Value = position;
			NinePatchNormal = GeeUIMain.NinePatchWindowUnselected;
			NinePatchSelected = GeeUIMain.NinePatchWindowSelected;
		}
Esempio n. 7
0
 public override void OrderChildren(View parentView)
 {
     if (!_wrapAround)
         NoWrap(parentView);
     else
         Wrap(parentView);
 }
Esempio n. 8
0
		public PanelView(GeeUIMain GeeUI, View rootView, Vector2 position)
			: base(GeeUI, rootView)
		{
			SelectedNinepatch = GeeUIMain.NinePatchPanelSelected;
			UnselectedNinepatch = GeeUIMain.NinePatchPanelUnselected;
			Position.Value = position;
		}
Esempio n. 9
0
 public TextView(View rootView, string text, Vector2 position, SpriteFont font)
     : base(rootView)
 {
     Text = text;
     Position = position;
     Font = font;
 }
Esempio n. 10
0
		private void Wrap(View parentView)
		{
			Rectangle container = parentView.ContentBoundBox;
			int xDone = container.Left - parentView.RealX;
			int yDone = container.Top - parentView.RealY;
			View widestChild = null;
			bool nullify = false;
			int furthestRight = 0;
			foreach (View v in parentView.Children)
			{
				if (!v.Active) continue;
				if (nullify)
				{
					//widestChild = null; //this is per-column
					nullify = false;
				}
				v.Position.Value = Vector2.Zero;
				if (ExcludedChildren.Contains(v)) continue;

				if (widestChild == null)
				{
					widestChild = v;
				}
				//Wrapping around has never felt so good
				if (v.BoundBox.Bottom + yDone > container.Bottom - parentView.Y)
				{
					yDone = container.Top - parentView.RealY;
					int addWidth = widestChild.BoundBox.Width + _paddingBetweenHorizontal;
					if (_resizeParentToFit)
					{
						int neededWidth = addWidth + xDone + v.BoundBox.Width;
						if (neededWidth > parentView.ContentBoundBox.Width)
						{
							int theWidth = (neededWidth - parentView.ContentBoundBox.Width);
							parentView.Width.Value += theWidth;
							widestChild = v;
						}
					}
					xDone += addWidth;
					nullify = true;
					widestChild = v;
				}
				else
				{
					if (v.BoundBox.Width > widestChild.BoundBox.Width)
					{
						widestChild = v;
					}
				}

				v.Position.Value = new Vector2(xDone, yDone);
				yDone += v.BoundBox.Height + _paddingBetweenVertical;
				if (widestChild == v)
					furthestRight = v.AbsoluteBoundBox.Right - parentView.AbsoluteContentBoundBox.Left;
			}

			if (_resizeParentToFit)
				parentView.Width.Value = furthestRight + 1;
		}
Esempio n. 11
0
		public ListView(GeeUIMain GeeUI, View rootView)
			: base(GeeUI, rootView)
		{
			this.Add(new NotifyBinding(delegate()
			{
				this.recomputeOffset(0);
			}, this.ChildrenBoundBox, this.Width, this.Height));
		}
Esempio n. 12
0
 public WindowView(View rootView, Vector2 position, SpriteFont windowTextFont)
     : base(rootView)
 {
     Position = position;
     WindowTextFont = windowTextFont;
     NinePatchNormal = GeeUI.NinePatchWindowUnselected;
     NinePatchSelected = GeeUI.NinePatchWindowSelected;
 }
Esempio n. 13
0
		public CheckBoxView(GeeUIMain GeeUI, View rootView, Vector2 position, string label)
			: base(GeeUI, rootView)
		{
			Position.Value = position;
			this.numChildrenAllowed = 1;

			new TextView(GeeUI, this, label, Vector2.Zero);
		}
Esempio n. 14
0
		public TabHost(GeeUIMain GeeUI, View rootView, Vector2 position)
			: base(GeeUI, rootView)
		{
			Position.Value = position;
			TabContainerView = new TabContainer(GeeUI, this);
			TabContainerView.ChildrenLayouts.Add(new HorizontalViewLayout(1, true));

			GeeUI.OnKeyPressedHandler += keyPressedHandler;
		}
Esempio n. 15
0
 public ButtonView(View rootview, View contentView, Vector2 position)
     : base(rootview)
 {
     NinePatchNormal = GeeUI.NinePatchBtnDefault;
     NinePatchHover = GeeUI.NinePatchBtnHover;
     NinePatchClicked = GeeUI.NinePatchBtnClicked;
     Position = position;
     ButtonContentview = contentView;
 }
Esempio n. 16
0
		public TextView(GeeUIMain GeeUI, View rootView, string text, Vector2 position)
			: base(GeeUI, rootView)
		{
			Text.Value = text;
			Position.Value = position;
			TextColor = GeeUI.TextColorDefault;

			Text.AddBinding(new NotifyBinding(HandleResize, Text));
			if(AutoSize.Value) HandleResize();
		}
Esempio n. 17
0
 public TabView AddTab(string tabText, View tabChild)
 {
     var ret = new TabView(this, new Vector2(AllTabsWidth, 0), TabFont) { TabText = tabText };
     ParentView.AddChild(tabChild);
     if (ActiveTabView == null)
         TabClicked(ret);
     else 
         TabClicked(ActiveTabView);
     return ret;
 }
Esempio n. 18
0
 /// <summary>
 /// Creates a new BorderViewLayout
 /// </summary>
 public BorderViewLayout(View top, View bottom, View left, View right, View middle, int topBottomHeight, int rightLeftWidth)
 {
     childrenLayout.Add(top);
     childrenLayout.Add(bottom);
     childrenLayout.Add(left);
     childrenLayout.Add(right);
     childrenLayout.Add(middle);
     this.topBottomHeight = topBottomHeight;
     this.rightLeftWidth = rightLeftWidth;
 }
Esempio n. 19
0
		public TabView AddTab(string tabText, View tabChild)
		{
			var ret = new TabView(ParentGeeUI, this, new Vector2(AllTabsWidth, 0)) { TabText = tabText };
			ParentView.Value.Children.Add(tabChild);
			if (ActiveTabView == null)
				TabClicked(ret);
			else 
				TabClicked(ActiveTabView);
			return ret;
		}
Esempio n. 20
0
		private void NoWrap(View parentView)
		{
			Rectangle container = parentView.ContentBoundBox;
			int xDone = container.Left - parentView.RealX;
			foreach (View v in parentView.Children)
			{
				v.Position.Value = Vector2.Zero;
				if (ExcludedChildren.Contains(v)) continue;
				v.Position.Value = new Vector2(xDone, container.Top - parentView.RealY);
				xDone += v.BoundBox.Width + _paddingBetweenHorizontal;
			}
		}
Esempio n. 21
0
		public SliderView(GeeUIMain GeeUI, View rootView, Vector2 position, int min, int max)
			: base(GeeUI, rootView)
		{
			SliderRange = GeeUIMain.NinePatchSliderRange;
			SliderDefault = GeeUIMain.TextureSliderDefault;
			SliderSelected = GeeUIMain.TextureSliderSelected;

			_min = min;
			_max = max;

			Position.Value = position;
		}
Esempio n. 22
0
		private void NoWrap(View parentView)
		{
			Rectangle container = parentView.ContentBoundBox;
			int yDone = container.Top - parentView.Y;
			foreach (View v in parentView.Children)
			{
				v.Position = Vector2.Zero;
				if (ExcludedChildren.Contains(v)) continue;
				v.Position = new Vector2(container.Left, yDone);
				yDone += v.BoundBox.Height + _paddingBetweenVertical;
			}
		}
Esempio n. 23
0
        public TabView(View rootView, Vector2 position, SpriteFont font)
            : base(rootView)
        {
            Position = position;
            TabFont = font;
            NumChildrenAllowed = 1;

            NinePatchDefault = GeeUI.NinePatchTabDefault;
            NinePatchSelected = GeeUI.NinePatchTabSelected;
            this.Height = 25;
            new TextView(this, "", Vector2.Zero, font) { TextJustification = TextJustification.Center };
        }
Esempio n. 24
0
        public SliderView(View rootView, Vector2 position, int min, int max)
            : base(rootView)
        {
            SliderRange = GeeUI.NinePatchSliderRange;
            SliderDefault = GeeUI.TextureSliderDefault;
            SliderSelected = GeeUI.TextureSliderSelected;

            _min = min;
            _max = max;

            Position = position;
        }
Esempio n. 25
0
        public TextFieldView(View rootView, Vector2 position, SpriteFont textFont)
            : base(rootView)
        {
            NinePatchDefault = GeeUI.NinePatchTextFieldDefault;
            NinePatchSelected = GeeUI.NinePatchTextFieldSelected;

            Position = position;
            TextInputFont = textFont;
            NumChildrenAllowed = -1;

            GeeUI.OnKeyPressedHandler += keyPressedHandler;
            GeeUI.OnKeyReleasedHandler += keyReleasedHandler;
        }
Esempio n. 26
0
        public CheckBoxView(View rootView, Vector2 position, string label, SpriteFont labelFont)
            : base(rootView)
        {
            Position = position;
            NumChildrenAllowed = 1;

            new TextView(this, label, Vector2.Zero, labelFont);

            TextureChecked = GeeUI.TextureCheckBoxDefaultChecked;
            TextureCheckedSelected = GeeUI.TextureCheckBoxSelectedChecked;
            TextureDefault = GeeUI.TextureCheckBoxDefault;
            TextureDefaultSelected = GeeUI.TextureCheckBoxSelected;
        }
Esempio n. 27
0
        public ButtonView(View rootView, string text, Vector2 position, SpriteFont font)
            : base(rootView)
        {
            NinePatchNormal = GeeUI.NinePatchBtnDefault;
            NinePatchHover = GeeUI.NinePatchBtnHover;
            NinePatchClicked = GeeUI.NinePatchBtnClicked;
            Position = position;

            //Make the TextView for the text
            new TextView(this, text, new Vector2(0, 0), font) {TextJustification = TextJustification.Center};
            Width = (int)font.MeasureString(text).X + NinePatchNormal.LeftWidth + NinePatchNormal.RightWidth;
            Height = (int) font.MeasureString(text).Y + NinePatchNormal.TopHeight + NinePatchNormal.BottomHeight;
        }
Esempio n. 28
0
		public ButtonView(GeeUIMain GeeUI, View rootView, string text, Vector2 position)
			: base(GeeUI, rootView)
		{
			NinePatchNormal = GeeUIMain.NinePatchBtnDefault;
			NinePatchHover = GeeUIMain.NinePatchBtnHover;
			NinePatchClicked = GeeUIMain.NinePatchBtnClicked;
			Position.Value = position;

			//Make the TextView for the text
			var textV = new TextView(this.ParentGeeUI, this, text, new Vector2(0, 0)) {TextJustification = TextJustification.Left};
			Width.Value = (textV.Width.Value = (int)GeeUIMain.Font.MeasureString(text).X) + NinePatchNormal.LeftWidth + NinePatchNormal.RightWidth;
			Height.Value = (textV.Height.Value = (int)GeeUIMain.Font.MeasureString(text).Y) + NinePatchNormal.TopHeight + NinePatchNormal.BottomHeight;
		}
Esempio n. 29
0
		public TabView(GeeUIMain GeeUI, View rootView, Vector2 position)
			: base(GeeUI, rootView)
		{
			Position.Value = position;
			this.numChildrenAllowed = 1;

			NinePatchDefault = GeeUIMain.NinePatchTabDefault;
			NinePatchSelected = GeeUIMain.NinePatchTabSelected;

			// HACK
			this.Height.Value = (int)(25.0f * GeeUI.Main.FontMultiplier);

			new TextView(GeeUI, this, "", Vector2.Zero) {  };
		}
Esempio n. 30
0
		private void Wrap(View parentView)
		{
			Rectangle container = parentView.ContentBoundBox;
			int xDone = container.Left - parentView.RealX;
			int yDone = container.Top - parentView.RealY;
			View tallestChild = null;
			bool nullify = false;
			int furthestDown = 0;
			foreach (View v in parentView.Children)
			{
				if (nullify)
				{
					tallestChild = null; //this is per-column
					nullify = false;
				}
				v.Position.Value = Vector2.Zero;
				if (ExcludedChildren.Contains(v)) continue;

				if (tallestChild == null || v.BoundBox.Height > tallestChild.BoundBox.Height)
					tallestChild = v;

				//Wrapping around has never felt so good
				if (v.BoundBox.Right + xDone > container.Right - parentView.X)
				{
					xDone = container.Left - parentView.X;
					int addHeight = tallestChild.BoundBox.Height + _paddingBetweenVertical;
					if (_resizeParentToFit)
					{
						int neededHeight = addHeight + yDone + v.BoundBox.Height;
						if (neededHeight > parentView.ContentBoundBox.Height)
						{
							int theHeight = (neededHeight - parentView.ContentBoundBox.Height);
							parentView.Height.Value += theHeight;
							tallestChild = v;
						}
					}
					yDone += tallestChild.BoundBox.Height + _paddingBetweenVertical;
					nullify = true;
				}

				v.Position.Value = new Vector2(xDone, yDone);
				xDone += v.BoundBox.Width + _paddingBetweenHorizontal;
				if (tallestChild == v)
					furthestDown = v.AbsoluteBoundBox.Bottom - parentView.AbsoluteContentBoundBox.Top;
			}
			if (_resizeParentToFit)
				parentView.Height.Value = furthestDown + 1;
		}
Esempio n. 31
0
        public override void Awake()
        {
            // This is to make it so nothing else can be interacted with.
            this.EncompassingView      = new View(this.main.GeeUI, this.main.GeeUI.RootView);
            this.MainView              = new PanelView(this.main.GeeUI, this.EncompassingView, Vector2.Zero);
            MainView.Resizeable        = false;
            MainView.AnchorPoint.Value = new Vector2(0.5f, 0.5f);
            MainView.Width.Value       = 400;
            MainView.Height.Value      = 100;

            this.EncompassingView.Add(new Binding <int, Point>(EncompassingView.Height, (p) => p.Y, main.ScreenSize));
            this.EncompassingView.Add(new Binding <int, Point>(EncompassingView.Width, (p) => p.X, main.ScreenSize));
            this.MainView.Add(new Binding <Vector2, int>(MainView.Position, i => new Vector2(i / 2f, MainView.Y), EncompassingView.Width));
            this.MainView.Add(new Binding <Vector2, int>(MainView.Position, i => new Vector2(MainView.X, i / 2f), EncompassingView.Height));

            new TextView(this.main.GeeUI, this.MainView, this.label, new Vector2(10, 8));
            this.Text = new TextFieldView(this.main.GeeUI, this.MainView, new Vector2(10, 25))
            {
                MultiLine = false,
            };
            this.Text.Height.Value   = 20;
            this.Text.Width.Value    = 340;
            this.Text.Text           = this.defaultText;
            this.Text.Selected.Value = true;

            this.Okay   = new ButtonView(main.GeeUI, MainView, this.action, new Vector2(50, 60));
            this.Cancel = new ButtonView(main.GeeUI, MainView, "Cancel", new Vector2(300, 60));

            this.Okay.OnMouseClick += (sender, args) =>
            {
                this.Go();
            };

            this.Cancel.OnMouseClick += (sender, args) =>
            {
                this.Delete.Execute();
            };

            base.Awake();

            this.Text.ParentGeeUI.OnKeyPressedHandler += this.keyHandler;
        }
Esempio n. 32
0
        public override void Awake()
        {
            // This is to make it so nothing else can be interacted with.
            this.EncompassingView      = new View(main.GeeUI, main.GeeUI.RootView);
            this.MainView              = new PanelView(main.GeeUI, EncompassingView, Vector2.Zero);
            MainView.Resizeable        = false;
            MainView.AnchorPoint.Value = new Vector2(0.5f, 0.5f);
            MainView.Width.Value       = 400;
            MainView.Height.Value      = 400;

            this.EncompassingView.Add(new Binding <int, Point>(EncompassingView.Height, (p) => p.Y, main.ScreenSize));
            this.EncompassingView.Add(new Binding <int, Point>(EncompassingView.Width, (p) => p.X, main.ScreenSize));
            this.MainView.Add(new Binding <Vector2, int>(MainView.Position, i => new Vector2(i / 2f, MainView.Y), EncompassingView.Width));
            this.MainView.Add(new Binding <Vector2, int>(MainView.Position, i => new Vector2(MainView.X, i / 2f), EncompassingView.Height));

            new TextView(main.GeeUI, MainView, "Workshop entry:", new Vector2(10, 8));
            this.SelectFile = new DropDownView(main.GeeUI, MainView, new Vector2(10, 35));
            SelectFile.AddOption("[Fetching...]", null);
            this.SelectFile.Position.Value = new Vector2(10, 30);

            this.queryResult = SteamWorker.GetCreatedWorkShopEntries((entries) =>
            {
                SelectFile.RemoveAllOptions();
                SelectFile.AddOption("[new]", delegate()
                {
                    this.currentPublishedFile = default(SteamUGCDetails_t);
                    this.UploadButton.Text    = "Publish";
                    this.UploadButton.AllowMouseEvents.Value = true;
                    this.CloseButton.AllowMouseEvents.Value  = true;
                });
                var listEntries = entries as List <SteamUGCDetails_t>;
                if (listEntries == null)
                {
                    SelectFile.AddOption("[Error fetching entries]", null);
                    return;
                }
                foreach (var entry in listEntries)
                {
                    SteamUGCDetails_t entry1 = entry;
                    SelectFile.AddOption(entry.m_rgchTitle, () =>
                    {
                        this.currentPublishedFile = entry1;
                        this.NameView.Text        = entry1.m_rgchTitle;
                        this.DescriptionView.Text = entry1.m_rgchDescription;
                        this.UploadButton.Text    = "Update";
                        this.UploadButton.AllowMouseEvents.Value = true;
                        this.CloseButton.AllowMouseEvents.Value  = true;
                    }, related: entry);
                }
            });

            new TextView(main.GeeUI, MainView, "Name:", new Vector2(10, 68));
            this.NameView = new TextFieldView(main.GeeUI, MainView, new Vector2(10, 85))
            {
                MultiLine = false
            };
            new TextView(main.GeeUI, MainView, "Description:", new Vector2(10, 118));
            this.DescriptionView = new TextFieldView(main.GeeUI, MainView, new Vector2(10, 135));

            this.UploadButton = new ButtonView(main.GeeUI, MainView, "Publish", new Vector2(50, 360));
            this.CloseButton  = new ButtonView(main.GeeUI, MainView, "Close", new Vector2(300, 360));

            var statusString = new TextView(main.GeeUI, MainView, "Waiting", new Vector2(110, 365))
            {
                TextJustification = TextJustification.Center,
            };

            statusString.AutoSize.Value = false;
            statusString.Width.Value    = 190;

            ConfigureTextField(NameView);
            ConfigureTextField(DescriptionView);

            UploadButton.OnMouseClick += (sender, args) =>
            {
                DoUpload();
            };

            CloseButton.OnMouseClick += (sender, args) =>
            {
                this.Delete.Execute();
            };

            this.Add(new Binding <string>(statusString.Text, StatusString));

            base.Awake();
        }
Esempio n. 33
0
        public DropDownView(GeeUIMain theGeeUI, View parentView, Vector2 position)
            : base(theGeeUI, parentView)
        {
            this.numChildrenAllowed          = 1;
            ParentGeeUI.OnKeyPressedHandler += this.keyPressedHandler;
            var button = new ButtonView(theGeeUI, this, "", Vector2.Zero);

            button.Add(new Binding <int>(this.Width, button.Width));
            button.Add(new Binding <int>(this.Height, button.Height));
            button.OnMouseClick += delegate(object sender, EventArgs e)
            {
                ToggleDropDown();
                this.FilterView.TemporarilyIgnoreMouseClickAway = true;
            };

            button.OnMouseClickAway += delegate(object sender, EventArgs args)
            {
                HideDropDown();
            };

            button.OnMouseRightClick += (sender, args) =>
            {
                if (AllowRightClickExecute)
                {
                    ExecuteLast();
                }
            };

            button.Name = "button";

            this.DropDownPanelView = new PanelView(theGeeUI, theGeeUI.RootView, Vector2.Zero);
            DropDownPanelView.ChildrenLayouts.Add(new VerticalViewLayout(2, false));
            this.DropDownPanelView.SelectedNinepatch = this.DropDownPanelView.UnselectedNinepatch = GeeUIMain.NinePatchDropDown;

            FilterView = new TextFieldView(theGeeUI, DropDownPanelView, Vector2.Zero);

            // HACK
            FilterView.Height.Value = (int)(20 * theGeeUI.Main.MainFontMultiplier);

            FilterView.MultiLine = false;
            FilterView.Add(new Binding <int>(FilterView.Width, x => x - 8, DropDownPanelView.Width));
            FilterView.OnTextChanged = () =>
            {
                if (FilterView.Active && DropDownPanelView.Active && AllowFilterText)
                {
                    Refilter();
                }
            };

            DropDownListView = new ListView(theGeeUI, DropDownPanelView);
            DropDownListView.ChildrenLayouts.Add(new VerticalViewLayout(1, false));
            DropDownListView.ScrollMultiplier = 20;
            DropDownListView.Add(new Binding <int, Rectangle>(DropDownListView.Width, x => Math.Max(200, x.Width), DropDownListView.ChildrenBoundBox));
            DropDownListView.Add(new Binding <int, Rectangle>(DropDownListView.Height, x => x.Height, DropDownListView.ChildrenBoundBox));

            DropDownPanelView.Add(new Binding <int>(DropDownPanelView.Width, DropDownListView.Width));

            DropDownListView.Name = "DropList";
            DropDownPanelView.Add(new Binding <int>(DropDownPanelView.Height, (i1) => i1 + 2 + ((AllowFilterText && FilterView.Active) ? FilterView.BoundBox.Height : 0), DropDownListView.Height));

            DropDownPanelView.Active.Value = false;

            this.Add(new SetBinding <string>(this.Label, delegate(string value)
            {
                ((ButtonView)FindFirstChildByName("button")).Text = value;
            }));
        }