Exemplo n.º 1
0
        public static Panel createPanel(this SdkTrayManager trayMgr, TrayLocation trayLoc, string name, float width, float height, float left, float top)
        {
            Panel panel = new Panel(name, width, height, left, top);

            trayMgr.moveWidgetToTray(panel, trayLoc);
            return(panel);
        }
Exemplo n.º 2
0
        public DecorWidget CreateDecorWidget(TrayLocation trayLoc, string name, string templateName)
        {
            DecorWidget dw = new DecorWidget(name, templateName);

            MoveWidgetToTray(dw, trayLoc);
            return(dw);
        }
Exemplo n.º 3
0
        void MoveWidgetToTray(Widget widget, TrayLocation trayLoc, int place = -1)
        {
            Contract.ArgumentNotNull(widget, "widget");

            // remove widget from old tray
            var wList = _widgets[(int)widget.TrayLocation];

            if (wList.Contains(widget))
            {
                wList.Remove(widget);
                _trays[(int)widget.TrayLocation].RemoveChild(widget.Name);
            }

            // insert widget into new tray at given position, or at the end if unspecified or invalid
            if (place == -1 || place > (int)_widgets[(int)trayLoc].Count)
            {
                place = (int)_widgets[(int)trayLoc].Count;
            }

            _widgets[(int)trayLoc].Insert(place, widget);
            _trays[(int)trayLoc].AddChild(widget.OverlayElement);

            widget.OverlayElement.HorizontalAlignment = _trayWidgetAlign[(int)trayLoc];

            // adjust trays if necessary
            if (widget.TrayLocation != TrayLocation.None || trayLoc != TrayLocation.None)
            {
                AdjustTrays();
            }

            widget.TrayLocation = trayLoc;
        }
Exemplo n.º 4
0
        public static Panel createPanel(this SdkTrayManager trayMgr, TrayLocation trayLoc, string name)
        {
            Panel panel = new Panel(name);

            trayMgr.moveWidgetToTray(panel, trayLoc);
            return(panel);
        }
Exemplo n.º 5
0
        public Label CreateLabel(TrayLocation trayLoc, string name, string caption, float width = 0.0f)
        {
            Label l = new Label(name, caption, width);

            MoveWidgetToTray(l, trayLoc);
            //l->_assignListener(mListener);
            return(l);
        }
Exemplo n.º 6
0
        public ParamsPanel CreateParamsPanel(TrayLocation trayLoc, string name, float width, StringVector paramNames)
        {
            ParamsPanel pp = new ParamsPanel(name, width, paramNames.Count);

            pp.SetAllParamNames(paramNames);
            MoveWidgetToTray(pp, trayLoc);
            return(pp);
        }
Exemplo n.º 7
0
        public void ShowLogo(TrayLocation trayLoc, int place = -1)
        {
            if (!IsLogoVisible())
            {
                _logo = CreateDecorWidget(TrayLocation.None, Name + "/Logo", "SdkTrays/Logo");
            }

            MoveWidgetToTray(_logo, trayLoc, place);
        }
Exemplo n.º 8
0
 private void _addTextureShadowDebugOverlay(TrayLocation loc, int num)
 {
     for (var i = 0; i < num; ++i)
     {
         //TODO
         //Texture shadowTex = this.SceneManager.GetShadowTexture( i );
         //_addTextureDebugOverlay( loc, shadowTex, i );
     }
 }
Exemplo n.º 9
0
        public static InputBox createInputBox(this SdkTrayManager trayMgr, TrayLocation trayLoc, string name, string caption, float width, float boxWidth, string text = null, bool onlyAcceptNum = false)
        {
            InputBox ib = new InputBox(name, caption, width, boxWidth, text, onlyAcceptNum);

            trayMgr.moveWidgetToTray(ib, trayLoc);
            ib.Text = text;
            //ib._assignListener(mListener);
            return(ib);
        }
Exemplo n.º 10
0
        public void ShowFrameStats(TrayLocation trayLoc, int place = -1)
        {
            if (!AreFrameStatsVisible())
            {
                StringVector stats = new StringVector();
                stats.Add("Average FPS");
                stats.Add("Best FPS");
                stats.Add("Worst FPS");
                stats.Add("Triangles");
                stats.Add("Batches");

                _fpsLabel = CreateLabel(TrayLocation.None, Name + "/FpsLabel", "FPS:", 180);
                //_fpsLabel._AssignListener(this);
                _statsPanel = CreateParamsPanel(TrayLocation.None, Name + "/StatsPanel", 180, stats);
            }
        }
Exemplo n.º 11
0
        private void _addTextureDebugOverlay(TrayLocation loc, string texname, int i)
        {
            // Create material
            var matName  = "Axiom/DebugTexture" + i;
            var debugMat = (Material)MaterialManager.Instance.GetByName(matName);

            if (debugMat == null)
            {
                debugMat = (Material)MaterialManager.Instance.Create(matName, ResourceGroupManager.DefaultResourceGroupName);
            }

            var p = debugMat.GetTechnique(0).GetPass(0);

            p.RemoveAllTextureUnitStates();
            p.LightingEnabled = false;
            var t = p.CreateTextureUnitState(texname);

            t.SetTextureAddressingMode(TextureAddressing.Clamp);

            // create template
            if (OverlayManager.Instance.Elements.GetElement("Axiom/DebugTexOverlay", true) == null)
            {
                var e = OverlayManager.Instance.Elements.CreateElement("Panel", "Axiom/DebugTexOverlay", true);
                e.MetricsMode = MetricsMode.Pixels;
                e.Width       = 128;
                e.Height      = 128;
            }

            // add widget
            var widgetName = "DebugTex" + i;
            var w          = TrayManager.GetWidget(widgetName);

            if (w == null)
            {
                w = TrayManager.CreateDecorWidget(loc, widgetName, "", "Axiom/DebugTexOverlay");
            }

            w.OverlayElement.MaterialName = matName;
        }
Exemplo n.º 12
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="trayLoc"></param>
		/// <param name="name"></param>
		/// <param name="caption"></param>
		/// <param name="width"></param>
		/// <param name="maxItemsShown"></param>
		/// <returns></returns>
		public SelectMenu CreateThickSelectMenu( TrayLocation trayLoc, String name, DisplayString caption, Real width,
		                                         int maxItemsShown )
		{
			return CreateThickSelectMenu( trayLoc, name, caption, width, maxItemsShown, new List<String>() );
		}
Exemplo n.º 13
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="trayLoc"></param>
		/// <param name="name"></param>
		/// <param name="caption"></param>
		/// <param name="width"></param>
		/// <param name="height"></param>
		/// <returns></returns>
		public TextBox CreateTextBox( TrayLocation trayLoc, String name, DisplayString caption, Real width, Real height )
		{
			var tb = new TextBox( name, caption, width, height );
			MoveWidgetToTray( tb, trayLoc );
			tb.AssignedTrayListener = this.listener;
			return tb;
		}
Exemplo n.º 14
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="trayLoc"></param>
		/// <param name="name"></param>
		/// <param name="caption"></param>
		/// <param name="width"></param>
		/// <returns></returns>
		public Button CreateButton( TrayLocation trayLoc, String name, String caption, Real width )
		{
			var b = new Button( name, caption, width );
			MoveWidgetToTray( b, trayLoc );
			b.AssignedTrayListener = this.listener;
			return b;
		}
Exemplo n.º 15
0
		/// <summary>
		/// Destroys all widgets in a tray.
		/// </summary>
		/// <param name="trayLoc"></param>
		public void DestroyAllWidgetsInTray( TrayLocation trayLoc )
		{
			while ( !( this.mWidgets[ (int)trayLoc ].Count == 0 ) )
			{
				DestroyWidget( this.mWidgets[ (int)trayLoc ][ 0 ] );
			}
		}
Exemplo n.º 16
0
		/// <summary>
		/// Shows logo in the specified location.
		/// </summary>
		/// <param name="trayLoc"></param>
		public void ShowLogo( TrayLocation trayLoc )
		{
			ShowLogo( trayLoc, -1 );
		}
Exemplo n.º 17
0
		/// <summary>
		/// Destroys a widget.
		/// </summary>
		/// <param name="trayLoc"></param>
		/// <param name="place"></param>
		public void DestroyWidget( TrayLocation trayLoc, int place )
		{
			DestroyWidget( GetWidget( trayLoc, place ) );
		}
Exemplo n.º 18
0
 private void _addTextureDebugOverlay(TrayLocation loc, Texture tex, int i)
 {
     _addTextureDebugOverlay(loc, tex.Name, i);
 }
Exemplo n.º 19
0
		/// <summary>
		///  Gets a widget from a tray by name.
		/// </summary>
		/// <param name="trayLoc"></param>
		/// <param name="name"></param>
		/// <returns></returns>
		public Widget GetWidget( TrayLocation trayLoc, String name )
		{
			for ( int i = 0; i < this.mWidgets[ (int)trayLoc ].Count; i++ )
			{
				if ( this.mWidgets[ (int)trayLoc ][ i ].Name == name )
				{
					return this.mWidgets[ (int)trayLoc ][ i ];
				}
			}
			return null;
		}
Exemplo n.º 20
0
		/// <summary>
		/// Adds a widget to a specified tray.
		/// </summary>
		/// <param name="currentTrayLoc"></param>
		/// <param name="currentPlace"></param>
		/// <param name="targetTrayLoc"></param>
		/// <param name="targetPlace"></param>
		public void MoveWidgetToTray( TrayLocation currentTrayLoc, int currentPlace, TrayLocation targetTrayLoc,
		                              int targetPlace )
		{
			MoveWidgetToTray( GetWidget( currentTrayLoc, currentPlace ), targetTrayLoc, targetPlace );
		}
Exemplo n.º 21
0
		/// <summary>
		/// Adds a widget to a specified tray.
		/// </summary>
		/// <param name="currentTrayLoc"></param>
		/// <param name="name"></param>
		/// <param name="targetTrayLoc"></param>
		/// <param name="place"></param>
		public void MoveWidgetToTray( TrayLocation currentTrayLoc, String name, TrayLocation targetTrayLoc, int place )
		{
			MoveWidgetToTray( GetWidget( currentTrayLoc, name ), targetTrayLoc, place );
		}
Exemplo n.º 22
0
		/// <summary>
		/// Adds a widget to a specified tray.
		/// </summary>
		/// <param name="name"></param>
		/// <param name="trayLoc"></param>
		/// <param name="place"></param>
		public void MoveWidgetToTray( String name, TrayLocation trayLoc, int place )
		{
			MoveWidgetToTray( GetWidget( name ), trayLoc, place );
		}
Exemplo n.º 23
0
		/// <summary>
		/// Adds a widget to a specified tray.
		/// </summary>
		/// <param name="name"></param>
		/// <param name="trayLoc"></param>
		public void MoveWidgetToTray( String name, TrayLocation trayLoc )
		{
			MoveWidgetToTray( GetWidget( name ), trayLoc, -1 );
		}
Exemplo n.º 24
0
		/// <summary>
		/// Adds a widget to a specified tray.
		/// </summary>
		/// <param name="widget"></param>
		/// <param name="trayLoc"></param>
		/// <param name="place"></param>
		public void MoveWidgetToTray( Widget widget, TrayLocation trayLoc, int place )
		{
			if ( widget == null )
			{
				throw new ArgumentNullException( "widget", "Widget deos not exist." );
			}

			// remove widget from old tray
			WidgetList wList = this.mWidgets[ (int)widget.TrayLocation ];
			if ( wList == null )
			{
				wList = new WidgetList();
				this.mWidgets[ (int)widget.TrayLocation ] = wList;
			}

			if ( wList.Contains( widget ) )
			{
				wList.Remove( widget );
				this.mTrays[ (int)widget.TrayLocation ].RemoveChild( widget.Name );
			}

			// insert widget into new tray at given position, or at the end if unspecified or invalid
			if ( place == -1 || place > this.mWidgets[ (int)trayLoc ].Count )
			{
				place = this.mWidgets[ (int)trayLoc ].Count;
			}
			this.mWidgets[ (int)trayLoc ].Insert( place, widget );
			// mWidgets[ (int)trayLoc ].Add( widget );
			this.mTrays[ (int)trayLoc ].AddChild( widget.OverlayElement );

			widget.OverlayElement.HorizontalAlignment = this.trayWidgetAlign[ (int)trayLoc ];

			// adjust trays if necessary
			if ( widget.TrayLocation != TrayLocation.None || trayLoc != TrayLocation.None )
			{
				AdjustTrays();
			}

			widget.AssigendTray = trayLoc;
			//widget.Show();
			//mTraysLayer.AddElement( (OverlayElementContainer)widget.OverlayElement);
		}
Exemplo n.º 25
0
		/// <summary>
		/// Adds a widget to a specified tray.
		/// </summary>
		/// <param name="widget"></param>
		/// <param name="trayLoc"></param>
		public void MoveWidgetToTray( Widget widget, TrayLocation trayLoc )
		{
			MoveWidgetToTray( widget, trayLoc, -1 );
		}
Exemplo n.º 26
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="trayLoc"></param>
		/// <param name="name"></param>
		/// <param name="caption"></param>
		/// <param name="width"></param>
		/// <param name="maxItemsShown"></param>
		/// <param name="items"></param>
		/// <returns></returns>
		public SelectMenu CreateThickSelectMenu( TrayLocation trayLoc, String name, DisplayString caption, Real width,
		                                         int maxItemsShown, IList<String> items )
		{
			var sm = new SelectMenu( name, caption, width, 0, maxItemsShown );
			MoveWidgetToTray( sm, trayLoc );
			sm.AssignedTrayListener = this.listener;
			if ( !( items.Count == 0 ) )
			{
				sm.Items = items;
			}
			return sm;
		}
Exemplo n.º 27
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="trayLoc"></param>
		/// <param name="name"></param>
		/// <param name="caption"></param>
		/// <param name="boxWidth"></param>
		/// <param name="maxItemsShown"></param>
		/// <returns></returns>
		public SelectMenu createLongSelectMenu( TrayLocation trayLoc, String name, DisplayString caption, Real boxWidth,
		                                        int maxItemsShown )
		{
			return CreateLongSelectMenu( trayLoc, name, caption, 0, boxWidth, maxItemsShown, new List<string>() );
		}
Exemplo n.º 28
0
		private void _addTextureDebugOverlay( TrayLocation loc, string texname, int i )
		{
			// Create material
			var matName = "Axiom/DebugTexture" + i;
			var debugMat = (Material)MaterialManager.Instance.GetByName( matName );
			if ( debugMat == null )
			{
				debugMat = (Material)MaterialManager.Instance.Create( matName, ResourceGroupManager.DefaultResourceGroupName );
			}

			var p = debugMat.GetTechnique( 0 ).GetPass( 0 );
			p.RemoveAllTextureUnitStates();
			p.LightingEnabled = false;
			var t = p.CreateTextureUnitState( texname );
			t.SetTextureAddressingMode( TextureAddressing.Clamp );

			// create template
			if ( OverlayManager.Instance.Elements.GetElement( "Axiom/DebugTexOverlay", true ) == null )
			{
				var e = OverlayManager.Instance.Elements.CreateElement( "Panel", "Axiom/DebugTexOverlay", true );
				e.MetricsMode = MetricsMode.Pixels;
				e.Width = 128;
				e.Height = 128;
			}

			// add widget
			var widgetName = "DebugTex" + i;
			var w = TrayManager.GetWidget( widgetName );
			if ( w == null )
			{
				w = TrayManager.CreateDecorWidget( loc, widgetName, "", "Axiom/DebugTexOverlay" );
			}

			w.OverlayElement.MaterialName = matName;
		}
Exemplo n.º 29
0
		/// <summary>
		/// Shows frame statistics widget set in the specified location.
		/// </summary>
		/// <param name="trayLoc"></param>
		/// <param name="place"></param>
		public void ShowFrameStats( TrayLocation trayLoc, int place )
		{
			if ( !IsFrameStatsVisible )
			{
				var stats = new List<string>();
				stats.Add( "Average FPS" );
				stats.Add( "Best FPS" );
				stats.Add( "Worst FPS" );
				stats.Add( "Triangles" );
				stats.Add( "Batches" );

				this.mFpsLabel = CreateLabel( TrayLocation.None, this.mName + "/FpsLabel", "FPS:", 180 );
				this.mFpsLabel.AssignedTrayListener = this;
				this.StatsPanel = CreateParamsPanel( TrayLocation.None, this.mName + "/StatsPanel", 180, stats );
			}

			MoveWidgetToTray( this.mFpsLabel, trayLoc, place );
			MoveWidgetToTray( this.StatsPanel, trayLoc, LocateWidgetInTray( this.mFpsLabel ) + 1 );
		}
Exemplo n.º 30
0
		/// <summary>
		/// Gets all the widgets of a specific tray.
		/// </summary>
		/// <param name="trayLoc"></param>
		/// <returns></returns>
		public IEnumerator<Widget> GetWidgetEnumerator( TrayLocation trayLoc )
		{
			return this.mWidgets[ (int)trayLoc ].GetEnumerator();
		}
Exemplo n.º 31
0
		/// <summary>
		/// Shows logo in the specified location.
		/// </summary>
		/// <param name="trayLoc"></param>
		/// <param name="place"></param>
		public void ShowLogo( TrayLocation trayLoc, int place )
		{
			if ( !IsLogoVisible )
			{
				this.Logo = CreateDecorWidget( trayLoc, this.mName + "/Logo", "Panel", "SdkTrays/Logo" );
			}
			MoveWidgetToTray( this.Logo, trayLoc, place );
		}
Exemplo n.º 32
0
		/// <summary>
		/// Shows frame statistics widget set in the specified location.
		/// </summary>
		/// <param name="trayLoc"></param>
		public void ShowFrameStats( TrayLocation trayLoc )
		{
			ShowFrameStats( trayLoc, -1 );
		}
Exemplo n.º 33
0
		/// <summary>
		/// Gets a widget from a tray by place.
		/// </summary>
		/// <param name="trayLoc"></param>
		/// <param name="place"></param>
		/// <returns></returns>
		public Widget GetWidget( TrayLocation trayLoc, int place )
		{
			if ( place >= 0 && place < this.mWidgets[ (int)trayLoc ].Count )
			{
				return this.mWidgets[ (int)trayLoc ][ place ];
			}
			return null;
		}
Exemplo n.º 34
0
		/// <summary>
		/// Destroys a widget.
		/// </summary>
		/// <param name="trayLoc"></param>
		/// <param name="name"></param>
		public void DestroyWidget( TrayLocation trayLoc, String name )
		{
			DestroyWidget( GetWidget( trayLoc, name ) );
		}
Exemplo n.º 35
0
		/// <summary>
		/// Removes a widget from its tray. Same as moving it to the null tray.
		/// </summary>
		/// <param name="trayLoc"></param>
		/// <param name="name"></param>
		public void RemoveWidgetFromTray( TrayLocation trayLoc, String name )
		{
			RemoveWidgetFromTray( GetWidget( trayLoc, name ) );
		}
Exemplo n.º 36
0
		/// <summary>
		/// Gets the number of widgets in a tray.
		/// </summary>
		/// <param name="trayLoc"></param>
		/// <returns></returns>
		public int GetWidgetCount( TrayLocation trayLoc )
		{
			return this.mWidgets[ (int)trayLoc ].Count;
		}
Exemplo n.º 37
0
		private void _addTextureDebugOverlay( TrayLocation loc, Texture tex, int i )
		{
			_addTextureDebugOverlay( loc, tex.Name, i );
		}
Exemplo n.º 38
0
		/// <summary>
		/// Removes a widget from its tray. Same as moving it to the null tray.
		/// </summary>
		/// <param name="trayLoc"></param>
		/// <param name="place"></param>
		public void RemoveWidgetFromTray( TrayLocation trayLoc, int place )
		{
			RemoveWidgetFromTray( GetWidget( trayLoc, place ) );
		}
Exemplo n.º 39
0
		private void _addTextureShadowDebugOverlay( TrayLocation loc, int num )
		{
			for ( var i = 0; i < num; ++i )
			{
				//TODO
				//Texture shadowTex = this.SceneManager.GetShadowTexture( i );
				//_addTextureDebugOverlay( loc, shadowTex, i );
			}
		}
Exemplo n.º 40
0
		/// <summary>
		/// Removes all widgets from a widget tray.
		/// </summary>
		/// <param name="trayLoc"></param>
		public void ClearTray( TrayLocation trayLoc )
		{
			if ( trayLoc == TrayLocation.None )
			{
				return; // can't clear the null tray
			}

			while ( !( this.mWidgets[ (int)trayLoc ].Count == 0 ) ) // remove every widget from given tray
			{
				RemoveWidgetFromTray( this.mWidgets[ (int)trayLoc ][ 0 ] );
			}
		}
Exemplo n.º 41
0
		/// <summary>
		/// Sets horizontal alignment of a tray's contents.
		/// </summary>
		/// <param name="trayLoc"></param>
		/// <param name="gha"></param>
		public void SetTrayWidgetAlignment( TrayLocation trayLoc, HorizontalAlignment gha )
		{
			this.trayWidgetAlign[ (int)trayLoc ] = gha;

			for ( int i = 0; i < this.mWidgets[ (int)trayLoc ].Count; i++ )
			{
				this.mWidgets[ (int)trayLoc ][ i ].OverlayElement.HorizontalAlignment = gha;
			}
		}
Exemplo n.º 42
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="trayLoc"></param>
		/// <param name="name"></param>
		/// <param name="caption"></param>
		/// <returns></returns>
		public Button CreateButton( TrayLocation trayLoc, String name, String caption )
		{
			return CreateButton( trayLoc, name, caption, 0 );
		}
Exemplo n.º 43
0
 protected Widget()
 {
     TrayLocation = TrayLocation.None;
 }
Exemplo n.º 44
0
 /// <summary>
 ///
 /// </summary>
 public Widget()
 {
     this.trayLoc  = TrayLocation.None;
     this.element  = null;
     this.listener = null;
 }