public Window(DockingManager manager) { // Must provide a valid manager instance if (manager == null) throw new ArgumentNullException("DockingManager"); // Default object state _state = State.Floating; _parentZone = null; _zoneArea = 100m; _minimalSize = new Size(0,0); _manager = manager; _autoDispose = true; _fullTitle = ""; _redockAllowed = true; _floatingCaption = true; _contentCaption = true; // Create collection of window details _windowDetails = new WindowDetailCollection(); // We want notification when window details are added/removed/cleared _windowDetails.Clearing += new CollectionClear(OnDetailsClearing); _windowDetails.Inserted += new CollectionChange(OnDetailInserted); _windowDetails.Removing += new CollectionChange(OnDetailRemoving); }
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(); }
public ManagerContentCollection(DockingManager manager) { // Must provide a valid manager instance if (manager == null) throw new ArgumentNullException("DockingManager"); // Default the state _manager = manager; }
public WindowDetail(DockingManager manager) { // Default the state _parentZone = null; _parentWindow = null; _manager = manager; // Get correct starting state from manager this.BackColor = _manager.BackColor; this.ForeColor = _manager.InactiveTextColor; }
//, ContextHandler contextHandler) public FloatingForm(DockingManager dockingManager, Zone zone) { // The caller is responsible for setting our initial screen location this.StartPosition = FormStartPosition.Manual; // Not in task bar to prevent clutter this.ShowInTaskbar = false; // Make sure the main Form owns us this.Owner = dockingManager.Container.FindForm(); // Need to know when the Zone is removed this.ControlRemoved += new ControlEventHandler(OnZoneRemoved); // Add the Zone as the only content of the Form Controls.Add(zone); // Default state _redocker = null; _intercept = false; _zone = zone; _dockingManager = dockingManager; // Assign any event handler for context menu // if (contextHandler != null) // this.Context += contextHandler; // Default color this.BackColor = _dockingManager.BackColor; this.ForeColor = _dockingManager.InactiveTextColor; // Monitor changes in the Zone content _zone.Windows.Inserted += new CollectionChange(OnWindowInserted); _zone.Windows.Removing += new CollectionChange(OnWindowRemoving); _zone.Windows.Removed += new CollectionChange(OnWindowRemoved); if (_zone.Windows.Count == 1) { // The first Window to be added. Tell it to hide details _zone.Windows[0].HideDetails(); // Monitor change in window title _zone.Windows[0].FullTitleChanged += new EventHandler(OnFullTitleChanged); // Grab any existing title this.Text = _zone.Windows[0].FullTitle; } // Need to hook into message pump so that the ESCAPE key can be // intercepted when in redocking mode Application.AddMessageFilter(this); }
public WindowContent(DockingManager manager, VisualStyle vs) : base(manager) { // Remember state _style = vs; // Create collection of window details _contents = new ContentCollection(); // We want notification when contents are added/removed/cleared _contents.Clearing += new CollectionClear(OnContentsClearing); _contents.Inserted += new CollectionChange(OnContentInserted); _contents.Removing += new CollectionChange(OnContentRemoving); _contents.Removed += new CollectionChange(OnContentRemoved); }
public WindowDetailCaption(DockingManager manager, Size fixedSize, EventHandler closeHandler, EventHandler restoreHandler, EventHandler invertAutoHideHandler) //, ContextHandler contextHandler) : base(manager) { // Setup correct color remapping depending on initial colors DefineButtonRemapping(); // Default state _maxButton = null; _hideButton = null; _maxInterface = null; _redocker = null; _showCloseButton = true; _showHideButton = true; _ignoreHideButton = false; _pinnedImage = false; // Prevent flicker with double buffering and all painting inside WM_PAINT SetStyle(ControlStyles.DoubleBuffer, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); // Our size is always fixed at the required length in both directions // as one of the sizes will be provided for us because of our docking this.Size = fixedSize; if (closeHandler != null) this.Close += closeHandler; if (restoreHandler != null) this.Restore += restoreHandler; if (invertAutoHideHandler != null) this.InvertAutoHide += invertAutoHideHandler; // if (contextHandler != null) // this.Context += contextHandler; // Let derived classes override the button creation CreateButtons(); // Need to hook into message pump so that the ESCAPE key can be // intercepted when in redocking mode Application.AddMessageFilter(this); }
public AutoHostPanel(DockingManager manager, AutoHidePanel autoHidePanel, Edge borderEdge) { // Remember parameters _manager = manager; _autoHidePanel = autoHidePanel; _borderEdge = borderEdge; Direction direction; if ((borderEdge == Edge.Left) || (borderEdge == Edge.Right)) direction = Direction.Horizontal; else direction = Direction.Vertical; // Create a resizing bar _resizeAutoBar = new ResizeAutoBar(direction, this); // Add to the display Controls.Add(_resizeAutoBar); // Define correct position based on Edge switch(_borderEdge) { case Edge.Left: _resizeAutoBar.Dock = DockStyle.Left; break; case Edge.Right: _resizeAutoBar.Dock = DockStyle.Right; break; case Edge.Top: _resizeAutoBar.Dock = DockStyle.Top; break; case Edge.Bottom: _resizeAutoBar.Dock = DockStyle.Bottom; break; } }
protected void InternalConstruct(DockingManager manager, State state) { // Must provide a valid manager instance if (manager == null) throw new ArgumentNullException("DockingManager"); // Remember initial state _state = state; _manager = manager; _autoDispose = true; // Get correct starting state from manager this.BackColor = _manager.BackColor; this.ForeColor = _manager.InactiveTextColor; // Create collection of windows _windows = new WindowCollection(); // We want notification when contents are added/removed/cleared _windows.Clearing += new CollectionClear(OnWindowsClearing); _windows.Inserted += new CollectionChange(OnWindowInserted); _windows.Removing += new CollectionChange(OnWindowRemoving); _windows.Removed += new CollectionChange(OnWindowRemoved); }
public AutoHidePanel(DockingManager manager, DockStyle dockEdge) { // Define initial state _number = _num++; _defaultColor = true; _dismissRunning = false; _slideRunning = false; _ignoreDismiss = false; _killing = false; _manager = manager; _currentWCT = null; _currentPanel = null; _slideRect = new Rectangle(); _rememberRect = new Rectangle(); // Get the minimum vector length used for sizing int vector = TabStub.TabStubVector(this.Font); // Use for both directions, the appropriate one will be ignored because of docking style this.Size = new Size(vector, vector); // Dock ourself against requested position this.Dock = dockEdge; // We should be hidden until some Contents are added this.Hide(); // We want to perform special action when container is resized _manager.Container.Resize += new EventHandler(OnContainerResized); // Add ourself to the application filtering list Application.AddMessageFilter(this); // Configuration timer objects CreateTimers(); }
public override void PerformRestore(DockingManager dm) { // Use the existing DockingManager method that will create a Window appropriate for // this Content and then add a new Zone for hosting the Window. It will always place // the Zone at the inner most level dm.AddContentWithState(_content, _state); }
public override void Reconnect(DockingManager dm) { // Connect to the current instance of required content object _content = dm.Contents[_title]; base.Reconnect(dm); }
protected void InternalConstruct(DockingManager manager, Control control, string title, ImageList imageList, int imageIndex) { // Must provide a valid manager instance if (manager == null) throw new ArgumentNullException("DockingManager"); // Define the initial object state _control = control; _title = title; _imageList = imageList; _imageIndex = imageIndex; _manager = manager; _parentWindowContent = null; _order = _counter++; _visible = false; _displaySize = new Size(_defaultDisplaySize, _defaultDisplaySize); _autoHideSize = new Size(_defaultAutoHideSize, _defaultAutoHideSize); _floatingSize = new Size(_defaultFloatingSize, _defaultFloatingSize); _displayLocation = new Point(_defaultLocation, _defaultLocation); _defaultRestore = new RestoreContentState(State.DockLeft, this); _floatingRestore = new RestoreContentState(State.Floating, this); _autoHideRestore = new RestoreAutoHideState(State.DockLeft, this); _dockingRestore = _defaultRestore; _autoHidePanel = null; _docked = true; _captionBar = true; _closeButton = true; _hideButton = true; _autoHidden = false; _fullTitle = title; }
public Content(DockingManager manager, Control control) { InternalConstruct(manager, control, "", null, -1); }
public virtual void Reconnect(DockingManager dm) { if (_child != null) _child.Reconnect(dm); }
public override void PerformRestore(DockingManager dm) { int count = dm.Container.Controls.Count; int min = -1; int max = count; if (dm.InnerControl != null) min = dm.Container.Controls.IndexOf(dm.InnerControl); if (dm.OuterControl != null) max = dm.OuterControlIndex(); int beforeIndex = -1; int afterIndex = max; int beforeAllIndex = -1; int afterAllIndex = max; // Create a collection of the Zones in the appropriate direction for(int index=0; index<count; index++) { Zone z = dm.Container.Controls[index] as Zone; if (z != null) { StringCollection sc = ZoneHelper.ContentNames(z); if (_state == z.State) { if (sc.Contains(_best)) { // Can we delegate to a child Restore object if (_child != null) _child.PerformRestore(z); else { // Just add an appropriate Window to start of the Zone dm.AddContentToZone(_content, z, 0); } return; } // If the WindowContent contains a Content previous to the target if (sc.Contains(_previous)) { if (index > beforeIndex) beforeIndex = index; } // If the WindowContent contains a Content next to the target if (sc.Contains(_next)) { if (index < afterIndex) afterIndex = index; } } else { // If the WindowContent contains a Content previous to the target if (sc.Contains(_previousAll)) { if (index > beforeAllIndex) beforeAllIndex = index; } // If the WindowContent contains a Content next to the target if (sc.Contains(_nextAll)) { if (index < afterAllIndex) afterAllIndex = index; } } } } dm.Container.SuspendLayout(); // Create a new Zone with correct State Zone newZ = dm.CreateZoneForContent(_state); // Restore the correct content size/location values _content.DisplaySize = _size; _content.DisplayLocation = _location; // Add an appropriate Window to start of the Zone dm.AddContentToZone(_content, newZ, 0); // Did we find a valid 'before' Zone? if (beforeIndex != -1) { // Try and place more accurately according to other edge Zones if (beforeAllIndex > beforeIndex) beforeIndex = beforeAllIndex; // Check against limits if (beforeIndex >= max) beforeIndex = max - 1; dm.Container.Controls.SetChildIndex(newZ, beforeIndex + 1); } else { // Try and place more accurately according to other edge Zones if (afterAllIndex < afterIndex) afterIndex = afterAllIndex; // Check against limits if (afterIndex <= min) afterIndex = min + 1; if (afterIndex > min) dm.Container.Controls.SetChildIndex(newZ, afterIndex); else { // Set the Zone to be the least important of our Zones dm.ReorderZoneToInnerMost(newZ); } } dm.Container.ResumeLayout(); }
// public ObjectMonitorClass ObjectMonitor // { // get // { // return objMonitor; // } // } public SharpClientForm() { // // Required for Windows Form Designer support // try { if(!Convert.ToBoolean(IsUserAnAdmin())) { if(DialogResult.No==MessageBox.Show("ProfileSharp has detected that you are running the profiler in a non-administrative account.\nThis can make the profiler unreponsive.Do you still want to continue?" ,"Non-Administrator",MessageBoxButtons.YesNo,MessageBoxIcon.Warning)) { System.Diagnostics.Process.GetCurrentProcess().Kill(); } } } catch {} try { if(IsProfilerAlreadyRunning()) { // if(objMonitor!=null) // { // try // { // Marshal.ReleaseComObject(objMonitor); // objMonitor=null; // } // catch{} // } MessageBox.Show("ProfileSharp could not be initialized on your system.\nPlease contact SoftProdigy for support on this issue." ,"ProfileSharp Error!",MessageBoxButtons.OK,MessageBoxIcon.Stop); System.Diagnostics.Process.GetCurrentProcess().Kill(); return; } } catch(Exception except){ MessageBox.Show("An Exception occured\n"+except.Message ,"ProfileSharp Error!.",MessageBoxButtons.OK,MessageBoxIcon.Stop); System.Diagnostics.Process.GetCurrentProcess().Kill(); return; } finally { // if(objMonitor!=null) // { // try // { // Marshal.ReleaseComObject(objMonitor); // objMonitor=null; // } // catch{} // } } Application.DoEvents(); InitializeComponent(); if(SharpClientForm.scInstance ==null) { SharpClientForm.scInstance=this; } sharpClientMDITab.Appearance=SharpClient.UI.Controls.TabControl.VisualAppearance.MultiDocument; subscribersTable=new Hashtable(); subscribersMenuTable =new Hashtable (); SetStyle(ControlStyles.DoubleBuffer, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); codeTabControl=new SharpClient.UI.Controls.TabControl(); this.Controls.Add(codeTabControl); _manager=new DockingManager(this,SharpClient.UI.Common.VisualStyle.IDE); this.codeTabControl.Appearance = SharpClient.UI.Controls.TabControl.VisualAppearance.MultiDocument; this.codeTabControl.BackColor = System.Drawing.SystemColors.ActiveCaptionText; this.codeTabControl.ButtonActiveColor = System.Drawing.SystemColors.ActiveCaptionText; this.codeTabControl.ButtonInactiveColor = System.Drawing.SystemColors.InactiveCaptionText; this.codeTabControl.Dock = System.Windows.Forms.DockStyle.Fill; this.codeTabControl.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.codeTabControl.HideTabsMode = SharpClient.UI.Controls.TabControl.HideTabsModes.ShowAlways; this.codeTabControl.HotTextColor = System.Drawing.SystemColors.Desktop; this.codeTabControl.IDEPixelBorder = false; this.codeTabControl.Location = new System.Drawing.Point(0, 31); this.codeTabControl.Name = "codeTabControl"; this.codeTabControl.Size = new System.Drawing.Size(790, 484); this.codeTabControl.TabIndex = 4; this.codeTabControl.ClosePressed+=new EventHandler(codeTabControl_ClosePressed); _manager.InnerControl=sharpClientMDITab; _manager.OuterControl= psStatusBar; Content c=_manager.Contents.Add(codeTabControl,"Source Code",imageList1,4); _manager.AddContentWithState(c,SharpClient.UI.Docking.State.DockBottom); _manager.HideAllContents(); ///////////////Stack Control/////// /// _stackManager=new DockingManager(this,SharpClient.UI.Common.VisualStyle.IDE); _stackManager.InnerControl=sharpClientMDITab; _stackManager.OuterControl= psStatusBar; // // TODO: Add any constructor code after InitializeComponent call // }
public WindowContentTabbed(DockingManager manager, VisualStyle vs) : base(manager, vs) { _redocker = null; _activeContent = null; // Create the TabControl used for viewing the Content windows _tabControl = new SharpClient.UI.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 = SharpClient.UI.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 SharpClient.UI.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); }
public Content(DockingManager manager, Control control, string title) { InternalConstruct(manager, control, title, null, -1); }
public ZoneSequence(DockingManager manager, State state, VisualStyle style, Direction direction, bool zoneMinMax) : base(manager, state) { InternalConstruct(style, direction, zoneMinMax); }
public ZoneSequence(DockingManager manager) : base(manager) { InternalConstruct(VisualStyle.IDE, Direction.Vertical, true); }
public override void PerformRestore(DockingManager dm) { // Create collection of Contents to auto hide ContentCollection cc = new ContentCollection(); // In this case, there is only one cc.Add(_content); // Add to appropriate AutoHidePanel based on _state dm.AutoHideContents(cc, _state); }
public override void PerformRestore(DockingManager dm) { // Get the correct target panel from state AutoHidePanel ahp = dm.AutoHidePanelForState(_state); ahp.AddContent(_content, _next, _previous, _nextAll, _previousAll); }
// public Content(XmlTextReader xmlIn, int formatVersion) // { // // Define the initial object state // _control = null; // _title = ""; // _fullTitle = ""; // _imageList = null; // _imageIndex = -1; // _manager = null; // _parentWindowContent = null; // _displaySize = new Size(_defaultDisplaySize, _defaultDisplaySize); // _autoHideSize = new Size(_defaultAutoHideSize, _defaultAutoHideSize); // _floatingSize = new Size(_defaultFloatingSize, _defaultFloatingSize); // _displayLocation = new Point(_defaultLocation, _defaultLocation); // _order = _counter++; // _visible = false; // _defaultRestore = null; // _autoHideRestore = null; // _floatingRestore = null; // _dockingRestore = null; // _autoHidePanel = null; // _docked = true; // _captionBar = true; // _closeButton = true; // _hideButton = true; // _autoHidden = false; // // // Overwrite default with values read in // LoadFromXml(xmlIn, formatVersion); // } public Content(DockingManager manager) { InternalConstruct(manager, null, "", null, -1); }
public virtual void PerformRestore(DockingManager dm) {}
public Zone(DockingManager manager) { InternalConstruct(manager, State.DockLeft); }
public override void PerformRestore(DockingManager dm) { // Grab a list of all floating forms Form[] owned = dm.Container.FindForm().OwnedForms; FloatingForm target = null; // Find the match to one of our best friends foreach(Form f in owned) { FloatingForm ff = f as FloatingForm; if (ff != null) { if (ZoneHelper.ContentNames(ff.Zone).Contains(_best)) { target = ff; break; } } } // If no friends then try associates as second best option if (target == null) { // Find the match to one of our best friends foreach(Form f in owned) { FloatingForm ff = f as FloatingForm; if (ff != null) { if (ZoneHelper.ContentNames(ff.Zone).Contains(_associates)) { target = ff; break; } } } } // If we found a friend/associate, then restore to it if (target != null) { // We should have a child and be able to restore to its Zone _child.PerformRestore(target.Zone); } else { // Restore its location/size _content.DisplayLocation = _location; _content.DisplaySize = _size; // Use the docking manage method to create us a new Floating Window at correct size/location dm.AddContentWithState(_content, State.Floating); } }
public Zone(DockingManager manager, State state) { InternalConstruct(manager, state); }
private SharpClient.UI.Controls.TabControl AddPanelContents(string ContentTitle,int imageListIndex,SharpClient.UI.Docking.State _dockstate,bool bShow) { SharpClient.UI.Controls.TabControl stackTabControl=null; Content cStack=null; if(_stackManager==null) { _stackManager=new DockingManager(this,SharpClient.UI.Common.VisualStyle.IDE); _stackManager.InnerControl=sharpClientMDITab; _stackManager.OuterControl= psStatusBar; } if(_stackManager.Contents[ContentTitle]==null) { stackTabControl=new SharpClient.UI.Controls.TabControl(); stackTabControl.Appearance = SharpClient.UI.Controls.TabControl.VisualAppearance.MultiDocument; stackTabControl.BackColor = System.Drawing.SystemColors.ActiveCaptionText; stackTabControl.ButtonActiveColor = System.Drawing.SystemColors.ActiveCaptionText; stackTabControl.ButtonInactiveColor = System.Drawing.SystemColors.InactiveCaptionText; stackTabControl.Dock = System.Windows.Forms.DockStyle.Fill; stackTabControl.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); stackTabControl.HideTabsMode = SharpClient.UI.Controls.TabControl.HideTabsModes.ShowAlways; stackTabControl.HotTextColor = System.Drawing.SystemColors.Desktop; stackTabControl.IDEPixelBorder = false; stackTabControl.Location = new System.Drawing.Point(0, 31); stackTabControl.Size = new System.Drawing.Size(790, 484); stackTabControl.ClosePressed+=new EventHandler(stackTabControl_ClosePressed); cStack=_stackManager.Contents.Add(stackTabControl,ContentTitle,imageList1,imageListIndex ); _stackManager.AddContentWithState(cStack,_dockstate); } else { cStack=_stackManager.Contents[ContentTitle]; stackTabControl=cStack.Control as SharpClient.UI.Controls.TabControl; } ShowStackControl(bShow,cStack); return stackTabControl; }
public Content(DockingManager manager, Control control, string title, ImageList imageList, int imageIndex) { InternalConstruct(manager, control, title, imageList, imageIndex); }