/// <summary>
            /// Returns a HeaderInfo that contains the deserialized HeaderInfoSurrogate data
            /// </summary>
            /// <returns>A HeaderInfo that contains the deserialized HeaderInfoSurrogate data</returns>
            public HeaderInfo Save()
            {
                HeaderInfo headerInfo = new HeaderInfo();

                if (this.FontName != null)
                {
                    headerInfo.TitleFont = new Font(this.FontName, this.FontSize, this.FontStyle);
                }

                headerInfo.Margin = this.Margin;

                headerInfo.SpecialBackImage = ThemeManager.ConvertByteArrayToImage(this.SpecialBackImage);
                headerInfo.NormalBackImage = ThemeManager.ConvertByteArrayToImage(this.NormalBackImage);

                headerInfo.SpecialTitleColor = ThemeManager.ConvertStringToColor(this.SpecialTitle);
                headerInfo.NormalTitleColor = ThemeManager.ConvertStringToColor(this.NormalTitle);
                headerInfo.SpecialTitleHotColor = ThemeManager.ConvertStringToColor(this.SpecialTitleHot);
                headerInfo.NormalTitleHotColor = ThemeManager.ConvertStringToColor(this.NormalTitleHot);

                headerInfo.SpecialAlignment = this.SpecialAlignment;
                headerInfo.NormalAlignment = this.NormalAlignment;

                headerInfo.SpecialPadding = this.SpecialPadding;
                headerInfo.NormalPadding = this.NormalPadding;

                headerInfo.SpecialBorder = this.SpecialBorder;
                headerInfo.NormalBorder = this.NormalBorder;
                headerInfo.SpecialBorderColor = ThemeManager.ConvertStringToColor(this.SpecialBorderColor);
                headerInfo.NormalBorderColor = ThemeManager.ConvertStringToColor(this.NormalBorderColor);

                headerInfo.SpecialBackColor = ThemeManager.ConvertStringToColor(this.SpecialBackColor);
                headerInfo.NormalBackColor = ThemeManager.ConvertStringToColor(this.NormalBackColor);

                headerInfo.SpecialArrowUp = ThemeManager.ConvertByteArrayToImage(this.SpecialArrowUp);
                headerInfo.SpecialArrowUpHot = ThemeManager.ConvertByteArrayToImage(this.SpecialArrowUpHot);
                headerInfo.SpecialArrowDown = ThemeManager.ConvertByteArrayToImage(this.SpecialArrowDown);
                headerInfo.SpecialArrowDownHot = ThemeManager.ConvertByteArrayToImage(this.SpecialArrowDownHot);
                headerInfo.NormalArrowUp = ThemeManager.ConvertByteArrayToImage(this.NormalArrowUp);
                headerInfo.NormalArrowUpHot = ThemeManager.ConvertByteArrayToImage(this.NormalArrowUpHot);
                headerInfo.NormalArrowDown = ThemeManager.ConvertByteArrayToImage(this.NormalArrowDown);
                headerInfo.NormalArrowDownHot = ThemeManager.ConvertByteArrayToImage(this.NormalArrowDownHot);

                headerInfo.TitleGradient = this.TitleGradient;
                headerInfo.SpecialGradientStartColor = ThemeManager.ConvertStringToColor(this.SpecialGradientStartColor);
                headerInfo.SpecialGradientEndColor = ThemeManager.ConvertStringToColor(this.SpecialGradientEndColor);
                headerInfo.NormalGradientStartColor = ThemeManager.ConvertStringToColor(this.NormalGradientStartColor);
                headerInfo.NormalGradientEndColor = ThemeManager.ConvertStringToColor(this.NormalGradientEndColor);
                headerInfo.GradientOffset = this.GradientOffset;

                return headerInfo;
            }
        /// <summary>
        /// Initializes a new instance of the ExplorerBarInfo class with 
        /// default settings
        /// </summary>
        public ExplorerBarInfo()
        {
            this.taskPane = new TaskPaneInfo();
            this.taskItem = new TaskItemInfo();
            this.expando = new ExpandoInfo();
            this.header = new HeaderInfo();

            this.officialTheme = false;
            this.classicTheme = false;
            this.shellStylePath = null;
        }
            /// <summary>
            /// Populates the HeaderInfoSurrogate with data that is to be 
            /// serialized from the specified HeaderInfo
            /// </summary>
            /// <param name="headerInfo">The HeaderInfo that contains the data 
            /// to be serialized</param>
            public void Load(HeaderInfo headerInfo)
            {
                if (headerInfo.TitleFont != null)
                {
                    this.FontName = headerInfo.TitleFont.Name;
                    this.FontSize = headerInfo.TitleFont.SizeInPoints;
                    this.FontStyle = headerInfo.TitleFont.Style;
                }

                this.Margin = headerInfo.Margin;

                this.SpecialBackImage = ThemeManager.ConvertImageToByteArray(headerInfo.SpecialBackImage);
                this.NormalBackImage = ThemeManager.ConvertImageToByteArray(headerInfo.NormalBackImage);

                this.SpecialTitle = ThemeManager.ConvertColorToString(headerInfo.SpecialTitleColor);
                this.NormalTitle = ThemeManager.ConvertColorToString(headerInfo.NormalTitleColor);
                this.SpecialTitleHot = ThemeManager.ConvertColorToString(headerInfo.SpecialTitleHotColor);
                this.NormalTitleHot = ThemeManager.ConvertColorToString(headerInfo.NormalTitleHotColor);

                this.SpecialAlignment = headerInfo.SpecialAlignment;
                this.NormalAlignment = headerInfo.NormalAlignment;

                this.SpecialPadding = headerInfo.SpecialPadding;
                this.NormalPadding = headerInfo.NormalPadding;

                this.SpecialBorder = headerInfo.SpecialBorder;
                this.NormalBorder = headerInfo.NormalBorder;
                this.SpecialBorderColor = ThemeManager.ConvertColorToString(headerInfo.SpecialBorderColor);
                this.NormalBorderColor = ThemeManager.ConvertColorToString(headerInfo.NormalBorderColor);

                this.SpecialBackColor = ThemeManager.ConvertColorToString(headerInfo.SpecialBackColor);
                this.NormalBackColor = ThemeManager.ConvertColorToString(headerInfo.NormalBackColor);

                this.SpecialArrowUp = ThemeManager.ConvertImageToByteArray(headerInfo.SpecialArrowUp);
                this.SpecialArrowUpHot = ThemeManager.ConvertImageToByteArray(headerInfo.SpecialArrowUpHot);
                this.SpecialArrowDown = ThemeManager.ConvertImageToByteArray(headerInfo.SpecialArrowDown);
                this.SpecialArrowDownHot = ThemeManager.ConvertImageToByteArray(headerInfo.SpecialArrowDownHot);
                this.NormalArrowUp = ThemeManager.ConvertImageToByteArray(headerInfo.NormalArrowUp);
                this.NormalArrowUpHot = ThemeManager.ConvertImageToByteArray(headerInfo.NormalArrowUpHot);
                this.NormalArrowDown = ThemeManager.ConvertImageToByteArray(headerInfo.NormalArrowDown);
                this.NormalArrowDownHot = ThemeManager.ConvertImageToByteArray(headerInfo.NormalArrowDownHot);

                this.TitleGradient = headerInfo.TitleGradient;
                this.SpecialGradientStartColor = ThemeManager.ConvertColorToString(headerInfo.SpecialGradientStartColor);
                this.SpecialGradientEndColor = ThemeManager.ConvertColorToString(headerInfo.SpecialGradientEndColor);
                this.NormalGradientStartColor = ThemeManager.ConvertColorToString(headerInfo.NormalGradientStartColor);
                this.NormalGradientEndColor = ThemeManager.ConvertColorToString(headerInfo.NormalGradientEndColor);
                this.GradientOffset = headerInfo.GradientOffset;
            }
Beispiel #4
0
        /// <summary>
        /// Initializes a new instance of the Expando class with default settings
        /// </summary>
        public Expando()
            : base()
        {
            // This call is required by the Windows.Forms Form Designer.
            this.components = new System.ComponentModel.Container();

            // set control styles
            this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.UserPaint, true);
            this.SetStyle(ControlStyles.ResizeRedraw, true);
            this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            this.SetStyle(ControlStyles.Selectable, true);
            this.TabStop = true;

            // get the system theme settings
            this.systemSettings = ThemeManager.GetSystemExplorerBarSettings();

            this.customSettings = new ExpandoInfo();
            this.customSettings.Expando = this;
            this.customSettings.SetDefaultEmptyValues();

            this.customHeaderSettings = new HeaderInfo();
            this.customHeaderSettings.Expando = this;
            this.customHeaderSettings.SetDefaultEmptyValues();

            this.BackColor = this.systemSettings.Expando.NormalBackColor;

            // the height of the Expando in the expanded state
            this.expandedHeight = 100;

            // animation
            this.animate = false;
            this.animatingFade = false;
            this.animatingSlide = false;
            this.animationImage = null;
            this.slideEndHeight = -1;
            this.animationHelper = null;
            this.fadeHeights = new int[AnimationHelper.NumAnimationFrames];

            // size
            this.Size = new Size(this.systemSettings.Header.BackImageWidth, this.expandedHeight);
            this.titleBarHeight = this.systemSettings.Header.BackImageHeight;
            this.headerHeight = this.titleBarHeight;
            this.oldWidth = this.Width;

            // start expanded
            this.collapsed = false;

            // not a special group
            this.specialGroup = false;

            // unfocused titlebar
            this.focusState = FocusStates.None;

            // no title image
            this.titleImage = null;
            this.watermark = null;

            this.Font = new Font(this.TitleFont.Name, 8.25f, FontStyle.Regular);

            // don't get the Expando to layout its items itself
            this.autoLayout = false;

            // don't know which TaskPane we belong to
            this.taskpane = null;

            // internal list of items
            this.itemList = new ItemCollection(this);
            this.hiddenControls = new ArrayList();

            // initialise the dummyPanel
            this.dummyPanel = new AnimationPanel();
            this.dummyPanel.Size = this.Size;
            this.dummyPanel.Location = new Point(-1000, 0);

            this.canCollapse = true;

            this.showFocusCues = false;
            this.useDefaultTabHandling = true;

            this.CalcAnimationHeights();

            this.slideAnimationBatched = false;

            this.dragging = false;
            this.dragStart = Point.Empty;

            this.beginUpdateCount = 0;

            this.initialising = false;
            this.layout = false;
        }