/// ------------------------------------------------------------------------------------
 /// <summary>
 /// Add another slave to the synchronization group.
 /// Note that it is usually also necessary to add it to the Controls collection.
 /// That isn't done here to give the client more control over when it is done.
 /// </summary>
 /// <param name="rootsite"></param>
 /// ------------------------------------------------------------------------------------
 public override void AddToSyncGroup(IRootSiteSlave rootsite)
 {
     base.AddToSyncGroup(rootsite);
     if (rootsite != null)
     {
         rootsite.Group = this;
     }
 }
Example #2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Creates the control in column.
        /// </summary>
        /// <param name="cell">The cell that will host the control we create.</param>
        /// ------------------------------------------------------------------------------------
        private void CreateHostedControl(DataGridViewControlCell cell)
        {
            if (cell.ControlCreateInfo == null || cell.ControlCreateInfo.ViewProxy == null)
            {
                return;
            }

            IRootSiteGroup group = cell.ControlCreateInfo.Group;
            Control        c     = cell.ControlCreateInfo.ViewProxy.CreateView(this);

            if (c is RootSite)
            {
                RootSite rs = c as RootSite;
                rs.Cache      = m_cache;
                rs.StyleSheet = m_StyleSheet;
            }

            if (group != null && c is IRootSiteSlave)
            {
                IRootSiteSlave slave = c as IRootSiteSlave;
                group.AddToSyncGroup(slave);

                if (cell.ControlCreateInfo.IsScrollingController)
                {
#if __MonoCS__
                    // TODO-Linux: HACK Check to see if a ScrollingControl has (in error) already been set.
                    // hack to prevent multiple scrollbars controling a group
                    // This isn't needed in Windows as RootSite.cs check to see if it is the Group ScrollingController
                    // Which should mean that if multiple scrolling Control are set only the last one actually contains a scrollbar
                    // However because on mono Creating events aren't exactly the same (shame!) the group property of the RootSite get set before
                    // the second RootSite with the ScrollingControl set, get created meaning when the group is set it IS the scrolling controler! (and hence AutoScroll isn't set to false)
                    // A alternative way of fixing this (and probably better) would be to change the ViewWrapperContructor to only set a single ScrollingControl
                    // (currently BtWrapper set one) and calls it base which also has set one.
                    if (group.ScrollingController != null)
                    {
                        if (group.ScrollingController is ScrollableControl)
                        {
                            (group.ScrollingController as ScrollableControl).AutoScroll = false;
                        }
                    }
#endif
                    group.ScrollingController = slave;
                }
            }

            if (c is ISelectableView)
            {
                ((ISelectableView)c).BaseInfoBarCaption = m_baseInfoBarCaption;
            }

            cell.ControlCreateInfo.Control = c;

            OnHostedControlCreated(c);
        }
Example #3
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Creates the control in column.
        /// </summary>
        /// <param name="cell">The cell that will host the control we create.</param>
        /// ------------------------------------------------------------------------------------
        private void CreateHostedControl(DataGridViewControlCell cell)
        {
            if (cell.ControlCreateInfo == null || (ControlCreator == null &&
                                                   !(cell.ControlCreateInfo.ClientControlInfo is FixedControlCreateInfo)))
            {
                return;
            }

            IRootSiteGroup group = cell.ControlCreateInfo.Group;
            Control        c;

            if (cell.ControlCreateInfo.ClientControlInfo is FixedControlCreateInfo)
            {
                // We know how to deal with this!
                c = ((FixedControlCreateInfo)cell.ControlCreateInfo.ClientControlInfo).Control;
            }
            else
            {
                c = ControlCreator.Create(this, cell.ControlCreateInfo.ClientControlInfo);
            }

            if (c is RootSite)
            {
                RootSite rs = c as RootSite;
                rs.Cache      = m_cache;
                rs.StyleSheet = m_StyleSheet;
            }

            if (group != null && c is IRootSiteSlave)
            {
                IRootSiteSlave slave = c as IRootSiteSlave;
                group.AddToSyncGroup(slave);

                if (cell.ControlCreateInfo.IsScrollingController)
                {
                    group.ScrollingController = slave;
                }
            }

            if (c is ISelectableView)
            {
                ((ISelectableView)c).BaseInfoBarCaption = m_baseInfoBarCaption;
            }

            cell.ControlCreateInfo.Control = c;

            OnHostedControlCreated(c);
        }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Add another slave to the synchronization group.
        /// Note that it is usually also necessary to add it to the Controls collection.
        /// That isn't done here to give the client more control over when it is done.
        /// </summary>
        /// <param name="rootSiteSlave">The slave to add</param>
        /// ------------------------------------------------------------------------------------
        public virtual void AddToSyncGroup(IRootSiteSlave rootSiteSlave)
        {
            CheckDisposed();

            if (rootSiteSlave == null)
            {
                return;
            }
            m_slaves.Add(rootSiteSlave);
            IRootSite rootSite = rootSiteSlave as IRootSite;

            if (rootSite != null)
            {
                rootSite.AllowPainting = AllowPainting;
            }
        }
Example #5
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Add another slave to the synchronization group.
		/// Note that it is usually also necessary to add it to the Controls collection.
		/// That isn't done here to give the client more control over when it is done.
		/// </summary>
		/// <param name="rootsite"></param>
		/// ------------------------------------------------------------------------------------
		public override void AddToSyncGroup(IRootSiteSlave rootsite)
		{
			base.AddToSyncGroup(rootsite);
			if (rootsite != null)
				rootsite.Group = this;
		}
Example #6
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Add another slave to the synchronization group.
		/// Note that it is usually also necessary to add it to the Controls collection.
		/// That isn't done here to give the client more control over when it is done.
		/// </summary>
		/// <param name="rootSiteSlave">The slave to add</param>
		/// ------------------------------------------------------------------------------------
		public virtual void AddToSyncGroup(IRootSiteSlave rootSiteSlave)
		{
			CheckDisposed();

			if (rootSiteSlave == null)
				return;
			m_slaves.Add(rootSiteSlave);
			IRootSite rootSite = rootSiteSlave as IRootSite;
			if (rootSite != null)
				rootSite.AllowPainting = AllowPainting;
		}
Example #7
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Add another slave to the synchronization group.
		/// Note that it is usually also necessary to add it to the Controls collection.
		/// That isn't done here to give the client more control over when it is done.
		/// </summary>
		/// <param name="rootsite"></param>
		/// ------------------------------------------------------------------------------------
		public void AddToSyncGroup(IRootSiteSlave rootsite)
		{
			CheckDisposed();

			if (rootsite == null)
				return;
			m_slaves.Add(rootsite);
			rootsite.Group = this;
		}
Example #8
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.
				Debug.Assert(m_scrollingController == null ||
					Controls.Contains(m_scrollingController as Control));
				if (m_slaves != null)
				{
					// We need to close all of the rootboxes because when controls are
					// destroyed they cause the other controls still on the parent to
					// resize. If the rootbox is sync'd with other views then the other
					// views will try to layout their rootboxes. This is BAD!!! :)
					foreach (RootSite site in m_slaves)
						site.CloseRootBox();

					foreach (Control ctrl in m_slaves)
					{
						if (!Controls.Contains(ctrl))
							ctrl.Dispose();
					}
				}
				if (m_slaves != null)
					m_slaves.Clear();
			}

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

			base.Dispose(disposing);
		}