Basic label widget.
Inheritance: Widget
Example #1
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="label"></param>
		public void LabelHit( Label label )
		{
		}
Example #2
0
		/// <summary>
		/// Sets up main page for browsing samples.
		/// </summary>
		protected virtual void SetupWidgets()
		{
			this.TrayManager.DestroyAllWidgets();

			// create main navigation tray
			this.TrayManager.ShowLogo( TrayLocation.Right );
			this.TrayManager.CreateSeparator( TrayLocation.Right, "LogoSep" );
			this.TrayManager.CreateButton( TrayLocation.Right, "StartStop", "Start Sample" );
			this.TrayManager.CreateButton( TrayLocation.Right, "UnloadReload",
			                               this.LoadedSamples.Count == 0 ? "Reload Samples" : "Unload Samples" );
			this.TrayManager.CreateButton( TrayLocation.Right, "Configure", "Configure" );
			this.TrayManager.CreateButton( TrayLocation.Right, "Quit", "Quit" );

			// // create sample viewing controls
			this.TitleLabel = this.TrayManager.CreateLabel( TrayLocation.Left, "SampleTitle", "" );
			this.DescBox = this.TrayManager.CreateTextBox( TrayLocation.Left, "SampleInfo", "Sample Info", 250, 208 );
			this.CategoryMenu = this.TrayManager.CreateThickSelectMenu( TrayLocation.Left, "CategoryMenu", "Select Category", 250,
			                                                            10 );
			this.SampleMenu = this.TrayManager.CreateThickSelectMenu( TrayLocation.Left, "SampleMenu", "Select Sample", 250, 10 );
			this.SampleSlider = this.TrayManager.CreateThickSlider( TrayLocation.Left, "SampleSlider", "Slide Samples", 250, 80,
			                                                        0, 0, 0 );

			/* Sliders do not notify their listeners on creation, so we manually call the callback here to format the slider value correctly. */
			SliderMoved( this.SampleSlider );

			// create configuration screen button tray
			this.TrayManager.CreateButton( TrayLocation.None, "Apply", "Apply Changes" );
			this.TrayManager.CreateButton( TrayLocation.None, "Back", "Go Back" );

			// create configuration screen label and renderer menu
			this.TrayManager.CreateLabel( TrayLocation.None, "ConfigLabel", "Configuration" );
			this.RendererMenu = this.TrayManager.CreateLongSelectMenu( TrayLocation.None, "RendererMenu", "Render System", 450,
			                                                           240, 10 );
			this.TrayManager.CreateSeparator( TrayLocation.None, "ConfigSeparator" );

			// populate render system names
			var rsNames = from rs in Root.RenderSystems.Values
			              select rs.Name;
			this.RendererMenu.Items = rsNames.ToList();

			PopulateSampleMenus();
		}
Example #3
0
		/// <summary>
		/// Toggles visibility of advanced statistics.
		/// </summary>
		/// <param name="label"></param>
		public void LabelHit( Label label )
		{
			if ( this.StatsPanel.OverlayElement.IsVisible )
			{
				this.StatsPanel.OverlayElement.Hide();
				this.mFpsLabel.OverlayElement.Width = 150;
				RemoveWidgetFromTray( this.StatsPanel );
			}
			else
			{
				this.StatsPanel.OverlayElement.Show();
				this.mFpsLabel.OverlayElement.Width = 180;
				MoveWidgetToTray( this.StatsPanel, this.mFpsLabel.TrayLocation, LocateWidgetInTray( this.mFpsLabel ) + 1 );
			}
		}
Example #4
0
		/// <summary>
		/// 
		/// </summary>
		protected override void Shutdown()
		{
			if ( this.TrayManager != null )
			{
				this.TrayManager = null;
			}
			if ( CurrentSample == null )
			{
				DestroyDummyScene();
			}

			this.CategoryMenu = null;
			this.SampleMenu = null;
			this.SampleSlider = null;
			this.TitleLabel = null;
			this.DescBox = null;
			this.RendererMenu = null;
			this.HiddenOverlays.Clear();
			this.Thumbs.Clear();
			this.CarouselPlace = 0;

			base.Shutdown();

			UnloadSamples();
		}
Example #5
0
		/// <summary>
		/// Destroys a widget.
		/// </summary>
		/// <param name="widget"></param>
		public void DestroyWidget( Widget widget )
		{
			if ( widget == null )
			{
				new AxiomException( "Widget does not exist,TrayManager.DestroyWidget" );
			}

			// in case special widgets are destroyed manually, set them to 0
			if ( widget == this.Logo )
			{
				this.Logo = null;
			}
			else if ( widget == this.StatsPanel )
			{
				this.StatsPanel = null;
			}
			else if ( widget == this.mFpsLabel )
			{
				this.mFpsLabel = null;
			}

			this.mTrays[ (int)widget.TrayLocation ].RemoveChild( widget.Name );

			WidgetList wList = this.mWidgets[ (int)widget.TrayLocation ];
			wList.Remove( widget );
			if ( widget == ExpandedMenu )
			{
				ExpandedMenu = null;
			}

			widget.Cleanup();

			this.mWidgetDeathRow.Add( widget );

			AdjustTrays();
		}
Example #6
0
		/// <summary>
		/// Hides frame statistics widget set.
		/// </summary>
		public void HideFrameStats()
		{
			if ( IsFrameStatsVisible )
			{
				DestroyWidget( this.mFpsLabel );
				DestroyWidget( this.StatsPanel );
				this.mFpsLabel = null;
				this.StatsPanel = null;
			}
		}
Example #7
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 );
		}
Example #8
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="trayLoc"></param>
		/// <param name="name"></param>
		/// <param name="caption"></param>
		/// <param name="width"></param>
		/// <returns></returns>
		public Label CreateLabel( TrayLocation trayLoc, String name, DisplayString caption, Real width )
		{
			var l = new Label( name, caption, width );
			MoveWidgetToTray( l, trayLoc );
			l.AssignedTrayListener = this.listener;
			return l;
		}
Example #9
0
		/// <summary>
		/// Hides frame statistics widget set.
		/// </summary>
		public void HideFrameStats()
		{
			if ( IsFrameStatsVisible )
			{
				DestroyWidget( mFpsLabel );
				DestroyWidget( StatsPanel );
				mFpsLabel = null;
				StatsPanel = null;
			}
		}