public void FirePropertyChanged(PropertyGrid.Section section, PropertyGrid.Item item, object oldValue)
 {
     if (this.OnPropertyChanged != null)
     {
         this.OnPropertyChanged(this, new PropertyChangedArgs(section, item, oldValue));
     }
 }
 protected void FirePropertySelected(PropertyGrid.Section section, PropertyGrid.Item item)
 {
     if (this.OnPropertySelected != null)
     {
         this.OnPropertySelected(this, new PropertySelectedArgs(section, item));
     }
 }
 public void FirePropertyKeyEnter(PropertyGrid.Section section, PropertyGrid.Item item)
 {
     if (this.OnPropertyKeyEnter != null)
     {
         this.OnPropertyKeyEnter(this, new PropertyKeyEnterArgs(section, item));
     }
 }
Ejemplo n.º 4
0
        public override void CreateEditor(PropertyGrid grid, PropertyGrid.Section section, PropertyGrid.Item item, Rectangle rect)
        {
            base.CreateEditor(grid, section, item, rect);
            Color value = (Color)item.Value;

            base.CreateTextbox(this.ColourString(value), rect, rect.Height + 5, this.mButton.Width);
        }
Ejemplo n.º 5
0
        public override void CreateEditor(PropertyGrid grid, PropertyGrid.Section section, PropertyGrid.Item item, Rectangle rect)
        {
            int num = (this.ButtonWidth == 0 ? rect.Height + 4 : this.ButtonWidth);

            this.mGrid    = grid;
            this.mItem    = item;
            this.mSection = section;
            int   right = rect.Right - num;
            int   y     = rect.Y;
            Point autoScrollPosition = grid.AutoScrollPosition;

            this.mButton  = new Rectangle(right, y - autoScrollPosition.Y, num, rect.Height);
            this.mState   = PushButtonState.Normal;
            this.mCapture = false;
            if (this.mButton.X < rect.Left)
            {
                this.mButton.Width = this.mButton.Right - rect.Left;
                this.mButton.X     = rect.Left;
            }
            if (this.Editable)
            {
                base.CreateTextbox(this.getAsString(item.Value), rect, 2, num);
                if (this.mTextBox != null)
                {
                    this.mTextBox.ReadOnly = this.Locked;
                }
            }
        }
Ejemplo n.º 6
0
 public override void CreateEditor(PropertyGrid grid, PropertyGrid.Section section, PropertyGrid.Item item, Rectangle rect)
 {
     base.CreateEditor(grid, section, item, rect);
     this.mList.Items.Add(false);
     this.mList.Items.Add(true);
     this.mList.SelectedItem = item.Value;
 }
Ejemplo n.º 7
0
 public override void CreateEditor(PropertyGrid grid, PropertyGrid.Section section, PropertyGrid.Item item, Rectangle rect)
 {
     base.CreateEditor(grid, section, item, rect);
     foreach (object value in Enum.GetValues(item.Value.GetType()))
     {
         this.mList.Items.Add(value);
     }
     this.mList.SelectedItem = item.Value;
 }
        private void PropertyGrid_MouseDown(object sender, MouseEventArgs e)
        {
            Point autoScrollPosition;

            base.Focus();
            if ((this.mEditor == null ? false : this.mEditor.Editing != null))
            {
                if (e.X <= this.DividerPosition + 2)
                {
                    this.closeEditor(true);
                }
                else
                {
                    CustomProperty customProperty            = this.mEditor;
                    System.Windows.Forms.MouseButtons button = e.Button;
                    int clicks = e.Clicks;
                    int x      = e.X;
                    int y      = e.Y;
                    autoScrollPosition = base.AutoScrollPosition;
                    customProperty.MouseDown(new MouseEventArgs(button, clicks, x, y - autoScrollPosition.Y, e.Delta));
                }
            }
            if ((this.DividerFixed ? true : Math.Abs(e.X - this.DividerPosition) >= 3))
            {
                int num = e.Y;
                autoScrollPosition = base.AutoScrollPosition;
                KeyValuePair <PropertyGrid.Section, PropertyGrid.Item> itemAt = this.getItemAt(num - autoScrollPosition.Y);
                if (itemAt.Value != null)
                {
                    this.mFocusedItem    = itemAt.Value;
                    this.mFocusedSection = itemAt.Key;
                    this.FirePropertySelected(this.mFocusedSection, this.mFocusedItem);
                    if (e.X > this.DividerPosition)
                    {
                        this.createEditor(itemAt.Key, itemAt.Value);
                    }
                }
                else if (itemAt.Key != null)
                {
                    this.mFocusedItem    = null;
                    this.mFocusedSection = itemAt.Key;
                    if (e.X < this.MarginSize)
                    {
                        this.mFocusedSection.Collapsed = !this.mFocusedSection.Collapsed;
                        this.recalculateSize();
                    }
                }
                base.Invalidate();
            }
            else
            {
                this.Cursor         = Cursors.VSplit;
                this.mMovingDivider = true;
                base.Capture        = true;
            }
        }
Ejemplo n.º 9
0
 public virtual void CreateEditor(PropertyGrid grid, PropertyGrid.Section section, PropertyGrid.Item item, Rectangle rect)
 {
     this.mGrid    = grid;
     this.mItem    = item;
     this.mSection = section;
     if (this.mTextBox == null)
     {
         this.CreateTextbox(this.getAsString(item.Value), rect, 2, 0);
     }
 }
 public void removeSection(string name)
 {
     this.closeEditor(true);
     this.Sections.RemoveAll((PropertyGrid.Section o) => o.Name == name);
     if ((this.mFocusedSection == null ? false : this.mFocusedSection.Name == name))
     {
         this.mFocusedSection = null;
     }
     base.Invalidate();
 }
 public override void CreateEditor(PropertyGrid grid, PropertyGrid.Section section, PropertyGrid.Item item, Rectangle rect)
 {
     base.CreateEditor(grid, section, item, rect);
     this.mList             = new ListBox();
     this.mList.Click      += new EventHandler(this.list_SelectedIndexChanged);
     this.mList.MouseMove  += new MouseEventHandler(this.list_mouseMoveChanged);
     this.mList.MinimumSize = new Size(rect.Width - 2, 16);
     this.mList.MaximumSize = new Size(400, 400);
     this.mList.BorderStyle = BorderStyle.None;
     this.mTextBox.KeyDown += new KeyEventHandler(this.mTextBox_KeyDown);
     base.PopupControl      = this.mList;
 }
 public void removeItem(string section, PropertyGrid.Item item)
 {
     this.closeEditor(true);
     PropertyGrid.Section section1 = this.getSection(section, false);
     if (section1 != null)
     {
         if (this.mFocusedItem == item)
         {
             this.mFocusedItem = null;
         }
         section1.Items.Remove(item);
         base.Invalidate();
     }
 }
 public void addItem(string section, PropertyGrid.Item item)
 {
     PropertyGrid.Section list = this.getSection(section, true);
     list.Items.Add(item);
     if (this.SortItems)
     {
         list.Items = (
             from o in list.Items
             orderby o.Name
             select o).ToList <PropertyGrid.Item>();
     }
     this.recalculateSize();
     base.Invalidate();
 }
 public PropertyGrid.Item getItem(string section, string name)
 {
     PropertyGrid.Item    item;
     PropertyGrid.Section section1 = this.getSection(section, false);
     if (section1 != null)
     {
         PropertyGrid.Item item1 = section1.Items.Find((PropertyGrid.Item o) => o.Name == name);
         item = item1;
     }
     else
     {
         item = null;
     }
     return(item);
 }
Ejemplo n.º 15
0
 private void mTextBox_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Return)
     {
         PropertyGrid         propertyGrid = this.mGrid;
         PropertyGrid.Section section      = this.mSection;
         PropertyGrid.Item    item         = this.mItem;
         this.Apply();
         propertyGrid.FirePropertyKeyEnter(section, item);
         e.SuppressKeyPress = true;
     }
     else if (e.KeyCode == Keys.Escape)
     {
         this.DestroyEditor();
         e.SuppressKeyPress = true;
     }
 }
 private void createEditor(PropertyGrid.Section s, PropertyGrid.Item item)
 {
     if ((this.mEditor == null ? true : this.mEditor.Editing != item))
     {
         this.closeEditor(true);
         if (item.Editable)
         {
             int verticalPosition = this.getVerticalPosition(s, item);
             this.mEditor = item.Property ?? this.DefaultType;
             CustomProperty      customProperty  = this.mEditor;
             int                 dividerPosition = this.DividerPosition;
             int                 y          = verticalPosition + 1 + base.AutoScrollPosition.Y;
             System.Drawing.Size clientSize = base.ClientSize;
             customProperty.CreateEditor(this, s, item, new Rectangle(dividerPosition, y, clientSize.Width - this.DividerPosition, this.LineHeight));
         }
     }
 }
 private PropertyGrid.Section getSection(string name, bool create)
 {
     PropertyGrid.Section section;
     foreach (PropertyGrid.Section section1 in this.Sections)
     {
         if (section1.Name != name)
         {
             continue;
         }
         section = section1;
         return(section);
     }
     if (create)
     {
         PropertyGrid.Section section2 = new PropertyGrid.Section()
         {
             Name        = name,
             TextColour  = SystemColors.WindowText,
             MarginColor = SystemColors.ButtonFace,
             BackColour1 = Color.White,
             BackColour2 = Color.FromArgb(252, 252, 252),
             Collapsed   = false,
             Items       = new List <PropertyGrid.Item>()
         };
         this.Sections.Add(section2);
         if (this.SortSections)
         {
             this.Sections = (
                 from o in this.Sections
                 orderby o.Name
                 select o).ToList <PropertyGrid.Section>();
         }
         section = section2;
     }
     else
     {
         section = null;
     }
     return(section);
 }
        private int getVerticalPosition(PropertyGrid.Section section, PropertyGrid.Item item)
        {
            int num;
            int lineHeight = 0;

            if (!section.Collapsed)
            {
                foreach (PropertyGrid.Section section1 in this.Sections)
                {
                    if ((section1 != section ? true : item != null))
                    {
                        lineHeight += this.LineHeight;
                        if (section1 == section)
                        {
                            num = lineHeight + section1.Items.IndexOf(item) * this.LineHeight;
                            return(num);
                        }
                        else if (!section1.Collapsed)
                        {
                            lineHeight = lineHeight + section1.Items.Count * this.LineHeight;
                        }
                    }
                    else
                    {
                        num = lineHeight;
                        return(num);
                    }
                }
                num = -1;
            }
            else
            {
                num = -1;
            }
            return(num);
        }
 private void PropertyGrid_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     PropertyGrid.Item item;
     if ((this.Sections.Count == 0 ? false : this.mFocusedSection != null))
     {
         int num  = this.Sections.IndexOf(this.mFocusedSection);
         int num1 = (this.mFocusedItem == null ? -1 : this.mFocusedSection.Items.IndexOf(this.mFocusedItem));
         PropertyGrid.Item item1 = this.mFocusedItem;
         if (e.KeyCode == Keys.Up)
         {
             if (num1 > 0)
             {
                 item1 = this.mFocusedSection.Items[num1 - 1];
             }
             else if (num1 == 0)
             {
                 item1 = null;
             }
             else if (num > 0)
             {
                 this.mFocusedSection = this.Sections[num - 1];
                 if (this.mFocusedSection.Items.Count == 0)
                 {
                     item = null;
                 }
                 else
                 {
                     item = this.mFocusedSection.Items[this.mFocusedSection.Items.Count - 1];
                 }
                 item1 = item;
             }
         }
         else if (e.KeyCode == Keys.Down)
         {
             if (num1 < this.mFocusedSection.Items.Count - 1)
             {
                 item1 = this.mFocusedSection.Items[num1 + 1];
             }
             else if (num < this.Sections.Count - 1)
             {
                 this.mFocusedSection = this.Sections[num + 1];
                 item1 = null;
             }
         }
         else if ((e.KeyCode != Keys.Left ? false : num1 < 0))
         {
             this.mFocusedSection.Collapsed = true;
             base.Invalidate();
         }
         else if ((e.KeyCode != Keys.Right ? false : num1 < 0))
         {
             this.mFocusedSection.Collapsed = false;
             base.Invalidate();
         }
         else if (this.mFocusedItem != null)
         {
             this.createEditor(this.mFocusedSection, this.mFocusedItem);
         }
         if (item1 != this.mFocusedItem)
         {
             this.mFocusedItem = item1;
             if (item1 != null)
             {
                 this.FirePropertySelected(this.mFocusedSection, this.mFocusedItem);
             }
             int   verticalPosition   = this.getVerticalPosition(this.mFocusedSection, this.mFocusedItem);
             Point autoScrollPosition = base.AutoScrollPosition;
             int   num2       = Math.Min(verticalPosition, -autoScrollPosition.Y);
             int   lineHeight = verticalPosition + this.LineHeight;
             System.Drawing.Size clientSize = base.ClientSize;
             num2 = Math.Max(num2, lineHeight - clientSize.Height);
             base.AutoScrollPosition = new Point(0, num2);
             base.Invalidate();
         }
     }
 }
Ejemplo n.º 20
0
 public PropertyChangedArgs(PropertyGrid.Section section, PropertyGrid.Item item, object oldValue)
 {
     this.Section  = section;
     this.Item     = item;
     this.OldValue = oldValue;
 }
Ejemplo n.º 21
0
 public PropertySelectedArgs(PropertyGrid.Section section, PropertyGrid.Item item)
 {
     this.Section = section;
     this.Item    = item;
 }
Ejemplo n.º 22
0
 public override void CreateEditor(PropertyGrid grid, PropertyGrid.Section section, PropertyGrid.Item item, Rectangle rect)
 {
     base.CreateEditor(grid, section, item, rect);
     this.mPopupX = rect.X;
 }
 public PropertyKeyEnterArgs(PropertyGrid.Section section, PropertyGrid.Item item)
 {
     this.Section = section;
     this.Item    = item;
 }
Ejemplo n.º 24
0
 public override void CreateEditor(PropertyGrid grid, PropertyGrid.Section section, PropertyGrid.Item item, Rectangle rect)
 {
     base.CreateEditor(grid, section, item, rect);
     this.mTextBox.KeyPress += new KeyPressEventHandler(this.mTextBox_KeyPress);
 }