/// <summary>
        /// Initializes a new instance of the TaskItem class with default settings
        /// </summary>
        public TaskItem() : base()
        {
            // set control styles
            this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.UserPaint, true);
            this.SetStyle(ControlStyles.Selectable, true);

            this.TabStop = true;

            this.BackColor = Color.Transparent;

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

            this.customSettings          = new TaskItemInfo();
            this.customSettings.TaskItem = this;
            this.customSettings.SetDefaultEmptyValues();

            // preferred size
            this.preferredWidth  = -1;
            this.preferredHeight = -1;

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

            this.Cursor = Cursors.Hand;

            this.textRect  = new Rectangle();
            this.TextAlign = ContentAlignment.TopLeft;

            this.showFocusCues = false;
            this.useGdiText    = false;

            this.InitStringFormat();
            this.InitDrawTextFlags();
        }
Example #2
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (components != null)
                {
                    components.Dispose();
                }

                if (this.systemSettings != null)
                {
                    this.systemSettings.Dispose();
                    this.systemSettings = null;
                }

                if (this.animationHelper != null)
                {
                    this.animationHelper.Dispose();
                    this.animationHelper = null;
                }
            }

            base.Dispose(disposing);
        }
Example #3
0
        public Expando()
            : base()
        {
            this.components = new System.ComponentModel.Container();

            this.SetStyle(ControlStyles.DoubleBuffer, 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;

            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;

            this.expandedHeight = 100;

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

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

            this.collapsed = false;

            this.specialGroup = false;

            this.focusState = FocusStates.None;

            this.titleImage = null;
            this.watermark = null;

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

            this.autoLayout = false;

            this.taskpane = null;

            this.itemList = new ItemCollection(this);
            this.hiddenControls = new ArrayList();

            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;
        }
Example #4
0
        /// <summary>
        /// Gets the System defined settings for the ExplorerBar specified
        /// by the shellstyle.dll at the specified path
        /// </summary>
        /// <param name="stylePath">The path to the shellstyle.dll</param>
        /// <returns>An ExplorerBarInfo object that contains the settings for 
        /// the ExplorerBar specified by the shellstyle.dll at the specified path</returns>
        public static ExplorerBarInfo GetSystemExplorerBarSettings(string stylePath)
        {
            // check if we can return the cached theme
            if (currentShellStyle != null)
            {
                if (!currentShellStyle.ClassicTheme && currentShellStyle.ShellStylePath != null && currentShellStyle.ShellStylePath.Equals(stylePath))
                {
                    return currentShellStyle;
                }
            }

            ExplorerBarInfo systemTheme;

            // attampt to load the specified shellstyle.dll
            if (LoadShellStyleDll(stylePath))
            {
                try
                {
                    // get the uifile contained in the shellstyle.dll
                    // and get ready to parse it
                    Parser parser = new Parser(GetResourceUIFile());

                    // let the parser do its stuff
                    systemTheme = parser.Parse();
                    systemTheme.SetOfficialTheme(false);
                    systemTheme.ShellStylePath = stylePath;
                }
                catch
                {
                    // something went wrong, so try to use current system theme
                    systemTheme = GetSystemExplorerBarSettings();
                }
                finally
                {
                    // unload the shellstyle.dll
                    FreeShellStyleDll();
                }
            }
            else
            {
                systemTheme = new ExplorerBarInfo();
                systemTheme.UseClassicTheme();
                systemTheme.SetOfficialTheme(true);

                systemTheme.SetUnthemedArrowImages();
            }

            currentShellStyle = systemTheme;

            return systemTheme;
        }
Example #5
0
        /// <summary>
        /// Gets the System defined settings for the ExplorerBar according
        /// to the current System theme
        /// </summary>
        /// <param name="useClassicTheme">Specifies whether the current system theme 
        /// should be ignored and return unthemed settings</param>
        /// <returns>An ExplorerBarInfo object that contains the System defined 
        /// settings for the ExplorerBar according to the current System theme</returns>
        public static ExplorerBarInfo GetSystemExplorerBarSettings(bool useClassicTheme)
        {
            // check if we can return the cached theme
            // note: caching a classic theme seems to cause a few
            //       problems i haven't been able to resolve, so
            //       for the moment always return a new
            //       ExplorerBarInfo if useClassicTheme is true
            if (currentShellStyle != null && !useClassicTheme)
            {
                if (currentShellStyle.ShellStylePath != null && currentShellStyle.ShellStylePath.Equals(GetShellStylePath()))
                {
                    return currentShellStyle;
                }
            }

            ExplorerBarInfo systemTheme;

            // check if we are using themes.  if so, load up the
            // appropriate shellstyle.dll
            if (!useClassicTheme && UxTheme.AppThemed && LoadShellStyleDll())
            {
                try
                {
                    // get the uifile contained in the shellstyle.dll
                    // and get ready to parse it
                    Parser parser = new Parser(GetResourceUIFile());

                    // let the parser do its stuff
                    systemTheme = parser.Parse();
                    systemTheme.SetOfficialTheme(true);
                    systemTheme.ShellStylePath = GetShellStylePath();
                }
                catch
                {
                    // something went wrong, so use default settings
                    systemTheme = new ExplorerBarInfo();
                    systemTheme.UseClassicTheme();
                    systemTheme.SetOfficialTheme(true);

                    // add non-themed arrows as the ExplorerBar will
                    // look funny without them.
                    systemTheme.SetUnthemedArrowImages();
                }
                finally
                {
                    // unload the shellstyle.dll
                    FreeShellStyleDll();
                }
            }
            else
            {
                // no themes available, so use default settings
                systemTheme = new ExplorerBarInfo();
                systemTheme.UseClassicTheme();
                systemTheme.SetOfficialTheme(true);

                // add non-themed arrows as the ExplorerBar will
                // look funny without them.
                systemTheme.SetUnthemedArrowImages();
            }

            // cache the theme
            currentShellStyle = systemTheme;

            return systemTheme;
        }
Example #6
0
        public ExplorerBarInfo Parse()
        {
            this.info = new ExplorerBarInfo();

            string token = null;

            while (this.tokenizer.HasMoreTokens())
            {
                token = this.tokenizer.NextToken();

                if (token.Equals("style"))
                {
                    style = GetStyle(token);
                }
                else if (token.Equals("/style"))
                {
                    style = UNKNOWN;
                }
                else if (style != UNKNOWN && IsSection(token))
                {
                    section = GetSection(token);
                }
                else if (style != UNKNOWN && section != UNKNOWN && IsProperty(token))
                {
                    property = GetPropertyType(token);
                    ExtractProperty();
                }
            }

            return info;
        }
Example #7
0
        /// <summary>
        /// Initializes a new instance of the TaskPane class with default settings
        /// </summary>
        public TaskPane()
        {
            // This call is required by the Windows.Forms Form Designer.
            components = new System.ComponentModel.Container();

            // set control styles
            this.SetStyle(ControlStyles.DoubleBuffer, true);
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.UserPaint, true);
            this.SetStyle(ControlStyles.ResizeRedraw, true);
            this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);

            this.expandoCollection = new TaskPane.ExpandoCollection(this);

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

            this.customSettings = new TaskPaneInfo();
            this.customSettings.TaskPane = this;
            this.customSettings.SetDefaultEmptyValues();

            this.BackColor = this.systemSettings.TaskPane.GradientStartColor;
            this.BackgroundImage = this.BackImage;

            this.classicTheme = false;
            this.customTheme = false;

            // size
            int width = (this.systemSettings.TaskPane.Padding.Left +
                this.systemSettings.TaskPane.Padding.Right +
                this.systemSettings.Header.BackImageWidth);
            int height = width;
            this.Size = new Size(width, height);

            // setup sutoscrolling
            this.AutoScroll = false;
            this.AutoScrollMargin = new Size(this.systemSettings.TaskPane.Padding.Right,
                this.systemSettings.TaskPane.Padding.Bottom);

            // Listen for changes to the parent
            this.ParentChanged += new EventHandler(this.OnParentChanged);

            this.allowExpandoDragging = false;
            this.dropPoint = Point.Empty;
            this.dropIndicatorColor = Color.Red;

            this.beginUpdateCount = 0;

            this.initialising = false;
            this.layout = false;
        }
Example #8
0
        /// <summary>
        /// Forces the TaskPane and all it's Expandos to use the 
        /// current system theme
        /// </summary>
        public void UseDefaultTheme()
        {
            this.customTheme = false;
            this.classicTheme = false;

            ExplorerBarInfo settings = ThemeManager.GetSystemExplorerBarSettings();

            this.systemSettings.Dispose();
            this.systemSettings = null;

            this.SystemSettings = settings;
        }
Example #9
0
        /// <summary>
        /// Forces the TaskPane and all it's Expandos to use the 
        /// specified theme
        /// </summary>
        /// <param name="stylePath">The path to the custom 
        /// shellstyle.dll to use</param>
        public void UseCustomTheme(string stylePath)
        {
            this.customTheme = true;
            this.classicTheme = false;

            ExplorerBarInfo settings = ThemeManager.GetSystemExplorerBarSettings(stylePath);

            this.systemSettings.Dispose();
            this.systemSettings = null;

            this.SystemSettings = settings;
        }
Example #10
0
        /// <summary> 
        /// Raises the SystemColorsChanged event
        /// </summary>
        /// <param name="e">An EventArgs that contains the event data</param>
        protected override void OnSystemColorsChanged(EventArgs e)
        {
            base.OnSystemColorsChanged(e);

            // don't go any further if we are explicitly using
            // the classic or a custom theme
            if (this.classicTheme || this.customTheme)
            {
                return;
            }

            this.SuspendLayout();

            // get rid of the current system theme info
            this.systemSettings.Dispose();
            this.systemSettings = null;

            // get a new system theme info for the new theme
            this.systemSettings = ThemeManager.GetSystemExplorerBarSettings();

            this.BackgroundImage = this.BackImage;

            // update the system settings for each expando
            foreach (Control control in this.Controls)
            {
                if (control is Expando)
                {
                    Expando expando = (Expando) control;

                    expando.SystemSettings = this.systemSettings;
                }
            }

            // update the layout of the controls
            this.DoLayout();

            this.ResumeLayout(true);
        }