예제 #1
0
        public PopupItemControl()
        {
            PainterFactory.InitFactory();
            if (!ColorFunctions.ColorsLoaded)
            {
                NativeFunctions.RefreshSettings();
                NativeFunctions.OnDisplayChange();
                ColorFunctions.LoadColors();
            }
            
            m_PopupItem = CreatePopupItem();
            m_PopupItem.GlobalItem = false;
            m_PopupItem.ContainerControl = this;
            m_PopupItem.Style = eDotNetBarStyle.Office2007;
            m_PopupItem.SetOwner(this);
            m_ColorScheme = new ColorScheme(m_PopupItem.EffectiveStyle);

            this.SetStyle(ControlStyles.UserPaint, true);
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.Opaque, true);
            this.SetStyle(ControlStyles.ResizeRedraw, true);
            this.SetStyle(DisplayHelp.DoubleBufferFlag, true);
            this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            this.SetStyle(ControlStyles.ContainerControl, false);

            this.SetStyle(ControlStyles.Selectable, true);
        }
예제 #2
0
        void IOwnerMenuSupport.RegisterPopup(PopupItem objPopup)
        {
            this.MenuFocus = true;

            if (m_RegisteredPopups.Contains(objPopup))
                return;

            if (!this.GetDesignMode() && !m_UseHook)
            {
                if (!m_FilterInstalled)
                {
                    MessageHandler.RegisterMessageClient(this);
                    m_FilterInstalled = true;
                }
            }
            else
            {
                if (m_Hook == null)
                {
                    m_Hook = new Hook(this);
                }
            }

            if (!m_MenuEventSupport)
                MenuEventSupportHook();

            m_RegisteredPopups.Add(objPopup);
            if (objPopup.GetOwner() != this)
                objPopup.SetOwner(this);
        }
예제 #3
0
		void IOwnerMenuSupport.RegisterPopup(PopupItem objPopup)
		{
			if(m_RegisteredPopups.Contains(objPopup))
				return;

            if (!this.GetDesignMode() && !m_UseHook)
            {
                InstallMessageFilter();

                if (!m_MenuEventSupport)
                    MenuEventSupportHook();
            }
            else
            {
                if (m_Hook == null)
                {
                    m_Hook = new Hook(this);
                }
            }

			m_RegisteredPopups.Add(objPopup);
			if(objPopup.GetOwner()!=this)
				objPopup.SetOwner(this);
		}
예제 #4
0
		void IOwnerMenuSupport.RegisterPopup(PopupItem objPopup)
		{
			if(m_RegisteredPopups.Contains(objPopup))
				return;
			
			if(!this.GetDesignMode())
			{
				if(!m_FilterInstalled)
				{
					//System.Windows.Forms.Application.AddMessageFilter(this);
					MessageHandler.RegisterMessageClient(this);
					m_FilterInstalled=true;
				}	
			}
            else
            {
                if (m_Hook == null)
                {
                    m_Hook = new Hook(this);
                }
            }

			if(!m_MenuEventSupport)
				MenuEventSupportHook();

			m_RegisteredPopups.Add(objPopup);
			if(objPopup.GetOwner()!=this)
				objPopup.SetOwner(this);
		}
예제 #5
0
        /// <summary>
        /// Displays or hides the automatic caption button popup menu.
        /// </summary>
        private void ToggleCaptionMenu()
        {
            if (m_CaptionMenu != null)
            {
                bool bClose = m_CaptionMenu.Expanded;
                if (bClose)
                    m_CaptionMenu.ClosePopup();
                m_CaptionMenu.Dispose();
                m_CaptionMenu = null;
                if (bClose)
                    return;
            }

            if (this.Items.Count <= 0)
                return;

            m_CaptionMenu = new ButtonItem("sysCaptionButtonMenuParent");
            m_CaptionMenu.Style = this.Style;
            m_CaptionMenu.PopupShowing += new EventHandler(this.CaptionMenuShowing);
            m_CaptionMenu.PopupFinalized += new EventHandler(this.CaptionMenuClose);
            foreach (BaseItem item in this.Items)
            {
                ButtonItem menuItem = new ButtonItem("sysCaption_" + item.Name);
                menuItem.Tag = item;
                menuItem.OptionGroup = "sysCaptionMenu";
                menuItem.Text = item.Text;
                menuItem.BeginGroup = item.BeginGroup;
                if (item is DockContainerItem)
                {
                    DockContainerItem dock = item as DockContainerItem;
                    menuItem.Checked = item.Displayed;
                    if (dock.Image != null)
                        menuItem.Image = dock.Image.Clone() as System.Drawing.Image;
                    else if (dock.Icon != null)
                        menuItem.Icon = dock.Icon.Clone() as System.Drawing.Icon;
                    else if (dock.ImageIndex >= 0 && dock.ImageList != null)
                        menuItem.Image = dock.ImageList.Images[dock.ImageIndex].Clone() as System.Drawing.Image;
                }
                else
                    menuItem.Checked = item.Visible;
                menuItem.Click += new EventHandler(this.CaptionMenuItemClick);
                m_CaptionMenu.SubItems.Add(menuItem);
            }

            if (m_CaptionMenu.GetOwner() == null)
                m_CaptionMenu.SetOwner(m_Owner);
            System.Drawing.Size size = m_CaptionMenu.PopupSize;
            Point popupLocation = new Point(m_SystemButtons.CaptionButtonRect.Right - size.Width, m_SystemButtons.CaptionButtonRect.Bottom);
            if (popupLocation.X < 0)
                popupLocation.X = 0;
            popupLocation = this.PointToScreen(popupLocation);
            m_CaptionMenu.Popup(popupLocation);
        }
예제 #6
0
		/// <summary>
		/// Registers popup item with DotNetBar. Use this function carefully. The registration is required only if Popup item is created completely from code and it is not added to any DotNetBarManager collection.
		/// </summary>
		/// <param name="objPopup"></param>
		public void RegisterPopup(PopupItem objPopup)
		{
			if(m_RegisteredPopups.Contains(objPopup))
				return;
			
			if(!this.DesignMode)
			{
				if(!m_FilterInstalled && !m_UseHook)
				{
					//System.Windows.Forms.Application.AddMessageFilter(this);
					MessageHandler.RegisterMessageClient(this);
					m_FilterInstalled=true;
				}
				else if(m_UseHook && m_Hook==null)
				{
					m_Hook=new Hook(this);
				}
			}
            else if (m_Hook == null)
            {
                m_Hook = new Hook(this);
            }

			m_RegisteredPopups.Add(objPopup);
			if(objPopup.GetOwner()==null)
				objPopup.SetOwner(this);
		}