/// <summary>
        /// Private helper to change one of the pane lightweight controls.
        /// </summary>
        /// <param name="lightweightControl">The new lightweight control.</param>
        /// <param name="paneLightweightControl">The pane lightweight control to change.</param>
        private void ChangePaneLightweightControl(LightweightControl lightweightControl, ref LightweightControl paneLightweightControl)
        {
            //	If the pane lightweight control is changing, change it.
            if (paneLightweightControl != lightweightControl)
            {
                //	If we have a current lightweight control in the pane, remove it.
                if (paneLightweightControl != null)
                {
                    paneLightweightControl.LightweightControlContainerControl = null;
                }

                //	Set the pane lightweight control.
                paneLightweightControl = lightweightControl;

                //	If we have a new lightweight control in the pane, add it.
                if (paneLightweightControl != null)
                {
                    paneLightweightControl.LightweightControlContainerControl = this;
                }

                //	Layout and invalidate.
                PerformLayout();
                Invalidate();
            }
        }
 private void AddCommandBarEntries(CommandBarEntryCollection entries, ArrayList list, bool rightAligned)
 {
     foreach (CommandBarEntry entry in entries)
     {
         LightweightControl control = entry.GetLightweightControl(this, rightAligned);
         list.Add(control);
     }
 }
Exemple #3
0
        /// <summary>
        /// Removes a specific <see cref='OpenLiveWriter.Controls.LightweightControl'/> from the <see cref='OpenLiveWriter.Controls.LightweightControlCollection'/> .
        /// </summary>
        /// <param name='value'>The <see cref='OpenLiveWriter.Controls.LightweightControl'/> to remove from the <see cref='OpenLiveWriter.Controls.LightweightControlCollection'/> .</param>
        /// <exception cref='System.ArgumentException'><paramref name='value'/> is not found in the Collection. </exception>
        public void Remove(LightweightControl value)
        {
            //	Remove the lightweight control.
            List.Remove(value);

            //	Set the lightweight control container of the lightweight control.
            value.LightweightControlContainerControl = null;

            //	Force the owner of this lightweight control collection to apply layout logic to child controls.
            owner.PerformLayout();
        }
Exemple #4
0
        /// <summary>
        /// Brings the lightweight control to the front of the z-order.
        /// </summary>
        /// <param name="value"></param>
        public void BringToFront(LightweightControl value)
        {
            //	Remove the lightweight control from the list.
            List.Remove(value);

            //	Add the lightweight control back to the list, now as the front control in the z-order.
            List.Add(value);

            //	Force the owner of this lightweight control collection to apply layout logic to child controls.
            owner.PerformLayout();
        }
Exemple #5
0
        /// <summary>
        /// Handles OnLeave for the LCCC.
        /// </summary>
        internal void OnLeave()
        {
            //_restoreFocusTargetControl = null;
            _focusedControlIndex = -1;
            _enteredState        = false;

            if (_control.ActiveLightweightControl != null)
            {
                LightweightControl focusedControl = _control.ActiveLightweightControl.GetFocusedControl();
                if (focusedControl != null)
                {
                    focusedControl.Unfocus();
                }
            }
        }
Exemple #6
0
        /// <summary>
        /// Inserts a <see cref='OpenLiveWriter.Controls.LightweightControl'/> into the <see cref='OpenLiveWriter.Controls.LightweightControlCollection'/> at the specified index.
        /// </summary>
        /// <param name='index'>The zero-based index where <paramref name='value'/> should be inserted.</param>
        /// <param name=' value'>The <see cref='OpenLiveWriter.Controls.LightweightControl'/> to insert.</param>
        /// <seealso cref='OpenLiveWriter.Controls.LightweightControlCollection.Add'/>
        public void Insert(int index, LightweightControl value)
        {
            //	Insert.
            List.Insert(index, value);

            //	Set the lightweight control container of the lightweight control to the owner of
            //	this lightweight control collection.
            value.LightweightControlContainerControl = owner;

            //	Force the lightweight control to apply layout logic to child controls.
            value.PerformLayout();

            //	Force the owner of this lightweight control collection to apply layout logic to child controls.
            owner.PerformLayout();
        }
Exemple #7
0
        /// <summary>
        /// Clears the lightweight control collection.
        /// </summary>
        public new void Clear()
        {
            //	Make a working copy of the lightweight control list.
            LightweightControl[] lightweightControls = new LightweightControl[Count];
            CopyTo(lightweightControls, 0);

            //	Remove each lightweight control.
            foreach (LightweightControl lightweightControl in lightweightControls)
            {
                lightweightControl.LightweightControlContainerControl = null;
                lightweightControl.Dispose();
            }

            //	Force the owner to apply layout logic to child controls.
            owner.PerformLayout();
        }
Exemple #8
0
        /// <summary>
        /// Adds a <see cref='OpenLiveWriter.Controls.LightweightControl'/> with the specified value to the
        /// <see cref='OpenLiveWriter.Controls.LightweightControlCollection'/> .
        /// </summary>
        /// <param name='value'>The <see cref='OpenLiveWriter.Controls.LightweightControl'/> to add.</param>
        /// <returns>The index at which the new element was inserted.</returns>
        /// <seealso cref='OpenLiveWriter.Controls.LightweightControlCollection.AddRange'/>
        public int Add(LightweightControl value)
        {
            //	Add.
            int index = List.Add(value);

            //	Set the lightweight control container of the lightweight control to the owner of
            //	this lightweight control collection.
            value.LightweightControlContainerControl = owner;

            //	Force the lightweight control to apply layout logic to child controls.
            value.PerformLayout();

            //	Force the owner of this lightweight control collection to apply layout logic to child controls.
            owner.PerformLayout();

            //	Return index.
            return(index);
        }
        /// <summary>
        /// Clears the workspace column pane.
        /// </summary>
        private void Clear()
        {
            //	If there's a control or a lightweight control, remove it.
            if (control != null)
            {
                control.Parent = null;
                control.Dispose();
                control = null;
            }
            else if (lightweightControl != null)
            {
                lightweightControl.LightweightControlContainerControl = null;
                lightweightControl.Dispose();
                lightweightControl = null;
            }

            //	Poof!  We're invisible.
            Visible = false;
        }
Exemple #10
0
        /// <summary>
        /// Handles OnLostFocus for the LCCC.
        /// </summary>
        internal void OnLostFocus()
        {
            if (_control.ActiveLightweightControl != null)
            {
                LightweightControl focusedControl = _control.ActiveLightweightControl.GetFocusedControl();
                if (focusedControl != null)
                {
                    if (_enteredState)
                    {
                        //Focus was lost, but since the control is in "entered" state, the focus needs
                        //to be restored to the appropriate subcontrol when focus returns to this control
                        //(this can happen when the active window changes)
                        _focusedControlIndex = GetFocusedControlIndex();
                    }
                    focusedControl.Unfocus();
                }
                _control.ActiveLightweightControl = null;
            }

            _control.Invalidate(true);
        }
Exemple #11
0
            public override bool VisitLightweightControl(LightweightControl control)
            {
                if (!control.Visible || !control.TabStop)
                {
                    return(false);
                }

                if (control.Parent != null)
                {
                    if (!control.Parent.Focused)
                    {
                        control.Parent.Focus();
                    }
                    if (control.Parent is LightweightControlContainerControl)
                    {
                        (control.Parent as LightweightControlContainerControl).ActiveControl = null;
                    }
                }
                bool focused = control.Focus();

                return(focused);
            }
		/// <summary>
		/// Private helper to change one of the pane lightweight controls.
		/// </summary>
		/// <param name="lightweightControl">The new lightweight control.</param>
		/// <param name="paneLightweightControl">The pane lightweight control to change.</param>
		private void ChangePaneLightweightControl(LightweightControl lightweightControl, ref LightweightControl paneLightweightControl)
		{
			//	If the pane lightweight control is changing, change it.
			if (paneLightweightControl != lightweightControl)
			{
				//	If we have a current lightweight control in the pane, remove it.
				if (paneLightweightControl != null)
					paneLightweightControl.LightweightControlContainerControl = null;

				//	Set the pane lightweight control.
				paneLightweightControl = lightweightControl;

				//	If we have a new lightweight control in the pane, add it.
				if (paneLightweightControl != null)
					paneLightweightControl.LightweightControlContainerControl = this;

				//	Layout and invalidate.
				PerformLayout();
				Invalidate();
			}
		}
Exemple #13
0
 /// <summary>
 /// Add a control to the list of accessible controls.
 /// </summary>
 /// <param name="control"></param>
 public void AddControl(LightweightControl control)
 {
     Debug.Assert(!_controls.Contains(control));
     _controls.Add(control);
 }
Exemple #14
0
 public virtual bool VisitLightweightControl(LightweightControl control)
 {
     return(false);
 }
Exemple #15
0
 /// <summary>
 /// Returns the index of a <see cref='OpenLiveWriter.Controls.LightweightControl'/> in the <see cref='OpenLiveWriter.Controls.LightweightControlCollection'/>.
 /// </summary>
 /// <param name='value'>The <see cref='OpenLiveWriter.Controls.LightweightControl'/> to locate.</param>
 /// <returns>The index of the <see cref='OpenLiveWriter.Controls.LightweightControl'/> of <paramref name='value'/> in the <see cref='OpenLiveWriter.Controls.LightweightControlCollection'/>, if found; otherwise, -1.</returns>
 /// <seealso cref='OpenLiveWriter.Controls.LightweightControlCollection.Contains'/>
 public int IndexOf(LightweightControl value)
 {
     return(List.IndexOf(value));
 }
Exemple #16
0
 /// <summary>
 /// Gets a value indicating whether the <see cref='OpenLiveWriter.Controls.LightweightControlCollection'/> contains the specified <see cref='OpenLiveWriter.Controls.LightweightControl'/>.
 /// </summary>
 /// <param name='value'>The <see cref='OpenLiveWriter.Controls.LightweightControl'/> to locate.</param>
 /// <returns><see langword='true'/> if the <see cref='OpenLiveWriter.Controls.LightweightControl'/> is contained in the collection; otherwise, <see langword='false'/>.</returns>
 /// <seealso cref='OpenLiveWriter.Controls.LightweightControlCollection.IndexOf'/>
 public bool Contains(LightweightControl value)
 {
     return(List.Contains(value));
 }
 /// <summary>
 /// Initializes a new instance of the ObjectStoreEventArgs class.
 /// </summary>
 /// <param name="lightweightControl">The LightweightControl.</param>
 public LightweightControlEventArgs(LightweightControl lightweightControl)
 {
     this.lightweightControl = lightweightControl;
 }
Exemple #18
0
 public override bool VisitLightweightControl(LightweightControl control)
 {
     return(control.Focused);
 }