InnerFwListBox implements the main body of an FwListBox.
Inheritance: SIL.FieldWorks.Common.RootSites.SimpleRootSite
Example #1
0
		public void UpdateBlankString(InnerFwListBox listbox)
		{
			CheckDisposed();

			ITsStrFactory tsf = TsStrFactoryClass.Create();
			m_tssBlanks = tsf.MakeString (new string(' ', 200), m_listbox.WritingSystemCode);
		}
Example #2
0
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			//Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
			// Must not be run more than once.
			if (IsDisposed)
				return;

			// m_sda COM object block removed due to crash in Finializer thread LT-6124

			if (disposing)
			{
				Controls.Clear();
				if (m_items != null)
					m_items.Dispose(); // This has to be done, before the next dispose.

				if (m_sda != null)
					m_sda.RemoveNotification(this);

				if (m_innerFwListBox != null)
					m_innerFwListBox.Dispose();
			}
			m_sda = null;
			m_items = null;
			m_innerFwListBox = null;
			m_tabStopControl = null;

			base.Dispose(disposing);
		}
Example #3
0
		/// <summary>
		/// Construct one. Must be part of an InnerFwListBox.
		/// </summary>
		/// <param name="listbox"></param>
		internal ListBoxVc(InnerFwListBox listbox)
		{
			m_listbox = listbox;
			UpdateBlankString(listbox);
		}
Example #4
0
		/// <summary>
		/// Executes in two distinct scenarios.
		///
		/// 1. If disposing is true, the method has been called directly
		/// or indirectly by a user's code via the Dispose method.
		/// Both managed and unmanaged resources can be disposed.
		///
		/// 2. If disposing is false, the method has been called by the
		/// runtime from inside the finalizer and you should not reference (access)
		/// other managed objects, as they already have been garbage collected.
		/// Only unmanaged resources can be disposed.
		/// </summary>
		/// <param name="disposing"></param>
		/// <remarks>
		/// If any exceptions are thrown, that is fine.
		/// If the method is being done in a finalizer, it will be ignored.
		/// If it is thrown by client code calling Dispose,
		/// it needs to be handled by fixing the bug.
		///
		/// If subclasses override this method, they should call the base implementation.
		/// </remarks>
		protected override void Dispose(bool disposing)
		{
			//Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
			// Must not be run more than once.
			if (IsDisposed)
				return;

			if (disposing)
			{
				// Dispose managed resources here.
			}

			// Dispose unmanaged resources here, whether disposing is true or false.
			m_listbox = null;
			if (m_tssBlanks != null)
			{
				Marshal.ReleaseComObject(m_tssBlanks);
				m_tssBlanks = null;
			}

			base.Dispose(disposing);
		}
Example #5
0
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			Debug.WriteLineIf(!disposing, "****************** Missing Dispose() call for " + GetType().Name + " ******************");
			// Must not be run more than once.
			if (IsDisposed)
				return;

			// m_sda COM object block removed due to crash in Finializer thread LT-6124

			if (disposing)
			{
				// Don't call Controls.Clear(). The Controls collection will be taken care of in the base class

				if (m_items != null)
					m_items.Dispose(); // This has to be done, before the next dispose.

				if (m_sda != null)
					m_sda.RemoveNotification(this);

				// Don't explicitly dispose inner list box - it gets disposed as part of Controls!
			}
			m_sda = null;
			m_items = null;
			m_innerFwListBox = null;
			m_tabStopControl = null;

			base.Dispose(disposing);
		}
Example #6
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Default Constructor.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public FwListBox()
		{
			m_items = new ObjectCollection(this);
			m_innerFwListBox = new InnerFwListBox(this);
			m_innerFwListBox.Dock = DockStyle.Fill;
			m_innerFwListBox.ReadOnlyView = true;		// ComboBoxStyle is always DropDownList.
			this.BorderStyle = BorderStyle.Fixed3D;
			this.Controls.Add(m_innerFwListBox);
			// This causes us to get a notification when the string gets changed.
			m_sda = m_innerFwListBox.DataAccess;
			m_sda.AddNotification(this);

			// This makes it, by default if the container's initialization doesn't change it,
			// the same default size as a standard list box.
			this.Size = new Size(120,84);
			// And, if not changed, it's background color is white.
			this.BackColor = SystemColors.Window;
			m_SelectedIndex = -1; // initially nothing selected.
			m_HighlightedIndex = -1; // nor highlighted.
		}
Example #7
0
		public void IsHighlighted_CollectionWithSingleElement_ReturnsTrue()
		{
			using (var listBox = new FwListBox())
			{
					using (var innerFwListBox = new InnerFwListBox(listBox))
					{
						ITsString testString1 = TsStringHelper.MakeTSS("test1", m_hvoEnglishWs);
						listBox.Items.Add(testString1);
						innerFwListBox.MakeRoot();
						listBox.HighlightedIndex = 0;

						// The Test
						Assert.AreEqual(true, innerFwListBox.IsHighlighted(0));
					}
			}
		}
Example #8
0
		public void IsHighlighted_EmptyFwListBox_ReturnsFalse()
		{
			using (var listBox = new FwListBox())
			{
				using (var innerFwListBox = new InnerFwListBox(listBox))
				{
					// The Test
					Assert.AreEqual(false, innerFwListBox.IsHighlighted(0));
				}
			}
		}
Example #9
0
		public void SetShowHighlight_EmptyFwListBox_ShouldBeSetToFalse()
		{
			using (var listBox = new FwListBox())
			{
				using (var innerFwListBox = new InnerFwListBox(listBox))
				{
					// The Test
					innerFwListBox.ShowHighlight = false;
					Assert.AreEqual(false, innerFwListBox.ShowHighlight);
				}
			}
		}
Example #10
0
		public void ShowHighlight_EmptyFwListBox_ReturnsTrue()
		{
			using (var listBox = new FwListBox())
			{
				using (var innerFwListBox = new InnerFwListBox(listBox))
				{
					// The Test
					Assert.AreEqual(true, innerFwListBox.ShowHighlight);
				}
			}
		}
Example #11
0
		public void WritingSystemCode_EmptyFwListBox_DoesNotThrowException()
		{
			using (var listBox = new FwListBox())
			{
				using (var innerFwListBox = new InnerFwListBox(listBox))
				{
					// The Test
					Assert.GreaterOrEqual(innerFwListBox.WritingSystemCode, 0);
				}
			}
		}