Example #1
0
            /// <summary>
            /// Partition a static IBranch instance
            /// </summary>
            /// <param name="innerBranch">The branch to partition</param>
            /// <param name="indexer">An array of indices to reorder the items in the branch (optional)</param>
            /// <param name="sections">One or more PartitionSection structures indicating how the branch should be split up. If indexer is specified, then the Start and Count properties of the partition should be relative to the indexer, not the starting branch.</param>
            public BranchPartition(IBranch innerBranch, int[] indexer, params BranchPartitionSection[] sections)
            {
                myInnerBranch = innerBranch;
                myIndexer     = indexer;
                mySections    = sections;
                int sectionCount = sections.Length;
                int totalCount   = 0;

                myInnerMultiColumnBranch = innerBranch as IMultiColumnBranch;
                BranchFeatures requiredFeatures = 0;

                for (int i = 0; i < sectionCount; ++i)
                {
                    BranchPartitionSection currentSection = sections[i];
                    int visibleCount = sections[i].VisibleItemCount;
                    if (visibleCount != 0)
                    {
                        if (currentSection.Header != null && requiredFeatures == 0)
                        {
                            requiredFeatures = BranchFeatures.Expansions | ((myInnerMultiColumnBranch != null) ? BranchFeatures.JaggedColumns : 0);
                        }
                        totalCount += visibleCount;
                    }
                }
                myItemCount = totalCount;
                myFeatures  = requiredFeatures;
            }
Example #2
0
 public void SetFlags(BranchFeatures tf)
 {
     // Don't clear myFlags because this messes up a second call to this routine, such
     // as when a new branch is attached to the same not during a level shift. Not all
     // flags are calculated from the tree flags.
     NoChildExpansion = (tf & BranchFeatures.Expansions) == 0;
     NoRelocate = (tf & BranchFeatures.BranchRelocation) == 0;
     CallUpdate = RequireUpdatable(tf);
     Dynamic = RequireDynamic(tf);
     CheckState = (tf & BranchFeatures.StateChanges) != 0;
     DefaultTracking = (tf & BranchFeatures.DefaultPositionTracking) != 0;
     NoTracking = DefaultTracking ? false : ((tf & BranchFeatures.PositionTracking) == 0);
     JaggedColumns = (tf & BranchFeatures.JaggedColumns) != 0;
     ComplexColumns = (tf & BranchFeatures.ComplexColumns) != 0;
     if (0 != (tf & BranchFeatures.OnCollapseCloseAndDiscard))
     {
         SetFlag(TreeNodeFlags.OnCollapseCloseAndDiscard, true);
     }
     else if (0 != (tf & BranchFeatures.OnCollapseCloseChildren))
     {
         SetFlag(TreeNodeFlags.OnCollapseCloseChildren, true);
     }
 }
Example #3
0
 public static bool RequireUpdatable(BranchFeatures tf)
 {
     return (tf & BranchFeatures.DelayedUpdates) != 0;
 }
Example #4
0
 public static bool RequireDynamic(BranchFeatures tf)
 {
     // if BranchFeatures.DisplayDataFixed flag is not set, we always require dynamic (aka Tracking) nodes. (see bug 58253)
     // if DisplayDataFixed flag is set, then we only require dynamic nodes if the Realigns or InsertsAndDeletes features are
     // set on the branch.
     return ((tf & (BranchFeatures.Realigns | BranchFeatures.InsertsAndDeletes)) != 0)
            || ((tf & BranchFeatures.DisplayDataFixed) == 0);
 }
Example #5
0
 /// <summary>
 ///     Translate values from a BranchFeatures value into the corresponding VirtualTreeLabelEditActivationStyles value
 /// </summary>
 /// <param name="features">Features value</param>
 /// <returns>Label Edit Activation Style</returns>
 public static VirtualTreeLabelEditActivationStyles ActivationStylesFromBranchFeatures(BranchFeatures features)
 {
     return
         (VirtualTreeLabelEditActivationStyles)
         (((int)features & BranchFeaturesToActivationStyleMask) >> BranchFeaturesToActivationStyleShift);
 }
Example #6
0
			/// <summary>
			/// Partition a static IBranch instance
			/// </summary>
			/// <param name="innerBranch">The branch to partition</param>
			/// <param name="indexer">An array of indices to reorder the items in the branch (optional)</param>
			/// <param name="sections">One or more PartitionSection structures indicating how the branch should be split up. If indexer is specified, then the Start and Count properties of the partition should be relative to the indexer, not the starting branch.</param>
			public BranchPartition(IBranch innerBranch, int[] indexer, params BranchPartitionSection[] sections)
			{
				myInnerBranch = innerBranch;
				myIndexer = indexer;
				mySections = sections;
				int sectionCount = sections.Length;
				int totalCount = 0;
				myInnerMultiColumnBranch = innerBranch as IMultiColumnBranch;
				BranchFeatures requiredFeatures = 0;
				for (int i = 0; i < sectionCount; ++i)
				{
					BranchPartitionSection currentSection = sections[i];
					int visibleCount = sections[i].VisibleItemCount;
					if (visibleCount != 0)
					{
						if (currentSection.Header != null && requiredFeatures == 0)
						{
							requiredFeatures = BranchFeatures.Expansions | ((myInnerMultiColumnBranch != null) ? BranchFeatures.JaggedColumns : 0);
						}
						totalCount += visibleCount;
					}
				}
				myItemCount = totalCount;
				myFeatures = requiredFeatures;
			}