コード例 #1
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);
        }
コード例 #2
0
 void IOwnerMenuSupport.UnregisterPopup(PopupItem objPopup)
 {
     if (m_RegisteredPopups.Contains(objPopup))
         m_RegisteredPopups.Remove(objPopup);
     if (m_RegisteredPopups.Count == 0)
     {
         MenuEventSupportUnhook();
         if (m_Hook != null)
         {
             m_Hook.Dispose();
             m_Hook = null;
         }
         this.MenuFocus = false;
     }
 }
コード例 #3
0
		protected override void OnHandleDestroyed(EventArgs e)
		{
			DisposeThemes();
			MenuEventSupportUnhook();
			base.OnHandleDestroyed(e);

			if(m_FilterInstalled)
			{
				MessageHandler.UnregisterMessageClient(this);
				m_FilterInstalled=false;
			}

            if (m_Hook != null)
            {
                m_Hook.Dispose();
                m_Hook = null;
            }
		}
コード例 #4
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);
		}
コード例 #5
0
		/// <summary>
		/// Un-registers specified popup. See RegisterPopup for more information.
		/// </summary>
		/// <param name="objPopup"></param>
		public void UnregisterPopup(PopupItem objPopup)
		{
			if(m_RegisteredPopups.Contains(objPopup))
				m_RegisteredPopups.Remove(objPopup);
			if(m_RegisteredPopups.Count==0 && m_Hook!=null && (!m_UseHook || this.DesignMode))
			{
				m_Hook.Dispose();
				m_Hook=null;
			}
		}
コード例 #6
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);
		}
コード例 #7
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);
		}
コード例 #8
0
		/// <summary>
		///    Clean up any resources being used.
		/// </summary>
		protected override void Dispose(bool disposing)
		{
			if(m_Disposed)
			{
				base.Dispose(disposing);
				return;
			}

			m_Disposed=true;

			if(disposing && m_License != null) 
			{
				m_License.Dispose();
				m_License = null;
			}

			if(m_ActiveMdiChild!=null)
			{
				m_ActiveMdiChild.Resize-=new EventHandler(this.OnMdiChildResize);
				m_ActiveMdiChild.VisibleChanged-=new EventHandler(this.OnMdiChildVisibleChanged);
				m_ActiveMdiChild=null;
			}

			this.Images=null;
			this.ImagesMedium=null;
			this.ImagesLarge=null;
			
			//ms_Managers.Remove(this);

			if(m_ClickTimer!=null)
			{
				m_ClickTimer.Stop();
				m_ClickTimer.Dispose();
				m_ClickTimer=null;
			}
			if(m_RegisteredPopups!=null && m_RegisteredPopups.Count>0)
			{
				BaseItem[] popups;
				lock(this)
				{
					popups=(BaseItem[])m_RegisteredPopups.ToArray(typeof(BaseItem));
				}
				foreach(PopupItem popup in popups)
					if(popup.Expanded) popup.ClosePopup();
				//m_RegisteredPopups=null;
			}

			// This was commented out becouse of the issue described below. This might have some of the same
			// problems as the solution below and after testing it did not show any ill effects.
//			if(m_MdiHandler!=null && m_MdiParentMsgHandler)
//			{
//				m_MdiHandler.ReleaseHandle();
//				m_MdiHandler=null;
//			}

			// Closing the form which contains dockable window which in turn contains the UserControl with DotNetBar and 
			// when DotNetBar is used to provide context menu for that UserControl
			// was rasing an NULL exception. fixed after 1.0.0.10
//			if(m_MsgHandler!=null)
//			{
//				m_MsgHandler.ReleaseHandle();
//				m_MsgHandler=null;
//			}
			ReleaseParentFormHooks();

			// Very bad things were happening when we put in the try..catch block, so I just commented it out. It seems it is working ok
			if(m_FilterInstalled)
			{
				// This was causing the Local Data Storage has been freed exception under some conditions. Client: [email protected], 02/25/2002
				//try
				//{
					//System.Windows.Forms.Application.RemoveMessageFilter(this);
					MessageHandler.UnregisterMessageClient(this);
				//}
				//catch(Exception)
				//{}
				m_FilterInstalled=false;
			}

			if(m_Hook!=null)
			{
				m_Hook.Dispose();
				m_Hook=null;
			}

			/*if(m_TopDockSite!=null)
			{
				if(m_TopDockSite.Parent!=null)
					m_TopDockSite.Parent.Controls.Remove(m_TopDockSite);
				m_TopDockSite.Dispose();
			}

			if(m_BottomDockSite!=null)
			{
				if(m_BottomDockSite.Parent!=null)
					m_BottomDockSite.Parent.Controls.Remove(m_BottomDockSite);
				m_BottomDockSite.Dispose();
			}

			if(m_LeftDockSite!=null)
			{
				if(m_LeftDockSite.Parent!=null)
					m_LeftDockSite.Parent.Controls.Remove(m_LeftDockSite);
				m_LeftDockSite.Dispose();
			}

			if(m_RightDockSite!=null)
			{
				if(m_RightDockSite.Parent!=null)
					m_RightDockSite.Parent.Controls.Remove(m_RightDockSite);
				m_RightDockSite.Dispose();
			}*/

			if(m_frmCustomize!=null)
			{
				m_frmCustomize.Close();
				if(m_frmCustomize!=null)
					m_frmCustomize.Dispose();
			}

			//foreach(DevComponents.DotNetBar.Bar  bar in m_Bars)
			//	bar.Dispose();
			if(m_Bars!=null)
			{
				//m_Bars.Clear();
				m_Bars=null;
			}
			if(m_Items!=null)
			{
				m_Items.Dispose();
				m_Items=null;
			}
			if(m_ContextMenus!=null)
			{
				m_ContextMenus.SetOwner(null);
				m_ContextMenus=null;
			}

			if(m_DisposeGCCollect) GC.Collect();

			base.Dispose(disposing);
		}
コード例 #9
0
		private void ParentVisibleChanged(object sender, System.EventArgs e)
		{
			if(m_ParentForm==null)
				return;
			if(m_ParentForm.Visible)
			{
				if(!m_FilterInstalled && !m_UseHook)
				{
					m_FilterInstalled=true;
					//System.Windows.Forms.Application.AddMessageFilter(this);
					MessageHandler.RegisterMessageClient(this);
				}
				else if(m_UseHook && m_Hook==null)
				{
					m_Hook=new Hook(this);
				}
			}
			else
			{
				if(m_FilterInstalled)
				{
					//System.Windows.Forms.Application.RemoveMessageFilter(this);
					MessageHandler.UnregisterMessageClient(this);
					m_FilterInstalled=false;
				}
				else if(m_Hook!=null)
				{
					m_Hook.Dispose();
					m_Hook=null;
				}
			}
		}
コード例 #10
0
		private void OnParentChanged()
		{
			// We always create docking sites on top level controls
			if(m_ParentForm==null)
				return;

            if(!this.DesignMode)
			    UnRegisterParentMsgHandler(this,m_ParentForm);

			if(m_ParentForm.IsHandleCreated && !this.DesignMode)
			{
				if(m_ParentForm.IsMdiChild && m_ParentForm.MdiParent!=null)
				{
					RegisterParentMsgHandler(this,m_ParentForm.MdiParent);
				}
				else
				{
                    RegisterParentMsgHandler(this,m_ParentForm);					
				}
			}

			m_ParentForm.HandleDestroyed+=new System.EventHandler(this.ParentHandleDestroyed);
			m_ParentForm.HandleCreated+=new System.EventHandler(this.ParentHandleCreated);
			if(!this.DesignMode)
			{
				m_ParentForm.Activated+=new System.EventHandler(this.ParentActivated);
				m_ParentForm.Deactivate+=new System.EventHandler(this.ParentDeactivate);
				m_ParentForm.Load+=new System.EventHandler(this.ParentLoad);
				m_ParentForm.VisibleChanged+=new System.EventHandler(this.ParentVisibleChanged);
				m_ParentForm.Resize+=new System.EventHandler(this.ParentResize);
			}

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

			// MDI Parent Handling
			if(m_MdiHandler!=null)
			{
                m_MdiHandler.MdiSetMenu -= this.OnMdiSetMenu;
				m_MdiHandler.ReleaseHandle();
				m_MdiHandler=null;
			}

			// MDI Handling...
			System.Windows.Forms.MdiClient client=((IOwner)this).GetMdiClient(m_ParentForm);
			if(client!=null)
			{
				SetupMdiHandler(client);
			}
			else
			{
				// Watch for its creation to catch it early
				m_ParentForm.ControlAdded+=new ControlEventHandler(ParentControlAdded);
				m_EventControlAdded=true;
			}

			// Try to load bar stream if possible
			//if(!this.DesignMode)
				BarStreamLoad();
		}
コード例 #11
0
        protected override void OnHandleCreated(EventArgs e)
        {
            if (!_FilterInstalled && !this.DesignMode)
            {
                MessageHandler.RegisterMessageClient(this);
                _FilterInstalled = true;
            }

            if (!this.GetDesignMode() && !_UseHook)
            {
                if (!_MenuEventSupport)
                    MenuEventSupportHook();
            }
            else
            {
                if (_Hook == null)
                {
                    _Hook = new Hook(this);
                }
            }
            base.OnHandleCreated(e);
        }