public static StringCollection ContentNamesInPriority(Zone z, Content c)
        {
            // Container for returned group of found Content objects
            StringCollection sc = new StringCollection();

            // Process each Window in the Zone
            foreach(Window w in z.Windows)
            {
                WindowContent wc = w as WindowContent;

                // Is the Zone a Content derived variation?
                if (wc != null)
                {
                    // Does this contain the interesting Content?
                    if (wc.Contents.Contains(c))
                    {
                        // All Content of this Window are given priority and
                        // added into the start of the collection
                        foreach(Content content in wc.Contents)
                            sc.Insert(0, content.Title);
                    }
                    else
                    {
                        // Lower priority Window and so contents are always
                        // added to the end of the collection
                        foreach(Content content in wc.Contents)
                            sc.Add(content.Title);
                    }
                }
            }

            return sc;
        }
        public Content Add(Content value)
        {
            // Use base class to process actual collection operation
            base.List.Add(value as object);

            return value;
        }
Пример #3
0
        protected void InternalConstruct(Control callingControl, 
                                         Source source, 
                                         Content c, 
                                         WindowContent wc, 
                                         FloatingForm ff,
                                         DockingManager dm,
                                         Point offset)
        {
            // Store the starting state
            _callingControl = callingControl;
            _source = source;
            _content = c;
            _windowContent = wc;
            _dockingManager = dm;
            _container = _dockingManager.Container;
            _floatingForm = ff;
            _hotZones = null;
            _currentHotZone = null;
            _insideRect = new Rectangle();
            _outsideRect = new Rectangle();
            _offset = offset;

            // Begin tracking straight away
            EnterTrackingMode();
        }
Пример #4
0
        public Content Add()
        {
            Content c = new Content(_manager);

            // Use base class to process actual collection operation
            base.List.Add(c as object);

            return c;
        }
        public Content Add(Control control, string title, ImageList imageList, int imageIndex)
        {
            Content c = new Content(_manager, control, title, imageList, imageIndex);

            // Use base class to process actual collection operation
            base.List.Add(c as object);

            return c;
        }
Пример #6
0
        // Should only ever be used by Serialization
        public Content Add(Content c)
        {
            // Assign correct docking manager to object
            c.DockingManager = _manager;

            // Use base class to process actual collection operation
            base.List.Add(c as object);

            return c;
        }
        public GameClientForm( )
        {
            InitializeComponent( );

            //	Write greeting
            AppLog.Info( "Beginning {0} at {1}", Assembly.GetCallingAssembly( ), DateTime.Now );
            AppLog.GetSource( Severity.Info ).WriteEnvironment( );

            //	Create the docking manager
            m_DockingManager = new DockingManager( this, VisualStyle.IDE );
            m_DockingManager.InnerControl = gameDisplay;
            m_DockingManager.OuterControl = this;

            ProfileViewer profileViewer1 = new ProfileViewer( );
            profileViewer1.RootSection = GameProfiles.Game;
            m_ProfileViewer1Content = m_DockingManager.Contents.Add( profileViewer1, "Profile Viewer 1" );
            m_DockingManager.AddContentWithState( m_ProfileViewer1Content, State.Floating );
            m_DockingManager.HideContent( m_ProfileViewer1Content );

            ProfileViewer profileViewer2 = new ProfileViewer( );
            profileViewer2.RootSection = GameProfiles.Game;
            m_ProfileViewer2Content = m_DockingManager.Contents.Add( profileViewer2, "Profile Viewer 2" );
            m_DockingManager.AddContentWithState( m_ProfileViewer2Content, State.Floating );
            m_DockingManager.HideContent( m_ProfileViewer2Content );

            PropertyGrid debugInfoProperties = CreateDebugInfoPropertyGrid( );
            m_DebugInfoContent = m_DockingManager.Contents.Add(debugInfoProperties, "Debug Info");
            m_DockingManager.AddContentWithState( m_DebugInfoContent, State.Floating );
            m_DockingManager.HideContent( m_DebugInfoContent );

            m_LogDisplayContent = m_DockingManager.Contents.Add( m_LogDisplay, "Log" );
            m_DockingManager.AddContentWithState( m_LogDisplayContent, State.DockBottom );

            if ( File.Exists( m_ClientSetupFile ) )
            {
                m_DockingManager.LoadConfigFromFile( m_ClientSetupFile );
            }
        }
Пример #8
0
        public MainForm()
        {
            InitializeComponent();

            ////////////////////////////////////////////////////////////////////////////////////////////
            // Open File Data and Program Database
            ////////////////////////////////////////////////////////////////////////////////////////////
            dat_conn = DatabaseConnection.getInstance();

            /////////////////////////////////////////////////////////////////////////////////////////////
            // MainTree and Table Tabpage
            /////////////////////////////////////////////////////////////////////////////////////////////
            //docking
            _manager = new DockingManager(this, VisualStyle.IDE);
            // Create Content which contains a RichTextBox
            c = _manager.Contents.Add(new TreeForm(), "tree menu");
            _manager.AddContentWithState(c, State.DockLeft);

            ////////////////////////////////////////////////////////////////////////////////////////////
            // Main WorkSpace - Show main working window - display model graphics
            ////////////////////////////////////////////////////////////////////////////////////////////

            // ShowModelGraphicWindow();
        }
Пример #9
0
        public WindowContent AddContentWithState(Content c, State newState)
        {
            // Validate the incoming Content instance is a valid reference
            // and is a current instance within our internal collection
            if ((c == null) || !_contents.Contains(c))
                return null;

            // Do not generate hiding/hidden/shown events
            _surpressVisibleEvents++;

            // Manageing Zones should remove display AutoHide windows
            RemoveShowingAutoHideWindows();

            // Is the window already part of a WindowContent?
            if (c.ParentWindowContent != null)
            {
                // If it used to be in a floating mode, then record state change
                if (c.ParentWindowContent.ParentZone.State == State.Floating)
                    c.ContentLeavesFloating();

                // Remove the Content from its current WindowContent
                c.ParentWindowContent.Contents.Remove(c);
            }

            // Create a new Window instance appropriate for hosting a Content object
            Window w = CreateWindowForContent(c);

            ContainerControl destination = null;

            if (newState != State.Floating)
            {
                destination = _container;
                destination.SuspendLayout();
            }

            // Create a new Zone capable of hosting a WindowContent
            Zone z = CreateZoneForContent(newState, destination);

            if (newState == State.Floating)
            {
                // Content is not in the docked state
                c.Docked = false;

                // destination a new floating form
                destination = new FloatingForm(this, z, new ContextHandler(OnShowContextMenu));

                // Define its location
                destination.Location = c.DisplayLocation;

                // ...and its size, add the height of the caption bar to the requested content size
                destination.Size = new Size(c.FloatingSize.Width,
                                            c.FloatingSize.Height + SystemInformation.ToolWindowCaptionHeight);
            }

            // Add the Window to the Zone
            z.Windows.Add(w);

            if (newState != State.Floating)
            {
                // Set the Zone to be the least important of our Zones
                ReorderZoneToInnerMost(z);

                UpdateInsideFill();

                destination.ResumeLayout();
            }
            else
                destination.Show();

            // Enable generation hiding/hidden/shown events
            _surpressVisibleEvents--;

            // Generate event to indicate content is now visible
            OnContentShown(c);

            return w as WindowContent;
        }
Пример #10
0
        internal AutoHidePanel AutoHidePanelForContent(Content c)
        {
            if (_ahpLeft.ContainsContent(c))
                return _ahpLeft;

            if (_ahpRight.ContainsContent(c))
                return _ahpRight;

            if (_ahpTop.ContainsContent(c))
                return _ahpTop;

            if (_ahpBottom.ContainsContent(c))
                return _ahpBottom;

            return null;
        }
Пример #11
0
        public Window AddContentToZone(Content c, Zone z, int index)
        {
            // Validate the incoming Content instance is a valid reference
            // and is a current instance within our internal collection
            if ((c == null) || !_contents.Contains(c))
                return null;

            // Validate the incoming Zone instance is a valid reference
            if (z == null)
                return null;

            // Do not generate hiding/hidden/shown events
            _surpressVisibleEvents++;

            // Manageing Zones should remove display AutoHide windows
            RemoveShowingAutoHideWindows();

            // Is the window already part of a WindowContent?
            if (c.ParentWindowContent != null)
            {
                // Is there a change in docking state?
                if (c.ParentWindowContent.ParentZone.State != z.State)
                {
                    // If it used to be in a floating mode, then record state change
                    if (c.ParentWindowContent.ParentZone.State == State.Floating)
                        c.ContentLeavesFloating();
                    else
                        c.ContentBecomesFloating();
                }

                // Remove the Content from its current WindowContent
                c.ParentWindowContent.Contents.Remove(c);
            }
            else
            {
                // If target zone is floating window then we are no longer docked
                if (z.State == State.Floating)
                    c.Docked = false;
            }

            // Create a new WindowContent instance according to our style
            Window w = CreateWindowForContent(c);

            // Add the Window to the Zone at given position
            z.Windows.Insert(index, w);

            // Enable generation hiding/hidden/shown events
            _surpressVisibleEvents--;

            // Generate event to indicate content is now visible
            OnContentShown(c);

            return w;
        }
Пример #12
0
        public WindowContentTabbed(DockingManager manager, VisualStyle vs)
            : base(manager, vs)
        {
            _redocker      = null;
            _activeContent = null;

            // Create the TabControl used for viewing the Content windows
            _tabControl = new Magic.Controls.TabControl();

            // It should always occupy the remaining space after all details
            _tabControl.Dock = DockStyle.Fill;

            // Show tabs only if two or more tab pages exist
            _tabControl.HideTabsMode = Magic.Controls.TabControl.HideTabsModes.HideUsingLogic;

            // Hook into the TabControl notifications
            _tabControl.GotFocus         += new EventHandler(OnTabControlGotFocus);
            _tabControl.LostFocus        += new EventHandler(OnTabControlLostFocus);
            _tabControl.PageGotFocus     += new EventHandler(OnTabControlGotFocus);
            _tabControl.PageLostFocus    += new EventHandler(OnTabControlLostFocus);
            _tabControl.SelectionChanged += new EventHandler(OnSelectionChanged);
            _tabControl.PageDragStart    += new MouseEventHandler(OnPageDragStart);
            _tabControl.PageDragMove     += new MouseEventHandler(OnPageDragMove);
            _tabControl.PageDragEnd      += new MouseEventHandler(OnPageDragEnd);
            _tabControl.PageDragQuit     += new MouseEventHandler(OnPageDragQuit);
            _tabControl.DoubleClickTab   += new Magic.Controls.TabControl.DoubleClickTabHandler(OnDoubleClickTab);
            _tabControl.Font              = manager.TabControlFont;
            _tabControl.BackColor         = manager.BackColor;
            _tabControl.ForeColor         = manager.InactiveTextColor;

            // Define the visual style required
            _tabControl.Style = vs;

            // Allow developers a chance to override default settings
            manager.OnTabControlCreated(_tabControl);

            switch (vs)
            {
            case VisualStyle.IDE:
                Controls.Add(_tabControl);
                break;

            case VisualStyle.Plain:
                // Only the border at the pages edge and not around the whole control
                _tabControl.InsetBorderPagesOnly = !_manager.PlainTabBorder;

                // We want a border around the TabControl so it is indented and looks consistent
                // with the Plain look and feel, so use the helper Control 'BorderForControl'
                BorderForControl bfc = new BorderForControl(_tabControl, _plainBorder);

                // It should always occupy the remaining space after all details
                bfc.Dock = DockStyle.Fill;

                // Define the default border border
                bfc.BackColor = _manager.BackColor;

                // When in 'VisualStyle.Plain' we need to
                Controls.Add(bfc);
                break;
            }

            // Need to hook into message pump so that the ESCAPE key can be
            // intercepted when in redocking mode
            Application.AddMessageFilter(this);
        }
Пример #13
0
 protected virtual void OnContentChanged(Content obj, Content.Property prop)
 {
 }
Пример #14
0
        public virtual Window CreateWindowForContent(Content c,
            EventHandler contentClose,
            EventHandler restore,
            EventHandler invertAutoHide,
            ContextHandler showContextMenu)
        {
            // Create new instance with correct style
            WindowContent wc = new WindowContentTabbed(this, _visualStyle);

            WindowDetailCaption wdc;

            // Create a style specific caption detail
            if (_visualStyle == VisualStyle.IDE)
                wdc = new WindowDetailCaptionIDE(this, contentClose, restore,
                                                 invertAutoHide, showContextMenu);
            else
                wdc = new WindowDetailCaptionPlain(this, contentClose, restore,
                                                   invertAutoHide, showContextMenu);

            // Add the caption to the window display
            wc.WindowDetails.Add(wdc);

            if (c != null)
            {
                // Add provided Content to this instance
                wc.Contents.Add(c);
            }

            return wc;
        }
Пример #15
0
        public virtual void HideContent(Content c, bool record, bool reorder)
        {
            // Remove it from view by removing from current WindowContent container
            if (c.Visible)
            {
                // Do not generate hiding/hidden/shown events
                _surpressVisibleEvents++;

                // Manageing Zones should remove display AutoHide windows
                RemoveShowingAutoHideWindows();

                if (record)
                {
                    // Tell the Content to create a new Restore object to record its current location
                    c.RecordRestore();
                }

                if (c.AutoHidden && (c.AutoHidePanel != null))
                {
                    // Remove it from its current AutoHidePanel
                    c.AutoHidePanel.RemoveContent(c);
                }
                else if ((c.ParentWindowContent != null) && (c.ParentWindowContent.Contents != null))
                {
                    // Remove the Content from its current WindowContent
                    c.ParentWindowContent.Contents.Remove(c);
                }

                if (reorder && (_contents != null))
                {
                    // Move the Content to the start of the list
                    _contents.SetIndex(0, c);
                }

                UpdateInsideFill();

                // Enable generation hiding/hidden/shown events
                _surpressVisibleEvents--;

                // Generate event
                OnContentHidden(c);
            }
        }
 public bool Contains(Content value)
 {
     // Use base class to process actual collection operation
     return base.List.Contains(value as object);
 }
Пример #17
0
        protected override void OnContentChanged(Content obj, Content.Property prop)
        {
            // Find the matching TabPage entry
            foreach (Magic.Controls.TabPage page in _tabControl.TabPages)
            {
                // Does this page manage our Content?
                if (page.Tag == obj)
                {
                    // Property specific processing
                    switch (prop)
                    {
                    case Content.Property.Control:
                        page.Control = obj.Control;
                        break;

                    case Content.Property.Title:
                        page.Title = obj.Title;
                        break;

                    case Content.Property.FullTitle:
                        // Title changed for the current page?
                        if (_tabControl.SelectedTab == page)
                        {
                            // Update displayed caption text
                            NotifyFullTitleText(obj.FullTitle);
                        }
                        break;

                    case Content.Property.ImageList:
                        page.ImageList = obj.ImageList;
                        break;

                    case Content.Property.ImageIndex:
                        page.ImageIndex = obj.ImageIndex;
                        break;

                    case Content.Property.Icon:
                        page.Icon = obj.Icon;
                        break;

                    case Content.Property.CaptionBar:
                        // Property changed for the current page?
                        if (_tabControl.SelectedTab == page)
                        {
                            Content target = page.Tag as Content;

                            // TODO
                            NotifyShowCaptionBar(target.CaptionBar);
                        }
                        break;

                    case Content.Property.CloseButton:
                        // Property changed for the current page?
                        if (_tabControl.SelectedTab == page)
                        {
                            Content target = page.Tag as Content;

                            NotifyCloseButton(target.CloseButton);
                        }
                        break;

                    case Content.Property.HideButton:
                        // Property changed for the current page?
                        if (_tabControl.SelectedTab == page)
                        {
                            Content target = page.Tag as Content;

                            NotifyHideButton(target.HideButton);
                        }
                        break;
                    }

                    break;
                }
            }
        }
Пример #18
0
        protected virtual void InitializeDockingControls( )
        {
            //	Create the docking manager
            m_DockingManager = new DockingManager( this, VisualStyle.IDE );
            m_DockingManager.InnerControl = display;
            m_DockingManager.OuterControl = statusStrip;

            //	Add log, property editor, and edit mode controls to the docking manager
            m_LogDisplayContent = m_DockingManager.Contents.Add( m_LogDisplay, "Log" );
            m_PropertyEditorContent = m_DockingManager.Contents.Add( new ObjectPropertyEditor( ), "Property Editor" );
            m_SelectionContent = m_DockingManager.Contents.Add( new SelectionControl( ), "Selection" );

            m_DockingManager.AddContentWithState( m_LogDisplayContent, State.DockBottom );
            m_DockingManager.AddContentWithState( m_SelectionContent, State.DockRight );
            m_DockingManager.AddContentWithState( m_PropertyEditorContent, State.DockLeft );

            m_EditModesContent = m_DockingManager.Contents.Add( new EditModesControl( ), Resources.EditModes );
            m_DockingManager.AddContentToZone( m_EditModesContent, m_SelectionContent.ParentWindowContent.ParentZone, 0 );
        }
 public void AddRange(Content[] values)
 {
     // Use existing method to add each array entry
     foreach(Content page in values)
         Add(page);
 }
 public void Remove(Content value)
 {
     // Use base class to process actual collection operation
     base.List.Remove(value as object);
 }
 public void Insert(int index, Content value)
 {
     // Use base class to process actual collection operation
     base.List.Insert(index, value as object);
 }
 public int IndexOf(Content value)
 {
     // Find the 0 based index of the requested entry
     return base.List.IndexOf(value);
 }
Пример #23
0
        public void BringAutoHideIntoView(Content c)
        {
            if (_ahpLeft.ContainsContent(c))
                _ahpLeft.BringContentIntoView(c);

            if (_ahpRight.ContainsContent(c))
                _ahpRight.BringContentIntoView(c);

            if (_ahpTop.ContainsContent(c))
                _ahpTop.BringContentIntoView(c);

            if (_ahpBottom.ContainsContent(c))
                _ahpBottom.BringContentIntoView(c);
        }
Пример #24
0
        public virtual bool OnContentHiding(Content c)
        {
            CancelEventArgs cea = new CancelEventArgs();

            if (_surpressVisibleEvents == 0)
            {
                // Allow user to prevent hide operation
                if (ContentHiding != null)
                    ContentHiding(c, cea);
            }

            // Was action cancelled?
            return cea.Cancel;
        }
Пример #25
0
 public virtual Window CreateWindowForContent(Content c)
 {
     return CreateWindowForContent(c, new EventHandler(OnContentClose),
                                      new EventHandler(OnRestore),
                                      new EventHandler(OnInvertAutoHide),
                                      new ContextHandler(OnShowContextMenu));
 }
Пример #26
0
 public virtual void OnContentShown(Content c)
 {
     if (_surpressVisibleEvents == 0)
     {
         // Notify operation has completed
         if (ContentShown != null)
             ContentShown(c, EventArgs.Empty);
     }
 }
Пример #27
0
 public virtual void HideContent(Content c)
 {
     HideContent(c, true, true);
 }
Пример #28
0
        public virtual bool ShowContent(Content c)
        {
            // Validate the incoming Content instance is a valid reference
            // and is a current instance within our internal collection
            if ((c == null) || !_contents.Contains(c))
                return false;

            // Remove it from view by removing from current WindowContent container
            if (!c.Visible)
            {
                // Do not generate hiding/hidden/shown events
                _surpressVisibleEvents++;

                // Manageing Zones should remove display AutoHide windows
                RemoveShowingAutoHideWindows();

                // Use the assigned restore object to position the Content appropriately
                if (c.Docked)
                {
                    if (c.AutoHidden && (c.AutoHideRestore != null))
                        c.AutoHideRestore.PerformRestore(this);
                    else if (c.DockingRestore != null)
                        c.DockingRestore.PerformRestore(this);
                }
                else if (c.FloatingRestore != null)
                    c.FloatingRestore.PerformRestore(this);

                // Enable generation hiding/hidden/shown events
                _surpressVisibleEvents--;

                // Generate event
                OnContentShown(c);

                return true;
            }
            else
                return false;
        }
Пример #29
0
        public WindowContent InsertContentIntoWindowContent(int pos, Content c, WindowContent wc)
        {
            // Validate the incoming Content instance is a valid reference
            // and is a current instance within our internal collection
            if ((c == null) || !_contents.Contains(c))
                return null;

            // Validate the incoming WindowContent instance is a valid reference
            if (wc == null)
                return null;

            // Is Content already part of given Window then nothing to do
            if (c.ParentWindowContent == wc)
                return wc;
            else
            {
                bool valid = true;

                // Do not generate hiding/hidden/shown events
                _surpressVisibleEvents++;

                // Manageing Zones should remove display AutoHide windows
                RemoveShowingAutoHideWindows();

                if (c.ParentWindowContent != null)
                {
                    // Is there a change in docking state?
                    if (c.ParentWindowContent.ParentZone.State != wc.ParentZone.State)
                    {
                        // If it used to be in a floating mode, then record state change
                        if (c.ParentWindowContent.ParentZone.State == State.Floating)
                            c.ContentLeavesFloating();
                        else
                            c.ContentBecomesFloating();
                    }

                    // Remove the Content from its current WindowContent
                    c.ParentWindowContent.Contents.Remove(c);
                }
                else
                {
                    // If a window content is in AutoHide then it will not have a parent zone
                    if (wc.ParentZone != null)
                    {
                        // If adding to a floating window then it is not docked
                        if (wc.ParentZone.State == State.Floating)
                            c.Docked = false;
                    }
                    else
                    {
                        // Cannot dynamically add into an autohide parent
                        valid = false;
                    }
                }

                if (valid)
                {
                    // Add the existing Content to this instance
                    wc.Contents.Insert(pos, c);
                }

                // Enable generation hiding/hidden/shown events
                _surpressVisibleEvents--;

                if (valid)
                {
                    // Generate event to indicate content is now visible
                    OnContentShown(c);
                }

                return wc;
            }
        }
Пример #30
0
        public virtual bool ToggleContentAutoHide(Content c)
        {
            // Content must be visible
            if (!c.Visible)
                return false;

            // Content is not allows to be floating
            // (if visible then content must have a valiud ParentWindowContent)
            if (c.ParentWindowContent.State == State.Floating)
                return false;

            // Is the content currently in auto hide mode?
            if (c.ParentWindowContent.ParentZone == null)
            {
                // Find the hosting panel for the window content instance
                AutoHidePanel ahp = AutoHidePanelForState(c.ParentWindowContent.State);

                // Ask the panel to un-autohide
                ahp.InvertAutoHideWindowContent(c.ParentWindowContent as WindowContentTabbed);
            }
            else
            {
                // No, so inform the window content to become auto hidden now
                InvertAutoHideWindowContent(c.ParentWindowContent);
            }

            // Success!
            return true;
        }
Пример #31
0
        private void AddDocking()
        {
            _dockingManager = new DockingManager(this, VisualStyle.IDE);
            _dockingManager.InnerControl = pnlBody;
            _dockingManager.OuterControl = tBarMain;
            Content ouBar = new Content(_dockingManager);

            _dockingManager.Contents.Add(ouBar);
            ouBar.Title = "Navigation";
            ouBar.FullTitle = "Navigation";
            ouBar.CaptionBar = true;
            ouBar.CloseButton = false;
            ouBar.DisplaySize = new Size(100, 410);
            ouBar.Control = pnlNavBar;
            ouBar.ImageList = imlMain;
            ouBar.ImageIndex = 3;

            _dockingManager.ShowContent(_dockingManager.Contents["Navigation"]);
            _dockingManager.AddContentWithState(ouBar, State.DockLeft);
        }
Пример #32
0
 public virtual void BringContentToFront(Content c)
 {
 }