GuiElement representing a flat, single-material (or transparent) panel which can contain other elements.
This class subclasses GuiContainer because it can contain other elements. Like other containers, if hidden it's contents are also hidden, if moved it's contents also move etc. The panel itself is a 2D rectangle which is either completely transparent, or is rendered with a single material. The texture(s) on the panel can be tiled depending on your requirements.

This component is suitable for backgrounds and grouping other elements. Note that because it has a single repeating material it cannot have a discrete border (unless the texture has one and the texture is tiled only once). For a bordered panel, see it's subclass BorderPanel.

Note that the material can have all the usual effects applied to it like multiple texture layers, scrolling / animated textures etc. For multiple texture layers, you have to set the tiling level for each layer.

Inheritance: OverlayElementContainer
Exemple #1
0
        private Dictionary<Int32, List<UpgradeGroup.Upgrade>> upgradesByCost; // Used for displaying indicator dots.

        #endregion Fields

        #region Constructors

        public UpgradeHUD(Ship pPlayerShip, Overlay pOverlay)
        {
            // Initialize local variables.
            playerShip = pPlayerShip;
            overlay = pOverlay;
            inSelectionMode = false;
            selectedUpgrade = 0;
            upgradesByCost = new Dictionary<int, List<UpgradeGroup.Upgrade>>();
            upgradePanelsByCost = new Dictionary<int, List<BorderPanel>>();
            costSelectorPanels = new Dictionary<int, BorderPanel>();

            // Create the upgrade panel.
            masterUpgradePanel = new PanelFactory().Create("Upgrade Panel") as Panel;
        }
Exemple #2
0
		/// <summary>
		///  Do not instantiate any widgets directly. Use SdkTrayManager.
		/// </summary>
		/// <param name="name"></param>
		/// <param name="caption"></param>
		/// <param name="width"></param>
		/// <param name="boxWidth"></param>
		/// <param name="maxItemsShown"></param>
		public SelectMenu( String name, String caption, Real width, Real boxWidth, int maxItemsShown )
		{
			items = new List<string>();
			itemElements = new List<BorderPanel>();

			this.sectionIndex = -1;
			this.isFitToContents = false;
			this.IsCursorOver = false;
			this.isExpanded = false;
			this.isDragging = false;
			this.maxItemsShown = maxItemsShown;
			this.itemsShown = 0;
			element = (BorderPanel)OverlayManager.Instance.Elements.CreateElementFromTemplate
										( "SdkTrays/SelectMenu", "BorderPanel", name );
			this.textArea = (TextArea)( (OverlayElementContainer)element ).Children[ name + "/MenuCaption" ];
			this.smallBox = (BorderPanel)( (OverlayElementContainer)element ).Children[ name + "/MenuSmallBox" ];
			this.smallBox.Width = width - 10;
			this.smallTextArea = (TextArea)this.smallBox.Children[ name + "/MenuSmallBox/MenuSmallText" ];
			element.Width = width;

			if ( boxWidth > 0 )  // long style
			{
				if ( width <= 0 )
					this.isFitToContents = true;
				this.smallBox.Width = boxWidth;
				this.smallBox.Top = 2;
				this.smallBox.Left = width - boxWidth - 5;
				element.Height = this.smallBox.Height + 4;
				this.textArea.HorizontalAlignment = HorizontalAlignment.Left;
				this.textArea.TextAlign = HorizontalAlignment.Left;
				this.textArea.Left = 12;
				this.textArea.Top = 10;
			}

			this.expandedBox = (BorderPanel)( (OverlayElementContainer)element ).Children[ name + "/MenuExpandedBox" ];
			this.expandedBox.Width = this.smallBox.Width + 10;
			this.expandedBox.Hide();
			this.scrollTrack = (BorderPanel)this.expandedBox.Children[ this.expandedBox.Name + "/MenuScrollTrack" ];
			this.scrollHandle = (Panel)this.scrollTrack.Children[ this.scrollTrack.Name + "/MenuScrollHandle" ];

			this.Caption = caption;
		}
Exemple #3
0
		/// <summary>
		/// Do not instantiate any widgets directly. Use SdkTrayManager.
		/// </summary>
		/// <param name="name"></param>
		/// <param name="caption"></param>
		/// <param name="width"></param>
		/// <param name="height"></param>
		public TextBox( String name, String caption, Real width, Real height )
		{
			this.lines = new List<string>();
			element = OverlayManager.Instance.Elements.CreateElementFromTemplate( "SdkTrays/TextBox", "BorderPanel", name );
			element.Width = width;
			element.Height = height;
			var container = (OverlayElementContainer)element;
			this.textArea = (TextArea)container.Children[ Name + "/TextBoxText" ];
			this.captionBar = (BorderPanel)container.Children[ Name + "/TextBoxCaptionBar" ];
			this.captionBar.Width = width - 4;
			this.captionTextArea = (TextArea)this.captionBar.Children[ this.captionBar.Name + "/TextBoxCaption" ];
			Caption = caption;
			this.scrollTrack = (BorderPanel)container.Children[ Name + "/TextBoxScrollTrack" ];
			this.scrollHandle = (Panel)this.scrollTrack.Children[ this.scrollTrack.Name + "/TextBoxScrollHandle" ];
			this.scrollHandle.Hide();
			this.isDragging = false;
			this.scrollPercentage = 0;
			this.startingLine = 0;
			this.padding = 15;
			this.text = "";
			RefitContents();
		}
Exemple #4
0
		/// <summary>
		/// Do not instantiate any widgets directly. Use SdkTrayManager.
		/// </summary>
		/// <param name="name"></param>
		/// <param name="caption"></param>
		/// <param name="width"></param>
		/// <param name="trackWidth"></param>
		/// <param name="valueBoxWidth"></param>
		/// <param name="minValue"></param>
		/// <param name="maxValue"></param>
		/// <param name="snaps"></param>
		public Slider( String name, String caption, Real width, Real trackWidth, Real valueBoxWidth, Real minValue,
		               Real maxValue, int snaps )
		{
			this.isDragging = false;
			this.isFitToContents = false;
			element = OverlayManager.Instance.Elements.CreateElementFromTemplate( "SdkTrays/Slider", "BorderPanel", name );
			element.Width = width;
			var c = (OverlayElementContainer)element;
			this.textArea = (TextArea)c.Children[ Name + "/SliderCaption" ];
			var valueBox = (OverlayElementContainer)c.Children[ Name + "/SliderValueBox" ];
			valueBox.Width = valueBoxWidth;
			valueBox.Left = -( valueBoxWidth + 5 );
			this.valueTextArea = (TextArea)valueBox.Children[ valueBox.Name + "/SliderValueText" ];
			this.track = (BorderPanel)c.Children[ Name + "/SliderTrack" ];
			this.handle = (Panel)this.track.Children[ this.track.Name + "/SliderHandle" ];

			if ( trackWidth <= 0 ) // tall style
			{
				this.track.Width = width - 16;
			}
			else // long style
			{
				if ( width <= 0 )
				{
					this.isFitToContents = true;
				}
				element.Height = 34;
				this.textArea.Top = 10;
				valueBox.Top = 2;
				this.track.Top = -23;
				this.track.Width = trackWidth;
				this.track.HorizontalAlignment = HorizontalAlignment.Right;
				this.track.Left = -( trackWidth + valueBoxWidth + 5 );
			}

			Caption = caption;
			SetRange( minValue, maxValue, snaps, false );
		}