Esempio n. 1
0
		private void AddCustomizeItems()
		{
			BaseItem objTmp;
			BaseItem objParent;

			this.SubItems.Clear();

			// Find the right parent item
			/*System.Windows.Forms.Control objCtrl=this.ContainerControl as System.Windows.Forms.Control;
			if(objCtrl is Bar)
			{
				Bar objTlb=objCtrl as Bar;
				if(objTlb.Parent==null)
					objParent=this.Parent;
				else
					objParent=objTlb.Parent;
			}
			else
			{
				objParent=this.Parent;
			}*/
			objParent=this.Parent;

			while(objParent!=null && objParent.SystemItem && !(objParent.SystemItem && objParent is GenericItemContainer))
				objParent=objParent.Parent;

			if(objParent==null)
				return;

			foreach(BaseItem objItem in objParent.SubItems)
			{
				if(!objItem.SystemItem && objItem.CanCustomize)
				{
					objTmp=objItem.Copy();
					objTmp.GlobalItem=false;
					objTmp.ClearClick();
					objTmp.BeginGroup=false;
					objTmp.Enabled=true;
					objTmp.SubItems.Clear();
					objTmp.Tooltip="";
					objTmp.SetIsOnCustomizeMenu(true);
					if(objItem is ButtonItem)
					{
						((ButtonItem)objTmp).HotTrackingStyle=eHotTrackingStyle.Default;
                        if (m_AutoSizeMenuImages && !m_MenuImageSize.IsEmpty && ((ButtonItem)objTmp).ImageSize != m_MenuImageSize)
                        {
                            ((ButtonItem)objTmp).ImageFixedSize = m_MenuImageSize;
                            ((ButtonItem)objTmp).UseSmallImage = true;
                        }
					}
					objTmp.Click+=new System.EventHandler(ShowHideClick);
					objTmp.Tag=objItem;
					this.SubItems.Add(objTmp);
				}
			}
			if(objParent is GenericItemContainer && ((GenericItemContainer)objParent).MoreItems!=null)
			{
				BaseItem objMore=((GenericItemContainer)objParent).MoreItems;
				foreach(BaseItem objItem in objMore.SubItems)
				{
					if(!objItem.SystemItem)
					{
						objTmp=objItem.Copy();
						objTmp.GlobalItem=false;
						objTmp.ClearClick();
						objTmp.BeginGroup=false;
						objTmp.Enabled=true;
						objTmp.SubItems.Clear();
						objTmp.Tooltip="";
						objTmp.SetIsOnCustomizeMenu(true);
						objTmp.Click+=new System.EventHandler(ShowHideClick);
						objTmp.Tag=objItem;
						this.SubItems.Add(objTmp);
					}
				}
			}

			objTmp=null;

			ButtonItem objBtn=null;
			IOwner owner=this.GetOwner() as IOwner;
			if(owner!=null && owner.ShowResetButton)
			{
				// Reset Bar Item
				objBtn=new ButtonItem();
				objBtn.GlobalItem=false;
				objBtn.BeginGroup=true;
				objBtn.Text=m_ResetStr; // "&Reset Bar";
				objBtn.SetIsOnCustomizeMenu(true);
				objBtn.SetSystemItem(true);
				objBtn.Orientation=eOrientation.Horizontal;
				objBtn.Click+=new System.EventHandler(ResetClick);
				this.SubItems.Add(objBtn);
			}
			if(m_CustomizeItemVisible)
			{
				// Customize
				objBtn=new ButtonItem();
				objBtn.GlobalItem=false;
				if(owner==null || owner!=null && !owner.ShowResetButton)
					objBtn.BeginGroup=true;
				objBtn.Text=m_CustomizeStr; //"&Customize...";
				objBtn.SetIsOnCustomizeMenu(true);
				objBtn.SetSystemItem(true);
				objBtn.Click+=new System.EventHandler(CustomizeClick);
				this.SubItems.Add(objBtn);
			}

			m_NeedRecalcSize=false;
		}