Scrollable text box widget.
Inheritance: Widget
Beispiel #1
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();
		}
Beispiel #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();
		}
Beispiel #3
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;
		}
Beispiel #4
0
		/// <summary>
		/// Hides whatever dialog is currently showing.
		/// </summary>
		public void CloseDialog()
		{
			if ( this.Dialog != null )
			{
				if ( this.mOk != null )
				{
					this.mOk.Cleanup();
					this.mOk = null;
				}
				else
				{
					if ( this.mYes != null )
					{
						this.mYes.Cleanup();
					}
					if ( this.mNo != null )
					{
						this.mNo.Cleanup();
					}

					this.mYes = null;
					this.mNo = null;
				}
				this.mDialogShade.Hide();
				this.Dialog.Cleanup();
				this.Dialog = null;
				if ( !this.CursorWasVisible )
				{
					HideCursor();
				}
			}
		}
Beispiel #5
0
		/// <summary>
		/// Pops up a question dialog with Yes and No buttons.
		/// </summary>
		/// <param name="caption"></param>
		/// <param name="question"></param>
		public void ShowYesNoDialog( DisplayString caption, DisplayString question )
		{
			OverlayElement e;
			if ( this.Dialog != null )
			{
				this.Dialog.Caption = caption;
				this.Dialog.Text = question;
				if ( this.mOk != null )
				{
					if ( this.mOk != null )
					{
						this.mOk.Cleanup();
					}

					this.mOk = null;
				}
				else
				{
					return;
				}
			}
			else
			{
				// give widgets a chance to reset in case they're in the middle of something
				for ( int i = 0; i < 10; i++ )
				{
					for ( int j = 0; j < this.mWidgets[ i ].Count; j++ )
					{
						this.mWidgets[ i ][ j ].OnLostFocus();
					}
				}
				this.mDialogShade.Show();
				this.Dialog = new TextBox( this.mName + "/DialogBox", caption, 300, 208 );
				this.Dialog.Text = question;
				e = this.Dialog.OverlayElement;
				this.mDialogShade.AddChild( e );
				e.VerticalAlignment = VerticalAlignment.Center;
				e.Left = -( e.Width/2 );
				e.Top = -( e.Height/2 );
				this.CursorWasVisible = IsCursorVisible;
				ShowCursor();
			}
			this.mYes = new Button( this.mName + "/YesButton", "Yes", 58 );
			this.mYes.AssignedTrayListener = this;
			e = this.mYes.OverlayElement;
			this.mDialogShade.AddChild( e );
			e.VerticalAlignment = VerticalAlignment.Center;
			e.Left = -( e.Width + 2 );
			e.Top = this.Dialog.OverlayElement.Top + this.Dialog.OverlayElement.Height + 5;
			this.mNo = new Button( this.mName + "/NoButton", "No", 50 );
			this.mNo.AssignedTrayListener = this;
			e = this.mNo.OverlayElement;
			this.mDialogShade.AddChild( e );
			e.VerticalAlignment = VerticalAlignment.Center;
			e.Left = 3;
			e.Top = this.Dialog.OverlayElement.Top + this.Dialog.OverlayElement.Height + 5;
		}
Beispiel #6
0
		/// <summary>
		/// Hides whatever dialog is currently showing.
		/// </summary>
		public void CloseDialog()
		{
			if ( Dialog != null )
			{
				if ( mOk != null )
				{
					mOk.Cleanup();
					mOk = null;
				}
				else
				{
					if ( mYes != null )
						mYes.Cleanup();
					if ( mNo != null )
						mNo.Cleanup();

					mYes = null;
					mNo = null;
				}
				mDialogShade.Hide();
				Dialog.Cleanup();
				Dialog = null;
				if ( !CursorWasVisible )
					HideCursor();
			}
		}
Beispiel #7
0
		/// <summary>
		/// Pops up a message dialog with an OK button.
		/// </summary>
		/// <param name="caption"></param>
		/// <param name="message"></param>
		public void ShowOkDialog( DisplayString caption, DisplayString message )
		{
			OverlayElement e;
			if ( Dialog != null )
			{
				Dialog.Caption = caption;
				Dialog.Text = message;
				if ( mOk != null )
					return;
				else
				{
					if ( mYes != null )
						mYes.Cleanup();
					if ( mNo != null )
						mNo.Cleanup();

					mYes = null;
					mNo = null;
				}
			}
			else
			{
				// give widgets a chance to reset in case they're in the middle of something
				for ( int i = 0; i < 10; i++ )
				{
					for ( int j = 0; j < mWidgets[ i ].Count; j++ )
					{
						mWidgets[ i ][ j ].OnLostFocus();
					}
				}
				mDialogShade.Show();
				Dialog = new TextBox( mName + "/DialogBox", caption, 300, 208 );
				Dialog.Text = message;
				e = Dialog.OverlayElement;
				mDialogShade.AddChild( e );
				e.VerticalAlignment = VerticalAlignment.Center;
				e.Left = -( e.Width / 2 );
				e.Top = -( e.Height / 2 );
				CursorWasVisible = IsCursorVisible;
				ShowCursor();
			}
			mOk = new Button( mName + "/OkButton", "OK", 60 );
			mOk.AssignedTrayListener = this;
			e = mOk.OverlayElement;
			mDialogShade.AddChild( e );
			e.VerticalAlignment = VerticalAlignment.Center;
			e.Left = -( e.Width / 2 );
			e.Top = Dialog.OverlayElement.Top + Dialog.OverlayElement.Height + 5;
		}