Ejemplo n.º 1
0
            /// <summary>
            /// Releases all resources used by the AnimationHelper
            /// </summary>
            public void Dispose()
            {
                if (this.animationTimer != null)
                {
                    this.animationTimer.Stop();
                    this.animationTimer.Dispose();
                    this.animationTimer = null;
                }

                this.expando = null;
            }
Ejemplo n.º 2
0
            /// <summary>
            /// Populates the ExpandoSurrogate with data that is to be 
            /// serialized from the specified Expando
            /// </summary>
            /// <param name="expando">The Expando that contains the data 
            /// to be serialized</param>
            public void Load(Expando expando)
            {
                this.Name = expando.Name;
                this.Text = expando.Text;
                this.Size = expando.Size;
                this.Location = expando.Location;

                this.BackColor = ThemeManager.ConvertColorToString(expando.BackColor);
                this.ExpandedHeight = expando.ExpandedHeight;

                this.CustomSettings = new ExpandoInfo.ExpandoInfoSurrogate();
                this.CustomSettings.Load(expando.CustomSettings);
                this.CustomHeaderSettings = new HeaderInfo.HeaderInfoSurrogate();
                this.CustomHeaderSettings.Load(expando.CustomHeaderSettings);

                this.Animate = expando.Animate;
                this.ShowFocusCues = expando.ShowFocusCues;
                this.Collapsed = expando.Collapsed;
                this.CanCollapse = expando.CanCollapse;
                this.SpecialGroup = expando.SpecialGroup;

                this.TitleImage = ThemeManager.ConvertImageToByteArray(expando.TitleImage);
                this.Watermark = ThemeManager.ConvertImageToByteArray(expando.Watermark);

                this.Enabled = expando.Enabled;
                this.Visible = expando.Visible;
                this.AutoLayout = expando.AutoLayout;

                this.Anchor = expando.Anchor;
                this.Dock = expando.Dock;

                this.FontName = expando.Font.FontFamily.Name;
                this.FontSize = expando.Font.SizeInPoints;
                this.FontDecoration = expando.Font.Style;

                this.Tag = ThemeManager.ConvertObjectToByteArray(expando.Tag);

                for (int i=0; i<expando.Items.Count; i++)
                {
                    if (expando.Items[i] is TaskItem)
                    {
                        TaskItem.TaskItemSurrogate tis = new TaskItem.TaskItemSurrogate();

                        tis.Load((TaskItem) expando.Items[i]);

                        this.Items.Add(tis);
                    }
                }
            }
Ejemplo n.º 3
0
        /// <summary>
        /// "Drops" the specified Expando and moves it to the current drop point
        /// </summary>
        /// <param name="expando">The Expando to be "dropped"</param>
        internal void DropExpando(Expando expando)
        {
            if (this.dropPoint == Point.Empty)
            {
                return;
            }

            if (expando != null && expando.TaskPane == this)
            {
                int i = 0;
                int expandoIndex = this.Expandos.IndexOf(expando);

                for (; i<this.Expandos.Count; i++)
                {
                    if (this.dropPoint.Y <= this.Expandos[i].Top)
                    {
                        if (i > expandoIndex)
                        {
                            this.Expandos.Move(expando, i-1);
                        }
                        else if (i < expandoIndex)
                        {
                            this.Expandos.Move(expando, i);
                        }

                        break;
                    }
                }

                if (i == this.Expandos.Count)
                {
                    this.Expandos.Move(expando, i);
                }
            }

            this.dropPoint = Point.Empty;

            this.Invalidate(false);
        }
Ejemplo n.º 4
0
            /// <summary>
            /// Initializes a new instance of the AnimationHelper class with the specified settings
            /// </summary>
            /// <param name="expando">The Expando to be animated</param>
            /// <param name="animationType">The type of animation to perform</param>
            public AnimationHelper(Expando expando, int animationType)
            {
                this.expando = expando;
                this.animationType = animationType;

                this.animating = false;

                this.numAnimationSteps = NumAnimationFrames;
                this.animationFrameInterval = 10;

                // I know that this isn't the best way to do this, but I
                // haven't quite worked out how to do it with threads so
                // this will have to do for the moment
                this.animationTimer = new System.Windows.Forms.Timer();
                this.animationTimer.Tick += new EventHandler(this.animationTimer_Tick);
                this.animationTimer.Interval = this.animationFrameInterval;
            }
        /// <summary>
        /// Initializes a new instance of the ExpandoInfo class with default settings
        /// </summary>
        public ExpandoInfo()
        {
            // set background color values
            this.specialBackColor = Color.Transparent;
            this.normalBackColor = Color.Transparent;

            // set border values
            this.specialBorder = new Border(1, 0, 1, 1);
            this.specialBorderColor = Color.Transparent;

            this.normalBorder = new Border(1, 0, 1, 1);
            this.normalBorderColor = Color.Transparent;

            // set padding values
            this.specialPadding = new Padding(12, 10, 12, 10);
            this.normalPadding = new Padding(12, 10, 12, 10);

            this.specialBackImage = null;
            this.normalBackImage = null;

            this.watermarkAlignment = ContentAlignment.BottomRight;

            this.owner = null;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Calculates where the specified Expando should be located
        /// </summary>
        /// <returns>A Point that specifies where the Expando should 
        /// be located</returns>
        protected internal Point CalcExpandoLocation(Expando target)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            int targetIndex = this.Expandos.IndexOf(target);

            Expando e;
            Point p;

            int y = this.DisplayRectangle.Y + this.Padding.Top;
            int width = this.ClientSize.Width - this.Padding.Left - this.Padding.Right;

            for (int i=0; i<targetIndex; i++)
            {
                e = this.Expandos[i];

                if (!e.Visible)
                {
                    continue;
                }

                p = new Point(this.Padding.Left, y);
                y += e.Height + this.Padding.Bottom;
            }

            return new Point(this.Padding.Left, y);
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Moves the specified expando to the top of the expando collection
 /// </summary>
 /// <param name="value">The expando to be moved</param>
 public void MoveToTop(Expando value)
 {
     this.Move(value, 0);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of the ExpandoEventArgs class with default settings
 /// </summary>
 public ExpandoEventArgs()
 {
     expando = null;
 }
Ejemplo n.º 9
0
            /// <summary>
            /// Moves the specified expando to the specified indexed location 
            /// in the expando collection
            /// </summary>
            /// <param name="value">The expando to be moved</param>
            /// <param name="index">The indexed location in the expando collection 
            /// that the specified expando will be moved to</param>
            public void Move(Expando value, int index)
            {
                if (value == null)
                {
                    throw new ArgumentNullException("value");
                }

                // make sure the index is within range
                if (index < 0)
                {
                    index = 0;
                }
                else if (index > this.Count)
                {
                    index = this.Count;
                }

                // don't go any further if the expando is already
                // in the desired position or we don't contain it
                if (!this.Contains(value) || this.IndexOf(value) == index)
                {
                    return;
                }

                this.List.Remove(value);

                // if the index we're supposed to move the expando to
                // is now greater to the number of expandos contained,
                // add it to the end of the list, otherwise insert it at
                // the specified index
                if (index > this.Count)
                {
                    this.List.Add(value);
                }
                else
                {
                    this.List.Insert(index, value);
                }

                // re-layout the controls
                this.owner.MatchControlCollToExpandoColl();
            }
Ejemplo n.º 10
0
 /// <summary>
 /// Moves the specified expando to the bottom of the expando collection
 /// </summary>
 /// <param name="value">The expando to be moved</param>
 public void MoveToBottom(Expando value)
 {
     this.Move(value, this.Count);
 }
Ejemplo n.º 11
0
            /// <summary>
            /// Retrieves the index of the specified expando in the expando 
            /// collection
            /// </summary>
            /// <param name="expando">The Expando to locate in the collection</param>
            /// <returns>A zero-based index value that represents the position 
            /// of the specified Expando in the TaskPane.ExpandoCollection</returns>
            public int IndexOf(Expando expando)
            {
                if (expando == null)
                {
                    throw new ArgumentNullException("expando");
                }

                for (int i=0; i<this.Count; i++)
                {
                    if (this[i] == expando)
                    {
                        return i;
                    }
                }

                return -1;
            }
Ejemplo n.º 12
0
            /// <summary>
            /// Determines whether the specified expando is a member of the 
            /// collection
            /// </summary>
            /// <param name="expando">The Expando to locate in the collection</param>
            /// <returns>true if the Expando is a member of the collection; 
            /// otherwise, false</returns>
            public bool Contains(Expando expando)
            {
                if (expando == null)
                {
                    throw new ArgumentNullException("expando");
                }

                return (this.IndexOf(expando) != -1);
            }
Ejemplo n.º 13
0
            /// <summary>
            /// Adds an array of expando objects to the collection
            /// </summary>
            /// <param name="expandos">An array of Expando objects to add 
            /// to the collection</param>
            public void AddRange(Expando[] expandos)
            {
                if (expandos == null)
                {
                    throw new ArgumentNullException("expandos");
                }

                for (int i=0; i<expandos.Length; i++)
                {
                    this.Add(expandos[i]);
                }
            }
Ejemplo n.º 14
0
            /// <summary>
            /// Returns an Expando that contains the deserialized ExpandoSurrogate data
            /// </summary>
            /// <returns>An Expando that contains the deserialized ExpandoSurrogate data</returns>
            public Expando Save()
            {
                Expando expando = new Expando();
                ((ISupportInitialize) expando).BeginInit();
                expando.SuspendLayout();

                expando.Name = this.Name;
                expando.Text = this.Text;
                expando.Size = this.Size;
                expando.Location = this.Location;

                expando.BackColor = ThemeManager.ConvertStringToColor(this.BackColor);
                expando.ExpandedHeight = this.ExpandedHeight;

                expando.customSettings = this.CustomSettings.Save();
                expando.customSettings.Expando = expando;
                expando.customHeaderSettings = this.CustomHeaderSettings.Save();
                expando.customHeaderSettings.Expando = expando;

                expando.TitleImage = ThemeManager.ConvertByteArrayToImage(this.TitleImage);
                expando.Watermark = ThemeManager.ConvertByteArrayToImage(this.Watermark);

                expando.Animate = this.Animate;
                expando.ShowFocusCues = this.ShowFocusCues;
                expando.Collapsed = this.Collapsed;
                expando.CanCollapse = this.CanCollapse;
                expando.SpecialGroup = this.SpecialGroup;

                expando.Enabled = this.Enabled;
                expando.Visible = this.Visible;
                expando.AutoLayout = this.AutoLayout;

                expando.Anchor = this.Anchor;
                expando.Dock = this.Dock;

                expando.Font = new Font(this.FontName, this.FontSize, this.FontDecoration);

                expando.Tag = ThemeManager.ConvertByteArrayToObject(this.Tag);

                foreach (Object o in this.Items)
                {
                    TaskItem ti = ((TaskItem.TaskItemSurrogate) o).Save();

                    expando.Items.Add(ti);
                }

                ((ISupportInitialize) expando).EndInit();
                expando.ResumeLayout(false);

                return expando;
            }
Ejemplo n.º 15
0
            /// <summary>
            /// Removes the specified expando from the expando collection
            /// </summary>
            /// <param name="value">The Expando to remove from the 
            /// TaskPane.ExpandoCollection</param>
            public void Remove(Expando value)
            {
                if (value == null)
                {
                    throw new ArgumentNullException("value");
                }

                this.List.Remove(value);

                this.owner.Controls.Remove(value);

                this.owner.OnExpandoRemoved(new ExpandoEventArgs(value));
            }
Ejemplo n.º 16
0
            /// <summary>
            /// Initializes a new instance of the Expando.ItemCollection class
            /// </summary>
            /// <param name="owner">An Expando representing the expando that owns 
            /// the Control collection</param>
            public ItemCollection(Expando owner)
                : base()
            {
                if (owner == null)
                {
                    throw new ArgumentNullException("owner");
                }

                this.owner = owner;
            }
Ejemplo n.º 17
0
 /// <summary>
 /// Collaspes all the Expandos contained in the TaskPane, 
 /// except for the specified Expando which is expanded
 /// </summary>
 /// <param name="expando">The Expando that is to be expanded</param>
 // suggested by: PaleyX ([email protected])
 //               03/06/2004
 //               v1.1
 public void CollapseAllButOne(Expando expando)
 {
     foreach (Expando e in this.Expandos)
     {
         if (e != expando)
         {
             e.Collapsed = true;
         }
         else
         {
             expando.Collapsed = false;
         }
     }
 }
Ejemplo n.º 18
0
 /// <summary>
 /// Initializes a new instance of the ExpandoEventArgs class with specific Expando
 /// </summary>
 /// <param name="expando">The Expando that generated the event</param>
 public ExpandoEventArgs(Expando expando)
 {
     this.expando = expando;
 }
        /// <summary>
        /// Initializes a new instance of the HeaderInfo class with default settings
        /// </summary>
        public HeaderInfo()
        {
            // work out the default font name for the user's os.
            // this ignores other fonts that may be specified - need
            // to change parser to get font names
            if (Environment.OSVersion.Version.Major >= 5)
            {
                // Win2k, XP, Server 2003
                this.titleFont = new Font("Tahoma", 8.25f, FontStyle.Bold);
            }
            else
            {
                // Win9x, ME, NT
                this.titleFont = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Bold);
            }

            this.margin = 15;

            // set title colors and alignment
            this.specialTitle = Color.Transparent;
            this.specialTitleHot = Color.Transparent;

            this.normalTitle = Color.Transparent;
            this.normalTitleHot = Color.Transparent;

            this.specialAlignment = ContentAlignment.MiddleLeft;
            this.normalAlignment = ContentAlignment.MiddleLeft;

            // set padding values
            this.specialPadding = new Padding(10, 0, 1, 0);
            this.normalPadding = new Padding(10, 0, 1, 0);

            // set border values
            this.specialBorder = new Border(2, 2, 2, 0);
            this.specialBorderColor = Color.Transparent;

            this.normalBorder = new Border(2, 2, 2, 0);
            this.normalBorderColor = Color.Transparent;

            this.specialBackColor = Color.Transparent;
            this.normalBackColor = Color.Transparent;

            // set background image values
            this.specialBackImage = null;
            this.normalBackImage = null;

            this.backImageWidth = -1;
            this.backImageHeight = -1;

            // set arrow values
            this.specialArrowUp = null;
            this.specialArrowUpHot = null;
            this.specialArrowDown = null;
            this.specialArrowDownHot = null;

            this.normalArrowUp = null;
            this.normalArrowUpHot = null;
            this.normalArrowDown = null;
            this.normalArrowDownHot = null;

            this.useTitleGradient = false;
            this.specialGradientStartColor = Color.White;
            this.specialGradientEndColor = SystemColors.Highlight;
            this.normalGradientStartColor = Color.White;
            this.normalGradientEndColor = SystemColors.Highlight;
            this.gradientOffset = 0.5f;
            this.titleRadius = 5;

            this.owner = null;
            this.rightToLeft = false;
        }