コード例 #1
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Sets properties for a menu bar or toolbar.
		/// </summary>
		/// <param name="bar">Bar to update.</param>
		/// <param name="barProps">New properties of bar.</param>
		/// ------------------------------------------------------------------------------------
		private void SetBarProperties(ToolStrip bar, TMBarProperties barProps)
		{
			if (bar == null || barProps == null || !barProps.Update)
				return;

			if (barProps.Text != bar.Text)
				bar.Text = barProps.Text;

			if (barProps.Enabled != bar.Enabled)
				bar.Enabled = barProps.Enabled;

			bool isBarDisplayed;
			if (!m_displayedBars.TryGetValue(bar.Name, out isBarDisplayed))
				isBarDisplayed = false;

			if (barProps.Visible != isBarDisplayed)
			{
				if (barProps.Visible)
					ShowToolBar(bar.Name);
				else
					HideToolBar(bar.Name);
			}
		}
コード例 #2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private int CompareBarProps(TMBarProperties x, TMBarProperties y)
		{
			return ((new CaseInsensitiveComparer()).Compare(x.Text, y.Text));
		}
コード例 #3
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Sets the properties of the main menu bar.
		/// object.
		/// </summary>
		/// <param name="barProps">Properties used to modfy the toolbar item.</param>
		/// ------------------------------------------------------------------------------------
		public void SetBarProperties(TMBarProperties barProps)
		{
			foreach (ToolStrip bar in m_bars.Values)
				SetBarProperties(bar, barProps);
		}
コード例 #4
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Sets properties for a menu bar or toolbar.
		/// </summary>
		/// <param name="name">Name of bar to update.</param>
		/// <param name="barProps">New properties of bar.</param>
		/// ------------------------------------------------------------------------------------
		public void SetBarProperties(string name, TMBarProperties barProps)
		{
			ToolStrip bar;
			if (m_bars.TryGetValue(name, out bar))
				SetBarProperties(bar, barProps);
		}
コード例 #5
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Make a new toolbar and initialize it based on what's in the XML
		/// definition.
		/// </summary>
		/// <param name="node"></param>
		/// <param name="barName"></param>
		/// ------------------------------------------------------------------------------------
		private ToolStrip MakeNewBar(XmlNode node, string barName)
		{
			// Every bar must have a unique name so if we received a null or empty barName
			// then name it with a new guid.
			if (string.IsNullOrEmpty(barName))
				barName = Guid.NewGuid().ToString();

			ToolStrip bar = ToolStripItemExtender.CreateToolStrip();
			m_bars[barName] = bar;
			bar.Name = barName;
			bar.AccessibleName = barName;
			Point barLoc = new Point(0, 0);
			barLoc.X = GetIntFromAttribute(node, "position", 0);
			barLoc.Y = GetIntFromAttribute(node, "row", m_barLocations.Count);
			m_barLocations[bar] = barLoc;

			string barText = GetAttributeValue(node, "text");
			barText = GetStringFromResource(barText);
			TMBarProperties barProps = new TMBarProperties(barName, barText, true,
				GetBoolFromAttribute(node, "visible", true), m_parentForm);

			if (InitializeBar != null)
				InitializeBar(ref barProps);

			m_displayedBars[barName] = barProps.Visible;
			barProps.Update = true;
			SetBarProperties(bar, barProps);

			return bar;
		}
コード例 #6
0
ファイル: DNBAdapter.cs プロジェクト: bbriggs/FieldWorks
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Sets properties for a menu bar or toolbar.
		/// </summary>
		/// <param name="bar">Bar to update.</param>
		/// <param name="barProps">New properties of bar.</param>
		/// ------------------------------------------------------------------------------------
		private void SetBarProperties(Bar bar, TMBarProperties barProps)
		{
			if (bar == null || barProps == null || !barProps.Update)
				return;

			if (barProps.Text != bar.Text)
				bar.Text = barProps.Text;

			if (barProps.Enabled != bar.Enabled)
				bar.Enabled = barProps.Enabled;

			if (barProps.Visible != bar.Visible)
			{
				if (barProps.Visible)
					bar.Show();
				else
					bar.Hide();
			}
		}
コード例 #7
0
ファイル: DNBAdapter.cs プロジェクト: bbriggs/FieldWorks
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Sets properties for a menu bar or toolbar.
		/// </summary>
		/// <param name="name">Name of bar to update.</param>
		/// <param name="barProps">New properties of bar.</param>
		/// ------------------------------------------------------------------------------------
		public void SetBarProperties(string name, TMBarProperties barProps)
		{
			SetBarProperties(m_dnbMngr.Bars[name], barProps);
		}
コード例 #8
0
ファイル: DNBAdapter.cs プロジェクト: bbriggs/FieldWorks
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Sets the properties of the main menu bar.
		/// object.
		/// </summary>
		/// <param name="barProps">Properties used to modfy the toolbar item.</param>
		/// ------------------------------------------------------------------------------------
		public void SetBarProperties(TMBarProperties barProps)
		{
			foreach (Bar bar in m_dnbMngr.Bars)
			{
				if (bar.MenuBar)
					SetBarProperties(bar, barProps);
			}
		}
コード例 #9
0
ファイル: DNBAdapter.cs プロジェクト: bbriggs/FieldWorks
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Make a new toolbar and initialize it based on what's in the XML
		/// definition.
		/// </summary>
		/// <param name="node"></param>
		/// <param name="barName"></param>
		/// ------------------------------------------------------------------------------------
		private Bar MakeNewBar(XmlNode node, string barName)
		{
			// Every bar must have a unique name so if we received a null or empty barName
			// then name it with a new guid.
			if (barName == null || barName == string.Empty)
				barName = Guid.NewGuid().ToString();

			Bar bar = new Bar();
			bar.Name = barName;
			bar.AccessibleName = barName;
			bar.MenuBar = false;
			bar.ShowToolTips = true;
			bar.CanCustomize = GetBoolFromAttribute(node, "allowcustomizing");
			bar.CanHide = true;
			bar.CanUndock = m_allowUndocking;
			bar.DockOffset = 0;
			bar.WrapItemsDock = false;
			bar.WrapItemsFloat = false;
			bar.ItemsContainer.Style = eDotNetBarStyle.OfficeXP;
			bar.GrabHandleStyle = eGrabHandleStyle.StripeFlat;

			Point barLoc = new Point(0, 0);
			barLoc.X = GetIntFromAttribute(node, "position", 0);
			barLoc.Y = GetIntFromAttribute(node, "row", m_dnbMngr.Bars.Count);
			m_htBarLocations[bar] = barLoc;

			string barText = GetAttributeValue(node, "text");
			barText = GetStringFromResource(barText);
			TMBarProperties barProps = new TMBarProperties(barName, barText, true,
				GetBoolFromAttribute(node, "visible", true), m_parentForm);

			if (InitializeBar != null)
				InitializeBar(ref barProps);

			barProps.Update = true;
			SetBarProperties(bar, barProps);

			return bar;
		}