A
download ToolBarButton.cs
Language: C#
Copyright: (C) 2004-2006 Novell, Inc. (http://www.novell.com)
LOC: 334
Project Info
mcs
Server: Mono
Type: svn
...Forms\System.Windows.Forms\
   AccessibleEvents.cs
   AccessibleNavigation.cs
   AccessibleObject.cs
   AccessibleRole.cs
   AccessibleSelection.cs
   AccessibleStates.cs
   AmbientProperties.cs
   AnchorStyles.cs
   Appearance.cs
   Application.cs
   ApplicationContext.cs
   ArrangeDirection.cs
   ArrangeStartingPosition.cs
   ArrowDirection.cs
   AsyncMethodData.cs
   AsyncMethodResult.cs
   AutoCompleteMode.cs
   AutoCompleteSource.cs
   AutoScaleMode.cs
   AutoSizeMode.cs
   AutoValidate.cs
   AxHost.cs
   BaseCollection.cs
   BatteryChargeStatus.cs
   Binding.cs
   BindingCompleteContext.cs
   ...ingCompleteEventArgs.cs
   ...CompleteEventHandler.cs
   BindingCompleteState.cs
   BindingContext.cs
   BindingManagerBase.cs
   ...erDataErrorEventArgs.cs
   ...ataErrorEventHandler.cs
   BindingMemberInfo.cs
   BindingsCollection.cs
   BootMode.cs
   Border3DSide.cs
   Border3DStyle.cs
   BorderStyle.cs
   BoundsSpecified.cs
   Button.cs
   ButtonBase.cs
   ButtonBorderStyle.cs
   ButtonRenderer.cs
   ButtonState.cs
   ...irtualItemsEventArgs.cs
   ...ualItemsEventHandler.cs
   CaptionButton.cs
   CategoryGridEntry.cs
   CharacterCasing.cs
   CheckBox.cs
   CheckBoxRenderer.cs
   CheckedListBox.cs
   CheckState.cs
   Clipboard.cs
   CloseReason.cs
   ColorDepth.cs
   ColorDialog.cs
   ColumnClickEventArgs.cs
   ColumnClickEventHandler.cs
   ColumnHeader.cs
   ...eaderAutoResizeStyle.cs
   ColumnHeaderStyle.cs
   ...mnReorderedEventArgs.cs
   ...eorderedEventHandler.cs
   ColumnStyle.cs
   ...idthChangedEventArgs.cs
   ...hChangedEventHandler.cs
   ...dthChangingEventArgs.cs
   ...ChangingEventHandler.cs
   ComboBox.cs
   ComboBoxRenderer.cs
   ComboBoxStyle.cs
   CommonDialog.cs
   ComponentModel.cs
   ContainerControl.cs
   ...entsResizedEventArgs.cs
   ...sResizedEventHandler.cs
   ContextMenu.cs
   Control.cs
   ...olBindingsCollection.cs
   ControlEventArgs.cs
   ControlEventHandler.cs
   ControlPaint.cs
   ControlStyles.cs
   ControlUpdateMode.cs
   ConvertEventArgs.cs
   ConvertEventHandler.cs
   CreateParams.cs
   CurrencyManager.cs
   Cursor.cs
   CursorConverter.cs
   Cursors.cs
   DataFormats.cs
   DataGrid.cs
   DataGridBoolColumn.cs
   DataGridCell.cs
   DataGridColumnStyle.cs
   DataGridLineStyle.cs
   ...ParentRowsLabelStyle.cs
   ...mnWidthTypeConverter.cs
   DataGridTableStyle.cs
   DataGridTextBox.cs
   DataGridTextBoxColumn.cs
   DataGridView.cs
   ...wAdvancedBorderStyle.cs
   ...ancedCellBorderStyle.cs
   ...ewAutoSizeColumnMode.cs
   ...eColumnModeEventArgs.cs
   ...lumnModeEventHandler.cs
   ...wAutoSizeColumnsMode.cs
   ...ColumnsModeEventArgs.cs
   ...umnsModeEventHandler.cs
   ...utoSizeModeEventArgs.cs
   ...SizeModeEventHandler.cs
   ...dViewAutoSizeRowMode.cs
   ...ViewAutoSizeRowsMode.cs
   DataGridViewBand.cs
   ...ingCompleteEventArgs.cs
   ...CompleteEventHandler.cs
   DataGridViewButtonCell.cs
   ...GridViewButtonColumn.cs
   DataGridViewCell.cs
   ...dViewCellBorderStyle.cs
   ...wCellCancelEventArgs.cs
   ...llCancelEventHandler.cs
   ...idViewCellCollection.cs
   ...StripNeededEventArgs.cs
   ...ipNeededEventHandler.cs
   ...rTextNeededEventArgs.cs
   ...xtNeededEventHandler.cs
   ...ridViewCellEventArgs.cs
   ...ViewCellEventHandler.cs
   ...lFormattingEventArgs.cs
   ...rmattingEventHandler.cs
   ...ewCellMouseEventArgs.cs
   ...ellMouseEventHandler.cs
   ...ellPaintingEventArgs.cs
   ...PaintingEventHandler.cs
   ...CellParsingEventArgs.cs
   ...lParsingEventHandler.cs
   ...tateChangedEventArgs.cs
   ...eChangedEventHandler.cs
   DataGridViewCellStyle.cs
   ...tentChangedEventArgs.cs
   ...tChangedEventHandler.cs
   ...ewCellStyleConverter.cs
   ...dViewCellStyleScopes.cs
   ...pTextNeededEventArgs.cs
   ...xtNeededEventHandler.cs
   ...lValidatingEventArgs.cs
   ...lidatingEventHandler.cs
   ...ewCellValueEventArgs.cs
   ...ellValueEventHandler.cs
   ...GridViewCheckBoxCell.cs
   ...idViewCheckBoxColumn.cs
   ...iewClipboardCopyMode.cs
   DataGridViewColumn.cs
   ...ViewColumnCollection.cs
   ...TimeVisibleAttribute.cs
   ...DoubleClickEventArgs.cs
   ...bleClickEventHandler.cs
   ...dViewColumnEventArgs.cs
   ...ewColumnEventHandler.cs
   ...ViewColumnHeaderCell.cs
   ...eadersHeightSizeMode.cs
   ...idViewColumnSortMode.cs
   ...tateChangedEventArgs.cs
   ...eChangedEventHandler.cs
   ...GridViewComboBoxCell.cs
   ...idViewComboBoxColumn.cs
   ...ComboBoxDisplayStyle.cs
   ...mboBoxEditingControl.cs
   ...ViewContentAlignment.cs
   ...iewDataErrorContexts.cs
   ...ewDataErrorEventArgs.cs
   ...ataErrorEventHandler.cs
   ...trolShowingEventArgs.cs
   ...lShowingEventHandler.cs
   DataGridViewEditMode.cs
   DataGridViewElement.cs
   ...ridViewElementStates.cs
   ...iewHeaderBorderStyle.cs
   DataGridViewHeaderCell.cs
   DataGridViewHitTestType.cs
   DataGridViewImageCell.cs
   ...dViewImageCellLayout.cs
   DataGridViewImageColumn.cs
   DataGridViewPaintParts.cs
   DataGridViewRow.cs
   ...ewRowCancelEventArgs.cs
   ...owCancelEventHandler.cs
   ...ridViewRowCollection.cs
   ...StripNeededEventArgs.cs
   ...ipNeededEventHandler.cs
   ...DoubleClickEventArgs.cs
   ...bleClickEventHandler.cs
   ...rTextNeededEventArgs.cs
   ...xtNeededEventHandler.cs
   ...GridViewRowEventArgs.cs
   ...dViewRowEventHandler.cs
   ...ridViewRowHeaderCell.cs
   ...HeadersWidthSizeMode.cs
   ...tInfoNeededEventArgs.cs
   ...foNeededEventHandler.cs
   ...tInfoPushedEventArgs.cs
   ...foPushedEventHandler.cs
   ...owPostPaintEventArgs.cs
   ...ostPaintEventHandler.cs
   ...RowPrePaintEventArgs.cs
   ...PrePaintEventHandler.cs
   ...ewRowsAddedEventArgs.cs
   ...owsAddedEventHandler.cs
   ...RowsDeletedEventArgs.cs
   ...RowsRemovedEventArgs.cs
   ...sRemovedEventHandler.cs
   ...tateChangedEventArgs.cs
   ...eChangedEventHandler.cs
   ...lectedCellCollection.cs
   ...ctedColumnCollection.cs
   ...electedRowCollection.cs
   ...ridViewSelectionMode.cs
   ...SortCompareEventArgs.cs
   ...tCompareEventHandler.cs
   DataGridViewTextBoxCell.cs
   ...ridViewTextBoxColumn.cs
   ...extBoxEditingControl.cs
   ...iewTopLeftHeaderCell.cs
   DataGridViewTriState.cs
   DataObject.cs
   DataSourceUpdateMode.cs
   DateBoldEventArgs.cs
   DateBoldEventHandler.cs
   DateRangeEventArgs.cs
   DateRangeEventHandler.cs
   DateTimePicker.cs
   DateTimePickerFormat.cs
   Day.cs
   DialogResult.cs
   DockingBehavior.cs
   DockStyle.cs
   DomainUpDown.cs
   DragAction.cs
   DragDropEffects.cs
   DragEventArgs.cs
   DragEventHandler.cs
   DrawItemEventArgs.cs
   DrawItemEventHandler.cs
   DrawItemState.cs
   DrawMode.cs
   ErrorBlinkStyle.cs
   ErrorIconAlignment.cs
   ErrorProvider.cs
   FeatureSupport.cs
   FileDialog.cs
   FixedPanel.cs
   FixedSizeTextBox.cs
   FlatStyle.cs
   FlowDirection.cs
   FolderBrowserDialog.cs
   FontDialog.cs
   Form.cs
   FormBorderStyle.cs
   FormClosedEventArgs.cs
   FormClosedEventHandler.cs
   FormClosingEventArgs.cs
   FormClosingEventHandler.cs
   FormStartPosition.cs
   FormWindowState.cs
   FrameStyle.cs
   GetChildAtPointSkip.cs
   GiveFeedbackEventArgs.cs
   ...FeedbackEventHandler.cs
   ...lumnStylesCollection.cs
   GridEntry.cs
   GridItem.cs
   GridItemCollection.cs
   GridItemType.cs
   GridTablesFactory.cs
   ...ableStylesCollection.cs
   GroupBox.cs
   GroupBoxRenderer.cs
   HandledMouseEventArgs.cs
   Help.cs
   HelpEventArgs.cs
   HelpEventHandler.cs
   HelpNavigator.cs
   HelpProvider.cs
   HorizontalAlignment.cs
   HScrollBar.cs
   ...InsertionOrientation.cs
   Hwnd.cs
   IButtonControl.cs
   ICommandExecutor.cs
   ...ponentEditorPageSite.cs
   IContainerControl.cs
   ...gNotificationService.cs
   IDataGridEditingService.cs
   ...aGridViewEditingCell.cs
   ...idViewEditingControl.cs
   IDataObject.cs
   IDropTarget.cs
   IFeatureSupport.cs
   IFileReaderService.cs
   ImageIndexConverter.cs
   ImageLayout.cs
   ImageList.cs
   ImageListConverter.cs
   ImageListStreamer.cs
   ImeMode.cs
   IMessageFilter.cs
   ImplicitHScrollBar.cs
   ImplicitVScrollBar.cs
   InputLanguage.cs
   ...uageChangedEventArgs.cs
   ...eChangedEventHandler.cs
   ...ageChangingEventArgs.cs
   ...ChangingEventHandler.cs
   InputLanguageCollection.cs
   InsertKeyMode.cs
   InternalWindowManager.cs
   InvalidateEventArgs.cs
   InvalidateEventHandler.cs
   IRootGridEntry.cs
   ItemActivation.cs
   ItemBoundsPortion.cs
   ItemChangedEventArgs.cs
   ItemChangedEventHandler.cs
   ItemCheckedEventArgs.cs
   ItemCheckedEventHandler.cs
   ItemCheckEventArgs.cs
   ItemCheckEventHandler.cs
   ItemDragEventArgs.cs
   ItemDragEventHandler.cs
   IWin32Window.cs
   IWindowTarget.cs
   KeyboardLayouts.cs
   KeyEventArgs.cs
   KeyEventHandler.cs
   KeyPressEventArgs.cs
   KeyPressEventHandler.cs
   Keys.cs
   KeysConverter.cs
   Label.cs
   LabelEditEventArgs.cs
   LabelEditEventHandler.cs
   LabelEditTextBox.cs
   LayoutEngine.cs
   LayoutEventArgs.cs
   LayoutEventHandler.cs
   LayoutSettings.cs
   LeftRightAlignment.cs
   LibSupport.cs
   LinkArea.cs
   LinkBehavior.cs
   LinkClickedEventArgs.cs
   LinkClickedEventHandler.cs
   LinkLabel.cs
   ...LinkClickedEventArgs.cs
   ...kClickedEventHandler.cs
   LinkState.cs
   ListBindingConverter.cs
   ListBox.cs
   ListControl.cs
   ...trolConvertEventArgs.cs
   ...lConvertEventHandler.cs
   ListView.cs
   ListViewAlignment.cs
   ...ViewHitTestLocations.cs
   ListViewItem.cs
   ListViewItemConverter.cs
   ...mMouseHoverEventArgs.cs
   ...useHoverEventHandler.cs
   ...tionChangedEventArgs.cs
   ...nChangedEventHandler.cs
   ListViewItemStates.cs
   ...angeChangedEventArgs.cs
   ...eChangedEventHandler.cs
   MainMenu.cs
   MaskFormat.cs
   ...putRejectedEventArgs.cs
   ...RejectedEventHandler.cs
   MdiChildContext.cs
   MdiClient.cs
   MdiLayout.cs
   MdiWindowManager.cs
   MeasureItemEventArgs.cs
   MeasureItemEventHandler.cs
   Menu.cs
   MenuAPI.cs
   MenuGlyph.cs
   MenuItem.cs
   MenuMerge.cs
   MenuStrip.cs
   MergeAction.cs
   Message.cs
   MessageBox.cs
   MessageBoxButtons.cs
   MessageBoxDefaultButton.cs
   MessageBoxIcon.cs
   MessageBoxOptions.cs
   MethodInvoker.cs
   Mime.cs
   MimeIcon.cs
   MonthCalendar.cs
   MouseButtons.cs
   MouseEventArgs.cs
   MouseEventHandler.cs
   MWFCategoryAttribute.cs
   MWFDescriptionAttribute.cs
   NativeWindow.cs
   NavigateEventArgs.cs
   NavigateEventHandler.cs
   NodeLabelEditEventArgs.cs
   ...abelEditEventHandler.cs
   NotifyIcon.cs
   NumericUpDown.cs
   OpacityConverter.cs
   OpenFileDialog.cs
   OpenTreeNodeEnumerator.cs
   Orientation.cs
   OSFeature.cs
   OSXStructs.cs
   OwnerDrawPropertyBag.cs
   Padding.cs
   PageSetupDialog.cs
   PaintEventArgs.cs
   PaintEventHandler.cs
   Panel.cs
   PictureBox.cs
   PictureBoxSizeMode.cs
   PopupEventArgs.cs
   PopupEventHandler.cs
   PowerLineStatus.cs
   PowerState.cs
   PreProcessControlState.cs
   PreviewKeyDownEventArgs.cs
   ...wKeyDownEventHandler.cs
   ...llerWithStatusDialog.cs
   PrintDialog.cs
   PrintPreviewControl.cs
   PrintPreviewDialog.cs
   ProfessionalColors.cs
   ProfessionalColorTable.cs
   ProgressBar.cs
   ProgressBarRenderer.cs
   ProgressBarStyle.cs
   PropertiesTab.cs
   PropertyGrid.cs
   PropertyGridCommands.cs
   PropertyGridEntry.cs
   PropertyGridTextBox.cs
   PropertyGridView.cs
   PropertyManager.cs
   PropertySort.cs
   ...yTabChangedEventArgs.cs
   ...bChangedEventHandler.cs
   ...alueChangedEventArgs.cs
   ...eChangedEventHandler.cs
   ...ibilityHelpEventArgs.cs
   ...lityHelpEventHandler.cs
   ...ontinueDragEventArgs.cs
   ...inueDragEventHandler.cs
   QuestionEventArgs.cs
   QuestionEventHandler.cs
   RadioButton.cs
   RadioButtonRenderer.cs
   RelatedCurrencyManager.cs
   RelatedPropertyManager.cs
   ...VirtualItemEventArgs.cs
   ...tualItemEventHandler.cs
   RichTextBox.cs
   RichTextBoxFinds.cs
   ...xtBoxLanguageOptions.cs
   RichTextBoxScrollBars.cs
   ...oxSelectionAttribute.cs
   ...extBoxSelectionTypes.cs
   RichTextBoxStreamType.cs
   ...tBoxWordPunctuations.cs
   RightToLeft.cs
   RowStyle.cs
   SaveFileDialog.cs
   Screen.cs
   ScreenOrientation.cs
   ScrollableControl.cs
   ScrollBar.cs
   ScrollBarRenderer.cs
   ScrollBars.cs
   ScrollButton.cs
   ScrollEventArgs.cs
   ScrollEventHandler.cs
   ScrollEventType.cs
   ScrollOrientation.cs
   SearchDirectionHint.cs
   ...VirtualItemEventArgs.cs
   ...tualItemEventHandler.cs
   SecurityIDType.cs
   ...ItemChangedEventArgs.cs
   ...mChangedEventHandler.cs
   SelectionMode.cs
   SelectionRange.cs
   SelectionRangeConverter.cs
   SendKeys.cs
   Shortcut.cs
   SizeGrip.cs
   SizeGripStyle.cs
   SizeType.cs
   SortOrder.cs
   Splitter.cs
   SplitterCancelEventArgs.cs
   ...erCancelEventHandler.cs
   SplitterEventArgs.cs
   SplitterEventHandler.cs
   StatusBar.cs
   ...BarDrawItemEventArgs.cs
   ...DrawItemEventHandler.cs
   StatusBarPanel.cs
   StatusBarPanelAutoSize.cs
   ...sBarPanelBorderStyle.cs
   ...rPanelClickEventArgs.cs
   ...nelClickEventHandler.cs
   StatusBarPanelStyle.cs
   StructFormat.cs
   SWF.csproj.user
   SystemInformation.cs
   SystemParameter.cs
   TabAlignment.cs
   TabAppearance.cs
   TabControl.cs
   TabControlAction.cs
   ...ntrolCancelEventArgs.cs
   ...olCancelEventHandler.cs
   TabControlEventArgs.cs
   TabControlEventHandler.cs
   TabDrawMode.cs
   TableLayout.cs
   ...utCellPaintEventArgs.cs
   ...ellPaintEventHandler.cs
   TableLayoutPanel.cs
   ...PanelCellBorderStyle.cs
   ...LayoutPanelGrowStyle.cs
   TableLayoutSettings.cs
   TabPage.cs
   TabRenderer.cs
   TabSizeMode.cs
   TextBox.cs
   TextBoxBase.cs
   TextBoxRenderer.cs
   TextControl.cs
   TextDataFormat.cs
   TextFormatFlags.cs
   TextImageRelation.cs
   TextRenderer.cs
   Theme.cs
   ThemeClearlooks.cs
   ThemeEngine.cs
   ThemeGtk.cs
   ThemeNice.cs
   ThemeWin32Classic.cs
   ThreadExceptionDialog.cs
   TickStyle.cs
   Timer.cs
   ToolBar.cs
   ToolBarAppearance.cs
   ToolBarButton.cs
   ...ButtonClickEventArgs.cs
   ...tonClickEventHandler.cs
   ToolBarButtonStyle.cs
   ToolBarTextAlign.cs
   ToolStrip.cs
   ...pDownClosedEventArgs.cs
   ...wnClosedEventHandler.cs
   ...pDropDownCloseReason.cs
   ...DownClosingEventArgs.cs
   ...nClosingEventHandler.cs
   ...ripDropDownDirection.cs
   ToolStripDropDownItem.cs
   ...tripGripDisplayStyle.cs
   ToolStripGripStyle.cs
   ToolStripItem.cs
   ToolStripItemAlignment.cs
   ...tripItemDisplayStyle.cs
   ...tripItemImageScaling.cs
   ToolStripItemOverflow.cs
   ToolStripItemPlacement.cs
   ToolStripLayoutStyle.cs
   ...ripManagerRenderMode.cs
   ToolStripMenuItem.cs
   ToolStripRenderMode.cs
   ...atusLabelBorderSides.cs
   ToolStripTextDirection.cs
   ToolTip.cs
   ToolTipIcon.cs
   TrackBar.cs
   TrackBarRenderer.cs
   TreeNode.cs
   TreeNodeCollection.cs
   TreeNodeConverter.cs
   ...eMouseClickEventArgs.cs
   ...useClickEventHandler.cs
   ...eMouseHoverEventArgs.cs
   ...useHoverEventHandler.cs
   TreeNodeStates.cs
   TreeView.cs
   TreeViewAction.cs
   TreeViewCancelEventArgs.cs
   ...ewCancelEventHandler.cs
   TreeViewDrawMode.cs
   TreeViewEventArgs.cs
   TreeViewEventHandler.cs
   ...ViewHitTestLocations.cs
   ...wImageIndexConverter.cs
   TypeValidationEventArgs.cs
   ...lidationEventHandler.cs
   UICues.cs
   UICuesEventArgs.cs
   UICuesEventHandler.cs
   UnhandledExceptionMode.cs
   UpDownBase.cs
   UpDownEventArgs.cs
   UpDownEventHandler.cs
   UserControl.cs
   ValidationConstraints.cs
   View.cs
   VScrollBar.cs
   ...ntCompletedEventArgs.cs
   ...ompletedEventHandler.cs
   ...owserEncryptionLevel.cs
   ...erNavigatedEventArgs.cs
   ...avigatedEventHandler.cs
   ...rNavigatingEventArgs.cs
   ...vigatingEventHandler.cs
   ...ressChangedEventArgs.cs
   ...sChangedEventHandler.cs
   WebBrowserReadyState.cs
   WebBrowserRefreshOption.cs
   Win32DnD.cs
   X11DesktopColors.cs
   X11Dnd.cs
   X11Keyboard.cs
   X11Structs.cs
   XEventQueue.cs
   XplatUI.cs
   XplatUIDriver.cs
   XplatUIOSX.cs
   XplatUIStructs.cs
   XplatUIWin32.cs
   XplatUIX11.cs
   XplatUIX11GTK.cs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
// System.Windows.Forms.ToolBarButton.cs
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
// 
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (C) 2004-2006 Novell, Inc. (http://www.novell.com)
//
// Authors:
//	Ravindra (rkumar@novell.com)
//	Mike Kestner <mkestner@novell.com>


using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing;
using System.Drawing.Imaging;

namespace System.Windows.Forms
{
	[DefaultProperty ("Text")]
	[Designer ("System.Windows.Forms.Design.ToolBarButtonDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
	[DesignTimeVisible (false)]
	[ToolboxItem (false)]
	public class ToolBarButton : Component
	{
		#region instance variable
		private bool enabled = true;
		private int image_index = -1;
		private ContextMenu menu;
		private ToolBar parent;
		private bool partial_push = false;
		private bool pushed = false;
		private ToolBarButtonStyle style = ToolBarButtonStyle.PushButton;
		private object tag;
		private string text = "";
		private string tooltip = "";
		private bool visible = true;
		internal bool dd_pressed = false; // to check for a mouse down on dropdown rect
		internal bool hilight = false;    // to hilight buttons in flat style
		internal bool inside = false;     // to handle the mouse move event with mouse pressed
		internal bool pressed = false;    // this is to check for mouse down on a button
		#endregion

		#region constructors
		public ToolBarButton () { }

		public ToolBarButton (string text)
		{
			this.text = text;
		}
		#endregion

		#region internal properties
		internal bool Hilight {
			get { return hilight; }
			set {
				if (hilight == value)
					return;

				hilight = value;
				InvalidateBorder ();
			}
		}

		internal Image Image {
			get {
				if (Parent == null || Parent.ImageList == null)
					return null;

				ImageList list = Parent.ImageList;
				if (ImageIndex > -1 && ImageIndex < list.Images.Count)
					return list.Images [ImageIndex];

				return null;
			}
		}

		Rectangle image_rect;
		internal Rectangle ImageRectangle {
			get {
				Rectangle result = image_rect;
				result.X += bounds.X;
				result.Y += bounds.Y;
				return result; 
			}
		}

		Rectangle text_rect;
		internal Rectangle TextRectangle {
			get { 
				Rectangle result = text_rect;
				result.X += bounds.X;
				result.Y += bounds.Y;
				return result; 
			}
		}

		Rectangle bounds;
		internal Point Location {
			get { return bounds.Location; }
			set { 
				if (bounds.Location == value)
					return;

				if (bounds != Rectangle.Empty)
					Invalidate ();

				bounds.Location = value;
				Invalidate ();
			}
		}

		internal bool Pressed {
			get {
				if (pressed && inside)
					return true;
				else
					return false;
			}
			set { pressed = value; }
		}
		#endregion internal properties

		#region properties
		[DefaultValue (null)]
		[TypeConverter (typeof (ReferenceConverter))]
		public Menu DropDownMenu {
			get { return menu; }

			set {
				if (value is ContextMenu)
					menu = (ContextMenu) value;
				else
					throw new ArgumentException ("DropDownMenu must be of type ContextMenu.");
			}
		}

		[DefaultValue (true)]
		[Localizable (true)]
		public bool Enabled {
			get { return enabled; }
			set {
				if (value == enabled)
					return;

				enabled = value;
				Invalidate ();
			}
		}

		[DefaultValue (-1)]
		[Editor ("System.Windows.Forms.Design.ImageIndexEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
		[Localizable (true)]
		[TypeConverter (typeof (ImageIndexConverter))]
		public int ImageIndex {
			get { return image_index; }
			set {
				if (value < -1)
					throw new ArgumentException ("ImageIndex value must be above or equal to -1.");

				if (value == image_index)
					return;

				image_index = value;
				if (bounds.Size != CalculateSize ())
					Parent.Redraw (true);
				else
					Invalidate ();
			}
		}

		[Browsable (false)]
		public ToolBar Parent {
			get { return parent; }
		}

		[DefaultValue (false)]
		public bool PartialPush {
			get { return partial_push; }
			set {
				if (value == partial_push)
					return;

				partial_push = value;
				Invalidate ();
			}
		}

		[DefaultValue (false)]
		public bool Pushed {
			get { return pushed; }
			set {
				if (value == pushed)
					return;

				pushed = value;
				Invalidate ();
			}
		}

		public Rectangle Rectangle {
			get {
				if (Visible && Parent != null && Parent.Visible) {
					Rectangle result = bounds;
					if (Style == ToolBarButtonStyle.DropDownButton && Parent.DropDownArrows)
						result.Width += ThemeEngine.Current.ToolBarDropDownWidth;
					return result;
				} else
					return Rectangle.Empty;
			}
		}

		[DefaultValue (ToolBarButtonStyle.PushButton)]
		[RefreshProperties (RefreshProperties.Repaint)]
		public ToolBarButtonStyle Style {
			get { return style; }
			set {
				if (value == style)
					return;

				style = value;
				Invalidate ();
			}
		}

		[Bindable (true)]
		[DefaultValue (null)]
		[Localizable (false)]
		[TypeConverter (typeof (StringConverter))]
		public object Tag {
			get { return tag; }
			set { tag = value; }
		}

		[DefaultValue ("")]
		[Localizable (true)]
		public string Text {
			get { return text; }
			set {
				if (value == text)
					return;

				text = value;
				if (Parent != null)
					Parent.Redraw (true);
			}
		}

		[DefaultValue ("")]
		[Localizable (true)]
		public string ToolTipText {
			get { return tooltip; }
			set { tooltip = value; }
		}

		[DefaultValue (true)]
		[Localizable (true)]
		public bool Visible {
			get { return visible; }
			set {
				if (value == visible)
					return;

				visible = value;
				if (Parent != null)
					Parent.Redraw (true);
			}
		}
		#endregion

		#region internal methods
		internal void SetParent (ToolBar parent)
		{
			if (Parent == parent)
				return;

			if (Parent != null)
				Parent.Buttons.Remove (this);

			this.parent = parent;
		}

		internal bool Layout ()
		{
			if (Parent == null || !Visible)
				return false;

			Size psize = Parent.ButtonSize;
			Size size = psize;
			if (!Parent.SizeSpecified) {
				size = CalculateSize ();
				if (size.Width == 0 || size.Height == 0)
					size = psize;
			}
			return Layout (size);
		}

		internal bool Layout (Size size)
		{
			if (Parent == null || !Visible)
				return false;

			bounds.Size = size;

			Size image_size = (Parent.ImageSize == Size.Empty) ? new Size (16, 16) : Parent.ImageSize;
			int grip = ThemeEngine.Current.ToolBarImageGripWidth;

			Rectangle new_image_rect, new_text_rect;
			
			if (Parent.TextAlign == ToolBarTextAlign.Underneath) {
				new_image_rect = new Rectangle ((bounds.Size.Width - image_size.Width) / 2 - grip, 0, image_size.Width + 2 + grip, image_size.Height + 2 * grip);
				new_text_rect = new Rectangle (0, new_image_rect.Height, bounds.Size.Width, bounds.Size.Height - new_image_rect.Height);
			} else {
				new_image_rect = new Rectangle (0, 0, image_size.Width + 2 * grip, image_size.Height + 2 * grip);
				new_text_rect = new Rectangle (new_image_rect.Width, 0, bounds.Size.Width - new_image_rect.Width, bounds.Size.Height);
			}

			bool changed = false;

			if (new_image_rect != image_rect || new_text_rect != text_rect)
				changed = true;

			image_rect = new_image_rect;
			text_rect = new_text_rect;

			return changed;
		}

		const int text_padding = 3;

		Size TextSize {
			get {
				SizeF sz = Parent.DeviceContext.MeasureString (Text, Parent.Font);
				if (sz == SizeF.Empty)
					return Size.Empty;
				return new Size ((int) Math.Ceiling (sz.Width) + 2 * text_padding, (int) Math.Ceiling (sz.Height));
			}
		}

		Size CalculateSize ()
		{
			if (Parent == null)
				return Size.Empty;

			Theme theme = ThemeEngine.Current;

			int ht = Parent.ButtonSize.Height + 2 * theme.ToolBarGripWidth;

			if (Style == ToolBarButtonStyle.Separator)
				return new Size (theme.ToolBarSeparatorWidth, ht);

			Size size = TextSize;
			Size image_size = (Parent.ImageSize == Size.Empty) ? new Size (16, 16) : Parent.ImageSize;

			int image_width = image_size.Width + 2 * theme.ToolBarImageGripWidth; 
			int image_height = image_size.Height + 2 * theme.ToolBarImageGripWidth; 

			if (Parent.TextAlign == ToolBarTextAlign.Right) {
				size.Width =  image_width + size.Width;
				size.Height = (size.Height > image_height) ? size.Height : image_height;
			} else {
				size.Height = image_height + size.Height;
				size.Width = (size.Width > image_width) ? size.Width : image_width;
			}

			size.Width += theme.ToolBarGripWidth;
			size.Height += theme.ToolBarGripWidth;
			return size;
		}

		internal void InvalidateBorder ()
		{
			if (ThemeEngine.Current.ToolBarInvalidateEntireButton) {
				Invalidate ();
			}
			else {
				if (Rectangle == Rectangle.Empty)
					return;

				/* invalidate the four sides of our border */
				Parent.Invalidate (new Rectangle (Rectangle.X - 2, Rectangle.Y - 2,
								  Rectangle.Width + 4, 4));
				Parent.Invalidate (new Rectangle (Rectangle.X - 2, Rectangle.Y - 2,
								  4, Rectangle.Height + 4));
				Parent.Invalidate (new Rectangle (Rectangle.X - 2, Rectangle.Y + Rectangle.Height - 2,
								  Rectangle.Width + 4, 4));
				Parent.Invalidate (new Rectangle (Rectangle.X + Rectangle.Width - 2, Rectangle.Y - 2,
								  4, Rectangle.Height + 4));
			}
		}

		void Invalidate ()
		{
			if (Parent != null)
				Parent.Invalidate (Rectangle);
		}

		#endregion Internal Methods

		#region methods
		protected override void Dispose (bool disposing)
		{
			base.Dispose (disposing);
		}

		public override string ToString ()
		{
			return string.Format ("ToolBarButton: {0}, Style: {1}", text, style);
		}
		#endregion
	}
}

About Koders | Resources | Downloads | Support | Black Duck | Terms of Service | DMCA | Privacy Policy | Contact Us