示例#1
0
		internal void SetRootSequence(TabGroupSequence tgs)
		{
			// Use the new sequence as the root
			_root = tgs;
		}
示例#2
0
 internal void MoveActiveToNearestFromSequence(TabGroupSequence tgs)
 {
     // Is active leaf being moved from root sequence
     if (_root == tgs)
     {
         // Then make nothing active
         ActiveLeaf = null;
     }
     else
     {
         // Find the parent sequence of given sequence
         TabGroupSequence tgsParent = tgs.Parent as TabGroupSequence;
     
         // Must be valid, but had better check anyway
         if (tgs != null)
         {
             // Move relative to given base in the sequence
             MoveActiveInSequence(tgsParent, tgs);
         }
     }
 }
示例#3
0
        protected void InternalConstruct(VisualStyle style)
		{
            // Prevent flicker with double buffering and all painting inside WM_PAINT
			SetStyle(ControlStyles.DoubleBuffer | 
					 ControlStyles.AllPaintingInWmPaint |
					 ControlStyles.UserPaint, true);
		
		    // We want to act as a drop target
		    this.AllowDrop = true;
		
		    // Remember parameters
		    _style = style;
		    
		    // Define initial state
		    _numLeafs = 0;
		    _compacting = false;
		    _initializing = false;
			_suspendLeafCount = 0;
		    
            // Create the root sequence that always exists
            _root = new TabGroupSequence(this);
		    
            // Define default settings
		    ResetProminentLeaf();
		    ResetResizeBarVector();
		    ResetResizeBarColor();
		    ResetResizeBarLock();
			ResetLayoutLock();
			ResetCompactOptions();
		    ResetDefaultGroupMinimumWidth();
            ResetDefaultGroupMinimumHeight();
            ResetActiveLeaf();
            ResetAutoCompact();
            ResetAtLeastOneLeaf();
            ResetCloseMenuText();
            ResetProminentMenuText();
            ResetRebalanceMenuText();
            ResetMovePreviousMenuText();
            ResetMoveNextMenuText();
            ResetNewVerticalMenuText();
            ResetNewHorizontalMenuText();
            ResetCloseShortcut();
            ResetProminentShortcut();
            ResetRebalanceShortcut();
            ResetMovePreviousShortcut();
            ResetMoveNextShortcut();
            ResetSplitVerticalShortcut();
            ResetSplitHorizontalShortcut();
            ResetImageList();
            ResetDisplayTabMode();
            ResetSaveControls();
            ResetAutoCalculateDirty();
            ResetDirty();
			ResetPageCloseWhenEmpty();
            
            // Add ourself to the application filtering list 
            // (to snoop for shortcut combinations)
            Application.AddMessageFilter(this);
            
        }
示例#4
0
 protected bool RecursiveActiveInSequence(TabGroupSequence tgs, bool forwards)
 {
     int count = tgs.Count;
 
     for(int i=0; i<count; i++)
     {
         // Index depends on which direction we are processing
         int index = (forwards == true) ? i : (tgs.Count - i - 1);
         
         // Is this the needed leaf node?
         if (tgs[index].IsLeaf)
         {
             // Make it active, and finish
             ActiveLeaf = tgs[index] as TabGroupLeaf;
             return true;
         }
         else
         {
             // Need to make a recursive check inside group
             if (RecursiveActiveInSequence(tgs[index] as TabGroupSequence, forwards))
                 return true;
         }
     }
     
     // Still no luck
     return false;
 }
示例#5
0
 protected void MoveActiveInSequence(TabGroupSequence tgs, TabGroupBase child)
 {
     int count = tgs.Count;
     int index = tgs.IndexOf(child);
 
     // First try each entry after that given
     for(int i=index+1; i<count; i++)
     {
         // Is this the needed leaf node?
         if (tgs[i].IsLeaf)
         {
             // Make it active, and finish
             ActiveLeaf = tgs[i] as TabGroupLeaf;
             return;  
         }
         else
         {
             // Need to make a recursive check inside group
             if (RecursiveActiveInSequence(tgs[i] as TabGroupSequence, true))
                 return;
         }
     }
     
     // Now try each entry before that given
     for(int i=index-1; i>=0; i--)
     {
         // Is this the needed leaf node?
         if (tgs[i].IsLeaf)
         {
             // Make it active, and finish
             ActiveLeaf = tgs[i] as TabGroupLeaf;
             return;  
         }
         else
         {
             // Need to make a recursive check inside group
             if (RecursiveActiveInSequence(tgs[i] as TabGroupSequence, false))
                 return;
         }
     }
     
     // Still no luck, try our own parent
     if (tgs.Parent != null)
         MoveActiveInSequence(tgs.Parent as TabGroupSequence, tgs);
 }
示例#6
0
 protected TabGroupLeaf RecursiveFindLeafInSequence(TabGroupSequence tgs, TabGroupBase tgb, bool forwards)
 {
     int count = tgs.Count;
     int index = tgs.IndexOf(tgb);
 
     // Are we look for entries after the provided one?
     if (forwards)
     {
         for(int i=index+1; i<count; i++)
         {
             // Is this the needed leaf node?
             if (tgs[i].IsLeaf)
                 return tgs[i] as TabGroupLeaf;
             else
             {
                 TabGroupLeaf leaf = RecursiveFindLeafInSequence(tgs[i] as TabGroupSequence, forwards);
             
                 if (leaf != null)
                     return leaf;
             }
         }
     }
     else
     {
         // Now try each entry before that given
         for(int i=index-1; i>=0; i--)
         {
             // Is this the needed leaf node?
             if (tgs[i].IsLeaf)
                 return tgs[i] as TabGroupLeaf;
             else
             {
                 TabGroupLeaf leaf = RecursiveFindLeafInSequence(tgs[i] as TabGroupSequence, forwards);
             
                 if (leaf != null)
                     return leaf;
             }
         }
     }
                 
     // Still no luck, try our own parent
     if (tgs.Parent != null)
         return RecursiveFindLeafInSequence(tgs.Parent as TabGroupSequence, tgs, forwards);
     else
         return null;
 }
示例#7
0
        protected TabGroupLeaf RecursiveFindLeafInSequence(TabGroupSequence tgs, bool forwards)
        {
            int count = tgs.Count;
        
            for(int i=0; i<count; i++)
            {
                // Index depends on which direction we are processing
                int index = (forwards == true) ? i : (tgs.Count - i - 1);
                
                // Is this the needed leaf node?
                if (tgs[index].IsLeaf)
                    return tgs[index] as TabGroupLeaf;
                else
                {
                    // Need to make a recursive check inside group
                    TabGroupLeaf leaf = RecursiveFindLeafInSequence(tgs[index] as TabGroupSequence, forwards);

                    if (leaf != null)
                        return leaf;
                }
            }
            
            // Still no luck
            return null;
        }
示例#8
0
        public override void LoadFromXml(XmlTextReader xmlIn)
        {
            // Grab the expected attributes
            string rawCount = xmlIn.GetAttribute(0);
            string rawUnique = xmlIn.GetAttribute(1);
            string rawSpace = xmlIn.GetAttribute(2);
            string rawDirection = xmlIn.GetAttribute(3);

            // Convert to correct types
            int count = Convert.ToInt32(rawCount);
            int unique = Convert.ToInt32(rawUnique);
            Decimal space = Convert.ToDecimal(rawSpace);
            Direction direction = (rawDirection == "Horizontal" ? Direction.Horizontal :
                                                                  Direction.Vertical);

            // Update myself with new values
            _unique = unique;
            _space = space;
            _direction = direction;

            // Load each of the children
            for(int i=0; i<count; i++)
            {
                // Read the next Element
                if (!xmlIn.Read())
                    throw new ArgumentException("An element was expected but could not be read in");

                TabGroupBase newElement = null;

                // Is it another sequence?
                if (xmlIn.Name == "Sequence")
                    newElement = new TabGroupSequence(_tabbedGroups, this);
                else if (xmlIn.Name == "Leaf")
                    newElement = new TabGroupLeaf(_tabbedGroups, this);
                else
                    throw new ArgumentException("Unknown element was encountered");

                bool expectEndElement = !xmlIn.IsEmptyElement;

                // Load its config
                newElement.LoadFromXml(xmlIn);

                // Add new element to the collection
                Add(newElement);

                // Do we expect and end element to occur?
                if (expectEndElement)
                {
                    // Move past the end element
                    if (!xmlIn.Read())
                        throw new ArgumentException("Could not read in next expected node");

                    // Check it has the expected name
                    if (xmlIn.NodeType != XmlNodeType.EndElement)
                        throw new ArgumentException("EndElement expected but not found");
                }
            }
        }
        protected void AddGroupToSequence(TabGroupSequence tgs, TabGroupLeaf sourceLeaf, bool before)
        {
            // Remember original auto compact mode
            bool autoCompact = _tabbedGroups.AutoCompact;

            // Turn mode off as it interferes with reorganisation
            _tabbedGroups.AutoCompact = false;

            // Find our index into parent collection
            int pos = tgs.IndexOf(this);

            TabGroupLeaf newGroup = null;

            // New group inserted before existing one?
            if (before)
                newGroup = tgs.InsertNewLeaf(pos);
            else
            {
                // No, are we at the end of the collection?
                if (pos == (tgs.Count - 1))
                    newGroup = tgs.AddNewLeaf();
                else
                    newGroup = tgs.InsertNewLeaf(pos + 1);
            }

            // Get tab control for source leaf
            Controls.TabControl tc = sourceLeaf.GroupControl as Controls.TabControl;

            TabPage tp = tc.SelectedTab;

            // Remove page from ourself
            tc.TabPages.Remove(tp);

            // Add into the new leaf
            newGroup.TabPages.Add(tp);

            // Reset compacting mode as we have updated the structure
            _tabbedGroups.AutoCompact = autoCompact;

            // Do we need to compact?
            if (_tabbedGroups.AutoCompact)
                _tabbedGroups.Compact();
        }