WinForms implementation of IShelfView.

This class may subclassed if customization is desired. In this case, the DesktopWindowView class must also be subclassed in order to instantiate the subclass from its DesktopWindowView.CreateShelfView method.

Reasons for subclassing may include: overriding SetTitle to customize the display of the workspace title.

Inheritance: ClearCanvas.Desktop.View.WinForms.DesktopObjectView, IShelfView
示例#1
0
        internal void RemoveShelfView(ShelfView shelfView)
        {
            shelfView.SaveState();

            _form.DockingManager.Contents.Remove(shelfView.Content);
            shelfView.SetVisibleStatus(false);
        }
示例#2
0
        internal void HideShelfView(ShelfView shelfView)
        {
            if (shelfView.Content.IsDocked)
            {
                if (shelfView.Content.IsAutoHidden)   // auto-hide mode
                {
                    // only one auto-hide window can be showing at a given time, so calling this method should hide it
                    _form.DockingManager.RemoveShowingAutoHideWindows();
                }
                else
                {
                    // content is pinned - putting it in auto-hide mode should hide it
                    _form.DockingManager.ToggleContentAutoHide(shelfView.Content);

                    // the window seems to remain active even though it is not visible, which doesn't make much sense
                    // therefore, let's report it as inactive
                    shelfView.SetActiveStatus(false);
                    // since we don't seem to get a content-hiding message in this case, need to explicitly set this
                    shelfView.SetVisibleStatus(false);
                }
            }
            else
            {
                // floating
                _form.DockingManager.HideContent(shelfView.Content);

                // since we don't seem to get a content-hiding message in this case, need to explicitly set this
                shelfView.SetVisibleStatus(false);
            }
        }
示例#3
0
        internal void ShowShelfView(ShelfView shelfView)
        {
            if (!shelfView.Content.Visible)
            {
                shelfView.Content.BringToFront();
            }

            if (shelfView.Content.IsDocked)
            {
                if (shelfView.Content.IsAutoHidden)   // auto-hide mode
                {
                    // show without activating
                    _form.DockingManager.BringAutoHideIntoView(shelfView.Content); // show it
                }
                else
                {
                    // content is pinned - therefore it should be already visible
                }
            }
            else
            {
                // floating
                _form.DockingManager.ShowContent(shelfView.Content);
            }
        }
示例#4
0
        internal void ActivateShelfView(ShelfView shelfView)
        {
            if (shelfView.Content.IsAutoHidden)
            {
                // auto-hidden - bring into view
                _form.DockingManager.BringAutoHideIntoView(shelfView.Content);
            }
            else
            {
                // docked or floating - ensure we are in front
                shelfView.Content.BringToFront();
            }

            // set focus to the control - this is what actually activates the window
            shelfView.Content.Control.Focus();
        }
示例#5
0
        internal void RemoveShelfView(ShelfView shelfView)
        {
			shelfView.SaveState();

            _form.DockingManager.Contents.Remove(shelfView.Content);
            shelfView.SetVisibleStatus(false);
        }
示例#6
0
        internal void ActivateShelfView(ShelfView shelfView)
        {
            if (shelfView.Content.IsAutoHidden)
            {
                // auto-hidden - bring into view
                _form.DockingManager.BringAutoHideIntoView(shelfView.Content);
            }
            else
            {
                // docked or floating - ensure we are in front
                shelfView.Content.BringToFront();
            }

            // set focus to the control - this is what actually activates the window
            shelfView.Content.Control.Focus();
        }
示例#7
0
        internal void HideShelfView(ShelfView shelfView)
        {
            if (shelfView.Content.IsDocked)
            {
                if (shelfView.Content.IsAutoHidden)   // auto-hide mode
                {
                    // only one auto-hide window can be showing at a given time, so calling this method should hide it
                    _form.DockingManager.RemoveShowingAutoHideWindows();
                }
                else
                {
                    // content is pinned - putting it in auto-hide mode should hide it
                    _form.DockingManager.ToggleContentAutoHide(shelfView.Content);

                    // the window seems to remain active even though it is not visible, which doesn't make much sense
                    // therefore, let's report it as inactive
                    shelfView.SetActiveStatus(false);
                    // since we don't seem to get a content-hiding message in this case, need to explicitly set this
                    shelfView.SetVisibleStatus(false);
                }
            }
            else
            {
                // floating
                _form.DockingManager.HideContent(shelfView.Content);

                // since we don't seem to get a content-hiding message in this case, need to explicitly set this
                shelfView.SetVisibleStatus(false);  
            }
        }
示例#8
0
        internal void ShowShelfView(ShelfView shelfView)
        {
			if (!shelfView.Content.Visible)
				shelfView.Content.BringToFront();

            if (shelfView.Content.IsDocked)
            {
                if (shelfView.Content.IsAutoHidden)   // auto-hide mode
                {
                    // show without activating
                    _form.DockingManager.BringAutoHideIntoView(shelfView.Content); // show it
                }
                else
                {
                    // content is pinned - therefore it should be already visible
                }
            }
            else
            {
                // floating
                _form.DockingManager.ShowContent(shelfView.Content);
            }
        }
示例#9
0
        internal Content AddShelfView(ShelfView shelfView, Control control, string title, ShelfDisplayHint hint, MemoryStream shelfRestoreStream)
        {
        	// Forcing this makes the control resize *before* adding it to the DotNetMagic control, 
        	// so the shelf will be the correct size.  This would be done automatically when the
			// control gets added - we're just doing it a bit prematurely in order to get the correct size.
        	control.Font = _form.DockingManager.TabControlFont;
        	var displaySize = control.Size;

			var content = _form.DockingManager.Contents.Add(control, title);
			content.Tag = shelfView;

			if (shelfRestoreStream != null)
			{
				content.LoadContentFromStream(shelfRestoreStream);

				// #4183 - the shelf restore stream includes the shelf title, which is supposed to be determined by the model/localization and not persisted
				content.Title = content.FullTitle = title;

				_form.DockingManager.ShowContent(content);
				if (content.IsAutoHidden && hint != ShelfDisplayHint.HideOnWorkspaceOpen)
					_form.DockingManager.BringAutoHideIntoView(content);

				return content;
			}

        	content.DisplaySize = displaySize;
        	content.AutoHideSize = displaySize;
        	content.FloatingSize = displaySize;

        	if ((hint & ShelfDisplayHint.DockAutoHide) != 0)
        		_form.DockingManager.Container.SuspendLayout();

        	// Dock the window on the correct edge
        	if ((hint & ShelfDisplayHint.DockTop) != 0)
        	{
        		_form.DockingManager.AddContentWithState(content, State.DockTop);
        	}
        	else if ((hint & ShelfDisplayHint.DockBottom) != 0)
        	{
        		_form.DockingManager.AddContentWithState(content, State.DockBottom);
        	}
        	else if ((hint & ShelfDisplayHint.DockLeft) != 0)
        	{
        		_form.DockingManager.AddContentWithState(content, State.DockLeft);
        	}
        	else if ((hint & ShelfDisplayHint.DockRight) != 0)
        	{
        		_form.DockingManager.AddContentWithState(content, State.DockRight);
        	}
        	else
        	{
				if ((hint & ShelfDisplayHint.ShowNearMouse) == ShelfDisplayHint.ShowNearMouse)
				{
					content.DisplayLocation = Control.MousePosition;
				}

        		_form.DockingManager.AddContentWithState(content, State.Floating);
        	}

		    if ((hint & ShelfDisplayHint.DockAutoHide) != 0)
            {
                _form.DockingManager.ToggleContentAutoHide(content);
                _form.DockingManager.Container.ResumeLayout();
                _form.DockingManager.BringAutoHideIntoView(content);
            }

            return content;
        }
示例#10
0
        internal Content AddShelfView(ShelfView shelfView, Control control, string title, ShelfDisplayHint hint, MemoryStream shelfRestoreStream)
        {
            // Forcing this makes the control resize *before* adding it to the DotNetMagic control,
            // so the shelf will be the correct size.  This would be done automatically when the
            // control gets added - we're just doing it a bit prematurely in order to get the correct size.
            control.Font = _form.DockingManager.TabControlFont;
            var displaySize = control.Size;

            var content = _form.DockingManager.Contents.Add(control, title);

            content.Tag = shelfView;

            if (shelfRestoreStream != null)
            {
                content.LoadContentFromStream(shelfRestoreStream);

                // #4183 - the shelf restore stream includes the shelf title, which is supposed to be determined by the model/localization and not persisted
                content.Title = content.FullTitle = title;

                _form.DockingManager.ShowContent(content);
                if (content.IsAutoHidden && hint != ShelfDisplayHint.HideOnWorkspaceOpen)
                {
                    _form.DockingManager.BringAutoHideIntoView(content);
                }

                return(content);
            }

            content.DisplaySize  = displaySize;
            content.AutoHideSize = displaySize;
            content.FloatingSize = displaySize;

            if ((hint & ShelfDisplayHint.DockAutoHide) != 0)
            {
                _form.DockingManager.Container.SuspendLayout();
            }

            // Dock the window on the correct edge
            if ((hint & ShelfDisplayHint.DockTop) != 0)
            {
                _form.DockingManager.AddContentWithState(content, State.DockTop);
            }
            else if ((hint & ShelfDisplayHint.DockBottom) != 0)
            {
                _form.DockingManager.AddContentWithState(content, State.DockBottom);
            }
            else if ((hint & ShelfDisplayHint.DockLeft) != 0)
            {
                _form.DockingManager.AddContentWithState(content, State.DockLeft);
            }
            else if ((hint & ShelfDisplayHint.DockRight) != 0)
            {
                _form.DockingManager.AddContentWithState(content, State.DockRight);
            }
            else
            {
                if ((hint & ShelfDisplayHint.ShowNearMouse) == ShelfDisplayHint.ShowNearMouse)
                {
                    content.DisplayLocation = Control.MousePosition;
                }

                _form.DockingManager.AddContentWithState(content, State.Floating);
            }

            if ((hint & ShelfDisplayHint.DockAutoHide) != 0)
            {
                _form.DockingManager.ToggleContentAutoHide(content);
                _form.DockingManager.Container.ResumeLayout();
                _form.DockingManager.BringAutoHideIntoView(content);
            }

            return(content);
        }