1 // System.Windows.Forms.ToolBar.cs
3 // Permission is hereby granted, free of charge, to any person obtaining
4 // a copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to
8 // permit persons to whom the Software is furnished to do so, subject to
9 // the following conditions:
11 // The above copyright notice and this permission notice shall be
12 // included in all copies or substantial portions of the Software.
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 // Ravindra (rkumar@novell.com)
24 // Mike Kestner <mkestner@novell.com>
29 // Copyright (C) 2004-2006 Novell, Inc. (http://www.novell.com)
35 using System.Collections;
36 using System.ComponentModel;
37 using System.ComponentModel.Design;
39 using System.Drawing.Imaging;
40 using System.Runtime.InteropServices;
42 namespace System.Windows.Forms
44 [DefaultEvent ("ButtonClick")]
45 [DefaultProperty ("Buttons")]
46 [Designer ("System.Windows.Forms.Design.ToolBarDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
47 public class ToolBar : Control
49 #region Instance Variables
50 bool size_specified = false;
51 ToolBarButton current_button;
52 #endregion Instance Variables
56 [EditorBrowsable (EditorBrowsableState.Never)]
57 public new event EventHandler BackColorChanged {
58 add { base.BackColorChanged += value; }
59 remove { base.BackColorChanged -= value; }
63 [EditorBrowsable (EditorBrowsableState.Never)]
64 public new event EventHandler BackgroundImageChanged {
65 add { base.BackgroundImageChanged += value; }
66 remove { base.BackgroundImageChanged -= value; }
69 public event ToolBarButtonClickEventHandler ButtonClick;
70 public event ToolBarButtonClickEventHandler ButtonDropDown;
73 [EditorBrowsable (EditorBrowsableState.Never)]
74 public new event EventHandler ForeColorChanged {
75 add { base.ForeColorChanged += value; }
76 remove { base.ForeColorChanged -= value; }
80 [EditorBrowsable (EditorBrowsableState.Never)]
81 public new event EventHandler ImeModeChanged {
82 add { base.ImeModeChanged += value; }
83 remove { base.ImeModeChanged -= value; }
87 [EditorBrowsable (EditorBrowsableState.Never)]
88 public new event PaintEventHandler Paint {
89 add { base.Paint += value; }
90 remove { base.Paint -= value; }
94 [EditorBrowsable (EditorBrowsableState.Never)]
95 public new event EventHandler RightToLeftChanged {
96 add { base.RightToLeftChanged += value; }
97 remove { base.RightToLeftChanged -= value; }
101 [EditorBrowsable (EditorBrowsableState.Never)]
102 public new event EventHandler TextChanged {
103 add { base.TextChanged += value; }
104 remove { base.TextChanged -= value; }
111 background_color = ThemeEngine.Current.DefaultControlBackColor;
112 foreground_color = ThemeEngine.Current.DefaultControlForeColor;
113 buttons = new ToolBarButtonCollection (this);
114 dock_style = DockStyle.Top;
116 GotFocus += new EventHandler (FocusChanged);
117 LostFocus += new EventHandler (FocusChanged);
118 MouseDown += new MouseEventHandler (ToolBar_MouseDown);
119 MouseHover += new EventHandler (ToolBar_MouseHover);
120 MouseLeave += new EventHandler (ToolBar_MouseLeave);
121 MouseMove += new MouseEventHandler (ToolBar_MouseMove);
122 MouseUp += new MouseEventHandler (ToolBar_MouseUp);
124 SetStyle (ControlStyles.UserPaint, false);
125 SetStyle (ControlStyles.FixedHeight, true);
127 #endregion Constructor
129 #region protected Properties
130 protected override CreateParams CreateParams
132 get { return base.CreateParams; }
135 protected override ImeMode DefaultImeMode {
136 get { return ImeMode.Disable; }
139 protected override Size DefaultSize {
140 get { return ThemeEngine.Current.ToolBarDefaultSize; }
144 ToolBarAppearance appearance = ToolBarAppearance.Normal;
146 #region Public Properties
147 [DefaultValue (ToolBarAppearance.Normal)]
149 public ToolBarAppearance Appearance {
150 get { return appearance; }
152 if (value == appearance)
160 bool autosize = true;
162 [DefaultValue (true)]
164 public bool AutoSize {
165 get { return autosize; }
167 if (value == autosize)
176 [EditorBrowsable (EditorBrowsableState.Never)]
177 public override Color BackColor {
178 get { return background_color; }
180 if (value == background_color)
183 background_color = value;
184 OnBackColorChanged (EventArgs.Empty);
190 [EditorBrowsable (EditorBrowsableState.Never)]
191 public override Image BackgroundImage {
192 get { return background_image; }
194 if (value == background_image)
197 background_image = value;
198 OnBackgroundImageChanged (EventArgs.Empty);
203 [DefaultValue (BorderStyle.None)]
204 [DispIdAttribute (-504)]
205 public BorderStyle BorderStyle {
206 get { return InternalBorderStyle; }
207 set { InternalBorderStyle = value; }
210 ToolBarButtonCollection buttons;
212 [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
214 [MergableProperty (false)]
215 public ToolBarButtonCollection Buttons {
216 get { return buttons; }
222 [RefreshProperties (RefreshProperties.All)]
223 public Size ButtonSize {
225 if (button_size.IsEmpty) {
226 if (buttons.Count == 0)
227 return new Size (24, 22);
228 Size result = CalcButtonSize ();
230 return new Size (24, 22);
237 size_specified = value != Size.Empty;
238 if (button_size == value)
248 [DefaultValue (true)]
249 public bool Divider {
250 get { return divider; }
252 if (value == divider)
260 [DefaultValue (DockStyle.Top)]
262 public override DockStyle Dock {
263 get { return base.Dock; }
264 set { base.Dock = value; }
267 bool drop_down_arrows = true;
269 [DefaultValue (false)]
271 public bool DropDownArrows {
272 get { return drop_down_arrows; }
274 if (value == drop_down_arrows)
277 drop_down_arrows = value;
283 [EditorBrowsable (EditorBrowsableState.Never)]
284 public override Color ForeColor {
285 get { return foreground_color; }
287 if (value == foreground_color)
290 foreground_color = value;
291 OnForeColorChanged (EventArgs.Empty);
296 ImageList image_list;
298 [DefaultValue (null)]
299 public ImageList ImageList {
300 get { return image_list; }
302 if (image_list == value)
310 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
311 [EditorBrowsable (EditorBrowsableState.Advanced)]
312 public Size ImageSize {
314 if (ImageList == null)
317 return ImageList.ImageSize;
324 [EditorBrowsable (EditorBrowsableState.Never)]
325 public new ImeMode ImeMode {
326 get { return ime_mode; }
328 if (value == ime_mode)
332 OnImeModeChanged (EventArgs.Empty);
337 [EditorBrowsable (EditorBrowsableState.Never)]
338 public override RightToLeft RightToLeft {
339 get { return base.RightToLeft; }
341 if (value == base.RightToLeft)
344 base.RightToLeft = value;
345 OnRightToLeftChanged (EventArgs.Empty);
349 bool show_tooltips = false;
351 [DefaultValue (false)]
353 public bool ShowToolTips {
354 get { return show_tooltips; }
355 set { show_tooltips = value; }
358 [DefaultValue (false)]
359 public new bool TabStop {
360 get { return base.TabStop; }
361 set { base.TabStop = value; }
366 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
367 [EditorBrowsable (EditorBrowsableState.Never)]
368 public override string Text {
376 OnTextChanged (EventArgs.Empty);
380 ToolBarTextAlign text_alignment = ToolBarTextAlign.Underneath;
382 [DefaultValue (ToolBarTextAlign.Underneath)]
384 public ToolBarTextAlign TextAlign {
385 get { return text_alignment; }
387 if (value == text_alignment)
390 text_alignment = value;
395 bool wrappable = true;
397 [DefaultValue (true)]
399 public bool Wrappable {
400 get { return wrappable; }
402 if (value == wrappable)
409 #endregion Public Properties
411 #region Public Methods
412 public override string ToString ()
414 int count = this.Buttons.Count;
417 return string.Format ("System.Windows.Forms.ToolBar, Button.Count: 0");
419 return string.Format ("System.Windows.Forms.ToolBar, Button.Count: {0}, Buttons[0]: {1}",
420 count, this.Buttons [0].ToString ());
422 #endregion Public Methods
424 #region Protected Methods
425 protected override void CreateHandle ()
427 base.CreateHandle ();
430 protected override void Dispose (bool disposing)
435 base.Dispose (disposing);
438 protected virtual void OnButtonClick (ToolBarButtonClickEventArgs e)
440 if (e.Button.Style == ToolBarButtonStyle.ToggleButton) {
441 if (! e.Button.Pushed)
442 e.Button.Pushed = true;
444 e.Button.Pushed = false;
446 e.Button.pressed = false;
448 e.Button.InvalidateBorder ();
450 if (ButtonClick != null)
451 ButtonClick (this, e);
454 protected virtual void OnButtonDropDown (ToolBarButtonClickEventArgs e)
456 if (ButtonDropDown != null)
457 ButtonDropDown (this, e);
459 if (e.Button.DropDownMenu == null)
462 Point loc = new Point (e.Button.Rectangle.X + 1, e.Button.Rectangle.Bottom + 1);
463 ((ContextMenu) e.Button.DropDownMenu).Show (this, loc);
465 e.Button.dd_pressed = false;
466 Invalidate (e.Button.Rectangle);
469 protected override void OnFontChanged (EventArgs e)
471 base.OnFontChanged (e);
475 protected override void OnHandleCreated (EventArgs e)
477 base.OnHandleCreated (e);
480 protected override void OnResize (EventArgs e)
484 if (Width <= 0 || Height <= 0 || !Visible)
487 Redraw (true, background_image != null);
490 bool height_specified = false;
491 int requested_height = -1;
493 protected override void SetBoundsCore (int x, int y, int width, int height, BoundsSpecified specified)
495 if ((specified & BoundsSpecified.Height) != 0) {
496 requested_height = height;
497 height_specified = true;
499 base.SetBoundsCore (x, y, width, height, specified);
502 protected override void WndProc (ref Message m)
504 base.WndProc (ref m);
507 internal override bool InternalPreProcessMessage (ref Message msg)
509 if (msg.Msg == (int)Msg.WM_KEYDOWN) {
510 Keys key_data = (Keys)msg.WParam.ToInt32();
511 if (HandleKeyDown (key_data))
514 return base.InternalPreProcessMessage (ref msg);
517 #endregion Protected Methods
519 #region Private Methods
520 private void FocusChanged (object sender, EventArgs args)
522 if (Appearance != ToolBarAppearance.Flat || Buttons.Count == 0)
525 ToolBarButton prelit = null;
526 foreach (ToolBarButton b in Buttons)
532 if (Focused && prelit == null)
533 foreach (ToolBarButton btn in Buttons) {
539 else if (prelit != null)
540 prelit.Hilight = false;
543 private bool HandleKeyDown (Keys key_data)
545 if (Appearance != ToolBarAppearance.Flat || Buttons.Count == 0)
551 HighlightButton (-1);
562 void HighlightButton (int offset)
564 ArrayList enabled = new ArrayList ();
567 ToolBarButton curr_button = null;
568 foreach (ToolBarButton btn in Buttons) {
580 int next = (start + offset) % count;
587 if (curr_button != null)
588 curr_button.Hilight = false;
589 (enabled [next] as ToolBarButton).Hilight = true;
592 private void ToolBar_MouseDown (object sender, MouseEventArgs me)
594 if ((!Enabled) || ((me.Button & MouseButtons.Left) == 0))
597 Point loc = new Point (me.X, me.Y);
599 if (ButtonAtPoint (loc) == null)
602 // Hide tooltip when left mouse button
603 if ((tip_window != null) && (tip_window.Visible) && ((me.Button & MouseButtons.Left) == MouseButtons.Left)) {
604 TipDownTimer.Stop ();
608 // draw the pushed button
609 foreach (ToolBarButton button in buttons) {
610 if (button.Enabled && button.Rectangle.Contains (loc)) {
611 // Mark the DropDown rect as pressed.
612 // We don't redraw the dropdown rect.
613 if (button.Style == ToolBarButtonStyle.DropDownButton) {
614 Rectangle rect = button.Rectangle;
615 if (DropDownArrows) {
616 rect.Width = ThemeEngine.Current.ToolBarDropDownWidth;
617 rect.X = button.Rectangle.Right - rect.Width;
620 if (rect.Contains (loc)) {
621 if (button.DropDownMenu != null) {
622 button.dd_pressed = true;
628 button.pressed = true;
629 button.inside = true;
630 button.InvalidateBorder ();
636 private void ToolBar_MouseUp (object sender, MouseEventArgs me)
638 if ((!Enabled) || ((me.Button & MouseButtons.Left) == 0))
641 Point loc = new Point (me.X, me.Y);
643 // draw the normal button
644 // Make a copy in case the list is modified during enumeration
645 ArrayList buttons = new ArrayList (this.buttons);
646 foreach (ToolBarButton button in buttons) {
647 if (button.Enabled && button.Rectangle.Contains (loc)) {
648 if (button.Style == ToolBarButtonStyle.DropDownButton) {
649 Rectangle ddRect = button.Rectangle;
650 ddRect.Width = ThemeEngine.Current.ToolBarDropDownWidth;
651 ddRect.X = button.Rectangle.Right - ddRect.Width;
652 if (ddRect.Contains (loc)) {
653 if (button.dd_pressed)
654 OnButtonDropDown (new ToolBarButtonClickEventArgs (button));
658 // Fire a ButtonClick
659 if ((button.pressed) && ((me.Button & MouseButtons.Left) == MouseButtons.Left))
660 OnButtonClick (new ToolBarButtonClickEventArgs (button));
661 } else if (button.pressed) {
662 button.pressed = false;
663 button.InvalidateBorder ();
668 private ToolBarButton ButtonAtPoint (Point pt)
670 foreach (ToolBarButton button in buttons)
671 if (button.Rectangle.Contains (pt))
677 ToolTip.ToolTipWindow tip_window = null;
678 Timer tipdown_timer = null;
680 private void PopDownTip (object o, EventArgs args)
685 private Timer TipDownTimer {
687 if (tipdown_timer == null) {
688 tipdown_timer = new Timer ();
689 tipdown_timer.Enabled = false;
690 tipdown_timer.Interval = 5000;
691 tipdown_timer.Tick += new EventHandler (PopDownTip);
693 return tipdown_timer;
697 private void ToolBar_MouseHover (object sender, EventArgs e)
702 if (tip_window == null)
703 tip_window = new ToolTip.ToolTipWindow ();
705 ToolBarButton btn = ButtonAtPoint (PointToClient (Control.MousePosition));
706 current_button = btn;
708 if (btn == null || btn.ToolTipText.Length == 0)
711 tip_window.Present (this, btn.ToolTipText);
712 TipDownTimer.Start ();
715 private void ToolBar_MouseLeave (object sender, EventArgs e)
717 if (tipdown_timer != null)
718 tipdown_timer.Dispose ();
719 tipdown_timer = null;
720 if (tip_window != null)
721 tip_window.Dispose ();
724 if (!Enabled || current_button == null)
727 current_button.Hilight = false;
728 current_button = null;
731 private void ToolBar_MouseMove (object sender, MouseEventArgs me)
736 if (tip_window != null && tip_window.Visible) {
737 TipDownTimer.Stop ();
738 TipDownTimer.Start ();
741 Point loc = new Point (me.X, me.Y);
744 // If the button was pressed and we leave, release the
745 // button press and vice versa
746 foreach (ToolBarButton button in buttons) {
747 if (button.pressed &&
748 (button.inside != button.Rectangle.Contains (loc))) {
749 button.inside = button.Rectangle.Contains (loc);
750 button.Hilight = false;
757 if (current_button != null && current_button.Rectangle.Contains (loc)) {
758 if (appearance == ToolBarAppearance.Flat) {
759 if (current_button.Hilight || current_button.Pushed || !current_button.Enabled)
761 current_button.Hilight = true;
764 if (tip_window != null) {
765 if (tip_window.Visible) {
767 TipDownTimer.Stop ();
769 current_button = ButtonAtPoint (loc);
770 if (current_button != null && current_button.ToolTipText.Length > 0) {
771 tip_window.Present (this, current_button.ToolTipText);
772 TipDownTimer.Start ();
776 if (appearance == ToolBarAppearance.Flat) {
777 foreach (ToolBarButton button in buttons) {
778 if (button.Rectangle.Contains (loc) && button.Enabled) {
779 current_button = button;
780 if (current_button.Hilight || current_button.Pushed)
782 current_button.Hilight = true;
784 else if (button.Hilight) {
785 button.Hilight = false;
792 internal override void OnPaintInternal (PaintEventArgs pevent)
794 ThemeEngine.Current.DrawToolBar (pevent.Graphics, pevent.ClipRectangle, this);
797 internal void Redraw (bool recalculate)
799 Redraw (recalculate, true);
802 internal void Redraw (bool recalculate, bool force)
804 bool invalidate = true;
806 invalidate = Layout ();
809 if (force || invalidate)
813 internal bool SizeSpecified {
814 get { return size_specified; }
817 const int text_padding = 3;
819 private Size CalcButtonSize ()
821 if (Buttons.Count == 0)
824 string longest_text = Buttons [0].Text;
825 for (int i = 1; i < Buttons.Count; i++) {
826 if (Buttons[i].Text.Length > longest_text.Length)
827 longest_text = Buttons[i].Text;
830 Size size = Size.Empty;
831 if (longest_text != null && longest_text.Length > 0) {
832 SizeF sz = DeviceContext.MeasureString (longest_text, Font);
833 if (sz != SizeF.Empty)
834 size = new Size ((int) Math.Ceiling (sz.Width) + 2 * text_padding, (int) Math.Ceiling (sz.Height));
837 Size img_size = ImageList == null ? new Size (16, 16) : ImageSize;
839 Theme theme = ThemeEngine.Current;
840 int imgWidth = img_size.Width + 2 * theme.ToolBarImageGripWidth;
841 int imgHeight = img_size.Height + 2 * theme.ToolBarImageGripWidth;
843 if (text_alignment == ToolBarTextAlign.Right) {
844 size.Width = imgWidth + size.Width;
845 size.Height = (size.Height > imgHeight) ? size.Height : imgHeight;
847 size.Height = imgHeight + size.Height;
848 size.Width = (size.Width > imgWidth) ? size.Width : imgWidth;
851 size.Width += theme.ToolBarImageGripWidth;
852 size.Height += theme.ToolBarImageGripWidth;
856 // Flat toolbars disregard specified sizes. Normal toolbars grow the
857 // button size to be at least large enough to show the image.
858 Size AdjustedButtonSize {
860 Size size = ButtonSize;
861 if (size_specified) {
862 if (Appearance == ToolBarAppearance.Flat)
863 size = CalcButtonSize ();
865 int grip = ThemeEngine.Current.ToolBarImageGripWidth;
866 if (size.Width < ImageSize.Width + 2 * grip )
867 size.Width = ImageSize.Width + 2 * grip;
868 if (size.Height < ImageSize.Height + 2 * grip)
869 size.Height = ImageSize.Height + 2 * grip;
878 bool changed = false;
879 Theme theme = ThemeEngine.Current;
880 int x = theme.ToolBarGripWidth;
881 int y = theme.ToolBarGripWidth;
883 Size button_size = AdjustedButtonSize;
885 int ht = button_size.Height + theme.ToolBarGripWidth;
887 if (Wrappable && Parent != null) {
888 int separator_index = -1;
890 for (int i = 0; i < buttons.Count; i++) {
891 ToolBarButton button = buttons [i];
896 if (size_specified && (button.Style != ToolBarButtonStyle.Separator)) {
897 if (button.Layout (button_size))
901 if (button.Layout ())
905 bool is_separator = button.Style == ToolBarButtonStyle.Separator;
907 if (x + button.Rectangle.Width < Width || is_separator) {
908 if (button.Location.X != x || button.Location.Y != y)
910 button.Location = new Point (x, y);
911 x += button.Rectangle.Width;
914 } else if (separator_index > 0) {
916 separator_index = -1;
917 x = theme.ToolBarGripWidth;
920 x = theme.ToolBarGripWidth;
922 if (button.Location.X != x || button.Location.Y != y)
924 button.Location = new Point (x, y);
925 x += button.Rectangle.Width;
933 else if (!height_specified)
934 Height = DefaultSize.Height;
935 foreach (ToolBarButton button in buttons) {
936 if (size_specified) {
937 if (button.Layout (button_size))
941 if (button.Layout ())
944 if (button.Location.X != x || button.Location.Y != y)
946 button.Location = new Point (x, y);
947 x += button.Rectangle.Width;
953 #endregion Private Methods
956 public class ToolBarButtonCollection : IList, ICollection, IEnumerable
958 #region instance variables
959 private ArrayList list;
960 private ToolBar owner;
965 public ToolBarButtonCollection (ToolBar owner)
968 list = new ArrayList ();
976 get { return list.Count; }
979 public bool IsReadOnly {
980 get { return list.IsReadOnly; }
983 public virtual ToolBarButton this [int index] {
984 get { return (ToolBarButton) list [index]; }
986 value.SetParent (owner);
987 list [index] = value;
992 bool ICollection.IsSynchronized {
993 get { return list.IsSynchronized; }
996 object ICollection.SyncRoot {
997 get { return list.SyncRoot; }
1000 bool IList.IsFixedSize {
1001 get { return list.IsFixedSize; }
1004 object IList.this [int index] {
1005 get { return this [index]; }
1007 if (! (value is ToolBarButton))
1008 throw new ArgumentException("Not of type ToolBarButton", "value");
1009 this [index] = (ToolBarButton) value;
1015 public int Add (string text)
1017 ToolBarButton button = new ToolBarButton (text);
1018 return this.Add (button);
1021 public int Add (ToolBarButton button)
1024 button.SetParent (owner);
1025 result = list.Add (button);
1027 owner.Redraw (true);
1031 public void AddRange (ToolBarButton [] buttons)
1035 foreach (ToolBarButton button in buttons)
1040 owner.Redraw (true);
1044 public void Clear ()
1047 owner.Redraw (false);
1050 public bool Contains (ToolBarButton button)
1052 return list.Contains (button);
1055 public IEnumerator GetEnumerator ()
1057 return list.GetEnumerator ();
1060 void ICollection.CopyTo (Array dest, int index)
1062 list.CopyTo (dest, index);
1065 int IList.Add (object button)
1067 if (! (button is ToolBarButton)) {
1068 throw new ArgumentException("Not of type ToolBarButton", "button");
1071 return this.Add ((ToolBarButton) button);
1074 bool IList.Contains (object button)
1076 if (! (button is ToolBarButton)) {
1077 throw new ArgumentException("Not of type ToolBarButton", "button");
1080 return this.Contains ((ToolBarButton) button);
1083 int IList.IndexOf (object button)
1085 if (! (button is ToolBarButton)) {
1086 throw new ArgumentException("Not of type ToolBarButton", "button");
1089 return this.IndexOf ((ToolBarButton) button);
1092 void IList.Insert (int index, object button)
1094 if (! (button is ToolBarButton)) {
1095 throw new ArgumentException("Not of type ToolBarButton", "button");
1098 this.Insert (index, (ToolBarButton) button);
1101 void IList.Remove (object button)
1103 if (! (button is ToolBarButton)) {
1104 throw new ArgumentException("Not of type ToolBarButton", "button");
1107 this.Remove ((ToolBarButton) button);
1110 public int IndexOf (ToolBarButton button)
1112 return list.IndexOf (button);
1115 public void Insert (int index, ToolBarButton button)
1117 list.Insert (index, button);
1118 owner.Redraw (true);
1121 public void Remove (ToolBarButton button)
1123 list.Remove (button);
1124 owner.Redraw (true);
1127 public void RemoveAt (int index)
1129 list.RemoveAt (index);
1130 owner.Redraw (true);