Beispiel #1
0
        /// <summary>
        /// Gets the style for a dock object, which will inherit values from all region/style definitions
        /// </summary>
        internal DockVisualStyle GetRegionStyleForObject(DockObject obj)
        {
            DockVisualStyle mergedStyle = null;

            if (obj is DockGroupItem)
            {
                DockVisualStyle s;
                if (stylesById.TryGetValue(((DockGroupItem)obj).Id, out s))
                {
                    mergedStyle = DefaultVisualStyle.Clone();
                    mergedStyle.CopyValuesFrom(s);
                }
            }
            foreach (var e in regionStyles)
            {
                if (InRegion(e.Item1, obj))
                {
                    if (mergedStyle == null)
                    {
                        mergedStyle = DefaultVisualStyle.Clone();
                    }
                    mergedStyle.CopyValuesFrom(e.Item2);
                }
            }
            return(mergedStyle ?? DefaultVisualStyle);
        }
Beispiel #2
0
        /// <summary>
        /// Gets the style assigned to a specific position of the layout
        /// </summary>
        /// <returns>
        /// The region style for position.
        /// </returns>
        /// <param name='parentGroup'>
        /// Group which contains the position
        /// </param>
        /// <param name='childIndex'>
        /// Index of the position inside the group
        /// </param>
        /// <param name='insertingPosition'>
        /// If true, the position will be inserted (meaning that the objects in childIndex will be shifted 1 position)
        /// </param>
        internal DockVisualStyle GetRegionStyleForPosition(DockGroup parentGroup, int childIndex, bool insertingPosition)
        {
            DockVisualStyle mergedStyle = null;

            foreach (var e in regionStyles)
            {
                if (InRegion(e.Item1, parentGroup, childIndex, insertingPosition))
                {
                    if (mergedStyle == null)
                    {
                        mergedStyle = DefaultVisualStyle.Clone();
                    }
                    mergedStyle.CopyValuesFrom(e.Item2);
                }
            }
            return(mergedStyle ?? DefaultVisualStyle);
        }