Пример #1
0
        /// <summary>
        /// Deserialization constructor
        /// </summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        protected ClassShape(SerializationInfo info, StreamingContext context) : base(info, context)
        {
            this.mClassName = info.GetString("mClassName");

            this.mCollapsed = (CollapseStates)info.GetValue("mCollapsed", typeof(CollapseStates));

            this.mMethods = info.GetValue("mMethods", typeof(ClassMethodCollection)) as ClassMethodCollection;

            this.mPropeties = info.GetValue("mProperties", typeof(ClassPropertyCollection)) as ClassPropertyCollection;

            Connectors.Clear();
            this.mTopConnector           = info.GetValue("mTopConnector", typeof(Connector)) as Connector;
            this.mTopConnector.BelongsTo = this;
            Connectors.Add(mTopConnector);

            this.mBottomConnector           = info.GetValue("mBottomConnector", typeof(Connector)) as Connector;
            this.mBottomConnector.BelongsTo = this;
            Connectors.Add(mBottomConnector);

            IsResizable     = false;
            boldFont        = new Font(Font, FontStyle.Bold);
            this.OnMouseUp += new MouseEventHandler(TaskEvent_OnMouseUp);
        }
Пример #2
0
        /// <summary>
        /// Handles the click event on the shape and initiates the expands/collapses the elements
        /// </summary>
        /// <param name="sender">the sender</param>
        /// <param name="e">mouse event arguments</param>
        private void TaskEvent_OnMouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            #region Test the main expansion icon
            RectangleF collapseRect = new RectangleF(((int)(Rectangle.Right - 20)), ((int)(Rectangle.Y + 5)), 16, 16);

            if (collapseRect.Contains(e.X, e.Y))
            {
                //switch the main state
                if ((mCollapsed & CollapseStates.Main) != CollapseStates.Main)
                {
                    mCollapsed |= CollapseStates.Main;                                          //set main collapsed on
                }
                else
                {
                    mCollapsed &= ~CollapseStates.Main;                                         //set main collapsed off
                }
                this.Invalidate();
                return;
            }

            #endregion

            #region Test the properties expansion icon
            collapseRect = new RectangleF(Rectangle.X + 5, Rectangle.Y + 55, 18, 18);

            if (collapseRect.Contains(e.X, e.Y))
            {
                //switch the props state
                if ((mCollapsed & CollapseStates.Properties) != CollapseStates.Properties)
                {
                    mCollapsed |= CollapseStates.Properties;
                }
                else
                {
                    mCollapsed &= ~CollapseStates.Properties;
                }
                this.Invalidate();
                return;
            }

            #endregion

            #region Test the method expansion icon
            float shift;
            if ((mCollapsed & CollapseStates.Properties) == CollapseStates.Properties)
            {
                shift = recPropertiesHeight;
            }
            else
            {
                shift = 0;
            }

            collapseRect = new RectangleF(Rectangle.X + 5, Rectangle.Y + 55 + 15 + shift, 18, 18);
            if (collapseRect.Contains(e.X, e.Y))
            {
                //switch the methods state
                if ((mCollapsed & CollapseStates.Methods) != CollapseStates.Methods)
                {
                    mCollapsed |= CollapseStates.Methods;
                }
                else
                {
                    mCollapsed &= ~CollapseStates.Methods;
                }
                this.Invalidate();
                return;
            }
            #endregion
        }
Пример #3
0
 public void Expand()
 {
     mCollapsed &= ~CollapseStates.Main;                                 //set main collapsed off
     this.Invalidate();
 }
Пример #4
0
 public void Collapse()
 {
     mCollapsed |= CollapseStates.Main;
     this.Invalidate();
 }