Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWade Berrier <wade@mono-cvs.ximian.com>2006-01-20 06:01:55 +0300
committerWade Berrier <wade@mono-cvs.ximian.com>2006-01-20 06:01:55 +0300
commit24906dde223bd634fe2b5ec231ba399eb01ed85e (patch)
tree41105c34861eec3b735807df22bb7b25baef78f9 /mcs/class/Managed.Windows.Forms
parentbf9916e270e2a7c449da248c0afcf667766e3fa2 (diff)
parent0694b14ef614fcbbd9b12a2b1a5ccd202fe7089a (diff)
oops, recopy from trunkmono-1-1-13-2
svn path=/branches/mono-1-1-13/mcs/; revision=55819
Diffstat (limited to 'mcs/class/Managed.Windows.Forms')
-rw-r--r--mcs/class/Managed.Windows.Forms/Assembly/AssemblyInfo.cs44
-rw-r--r--mcs/class/Managed.Windows.Forms/Assembly/ChangeLog18
-rw-r--r--mcs/class/Managed.Windows.Forms/Assembly/Locale.cs75
-rw-r--r--mcs/class/Managed.Windows.Forms/ChangeLog835
-rw-r--r--mcs/class/Managed.Windows.Forms/Design84
-rw-r--r--mcs/class/Managed.Windows.Forms/Guidelines58
-rw-r--r--mcs/class/Managed.Windows.Forms/M.gifbin0 -> 6288 bytes
-rw-r--r--mcs/class/Managed.Windows.Forms/Makefile55
-rw-r--r--mcs/class/Managed.Windows.Forms/Notes17
-rw-r--r--mcs/class/Managed.Windows.Forms/README48
-rw-r--r--mcs/class/Managed.Windows.Forms/SWF.csproj2081
-rw-r--r--mcs/class/Managed.Windows.Forms/SWF.sln21
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Resources/ChangeLog101
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Resources/ResXFileRef.cs105
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Resources/ResXNullRef.cs34
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Resources/ResXResourceReader.cs289
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Resources/ResXResourceSet.cs63
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Resources/ResXResourceWriter.cs336
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.Design/ChangeLog81
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.Design/ComponentEditorForm.cs76
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.Design/ComponentEditorPage.cs188
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.Design/EventsTab.cs122
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.Design/IUIService.cs51
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.Design/IWindowsFormsEditorService.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.Design/PropertyTab.cs101
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.Design/WindowsFormsComponentEditor.cs64
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/ChangeLog45
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Charcode.cs405
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Charset.cs159
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/CharsetFlags.cs36
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/CharsetType.cs34
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/ClassDelegate.cs49
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Color.cs127
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/DestinationDelegate.cs49
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Font.cs201
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/KeyStruct.cs40
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/KeysInit.cs719
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Major.cs67
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Minor.cs765
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/README7
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/RTF.cs883
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/RTFException.cs81
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/StandardCharCode.cs386
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/StandardCharName.cs405
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Style.cs205
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/StyleElement.cs116
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/StyleType.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/TextMap.cs228
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/TokenClass.cs39
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/rtf.csproj200
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/rtf.csproj.user48
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/test.cs286
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.resources9
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.sources533
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/AccessibleEvents.cs74
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/AccessibleNavigation.cs39
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/AccessibleObject.cs570
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/AccessibleRole.cs95
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/AccessibleSelection.cs39
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/AccessibleStates.cs67
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/AmbientProperties.cs87
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/AnchorStyles.cs42
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/Appearance.cs37
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs475
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ApplicationContext.cs92
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ArrangeDirection.cs39
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ArrangeStartingPosition.cs37
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/AsyncMethodData.cs43
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/AsyncMethodResult.cs90
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/AxHost.cs827
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/BaseCollection.cs99
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/Binding.cs284
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/BindingContext.cs229
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/BindingManagerBase.cs153
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/BindingMemberInfo.cs93
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/BindingsCollection.cs120
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/BootMode.cs39
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/Border3DSide.cs42
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/Border3DStyle.cs45
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/BorderStyle.cs37
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/BoundsSpecified.cs42
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/Button.cs122
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ButtonBase.cs563
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ButtonBorderStyle.cs38
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ButtonState.cs40
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/CaptionButton.cs37
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/CategoryGridEntry.cs30
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog10522
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/CharacterCasing.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/CheckBox.cs346
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/CheckState.cs34
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/CheckedListBox.cs685
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/Clipboard.cs142
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColorDepth.cs38
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColorDialog.cs2141
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnClickEventArgs.cs52
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnClickEventHandler.cs34
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnHeader.cs206
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnHeaderStyle.cs36
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs2009
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBoxStyle.cs37
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/CommonDialog.cs142
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComponentModel.cs54
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ContainerControl.cs259
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ContentsResizedEventArgs.cs51
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ContentsResizedEventHandler.cs31
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ContextMenu.cs97
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs4412
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ControlBindingsCollection.cs143
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ControlEventArgs.cs48
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ControlEventHandler.cs32
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ControlPaint.cs466
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ControlStyles.cs50
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ConvertEventArgs.cs60
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ConvertEventHandler.cs31
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/Copyright40
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/CreateParams.cs125
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/CurrencyManager.cs289
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/Cursor.cs729
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/CursorConverter.cs116
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/Cursors.cs353
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataFormats.cs215
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGrid.cs2190
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridBoolColumn.cs384
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridCell.cs85
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridColumnStyle.cs602
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridDrawingLogic.cs616
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridLineStyle.cs33
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridParentRowsLabelStyle.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridPreferredColumnWidthTypeConverter.cs69
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridTableStyle.cs937
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridTextBox.cs130
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridTextBoxColumn.cs339
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs2985
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAdvancedBorderStyle.cs154
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAdvancedCellBorderStyle.cs43
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeColumnMode.cs44
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeColumnModeEventArgs.cs53
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeColumnModeEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeColumnsMode.cs43
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeColumnsModeEventArgs.cs47
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeColumnsModeEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeModeEventArgs.cs47
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeModeEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeRowMode.cs39
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeRowsMode.cs43
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewBand.cs164
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewBindingCompleteEventArgs.cs49
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewBindingCompleteEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewButtonCell.cs199
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewButtonColumn.cs92
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCell.cs1074
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellBorderStyle.cs47
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellCancelEventArgs.cs55
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellCancelEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellCollection.cs164
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellContextMenuStripNeededEventArgs.cs49
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellContextMenuStripNeededEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellErrorTextNeededEventArgs.cs48
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellErrorTextNeededEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellEventArgs.cs53
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellFormattingEventArgs.cs69
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellFormattingEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellMouseEventArgs.cs53
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellMouseEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellPaintingEventArgs.cs130
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellPaintingEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellParsingEventArgs.cs66
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellParsingEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStateChangedEventArgs.cs53
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStateChangedEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStyle.cs286
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStyleContentChangedEventArgs.cs53
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStyleContentChangedEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStyleConverter.cs50
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStyleScopes.cs45
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellToolTipTextNeededEventArgs.cs48
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellToolTipTextNeededEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellValidatingEventArgs.cs60
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellValidatingEventHandler.cs34
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellValueEventArgs.cs59
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellValueEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCheckBoxCell.cs322
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCheckBoxColumn.cs134
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewClipboardCopyMode.cs40
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumn.cs387
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnCollection.cs237
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnDesignTimeVisibleAttribute.cs75
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnDividerDoubleClickEventArgs.cs47
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnDividerDoubleClickEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnEventArgs.cs47
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnHeaderCell.cs144
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnHeadersHeightSizeMode.cs39
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnSortMode.cs39
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnStateChangedEventArgs.cs53
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnStateChangedEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewComboBoxCell.cs330
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewComboBoxColumn.cs190
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewComboBoxDisplayStyle.cs39
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewComboBoxEditingControl.cs102
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewContentAlignment.cs45
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewDataErrorContexts.cs48
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewDataErrorEventArgs.cs62
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewDataErrorEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewEditMode.cs41
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewEditingControlShowingEventArgs.cs54
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewEditingControlShowingEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewElement.cs110
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewElementStates.cs49
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewHeaderBorderStyle.cs41
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewHeaderCell.cs98
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewHitTestType.cs43
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewImageCell.cs174
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewImageCellLayout.cs40
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewImageColumn.cs94
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewPaintParts.cs46
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRow.cs484
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowCancelEventArgs.cs49
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowCancelEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowCollection.cs434
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowContextMenuStripNeededEventArgs.cs55
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowContextMenuStripNeededEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowDividerDoubleClickEventArgs.cs47
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowDividerDoubleClickEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowErrorTextNeededEventArgs.cs54
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowErrorTextNeededEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowEventArgs.cs47
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowHeaderCell.cs144
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowHeadersWidthSizeMode.cs41
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowHeightInfoNeededEventArgs.cs59
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowHeightInfoNeededEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowHeightInfoPushedEventArgs.cs61
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowHeightInfoPushedEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowPostPaintEventArgs.cs125
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowPostPaintEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowPrePaintEventArgs.cs131
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowPrePaintEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowStateChangedEventArgs.cs53
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowStateChangedEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowsAddedEventArgs.cs53
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowsAddedEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowsDeletedEventArgs.cs53
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowsRemovedEventArgs.cs53
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowsRemovedEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewSelectedCellCollection.cs118
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewSelectedColumnCollection.cs104
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewSelectedRowCollection.cs104
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewSelectionMode.cs41
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewSortCompareEventArgs.cs79
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewSortCompareEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewTextBoxCell.cs176
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewTextBoxColumn.cs77
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewTextBoxEditingControl.cs117
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewTopLeftHeaderCell.cs100
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewTriState.cs39
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataObject.cs288
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DateBoldEventArgs.cs69
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DateBoldEventHandler.cs31
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DateRangeEventArgs.cs67
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DateRangeEventHandler.cs31
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DateTimePicker.cs829
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DateTimePickerFormat.cs33
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/Day.cs39
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DialogResult.cs46
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DockStyle.cs41
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DomainUpDown.cs572
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DragAction.cs39
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DragDropEffects.cs41
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DragEventArgs.cs97
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DragEventHandler.cs31
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DrawItemEventArgs.cs101
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DrawItemEventHandler.cs32
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DrawItemState.cs44
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/DrawMode.cs37
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ErrorBlinkStyle.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ErrorIconAlignment.cs38
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ErrorProvider.cs440
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/FeatureSupport.cs116
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs2584
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/FlatStyle.cs36
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/FolderBrowserDialog.cs442
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/FontDialog.cs897
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs1609
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/FormBorderStyle.cs43
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/FormStartPosition.cs40
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/FormWindowState.cs39
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/FrameStyle.cs34
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/GiveFeedbackEventArgs.cs62
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/GiveFeedbackEventHandler.cs32
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridColumnStylesCollection.cs273
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridEntry.cs167
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridItem.cs120
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridItemCollection.cs141
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridItemType.cs39
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridTableStylesCollection.cs237
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridTablesFactory.cs54
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/GroupBox.cs221
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/HScrollBar.cs51
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/HandledMouseEventArgs.cs52
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/Help.cs70
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/HelpEventArgs.cs64
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/HelpEventHandler.cs30
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/HelpNavigator.cs38
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/HelpProvider.cs279
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/HorizontalAlignment.cs37
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/Hwnd.cs557
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/IButtonControl.cs40
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ICommandExecutor.cs34
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/IComponentEditorPageSite.cs34
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/IContainerControl.cs39
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/IDataGridColumnStyleEditingNotificationService.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/IDataGridEditingService.cs36
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/IDataGridViewEditingCell.cs45
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/IDataGridViewEditingControl.cs57
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/IDataObject.cs53
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/IFeatureSupport.cs37
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/IFileReaderService.cs37
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/IMessageFilter.cs34
-rwxr-xr-xmcs/class/Managed.Windows.Forms/System.Windows.Forms/IRootGridEntry.cs40
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/IWin32Window.cs43
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/IWindowTarget.cs34
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImageIndexConverter.cs98
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImageLayout.cs41
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImageList.cs1159
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImageListConverter.cs44
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImageListStreamer.cs226
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImeMode.cs47
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImplicitHScrollBar.cs47
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImplicitVScrollBar.cs47
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/InputLanguage.cs137
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/InputLanguageChangedEventArgs.cs72
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/InputLanguageChangedEventHandler.cs31
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/InputLanguageChangingEventArgs.cs74
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/InputLanguageChangingEventHandler.cs31
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/InputLanguageCollection.cs84
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/InternalWindowManager.cs639
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/InvalidateEventArgs.cs49
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/InvalidateEventHandler.cs32
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ItemActivation.cs40
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ItemBoundsPortion.cs37
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ItemChangedEventArgs.cs50
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ItemChangedEventHandler.cs34
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ItemCheckEventArgs.cs65
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ItemCheckEventHandler.cs34
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ItemDragEventArgs.cs63
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ItemDragEventHandler.cs34
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/KeyEventArgs.cs111
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/KeyEventHandler.cs33
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/KeyPressEventArgs.cs63
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/KeyPressEventHandler.cs31
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/KeyboardLayouts.cs697
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/Keys.cs221
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/KeysConverter.cs126
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/Label.cs657
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/LabelEditEventArgs.cs68
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/LabelEditEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/LayoutEventArgs.cs56
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/LayoutEventHandler.cs32
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/LeftRightAlignment.cs37
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/LibSupport.cs56
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkArea.cs168
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkBehavior.cs39
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkClickedEventArgs.cs48
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkClickedEventHandler.cs34
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkLabel.cs895
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkLabelLinkClickedEventArgs.cs49
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkLabelLinkClickedEventHandler.cs39
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkState.cs41
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBindingConverter.cs60
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs2390
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListControl.cs316
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs2479
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListViewAlignment.cs37
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListViewItem.cs899
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListViewItemConverter.cs97
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/MWFCategoryAttribute.cs50
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/MWFDescriptionAttribute.cs51
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/MainMenu.cs143
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiChildContext.cs691
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs328
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiLayout.cs36
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiWindowManager.cs124
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/MeasureItemEventArgs.cs76
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/MeasureItemEventHandler.cs31
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/Menu.cs501
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuAPI.cs746
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuGlyph.cs36
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuItem.cs673
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuMerge.cs38
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/Message.cs108
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/MessageBox.cs516
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/MessageBoxButtons.cs43
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/MessageBoxDefaultButton.cs40
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/MessageBoxIcon.cs45
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/MessageBoxOptions.cs41
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/MethodInvoker.cs32
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/Mime.cs823
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/MimeGenerated.cs7245
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/MimeIcon.cs1021
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/MonthCalendar.cs2019
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/MouseButtons.cs42
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/MouseEventArgs.cs82
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/MouseEventHandler.cs32
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/NativeWindow.cs167
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/NavigateEventArgs.cs52
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/NavigateEventHandler.cs32
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/NodeLabelEditEventArgs.cs61
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/NodeLabelEditEventHandler.cs33
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/NotifyIcon.cs379
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/NumericUpDown.cs463
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/OSFeature.cs63
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/OSXStructs.cs514
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/OpacityConverter.cs74
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/OpenFileDialog.cs140
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/OpenTreeNodeEnumerator.cs113
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/Orientation.cs39
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/OwnerDrawPropertyBag.cs84
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/Padding.cs144
-rwxr-xr-xmcs/class/Managed.Windows.Forms/System.Windows.Forms/PageSetupDialog.cs377
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/PaintEventArgs.cs86
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/PaintEventHandler.cs34
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/Panel.cs125
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/PictureBox.cs382
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/PictureBoxSizeMode.cs37
-rwxr-xr-xmcs/class/Managed.Windows.Forms/System.Windows.Forms/PrintControllerWithStatusDialog.cs129
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/PrintDialog.cs168
-rwxr-xr-xmcs/class/Managed.Windows.Forms/System.Windows.Forms/PrintPreviewControl.cs159
-rwxr-xr-xmcs/class/Managed.Windows.Forms/System.Windows.Forms/PrintPreviewDialog.cs77
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ProgressBar.cs414
-rwxr-xr-xmcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertiesTab.cs77
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGrid.cs1068
-rwxr-xr-xmcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridCommands.cs47
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridEntry.cs18
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridTextBox.cs146
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs758
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyManager.cs141
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertySort.cs41
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyTabChangedEventArgs.cs66
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyTabChangedEventHandler.cs34
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyValueChangedEventArgs.cs66
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyValueChangedEventHandler.cs32
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/QueryAccessibilityHelpEventArgs.cs84
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/QueryAccessibilityHelpEventHandler.cs31
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/QueryContinueDragEventArgs.cs71
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/QueryContinueDragEventHandler.cs31
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/QuestionEventArgs.cs52
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/QuestionEventHandler.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/RadioButton.cs333
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBox.cs1612
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBoxFinds.cs38
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBoxScrollBars.cs39
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBoxSelectionAttribute.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBoxSelectionTypes.cs38
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBoxStreamType.cs37
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBoxWordPunctuations.cs36
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/RightToLeft.cs36
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/SWF.csproj.user48
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/SaveFileDialog.cs117
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/Screen.cs181
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollBar.cs1235
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollBars.cs36
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollButton.cs39
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollEventArgs.cs64
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollEventHandler.cs31
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollEventType.cs44
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollableControl.cs659
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/SecurityIDType.cs41
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/SelectedGridItemChangedEventArgs.cs65
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/SelectedGridItemChangedEventHandler.cs32
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/SelectionMode.cs43
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/SelectionRange.cs100
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/SelectionRangeConverter.cs109
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/SendKeys.cs199
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/Shortcut.cs187
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/SizeGrip.cs135
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/SizeGripStyle.cs38
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/SortOrder.cs38
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/Splitter.cs735
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/SplitterEventArgs.cs79
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/SplitterEventHandler.cs32
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBar.cs616
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBarDrawItemEventArgs.cs57
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBarDrawItemEventHandler.cs36
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBarPanel.cs215
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBarPanelAutoSize.cs33
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBarPanelBorderStyle.cs33
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBarPanelClickEventArgs.cs46
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBarPanelClickEventHandler.cs32
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBarPanelStyle.cs33
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/StructFormat.cs37
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/SystemInformation.cs415
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabAlignment.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabAppearance.cs34
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabControl.cs1226
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabDrawMode.cs33
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabPage.cs269
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabSizeMode.cs34
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBox.cs218
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs1641
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextControl.cs4386
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextFormatFlags.cs66
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/Theme.cs849
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeClearlooks.cs3402
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeEngine.cs65
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeGtk.cs887
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeNice.cs1423
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeWin32Classic.cs5572
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThreadExceptionDialog.cs203
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/TickStyle.cs40
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/Timer.cs147
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBar.cs982
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBarAppearance.cs41
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBarButton.cs294
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBarButtonClickEventArgs.cs57
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBarButtonClickEventHandler.cs36
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBarButtonStyle.cs42
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBarTextAlign.cs40
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolTip.cs453
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/TrackBar.cs694
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNode.cs678
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNodeCollection.cs371
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNodeConverter.cs54
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeView.cs1575
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeViewAction.cs35
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeViewCancelEventArgs.cs52
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeViewCancelEventHandler.cs31
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeViewEventArgs.cs51
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeViewEventHandler.cs30
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeViewImageIndexConverter.cs45
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/UICues.cs41
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/UICuesEventArgs.cs87
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/UICuesEventHandler.cs32
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/UpDownBase.cs680
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/UpDownEventArgs.cs49
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/UpDownEventHandler.cs31
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/UserControl.cs103
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/VScrollBar.cs76
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/View.cs37
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/Win32DnD.cs1097
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/X11DesktopColors.cs286
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/X11Dnd.cs1208
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/X11Keyboard.cs686
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/X11Structs.cs1580
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/XEventQueue.cs109
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs874
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIDriver.cs306
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIOSX.cs2067
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIStructs.cs799
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs2500
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs4226
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms_test.dll.sources51
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Resources/ChangeLog8
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Resources/CompatTest.cs51
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Resources/CultureTest.cs59
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Resources/WriterTest.cs60
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Resources/compat_1_1.resx81
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Resources/compat_2_0.resx102
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ButtonTest.cs104
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog253
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/CheckBoxEventTest.cs65
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/CheckBoxTest.cs40
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/CheckedListBoxEventTest.cs42
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/CheckedListBoxTest.cs133
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ComboBoxTest.cs326
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/Common.cs251
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ControlEventTest.cs300
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ControlPaintTest.cs150
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ControlStyleTest.cs961
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ControlTest.cs746
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/CursorTest.cs29
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridCellTest.cs56
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridTableStyleTest.cs270
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridTest.cs314
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridTextBoxColumnTest.cs105
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewAdvancedBorderStyleTest.cs149
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewBandTest.cs73
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewCellStyleTest.cs125
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewCellTest.cs74
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewElementTest.cs57
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewRowTest.cs64
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewTest.cs282
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ErrorProviderTest.cs98
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/FormEventTest.cs237
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/FormTest.cs175
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/GenerateControlStyleTest.cs129
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/GridColumnStylesCollectionTest.cs199
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/GridTableStylesCollectionTest.cs193
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/GroupBoxTest.cs40
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ImageListTest.cs94
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/LabelPropertyTest.cs138
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/LabelTest.cs970
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ListBoxEventTest.cs65
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ListBoxTest.cs351
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ListViewCollectionsTest.cs243
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ListViewEventTest.cs208
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ListViewItemTest.cs88
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ListViewTest.cs136
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/MenuItemTest.cs170
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/MenuTest.cs86
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/MonthCalendarTest.cs166
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/PictureBoxTest.cs82
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ProgressBarTest.cs84
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/RadioButtonTest.cs104
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/RichTextBoxTest.cs187
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ScrollBarTest.cs1453
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/StatusBarTest.cs75
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TabControlTest.cs87
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TestImageIndexConverter.cs157
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TextBoxTest.cs191
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolBarTest.cs97
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolTipTest.cs71
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TrackBarTest.cs79
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TreeNodeTest.cs162
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TreeViewTest.cs34
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/bitmaps/a.pngbin0 -> 651 bytes
-rwxr-xr-xmcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/tests-ms.sh28
-rwxr-xr-xmcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/tests.sh29
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/resources/a.curbin0 -> 766 bytes
-rwxr-xr-xmcs/class/Managed.Windows.Forms/build-csproj215
-rw-r--r--mcs/class/Managed.Windows.Forms/resources/ChangeLog45
-rw-r--r--mcs/class/Managed.Windows.Forms/resources/DnDCopy.curbin0 -> 326 bytes
-rw-r--r--mcs/class/Managed.Windows.Forms/resources/DnDLink.curbin0 -> 326 bytes
-rw-r--r--mcs/class/Managed.Windows.Forms/resources/DnDMove.curbin0 -> 326 bytes
-rw-r--r--mcs/class/Managed.Windows.Forms/resources/DnDNo.curbin0 -> 326 bytes
-rw-r--r--mcs/class/Managed.Windows.Forms/resources/SplitterNS.curbin0 -> 326 bytes
-rw-r--r--mcs/class/Managed.Windows.Forms/resources/SplitterWE.curbin0 -> 326 bytes
-rw-r--r--mcs/class/Managed.Windows.Forms/resources/System.Windows.Forms.de.resources.prebuiltbin0 -> 141068 bytes
-rw-r--r--mcs/class/Managed.Windows.Forms/resources/System.Windows.Forms.de.resx831
-rw-r--r--mcs/class/Managed.Windows.Forms/resources/System.Windows.Forms.en.resources.prebuiltbin0 -> 141020 bytes
-rw-r--r--mcs/class/Managed.Windows.Forms/resources/System.Windows.Forms.en.resx831
-rw-r--r--mcs/class/Managed.Windows.Forms/resources/System.Windows.Forms.resources.prebuiltbin0 -> 145735 bytes
-rw-r--r--mcs/class/Managed.Windows.Forms/resources/System.Windows.Forms.resx844
-rw-r--r--mcs/class/Managed.Windows.Forms/samples/Changelog6
-rw-r--r--mcs/class/Managed.Windows.Forms/samples/mailclient.cs280
-rw-r--r--mcs/class/Managed.Windows.Forms/samples/notepad.cs275
638 files changed, 173193 insertions, 0 deletions
diff --git a/mcs/class/Managed.Windows.Forms/Assembly/AssemblyInfo.cs b/mcs/class/Managed.Windows.Forms/Assembly/AssemblyInfo.cs
new file mode 100644
index 00000000000..2f390520b2a
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Assembly/AssemblyInfo.cs
@@ -0,0 +1,44 @@
+//
+// AssemblyInfo.cs
+//
+// Author:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) 2003 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Resources;
+using System.Security;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about the System.Windows.Forms assembly
+
+[assembly: AssemblyVersion (Consts.FxVersion)]
+[assembly: SatelliteContractVersion (Consts.FxVersion)]
+
+#if (ONLY_1_1)
+[assembly: ComCompatibleVersion (1, 0, 3300, 0)]
+[assembly: TypeLibVersion (1, 10)]
+#endif
+
+[assembly: AssemblyTitle("System.Windows.Forms.dll")]
+[assembly: AssemblyDescription("System.Windows.Forms.dll")]
+[assembly: AssemblyConfiguration("Development version")]
+[assembly: AssemblyCompany("MONO development team")]
+[assembly: AssemblyProduct("MONO CLI")]
+[assembly: AssemblyCopyright("(c) 2003 Various Authors")]
+[assembly: AssemblyTrademark("")]
+
+[assembly: CLSCompliant(true)]
+[assembly: ComVisible(false)]
+[assembly: AssemblyDefaultAlias("System.Windows.Forms.dll")]
+[assembly: AssemblyInformationalVersion("0.0.0.1")]
+[assembly: NeutralResourcesLanguage("en-US")]
+
+[assembly: AllowPartiallyTrustedCallers()]
+
+[assembly: AssemblyDelaySign(true)]
+[assembly: AssemblyKeyFile("../ecma.pub")]
diff --git a/mcs/class/Managed.Windows.Forms/Assembly/ChangeLog b/mcs/class/Managed.Windows.Forms/Assembly/ChangeLog
new file mode 100644
index 00000000000..3ab76192247
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Assembly/ChangeLog
@@ -0,0 +1,18 @@
+2005-02-13 Peter Bartok <pbartok@novell.com>
+
+ * Locale.cs: Implemented support for reading resources from
+ the assembly
+
+2004-04-13 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * Consts.cs: Added
+
+2004-04-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AssemblyInfo.cs: patch by Gert Driesen that makes SWF CLS compliant.
+
+2004-03-15 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * AssemblyInfo.cs: Added
+ * Locale.cs: Added
+ * ChangeLog: Added
diff --git a/mcs/class/Managed.Windows.Forms/Assembly/Locale.cs b/mcs/class/Managed.Windows.Forms/Assembly/Locale.cs
new file mode 100644
index 00000000000..bf47b659fbd
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Assembly/Locale.cs
@@ -0,0 +1,75 @@
+// 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) 2001-2005 Novell, Inc.
+//
+// Authors:
+// Miguel de Icaza (miguel@ximian.com)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// NOT COMPLETE
+
+using System;
+using System.Globalization;
+using System.Reflection;
+using System.Resources;
+
+namespace System.Windows.Forms {
+ internal sealed class Locale {
+ #region Local Variables
+ private static ResourceManager rm;
+ #endregion // Local Variables
+
+ #region Constructors
+ static Locale () {
+ rm = new ResourceManager("System.Windows.Forms", Assembly.GetExecutingAssembly());
+ }
+ #endregion
+
+ #region Static Properties
+ public static ResourceManager ResourceManager {
+ get {
+ return rm;
+ }
+ }
+
+ #endregion // Static Properties
+
+ #region Static Methods
+ public static string GetText (string msg){
+ string ret;
+
+// This code and behaviour may change without notice. It's a placeholder until I
+// understand how Miguels wants localization of strings done.
+ ret = (string)rm.GetObject(msg);
+ if (ret != null) {
+ return ret;
+ }
+ return msg;
+ }
+
+ public static object GetResource(string name) {
+ return rm.GetObject(name);
+ }
+ #endregion // Static Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/ChangeLog b/mcs/class/Managed.Windows.Forms/ChangeLog
new file mode 100644
index 00000000000..90a5033acbd
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/ChangeLog
@@ -0,0 +1,835 @@
+2006-1-12 Jonathan Chambers <jonathan.chambers@ansys.com>
+
+ * build-csproj: Fixed so the csproj is usable.
+
+2006-1-12 Jonathan Chambers <jonathan.chambers@ansys.com>
+
+ * System.Windows.Forms.dll.sources: Added PageSetupDialog.cs.
+
+2006-1-12 Jonathan Chambers <jonathan.chambers@ansys.com>
+
+ * System.Windows.Forms.dll.sources: Added printing items and *committed* file this time.
+
+2006-1-10 Jonathan Chambers <jonathan.chambers@ansys.com>
+
+ * System.Windows.Forms.dll.sources: Add PrintPreviewDialog and PrintPreviewControl
+
+2006-1-10 Jonathan Chambers <jonathan.chambers@ansys.com>
+
+ * System.Windows.Forms.dll.sources: Add PrintControllerWithStatusDialog
+
+2005-12-13 Jackson Harper <jackson@ximian.com>
+
+ * System.Windows.Forms.dll.sources: Add the new internal window
+ managers
+
+2005-12-04 Alexander Olk <alex.olk@googlemail.com>
+
+ * System.Windows.Forms.dll.sources: Added ThemeClearlooks.cs
+
+2005-12-02 Jackson Harper <jackson@ximian.com>
+
+ * System.Windows.Forms.dll.sources: New implicit scrollbars.
+
+2005-12-01 Robert Jordan <robertj@gmx.net>
+
+ * System.Windows.Forms_test.dll.sources: Added
+ System.Resources/CompatTest.cs
+ System.Resources/WriterTest.cs.
+
+2005-12-01 Raja R Harinath <rharinath@novell.com>
+
+ * Makefile (EXTRA_DISTFILES): Add Test/resources/a.cur.
+
+2005-11-30 Robert Jordan <robertj@gmx.net>
+
+ * System.Windows.Forms_test.dll.sources: Added System.Resources/CultureTest.cs
+
+2005-11-12 Pedro Martínez Juliá <pedromj@gmail.com>
+
+ * System.Windows.Forms_test.dll.sources: Added DataGridViewElementTest.cs
+ DataGridViewBandTest.cs DataGridViewCellTest.cs
+ DataGridViewAdvancedBorderStyleTest.cs DataGridViewCellStyleTest.cs
+ DataGridViewRowTest.cs DataGridViewTest.cs
+
+2005-11-09 Peter Dennis Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms_test.dll.sources: Added RichTextBoxTest.cs
+
+2005-11-01 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Makefile, System.Windows.Forms.dll.resources, SWF.csproj: Added
+ DnDLink cursor
+
+2005-10-31 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Makefile: Added new cursors; added dependency rule on
+ cursors to force rebuild when cursors are changed or added
+ * System.Windows.Forms.dll.resources: Added new cursors
+
+2005-10-17 Raja R Harinath <rharinath@novell.com>
+
+ * Makefile (RESOURCES): Distribute newly added cursors.
+
+2005-10-13 Peter Dennis Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.resources: Added cursors
+ * build-csproj: Updated to support resources
+ * SWF.csproj: Updated
+ * System.Windows.Forms.dll.sources: Removed blank line to support
+ build-csproj
+ * System.Windows.Forms_test.dll.sources: Added ControlStyleTest
+
+2005-10-05 Hisham Mardam Bey <hisham.mardambey@gmail.com>
+
+ * Created samples/ directory.
+
+2005-09-30 Peter Dennis Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.sources: Added X11DesktopColors.cs
+ * SWF.csproj: Updated
+
+2005-09-28 Hisham Mardam Bey <hisham.mardambey@gmail.com>
+
+ * System.Windows.Forms_test.dll.sources : Added Common.cs
+
+2005-09-27 Kornél Pál <kornelpal@hotmail.com>
+
+ * Makefile: Replaced /codepage with CODEPAGE.
+
+2005-09-20 Ritvik Mayank <mritvik@novell.com>
+
+ * System.Windows.Forms_test.dll.sources : Added pictureBoxTest.cs
+
+2005-09-09 Jonathan Chambers <jonathan.chambers@ansys.com>
+
+ * System.Windows.Forms.dll.sources: Added IRootGridEntry.cs and PropertyGridCommands.cs
+
+2005-09-09 Hisham Mardam Bey <hisham.mardambey@gmail.com>
+
+ * Test/System.Windows.Forms/LabelTest.cs : More tests.
+
+2005-09-09 Hisham Mardam Bey <hisham.mardambey@gmail.com>
+
+ * Test/System.Windows.Forms/LabelTest.cs : new Label tests (incomplete)
+ * System.Windows.Forms_test.dll.sources : add new tests
+ * System.Windows.Forms/Label.cs : give FlatStyle a default value
+ of FlatStyle.Standard.
+
+2005-09-08 Ritvik Mayank <mritvik@novell.com>
+
+ * System.Windows.Forms_test.dll.sources : added MonthCalendarTest.cs
+
+2005-09-08 Peter Dennis Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.sources: Added RichTextBox.cs to build
+ * SWF.csproj: Updated
+
+2005-09-06 Jonathan Chambers <jonathan.chambers@ansys.com>
+
+ * System.Windows.Forms.dll.sources: Added System.Windows.Forms.PropertiesTab.cs
+
+2005-09-04 Peter Dennis Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.sources: Added System.Windows.Forms.RTF
+ subdirectory to build
+ * SWF.csproj: Updated
+
+2005-08-29 Alexander Olk <xenomorph2@onlinehome.de>
+
+ * System.Windows.Forms.dll.sources: Added ThemeNice.cs
+
+2005-08-29 Ritvik Mayank <mritvik@novell.com>
+
+ * System.Windows.Forms_test.dll.sources : added ProgressBarTest.cs,
+ ToolBarTest.cs, ToolTipTest.cs
+
+ RadioButtonTest.cs, ScrollBarTest.cs and StatusBarTest.cs .
+2005-08-25 Atsushi Enomoto <atsushi@ximian.com>
+
+ * Makefile : added /codepage:65001 (otherwise the build gets broken
+ on KeyboardLayout.cs on some non-iso-8859-1 environment).
+
+2005-08-18 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
+ * System.Windows.Forms/TreeView.cs: some spaces to tabs
+ FIX: ToString() was generating exception on empty Nodes
+ (was testing <0 instead of <= 0)
+
+2005-08-16 Ritvik Mayank <mritvik@novell.com>
+
+ * System.Windows.Forms_test.dll.sources : added ImageListTest.cs,
+ RadioButtonTest.cs, ScrollBarTest.cs and StatusBarTest.cs .
+
+2005-08-06 Ritvik Mayank <mritvik@novell.com>
+
+ * System.Windows.Forms_test.dll.sources : sorted and removed test-cases for Form
+ and TextBox as these are still under development.
+
+2005-08-04 Peter Dennis Bartok <pbartok@novell.com>
+
+ * SWF.csproj: Updated
+
+2005-08-02 Ritvik Mayank <mritvik@novell.com>
+
+ * M.gif : used by some of the test-cases
+ * System.Windows.Forms_test.dll.sources : Added test-case for
+ ListView, ComboBox, CheckBox, CheckedList, Form, Menu, GroupBox
+ and ImageList
+
+2005-07-07 Alexander Olk <xenomorph2@onlinehome.de>
+
+ * System.Windows.Forms_test.dll.sources : Added MimeIcon.cs
+
+2005-07-06 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * DataGridTextBoxColumn.cs: default value
+ * GridColumnStylesCollection.cs: fixes event firing, checking MappingName
+ * GridTableStylesCollection.cs: fixes checking MappingName
+ * DataGridDrawingLogic.cs: fixes drawing logic issues
+ * DataSourceHelper.cs: rewritten to make compatible with more data sources
+ * DataGrid.cs: fixes
+
+
+2005-07-04 Ritvik Mayank <mritvik@novell.com>
+
+ * System.Windows.Forms_test.dll.sources : Added ListBoxTest.cs and
+ ListBoxEventTest.cs for ListBox tests.
+
+2005-06-15 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.sources: Added MWFCategoryAttribute.cs and
+ MWFDescriptionAttribute.cs
+ * SWF.csproj: Updated
+
+2005-06-15 Alexander Olk <xenomorph2@onlinehome.de>
+
+ * System.Windows.Forms.dll.sources: Added Mime.cs and
+ MimeGenerated.cs.
+
+2005-06-13 Jackson Harper <jackson@ximian.com>
+
+ * SWF.csproj:
+ * System.Windows.Forms.dll.sources: Add MdiClientContext to the
+ build.
+
+2005-06-13 Ritvik Mayank <mritvik@novell.com>
+
+ * System.Windows.Forms_test.dll.sources : Added TextBoxTest.cs
+ and ButtonTest.cs for TextBox and Button tests respectively.
+
+2005-06-10 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.sources: Add ImageListConverter.cs
+ * SWF.csproj: Updated
+
+2005-06-08 Jackson Harper <jackson@ximian.com>
+
+ * Guidelines:
+ * Design: Double buffering is handled at a different level now, so
+ I am removing mention of it. Control developers do not need to
+ know how it works.
+
+2005-06-05 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.sources: Add Win32DnD.cs
+ * SWF.csproj: Updated
+
+2005-05-24 Jackson Harper <jackson@ximian.com>
+
+ * System.Windows.Forms.dll.sources: Add X11Dnd.cs
+
+2005-05-24 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.sources: Added
+ DataGridPreferredColumnWidthTypeConverter.cs
+ * SWF.csproj: Updated
+
+2005-05-24 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.sources: Added Help.cs
+ * SWF.csproj: Updated
+
+2005-05-18 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.sources: Added Clipboard.cs
+ * SWF.csproj: Update
+
+2005-05-11 Ritvik Mayank <mritvik@novell.com>
+
+ * System.Windows.Forms_test.dll.sources : Added ControlEventTest.cs
+ for Event Test
+
+2005-05-11 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.sources: Added
+ IDataGridEditingService.cs, System.Resources/ResXFileRef.cs,
+ System.Resources/ResXResourceSet.cs
+ * SWF.csproj: Updated
+
+2005-05-10 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.sources: Added SecurityIDType.cs,
+ DataObject.cs and DataFormats.cs
+ * SWF.csproj: Update
+
+2005-05-06 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.sources: Added Screen.cs, HelpNavigator.cs
+ and HelpProvider.cs
+ * SWF.csproj: Updated
+
+2005-05-05 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.sources: Added AxHost.cs,
+ ErrorProvider.cs, RichTextBoxFinds.cs, RichTextBoxScrollBars.cs,
+ RichTextBoxSelectionAttribute.cs, RichTextBoxSelectionTypes.cs,
+ RichTextBoxStreamType.cs, RichTextBoxWordPunctuations.cs
+ * SWF.csproj: Updated
+
+2005-05-02 Ritvik Mayank <mritvik@novell.com>
+
+ * System.Windows.Forms_test.dll.sources : Added ControlTest.cs for Label Test
+
+2005-04-26 Ritvik Mayank <mritvik@novell.com>
+
+ * System.Windows.Forms_test.dll.sources : Added LabelPropertyTest.cs for Label Test
+
+2005-04-25 Jackson Harper <jackson@ximian.com>
+
+ * System.Windows.Forms.dll.sources: Add CursorConvert.cs to the
+ build
+
+2005-04-09 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.sources: Added FolderBrowserDialog.cs
+
+2005-03-11 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.sources: Added MdiClient.cs
+
+2005-03-10 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.sources: Added SaveFileDialog.cs
+
+2005-03-09 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.sources: Added MdiClient.cs
+
+2005-02-24 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.sources: Removed HandleData.cs
+
+2005-02-22 Jackson Harper <jackson@ximian.com>
+
+ * System.Windows.Forms.dll.sources: Add databinding classes
+
+2005-02-22 Raja R Harinath <rharinath@novell.com>
+
+ * Makefile (EXTRA_DISTFILES): Add 'build-csproj'.
+ (PREBUILT): New rule to copy *.resources to *.resources.prebuilt.
+ (dist-default): Depend on it.
+
+2005-02-18 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.sources: Added MethodInvoker.cs,
+ ErrorIconAlignment.cs, MdiLayout.cs, SendKeys.cs
+
+2005-02-18 Raja R Harinath <rharinath@novell.com>
+
+ * Makefile (EXTRA_DISTFILES): Distribute all *.resx and
+ *.resources.prebuilt.
+
+2005-02-17 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.sources: Added DateBoldEventHandler.cs,
+ DateBoldEventArgs.cs, UpDownEventHandler.cs, UpDownEventArgs.cs,
+ ContentsResizedEventHandler.cs, ContentsResizedEventArgs.cs
+
+2005-02-15 Peter Bartok <pbartok@novell.com>
+
+ * Makefile: Altered, following Harinath's suggestion of trying to
+ build and handling the failure by copying prebuilt resources in
+ place
+
+2005-02-15 Peter Bartok <pbartok@novell.com>
+
+ * Makefile: Removed resources as automatic target; to build
+ .resource files 'make resources' must be invoked. This removes
+ the libgdiplus installed requirement. Instead, the compiled files
+ are checked in as well.
+
+2005-02-13 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.sources: Added SelectionRangeConverter.cs,
+ OpacityConverter.cs, KeysConverter.cs, Hwnd.cs
+ * System.Windows.Forms.dll.resources: Added
+ * Makefile: Added support for generating resources
+
+2005-02-12 Geoff Norton <gnorton@customerdna.com>
+
+ * System.Windows.Forms.dll.sources: Added ResXNullRef.cs
+
+2005-02-03 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.Sources: Added ComponentModel.cs and
+ PropertyGridView.cs
+
+2005-01-30 John BouAntoun <jba-mono@optusnet.com.au>
+
+ * System.Windows.Forms.dll.Sources: Added DateTimePicker.cs and
+ DateTimePickerFormat.cs
+
+2005-01-29 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.Sources: Added ArrangeDirection.cs and
+ ArrangeStartingPosition.cs
+ * SWF.csproj: Updated
+
+2005-01-28 Peter Bartok <pbartok@novell.com>
+
+ * SWF.csproj: Updated with all the latest files
+ * build-csproj: Added, allows to autogenerate SWF.csproj
+ * Makefile: Added rule to automatically call build-csproj (Thanks
+ to Geoff Norton for review and a simpler rule)
+
+2005-01-26 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.Sources: Added GridEntry.cs,
+ GridItem.cs, GridItemCollection.cs, GridItemType.cs,
+ PropertyGrid.cs, PropertySort.cs, PropertyTabChangedEventArgs.cs,
+ PropertyTabChangedEventHandler.cs, PropertyValueChangedEventArgs.cs
+ PropertyValueChangedEventHandler.cs,
+ SelectedGridItemChangedEventArgs.cs,
+ SelectedGridItemChangedEventHandler.cs
+
+2005-01-26 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.Sources: Added NotifyIcon.cs
+
+2005-01-16 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.Sources: Added AccessibleEvents.cs
+
+2005-01-16 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.Sources: Added Cursors.cs
+
+2005-01-11 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.Sources: Added OSXStructs.cs
+
+2005-01-05 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.Sources: Added ICommandExecutor.cs,
+ IDataGridColumnStyleEditingNotificationService.cs,
+ IFeatureSupport.cs, IFileReaderService.cs, AmbientProperties.cs,
+ NavigateEventArgs.cs, NavigateEventHandler.cs, FeatureSupport.cs,
+ OSFeature.cs, ErrorBlinkStyle.cs, ListBindingConverter.cs
+
+2004-12-27 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.Sources: Added
+ System.Windows.Forms.Design/ComponentEditorForm.cs,
+ System.Windows.Forms.Design/ComponentEditorPage.cs,
+ System.Windows.Forms.Design/EventsTab.cs,
+ System.Windows.Forms.Design/IUIService.cs,
+ System.Windows.Forms.Design/IWindowsFormsEditorService.cs,
+ System.Windows.Forms.Design/PropertyTab.cs,
+ System.Windows.Forms.Design/WindowsFormsComponentEditor.cs,
+ ColorDialog.cs, ComboBox.cs, ComboBoxStyle.cs, DataGrid.cs,
+ DataGridLineStyle.cs, DataGridParentRowsLabelStyle.cs,
+ DataGridTableStyle.cs, FontDialog.cs, FileDialog.cs,
+ GridColumnStylesCollection.cs, GridTableStylesCollection.cs,
+ IComponentEditorPageSite.cs, OpenFileDialog, Splitter.cs,
+ SplitterEventArgs.cs, SplitterEventHandler.cs, TextBox.cs
+
+2004-12-24 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * System.Windows.Forms.dll.Sources: Added ComboBox.cs and
+ ComboBoxStyle.cs
+
+2004-12-20 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.Sources: Added CommonDialog.cs
+
+2004-12-16 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.Sources: Added TextBoxBase.cs and
+ TextControl.cs
+
+2004-12-15 Peter Bartok <pbartok@novell.com>
+
+ * Design: Updated to reflect Mac Driver; added mention
+ of System.Drawing patches for MWF support
+
+ * README: Credited Geoff Norton with the Mac driver
+
+2004-12-15 Jackson Harper <jackson@ximian.com>
+
+ * System.Windows.Forms.dll.sources: Add keyboard love to the build.
+
+2004-12-08 Peter Bartok <pbartok@novell.com>
+
+ * SWF.csproj: Added XplatUIOSX.cs to build list
+
+2004-12-07 Geoff Norton <gnorton@customerdna.com>
+
+ * System.Windows.Forms.dll.sources: Add the XplatUIOSX.cs driver.
+
+2004-12-07 Ravindra <rkumar@novell.com>
+
+ * SWF.csproj: Added ThreadExceptionDialog.cs to project and removed
+ some of the components that were added twice. This fixes MWF build on
+ Windows.
+
+2004-12-03 Marek Safar <marek.safar@seznam.cz>
+
+ * System.Windows.Forms.dll.sources: Add ThreadExceptionDialog.cs
+
+2004-12-03 Marek Safar <marek.safar@seznam.cz>
+
+ * Makefile: Added System.Drawing.dll deps for tests.
+
+ * System.Windows.Forms_test.dll.sources: New test files.
+
+2004-12-02 Peter Bartok <pbartok@novell.com>
+
+ * SWF.csproj: Added Jackson's fresly minted TreeView files to
+ build list
+
+2004-12-01 Jackson Harper <jackson@ximian.com>
+
+ * System.Windows.Forms.dll.sources: Add TreeNode love to the build.
+
+2004-11-30 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.sources: Removed textbox
+ references, accidentally checked those in, but textbox is
+ not yet ready for primetime
+
+2004-11-29 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.dll.sources: Removed tree
+ additions.
+ I am removing these files as they conflict with already completed
+ work. While it is fantastic to get contributions to MWF, I
+ respectfully ask that everyone please coordinate their contributions
+ through mono-winforms-list or #mono-winforms at this time. We're
+ explicitly avoiding stubbing and don't want controls that don't have
+ their basic functionality implemented in svn. Please also see
+ http://www.mono-project.com/contributing/winforms.html
+
+2004-11-29 Marek Safar <marek.safar@seznam.cz>
+
+ * System.Windows.Forms.dll.sources: Added
+ TreeNode.cs, TreeNodeCollection.cs, TreeView.cs,
+ TreeViewAction.cs, TreeViewEventArgs.cs
+
+ * System.Windows.Forms_test.dll.sources: Added
+ TreeNodeTest.cs
+
+2004-11-24 Ravindra <rkumar@novell.com>
+
+ * SWF.csproj: Updated project.
+
+2004-11-23 John BouAntoun <jba-mono@optusnet.com.au>
+
+ * System.Windows.Forms.dll.sources: added MonthCalendar files
+
+2004-11-21 Ravindra <rkumar@novell.com>
+
+ * SWF.csproj: Updated project.
+
+2004-11-11 Jackson Harper <jackson@ximian.com>
+
+ * System.Windows.Forms.dll.sources: Add
+ TreeViewImageIndexConverter.cs and OwnerDrawPropertyBag.cs to build
+
+2004-11-01 23:19 ravindra
+
+ * SWF.csproj: Updated project.
+
+2004-10-26 03:38 ravindra
+
+ * SWF.csproj: Updated project.
+
+2004-10-20 04:16 jordi
+
+ * System.Windows.Forms.dll.sources: enum need it by SystemInfo
+
+2004-10-19 16:50 jackson
+
+ * System.Windows.Forms.dll.sources: New optimized event queue
+
+2004-10-18 00:31 ravindra
+
+ * SWF.csproj, System.Windows.Forms.dll.sources: Updated sources
+ list and project to fix the build.
+
+2004-10-15 09:14 ravindra
+
+ * SWF.csproj, System.Windows.Forms.dll.sources: Updates sources
+ list and project.
+
+2004-10-15 06:43 jordi
+
+ * System.Windows.Forms.dll.sources: menu work, mainmenu, subitems,
+ etc
+
+2004-10-13 21:21 ravindra
+
+ * SWF.csproj: Updated project.
+
+2004-10-04 04:58 ravindra
+
+ * SWF.csproj: Updated project.
+
+2004-10-02 12:55 pbartok
+
+ * System.Windows.Forms.dll.sources:
+ - Added LeftRightAlignment source reference
+
+2004-09-30 07:32 ravindra
+
+ * SWF.csproj, System.Windows.Forms.dll.sources: Updated project and
+ sources list.
+
+2004-09-29 23:02 jambunathan
+
+ * SWF.csproj: Updated csproj to include Appearance.cs, CheckBox.cs,
+ CheckState.cs
+
+2004-09-28 14:11 jackson
+
+ * System.Windows.Forms.dll.sources: Give the build some love
+
+2004-09-28 04:31 ravindra
+
+ * Notes: Added a minor note.
+
+2004-09-28 00:18 pbartok
+
+ * Notes:
+ - Initial check in. A place to log info about MWF that doesn't fit
+ anywhere else
+
+2004-09-24 12:02 jackson
+
+ * System.Windows.Forms.dll.sources: Add tab classes to the build
+
+2004-09-23 01:44 ravindra
+
+ * SWF.csproj, System.Windows.Forms.dll.sources: Updated sources
+ list and project file.
+
+2004-09-20 18:54 jackson
+
+ * Makefile: New message loop that uses poll so we don't get a busy
+ loop
+
+2004-09-19 23:41 ravindra
+
+ * Guidelines: Added a note to Guidelines.
+
+2004-09-17 06:19 jordi
+
+ * System.Windows.Forms.dll.sources: Very early menu support
+
+2004-09-16 01:19 ravindra
+
+ * SWF.csproj, System.Windows.Forms.dll.sources: Updated project and
+ sources list.
+
+2004-09-13 22:09 ravindra
+
+ * SWF.csproj: Updated project.
+
+2004-09-13 09:24 jordi
+
+ * System.Windows.Forms.dll.sources: Add to the build Process
+
+2004-09-09 01:15 jordi
+
+ * System.Windows.Forms.dll.sources: measureitem args and handler
+
+2004-09-09 00:03 ravindra
+
+ * SWF.csproj: Updated project.
+
+2004-09-08 23:57 ravindra
+
+ * System.Windows.Forms.dll.sources: Added some new enums to the
+ list.
+
+2004-09-08 06:45 jordi
+
+ * System.Windows.Forms.dll.sources: enumerations need it by menus
+
+2004-09-07 11:12 jordi
+
+ * System.Windows.Forms.dll.sources: GroupBox control
+
+2004-09-02 14:28 pbartok
+
+ * System.Windows.Forms.dll.sources:
+ - Added AccessibleNavigation and AccessibleSelection source files
+
+2004-08-31 20:52 ravindra
+
+ * Design, Guidelines: Minor formatting changes and added location
+ for the coding style guideline for Mono.
+
+2004-08-31 19:37 pbartok
+
+ * Guidelines:
+ - Removed wrong stuff
+
+2004-08-31 16:10 pbartok
+
+ * README:
+ - Updated
+
+2004-08-31 03:13 ravindra
+
+ * System.Windows.Forms_test.dll.sources: Added sources list for
+ test dll.
+
+2004-08-30 10:48 pbartok
+
+ * Design, Guidelines:
+ - Initial check-in
+
+2004-08-29 22:35 pbartok
+
+ * System.Windows.Forms.dll.sources:
+ - Added System.Resources source files
+
+2004-08-27 16:18 ravindra
+
+ * Makefile: Lets do some tests too.
+
+2004-08-27 16:14 ravindra
+
+ * System.Windows.Forms.dll.sources: Added ImageIndexConverter to
+ sources.
+
+2004-08-23 13:14 pbartok
+
+ * SWF.csproj, SWF.sln:
+ - Created properly pathed VS.Net project and solution
+
+2004-08-23 10:46 jackson
+
+ * System.Windows.Forms.dll.sources: oops. remove unused file
+
+2004-08-22 17:47 jackson
+
+ * System.Windows.Forms.dll.sources: Add PictureBox to the build
+
+2004-08-22 12:04 pbartok
+
+ * System.Windows.Forms.dll.sources:
+ - Added Cursor.cs source
+
+2004-08-22 11:59 pbartok
+
+ * System.Windows.Forms.dll.sources:
+ - Restored sort order for file
+ - Added UserControl source file
+
+2004-08-20 13:10 jackson
+
+ * System.Windows.Forms.dll.sources: Classes for sending Async
+ messages through X/Win32
+
+2004-08-19 16:25 jordi
+
+ * System.Windows.Forms.dll.sources: theme enhancaments
+
+2004-08-17 15:09 jackson
+
+ * System.Windows.Forms.dll.sources: Add Panel to the build
+
+2004-08-16 15:24 jackson
+
+ * System.Windows.Forms.dll.sources: HandleData is used for storing
+ message information for window handles
+
+2004-08-16 08:59 pbartok
+
+ * System.Windows.Forms.dll.sources:
+ - Added ButtonBase.cs
+
+2004-08-15 17:22 ravindra
+
+ * System.Windows.Forms.dll.sources: Updated sources list for
+ ToolBar Control.
+
+2004-08-13 10:25 jackson
+
+ * System.Windows.Forms.dll.sources: SWF Timer
+
+2004-08-12 10:19 jackson
+
+ * System.Windows.Forms.dll.sources: Classes for handling status bar
+ panel click events
+
+2004-08-11 15:24 pbartok
+
+ * System.Windows.Forms.dll.sources:
+ - Fixed filename for BindingManagerBase.cs
+ - Alphabetized files
+
+2004-08-10 19:11 jackson
+
+ * System.Windows.Forms.dll.sources: Add StatusBarDrawItem stuff to
+ build
+
+2004-08-10 12:59 jackson
+
+ * System.Windows.Forms.dll.sources: Add Draw Item
+
+2004-08-09 15:40 jackson
+
+ * System.Windows.Forms.dll.sources: Add status bar panel files to
+ the build
+
+2004-08-07 17:01 jackson
+
+ * System.Windows.Forms.dll.sources: Add HorizontalAlignment enum to
+ build
+
+2004-07-26 11:42 jordi
+
+ * System.Windows.Forms.dll.sources: Theme support
+
+2004-07-26 05:41 jordi
+
+ * System.Windows.Forms.dll.sources: initial messagebox
+ implementation
+
+2004-07-21 10:19 jordi
+
+ * System.Windows.Forms.dll.sources: LinkLabel control
+ implementation
+
+2004-07-16 05:18 jordi
+
+ * System.Windows.Forms.dll.sources: add ImageList,
+ ImageListStreamer, and ColorDepth to the build process
+
+2004-07-15 03:38 jordi
+
+ * System.Windows.Forms.dll.sources: Horizontal and Vertical
+ TrackBar control implementation
+
+2004-07-13 09:33 jordi
+
+ * System.Windows.Forms.dll.sources: vertical and hort. classes
+ commit
+
+2004-07-08 23:21 pbartok
+
+ * Makefile, README, System.Windows.Forms.dll.sources:
+ - Initial check-in
+
diff --git a/mcs/class/Managed.Windows.Forms/Design b/mcs/class/Managed.Windows.Forms/Design
new file mode 100644
index 00000000000..c9fa450d553
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Design
@@ -0,0 +1,84 @@
+ Design of new implementation of SWF
+ ===================================
+
+0. About SWF:
+=============
+
+SWF stands for System.Windows.Forms. This is a class library that
+provides a set of controls for designing application UI.
+
+
+1. Architecture:
+================
+
+The new implementation of SWF is based on drivers providing access to
+the native windowing system of the host OS. The old implementation was
+based on Wine library. The motivation for new implementation comes from
+the problems faced with the Wine approach:
+- Wine was missing features that .NET provided over Win32; to add those
+ features we would have had to write the controls managed anyway
+- Installation became much more difficult due to the Wine dependencies
+ and the relatively akward way we had to initialize Wine.
+
+The new implementation takes advantage of Win32 APIs on Windows and
+emulates the same on Linux using X11 for window management and events.
+Following gives a high level idea of the new implementation of SWF.
+
+ -------------------------------------
+ | Managed SWF |
+ -------------------------------------
+ | XplatUI Driver Interface |
+ -------------------------------------
+ | X11 Driver|Win32 Driver|OSX Driver|
+ | | | |
+ | Mono on | Mono on | Mono on |
+ | Linux/Mac | Windows | Mac OS/X |
+ -------------------------------------
+
+The above picture explains how the window management is done in the new
+implementation. For drawing the controls System.Drawing library is used.
+To handle some special needs for different platforms, there are a few
+limited patches to System.Drawing to deal with calls from System.Windows.Forms
+
+
+2. Design:
+==========
+
+The new design of SWF makes porting of the library to Linux/Windows/Mac
+very easy.
+All the controls in SWF inherit from Control class and most of the painting
+operations are done using ControlPaint class. At the low level, XplatUI class
+provides the abstraction over the underlying window management system. It
+contains a XplatUIDriver for providing the window management. XplatUIDriver
+is an abstract class which is implemented by XplatX11 and XplatWin32 classes
+respectively for Linux/Mac and Windows platforms. Support for any new platform
+can be added simply by implementing XplatUIDriver for the new platform.
+
+
+2b. Themes:
+===========
+
+The look of any control is supposed to be controlled by the chosen theme.
+All control drawing needs to be done by the currently selected theme class.
+The ThemeEngine class manages the themes. All the themes implement
+Theme abstract class. The Theme class provides the drawing primitives for
+all controls. The current implementation supports the Windows Classic theme
+through the ThemeWin32Classic class and the Gnome theme through the ThemeGtk
+class. Gnome support is still very incomplete (even more incomplete than SWF
+itself)
+
+
+2c. Multi-threading:
+====================
+
+ As of this writing, multi-threading was fully supported, provided the
+ standard Microsoft implementation guidelines involving Invoke() are
+ followed.
+
+
+
+2d. Issues:
+===========
+
+ - To be added when MWF reaches completion
+
diff --git a/mcs/class/Managed.Windows.Forms/Guidelines b/mcs/class/Managed.Windows.Forms/Guidelines
new file mode 100644
index 00000000000..967ef6c7f6d
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Guidelines
@@ -0,0 +1,58 @@
+ Guidelines for hacking SWF
+ ==========================
+
+This document describes some of the minimal coding guidelines
+to be followed while hacking the new SWF implementation. These
+guidelines are for the sake of consistency.
+
+1. Please refer to the design document of SWF to understand the
+ implementation.
+
+2. Please follow the general coding style described for the Mono
+ project (/cvs/mcs/class/README).
+
+3. Method stubbing is highly discouraged. It's recommended to submit
+ an implemented method instead of just the signature. If you have
+ to stub a property or method, please use the [MonoTODO ("what")]
+ attribute to document what still needs to be done.
+
+4. When you implement the drawing method for a control in a theme, it
+ should make call to ControlPaint class methods and System.Drawing
+ classes. If it is not possible to implement a control's draw method
+ under these restrictions and you need some functionality from
+ XplatUIDriver, please let us know. We will try to enhance the
+ driver, if *really* required.
+
+5. Minimize redraws as much as possible by utilizing the clipRectangle
+ when possible.
+
+6. Setting the size of a control raises a resize event even if the
+ control size is same. Be careful is setting the size and it's better
+ to avoid changing the control size as much as possible. Wherever
+ possible try scaling the control bitmap as per the size needs.
+
+7. Make sure to call the base class event methods when overriding them.
+
+8. Define regions in your code, as it makes it easy to browse the code
+ in the editors which can collapse/expand regions. Also, keep the
+ methods and properties sorted alphabetically.
+
+9. Last but not the least, please let others on the mono-winforms-list
+ know about your work, so that duplication can be avoided.
+
+10. Theme.cs provides Pen and Brush caching. This allows to share
+ the same brushes and pens between different controls and also to avoid
+ to create and destroy them in every draw operation. You should not create
+ Brushes or Pens directly, you should ask the Resource Pool for them. For
+ example, instead of:
+
+ new SolidBrush(button.BackColor);
+
+ you should use:
+
+ ResPool.GetSolidBrush (button.BackColor);
+
+ Look at SystemResPool class for more details.
+
+Happy hacking!
+
diff --git a/mcs/class/Managed.Windows.Forms/M.gif b/mcs/class/Managed.Windows.Forms/M.gif
new file mode 100644
index 00000000000..0199c2b8489
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/M.gif
Binary files differ
diff --git a/mcs/class/Managed.Windows.Forms/Makefile b/mcs/class/Managed.Windows.Forms/Makefile
new file mode 100644
index 00000000000..f23044066c6
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Makefile
@@ -0,0 +1,55 @@
+thisdir = class/Managed.Windows.Forms
+include ../../build/rules.make
+
+LIBRARY = System.Windows.Forms.dll
+
+# UTF-8
+CODEPAGE = 65001
+
+LIB_MCS_FLAGS = /unsafe \
+ /r:$(corlib) /r:System.dll /r:System.Xml.dll \
+ /r:System.Drawing.dll /r:Accessibility.dll \
+ /r:System.Data.dll /r:Mono.Posix.dll \
+ @System.Windows.Forms.dll.resources \
+ /nowarn:649 /nowarn:169 /nowarn:67 /nowarn:108 /nowarn:114 -debug
+
+RESX_RESOURCES = \
+ resources/System.Windows.Forms.resources \
+ resources/System.Windows.Forms.en.resources \
+ resources/System.Windows.Forms.de.resources
+
+CUR_RESOURCES = \
+ resources/SplitterNS.cur \
+ resources/SplitterWE.cur \
+ resources/DnDNo.cur \
+ resources/DnDCopy.cur \
+ resources/DnDLink.cur \
+ resources/DnDMove.cur
+
+RESOURCES = $(RESX_RESOURCES) $(CUR_RESOURCES)
+
+PREBUILT = $(RESX_RESOURCES:=.prebuilt)
+
+EXTRA_DISTFILES = \
+ README System.Windows.Forms.dll.resources \
+ $(RESX_RESOURCES:.resources=.resx) $(CUR_RESOURCES) $(PREBUILT) build-csproj \
+ Test/resources/a.cur
+
+TEST_MCS_FLAGS = /r:System.Drawing.dll -resource:Test/resources/a.cur,a.cur
+
+SWF.csproj: System.Windows.Forms.dll.sources
+ ./build-csproj
+
+include ../../build/library.make
+
+$(the_lib): $(RESOURCES) SWF.csproj
+
+$(RESX_RESOURCES): %.resources: %.resx
+ $(RESGEN) $< || cp $@.prebuilt $@
+
+$(LIBRARY): $(CUR_RESOURCES)
+
+$(PREBUILT): %.prebuilt: %
+ cp $* $@
+
+dist-default: $(PREBUILT)
diff --git a/mcs/class/Managed.Windows.Forms/Notes b/mcs/class/Managed.Windows.Forms/Notes
new file mode 100644
index 00000000000..35e60254400
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Notes
@@ -0,0 +1,17 @@
+ Random things to look out for when writing or using
+ code in Managed.Windows.Forms
+===========================================================================
+
+* Don't do anything that causes the <control>.DeviceContext to be recreated
+ when inside the drawing routine. Chances are the drawing routine was
+ passed <control>.DeviceContext. If an event, for example a resize, that
+ causes <control>.DeviceContext to be recreated, is initiated by the
+ drawing function, the Graphics object passed to it will no longer be valid.
+ Remember that resizing a control results in recreating <control>.DeviceContext
+ and this in turn results in destroying the old <control>.DeviceContext.
+
+* If you're implementing a theme and you need to know about certain states
+ of the control, you have to access the internal variables of the control
+ to get those states. We should probably expose those vars that are used
+ by themes as properties. We'll watch which are needed and 'propertyize'
+ them.
diff --git a/mcs/class/Managed.Windows.Forms/README b/mcs/class/Managed.Windows.Forms/README
new file mode 100644
index 00000000000..d47315aeab8
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/README
@@ -0,0 +1,48 @@
+Managed.Windows.Forms README
+$Revision: 1.2 $
+
+* Introduction
+
+Managed.Windows.Forms is a managed implementation of System.Windows.Forms.
+It implements a driver interface to allow running on multiple windowing systems,
+for example X11 or Windows. All controls are implemented in managed code,
+using System.Drawing to draw them.
+
+
+* Status
+
+This library is in pre-alpha state. Development is still in the very early
+stages. Bug reports are welcome, provided they don't just point out missing
+classes. Please use http://bugzilla.ximian.com/
+
+
+* Contributions
+
+No contributions providing only stubs will be accepted at this time. We ask
+that you submit contributions for review before committing them, our goal is
+to have a consistent and complete implementation, ideally having most or all
+methods and properties of a class written by the same author. This will ensure
+a certain degree of consistency in the code. Please also check the
+'Guidelines' file.
+
+
+The core team for Managed.Windows.Forms currently are:
+ Jordi Mas i Hernandez (jordi@ximian.com)
+ Jackson Harper (jackson@ximian.com)
+ Peter Bartok (pbartok@novell.com)
+
+The Mac OS/X driver implementation is currently being done by:
+ Geoff Norton (gnorton@customerdna.com)
+
+
+* Mailing List
+
+There is a mailing list dedicated to Mono's System.Windows.Forms
+implementation, mono-winforms-list, see
+http://lists.ximian.com/mailman/listinfo/mono-winforms-list
+
+
+* To run System.Windows.Forms Applications
+
+You should use the old Wine-based implementation until this library is
+more functional and reaches beta-stage.
diff --git a/mcs/class/Managed.Windows.Forms/SWF.csproj b/mcs/class/Managed.Windows.Forms/SWF.csproj
new file mode 100644
index 00000000000..a57b8fa0d60
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/SWF.csproj
@@ -0,0 +1,2081 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.10.3077"
+ SchemaVersion = "2.0"
+ ProjectGuid = "{5E6430B2-6B9F-4E76-802E-20207EF80391}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "System.Windows.Forms"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ PreBuildEvent = ""
+ PostBuildEvent = ""
+ RootNamespace = ""
+ RunPostBuildEvent = "OnBuildSuccess"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = ""
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "1"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = ""
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "false"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "1"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "Accessibility"
+ AssemblyName = "Accessibility"
+ HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Accessibility.dll"
+ />
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
+ />
+ <Reference
+ Name = "System.Drawing"
+ AssemblyName = "System.Drawing"
+ HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Drawing.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.XML"
+ HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "..\..\build\common\Consts.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Assembly\Locale.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Resources\ResXNullRef.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Resources\ResXFileRef.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Resources\ResXResourceReader.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Resources\ResXResourceSet.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Resources\ResXResourceWriter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms.Design\ComponentEditorForm.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms.Design\ComponentEditorPage.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms.Design\EventsTab.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms.Design\IUIService.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms.Design\IWindowsFormsEditorService.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms.Design\PropertyTab.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms.Design\WindowsFormsComponentEditor.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\AccessibleEvents.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\AccessibleNavigation.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\AccessibleObject.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\AccessibleRole.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\AccessibleSelection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\AccessibleStates.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\AmbientProperties.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\AnchorStyles.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\Appearance.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\Application.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ApplicationContext.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ArrangeDirection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ArrangeStartingPosition.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\AsyncMethodData.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\AsyncMethodResult.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\AxHost.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\BaseCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\BindingContext.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\Binding.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\BindingManagerBase.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\BindingMemberInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\BindingsCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\BootMode.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\Border3DSide.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\Border3DStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\BorderStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\BoundsSpecified.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\Button.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ButtonBase.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ButtonBorderStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ButtonState.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\CaptionButton.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\CategoryGridEntry.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\CharacterCasing.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\CheckBox.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\CheckedListBox.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\CheckState.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ColorDepth.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\Clipboard.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ColorDialog.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ColumnClickEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ColumnClickEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ColumnHeader.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ColumnHeaderStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ComboBox.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ComboBoxStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\CommonDialog.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ComponentModel.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ContainerControl.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ContentsResizedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ContentsResizedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ContextMenu.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\Control.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ControlBindingsCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ControlEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ControlEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ControlPaint.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ControlStyles.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ConvertEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ConvertEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\CreateParams.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\CurrencyManager.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\Cursor.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\CursorConverter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\Cursors.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\DataFormats.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\DataGrid.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\DataGridDrawingLogic.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\DataGridBoolColumn.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\DataGridCell.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\DataGridColumnStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\DataGridLineStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\DataGridParentRowsLabelStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\DataGridPreferredColumnWidthTypeConverter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\DataGridTableStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\DataGridTextBox.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\DataGridTextBoxColumn.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\DataObject.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\DateBoldEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\DateBoldEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\DateRangeEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\DateRangeEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\DateTimePicker.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\DateTimePickerFormat.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\Day.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\DialogResult.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\DockStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\DomainUpDown.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\DragAction.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\DragDropEffects.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\DragEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\DragEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\DrawItemEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\DrawItemEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\DrawItemState.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\DrawMode.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ErrorBlinkStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ErrorIconAlignment.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ErrorProvider.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\FeatureSupport.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\FlatStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\FontDialog.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\FileDialog.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\FolderBrowserDialog.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\Form.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\FormBorderStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\FormStartPosition.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\FormWindowState.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\FrameStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\GiveFeedbackEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\GiveFeedbackEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\GridColumnStylesCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\GridTablesFactory.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\GridTableStylesCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\GridEntry.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\GridItem.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\GridItemCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\GridItemType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\GroupBox.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\Help.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\HelpEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\HelpEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\HelpNavigator.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\HelpProvider.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\HorizontalAlignment.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\HScrollBar.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\Hwnd.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\IButtonControl.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ICommandExecutor.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\IComponentEditorPageSite.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\IContainerControl.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\IDataGridColumnStyleEditingNotificationService.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\IDataGridEditingService.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\IDataObject.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\IFeatureSupport.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\IFileReaderService.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ImageIndexConverter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ImageList.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ImageListConverter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ImageListStreamer.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ImeMode.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\IMessageFilter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\InputLanguageChangedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\InputLanguageChangedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\InputLanguageChangingEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\InputLanguageChangingEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\InputLanguageCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\InputLanguage.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\InvalidateEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\InvalidateEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\IRootGridEntry.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ItemActivation.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ItemBoundsPortion.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ItemChangedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ItemChangedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ItemCheckEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ItemCheckEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ItemDragEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ItemDragEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\IWin32Window.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\IWindowTarget.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\KeyboardLayouts.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\KeyEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\KeyEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\KeyPressEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\KeyPressEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\Keys.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\KeysConverter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\Label.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\LabelEditEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\LabelEditEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\LayoutEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\LayoutEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\LeftRightAlignment.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\LinkArea.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\LinkBehavior.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\LinkClickedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\LinkClickedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\LinkLabel.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\LinkLabelLinkClickedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\LinkLabelLinkClickedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\LinkState.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ListBindingConverter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ListBox.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ListControl.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ListView.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ListViewAlignment.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ListViewItem.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ListViewItemConverter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\MainMenu.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\MdiChildContext.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\MdiClient.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\MdiLayout.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\MeasureItemEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\MeasureItemEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\MenuGlyph.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\Menu.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\MenuAPI.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\MenuItem.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\MenuMerge.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\MessageBoxButtons.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\MessageBox.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\MessageBoxDefaultButton.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\MessageBoxIcon.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\MessageBoxOptions.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\Message.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\MethodInvoker.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\Mime.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\MimeGenerated.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\MimeIcon.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\MonthCalendar.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\MouseButtons.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\MouseEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\MouseEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\MWFCategoryAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\MWFDescriptionAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\NativeWindow.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\NavigateEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\NavigateEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\NumericUpDown.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\NodeLabelEditEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\NodeLabelEditEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\NotifyIcon.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\OpacityConverter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\OpenFileDialog.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\OpenTreeNodeEnumerator.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\Orientation.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\OSFeature.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\OSXStructs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\OwnerDrawPropertyBag.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\PaintEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\PaintEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\Panel.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\PictureBox.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\PictureBoxSizeMode.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ProgressBar.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\PropertiesTab.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\PropertyGrid.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\PropertyGridCommands.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\PropertyGridEntry.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\PropertyGridTextBox.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\PropertyGridView.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\PropertyManager.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\PropertySort.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\PropertyTabChangedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\PropertyTabChangedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\PropertyValueChangedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\PropertyValueChangedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\QueryAccessibilityHelpEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\QueryAccessibilityHelpEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\QueryContinueDragEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\QueryContinueDragEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\RadioButton.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\RichTextBox.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\RichTextBoxFinds.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\RichTextBoxScrollBars.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\RichTextBoxSelectionAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\RichTextBoxSelectionTypes.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\RichTextBoxStreamType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\RichTextBoxWordPunctuations.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\RightToLeft.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\SaveFileDialog.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\Screen.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ScrollableControl.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ScrollBar.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ScrollBars.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ScrollButton.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ScrollEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ScrollEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ScrollEventType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\SecurityIDType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\SelectedGridItemChangedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\SelectedGridItemChangedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\SelectionRange.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\SelectionRangeConverter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\SelectionMode.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\SendKeys.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\Shortcut.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\SizeGrip.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\SizeGripStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\SortOrder.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\Splitter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\SplitterEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\SplitterEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\StatusBar.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\StatusBarDrawItemEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\StatusBarDrawItemEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\StatusBarPanelAutoSize.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\StatusBarPanelBorderStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\StatusBarPanelClickEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\StatusBarPanelClickEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\StatusBarPanel.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\StatusBarPanelStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\StructFormat.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\SystemInformation.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\TabAlignment.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\TabAppearance.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\TabControl.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\TabDrawMode.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\TabPage.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\TabSizeMode.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\TextBox.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\TextBoxBase.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\TextControl.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\Theme.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ThemeEngine.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ThemeGtk.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ThemeNice.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ThemeWin32Classic.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ThreadExceptionDialog.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\TickStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\Timer.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "..\..\build\common\MonoTODOAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ToolBarAppearance.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ToolBarButtonClickEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ToolBarButtonClickEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ToolBarButton.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ToolBarButtonStyle.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ToolBar.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ToolBarTextAlign.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\ToolTip.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\TrackBar.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\TreeNode.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\TreeNodeCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\TreeNodeConverter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\TreeView.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\TreeViewAction.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\TreeViewCancelEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\TreeViewCancelEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\TreeViewEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\TreeViewEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\TreeViewImageIndexConverter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\UICues.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\UICuesEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\UICuesEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\UpDownBase.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\UpDownEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\UpDownEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\UserControl.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\View.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\VScrollBar.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\Win32DnD.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\X11DesktopColors.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\X11Dnd.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\X11Structs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\X11Keyboard.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\XEventQueue.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\XplatUI.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\XplatUIDriver.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\XplatUIOSX.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\XplatUIStructs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\XplatUIWin32.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms\XplatUIX11.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms.RTF\Charcode.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms.RTF\Charset.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms.RTF\CharsetFlags.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms.RTF\CharsetType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms.RTF\ClassDelegate.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms.RTF\Color.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms.RTF\DestinationDelegate.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms.RTF\Font.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms.RTF\KeysInit.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms.RTF\KeyStruct.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms.RTF\Major.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms.RTF\Minor.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms.RTF\RTF.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms.RTF\RTFException.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms.RTF\StandardCharCode.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms.RTF\StandardCharName.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms.RTF\Style.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms.RTF\StyleElement.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms.RTF\StyleType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms.RTF\TextMap.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Windows.Forms.RTF\TokenClass.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = ""
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "resources\System.Windows.Forms.resources"
+ BuildAction = "EmbeddedResource"
+ />
+ <File
+ RelPath = "resources\System.Windows.Forms.en.resources"
+ BuildAction = "EmbeddedResource"
+ />
+ <File
+ RelPath = "resources\System.Windows.Forms.de.resources"
+ BuildAction = "EmbeddedResource"
+ />
+ <File
+ RelPath = "resources\SplitterNS.cur"
+ CustomToolNameSpace = "System.Windows.Forms.SplitterNS.cur"
+ BuildAction = "EmbeddedResource"
+ />
+ <File
+ RelPath = "resources\SplitterWE.cur"
+ CustomToolNameSpace = "System.Windows.Forms.SplitterWE.cur"
+ BuildAction = "EmbeddedResource"
+ />
+ <File
+ RelPath = "resources\DnDNo.cur"
+ CustomToolNameSpace = "System.Windows.Forms.DnDNo.cur"
+ BuildAction = "EmbeddedResource"
+ />
+ <File
+ RelPath = "resources\DnDCopy.cur"
+ CustomToolNameSpace = "System.Windows.Forms.DnDCopy.cur"
+ BuildAction = "EmbeddedResource"
+ />
+ <File
+ RelPath = "resources\DnDLink.cur"
+ CustomToolNameSpace = "System.Windows.Forms.DnDLink.cur"
+ BuildAction = "EmbeddedResource"
+ />
+ <File
+ RelPath = "resources\DnDMove.cur"
+ CustomToolNameSpace = "System.Windows.Forms.DnDMove.cur"
+ BuildAction = "EmbeddedResource"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
diff --git a/mcs/class/Managed.Windows.Forms/SWF.sln b/mcs/class/Managed.Windows.Forms/SWF.sln
new file mode 100644
index 00000000000..f8a03830319
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/SWF.sln
@@ -0,0 +1,21 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SWF", "SWF.csproj", "{5E6430B2-6B9F-4E76-802E-20207EF80391}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Release = Release
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {5E6430B2-6B9F-4E76-802E-20207EF80391}.Debug.ActiveCfg = Debug|.NET
+ {5E6430B2-6B9F-4E76-802E-20207EF80391}.Debug.Build.0 = Debug|.NET
+ {5E6430B2-6B9F-4E76-802E-20207EF80391}.Release.ActiveCfg = Release|.NET
+ {5E6430B2-6B9F-4E76-802E-20207EF80391}.Release.Build.0 = Release|.NET
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/mcs/class/Managed.Windows.Forms/System.Resources/ChangeLog b/mcs/class/Managed.Windows.Forms/System.Resources/ChangeLog
new file mode 100644
index 00000000000..307e6d6624e
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Resources/ChangeLog
@@ -0,0 +1,101 @@
+2005-12-05 Peter Bartok <pbartok@novell.com>
+
+ * ResXResourceReader.cs: Removed previous patch. More than just Byte[]
+ has that mime type and the patch was causing things to fail.
+ Since our writer no longer emits the mimetype this should be fine.
+
+2005-12-01 Robert Jordan <robertj@gmx.net>
+
+ * ResXResourceReader.cs: Handle mimetype="application/x-microsoft.net.object.bytearray.base64" correctly. Fixes the decoding of System.Byte[].
+ * ResXResourceWriter.cs: Fixed AddResource (string, object) to pass
+ control to AddResource (string, byte[]) if the value parameter is
+ a byte[]. Removed the emitting of the mimetype attribute for
+ System.Byte[].
+
+2005-11-30 Peter Bartok <pbartok@novell.com>
+
+ * ResXResourceReader.cs: Handle System.Byte[] encodings without
+ needing a typeconverter (This fixes bug #76414)
+
+2005-11-30 Robert Jordan <robertj@gmx.net>
+
+ * ResXResourceReader.cs, ResXResourceWriter.cs: Made string conversions
+ culture-invariant.
+ * ResXResourceWriter.cs: Fixed AddResource (string, object) to emit
+ the type attribute when the object has a type converter.
+
+2005-10-04 Peter Bartok <pbartok@novell.com>
+
+ * ResXResourceReader.cs, ResXResourceWriter.cs: Added call
+ to GC.SuppressFinalize() in dispose method. Fixes #76330
+
+2005-05-13 Peter Bartok <pbartok@novell.com>
+
+ * ResXResourceWriter.cs:
+ - Fixed/Improved AddResource(), now only uses string converter if
+ the converter supports both directions
+ - Added ability for AddResource(string, object) to detect if
+ a byte[] converter is supported for the object, if so it now calls
+ AddResource(string, byte[]) for those
+ - WriteBytes: Changed to write it's base64 output as pretty
+ as Microsoft's, inserting newlines every 80 chars
+ - WriteBytes: Added output of mimetype even if type is specified
+
+2005-05-11 Peter Bartok <pbartok@novell.com>
+
+ * ResXResourceSet.cs: Implemented
+ * ResXFileRef.cs: Implemented
+ * ResXNullRef.cs: Added missing attribute
+ * ResXResourceReader.cs: Implemented missing .ctor()s and other
+ assorted fun stuff, should now be complete
+ * ResResourceWriter.cs: Implemented missing methods and added
+ missing static fields
+
+2005-04-14 Jackson Harper <jackson@ximian.com>
+
+ * ResXResourceReader.cs: Use serialization on values that have a
+ mime type set but no type.
+
+2005-02-16 Peter Bartok <pbartok@novell.com>
+
+ * ResXResourceReader.cs, ResXResourceWriter.cs: Removed sealed
+ attribute from classes
+
+2005-02-12 Geoff Norton (gnorton@customerdna.com)
+
+ * ResXResourceReader.cs (load_data): Undo previous change as
+ ResXNullRef is now properly handled.
+ * ResXNullRef.cs: Added
+
+2005-02-11 Geoff Norton (gnorton@customerdna.com)
+
+ * ResXResourceReader.cs (load_data): Temporarily re-introduce the
+ old failure for types that we cannot yet handle to allow Npgsql to
+ build.
+
+2005-02-11 Raja R Harinath <rharinath@novell.com>
+
+ * ResXResourceReader.cs (load_data): Make exception more informative.
+
+2005-02-10 Geoff Norton <gnorton@customerdna.com>
+
+ * ResXResourceReader.cs: Implement the ability to convert the
+ MS Base64 encoded objects. Implement the ability to convert objects
+ to their type rather than just to string.
+
+2004-11-08 14:28 pbartok
+
+ * ResXResourceReader.cs:
+ - BenM's Fix for bug 68260
+
+2004-10-13 08:14 pbartok
+
+ * ResXResourceReader.cs:
+ - Patch by joel.reed@ddiworld.com (joel) to handle CDATA sections.
+
+2004-08-29 22:36 pbartok
+
+ * ResXResourceReader.cs, ResXResourceWriter.cs:
+ - Transfered files from previous version of System.Windows.Forms
+ - Added full copyright header
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Resources/ResXFileRef.cs b/mcs/class/Managed.Windows.Forms/System.Resources/ResXFileRef.cs
new file mode 100644
index 00000000000..52081d265da
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Resources/ResXFileRef.cs
@@ -0,0 +1,105 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+using System;
+using System.ComponentModel;
+using System.IO;
+using System.Reflection;
+
+namespace System.Resources {
+ [Serializable]
+ [TypeConverter(typeof(ResXFileRef.Converter))]
+ public class ResXFileRef {
+ #region Converter Class
+ public class Converter : TypeConverter {
+ #region Constructors
+ public Converter() {
+ }
+ #endregion // Constructors
+
+ #region Methods
+ public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) {
+ return sourceType == typeof(string);
+ }
+
+ public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) {
+ return destinationType == typeof(string);
+ }
+
+ public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) {
+ string[] parts;
+ byte[] buffer;
+
+ if ( !(value is String)) {
+ return base.ConvertFrom(context, culture, value);
+ }
+
+ parts = ((string)value).Split(';');
+
+ using (FileStream file = new FileStream(parts[0], FileMode.Open, FileAccess.Read, FileShare.Read)) {
+ buffer = new byte[file.Length];
+
+ file.Read(buffer, 0, (int)file.Length);
+ }
+
+ return Activator.CreateInstance(Type.GetType(parts[1]), BindingFlags.CreateInstance | BindingFlags.Public | BindingFlags.Instance, null, new object[] { new MemoryStream(buffer) }, culture);
+ }
+
+ public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) {
+ if (destinationType != typeof(String)) {
+ return base.ConvertTo (context, culture, value, destinationType);
+ }
+
+ return ((ResXFileRef)value).ToString();
+ }
+ #endregion // Methods
+ }
+ #endregion // Converter Class
+
+ #region Local Variables
+ private string filename;
+ private string typename;
+ #endregion // Local Variables
+
+ #region Public Constructors
+ public ResXFileRef(string fileName, string typeName) {
+ this.filename = fileName;
+ this.typename = typeName;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ #endregion // Public Instance Properties
+
+ #region Public Instance Methods
+ public override string ToString() {
+ return filename + ";" + typename;
+ }
+ #endregion // Public Instance Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Resources/ResXNullRef.cs b/mcs/class/Managed.Windows.Forms/System.Resources/ResXNullRef.cs
new file mode 100644
index 00000000000..d172feccea9
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Resources/ResXNullRef.cs
@@ -0,0 +1,34 @@
+// 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) 2005 Novell, Inc.
+//
+// Authors:
+// Geoff Norton gnorton@customerdna.com
+//
+
+using System;
+
+namespace System.Resources
+{
+ [Serializable]
+ internal class ResXNullRef
+ {
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Resources/ResXResourceReader.cs b/mcs/class/Managed.Windows.Forms/System.Resources/ResXResourceReader.cs
new file mode 100644
index 00000000000..cd0e027d0b8
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Resources/ResXResourceReader.cs
@@ -0,0 +1,289 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Duncan Mak duncan@ximian.com
+// Nick Drochak ndrochak@gol.com
+// Paolo Molaro lupus@ximian.com
+// Peter Bartok pbartok@novell.com
+//
+
+// COMPLETE
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Globalization;
+using System.IO;
+using System.Resources;
+using System.Runtime.Serialization.Formatters.Binary;
+using System.Xml;
+
+namespace System.Resources
+{
+ public class ResXResourceReader : IResourceReader, IDisposable
+ {
+ #region Local Variables
+ private Stream stream;
+ private XmlTextReader reader;
+ private Hashtable hasht;
+ private ITypeResolutionService typeresolver;
+ #endregion // Local Variables
+
+ #region Constructors & Destructor
+ public ResXResourceReader (Stream stream)
+ {
+ if (stream == null)
+ throw new ArgumentNullException ("Value cannot be null.");
+
+ if (!stream.CanRead)
+ throw new ArgumentException ("Stream was not readable.");
+
+ this.stream = stream;
+ basic_setup ();
+ }
+
+ public ResXResourceReader (Stream stream, ITypeResolutionService typeresolver) : this(stream) {
+ this.typeresolver = typeresolver;
+ }
+
+ public ResXResourceReader (string fileName)
+ {
+ stream = File.OpenRead (fileName);
+ basic_setup ();
+ }
+
+ public ResXResourceReader (string fileName, ITypeResolutionService typeresolver) : this(fileName) {
+ this.typeresolver = typeresolver;
+ }
+
+ public ResXResourceReader(TextReader reader) {
+ this.reader = new XmlTextReader(reader);
+ this.hasht = new Hashtable();
+
+ load_data();
+ }
+
+ public ResXResourceReader (TextReader reader, ITypeResolutionService typeresolver) : this(reader) {
+ this.typeresolver = typeresolver;
+ }
+
+ ~ResXResourceReader() {
+ Dispose(false);
+ }
+ #endregion // Constructors & Destructor
+
+
+ #region Private Methods
+ void basic_setup () {
+ reader = new XmlTextReader (stream);
+ hasht = new Hashtable ();
+
+ if (!IsStreamValid()){
+ throw new ArgumentException("Stream is not a valid .resx file! It was possibly truncated.");
+ }
+ load_data ();
+ }
+
+ static string get_attr (XmlTextReader reader, string name) {
+ if (!reader.HasAttributes)
+ return null;
+ for (int i = 0; i < reader.AttributeCount; i++) {
+ reader.MoveToAttribute (i);
+ if (String.Compare (reader.Name, name, true) == 0) {
+ string v = reader.Value;
+ reader.MoveToElement ();
+ return v;
+ }
+ }
+ reader.MoveToElement ();
+ return null;
+ }
+
+ static string get_value (XmlTextReader reader, string name) {
+ bool gotelement = false;
+ while (reader.Read ()) {
+ if (reader.NodeType == XmlNodeType.Element && String.Compare (reader.Name, name, true) == 0) {
+ gotelement = true;
+ break;
+ }
+ }
+ if (!gotelement)
+ return null;
+ while (reader.Read ()) {
+ if (reader.NodeType == XmlNodeType.Text || reader.NodeType == XmlNodeType.CDATA) {
+ string v = reader.Value;
+ return v;
+ }
+ else if (reader.NodeType == XmlNodeType.EndElement && reader.Value == string.Empty)
+ {
+ string v = reader.Value;
+ return v;
+ }
+ }
+ return null;
+ }
+
+ private bool IsStreamValid() {
+ bool gotroot = false;
+ bool gotmime = false;
+
+ while (reader.Read ()) {
+ if (reader.NodeType == XmlNodeType.Element && String.Compare (reader.Name, "root", true) == 0) {
+ gotroot = true;
+ break;
+ }
+ }
+ if (!gotroot)
+ return false;
+ while (reader.Read ()) {
+ if (reader.NodeType == XmlNodeType.Element && String.Compare (reader.Name, "resheader", true) == 0) {
+ string v = get_attr (reader, "name");
+ if (v != null && String.Compare (v, "resmimetype", true) == 0) {
+ v = get_value (reader, "value");
+ if (String.Compare (v, "text/microsoft-resx", true) == 0) {
+ gotmime = true;
+ break;
+ }
+ }
+ } else if (reader.NodeType == XmlNodeType.Element && String.Compare (reader.Name, "data", true) == 0) {
+ /* resheader apparently can appear anywhere, so we collect
+ * the data even if we haven't validated yet.
+ */
+ string n = get_attr (reader, "name");
+ if (n != null) {
+ string v = get_value (reader, "value");
+ hasht [n] = v;
+ }
+ }
+ }
+ return gotmime;
+ }
+
+ private void load_data ()
+ {
+ while (reader.Read ()) {
+ if (reader.NodeType == XmlNodeType.Element && String.Compare (reader.Name, "data", true) == 0) {
+ string n = get_attr (reader, "name");
+ string t = get_attr (reader, "type");
+ string mt = get_attr (reader, "mimetype");
+
+ Type tt = t == null ? null : Type.GetType (t);
+
+ if (t != null && tt == null) {
+ throw new SystemException ("The type `" + t +"' could not be resolved");
+ }
+ if (tt == typeof (ResXNullRef)) {
+ hasht [n] = null;
+ continue;
+ }
+ if (n != null) {
+ object v = null;
+ string val = get_value (reader, "value");
+
+ if (mt != null && tt != null) {
+ TypeConverter c = TypeDescriptor.GetConverter (tt);
+ v = c.ConvertFrom (Convert.FromBase64String (val));
+ } else if (tt != null) {
+ // MS seems to handle Byte[] without any mimetype :-(
+ if (t.StartsWith("System.Byte[], mscorlib")) {
+ v = Convert.FromBase64String(val);
+ } else {
+ TypeConverter c = TypeDescriptor.GetConverter (tt);
+ v = c.ConvertFromInvariantString (val);
+ }
+ } else if (mt != null) {
+ byte [] data = Convert.FromBase64String (val);
+ BinaryFormatter f = new BinaryFormatter ();
+ using (MemoryStream s = new MemoryStream (data)) {
+ v = f.Deserialize (s);
+ }
+ } else {
+ v = val;
+ }
+ hasht [n] = v;
+ }
+ }
+ }
+ }
+
+ private Type GetType(string type) {
+ if (typeresolver == null) {
+ return Type.GetType(type);
+ } else {
+ return typeresolver.GetType(type);
+ }
+ }
+ #endregion // Private Methods
+
+ #region Public Methods
+ public void Close ()
+ {
+ if (stream != null) {
+ stream.Close ();
+ stream = null;
+ }
+
+ if (reader != null) {
+ reader.Close();
+ reader = null;
+ }
+ }
+
+ public IDictionaryEnumerator GetEnumerator () {
+ if (null == stream){
+ throw new InvalidOperationException("ResourceReader is closed.");
+ }
+ else {
+ return hasht.GetEnumerator ();
+ }
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return ((IResourceReader) this).GetEnumerator();
+ }
+
+ void IDisposable.Dispose ()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing) {
+ if (disposing) {
+ Close();
+ }
+ }
+
+ public static ResXResourceReader FromFileContents(string fileContents) {
+ return new ResXResourceReader(new StringReader(fileContents));
+ }
+
+ public static ResXResourceReader FromFileContents(string fileContents, ITypeResolutionService typeResolver) {
+ return new ResXResourceReader(new StringReader(fileContents), typeResolver);
+ }
+
+ #endregion // Public Methods
+
+ } // public sealed class ResXResourceReader
+} // namespace System.Resources
diff --git a/mcs/class/Managed.Windows.Forms/System.Resources/ResXResourceSet.cs b/mcs/class/Managed.Windows.Forms/System.Resources/ResXResourceSet.cs
new file mode 100644
index 00000000000..5fc589a41d6
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Resources/ResXResourceSet.cs
@@ -0,0 +1,63 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+using System;
+using System.IO;
+using System.Collections;
+
+namespace System.Resources {
+ public class ResXResourceSet : ResourceSet {
+ #region Local Variables
+
+ #endregion // Local Variables
+
+ #region Public Constructors
+ public ResXResourceSet(Stream stream) {
+ this.Reader = new ResXResourceReader(stream);
+ this.Table = new Hashtable();
+ this.ReadResources();
+ }
+
+ public ResXResourceSet(string fileName) {
+ this.Reader = new ResXResourceReader(fileName);
+ this.Table = new Hashtable();
+ this.ReadResources();
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Methods
+ public override Type GetDefaultReader() {
+ return typeof(ResXResourceReader);
+ }
+
+ public override Type GetDefaultWriter() {
+ return typeof(ResXResourceWriter);
+ }
+ #endregion // Public Instance Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Resources/ResXResourceWriter.cs b/mcs/class/Managed.Windows.Forms/System.Resources/ResXResourceWriter.cs
new file mode 100644
index 00000000000..76da29c1cef
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Resources/ResXResourceWriter.cs
@@ -0,0 +1,336 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Duncan Mak duncan@ximian.com
+// Gonzalo Paniagua Javier gonzalo@ximian.com
+// Peter Bartok pbartok@novell.com
+//
+
+// COMPLETE
+
+using System.ComponentModel;
+using System.IO;
+using System.Runtime.Serialization.Formatters.Binary;
+using System.Text;
+using System.Xml;
+
+namespace System.Resources
+{
+ public class ResXResourceWriter : IResourceWriter, IDisposable
+ {
+ #region Local Variables
+ private string filename;
+ private Stream stream;
+ private TextWriter textwriter;
+ private XmlTextWriter writer;
+ private bool written;
+ #endregion // Local Variables
+
+ #region Static Fields
+ public static readonly string BinSerializedObjectMimeType = "application/x-microsoft.net.object.binary.base64";
+ public static readonly string ByteArraySerializedObjectMimeType = "application/x-microsoft.net.object.bytearray.base64";
+ public static readonly string DefaultSerializedObjectMimeType = BinSerializedObjectMimeType;
+ public static readonly string ResMimeType = "text/microsoft-resx";
+ public static readonly string ResourceSchema = schema;
+ public static readonly string SoapSerializedObjectMimeType = "application/x-microsoft.net.object.soap.base64";
+ public static readonly string Version = "1.3";
+ #endregion // Static Fields
+
+ #region Constructors & Destructor
+ public ResXResourceWriter (Stream stream)
+ {
+ if (stream == null)
+ throw new ArgumentNullException ("stream");
+
+ if (stream.CanWrite == false)
+ throw new ArgumentException ("stream is not writable.", "stream");
+
+ this.stream = stream;
+ }
+
+ public ResXResourceWriter (TextWriter textwriter)
+ {
+ if (textwriter == null)
+ throw new ArgumentNullException ("textwriter");
+
+ this.textwriter = textwriter;
+ }
+
+ public ResXResourceWriter (string fileName)
+ {
+ if (fileName == null)
+ throw new ArgumentNullException ("fileName");
+
+ this.filename = fileName;
+ }
+
+ ~ResXResourceWriter() {
+ Dispose(false);
+ }
+ #endregion // Constructors & Destructor
+
+ void InitWriter ()
+ {
+ if (filename != null) {
+ stream = File.OpenWrite (filename);
+ textwriter = new StreamWriter (stream, Encoding.UTF8);
+ }
+
+ writer = new XmlTextWriter (textwriter);
+ writer.Formatting = Formatting.Indented;
+ writer.WriteStartDocument ();
+ writer.WriteStartElement ("root");
+ writer.WriteRaw (schema);
+ WriteHeader ("resmimetype", "text/microsoft-resx");
+ WriteHeader ("version", "1.3");
+ WriteHeader ("reader", typeof (ResXResourceReader).AssemblyQualifiedName);
+ WriteHeader ("writer", typeof (ResXResourceWriter).AssemblyQualifiedName);
+ }
+
+ void WriteHeader (string name, string value)
+ {
+ writer.WriteStartElement ("resheader");
+ writer.WriteAttributeString ("name", name);
+ writer.WriteStartElement ("value");
+ writer.WriteString (value);
+ writer.WriteEndElement ();
+ writer.WriteEndElement ();
+ }
+
+ void WriteNiceBase64(byte[] value, int offset, int length) {
+ string b64;
+ StringBuilder sb;
+ int pos;
+ int inc;
+ string ins;
+
+ b64 = Convert.ToBase64String(value, offset, length);
+
+ // Wild guess; two extra newlines, and one newline/tab pair for every 80 chars
+ sb = new StringBuilder(b64, b64.Length + ((b64.Length + 160) / 80) * 3);
+ pos = 0;
+ inc = 80 + Environment.NewLine.Length + 1;
+ ins = Environment.NewLine + "\t";
+ while (pos < sb.Length) {
+ sb.Insert(pos, ins);
+ pos += inc;
+ }
+ sb.Insert(sb.Length, Environment.NewLine);
+ writer.WriteString(sb.ToString());
+ }
+
+ void WriteBytes (string name, string typename, byte [] value, int offset, int length)
+ {
+ writer.WriteStartElement ("data");
+ writer.WriteAttributeString ("name", name);
+
+ if (typename != null) {
+ writer.WriteAttributeString ("type", typename);
+ writer.WriteStartElement ("value");
+ WriteNiceBase64(value, offset, length);
+ } else {
+ writer.WriteAttributeString ("mimetype",
+ "application/x-microsoft.net.object.binary.base64");
+ writer.WriteStartElement ("value");
+ writer.WriteBase64 (value, offset, length);
+ }
+
+ writer.WriteEndElement ();
+ writer.WriteEndElement ();
+ }
+
+ void WriteBytes (string name, string typename, byte [] value)
+ {
+ WriteBytes (name, typename, value, 0, value.Length);
+ }
+
+ void WriteString (string name, string value)
+ {
+ WriteString (name, value, null);
+ }
+
+ void WriteString (string name, string value, string typename)
+ {
+ writer.WriteStartElement ("data");
+ writer.WriteAttributeString ("name", name);
+ if (typename != null)
+ writer.WriteAttributeString ("type", typename);
+ writer.WriteStartElement ("value");
+ writer.WriteString (value);
+ writer.WriteEndElement ();
+ writer.WriteEndElement ();
+ writer.WriteWhitespace ("\n ");
+ }
+
+ public void AddResource (string name, byte [] value)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+
+ if (value == null)
+ throw new ArgumentNullException ("value");
+
+ if (written)
+ throw new InvalidOperationException ("The resource is already generated.");
+
+ if (writer == null)
+ InitWriter ();
+
+ WriteBytes (name, value.GetType ().AssemblyQualifiedName, value);
+ }
+
+ public void AddResource (string name, object value)
+ {
+ if (value is string) {
+ AddResource (name, (string) value);
+ return;
+ }
+
+ if (value is byte[]) {
+ AddResource (name, (byte[]) value);
+ return;
+ }
+
+ if (name == null)
+ throw new ArgumentNullException ("name");
+
+ if (value == null)
+ throw new ArgumentNullException ("value");
+
+ if (written)
+ throw new InvalidOperationException ("The resource is already generated.");
+
+ if (writer == null)
+ InitWriter ();
+
+ TypeConverter converter = TypeDescriptor.GetConverter (value);
+ if (converter != null && converter.CanConvertTo (typeof (string)) && converter.CanConvertFrom (typeof (string))) {
+ string str = (string) converter.ConvertToInvariantString (value);
+ WriteString (name, str, value.GetType ().AssemblyQualifiedName);
+ return;
+ }
+
+ if (converter != null && converter.CanConvertTo (typeof (byte[])) && converter.CanConvertFrom (typeof (byte[]))) {
+ byte[] b = (byte[]) converter.ConvertTo (value, typeof (byte[]));
+ WriteBytes (name, value.GetType().AssemblyQualifiedName, b);
+ return;
+ }
+
+ MemoryStream ms = new MemoryStream ();
+ BinaryFormatter fmt = new BinaryFormatter ();
+ try {
+ fmt.Serialize (ms, value);
+ } catch (Exception e) {
+ throw new InvalidOperationException ("Cannot add a " + value.GetType () +
+ "because it cannot be serialized: " +
+ e.Message);
+ }
+
+ WriteBytes (name, null, ms.GetBuffer (), 0, (int) ms.Length);
+ ms.Close ();
+ }
+
+ public void AddResource (string name, string value)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+
+ if (value == null)
+ throw new ArgumentNullException ("value");
+
+ if (written)
+ throw new InvalidOperationException ("The resource is already generated.");
+
+ if (writer == null)
+ InitWriter ();
+
+ WriteString (name, value);
+ }
+
+ public void Close ()
+ {
+ if (!written) {
+ Generate ();
+ }
+
+ if (writer != null) {
+ writer.Close ();
+ stream = null;
+ filename = null;
+ textwriter = null;
+ }
+ }
+
+ public void Dispose ()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ public void Generate ()
+ {
+ if (written)
+ throw new InvalidOperationException ("The resource is already generated.");
+
+ written = true;
+ writer.WriteEndElement ();
+ writer.Flush ();
+ }
+
+ protected virtual void Dispose(bool disposing) {
+ if (disposing) {
+ Close();
+ }
+ }
+
+ static string schema = @"
+ <xsd:schema id='root' xmlns='' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'>
+ <xsd:element name='root' msdata:IsDataSet='true'>
+ <xsd:complexType>
+ <xsd:choice maxOccurs='unbounded'>
+ <xsd:element name='data'>
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name='value' type='xsd:string' minOccurs='0' msdata:Ordinal='1' />
+ <xsd:element name='comment' type='xsd:string' minOccurs='0' msdata:Ordinal='2' />
+ </xsd:sequence>
+ <xsd:attribute name='name' type='xsd:string' msdata:Ordinal='1' />
+ <xsd:attribute name='type' type='xsd:string' msdata:Ordinal='3' />
+ <xsd:attribute name='mimetype' type='xsd:string' msdata:Ordinal='4' />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name='resheader'>
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name='value' type='xsd:string' minOccurs='0' msdata:Ordinal='1' />
+ </xsd:sequence>
+ <xsd:attribute name='name' type='xsd:string' use='required' />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+".Replace ("'", "\"");
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Design/ChangeLog b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Design/ChangeLog
new file mode 100644
index 00000000000..d836057885a
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Design/ChangeLog
@@ -0,0 +1,81 @@
+2005-12-01 Peter Dennis Bartok <pbartok@novell.com>
+
+ * ComponentEditorForm.cs: Added missing attribute
+
+2005-10-13 Peter Dennis Bartok <pbartok@novell.com>
+
+ * EventsTab.cs: Made .ctor() private to fix signature
+
+2005-05-14 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
+ * EventsTab.cs: Implementation start with many gaping holes
+
+2005-05-09 Marek Safar <marek.safar@seznam.cz>
+
+ * PropertyTab.cs: Implemented.
+
+2005-02-14 Peter Bartok <pbartok@novell.com>
+
+ * PropertyTab.cs: Made class abstract
+
+2004-04-14 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * AssemblyInfo.cs: Removed
+ * TODOAttribute.cs: Removed (duplicate)
+
+ * System.Windows.Forms.Design.csproj.user
+ * System.Windows.Forms.Design.csproj: Removed (outdated)
+
+ * WindowsFormsComponentEditor.cs
+ * ComponentEditorPage.cs: Added, mostly implemented
+
+ * ComponentEditor.cs: Removed (does not belong here)
+
+2004-02-24 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * IWindowsFormsEditorService.cs: Corrected casing,
+ it is not yet corrected in the filename, implemented
+
+2003-08-30 Alexandre Pigolkine <pigolkine@gmx.de>
+
+ * ComponentEditor.cs
+ * IUIService.cs: stubs added
+
+2003-03-31 Alan Tam <Tam@SiuLung.com>
+
+ * UITypeEditor.cs: Removed because it shan't be here
+
+2002-08-04 DennisHayes <dennish@raytek.com>
+
+ * Started cheanglog
+
+2002-08-04 DennisHayes <dennish@raytek.com>
+
+ * AnchorEditor.cs
+ * AxImporter.cs
+ * ComponentDocumentDesigner.cs
+ * ComponentEditorForm.cs: Stubbed out
+
+ * ComponentTray.cs
+ * ControlDesigner.cs
+ * ComponentEditor.cs
+ * DocumentDesigner.cs
+ * EventsTab.cs
+ * FileNameEditor.cs
+ * IMenuEditorService.cs
+ * IUIService.cs
+ * IWindowsformsEditorService.cs
+ * MenusCommands.cs
+ * ParentControlDesigner.cs
+ * PropertyTab.cs
+ * ScrollableControlDesigner.cs
+ * SelectionRules.cs
+ * UITypeEditor.cs: Class body defined only. No stubbs done.
+
+ * TODOAttribute.cs:
+ Used to mark unimplemented functions.
+
+ * System.Windows.Forms.Design.csproj
+ * System.Windows.Forms.Design.csproj.user
+ * AssemblyInfo.cs:
+ Needed for Visual Studio compile.
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Design/ComponentEditorForm.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Design/ComponentEditorForm.cs
new file mode 100644
index 00000000000..5221c0a96b4
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Design/ComponentEditorForm.cs
@@ -0,0 +1,76 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Dennis Hayes (dennish@raytek.com)
+
+// NOT COMPLETE
+
+using System;
+using System.ComponentModel;
+using System.Windows.Forms;
+
+namespace System.Windows.Forms.Design {
+ [ToolboxItem(false)]
+ public class ComponentEditorForm : Form {
+
+ [MonoTODO]
+ public ComponentEditorForm(object component, Type[] pageTypes){
+ }
+
+ [MonoTODO]
+ protected override void OnActivated(EventArgs e){
+ }
+
+ [MonoTODO]
+ protected virtual void OnSelChangeSelector(object source, TreeViewEventArgs e){
+ }
+
+ [MonoTODO]
+ public override bool PreProcessMessage(ref Message msg){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual DialogResult ShowForm(){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual DialogResult ShowForm(int page){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual DialogResult ShowForm(IWin32Window owner){
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual DialogResult ShowForm(IWin32Window owner, int page){
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ // can't override the function in control. bug in compiler. Fixed?
+ protected override void OnHelpRequested(HelpEventArgs e){
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Design/ComponentEditorPage.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Design/ComponentEditorPage.cs
new file mode 100644
index 00000000000..e21f225f8eb
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Design/ComponentEditorPage.cs
@@ -0,0 +1,188 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+
+using System.ComponentModel;
+using System.Drawing;
+
+namespace System.Windows.Forms.Design
+{
+ public abstract class ComponentEditorPage : Panel
+ {
+ private bool commitOnDeactivate = false;
+ private IComponent component;
+ private bool firstActivate = true;
+ private Icon icon;
+ private int loading = 0;
+ private bool loadRequired = false;
+ private IComponentEditorPageSite pageSite;
+
+ public ComponentEditorPage ()
+ {
+ }
+
+ public bool CommitOnDeactivate {
+ get { return commitOnDeactivate; }
+ set { commitOnDeactivate = value; }
+ }
+
+ protected IComponent Component {
+ get { return component; }
+ set { component = value; }
+ }
+
+ [MonoTODO ("Find out what this does.")]
+ protected override CreateParams CreateParams {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ protected bool FirstActivate {
+ get { return firstActivate; }
+ set { firstActivate = value; }
+ }
+
+ public Icon Icon {
+ get { return icon; }
+ set { icon = value; }
+ }
+
+ protected int Loading {
+ get { return loading; }
+ set { loading = value; }
+ }
+
+ protected bool LoadRequired {
+ get { return loadRequired; }
+ set { loadRequired = value; }
+ }
+
+ protected IComponentEditorPageSite PageSite {
+ get { return pageSite; }
+ set { pageSite = value; }
+ }
+
+ public virtual string Title {
+ get { return base.Text; }
+ }
+
+ public virtual void Activate ()
+ {
+ Visible = true;
+ firstActivate = false;
+ if (loadRequired) {
+ EnterLoadingMode ();
+ LoadComponent ();
+ ExitLoadingMode ();
+ }
+ }
+
+ public virtual void ApplyChanges ()
+ {
+ SaveComponent ();
+ }
+
+ public virtual void Deactivate ()
+ {
+ Visible = false;
+ }
+
+ protected void EnterLoadingMode ()
+ {
+ loading++;
+ }
+
+ protected void ExitLoadingMode ()
+ {
+ loading--;
+ }
+
+ public virtual Control GetControl ()
+ {
+ return this;
+ }
+
+ protected IComponent GetSelectedComponent ()
+ {
+ return component;
+ }
+
+ protected bool IsFirstActivate ()
+ {
+ return firstActivate;
+ }
+
+ protected bool IsLoading ()
+ {
+ return (loading != 0);
+ }
+
+ public virtual bool IsPageMessage (ref Message msg)
+ {
+ return PreProcessMessage (ref msg);
+ }
+
+ protected abstract void LoadComponent ();
+
+ [MonoTODO ("Find out what this does.")]
+ public virtual void OnApplyComplete ()
+ {
+ }
+
+ protected virtual void ReloadComponent ()
+ {
+ loadRequired = true;
+ }
+
+ protected abstract void SaveComponent ();
+
+ public virtual void SetComponent (IComponent component)
+ {
+ this.component = component;
+ ReloadComponent ();
+ }
+
+ [MonoTODO ("Find out what this does.")]
+ protected virtual void SetDirty ()
+ {
+ }
+
+ public virtual void SetSite (IComponentEditorPageSite site)
+ {
+ pageSite = site;
+ pageSite.GetControl ().Controls.Add (this);
+
+ }
+
+ public virtual void ShowHelp ()
+ {
+ }
+
+ public virtual bool SupportsHelp ()
+ {
+ return false;
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Design/EventsTab.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Design/EventsTab.cs
new file mode 100644
index 00000000000..f5f5e03a5fb
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Design/EventsTab.cs
@@ -0,0 +1,122 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Dennis Hayes (dennish@raytek.com)
+// Rafael Teixeira (rafaelteixeirabr@hotmail.com)
+//
+
+// NOT COMPLETE
+
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+
+namespace System.Windows.Forms.Design
+{
+ public class EventsTab : PropertyTab
+ {
+ [MonoTODO]
+ private EventsTab()
+ {
+ }
+
+ private IServiceProvider serviceProvider;
+
+ [MonoTODO]
+ public EventsTab(IServiceProvider serviceProvider)
+ {
+ this.serviceProvider = serviceProvider;
+ }
+
+ [MonoTODO("What value should we return?")]
+ public override string HelpKeyword
+ {
+ get {
+ return TabName;
+ }
+ }
+
+ [MonoTODO("Localization")]
+ public override string TabName
+ {
+ get {
+ return "Events";
+ }
+ }
+
+ [MonoTODO("Test")]
+ public override PropertyDescriptorCollection GetProperties(
+ ITypeDescriptorContext context,
+ object component,
+ Attribute[] attributes)
+ {
+ IEventBindingService eventPropertySvc = null;
+ EventDescriptorCollection events;
+
+ if (serviceProvider != null)
+ eventPropertySvc = (IEventBindingService)
+ serviceProvider.GetService(typeof(IEventBindingService));
+
+ if (eventPropertySvc == null)
+ return new PropertyDescriptorCollection(null);
+
+ if (attributes != null)
+ events = TypeDescriptor.GetEvents(component, attributes);
+ else
+ events = TypeDescriptor.GetEvents(component);
+
+ // Return event properties for the event descriptors.
+ return eventPropertySvc.GetEventProperties(events);
+ }
+
+ public override PropertyDescriptorCollection GetProperties(object component, Attribute[] attributes)
+ {
+ return this.GetProperties(null, component, attributes);
+ }
+
+ [MonoTODO]
+ public override bool CanExtend(object component)
+ {
+ return false;
+ }
+
+ [MonoTODO("Test")]
+ public override PropertyDescriptor GetDefaultProperty(object component)
+ {
+ object[] attributes = component.GetType().GetCustomAttributes(typeof(DefaultEventAttribute), true);
+ if (attributes.Length > 0) {
+ DefaultEventAttribute defaultEvent = attributes[0] as DefaultEventAttribute;
+ if (defaultEvent != null && serviceProvider != null) {
+ IEventBindingService eventPropertySvc = (IEventBindingService)
+ serviceProvider.GetService(typeof(IEventBindingService));
+
+ if (eventPropertySvc == null)
+ foreach (EventDescriptor ed in TypeDescriptor.GetEvents(component))
+ if (ed.Name == defaultEvent.Name)
+ return eventPropertySvc.GetEventProperty(ed);
+ }
+ }
+ return null;
+ }
+
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Design/IUIService.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Design/IUIService.cs
new file mode 100644
index 00000000000..e7bc6da80ec
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Design/IUIService.cs
@@ -0,0 +1,51 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+
+// NOT COMPLETE
+
+using System.Runtime.InteropServices;
+using System.Collections;
+
+namespace System.Windows.Forms.Design
+{
+ [Guid ("06a9c74b-5e32-4561-be73-381b37869f4f")]
+ public interface IUIService
+ {
+ IDictionary Styles {get;}
+
+ bool CanShowComponentEditor (object component);
+ IWin32Window GetDialogOwnerWindow ();
+ void SetUIDirty ();
+ bool ShowComponentEditor (object component, IWin32Window parent);
+ void ShowError (Exception ex);
+ void ShowError (string message);
+ void ShowError (Exception ex, string message);
+ DialogResult ShowDialog (Form form);
+ void ShowMessage (string message);
+ void ShowMessage (string message, string caption);
+ DialogResult ShowMessage (string message, string caption, MessageBoxButtons buttons);
+ bool ShowToolWindow (Guid toolWindow);
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Design/IWindowsFormsEditorService.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Design/IWindowsFormsEditorService.cs
new file mode 100644
index 00000000000..c68144917d8
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Design/IWindowsFormsEditorService.cs
@@ -0,0 +1,35 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+
+// NOT COMPLETE
+
+namespace System.Windows.Forms.Design
+{
+ public interface IWindowsFormsEditorService {
+ void CloseDropDown ();
+ void DropDownControl (Control control);
+ DialogResult ShowDialog (Form dialog);
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Design/PropertyTab.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Design/PropertyTab.cs
new file mode 100644
index 00000000000..08a1b6b3448
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Design/PropertyTab.cs
@@ -0,0 +1,101 @@
+// 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 Novell, Inc.
+//
+// Authors: Marek Safar (marek.safar@seznam.cz)
+//
+
+// COMPLETE
+
+using System.Drawing;
+using System.ComponentModel;
+
+namespace System.Windows.Forms.Design
+{
+ public abstract class PropertyTab: IExtenderProvider
+ {
+ Bitmap bitmap;
+ object[] components;
+
+ protected PropertyTab () {}
+
+ ~PropertyTab ()
+ {
+ Dispose (false);
+ }
+
+ public virtual Bitmap Bitmap {
+ get {
+ if (bitmap == null) {
+ Type t = base.GetType();
+ bitmap = new Bitmap (t, t.Name + ".bmp");
+ }
+ return bitmap;
+ }
+ }
+
+ public virtual object[] Components {
+ get { return components; }
+ set { components = value; }
+ }
+
+ public virtual string HelpKeyword {
+ get { return TabName; }
+ }
+
+ public abstract string TabName { get; }
+
+ public virtual bool CanExtend (object extendee)
+ {
+ return true;
+ }
+
+ public virtual void Dispose()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (disposing && bitmap != null) {
+ bitmap.Dispose ();
+ bitmap = null;
+ }
+ }
+
+ public virtual PropertyDescriptor GetDefaultProperty (object component)
+ {
+ return TypeDescriptor.GetDefaultProperty(component);
+ }
+
+ public virtual PropertyDescriptorCollection GetProperties (object component)
+ {
+ return GetProperties (component, null);
+ }
+
+ public abstract PropertyDescriptorCollection GetProperties (object component, Attribute[] attributes);
+
+ public virtual PropertyDescriptorCollection GetProperties (ITypeDescriptorContext context, object component, Attribute[] attributes)
+ {
+ return GetProperties (component, attributes);
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Design/WindowsFormsComponentEditor.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Design/WindowsFormsComponentEditor.cs
new file mode 100644
index 00000000000..1de8cecdaae
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Design/WindowsFormsComponentEditor.cs
@@ -0,0 +1,64 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+
+using System.ComponentModel;
+
+namespace System.Windows.Forms.Design
+{
+ public abstract class WindowsFormsComponentEditor : ComponentEditor
+ {
+ protected WindowsFormsComponentEditor ()
+ {
+ }
+
+ public override bool EditComponent (ITypeDescriptorContext context, object component)
+ {
+ return EditComponent (context, component, null);
+ }
+
+ public virtual bool EditComponent (ITypeDescriptorContext context, object component, IWin32Window owner)
+ {
+ ComponentEditorForm f = new ComponentEditorForm (component, GetComponentEditorPages ());
+ if (f.ShowForm (owner, GetInitialComponentEditorPageIndex ()) == DialogResult.OK)
+ return true;
+ return false;
+ }
+
+ public bool EditComponent (object component, IWin32Window owner)
+ {
+ return EditComponent (null, component, owner);
+ }
+
+ protected virtual Type[] GetComponentEditorPages ()
+ {
+ return null;
+ }
+
+ protected virtual int GetInitialComponentEditorPageIndex ()
+ {
+ return 0;
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/ChangeLog b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/ChangeLog
new file mode 100644
index 00000000000..8ded44833a4
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/ChangeLog
@@ -0,0 +1,45 @@
+2005-12-22 Peter Dennis Bartok <pbartok@novell.com>
+
+ * RTF.cs: Added method to allow setting the default font for the RTF
+ document. This font will be used if the document does not contain
+ a font table.
+ * Font.cs: Added method to delete font with a given number;
+ changed set_Num to call this method (to allow replacing fonts
+ with the same number, particulary the default font)
+
+2005-09-04 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Charcode.cs: Created; provides StandardCharCode <-> character
+ translation
+ * Charset.cs: Created; provides two standard charsets, AnsiGeneral
+ and AnsiSymbol
+ * CharsetFlags.cs: Created
+ * CharsetType.cs: Created
+ * ClassDelegate.cs: Created; allows consumer to register a callback
+ for RTF command classes
+ * Color.cs: Created; provides access to RTF-defined RGB color sets
+ * DestinationDelegate.cs: Created; allows consumer to register a
+ callback for Destination class types
+ * Font.cs: Created; provides access to RTF-defined font descriptions
+ * KeysInit.cs: Created; provides translation table from RTF keyword
+ to Major/Minor classes
+ * KeyStruct.cs: Created
+ * Major.cs: Created; describes available RTF command groups
+ * Minor.cs: Created; describes available 'arguments' for command groups
+ * README: Created
+ * RTF.cs: Created; contains main RTF parser code
+ * rtf.csproj: Created; provides Visual Studio project that allows to
+ use test this assembly via the included test.cs
+ to provide
+ * RTFException.cs: Created; provides custom RTF exception class
+ * StandardCharCode.cs: Created
+ * StandardCharName.cs: Created
+ * Style.cs: Created; provides access to RTF-define styles
+ * StyleElement.cs: Created; provides support class to allow parsing
+ recursive styles
+ * StyleType.cs: Created
+ * test.cs: Test code showing use of RTF class (also acts as Main for
+ the included Visual Studio project)
+ * TextMap.cs: Created; allows to create simple translation table for
+ converting parsed RTF document to text; table-based
+ * TokenClass.cs: Created; describes all available RTF command classes
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Charcode.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Charcode.cs
new file mode 100644
index 00000000000..600c74450ba
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Charcode.cs
@@ -0,0 +1,405 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+using System.Collections;
+
+namespace System.Windows.Forms.RTF {
+ internal class Charcode {
+ #region Local Variables
+ private StandardCharCode[] codes;
+ private Hashtable reverse;
+ private int size;
+ #endregion // Local Variables
+
+ #region Public Constructors
+ public Charcode() : this(256) {
+ }
+
+ private Charcode(int size) {
+ this.size = size;
+ this.codes = new StandardCharCode[size];
+ this.reverse = new Hashtable(size);
+
+ for (int i = 0; i < size; i++) {
+ codes[i] = StandardCharCode.nothing;
+ }
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public int this[StandardCharCode c] {
+ get {
+ object obj;
+
+ obj = reverse[c];
+ if (obj != null) {
+ return (int)obj;
+ }
+ for (int i = 0; i < size; i++) {
+ if (codes[i] == c) {
+ return i;
+ }
+ }
+
+ return -1;
+ }
+ }
+
+ public StandardCharCode this[int c] {
+ get {
+ if (c < 0 || c >= size) {
+ return StandardCharCode.nothing;
+ }
+
+ return codes[c];
+ }
+
+ set {
+ if (c < 0 || c >= size) {
+ return;
+ }
+
+ codes[c] = value;
+ reverse[value] = c;
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Instance Methods
+ #endregion // Public Instance Methods
+
+ #region Public Static Methods
+ public static Charcode AnsiGeneric {
+ get {
+ Charcode code = new Charcode(256);
+
+ code[0x06] = StandardCharCode.formula;
+ code[0x1e] = StandardCharCode.nobrkhyphen;
+ code[0x1f] = StandardCharCode.opthyphen;
+ code[' '] = StandardCharCode.space;
+ code['!'] = StandardCharCode.exclam;
+ code['"'] = StandardCharCode.quotedbl;
+ code['#'] = StandardCharCode.numbersign;
+ code['$'] = StandardCharCode.dollar;
+ code['%'] = StandardCharCode.percent;
+ code['&'] = StandardCharCode.ampersand;
+ code['\\'] = StandardCharCode.quoteright;
+ code['('] = StandardCharCode.parenleft;
+ code[')'] = StandardCharCode.parenright;
+ code['*'] = StandardCharCode.asterisk;
+ code['+'] = StandardCharCode.plus;
+ code[','] = StandardCharCode.comma;
+ code['-'] = StandardCharCode.hyphen;
+ code['.'] = StandardCharCode.period;
+ code['/'] = StandardCharCode.slash;
+ code['0'] = StandardCharCode.zero;
+ code['1'] = StandardCharCode.one;
+ code['2'] = StandardCharCode.two;
+ code['3'] = StandardCharCode.three;
+ code['4'] = StandardCharCode.four;
+ code['5'] = StandardCharCode.five;
+ code['6'] = StandardCharCode.six;
+ code['7'] = StandardCharCode.seven;
+ code['8'] = StandardCharCode.eight;
+ code['9'] = StandardCharCode.nine;
+ code[':'] = StandardCharCode.colon;
+ code[';'] = StandardCharCode.semicolon;
+ code['<'] = StandardCharCode.less;
+ code['='] = StandardCharCode.equal;
+ code['>'] = StandardCharCode.greater;
+ code['?'] = StandardCharCode.question;
+ code['@'] = StandardCharCode.at;
+ code['A'] = StandardCharCode.A;
+ code['B'] = StandardCharCode.B;
+ code['C'] = StandardCharCode.C;
+ code['D'] = StandardCharCode.D;
+ code['E'] = StandardCharCode.E;
+ code['F'] = StandardCharCode.F;
+ code['G'] = StandardCharCode.G;
+ code['H'] = StandardCharCode.H;
+ code['I'] = StandardCharCode.I;
+ code['J'] = StandardCharCode.J;
+ code['K'] = StandardCharCode.K;
+ code['L'] = StandardCharCode.L;
+ code['M'] = StandardCharCode.M;
+ code['N'] = StandardCharCode.N;
+ code['O'] = StandardCharCode.O;
+ code['P'] = StandardCharCode.P;
+ code['Q'] = StandardCharCode.Q;
+ code['R'] = StandardCharCode.R;
+ code['S'] = StandardCharCode.S;
+ code['T'] = StandardCharCode.T;
+ code['U'] = StandardCharCode.U;
+ code['V'] = StandardCharCode.V;
+ code['W'] = StandardCharCode.W;
+ code['X'] = StandardCharCode.X;
+ code['Y'] = StandardCharCode.Y;
+ code['Z'] = StandardCharCode.Z;
+ code['['] = StandardCharCode.bracketleft;
+ code['\\'] = StandardCharCode.backslash;
+ code[']'] = StandardCharCode.bracketright;
+ code['^'] = StandardCharCode.asciicircum;
+ code['_'] = StandardCharCode.underscore;
+ code['`'] = StandardCharCode.quoteleft;
+ code['a'] = StandardCharCode.a;
+ code['b'] = StandardCharCode.b;
+ code['c'] = StandardCharCode.c;
+ code['d'] = StandardCharCode.d;
+ code['e'] = StandardCharCode.e;
+ code['f'] = StandardCharCode.f;
+ code['g'] = StandardCharCode.g;
+ code['h'] = StandardCharCode.h;
+ code['i'] = StandardCharCode.i;
+ code['j'] = StandardCharCode.j;
+ code['k'] = StandardCharCode.k;
+ code['l'] = StandardCharCode.l;
+ code['m'] = StandardCharCode.m;
+ code['n'] = StandardCharCode.n;
+ code['o'] = StandardCharCode.o;
+ code['p'] = StandardCharCode.p;
+ code['q'] = StandardCharCode.q;
+ code['r'] = StandardCharCode.r;
+ code['s'] = StandardCharCode.s;
+ code['t'] = StandardCharCode.t;
+ code['u'] = StandardCharCode.u;
+ code['v'] = StandardCharCode.v;
+ code['w'] = StandardCharCode.w;
+ code['x'] = StandardCharCode.x;
+ code['y'] = StandardCharCode.y;
+ code['z'] = StandardCharCode.z;
+ code['{'] = StandardCharCode.braceleft;
+ code['|'] = StandardCharCode.bar;
+ code['}'] = StandardCharCode.braceright;
+ code['~'] = StandardCharCode.asciitilde;
+ code[0xa0] = StandardCharCode.nobrkspace;
+ code[0xa1] = StandardCharCode.exclamdown;
+ code[0xa2] = StandardCharCode.cent;
+ code[0xa3] = StandardCharCode.sterling;
+ code[0xa4] = StandardCharCode.currency;
+ code[0xa5] = StandardCharCode.yen;
+ code[0xa6] = StandardCharCode.brokenbar;
+ code[0xa7] = StandardCharCode.section;
+ code[0xa8] = StandardCharCode.dieresis;
+ code[0xa9] = StandardCharCode.copyright;
+ code[0xaa] = StandardCharCode.ordfeminine;
+ code[0xab] = StandardCharCode.guillemotleft;
+ code[0xac] = StandardCharCode.logicalnot;
+ code[0xad] = StandardCharCode.opthyphen;
+ code[0xae] = StandardCharCode.registered;
+ code[0xaf] = StandardCharCode.macron;
+ code[0xb0] = StandardCharCode.degree;
+ code[0xb1] = StandardCharCode.plusminus;
+ code[0xb2] = StandardCharCode.twosuperior;
+ code[0xb3] = StandardCharCode.threesuperior;
+ code[0xb4] = StandardCharCode.acute;
+ code[0xb5] = StandardCharCode.mu;
+ code[0xb6] = StandardCharCode.paragraph;
+ code[0xb7] = StandardCharCode.periodcentered;
+ code[0xb8] = StandardCharCode.cedilla;
+ code[0xb9] = StandardCharCode.onesuperior;
+ code[0xba] = StandardCharCode.ordmasculine;
+ code[0xbb] = StandardCharCode.guillemotright;
+ code[0xbc] = StandardCharCode.onequarter;
+ code[0xbd] = StandardCharCode.onehalf;
+ code[0xbe] = StandardCharCode.threequarters;
+ code[0xbf] = StandardCharCode.questiondown;
+ code[0xc0] = StandardCharCode.Agrave;
+ code[0xc1] = StandardCharCode.Aacute;
+ code[0xc2] = StandardCharCode.Acircumflex;
+ code[0xc3] = StandardCharCode.Atilde;
+ code[0xc4] = StandardCharCode.Adieresis;
+ code[0xc5] = StandardCharCode.Aring;
+ code[0xc6] = StandardCharCode.AE;
+ code[0xc7] = StandardCharCode.Ccedilla;
+ code[0xc8] = StandardCharCode.Egrave;
+ code[0xc9] = StandardCharCode.Eacute;
+ code[0xca] = StandardCharCode.Ecircumflex;
+ code[0xcb] = StandardCharCode.Edieresis;
+ code[0xcc] = StandardCharCode.Igrave;
+ code[0xcd] = StandardCharCode.Iacute;
+ code[0xce] = StandardCharCode.Icircumflex;
+ code[0xcf] = StandardCharCode.Idieresis;
+ code[0xd0] = StandardCharCode.Eth;
+ code[0xd1] = StandardCharCode.Ntilde;
+ code[0xd2] = StandardCharCode.Ograve;
+ code[0xd3] = StandardCharCode.Oacute;
+ code[0xd4] = StandardCharCode.Ocircumflex;
+ code[0xd5] = StandardCharCode.Otilde;
+ code[0xd6] = StandardCharCode.Odieresis;
+ code[0xd7] = StandardCharCode.multiply;
+ code[0xd8] = StandardCharCode.Oslash;
+ code[0xd9] = StandardCharCode.Ugrave;
+ code[0xda] = StandardCharCode.Uacute;
+ code[0xdb] = StandardCharCode.Ucircumflex;
+ code[0xdc] = StandardCharCode.Udieresis;
+ code[0xdd] = StandardCharCode.Yacute;
+ code[0xde] = StandardCharCode.Thorn;
+ code[0xdf] = StandardCharCode.germandbls;
+ code[0xe0] = StandardCharCode.agrave;
+ code[0xe1] = StandardCharCode.aacute;
+ code[0xe2] = StandardCharCode.acircumflex;
+ code[0xe3] = StandardCharCode.atilde;
+ code[0xe4] = StandardCharCode.adieresis;
+ code[0xe5] = StandardCharCode.aring;
+ code[0xe6] = StandardCharCode.ae;
+ code[0xe7] = StandardCharCode.ccedilla;
+ code[0xe8] = StandardCharCode.egrave;
+ code[0xe9] = StandardCharCode.eacute;
+ code[0xea] = StandardCharCode.ecircumflex;
+ code[0xeb] = StandardCharCode.edieresis;
+ code[0xec] = StandardCharCode.igrave;
+ code[0xed] = StandardCharCode.iacute;
+ code[0xee] = StandardCharCode.icircumflex;
+ code[0xef] = StandardCharCode.idieresis;
+ code[0xf0] = StandardCharCode.eth;
+ code[0xf1] = StandardCharCode.ntilde;
+ code[0xf2] = StandardCharCode.ograve;
+ code[0xf3] = StandardCharCode.oacute;
+ code[0xf4] = StandardCharCode.ocircumflex;
+ code[0xf5] = StandardCharCode.otilde;
+ code[0xf6] = StandardCharCode.odieresis;
+ code[0xf7] = StandardCharCode.divide;
+ code[0xf8] = StandardCharCode.oslash;
+ code[0xf9] = StandardCharCode.ugrave;
+ code[0xfa] = StandardCharCode.uacute;
+ code[0xfb] = StandardCharCode.ucircumflex;
+ code[0xfc] = StandardCharCode.udieresis;
+ code[0xfd] = StandardCharCode.yacute;
+ code[0xfe] = StandardCharCode.thorn;
+ code[0xff] = StandardCharCode.ydieresis;
+
+ return code;
+ }
+ }
+
+ public static Charcode AnsiSymbol {
+ get {
+ Charcode code = new Charcode(256);
+
+ code[0x06] = StandardCharCode.formula;
+ code[0x1e] = StandardCharCode.nobrkhyphen;
+ code[0x1f] = StandardCharCode.opthyphen;
+ code[' '] = StandardCharCode.space;
+ code['!'] = StandardCharCode.exclam;
+ code['"'] = StandardCharCode.universal;
+ code['#'] = StandardCharCode.mathnumbersign;
+ code['$'] = StandardCharCode.existential;
+ code['%'] = StandardCharCode.percent;
+ code['&'] = StandardCharCode.ampersand;
+ code['\\'] = StandardCharCode.suchthat;
+ code['('] = StandardCharCode.parenleft;
+ code[')'] = StandardCharCode.parenright;
+ code['*'] = StandardCharCode.mathasterisk;
+ code['+'] = StandardCharCode.mathplus;
+ code[','] = StandardCharCode.comma;
+ code['-'] = StandardCharCode.mathminus;
+ code['.'] = StandardCharCode.period;
+ code['/'] = StandardCharCode.slash;
+ code['0'] = StandardCharCode.zero;
+ code['1'] = StandardCharCode.one;
+ code['2'] = StandardCharCode.two;
+ code['3'] = StandardCharCode.three;
+ code['4'] = StandardCharCode.four;
+ code['5'] = StandardCharCode.five;
+ code['6'] = StandardCharCode.six;
+ code['7'] = StandardCharCode.seven;
+ code['8'] = StandardCharCode.eight;
+ code['9'] = StandardCharCode.nine;
+ code[':'] = StandardCharCode.colon;
+ code[';'] = StandardCharCode.semicolon;
+ code['<'] = StandardCharCode.less;
+ code['='] = StandardCharCode.mathequal;
+ code['>'] = StandardCharCode.greater;
+ code['?'] = StandardCharCode.question;
+ code['@'] = StandardCharCode.congruent;
+ code['A'] = StandardCharCode.Alpha;
+ code['B'] = StandardCharCode.Beta;
+ code['C'] = StandardCharCode.Chi;
+ code['D'] = StandardCharCode.Delta;
+ code['E'] = StandardCharCode.Epsilon;
+ code['F'] = StandardCharCode.Phi;
+ code['G'] = StandardCharCode.Gamma;
+ code['H'] = StandardCharCode.Eta;
+ code['I'] = StandardCharCode.Iota;
+ code['K'] = StandardCharCode.Kappa;
+ code['L'] = StandardCharCode.Lambda;
+ code['M'] = StandardCharCode.Mu;
+ code['N'] = StandardCharCode.Nu;
+ code['O'] = StandardCharCode.Omicron;
+ code['P'] = StandardCharCode.Pi;
+ code['Q'] = StandardCharCode.Theta;
+ code['R'] = StandardCharCode.Rho;
+ code['S'] = StandardCharCode.Sigma;
+ code['T'] = StandardCharCode.Tau;
+ code['U'] = StandardCharCode.Upsilon;
+ code['V'] = StandardCharCode.varsigma;
+ code['W'] = StandardCharCode.Omega;
+ code['X'] = StandardCharCode.Xi;
+ code['Y'] = StandardCharCode.Psi;
+ code['Z'] = StandardCharCode.Zeta;
+ code['['] = StandardCharCode.bracketleft;
+ code['\\'] = StandardCharCode.backslash;
+ code[']'] = StandardCharCode.bracketright;
+ code['^'] = StandardCharCode.asciicircum;
+ code['_'] = StandardCharCode.underscore;
+ code['`'] = StandardCharCode.quoteleft;
+ code['a'] = StandardCharCode.alpha;
+ code['b'] = StandardCharCode.beta;
+ code['c'] = StandardCharCode.chi;
+ code['d'] = StandardCharCode.delta;
+ code['e'] = StandardCharCode.epsilon;
+ code['f'] = StandardCharCode.phi;
+ code['g'] = StandardCharCode.gamma;
+ code['h'] = StandardCharCode.eta;
+ code['i'] = StandardCharCode.iota;
+ code['k'] = StandardCharCode.kappa;
+ code['l'] = StandardCharCode.lambda;
+ code['m'] = StandardCharCode.mu;
+ code['n'] = StandardCharCode.nu;
+ code['o'] = StandardCharCode.omicron;
+ code['p'] = StandardCharCode.pi;
+ code['q'] = StandardCharCode.theta;
+ code['r'] = StandardCharCode.rho;
+ code['s'] = StandardCharCode.sigma;
+ code['t'] = StandardCharCode.tau;
+ code['u'] = StandardCharCode.upsilon;
+ code['w'] = StandardCharCode.omega;
+ code['x'] = StandardCharCode.xi;
+ code['y'] = StandardCharCode.psi;
+ code['z'] = StandardCharCode.zeta;
+ code['{'] = StandardCharCode.braceleft;
+ code['|'] = StandardCharCode.bar;
+ code['}'] = StandardCharCode.braceright;
+ code['~'] = StandardCharCode.mathtilde;
+
+ return code;
+ }
+ }
+ #endregion // Public Static Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Charset.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Charset.cs
new file mode 100644
index 00000000000..5e093b4254c
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Charset.cs
@@ -0,0 +1,159 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+using System;
+
+// COMPLETE
+
+namespace System.Windows.Forms.RTF {
+ internal class Charset {
+ #region Local Variables
+ private CharsetType id;
+ private CharsetFlags flags;
+ private Charcode code;
+ private string file;
+ private bool loaded;
+ #endregion // Local Variables
+
+ #region Public Constructors
+ public Charset() {
+ flags = CharsetFlags.Read | CharsetFlags.Switch;
+ id = CharsetType.General;
+ file = string.Empty;
+ loaded = false;
+ this.ReadMap();
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public Charcode Code {
+ get {
+ return code;
+ }
+
+ set {
+ code = value;
+ }
+ }
+
+ public CharsetFlags Flags {
+ get {
+ return flags;
+ }
+
+ set {
+ flags = value;
+ }
+ }
+
+ public CharsetType ID {
+ get {
+ return id;
+ }
+
+ set {
+ switch(value) {
+ case CharsetType.Symbol: {
+ id = CharsetType.Symbol;
+ return;
+ }
+
+ default:
+ case CharsetType.General: {
+ id = CharsetType.General;
+ return;
+ }
+ }
+ }
+ }
+
+ public string File {
+ get {
+ return file;
+ }
+
+ set {
+ if (file != value) {
+ file = value;
+ loaded = false;
+ }
+ }
+ }
+
+ public StandardCharCode this[int c] {
+ get {
+ return code[c];
+ }
+ }
+
+ #endregion // Public Instance Properties
+
+ #region Public Instance Methods
+ public bool ReadMap() {
+ switch (id) {
+ case CharsetType.General: {
+ if (file == string.Empty) {
+ code = Charcode.AnsiGeneric;
+ return true;
+ }
+ // FIXME - implement reading charmap from file...
+ return true;
+ }
+
+ case CharsetType.Symbol: {
+ if (file == string.Empty) {
+ code = Charcode.AnsiSymbol;
+ return true;
+ }
+
+ // FIXME - implement reading charmap from file...
+ return true;
+ }
+
+ default: {
+ return false;
+ }
+ }
+ }
+
+ public char StdCharCode(string name) {
+ // FIXME - finish this
+ return ' ';
+
+ }
+
+ public string StdCharName(char code) {
+ // FIXME - finish this
+ return String.Empty;
+ }
+
+ public StandardCharCode MapChar(char c) {
+ return code[c];
+
+ }
+ #endregion // Public Instance Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/CharsetFlags.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/CharsetFlags.cs
new file mode 100644
index 00000000000..4a9ab4d06d7
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/CharsetFlags.cs
@@ -0,0 +1,36 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms.RTF {
+ [Flags]
+ internal enum CharsetFlags {
+ None = 0x00,
+ Read = 0x01,
+ Switch = 0x02
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/CharsetType.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/CharsetType.cs
new file mode 100644
index 00000000000..66de5c2cc3e
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/CharsetType.cs
@@ -0,0 +1,34 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms.RTF {
+ internal enum CharsetType {
+ General = 0,
+ Symbol = 1,
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/ClassDelegate.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/ClassDelegate.cs
new file mode 100644
index 00000000000..1c252ef0825
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/ClassDelegate.cs
@@ -0,0 +1,49 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms.RTF {
+ internal delegate void ClassDelegate(RTF sender);
+
+ internal class ClassCallback {
+ ClassDelegate[] callbacks;
+
+ public ClassCallback() {
+ callbacks = new ClassDelegate[Enum.GetValues(typeof(Major)).Length];
+ }
+
+ public ClassDelegate this[TokenClass c] {
+ get {
+ return callbacks[(int)c];
+ }
+
+ set {
+ callbacks[(int)c] = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Color.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Color.cs
new file mode 100644
index 00000000000..253fe3a987f
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Color.cs
@@ -0,0 +1,127 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms.RTF {
+ internal class Color {
+ #region Local Variables
+ private int red;
+ private int green;
+ private int blue;
+ private int num;
+ private Color next;
+ #endregion // Local Variables
+
+ #region Constructors
+ public Color(RTF rtf) {
+ red = -1;
+ green = -1;
+ blue = -1;
+ num = -1;
+
+ lock (rtf) {
+ if (rtf.Colors == null) {
+ rtf.Colors = this;
+ } else {
+ Color c = rtf.Colors;
+ while (c.next != null)
+ c = c.next;
+ c.next = this;
+ }
+ }
+ }
+ #endregion // Constructors
+
+ #region Properties
+ public int Red {
+ get {
+ return red;
+ }
+
+ set {
+ red = value;
+ }
+ }
+
+ public int Green {
+ get {
+ return green;
+ }
+
+ set {
+ green = value;
+ }
+ }
+
+ public int Blue {
+ get {
+ return blue;
+ }
+
+ set {
+ blue = value;
+ }
+ }
+
+ public int Num {
+ get {
+ return num;
+ }
+
+ set {
+ num = value;
+ }
+ }
+ #endregion // Properties
+
+ #region Methods
+ static public Color GetColor(RTF rtf, int color_number) {
+ Color c;
+
+ lock (rtf) {
+ c = GetColor(rtf.Colors, color_number);
+ }
+ return c;
+ }
+
+ static private Color GetColor(Color start, int color_number) {
+ Color c;
+
+ if (color_number == -1) {
+ return start;
+ }
+
+ c = start;
+
+ while ((c != null) && (c.num != color_number)) {
+ c = c.next;
+ }
+ return c;
+ }
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/DestinationDelegate.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/DestinationDelegate.cs
new file mode 100644
index 00000000000..4c85bdb7607
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/DestinationDelegate.cs
@@ -0,0 +1,49 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms.RTF {
+ internal delegate void DestinationDelegate(RTF Sender);
+
+ internal class DestinationCallback {
+ DestinationDelegate[] callbacks;
+
+ public DestinationCallback() {
+ callbacks = new DestinationDelegate[Enum.GetValues(typeof(Minor)).Length];
+ }
+
+ public DestinationDelegate this[Minor c] {
+ get {
+ return callbacks[(int)c];
+ }
+
+ set {
+ callbacks[(int)c] = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Font.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Font.cs
new file mode 100644
index 00000000000..b0af7c7e534
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Font.cs
@@ -0,0 +1,201 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms.RTF {
+ internal class Font {
+ #region Local Variables
+ private string name;
+ private string alt_name;
+ private int num;
+ private int family;
+ private CharsetType charset;
+ private int pitch;
+ private int type;
+ private int codepage;
+ private Font next;
+ private RTF rtf;
+ #endregion // Local Variables
+
+ #region Constructors
+ public Font(RTF rtf) {
+ this.rtf = rtf;
+ num = -1;
+
+ lock (rtf) {
+ if (rtf.Fonts == null)
+ rtf.Fonts = this;
+ else {
+ Font f = rtf.Fonts;
+ while (f.next != null)
+ f = f.next;
+ f.next = this;
+ }
+ }
+ }
+ #endregion // Constructors
+
+ #region Properties
+ public string Name {
+ get {
+ return name;
+ }
+
+ set {
+ name = value;
+ }
+ }
+
+ public string AltName {
+ get {
+ return alt_name;
+ }
+
+ set {
+ alt_name = value;
+ }
+ }
+
+ public int Num {
+ get {
+ return num;
+ }
+
+ set {
+ // Whack any previous font with the same number
+ DeleteFont(rtf, value);
+ num = value;
+ }
+ }
+
+ public int Family {
+ get {
+ return family;
+ }
+
+ set {
+ family = value;
+ }
+ }
+
+ public CharsetType Charset {
+ get {
+ return charset;
+ }
+
+ set {
+ charset = value;
+ }
+ }
+
+
+ public int Pitch {
+ get {
+ return pitch;
+ }
+
+ set {
+ pitch = value;
+ }
+ }
+
+ public int Type {
+ get {
+ return type;
+ }
+
+ set {
+ type = value;
+ }
+ }
+
+ public int Codepage {
+ get {
+ return codepage;
+ }
+
+ set {
+ codepage = value;
+ }
+ }
+ #endregion // Properties
+
+ #region Methods
+ static public bool DeleteFont(RTF rtf, int font_number) {
+ Font f;
+ Font prev;
+
+ lock (rtf) {
+ f = rtf.Fonts;
+ prev = null;
+ while ((f != null) && (f.num != font_number)) {
+ prev = f;
+ f = f.next;
+ }
+
+ if (f != null) {
+ if (f == rtf.Fonts) {
+ rtf.Fonts = f.next;
+ } else {
+ if (prev != null) {
+ prev.next = f.next;
+ } else {
+ rtf.Fonts = f.next;
+ }
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ static public Font GetFont(RTF rtf, int font_number) {
+ Font f;
+
+ lock (rtf) {
+ f = GetFont(rtf.Fonts, font_number);
+ }
+ return f;
+ }
+
+ static public Font GetFont(Font start, int font_number) {
+ Font f;
+
+ if (font_number == -1) {
+ return start;
+ }
+
+ f = start;
+
+ while ((f != null) && (f.num != font_number)) {
+ f = f.next;
+ }
+ return f;
+ }
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/KeyStruct.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/KeyStruct.cs
new file mode 100644
index 00000000000..3e2280a6d8d
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/KeyStruct.cs
@@ -0,0 +1,40 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms.RTF {
+ internal struct KeyStruct {
+ public KeyStruct(Major major, Minor minor, string symbol) {
+ Major = major;
+ Minor = minor;
+ Symbol = symbol;
+ }
+ public Major Major;
+ public Minor Minor;
+ public string Symbol;
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/KeysInit.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/KeysInit.cs
new file mode 100644
index 00000000000..9a1cce188fb
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/KeysInit.cs
@@ -0,0 +1,719 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms.RTF {
+ internal class KeysInit {
+ public static KeyStruct[] Init() {
+ return new KeyStruct[] {
+ new KeyStruct(Major.SpecialChar, Minor.IIntVersion, "vern"),
+ new KeyStruct(Major.SpecialChar, Minor.ICreateTime, "creatim"),
+ new KeyStruct(Major.SpecialChar, Minor.IRevisionTime, "revtim"),
+ new KeyStruct(Major.SpecialChar, Minor.IPrintTime, "printim"),
+ new KeyStruct(Major.SpecialChar, Minor.IBackupTime, "buptim"),
+ new KeyStruct(Major.SpecialChar, Minor.IEditTime, "edmins"),
+ new KeyStruct(Major.SpecialChar, Minor.IYear, "yr"),
+ new KeyStruct(Major.SpecialChar, Minor.IMonth, "mo"),
+ new KeyStruct(Major.SpecialChar, Minor.IDay, "dy"),
+ new KeyStruct(Major.SpecialChar, Minor.IHour, "hr"),
+ new KeyStruct(Major.SpecialChar, Minor.IMinute, "min"),
+ new KeyStruct(Major.SpecialChar, Minor.ISecond, "sec"),
+ new KeyStruct(Major.SpecialChar, Minor.INPages, "nofpages"),
+ new KeyStruct(Major.SpecialChar, Minor.INWords, "nofwords"),
+ new KeyStruct(Major.SpecialChar, Minor.INChars, "nofchars"),
+ new KeyStruct(Major.SpecialChar, Minor.IIntID, "id"),
+ new KeyStruct(Major.SpecialChar, Minor.CurHeadDate, "chdate"),
+ new KeyStruct(Major.SpecialChar, Minor.CurHeadDateLong, "chdpl"),
+ new KeyStruct(Major.SpecialChar, Minor.CurHeadDateAbbrev, "chdpa"),
+ new KeyStruct(Major.SpecialChar, Minor.CurHeadTime, "chtime"),
+ new KeyStruct(Major.SpecialChar, Minor.CurHeadPage, "chpgn"),
+ new KeyStruct(Major.SpecialChar, Minor.SectNum, "sectnum"),
+ new KeyStruct(Major.SpecialChar, Minor.CurFNote, "chftn"),
+ new KeyStruct(Major.SpecialChar, Minor.CurAnnotRef, "chatn"),
+ new KeyStruct(Major.SpecialChar, Minor.FNoteSep, "chftnsep"),
+ new KeyStruct(Major.SpecialChar, Minor.FNoteCont, "chftnsepc"),
+ new KeyStruct(Major.SpecialChar, Minor.Cell, "cell"),
+ new KeyStruct(Major.SpecialChar, Minor.Row, "row"),
+ new KeyStruct(Major.SpecialChar, Minor.Par, "par"),
+ new KeyStruct(Major.SpecialChar, Minor.Par, "\n"),
+ new KeyStruct(Major.SpecialChar, Minor.Par, "\r"),
+ new KeyStruct(Major.SpecialChar, Minor.Sect, "sect"),
+ new KeyStruct(Major.SpecialChar, Minor.Page, "page"),
+ new KeyStruct(Major.SpecialChar, Minor.Column, "column"),
+ new KeyStruct(Major.SpecialChar, Minor.Line, "line"),
+ new KeyStruct(Major.SpecialChar, Minor.SoftPage, "softpage"),
+ new KeyStruct(Major.SpecialChar, Minor.SoftColumn, "softcol"),
+ new KeyStruct(Major.SpecialChar, Minor.SoftLine, "softline"),
+ new KeyStruct(Major.SpecialChar, Minor.SoftLineHt, "softlheight"),
+ new KeyStruct(Major.SpecialChar, Minor.Tab, "tab"),
+ new KeyStruct(Major.SpecialChar, Minor.EmDash, "emdash"),
+ new KeyStruct(Major.SpecialChar, Minor.EnDash, "endash"),
+ new KeyStruct(Major.SpecialChar, Minor.EmSpace, "emspace"),
+ new KeyStruct(Major.SpecialChar, Minor.EnSpace, "enspace"),
+ new KeyStruct(Major.SpecialChar, Minor.Bullet, "bullet"),
+ new KeyStruct(Major.SpecialChar, Minor.LQuote, "lquote"),
+ new KeyStruct(Major.SpecialChar, Minor.RQuote, "rquote"),
+ new KeyStruct(Major.SpecialChar, Minor.LDblQuote, "ldblquote"),
+ new KeyStruct(Major.SpecialChar, Minor.RDblQuote, "rdblquote"),
+ new KeyStruct(Major.SpecialChar, Minor.Formula, "|"),
+ new KeyStruct(Major.SpecialChar, Minor.NoBrkSpace, "~"),
+ new KeyStruct(Major.SpecialChar, Minor.NoReqHyphen, "-"),
+ new KeyStruct(Major.SpecialChar, Minor.NoBrkHyphen, "_"),
+ new KeyStruct(Major.SpecialChar, Minor.OptDest, "*"),
+ new KeyStruct(Major.SpecialChar, Minor.LTRMark, "ltrmark"),
+ new KeyStruct(Major.SpecialChar, Minor.RTLMark, "rtlmark"),
+ new KeyStruct(Major.SpecialChar, Minor.NoWidthJoiner, "zwj"),
+ new KeyStruct(Major.SpecialChar, Minor.NoWidthNonJoiner, "zwnj"),
+ new KeyStruct(Major.SpecialChar, Minor.CurHeadPict, "chpict"),
+ new KeyStruct(Major.CharAttr, Minor.Plain, "plain"),
+ new KeyStruct(Major.CharAttr, Minor.Bold, "b"),
+ new KeyStruct(Major.CharAttr, Minor.AllCaps, "caps"),
+ new KeyStruct(Major.CharAttr, Minor.Deleted, "deleted"),
+ new KeyStruct(Major.CharAttr, Minor.SubScript, "dn"),
+ new KeyStruct(Major.CharAttr, Minor.SubScrShrink, "sub"),
+ new KeyStruct(Major.CharAttr, Minor.NoSuperSub, "nosupersub"),
+ new KeyStruct(Major.CharAttr, Minor.Expand, "expnd"),
+ new KeyStruct(Major.CharAttr, Minor.ExpandTwips, "expndtw"),
+ new KeyStruct(Major.CharAttr, Minor.Kerning, "kerning"),
+ new KeyStruct(Major.CharAttr, Minor.FontNum, "f"),
+ new KeyStruct(Major.CharAttr, Minor.FontSize, "fs"),
+ new KeyStruct(Major.CharAttr, Minor.Italic, "i"),
+ new KeyStruct(Major.CharAttr, Minor.Outline, "outl"),
+ new KeyStruct(Major.CharAttr, Minor.Revised, "revised"),
+ new KeyStruct(Major.CharAttr, Minor.RevAuthor, "revauth"),
+ new KeyStruct(Major.CharAttr, Minor.RevDTTM, "revdttm"),
+ new KeyStruct(Major.CharAttr, Minor.SmallCaps, "scaps"),
+ new KeyStruct(Major.CharAttr, Minor.Shadow, "shad"),
+ new KeyStruct(Major.CharAttr, Minor.StrikeThru, "strike"),
+ new KeyStruct(Major.CharAttr, Minor.Underline, "ul"),
+ new KeyStruct(Major.CharAttr, Minor.DotUnderline, "uld"),
+ new KeyStruct(Major.CharAttr, Minor.DbUnderline, "uldb"),
+ new KeyStruct(Major.CharAttr, Minor.NoUnderline, "ulnone"),
+ new KeyStruct(Major.CharAttr, Minor.WordUnderline, "ulw"),
+ new KeyStruct(Major.CharAttr, Minor.SuperScript, "up"),
+ new KeyStruct(Major.CharAttr, Minor.SuperScrShrink, "super"),
+ new KeyStruct(Major.CharAttr, Minor.Invisible, "v"),
+ new KeyStruct(Major.CharAttr, Minor.ForeColor, "cf"),
+ new KeyStruct(Major.CharAttr, Minor.BackColor, "cb"),
+ new KeyStruct(Major.CharAttr, Minor.RTLChar, "rtlch"),
+ new KeyStruct(Major.CharAttr, Minor.LTRChar, "ltrch"),
+ new KeyStruct(Major.CharAttr, Minor.CharStyleNum, "cs"),
+ new KeyStruct(Major.CharAttr, Minor.CharCharSet, "cchs"),
+ new KeyStruct(Major.CharAttr, Minor.Language, "lang"),
+ new KeyStruct(Major.CharAttr, Minor.Gray, "gray"),
+ new KeyStruct(Major.ParAttr, Minor.ParDef, "pard"),
+ new KeyStruct(Major.ParAttr, Minor.StyleNum, "s"),
+ new KeyStruct(Major.ParAttr, Minor.Hyphenate, "hyphpar"),
+ new KeyStruct(Major.ParAttr, Minor.InTable, "intbl"),
+ new KeyStruct(Major.ParAttr, Minor.Keep, "keep"),
+ new KeyStruct(Major.ParAttr, Minor.NoWidowControl, "nowidctlpar"),
+ new KeyStruct(Major.ParAttr, Minor.KeepNext, "keepn"),
+ new KeyStruct(Major.ParAttr, Minor.OutlineLevel, "level"),
+ new KeyStruct(Major.ParAttr, Minor.NoLineNum, "noline"),
+ new KeyStruct(Major.ParAttr, Minor.PBBefore, "pagebb"),
+ new KeyStruct(Major.ParAttr, Minor.SideBySide, "sbys"),
+ new KeyStruct(Major.ParAttr, Minor.QuadLeft, "ql"),
+ new KeyStruct(Major.ParAttr, Minor.QuadRight, "qr"),
+ new KeyStruct(Major.ParAttr, Minor.QuadJust, "qj"),
+ new KeyStruct(Major.ParAttr, Minor.QuadCenter, "qc"),
+ new KeyStruct(Major.ParAttr, Minor.FirstIndent, "fi"),
+ new KeyStruct(Major.ParAttr, Minor.LeftIndent, "li"),
+ new KeyStruct(Major.ParAttr, Minor.RightIndent, "ri"),
+ new KeyStruct(Major.ParAttr, Minor.SpaceBefore, "sb"),
+ new KeyStruct(Major.ParAttr, Minor.SpaceAfter, "sa"),
+ new KeyStruct(Major.ParAttr, Minor.SpaceBetween, "sl"),
+ new KeyStruct(Major.ParAttr, Minor.SpaceMultiply, "slmult"),
+ new KeyStruct(Major.ParAttr, Minor.SubDocument, "subdocument"),
+ new KeyStruct(Major.ParAttr, Minor.RTLPar, "rtlpar"),
+ new KeyStruct(Major.ParAttr, Minor.LTRPar, "ltrpar"),
+ new KeyStruct(Major.ParAttr, Minor.TabPos, "tx"),
+ new KeyStruct(Major.ParAttr, Minor.TabLeft, "tql"),
+ new KeyStruct(Major.ParAttr, Minor.TabRight, "tqr"),
+ new KeyStruct(Major.ParAttr, Minor.TabCenter, "tqc"),
+ new KeyStruct(Major.ParAttr, Minor.TabDecimal, "tqdec"),
+ new KeyStruct(Major.ParAttr, Minor.TabBar, "tb"),
+ new KeyStruct(Major.ParAttr, Minor.LeaderDot, "tldot"),
+ new KeyStruct(Major.ParAttr, Minor.LeaderHyphen, "tlhyph"),
+ new KeyStruct(Major.ParAttr, Minor.LeaderUnder, "tlul"),
+ new KeyStruct(Major.ParAttr, Minor.LeaderThick, "tlth"),
+ new KeyStruct(Major.ParAttr, Minor.LeaderEqual, "tleq"),
+ new KeyStruct(Major.ParAttr, Minor.ParLevel, "pnlvl"),
+ new KeyStruct(Major.ParAttr, Minor.ParBullet, "pnlvlblt"),
+ new KeyStruct(Major.ParAttr, Minor.ParSimple, "pnlvlbody"),
+ new KeyStruct(Major.ParAttr, Minor.ParNumCont, "pnlvlcont"),
+ new KeyStruct(Major.ParAttr, Minor.ParNumOnce, "pnnumonce"),
+ new KeyStruct(Major.ParAttr, Minor.ParNumAcross, "pnacross"),
+ new KeyStruct(Major.ParAttr, Minor.ParHangIndent, "pnhang"),
+ new KeyStruct(Major.ParAttr, Minor.ParNumRestart, "pnrestart"),
+ new KeyStruct(Major.ParAttr, Minor.ParNumCardinal, "pncard"),
+ new KeyStruct(Major.ParAttr, Minor.ParNumDecimal, "pndec"),
+ new KeyStruct(Major.ParAttr, Minor.ParNumULetter, "pnucltr"),
+ new KeyStruct(Major.ParAttr, Minor.ParNumURoman, "pnucrm"),
+ new KeyStruct(Major.ParAttr, Minor.ParNumLLetter, "pnlcltr"),
+ new KeyStruct(Major.ParAttr, Minor.ParNumLRoman, "pnlcrm"),
+ new KeyStruct(Major.ParAttr, Minor.ParNumOrdinal, "pnord"),
+ new KeyStruct(Major.ParAttr, Minor.ParNumOrdinalText, "pnordt"),
+ new KeyStruct(Major.ParAttr, Minor.ParNumBold, "pnb"),
+ new KeyStruct(Major.ParAttr, Minor.ParNumItalic, "pni"),
+ new KeyStruct(Major.ParAttr, Minor.ParNumAllCaps, "pncaps"),
+ new KeyStruct(Major.ParAttr, Minor.ParNumSmallCaps, "pnscaps"),
+ new KeyStruct(Major.ParAttr, Minor.ParNumUnder, "pnul"),
+ new KeyStruct(Major.ParAttr, Minor.ParNumDotUnder, "pnuld"),
+ new KeyStruct(Major.ParAttr, Minor.ParNumDbUnder, "pnuldb"),
+ new KeyStruct(Major.ParAttr, Minor.ParNumNoUnder, "pnulnone"),
+ new KeyStruct(Major.ParAttr, Minor.ParNumWordUnder, "pnulw"),
+ new KeyStruct(Major.ParAttr, Minor.ParNumStrikethru, "pnstrike"),
+ new KeyStruct(Major.ParAttr, Minor.ParNumForeColor, "pncf"),
+ new KeyStruct(Major.ParAttr, Minor.ParNumFont, "pnf"),
+ new KeyStruct(Major.ParAttr, Minor.ParNumFontSize, "pnfs"),
+ new KeyStruct(Major.ParAttr, Minor.ParNumIndent, "pnindent"),
+ new KeyStruct(Major.ParAttr, Minor.ParNumSpacing, "pnsp"),
+ new KeyStruct(Major.ParAttr, Minor.ParNumInclPrev, "pnprev"),
+ new KeyStruct(Major.ParAttr, Minor.ParNumCenter, "pnqc"),
+ new KeyStruct(Major.ParAttr, Minor.ParNumLeft, "pnql"),
+ new KeyStruct(Major.ParAttr, Minor.ParNumRight, "pnqr"),
+ new KeyStruct(Major.ParAttr, Minor.ParNumStartAt, "pnstart"),
+ new KeyStruct(Major.ParAttr, Minor.BorderTop, "brdrt"),
+ new KeyStruct(Major.ParAttr, Minor.BorderBottom, "brdrb"),
+ new KeyStruct(Major.ParAttr, Minor.BorderLeft, "brdrl"),
+ new KeyStruct(Major.ParAttr, Minor.BorderRight, "brdrr"),
+ new KeyStruct(Major.ParAttr, Minor.BorderBetween, "brdrbtw"),
+ new KeyStruct(Major.ParAttr, Minor.BorderBar, "brdrbar"),
+ new KeyStruct(Major.ParAttr, Minor.BorderBox, "box"),
+ new KeyStruct(Major.ParAttr, Minor.BorderSingle, "brdrs"),
+ new KeyStruct(Major.ParAttr, Minor.BorderThick, "brdrth"),
+ new KeyStruct(Major.ParAttr, Minor.BorderShadow, "brdrsh"),
+ new KeyStruct(Major.ParAttr, Minor.BorderDouble, "brdrdb"),
+ new KeyStruct(Major.ParAttr, Minor.BorderDot, "brdrdot"),
+ new KeyStruct(Major.ParAttr, Minor.BorderDot, "brdrdash"),
+ new KeyStruct(Major.ParAttr, Minor.BorderHair, "brdrhair"),
+ new KeyStruct(Major.ParAttr, Minor.BorderWidth, "brdrw"),
+ new KeyStruct(Major.ParAttr, Minor.BorderColor, "brdrcf"),
+ new KeyStruct(Major.ParAttr, Minor.BorderSpace, "brsp"),
+ new KeyStruct(Major.ParAttr, Minor.Shading, "shading"),
+ new KeyStruct(Major.ParAttr, Minor.BgPatH, "bghoriz"),
+ new KeyStruct(Major.ParAttr, Minor.BgPatV, "bgvert"),
+ new KeyStruct(Major.ParAttr, Minor.FwdDiagBgPat, "bgfdiag"),
+ new KeyStruct(Major.ParAttr, Minor.BwdDiagBgPat, "bgbdiag"),
+ new KeyStruct(Major.ParAttr, Minor.HatchBgPat, "bgcross"),
+ new KeyStruct(Major.ParAttr, Minor.DiagHatchBgPat, "bgdcross"),
+ new KeyStruct(Major.ParAttr, Minor.DarkBgPatH, "bgdkhoriz"),
+ new KeyStruct(Major.ParAttr, Minor.DarkBgPatV, "bgdkvert"),
+ new KeyStruct(Major.ParAttr, Minor.FwdDarkBgPat, "bgdkfdiag"),
+ new KeyStruct(Major.ParAttr, Minor.BwdDarkBgPat, "bgdkbdiag"),
+ new KeyStruct(Major.ParAttr, Minor.DarkHatchBgPat, "bgdkcross"),
+ new KeyStruct(Major.ParAttr, Minor.DarkDiagHatchBgPat, "bgdkdcross"),
+ new KeyStruct(Major.ParAttr, Minor.BgPatLineColor, "cfpat"),
+ new KeyStruct(Major.ParAttr, Minor.BgPatColor, "cbpat"),
+ new KeyStruct(Major.SectAttr, Minor.SectDef, "sectd"),
+ new KeyStruct(Major.SectAttr, Minor.ENoteHere, "endnhere"),
+ new KeyStruct(Major.SectAttr, Minor.PrtBinFirst, "binfsxn"),
+ new KeyStruct(Major.SectAttr, Minor.PrtBin, "binsxn"),
+ new KeyStruct(Major.SectAttr, Minor.SectStyleNum, "ds"),
+ new KeyStruct(Major.SectAttr, Minor.NoBreak, "sbknone"),
+ new KeyStruct(Major.SectAttr, Minor.ColBreak, "sbkcol"),
+ new KeyStruct(Major.SectAttr, Minor.PageBreak, "sbkpage"),
+ new KeyStruct(Major.SectAttr, Minor.EvenBreak, "sbkeven"),
+ new KeyStruct(Major.SectAttr, Minor.OddBreak, "sbkodd"),
+ new KeyStruct(Major.SectAttr, Minor.Columns, "cols"),
+ new KeyStruct(Major.SectAttr, Minor.ColumnSpace, "colsx"),
+ new KeyStruct(Major.SectAttr, Minor.ColumnNumber, "colno"),
+ new KeyStruct(Major.SectAttr, Minor.ColumnSpRight, "colsr"),
+ new KeyStruct(Major.SectAttr, Minor.ColumnWidth, "colw"),
+ new KeyStruct(Major.SectAttr, Minor.ColumnLine, "linebetcol"),
+ new KeyStruct(Major.SectAttr, Minor.LineModulus, "linemod"),
+ new KeyStruct(Major.SectAttr, Minor.LineDist, "linex"),
+ new KeyStruct(Major.SectAttr, Minor.LineStarts, "linestarts"),
+ new KeyStruct(Major.SectAttr, Minor.LineRestart, "linerestart"),
+ new KeyStruct(Major.SectAttr, Minor.LineRestartPg, "lineppage"),
+ new KeyStruct(Major.SectAttr, Minor.LineCont, "linecont"),
+ new KeyStruct(Major.SectAttr, Minor.SectPageWid, "pgwsxn"),
+ new KeyStruct(Major.SectAttr, Minor.SectPageHt, "pghsxn"),
+ new KeyStruct(Major.SectAttr, Minor.SectMarginLeft, "marglsxn"),
+ new KeyStruct(Major.SectAttr, Minor.SectMarginRight, "margrsxn"),
+ new KeyStruct(Major.SectAttr, Minor.SectMarginTop, "margtsxn"),
+ new KeyStruct(Major.SectAttr, Minor.SectMarginBottom, "margbsxn"),
+ new KeyStruct(Major.SectAttr, Minor.SectMarginGutter, "guttersxn"),
+ new KeyStruct(Major.SectAttr, Minor.SectLandscape, "lndscpsxn"),
+ new KeyStruct(Major.SectAttr, Minor.TitleSpecial, "titlepg"),
+ new KeyStruct(Major.SectAttr, Minor.HeaderY, "headery"),
+ new KeyStruct(Major.SectAttr, Minor.FooterY, "footery"),
+ new KeyStruct(Major.SectAttr, Minor.PageStarts, "pgnstarts"),
+ new KeyStruct(Major.SectAttr, Minor.PageCont, "pgncont"),
+ new KeyStruct(Major.SectAttr, Minor.PageRestart, "pgnrestart"),
+ new KeyStruct(Major.SectAttr, Minor.PageNumRight, "pgnx"),
+ new KeyStruct(Major.SectAttr, Minor.PageNumTop, "pgny"),
+ new KeyStruct(Major.SectAttr, Minor.PageDecimal, "pgndec"),
+ new KeyStruct(Major.SectAttr, Minor.PageURoman, "pgnucrm"),
+ new KeyStruct(Major.SectAttr, Minor.PageLRoman, "pgnlcrm"),
+ new KeyStruct(Major.SectAttr, Minor.PageULetter, "pgnucltr"),
+ new KeyStruct(Major.SectAttr, Minor.PageLLetter, "pgnlcltr"),
+ new KeyStruct(Major.SectAttr, Minor.PageNumHyphSep, "pgnhnsh"),
+ new KeyStruct(Major.SectAttr, Minor.PageNumSpaceSep, "pgnhnsp"),
+ new KeyStruct(Major.SectAttr, Minor.PageNumColonSep, "pgnhnsc"),
+ new KeyStruct(Major.SectAttr, Minor.PageNumEmdashSep, "pgnhnsm"),
+ new KeyStruct(Major.SectAttr, Minor.PageNumEndashSep, "pgnhnsn"),
+ new KeyStruct(Major.SectAttr, Minor.TopVAlign, "vertalt"),
+ new KeyStruct(Major.SectAttr, Minor.BottomVAlign, "vertalb"),
+ new KeyStruct(Major.SectAttr, Minor.CenterVAlign, "vertalc"),
+ new KeyStruct(Major.SectAttr, Minor.JustVAlign, "vertalj"),
+ new KeyStruct(Major.SectAttr, Minor.RTLSect, "rtlsect"),
+ new KeyStruct(Major.SectAttr, Minor.LTRSect, "ltrsect"),
+ new KeyStruct(Major.DocAttr, Minor.DefTab, "deftab"),
+ new KeyStruct(Major.DocAttr, Minor.HyphHotZone, "hyphhotz"),
+ new KeyStruct(Major.DocAttr, Minor.HyphConsecLines, "hyphconsec"),
+ new KeyStruct(Major.DocAttr, Minor.HyphCaps, "hyphcaps"),
+ new KeyStruct(Major.DocAttr, Minor.HyphAuto, "hyphauto"),
+ new KeyStruct(Major.DocAttr, Minor.LineStart, "linestart"),
+ new KeyStruct(Major.DocAttr, Minor.FracWidth, "fracwidth"),
+ new KeyStruct(Major.DocAttr, Minor.MakeBackup, "makeback"),
+ new KeyStruct(Major.DocAttr, Minor.MakeBackup, "makebackup"),
+ new KeyStruct(Major.DocAttr, Minor.RTFDefault, "defformat"),
+ new KeyStruct(Major.DocAttr, Minor.PSOverlay, "psover"),
+ new KeyStruct(Major.DocAttr, Minor.DocTemplate, "doctemp"),
+ new KeyStruct(Major.DocAttr, Minor.DefLanguage, "deflang"),
+ new KeyStruct(Major.DocAttr, Minor.FENoteType, "fet"),
+ new KeyStruct(Major.DocAttr, Minor.FNoteEndSect, "endnotes"),
+ new KeyStruct(Major.DocAttr, Minor.FNoteEndDoc, "enddoc"),
+ new KeyStruct(Major.DocAttr, Minor.FNoteText, "ftntj"),
+ new KeyStruct(Major.DocAttr, Minor.FNoteBottom, "ftnbj"),
+ new KeyStruct(Major.DocAttr, Minor.ENoteEndSect, "aendnotes"),
+ new KeyStruct(Major.DocAttr, Minor.ENoteEndDoc, "aenddoc"),
+ new KeyStruct(Major.DocAttr, Minor.ENoteText, "aftntj"),
+ new KeyStruct(Major.DocAttr, Minor.ENoteBottom, "aftnbj"),
+ new KeyStruct(Major.DocAttr, Minor.FNoteStart, "ftnstart"),
+ new KeyStruct(Major.DocAttr, Minor.ENoteStart, "aftnstart"),
+ new KeyStruct(Major.DocAttr, Minor.FNoteRestartPage, "ftnrstpg"),
+ new KeyStruct(Major.DocAttr, Minor.FNoteRestart, "ftnrestart"),
+ new KeyStruct(Major.DocAttr, Minor.FNoteRestartCont, "ftnrstcont"),
+ new KeyStruct(Major.DocAttr, Minor.ENoteRestart, "aftnrestart"),
+ new KeyStruct(Major.DocAttr, Minor.ENoteRestartCont, "aftnrstcont"),
+ new KeyStruct(Major.DocAttr, Minor.FNoteNumArabic, "ftnnar"),
+ new KeyStruct(Major.DocAttr, Minor.FNoteNumLLetter, "ftnnalc"),
+ new KeyStruct(Major.DocAttr, Minor.FNoteNumULetter, "ftnnauc"),
+ new KeyStruct(Major.DocAttr, Minor.FNoteNumLRoman, "ftnnrlc"),
+ new KeyStruct(Major.DocAttr, Minor.FNoteNumURoman, "ftnnruc"),
+ new KeyStruct(Major.DocAttr, Minor.FNoteNumChicago, "ftnnchi"),
+ new KeyStruct(Major.DocAttr, Minor.ENoteNumArabic, "aftnnar"),
+ new KeyStruct(Major.DocAttr, Minor.ENoteNumLLetter, "aftnnalc"),
+ new KeyStruct(Major.DocAttr, Minor.ENoteNumULetter, "aftnnauc"),
+ new KeyStruct(Major.DocAttr, Minor.ENoteNumLRoman, "aftnnrlc"),
+ new KeyStruct(Major.DocAttr, Minor.ENoteNumURoman, "aftnnruc"),
+ new KeyStruct(Major.DocAttr, Minor.ENoteNumChicago, "aftnnchi"),
+ new KeyStruct(Major.DocAttr, Minor.PaperWidth, "paperw"),
+ new KeyStruct(Major.DocAttr, Minor.PaperHeight, "paperh"),
+ new KeyStruct(Major.DocAttr, Minor.PaperSize, "psz"),
+ new KeyStruct(Major.DocAttr, Minor.LeftMargin, "margl"),
+ new KeyStruct(Major.DocAttr, Minor.RightMargin, "margr"),
+ new KeyStruct(Major.DocAttr, Minor.TopMargin, "margt"),
+ new KeyStruct(Major.DocAttr, Minor.BottomMargin, "margb"),
+ new KeyStruct(Major.DocAttr, Minor.FacingPage, "facingp"),
+ new KeyStruct(Major.DocAttr, Minor.GutterWid, "gutter"),
+ new KeyStruct(Major.DocAttr, Minor.MirrorMargin, "margmirror"),
+ new KeyStruct(Major.DocAttr, Minor.Landscape, "landscape"),
+ new KeyStruct(Major.DocAttr, Minor.PageStart, "pgnstart"),
+ new KeyStruct(Major.DocAttr, Minor.WidowCtrl, "widowctrl"),
+ new KeyStruct(Major.DocAttr, Minor.LinkStyles, "linkstyles"),
+ new KeyStruct(Major.DocAttr, Minor.NoAutoTabIndent, "notabind"),
+ new KeyStruct(Major.DocAttr, Minor.WrapSpaces, "wraptrsp"),
+ new KeyStruct(Major.DocAttr, Minor.PrintColorsBlack, "prcolbl"),
+ new KeyStruct(Major.DocAttr, Minor.NoExtraSpaceRL, "noextrasprl"),
+ new KeyStruct(Major.DocAttr, Minor.NoColumnBalance, "nocolbal"),
+ new KeyStruct(Major.DocAttr, Minor.CvtMailMergeQuote, "cvmme"),
+ new KeyStruct(Major.DocAttr, Minor.SuppressTopSpace, "sprstsp"),
+ new KeyStruct(Major.DocAttr, Minor.SuppressPreParSpace, "sprsspbf"),
+ new KeyStruct(Major.DocAttr, Minor.CombineTblBorders, "otblrul"),
+ new KeyStruct(Major.DocAttr, Minor.TranspMetafiles, "transmf"),
+ new KeyStruct(Major.DocAttr, Minor.SwapBorders, "swpbdr"),
+ new KeyStruct(Major.DocAttr, Minor.ShowHardBreaks, "brkfrm"),
+ new KeyStruct(Major.DocAttr, Minor.FormProtected, "formprot"),
+ new KeyStruct(Major.DocAttr, Minor.AllProtected, "allprot"),
+ new KeyStruct(Major.DocAttr, Minor.FormShading, "formshade"),
+ new KeyStruct(Major.DocAttr, Minor.FormDisplay, "formdisp"),
+ new KeyStruct(Major.DocAttr, Minor.PrintData, "printdata"),
+ new KeyStruct(Major.DocAttr, Minor.RevProtected, "revprot"),
+ new KeyStruct(Major.DocAttr, Minor.Revisions, "revisions"),
+ new KeyStruct(Major.DocAttr, Minor.RevDisplay, "revprop"),
+ new KeyStruct(Major.DocAttr, Minor.RevBar, "revbar"),
+ new KeyStruct(Major.DocAttr, Minor.AnnotProtected, "annotprot"),
+ new KeyStruct(Major.DocAttr, Minor.RTLDoc, "rtldoc"),
+ new KeyStruct(Major.DocAttr, Minor.LTRDoc, "ltrdoc"),
+ new KeyStruct(Major.StyleAttr, Minor.Additive, "additive"),
+ new KeyStruct(Major.StyleAttr, Minor.BasedOn, "sbasedon"),
+ new KeyStruct(Major.StyleAttr, Minor.Next, "snext"),
+ new KeyStruct(Major.PictAttr, Minor.MacQD, "macpict"),
+ new KeyStruct(Major.PictAttr, Minor.PMMetafile, "pmmetafile"),
+ new KeyStruct(Major.PictAttr, Minor.WinMetafile, "wmetafile"),
+ new KeyStruct(Major.PictAttr, Minor.DevIndBitmap, "dibitmap"),
+ new KeyStruct(Major.PictAttr, Minor.WinBitmap, "wbitmap"),
+ new KeyStruct(Major.PictAttr, Minor.PixelBits, "wbmbitspixel"),
+ new KeyStruct(Major.PictAttr, Minor.BitmapPlanes, "wbmplanes"),
+ new KeyStruct(Major.PictAttr, Minor.BitmapWid, "wbmwidthbytes"),
+ new KeyStruct(Major.PictAttr, Minor.PicWid, "picw"),
+ new KeyStruct(Major.PictAttr, Minor.PicHt, "pich"),
+ new KeyStruct(Major.PictAttr, Minor.PicGoalWid, "picwgoal"),
+ new KeyStruct(Major.PictAttr, Minor.PicGoalHt, "pichgoal"),
+ new KeyStruct(Major.PictAttr, Minor.PicGoalWid, "picwGoal"),
+ new KeyStruct(Major.PictAttr, Minor.PicGoalHt, "pichGoal"),
+ new KeyStruct(Major.PictAttr, Minor.PicScaleX, "picscalex"),
+ new KeyStruct(Major.PictAttr, Minor.PicScaleY, "picscaley"),
+ new KeyStruct(Major.PictAttr, Minor.PicScaled, "picscaled"),
+ new KeyStruct(Major.PictAttr, Minor.PicCropTop, "piccropt"),
+ new KeyStruct(Major.PictAttr, Minor.PicCropBottom, "piccropb"),
+ new KeyStruct(Major.PictAttr, Minor.PicCropLeft, "piccropl"),
+ new KeyStruct(Major.PictAttr, Minor.PicCropRight, "piccropr"),
+ new KeyStruct(Major.PictAttr, Minor.PicMFHasBitmap, "picbmp"),
+ new KeyStruct(Major.PictAttr, Minor.PicMFBitsPerPixel, "picbpp"),
+ new KeyStruct(Major.PictAttr, Minor.PicBinary, "bin"),
+ new KeyStruct(Major.NeXTGrAttr, Minor.NeXTGWidth, "width"),
+ new KeyStruct(Major.NeXTGrAttr, Minor.NeXTGHeight, "height"),
+ new KeyStruct(Major.Destination, Minor.FontTbl, "fonttbl"),
+ new KeyStruct(Major.Destination, Minor.FontAltName, "falt"),
+ new KeyStruct(Major.Destination, Minor.EmbeddedFont, "fonteb"),
+ new KeyStruct(Major.Destination, Minor.FontFile, "fontfile"),
+ new KeyStruct(Major.Destination, Minor.FileTbl, "filetbl"),
+ new KeyStruct(Major.Destination, Minor.FileInfo, "file"),
+ new KeyStruct(Major.Destination, Minor.ColorTbl, "colortbl"),
+ new KeyStruct(Major.Destination, Minor.StyleSheet, "stylesheet"),
+ new KeyStruct(Major.Destination, Minor.KeyCode, "keycode"),
+ new KeyStruct(Major.Destination, Minor.RevisionTbl, "revtbl"),
+ new KeyStruct(Major.Destination, Minor.Info, "info"),
+ new KeyStruct(Major.Destination, Minor.ITitle, "title"),
+ new KeyStruct(Major.Destination, Minor.ISubject, "subject"),
+ new KeyStruct(Major.Destination, Minor.IAuthor, "author"),
+ new KeyStruct(Major.Destination, Minor.IOperator, "operator"),
+ new KeyStruct(Major.Destination, Minor.IKeywords, "keywords"),
+ new KeyStruct(Major.Destination, Minor.IComment, "comment"),
+ new KeyStruct(Major.Destination, Minor.IVersion, "version"),
+ new KeyStruct(Major.Destination, Minor.IDoccomm, "doccomm"),
+ new KeyStruct(Major.Destination, Minor.IVerscomm, "verscomm"),
+ new KeyStruct(Major.Destination, Minor.NextFile, "nextfile"),
+ new KeyStruct(Major.Destination, Minor.Template, "template"),
+ new KeyStruct(Major.Destination, Minor.FNSep, "ftnsep"),
+ new KeyStruct(Major.Destination, Minor.FNContSep, "ftnsepc"),
+ new KeyStruct(Major.Destination, Minor.FNContNotice, "ftncn"),
+ new KeyStruct(Major.Destination, Minor.ENSep, "aftnsep"),
+ new KeyStruct(Major.Destination, Minor.ENContSep, "aftnsepc"),
+ new KeyStruct(Major.Destination, Minor.ENContNotice, "aftncn"),
+ new KeyStruct(Major.Destination, Minor.PageNumLevel, "pgnhn"),
+ new KeyStruct(Major.Destination, Minor.ParNumLevelStyle, "pnseclvl"),
+ new KeyStruct(Major.Destination, Minor.Header, "header"),
+ new KeyStruct(Major.Destination, Minor.Footer, "footer"),
+ new KeyStruct(Major.Destination, Minor.HeaderLeft, "headerl"),
+ new KeyStruct(Major.Destination, Minor.HeaderRight, "headerr"),
+ new KeyStruct(Major.Destination, Minor.HeaderFirst, "headerf"),
+ new KeyStruct(Major.Destination, Minor.FooterLeft, "footerl"),
+ new KeyStruct(Major.Destination, Minor.FooterRight, "footerr"),
+ new KeyStruct(Major.Destination, Minor.FooterFirst, "footerf"),
+ new KeyStruct(Major.Destination, Minor.ParNumText, "pntext"),
+ new KeyStruct(Major.Destination, Minor.ParNumbering, "pn"),
+ new KeyStruct(Major.Destination, Minor.ParNumTextAfter, "pntexta"),
+ new KeyStruct(Major.Destination, Minor.ParNumTextBefore, "pntextb"),
+ new KeyStruct(Major.Destination, Minor.BookmarkStart, "bkmkstart"),
+ new KeyStruct(Major.Destination, Minor.BookmarkEnd, "bkmkend"),
+ new KeyStruct(Major.Destination, Minor.Pict, "pict"),
+ new KeyStruct(Major.Destination, Minor.Object, "object"),
+ new KeyStruct(Major.Destination, Minor.ObjClass, "objclass"),
+ new KeyStruct(Major.Destination, Minor.ObjName, "objname"),
+ new KeyStruct(Major.ObjAttr, Minor.ObjTime, "objtime"),
+ new KeyStruct(Major.Destination, Minor.ObjData, "objdata"),
+ new KeyStruct(Major.Destination, Minor.ObjAlias, "objalias"),
+ new KeyStruct(Major.Destination, Minor.ObjSection, "objsect"),
+ new KeyStruct(Major.Destination, Minor.ObjItem, "objitem"),
+ new KeyStruct(Major.Destination, Minor.ObjTopic, "objtopic"),
+ new KeyStruct(Major.Destination, Minor.ObjResult, "result"),
+ new KeyStruct(Major.Destination, Minor.DrawObject, "do"),
+ new KeyStruct(Major.Destination, Minor.Footnote, "footnote"),
+ new KeyStruct(Major.Destination, Minor.AnnotRefStart, "atrfstart"),
+ new KeyStruct(Major.Destination, Minor.AnnotRefEnd, "atrfend"),
+ new KeyStruct(Major.Destination, Minor.AnnotID, "atnid"),
+ new KeyStruct(Major.Destination, Minor.AnnotAuthor, "atnauthor"),
+ new KeyStruct(Major.Destination, Minor.Annotation, "annotation"),
+ new KeyStruct(Major.Destination, Minor.AnnotRef, "atnref"),
+ new KeyStruct(Major.Destination, Minor.AnnotTime, "atntime"),
+ new KeyStruct(Major.Destination, Minor.AnnotIcon, "atnicn"),
+ new KeyStruct(Major.Destination, Minor.Field, "field"),
+ new KeyStruct(Major.Destination, Minor.FieldInst, "fldinst"),
+ new KeyStruct(Major.Destination, Minor.FieldResult, "fldrslt"),
+ new KeyStruct(Major.Destination, Minor.DataField, "datafield"),
+ new KeyStruct(Major.Destination, Minor.Index, "xe"),
+ new KeyStruct(Major.Destination, Minor.IndexText, "txe"),
+ new KeyStruct(Major.Destination, Minor.IndexRange, "rxe"),
+ new KeyStruct(Major.Destination, Minor.TOC, "tc"),
+ new KeyStruct(Major.Destination, Minor.NeXTGraphic, "NeXTGraphic"),
+ new KeyStruct(Major.FontFamily, Minor.FFNil, "fnil"),
+ new KeyStruct(Major.FontFamily, Minor.FFRoman, "froman"),
+ new KeyStruct(Major.FontFamily, Minor.FFSwiss, "fswiss"),
+ new KeyStruct(Major.FontFamily, Minor.FFModern, "fmodern"),
+ new KeyStruct(Major.FontFamily, Minor.FFScript, "fscript"),
+ new KeyStruct(Major.FontFamily, Minor.FFDecor, "fdecor"),
+ new KeyStruct(Major.FontFamily, Minor.FFTech, "ftech"),
+ new KeyStruct(Major.FontFamily, Minor.FFBidirectional, "fbidi"),
+ new KeyStruct(Major.FontAttr, Minor.FontCharSet, "fcharset"),
+ new KeyStruct(Major.FontAttr, Minor.FontPitch, "fprq"),
+ new KeyStruct(Major.FontAttr, Minor.FontCodePage, "cpg"),
+ new KeyStruct(Major.FontAttr, Minor.FTypeNil, "ftnil"),
+ new KeyStruct(Major.FontAttr, Minor.FTypeTrueType, "fttruetype"),
+ new KeyStruct(Major.FileAttr, Minor.FileNum, "fid"),
+ new KeyStruct(Major.FileAttr, Minor.FileRelPath, "frelative"),
+ new KeyStruct(Major.FileAttr, Minor.FileOSNum, "fosnum"),
+ new KeyStruct(Major.FileSource, Minor.SrcMacintosh, "fvalidmac"),
+ new KeyStruct(Major.FileSource, Minor.SrcDOS, "fvaliddos"),
+ new KeyStruct(Major.FileSource, Minor.SrcNTFS, "fvalidntfs"),
+ new KeyStruct(Major.FileSource, Minor.SrcHPFS, "fvalidhpfs"),
+ new KeyStruct(Major.FileSource, Minor.SrcNetwork, "fnetwork"),
+ new KeyStruct(Major.ColorName, Minor.Red, "red"),
+ new KeyStruct(Major.ColorName, Minor.Green, "green"),
+ new KeyStruct(Major.ColorName, Minor.Blue, "blue"),
+ new KeyStruct(Major.CharSet, Minor.MacCharSet, "mac"),
+ new KeyStruct(Major.CharSet, Minor.AnsiCharSet, "ansi"),
+ new KeyStruct(Major.CharSet, Minor.PcCharSet, "pc"),
+ new KeyStruct(Major.CharSet, Minor.PcaCharSet, "pca"),
+ new KeyStruct(Major.TblAttr, Minor.RowDef, "trowd"),
+ new KeyStruct(Major.TblAttr, Minor.RowGapH, "trgaph"),
+ new KeyStruct(Major.TblAttr, Minor.CellPos, "cellx"),
+ new KeyStruct(Major.TblAttr, Minor.MergeRngFirst, "clmgf"),
+ new KeyStruct(Major.TblAttr, Minor.MergePrevious, "clmrg"),
+ new KeyStruct(Major.TblAttr, Minor.RowLeft, "trql"),
+ new KeyStruct(Major.TblAttr, Minor.RowRight, "trqr"),
+ new KeyStruct(Major.TblAttr, Minor.RowCenter, "trqc"),
+ new KeyStruct(Major.TblAttr, Minor.RowLeftEdge, "trleft"),
+ new KeyStruct(Major.TblAttr, Minor.RowHt, "trrh"),
+ new KeyStruct(Major.TblAttr, Minor.RowHeader, "trhdr"),
+ new KeyStruct(Major.TblAttr, Minor.RowKeep, "trkeep"),
+ new KeyStruct(Major.TblAttr, Minor.RTLRow, "rtlrow"),
+ new KeyStruct(Major.TblAttr, Minor.LTRRow, "ltrrow"),
+ new KeyStruct(Major.TblAttr, Minor.RowBordTop, "trbrdrt"),
+ new KeyStruct(Major.TblAttr, Minor.RowBordLeft, "trbrdrl"),
+ new KeyStruct(Major.TblAttr, Minor.RowBordBottom, "trbrdrb"),
+ new KeyStruct(Major.TblAttr, Minor.RowBordRight, "trbrdrr"),
+ new KeyStruct(Major.TblAttr, Minor.RowBordHoriz, "trbrdrh"),
+ new KeyStruct(Major.TblAttr, Minor.RowBordVert, "trbrdrv"),
+ new KeyStruct(Major.TblAttr, Minor.CellBordBottom, "clbrdrb"),
+ new KeyStruct(Major.TblAttr, Minor.CellBordTop, "clbrdrt"),
+ new KeyStruct(Major.TblAttr, Minor.CellBordLeft, "clbrdrl"),
+ new KeyStruct(Major.TblAttr, Minor.CellBordRight, "clbrdrr"),
+ new KeyStruct(Major.TblAttr, Minor.CellShading, "clshdng"),
+ new KeyStruct(Major.TblAttr, Minor.CellBgPatH, "clbghoriz"),
+ new KeyStruct(Major.TblAttr, Minor.CellBgPatV, "clbgvert"),
+ new KeyStruct(Major.TblAttr, Minor.CellFwdDiagBgPat, "clbgfdiag"),
+ new KeyStruct(Major.TblAttr, Minor.CellBwdDiagBgPat, "clbgbdiag"),
+ new KeyStruct(Major.TblAttr, Minor.CellHatchBgPat, "clbgcross"),
+ new KeyStruct(Major.TblAttr, Minor.CellDiagHatchBgPat, "clbgdcross"),
+ new KeyStruct(Major.TblAttr, Minor.CellDarkBgPatH, "clbgdkhoriz"),
+ new KeyStruct(Major.TblAttr, Minor.CellDarkBgPatH, "clbgdkhor"),
+ new KeyStruct(Major.TblAttr, Minor.CellDarkBgPatV, "clbgdkvert"),
+ new KeyStruct(Major.TblAttr, Minor.CellFwdDarkBgPat, "clbgdkfdiag"),
+ new KeyStruct(Major.TblAttr, Minor.CellBwdDarkBgPat, "clbgdkbdiag"),
+ new KeyStruct(Major.TblAttr, Minor.CellDarkHatchBgPat, "clbgdkcross"),
+ new KeyStruct(Major.TblAttr, Minor.CellDarkDiagHatchBgPat, "clbgdkdcross"),
+ new KeyStruct(Major.TblAttr, Minor.CellBgPatLineColor, "clcfpat"),
+ new KeyStruct(Major.TblAttr, Minor.CellBgPatColor, "clcbpat"),
+ new KeyStruct(Major.FieldAttr, Minor.FieldDirty, "flddirty"),
+ new KeyStruct(Major.FieldAttr, Minor.FieldEdited, "fldedit"),
+ new KeyStruct(Major.FieldAttr, Minor.FieldLocked, "fldlock"),
+ new KeyStruct(Major.FieldAttr, Minor.FieldPrivate, "fldpriv"),
+ new KeyStruct(Major.FieldAttr, Minor.FieldAlt, "fldalt"),
+ new KeyStruct(Major.PosAttr, Minor.AbsWid, "absw"),
+ new KeyStruct(Major.PosAttr, Minor.AbsHt, "absh"),
+ new KeyStruct(Major.PosAttr, Minor.RPosMargH, "phmrg"),
+ new KeyStruct(Major.PosAttr, Minor.RPosPageH, "phpg"),
+ new KeyStruct(Major.PosAttr, Minor.RPosColH, "phcol"),
+ new KeyStruct(Major.PosAttr, Minor.PosX, "posx"),
+ new KeyStruct(Major.PosAttr, Minor.PosNegX, "posnegx"),
+ new KeyStruct(Major.PosAttr, Minor.PosXCenter, "posxc"),
+ new KeyStruct(Major.PosAttr, Minor.PosXInside, "posxi"),
+ new KeyStruct(Major.PosAttr, Minor.PosXOutSide, "posxo"),
+ new KeyStruct(Major.PosAttr, Minor.PosXRight, "posxr"),
+ new KeyStruct(Major.PosAttr, Minor.PosXLeft, "posxl"),
+ new KeyStruct(Major.PosAttr, Minor.RPosMargV, "pvmrg"),
+ new KeyStruct(Major.PosAttr, Minor.RPosPageV, "pvpg"),
+ new KeyStruct(Major.PosAttr, Minor.RPosParaV, "pvpara"),
+ new KeyStruct(Major.PosAttr, Minor.PosY, "posy"),
+ new KeyStruct(Major.PosAttr, Minor.PosNegY, "posnegy"),
+ new KeyStruct(Major.PosAttr, Minor.PosYInline, "posyil"),
+ new KeyStruct(Major.PosAttr, Minor.PosYTop, "posyt"),
+ new KeyStruct(Major.PosAttr, Minor.PosYCenter, "posyc"),
+ new KeyStruct(Major.PosAttr, Minor.PosYBottom, "posyb"),
+ new KeyStruct(Major.PosAttr, Minor.NoWrap, "nowrap"),
+ new KeyStruct(Major.PosAttr, Minor.DistFromTextAll, "dxfrtext"),
+ new KeyStruct(Major.PosAttr, Minor.DistFromTextX, "dfrmtxtx"),
+ new KeyStruct(Major.PosAttr, Minor.DistFromTextY, "dfrmtxty"),
+ new KeyStruct(Major.PosAttr, Minor.TextDistY, "dyfrtext"),
+ new KeyStruct(Major.PosAttr, Minor.DropCapLines, "dropcapli"),
+ new KeyStruct(Major.PosAttr, Minor.DropCapType, "dropcapt"),
+ new KeyStruct(Major.ObjAttr, Minor.ObjEmb, "objemb"),
+ new KeyStruct(Major.ObjAttr, Minor.ObjLink, "objlink"),
+ new KeyStruct(Major.ObjAttr, Minor.ObjAutoLink, "objautlink"),
+ new KeyStruct(Major.ObjAttr, Minor.ObjSubscriber, "objsub"),
+ new KeyStruct(Major.ObjAttr, Minor.ObjPublisher, "objpub"),
+ new KeyStruct(Major.ObjAttr, Minor.ObjICEmb, "objicemb"),
+ new KeyStruct(Major.ObjAttr, Minor.ObjLinkSelf, "linkself"),
+ new KeyStruct(Major.ObjAttr, Minor.ObjLock, "objupdate"),
+ new KeyStruct(Major.ObjAttr, Minor.ObjUpdate, "objlock"),
+ new KeyStruct(Major.ObjAttr, Minor.ObjHt, "objh"),
+ new KeyStruct(Major.ObjAttr, Minor.ObjWid, "objw"),
+ new KeyStruct(Major.ObjAttr, Minor.ObjSetSize, "objsetsize"),
+ new KeyStruct(Major.ObjAttr, Minor.ObjAlign, "objalign"),
+ new KeyStruct(Major.ObjAttr, Minor.ObjTransposeY, "objtransy"),
+ new KeyStruct(Major.ObjAttr, Minor.ObjCropTop, "objcropt"),
+ new KeyStruct(Major.ObjAttr, Minor.ObjCropBottom, "objcropb"),
+ new KeyStruct(Major.ObjAttr, Minor.ObjCropLeft, "objcropl"),
+ new KeyStruct(Major.ObjAttr, Minor.ObjCropRight, "objcropr"),
+ new KeyStruct(Major.ObjAttr, Minor.ObjScaleX, "objscalex"),
+ new KeyStruct(Major.ObjAttr, Minor.ObjScaleY, "objscaley"),
+ new KeyStruct(Major.ObjAttr, Minor.ObjResRTF, "rsltrtf"),
+ new KeyStruct(Major.ObjAttr, Minor.ObjResPict, "rsltpict"),
+ new KeyStruct(Major.ObjAttr, Minor.ObjResBitmap, "rsltbmp"),
+ new KeyStruct(Major.ObjAttr, Minor.ObjResText, "rslttxt"),
+ new KeyStruct(Major.ObjAttr, Minor.ObjResMerge, "rsltmerge"),
+ new KeyStruct(Major.ObjAttr, Minor.ObjBookmarkPubObj, "bkmkpub"),
+ new KeyStruct(Major.ObjAttr, Minor.ObjPubAutoUpdate, "pubauto"),
+ new KeyStruct(Major.ACharAttr, Minor.ACBold, "ab"),
+ new KeyStruct(Major.ACharAttr, Minor.ACAllCaps, "caps"),
+ new KeyStruct(Major.ACharAttr, Minor.ACForeColor, "acf"),
+ new KeyStruct(Major.ACharAttr, Minor.ACSubScript, "adn"),
+ new KeyStruct(Major.ACharAttr, Minor.ACExpand, "aexpnd"),
+ new KeyStruct(Major.ACharAttr, Minor.ACFontNum, "af"),
+ new KeyStruct(Major.ACharAttr, Minor.ACFontSize, "afs"),
+ new KeyStruct(Major.ACharAttr, Minor.ACItalic, "ai"),
+ new KeyStruct(Major.ACharAttr, Minor.ACLanguage, "alang"),
+ new KeyStruct(Major.ACharAttr, Minor.ACOutline, "aoutl"),
+ new KeyStruct(Major.ACharAttr, Minor.ACSmallCaps, "ascaps"),
+ new KeyStruct(Major.ACharAttr, Minor.ACShadow, "ashad"),
+ new KeyStruct(Major.ACharAttr, Minor.ACStrikeThru, "astrike"),
+ new KeyStruct(Major.ACharAttr, Minor.ACUnderline, "aul"),
+ new KeyStruct(Major.ACharAttr, Minor.ACDotUnderline, "auld"),
+ new KeyStruct(Major.ACharAttr, Minor.ACDbUnderline, "auldb"),
+ new KeyStruct(Major.ACharAttr, Minor.ACNoUnderline, "aulnone"),
+ new KeyStruct(Major.ACharAttr, Minor.ACWordUnderline, "aulw"),
+ new KeyStruct(Major.ACharAttr, Minor.ACSuperScript, "aup"),
+ new KeyStruct(Major.FNoteAttr, Minor.FNAlt, "ftnalt"),
+ new KeyStruct(Major.KeyCodeAttr, Minor.AltKey, "alt"),
+ new KeyStruct(Major.KeyCodeAttr, Minor.ShiftKey, "shift"),
+ new KeyStruct(Major.KeyCodeAttr, Minor.ControlKey, "ctrl"),
+ new KeyStruct(Major.KeyCodeAttr, Minor.FunctionKey, "fn"),
+ new KeyStruct(Major.BookmarkAttr, Minor.BookmarkFirstCol, "bkmkcolf"),
+ new KeyStruct(Major.BookmarkAttr, Minor.BookmarkLastCol, "bkmkcoll"),
+ new KeyStruct(Major.IndexAttr, Minor.IndexNumber, "xef"),
+ new KeyStruct(Major.IndexAttr, Minor.IndexBold, "bxe"),
+ new KeyStruct(Major.IndexAttr, Minor.IndexItalic, "ixe"),
+ new KeyStruct(Major.TOCAttr, Minor.TOCType, "tcf"),
+ new KeyStruct(Major.TOCAttr, Minor.TOCLevel, "tcl"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawLock, "dolock"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawPageRelX, "doxpage"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawColumnRelX, "dobxcolumn"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawMarginRelX, "dobxmargin"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawPageRelY, "dobypage"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawColumnRelY, "dobycolumn"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawMarginRelY, "dobymargin"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawHeight, "dobhgt"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawBeginGroup, "dpgroup"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawGroupCount, "dpcount"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawEndGroup, "dpendgroup"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawArc, "dparc"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawCallout, "dpcallout"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawEllipse, "dpellipse"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawLine, "dpline"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawPolygon, "dppolygon"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawPolyLine, "dppolyline"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawRect, "dprect"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawTextBox, "dptxbx"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawOffsetX, "dpx"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawSizeX, "dpxsize"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawOffsetY, "dpy"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawSizeY, "dpysize"),
+ new KeyStruct(Major.DrawAttr, Minor.COAngle, "dpcoa"),
+ new KeyStruct(Major.DrawAttr, Minor.COAccentBar, "dpcoaccent"),
+ new KeyStruct(Major.DrawAttr, Minor.COBestFit, "dpcobestfit"),
+ new KeyStruct(Major.DrawAttr, Minor.COBorder, "dpcoborder"),
+ new KeyStruct(Major.DrawAttr, Minor.COAttachAbsDist, "dpcodabs"),
+ new KeyStruct(Major.DrawAttr, Minor.COAttachBottom, "dpcodbottom"),
+ new KeyStruct(Major.DrawAttr, Minor.COAttachCenter, "dpcodcenter"),
+ new KeyStruct(Major.DrawAttr, Minor.COAttachTop, "dpcodtop"),
+ new KeyStruct(Major.DrawAttr, Minor.COLength, "dpcolength"),
+ new KeyStruct(Major.DrawAttr, Minor.CONegXQuadrant, "dpcominusx"),
+ new KeyStruct(Major.DrawAttr, Minor.CONegYQuadrant, "dpcominusy"),
+ new KeyStruct(Major.DrawAttr, Minor.COOffset, "dpcooffset"),
+ new KeyStruct(Major.DrawAttr, Minor.COAttachSmart, "dpcosmarta"),
+ new KeyStruct(Major.DrawAttr, Minor.CODoubleLine, "dpcotdouble"),
+ new KeyStruct(Major.DrawAttr, Minor.CORightAngle, "dpcotright"),
+ new KeyStruct(Major.DrawAttr, Minor.COSingleLine, "dpcotsingle"),
+ new KeyStruct(Major.DrawAttr, Minor.COTripleLine, "dpcottriple"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawTextBoxMargin, "dptxbxmar"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawTextBoxText, "dptxbxtext"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawRoundRect, "dproundr"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawPointX, "dpptx"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawPointY, "dppty"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawPolyCount, "dppolycount"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawArcFlipX, "dparcflipx"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawArcFlipY, "dparcflipy"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawLineBlue, "dplinecob"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawLineGreen, "dplinecog"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawLineRed, "dplinecor"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawLinePalette, "dplinepal"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawLineDashDot, "dplinedado"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawLineDashDotDot, "dplinedadodo"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawLineDash, "dplinedash"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawLineDot, "dplinedot"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawLineGray, "dplinegray"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawLineHollow, "dplinehollow"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawLineSolid, "dplinesolid"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawLineWidth, "dplinew"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawHollowEndArrow, "dpaendhol"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawEndArrowLength, "dpaendl"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawSolidEndArrow, "dpaendsol"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawEndArrowWidth, "dpaendw"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawHollowStartArrow,"dpastarthol"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawStartArrowLength,"dpastartl"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawSolidStartArrow, "dpastartsol"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawStartArrowWidth, "dpastartw"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawBgFillBlue, "dpfillbgcb"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawBgFillGreen, "dpfillbgcg"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawBgFillRed, "dpfillbgcr"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawBgFillPalette, "dpfillbgpal"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawBgFillGray, "dpfillbggray"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawFgFillBlue, "dpfillfgcb"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawFgFillGreen, "dpfillfgcg"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawFgFillRed, "dpfillfgcr"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawFgFillPalette, "dpfillfgpal"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawFgFillGray, "dpfillfggray"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawFillPatIndex, "dpfillpat"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawShadow, "dpshadow"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawShadowXOffset, "dpshadx"),
+ new KeyStruct(Major.DrawAttr, Minor.DrawShadowYOffset, "dpshady"),
+ new KeyStruct(Major.Version, Minor.Undefined, "rtf"),
+ new KeyStruct(Major.DefFont, Minor.Undefined, "deff"),
+ new KeyStruct(Major.Unicode, Minor.UnicodeCharBytes, "uc"),
+ new KeyStruct(Major.Unicode, Minor.UnicodeChar, "u"),
+ new KeyStruct(Major.Unicode, Minor.UnicodeDestination, "ud"),
+ new KeyStruct(Major.Unicode, Minor.UnicodeDualDestination, "upr"),
+ new KeyStruct(Major.Unicode, Minor.UnicodeAnsiCodepage, "ansicpg"),
+ };
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Major.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Major.cs
new file mode 100644
index 00000000000..023a012e370
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Major.cs
@@ -0,0 +1,67 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms.RTF {
+ internal enum Major {
+ // Group class
+ BeginGroup = 0,
+ EndGroup = 1,
+
+ // Control
+ Version = 0,
+ DefFont = 1,
+ CharSet = 2,
+
+ Destination = 3,
+ FontFamily = 4,
+ ColorName = 5,
+ SpecialChar = 6,
+ StyleAttr = 7,
+ DocAttr = 8,
+ SectAttr = 9,
+ TblAttr = 10,
+ ParAttr = 11,
+ CharAttr = 12,
+ PictAttr = 13,
+ BookmarkAttr = 14,
+ NeXTGrAttr = 15,
+ FieldAttr = 16,
+ TOCAttr = 17,
+ PosAttr = 18,
+ ObjAttr = 19,
+ FNoteAttr = 20,
+ KeyCodeAttr = 21,
+ ACharAttr = 22,
+ FontAttr = 23,
+ FileAttr = 24,
+ FileSource = 25,
+ DrawAttr = 26,
+ IndexAttr = 27,
+ Unicode = 28
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Minor.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Minor.cs
new file mode 100644
index 00000000000..92afb4a42f6
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Minor.cs
@@ -0,0 +1,765 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ internal enum Minor {
+ Undefined = -1,
+
+ // Major.CharSet
+ AnsiCharSet = 0,
+ MacCharSet = 1,
+ PcCharSet = 2,
+ PcaCharSet = 3,
+
+ // Major.Destination
+ FontTbl = 0,
+ FontAltName = 1,
+ EmbeddedFont = 2,
+ FontFile = 3,
+ FileTbl = 4,
+ FileInfo = 5,
+ ColorTbl = 6,
+ StyleSheet = 7,
+ KeyCode = 8,
+ RevisionTbl = 9,
+ Info = 10,
+ ITitle = 11,
+ ISubject = 12,
+ IAuthor = 13,
+ IOperator = 14,
+ IKeywords = 15,
+ IComment = 16,
+ IVersion = 17,
+ IDoccomm = 18,
+ IVerscomm = 19,
+ NextFile = 20,
+ Template = 21,
+ FNSep = 22,
+ FNContSep = 23,
+ FNContNotice = 24,
+ ENSep = 25,
+ ENContSep = 26,
+ ENContNotice = 27,
+ PageNumLevel = 28,
+ ParNumLevelStyle= 29,
+ Header = 30,
+ Footer = 31,
+ HeaderLeft = 32,
+ HeaderRight = 33,
+ HeaderFirst = 34,
+ FooterLeft = 35,
+ FooterRight = 36,
+ FooterFirst = 37,
+ ParNumText = 38,
+ ParNumbering = 39,
+ ParNumTextAfter = 40,
+ ParNumTextBefore= 41,
+ BookmarkStart = 42,
+ BookmarkEnd = 43,
+ Pict = 44,
+ Object = 45,
+ ObjClass = 46,
+ ObjName = 47,
+ ObjTime = 48,
+ ObjData = 49,
+ ObjAlias = 50,
+ ObjSection = 51,
+ ObjResult = 52,
+ ObjItem = 53,
+ ObjTopic = 54,
+ DrawObject = 55,
+ Footnote = 56,
+ AnnotRefStart = 57,
+ AnnotRefEnd = 58,
+ AnnotID = 59,
+ AnnotAuthor = 60,
+ Annotation = 61,
+ AnnotRef = 62,
+ AnnotTime = 63,
+ AnnotIcon = 64,
+ Field = 65,
+ FieldInst = 66,
+ FieldResult = 67,
+ DataField = 68,
+ Index = 69,
+ IndexText = 70,
+ IndexRange = 71,
+ TOC = 72,
+ NeXTGraphic = 73,
+ MaxDestination = 74,
+
+ // Major.FontFamily
+ FFNil = 0,
+ FFRoman = 1,
+ FFSwiss = 2,
+ FFModern = 3,
+ FFScript = 4,
+ FFDecor = 5,
+ FFTech = 6,
+ FFBidirectional = 7,
+
+ // Major.ColorName
+ Red = 0,
+ Green = 1,
+ Blue = 2,
+
+ // Major.SpecialChar
+ IIntVersion = 0,
+ ICreateTime = 1,
+ IRevisionTime = 2,
+ IPrintTime = 3,
+ IBackupTime = 4,
+ IEditTime = 5,
+ IYear = 6,
+ IMonth = 7,
+ IDay = 8,
+ IHour = 9,
+ IMinute = 10,
+ ISecond = 11,
+ INPages = 12,
+ INWords = 13,
+ INChars = 14,
+ IIntID = 15,
+ CurHeadDate = 16,
+ CurHeadDateLong = 17,
+ CurHeadDateAbbrev= 18,
+ CurHeadTime = 19,
+ CurHeadPage = 20,
+ SectNum = 21,
+ CurFNote = 22,
+ CurAnnotRef = 23,
+ FNoteSep = 24,
+ FNoteCont = 25,
+ Cell = 26,
+ Row = 27,
+ Par = 28,
+ Sect = 29,
+ Page = 30,
+ Column = 31,
+ Line = 32,
+ SoftPage = 33,
+ SoftColumn = 34,
+ SoftLine = 35,
+ SoftLineHt = 36,
+ Tab = 37,
+ EmDash = 38,
+ EnDash = 39,
+ EmSpace = 40,
+ EnSpace = 41,
+ Bullet = 42,
+ LQuote = 43,
+ RQuote = 44,
+ LDblQuote = 45,
+ RDblQuote = 46,
+ Formula = 47,
+ NoBrkSpace = 49,
+ NoReqHyphen = 50,
+ NoBrkHyphen = 51,
+ OptDest = 52,
+ LTRMark = 53,
+ RTLMark = 54,
+ NoWidthJoiner = 55,
+ NoWidthNonJoiner= 56,
+ CurHeadPict = 57,
+
+ // Major.StyleAttr
+ Additive = 0,
+ BasedOn = 1,
+ Next = 2,
+
+ // Major.DocAttr
+ DefTab = 0,
+ HyphHotZone = 1,
+ HyphConsecLines = 2,
+ HyphCaps = 3,
+ HyphAuto = 4,
+ LineStart = 5,
+ FracWidth = 6,
+ MakeBackup = 7,
+ RTFDefault = 8,
+ PSOverlay = 9,
+ DocTemplate = 10,
+ DefLanguage = 11,
+ FENoteType = 12,
+ FNoteEndSect = 13,
+ FNoteEndDoc = 14,
+ FNoteText = 15,
+ FNoteBottom = 16,
+ ENoteEndSect = 17,
+ ENoteEndDoc = 18,
+ ENoteText = 19,
+ ENoteBottom = 20,
+ FNoteStart = 21,
+ ENoteStart = 22,
+ FNoteRestartPage= 23,
+ FNoteRestart = 24,
+ FNoteRestartCont= 25,
+ ENoteRestart = 26,
+ ENoteRestartCont= 27,
+ FNoteNumArabic = 28,
+ FNoteNumLLetter = 29,
+ FNoteNumULetter = 30,
+ FNoteNumLRoman = 31,
+ FNoteNumURoman = 32,
+ FNoteNumChicago = 33,
+ ENoteNumArabic = 34,
+ ENoteNumLLetter = 35,
+ ENoteNumULetter = 36,
+ ENoteNumLRoman = 37,
+ ENoteNumURoman = 38,
+ ENoteNumChicago = 39,
+ PaperWidth = 40,
+ PaperHeight = 41,
+ PaperSize = 42,
+ LeftMargin = 43,
+ RightMargin = 44,
+ TopMargin = 45,
+ BottomMargin = 46,
+ FacingPage = 47,
+ GutterWid = 48,
+ MirrorMargin = 49,
+ Landscape = 50,
+ PageStart = 51,
+ WidowCtrl = 52,
+ LinkStyles = 53,
+ NoAutoTabIndent = 54,
+ WrapSpaces = 55,
+ PrintColorsBlack= 56,
+ NoExtraSpaceRL = 57,
+ NoColumnBalance = 58,
+ CvtMailMergeQuote= 59,
+ SuppressTopSpace= 60,
+ SuppressPreParSpace= 61,
+ CombineTblBorders= 62,
+ TranspMetafiles = 63,
+ SwapBorders = 64,
+ ShowHardBreaks = 65,
+ FormProtected = 66,
+ AllProtected = 67,
+ FormShading = 68,
+ FormDisplay = 69,
+ PrintData = 70,
+ RevProtected = 71,
+ Revisions = 72,
+ RevDisplay = 73,
+ RevBar = 74,
+ AnnotProtected = 75,
+ RTLDoc = 76,
+ LTRDoc = 77,
+
+ // Major.SectAttr
+
+ SectDef = 0,
+ ENoteHere = 1,
+ PrtBinFirst = 2,
+ PrtBin = 3,
+ SectStyleNum = 4,
+ NoBreak = 5,
+ ColBreak = 6,
+ PageBreak = 7,
+ EvenBreak = 8,
+ OddBreak = 9,
+ Columns = 10,
+ ColumnSpace = 11,
+ ColumnNumber = 12,
+ ColumnSpRight = 13,
+ ColumnWidth = 14,
+ ColumnLine = 15,
+ LineModulus = 16,
+ LineDist = 17,
+ LineStarts = 18,
+ LineRestart = 19,
+ LineRestartPg = 20,
+ LineCont = 21,
+ SectPageWid = 22,
+ SectPageHt = 23,
+ SectMarginLeft = 24,
+ SectMarginRight = 25,
+ SectMarginTop = 26,
+ SectMarginBottom= 27,
+ SectMarginGutter= 28,
+ SectLandscape = 29,
+ TitleSpecial = 30,
+ HeaderY = 31,
+ FooterY = 32,
+ PageStarts = 33,
+ PageCont = 34,
+ PageRestart = 35,
+ PageNumRight = 36,
+ PageNumTop = 37,
+ PageDecimal = 38,
+ PageURoman = 39,
+ PageLRoman = 40,
+ PageULetter = 41,
+ PageLLetter = 42,
+ PageNumHyphSep = 43,
+ PageNumSpaceSep = 44,
+ PageNumColonSep = 45,
+ PageNumEmdashSep= 46,
+ PageNumEndashSep= 47,
+ TopVAlign = 48,
+ BottomVAlign = 49,
+ CenterVAlign = 50,
+ JustVAlign = 51,
+ RTLSect = 52,
+ LTRSect = 53,
+
+ // Major.TblAttr
+ RowDef = 0,
+ RowGapH = 1,
+ CellPos = 2,
+ MergeRngFirst = 3,
+ MergePrevious = 4,
+ RowLeft = 5,
+ RowRight = 6,
+ RowCenter = 7,
+ RowLeftEdge = 8,
+ RowHt = 9,
+ RowHeader = 10,
+ RowKeep = 11,
+ RTLRow = 12,
+ LTRRow = 13,
+ RowBordTop = 14,
+ RowBordLeft = 15,
+ RowBordBottom = 16,
+ RowBordRight = 17,
+ RowBordHoriz = 18,
+ RowBordVert = 19,
+ CellBordBottom = 20,
+ CellBordTop = 21,
+ CellBordLeft = 22,
+ CellBordRight = 23,
+ CellShading = 24,
+ CellBgPatH = 25,
+ CellBgPatV = 26,
+ CellFwdDiagBgPat= 27,
+ CellBwdDiagBgPat= 28,
+ CellHatchBgPat = 29,
+ CellDiagHatchBgPat = 30,
+ CellDarkBgPatH = 31,
+ CellDarkBgPatV = 32,
+ CellFwdDarkBgPat= 33,
+ CellBwdDarkBgPat= 34,
+ CellDarkHatchBgPat = 35,
+ CellDarkDiagHatchBgPat = 36,
+ CellBgPatLineColor = 37,
+ CellBgPatColor = 38,
+
+ // Major.ParAttr
+ ParDef = 0,
+ StyleNum = 1,
+ Hyphenate = 2,
+ InTable = 3,
+ Keep = 4,
+ NoWidowControl = 5,
+ KeepNext = 6,
+ OutlineLevel = 7,
+ NoLineNum = 8,
+ PBBefore = 9,
+ SideBySide = 10,
+ QuadLeft = 11,
+ QuadRight = 12,
+ QuadJust = 13,
+ QuadCenter = 14,
+ FirstIndent = 15,
+ LeftIndent = 16,
+ RightIndent = 17,
+ SpaceBefore = 18,
+ SpaceAfter = 19,
+ SpaceBetween = 20,
+ SpaceMultiply = 21,
+ SubDocument = 22,
+ RTLPar = 23,
+ LTRPar = 24,
+ TabPos = 25,
+ TabLeft = 26,
+ TabRight = 27,
+ TabCenter = 28,
+ TabDecimal = 29,
+ TabBar = 30,
+ LeaderDot = 31,
+ LeaderHyphen = 32,
+ LeaderUnder = 33,
+ LeaderThick = 34,
+ LeaderEqual = 35,
+ ParLevel = 36,
+ ParBullet = 37,
+ ParSimple = 38,
+ ParNumCont = 39,
+ ParNumOnce = 40,
+ ParNumAcross = 41,
+ ParHangIndent = 42,
+ ParNumRestart = 43,
+ ParNumCardinal = 44,
+ ParNumDecimal = 45,
+ ParNumULetter = 46,
+ ParNumURoman = 47,
+ ParNumLLetter = 48,
+ ParNumLRoman = 49,
+ ParNumOrdinal = 50,
+ ParNumOrdinalText= 51,
+ ParNumBold = 52,
+ ParNumItalic = 53,
+ ParNumAllCaps = 54,
+ ParNumSmallCaps = 55,
+ ParNumUnder = 56,
+ ParNumDotUnder = 57,
+ ParNumDbUnder = 58,
+ ParNumNoUnder = 59,
+ ParNumWordUnder = 60,
+ ParNumStrikethru= 61,
+ ParNumForeColor = 62,
+ ParNumFont = 63,
+ ParNumFontSize = 64,
+ ParNumIndent = 65,
+ ParNumSpacing = 66,
+ ParNumInclPrev = 67,
+ ParNumCenter = 68,
+ ParNumLeft = 69,
+ ParNumRight = 70,
+ ParNumStartAt = 71,
+ BorderTop = 72,
+ BorderBottom = 73,
+ BorderLeft = 74,
+ BorderRight = 75,
+ BorderBetween = 76,
+ BorderBar = 77,
+ BorderBox = 78,
+ BorderSingle = 79,
+ BorderThick = 80,
+ BorderShadow = 81,
+ BorderDouble = 82,
+ BorderDot = 83,
+ BorderDash = 84,
+ BorderHair = 85,
+ BorderWidth = 86,
+ BorderColor = 87,
+ BorderSpace = 88,
+ Shading = 89,
+ BgPatH = 90,
+ BgPatV = 91,
+ FwdDiagBgPat = 92,
+ BwdDiagBgPat = 93,
+ HatchBgPat = 94,
+ DiagHatchBgPat = 95,
+ DarkBgPatH = 96,
+ DarkBgPatV = 97,
+ FwdDarkBgPat = 98,
+ BwdDarkBgPat = 99,
+ DarkHatchBgPat = 100,
+ DarkDiagHatchBgPat= 101,
+ BgPatLineColor = 102,
+ BgPatColor = 103,
+
+ // Major.CharAttr
+ Plain = 0,
+ Bold = 1,
+ AllCaps = 2,
+ Deleted = 3,
+ SubScript = 4,
+ SubScrShrink = 5,
+ NoSuperSub = 6,
+ Expand = 7,
+ ExpandTwips = 8,
+ Kerning = 9,
+ FontNum = 10,
+ FontSize = 11,
+ Italic = 12,
+ Outline = 13,
+ Revised = 14,
+ RevAuthor = 15,
+ RevDTTM = 16,
+ SmallCaps = 17,
+ Shadow = 18,
+ StrikeThru = 19,
+ Underline = 20,
+ DotUnderline = 21,
+ DbUnderline = 22,
+ NoUnderline = 23,
+ WordUnderline = 24,
+ SuperScript = 25,
+ SuperScrShrink = 26,
+ Invisible = 27,
+ ForeColor = 28,
+ BackColor = 29,
+ RTLChar = 30,
+ LTRChar = 31,
+ CharStyleNum = 32,
+ CharCharSet = 33,
+ Language = 34,
+ Gray = 35,
+
+ // Major.PictAttr
+ MacQD = 0,
+ PMMetafile = 1,
+ WinMetafile = 2,
+ DevIndBitmap = 3,
+ WinBitmap = 4,
+ PixelBits = 5,
+ BitmapPlanes = 6,
+ BitmapWid = 7,
+ PicWid = 8,
+ PicHt = 9,
+ PicGoalWid = 10,
+ PicGoalHt = 11,
+ PicScaleX = 12,
+ PicScaleY = 13,
+ PicScaled = 14,
+ PicCropTop = 15,
+ PicCropBottom = 16,
+ PicCropLeft = 17,
+ PicCropRight = 18,
+ PicMFHasBitmap = 19,
+ PicMFBitsPerPixel= 20,
+ PicBinary = 21,
+
+ // Major.BookmarkAttr
+ BookmarkFirstCol= 0,
+ BookmarkLastCol = 1,
+
+ // Major.NeXTGrAttr
+ NeXTGWidth = 0,
+ NeXTGHeight = 1,
+
+ // Major.FieldAttr
+ FieldDirty = 0,
+ FieldEdited = 1,
+ FieldLocked = 2,
+ FieldPrivate = 3,
+ FieldAlt = 4,
+
+ // Major.TOCAttr
+ TOCType = 0,
+ TOCLevel = 1,
+
+ // Major.PosAttr
+ AbsWid = 0,
+ AbsHt = 1,
+ RPosMargH = 2,
+ RPosPageH = 3,
+ RPosColH = 4,
+ PosX = 5,
+ PosNegX = 6,
+ PosXCenter = 7,
+ PosXInside = 8,
+ PosXOutSide = 9,
+ PosXRight = 10,
+ PosXLeft = 11,
+ RPosMargV = 12,
+ RPosPageV = 13,
+ RPosParaV = 14,
+ PosY = 15,
+ PosNegY = 16,
+ PosYInline = 17,
+ PosYTop = 18,
+ PosYCenter = 19,
+ PosYBottom = 20,
+ NoWrap = 21,
+ DistFromTextAll = 22,
+ DistFromTextX = 23,
+ DistFromTextY = 24,
+ TextDistY = 25,
+ DropCapLines = 26,
+ DropCapType = 27,
+
+ // Major.ObjAttr
+ ObjEmb = 0,
+ ObjLink = 1,
+ ObjAutoLink = 2,
+ ObjSubscriber = 3,
+ ObjPublisher = 4,
+ ObjICEmb = 5,
+ ObjLinkSelf = 6,
+ ObjLock = 7,
+ ObjUpdate = 8,
+ ObjHt = 9,
+ ObjWid = 10,
+ ObjSetSize = 11,
+ ObjAlign = 12,
+ ObjTransposeY = 13,
+ ObjCropTop = 14,
+ ObjCropBottom = 15,
+ ObjCropLeft = 16,
+ ObjCropRight = 17,
+ ObjScaleX = 18,
+ ObjScaleY = 19,
+ ObjResRTF = 20,
+ ObjResPict = 21,
+ ObjResBitmap = 22,
+ ObjResText = 23,
+ ObjResMerge = 24,
+ ObjBookmarkPubObj= 25,
+ ObjPubAutoUpdate= 26,
+
+ // Major.FNoteAttr
+ FNAlt = 0,
+
+ // Major.KeyCodeAttr
+ AltKey = 0,
+ ShiftKey = 1,
+ ControlKey = 2,
+ FunctionKey = 3,
+
+ // Major.ACharAttr
+ ACBold = 0,
+ ACAllCaps = 1,
+ ACForeColor = 2,
+ ACSubScript = 3,
+ ACExpand = 4,
+ ACFontNum = 5,
+ ACFontSize = 6,
+ ACItalic = 7,
+ ACLanguage = 8,
+ ACOutline = 9,
+ ACSmallCaps = 10,
+ ACShadow = 11,
+ ACStrikeThru = 12,
+ ACUnderline = 13,
+ ACDotUnderline = 14,
+ ACDbUnderline = 15,
+ ACNoUnderline = 16,
+ ACWordUnderline = 17,
+ ACSuperScript = 18,
+
+ // Major.FontAttr
+ FontCharSet = 0,
+ FontPitch = 1,
+ FontCodePage = 2,
+ FTypeNil = 3,
+ FTypeTrueType = 4,
+
+ // Major.FileAttr
+ FileNum = 0,
+ FileRelPath = 1,
+ FileOSNum = 2,
+
+ // Major.FileSource
+ SrcMacintosh = 0,
+ SrcDOS = 1,
+ SrcNTFS = 2,
+ SrcHPFS = 3,
+ SrcNetwork = 4,
+
+ // Major.DrawAttr
+ DrawLock = 0,
+ DrawPageRelX = 1,
+ DrawColumnRelX = 2,
+ DrawMarginRelX = 3,
+ DrawPageRelY = 4,
+ DrawColumnRelY = 5,
+ DrawMarginRelY = 6,
+ DrawHeight = 7,
+ DrawBeginGroup = 8,
+ DrawGroupCount = 9,
+ DrawEndGroup = 10,
+ DrawArc = 11,
+ DrawCallout = 12,
+ DrawEllipse = 13,
+ DrawLine = 14,
+ DrawPolygon = 15,
+ DrawPolyLine = 16,
+ DrawRect = 17,
+ DrawTextBox = 18,
+ DrawOffsetX = 19,
+ DrawSizeX = 20,
+ DrawOffsetY = 21,
+ DrawSizeY = 22,
+ COAngle = 23,
+ COAccentBar = 24,
+ COBestFit = 25,
+ COBorder = 26,
+ COAttachAbsDist = 27,
+ COAttachBottom = 28,
+ COAttachCenter = 29,
+ COAttachTop = 30,
+ COLength = 31,
+ CONegXQuadrant = 32,
+ CONegYQuadrant = 33,
+ COOffset = 34,
+ COAttachSmart = 35,
+ CODoubleLine = 36,
+ CORightAngle = 37,
+ COSingleLine = 38,
+ COTripleLine = 39,
+ DrawTextBoxMargin= 40,
+ DrawTextBoxText = 41,
+ DrawRoundRect = 42,
+ DrawPointX = 43,
+ DrawPointY = 44,
+ DrawPolyCount = 45,
+ DrawArcFlipX = 46,
+ DrawArcFlipY = 47,
+ DrawLineBlue = 48,
+ DrawLineGreen = 49,
+ DrawLineRed = 50,
+ DrawLinePalette = 51,
+ DrawLineDashDot = 52,
+ DrawLineDashDotDot= 53,
+ DrawLineDash = 54,
+ DrawLineDot = 55,
+ DrawLineGray = 56,
+ DrawLineHollow = 57,
+ DrawLineSolid = 58,
+ DrawLineWidth = 59,
+ DrawHollowEndArrow = 60,
+ DrawEndArrowLength = 61,
+ DrawSolidEndArrow = 62,
+ DrawEndArrowWidth = 63,
+ DrawHollowStartArrow = 64,
+ DrawStartArrowLength = 65,
+ DrawSolidStartArrow = 66,
+ DrawStartArrowWidth = 67,
+ DrawBgFillBlue = 68,
+ DrawBgFillGreen = 69,
+ DrawBgFillRed = 70,
+ DrawBgFillPalette = 71,
+ DrawBgFillGray = 72,
+ DrawFgFillBlue = 73,
+ DrawFgFillGreen = 74,
+ DrawFgFillRed = 75,
+ DrawFgFillPalette = 76,
+ DrawFgFillGray = 77,
+ DrawFillPatIndex = 78,
+ DrawShadow = 79,
+ DrawShadowXOffset = 80,
+ DrawShadowYOffset = 81,
+
+ // Major.IndexAttr
+ IndexNumber = 0,
+ IndexBold = 1,
+ IndexItalic = 2,
+
+ // Major.Unicode
+ UnicodeCharBytes = 0,
+ UnicodeChar = 1,
+ UnicodeDestination = 2,
+ UnicodeDualDestination = 3,
+ UnicodeAnsiCodepage = 4
+
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/README b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/README
new file mode 100644
index 00000000000..ccfb3fab6a2
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/README
@@ -0,0 +1,7 @@
+This RTF parser was originally based on a C-based RTF parser written
+by Paul DuBois (dubois@primate.wisc.edu). It came with the following license:
+
+ * This software may be redistributed without restriction and used for
+ * any purpose whatsoever.
+
+and was part of the code found in the 'rewind' project.
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/RTF.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/RTF.cs
new file mode 100644
index 00000000000..689deafa8a4
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/RTF.cs
@@ -0,0 +1,883 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+
+// COMPLETE
+
+#undef RTF_DEBUG
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Text;
+
+namespace System.Windows.Forms.RTF {
+ internal class RTF {
+ #region Local Variables
+ internal const char EOF = unchecked((char)-1);
+ internal const int NoParam = -1000000;
+
+ private TokenClass rtf_class;
+ private Major major;
+ private Minor minor;
+ private int param;
+ private int format;
+ private StringBuilder text_buffer;
+ private int line_num;
+ private int line_pos;
+
+ private char pushed_char;
+ private StringBuilder pushed_text_buffer;
+ private TokenClass pushed_class;
+ private Major pushed_major;
+ private Minor pushed_minor;
+ private int pushed_param;
+
+ private char prev_char;
+ private bool bump_line;
+
+ private Font font_list;
+ private Color color_list;
+ private Style style_list;
+
+ private Charset cur_charset;
+ private Stack charset_stack;
+
+ private Style styles;
+ private Color colors;
+ private Font fonts;
+
+ private StreamReader source;
+
+ private static Hashtable key_table;
+ private static KeyStruct[] Keys = KeysInit.Init();
+
+ private DestinationCallback destination_callbacks;
+ private ClassCallback class_callbacks;
+ #endregion // Local Variables
+
+ #region Constructors
+ static RTF() {
+ key_table = new Hashtable(Keys.Length);
+ for (int i = 0; i < Keys.Length; i++) {
+ key_table[Keys[i].Symbol] = Keys[i];
+ }
+ }
+
+ public RTF(Stream stream) {
+ source = new StreamReader(stream);
+
+ text_buffer = new StringBuilder(1024);
+ pushed_text_buffer = new StringBuilder(1024);
+
+ rtf_class = TokenClass.None;
+ pushed_class = TokenClass.None;
+ pushed_char = unchecked((char)-1);
+
+ line_num = 0;
+ line_pos = 0;
+ prev_char = unchecked((char)-1);
+ bump_line = false;
+
+ cur_charset = new Charset();
+
+ destination_callbacks = new DestinationCallback();
+ class_callbacks = new ClassCallback();
+
+ destination_callbacks[Minor.FontTbl] = new DestinationDelegate(ReadFontTbl);
+ destination_callbacks[Minor.ColorTbl] = new DestinationDelegate(ReadColorTbl);
+ destination_callbacks[Minor.StyleSheet] = new DestinationDelegate(ReadStyleSheet);
+ destination_callbacks[Minor.Info] = new DestinationDelegate(ReadInfoGroup);
+ destination_callbacks[Minor.Pict] = new DestinationDelegate(ReadPictGroup);
+ destination_callbacks[Minor.Object] = new DestinationDelegate(ReadObjGroup);
+ }
+ #endregion // Constructors
+
+ #region Properties
+ public TokenClass TokenClass {
+ get {
+ return this.rtf_class;
+ }
+
+ set {
+ this.rtf_class = value;
+ }
+ }
+
+ public Major Major {
+ get {
+ return this.major;
+ }
+
+ set {
+ this.major = value;
+ }
+ }
+
+ public Minor Minor {
+ get {
+ return this.minor;
+ }
+
+ set {
+ this.minor = value;
+ }
+ }
+
+ public int Param {
+ get {
+ return this.param;
+ }
+
+ set {
+ this.param = value;
+ }
+ }
+
+ public string Text {
+ get {
+ return this.text_buffer.ToString();
+ }
+
+ set {
+ if (value == null) {
+ this.text_buffer.Length = 0;
+ } else {
+ this.text_buffer = new StringBuilder(value);
+ }
+ }
+ }
+
+ public Color Colors {
+ get {
+ return colors;
+ }
+
+ set {
+ colors = value;
+ }
+ }
+
+ public Style Styles {
+ get {
+ return styles;
+ }
+
+ set {
+ styles = value;
+ }
+ }
+
+ public Font Fonts {
+ get {
+ return fonts;
+ }
+
+ set {
+ fonts = value;
+ }
+ }
+
+ public ClassCallback ClassCallback {
+ get {
+ return class_callbacks;
+ }
+
+ set {
+ class_callbacks = value;
+ }
+ }
+
+ public DestinationCallback DestinationCallback {
+ get {
+ return destination_callbacks;
+ }
+
+ set {
+ destination_callbacks = value;
+ }
+ }
+
+ public int LineNumber {
+ get {
+ return line_num;
+ }
+ }
+
+ public int LinePos {
+ get {
+ return line_pos;
+ }
+ }
+ #endregion // Properties
+
+ #region Methods
+ /// <summary>Set the default font for documents without font table</summary>
+ public void DefaultFont(string name) {
+ Font font;
+
+ font = new Font(this);
+ font.Num = 0;
+ font.Name = name;
+ }
+
+ /// <summary>Read the next character from the input</summary>
+ private char GetChar() {
+ char c;
+ bool old_bump_line;
+
+ if ((c = (char)source.Read()) != EOF) {
+ this.text_buffer.Append(c);
+ }
+
+ if (this.prev_char == EOF) {
+ this.bump_line = true;
+ }
+
+ old_bump_line = bump_line;
+ bump_line = false;
+
+ if (c == '\r') {
+ bump_line = true;
+ } else if (c == '\n') {
+ bump_line = true;
+ if (this.prev_char == '\r') {
+ old_bump_line = false;
+ }
+ }
+
+ this.line_pos ++;
+ if (old_bump_line) {
+ this.line_num++;
+ this.line_pos = 1;
+ }
+
+ this.prev_char = c;
+ return c;
+ }
+
+ /// <summary>Parse the RTF stream</summary>
+ public void Read() {
+ while (GetToken() != TokenClass.EOF) {
+ RouteToken();
+ }
+ }
+
+ /// <summary>Route a token</summary>
+ public void RouteToken() {
+ if (CheckCM(TokenClass.Control, Major.Destination)) {
+ DestinationDelegate d;
+
+ d = destination_callbacks[minor];
+ if (d != null) {
+ d(this);
+ }
+ }
+
+ // Invoke class callback if there is one
+ ClassDelegate c;
+
+ c = class_callbacks[rtf_class];
+ if (c != null) {
+ c(this);
+ }
+
+ }
+
+ /// <summary>Skip to the end of the current group</summary>
+ public void SkipGroup() {
+ int level;
+
+ level = 1;
+
+ while (GetToken() != TokenClass.EOF) {
+ if (rtf_class == TokenClass.Group) {
+ if (this.major == Major.BeginGroup) {
+ level++;
+ } else if (this.major == Major.EndGroup) {
+ level--;
+ if (level < 1) {
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ /// <summary>Return the next token in the stream</summary>
+ public TokenClass GetToken() {
+ if (pushed_class != TokenClass.None) {
+ this.rtf_class = this.pushed_class;
+ this.major = this.pushed_major;
+ this.minor = this.pushed_minor;
+ this.param = this.pushed_param;
+ this.pushed_class = TokenClass.None;
+ return this.rtf_class;
+ }
+
+ GetToken2();
+
+ if (this.rtf_class == TokenClass.Text) {
+ this.minor = (Minor)this.cur_charset[(int)this.major];
+ }
+
+ if (this.cur_charset.Flags == CharsetFlags.None) {
+ return this.rtf_class;
+ }
+
+ if (((this.cur_charset.Flags & CharsetFlags.Read) != 0) && CheckCM(TokenClass.Control, Major.CharSet)) {
+ this.cur_charset.ReadMap();
+ } else if (((this.cur_charset.Flags & CharsetFlags.Switch) != 0) && CheckCMM(TokenClass.Control, Major.CharAttr, Minor.FontNum)) {
+ Font fp;
+
+ fp = Font.GetFont(this.font_list, this.param);
+
+ if (fp != null) {
+ if (fp.Name.StartsWith("Symbol")) {
+ this.cur_charset.ID = CharsetType.Symbol;
+ } else {
+ this.cur_charset.ID = CharsetType.General;
+ }
+ } else if (((this.cur_charset.Flags & CharsetFlags.Switch) != 0) && (this.rtf_class == TokenClass.Group)) {
+ switch(this.major) {
+ case Major.BeginGroup: {
+ this.charset_stack.Push(this.cur_charset);
+ break;
+ }
+
+ case Major.EndGroup: {
+ this.cur_charset = (Charset)this.charset_stack.Pop();
+ break;
+ }
+ }
+ }
+ }
+
+ return this.rtf_class;
+ }
+
+ private void GetToken2() {
+ char c;
+ int sign;
+
+ this.rtf_class = TokenClass.Unknown;
+ this.param = NoParam;
+
+ this.text_buffer.Length = 0;
+
+ if (this.pushed_char != EOF) {
+ c = this.pushed_char;
+ this.text_buffer.Append(c);
+ this.pushed_char = EOF;
+ } else if ((c = GetChar()) == EOF) {
+ this.rtf_class = TokenClass.EOF;
+ return;
+ }
+
+ if (c == '{') {
+ this.rtf_class = TokenClass.Group;
+ this.major = Major.BeginGroup;
+ return;
+ }
+
+ if (c == '}') {
+ this.rtf_class = TokenClass.Group;
+ this.major = Major.EndGroup;
+ return;
+ }
+
+ if (c != '\\') {
+ if (c != '\t') {
+ this.rtf_class = TokenClass.Text;
+ this.major = (Major)c; // FIXME - typing?
+ return;
+ } else {
+ this.rtf_class = TokenClass.Control;
+ this.major = Major.SpecialChar;
+ this.minor = Minor.Tab;
+ return;
+ }
+ }
+
+ if ((c = GetChar()) == EOF) {
+ // Not so good
+ return;
+ }
+
+ if (!Char.IsLetter(c)) {
+ if (c == '\'') {
+ char c2;
+
+ if ((c = GetChar()) == EOF) {
+ return;
+ }
+
+ if ((c2 = GetChar()) == EOF) {
+ return;
+ }
+
+ this.rtf_class = TokenClass.Text;
+ this.major = (Major)((Char)((Convert.ToByte(c.ToString(), 16) * 16 + Convert.ToByte(c2.ToString(), 16))));
+ return;
+ }
+
+ // Escaped char
+ if (c == ':' || c == '{' || c == '}' || c == '\\') {
+ this.rtf_class = TokenClass.Text;
+ this.major = (Major)c;
+ return;
+ }
+
+ Lookup(this.text_buffer.ToString());
+ return;
+ }
+
+ while (Char.IsLetter(c)) {
+ if ((c = GetChar()) == EOF) {
+ break;
+ }
+ }
+
+ if (c != EOF) {
+ this.text_buffer.Length--;
+ }
+
+ Lookup(this.text_buffer.ToString());
+
+ if (c != EOF) {
+ this.text_buffer.Append(c);
+ }
+
+ sign = 1;
+ if (c == '-') {
+ sign = -1;
+ c = GetChar();
+ }
+
+ if (c != EOF && Char.IsDigit(c)) {
+ this.param = 0;
+ while (Char.IsDigit(c)) {
+ this.param = this.param * 10 + Convert.ToByte(c) - 48;
+ if ((c = GetChar()) == EOF) {
+ break;
+ }
+ }
+ this.param *= sign;
+ }
+
+ if (c != EOF) {
+ if (c != ' ') {
+ this.pushed_char = c;
+ }
+ this.text_buffer.Length--;
+ }
+ }
+
+ public void SetToken(TokenClass cl, Major maj, Minor min, int par, string text) {
+ this.rtf_class = cl;
+ this.major = maj;
+ this.minor = min;
+ this.param = par;
+ if (par == NoParam) {
+ this.text_buffer = new StringBuilder(text);
+ } else {
+ this.text_buffer = new StringBuilder(text + par.ToString());
+ }
+ }
+
+ public void UngetToken() {
+ if (this.pushed_class != TokenClass.None) {
+ throw new RTFException(this, "Cannot unget more than one token");
+ }
+
+ if (this.rtf_class == TokenClass.None) {
+ throw new RTFException(this, "No token to unget");
+ }
+
+ this.pushed_class = this.rtf_class;
+ this.pushed_major = this.major;
+ this.pushed_minor = this.minor;
+ this.pushed_param = this.param;
+ this.pushed_text_buffer = new StringBuilder(this.text_buffer.ToString());
+ }
+
+ public TokenClass PeekToken() {
+ GetToken();
+ UngetToken();
+ return rtf_class;
+ }
+
+ public void Lookup(string token) {
+ Object obj;
+ KeyStruct key;
+
+ obj = key_table[token.Substring(1)];
+ if (obj == null) {
+ rtf_class = TokenClass.Unknown;
+ return;
+ }
+
+ key = (KeyStruct)obj;
+ this.rtf_class = TokenClass.Control;
+ this.major = key.Major;
+ this.minor = key.Minor;
+ }
+
+ public bool CheckCM(TokenClass rtf_class, Major major) {
+ if ((this.rtf_class == rtf_class) && (this.major == major)) {
+ return true;
+ }
+
+ return false;
+ }
+
+ public bool CheckCMM(TokenClass rtf_class, Major major, Minor minor) {
+ if ((this.rtf_class == rtf_class) && (this.major == major) && (this.minor == minor)) {
+ return true;
+ }
+
+ return false;
+ }
+
+ public bool CheckMM(Major major, Minor minor) {
+ if ((this.major == major) && (this.minor == minor)) {
+ return true;
+ }
+
+ return false;
+ }
+ #endregion // Methods
+
+ #region Default Delegates
+ private void ReadFontTbl(RTF rtf) {
+ int old;
+ Font font;
+
+ old = -1;
+ font = null;
+
+ while (true) {
+ rtf.GetToken();
+
+ if (rtf.CheckCM(TokenClass.Group, Major.EndGroup)) {
+ break;
+ }
+
+ if (old < 0) {
+ if (rtf.CheckCMM(TokenClass.Control, Major.CharAttr, Minor.FontNum)) {
+ old = 1;
+ } else if (rtf.CheckCM(TokenClass.Group, Major.BeginGroup)) {
+ old = 0;
+ } else {
+ throw new RTFException(rtf, "Cannot determine format");
+ }
+ }
+
+ if (old == 0) {
+ if (!rtf.CheckCM(TokenClass.Group, Major.BeginGroup)) {
+ throw new RTFException(rtf, "missing \"{\"");
+ }
+ rtf.GetToken();
+ }
+
+ font = new Font(rtf);
+
+ while ((rtf.rtf_class != TokenClass.EOF) && (!rtf.CheckCM(TokenClass.Text, (Major)';')) && (!rtf.CheckCM(TokenClass.Group, Major.EndGroup))) {
+ if (rtf.rtf_class == TokenClass.Control) {
+ switch(rtf.major) {
+ case Major.FontFamily: {
+ font.Family = (int)rtf.minor;
+ break;
+ }
+
+ case Major.CharAttr: {
+ switch(rtf.minor) {
+ case Minor.FontNum: {
+ font.Num = rtf.param;
+ break;
+ }
+
+ default: {
+ #if RTF_DEBUG
+ Console.WriteLine("Got unhandled Control.CharAttr.Minor: " + rtf.minor);
+ #endif
+ break;
+ }
+ }
+ break;
+ }
+
+ case Major.FontAttr: {
+ switch (rtf.minor) {
+ case Minor.FontCharSet: {
+ font.Charset = (CharsetType)rtf.param;
+ break;
+ }
+
+ case Minor.FontPitch: {
+ font.Pitch = rtf.param;
+ break;
+ }
+
+ case Minor.FontCodePage: {
+ font.Codepage = rtf.param;
+ break;
+ }
+
+ case Minor.FTypeNil:
+ case Minor.FTypeTrueType: {
+ font.Type = rtf.param;
+ break;
+ }
+ default: {
+ #if RTF_DEBUG
+ Console.WriteLine("Got unhandled Control.FontAttr.Minor: " + rtf.minor);
+ #endif
+ break;
+ }
+ }
+ break;
+ }
+
+ default: {
+ #if RTF_DEBUG
+ Console.WriteLine("ReadFontTbl: Unknown Control token " + rtf.major);
+ #endif
+ break;
+ }
+ }
+ } else if (rtf.CheckCM(TokenClass.Group, Major.BeginGroup)) {
+ rtf.SkipGroup();
+ } else if (rtf.rtf_class == TokenClass.Text) {
+ StringBuilder sb;
+
+ sb = new StringBuilder();
+
+ while ((rtf.rtf_class != TokenClass.EOF) && (!rtf.CheckCM(TokenClass.Text, (Major)';')) && (!rtf.CheckCM(TokenClass.Group, Major.EndGroup))) {
+ sb.Append((char)rtf.major);
+ rtf.GetToken();
+ }
+
+ if (rtf.CheckCM(TokenClass.Group, Major.EndGroup)) {
+ rtf.UngetToken();
+ }
+
+ font.Name = sb.ToString();
+ continue;
+#if RTF_DEBUG
+ } else {
+ Console.WriteLine("ReadFontTbl: Unknown token " + rtf.text_buffer);
+#endif
+ }
+
+ rtf.GetToken();
+ }
+
+ if (old == 0) {
+ rtf.GetToken();
+
+ if (!rtf.CheckCM(TokenClass.Group, Major.EndGroup)) {
+ throw new RTFException(rtf, "Missing \"}\"");
+ }
+ }
+ }
+
+ if (font == null) {
+ throw new RTFException(rtf, "No font created");
+ }
+
+ if (font.Num == -1) {
+ throw new RTFException(rtf, "Missing font number");
+ }
+
+ rtf.RouteToken();
+ }
+
+ private void ReadColorTbl(RTF rtf) {
+ Color color;
+ int num;
+
+ num = 0;
+
+ while (true) {
+ rtf.GetToken();
+
+ if (rtf.CheckCM(TokenClass.Group, Major.EndGroup)) {
+ break;
+ }
+
+ color = new Color(rtf);
+ color.Num = num++;
+
+ while (rtf.CheckCM(TokenClass.Control, Major.ColorName)) {
+ switch (rtf.minor) {
+ case Minor.Red: {
+ color.Red = rtf.param;
+ break;
+ }
+
+ case Minor.Green: {
+ color.Green = rtf.param;
+ break;
+ }
+
+ case Minor.Blue: {
+ color.Blue = rtf.param;
+ break;
+ }
+ }
+
+ rtf.GetToken();
+ }
+ if (!rtf.CheckCM(TokenClass.Text, (Major)';')) {
+ throw new RTFException(rtf, "Malformed color entry");
+ }
+ }
+ rtf.RouteToken();
+ }
+
+ private void ReadStyleSheet(RTF rtf) {
+ Style style;
+ StringBuilder sb;
+
+ sb = new StringBuilder();
+
+ while (true) {
+ rtf.GetToken();
+
+ if (rtf.CheckCM(TokenClass.Group, Major.EndGroup)) {
+ break;
+ }
+
+ style = new Style(rtf);
+
+ if (!rtf.CheckCM(TokenClass.Group, Major.BeginGroup)) {
+ throw new RTFException(rtf, "Missing \"{\"");
+ }
+
+ while (true) {
+ rtf.GetToken();
+
+ if ((rtf.rtf_class == TokenClass.EOF) || rtf.CheckCM(TokenClass.Text, (Major)';')) {
+ break;
+ }
+
+ if (rtf.rtf_class == TokenClass.Control) {
+ if (rtf.CheckMM(Major.SpecialChar, Minor.OptDest)) {
+ continue;
+ }
+ if (rtf.CheckMM(Major.ParAttr, Minor.StyleNum)) {
+ style.Num = rtf.param;
+ style.Type = StyleType.Paragraph;
+ continue;
+ }
+ if (rtf.CheckMM(Major.CharAttr, Minor.CharStyleNum)) {
+ style.Num = rtf.param;
+ style.Type = StyleType.Character;
+ continue;
+ }
+ if (rtf.CheckMM(Major.StyleAttr, Minor.SectStyleNum)) {
+ style.Num = rtf.param;
+ style.Type = StyleType.Section;
+ continue;
+ }
+ if (rtf.CheckMM(Major.StyleAttr, Minor.BasedOn)) {
+ style.BasedOn = rtf.param;
+ continue;
+ }
+ if (rtf.CheckMM(Major.StyleAttr, Minor.Additive)) {
+ style.Additive = true;
+ continue;
+ }
+ if (rtf.CheckMM(Major.StyleAttr, Minor.Next)) {
+ style.NextPar = rtf.param;
+ continue;
+ }
+
+ new StyleElement(style, rtf.rtf_class, rtf.major, rtf.minor, rtf.param, rtf.text_buffer.ToString());
+ } else if (rtf.CheckCM(TokenClass.Group, Major.BeginGroup)) {
+ // This passes over "{\*\keycode ... }, among other things
+ rtf.SkipGroup();
+ } else if (rtf.rtf_class == TokenClass.Text) {
+ while (rtf.rtf_class == TokenClass.Text) {
+ if (rtf.major == (Major)';') {
+ rtf.UngetToken();
+ break;
+ }
+
+ sb.Append((char)rtf.major);
+ rtf.GetToken();
+ }
+
+ style.Name = sb.ToString();
+#if RTF_DEBUG
+ } else {
+ Console.WriteLine("ReadStyleSheet: Ignored token " + rtf.text_buffer);
+#endif
+ }
+ }
+ rtf.GetToken();
+
+ if (!rtf.CheckCM(TokenClass.Group, Major.EndGroup)) {
+ throw new RTFException(rtf, "Missing EndGroup (\"}\"");
+ }
+
+ // Sanity checks
+ if (style.Name == null) {
+ throw new RTFException(rtf, "Style must have name");
+ }
+
+ if (style.Num < 0) {
+ if (!sb.ToString().StartsWith("Normal") && !sb.ToString().StartsWith("Standard")) {
+ throw new RTFException(rtf, "Missing style number");
+ }
+
+ style.Num = Style.NormalStyleNum;
+ }
+
+ if (style.NextPar == -1) {
+ style.NextPar = style.Num;
+ }
+ }
+
+ rtf.RouteToken();
+ }
+
+ private void ReadInfoGroup(RTF rtf) {
+ rtf.SkipGroup();
+ rtf.RouteToken();
+ }
+
+ private void ReadPictGroup(RTF rtf) {
+ rtf.SkipGroup();
+ rtf.RouteToken();
+ }
+
+ private void ReadObjGroup(RTF rtf) {
+ rtf.SkipGroup();
+ rtf.RouteToken();
+ }
+ #endregion // Default Delegates
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/RTFException.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/RTFException.cs
new file mode 100644
index 00000000000..07d35f2dd4f
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/RTFException.cs
@@ -0,0 +1,81 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+using System;
+using System.Text;
+
+namespace System.Windows.Forms.RTF {
+ internal class RTFException : ApplicationException {
+ #region Local Variables
+ private int pos;
+ private int line;
+ private TokenClass token_class;
+ private Major major;
+ private Minor minor;
+ private int param;
+ private string text;
+ private string error_message;
+ #endregion // Local Variables
+
+ #region Constructors
+ public RTFException(RTF rtf, string error_message) {
+ this.pos = rtf.LinePos;
+ this.line = rtf.LineNumber;
+ this.token_class = rtf.TokenClass;
+ this.major = rtf.Major;
+ this.minor = rtf.Minor;
+ this.param = rtf.Param;
+ this.text = rtf.Text;
+ this.error_message = error_message;
+ }
+ #endregion // Constructors
+
+ #region Properties
+ public override string Message {
+ get {
+ StringBuilder sb;
+
+ sb = new StringBuilder();
+ sb.Append(error_message);
+ sb.Append("\n");
+
+ sb.Append("RTF Stream Info: Pos:" + pos + " Line:" + line);
+ sb.Append("\n");
+
+ sb.Append("TokenClass:" + token_class + ", ");
+ sb.Append("Major:" + String.Format("{0}", (int)major) + ", ");
+ sb.Append("Minor:" + String.Format("{0}", (int)minor) + ", ");
+ sb.Append("Param:" + String.Format("{0}", param) + ", ");
+ sb.Append("Text:" + text);
+
+ return sb.ToString();
+ }
+ }
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/StandardCharCode.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/StandardCharCode.cs
new file mode 100644
index 00000000000..02eacf82f90
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/StandardCharCode.cs
@@ -0,0 +1,386 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms.RTF {
+ internal enum StandardCharCode {
+ nothing = 0,
+ space = 1,
+ exclam = 2,
+ quotedbl = 3,
+ numbersign = 4,
+ dollar = 5,
+ percent = 6,
+ ampersand = 7,
+ quoteright = 8,
+ parenleft = 9,
+ parenright = 10,
+ asterisk = 11,
+ plus = 12,
+ comma = 13,
+ hyphen = 14,
+ period = 15,
+ slash = 16,
+ zero = 17,
+ one = 18,
+ two = 19,
+ three = 20,
+ four = 21,
+ five = 22,
+ six = 23,
+ seven = 24,
+ eight = 25,
+ nine = 26,
+ colon = 27,
+ semicolon = 28,
+ less = 29,
+ equal = 30,
+ greater = 31,
+ question = 32,
+ at = 33,
+ A = 34,
+ B = 35,
+ C = 36,
+ D = 37,
+ E = 38,
+ F = 39,
+ G = 40,
+ H = 41,
+ I = 42,
+ J = 43,
+ K = 44,
+ L = 45,
+ M = 46,
+ N = 47,
+ O = 48,
+ P = 49,
+ Q = 50,
+ R = 51,
+ S = 52,
+ T = 53,
+ U = 54,
+ V = 55,
+ W = 56,
+ X = 57,
+ Y = 58,
+ Z = 59,
+ bracketleft = 60,
+ backslash = 61,
+ bracketright = 62,
+ asciicircum = 63,
+ underscore = 64,
+ quoteleft = 65,
+ a = 66,
+ b = 67,
+ c = 68,
+ d = 69,
+ e = 70,
+ f = 71,
+ g = 72,
+ h = 73,
+ i = 74,
+ j = 75,
+ k = 76,
+ l = 77,
+ m = 78,
+ n = 79,
+ o = 80,
+ p = 81,
+ q = 82,
+ r = 83,
+ s = 84,
+ t = 85,
+ u = 86,
+ v = 87,
+ w = 88,
+ x = 89,
+ y = 90,
+ z = 91,
+ braceleft = 92,
+ bar = 93,
+ braceright = 94,
+ asciitilde = 95,
+ exclamdown = 96,
+ cent = 97,
+ sterling = 98,
+ fraction = 99,
+ yen = 100,
+ florin = 101,
+ section = 102,
+ currency = 103,
+ quotedblleft = 104,
+ guillemotleft = 105,
+ guilsinglleft = 106,
+ guilsinglright = 107,
+ fi = 108,
+ fl = 109,
+ endash = 110,
+ dagger = 111,
+ daggerdbl = 112,
+ periodcentered = 113,
+ paragraph = 114,
+ bullet = 115,
+ quotesinglbase = 116,
+ quotedblbase = 117,
+ quotedblright = 118,
+ guillemotright = 119,
+ ellipsis = 120,
+ perthousand = 121,
+ questiondown = 122,
+ grave = 123,
+ acute = 124,
+ circumflex = 125,
+ tilde = 126,
+ macron = 127,
+ breve = 128,
+ dotaccent = 129,
+ dieresis = 130,
+ ring = 131,
+ cedilla = 132,
+ hungarumlaut = 133,
+ ogonek = 134,
+ caron = 135,
+ emdash = 136,
+ AE = 137,
+ ordfeminine = 138,
+ Lslash = 139,
+ Oslash = 140,
+ OE = 141,
+ ordmasculine = 142,
+ ae = 143,
+ dotlessi = 144,
+ lslash = 145,
+ oslash = 146,
+ oe = 147,
+ germandbls = 148,
+ Aacute = 149,
+ Acircumflex = 150,
+ Adieresis = 151,
+ Agrave = 152,
+ Aring = 153,
+ Atilde = 154,
+ Ccedilla = 155,
+ Eacute = 156,
+ Ecircumflex = 157,
+ Edieresis = 158,
+ Egrave = 159,
+ Eth = 160,
+ Iacute = 161,
+ Icircumflex = 162,
+ Idieresis = 163,
+ Igrave = 164,
+ Ntilde = 165,
+ Oacute = 166,
+ Ocircumflex = 167,
+ Odieresis = 168,
+ Ograve = 169,
+ Otilde = 170,
+ Scaron = 171,
+ Thorn = 172,
+ Uacute = 173,
+ Ucircumflex = 174,
+ Udieresis = 175,
+ Ugrave = 176,
+ Yacute = 177,
+ Ydieresis = 178,
+ aacute = 179,
+ acircumflex = 180,
+ adieresis = 181,
+ agrave = 182,
+ aring = 183,
+ atilde = 184,
+ brokenbar = 185,
+ ccedilla = 186,
+ copyright = 187,
+ degree = 188,
+ divide = 189,
+ eacute = 190,
+ ecircumflex = 191,
+ edieresis = 192,
+ egrave = 193,
+ eth = 194,
+ iacute = 195,
+ icircumflex = 196,
+ idieresis = 197,
+ igrave = 198,
+ logicalnot = 199,
+ minus = 200,
+ multiply = 201,
+ ntilde = 202,
+ oacute = 203,
+ ocircumflex = 204,
+ odieresis = 205,
+ ograve = 206,
+ onehalf = 207,
+ onequarter = 208,
+ onesuperior = 209,
+ otilde = 210,
+ plusminus = 211,
+ registered = 212,
+ thorn = 213,
+ threequarters = 214,
+ threesuperior = 215,
+ trademark = 216,
+ twosuperior = 217,
+ uacute = 218,
+ ucircumflex = 219,
+ udieresis = 220,
+ ugrave = 221,
+ yacute = 222,
+ ydieresis = 223,
+ Alpha = 224,
+ Beta = 225,
+ Chi = 226,
+ Delta = 227,
+ Epsilon = 228,
+ Phi = 229,
+ Gamma = 230,
+ Eta = 231,
+ Iota = 232,
+ Kappa = 233,
+ Lambda = 234,
+ Mu = 235,
+ Nu = 236,
+ Omicron = 237,
+ Pi = 238,
+ Theta = 239,
+ Rho = 240,
+ Sigma = 241,
+ Tau = 242,
+ Upsilon = 243,
+ varUpsilon = 244,
+ Omega = 245,
+ Xi = 246,
+ Psi = 247,
+ Zeta = 248,
+ alpha = 249,
+ beta = 250,
+ chi = 251,
+ delta = 252,
+ epsilon = 253,
+ phi = 254,
+ varphi = 255,
+ gamma = 256,
+ eta = 257,
+ iota = 258,
+ kappa = 259,
+ lambda = 260,
+ mu = 261,
+ nu = 262,
+ omicron = 263,
+ pi = 264,
+ varpi = 265,
+ theta = 266,
+ vartheta = 267,
+ rho = 268,
+ sigma = 269,
+ varsigma = 270,
+ tau = 271,
+ upsilon = 272,
+ omega = 273,
+ xi = 274,
+ psi = 275,
+ zeta = 276,
+ nobrkspace = 277,
+ nobrkhyphen = 278,
+ lessequal = 279,
+ greaterequal = 280,
+ infinity = 281,
+ integral = 282,
+ notequal = 283,
+ radical = 284,
+ radicalex = 285,
+ approxequal = 286,
+ apple = 287,
+ partialdiff = 288,
+ opthyphen = 289,
+ formula = 290,
+ lozenge = 291,
+ universal = 292,
+ existential = 293,
+ suchthat = 294,
+ congruent = 295,
+ therefore = 296,
+ perpendicular = 297,
+ minute = 298,
+ club = 299,
+ diamond = 300,
+ heart = 301,
+ spade = 302,
+ arrowboth = 303,
+ arrowleft = 304,
+ arrowup = 305,
+ arrowright = 306,
+ arrowdown = 307,
+ second = 308,
+ proportional = 309,
+ equivalence = 310,
+ arrowvertex = 311,
+ arrowhorizex = 312,
+ carriagereturn = 313,
+ aleph = 314,
+ Ifraktur = 315,
+ Rfraktur = 316,
+ weierstrass = 317,
+ circlemultiply = 318,
+ circleplus = 319,
+ emptyset = 320,
+ intersection = 321,
+ union = 322,
+ propersuperset = 323,
+ reflexsuperset = 324,
+ notsubset = 325,
+ propersubset = 326,
+ reflexsubset = 327,
+ element = 328,
+ notelement = 329,
+ angle = 330,
+ gradient = 331,
+ product = 332,
+ logicaland = 333,
+ logicalor = 334,
+ arrowdblboth = 335,
+ arrowdblleft = 336,
+ arrowdblup = 337,
+ arrowdblright = 338,
+ arrowdbldown = 339,
+ angleleft = 340,
+ registersans = 341,
+ copyrightsans = 342,
+ trademarksans = 343,
+ angleright = 344,
+ mathplus = 345,
+ mathminus = 346,
+ mathasterisk = 347,
+ mathnumbersign = 348,
+ dotmath = 349,
+ mathequal = 350,
+ mathtilde = 351,
+
+ MaxChar = 352
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/StandardCharName.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/StandardCharName.cs
new file mode 100644
index 00000000000..3c75464d104
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/StandardCharName.cs
@@ -0,0 +1,405 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms.RTF {
+ internal class StandardCharName {
+ public static string[] Names = {
+ "nothing",
+ "space",
+ "exclam",
+ "quotedbl",
+ "numbersign",
+ "dollar",
+ "percent",
+ "ampersand",
+ "quoteright",
+ "parenleft",
+ "parenright",
+ "asterisk",
+ "plus",
+ "comma",
+ "hyphen",
+ "period",
+ "slash",
+ "zero",
+ "one",
+ "two",
+ "three",
+ "four",
+ "five",
+ "six",
+ "seven",
+ "eight",
+ "nine",
+ "colon",
+ "semicolon",
+ "less",
+ "equal",
+ "greater",
+ "question",
+ "at",
+ "A",
+ "B",
+ "C",
+ "D",
+ "E",
+ "F",
+ "G",
+ "H",
+ "I",
+ "J",
+ "K",
+ "L",
+ "M",
+ "N",
+ "O",
+ "P",
+ "Q",
+ "R",
+ "S",
+ "T",
+ "U",
+ "V",
+ "W",
+ "X",
+ "Y",
+ "Z",
+ "bracketleft",
+ "backslash",
+ "bracketright",
+ "asciicircum",
+ "underscore",
+ "quoteleft",
+ "a",
+ "b",
+ "c",
+ "d",
+ "e",
+ "f",
+ "g",
+ "h",
+ "i",
+ "j",
+ "k",
+ "l",
+ "m",
+ "n",
+ "o",
+ "p",
+ "q",
+ "r",
+ "s",
+ "t",
+ "u",
+ "v",
+ "w",
+ "x",
+ "y",
+ "z",
+ "braceleft",
+ "bar",
+ "braceright",
+ "asciitilde",
+ "exclamdown",
+ "cent",
+ "sterling",
+ "fraction",
+ "yen",
+ "florin",
+ "section",
+ "currency",
+ "quotedblleft",
+ "guillemotleft",
+ "guilsinglleft",
+ "guilsinglright",
+ "fi",
+ "fl",
+ "endash",
+ "dagger",
+ "daggerdbl",
+ "periodcentered",
+ "paragraph",
+ "bullet",
+ "quotesinglbase",
+ "quotedblbase",
+ "quotedblright",
+ "guillemotright",
+ "ellipsis",
+ "perthousand",
+ "questiondown",
+ "grave",
+ "acute",
+ "circumflex",
+ "tilde",
+ "macron",
+ "breve",
+ "dotaccent",
+ "dieresis",
+ "ring",
+ "cedilla",
+ "hungarumlaut",
+ "ogonek",
+ "caron",
+ "emdash",
+ "AE",
+ "ordfeminine",
+ "Lslash",
+ "Oslash",
+ "OE",
+ "ordmasculine",
+ "ae",
+ "dotlessi",
+ "lslash",
+ "oslash",
+ "oe",
+ "germandbls",
+ "Aacute",
+ "Acircumflex",
+ "Adieresis",
+ "Agrave",
+ "Aring",
+ "Atilde",
+ "Ccedilla",
+ "Eacute",
+ "Ecircumflex",
+ "Edieresis",
+ "Egrave",
+ "Eth",
+ "Iacute",
+ "Icircumflex",
+ "Idieresis",
+ "Igrave",
+ "Ntilde",
+ "Oacute",
+ "Ocircumflex",
+ "Odieresis",
+ "Ograve",
+ "Otilde",
+ "Scaron",
+ "Thorn",
+ "Uacute",
+ "Ucircumflex",
+ "Udieresis",
+ "Ugrave",
+ "Yacute",
+ "Ydieresis",
+ "aacute",
+ "acircumflex",
+ "adieresis",
+ "agrave",
+ "aring",
+ "atilde",
+ "brokenbar",
+ "ccedilla",
+ "copyright",
+ "degree",
+ "divide",
+ "eacute",
+ "ecircumflex",
+ "edieresis",
+ "egrave",
+ "eth",
+ "iacute",
+ "icircumflex",
+ "idieresis",
+ "igrave",
+ "logicalnot",
+ "minus",
+ "multiply",
+ "ntilde",
+ "oacute",
+ "ocircumflex",
+ "odieresis",
+ "ograve",
+ "onehalf",
+ "onequarter",
+ "onesuperior",
+ "otilde",
+ "plusminus",
+ "registered",
+ "thorn",
+ "threequarters",
+ "threesuperior",
+ "trademark",
+ "twosuperior",
+ "uacute",
+ "ucircumflex",
+ "udieresis",
+ "ugrave",
+ "yacute",
+ "ydieresis",
+ "Alpha",
+ "Beta",
+ "Chi",
+ "Delta",
+ "Epsilon",
+ "Phi",
+ "Gamma",
+ "Eta",
+ "Iota",
+ "Kappa",
+ "Lambda",
+ "Mu",
+ "Nu",
+ "Omicron",
+ "Pi",
+ "Theta",
+ "Rho",
+ "Sigma",
+ "Tau",
+ "Upsilon",
+ "varUpsilon",
+ "Omega",
+ "Xi",
+ "Psi",
+ "Zeta",
+ "alpha",
+ "beta",
+ "chi",
+ "delta",
+ "epsilon",
+ "phi",
+ "varphi",
+ "gamma",
+ "eta",
+ "iota",
+ "kappa",
+ "lambda",
+ "mu",
+ "nu",
+ "omicron",
+ "pi",
+ "varpi",
+ "theta",
+ "vartheta",
+ "rho",
+ "sigma",
+ "varsigma",
+ "tau",
+ "upsilon",
+ "omega",
+ "xi",
+ "psi",
+ "zeta",
+ "nobrkspace",
+ "nobrkhyphen",
+ "lessequal",
+ "greaterequal",
+ "infinity",
+ "integral",
+ "notequal",
+ "radical",
+ "radicalex",
+ "approxequal",
+ "apple",
+ "partialdiff",
+ "opthyphen",
+ "formula",
+ "lozenge",
+ "universal",
+ "existential",
+ "suchthat",
+ "congruent",
+ "therefore",
+ "perpendicular",
+ "minute",
+ "club",
+ "diamond",
+ "heart",
+ "spade",
+ "arrowboth",
+ "arrowleft",
+ "arrowup",
+ "arrowright",
+ "arrowdown",
+ "second",
+ "proportional",
+ "equivalence",
+ "arrowvertex",
+ "arrowhorizex",
+ "carriagereturn",
+ "aleph",
+ "Ifraktur",
+ "Rfraktur",
+ "weierstrass",
+ "circlemultiply",
+ "circleplus",
+ "emptyset",
+ "intersection",
+ "union",
+ "propersuperset",
+ "reflexsuperset",
+ "notsubset",
+ "propersubset",
+ "reflexsubset",
+ "element",
+ "notelement",
+ "angle",
+ "gradient",
+ "product",
+ "logicaland",
+ "logicalor",
+ "arrowdblboth",
+ "arrowdblleft",
+ "arrowdblup",
+ "arrowdblright",
+ "arrowdbldown",
+ "angleleft",
+ "registersans",
+ "copyrightsans",
+ "trademarksans",
+ "angleright",
+ "mathplus",
+ "mathminus",
+ "mathasterisk",
+ "mathnumbersign",
+ "dotmath",
+ "mathequal",
+ "mathtilde"
+ };
+
+ /// <summary>Lookup name by ID</summary>
+ public static string Name(int index) {
+ if ((index < 0) || (index >= Names.Length)) {
+ return string.Empty;
+ }
+
+ return Names[index];
+ }
+
+ /// <summary>Lookup ID by name (e.g. mathtilde)</summary>
+ public static int ID(string name) {
+ for (int i=0; i < Names.Length; i++) {
+ if (name.Equals(Names[i])) {
+ return i;
+ }
+ }
+ return 0;
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Style.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Style.cs
new file mode 100644
index 00000000000..9e8ed79efc2
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/Style.cs
@@ -0,0 +1,205 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms.RTF {
+ internal class Style {
+ #region Local Variables
+ public const int NoStyleNum = 222;
+ public const int NormalStyleNum = 0;
+
+ private string name;
+ private StyleType type;
+ private bool additive;
+ private int num;
+ private int based_on;
+ private int next_par;
+ private int se_list;
+ private bool expanding;
+ private StyleElement elements;
+ private Style next;
+ #endregion Local Variables
+
+ #region Constructors
+ public Style(RTF rtf) {
+ num = -1;
+ type = StyleType.Paragraph;
+ based_on = NoStyleNum;
+ next_par = -1;
+
+ lock (rtf) {
+ if (rtf.Styles == null) {
+ rtf.Styles = this;
+ } else {
+ Style s = rtf.Styles;
+ while (s.next != null)
+ s = s.next;
+ s.next = this;
+ }
+ }
+ }
+ #endregion // Constructors
+
+ #region Properties
+ public string Name {
+ get {
+ return name;
+ }
+
+ set {
+ name = value;
+ }
+ }
+
+ public StyleType Type {
+ get {
+ return type;
+ }
+
+ set {
+ type = value;
+ }
+ }
+
+ public bool Additive {
+ get {
+ return additive;
+ }
+
+ set {
+ additive = value;
+ }
+ }
+
+ public int BasedOn {
+ get {
+ return based_on;
+ }
+
+ set {
+ based_on = value;
+ }
+ }
+
+ public StyleElement Elements {
+ get {
+ return elements;
+ }
+
+ set {
+ elements = value;
+ }
+ }
+
+ public bool Expanding {
+ get {
+ return expanding;
+ }
+
+ set {
+ expanding = value;
+ }
+ }
+
+ public int NextPar {
+ get {
+ return next_par;
+ }
+
+ set {
+ next_par = value;
+ }
+ }
+
+ public int Num {
+ get {
+ return num;
+ }
+
+ set {
+ num = value;
+ }
+ }
+ #endregion // Properties
+
+ #region Methods
+ public void Expand(RTF rtf) {
+ StyleElement se;
+
+ if (num == -1) {
+ return;
+ }
+
+ if (expanding) {
+ throw new Exception("Recursive style expansion");
+ }
+ expanding = true;
+
+ if (num != based_on) {
+ rtf.SetToken(TokenClass.Control, Major.ParAttr, Minor.StyleNum, based_on, "\\s");
+ rtf.RouteToken();
+ }
+
+ se = elements;
+ while (se != null) {
+ rtf.TokenClass = se.TokenClass;
+ rtf.Major = se.Major;
+ rtf.Minor = se.Minor;
+ rtf.Param = se.Param;
+ rtf.Text = se.Text;
+ rtf.RouteToken();
+ }
+
+ expanding = false;
+ }
+
+ static public Style GetStyle(RTF rtf, int style_number) {
+ Style s;
+
+ lock (rtf) {
+ s = GetStyle(rtf.Styles, style_number);
+ }
+ return s;
+ }
+
+ static public Style GetStyle(Style start, int style_number) {
+ Style s;
+
+ if (style_number == -1) {
+ return start;
+ }
+
+ s = start;
+
+ while ((s != null) && (s.num != style_number)) {
+ s = s.next;
+ }
+ return s;
+ }
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/StyleElement.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/StyleElement.cs
new file mode 100644
index 00000000000..505758de792
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/StyleElement.cs
@@ -0,0 +1,116 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms.RTF {
+ internal class StyleElement {
+ #region Local Variables
+ private TokenClass token_class;
+ private Major major;
+ private Minor minor;
+ private int param;
+ private string text;
+ private StyleElement next;
+ #endregion Local Variables
+
+ #region Constructors
+ public StyleElement(Style s, TokenClass token_class, Major major, Minor minor, int param, string text) {
+ this.token_class = token_class;
+ this.major = major;
+ this.minor = minor;
+ this.param = param;
+ this.text = text;
+
+ lock (s) {
+ if (s.Elements == null) {
+ s.Elements = this;
+ } else {
+ StyleElement se = s.Elements;
+ while (se.next != null)
+ se = se.next;
+ se.next = this;
+ }
+ }
+ }
+ #endregion // Constructors
+
+ #region Properties
+ public TokenClass TokenClass {
+ get {
+ return token_class;
+ }
+
+ set {
+ token_class = value;
+ }
+ }
+
+ public Major Major {
+ get {
+ return major;
+ }
+
+ set {
+ major = value;
+ }
+ }
+
+ public Minor Minor {
+ get {
+ return minor;
+ }
+
+ set {
+ minor = value;
+ }
+ }
+
+ public int Param {
+ get {
+ return param;
+ }
+
+ set {
+ param = value;
+ }
+ }
+
+ public string Text {
+ get {
+ return text;
+ }
+
+ set {
+ text = value;
+ }
+ }
+ #endregion // Properties
+
+ #region Methods
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/StyleType.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/StyleType.cs
new file mode 100644
index 00000000000..f34a667e8fc
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/StyleType.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms.RTF {
+ internal enum StyleType {
+ Paragraph = 0,
+ Character = 1,
+ Section = 2
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/TextMap.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/TextMap.cs
new file mode 100644
index 00000000000..b77497a20e8
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/TextMap.cs
@@ -0,0 +1,228 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// This map is for convencience only, any app can create/use it's own
+// StdCharCode -> <text> table
+
+using System.Collections;
+
+namespace System.Windows.Forms.RTF {
+ internal class TextMap {
+ #region Local Variables
+ private string[] table;
+ #endregion // Local Variables
+
+ #region Public Constructors
+ public TextMap() {
+ table = new string[(int)StandardCharCode.MaxChar];
+
+ for (int i = 0; i < (int)StandardCharCode.MaxChar; i++) {
+ table[i] = string.Empty;
+ }
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ internal string this[StandardCharCode c] { // FIXME - this should be public, if the whole namespace was public (ie standalone RTF parser)
+ get {
+ return table[(int)c];
+ }
+
+ set {
+ table[(int)c] = value;
+ }
+ }
+
+ public string[] Table {
+ get {
+ return table;
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Static Methods
+ public static void SetupStandardTable(string[] table) {
+ table[(int)StandardCharCode.space] = " ";
+ table[(int)StandardCharCode.exclam] = "!";
+ table[(int)StandardCharCode.quotedbl] = "\"";
+ table[(int)StandardCharCode.numbersign] = "#";
+ table[(int)StandardCharCode.dollar] = "$";
+ table[(int)StandardCharCode.percent] = "%";
+ table[(int)StandardCharCode.ampersand] = "&";
+ table[(int)StandardCharCode.quoteright] = "'";
+ table[(int)StandardCharCode.parenleft] = "(";
+ table[(int)StandardCharCode.parenright] = ")";
+ table[(int)StandardCharCode.asterisk] = "*";
+ table[(int)StandardCharCode.plus] = "+";
+ table[(int)StandardCharCode.comma] = ",";
+ table[(int)StandardCharCode.hyphen] = "-";
+ table[(int)StandardCharCode.period] = ".";
+ table[(int)StandardCharCode.slash] = "/";
+ table[(int)StandardCharCode.zero] = "0";
+ table[(int)StandardCharCode.one] = "1";
+ table[(int)StandardCharCode.two] = "2";
+ table[(int)StandardCharCode.three] = "3";
+ table[(int)StandardCharCode.four] = "4";
+ table[(int)StandardCharCode.five] = "5";
+ table[(int)StandardCharCode.six] = "6";
+ table[(int)StandardCharCode.seven] = "7";
+ table[(int)StandardCharCode.eight] = "8";
+ table[(int)StandardCharCode.nine] = "9";
+ table[(int)StandardCharCode.colon] = ":";
+ table[(int)StandardCharCode.semicolon] = ";";
+ table[(int)StandardCharCode.less] = "<";
+ table[(int)StandardCharCode.equal] = "=";
+ table[(int)StandardCharCode.greater] = ">";
+ table[(int)StandardCharCode.question] = "?";
+ table[(int)StandardCharCode.at] = "@";
+ table[(int)StandardCharCode.A] = "A";
+ table[(int)StandardCharCode.B] = "B";
+ table[(int)StandardCharCode.C] = "C";
+ table[(int)StandardCharCode.D] = "D";
+ table[(int)StandardCharCode.E] = "E";
+ table[(int)StandardCharCode.F] = "F";
+ table[(int)StandardCharCode.G] = "G";
+ table[(int)StandardCharCode.H] = "H";
+ table[(int)StandardCharCode.I] = "I";
+ table[(int)StandardCharCode.J] = "J";
+ table[(int)StandardCharCode.K] = "K";
+ table[(int)StandardCharCode.L] = "L";
+ table[(int)StandardCharCode.M] = "M";
+ table[(int)StandardCharCode.N] = "N";
+ table[(int)StandardCharCode.O] = "O";
+ table[(int)StandardCharCode.P] = "P";
+ table[(int)StandardCharCode.Q] = "Q";
+ table[(int)StandardCharCode.R] = "R";
+ table[(int)StandardCharCode.S] = "S";
+ table[(int)StandardCharCode.T] = "T";
+ table[(int)StandardCharCode.U] = "U";
+ table[(int)StandardCharCode.V] = "V";
+ table[(int)StandardCharCode.W] = "W";
+ table[(int)StandardCharCode.X] = "X";
+ table[(int)StandardCharCode.Y] = "Y";
+ table[(int)StandardCharCode.Z] = "Z";
+ table[(int)StandardCharCode.bracketleft] = "[";
+ table[(int)StandardCharCode.backslash] = "\\";
+ table[(int)StandardCharCode.bracketright] = "]";
+ table[(int)StandardCharCode.asciicircum] = "^";
+ table[(int)StandardCharCode.underscore] = "_";
+ table[(int)StandardCharCode.quoteleft] = "`";
+ table[(int)StandardCharCode.a] = "a";
+ table[(int)StandardCharCode.b] = "b";
+ table[(int)StandardCharCode.c] = "c";
+ table[(int)StandardCharCode.d] = "d";
+ table[(int)StandardCharCode.e] = "e";
+ table[(int)StandardCharCode.f] = "f";
+ table[(int)StandardCharCode.g] = "g";
+ table[(int)StandardCharCode.h] = "h";
+ table[(int)StandardCharCode.i] = "i";
+ table[(int)StandardCharCode.j] = "j";
+ table[(int)StandardCharCode.k] = "k";
+ table[(int)StandardCharCode.l] = "l";
+ table[(int)StandardCharCode.m] = "m";
+ table[(int)StandardCharCode.n] = "n";
+ table[(int)StandardCharCode.o] = "o";
+ table[(int)StandardCharCode.p] = "p";
+ table[(int)StandardCharCode.q] = "q";
+ table[(int)StandardCharCode.r] = "r";
+ table[(int)StandardCharCode.s] = "s";
+ table[(int)StandardCharCode.t] = "t";
+ table[(int)StandardCharCode.u] = "u";
+ table[(int)StandardCharCode.v] = "v";
+ table[(int)StandardCharCode.w] = "w";
+ table[(int)StandardCharCode.x] = "x";
+ table[(int)StandardCharCode.y] = "y";
+ table[(int)StandardCharCode.z] = "z";
+ table[(int)StandardCharCode.braceleft] = "{";
+ table[(int)StandardCharCode.bar] = "|";
+ table[(int)StandardCharCode.braceright] = "}";
+ table[(int)StandardCharCode.asciitilde] = "~";
+ table[(int)StandardCharCode.AE] = "AE";
+ table[(int)StandardCharCode.OE] = "OE";
+ table[(int)StandardCharCode.acute] = "'";
+ table[(int)StandardCharCode.ae] = "ae";
+ table[(int)StandardCharCode.angleleft] = "<";
+ table[(int)StandardCharCode.angleright] = ">";
+ table[(int)StandardCharCode.arrowboth] = "<->";
+ table[(int)StandardCharCode.arrowdblboth] = "<=>";
+ table[(int)StandardCharCode.arrowdblleft] = "<=";
+ table[(int)StandardCharCode.arrowdblright] = "=>";
+ table[(int)StandardCharCode.arrowleft] = "<-";
+ table[(int)StandardCharCode.arrowright] = "->";
+ table[(int)StandardCharCode.bullet] = "o";
+ table[(int)StandardCharCode.cent] = "cent";
+ table[(int)StandardCharCode.circumflex] = "^";
+ table[(int)StandardCharCode.copyright] = "(c)";
+ table[(int)StandardCharCode.copyrightsans] = "(c)";
+ table[(int)StandardCharCode.degree] = "deg.";
+ table[(int)StandardCharCode.divide] = "/";
+ table[(int)StandardCharCode.dotlessi] = "i";
+ table[(int)StandardCharCode.ellipsis] = "...";
+ table[(int)StandardCharCode.emdash] = "--";
+ table[(int)StandardCharCode.endash] = "-";
+ table[(int)StandardCharCode.fi] = "fi";
+ table[(int)StandardCharCode.fl] = "fl";
+ table[(int)StandardCharCode.fraction] = "/";
+ table[(int)StandardCharCode.germandbls] = "ss";
+ table[(int)StandardCharCode.grave] = "`";
+ table[(int)StandardCharCode.greaterequal] = ">=";
+ table[(int)StandardCharCode.guillemotleft] = "<<";
+ table[(int)StandardCharCode.guillemotright] = ">>";
+ table[(int)StandardCharCode.guilsinglleft] = "<";
+ table[(int)StandardCharCode.guilsinglright] = ">";
+ table[(int)StandardCharCode.lessequal] = "<=";
+ table[(int)StandardCharCode.logicalnot] = "~";
+ table[(int)StandardCharCode.mathasterisk] = "*";
+ table[(int)StandardCharCode.mathequal] = "=";
+ table[(int)StandardCharCode.mathminus] = "-";
+ table[(int)StandardCharCode.mathnumbersign] = "#";
+ table[(int)StandardCharCode.mathplus] = "+";
+ table[(int)StandardCharCode.mathtilde] = "~";
+ table[(int)StandardCharCode.minus] = "-";
+ table[(int)StandardCharCode.mu] = "u";
+ table[(int)StandardCharCode.multiply] = "x";
+ table[(int)StandardCharCode.nobrkhyphen] = "-";
+ table[(int)StandardCharCode.nobrkspace] = "";
+ table[(int)StandardCharCode.notequal] = "!=";
+ table[(int)StandardCharCode.oe] = "oe";
+ table[(int)StandardCharCode.onehalf] = "1/2";
+ table[(int)StandardCharCode.onequarter] = "1/4";
+ table[(int)StandardCharCode.periodcentered] = ".";
+ table[(int)StandardCharCode.plusminus] = "+/-";
+ table[(int)StandardCharCode.quotedblbase] = ",,";
+ table[(int)StandardCharCode.quotedblleft] = "\"";
+ table[(int)StandardCharCode.quotedblright] = "\"";
+ table[(int)StandardCharCode.quotesinglbase] = ",";
+ table[(int)StandardCharCode.registered] = "reg.";
+ table[(int)StandardCharCode.registersans] = "reg.";
+ table[(int)StandardCharCode.threequarters] = "3/4";
+ table[(int)StandardCharCode.tilde] = "~";
+ table[(int)StandardCharCode.trademark] = "(TM)";
+ table[(int)StandardCharCode.trademarksans] = "(TM)";
+ }
+ #endregion // Public Static Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/TokenClass.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/TokenClass.cs
new file mode 100644
index 00000000000..bd86509b101
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/TokenClass.cs
@@ -0,0 +1,39 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms.RTF {
+ internal enum TokenClass {
+ None = -1,
+ Unknown = 0,
+ Group = 1,
+ Text = 2,
+ Control = 3,
+ EOF = 4,
+ MaxClass = 5
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/rtf.csproj b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/rtf.csproj
new file mode 100644
index 00000000000..f8763b1b5c7
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/rtf.csproj
@@ -0,0 +1,200 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.10.3077"
+ SchemaVersion = "2.0"
+ ProjectGuid = "{12D60959-776E-41E9-82BE-AA5DF4BB7CAE}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "rtf"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Exe"
+ PreBuildEvent = ""
+ PostBuildEvent = ""
+ RootNamespace = "rtf"
+ RunPostBuildEvent = "OnBuildSuccess"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = ""
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "1"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = ""
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "false"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "1"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System.Drawing"
+ AssemblyName = "System.Drawing"
+ HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Drawing.dll"
+ />
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
+ />
+ <Reference
+ Name = "System.Windows.Forms"
+ AssemblyName = "System.Windows.Forms"
+ HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Windows.Forms.dll"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "Charcode.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Charset.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "CharsetFlags.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "CharsetType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ClassDelegate.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Color.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DestinationDelegate.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Font.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "KeysInit.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "KeyStruct.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Major.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Minor.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RTF.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RTFException.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StandardCharCode.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StandardCharName.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Style.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StyleElement.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StyleType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "test.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TextMap.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TokenClass.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/rtf.csproj.user b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/rtf.csproj.user
new file mode 100644
index 00000000000..0e89b7e9542
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/rtf.csproj.user
@@ -0,0 +1,48 @@
+<VisualStudioProject>
+ <CSHARP LastOpenVersion = "7.10.3077" >
+ <Build>
+ <Settings ReferencePath = "" >
+ <Config
+ Name = "Debug"
+ EnableASPDebugging = "false"
+ EnableASPXDebugging = "false"
+ EnableUnmanagedDebugging = "false"
+ EnableSQLServerDebugging = "false"
+ RemoteDebugEnabled = "false"
+ RemoteDebugMachine = ""
+ StartAction = "Project"
+ StartArguments = ""
+ StartPage = ""
+ StartProgram = ""
+ StartURL = ""
+ StartWorkingDirectory = ""
+ StartWithIE = "false"
+ />
+ <Config
+ Name = "Release"
+ EnableASPDebugging = "false"
+ EnableASPXDebugging = "false"
+ EnableUnmanagedDebugging = "false"
+ EnableSQLServerDebugging = "false"
+ RemoteDebugEnabled = "false"
+ RemoteDebugMachine = ""
+ StartAction = "Project"
+ StartArguments = ""
+ StartPage = ""
+ StartProgram = ""
+ StartURL = ""
+ StartWorkingDirectory = ""
+ StartWithIE = "false"
+ />
+ </Settings>
+ </Build>
+ <OtherProjectSettings
+ CopyProjectDestinationFolder = ""
+ CopyProjectUncPath = ""
+ CopyProjectOption = "0"
+ ProjectView = "ProjectFiles"
+ ProjectTrust = "0"
+ />
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/test.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/test.cs
new file mode 100644
index 00000000000..c62cdb90c49
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/test.cs
@@ -0,0 +1,286 @@
+using System;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.Drawing.Text;
+using System.Windows.Forms;
+using System.Text;
+using System.Threading;
+using System.Windows.Forms.RTF;
+using System.IO;
+
+namespace TextTestClass {
+ public class Test {
+ static Test test;
+ int skip_width;
+ int skip_count;
+ private string rtf_string = "{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Microsoft Sans Serif;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs17 testing 123testiong\\par\r\n}";
+ private string rtf_string2 = "{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fswiss\\fcharset0 Arial;}{\\f1\\fmodern\\fprq1\\fcharset0 Courier;}{\\f2\\fswiss\\fprq2\\fcharset0 Arial;}}\r\n" +
+ "{\\colortbl ;\\red255\\green0\\blue0;\\red0\\green0\\blue0;}\r\n" +
+ "{\\*\\generator Msftedit 5.41.15.1507;}\\viewkind4\\uc1\\pard\\f0\\fs20 I am in Arial 10pt\\par\r\n" +
+ "\\fs24 I am in Arial 12pt\\par\r\n" +
+ "\\f1 I am in Courier 12pt\\par\r\n" +
+ "\\cf1 I am in Courier 12pt Red\\par\r\n" +
+ "\\cf2\\f2\\fs20 I am in Arial 10pt\\par\r\n" +
+ "\\b I am in Arial 10pt Italic\\cf0\\b0\\f0\\par\r\n" +
+ "}";
+ private string rtf_string3 = "{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fswiss\\fcharset0 Arial;}{" +
+ "\\f1\\fmodern\\fprq1\\fcharset0 Courier;}{\\f2\\fswiss\\fprq2\\fcharset0 Arial;}{\\f3\\fni" +
+ "l\\fcharset0 Impact;}{\\f4\\fnil\\fcharset0 Arial Unicode MS;}{\\f5\\fnil\\fcharset136 Arial Unicode MS;}{\\f6\\fnil\\fcharset0 MS" +
+ " Shell Dlg;}}" +
+ "{\\colortbl ;\\red255\\green0\\blue0;\\red0\\green0\\blue0;}" +
+ "{\\*\\generator Msftedit 5.41.15.1507;}\\viewkind4\\uc1\\pard\\f0\\fs20 I am in Arial 1" +
+ "0pt\\par" +
+ "\\fs24 I am in Arial 12pt\\par" +
+ "\\f1 I am in Courier 12pt\\par" +
+ "\\cf1 I am in Courier 12pt Red\\par" +
+ "\\cf2\\f2\\fs20 I am in Arial 10pt\\par" +
+ "\\b I am in Arial 10pt Bold\\par" +
+ "\\i I am in Arial 10pt Bold Italic\\par" +
+ "\\ul I am in Arial 10pt Bold Italic Underline\\par" +
+ "\\ulnone\\b0\\i0\\strike I am in Arial 10pt Strikethrough\\par" +
+ "\\cf0\\strike0\\f3\\fs23 Some cyrilic character: \\u1034?\\par" +
+ "And 5 CJK characters: \\f4\\fs21\\u23854?\\u23854?\\u23854?\\u23854?\\u23854?\\f5\\fs17\\par" +
+ "Some special chars:\\par" +
+ "\\tab Tilde: ~\\par" +
+ "\\tab Questionmark:?\\par" +
+ "\\tab Yen: \\f5\\u165?\\f6\\fs17\\par" +
+ "\\tab Umlaut: \\'e4\\par" +
+ "\\f0\\fs20\\par" +
+ "}";
+
+ TextMap text;
+
+ public Test() {
+ MemoryStream stream;
+ RTF rtf;
+ byte[] buffer;
+
+ text = new TextMap();
+ TextMap.SetupStandardTable(text.Table);
+
+ buffer = new byte[rtf_string.Length];
+ for (int i = 0; i < buffer.Length; i++) {
+ buffer[i] = (byte)rtf_string[i];
+ }
+ stream = new MemoryStream(buffer);
+ rtf = new RTF(stream);
+
+ skip_width = 0;
+ skip_count = 0;
+
+ rtf.ClassCallback[TokenClass.Text] = new ClassDelegate(HandleText);
+ rtf.ClassCallback[TokenClass.Control] = new ClassDelegate(HandleControl);
+
+ rtf.Read();
+
+ stream.Close();
+ }
+
+ void HandleControl(RTF rtf) {
+ switch(rtf.Major) {
+ case Major.Unicode: {
+ switch(rtf.Minor) {
+ case Minor.UnicodeCharBytes: {
+ skip_width = rtf.Param;
+ break;
+ }
+
+ case Minor.UnicodeChar: {
+ Console.Write("[Unicode {0:X4}]", rtf.Param);
+ skip_count += skip_width;
+ break;
+ }
+ }
+ break;
+ }
+
+ case Major.Destination: {
+ Console.Write("[Got Destination control {0}]", rtf.Minor);
+ rtf.SkipGroup();
+ break;
+ }
+
+ case Major.CharAttr: {
+ switch(rtf.Minor) {
+ case Minor.ForeColor: {
+ System.Windows.Forms.RTF.Color color;
+ int num;
+
+ color = System.Windows.Forms.RTF.Color.GetColor(rtf, rtf.Param);
+ if (color != null) {
+ if (color.Red == -1 && color.Green == -1 && color.Blue == -1) {
+ Console.Write("[Default Color]");
+ } else {
+ Console.Write("[Color {0} [{1:X2}{2:X2}{3:X}]]", rtf.Param, color.Red, color.Green, color.Blue);
+ }
+ }
+ break;
+ }
+
+ case Minor.FontSize: {
+ Console.Write("[Fontsize {0}]", rtf.Param);
+ break;
+ }
+
+ case Minor.FontNum: {
+ System.Windows.Forms.RTF.Font font;
+
+ font = System.Windows.Forms.RTF.Font.GetFont(rtf, rtf.Param);
+ if (font != null) {
+ Console.Write("[Font {0} [{1}]]", rtf.Param, font.Name);
+ }
+ break;
+ }
+
+ case Minor.Plain: {
+ Console.Write("[Normal]");
+ break;
+ }
+
+ case Minor.Bold: {
+ if (rtf.Param == RTF.NoParam) {
+ Console.Write("[Bold]");
+ } else {
+ Console.Write("[NoBold]");
+ }
+ break;
+ }
+
+ case Minor.Italic: {
+ if (rtf.Param == RTF.NoParam) {
+ Console.Write("[Italic]");
+ } else {
+ Console.Write("[NoItalic]");
+ }
+ break;
+ }
+
+ case Minor.StrikeThru: {
+ if (rtf.Param == RTF.NoParam) {
+ Console.Write("[StrikeThru]");
+ } else {
+ Console.Write("[NoStrikeThru]");
+ }
+ break;
+ }
+
+ case Minor.Underline: {
+ if (rtf.Param == RTF.NoParam) {
+ Console.Write("[Underline]");
+ } else {
+ Console.Write("[NoUnderline]");
+ }
+ break;
+ }
+
+ case Minor.NoUnderline: {
+ Console.Write("[NoUnderline]");
+ break;
+ }
+ }
+ break;
+ }
+
+ case Major.SpecialChar: {
+ Console.Write("[Got SpecialChar control {0}]", rtf.Minor);
+ SpecialChar(rtf);
+ break;
+ }
+ }
+ }
+
+ void SpecialChar(RTF rtf) {
+ switch(rtf.Minor) {
+ case Minor.Page:
+ case Minor.Sect:
+ case Minor.Row:
+ case Minor.Line:
+ case Minor.Par: {
+ Console.Write("\n");
+ break;
+ }
+
+ case Minor.Cell: {
+ Console.Write(" ");
+ break;
+ }
+
+ case Minor.NoBrkSpace: {
+ Console.Write(" ");
+ break;
+ }
+
+ case Minor.Tab: {
+ Console.Write("\t");
+ break;
+ }
+
+ case Minor.NoBrkHyphen: {
+ Console.Write("-");
+ break;
+ }
+
+ case Minor.Bullet: {
+ Console.Write("*");
+ break;
+ }
+
+ case Minor.EmDash: {
+ Console.Write("—");
+ break;
+ }
+
+ case Minor.EnDash: {
+ Console.Write("–");
+ break;
+ }
+
+ case Minor.LQuote: {
+ Console.Write("‘");
+ break;
+ }
+
+ case Minor.RQuote: {
+ Console.Write("’");
+ break;
+ }
+
+ case Minor.LDblQuote: {
+ Console.Write("“");
+ break;
+ }
+
+ case Minor.RDblQuote: {
+ Console.Write("”");
+ break;
+ }
+
+ default: {
+ rtf.SkipGroup();
+ break;
+ }
+ }
+ }
+
+
+ void HandleText(RTF rtf) {
+ if (skip_count > 0) {
+ skip_count--;
+ return;
+ }
+ if ((StandardCharCode)rtf.Minor != StandardCharCode.nothing) {
+ Console.Write("{0}", text[(StandardCharCode)rtf.Minor]);
+ } else {
+ if ((int)rtf.Major > 31 && (int)rtf.Major < 128) {
+ Console.Write("{0}", (char)rtf.Major);
+ } else {
+ Console.Write("[Literal:0x{0:X2}]", (int)rtf.Major);
+ }
+ }
+ }
+
+ public static void Main() {
+ test = new Test();
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.resources b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.resources
new file mode 100644
index 00000000000..399de36c6a3
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.resources
@@ -0,0 +1,9 @@
+-resource:resources/System.Windows.Forms.resources
+-resource:resources/System.Windows.Forms.en.resources
+-resource:resources/System.Windows.Forms.de.resources
+-resource:resources/SplitterNS.cur,System.Windows.Forms.SplitterNS.cur
+-resource:resources/SplitterWE.cur,System.Windows.Forms.SplitterWE.cur
+-resource:resources/DnDNo.cur,System.Windows.Forms.DnDNo.cur
+-resource:resources/DnDCopy.cur,System.Windows.Forms.DnDCopy.cur
+-resource:resources/DnDLink.cur,System.Windows.Forms.DnDLink.cur
+-resource:resources/DnDMove.cur,System.Windows.Forms.DnDMove.cur
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.sources b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.sources
new file mode 100644
index 00000000000..31120733713
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.sources
@@ -0,0 +1,533 @@
+Assembly/AssemblyInfo.cs
+../../build/common/Consts.cs
+Assembly/Locale.cs
+System.Resources/ResXNullRef.cs
+System.Resources/ResXFileRef.cs
+System.Resources/ResXResourceReader.cs
+System.Resources/ResXResourceSet.cs
+System.Resources/ResXResourceWriter.cs
+System.Windows.Forms.Design/ComponentEditorForm.cs
+System.Windows.Forms.Design/ComponentEditorPage.cs
+System.Windows.Forms.Design/EventsTab.cs
+System.Windows.Forms.Design/IUIService.cs
+System.Windows.Forms.Design/IWindowsFormsEditorService.cs
+System.Windows.Forms.Design/PropertyTab.cs
+System.Windows.Forms.Design/WindowsFormsComponentEditor.cs
+System.Windows.Forms/AccessibleEvents.cs
+System.Windows.Forms/AccessibleNavigation.cs
+System.Windows.Forms/AccessibleObject.cs
+System.Windows.Forms/AccessibleRole.cs
+System.Windows.Forms/AccessibleSelection.cs
+System.Windows.Forms/AccessibleStates.cs
+System.Windows.Forms/AmbientProperties.cs
+System.Windows.Forms/AnchorStyles.cs
+System.Windows.Forms/Appearance.cs
+System.Windows.Forms/Application.cs
+System.Windows.Forms/ApplicationContext.cs
+System.Windows.Forms/ArrangeDirection.cs
+System.Windows.Forms/ArrangeStartingPosition.cs
+System.Windows.Forms/AsyncMethodData.cs
+System.Windows.Forms/AsyncMethodResult.cs
+System.Windows.Forms/AxHost.cs
+System.Windows.Forms/BaseCollection.cs
+System.Windows.Forms/BindingContext.cs
+System.Windows.Forms/Binding.cs
+System.Windows.Forms/BindingManagerBase.cs
+System.Windows.Forms/BindingMemberInfo.cs
+System.Windows.Forms/BindingsCollection.cs
+System.Windows.Forms/BootMode.cs
+System.Windows.Forms/Border3DSide.cs
+System.Windows.Forms/Border3DStyle.cs
+System.Windows.Forms/BorderStyle.cs
+System.Windows.Forms/BoundsSpecified.cs
+System.Windows.Forms/Button.cs
+System.Windows.Forms/ButtonBase.cs
+System.Windows.Forms/ButtonBorderStyle.cs
+System.Windows.Forms/ButtonState.cs
+System.Windows.Forms/CaptionButton.cs
+System.Windows.Forms/CategoryGridEntry.cs
+System.Windows.Forms/CharacterCasing.cs
+System.Windows.Forms/CheckBox.cs
+System.Windows.Forms/CheckedListBox.cs
+System.Windows.Forms/CheckState.cs
+System.Windows.Forms/ColorDepth.cs
+System.Windows.Forms/Clipboard.cs
+System.Windows.Forms/ColorDialog.cs
+System.Windows.Forms/ColumnClickEventArgs.cs
+System.Windows.Forms/ColumnClickEventHandler.cs
+System.Windows.Forms/ColumnHeader.cs
+System.Windows.Forms/ColumnHeaderStyle.cs
+System.Windows.Forms/ComboBox.cs
+System.Windows.Forms/ComboBoxStyle.cs
+System.Windows.Forms/CommonDialog.cs
+System.Windows.Forms/ComponentModel.cs
+System.Windows.Forms/ContainerControl.cs
+System.Windows.Forms/ContentsResizedEventArgs.cs
+System.Windows.Forms/ContentsResizedEventHandler.cs
+System.Windows.Forms/ContextMenu.cs
+System.Windows.Forms/Control.cs
+System.Windows.Forms/ControlBindingsCollection.cs
+System.Windows.Forms/ControlEventArgs.cs
+System.Windows.Forms/ControlEventHandler.cs
+System.Windows.Forms/ControlPaint.cs
+System.Windows.Forms/ControlStyles.cs
+System.Windows.Forms/ConvertEventArgs.cs
+System.Windows.Forms/ConvertEventHandler.cs
+System.Windows.Forms/CreateParams.cs
+System.Windows.Forms/CurrencyManager.cs
+System.Windows.Forms/Cursor.cs
+System.Windows.Forms/CursorConverter.cs
+System.Windows.Forms/Cursors.cs
+System.Windows.Forms/DataFormats.cs
+System.Windows.Forms/DataGrid.cs
+System.Windows.Forms/DataGridDrawingLogic.cs
+System.Windows.Forms/DataGridBoolColumn.cs
+System.Windows.Forms/DataGridCell.cs
+System.Windows.Forms/DataGridColumnStyle.cs
+System.Windows.Forms/DataGridLineStyle.cs
+System.Windows.Forms/DataGridParentRowsLabelStyle.cs
+System.Windows.Forms/DataGridPreferredColumnWidthTypeConverter.cs
+System.Windows.Forms/DataGridTableStyle.cs
+System.Windows.Forms/DataGridTextBox.cs
+System.Windows.Forms/DataGridTextBoxColumn.cs
+System.Windows.Forms/DataGridViewAdvancedBorderStyle.cs
+System.Windows.Forms/DataGridViewAdvancedCellBorderStyle.cs
+System.Windows.Forms/DataGridViewAutoSizeColumnMode.cs
+System.Windows.Forms/DataGridViewAutoSizeColumnModeEventArgs.cs
+System.Windows.Forms/DataGridViewAutoSizeColumnModeEventHandler.cs
+System.Windows.Forms/DataGridViewAutoSizeColumnsMode.cs
+System.Windows.Forms/DataGridViewAutoSizeColumnsModeEventArgs.cs
+System.Windows.Forms/DataGridViewAutoSizeColumnsModeEventHandler.cs
+System.Windows.Forms/DataGridViewAutoSizeModeEventArgs.cs
+System.Windows.Forms/DataGridViewAutoSizeModeEventHandler.cs
+System.Windows.Forms/DataGridViewAutoSizeRowMode.cs
+System.Windows.Forms/DataGridViewAutoSizeRowsMode.cs
+System.Windows.Forms/DataGridViewBand.cs
+System.Windows.Forms/DataGridViewBindingCompleteEventArgs.cs
+System.Windows.Forms/DataGridViewBindingCompleteEventHandler.cs
+System.Windows.Forms/DataGridViewButtonCell.cs
+System.Windows.Forms/DataGridViewButtonColumn.cs
+System.Windows.Forms/DataGridViewCellBorderStyle.cs
+System.Windows.Forms/DataGridViewCellCancelEventArgs.cs
+System.Windows.Forms/DataGridViewCellCancelEventHandler.cs
+System.Windows.Forms/DataGridViewCellCollection.cs
+System.Windows.Forms/DataGridViewCellContextMenuStripNeededEventArgs.cs
+System.Windows.Forms/DataGridViewCellContextMenuStripNeededEventHandler.cs
+System.Windows.Forms/DataGridViewCell.cs
+System.Windows.Forms/DataGridViewCellErrorTextNeededEventArgs.cs
+System.Windows.Forms/DataGridViewCellErrorTextNeededEventHandler.cs
+System.Windows.Forms/DataGridViewCellEventArgs.cs
+System.Windows.Forms/DataGridViewCellEventHandler.cs
+System.Windows.Forms/DataGridViewCellFormattingEventArgs.cs
+System.Windows.Forms/DataGridViewCellFormattingEventHandler.cs
+System.Windows.Forms/DataGridViewCellMouseEventArgs.cs
+System.Windows.Forms/DataGridViewCellMouseEventHandler.cs
+System.Windows.Forms/DataGridViewCellPaintingEventArgs.cs
+System.Windows.Forms/DataGridViewCellPaintingEventHandler.cs
+System.Windows.Forms/DataGridViewCellParsingEventArgs.cs
+System.Windows.Forms/DataGridViewCellParsingEventHandler.cs
+System.Windows.Forms/DataGridViewCellStateChangedEventArgs.cs
+System.Windows.Forms/DataGridViewCellStateChangedEventHandler.cs
+System.Windows.Forms/DataGridViewCellStyleContentChangedEventArgs.cs
+System.Windows.Forms/DataGridViewCellStyleContentChangedEventHandler.cs
+System.Windows.Forms/DataGridViewCellStyleConverter.cs
+System.Windows.Forms/DataGridViewCellStyle.cs
+System.Windows.Forms/DataGridViewCellStyleScopes.cs
+System.Windows.Forms/DataGridViewCellToolTipTextNeededEventArgs.cs
+System.Windows.Forms/DataGridViewCellToolTipTextNeededEventHandler.cs
+System.Windows.Forms/DataGridViewCellValidatingEventArgs.cs
+System.Windows.Forms/DataGridViewCellValidatingEventHandler.cs
+System.Windows.Forms/DataGridViewCellValueEventArgs.cs
+System.Windows.Forms/DataGridViewCellValueEventHandler.cs
+System.Windows.Forms/DataGridViewCheckBoxCell.cs
+System.Windows.Forms/DataGridViewCheckBoxColumn.cs
+System.Windows.Forms/DataGridViewClipboardCopyMode.cs
+System.Windows.Forms/DataGridViewColumnCollection.cs
+System.Windows.Forms/DataGridViewColumn.cs
+System.Windows.Forms/DataGridViewColumnDesignTimeVisibleAttribute.cs
+System.Windows.Forms/DataGridViewColumnDividerDoubleClickEventArgs.cs
+System.Windows.Forms/DataGridViewColumnDividerDoubleClickEventHandler.cs
+System.Windows.Forms/DataGridViewColumnEventArgs.cs
+System.Windows.Forms/DataGridViewColumnEventHandler.cs
+System.Windows.Forms/DataGridViewColumnHeaderCell.cs
+System.Windows.Forms/DataGridViewColumnHeadersHeightSizeMode.cs
+System.Windows.Forms/DataGridViewColumnSortMode.cs
+System.Windows.Forms/DataGridViewColumnStateChangedEventArgs.cs
+System.Windows.Forms/DataGridViewColumnStateChangedEventHandler.cs
+System.Windows.Forms/DataGridViewComboBoxCell.cs
+System.Windows.Forms/DataGridViewComboBoxColumn.cs
+System.Windows.Forms/DataGridViewComboBoxDisplayStyle.cs
+System.Windows.Forms/DataGridViewComboBoxEditingControl.cs
+System.Windows.Forms/DataGridViewContentAlignment.cs
+System.Windows.Forms/DataGridView.cs
+System.Windows.Forms/DataGridViewDataErrorContexts.cs
+System.Windows.Forms/DataGridViewDataErrorEventArgs.cs
+System.Windows.Forms/DataGridViewDataErrorEventHandler.cs
+System.Windows.Forms/DataGridViewEditingControlShowingEventArgs.cs
+System.Windows.Forms/DataGridViewEditingControlShowingEventHandler.cs
+System.Windows.Forms/DataGridViewEditMode.cs
+System.Windows.Forms/DataGridViewElement.cs
+System.Windows.Forms/DataGridViewElementStates.cs
+System.Windows.Forms/DataGridViewHeaderBorderStyle.cs
+System.Windows.Forms/DataGridViewHeaderCell.cs
+System.Windows.Forms/DataGridViewHitTestType.cs
+System.Windows.Forms/DataGridViewImageCell.cs
+System.Windows.Forms/DataGridViewImageCellLayout.cs
+System.Windows.Forms/DataGridViewImageColumn.cs
+System.Windows.Forms/DataGridViewPaintParts.cs
+System.Windows.Forms/DataGridViewRowCancelEventArgs.cs
+System.Windows.Forms/DataGridViewRowCancelEventHandler.cs
+System.Windows.Forms/DataGridViewRowCollection.cs
+System.Windows.Forms/DataGridViewRowContextMenuStripNeededEventArgs.cs
+System.Windows.Forms/DataGridViewRowContextMenuStripNeededEventHandler.cs
+System.Windows.Forms/DataGridViewRow.cs
+System.Windows.Forms/DataGridViewRowDividerDoubleClickEventArgs.cs
+System.Windows.Forms/DataGridViewRowDividerDoubleClickEventHandler.cs
+System.Windows.Forms/DataGridViewRowErrorTextNeededEventArgs.cs
+System.Windows.Forms/DataGridViewRowErrorTextNeededEventHandler.cs
+System.Windows.Forms/DataGridViewRowEventArgs.cs
+System.Windows.Forms/DataGridViewRowEventHandler.cs
+System.Windows.Forms/DataGridViewRowHeaderCell.cs
+System.Windows.Forms/DataGridViewRowHeadersWidthSizeMode.cs
+System.Windows.Forms/DataGridViewRowHeightInfoNeededEventArgs.cs
+System.Windows.Forms/DataGridViewRowHeightInfoNeededEventHandler.cs
+System.Windows.Forms/DataGridViewRowHeightInfoPushedEventArgs.cs
+System.Windows.Forms/DataGridViewRowHeightInfoPushedEventHandler.cs
+System.Windows.Forms/DataGridViewRowPostPaintEventArgs.cs
+System.Windows.Forms/DataGridViewRowPostPaintEventHandler.cs
+System.Windows.Forms/DataGridViewRowPrePaintEventArgs.cs
+System.Windows.Forms/DataGridViewRowPrePaintEventHandler.cs
+System.Windows.Forms/DataGridViewRowsAddedEventArgs.cs
+System.Windows.Forms/DataGridViewRowsAddedEventHandler.cs
+System.Windows.Forms/DataGridViewRowsDeletedEventArgs.cs
+System.Windows.Forms/DataGridViewRowsRemovedEventArgs.cs
+System.Windows.Forms/DataGridViewRowsRemovedEventHandler.cs
+System.Windows.Forms/DataGridViewRowStateChangedEventArgs.cs
+System.Windows.Forms/DataGridViewRowStateChangedEventHandler.cs
+System.Windows.Forms/DataGridViewSelectedCellCollection.cs
+System.Windows.Forms/DataGridViewSelectedColumnCollection.cs
+System.Windows.Forms/DataGridViewSelectedRowCollection.cs
+System.Windows.Forms/DataGridViewSelectionMode.cs
+System.Windows.Forms/DataGridViewSortCompareEventArgs.cs
+System.Windows.Forms/DataGridViewSortCompareEventHandler.cs
+System.Windows.Forms/DataGridViewTextBoxCell.cs
+System.Windows.Forms/DataGridViewTextBoxColumn.cs
+System.Windows.Forms/DataGridViewTextBoxEditingControl.cs
+System.Windows.Forms/DataGridViewTopLeftHeaderCell.cs
+System.Windows.Forms/DataGridViewTriState.cs
+System.Windows.Forms/DataObject.cs
+System.Windows.Forms/DateBoldEventArgs.cs
+System.Windows.Forms/DateBoldEventHandler.cs
+System.Windows.Forms/DateRangeEventArgs.cs
+System.Windows.Forms/DateRangeEventHandler.cs
+System.Windows.Forms/DateTimePicker.cs
+System.Windows.Forms/DateTimePickerFormat.cs
+System.Windows.Forms/Day.cs
+System.Windows.Forms/DialogResult.cs
+System.Windows.Forms/DockStyle.cs
+System.Windows.Forms/DomainUpDown.cs
+System.Windows.Forms/DragAction.cs
+System.Windows.Forms/DragDropEffects.cs
+System.Windows.Forms/DragEventArgs.cs
+System.Windows.Forms/DragEventHandler.cs
+System.Windows.Forms/DrawItemEventArgs.cs
+System.Windows.Forms/DrawItemEventHandler.cs
+System.Windows.Forms/DrawItemState.cs
+System.Windows.Forms/DrawMode.cs
+System.Windows.Forms/ErrorBlinkStyle.cs
+System.Windows.Forms/ErrorIconAlignment.cs
+System.Windows.Forms/ErrorProvider.cs
+System.Windows.Forms/FeatureSupport.cs
+System.Windows.Forms/FlatStyle.cs
+System.Windows.Forms/FontDialog.cs
+System.Windows.Forms/FileDialog.cs
+System.Windows.Forms/FolderBrowserDialog.cs
+System.Windows.Forms/Form.cs
+System.Windows.Forms/FormBorderStyle.cs
+System.Windows.Forms/FormStartPosition.cs
+System.Windows.Forms/FormWindowState.cs
+System.Windows.Forms/FrameStyle.cs
+System.Windows.Forms/GiveFeedbackEventArgs.cs
+System.Windows.Forms/GiveFeedbackEventHandler.cs
+System.Windows.Forms/GridColumnStylesCollection.cs
+System.Windows.Forms/GridTablesFactory.cs
+System.Windows.Forms/GridTableStylesCollection.cs
+System.Windows.Forms/GridEntry.cs
+System.Windows.Forms/GridItem.cs
+System.Windows.Forms/GridItemCollection.cs
+System.Windows.Forms/GridItemType.cs
+System.Windows.Forms/GroupBox.cs
+System.Windows.Forms/HandledMouseEventArgs.cs
+System.Windows.Forms/Help.cs
+System.Windows.Forms/HelpEventArgs.cs
+System.Windows.Forms/HelpEventHandler.cs
+System.Windows.Forms/HelpNavigator.cs
+System.Windows.Forms/HelpProvider.cs
+System.Windows.Forms/HorizontalAlignment.cs
+System.Windows.Forms/HScrollBar.cs
+System.Windows.Forms/Hwnd.cs
+System.Windows.Forms/IButtonControl.cs
+System.Windows.Forms/ICommandExecutor.cs
+System.Windows.Forms/IComponentEditorPageSite.cs
+System.Windows.Forms/IContainerControl.cs
+System.Windows.Forms/IDataGridColumnStyleEditingNotificationService.cs
+System.Windows.Forms/IDataGridEditingService.cs
+System.Windows.Forms/IDataGridViewEditingCell.cs
+System.Windows.Forms/IDataGridViewEditingControl.cs
+System.Windows.Forms/IDataObject.cs
+System.Windows.Forms/IFeatureSupport.cs
+System.Windows.Forms/IFileReaderService.cs
+System.Windows.Forms/ImageIndexConverter.cs
+System.Windows.Forms/ImageLayout.cs
+System.Windows.Forms/ImageList.cs
+System.Windows.Forms/ImageListConverter.cs
+System.Windows.Forms/ImageListStreamer.cs
+System.Windows.Forms/ImeMode.cs
+System.Windows.Forms/IMessageFilter.cs
+System.Windows.Forms/ImplicitHScrollBar.cs
+System.Windows.Forms/ImplicitVScrollBar.cs
+System.Windows.Forms/InputLanguageChangedEventArgs.cs
+System.Windows.Forms/InputLanguageChangedEventHandler.cs
+System.Windows.Forms/InputLanguageChangingEventArgs.cs
+System.Windows.Forms/InputLanguageChangingEventHandler.cs
+System.Windows.Forms/InputLanguageCollection.cs
+System.Windows.Forms/InputLanguage.cs
+System.Windows.Forms/InternalWindowManager.cs
+System.Windows.Forms/InvalidateEventArgs.cs
+System.Windows.Forms/InvalidateEventHandler.cs
+System.Windows.Forms/IRootGridEntry.cs
+System.Windows.Forms/ItemActivation.cs
+System.Windows.Forms/ItemBoundsPortion.cs
+System.Windows.Forms/ItemChangedEventArgs.cs
+System.Windows.Forms/ItemChangedEventHandler.cs
+System.Windows.Forms/ItemCheckEventArgs.cs
+System.Windows.Forms/ItemCheckEventHandler.cs
+System.Windows.Forms/ItemDragEventArgs.cs
+System.Windows.Forms/ItemDragEventHandler.cs
+System.Windows.Forms/IWin32Window.cs
+System.Windows.Forms/IWindowTarget.cs
+System.Windows.Forms/KeyboardLayouts.cs
+System.Windows.Forms/KeyEventArgs.cs
+System.Windows.Forms/KeyEventHandler.cs
+System.Windows.Forms/KeyPressEventArgs.cs
+System.Windows.Forms/KeyPressEventHandler.cs
+System.Windows.Forms/Keys.cs
+System.Windows.Forms/KeysConverter.cs
+System.Windows.Forms/Label.cs
+System.Windows.Forms/LabelEditEventArgs.cs
+System.Windows.Forms/LabelEditEventHandler.cs
+System.Windows.Forms/LayoutEventArgs.cs
+System.Windows.Forms/LayoutEventHandler.cs
+System.Windows.Forms/LeftRightAlignment.cs
+System.Windows.Forms/LinkArea.cs
+System.Windows.Forms/LinkBehavior.cs
+System.Windows.Forms/LinkClickedEventArgs.cs
+System.Windows.Forms/LinkClickedEventHandler.cs
+System.Windows.Forms/LinkLabel.cs
+System.Windows.Forms/LinkLabelLinkClickedEventArgs.cs
+System.Windows.Forms/LinkLabelLinkClickedEventHandler.cs
+System.Windows.Forms/LinkState.cs
+System.Windows.Forms/ListBindingConverter.cs
+System.Windows.Forms/ListBox.cs
+System.Windows.Forms/ListControl.cs
+System.Windows.Forms/ListView.cs
+System.Windows.Forms/ListViewAlignment.cs
+System.Windows.Forms/ListViewItem.cs
+System.Windows.Forms/ListViewItemConverter.cs
+System.Windows.Forms/MainMenu.cs
+System.Windows.Forms/MdiWindowManager.cs
+System.Windows.Forms/MdiChildContext.cs
+System.Windows.Forms/MdiClient.cs
+System.Windows.Forms/MdiLayout.cs
+System.Windows.Forms/MeasureItemEventHandler.cs
+System.Windows.Forms/MeasureItemEventArgs.cs
+System.Windows.Forms/MenuGlyph.cs
+System.Windows.Forms/Menu.cs
+System.Windows.Forms/MenuAPI.cs
+System.Windows.Forms/MenuItem.cs
+System.Windows.Forms/MenuMerge.cs
+System.Windows.Forms/MessageBoxButtons.cs
+System.Windows.Forms/MessageBox.cs
+System.Windows.Forms/MessageBoxDefaultButton.cs
+System.Windows.Forms/MessageBoxIcon.cs
+System.Windows.Forms/MessageBoxOptions.cs
+System.Windows.Forms/Message.cs
+System.Windows.Forms/MethodInvoker.cs
+System.Windows.Forms/Mime.cs
+System.Windows.Forms/MimeGenerated.cs
+System.Windows.Forms/MimeIcon.cs
+System.Windows.Forms/MonthCalendar.cs
+System.Windows.Forms/MouseButtons.cs
+System.Windows.Forms/MouseEventArgs.cs
+System.Windows.Forms/MouseEventHandler.cs
+System.Windows.Forms/MWFCategoryAttribute.cs
+System.Windows.Forms/MWFDescriptionAttribute.cs
+System.Windows.Forms/NativeWindow.cs
+System.Windows.Forms/NavigateEventArgs.cs
+System.Windows.Forms/NavigateEventHandler.cs
+System.Windows.Forms/NumericUpDown.cs
+System.Windows.Forms/NodeLabelEditEventArgs.cs
+System.Windows.Forms/NodeLabelEditEventHandler.cs
+System.Windows.Forms/NotifyIcon.cs
+System.Windows.Forms/OpacityConverter.cs
+System.Windows.Forms/OpenFileDialog.cs
+System.Windows.Forms/OpenTreeNodeEnumerator.cs
+System.Windows.Forms/Orientation.cs
+System.Windows.Forms/OSFeature.cs
+System.Windows.Forms/OSXStructs.cs
+System.Windows.Forms/OwnerDrawPropertyBag.cs
+System.Windows.Forms/Padding.cs
+System.Windows.Forms/PageSetupDialog.cs
+System.Windows.Forms/PaintEventArgs.cs
+System.Windows.Forms/PaintEventHandler.cs
+System.Windows.Forms/Panel.cs
+System.Windows.Forms/PictureBox.cs
+System.Windows.Forms/PictureBoxSizeMode.cs
+System.Windows.Forms/PrintControllerWithStatusDialog.cs
+System.Windows.Forms/PrintDialog.cs
+System.Windows.Forms/PrintPreviewControl.cs
+System.Windows.Forms/PrintPreviewDialog.cs
+System.Windows.Forms/ProgressBar.cs
+System.Windows.Forms/PropertiesTab.cs
+System.Windows.Forms/PropertyGrid.cs
+System.Windows.Forms/PropertyGridCommands.cs
+System.Windows.Forms/PropertyGridEntry.cs
+System.Windows.Forms/PropertyGridTextBox.cs
+System.Windows.Forms/PropertyGridView.cs
+System.Windows.Forms/PropertyManager.cs
+System.Windows.Forms/PropertySort.cs
+System.Windows.Forms/PropertyTabChangedEventArgs.cs
+System.Windows.Forms/PropertyTabChangedEventHandler.cs
+System.Windows.Forms/PropertyValueChangedEventArgs.cs
+System.Windows.Forms/PropertyValueChangedEventHandler.cs
+System.Windows.Forms/QueryAccessibilityHelpEventArgs.cs
+System.Windows.Forms/QueryAccessibilityHelpEventHandler.cs
+System.Windows.Forms/QueryContinueDragEventArgs.cs
+System.Windows.Forms/QueryContinueDragEventHandler.cs
+System.Windows.Forms/QuestionEventArgs.cs
+System.Windows.Forms/QuestionEventHandler.cs
+System.Windows.Forms/RadioButton.cs
+System.Windows.Forms/RichTextBox.cs
+System.Windows.Forms/RichTextBoxFinds.cs
+System.Windows.Forms/RichTextBoxScrollBars.cs
+System.Windows.Forms/RichTextBoxSelectionAttribute.cs
+System.Windows.Forms/RichTextBoxSelectionTypes.cs
+System.Windows.Forms/RichTextBoxStreamType.cs
+System.Windows.Forms/RichTextBoxWordPunctuations.cs
+System.Windows.Forms/RightToLeft.cs
+System.Windows.Forms/SaveFileDialog.cs
+System.Windows.Forms/Screen.cs
+System.Windows.Forms/ScrollableControl.cs
+System.Windows.Forms/ScrollBar.cs
+System.Windows.Forms/ScrollBars.cs
+System.Windows.Forms/ScrollButton.cs
+System.Windows.Forms/ScrollEventArgs.cs
+System.Windows.Forms/ScrollEventHandler.cs
+System.Windows.Forms/ScrollEventType.cs
+System.Windows.Forms/SecurityIDType.cs
+System.Windows.Forms/SelectedGridItemChangedEventArgs.cs
+System.Windows.Forms/SelectedGridItemChangedEventHandler.cs
+System.Windows.Forms/SelectionRange.cs
+System.Windows.Forms/SelectionRangeConverter.cs
+System.Windows.Forms/SelectionMode.cs
+System.Windows.Forms/SendKeys.cs
+System.Windows.Forms/Shortcut.cs
+System.Windows.Forms/SizeGrip.cs
+System.Windows.Forms/SizeGripStyle.cs
+System.Windows.Forms/SortOrder.cs
+System.Windows.Forms/Splitter.cs
+System.Windows.Forms/SplitterEventArgs.cs
+System.Windows.Forms/SplitterEventHandler.cs
+System.Windows.Forms/StatusBar.cs
+System.Windows.Forms/StatusBarDrawItemEventArgs.cs
+System.Windows.Forms/StatusBarDrawItemEventHandler.cs
+System.Windows.Forms/StatusBarPanelAutoSize.cs
+System.Windows.Forms/StatusBarPanelBorderStyle.cs
+System.Windows.Forms/StatusBarPanelClickEventArgs.cs
+System.Windows.Forms/StatusBarPanelClickEventHandler.cs
+System.Windows.Forms/StatusBarPanel.cs
+System.Windows.Forms/StatusBarPanelStyle.cs
+System.Windows.Forms/StructFormat.cs
+System.Windows.Forms/SystemInformation.cs
+System.Windows.Forms/TabAlignment.cs
+System.Windows.Forms/TabAppearance.cs
+System.Windows.Forms/TabControl.cs
+System.Windows.Forms/TabDrawMode.cs
+System.Windows.Forms/TabPage.cs
+System.Windows.Forms/TabSizeMode.cs
+System.Windows.Forms/TextBox.cs
+System.Windows.Forms/TextBoxBase.cs
+System.Windows.Forms/TextControl.cs
+System.Windows.Forms/TextFormatFlags.cs
+System.Windows.Forms/Theme.cs
+System.Windows.Forms/ThemeClearlooks.cs
+System.Windows.Forms/ThemeEngine.cs
+System.Windows.Forms/ThemeGtk.cs
+System.Windows.Forms/ThemeNice.cs
+System.Windows.Forms/ThemeWin32Classic.cs
+System.Windows.Forms/ThreadExceptionDialog.cs
+System.Windows.Forms/TickStyle.cs
+System.Windows.Forms/Timer.cs
+../../build/common/MonoTODOAttribute.cs
+System.Windows.Forms/ToolBarAppearance.cs
+System.Windows.Forms/ToolBarButtonClickEventArgs.cs
+System.Windows.Forms/ToolBarButtonClickEventHandler.cs
+System.Windows.Forms/ToolBarButton.cs
+System.Windows.Forms/ToolBarButtonStyle.cs
+System.Windows.Forms/ToolBar.cs
+System.Windows.Forms/ToolBarTextAlign.cs
+System.Windows.Forms/ToolTip.cs
+System.Windows.Forms/TrackBar.cs
+System.Windows.Forms/TreeNode.cs
+System.Windows.Forms/TreeNodeCollection.cs
+System.Windows.Forms/TreeNodeConverter.cs
+System.Windows.Forms/TreeView.cs
+System.Windows.Forms/TreeViewAction.cs
+System.Windows.Forms/TreeViewCancelEventArgs.cs
+System.Windows.Forms/TreeViewCancelEventHandler.cs
+System.Windows.Forms/TreeViewEventArgs.cs
+System.Windows.Forms/TreeViewEventHandler.cs
+System.Windows.Forms/TreeViewImageIndexConverter.cs
+System.Windows.Forms/UICues.cs
+System.Windows.Forms/UICuesEventArgs.cs
+System.Windows.Forms/UICuesEventHandler.cs
+System.Windows.Forms/UpDownBase.cs
+System.Windows.Forms/UpDownEventArgs.cs
+System.Windows.Forms/UpDownEventHandler.cs
+System.Windows.Forms/UserControl.cs
+System.Windows.Forms/View.cs
+System.Windows.Forms/VScrollBar.cs
+System.Windows.Forms/Win32DnD.cs
+System.Windows.Forms/X11DesktopColors.cs
+System.Windows.Forms/X11Dnd.cs
+System.Windows.Forms/X11Structs.cs
+System.Windows.Forms/X11Keyboard.cs
+System.Windows.Forms/XEventQueue.cs
+System.Windows.Forms/XplatUI.cs
+System.Windows.Forms/XplatUIDriver.cs
+System.Windows.Forms/XplatUIOSX.cs
+System.Windows.Forms/XplatUIStructs.cs
+System.Windows.Forms/XplatUIWin32.cs
+System.Windows.Forms/XplatUIX11.cs
+System.Windows.Forms.RTF/Charcode.cs
+System.Windows.Forms.RTF/Charset.cs
+System.Windows.Forms.RTF/CharsetFlags.cs
+System.Windows.Forms.RTF/CharsetType.cs
+System.Windows.Forms.RTF/ClassDelegate.cs
+System.Windows.Forms.RTF/Color.cs
+System.Windows.Forms.RTF/DestinationDelegate.cs
+System.Windows.Forms.RTF/Font.cs
+System.Windows.Forms.RTF/KeysInit.cs
+System.Windows.Forms.RTF/KeyStruct.cs
+System.Windows.Forms.RTF/Major.cs
+System.Windows.Forms.RTF/Minor.cs
+System.Windows.Forms.RTF/RTF.cs
+System.Windows.Forms.RTF/RTFException.cs
+System.Windows.Forms.RTF/StandardCharCode.cs
+System.Windows.Forms.RTF/StandardCharName.cs
+System.Windows.Forms.RTF/Style.cs
+System.Windows.Forms.RTF/StyleElement.cs
+System.Windows.Forms.RTF/StyleType.cs
+System.Windows.Forms.RTF/TextMap.cs
+System.Windows.Forms.RTF/TokenClass.cs
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/AccessibleEvents.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/AccessibleEvents.cs
new file mode 100644
index 00000000000..0252cf27473
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/AccessibleEvents.cs
@@ -0,0 +1,74 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public enum AccessibleEvents {
+ SystemSound = 1,
+ SystemAlert = 2,
+ SystemForeground = 3,
+ SystemMenuStart = 4,
+ SystemMenuEnd = 5,
+ SystemMenuPopupStart = 6,
+ SystemMenuPopupEnd = 7,
+ SystemCaptureStart = 8,
+ SystemCaptureEnd = 9,
+ SystemMoveSizeStart = 10,
+ SystemMoveSizeEnd = 11,
+ SystemContextHelpStart = 12,
+ SystemContextHelpEnd = 13,
+ SystemDragDropStart = 14,
+ SystemDragDropEnd = 15,
+ SystemDialogStart = 16,
+ SystemDialogEnd = 17,
+ SystemScrollingStart = 18,
+ SystemScrollingEnd = 19,
+ SystemSwitchStart = 20,
+ SystemSwitchEnd = 21,
+ SystemMinimizeStart = 22,
+ SystemMinimizeEnd = 23,
+ Create = 32768,
+ Destroy = 32769,
+ Show = 32770,
+ Hide = 32771,
+ Reorder = 32772,
+ Focus = 32773,
+ Selection = 32774,
+ SelectionAdd = 32775,
+ SelectionRemove = 32776,
+ SelectionWithin = 32777,
+ StateChange = 32778,
+ LocationChange = 32779,
+ NameChange = 32780,
+ DescriptionChange = 32781,
+ ValueChange = 32782,
+ ParentChange = 32783,
+ HelpChange = 32784,
+ DefaultActionChange = 32785,
+ AcceleratorChange = 32786
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/AccessibleNavigation.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/AccessibleNavigation.cs
new file mode 100644
index 00000000000..f91faadb3a0
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/AccessibleNavigation.cs
@@ -0,0 +1,39 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public enum AccessibleNavigation {
+ Up = 1,
+ Down = 2,
+ Left = 3,
+ Right = 4,
+ Next = 5,
+ Previous = 6,
+ FirstChild = 7,
+ LastChild = 8
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/AccessibleObject.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/AccessibleObject.cs
new file mode 100644
index 00000000000..043e23c5078
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/AccessibleObject.cs
@@ -0,0 +1,570 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// NOT COMPLETE
+
+using Accessibility;
+using System.Drawing;
+using System.Globalization;
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [ComVisible(true)]
+ public class AccessibleObject : MarshalByRefObject, IReflect, IAccessible {
+ #region Private Variables
+ internal string name;
+ internal string value;
+ internal Control owner;
+ internal AccessibleRole role;
+ internal string default_action;
+ internal string description;
+ internal string help;
+ internal string keyboard_shortcut;
+ #endregion // Private Variables
+
+ #region Public Constructors
+ public AccessibleObject() {
+ this.owner=null;
+ this.value=null;
+ this.name=null;
+ this.role=AccessibleRole.Default;
+ this.default_action=null;
+ this.description=null;
+ this.help=null;
+ this.keyboard_shortcut=null;
+ }
+ #endregion // Public Constructors
+
+ #region Private Constructors
+ internal AccessibleObject(Control owner) : this () {
+ this.owner=owner;
+ }
+ #endregion // Private Constructors
+
+ #region Public Instance Properties
+ public virtual Rectangle Bounds {
+ get {
+ return owner.Bounds;
+ }
+ }
+
+ public virtual string DefaultAction {
+ get {
+ return default_action;
+ }
+ }
+
+ public virtual string Description {
+ get {
+ return description;
+ }
+ }
+
+ public virtual string Help {
+ get {
+ return help;
+ }
+ }
+
+ public virtual string KeyboardShortcut {
+ get {
+ return keyboard_shortcut;
+ }
+ }
+
+ public virtual string Name {
+ get {
+ return name;
+ }
+
+ set {
+ name=value;
+ }
+ }
+
+ public virtual AccessibleObject Parent {
+ get {
+ if ((owner!=null) && (owner.Parent!=null)) {
+ return owner.Parent.AccessibilityObject;
+ }
+ return null;
+ }
+ }
+
+ public virtual AccessibleRole Role {
+ get {
+ return role;
+ }
+ }
+
+ public virtual AccessibleStates State {
+ get {
+ AccessibleStates state=AccessibleStates.None;
+
+ if (owner!=null) {
+ if (owner.Focused) {
+ state |= AccessibleStates.Focused;
+ }
+
+ if (!owner.Visible) {
+ state |= AccessibleStates.Invisible;
+ }
+ }
+ return state;
+ }
+ }
+
+ public virtual string Value {
+ get {
+ return this.value;
+ }
+
+ set {
+ this.value=value;
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Instance Methods
+ public virtual void DoDefaultAction() {
+ if (owner!=null) {
+ owner.DoDefaultAction();
+ }
+ }
+
+ public virtual AccessibleObject GetChild(int index) {
+ if (owner!=null) {
+ if (index<owner.child_controls.Count) {
+ return owner.child_controls[index].AccessibilityObject;
+ }
+ }
+ return null;
+ }
+
+ public virtual int GetChildCount() {
+ if (owner!=null) {
+ return owner.child_controls.Count;
+ }
+ return -1;
+ }
+
+ public virtual AccessibleObject GetFocused() {
+ Control result;
+
+ if (owner.has_focus) {
+ return owner.AccessibilityObject;
+ }
+
+ result = FindFocusControl(owner);
+
+ if (result != null) {
+ return result.AccessibilityObject;
+ }
+
+ return null;
+ }
+
+ public virtual int GetHelpTopic(out string FileName) {
+
+ FileName = null;
+
+ return -1;
+ }
+
+ public virtual AccessibleObject GetSelected() {
+ Control result;
+
+ if (owner.is_selected) {
+ return owner.AccessibilityObject;
+ }
+
+ result = FindSelectedControl(owner);
+
+ if (result != null) {
+ return result.AccessibilityObject;
+ }
+
+ return null;
+ }
+
+ public virtual AccessibleObject HitTest(int x, int y) {
+ Control result;
+
+ result = FindHittestControl(owner, x, y);
+
+ if (result != null) {
+ return result.AccessibilityObject;
+ }
+
+ return null;
+ }
+
+ public virtual AccessibleObject Navigate(AccessibleNavigation navdir) {
+ int index;
+
+ // I'm not throwing exceptions if an object doesn't exist in the specified direction
+ // Might not be too helpful to a blind dude trying to navigate. Instead we return
+ // our own object
+
+ if (owner.parent != null) {
+ index = owner.parent.child_controls.IndexOf(owner);
+ } else {
+ index = -1;
+ }
+
+ switch (navdir) {
+ // Spatial navigation; limited to siblings
+ case AccessibleNavigation.Up: {
+ if (owner.parent != null) {
+ for (int i=0; i<owner.parent.child_controls.Count; i++) {
+ if ((owner != owner.parent.child_controls[i]) && (owner.parent.child_controls[i].Top<owner.Top)) {
+ return owner.parent.child_controls[i].AccessibilityObject;
+ }
+ }
+
+ }
+ return owner.AccessibilityObject;
+ }
+
+ case AccessibleNavigation.Down: {
+ if (owner.parent != null) {
+ for (int i=0; i<owner.parent.child_controls.Count; i++) {
+ if ((owner != owner.parent.child_controls[i]) && (owner.parent.child_controls[i].Top>owner.Bottom)) {
+ return owner.parent.child_controls[i].AccessibilityObject;
+ }
+ }
+
+ }
+ return owner.AccessibilityObject;
+ }
+
+ case AccessibleNavigation.Left: {
+ if (owner.parent != null) {
+ for (int i=0; i<owner.parent.child_controls.Count; i++) {
+ if ((owner != owner.parent.child_controls[i]) && (owner.parent.child_controls[i].Left<owner.Left)) {
+ return owner.parent.child_controls[i].AccessibilityObject;
+ }
+ }
+
+ }
+ return owner.AccessibilityObject;
+ }
+
+ case AccessibleNavigation.Right: {
+ if (owner.parent != null) {
+ for (int i=0; i<owner.parent.child_controls.Count; i++) {
+ if ((owner != owner.parent.child_controls[i]) && (owner.parent.child_controls[i].Left>owner.Right)) {
+ return owner.parent.child_controls[i].AccessibilityObject;
+ }
+ }
+
+ }
+ return owner.AccessibilityObject;
+ }
+
+ // Logical navigation
+ case AccessibleNavigation.Next: {
+ if (owner.parent != null) {
+ if ((index+1)<owner.parent.child_controls.Count) {
+ return owner.parent.child_controls[index+1].AccessibilityObject;
+ } else {
+ return owner.parent.child_controls[0].AccessibilityObject;
+ }
+ } else {
+ return owner.AccessibilityObject;
+ }
+ }
+
+ case AccessibleNavigation.Previous: {
+ if (owner.parent != null) {
+ if (index>0) {
+ return owner.parent.child_controls[index-1].AccessibilityObject;
+ } else {
+ return owner.parent.child_controls[owner.parent.child_controls.Count-1].AccessibilityObject;
+ }
+ } else {
+ return owner.AccessibilityObject;
+ }
+ }
+
+ case AccessibleNavigation.FirstChild: {
+ if (owner.child_controls.Count>0) {
+ return owner.child_controls[0].AccessibilityObject;
+ } else {
+ return owner.AccessibilityObject;
+ }
+ }
+
+ case AccessibleNavigation.LastChild: {
+ if (owner.child_controls.Count>0) {
+ return owner.child_controls[owner.child_controls.Count-1].AccessibilityObject;
+ } else {
+ return owner.AccessibilityObject;
+ }
+ }
+ }
+
+ return owner.AccessibilityObject;
+ }
+
+ public virtual void Select(AccessibleSelection flags) {
+ if ((flags & AccessibleSelection.TakeFocus) != 0){
+ owner.Select(owner);
+ }
+ return;
+ }
+ #endregion // Public Instance Methods
+
+ #region Protected Instance Methods
+ protected void UseStdAccessibleObjects(IntPtr handle) {
+ }
+
+ protected void UseStdAccessibleObjects(IntPtr handle, int objid) {
+ UseStdAccessibleObjects(handle, 0);
+ }
+ #endregion // Protected Instance Methods
+
+
+ #region Internal Methods
+ internal static Control FindFocusControl(Control parent) {
+ Control child;
+
+ for (int i=0; i < parent.child_controls.Count; i++) {
+ child=parent.child_controls[i];
+ if (child.has_focus) {
+ return child;
+ }
+ if (child.child_controls.Count>0) {
+ Control result;
+
+ result = FindFocusControl(child);
+ if (result != null) {
+ return result;
+ }
+ }
+ }
+ return null;
+ }
+
+ internal static Control FindSelectedControl(Control parent) {
+ Control child;
+
+ for (int i=0; i < parent.child_controls.Count; i++) {
+ child=parent.child_controls[i];
+ if (child.has_focus) {
+ return child;
+ }
+ if (child.child_controls.Count>0) {
+ Control result;
+
+ result = FindSelectedControl(child);
+ if (result != null) {
+ return result;
+ }
+ }
+ }
+ return null;
+ }
+
+ internal static Control FindHittestControl(Control parent, int x, int y) {
+ Control child;
+ Point child_point;
+ Point hittest_point;
+
+ hittest_point = new Point(x, y);
+
+ child_point = parent.PointToClient(hittest_point);
+ if (parent.ClientRectangle.Contains(child_point)) {
+ return parent;
+ }
+
+ for (int i=0; i < parent.child_controls.Count; i++) {
+ child=parent.child_controls[i];
+ child_point = child.PointToClient(hittest_point);
+ if (child.ClientRectangle.Contains(child_point)) {
+ return child;
+ }
+ if (child.child_controls.Count>0) {
+ Control result;
+
+ result = FindHittestControl(child, x, y);
+ if (result != null) {
+ return result;
+ }
+ }
+ }
+ return null;
+ }
+ #endregion // Internal Methods
+
+ #region IReflection Methods and Properties
+ FieldInfo IReflect.GetField(String name, BindingFlags bindingAttr) {
+ throw new NotImplementedException();
+ }
+
+ FieldInfo[] IReflect.GetFields(BindingFlags bindingAttr) {
+ throw new NotImplementedException();
+ }
+
+ MemberInfo[] IReflect.GetMember(String name, BindingFlags bindingAttr) {
+ throw new NotImplementedException();
+ }
+
+ MemberInfo[] IReflect.GetMembers(BindingFlags bindingAttr) {
+ throw new NotImplementedException();
+ }
+
+ MethodInfo IReflect.GetMethod(String name, BindingFlags bindingAttr) {
+ throw new NotImplementedException();
+ }
+
+ MethodInfo IReflect.GetMethod(String name, BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers) {
+ throw new NotImplementedException();
+ }
+
+ MethodInfo[] IReflect.GetMethods(BindingFlags bindingAttr) {
+ throw new NotImplementedException();
+ }
+
+ PropertyInfo IReflect.GetProperty(String name, BindingFlags bindingAttr) {
+ throw new NotImplementedException();
+ }
+
+ PropertyInfo IReflect.GetProperty(String name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers) {
+ throw new NotImplementedException();
+ }
+
+ PropertyInfo[] IReflect.GetProperties(BindingFlags bindingAttr) {
+ throw new NotImplementedException();
+ }
+
+ Object IReflect.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters) {
+ throw new NotImplementedException();
+ }
+
+ Type IReflect.UnderlyingSystemType {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+ #endregion // IReflection Methods and Properties
+
+ #region IAccessible Methods and Properties
+ void IAccessible.accDoDefaultAction(object childID) {
+ throw new NotImplementedException();
+ }
+
+ int IAccessible.accChildCount {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ object IAccessible.accFocus {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ object IAccessible.accHitTest(int xLeft, int yTop) {
+ throw new NotImplementedException();
+ }
+
+ void IAccessible.accLocation(out int pxLeft, out int pyTop, out int pcxWidth, out int pcyHeight, object childID) {
+ throw new NotImplementedException();
+ }
+
+ object IAccessible.accNavigate(int navDir, object childID) {
+ throw new NotImplementedException();
+ }
+
+ object IAccessible.accParent {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ void IAccessible.accSelect(int flagsSelect, object childID) {
+ throw new NotImplementedException();
+ }
+
+ object IAccessible.accSelection {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ object IAccessible.get_accChild(object childID) {
+ throw new NotImplementedException();
+ }
+
+ string IAccessible.get_accDefaultAction(object childID) {
+ throw new NotImplementedException();
+ }
+
+ string IAccessible.get_accDescription(object childID) {
+ throw new NotImplementedException();
+ }
+
+ string IAccessible.get_accHelp(object childID) {
+ throw new NotImplementedException();
+ }
+
+ int IAccessible.get_accHelpTopic(out string pszHelpFile,object childID) {
+ throw new NotImplementedException();
+ }
+
+ string IAccessible.get_accKeyboardShortcut(object childID) {
+ throw new NotImplementedException();
+ }
+
+ string IAccessible.get_accName(object childID) {
+ throw new NotImplementedException();
+ }
+
+ object IAccessible.get_accRole(object childID) {
+ throw new NotImplementedException();
+ }
+
+ object IAccessible.get_accState(object childID) {
+ throw new NotImplementedException();
+ }
+
+ string IAccessible.get_accValue(object childID) {
+ throw new NotImplementedException();
+ }
+
+ void IAccessible.set_accName(object childID, string newName) {
+ throw new NotImplementedException();
+ }
+
+ void IAccessible.set_accValue(object childID, string newValue) {
+ throw new NotImplementedException();
+ }
+ #endregion // IAccessible Methods and Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/AccessibleRole.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/AccessibleRole.cs
new file mode 100644
index 00000000000..1e512e29f7e
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/AccessibleRole.cs
@@ -0,0 +1,95 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public enum AccessibleRole {
+ None = 0,
+ TitleBar = 1,
+ MenuBar = 2,
+ ScrollBar = 3,
+ Grip = 4,
+ Sound = 5,
+ Cursor = 6,
+ Caret = 7,
+ Alert = 8,
+ Window = 9,
+ Client = 10,
+ MenuPopup = 11,
+ MenuItem = 12,
+ ToolTip = 13,
+ Application = 14,
+ Document = 15,
+ Pane = 16,
+ Chart = 17,
+ Dialog = 18,
+ Border = 19,
+ Grouping = 20,
+ Separator = 21,
+ ToolBar = 22,
+ StatusBar = 23,
+ Table = 24,
+ ColumnHeader = 25,
+ RowHeader = 26,
+ Column = 27,
+ Row = 28,
+ Cell = 29,
+ Link = 30,
+ HelpBalloon = 31,
+ Character = 32,
+ List = 33,
+ ListItem = 34,
+ Outline = 35,
+ OutlineItem = 36,
+ PageTab = 37,
+ PropertyPage = 38,
+ Indicator = 39,
+ Graphic = 40,
+ StaticText = 41,
+ Text = 42,
+ PushButton = 43,
+ CheckButton = 44,
+ RadioButton = 45,
+ ComboBox = 46,
+ DropList = 47,
+ ProgressBar = 48,
+ Dial = 49,
+ HotkeyField = 50,
+ Slider = 51,
+ SpinButton = 52,
+ Diagram = 53,
+ Animation = 54,
+ Equation = 55,
+ ButtonDropDown = 56,
+ ButtonMenu = 57,
+ ButtonDropDownGrid= 58,
+ WhiteSpace = 59,
+ PageTabList = 60,
+ Clock = 61,
+ Default = -1
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/AccessibleSelection.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/AccessibleSelection.cs
new file mode 100644
index 00000000000..fd7ea3be8e2
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/AccessibleSelection.cs
@@ -0,0 +1,39 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ [Flags]
+ public enum AccessibleSelection {
+ None = 0x00000000,
+ TakeFocus = 0x00000001,
+ TakeSelection = 0x00000002,
+ ExtendSelection = 0x00000004,
+ AddSelection = 0x00000008,
+ RemoveSelection = 0x00000010
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/AccessibleStates.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/AccessibleStates.cs
new file mode 100644
index 00000000000..3daaa48333c
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/AccessibleStates.cs
@@ -0,0 +1,67 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+
+ [Flags]
+ public enum AccessibleStates {
+ None = 0x00000000,
+ Unavailable = 0x00000001,
+ Selected = 0x00000002,
+ Focused = 0x00000004,
+ Pressed = 0x00000008,
+ Checked = 0x00000010,
+ Mixed = 0x00000020,
+ Indeterminate = 0x00000020,
+ ReadOnly = 0x00000040,
+ HotTracked = 0x00000080,
+ Default = 0x00000100,
+ Expanded = 0x00000200,
+ Collapsed = 0x00000400,
+ Busy = 0x00000800,
+ Floating = 0x00001000,
+ Marqueed = 0x00002000,
+ Animated = 0x00004000,
+ Invisible = 0x00008000,
+ Offscreen = 0x00010000,
+ Sizeable = 0x00020000,
+ Moveable = 0x00040000,
+ SelfVoicing = 0x00080000,
+ Focusable = 0x00100000,
+ Selectable = 0x00200000,
+ Linked = 0x00400000,
+ Traversed = 0x00800000,
+ MultiSelectable = 0x01000000,
+ ExtSelectable = 0x02000000,
+ AlertLow = 0x04000000,
+ AlertMedium = 0x08000000,
+ AlertHigh = 0x10000000,
+ Protected = 0x20000000,
+ Valid = 0x3FFFFFFF
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/AmbientProperties.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/AmbientProperties.cs
new file mode 100644
index 00000000000..e9004f19627
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/AmbientProperties.cs
@@ -0,0 +1,87 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+using System.Drawing;
+
+namespace System.Windows.Forms {
+ public sealed class AmbientProperties {
+ #region Local Variables
+ private Color fore_color;
+ private Color back_color;
+ private Font font;
+ private Cursor cursor;
+ #endregion // Local Variables
+
+ #region Public Constructors
+ public AmbientProperties() {
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public Color BackColor {
+ get {
+ return back_color;
+ }
+
+ set {
+ back_color = value;
+ }
+ }
+
+ public Cursor Cursor {
+ get {
+ return cursor;
+ }
+
+ set {
+ cursor = value;
+ }
+ }
+
+ public Font Font {
+ get {
+ return font;
+ }
+
+ set {
+ font = value;
+ }
+ }
+
+ public Color ForeColor {
+ get {
+ return fore_color;
+ }
+
+ set {
+ fore_color = value;
+ }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/AnchorStyles.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/AnchorStyles.cs
new file mode 100644
index 00000000000..23355ab3786
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/AnchorStyles.cs
@@ -0,0 +1,42 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+ [Flags]
+ [Serializable]
+ [Editor("System.Windows.Forms.Design.AnchorEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
+ public enum AnchorStyles {
+ None = 0x00000000,
+ Top = 0x00000001,
+ Bottom = 0x00000002,
+ Left = 0x00000004,
+ Right = 0x00000008
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Appearance.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Appearance.cs
new file mode 100644
index 00000000000..02becb9b297
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Appearance.cs
@@ -0,0 +1,37 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [ComVisible(true)]
+ public enum Appearance {
+ Normal = 0,
+ Button = 1
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs
new file mode 100644
index 00000000000..e8e65f01649
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs
@@ -0,0 +1,475 @@
+// 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.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+// COMPLETE
+
+#undef DebugRunLoop
+
+using Microsoft.Win32;
+using System;
+using System.Drawing;
+using System.ComponentModel;
+using System.Collections;
+using System.Diagnostics;
+using System.Globalization;
+using System.IO;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Threading;
+
+namespace System.Windows.Forms {
+ public sealed class Application {
+ private static bool browser_embedded = false;
+ private static InputLanguage input_language = InputLanguage.CurrentInputLanguage;
+ private static bool messageloop_started = false;
+ private static string safe_caption_format = "{1} - {0} - {2}";
+ private static ArrayList message_filters = new ArrayList();
+
+ private Application () {
+ }
+
+ #region Private Methods
+ private static void CloseForms(Thread thread) {
+ Control c;
+ IEnumerator control;
+ bool all;
+
+ #if DebugRunLoop
+ Console.WriteLine(" CloseForms({0}) called", thread);
+ #endif
+ if (thread == null) {
+ all = true;
+ } else {
+ all = false;
+ }
+
+ control = Control.controls.GetEnumerator();
+
+ while (control.MoveNext()) {
+ c = (Control)control.Current;
+ if (c is Form) {
+ if (all || (thread == c.creator_thread)) {
+ if (c.IsHandleCreated) {
+ XplatUI.PostMessage(c.Handle, Msg.WM_CLOSE_INTERNAL, IntPtr.Zero, IntPtr.Zero);
+ }
+ #if DebugRunLoop
+ Console.WriteLine(" Closing form {0}", c);
+ #endif
+ }
+ }
+ }
+
+ }
+ #endregion // Private methods
+
+ #region Public Static Properties
+ public static bool AllowQuit {
+ get {
+ return browser_embedded;
+ }
+ }
+
+ public static string CommonAppDataPath {
+ get {
+ return Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
+ }
+ }
+
+ public static RegistryKey CommonAppDataRegistry {
+ get {
+ RegistryKey key;
+
+ key = Registry.LocalMachine.OpenSubKey("Software\\" + Application.CompanyName + "\\" + Application.ProductName + "\\" + Application.ProductVersion, true);
+
+ return key;
+ }
+ }
+
+ public static string CompanyName {
+ get {
+ AssemblyCompanyAttribute[] attrs = (AssemblyCompanyAttribute[]) Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), true);
+
+ if ((attrs != null) && attrs.Length>0) {
+ return attrs[0].Company;
+ }
+
+ return Assembly.GetEntryAssembly().GetName().Name;
+ }
+ }
+
+ public static CultureInfo CurrentCulture {
+ get {
+ return Thread.CurrentThread.CurrentUICulture;
+ }
+
+ set {
+
+ Thread.CurrentThread.CurrentUICulture=value;
+ }
+ }
+
+ public static InputLanguage CurrentInputLanguage {
+ get {
+ return input_language;
+ }
+
+ set {
+ input_language=value;
+ }
+ }
+
+ public static string ExecutablePath {
+ get {
+ return Assembly.GetEntryAssembly().Location;
+ }
+ }
+
+ public static string LocalUserAppDataPath {
+ get {
+ return Path.Combine(Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), CompanyName), ProductName), ProductVersion);
+ }
+ }
+
+ public static bool MessageLoop {
+ get {
+ return messageloop_started;
+ }
+ }
+
+ public static string ProductName {
+ get {
+ AssemblyProductAttribute[] attrs = (AssemblyProductAttribute[]) Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), true);
+
+ if ((attrs != null) && attrs.Length>0) {
+ return attrs[0].Product;
+ }
+
+ return Assembly.GetEntryAssembly().GetName().Name;
+ }
+ }
+
+ public static string ProductVersion {
+ get {
+ String version;
+
+ version = Assembly.GetEntryAssembly().GetName().Version.ToString();
+
+ if (version.StartsWith("0.")) {
+ version="1." + version.Substring(2);
+ }
+ return version;
+ }
+ }
+
+ public static string SafeTopLevelCaptionFormat {
+ get {
+ return safe_caption_format;
+ }
+
+ set {
+ safe_caption_format=value;
+ }
+ }
+
+ public static string StartupPath {
+ get {
+ return Path.GetDirectoryName(Application.ExecutablePath);
+ }
+ }
+
+ public static string UserAppDataPath {
+ get {
+ return Path.Combine(Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), CompanyName), ProductName), ProductVersion);
+ }
+ }
+
+ public static RegistryKey UserAppDataRegistry {
+ get {
+ RegistryKey key;
+
+ key = Registry.CurrentUser.OpenSubKey("Software\\" + Application.CompanyName + "\\" + Application.ProductName + "\\" + Application.ProductVersion, true);
+
+ return key;
+ }
+ }
+ #endregion
+
+ #region Public Static Methods
+ public static void AddMessageFilter(IMessageFilter value) {
+ message_filters.Add(value);
+ }
+
+ public static void DoEvents() {
+ XplatUI.DoEvents();
+ }
+
+ public static void EnableVisualStyles() {
+ XplatUI.EnableThemes();
+ }
+
+#if NET_2_0
+ public static void EnableRTLMirroring ()
+ {
+ }
+
+ //
+ // If true, it uses GDI+, performance reasons were quoted
+ //
+ static internal bool use_compatible_text_rendering = true;
+
+ public static void SetCompatibleTextRenderingDefault (bool defaultValue)
+ {
+ use_compatible_text_rendering = defaultValue;
+ }
+#endif
+
+ public static void Exit() {
+ CloseForms(null);
+
+ // FIXME - this needs to be fired when they're all closed
+ // But CloseForms uses PostMessage, so it gets fired before
+ // We need to wait on something...
+ if (ApplicationExit != null) {
+ ApplicationExit(null, EventArgs.Empty);
+ }
+ }
+
+ public static void ExitThread() {
+ CloseForms(Thread.CurrentThread);
+ }
+
+ public static ApartmentState OleRequired() {
+ //throw new NotImplementedException("OLE Not supported by this System.Windows.Forms implementation");
+ return ApartmentState.Unknown;
+ }
+
+ public static void OnThreadException(Exception t) {
+ if (Application.ThreadException != null) {
+ Application.ThreadException(null, new ThreadExceptionEventArgs(t));
+ return;
+ }
+
+ if (SystemInformation.UserInteractive) {
+ Form form = new ThreadExceptionDialog (t);
+ form.ShowDialog ();
+ } else {
+ Console.WriteLine (t.ToString ());
+ }
+ }
+
+ public static void RemoveMessageFilter(IMessageFilter filter) {
+ message_filters.Remove(filter);
+ }
+
+ public static void Run() {
+ RunLoop(false, new ApplicationContext());
+ }
+
+ public static void Run(Form mainForm) {
+ RunLoop(false, new ApplicationContext(mainForm));
+ }
+
+ public static void Run(ApplicationContext context) {
+ RunLoop(false, context);
+ }
+
+ internal static void RunLoop(bool Modal, ApplicationContext context) {
+ Queue toplevels;
+ IEnumerator control;
+ MSG msg;
+
+ msg = new MSG();
+
+ if (context == null) {
+ context = new ApplicationContext();
+ }
+
+ if (context.MainForm != null) {
+ context.MainForm.Show();
+ // FIXME - do we need this?
+ //context.MainForm.PerformLayout();
+ context.MainForm.context = context;
+ context.MainForm.Activate();
+ context.MainForm.closing = false;
+ }
+
+ #if DebugRunLoop
+ Console.WriteLine("Entering RunLoop(Modal={0}, Form={1})", Modal, context.MainForm != null ? context.MainForm.ToString() : "NULL");
+ #endif
+
+ if (Modal) {
+ Control c;
+
+ if (context.MainForm.Modal) {
+ throw new Exception("fixme");
+ }
+ context.MainForm.is_modal = true;
+
+ toplevels = new Queue();
+ control = Control.controls.GetEnumerator();
+
+ while (control.MoveNext()) {
+
+ c = (Control)control.Current;
+ if (c is Form && (c != context.MainForm)) {
+ if (c.IsHandleCreated && XplatUI.IsEnabled(c.Handle)) {
+ #if DebugRunLoop
+ Console.WriteLine(" Disabling form {0}", c);
+ #endif
+ XplatUI.EnableWindow(c.Handle, false);
+ toplevels.Enqueue(c);
+ }
+ }
+ }
+ // FIXME - need activate?
+
+ XplatUI.SetModal(context.MainForm.Handle, true);
+ } else {
+ toplevels = null;
+ }
+
+ XplatUI.StartLoop(Thread.CurrentThread);
+ messageloop_started = true;
+
+ while (XplatUI.GetMessage(ref msg, IntPtr.Zero, 0, 0)) {
+ if ((message_filters != null) && (message_filters.Count > 0)) {
+ Message m;
+ bool drop;
+
+ drop = false;
+ m = Message.Create(msg.hwnd, (int)msg.message, msg.wParam, msg.lParam);
+ for (int i = 0; i < message_filters.Count; i++) {
+ if (((IMessageFilter)message_filters[i]).PreFilterMessage(ref m)) {
+ // we're dropping the message
+ drop = true;
+ break;
+ }
+ }
+ if (drop) {
+ continue;
+ }
+ }
+
+ switch((Msg)msg.message) {
+ case Msg.WM_KEYDOWN:
+ case Msg.WM_SYSKEYDOWN:
+ case Msg.WM_CHAR:
+ case Msg.WM_SYSCHAR:
+ case Msg.WM_KEYUP:
+ case Msg.WM_SYSKEYUP: {
+ Message m;
+ Control c;
+
+ m = Message.Create(msg.hwnd, (int)msg.message, msg.wParam, msg.lParam);
+ c = Control.FromHandle(msg.hwnd);
+ if ((c != null) && !c.PreProcessMessage(ref m)) {
+ goto default;
+ }
+ break;
+ }
+ default: {
+ XplatUI.TranslateMessage(ref msg);
+ XplatUI.DispatchMessage(ref msg);
+ break;
+ }
+ }
+
+ // Handle exit, Form might have received WM_CLOSE and set 'closing' in response
+ if ((context.MainForm != null) && context.MainForm.closing) {
+ if (!Modal) {
+ XplatUI.PostQuitMessage(0);
+ } else {
+ break;
+ }
+ }
+ }
+ #if DebugRunLoop
+ Console.WriteLine(" RunLoop loop left");
+ #endif
+
+ messageloop_started = false;
+ XplatUI.EndLoop(Thread.CurrentThread);
+
+ if (Modal) {
+ Control c;
+
+ context.MainForm.Hide();
+ context.MainForm.is_modal = false;
+
+ while (toplevels.Count>0) {
+ #if DebugRunLoop
+ Console.WriteLine(" Re-Enabling form form {0}", toplevels.Peek());
+ #endif
+ c = (Control)toplevels.Dequeue();
+ if (c.IsHandleCreated) {
+ XplatUI.EnableWindow(c.window.Handle, true);
+ }
+ }
+ #if DebugRunLoop
+ Console.WriteLine(" Done with the re-enable");
+ #endif
+ if (context.MainForm.IsHandleCreated) {
+ XplatUI.SetModal(context.MainForm.Handle, false);
+ }
+ #if DebugRunLoop
+ Console.WriteLine(" Done with the SetModal");
+ #endif
+ }
+
+ #if DebugRunLoop
+ Console.WriteLine("Leaving RunLoop(Modal={0}, Form={1})", Modal, context.MainForm != null ? context.MainForm.ToString() : "NULL");
+ #endif
+ if (context.MainForm != null) {
+ context.MainForm.context = null;
+ }
+
+ if (!Modal) {
+ if (ThreadExit != null) {
+ ThreadExit(null, EventArgs.Empty);
+ }
+
+ context.ExitThread();
+ }
+ }
+
+ #endregion // Public Static Methods
+
+ #region Events
+ public static event EventHandler ApplicationExit;
+
+ public static event EventHandler Idle {
+ add {
+ XplatUI.Idle += value;
+ }
+ remove {
+ XplatUI.Idle -= value;
+ }
+ }
+
+ public static event EventHandler ThreadExit;
+ public static event ThreadExceptionEventHandler ThreadException;
+ #endregion // Events
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ApplicationContext.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ApplicationContext.cs
new file mode 100644
index 00000000000..8e14ce3d0f0
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ApplicationContext.cs
@@ -0,0 +1,92 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public class ApplicationContext {
+ #region Local Variables
+ Form main_form;
+ #endregion // Local Variables
+
+ #region Public Constructors & Destructors
+ public ApplicationContext() : this(null) {
+ }
+
+ public ApplicationContext(Form mainForm) {
+ main_form=mainForm;
+ }
+
+ ~ApplicationContext() {
+ this.Dispose(false);
+ }
+ #endregion // Public Constructors & Destructors
+
+ #region Public Instance Properties
+ public Form MainForm {
+ get {
+ return main_form;
+ }
+
+ set {
+ if (main_form!=value) {
+ main_form=value;
+ }
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Instance Methods
+ public void Dispose() {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ public void ExitThread() {
+ ExitThreadCore();
+ }
+ #endregion // Public Instance Methods
+
+ #region Protected Instance Methods
+ protected virtual void Dispose(bool disposing) {
+ main_form=null;
+ }
+
+ protected virtual void ExitThreadCore() {
+ if (ThreadExit!=null) {
+ ThreadExit(this, EventArgs.Empty);
+ }
+ }
+
+ protected virtual void OnMainFormClosed(object sender, EventArgs e) {
+ ExitThreadCore();
+ }
+ #endregion // Public Instance Methods
+
+ #region Events
+ public event EventHandler ThreadExit;
+ #endregion // Events
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ArrangeDirection.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ArrangeDirection.cs
new file mode 100644
index 00000000000..bc6e8190e02
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ArrangeDirection.cs
@@ -0,0 +1,39 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+// COMPLETE
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [ComVisible(true)]
+ public enum ArrangeDirection {
+ Left = 0,
+ Right = 0,
+ Down = 4,
+ Up = 4
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ArrangeStartingPosition.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ArrangeStartingPosition.cs
new file mode 100644
index 00000000000..59584b8f016
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ArrangeStartingPosition.cs
@@ -0,0 +1,37 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public enum ArrangeStartingPosition {
+ BottomLeft = 0,
+ BottomRight = 1,
+ TopLeft = 2,
+ TopRight = 3,
+ Hide = 8
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/AsyncMethodData.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/AsyncMethodData.cs
new file mode 100644
index 00000000000..7a001cbc731
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/AsyncMethodData.cs
@@ -0,0 +1,43 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+
+using System;
+using System.Threading;
+
+
+namespace System.Windows.Forms {
+
+ internal class AsyncMethodData {
+ public Delegate Method;
+ public object [] Args;
+ public AsyncMethodResult Result;
+#if NET_2_0
+ public ExecutionContext Context;
+#else
+ public CompressedStack Stack;
+#endif
+ }
+
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/AsyncMethodResult.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/AsyncMethodResult.cs
new file mode 100644
index 00000000000..8c52ca71dcc
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/AsyncMethodResult.cs
@@ -0,0 +1,90 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+
+using System;
+using System.Threading;
+
+namespace System.Windows.Forms {
+
+ internal class AsyncMethodResult : IAsyncResult {
+
+ private ManualResetEvent handle;
+ private object state;
+ private bool completed;
+ private object return_value;
+
+ public AsyncMethodResult ()
+ {
+ handle = new ManualResetEvent (false);
+ }
+
+ public virtual WaitHandle AsyncWaitHandle {
+ get {
+ lock (this) {
+ return handle;
+ }
+ }
+ }
+
+ public object AsyncState {
+ get { return state; }
+ set { state = value; }
+ }
+
+ public bool CompletedSynchronously {
+ get { return false; }
+ }
+
+ public bool IsCompleted {
+ get {
+ lock (this) {
+ return completed;
+ }
+ }
+ }
+
+ public object EndInvoke ()
+ {
+ lock (this) {
+ if (completed)
+ return return_value;
+ }
+ handle.WaitOne ();
+ return return_value;
+ }
+
+ public void Complete (object result)
+ {
+ lock (this) {
+ completed = true;
+ return_value = result;
+ handle.Set ();
+ }
+ }
+ }
+
+}
+
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/AxHost.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/AxHost.cs
new file mode 100644
index 00000000000..98fe10b90ae
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/AxHost.cs
@@ -0,0 +1,827 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok <pbartok@novell.com>
+//
+//
+
+// NOT COMPLETE
+
+using System;
+using System.ComponentModel;
+using System.Drawing;
+using System.IO;
+using System.Runtime.InteropServices;
+using System.Runtime.Serialization;
+
+namespace System.Windows.Forms {
+ [MonoTODO("Possibly implement this for Win32; find a way for Linux and Mac")]
+ [DefaultEvent("Enter")]
+ [Designer("System.Windows.Forms.Design.AxHostDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+ [DesignTimeVisible(false)]
+ [ToolboxItem(false)]
+ public abstract class AxHost : Control, ISupportInitialize, ICustomTypeDescriptor {
+ #region AxHost Subclasses
+ #region AxHost.ActiveXInvokeKind Enum
+ public enum ActiveXInvokeKind {
+ MethodInvoke = 0,
+ PropertyGet = 1,
+ PropertySet = 2
+ }
+ #endregion // AxHost.ActiveXInvokeKind Enum
+
+ #region AxHost.AxComponentEditor Class
+ public class AxComponentEditor : System.Windows.Forms.Design.WindowsFormsComponentEditor {
+ public AxComponentEditor() {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ public override bool EditComponent(ITypeDescriptorContext context, object obj, IWin32Window parent) {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+ }
+ #endregion // AxHost.AxComponentEditor Class
+
+ #region AxHost.ClsidAttribute
+ [AttributeUsage(AttributeTargets.Class,Inherited=false)]
+ public sealed class ClsidAttribute : Attribute {
+ string clsid;
+
+ public ClsidAttribute (string clsid) {
+ this.clsid = clsid;
+ }
+
+ public string Value {
+ get {
+ return clsid;
+ }
+ }
+ }
+ #endregion AxHost.ClsidAttribute
+
+ #region AxHost.ConnectionPointCookie
+ [ComVisible(false)]
+ public class ConnectionPointCookie {
+ public ConnectionPointCookie(object source, object sink, Type eventInterface) {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ public void Disconnect() {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ ~ConnectionPointCookie() {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+ }
+ #endregion // AxHost.ConnectionPointCookie
+
+ #region AxHost.InvalidActiveXStateException Class
+ public class InvalidActiveXStateException : Exception {
+ public InvalidActiveXStateException(string name, ActiveXInvokeKind kind) {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ public override string ToString() {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+ }
+ #endregion // AxHost.InvalidActiveXStateException Class
+
+ #region AxHost.State Class
+ [Serializable]
+ [TypeConverter("System.ComponentModel.TypeConverter, " + Consts.AssemblySystem)]
+ public class State : ISerializable {
+ public State(Stream ms, int storageType, bool manualUpdate, string licKey) {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ void ISerializable.GetObjectData(SerializationInfo si,StreamingContext context) {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+ }
+ #endregion // AxHost.State Class
+
+ #region AxHost.TypeLibraryTimeStampAttribute Class
+ [AttributeUsage(AttributeTargets.Assembly, Inherited=false)]
+ public sealed class TypeLibraryTimeStampAttribute : Attribute {
+ public TypeLibraryTimeStampAttribute(string timestamp) {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ public DateTime Value {
+ get {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+ }
+ }
+ #endregion // AxHost.TypeLibraryTimeStampAttribute Class
+
+ #region AxHost.StateConverter Class
+ public class StateConverter : System.ComponentModel.TypeConverter {
+ public StateConverter() {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+ }
+ #endregion // AxHost.StateConverter Class
+ #endregion // AxHost Subclasses
+
+ string text;
+
+ #region Protected Constructors
+ protected AxHost(string clsid) {
+ text = "";
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ protected AxHost(string clsid, int flags) {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Instance Properties
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override Color BackColor {
+ get {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ set {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override Image BackgroundImage {
+ get {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ set {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public ContainerControl ContainingControl {
+ get {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ set {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override ContextMenu ContextMenu {
+ get {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ set {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override Cursor Cursor {
+ get {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ set {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public bool EditMode {
+ get {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new virtual bool Enabled {
+ get {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ set {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override Font Font {
+ get {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ set {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override Color ForeColor {
+ get {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ set {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public bool HasAboutBox {
+ get {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+ }
+
+ [Browsable(false)]
+ [DefaultValue(null)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [RefreshProperties(RefreshProperties.All)]
+ public AxHost.State OcxState {
+ get {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ set {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [Localizable(true)]
+ public new virtual bool RightToLeft {
+ get {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ set {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+ }
+
+ public override ISite Site {
+ set {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override string Text {
+ get {
+ return text;
+ }
+
+ set {
+ text = value;
+ }
+ }
+ #endregion // Protected Constructors
+
+ #region Protected Instance Properties
+ protected override CreateParams CreateParams {
+ get {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+ }
+
+ protected override Size DefaultSize {
+ get {
+ return new Size (75, 23);
+ }
+ }
+ #endregion // Protected Instance Properties
+
+ #region Protected Static Methods
+ [CLSCompliant(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected static Color GetColorFromOleColor(uint color){
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected static Font GetFontFromIFont(object font){
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected static Font GetFontFromIFontDisp(object font){
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected static object GetIFontDispFromFont(Font font){
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected static object GetIFontFromFont(Font font){
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected static object GetIPictureDispFromPicture(Image image){
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected static object GetIPictureFromCursor(Cursor cursor){
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected static object GetIPictureFromPicture(Image image){
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected static double GetOADateFromTime(DateTime time){
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [CLSCompliant(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected static uint GetOleColorFromColor(Color color){
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected static Image GetPictureFromIPicture(object picture){
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected static Image GetPictureFromIPictureDisp(object picture){
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected static DateTime GetTimeFromOADate(double date){
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+ #endregion // Protected Static Methods
+
+ #region Public Instance Methods
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public void BeginInit() {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ public void DoVerb(int verb){
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public virtual void EndInit() {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public object GetOcx() {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ public bool HasPropertyPages() {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public void InvokeEditMode(){
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public void MakeDirty(){
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ public override bool PreProcessMessage(ref Message msg) {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ public void ShowAboutBox() {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ public void ShowPropertyPages() {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ public void ShowPropertyPages(Control control) {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+ #endregion // Public Instance Methods
+
+ #region Protected Instance Methods
+ protected virtual void AttachInterfaces() {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ protected override void CreateHandle() {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void CreateSink(){
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ protected override void DestroyHandle() {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void DetachSink(){
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ protected override void Dispose(bool disposing) {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ protected override bool IsInputChar(char charCode) {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ protected override void OnBackColorChanged(EventArgs e) {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ protected override void OnFontChanged(EventArgs e) {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ protected override void OnForeColorChanged(EventArgs e) {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ protected override void OnHandleCreated(EventArgs e) {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ protected virtual void OnInPlaceActive() {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected override void OnLostFocus(EventArgs e) {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ protected override bool ProcessDialogKey(Keys keyData) {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ protected override bool ProcessMnemonic(char charCode) {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected bool PropsValid(){
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected void RaiseOnMouseDown(short button, short shift, int x, int y){
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected void RaiseOnMouseDown(short button, short shift, float x, float y){
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected void RaiseOnMouseDown(object o1, object o2, object o3, object o4){
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected void RaiseOnMouseMove(short button, short shift, int x, int y){
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected void RaiseOnMouseMove(short button, short shift, float x, float y){
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected void RaiseOnMouseMove(object o1, object o2, object o3, object o4){
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected void RaiseOnMouseUp(short button, short shift, int x, int y){
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected void RaiseOnMouseUp(short button, short shift, float x, float y){
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected void RaiseOnMouseUp(object o1, object o2, object o3, object o4){
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ protected void SetAboutBoxDelegate(AxHost.AboutBoxDelegate d) {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified) {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ protected override void SetVisibleCore(bool value) {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ protected override void WndProc(ref Message m) {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+ #endregion // Protected Instance Methods
+
+ #region Private Instance Methods
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ private bool ShouldSerializeContainingControl() {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+ #endregion // Protected Instance Methods
+
+ #region Events
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler BackColorChanged;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler BackgroundImageChanged;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler BindingContextChanged;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event UICuesEventHandler ChangeUICues;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler Click;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler ContextMenuChanged;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler CursorChanged;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler DoubleClick;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event DragEventHandler DragDrop;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event DragEventHandler DragEnter;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler DragLeave;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event DragEventHandler DragOver;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler EnabledChanged;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler FontChanged;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler ForeColorChanged;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event GiveFeedbackEventHandler GiveFeedback;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event HelpEventHandler HelpRequested;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler ImeModeChanged;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event KeyEventHandler KeyDown;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event KeyPressEventHandler KeyPress;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event KeyEventHandler KeyUp;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event LayoutEventHandler Layout;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event MouseEventHandler MouseDown;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler MouseEnter;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler MouseHover;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler MouseLeave;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event MouseEventHandler MouseMove;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event MouseEventHandler MouseUp;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event MouseEventHandler MouseWheel;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event PaintEventHandler Paint;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event QueryAccessibilityHelpEventHandler QueryAccessibilityHelp;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event QueryContinueDragEventHandler QueryContinueDrag;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler RightToLeftChanged;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler StyleChanged;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler TabIndexChanged;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler TabStopChanged;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler TextChanged;
+ #endregion // Events
+
+ #region Delegates
+ [Serializable]
+ protected delegate void AboutBoxDelegate();
+ #endregion // Delegates
+
+ #region Interfaces
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ AttributeCollection ICustomTypeDescriptor.GetAttributes() {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ string ICustomTypeDescriptor.GetClassName() {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ string ICustomTypeDescriptor.GetComponentName() {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ TypeConverter ICustomTypeDescriptor.GetConverter() {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ EventDescriptor ICustomTypeDescriptor.GetDefaultEvent() {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ PropertyDescriptor ICustomTypeDescriptor.GetDefaultProperty() {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ object ICustomTypeDescriptor.GetEditor(Type editorBaseType) {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ EventDescriptorCollection ICustomTypeDescriptor.GetEvents() {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ EventDescriptorCollection ICustomTypeDescriptor.GetEvents(Attribute[] attributes) {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties() {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[] attributes) {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ object ICustomTypeDescriptor.GetPropertyOwner(PropertyDescriptor pd) {
+ throw new NotImplementedException("COM/ActiveX support is not implemented");
+ }
+ #endregion // Interfaces
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/BaseCollection.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/BaseCollection.cs
new file mode 100644
index 00000000000..028f33f0185
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/BaseCollection.cs
@@ -0,0 +1,99 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+ public class BaseCollection : MarshalByRefObject, ICollection, IEnumerable {
+ internal ArrayList list;
+
+ #region Public Constructors
+ public BaseCollection ()
+ {
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public virtual int Count {
+ get {
+ return List.Count;
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public bool IsReadOnly {
+ get {
+ return false;
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public bool IsSynchronized {
+ get {
+ return false;
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public object SyncRoot {
+ get {
+ return this;
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Protected Instance Properties
+ protected virtual ArrayList List {
+ get {
+ if (list == null)
+ list = new ArrayList ();
+ return list;
+ }
+ }
+ #endregion // Protected Instance Properties
+
+ #region Public Instance Methods
+ public void CopyTo (Array ar, int index)
+ {
+ List.CopyTo (ar, index);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return List.GetEnumerator ();
+ }
+ #endregion // Public Instance Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Binding.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Binding.cs
new file mode 100644
index 00000000000..1677f2f46cd
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Binding.cs
@@ -0,0 +1,284 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+// Jackson Harper jackson@ximian.com
+//
+
+
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ [TypeConverter (typeof (ListBindingConverter))]
+ public class Binding {
+
+ private string property_name;
+ private object data_source;
+ private string data_member;
+ private BindingMemberInfo binding_member_info;
+ private Control control;
+
+ private BindingManagerBase manager;
+ private PropertyDescriptor prop_desc;
+ private PropertyDescriptor is_null_desc;
+
+ private EventDescriptor changed_event;
+ private EventHandler property_value_changed_handler;
+ private object event_current; // The manager.Current as far as the changed_event knows
+
+ private object data;
+ private Type data_type;
+
+ #region Public Constructors
+ public Binding (string propertyName, object dataSource, string dataMember)
+ {
+ property_name = propertyName;
+ data_source = dataSource;
+ data_member = dataMember;
+ binding_member_info = new BindingMemberInfo (dataMember);
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public BindingManagerBase BindingManagerBase {
+ get {
+ return manager;
+ }
+ }
+
+ public BindingMemberInfo BindingMemberInfo {
+ get {
+ return binding_member_info;
+ }
+ }
+
+ [DefaultValue (null)]
+ public Control Control {
+ get {
+ return control;
+ }
+ }
+
+ public object DataSource {
+ get {
+ return data_source;
+ }
+ }
+
+ public bool IsBinding {
+ get {
+ if (control == null || !control.Created)
+ return false;
+ if (manager == null || manager.IsSuspended)
+ return false;
+ return true;
+ }
+ }
+
+ [DefaultValue ("")]
+ public string PropertyName {
+ get {
+ return property_name;
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Protected Instance Methods
+ protected virtual void OnFormat (ConvertEventArgs cevent)
+ {
+ if (Format!=null)
+ Format (this, cevent);
+ }
+
+ protected virtual void OnParse (ConvertEventArgs cevent)
+ {
+ if (Parse!=null)
+ Parse (this, cevent);
+ }
+ #endregion // Protected Instance Methods
+
+
+ internal void SetControl (Control control)
+ {
+ if (control == this.control)
+ return;
+
+ prop_desc = TypeDescriptor.GetProperties (control).Find (property_name, true);
+
+ if (prop_desc == null)
+ throw new ArgumentException (String.Concat ("Cannot bind to property '", property_name, "' on target control."));
+ if (prop_desc.IsReadOnly)
+ throw new ArgumentException (String.Concat ("Cannot bind to property '", property_name, "' because it is read only."));
+
+ data_type = prop_desc.PropertyType; // Getting the PropertyType is kinda slow and it should never change, so it is cached
+ control.Validating += new CancelEventHandler (ControlValidatingHandler);
+
+ this.control = control;
+ }
+
+ internal void Check (BindingContext binding_context)
+ {
+ if (control == null)
+ return;
+
+ manager = control.BindingContext [data_source];
+ manager.AddBinding (this);
+
+ WirePropertyValueChangedEvent ();
+
+ is_null_desc = TypeDescriptor.GetProperties (manager.Current).Find (property_name + "IsNull", false);
+
+ PullData ();
+ }
+
+ internal void PushData ()
+ {
+ if (IsBinding == false)
+ return;
+
+ data = prop_desc.GetValue (control);
+ data = FormatData (data);
+ SetPropertyValue (data);
+ }
+
+ internal void PullData ()
+ {
+ if (IsBinding == false)
+ return;
+
+ if (is_null_desc != null) {
+ bool is_null = (bool) is_null_desc.GetValue (manager.Current);
+ if (is_null) {
+ data = Convert.DBNull;
+ return;
+ }
+ }
+
+ if (data_member != null) {
+ PropertyDescriptor pd = TypeDescriptor.GetProperties (manager.Current).Find (data_member, true);
+ object pulled = pd.GetValue (manager.Current);
+ data = ParseData (pulled, pd.PropertyType);
+ } else {
+ object pulled = manager.Current;
+ data = ParseData (pulled, pulled.GetType ());
+ }
+
+ data = FormatData (data);
+ SetControlValue (data);
+ }
+
+ internal void UpdateIsBinding ()
+ {
+ PushData ();
+ }
+
+ private void SetControlValue (object data)
+ {
+ prop_desc.SetValue (control, data);
+ }
+
+ private void SetPropertyValue (object data)
+ {
+ PropertyDescriptor pd = TypeDescriptor.GetProperties (manager.Current).Find (data_member, true);
+ if (pd.IsReadOnly)
+ return;
+ pd.SetValue (manager.Current, data);
+ }
+
+ private void CurrentChangedHandler ()
+ {
+ if (changed_event != null) {
+ changed_event.RemoveEventHandler (event_current, property_value_changed_handler);
+ WirePropertyValueChangedEvent ();
+ }
+ }
+
+ private void WirePropertyValueChangedEvent ()
+ {
+ EventDescriptor changed_event = TypeDescriptor.GetEvents (manager.Current).Find (property_name + "Changed", false);
+ if (changed_event == null)
+ return;
+ property_value_changed_handler = new EventHandler (PropertyValueChanged);
+ changed_event.AddEventHandler (manager.Current, property_value_changed_handler);
+
+ event_current = manager.Current;
+ }
+
+ private void PropertyValueChanged (object sender, EventArgs e)
+ {
+ PullData ();
+ }
+
+ private void ControlValidatingHandler (object sender, CancelEventArgs e)
+ {
+ PullData ();
+ }
+
+ private object ParseData (object data, Type data_type)
+ {
+ ConvertEventArgs e = new ConvertEventArgs (data, data_type);
+
+ OnParse (e);
+ if (data_type.IsInstanceOfType (e.Value))
+ return e.Value;
+ if (e.Value == Convert.DBNull)
+ return e.Value;
+
+ return ConvertData (e.Value, data_type);
+ }
+
+ private object FormatData (object data)
+ {
+ if (data_type == typeof (object))
+ return data;
+
+ ConvertEventArgs e = new ConvertEventArgs (data, data_type);
+
+ OnFormat (e);
+ if (data_type.IsInstanceOfType (e.Value))
+ return e.Value;
+
+ return ConvertData (data, data_type);
+ }
+
+ private object ConvertData (object data, Type data_type)
+ {
+ TypeConverter converter = TypeDescriptor.GetConverter (data.GetType ());
+ if (converter != null && converter.CanConvertTo (data_type))
+ return converter.ConvertTo (data, data_type);
+
+ if (data is IConvertible) {
+ object res = Convert.ChangeType (data, data_type);
+ if (data_type.IsInstanceOfType (res))
+ return res;
+ }
+
+ return null;
+ }
+
+ #region Events
+ public event ConvertEventHandler Format;
+ public event ConvertEventHandler Parse;
+ #endregion // Events
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/BindingContext.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/BindingContext.cs
new file mode 100644
index 00000000000..b0205d80c6d
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/BindingContext.cs
@@ -0,0 +1,229 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+// Jackson Harper jackson@ximian.com
+
+
+using System.Collections;
+using System.Globalization;
+using System.ComponentModel;
+
+
+namespace System.Windows.Forms {
+
+ [DefaultEvent("CollectionChanged")]
+ public class BindingContext : ICollection, IEnumerable {
+
+ private Hashtable managers;
+
+ private class ManagerEntry {
+
+ private object source;
+ private WeakReference member_ref;
+
+ private int member_hash;
+
+ public ManagerEntry (object source, string member)
+ {
+ this.source = source;
+ if (member == null)
+ member = String.Empty;
+
+ member_hash = member.ToLower (CultureInfo.InvariantCulture).GetHashCode ();
+ if (member_hash == 0)
+ member_hash = 1;
+ member_ref = new WeakReference (member, false);
+ }
+
+ public override bool Equals (object b)
+ {
+ ManagerEntry o = (ManagerEntry) b;
+
+ return (o.source == source && o.member_ref.Target == member_ref.Target);
+ }
+
+ public override int GetHashCode ()
+ {
+ return member_hash * source.GetHashCode ();
+ }
+
+ public override string ToString ()
+ {
+ return source.ToString () + " + " + (member_ref.Target == null ? " -- null --" : member_ref.Target.ToString ());
+ }
+ }
+
+ public BindingContext ()
+ {
+ managers = new Hashtable ();
+ }
+
+ public bool IsReadOnly {
+ get {
+ return false;
+ }
+ }
+
+ public BindingManagerBase this [object dataSource] {
+ get {
+ return this [dataSource, String.Empty];
+ }
+ }
+
+ public BindingManagerBase this [object data_source, string data_member] {
+ get {
+ ManagerEntry e = CreateEntry (data_source, data_member);
+ WeakReference wref = managers [e] as WeakReference;
+
+ if (wref != null && wref.Target != null)
+ return wref.Target as BindingManagerBase;
+ BindingManagerBase res = AddManager (data_source, data_member);
+ return res;
+ }
+ }
+
+ private BindingManagerBase AddManager (object data_source, string data_member)
+ {
+ BindingManagerBase res = CreateBindingManager (data_source, data_member);
+ managers [CreateEntry (data_source, data_member)] = new WeakReference (res);
+
+ return res;
+ }
+
+ private BindingManagerBase CreateBindingManager (object data_source,
+ string data_member)
+ {
+ if (data_source is IList ||
+ data_source is IListSource ||
+ data_source is IBindingList) {
+ CurrencyManager res = new CurrencyManager (data_source);
+ return res;
+ }
+
+ return new PropertyManager (data_source, data_member);
+ }
+
+ #region Public Instance Methods
+ public bool Contains(object dataSource)
+ {
+ return Contains (dataSource, String.Empty);
+ }
+
+ public bool Contains (object dataSource, string dataMember)
+ {
+ ManagerEntry entry = CreateEntry (dataSource, dataMember);
+
+ return managers.ContainsKey (entry);
+ }
+ #endregion // Public Instance Methods
+
+ #region Protected Instance Methods
+
+ protected internal void Add (object dataSource, BindingManagerBase listManager)
+ {
+ AddCore (dataSource, listManager);
+ OnCollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Add, dataSource));
+ }
+
+ protected virtual void AddCore (object dataSource, BindingManagerBase listManager)
+ {
+ if (dataSource == null)
+ throw new ArgumentNullException ("dataSource");
+ if (listManager == null)
+ throw new ArgumentNullException ("listManager");
+ managers.Add (CreateEntry (dataSource, String.Empty), new WeakReference (listManager));
+ }
+
+ protected internal void Clear ()
+ {
+ ClearCore();
+ OnCollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Refresh, null));
+ }
+
+ protected virtual void ClearCore ()
+ {
+ managers.Clear ();
+ }
+
+ protected virtual void OnCollectionChanged(System.ComponentModel.CollectionChangeEventArgs ccevent)
+ {
+ if (CollectionChanged != null) {
+ CollectionChanged (this, ccevent);
+ }
+ }
+
+ protected internal void Remove (object dataSource)
+ {
+ RemoveCore (dataSource);
+ OnCollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Remove, dataSource));
+ }
+
+ protected virtual void RemoveCore (object dataSource)
+ {
+ managers.Remove (CreateEntry (dataSource, String.Empty));
+ }
+ #endregion // Protected Instance Methods
+
+ #region Events
+ public event CollectionChangeEventHandler CollectionChanged;
+ #endregion // Events
+
+ #region ICollection Interfaces
+ void ICollection.CopyTo (Array array, int index)
+ {
+ managers.CopyTo (array, index);
+ }
+
+ int ICollection.Count {
+ get {
+ return managers.Count;
+ }
+ }
+
+ bool ICollection.IsSynchronized {
+ get {
+ return false;
+ }
+ }
+
+ object ICollection.SyncRoot {
+ get {
+ return null;
+ }
+ }
+
+ #endregion // ICollection Interfaces
+
+ #region IEnumerable Interfaces
+ [MonoTODO]
+ IEnumerator IEnumerable.GetEnumerator() {
+ throw new NotImplementedException();
+ }
+ #endregion // IEnumerable Interfaces
+
+ private ManagerEntry CreateEntry (object dataSource, string dataMember)
+ {
+ return new ManagerEntry (dataSource, dataMember);
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/BindingManagerBase.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/BindingManagerBase.cs
new file mode 100644
index 00000000000..e3ab60b7170
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/BindingManagerBase.cs
@@ -0,0 +1,153 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+// Jackson Harper jackson@ximian.com
+//
+
+
+// NOT COMPLETE
+
+using System.ComponentModel;
+using System.Collections;
+
+namespace System.Windows.Forms {
+ public abstract class BindingManagerBase {
+ private BindingsCollection bindings;
+ private bool pulling_data;
+
+ private static int count = 0;
+ private int id = count++;
+
+#region Public Constructors
+ public BindingManagerBase() {
+ }
+ #endregion // Public Constructors
+
+ #region Protected Instance Fields
+ protected EventHandler onCurrentChangedHandler;
+ protected EventHandler onPositionChangedHandler;
+ #endregion // Protected Instance Fields
+
+ #region Public Instance Properties
+ public BindingsCollection Bindings {
+ get {
+ if (bindings == null) {
+ bindings = new BindingsCollection ();
+ }
+ return bindings;
+ }
+ }
+
+ public abstract int Count {
+ get;
+ }
+
+ public abstract object Current {
+ get;
+ }
+
+ public abstract int Position {
+ get; set;
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Instance Methods
+ public abstract void AddNew();
+
+ public abstract void CancelCurrentEdit();
+
+ public abstract void EndCurrentEdit();
+
+ public abstract PropertyDescriptorCollection GetItemProperties();
+
+ public abstract void RemoveAt(int index);
+
+ public abstract void ResumeBinding();
+
+ public abstract void SuspendBinding();
+ #endregion // Public Instance Methods
+
+ internal abstract bool IsSuspended {
+ get;
+ }
+
+ #region Protected Instance Methods
+ [MonoTODO]
+ protected internal virtual PropertyDescriptorCollection GetItemProperties(System.Collections.ArrayList dataSources, System.Collections.ArrayList listAccessors) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ protected virtual PropertyDescriptorCollection GetItemProperties(Type lisType, int offset, System.Collections.ArrayList dataSources, System.Collections.ArrayList listAccessors) {
+ throw new NotImplementedException();
+ }
+
+ protected internal abstract string GetListName (System.Collections.ArrayList listAccessors);
+
+ protected internal abstract void OnCurrentChanged (EventArgs e);
+
+ protected void PullData()
+ {
+ pulling_data = true;
+ try {
+ UpdateIsBinding ();
+ foreach (Binding binding in Bindings)
+ binding.PullData ();
+ } finally {
+ pulling_data = false;
+ }
+ }
+
+ protected void PushData()
+ {
+ if (pulling_data)
+ return;
+
+ UpdateIsBinding ();
+ foreach (Binding binding in Bindings)
+ binding.PushData ();
+ }
+
+ protected abstract void UpdateIsBinding();
+ #endregion // Protected Instance Methods
+
+ internal void AddBinding (Binding binding)
+ {
+ if (Bindings.Contains (binding))
+ return;
+ Bindings.Add (binding);
+ }
+
+ #region Events
+ public event EventHandler CurrentChanged {
+ add { onCurrentChangedHandler += value; }
+ remove { onCurrentChangedHandler -= value; }
+ }
+
+ public event EventHandler PositionChanged {
+ add { onPositionChangedHandler += value; }
+ remove { onPositionChangedHandler -= value; }
+ }
+ #endregion // Events
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/BindingMemberInfo.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/BindingMemberInfo.cs
new file mode 100644
index 00000000000..7bf925a6ef5
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/BindingMemberInfo.cs
@@ -0,0 +1,93 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public struct BindingMemberInfo {
+ private string data_member;
+ private string data_field;
+ private string data_path;
+
+ #region Public Constructors
+ public BindingMemberInfo(string dataMember) {
+ int i;
+
+ if (dataMember!=null) {
+ this.data_member=dataMember;
+ } else {
+ this.data_member=String.Empty;
+ }
+
+ // Break out our components
+ i=data_member.LastIndexOf('.');
+ if (i!=-1) {
+ data_field=data_member.Substring(i+1);
+ data_path=data_member.Substring(0, i);
+ } else {
+ data_field=data_member;
+ data_path=String.Empty;
+ }
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public string BindingField {
+ get {
+ return this.data_field;
+ }
+ }
+
+ public string BindingMember {
+ get {
+ return this.data_member;
+ }
+ }
+
+ public string BindingPath {
+ get {
+ return this.data_path;
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Instance Methods
+ public override bool Equals(object otherObject) {
+ if (otherObject is BindingMemberInfo) {
+ return ((this.data_field == ((BindingMemberInfo)otherObject).data_field) &&
+ (this.data_path == ((BindingMemberInfo)otherObject).data_path) &&
+ (this.data_member == ((BindingMemberInfo)otherObject).data_member));
+ } else {
+ return false;
+ }
+ }
+
+ public override int GetHashCode() {
+ return this.data_member.GetHashCode();
+ }
+ #endregion // Public Instance Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/BindingsCollection.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/BindingsCollection.cs
new file mode 100644
index 00000000000..b8572eb7c14
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/BindingsCollection.cs
@@ -0,0 +1,120 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+// Jackson Harper jackson@ximian.com
+//
+
+
+// COMPLETE
+
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+ [DefaultEvent("CollectionChanged")]
+ public class BindingsCollection : BaseCollection {
+
+#region Public Constructors
+ internal BindingsCollection ()
+ {
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public override int Count {
+ get {
+ return base.Count;
+ }
+ }
+
+ public Binding this[int index] {
+ get {
+ return (Binding)(base.List[index]);
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Protected Instance Properties
+ protected override ArrayList List {
+ get {
+ return base.List;
+ }
+ }
+ #endregion // Protected Instance Properties
+
+ #region Protected Instance Methods
+ protected internal void Add(Binding binding) {
+ AddCore(binding);
+ }
+
+ protected virtual void AddCore(Binding dataBinding) {
+ base.List.Add(dataBinding);
+ OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Add, base.List));
+ }
+
+ protected internal void Clear() {
+ ClearCore();
+ }
+
+ protected virtual void ClearCore() {
+ base.List.Clear();
+ OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Refresh, base.List));
+ }
+
+ protected virtual void OnCollectionChanged(System.ComponentModel.CollectionChangeEventArgs ccevent) {
+ if (CollectionChanged!=null) CollectionChanged(this, ccevent);
+ }
+
+ protected internal void Remove(Binding binding) {
+ RemoveCore(binding);
+ }
+
+ protected internal void RemoveAt(int index) {
+ base.List.RemoveAt(index);
+ OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Remove, base.List));
+ }
+
+ protected virtual void RemoveCore(Binding dataBinding) {
+ base.List.Remove(dataBinding);
+ OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Remove, base.List));
+ }
+
+ protected internal bool ShouldSerializeMyAll() {
+ if (this.Count>0) {
+ return(true);
+ } else {
+ return(false);
+ }
+ }
+ #endregion // Public Instance Methods
+
+ internal bool Contains (Binding binding)
+ {
+ return List.Contains (binding);
+ }
+
+ #region Events
+ public event CollectionChangeEventHandler CollectionChanged;
+ #endregion // Events
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/BootMode.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/BootMode.cs
new file mode 100644
index 00000000000..943779459b4
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/BootMode.cs
@@ -0,0 +1,39 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+
+//COMPLETE
+
+
+namespace System.Windows.Forms
+{
+
+ public enum BootMode
+ {
+ Normal = 0,
+ FailSafe = 1,
+ FailSafeWithNetwork = 2
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Border3DSide.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Border3DSide.cs
new file mode 100644
index 00000000000..ae739e9e40c
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Border3DSide.cs
@@ -0,0 +1,42 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [ComVisible(true)]
+ [Flags]
+ public enum Border3DSide {
+ Left = 0x00000001,
+ Top = 0x00000002,
+ Right = 0x00000004,
+ Bottom = 0x00000008,
+ Middle = 0x00000800,
+ All = 0x0000080F
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Border3DStyle.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Border3DStyle.cs
new file mode 100644
index 00000000000..ecf9b828bdf
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Border3DStyle.cs
@@ -0,0 +1,45 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [ComVisible(true)]
+ public enum Border3DStyle {
+ RaisedOuter = 1,
+ SunkenOuter = 2,
+ RaisedInner = 4,
+ Raised = 5,
+ Etched = 6,
+ SunkenInner = 8,
+ Bump = 9,
+ Sunken = 10,
+ Adjust = 8192,
+ Flat = 16394
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/BorderStyle.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/BorderStyle.cs
new file mode 100644
index 00000000000..b4bb1eecb45
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/BorderStyle.cs
@@ -0,0 +1,37 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+// COMPLETE
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [ComVisible(true)]
+ public enum BorderStyle {
+ None = 0,
+ FixedSingle = 1,
+ Fixed3D = 2
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/BoundsSpecified.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/BoundsSpecified.cs
new file mode 100644
index 00000000000..0b64c75381b
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/BoundsSpecified.cs
@@ -0,0 +1,42 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms
+{
+ [Flags]
+ public enum BoundsSpecified
+ {
+ None = 0x00000000,
+ X = 0x00000001,
+ Y = 0x00000002,
+ Location = 0x00000003,
+ Width = 0x00000004,
+ Height = 0x00000008,
+ Size = 0x0000000c,
+ All = 0x0000000f
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Button.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Button.cs
new file mode 100644
index 00000000000..fee2af3d6fe
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Button.cs
@@ -0,0 +1,122 @@
+//
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+// COMPLETE
+
+using System.ComponentModel;
+using System.Drawing;
+using System.Drawing.Text;
+
+namespace System.Windows.Forms {
+ public class Button : ButtonBase, IButtonControl {
+ #region Local variables
+ DialogResult dialog_result;
+ #endregion // Local variables
+
+ #region Public Constructors
+ public Button() {
+ dialog_result = DialogResult.None;
+ SetStyle(ControlStyles.StandardDoubleClick, false);
+ }
+ #endregion // Public Constructors
+
+ #region Internal methods
+ internal override void HaveDoubleClick() {
+ if (DoubleClick != null) DoubleClick(this, EventArgs.Empty);
+ }
+ #endregion // Internal methods
+
+ #region Public Instance Properties
+ [DefaultValue(DialogResult.None)]
+ public DialogResult DialogResult { // IButtonControl
+ get {
+ return dialog_result;
+ }
+ set {
+ dialog_result = value;
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Protected Instance Properties
+ protected override CreateParams CreateParams {
+ get {
+ return base.CreateParams;
+ }
+ }
+ #endregion // Protected Instance Properties
+
+ #region Public Instance Methods
+ public virtual void NotifyDefault(bool value) { // IButtonControl
+ this.IsDefault = value;
+ }
+
+ public void PerformClick() { // IButtonControl
+ OnClick(EventArgs.Empty);
+ }
+
+ public override string ToString() {
+ return base.ToString() + ", Text: " + this.text;
+ }
+ #endregion // Public Instance Methods
+
+ #region Protected Instance Methods
+ protected override void OnClick(EventArgs e) {
+ if (dialog_result != DialogResult.None) {
+ Form p = Parent as Form;
+
+ if (p != null) {
+ p.DialogResult = dialog_result;
+ }
+ }
+ base.OnClick(e);
+ }
+
+ protected override void OnMouseUp(MouseEventArgs e) {
+ base.OnMouseUp (e);
+ }
+
+ protected override bool ProcessMnemonic(char charCode) {
+ if (IsMnemonic(charCode, Text) == true) {
+ PerformClick();
+ return true;
+ }
+
+ return base.ProcessMnemonic(charCode);
+ }
+
+ protected override void WndProc(ref Message m) {
+ base.WndProc (ref m);
+ }
+ #endregion // Protected Instance Methods
+
+ #region Events
+ [Browsable(false)]
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ public event EventHandler DoubleClick;
+ #endregion // Events
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ButtonBase.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ButtonBase.cs
new file mode 100644
index 00000000000..17cb96e1bd5
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ButtonBase.cs
@@ -0,0 +1,563 @@
+// 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.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+// COMPLETE
+
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Drawing;
+using System.Drawing.Text;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ public abstract class ButtonBase : Control {
+ #region Local Variables
+ internal FlatStyle flat_style;
+ internal int image_index;
+ internal Image image;
+ internal ImageList image_list;
+ internal ContentAlignment image_alignment;
+ internal ContentAlignment text_alignment;
+ private bool is_default;
+ internal bool is_pressed;
+ internal bool enter_state;
+ internal StringFormat text_format;
+ #endregion // Local Variables
+
+ #region ButtonBaseAccessibleObject sub-class
+ [ComVisible(true)]
+ public class ButtonBaseAccessibleObject : ControlAccessibleObject {
+ #region ButtonBaseAccessibleObject Local Variables
+ private Control owner;
+ #endregion // ButtonBaseAccessibleObject Local Variables
+
+ #region ButtonBaseAccessibleObject Constructors
+ public ButtonBaseAccessibleObject(Control owner) : base(owner) {
+ this.owner = owner;
+ }
+ #endregion // ButtonBaseAccessibleObject Constructors
+
+ #region ButtonBaseAccessibleObject Methods
+ public override void DoDefaultAction() {
+ ((ButtonBase)owner).PerformClick();
+ }
+ #endregion // ButtonBaseAccessibleObject Methods
+ }
+ #endregion // ButtonBaseAccessibleObject sub-class
+
+ #region Private Properties and Methods
+ internal ButtonState ButtonState {
+ get {
+ ButtonState ret = ButtonState.Normal;
+
+ if (Enabled) {
+ // Popup style is only followed as long as the mouse isn't "in" the control
+ if (is_entered) {
+ if (flat_style == FlatStyle.Flat) {
+ ret |= ButtonState.Flat;
+ }
+ } else {
+ if (flat_style == FlatStyle.Flat || flat_style == FlatStyle.Popup) {
+ ret |= ButtonState.Flat;
+ }
+ }
+
+ if (is_entered && is_pressed) {
+ ret |= ButtonState.Pushed;
+ }
+ } else {
+ ret |= ButtonState.Inactive;
+ if ((flat_style == FlatStyle.Flat) || (flat_style == FlatStyle.Popup)) {
+ ret |= ButtonState.Flat;
+ }
+ }
+ return ret;
+ }
+ }
+
+ [MonoTODO("Make the FillRectangle use a global brush instead of creating one every time")]
+ internal void Redraw() {
+ Refresh ();
+ }
+
+ // Derived classes should override Draw method and we dont want
+ // to break the control signature, hence this approach.
+ internal virtual void Draw (PaintEventArgs pevent) {
+ ThemeEngine.Current.DrawButtonBase (pevent.Graphics, pevent.ClipRectangle, this);
+ }
+
+ internal virtual void HaveDoubleClick() {
+ // override me
+ }
+
+ private void RedrawEvent(object sender, System.EventArgs e) {
+ Redraw();
+ }
+
+ #endregion // Private Properties and Methods
+
+ #region Public Constructors
+ protected ButtonBase() : base() {
+ flat_style = FlatStyle.Standard;
+ image_index = -1;
+ image = null;
+ image_list = null;
+ image_alignment = ContentAlignment.MiddleCenter;
+ text_alignment = ContentAlignment.MiddleCenter;
+ ime_mode = ImeMode.Inherit;
+ is_default = false;
+ is_entered = false;
+ is_pressed = false;
+ has_focus = false;
+ text_format = new StringFormat();
+ text_format.Alignment = StringAlignment.Center;
+ text_format.LineAlignment = StringAlignment.Center;
+ text_format.HotkeyPrefix = HotkeyPrefix.Show;
+
+ TextChanged+=new System.EventHandler(RedrawEvent);
+ ForeColorChanged+=new EventHandler(RedrawEvent);
+ BackColorChanged+=new System.EventHandler(RedrawEvent);
+ FontChanged+=new EventHandler(RedrawEvent);
+ SizeChanged+=new EventHandler(RedrawEvent);
+
+ SetStyle(ControlStyles.ResizeRedraw |
+ ControlStyles.Opaque |
+ ControlStyles.UserMouse |
+ ControlStyles.SupportsTransparentBackColor |
+ ControlStyles.CacheText |
+ ControlStyles.DoubleBuffer, true);
+ SetStyle(ControlStyles.StandardClick, false);
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ [Localizable(true)]
+ [DefaultValue(FlatStyle.Standard)]
+ [MWFDescription("Determines look of button"), MWFCategory("Appearance")]
+ public FlatStyle FlatStyle {
+ get {
+ return flat_style;
+ }
+
+ set {
+ flat_style = value;
+ Redraw();
+ }
+ }
+
+ [Localizable(true)]
+ [MWFDescription("Sets image to be displayed on button face"), MWFCategory("Appearance")]
+ public Image Image {
+ get {
+ return image;
+ }
+
+ set {
+ image = value;
+ Redraw();
+ }
+ }
+
+ [Localizable(true)]
+ [DefaultValue(ContentAlignment.MiddleCenter)]
+ [MWFDescription("Sets the alignment of the image to be displayed on button face"), MWFCategory("Appearance")]
+ public ContentAlignment ImageAlign {
+ get {
+ return image_alignment;
+ }
+
+ set {
+ image_alignment=value;
+ Redraw();
+ }
+ }
+
+ [Localizable(true)]
+ [DefaultValue(-1)]
+ [Editor("System.Windows.Forms.Design.ImageIndexEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
+ [TypeConverter(typeof(ImageIndexConverter))]
+ [MWFDescription("Index of image to display, if ImageList is used for button face images"), MWFCategory("Appearance")]
+ public int ImageIndex {
+ get {
+ if (image_list==null) {
+ return -1;
+ }
+ return image_index;
+ }
+
+ set {
+ image_index=value;
+ Redraw();
+ }
+ }
+
+ [DefaultValue(null)]
+ [MWFDescription("ImageList used for ImageIndex"), MWFCategory("Appearance")]
+ public ImageList ImageList {
+ get {
+ return image_list;
+ }
+
+ set {
+ image_list = value;
+ if (value != null) {
+ if (image != null) {
+ image=null;
+ }
+ if (image_list.Images.Count >= image_index) {
+ image_index=image_list.Images.Count-1;
+ }
+ }
+ Redraw();
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new ImeMode ImeMode {
+ get {
+ return ime_mode;
+ }
+
+ set {
+ if (ime_mode != value) {
+ ime_mode = value;
+
+ if (ImeModeChanged != null) {
+ ImeModeChanged(this, EventArgs.Empty);
+ }
+ }
+ }
+ }
+
+ [Localizable(true)]
+ [DefaultValue(ContentAlignment.MiddleCenter)]
+ [MWFDescription("Alignment for button text"), MWFCategory("Appearance")]
+ public virtual ContentAlignment TextAlign {
+ get {
+ return text_alignment;
+ }
+
+ set {
+ if (text_alignment != value) {
+ text_alignment = value;
+ switch(text_alignment) {
+ case ContentAlignment.TopLeft: {
+ text_format.Alignment=StringAlignment.Near;
+ text_format.LineAlignment=StringAlignment.Near;
+ break;
+ }
+
+ case ContentAlignment.TopCenter: {
+ text_format.Alignment=StringAlignment.Center;
+ text_format.LineAlignment=StringAlignment.Near;
+ break;
+ }
+
+ case ContentAlignment.TopRight: {
+ text_format.Alignment=StringAlignment.Far;
+ text_format.LineAlignment=StringAlignment.Near;
+ break;
+ }
+
+ case ContentAlignment.MiddleLeft: {
+ text_format.Alignment=StringAlignment.Near;
+ text_format.LineAlignment=StringAlignment.Center;
+ break;
+ }
+
+ case ContentAlignment.MiddleCenter: {
+ text_format.Alignment=StringAlignment.Center;
+ text_format.LineAlignment=StringAlignment.Center;
+ break;
+ }
+
+ case ContentAlignment.MiddleRight: {
+ text_format.Alignment=StringAlignment.Far;
+ text_format.LineAlignment=StringAlignment.Center;
+ break;
+ }
+
+ case ContentAlignment.BottomLeft: {
+ text_format.Alignment=StringAlignment.Near;
+ text_format.LineAlignment=StringAlignment.Far;
+ break;
+ }
+
+ case ContentAlignment.BottomCenter: {
+ text_format.Alignment=StringAlignment.Center;
+ text_format.LineAlignment=StringAlignment.Far;
+ break;
+ }
+
+ case ContentAlignment.BottomRight: {
+ text_format.Alignment=StringAlignment.Far;
+ text_format.LineAlignment=StringAlignment.Far;
+ break;
+ }
+ }
+ Redraw();
+ }
+ }
+ }
+
+ #endregion // Public Instance Properties
+
+ #region Protected Instance Properties
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams cp;
+
+ cp=base.CreateParams;
+
+ cp.Style=(int)(WindowStyles.WS_VISIBLE | WindowStyles.WS_CHILD | WindowStyles.WS_CLIPSIBLINGS | WindowStyles.WS_CLIPCHILDREN);
+
+ if (!is_enabled) {
+ cp.Style |= (int)(WindowStyles.WS_DISABLED);
+ }
+
+ return cp;
+ }
+ }
+
+ protected override ImeMode DefaultImeMode {
+ get {
+ return ImeMode.Inherit;
+ }
+ }
+
+ protected override Size DefaultSize {
+ get {
+ return ThemeEngine.Current.ButtonBaseDefaultSize;
+ }
+ }
+
+ protected bool IsDefault {
+ get {
+ return is_default;
+ }
+
+ set {
+ if (is_default != value) {
+ is_default = true;
+ Redraw();
+ }
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Protected Instance Methods
+ protected override AccessibleObject CreateAccessibilityInstance() {
+ AccessibleObject ao;
+ ao = base.CreateAccessibilityInstance();
+ ao.description = "Button";
+ ao.role = AccessibleRole.PushButton;
+
+ return ao;
+ }
+
+ protected override void Dispose(bool Disposing) {
+ base.Dispose(Disposing);
+ }
+
+ protected override void OnEnabledChanged(EventArgs e) {
+ Redraw();
+ base.OnEnabledChanged(e);
+ }
+
+ protected override void OnGotFocus(EventArgs e) {
+ has_focus=true;
+ Redraw();
+ base.OnGotFocus(e);
+ }
+
+ protected override void OnKeyDown(KeyEventArgs kevent) {
+ if (is_enabled && (kevent.KeyData == Keys.Space)) {
+ enter_state = is_entered;
+ is_entered = true;
+ OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 2, 2, 0));
+ kevent.Handled=true;
+ }
+ base.OnKeyDown(kevent);
+ }
+
+ protected override void OnKeyUp(KeyEventArgs kevent) {
+ if (is_enabled && (kevent.KeyData == Keys.Space)) {
+ OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 2, 2, 0));
+ is_entered = enter_state;
+ kevent.Handled=true;
+ }
+ base.OnKeyUp(kevent);
+ }
+
+ protected override void OnLostFocus(EventArgs e) {
+ has_focus=false;
+ Redraw();
+ base.OnLostFocus(e);
+ }
+
+ protected override void OnMouseDown(MouseEventArgs mevent) {
+ if (is_enabled && (mevent.Button == MouseButtons.Left)) {
+ is_pressed = true;
+ this.Capture = true;
+ Redraw();
+ }
+
+ base.OnMouseDown(mevent);
+ }
+
+ protected override void OnMouseEnter(EventArgs e) {
+ is_entered=true;
+ if ( is_enabled )
+ Redraw();
+ base.OnMouseEnter(e);
+ }
+
+ protected override void OnMouseLeave(EventArgs e) {
+ is_entered=false;
+ if ( is_enabled )
+ Redraw();
+ base.OnMouseLeave(e);
+ }
+
+ protected override void OnMouseMove(MouseEventArgs mevent) {
+ bool inside = false;
+ bool redraw = false;
+
+ if (mevent.X>=0 && mevent.Y>=0 && mevent.X<this.client_size.Width && mevent.Y<=this.client_size.Height) {
+ inside = true;
+ }
+
+ // If the button was pressed and we leave, release the button press and vice versa
+ if (this.Capture && (inside != is_pressed)) {
+ is_pressed = inside;
+ redraw = true;
+ }
+
+ if (is_entered != inside) {
+ is_entered = inside;
+ redraw = true;
+ }
+
+ if (redraw) {
+ Redraw();
+ }
+
+ base.OnMouseMove(mevent);
+ }
+
+ protected override void OnMouseUp(MouseEventArgs mevent) {
+ if (this.Capture && mevent.Button == MouseButtons.Left) {
+ this.Capture = false;
+ if (is_pressed) {
+ is_pressed = false;
+ Redraw();
+ } else if ((this.flat_style == FlatStyle.Flat) || (this.flat_style == FlatStyle.Popup)) {
+ Redraw();
+ }
+
+ if (mevent.X>=0 && mevent.Y>=0 && mevent.X<this.client_size.Width && mevent.Y<=this.client_size.Height) {
+ OnClick(EventArgs.Empty);
+ }
+ }
+ base.OnMouseUp(mevent);
+ }
+
+ protected override void OnPaint(PaintEventArgs pevent) {
+ Draw (pevent);
+ base.OnPaint (pevent);
+ }
+
+ protected override void OnParentChanged(EventArgs e) {
+ base.OnParentChanged(e);
+ }
+
+ protected override void OnTextChanged(EventArgs e) {
+ Redraw();
+ base.OnTextChanged(e);
+ }
+
+ protected override void OnVisibleChanged(EventArgs e) {
+ if (!Visible) {
+ is_pressed = false;
+ has_focus = false;
+ is_entered = false;
+ }
+ base.OnVisibleChanged(e);
+ }
+
+ protected void ResetFlagsandPaint() {
+ // Nothing to do; MS internal
+ // Should we do Redraw (); ?
+ }
+
+ protected override void WndProc(ref Message m) {
+ switch((Msg)m.Msg) {
+ case Msg.WM_LBUTTONDBLCLK: {
+ HaveDoubleClick();
+ break;
+ }
+
+ case Msg.WM_MBUTTONDBLCLK: {
+ HaveDoubleClick();
+ break;
+ }
+
+ case Msg.WM_RBUTTONDBLCLK: {
+ HaveDoubleClick();
+ break;
+ }
+ }
+ base.WndProc (ref m);
+ }
+ #endregion // Public Instance Properties
+
+
+ #region Internal Methods
+ private void PerformClick() {
+ OnClick(EventArgs.Empty);
+ }
+ #endregion // Internal Methods
+
+ #region Events
+ [Browsable(false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler ImeModeChanged;
+ #endregion // Events
+
+#if NET_2_0
+
+ public bool UseCompatibleTextRendering {
+ get {
+ return use_compatible_text_rendering;
+ }
+
+ set {
+ use_compatible_text_rendering = value;
+ }
+ }
+#endif
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ButtonBorderStyle.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ButtonBorderStyle.cs
new file mode 100644
index 00000000000..b4dfb70aa16
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ButtonBorderStyle.cs
@@ -0,0 +1,38 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public enum ButtonBorderStyle {
+ None = 0,
+ Dotted = 1,
+ Dashed = 2,
+ Solid = 3,
+ Inset = 4,
+ Outset = 5
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ButtonState.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ButtonState.cs
new file mode 100644
index 00000000000..52c9887a72a
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ButtonState.cs
@@ -0,0 +1,40 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+
+ [Flags]
+ public enum ButtonState {
+ Normal = 0x00000000,
+ Inactive = 0x00000100,
+ Pushed = 0x00000200,
+ Checked = 0x00000400,
+ Flat = 0x00004000,
+ All = 0x00004700
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CaptionButton.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CaptionButton.cs
new file mode 100644
index 00000000000..8b6c23e69a9
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CaptionButton.cs
@@ -0,0 +1,37 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public enum CaptionButton {
+ Close = 0,
+ Minimize = 1,
+ Maximize = 2,
+ Restore = 3,
+ Help = 4
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CategoryGridEntry.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CategoryGridEntry.cs
new file mode 100644
index 00000000000..5f02ff70ef3
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CategoryGridEntry.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Drawing;
+
+namespace System.Windows.Forms.PropertyGridInternal
+{
+ /// <summary>
+ /// Summary description for CategoryGridEntry.
+ /// </summary>
+ internal class CategoryGridEntry : GridEntry
+ {
+ private string label;
+ public CategoryGridEntry(string category)
+ {
+ label = category;
+ }
+
+ public override GridItemType GridItemType {
+ get {
+ return GridItemType.Category;
+ }
+ }
+
+
+ public override string Label {
+ get {
+ return label;
+ }
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
new file mode 100644
index 00000000000..22c5e828061
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
@@ -0,0 +1,10522 @@
+2006-01-19 Peter Dennis Bartok <pbartok@novell.com>
+
+ * TextBoxBase.cs (WndProc): When handling WM_KEYDOWN we need to
+ first call base before processing the event. Fixes #77279
+
+2006-01-19 Peter Dennis Bartok <pbartok@novell.com>
+
+ * XplatUIWin32.cs, Cursor.cs: Fixed code that wrongly assumed
+ that the stride for the GDI bitmap would match the stride of
+ a DIB or a Cursor.
+
+2006-01-19 Alexander Olk <alex.olk@googlemail.com>
+
+ * ThemeGtk.cs: Added ProgressBar, RadioButton, CheckBox
+
+2006-01-19 Jackson Harper <jackson@ximian.com>
+
+ * ComboBox.cs: Hookup the text controls keydown event so we get
+ those when the text control has the focus.
+
+2006-01-18 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Label.cs: Now using the base events instead of defining new ones;
+ this allows us to just call the base properties without having to
+ duplicate all base property logic
+
+2006-01-18 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Label.cs: A label by default is not a tabstop (Fixes one of our
+ failing nunit tests)
+
+2006-01-18 Peter Dennis Bartok <pbartok@novell.com>
+
+ * XplatUIWin32.cs: Fixed wrong DoEvents logic. Fixes #77282
+ * XplatUIX11.cs: Removed WM_PAINT check from DoEvents. Fixes #77282
+
+2006-01-18 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Cursor.cs: Reimplemented creating cursor bitmaps without using
+ the Bitmap(Stream) constructor which is semi-broken on MS GDI+.
+ This fixes #77218
+ * XplatUIWin32.cs:
+ - Reimplemented creating Bitmaps from DIBs since the Bitmap(Stream)
+ constructor creates images that can't be saved. Part of the fix
+ for #76103
+ - Added handling of CF_BITMAP as CF_DIB to clipboard code (Fixes #76103)
+ - SetWindowState: Switched ShowWindow flags (part of an upcoming
+ bug fix for handling window state in forms properly)
+
+2006-01-18 Alexander Olk <alex.olk@googlemail.com>
+
+ * ThemeGtk.cs: Simplify ScrollBar drawing
+
+2006-01-18 Jackson Harper <jackson@ximian.com>
+
+ * Splitter.cs: Set the default dock style for the splitter control
+ in the constructor.
+
+2006-01-18 Alexander Olk <alex.olk@googlemail.com>
+
+ * ThemeGtk.cs: Corrected StateType and ShadowType for
+ gtk_paint_box
+
+2006-01-18 Alexander Olk <alex.olk@googlemail.com>
+
+ * Control.cs: Make use of Theme.DoubleBufferingSupported
+ * ThemeGtk.cs:
+ - Added drawing for flat style buttons
+ - Added ScrollBar drawing
+
+2006-01-18 Alexander Olk <alex.olk@googlemail.com>
+
+ * ThemeClearlooks.cs: Removed some unneeded code.
+ * ThemeGtk.cs: First part of ThemeGtk enhancements.
+
+2006-01-17 Peter Dennis Bartok <pbartok@novell.com>
+
+ * LinkLabel.cs: We need to update the hover drawing when
+ leaving the control as well.
+
+2006-01-18 Jordi Mas i Hernandez <jordimash@gmail.com>
+
+ * DataGrid.cs: Clicking on non empty areas in the columns
+ area was giving an exception
+
+2006-01-17 Jackson Harper <jackson@ximian.com>
+
+ * ThemeWin32Classic.cs:
+ * ListView.cs: Do not draw/clip the headers when the header style
+ is None.
+
+2006-01-17 Jordi Mas i Hernandez <jordimash@gmail.com>
+
+ * DataGrid.cs: Fixes 77260
+
+2006-01-17 Jordi Mas i Hernandez <jordimash@gmail.com>
+
+ * DataGrid.cs: Clicking on a column on a empty grid was giving
+ an exception
+
+2006-01-17 Peter Dennis Bartok <pbartok@novell.com>
+
+ * DataGrid.cs (OnKeyDown): Don't use the array if it's empty
+ or any keypress will crash the grid.
+
+2006-01-17 Mike Kestner <mkestner@novell.com>
+
+ * MainMenu.cs (OnMenuChanged): set Height=0 to cause relayout.
+ * ThemeWin32Classic.cs (CalcItemSize): clear Height/Width for
+ invisible/previously-visible items.
+ [Fixes #76909]
+
+2006-01-17 Alexander Olk <alex.olk@googlemail.com>
+
+ * ThemeClearlooks.cs:
+ - Added CL_Draw_Button method; now other theme controls that are
+ not derived from button or do not have a button can draw buttons
+ too
+ - Updated ComboBox drawing
+ - Beautified RadioButton drawing
+ - Corrected drawing of bottom and left tabs
+ - Beautified DateTimePicker and MonthCalendar
+ - Added CPDrawButton and CPDrawRadioButton
+
+2006-01-16 Jackson Harper <jackson@ximian.com>
+
+ * ComboBox.cs: Set the initial value of the scrollbar to the
+ current index. Reduce the numbers of refreshs and IndexOfs called.
+
+2006-01-14 Alexander Olk <alex.olk@googlemail.com>
+
+ * FileDialog.cs: When the file listview is focused hitting the
+ backspace key moves the fileview to the parent directory
+
+2006-01-13 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Form.cs:
+ - Added RecreateHandle call when changing taskbar visibility to
+ trigger reparenting in Win32 driver (Fixes #75719)
+ - If a window has minimize or maximize buttons, it cannot have
+ a help button
+ * XplatUIWin32.cs:
+ - CreateWindow: When no WS_EX_APPWINDOW style is found we parent
+ the toplevel form with FosterParent (A toolwindow not on the
+ taskbar) (Fixes #75719)
+ - Made FosterParent a toolwindow
+
+2006-01-13 Alexander Olk <alex.olk@googlemail.com>
+
+ * FileDialog.cs: Don't crash if InitialDirectory doesn't exist
+
+2006-01-13 Alexander Olk <alex.olk@googlemail.com>
+
+ * ToolTip.cs: If SetToolTip is called from a control and the mouse
+ is currently over that control, make sure that tooltip_window.Text
+ gets updated
+
+2006-01-13 Mike Kestner <mkestner@novell.com>
+
+ * MimeIcon.cs: size_t on lp64 fix for gdk_pixbuf_save_to_file extern.
+
+2006-01-13 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: On MS GetNodeAt never actually factors in the X
+ value passed. Also redraw the selected node when we recieve
+ focus, so tabbing between trees works correctly.
+
+2006-01-13 Alexander Olk <alex.olk@googlemail.com>
+
+ * MimeIcon.cs: GnomeHandler: older gnome versions don't have
+ ~/.gconf/%gconf-tree.xml, so use
+ .gconf/desktop/gnome/interface/%gconf.xml
+
+2006-01-13 Peter Dennis Bartok <pbartok@novell.com>
+
+ * TextControl.cs: Draw text in gray if control is disabled
+
+2006-01-13 Peter Dennis Bartok <pbartok@novell.com>
+
+ * TreeView.cs: Draw the focus rectangle outside the highlight, to
+ make sure it's always visible. Fixes #76680.
+
+2006-01-13 Peter Dennis Bartok <pbartok@novell.com>
+
+ * TreeView.cs: Implemented Wheel scrolling. Fixes #76531
+
+2006-01-13 Jonathan Chambers <jonathan.chambers@ansys.com>
+
+ * PageSetupDialog.cs: Added.
+ * PrintDialog.cs: Attributes.
+ * PrintPreviewControl.cs: Updates.
+ * PrintPreviewDialog.cs: Updates.
+
+2006-01-12 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Control.cs: Undid my selection check fix, since it's not needed
+ * TextBoxBase.cs:
+ - Now considering the presence of hscroll/vscroll when sizing
+ vscroll/hscroll respectively. Fixed bug #77077
+ - Added Left/Up/Down/Right to IsInputKey list to prevent
+ ContainerControl from stealing them. This fixes what I broke
+ with my last checkin.
+
+2006-01-12 Peter Dennis Bartok <pbartok@novell.com>
+
+ * ScrollableControl.cs: Implemented dockpadding. Fixes #77166. And
+ I finally understand how the property can be set without a setter :-)
+
+2006-01-12 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Application.cs:
+ - Switched RunLoop to use static Message.Create to create a
+ Message object
+ - Added PreProcessMessage call in runloop for keyboard events; this
+ is part of the fix for #77219, I overlooked this originally in the
+ MSDN doc for PreProcessMessage
+ * Control.cs:
+ - Removed call to PreProcessMessage from handling of keyboard
+ messages; it's supposed to be done in the message pump
+ - Moved call to ProcessKeyEventArgs inside ProcessKeyMessage as
+ per MSDN documentation.
+ - IsInputChar: All chars are input chars by default; removed the
+ parent calling chain, MS does not document that
+ - PreProcessMessage: If IsInputChar is true, we want to return false
+ to allow dispatching of the message
+ - When selecting the next control, now also check that we're not
+ selecting ourselves again and therefore return a false positive.
+ * TextBoxBase.cs:
+ - Tried to match return values for IsInputKey and ProcessDialogKey
+ to what MS returns; moved processing of our special keys outside
+ ProcessDialogKey since MS does not seem to return true on those.
+ - Moved code that previously was in ProcessDialogKey into new private
+ ProcessKey method, which gets called upon receipt of WM_KEYDOWN
+ - Reworked handling of WM_CHAR to not have to duplicate code from
+ Control.cs anymore, instead we simply call down to base.
+
+2006-01-12 Jackson Harper <jackson@ximian.com>
+
+ * ComboBox.cs: We always need to refresh the text area when
+ EndUpdate is called. Fixes the combobox in the file dialog.
+ * Control.cs: Don't create the creator_thread until the controls
+ handle is created. Also in InvokeRequired we check if the
+ creator_thread is null. This gives the effect of InvokeRequired
+ returning true if the controls handle is not created yet, and
+ matches MS.
+
+2006-01-12 Peter Dennis Bartok <pbartok@novell.com>
+
+ * XplatUI.cs:
+ - Added StartLoop() driver method. This is used to allow drivers to
+ prepare for an upcoming GetMessage/TranslateMessage/DispatchMessage
+ loop for a particular thread
+ - Added EndLoop() driver method. This is called once the message
+ pump for the thread is shut down
+ - Added SupportsTransparency method to allow the driver to indicate
+ opacity support for windows
+ * Form.cs:
+ - Removed TODO attribute, completed AllowTransparency property
+ - Added documented logic to Opacity
+ * GroupBox.cs, Label.cs, LinkLabel.cs, PropertyGrid.cs, Control.cs,
+ ButtonBase.cs, CheckedListBox.cs: Combined Jackson's and Miguel's
+ versions of CompatibleTextRendering
+ * X11Structs.cs: Added opacity atom to our atom enumeration
+ * Hwnd.cs: Added opacity tracking (we need to track since the opacity
+ of a form might be set before it's reparented by the WM, and we need
+ the opacity value without calling up to Form)
+ * XplatUIDriver.cs: Added StartLoop(), EndLoop() and
+ SupportsTransparency() driver methods
+ * Application.cs: Now calling StartLoop and EndLoop driver methods
+ * XplatUIX11.cs:
+ - Added opacity atom registration
+ - Added StartLoop()/EndLoop() methods. They're empty right now but
+ will need to get implemented when we switch to a per-thread queue
+ - Implemented SupportsTransparency() method
+ - Implemented SetWindowTransparency() method
+ - Added support for setting the opacity value when a window is
+ reparented (since the opacity needs to be set on the WM frame)
+ * XplatUIOSX.cs, XplatUIWin32.cs:
+ - Added SupportsTransparency(), StartLoop() and EndLoop() methods
+
+2006-01-12 Alexander Olk <alex.olk@googlemail.com>
+
+ * ThemeClearlooks.cs: Don't crash if TabControl.Parent is null.
+
+2006-01-12 Alexander Olk <alex.olk@googlemail.com>
+
+ * FileDialog.cs: Added ToolTip for MWFFileView
+ * MimeIcon.cs: Rewrote GnomeHandler.
+ - Get currently used gnome icon theme from
+ ($HOME)/.gconf/%gconf-tree.xml
+ - Make use of inherited icon themes
+ - Support SVG icon themes like Tango via librsvg
+
+2006-01-12 Miguel de Icaza <miguel@novell.com>
+
+ Revert's Jackson's revert which broke 2.0 builds. Fix both
+ builds.
+
+ * Application.cs: Move the use_compatible_text_rendering outside
+ the NET_2_0 define. If we ever need to use the
+ use_compatible_text_rendering on the individual controls they will
+ access the variable from the common shared code paths.
+
+2006-01-12 Peter Dennis Bartok <pbartok@novell.com>
+
+ * XplatUI.cs:
+ - Added more granular debug options
+ - Added method to print both window text and id
+ - Switched debug output to use new Window() debug method
+ - Added IsEnabled() driver method
+ - Added EnableWindow() driver method
+ * Form.cs:
+ - Removed end_modal; no longer needed, new loop handles termination
+ via 'closing' variable
+ - If form is modal, setting DialogResult will now initiate loop
+ termination via 'closing' variable
+ - Added support for is_enabled/WS_DISABLED to CreateParams
+ - Close() now just send the WM_CLOSE message; the WM_CLOSE handler
+ does all the work
+ - Removed code that's now in RunLoop from ShowDialog()
+ - Added various documented sanity checks to ShowDialog()
+ - Added handling of WM_DESTROY message; we set 'closing' on getting
+ the message to indicate the message pump to terminate
+ - Added handling of new internal WM_CLOSE_INTERNAL message - it's
+ send by the Application.ExitThread method. (We send the message
+ to destroy the window after all other events have been
+ processed through the queue, instead of destroying the handle
+ directly)
+ - Moved code from Close() method to WM_CLOSE handler; added logic
+ to only send close-related events if the form is not displayed
+ modal
+ * Splitter.cs (..ctor): Fixed typo in resource name
+ * Control.cs:
+ - DrawBackgroundImage: Explicitly selecting the wrap mode for the
+ brush now
+ - set_Cursor: Now only setting calling into XplatUI if the handle for
+ the control is already created; this avoids implict handle creation
+ or crashes if it's not created
+ - set_Enabled: Now setting the enabled state via the new driver method
+ instead of just tracking it
+ - CreateParams: Added logic to set WS_DISABLED based on enabled state
+ - CreateControl: Reordered event firing and method calls to more
+ closely fire events in the order MS does. Now setting the
+ enabled state in the driver when creating the control.
+ - SetVisibleCore: Moved when the OnVisibleChanged event is fired to
+ match MS order
+ * FolderBrowserDialog.cs, MessageBox.cs, ButtonBase.cs, TrackBar.cs,
+ MonthCalendar.cs: get_CreateParams: Added setting of WS_DISABLED
+ * XplatUIStructs.cs: Added internal WM_CLOSE_INTERNAL mesage id
+ * Hwnd.cs:
+ - Added tracking of window enabled state (get_Enabled/set_Enabled)
+ - Added EnabledHwnd property to easily allow a driver to find the
+ handle of the first enabled window in the parent chain (this is
+ used by drivers to pass up input events of disabled windows)
+ * XplatUIDriver.cs: Added IsEnabled() method
+ * Application.cs:
+ - Removed crude and obsolete exiting tracking variable
+ - Removed internal ModalRun(); replaced by RunLoop()
+ - Implemented private CloseForms() method to allow closing all
+ windows owned by a particular (or all) threads
+ - Exit() now properly closes all windows without forcing the message
+ pump to quit
+ - Removed obsolete InternalExit() method
+ - Changed Run() methods to use new RunLoop() message pump
+ - Implemented new RunLoop() method for both modal and non-modal forms
+ * CommonDialog.cs:
+ - get_CreateParams: Added setting of WS_DISABLED
+ - Simplified ShowDialog(); now all the work is done in RunLoop(),
+ invoked via Form.ShowDialog()
+ * NativeWindow.cs: We don't remove the window from the collection when
+ the handle is destroyed; there might still be messages for it in the
+ queue (mainly the resulting WM_DESTROY); instead it will be removed
+ when Control calls InvalidateHandle in the WM_DESTROY handler
+ * XplatUIX11.cs:
+ - CreateWindow: Added logic to handle the WS_DISABLED window style
+ - EnableWindow: Implemented based on Hwnd.Enabled
+ - GetMessage: Reset PostQuitState so the method can be called again
+ - Implemented support for disabled windows (passing messages to the
+ first enabled parent) in handling all input messages
+ - Added optimizations for handling Expose events
+ - Implemeted new driver method IsEnabled()
+ - Now always resetting paint pending tracking vars when we start paint
+ - Re-implemented UpdateWindow via just sending a WM_PAINT message
+ * XplatUIOSX.cs: Added IsEnabled method stub
+ * XplatUIWin32.cs: Implemented new IsEnabled() method
+
+2006-01-11 Jackson Harper <jackson@ximian.com>
+
+ * ButtonBase.cs, CheckedListBox.cs, GroupBox.cs, Label.cs,
+ LinkLabel.cs, PropertyGrid.cs: Unbreak 1.1 build. Consolidate the
+ variables a little.
+ * ColorDialog.cs: Clear out the old form before adding the new
+ panel.
+
+2006-01-11 Jackson Harper <jackson@ximian.com>
+
+ * X11Dnd.cs: Make sure to add all the text formats when adding
+ strings to the data object.
+ * TreeNodeCollection.cs: When adding to a sorted tree we need to
+ do some redrawing too. Also change the UpdateNode to an
+ UpdateBelow so the newly added node gets painted.
+
+2006-01-11 Miguel de Icaza <miguel@novell.com>
+
+ * ButtonBase.cs, CheckedListBox.cs, GroupBox.cs, Label.cs,
+ LinkLabel.cs, PropertyGrid.cs: Implement the
+ UseCompatibleTextRendering property for 2.x
+
+ * Application.cs (SetCompatibleTextRenderingDefault): Add.
+
+2006-01-11 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Use the property for setting the selected node so
+ the correct events get raised.
+ * TreeNode.cs: Update the tree when the fore/back colours of a
+ node are set.
+
+2006-01-10 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Allow setting SelectedNode to null.
+
+2006-01-9 Jonathan Chambers <jonathan.chambers@ansys.com>
+
+ * Form.cs: Fix support for Form TransparencyKey and Opacity on Windows.
+
+2006-01-9 Jonathan Chambers <jonathan.chambers@ansys.com>
+
+ * PrintControllerWithStatusDialog.cs: Update page number in dialog.
+
+2006-01-9 Jonathan Chambers <jonathan.chambers@ansys.com>
+
+ * PrintDialog.cs: Added attributes and set default property values.
+
+2006-01-9 Jonathan Chambers <jonathan.chambers@ansys.com>
+
+ * PrintControllerWithStatusDialog.cs:
+ Added PrintControllerWithStatusDialog.
+
+2006-01-9 Jonathan Chambers <jonathan.chambers@ansys.com>
+
+ * XplatUI.cs, Form.cs, XplatUIDriver.cs, XplatUIX11.cs, XplatUIOSX.cs,
+ XplatUIWin32.cs: Added support for Form TransparencyKey and Opacity on Windows.
+
+2006-01-9 Jonathan Chambers <jonathan.chambers@ansys.com>
+
+ * ComboBox.cs: Fix crash when there is no selected item (due to last commit)
+
+2006-01-09 Jonathan Chambers <jonathan.chambers@ansys.com>
+
+ * ComboBox.cs: Added KeyDown event handler for processing arrow keys
+ and PgUp/PgDown. Also, scroll to selected item upon dropdown. Bugs 76857 and 76788.
+
+2006-01-08 Alexander Olk <alex.olk@googlemail.com>
+
+ * MimeIcon.cs: Added internal class SVGUtil.
+
+2006-01-08 Alexander Olk <alex.olk@googlemail.com>
+
+ * FileDialog.cs: Don't crash if there are two files with the
+ same name but different locations.
+
+2006-01-08 John BouAntoun <jba-mono@optusnet.com.au>
+
+ * MonthCalendar.cs: Fixed annoying rendering bug when selecting
+ dates across multiple month grids. Used to not highlight entire
+ month, but does now.
+
+2006-01-06 Jackson Harper <jackson@ximian.com>
+
+ * MonthCalendar.cs: Removed DoEvents call to prevent a running
+ message loop. Change timer intervals to numbers that seem more
+ natural.
+
+2006-01-06 John BouAntoun <jba-mono@optusnet.com.au>
+
+ * DateTimePicker.cs: Modified CalculateDropDownLocation to use the screen
+ object for location info since screen object is now implemented.
+
+2006-01-05 Jackson Harper <jackson@ximian.com>
+
+ * AsyncMethodData.cs: Check if the call is complete before doing a WaitOne
+ * AsyncMethodResult.cs: We no longer use a WeakReference for the
+ AsyncMethodResult, this is because we ALWAYS want the
+ ManualResetEvent to get set.
+ * Control.cs: When disposing use an async invoke to call shutdown
+ code, so that thigns don't block on the finalizer thread. Also
+ check if we even have a message loop before trying to send
+ messages, if we don't then don't bother sending messages.
+ - No more weak references for async methods
+ * XplatUIDriver.cs: No more weak references for async methods.
+
+2006-01-04 Alexander Olk <alex.olk@googlemail.com>
+
+ * FontDialog.cs: Fix, don't throw an exception if FontFamily.Families
+ returns two FontFamily with the same name
+
+2006-01-04 Peter Dennis Bartok <pbartok@novell.com>
+
+ * ThemeWin32Classic.cs, ThemeClearlooks.cs: Dropped stupid scheme of
+ drawing disabled text. Instead using the ColorGrayText color
+
+2006-01-04 Jackson Harper <jackson@ximian.com>
+
+ * TreeNode.cs: redraw the node when its image index is changed.
+
+2006-01-04 Peter Dennis Bartok <pbartok@novell.com>
+
+ * RichTextBox.cs: Same fix as last, just for SelectionColor. This
+ time I checked there are no others like it.
+
+2006-01-04 Jackson Harper <jackson@ximian.com>
+
+ * AsyncMethodResult.cs: Use a ManualResetEvent instead of a mutex,
+ this gives the behavoir I was looking for.
+ * Control.cs: Special case Invoking EventHandlers, this matches MS
+ and fixes part of bug #76326.
+
+2006-01-04 Alexander Olk <alex.olk@googlemail.com>
+
+ * ThemeClearlooks.cs, FileDialog.cs:
+ - Reflect the latest Theme class changes
+ - Remove Mono.Unix.Syscall.time in FileDialg and replace it
+ with DateTime
+
+2006-01-04 Alexander Olk <alex.olk@googlemail.com>
+
+ * Theme.cs: Cache UI resource images and resize them if needed
+
+2006-01-03 Peter Dennis Bartok <pbartok@novell.com>
+
+ * RichTextBox.cs: FormatText is 1-based, make it so when SelectionFont
+ is called. This fixes the crash in Nexxia when setting the font
+ attributes in the chat. [However, RTF needs a look-over to make sure
+ that all SelectionXXX methods handle the special case that selection
+ is empty and therefore the change must be applied to all text starting
+ at the cursor/selection start]
+
+2006-01-03 Peter Dennis Bartok <pbartok@novell.com>
+
+ * XplatUI.cs, XplatUIDriver.cs, XplatUIX11.cs, XplatUIWin32.cs,
+ XplatUIOSX.cs: Added SendMessage and PostMessage methods
+ * X11Keyboard.cs: Switched to new way of calling PostMessage
+
+2006-01-03 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Theme.cs: Added theme interface for images to allow the theme to
+ control what images are used for things like FileDialog, MessageBox
+ icons, etc.
+ * MessageBox.cs: Now uses the new Theme icon/image interfaces
+
+2006-01-03 Alexander Olk <alex.olk@googlemail.com>
+
+ * FileDialog.cs:
+ - Removed some dead code
+ - Opening a recently used file does work now
+ - Small UI enhancements
+ - Refactoring
+
+2006-01-02 Alexander Olk <alex.olk@googlemail.com>
+
+ * FileDialog.cs: Forgot too add __MonoCS__
+
+2006-01-02 Alexander Olk <alex.olk@googlemail.com>
+
+ * FileDialog.cs: We are able to read recently used files now let's
+ go on and write them.
+
+2006-01-01 Alexander Olk <alex.olk@googlemail.com>
+
+ * FileDialog.cs: Breathe some life into "last open"/"recently used"
+ button
+ * MimeIcon.cs: Do a check for the top level media type also
+
+2005-12-31 Alexander Olk <alex.olk@googlemail.com>
+
+ * ThemeClearlooks.cs:
+ - Added CPDrawStringDisabled
+ - ButtonBase_DrawText: Workaround for a DrawString bug; cut off
+ some chars if the text doesn't fit into text_rect
+ - DrawListViewItem: If View = View.LargeIcon center the image;
+ rewrote the drawing of ListViewItem.Text if View =
+ View.LargeIcon
+
+2005-12-31 Alexander Olk <alex.olk@googlemail.com>
+
+ * MimeIcon.cs: Use default KDE icon theme if there is no
+ "48x48" directory for the current icon theme, fixes #77114
+ * Mime.cs: Disable not working and actually not used code.
+ * ThemeWin32Classic.cs:
+ - Replace "new SolidBrush" in GetControlBackBrush and
+ GetControlForeBrush with ResPool.GetSolidBrush
+ - Changed DrawListViewItem from private to protected virtual
+ * FileDialog.cs:
+ - Added form.MaximizeBox = true
+ - Don't throw an exception if there is a broken symbolic link
+
+2005-12-23 Jackson Harper <jackson@ximian.com>
+
+ * TabControl.cs: Give the panels focus, keyboard navigation is
+ fixed so this works correctly now.
+ - We need these key events also.
+ * ToolBar.cs: Remove some of the poor mans double buffering.
+
+2005-12-24 Alexander Olk <alex.olk@googlemail.com>
+
+ * ComboBox.cs: The internal TextBox now returns the focus.
+
+2005-12-23 Jackson Harper <jackson@ximian.com>
+
+ * ThemeWin32Classic.cs: Draw the text for all tab appearances.
+
+2005-12-23 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Control.cs: Removed debug code
+ * XplatUIX11.cs: Changed DestroyChildWindows to also consider
+ implicit children
+
+2005-12-23 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Control.cs: When creating the control, update the Z-order after
+ all it's children are created, too. (Fixes nexxia not showing
+ picturebox bug)
+
+2005-12-23 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Control.cs: Do not update the anchoring distances if layout is
+ suspended, instead do it once layout is resumed
+
+2005-12-22 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Control.cs:
+ - After many hours of debugging, for both Jackson and
+ myself, it turns out that it helps to set the parent of a control
+ if you want to actually see it onscreen. In the spirit of that
+ discovery, we're now setting the parent of the control and
+ it's children when the control's handle is created. This fix
+ will make Lutz Roeder's Reflector run happily.
+ - now just creating the handle instead of the whole control when
+ getting a graphics context for the control.
+
+2005-12-22 Peter Dennis Bartok <pbartok@novell.com>
+
+ * ScrollableControl.cs: When calculating the canvas, don't consider
+ the scrollbar widths. Instead, predict if horizontal scrollbar
+ will affect canvas when deciding on vertical display and vice versa.
+
+2005-12-22 Peter Dennis Bartok <pbartok@novell.com>
+
+ * RichTextBox.cs: Set default RTF font for documents that don't
+ have a font table (Fixes #77076)
+
+2005-12-22 Jackson Harper <jackson@ximian.com>
+
+ * TextBoxBase.cs: It's difficult to do, but you can have an empty
+ clipboard. This prevents a NullRef in that case.
+ * XplatUIX11.cs: Use CLIPBOARD not PRIMARY for our
+ clipboard. PRIMARY is for the currently selected text only. (We
+ should implement PRIMARY at some point.
+
+2005-12-21 Peter Dennis Bartok <pbartok@novell.com>
+
+ * XplatUIWin32.cs: Fixed the TEXTMETRIC structure, we were calling
+ a Unicode function with a structure that was defined in Ansi way.
+ This fixes #76942.
+
+2005-12-21 Jackson Harper <jackson@ximian.com>
+
+ * StatusBar.cs: Statusbar handles its fore/back colours on it's
+ on. Because thats how it rolls. (and this avoids it using ambient
+ colours).
+ * ThemeWin32Classic.cs: Use the proper back color for filling.
+ * Menu.cs: Use the system menu bar color for drawing menu
+ bars. Using the window back color will bring ambient colours into
+ the picture.
+
+2005-12-21 Alexander Olk <alex.olk@googlemail.com>
+
+ * ColorDialog.cs: Fixed a memory leak that caused a SIGSEV. A lot of
+ Bitmaps were created and not disposed.
+
+2005-12-21 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Control.cs (CreateControl): Don't do anything if the control is
+ already created, otherwise we'd fire the OnCreated event more than
+ once
+
+2005-12-21 Peter Dennis Bartok <pbartok@novell.com>
+
+ * ComboBox.cs (FindStringCaseInsensitive): Don't search for emtpy strings,
+ will always match. Instead return -1. Fixes #76464.
+
+2005-12-21 Peter Dennis Bartok <pbartok@novell.com>
+
+ * TextControl.cs (RecalculateLine): Only wrap if the wrap point is
+ neither the beginning nor the end of the line (Fixes bug #76479)
+
+2005-12-21 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Control.cs:
+ - ControlNativeWindow.ControlFromHandle(): Now handling situation
+ where handle is invalid
+ - FromHandle(): Now using hashtable-based ControlFromHandle() lookup
+ instead of slower linear search
+ * NativeWindow.cs: Don't remove the window from the hashtable until
+ after the driver has destroyed it (since the driver might use
+ Control.FromHandle to lookup the control object
+ * Hwnd.cs: Added DestroyPending property to track if a window is
+ already destroyed as far as the driver is concerned and only hasn't
+ yet notified the control
+ * XplatUIX11.cs:
+ - Activate(): Check if the window is still valid before using the
+ handle
+ - Implemented DestroyChildWindow() method to mark child windows as
+ destroyed when a window is destroyed. This prevents situations
+ where we might call an X method based on queued events for a
+ window that already has been destroyed but we haven't yet pulled
+ the destroy method from the queue.
+ - Added a call to the new DestroyChildWindow() method to the drivers
+ DestroyWindow code. Also now marking the destroyed window itself
+ as pending
+
+2005-12-20 Jackson Harper <jackson@ximian.com>
+
+ * StatusBar.cs:
+ * StatusBarPanel.cs: Don't calculate panel sizes on draw
+ anymore. Just do them when needed, also track the rects of panels
+ so that we can optimize refreshing more in the future.
+
+2005-12-20 Alexander Olk <alex.olk@googlemail.com>
+
+ * ColorDialog.cs: Fixed focus drawing in small color controls
+
+2005-12-19 Jackson Harper <jackson@ximian.com>
+
+ * InternalWindowManager.cs:
+ * MdiWindowManager.cs: Cleanup some coordinate system changes so
+ moving windows works properly.
+
+2005-12-19 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Control.cs:
+ - Removed call to InitLayout() from SetBoundsCore(); doc says
+ it's only called when a control is added to a container
+ - Split InitLayout logic, moved to separate UpdateDistances() method
+ since we need to perform those calculations more often than just
+ when adding the control to a container. (Needed to fix #77022)
+ - Now calling UpdateDistances() from UpdateBounds() (fixes #77022)
+ - Reduced the OnBindingContextChanged events count, don't send them
+ unless the control is created, we still aren't totally matching
+ MS, but I can't quite figure out some of their rules
+
+2005-12-18 Alexander Olk <alex.olk@googlemail.com>
+
+ * ThemeClearlooks.cs: Corrected distance between ProgressBar
+ stripes
+
+2005-12-18 Alexander Olk <alex.olk@googlemail.com>
+
+ * ThemeClearlooks.cs:
+ - Updated ProgressBar drawing
+ - Corrected drawing of ScrollBars and scroll buttons
+ - Some temporary fixes for minor pixel artefacts
+
+2005-12-18 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Control.cs:
+ - Reworked Controls.Add(), Controls.Remove() and set_Parent() to
+ cause events to be sent in the same order as MS does.
+ - Added ChangeParent() method to trigger various OnXXXChanged events
+ that need to be fired when a parent changes (This is a reworking
+ of the patch from r54254, with the X11 errors fixed)
+ - Removed SuspendLayout()/ResumeLayout() calls from Controls.Clear()
+ since on MS we get OnLayoutChanged events when calling Clear()
+ - Changed Enabled property to consider parent state as well, if a
+ parent is not enabled, the control will not be either
+ - Changed Parent property to simply call Controls.Add() since that
+ now does all the work required, this way we avoid code duplication
+ - Threw in a few OnBindingsContextChanged calls to try and match
+ when MS sends them. We seem to send a few too many, though.
+ - Added call to CreateControl when adding the control to a parent.
+ We were never calling CreateControl. Still needs some work, in
+ some places we treat HandleCreated and ControlCreated as equal,
+ which is wrong
+ - Removed obsolete commented out code from UpdateZOrder()
+
+2005-12-18 Alexander Olk <alex.olk@googlemail.com>
+
+ * ThemeClearlooks.cs: Updated TrackBar drawing.
+
+2005-12-17 Alexander Olk <alex.olk@googlemail.com>
+
+ * FileDialog.cs: Patch for #76901 by Atsushi Enomoto
+
+2005-12-17 Alexander Olk <alex.olk@googlemail.com>
+
+ * FileDialog.cs: Add the Help button and the open readonly
+ checkbox only if needed
+
+2005-12-16 Jackson Harper <jackson@ximian.com>
+
+ * Control.cs: Make sure we have an active menu before trying to
+ process commands on it. Prevents menu-less forms from crashing
+ when Alt is pressed.
+ * TreeNodeCollection.cs: Some fixes to prevent null refs. Patch by
+ Dieter Bremes.
+ * RichTextBox.cs: Expand statement to help out gmcs and fix the
+ 2.0 build.
+
+2005-12-16 Jackson Harper <jackson@ximian.com>
+
+ * InternalWindowManager.cs: Don't translate tool windows screen
+ coordinates. This fixes windows 'bouncing' around when being moved.
+
+2005-12-15 Peter Dennis Bartok <pbartok@novell.com>
+
+ * TextBoxBase.cs:
+ - MaxLength now treats 2^31-1 equal to unlimited length (this is
+ not quite MS compatible, MS uses that number only for single line
+ and 2^32-1 for multi-line, but I figure it won't hurt keeping
+ the limit at 2GB)
+ - Now enforcing the MaxLength limit when entering characters
+ - Added argument to internal Paste() method to track if it's called
+ from programatically or via keyboard, since keyboard driven pastes
+ need to enforce max-length
+ - Added logic to Paste to only paste as many chars as MaxLength
+ allows
+ * RichTextBox.cs: Updated to use new obey argument for internal Paste()
+ * TextControl.cs:
+ - Added Length property to return number of characters in document
+ - Added private CharCount property which only tracks actual chars
+ in the document (no linefeeds) and fires event when CharCount
+ changes
+ - Added tracking of character count to all methods that alter it
+ - Added LengthChanged event to allow applications to subscribe
+ to any changes to the document
+
+2005-12-15 Peter Dennis Bartok <pbartok@novell.com>
+
+ * TextBox.cs:
+ - Removed local password_char field (moved to TextBoxBase)
+ - Now setting the document's password var when password is
+ set
+ * TextBoxBase.cs:
+ - Added password_char field (needed here so MultiLine can
+ access it)
+ - Added logic to MultiLine property setter to set the document's
+ variable when password display is allowed
+ - Removed debug code and made some debug code conditional
+ * TextControl.cs:
+ - Added RecalculatePasswordLine() method to handle special password
+ char only lines
+ - Added PasswordChar property, also added related tracking vars
+ - Draw() method now uses local text var for grabbing text to draw,
+ this var is set to line.text unless we're doing password display,
+ then it is set to the pre-generated all-password-chars line
+ - Added calling RecalculatePasswordLine() method for password lines
+
+2005-12-14 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Hwnd.cs:
+ - Added Reparented property to allow tracking of Window Manager
+ reparenting actions (which affect X/Y calculations of toplevel
+ windows)
+ - Made ToString() print window handles in hex
+ * XplatUIX11.cs:
+ - AddConfigureNotify(): Now uses reparented state off Hwnd to
+ determine if X/Y needs offsetting
+ - AddConfigureNotify(): Fixed offset calculations
+ - Now adds ReparentNotify messages into the queue
+ - Now processes ReparentNotify messages and causes a
+ WM_WINDOWPOSCHANGED message to be sent upstream if a window
+ is reparented (as most likely it's X/Y coordinates are changed
+ due to that)
+
+2005-12-14 Jackson Harper <jackson@ximian.com>
+
+ * XplatUIX11.cs: Tool windows still need to respek focus.
+
+2005-12-14 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Control.cs: Undid 54254 (causing XConfigure errors) so we can
+ have a working release
+
+2005-12-13 Jackson Harper <jackson@ximian.com>
+
+ * Form.cs: Update styles after setting the border style regardless
+ of whether or not the window is using a window manager.
+
+2005-12-13 Jackson Harper <jackson@ximian.com>
+
+ * Form.cs: We now hook into an internal window manager instead of just an
+ MDI subsystem, this is so we can have properly behaving tool windows.
+ * MdiClient.cs: Naming change, MdiChildContext is now WindowManager
+ * InternalWindowManager.cs: New internal class that acts as a
+ window manager for tool windows and as a base for mdi windows.
+ * MdiWindowManager.cs: New class that acts as a window manager for
+ mdi windows.
+
+2005-12-12 Jackson Harper <jackson@ximian.com>
+
+ * Control.cs: Updates so we match behavoir for for implicit
+ controls. Fixes explosions in MDI.
+
+2005-12-12 Jackson Harper <jackson@ximian.com>
+
+ * Control.cs: Implement Invalidate (Region).
+
+2005-12-12 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Control.cs:
+ - Changed handling of Controls.Add/Controls.Remove to fire (almost)
+ the same events as MS does. MS fires events for each property
+ except, for unknown reasons, Cursor, when the control is reparented.
+ I can't seem to totally match add/remove since MS also fires some
+ VisibleChanged events, which makes no sense. Consolidated the
+ parenting code into a separate method so it can be called from
+ both Add and Remove. set_Parent no longer needs any special logic
+ as it calls the parent's add method which implicitly fires
+ all events
+ - Removed some obsolete code and debug output
+ - Enabled state is inherited from parents, if this is enabled
+
+2005-12-08 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Form.cs: Removed commented out code
+
+2005-12-08 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Control.cs:
+ - Added internal version of Invoke, with additional argument
+ indicating if we're calling it from a Dispose() handler. That
+ way we can avoid BeginInvoke throwing an exception if we're
+ calling for an already destroyed window.
+ - Added a dispose argument to BeginInvokeInternal, and made the
+ check if a valid window handle chain exists conditional on
+ it not being a dispose call
+ - Removed code in DestroyHandle to destroy our children. Since we
+ now handle the WM_DESTROY message we will catch all our children
+ being destroyed.
+ - Now calling OnHandleDestroyed from our new WM_DESTROY handler
+ * Form.cs:
+ - Added a field to track the application context of the form.
+ - No need to set closing variable as response to WM_CLOSE, instead
+ we destroy the window. We also call PostQuitMessage if the form
+ has an application context (which makes it the main app form,
+ which, when closed terminates the app)
+ * XplatUI.cs:
+ - Dropped Exit() method, it's naming was confusing
+ - Added PostQuitMessage() which causes GetMessage to return false
+ once the message queue is empty
+ * XplatUIDriver.cs, XplatUIWin32.cs: Dropped Exit(), added
+ PostQuitMessage()
+ * XplatUIOSX.cs: Switched signature for Exit method since Exit() is
+ no longer a valid XplatUI method, but left it in since it's used
+ internally. Added empty PostQuitMessage() method.
+ * MenuAPI.cs: Replaced call to Exit() with call to
+ PostQuitMessage, even though this is probably no longer needed.
+ * Hwnd.cs: Added 'pretty' ToString() to support debugging.
+ * X11Structs.cs: Added pretty XEvent.ToString() to support debugging.
+ * Application.cs:
+ - Replaced call to XplatUI.Exit() with PostQuitMessage()
+ - Removed old debug code that would call XplatUI for exception
+ display, enabled standard exception handling (Still not enabled
+ though, until NativeWindow's ExternalExceptionHandler define
+ is removed
+ * NativeWindow.cs:
+ - Added internal method to allow control to update NativeWindow
+ after a window has been destroyed
+ - Added handling of already destroyed windows when calling i
+ DestroyWindow
+ - Added removal of handle from list on ReleaseHandle
+ * XplatUIX11.cs:
+ - Dropped GetMessageResult var and related code
+ - Added PostQuitState to field to track if PostQuitMessage has been
+ called
+ - Dropped Exit() method
+ - Added PostQuitMessage() method
+ - GetMessage now will return false if PostQuitState is set and no
+ more messages are in the queue.
+ - Expose handler will no longer generate WM_PAINT messages if we are
+ in PostQuitState since it's very likely any windows have already
+ been destroyed, and since Hwnd won't get updated until we have
+ processed the DestroyNotify we'd be causing X errors.
+
+2005-12-07 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Control.cs(WndProc): Apparently I'm suffering from brain cloud.
+ Thanks to Mike for pointing out the err of my ways.
+
+2005-12-07 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Control.cs(PreProcessMessage): Moved menu handling back, but
+ after all other key handling, to match MS (who handles Menu in
+ DefWndProc)
+ * Menu.cs (WndProc): Removed my brainfart
+
+2005-12-07 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Control.cs(PreProcessMessage): Removed special menu handling
+ * Menu.cs (WndProc): Added handling of WM_SYSKEYUP for menu purposes.
+
+2005-12-07 Mike Kestner <mkestner@novell.com>
+
+ * Control.cs : special case SYSKEYUP so that we can adjust keynav
+ state according in tracker.
+ * Menu.cs : promote tracker field to base class and provide a tracker
+ lookup capability. Add/Remove shortcuts dynamically if the top menu
+ has a tracker. Unparent items that are removed from the collection.
+ * MenuAPI.cs : implement mnemonic, shortcut, and arrow-based keynav.
+ * Theme*.cs: add always_show_hotkeys field to support configurability
+ of mnemonic display. win32 doesn't show mnemonics until Alt is
+ pressed.
+
+2005-12-07 Jackson Harper <jackson@ximian.com>
+
+ * MdiChildContext.cs: Use Control.ResetCursor.
+ * Control.cs: ResetCursor needs to set the property so that the
+ correct XplatUI call gets made.
+
+2005-12-07 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Control.cs: More fixes to make our key events match MS. We
+ were not setting the modifier state on KeyData, and we were
+ not generating any events when Alt was pressed with a key
+ since handling of WM_SYSxxx was missing for the OnKey methods.
+
+2005-12-07 Jackson Harper <jackson@ximian.com>
+
+ * MdiChildContext.cs: reenable the sizing code.
+ - When the mouse leaves a window reset its cursor.
+
+2005-12-07 Alexander Olk <alex.olk@googlemail.com>
+
+ * ThemeClearlooks.cs: Reflect latest Hwnd changes
+
+2005-12-07 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Hwnd.cs: Now using the theme 3d bordersize to calculate
+ widths of Fixed3D borders
+
+2005-12-07 Jackson Harper <jackson@ximian.com>
+
+ * MdiClient.cs: Fix warnings. Earn Mike's love.
+
+2005-12-07 Alexander Olk <alex.olk@googlemail.com>
+
+ * ThemeClearlooks.cs:
+ - Adjusted mouse over button color
+ - Added first parts of CheckBox drawing
+ - Added correct color for selected text background
+ - Fixed ComboBox drawing
+ - Added CPDrawBorder3D and CPDrawBorder
+
+2005-12-06 Peter Dennis Bartok <pbartok@novell.com>
+
+ * XplatUIX11.cs: Added call to XBell for AudibleAlert
+
+2005-12-06 Peter Dennis Bartok <pbartok@novell.com>
+
+ * XplatUI.cs, XplatUIDriver.cs, XplatUIX11.cs, XplatUIWin32.cs,
+ XplatUIOSX.cs: Added AudibleAlert() method to have a means to
+ alert users via sound. We could add an enum arg with different
+ types of alerts in the future
+
+2005-12-06 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Control.cs: Fix behaviour problems pointed out by Mike
+
+2005-12-05 Mike Kestner <mkestner@novell.com>
+
+ * StatusBarPanel.cs: add Invalidate method and hook it into all the
+ prop setters. Calls parent.Refresh for now, but could be maybe be
+ optimized with an internal method on StatusBar at some point.
+ [Fixes #76513]
+
+2005-12-05 Peter Dennis Bartok <pbartok@novell.com>
+
+ * RichTextBox.cs: Implemented get_SelectionColor
+
+2005-12-05 Alexander Olk <alex.olk@googlemail.com>
+
+ * ThemeClearlooks.cs:
+ - Removed dead code
+ - Draw black button border only if button is Form.AcceptButton
+ - Draw correct button color for pressed RadioButton if the mouse
+ has entered the button
+ - Updated ProgressBar drawing!
+ - Updated CPDrawSizeGrip drawing
+ - Updated StatusBarPanel drawing
+
+2005-12-05 Mike Kestner <mkestner@novell.com>
+
+ * Control.cs (PreProcessMessage): add Keys.Alt based on LParam value.
+ * X11Keyboard.cs (SendKeyboardInput): formal lParam for alt mod.
+
+2005-12-04 Alexander Olk <alex.olk@googlemail.com>
+
+ * ThemeClearlooks.cs: Initial check-in, activate with
+ export MONO_THEME=clearlooks
+ * ThemeEngine.cs: Added ThemeClearlooks
+
+2005-12-03 Mike Kestner <mkestner@novell.com>
+
+ * MenuAPI.cs: deactivate menus prior to calling item.PerformClick.
+ [Fixes #76897]
+
+2005-12-02 Jackson Harper <jackson@ximian.com>
+
+ * Form.cs: If the child form has no menu the default main menu is
+ used as the active menu.
+
+2005-12-02 Peter Dennis Bartok <pbartok@novell.com>
+
+ * ListBox.cs: Check if any items exist before trying to resolve
+ coordinates into items
+
+2005-12-02 Peter Dennis Bartok <pbartok@novell.com>
+
+ * ThemeWin32Classic.cs: Hatchbrush on Win32 seems to always use white
+ as the second color for the background hatch
+
+2005-12-02 Peter Dennis Bartok <pbartok@novell.com>
+
+ * TextBoxBase.cs: Now uses Jackson's new and improved ImplicitScrollbar
+ * RichTextBox.cs: FormatText position arguments are 1-based, now making
+ sure that what we pass to FormatText is always 1-based. Fixes #76885
+
+2005-11-29 Miguel de Icaza <miguel@novell.com>
+
+ * NumericUpDown.cs (EndInit): When we are done initializing,
+ reflect any updates on the UI.
+
+2005-12-02 Jackson Harper <jackson@ximian.com>
+
+ * ImplicitHScrollBar.cs:
+ * ImplicitVScrollBar.cs: New scrollbars that don't take focus from
+ their container controls.
+ * TreeView.cs: Use the new implicit scrollbars.
+
+2005-12-02 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Make top_node internal so the TreeNodeCollections
+ can play with it.
+ * TreeNodeCollection.cs: If we remove the topnode we need to
+ update topnode to the next node in line.
+ - When clearing nodes go through the same process as removing
+ them, so they get depareneted and checked if they are top node.
+
+2005-12-01 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: When imagelists are used the image area is
+ selectable as well as the text.
+ - If there are no selected nodes select the first one.
+ * TreeNodeCollection.cs: Getting the TreeView is mildly expensive,
+ so don't do it more then we need to.
+
+2005-12-01 Jackson Harper <jackson@ximian.com>
+
+ * ThemeWin32Classic.cs: Reimplement the scroll arrow drawing so
+ that arrows can be scaled.
+
+2005-12-01 Jackson Harper <jackson@ximian.com>
+
+ * TreeNode.cs : Fixed bugs that caused FullPathTest + Traverse to
+ fail. Patch by Dieter Bremes
+
+2005-11-30 Jackson Harper <jackson@ximian.com>
+
+ * Form.cs: Property is 2.0 only
+ * PrintDialog.cs: Signature fix.
+
+2005-11-30 Peter Dennis Bartok <pbartok@novell.com>
+
+ * TextControl.cs:
+ - No longer artificially moves text 2 pixels down (now that we have
+ borders this is no longer needed)
+ - Added calcs for left, hanging and right indent
+
+2005-11-23 Mike Kestner <mkestner@novell.com>
+
+ * Menu.cs: mark MenuChanged internal, since it's not exposed by MS.
+
+2005-11-30 Jackson Harper <jackson@ximian.com>
+
+ * MdiChildContext.cs: Set the cloned menus forms, as these don't
+ get cloned as part of CloneMenu ().
+ * Menu.cs: Make sure the parent of the items get set correctly
+ when they are added. And the owners are notified of the changes.
+ * Form.cs: Create an ActiveMenu property, so that when MDI is used
+ we can change the menu being displayed/handled by the form without
+ changing the menu assosciated with the form.
+ - Don't let Mdi children draw/handle menus.
+
+2005-11-30 Jackson Harper <jackson@ximian.com>
+
+ * Menu.cs: Switch the MenuChanged method to OnMenuChanged and add
+ a MenuChanged event. Just to make the API a little more
+ consistent.
+ * MainMenu.cs:
+ * MenuItem.cs: Use the new OnMenuChanged
+ * MdiChildContext.cs: Handle menu merging.
+ * Form.cs: Implement MergedMenu.
+
+2005-11-30 Jackson Harper <jackson@ximian.com>
+
+ * Menu.cs: We were misusing Add. Add goes behind the specified
+ index according to the docs, and does not replace the specified
+ index. So I added an Insert method.
+
+2005-11-30 Peter Dennis Bartok <pbartok@novell.com>
+
+ * TextBoxBase.cs: Implemented Ctrl-Ins (Copy), Shift-Ins (Paste) and
+ Shift-Del (Cut), apparently Emacs uses these old Win 2.x keys. This
+ is for Jackson
+ * RichTextBox.cs: Added calls to base for DnD events
+
+2005-11-28 Peter Dennis Bartok <pbartok@novell.com>
+
+ * TextControl.cs:
+ - Fixed drag-selection related crash; style fixes
+ - Implemented undo class
+ o Implemented method to capture document state for specified
+ range in document tree
+ o Implemented method to restore captured document state
+ o Implemented cursor tracking
+ o Implemented basic undo stack
+ - Added undo cursor tracking to methods altering cursor location
+ - Added undo tracking to selection deletion (still missing
+ other text-altering hookups)
+ * RichTextBox.cs:
+ - Added SelectionLength property
+ - Implemented CanPaste()
+ - Implemented Paste()
+ - Added missing protected methods
+ - Fixed RTF->Document conversion; now uses font index 0 and color
+ index 0 as the default font for the parsed text
+ - Fixed RTF<->Document font size translation
+ - Fixed RTF generation, now properly handles cross-tag boundaries
+ for single line selection
+ - No longer always appends blank line to generated RTF
+ - Removed TODOs
+ - Added missing attributes
+ - Hooked up undo-related methods
+ * TextBoxBase.cs:
+ - Implemented Copy()
+ - Implemented Paste()
+ - Implemented Cut()
+ - Fixed caret mis-behaviour on backspace across line-boundaries
+
+2005-11-29 Jackson Harper <jackson@ximian.com>
+
+ * MdiClient.cs: Add a method for activating mdi children. Very
+ basic right now. I imagine someday it might need more girth.
+ * MenuItem.cs: Implement MDI lists. When mdilist is true the mdi
+ children windows names are added to the menu item.
+ * ThemeWin32Classic.cs: Draw the arrow if the item is an
+ mdilist. This happens regardless of whether or not there are any
+ mdi windows to see in the list, and according to my tests happens
+ before the items are even added. Also happens if there isn't even
+ an mdi client to get windows from.
+
+2005-11-29 Alexander Olk <alex.olk@googlemail.com>
+
+ * ThemeWin32Classic.cs: Make DrawFlatStyleRadioButton protected
+ * ThemeNice.cs: Fix drawing of flatstyle radiobuttons
+
+2005-11-29 Jordi Mas i Hernandez <jordimash@gmail.com>
+
+ * DataGridTableStyle.cs:
+ - Create always the styles for the missing columns even if they are
+ provided by the user (not default table style)
+ * DataGrid.cs:
+ - Fixes bug 76770
+ - Fixes SetDataBinding (always re-attach source)
+ - Fixes SetNewDataSource (only clear styles if they are not for
+ this source)
+ - Expands OnTableStylesCollectionChanged to handle style refresh
+ and remove properly
+
+2005-11-29 Jackson Harper <jackson@ximian.com>
+
+ * FileDialog.cs: Implement missing bits, remove some dead
+ code.
+ * FontDialog.cs: Implement missing Apply stuff, and ToString. Move
+ creation of the panel so that the options set on the dialog are
+ seen when the panel is created.
+ * TreeView.cs: raise a click when items are clicked.
+
+2005-11-29 Jackson Harper <jackson@ximian.com>
+
+ * MdiClient.cs: Pass some signature methods through to base.
+
+2005-11-28 Jackson Harper <jackson@ximian.com>
+
+ * ListView.cs: Raise the click event when items are clicked.
+
+2005-11-28 Jackson Harper <jackson@ximian.com>
+
+ * MdiClient.cs: Make this algorithm even more beautiful. And fix
+ a nullref.
+
+2005-11-27 Alexander Olk <alex.olk@googlemail.com>
+
+ * ThemeNice.cs: - Removed 1 pixel bitmaps
+ - Use SmoothingMode.AntiAlias where it makes sense
+ (ScrollButton arrow for example)
+ - Enhanced Button focus drawing
+ - Fixed ComboBox drawing (no artefacts anymore, focus
+ rectangle is back again, reduced size of ComboButton, etc.)
+ - Fixed RadioButton focus drawing for Appearence.Button
+ - Slight ScrollButton redesign
+ - Some LinearGradientBrush size fixes
+ - GroupBoxes have now rounded edges
+ - Fixed StatusBar drawing
+
+2005-11-25 Alexander Olk <alex.olk@googlemail.com>
+
+ * ThemeNice.cs: - Remove dead code
+ - use correct background colors for menus, etc.
+ - Fake pixel drawing with 1 pixel bitmaps
+
+2005-11-24 Jackson Harper <jackson@ximian.com>
+
+ * MdiClient.cs: Size the scrollbars when resizing the window.
+ - Resize the maximized windows when the client is resized
+ * Form.cs: Make the child context available
+
+2005-11-23 Jackson Harper <jackson@ximian.com>
+
+ * MdiChildContext.cs: Don't size windows if they are maximized.
+
+2005-11-23 Mike Kestner <mkestner@novell.com>
+
+ * ContextMenu.cs: use MenuTracker.
+ * Control.cs: remove menu handle usage.
+ * Form.cs: remove menu handle usage.
+ * Hwnd.cs: remove menu handle usage.
+ * MainMenu.cs: Draw method moved here from MenuAPI.DrawMenuBar. Proxy
+ motion and clicks to the new Tracker handlers.
+ * Menu.cs: add sizing accessors, SelectedItem prop, kill CreateItems
+ and handle usage.
+ * MenuAPI.cs: refactored to combine popup and menubar event handling.
+ Killed the MENU and MENUITEM data types and associated collections
+ since we now keep the info on Menu and MenuItem. Expanded TRACKER into
+ MenuTracker class that exposes the leftovers from the old MenuAPI
+ static methods. Restructured Capture handling so that only one grab is
+ done for the entire menu hierarchy instead of handing off grabs to
+ submenus. Tracker now has an invisible control to Capture when active.
+ * MenuItem.cs: add sizing accessors, kill Create
+ and handle usage.
+ * Theme.cs: remove menu handle and MENU(ITEM) usage.
+ * ThemeWin32Classic.cs: use Menu/MenuItem sizing props instead of
+ MENU(ITEM). remove menu handle usage, use Menu directly.
+ * XplatUIDriver.cs: remove menu handle usage.
+ * XplatUIOSX.cs: remove menu handle usage.
+ * XplatUIWin32.cs: remove menu handle usage.
+ * XplatUIX11.cs: remove menu handle usage.
+
+2005-11-22 Jackson Harper <jackson@ximian.com>
+
+ * Hwnd.cs: Don't compute the menu size for
+ DefaultClientRectangle.
+ - Reenable menu sizes being computed for GetClienRectangle.
+ * Form.cs: Remove comment of trechery
+
+2005-11-22 Jackson Harper <jackson@ximian.com>
+
+ * Hwnd.cs: The adjustments for the menu bar are made when it is
+ attached to the form.
+
+2005-11-19 Jackson Harper <jackson@ximian.com>
+
+ * XplatUIX11.cs: Create an HGRN of the invalid area for WM_NCPAINT
+ (just like on windows).
+
+2005-11-19 Jackson Harper <jackson@ximian.com>
+
+ * MdiChildContext.cs: Handle all the buttons ourselves. We can't
+ use real buttons anymore because they are in non client area. The
+ one TODO here is that I need to somehow invalidate a section of
+ the non client area.
+
+2005-11-18 Jackson Harper <jackson@ximian.com>
+
+ * Control.cs: Put the enum check back in now that MDI doesnt have
+ to use this to set border styles.
+ * Form.cs: Only set mdi child windows borders if the handle has
+ been created.
+ * MdiChildContext.cs: Don't set the InternalBorderStyle, just pass
+ this directly on to the driver.
+ - Get the move start position before adjusting for the titlebar
+ height, this fixes the windows "skipping" when they are first
+ moved.
+
+2005-11-18 Jackson Harper <jackson@ximian.com>
+
+ * XplatUIX11.cs: Just compute the mdi borders separately as they
+ don't totally match up with normal form borders.
+
+2005-11-18 Jackson Harper <jackson@ximian.com>
+
+ * Control.cs: Set WS_ styles for borders, so that the driver does
+ not have to retrieve the control instance to figure out what kind
+ of borders it should have.
+ * Form.cs: Set the WS_EX_MDICHILD flag on mdi children, so the
+ driver can know its an mdi child easily.
+ * XplatUIX11.cs: Get the border styles and whether the window is
+ MDI from the Styles and ExStyles params instead of having to get a
+ control. This prevents a chicken and egg problem.
+
+2005-11-18 Jackson Harper <jackson@ximian.com>
+
+ * MdiClient.cs: Fix typo so scrollbars show up correctly.
+
+2005-11-18 Jackson Harper <jackson@ximian.com>
+
+ * MdiClient.cs: Calculate when to add and remove scrollbars
+ correctly.
+ * MdiChildContext.cs: Adjust the y position to take the titlebar
+ into account.
+ - No height for FormBorderStyle.None
+
+2005-11-18 Jackson Harper <jackson@ximian.com>
+
+ * Control.cs: Allow non enum values to be used for
+ InternalBorderStyle. MDI does this to set a special border style.
+ - New utility methods for converting points to/from client coords
+ - Add the newly created control to the Controls collection before
+ updating its style. This way UpdateStyle can walk the control
+ heirarchy to find the control if needed.
+ so I don't need to create a new Point object all the time.
+ * Form.cs: Let MDI windows handle their border styles.
+ - Set styles on MDI windows so the correct title style is derived.
+ * MdiChildContext.cs: Move all the painting and window handling
+ into the non client area.
+ - Use correct sizing and put correct buttons on frames based on
+ the FormBorderStyle.
+ - Notify the mdi client about scrolling
+ - Need to handle the buttons ourselves now, because they are all
+ in non client areas and we can't add controls there.
+ * MdiClient.cs: Halfway to scrolling, this implementation is
+ somewhat broken though, we need to check to make sure other
+ windows aren't causing scrolling before removing the bars. Also
+ the bars need to be drawn on top, maybe I can switch implicit
+ controls to be on top.
+ * Hwnd.cs: caption_height and tool_caption_height are now
+ properties of an hwnd, this way they can be set by the driver
+ based on the type of window they are. In X11 the window manager
+ handles the decorations so caption_height is zero unless its an
+ MDI window.
+ - Add 3 pixel borders for MDI windows (0xFFFF).
+ - Get rid of some code duplication, have DefaultClientRectanle
+ just call GetClientRectangle.
+ * XplatUIX11.cs: Pass caption_height and tool_caption_height to
+ Hwnd now.
+ - Set border styles differently for mdi windows.
+ * XplatUIOSX.cs: Pass caption_height and tool_caption_height to
+ Hwnd now.
+
+2005-11-15 Mike Kestner <mkestner@novell.com>
+
+ * Menu.cs: when adding an item to the collection, if item is already
+ parented, remove it from the parent.
+
+2005-11-13 Alexander Olk <alex.olk@googlemail.com>
+
+ * X11DesktopColors.cs: Added KDE support
+
+2005-11-11 Peter Dennis Bartok <pbartok@novell.com>
+
+ * XplatUIWin32.cs:
+ - Clipboard methods now can translate Rtf format
+ - No longer removes clipboard contents whenever a new format is added
+ to allow placing multiple formats on the clipboard
+ * Clipboard.cs: Clipboard now supports getting a IDataObject and
+ will place all formats contained in it onto the clipboard. Also
+ now cleans the clipboard before placing a new object onto it
+ * RichTextBox.cs:
+ - Implemented set_Rtf
+ - Implemented set_SelectedRtf
+ - Created InsertRTFFromStream() method to allow single code base
+ for all properties and methods that insert RTF into document
+ - Removed debug output
+ * TextControl.cs:
+ - Fixed Delete(int) to fix up line numbers
+ - Fixed ReplaceSelection to combine start and end line
+ - Fixed serious DeleteChars bug that would leave the document tree
+ broken
+ - Improved DumpTree with several logic checks to detect broken
+ document trees
+ - Removed debug lines
+ - Fixed Caret.WordForward/WordBack moving code, now always also
+ updates caret.tag (fixes crash when word-selecting across tag
+ boundaries via keyboard)
+ - Added Insert() method for inserting multiline text into documents
+ - Fixed DeleteChars() calculation errors that would cause a broken
+ tag chain with multiple tag lines
+ - DeleteChars() no longer crashes on multi-tag lines if not all tags
+ - Split() no longer moves caret if split is at caret location
+ - ReplaceSelection() now updates the cursor and re-displays it
+ - ReplaceSelection() now uses new Insert() method to avoid code
+ duplication
+ - FormatText() can now handle formatting partial lines
+ * TextBoxBase.cs:
+ - Append now uses new TextControl.Insert() method (this avoids
+ duplicate code)
+ - Implemented Ctrl-X (Cut) (
+ - Implemented Ctrl-C (Copy)
+ - Implemented Ctrl-V (Paste) (Still some bugs related to screen
+ regeneration when pasting text; roundtripping Copy&Paste within
+ edit control still fails due to some calculation bugs in GenerateRTF)
+ - The Delete key will now remove the current selection if it is visible
+ * TextBox.cs: Removed debug lines
+ * XplatUI.cs: Trigger initialization of DataFormats (which requires the
+ driver to be initialized and can't therefore be done via a static ctor)
+
+2005-11-10 Peter Dennis Bartok <pbartok@novell.com>
+
+ * TextControl.cs: Added backend code for finding char arrays and strings
+ * TextBoxBase.cs:
+ - Added mouse wheel scroll support
+ - Added support for VScroll and HScroll events
+ * RichTextBox.cs:
+ - Implemented all seven Find() variants
+ - Implemented GetCharFromPosition()
+ - Implemented GetCharIndexFromPosition()
+ - Implemented GetLineFromIndex()
+ - Implemented GetPositionFromCharIndex();
+ - Implemented SaveFile for PlainText and UnicodeText
+ - Fixed set_Font, now setting a new font applies that font to
+ the whole document
+ - Implemented generic Document to RTF converter
+ - Implemented SaveFile for RichText format (still missing unicode
+ conversion for non-ansi chars)
+ - Implemented get_Rtf
+ - Implemented get_SelectedRtf
+
+2005-11-09 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Control.cs (WndProc): Call HandleClick after having sent OnMouseUp
+ to allow any captures to be released before triggering OnClick. This
+ way a click handler may capture the mouse without interference.
+ * XplatUIX11.cs: Always send mouse messages to grab window if one exists.
+ This way we send them even though X may not allow a grab (if the window
+ isn't visible, for example)
+
+2005-11-08 Pedro Martinez Julia <pedromj@gmail.com>
+
+ * DataGridViewRowEventArgs.cs: DataGridView implementation
+ * DataGridViewElement.cs: DataGridView implementation
+ * DataGridViewComboBoxCell.cs: DataGridView implementation
+ * DataGridViewDataErrorContexts.cs: DataGridView implementation
+ * DataGridViewCellErrorTextNeededEventArgs.cs: DataGridView implementation
+ * DataGridViewColumnHeadersHeightSizeMode.cs: DataGridView implementation
+ * ImageLayout.cs: DataGridView implementation
+ * DataGridViewComboBoxColumn.cs: DataGridView implementation
+ * DataGridViewCellMouseEventHandler.cs: DataGridView implementation
+ * DataGridViewSelectionMode.cs: DataGridView implementation
+ * IDataGridViewEditingControl.cs: DataGridView implementation
+ * DataGridViewSortCompareEventHandler.cs: DataGridView implementation
+ * DataGridViewCellStyleContentChangedEventHandler.cs: DataGridView implementation
+ * DataGridViewAutoSizeModeEventHandler.cs: DataGridView implementation
+ * DataGridViewColumnStateChangedEventHandler.cs: DataGridView implementation
+ * DataGridViewColumnSortMode.cs: DataGridView implementation
+ * DataGridView.cs: DataGridView implementation
+ * DataGridViewRowStateChangedEventHandler.cs: DataGridView implementation
+ * DataGridViewRowPostPaintEventArgs.cs: DataGridView implementation
+ * DataGridViewDataErrorEventArgs.cs: DataGridView implementation
+ * Padding.cs: DataGridView implementation
+ * DataGridViewCellParsingEventArgs.cs: DataGridView implementation
+ * DataGridViewCellStateChangedEventHandler.cs: DataGridView implementation
+ * DataGridViewRowEventHandler.cs: DataGridView implementation
+ * DataGridViewCellPaintingEventHandler.cs: DataGridView implementation
+ * DataGridViewCellFormattingEventHandler.cs: DataGridView implementation
+ * DataGridViewButtonCell.cs: DataGridView implementation
+ * DataGridViewCellStyleContentChangedEventArgs.cs: DataGridView implementation
+ * DataGridViewEditMode.cs: DataGridView implementation
+ * DataGridViewCellValueEventArgs.cs: DataGridView implementation
+ * DataGridViewRowCancelEventArgs.cs: DataGridView implementation
+ * DataGridViewRowHeadersWidthSizeMode.cs: DataGridView implementation
+ * DataGridViewCheckBoxColumn.cs: DataGridView implementation
+ * DataGridViewCellToolTipTextNeededEventHandler.cs: DataGridView implementation
+ * DataGridViewAutoSizeColumnsMode.cs: DataGridView implementation
+ * DataGridViewCellEventHandler.cs: DataGridView implementation
+ * DataGridViewEditingControlShowingEventHandler.cs: DataGridView implementation
+ * DataGridViewCellStyleConverter.cs: DataGridView implementation
+ * DataGridViewSelectedRowCollection.cs: DataGridView implementation
+ * DataGridViewBindingCompleteEventHandler.cs: DataGridView implementation
+ * DataGridViewColumnEventArgs.cs: DataGridView implementation
+ * DataGridViewRowHeightInfoPushedEventHandler.cs: DataGridView implementation
+ * DataGridViewRowContextMenuStripNeededEventHandler.cs: DataGridView implementation
+ * QuestionEventArgs.cs: DataGridView implementation
+ * IDataGridViewEditingCell.cs: DataGridView implementation
+ * DataGridViewTriState.cs: DataGridView implementation
+ * DataGridViewColumnDesignTimeVisibleAttribute.cs: DataGridView implementation
+ * DataGridViewCellStateChangedEventArgs.cs: DataGridView implementation
+ * DataGridViewColumnCollection.cs: DataGridView implementation
+ * DataGridViewCellValueEventHandler.cs: DataGridView implementation
+ * DataGridViewRowDividerDoubleClickEventHandler.cs: DataGridView implementation
+ * DataGridViewCellFormattingEventArgs.cs: DataGridView implementation
+ * DataGridViewColumn.cs: DataGridView implementation
+ * DataGridViewCellBorderStyle.cs: DataGridView implementation
+ * DataGridViewCellContextMenuStripNeededEventHandler.cs: DataGridView implementation
+ * DataGridViewCellValidatingEventArgs.cs: DataGridView implementation
+ * DataGridViewRow.cs: DataGridView implementation
+ * DataGridViewImageCellLayout.cs: DataGridView implementation
+ * DataGridViewImageCell.cs: DataGridView implementation
+ * DataGridViewTopLeftHeaderCell.cs: DataGridView implementation
+ * DataGridViewCheckBoxCell.cs: DataGridView implementation
+ * DataGridViewHeaderCell.cs: DataGridView implementation
+ * DataGridViewCellErrorTextNeededEventHandler.cs: DataGridView implementation
+ * DataGridViewRowHeightInfoPushedEventArgs.cs: DataGridView implementation
+ * DataGridViewAutoSizeColumnsModeEventHandler.cs: DataGridView implementation
+ * DataGridViewTextBoxColumn.cs: DataGridView implementation
+ * QuestionEventHandler.cs: DataGridView implementation
+ * DataGridViewCellStyleScopes.cs: DataGridView implementation
+ * DataGridViewSortCompareEventArgs.cs: DataGridView implementation
+ * DataGridViewCellContextMenuStripNeededEventArgs.cs: DataGridView implementation
+ * DataGridViewCell.cs: DataGridView implementation
+ * DataGridViewCellEventArgs.cs: DataGridView implementation
+ * DataGridViewClipboardCopyMode.cs: DataGridView implementation
+ * DataGridViewCellStyle.cs: DataGridView implementation
+ * DataGridViewColumnHeaderCell.cs: DataGridView implementation
+ * DataGridViewRowPrePaintEventHandler.cs: DataGridView implementation
+ * DataGridViewRowCancelEventHandler.cs: DataGridView implementation
+ * TextFormatFlags.cs: DataGridView implementation
+ * DataGridViewCellToolTipTextNeededEventArgs.cs: DataGridView implementation
+ * DataGridViewDataErrorEventHandler.cs: DataGridView implementation
+ * DataGridViewAdvancedCellBorderStyle.cs: DataGridView implementation
+ * DataGridViewCellPaintingEventArgs.cs: DataGridView implementation
+ * DataGridViewButtonColumn.cs: DataGridView implementation
+ * DataGridViewRowsRemovedEventArgs.cs: DataGridView implementation
+ * HandledMouseEventArgs.cs: DataGridView implementation
+ * DataGridViewCellParsingEventHandler.cs: DataGridView implementation
+ * DataGridViewColumnDividerDoubleClickEventHandler.cs: DataGridView implementation
+ * DataGridViewCellMouseEventArgs.cs: DataGridView implementation
+ * DataGridViewAutoSizeRowsMode.cs: DataGridView implementation
+ * DataGridViewRowCollection.cs: DataGridView implementation
+ * DataGridViewAdvancedBorderStyle.cs: DataGridView implementation
+ * DataGridViewCellCancelEventHandler.cs: DataGridView implementation
+ * DataGridViewHitTestType.cs: DataGridView implementation
+ * DataGridViewAutoSizeModeEventArgs.cs: DataGridView implementation
+ * DataGridViewColumnStateChangedEventArgs.cs: DataGridView implementation
+ * DataGridViewColumnEventHandler.cs: DataGridView implementation
+ * DataGridViewRowDividerDoubleClickEventArgs.cs: DataGridView implementation
+ * DataGridViewAutoSizeRowMode.cs: DataGridView implementation
+ * DataGridViewRowHeightInfoNeededEventArgs.cs: DataGridView implementation
+ * DataGridViewRowsDeletedEventArgs.cs: DataGridView implementation
+ * DataGridViewTextBoxEditingControl.cs: DataGridView implementation
+ * DataGridViewContentAlignment.cs: DataGridView implementation
+ * DataGridViewRowPostPaintEventHandler.cs: DataGridView implementation
+ * DataGridViewComboBoxEditingControl.cs: DataGridView implementation
+ * DataGridViewCellValidatingEventHandler.cs: DataGridView implementation
+ * DataGridViewSelectedColumnCollection.cs: DataGridView implementation
+ * DataGridViewPaintParts.cs: DataGridView implementation
+ * DataGridViewCellCollection.cs: DataGridView implementation
+ * DataGridViewRowsAddedEventArgs.cs: DataGridView implementation
+ * DataGridViewImageColumn.cs: DataGridView implementation
+ * DataGridViewRowsRemovedEventHandler.cs: DataGridView implementation
+ * DataGridViewElementStates.cs: DataGridView implementation
+ * DataGridViewRowHeightInfoNeededEventHandler.cs: DataGridView implementation
+ * DataGridViewColumnDividerDoubleClickEventArgs.cs: DataGridView implementation
+ * DataGridViewRowPrePaintEventArgs.cs: DataGridView implementation
+ * DataGridViewRowStateChangedEventArgs.cs: DataGridView implementation
+ * DataGridViewEditingControlShowingEventArgs.cs: DataGridView implementation
+ * DataGridViewCellCancelEventArgs.cs: DataGridView implementation
+ * DataGridViewRowHeaderCell.cs: DataGridView implementation
+ * DataGridViewBindingCompleteEventArgs.cs: DataGridView implementation
+ * DataGridViewTextBoxCell.cs: DataGridView implementation
+ * DataGridViewBand.cs: DataGridView implementation
+ * DataGridViewAutoSizeColumnModeEventArgs.cs: DataGridView implementation
+ * DataGridViewHeaderBorderStyle.cs: DataGridView implementation
+ * DataGridViewRowsAddedEventHandler.cs: DataGridView implementation
+ * DataGridViewAutoSizeColumnMode.cs: DataGridView implementation
+ * DataGridViewAutoSizeColumnModeEventHandler.cs: DataGridView implementation
+ * DataGridViewAutoSizeColumnsModeEventArgs.cs: DataGridView implementation
+ * DataGridViewRowErrorTextNeededEventHandler.cs: DataGridView implementation
+ * DataGridViewSelectedCellCollection.cs: DataGridView implementation
+ * DataGridViewRowContextMenuStripNeededEventArgs.cs: DataGridView implementation
+ * DataGridViewRowErrorTextNeededEventArgs.cs: DataGridView implementation
+ * DataGridViewComboBoxDisplayStyle.cs: DataGridView implementation
+
+2005-11-08 Peter Dennis Bartok <pbartok@novell.com>
+
+ * ThemeWin32Classic.cs:
+ - Draw the outside focus rectangle around buttons
+ - Use CPDrawFocusRectangle to draw focus rectangles until Cairo
+ doesn't use end caps for every dash of a line anymore. This
+ workaround ignores the forecolor.
+
+2005-11-08 Kornél Pál <kornelpal@hotmail.com>
+
+ * ImageList.cs: Don't use ArgbColor with LayoutKind.Explicit as it isn't
+ endian safe.
+
+2005-11-07 Jackson Harper <jackson@ximian.com>
+
+ * X11Dnd.cs: Set the X/Y positions on the DragEventArgs correctly.
+
+2005-11-07 Jackson Harper <jackson@ximian.com>
+
+ * ScrollableControl.cs: Calculate the maximum and change vars
+ (more) correctly so that scrollbars appear as a sensible size.
+
+2005-11-04 Jackson Harper <jackson@ximian.com>
+
+ * TreeNodeCollection.cs: Refresh when nodes are cleared from the
+ collection.
+ * TreeView.cs: When the tree is sorted null out the top_node so
+ that it is recalculated.
+ - Use dotted lines instead of dashed lines to match MS better.
+
+2005-11-04 Jordi Mas i Hernandez <jordimash@gmail.com>
+
+ * ListView.cs:
+ - Implements key search for items. Useful when browsing files with FileDialog
+ - When changing view mode or when clear the items reset scrollbar positions
+
+2005-11-04 Jackson Harper <jackson@ximian.com>
+
+ * CurrencyManager.cs: Implement the MetaDataChanged event, the
+ Reset method, and the CheckEmpty. CheckEmpty is just a total guess
+ as to what the method may do as there is no real way of creating a
+ derived CurrencyManager and calling the method.
+
+2005-11-03 Jackson Harper <jackson@ximian.com>
+
+ * ThemeWin32Classic.cs: Implement ownerdrawing in the tab control
+ * TabControl.cs: Add Ownerdrawing bits, add the UpdateTabSelection
+ method which seems to just be used internally to refresh the tabs.
+
+2005-11-03 Jackson Harper <jackson@ximian.com>
+
+ * TabControl.cs: Implement the remove method. Fix some broken
+ comments.
+
+2005-11-03 Peter Dennis Bartok <pbartok@novell.com>
+
+ * DateTimePicker.cs:
+ - Added missing DateTimePickerAccessibleObject class
+ - Added missing events
+ - Added OnFontChanged method
+ * Form.cs: Added missing attributes
+ * TreeView.cs: Added missing attributes
+
+2005-11-03 Peter Dennis Bartok <pbartok@novell.com>
+
+ * GridItemCollection.cs: Fix signatures
+
+2005-11-03 Peter Dennis Bartok <pbartok@novell.com>
+
+ * XplatUI.cs: Updated build rev/date
+ * ComboBox.cs, DataGridTextBoxColumn.cs Control.cs,
+ DataGridTableStyle.cs, DataGrid.cs, DateTimePicker.cs: Signature fixes
+ * Application.cs: Trigger context-specific ExitThread events
+
+2005-11-03 Jackson Harper <jackson@ximian.com>
+
+ * Menu.cs:
+ * MainMenu.cs:
+ * GridTableStylesCollection.cs:
+ * Timer.cs:
+ * TabPage.cs:
+ * HelpProvider.cs:
+ * StatusBar.cs:
+ * MonthCalendar.cs: Signature fixes
+
+2005-11-03 Jackson Harper <jackson@ximian.com>
+
+ * TreeNodeCollection.cs: Remove should not be virtual.
+ * TreeView.cs: Implement the last of the missing methods.
+
+2005-11-03 Jackson Harper <jackson@ximian.com>
+
+ * TreeNodeConverter.cs: Implement to get off my class-status back.
+
+2005-11-03 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Hookup the bits for drag and drop.
+ * TreeNode.cs: Don't cache the tree_view or index anymore, now
+ that nodes can be moved from tree to tree easily this just causes
+ all sorts of problems.
+ * TreeNodeCollection: Don't need to give treenodes an index and
+ treeview anymore when they are added, these are computed on the
+ fly. Also make sure to remove a node before its added.
+
+2005-11-03 Peter Dennis Bartok <pbartok@novell.com>
+
+ * TextControl.cs:
+ - Added CaretSelection enum
+ - Added comparison methods to Marker struct, makes selection code
+ more readable
+ - Added SelectionStart and SelectionEnd as 'moveable' location for
+ the CaretDirection enum and handler
+ - Added selection_prev variable to track optimized invalidation for
+ word and line selection
+ - Added SelectionVisible property (returns true if there is a valid
+ selection)
+ - Switched CaretHasFocus to only display the caret if there is no
+ visible selection
+ - Avoiding StringBuilder.ToString to retrieve a single char, instead
+ using the direct character index; should be much faster
+ - Added various conditional debug statements
+ - Fixed invalidation calculation for selection ranges
+ - Added ExpandSelection() method to support word and line selection
+ - Switched SetSelectionToCaret to use new Marker compare overloads
+ - Added central IsWordSeparator() method to determine word
+ separators/whitespace and FindWordSeparator() to streamline common
+ usage of IsWordSeparator()
+ * TextBoxBase.cs:
+ - Removed unneeded grabbed variable, it was just mirroring
+ Control.Capture
+ - No longer firing OnTextChanged event when Text setter is called,
+ since the base will fire the event for us
+ - Added handling of Ctrl-Up/Down selection
+ - Added handling of Shift-Cursorkey selection
+ - Added handling for Ctrl-Delete and Ctrl-Backspace to remove
+ words
+ - Added handling of Shift and Ctrl-Shift-Home/End selection
+ - Removed some debug output
+ - Added handling for single/double/tripple-click to place caret/
+ select word/select line respectively (Fixes bug #76031)
+ - Added support for drag expansion of word/line selection
+ * RichTextBox.cs: Handle GotFocus event to trigger redrawing of
+ current selection
+
+2005-11-02 Jackson Harper <jackson@ximian.com>
+
+ * X11Dnd.cs: If the drag is going to and from a MWF window just
+ copy the data instead of sending it out through the X Selection
+ mechanism.
+
+2005-11-02 Jackson Harper <jackson@ximian.com>
+
+ * X11Dnd.cs:
+ * XplatUIX11.cs: When in a drag we don't want motion notify
+ messages to get passed on to the other controls. This prevents
+ mouse move messages from showing up in the drag source.
+
+2005-11-02 Jackson Harper <jackson@ximian.com>
+
+ * X11Dnd.cs: Remove unneeded call to XAllowEvents. Make sure that
+ the correct button is release to end a drag.
+ * XplatUIX11.cs: Make the button state internal so the drag system
+ can access it. Dragging needs to know about all button releases,
+ not just left button.
+
+2005-11-02 Miguel de Icaza <miguel@novell.com>
+
+ * Form.cs (Icon): If the icon is null, reset the icon to the
+ default value.
+
+ * Cursor.cs: When writing the AND-mask bitmap do not include the
+ number of colors, but hardcode those to two (black and white),
+ fixes the loading of color cursors (Paint Dot Net).
+
+ * Form.cs: To debug, allow MONO_MWF_SCALING=disable variable to
+ turn off autoscaling.
+
+ * Cursor.cs: Allow resource type to be 1 or 2 (from ImageMagic).
+
+2005-11-02 Jackson Harper <jackson@ximian.com>
+
+ * X11Dnd.cs: Make sure to send a status message if the pointer
+ enters a control that can not accept a drop, otherwise the cursor
+ isn't updated correctly. Also tried to compress the lines of code
+ a bit.
+
+2005-11-02 Jackson Harper <jackson@ximian.com>
+
+ * X11Dnd.cs: Change cursors based on drag action. Also attempt to
+ set actions correctly. This isn't perfect as XDND and win32 have
+ some differences on how you allow actions. I'll clear this up by
+ adding a path for drag from MWF to MWF windows.
+ * XplatUIX11.cs: Hook into the dnd system.
+
+2005-11-02 Jordi Mas i Hernandez <jmas@softcatala.org>
+
+ * ListView.cs: Fixes scroll bar visibility. Hide them if they were
+ previously shown but they are no longer need it. Very obvious when
+ browsing files with FileDialog.
+
+2005-11-01 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Control.cs: We always need to call OnPaintBackground. We pretty much
+ ignore AllPaintingInWmPaint and always do the painting there, whether
+ it's set or not, since we always ignore the WM_ERASEBKGND message
+ (which we don't generate on X11). This fixes #76616.
+ * Panel.cs: Removed unneeded background painting. This happens properly
+ in Control.cs already
+
+2005-10-31 Mike Kestner <mkestner@novell.com>
+
+ * Menu.cs: Add items to collection before setting their index.
+ * MenuItem.cs : add range checking with ArgumentException like MS.
+ [Fixes #76510]
+
+2005-10-31 Jackson Harper <jackson@ximian.com>
+
+ * ListBox.cs: Invalidate if the area is visible at all not just
+ contained in the visible rect. Fixes unselection of semi visible
+ items.
+
+2005-10-31 Jackson Harper <jackson@ximian.com>
+
+ * Control.cs: Consistently name the dnd methods. Make them
+ internal so we can override them to match some MS behavoir
+ internally.
+ * Win32DnD.cs: Use the new consistent names.
+
+2005-10-31 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Don't draw the selected node when we lose focus.
+
+2005-10-31 Jackson Harper <jackson@ximian.com>
+
+ * X11Dnd.cs: We still need to reset the state even though a full
+ reset isn't being done, otherwise status's still get sent all over
+ the place.
+
+2005-10-31 Jackson Harper <jackson@ximian.com>
+
+ * Control.cs: Make the dnd_aware flag internal so the dnd
+ subsystem can check it. Catch exceptions thrown in dnd handlers to
+ match MS behavoir.
+ * Hwnd.cs: Add a flag for whether or not a window is dnd aware.
+ * X11Dnd.cs: Handle null data in the converters. Set the XDND
+ version when sending a XdndEnter. Use the control/hwnd dnd_aware
+ flags to reduce the number of dnd enters/status's sent.
+
+2005-10-31 Jackson Harper <jackson@ximian.com>
+
+ * X11Dnd.cs: Don't need the sizeof here. Patch by Jordi Mas.
+
+2005-10-31 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * PictureBox.cs: Fixes 76512
+
+2005-10-28 Jackson Harper <jackson@ximian.com>
+
+ * X11Dnd.cs: Early implementation to support winforms being a drag
+ source for data on X11. Also restructured the converters so they
+ can go both ways now.
+ * XplatUIX11.cs: Tie ins to the the Dnd stuff.
+
+2005-10-27 Peter Dennis Bartok <pbartok@novell.com>
+
+ * XplatUIX11.cs: Fixed FIXME - implemented ASCII encoding for XA_STRING
+ clipboard requests
+
+2005-10-27 Jackson Harper <jackson@ximian.com>
+
+ * TreeNode.cs: Implement serialization so my DnD examples will work.
+
+2005-10-24 Kornél Pál <kornelpal@hotmail.com>
+
+ * ButtonBase.cs, ListView.cs, NotifyIcon.cs, PictureBox.cs, ToolBar.cs,
+ TreeView.cs: Don't dispose objects that are not owned.
+
+2005-10-24 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Cursor.cs: Defaulting the Current cursor to Cursors.Default. We
+ should retrieve the current cursor and report that, but XplatUI
+ doesn't (yet) have an interface for that (and I'm not sure I even
+ can, on X11)
+ * XplatUIWin32.cs: Fixed override behaviour. The override is temporary,
+ until any message loop processing is done (and the WM_SETCURSOR
+ replaces the cursor to the proper one)
+ * XplatUIX11.cs:
+ - Fixed override behaviour, we can't set the cursor globally on X11,
+ just for our windows.
+ - Invalidating the System.Drawing X11 display handle when we are
+ shutting down
+ * Control.cs: Fix to make csc happy
+
+2005-10-23 Peter Dennis Bartok <pbartok@novell.com>
+
+ * TextBoxBase.cs:
+ - get_Text: Add last line (without trailing newline) to returned
+ value (Fixes 76212)
+ - get_TextLength: Count last line in returned length
+ - ToString: Call Text property instead of duplicating code
+
+2005-10-23 Kornél Pál <kornelpal@hotmail.com>
+
+ * ImageList.cs: Dispose ImageAttributes objects.
+
+2005-10-22 Kornél Pál <kornelpal@hotmail.com>
+
+ * ImageList.cs: Use attribute constructors with less arguments where
+ possible.
+
+2005-10-22 Kornél Pál <kornelpal@hotmail.com>
+
+ * ImageList.cs: Added lastKeyIndex field and use in IndexOfKey.
+ Use typeof instead of strings when assembly is referenced. Added
+ some more comments.
+
+2005-10-21 Jackson Harper <jackson@ximian.com>
+
+ * ListView.cs: Raise a double click event. Also tried to somewhat
+ fix when the selectedindexchanged event is raised. Its still
+ broken though.
+
+2005-10-21 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: New method to invalidate the plus minus area of a
+ node without invalidating the whole node (maybe this can be used
+ in some more places).
+ * TreeNodeCollection.cs: When adding to an empty node we need to
+ invalidate its plus minus area so the little block shows up.
+
+2005-10-21 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Make sure that when we invalidate a node the bounds
+ are big enough to cover the selected box and the focus
+ rectangle. Use a different colour for the lines connecting nodes
+ so they show up with all themes.
+
+2005-10-21 Peter Dennis Bartok <pbartok@novell.com>
+
+ * NativeWindow.cs: Don't call anything that could call into the driver,
+ we might be on a different thread.
+
+2005-10-21 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Control.cs(Dispose): Since Dispose might run on a different thread,
+ make sure that we call methods that could call into the driver via
+ invoke, to avoid thread issues
+
+2005-10-21 Peter Dennis Bartok <pbartok@novell.com>
+
+ * XplatUI.cs: Removed finalizer
+ * XplatUIX11.cs: Removed Destructor, was causing crashes due to X11
+ not allowing to be called on the finalizer thread.
+
+2005-10-21 Kornél Pál <kornelpal@hotmail.com>
+
+ * ImageList.cs:
+ - Reverted r51889 and r51891.
+ - Added ImageListItem class that stores unmodified image items and image
+ properties required to create list images until handle is created.
+ - Added AddItem and moved image creation logic to AddItemInternal.
+ - Added CreateHandle method that creates images based on unmodified items.
+ - Added DestroyHandle that changes state to store unmodified items.
+ - Add and AddStrip methods no more create handle.
+ - ReduceColorDepth has no return value.
+ - Dispose destroys handle.
+ - Modified other methods to reflect the above changes.
+ - Implemented key support.
+ - Added profile 2.0 members and attributes.
+ - Added private Reset and ShouldSerialize methods that provide the same
+ behavior as MS.NET but the Visual Studio .NET designer seems to ignore
+ them as they are private.
+ - Added some more comments about implementation details.
+
+2005-10-21 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * DataGrid.cs: Adds support for vertical scrolling using the mousewheel
+
+2005-10-21 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * Binding.cs: No PushData/PullData if there is no binding (fixes crash)
+
+2005-10-21 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * DataGridDrawingLogic.cs: Fixes column hit calcultation
+ * DataGridColumnStyle.cs: Remove debug message
+
+2005-10-20 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: We can always get input keys regardless of whether
+ or not editing is enabled. They are used for navigation.
+
+2005-10-20 Jackson Harper <jackson@ximian.com>
+
+ * TreeNode.cs: Use the viewport rect for determining if a node
+ needs to be moved for visibility. Don't use Begin/End edit. This
+ calls a full refresh when its done.
+ * TreeView.cs: New SetBottom works correctly. Make the viewport
+ rect property internal so the treenodes can see it. When clicking
+ on a node we need to ensure that its visible because it might just
+ be partly visible when clicked.
+
+2005-10-20 Jackson Harper <jackson@ximian.com>
+
+ * TreeNodeCollection.cs: Remove debug code.
+
+2005-10-20 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * Datagrid.cs: Implements column sorting in Datagrid
+ * DataGridColumnStyle.cs: Implements column sorting in Datagrid
+
+2005-10-20 Jackson Harper <jackson@ximian.com>
+
+ * TreeNodeCollection.cs: Remove items properly. Update the correct
+ area after removing them.
+
+2005-10-20 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * Datagrid.cs: Should not call base.OnPaintBackground
+
+2005-10-20 Peter Dennis Bartok <pbartok@novell.com>
+
+ * XplatUIX11.cs (GetMessage):
+ - Now properly calculates NC_xBUTTONDOWN coordinates off the whole
+ window instead of client window
+ - Now properly calculates NC_xBUTTONUP message coordinates
+ - ScreenToMenu now properly calculates it's coordinates of whole
+ window, since menus are in the whole window, not in the client
+ window
+ - Added WholeToScreen coordinate translation method
+
+2005-10-20 Peter Dennis Bartok <pbartok@novell.com>
+
+ * XplatUIX11.cs (GetMessage): Don't return in situations where we don't
+ want to return a message, loop back to the beginning of the function
+ and grab the next real message to process instead.
+
+2005-10-20 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Splitter.cs: Properly set limits if no filler control is used
+
+2005-10-19 Jackson Harper <jackson@ximian.com>
+
+ * ColorDialog.cs: Don't show the help button if it is not enabled
+ instead of disabling it (this is what MS does). Don't create the
+ panel until the dialog is run, otherwise the vars (such as
+ ShowHelp) are not set yet.
+
+2005-10-19 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Implement Begin/EndEdit more correctly so refreshes
+ are reduced when adding nodes.
+ * TreeNode.cs:
+ * TreeNodeCollection.cs: Use UpdateNode instead of refreshing the
+ tree.
+
+2005-10-19 Jackson Harper <jackson@ximian.com>
+
+ * FolderBrowserDialog.cs: End editing our treeview so the window
+ actually gets refreshed.
+
+2005-10-18 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Control.cs: Fixed logic flip on when to call OnPaintBackground.
+ Obsoleted handling of WM_ERASEBKGND, now always draws our background
+ inside of WM_PAINT
+
+2005-10-18 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * MenuAPI.cs: Returns after Hidding window
+ * XplatUIX11.cs: Added TODO found while debugging menu issues
+
+2005-10-18 Peter Dennis Bartok <pbartok@novell.com>
+
+ * XplatUIX11.cs: Do not re-map the whole window when it's size
+ becomes non-zero unless it's supposed to be actually visible
+
+2005-10-18 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: We don't need to keep a count anymore.
+ * TreeNodeCollection.cs: Fix off by one in RemoveAt, Insert can
+ use the Grow method.
+
+2005-10-18 Jackson Harper <jackson@ximian.com>
+
+ * TreeNodeCollection.cs: Insert is not supported on arrays, so
+ implement it manually here.
+
+2005-10-18 Jackson Harper <jackson@ximian.com>
+
+ * ImageList.cs: Dont kill the list when the colour depth is
+ changed, just change the colour depth of all the images.
+ - Same goes for setting the image size. Just resize them all
+ instead of killing the list softly.
+
+2005-10-18 Jackson Harper <jackson@ximian.com>
+
+ * Control.cs: Don't invalidate empty rectangles.
+
+2005-10-18 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ListViewItem.cs:
+ - Adds checked item to the Checked/Item lists (where empty before)
+ - Do not add items to the Selected lists if they are already present
+ * ListView.cs:
+ - Fixes IsFixedSize, SyncRoot, IsReadOnly in many collections
+ - When deleting items make sure that we delete them for the Selected
+ and Checked list also.
+
+2005-10-18 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * Label.cs: Dispose objects no longer used
+ * ThemeWin32Classic.cs: Dispose objects no longer used
+
+2005-10-18 Jackson Harper <jackson@ximian.com>
+
+ * TabControl.cs: Don't refresh the whole control when the tabs are
+ scrolled, we just need to refresh the tab area.
+
+2005-10-17 Jackson Harper <jackson@ximian.com>
+
+ * XplatUIX11.cs: Compress code a little bit. Only calculate the
+ after handle when we need it.
+
+2005-10-17 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Control.cs: When the parent size changes, recalculate anchor
+ positions. Partial fix for #76462
+
+2005-10-17 Peter Dennis Bartok <pbartok@novell.com>
+
+ * ThemeWin32Classic.cs: Make sure the picturebox has it's background
+ drawn. Fixes #76462
+
+2005-10-17 Jackson Harper <jackson@ximian.com>
+
+ * MonthCalendar.cs: Don't create the numeric up down until our
+ handle is created. Otherwise our handle is created in the
+ constructor and we don't know if we are a WS_CHILD or WS_POPUP
+ yet.
+
+2005-10-17 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Merge in patch by Rafael Teixeira to align strings
+ correctly.
+
+2005-10-17 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
+ * TreeNode.cs : small logical fix (was using local var instead of field)
+
+2005-10-17 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ThemeWin32Classic.cs: Fixes vert/horz scrollbar colours
+
+2005-10-17 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ThemeWin32Classic.cs: Fixes focus drawing in for non-flat/popup buttons
+
+2005-10-16 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Control.cs:
+ - Re-implemented anchoring code. My first version was really broken.
+ This fixes bug #76033. Unlike the previous implementation we will
+ no longer have round errors since all numbers are calculated from
+ scratch every time. Removed various anchor-related obsolete vars.
+ - InitLayout no longer causes layout event firing and layout to be
+ performed
+
+2005-10-16 Jackson Harper <jackson@ximian.com>
+
+ * Hwnd.cs: Compute invalid area correctly (fixes my last commit
+ which was broken).
+
+2005-10-16 Jackson Harper <jackson@ximian.com>
+
+ * TabControl.cs: Remove debug code.
+
+2005-10-16 Jackson Harper <jackson@ximian.com>
+
+ * XEventQueue.cs: Increase the default queue size (very simple
+ apps needed to grow the queue).
+ * Hwnd.cs: No finalizer so we don't need to suppress
+ finalization. Compute the invalid area manually so a new rectangle
+ does not newto be created.
+ * ScrollableControl.cs: Don't set any params (otherwise visibility
+ isn't set correctly).
+ * MdiChildContext.cs: New constructor takes the mdi parent so it
+ doesn't have to be computed and avoids a crash on windows. Draw
+ the window icon properly, and allow the text to be seen.
+ * Form.cs: Use new MdiChildContext constructor. Make sure the
+ child context isn't null in wndproc.
+ * TabControl.cs: Don't set focus, this is muddling keyboard
+ behavoir. Expand the tab rows when a window size increase will
+ allow extra tabs to be seen. Don't allow tabs smaller than the
+ width of a window to be scrolled out of view.
+ * TreeNode.cs:
+ * TreeView.cs: Use measure string to calculate a nodes width, the
+ width is cached and only updated when the text or the font is
+ changed. Don't check for expand/collapse clicks on the first level
+ nodes if root lines are disabled.
+
+2005-10-16 Ritvik Mayank <mritvik@novell.com>
+
+ * TextBoxBase.cs: Fixes #76352 (passing tab key in a multiline textbox)
+
+2005-10-16 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * DataGridBoolColumn.cs: fixes warning
+
+2005-10-16 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ControlPaint.cs: Fixes methods Dark, DarkDark, Light, LightLight
+ to match more to match more precisely the MS Net behavior
+
+2005-10-13 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Hwnd.cs: Added field to track if window is mapped
+ * XplatUIX11.cs:
+ - Unmap windows if they become 0-size, re-map when
+ they are >0 again; fixes #76035
+ - Re-set our error handler after initializing X11Desktop
+ to override any error handlers Gtk or whatever was called
+ may have set.
+
+2005-10-13 Peter Dennis Bartok <pbartok@novell.com>
+
+ * CheckedListBox.cs: Removed unused vars
+ * ListView.cs: Fixed signatures
+ * RichTextBox.cs: Removed unused vars
+ * TextBoxBase.cs: Removed unused vars
+ * XplatUIWin32.cs: Removed unused vars
+ * XplatUIX11.cs: Removed unused vars
+ * XplatUI.cs: Updated version and date to latest published
+
+2005-10-13 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Cursor.cs: Added private .ctor to work around a bug in
+ resourceset (Thanks to Geoff Norton for the help on this)
+ * SplitterEventArgs.cs: Made fields accessible so we don't
+ waste boatloads of objects and can reuse the same one
+ in Splitter
+ * XplatUIWin32.cs(DrawReversibleLine): Now also considers
+ any captions and borders when generating screen coordinates
+ * Splitter.cs: Reimplemented control, now fully complete, uses
+ rubberband drawing, supports and obeys all properties, has
+ proper cursors
+
+2005-10-13 Miguel de Icaza <miguel@novell.com>
+
+ * Form.cs (Form): Setup default values for autoscale and
+ autoscale_base_size; Make these instance variables, not static
+ variables.
+
+ (OnLoad): on the first load, adjust the size of the form.
+
+2005-10-13 Peter Dennis Bartok <pbartok@novell.com>
+
+ * XplatUI.cs, XplatUIDriver.cs, XplatUIOSX.cs: Added
+ width argument to DrawReversibleRectangle()
+ * XplatUIWin32.cs, XplatUIX11.cs:
+ - Implemented width for DrawReversibleRectangle()
+ - Added logic to DrawReversibleRectangle that recognizes a zero
+ width or height and only draws a line in that situation
+
+2005-10-12 Peter Dennis Bartok <pbartok@novell.com>
+
+ * XplatUI.cs, XplatUIDriver.cs: Added GetAutoScaleSize()
+ * XplatUIOSX.cs: Stubbed GetAutoScaleSize() method
+ * XplatUIWin32.cs, XplatUIX11.cs: Implemented GetAutoScaleSize()
+ method (it uses our FosterParent window to get a graphics context)
+
+2005-10-12 Peter Dennis Bartok <pbartok@novell.com>
+
+ * XplatUI.cs, XplatUIDriver.cs: Removed EraseWindowBackground
+ and SetWindowBackground methods
+ * Control.cs:
+ - Setting proper ControlStyles
+ - We no longer call XplatUI.SetWindowBackground and XplatUI.
+ EraseWindowBackground, instead we draw the window background
+ ourselves in PaintControlBackground. This behaviour is
+ required to match MS, where, when OnPaintBackground is not
+ called, the background is not drawn.
+ - Removed unneeded Refresh() in set_Text
+ * Hwnd.cs: Dropped the ErasePending support. No longer needed
+ * XplatUIX11.cs:
+ - Created DeriveStyles method to translate from CreateParams to
+ FormBorderStyle and TitleStyle, also handles BorderStyle (which
+ matches FormBorderStyle enum values)
+ - Consolidated SetHwndStyles and CalculateWindowRect border/title
+ style calculations into single DeriveStyles method
+ - Fixed CreateWindow to (finally) use Gravity. This prevents X11
+ from redrawing the whole window on any resize or expose.
+ - Fixed CreateWindow usage of SetWindowValuemask. Before not
+ all styles were applied to our whole/client window appropriately
+ - Removed EraseWindowBackground() and SetWindowBackground() methods
+ - Removed handling of WM_ERASEBKGND message from DefWndProc, we
+ no longer clear/redraw the background through X
+ - Removed handling of erase_pending bit, we have no use for it (or
+ so it seems)
+ * XplatUIOSX.cs:
+ - Removed generation and handling of WM_ERASEBKGND message
+ - Removed EraseWindowBackground() and SetWindowBackground() methods
+ - Removed handling of hwnd.ErasePending flag
+ * XplatUIWin32.cs:
+ - Removed EraseWindowBackground() and SetWindowBackground() methods
+ - We no longer call EraseWindowBackground on PaintEventStart, we
+ ignore the fErase flag, erasing is handled in Control in the
+ background handler
+ * Button.cs, GroupBox.cs, Label.cs, CheckBox.cs, ProgressBar.cs,
+ LinkLabel.cs, ListControl.cs, TabPage.cs, UpDownBase.cs,
+ TextBoxBase.cs, TextBox.cs, ListView.cs, ButtonBase.cs,
+ CheckedListBox.cs, MdiClient.cs, Panel.cs, DataGrid.cs,
+ DataGridTextBox.cs, ScrollBar.cs, ListBox.cs, TrackBar.cs,
+ TabControl.cs, ScrollableControl.cs, ToolBar.cs, PictureBox.cs,
+ DateTimePicker.cs, StatusBar.cs, MonthCalendar.cs: Setting proper ControlStyles
+
+2005-10-12 Jonathan Chambers <jonathan.chambers@ansys.com>
+
+ * PropertyGrids.cs: Get sub properties
+ * PropertyGridView.cs: Fix drawing code
+
+2005-10-11 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ListBox.cs: Fixes 76383
+
+2005-10-11 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * DataGridTextBoxColumn.cs: Sets location and size before attachment
+ * ThemeWin32Classic.cs: Fixes border drawing and calculations
+ * DataGridDrawingLogic.cs: Fixes border drawing and calculations
+
+
+2005-10-11 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ComboBox.cs: Fixes border drawing
+
+2005-10-10 Miguel de Icaza <miguel@novell.com>
+
+ * MimeIcon.cs: Ignore errors if the file can not be read.
+
+2005-10-11 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * Theme.cs, ThemeWin32Classic.cs, ListBox.cs:
+ - Fixed border calculations
+ - Fixed horizontal scrolling in single column listboxes
+ - Fixed drawing issues
+
+2005-10-10 Peter Dennis Bartok <pbartok@novell.com>
+
+ * XplatUI.cs, XplatUIOSX.cs, XplatUIWin32.cs: Switched from BorderStyle to
+ FormBorderStyle enum
+ * XplatUIX11.cs: Switched BorderStyle to FormBorderStyle, added
+ code to determine FormBorderStyles from CreateParams
+ * Form.cs:
+ - Fixed bug where we'd set the wrong window styles if we were
+ not creating an MDI window
+ - Added call to XplatUI.SetBorderStyle when form borders are set
+ * Control.cs: Casting BorderStyles to accommodate changed XplatUI APIs
+ * Hwnd.cs:
+ - Removed obsolete edge style
+ - Switched from BorderStyle to FormBorderStyle
+
+2005-10-10 Jackson Harper <jackson@ximian.com>
+
+ * Form.cs: Use the property to get the window handle instead of
+ accessing it directly. Prevents a null reference exception.
+
+2005-10-10 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Don't adjust the rect given to DrawString now that
+ our libgdiplus draws correctly.
+
+2005-10-08 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Don't try to find the clicked on node if there are
+ no nodes in the tree.
+
+2005-10-08 Alexander Olk <alex.olk@googlemail.com>
+
+ * RichTextBox.cs:
+
+ restore
+
+2005-10-08 Alexander Olk <alex.olk@googlemail.com>
+
+ * ImageListStreamer.cs, TreeView.cs, UpDownBase.cs, RichTextBox.cs,
+ ColorDialog.cs, TextControl.cs, Panel.cs, MdiChildContext.cs,
+ ErrorProvider.cs:
+ Use ResPool for brushes and dispose System.Drawing objects that
+ are not used anymore.
+
+2005-10-07 Jackson Harper <jackson@ximian.com>
+
+ * MdiChildContext.cs: Use the new borders instead of drawing them
+ ourselves.
+
+2005-10-06 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * Calling UpdateBounds after changing the window's BorderStyle
+ since the style can change the ClientSize
+
+2005-10-06 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Control.cs: Made PaintControlBackground virtual
+ * Panel.cs: Overriding PaintControlBackground instead of using paint
+ event; paint event method was interfering with 'real' users of the
+ event.
+
+2005-10-06 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ThemeWin32Classic.cs: remove border drawing since it is handled
+ by the base control class now and was causing double border drawing.
+
+2005-10-06 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Panel.cs: Redraw our background on paint. Not a pretty solution,
+ but it does seem to match MS behaviour. This fixes bug #75324
+
+2005-10-06 Peter Dennis Bartok <pbartok@novell.com>
+
+ * XplatUIX11.cs: A better DrawReversibleRectangle version, however
+ somewhat hackish looking
+
+2005-10-06 Peter Dennis Bartok <pbartok@novell.com>
+
+ * TextBoxBase.cs:
+ - We now accept Enter even if AcceptEnter is false, if the containing
+ form does not have an AcceptButton configured (fixes bug #76355)
+ - Calculations are now fixed to no longer use Width/Height, but
+ ClientSize.Width/Height, since we now support borders (this was
+ a result of fixing borders and therefore bug #76166)
+ - We no longer show the horizontal scrollbar if TextBox.WordWrap is
+ true (fixes bug #76354)
+
+2005-10-06 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Control.cs:
+ - Defaulting BorderStyle and setting it in XplatUI when our window
+ is created
+ - Added enum check to InternalBorderStyle setter
+ * XplatUIX11.cs:
+ - Added drawing of window borders
+ - Now properly calculates WM decorations offset for toplevel
+ windows (fixes bug #74763)
+ * XplatUIWin32.cs:
+ - Implemented BorderStyles for windows (we're letting win32 draw
+ the border for us)
+ - Fixed the signature for SetWindowLong
+ * PictureBox.cs, DataGrid.cs, TextBoxBase.cs, ToolBar.cs, Panel.cs,
+ ListBox.cs, Label.cs: Now uses Control.InternalBorderStyle for
+ setting borders
+ * UpDownBase.cs: Remove drawing of borders, this is handled by
+ the driver, outside the client area
+ * ListView.cs: Removed bogus border calculations. The control should
+ be oblivious to borders, since those are not part of the client
+ area.
+ * X11DesktopColors.cs: Commented out (currently) unneeded variables
+ * ThemeWin32Classic.cs: Removed border calculations from ListView
+ drawing code
+
+2005-10-06 Jackson Harper <jackson@ximian.com>
+
+ * MdiChildContext.cs: Clear out the old virtual position remove
+ all the unneeded calls to CreateGraphics.
+
+2005-10-06 Peter Dennis Bartok <pbartok@novell.com>
+
+ * TextControl.cs: Use proper color for highlighted text; fixes #76350
+
+2005-10-06 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Form.cs:
+ - Added loading and setting of our new default icon
+ - Only set icon if window is already created
+
+2005-10-06 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Label.cs:
+ - Do not explicitly set the foreground and background colors, to
+ allow inheriting from parents (fixes #76302)
+ - Use Control's InternalBorderStyle property to deal with borders
+
+2005-10-06 Jackson Harper <jackson@ximian.com>
+
+ * MdiChildContext.cs: Use the new xplatui function to draw a
+ reversible rect.
+
+2005-10-06 Jackson Harper <jackson@ximian.com>
+
+ * Form.cs: Add the parent before creating the child context cause
+ we need the parent when setting up the child.
+
+2005-10-06 Jackson Harper <jackson@ximian.com>
+
+ * FolderBrowserDialog.cs: redo the tree population code so a
+ second thread isn't used. Should be a lot faster and more stable
+ now.
+
+2005-10-05 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: There are no expand/collapse boxes if the node has
+ no children.
+
+2005-10-05 Jackson Harper <jackson@ximian.com>
+
+ * X11DesktopColors.cs: Get menu colours for the gtk theme.
+
+2005-10-05 Alexander Olk <alex.olk@googlemail.com>
+
+ * FileDialog.cs: Fix InitialDirectory
+
+2005-10-05 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ComboBox.cs:
+ - Fixes changing between styles
+ - Fixes simple mode
+ - Fixes last item crashing when navigating with keyboard
+
+2005-10-05 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * LinkLabel.cs: Related to 76045. Stops the LinkLabel been drawn as a Label
+
+2005-10-05 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: If updating the root node do a full refresh.
+ * TreeNode.cs: The root node should be expanded by default. Also
+ added a utility prop to tell if we are the root node.
+ * TreeNodeCollection.cs: Only refresh if the node we are being
+ added to is expanded. Also added a comment on a potential
+ optimization.
+
+2005-10-04 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Cursor.cs, Hwnd.cs: Added call to GC.SuppressFinalize()
+ in dispose method. Fixes #76330
+
+2005-10-04 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ListView.cs, ThemeWin32Classic.cs, ListViewItem.cs:
+
+ - Implements vertical and horizontal scrolling using XplatUI
+ - Fixes keyboard navagation
+ - Fixes EnsureVisible
+ - Drawing fixes
+ - Handles and draws focus properly
+
+
+2005-10-04 Kornél Pál <kornelpal@hotmail.com>
+
+ * ImageList.cs: Use upper case initials for internal fields. ImageStream:
+ Create handle. NET_2_0: Destroy handle when value is null.
+
+2005-10-03 Jackson Harper <jackson@ximian.com>
+
+ * ScrollBar.cs: My last scrollbar patch was broken. This is a
+ revert and a new patch to prevent the thumb from refreshing so
+ much.
+
+2005-10-02 Jackson Harper <jackson@ximian.com>
+
+ * ScrollBar.cs: Don't update position if it hasn't actually
+ changed. This occurs when you hold down the increment/decrement
+ buttons and the thumb gets to the max/min.
+
+2005-10-01 Jackson Harper <jackson@ximian.com>
+
+ * Form.cs:
+ * MdiChildContext.cs:
+ * MdiClient.cs: Implement ActiveMdiChild in Form.
+
+2005-10-01 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ComboBox.cs: Include ComboBoxEdit flag for the edit item
+
+2005-10-01 Peter Dennis Bartok <pbartok@novell.com>
+
+ * X11DesktopColors.cs: Bow out gracefully if the Gtk libs cannot
+ be found
+
+2005-09-30 Jackson Harper <jackson@ximian.com>
+
+ * ListBox.cs: Don't do a full refresh unless some data has
+ actually changed.
+
+2005-09-30 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Make sure that the checkboxes size is factored in
+ even when not visible.
+
+2005-09-30 Peter Dennis Bartok <pbartok@novell.com>
+
+ * FileDialog.cs: Fix Jordi's build break
+
+2005-09-30 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * FileDialog.cs:
+ - Use standard the Windows colours for the combobox as espected
+ - Dispose objects that use resouces when no longer need them
+
+2005-09-30 Peter Dennis Bartok <pbartok@novell.com>
+
+ * X11DesktopColors.cs: Initial incomplete implementation
+ * XplatUIX11.cs: Added call to initialize X11DesktopColors
+
+2005-09-30 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Theme.cs:
+ - Switched Theme color names to match the names defined in
+ System.Drawing.KnownColors. Life's hard enough, no need to make
+ it harder.
+ - Added setters to all theme color properties so themes can set
+ their color schemes. The setters also propagate the color changes
+ to System.Drawing.KnownColors via reflection
+ * ControlPaint.cs, Label.cs, TextControl.cs, ToolTip.cs, ThemeNice.cs,
+ ComboBox.cs, MdiChildContext.cs, TextBoxBase.cs, DateTimePicker.cs
+ DataGridColumnStyle.cs, MonthCalendar.cs, TreeView.cs: Updated to
+ use the new, more logical theme color names
+ * XplatUIWin32.cs: Updated the GetSysColorIndex enum to include new
+ post-NT colors
+ * ThemeWin32Classic.cs:
+ - Removed code to set the old classic Windows colors. Instead it
+ now relies on the colors returned by System.Drawing.KnownColors
+ which will be either modern static colors (Unix) or colors
+ read from the user's configuration (Win32)
+ - Updated to use the new, more logical theme color names
+ - Switched DataGrid drawing code to use only Theme colors instead of
+ a mix of System.Drawing.KnownColors and Theme colors
+ - DrawFrameControl(): Removed code that fills the button area, the
+ fill would overwrite any previous fill done by a control. This
+ fixes bug #75338
+ - Added DrawReversibleRectangle() stub
+ * ScrollableControl.cs: Set visible state to false when scrollbars
+ are removed (pdn fix)
+ * XplatUI.cs, XplatUIOSX.cs, XplatUIDriver.cs: Added
+ DrawReversibleRectangle() method to allow drawing primitive
+ 'rubber bands'
+ * XplatUIX11.cs: Implemented DrawReversibleRectangle()
+
+2005-09-30 Kornél Pál <kornelpal@hotmail.com>
+
+ * ImageList.cs: Add(Icon): Create handle.
+
+2005-09-30 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ListView.cs:
+ * ThemeWin32Classic.cs:
+ - Fixes detail mode
+ - Sets clippings
+ - Issues with drawing
+
+2005-09-30 Kornél Pál <kornelpal@hotmail.com>
+
+ * ImageList.cs: Moved RecreateHandle back to ImageList as event
+ source has to be the ImageList.
+
+2005-09-30 Kornél Pál <kornelpal@hotmail.com>
+
+ * ImageList.cs: Add(Icon): Use Graphics.DrawIcon instead of Icon.ToBitmap.
+
+2005-09-30 Kornél Pál <kornelpal@hotmail.com>
+
+ * ImageList.cs: ReduceColorDepth: Clean up pointer operations.
+
+2005-09-30 Kornél Pál <kornelpal@hotmail.com>
+
+ * ImageList.cs: ImageCollection: Removed owner field as it is no more used.
+
+2005-09-29 Jonathan Chambers <jonathan.chambers@ansys.com>
+ * GridItem.cs: Fixed TODOs
+ * GridItemCollection.cs: Added ICollection interface
+
+2005-09-30 Kornél Pál <kornelpal@hotmail.com>
+
+ * ImageList.cs: Resize icons when needed.
+
+2005-09-29 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ListViewItem.cs
+ - Fixes GetBounds and returns on screen rects
+ * ListView.cs:
+ - Fixes vertical and horzintal scrolling of items
+ * ThemeWin32Classic.cs:
+ - Fixes drawing
+
+2005-09-29 Raja R Harinath <harinath@gmail.com>
+
+ * ImageList.cs (ImageStream) [NET_2_0]: Reflect re-factoring.
+
+2005-09-29 Kornél Pál <kornelpal@hotmail.com>
+
+ * ImageList.cs: Added comments about handle creation. Moved Handle,
+ HandleCreated and OnRecreateHandle implementations to ImageCollection.
+ Handle is created in Add methods.
+
+2005-09-28 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * DataGridDrawingLogic.cs:
+ - Takes rows into account on Colum calculations
+ - Returns the column when clickig
+ * DataGrid.cs:
+ - Fixes default HitTestInfo values
+ - Fixes HitTestInfo.ToString
+ - Fixes ResetBackColor
+
+2005-09-28 Jackson Harper <jackson@ximian.com>
+
+ * MdiChildContext.cs: Obey rules for fixed sized windows (no
+ sizing or cursor changes). Also added some temp code to draw the
+ titlebars text (Makes dev a little easier).
+
+2005-09-28 Kornél Pál <kornelpal@hotmail.com>
+
+ * ImageList.cs: AddStrip: Throw ArgumentException when Image is not a Bitmap.
+
+2005-09-28 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ListBox.cs: Fixes bug 76253
+
+2005-09-28 Kornél Pál <kornelpal@hotmail.com>
+
+ * ImageList.cs: Added comments about the current implementation. Added
+ ReduceColorDepth, IndexedColorDepths and GetNearestColor to can use
+ Format32bppArgb to preserve transparency and can use Graphics.FromImage
+ while using the specified ColorDepth. ReduceColorDepth uses unsafe code
+ with Bitmap.LockBits for better performance. Revised the whole file to
+ match MS.NET behaviour and provide better performance. Non-public
+ interface members are calling public members even when they throw
+ NotSupportedException for better maintainability. Moved ColorDepth,
+ ImageSize, ImageStream and TransparentColor implementations to
+ ImageCollection for better performance as these properties are not used
+ by ImageList.
+ * ImageListStreamer.cs: Added a new internal constructor that takes an
+ ImageList.ImageCollection and serializes Images based on
+ ImageCollection.ToArray(). Renamed ImageColorDepth to ColorDepth to
+ match ImageList property name.
+
+2005-09-28 Kazuki Oikawa <kazuki@panicode.com>
+
+ * ListBox.cs: Fixes IndexFromPoint for last item
+
+2005-09-27 Jackson Harper <jackson@ximian.com>
+
+ * Form.cs: Set the position of new mdi children correctly.
+
+2005-09-27 Jackson Harper <jackson@ximian.com>
+
+ * MdiClient.cs: New mdi children need to be added to the back of
+ the controls collection so the zorder is set correctly. Also add a
+ count of all the child windows that have been created.
+
+2005-09-27 Jackson Harper <jackson@ximian.com>
+
+ * Form.cs (CreateParams): Setup MDI forms correctly.
+
+2005-09-27 Jackson Harper <jackson@ximian.com>
+
+ * MdiChildContext.cs:
+ * MonthCalendar.cs:
+ * UpDownBase.cs:
+ * ListBox.cs:
+ * ListView.cs:
+ * TextBoxBase.cs:
+ * TreeView.cs:
+ * ScrollableControl.cs:
+ * ComboBox.cs: Add implicit controls using the new implict control
+ functionality in ControlCollection. Also try to block multiple
+ control add in a suspend/resume layout to save some cycles.
+
+2005-09-27 Jackson Harper <jackson@ximian.com>
+
+ * Control.cs: Add functionality to the controls collection to add
+ 'implicit controls' these are controls that are created by the
+ containing control but should not be exposed to the user. Such as
+ scrollbars in the treeview.
+ * Form.cs: The list var of the ControlsCollection is no longer
+ available because of the potential of implicit controls getting
+ ignored by someone accessing the list directly.
+
+2005-09-26 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Control.cs: Fixed SetChildIndex; it no longer causes a child to
+ loose it's parent. (Fixed bug introduced in r49103 when we added
+ setting the child parent to null on Remove)
+
+2005-09-26 Gert Driesen <drieseng@users.sourceforge.net>
+
+ * DataGridBoolColumn.cs: Marked CheckState private to fix public API.
+ * Splitter.cs: Added missing attributes for BorderStyle property.
+ * TextBoxBase.cs: Marked Calculate* methods internal.
+ * TextBox.cs: Fixed DefaultValue for PasswordChar property to match
+ MS.NET.
+
+2005-09-26 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ListBox.cs: Fixes navigation to the last item in multicolumn lists
+
+2005-09-25 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Update the node bounds correctly regardless of
+ whether the node is visible.
+
+2005-09-25 Jackson Harper <jackson@ximian.com>
+
+ * ImageList.cs: Don't dispose the image after it is added to the
+ image list. Only reformat images that need to be resized.
+
+2005-09-25 Jackson Harper <jackson@ximian.com>
+
+ * ImageList.cs: Don't set the format when changing the image.
+
+2005-09-25 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: We can't just assume the node has a font. Use the
+ treeviews font if no node font is available.
+
+2005-09-25 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Allow the scrollbars to be reset with negative
+ values.
+ - Don't add scrollbars to negative sized windows.
+
+2005-09-23 Jackson Harper <jackson@ximian.com>
+
+ * XplatUIX11.cs: Update to use Mono.Posix.Native instead of plain
+ old Mono.Posix. Also remove some stray code that shouldn't have
+ been committed.
+
+2005-09-23 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Attempt at proper sizing of the horizontal
+ scrollbar. Also don't resize the scrollbars unless they are
+ visible.
+
+2005-09-23 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: We don't need to expand the invalid area when the
+ selection changes, as this is all drawn in the node's bounding
+ box. The area needs to be expanded (previous typo was contracting
+ it) when the focus rect moves.
+
+2005-09-23 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Display the selection box under the correct
+ circumstances. We were rendering white text with no selection box
+ before.
+
+2005-09-23 Peter Dennis Bartok <pbartok@novell.com>
+
+ * TextControl.cs(Split): Now updates selection start/end if it points
+ into a line that's being split. Fixes a FIXME and bug #75258
+
+2005-09-23 Jackson Harper <jackson@ximian.com>
+
+ * Binding.cs:
+ * ListControl.cs: Don't use the path when retrieving binding
+ managers from the binding context. My bat sense tells me that the
+ path is only used on insertion.
+
+2005-09-22 Jackson Harper <jackson@ximian.com>
+
+ * Splitter.cs: Set the cursor an easier way. (Thanks peter).
+
+2005-09-22 Jackson Harper <jackson@ximian.com>
+
+ * Splitter.cs: There are special cursors used for splitting.
+ * XplatUIX11.cs: The VSplit and HSplit cursors were backwards.
+
+2005-09-22 Jackson Harper <jackson@ximian.com>
+
+ * Splitter.cs: Change the cursor appropriately when the splitter
+ is moused over, so the user actually knows there is a splitter
+ there.
+
+2005-09-22 Hisham Mardam Bey <hisham.mardambey@gmail.com>
+
+ * Label.cs : Fix ToString method to give same output as MS.NET
+
+2005-09-22 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Create the scrollbars when the handle is created
+ and add them right away, just make them invisble. Also account for
+ the window being shrunk vertically to the point that the vert
+ scrollbar needs to be added.
+ - Remove some 0.5 adjustments to get around anti aliasing issues.
+
+2005-09-22 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * MainMenu.cs: Fixes default value
+ * MenuItem.cs: Fixes default value
+
+2005-09-22 Kazuki Oikawa <kazuki@panicode.com>
+
+ * AsyncMethodResult.cs: Fixes Control.Invoke is blocked infinitely.
+
+2005-09-21 Jackson Harper <jackson@ximian.com>
+
+ * Control.cs: Don't try to set the border style on the window if
+ it hasn't been created. When the window is created the border
+ style will be used.
+
+2005-09-21 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Control.cs (Update): Don't call XplatUI if we don't have a
+ window handle yet
+
+2005-09-21 Peter Dennis Bartok <pbartok@novell.com>
+
+ * ContainerControl.cs: Instead of throwing an exception, print
+ a one-time warning about Validate not being implemented
+ * XplatUIWin32.cs: Removed debug output
+
+2005-09-21 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Control.cs: Only set XplatUI background if we expect the windowing
+ system to handle the background. This stops controls that draw their
+ own background from flickering
+
+ * XplatUIX11.cs: Support custom visuals and colormaps for window
+ creation. This allows, amongst other things, using MWF X11 windows
+ with OpenGL.
+
+2005-09-21 Peter Dennis Bartok <pbartok@novell.com>
+
+ * OpenFileDialog.cs, ContentsResizedEventArgs.cs, LibSupport.cs, GridItem.cs,
+ CursorConverter.cs, SplitterEventHandler.cs, PropertyGridTextBox.cs,
+ GridTablesFactory.cs, MethodInvoker.cs, AccessibleEvents.cs,
+ SplitterEventArgs.cs, XplatUI.cs, Mime.cs, PropertySort.cs,
+ TreeViewCancelEventHandler.cs, Form.cs, PropertyGridCommands.cs,
+ IDataGridEditingService.cs, DateBoldEventHandler.cs, Label.cs,
+ KeyboardLayouts.cs, TextControl.cs, ProgressBar.cs, ToolTip.cs,
+ RadioButton.cs, OSFeature.cs, LinkLabel.cs, ColorDialog.cs,
+ ThemeNice.cs, ErrorIconAlignment.cs, TreeNode.cs, MimeGenerated.cs,
+ ComboBox.cs, DataGridTextBoxColumn.cs, ArrangeStartingPosition.cs,
+ GridColumnStylesCollection.cs,
+ IDataGridColumnStyleEditingNotificationService.cs,
+ PropertyGrid.cs, IFeatureSupport.cs, ICommandExecutor.cs,
+ MdiLayout.cs, GridEntry.cs, ControlBindingsCollection.cs,
+ GridTableStylesCollection.cs, TreeViewCancelEventArgs.cs,
+ TreeNodeCollection.cs, AmbientProperties.cs,
+ RichTextBoxSelectionAttribute.cs, RichTextBoxSelectionTypes.cs,
+ DataObject.cs, ErrorProvider.cs, Splitter.cs,
+ DataGridLineStyle.cs, Shortcut.cs, Control.cs,
+ FontDialog.cs, SecurityIDType.cs, GridItemType.cs,
+ BindingMemberInfo.cs, DataGridCell.cs, MdiChildContext.cs,
+ IRootGridEntry.cs, PropertyGridView.cs, DataGridParentRowsLabelStyle.cs,
+ FolderBrowserDialog.cs, OpacityConverter.cs, HelpProvider.cs,
+ IComponentEditorPageSite.cs, DataGridTableStyle.cs, NavigateEventArgs.cs,
+ NotifyIcon.cs, ContentsResizedEventHandler.cs, MenuItem.cs,
+ PropertyTabChangedEventHandler.cs, TextBoxBase.cs, OpenTreeNodeEnumerator.cs,
+ SelectionMode.cs, TextBox.cs, ListBindingConverter.cs,
+ FileDialog.cs, KeysConverter.cs, DomainUpDown.cs,
+ DataFormats.cs, SaveFileDialog.cs, GridItemCollection.cs,
+ ArrangeDirection.cs, FeatureSupport.cs, SelectionRangeConverter.cs,
+ RichTextBoxScrollBars.cs, NodeLabelEditEventHandler.cs, TreeNodeConverter.cs,
+ MimeIcon.cs, X11Structs.cs, PropertyGridEntry.cs,
+ ImageList.cs, ThemeWin32Classic.cs, X11Keyboard.cs,
+ CheckedListBox.cs, HelpNavigator.cs, DateTimePickerFormat.cs,
+ MdiClient.cs, DataGridDrawingLogic.cs, DataGridBoolColumn.cs,
+ NodeLabelEditEventArgs.cs, Screen.cs, PropertyManager.cs,
+ ComponentModel.cs, PropertiesTab.cs, CurrencyManager.cs,
+ SizeGrip.cs, DateBoldEventArgs.cs, X11Dnd.cs, Panel.cs,
+ Hwnd.cs, OSXStructs.cs, DrawMode.cs, XplatUIDriver.cs,
+ RichTextBox.cs, PropertyTabChangedEventArgs.cs, CommonDialog.cs,
+ DataGrid.cs, XplatUIX11.cs, RichTextBoxStreamType.cs, Win32DnD.cs,
+ ErrorBlinkStyle.cs, TreeViewEventHandler.cs,
+ PropertyValueChangedEventHandler.cs, IFileReaderService.cs,
+ DataGridTextBox.cs, SelectedGridItemChangedEventArgs.cs, ScrollBar.cs,
+ ListBox.cs, TreeViewAction.cs, Help.cs, TrackBar.cs,
+ AxHost.cs, PropertyValueChangedEventArgs.cs, XplatUIOSX.cs,
+ RichTextBoxFinds.cs, UpDownEventArgs.cs, Cursors.cs,
+ CategoryGridEntry.cs, RichTextBoxWordPunctuations.cs, DataGridColumnStyle.cs,
+ SelectedGridItemChangedEventHandler.cs, DateTimePicker.cs, NavigateEventHandler.cs,
+ Clipboard.cs, UpDownEventHandler.cs, MonthCalendar.cs,
+ SendKeys.cs, DataGridPreferredColumnWidthTypeConverter.cs, TreeView.cs,
+ ThreadExceptionDialog.cs, ImageListConverter.cs, XplatUIWin32.cs,
+ TreeViewEventArgs.cs: Fixed whitespace and set eol-style:native attribute
+
+2005-09-21 Jackson Harper <jackson@ximian.com>
+
+ * TreeNode.cs: Call Before/After Expand not Collapse when
+ expanding.
+
+2005-09-20 Jackson Harper <jackson@ximian.com>
+
+ * XplatUIX11.cs: Use the more hand looking hand (in most themes).
+
+2005-09-16 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ListViewItem.cs:
+ - Fixes bug 76120
+ - Fixes proper storing of subitems
+ - Fixes not updated items
+
+2005-09-20 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Control.cs, TextBoxBase.cs, TextControl.cs: Don't do certain
+ things if our window handle isn't created yet. Also disabled
+ debug for TextBoxBase
+
+2005-09-20 Peter Dennis Bartok <pbartok@novell.com>
+
+ * MenuAPI.cs: Remove filtering of events to allow menu usage
+
+2005-09-20 Miguel de Icaza <miguel@novell.com>
+
+ * Cursor.cs: Allow null to be passed to Cursor.Current.
+
+2005-09-20 Alexander Olk <alex.olk@googlemail.com>
+
+ * ThemeWin32Classic.cs:
+ - Change some private methods/fields to protected virtual so that
+ they can be accessed and overriden in derived classes
+ - First refactoring of some methods. Derived themes now don't
+ need to duplicate the complete code from ThemeWin32Classic
+ * ThemeNice.cs:
+ - Added nice StatusBar
+ - Derive from ThemeWin32Classic and not Theme
+ - Removed duplicate ThemeWin32Classic code
+
+2005-09-20 Miguel de Icaza <miguel@novell.com>
+
+ * Control.cs (ControlCollection.Add): If the value null is passed
+ the control is ignored.
+
+ Optimize this loop.
+
+2005-09-19 Peter Dennis Bartok <pbartok@novell.com>
+
+ * MenuAPI.cs: Replaced Application.Run() with a loop that tracks
+ PostQuitMessage state.
+ * XplatUIWin32.cs: Removed bogus PostQuitMessage P/Invoke with HWND arg
+
+2005-09-19 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Application.cs: Our constructor will never get called, move
+ initialization to fields; fixes bug #75933
+
+2005-09-19 Hisham Mardam Bey <hisham.mardambey@gmail.com>
+
+ * FileDialog.cs :
+ - Allow files to be selected properly using file name
+ combo box.
+ - Add ability to change diretory (absolute / relative)
+ using file name combo box.
+
+2005-09-16 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ListBox.cs:
+ - Fixes Multicolumn listboxes item wrong calculations
+ - Allows to click when only one item is in the listbox
+ - Fixes crash when no items using keyboard navigation
+
+2005-09-16 Alexander Olk <alex.olk@googlemail.com>
+
+ * ComboBox.cs: Reverted almost everything from the latest patch which
+ broke ComboBox
+
+2005-09-16 Kazuki Oikawa <kazuki@panicode.com>
+
+ * ToolTip.cs:
+ - Fixed #Mtd2 of ToolTipTest.RemoveToolTipTest.
+ * ComboBox.cs:
+ - When DropDownStyle is Simple, it does not show scrollbar
+ to the last item of the list.
+ - When DropDownStyle is Simple, it crashed when the list was
+ scrolled down with the down cursor key.
+ - Fixed a bug that when DropDownStyle is DropDownList, the
+ selected item was not shown.
+ - The position of the selected item was not preserved when
+ the next dropdown happened.
+ * ThemeWin32Classic.cs:
+ - Items were wrapped at the right end.
+ * CheckedListBox.cs:
+ - Fixed Add method
+ * ListBox.cs:
+ - Items should be fully shown.
+ - When resizing and vertical scrollbar disappeared, the item
+ of index 0 should be on the top of the list.
+ - GetItemRectangle should consider the size of ver. scrollbar
+ * StatusBar.cs:
+ - SizingGrip area should not be allocated when it is not
+ displayed.
+ - Now it reflects MinWidth of the containing panel and
+ fixed a crash that happens when its width becomes so small.
+
+2005-09-13 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * CheckedListBox.cs: Fixes bug 76028
+ * ListBox.cs: Fixes bug 76028
+
+2005-09-13 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ThemeWin32Classic.cs: Sets clipping on DataGridPaintRowsHeaders
+ * DataGridDrawingLogic.cs: fixes issues with Datagrid drawing
+
+2005-09-12 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * XplatUIX11.cs: fixes System.NullReferenceException in some situations
+
+2005-09-09 Jonathan Chambers <jonathan.chambers@ansys.com>
+
+ * IRootGridEntry.cs: Changed namespace to PropertyGridInternal
+
+2005-09-09 Jonathan Chambers <jonathan.chambers@ansys.com>
+
+ * IRootGridEntry.cs: Added
+ * PropertyGridCommands.cs: Added
+ * PropertiesTab.cs: Added missing methods and property
+ * PropertyGridView.cs: Made class internal
+ * PropertyGridTextBox.cs: Made class internal
+
+2005-09-09 Alexander Olk <alex.olk@googlemail.com>
+
+ * MimeIcon.cs: Try to check some other environment variables
+ if "DESKTOP_SESSION" returns "default"
+
+2005-09-09 Alexander Olk <alex.olk@googlemail.com>
+
+ * ThemeNice.cs: Corrected background colors (e.g. menus)
+ * ColorDialog.cs: Use correct background colors for controls
+
+2005-09-09 Alexander Olk <alex.olk@googlemail.com>
+
+ * ThemeNice.cs: Merged r49535 from ThemeWin32Classic
+
+2005-09-08 Peter Dennis Bartok <pbartok@novell.com>
+
+ * RichTextBox.cs: Added initial implementation
+ * lang.cs: Removed. Was accidentally checked in long time ago
+ * TODO: Removed. Contents were obsolete
+
+2005-09-06 Jonathan Chambers <jonathan.chambers@ansys.com>
+
+ * PropertiesTab.cs : Added
+
+2005-09-06 Jonathan Chambers <jonathan.chambers@ansys.com>
+
+ * PropertyGrid.cs : Update
+ * PropertyGridView.cs : Update
+ * System.Windows.Forms.resx : Added images and strings
+
+2005-09-06 Peter Dennis Bartok <pbartok@novell.com>
+
+ * ThemeNice.cs: Do not dispose Pens retrieved from ResPool
+
+2005-09-06 Peter Dennis Bartok <pbartok@novell.com>
+
+ * XplatUIX11.cs: Force a flush after Ungrab; if case the app enters
+ a busy loop right after the Ungrab the X11 display is otherwise
+ blocked
+
+2005-09-06 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ThemeWin32Classic.cs: Optimise the use of clipping
+
+2005-09-05 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * DataGrid.cs: fixes recursion bug
+
+2005-09-03 Alexander Olk <alex.olk@googlemail.com>
+
+ * ThemeNice.cs:
+ - Draw RadioButton and CheckBox Buttons with DrawButtonBase
+ - Cleanup
+
+2005-09-02 Alexander Olk <alex.olk@googlemail.com>
+
+ * ThemeNice.cs: Draw nice ProgressBars
+
+2005-09-01 Miguel de Icaza <miguel@novell.com>
+
+ * VScrollBar.cs: Another buglet found by Aaron's tool.
+
+ * ProgressBar.cs: Fix three recursive bugs found by Aaron Tomb's
+ bug finder.
+
+2005-08-30 Alexander Olk <alex.olk@googlemail.com>
+
+ * ThemeNice.cs:
+ - Added nicer menu drawing
+ - Updated DrawTab
+ - some refactoring
+
+2005-08-30 Peter Dennis Bartok <pbartok@novell.com>
+
+ * CreateParams.cs (ToString): Made output match MS
+ * Control.cs (Text): Don't set Text or Focus via XplatUI unless
+ handle is already created (to avoid forcing window creation)
+ * XplatUIX11.cs: Set window text to caption after creating window,
+ in case Text was set before window was created
+ * Form.cs: Use this.Text instead of a static string as caption
+
+2005-08-30 Peter Dennis Bartok <pbartok@novell.com>
+
+ * NotifyIcon.cs: Don't set the window to visible; this screws
+ up Win32 (causes WM_NCPAINT to be sent on Win32, which calls
+ OnPaint without a bitmap)
+ * XplatUIX11.cs: Removed Visible optimization in AddExpose; doesn't
+ happen very often anyway; we could add the check to the WM_PAINT
+ event generation code
+
+2005-08-30 Peter Dennis Bartok <pbartok@novell.com>
+
+ * NotifyIcon.cs: Fill the icon area with a background color, to
+ avoid 'residue' when transparent icons are drawn
+ * XplatUIX11.cs:
+ - Handle whole_window == client_window when destroying windows
+ - SystrayAdd(): Set client_window to whole_window value to
+ get mouse and other events passed to NotifyIcon
+
+2005-08-30 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Form.cs: Set proper default for Opacity property
+ * NotifyIcon.cs:
+ - ShowSystray(): Don't bother creating telling the OS
+ about the systray item if no icon is provided
+ - Now handles WM_NCPAINT message to deal with whole/client window
+ split
+ - Create window as visible to not get caught by Expose optimization
+ * Hwnd.cs: Removed debug message
+ * ComboBox.cs, ScrollBar.cs, ListBox.cs, TrackBar.cs, TabControl.cs,
+ StatusBar.cs, TreeView.cs, XplatUIOSX.cs, XplatUIWin32.cs: Switched
+ PaintEventStart/End to use new client argument
+ * TextBoxBase.cs:
+ - Commented out debug messages
+ - Switched PaintEventStart/End to use new client argument
+ * XplatUI.cs: Added client window bool to PaintEventStart()/
+ PaintEventEnd() calls, to support drawing in non-client areas
+ * XplatUIDriver.cs:
+ - Added client window bool to PaintEventStart()/PaintEventEnd()
+ calls, to support drawing in non-client areas
+ - Added conditional compile to allow using MWF BeginInvoke
+ on MS runtime
+ * XplatUIX11.cs:
+ - Added some conditional debug output
+ - Fixed SystrayAdd() method to support new (for SystrayAdd, anyway)
+ whole/client window split
+ - Implemented handling of client argument to PaintEventStart()/End()
+ * Control.cs:
+ - Throw exception if BeginInvoke() is called and the window handle
+ or one of the window's parent handles is not created
+ - Added conditional compile to allow using MWF BeginInvoke on
+ MS runtime
+ - get_Parent(): Only sets parent if handle is created. This avoids
+ forcing window handle creation when parent is set.
+ - Now fires Layout and Parent changed events in proper order
+ - Switched to use Handle instead of window.Handle for Z-Order setting,
+ the get_Parent() patch above causes us to possibly get null for 'window'
+ - Implemented handling of client argument to PaintEventStart()/End()
+ - Now reports back to windows that WM_SETCURSOR was handled (to avoid
+ default handling)
+ - Now sends a Refresh() to all child windows when Refresh() is called
+
+2005-08-29 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Form.cs: Added (non-functional) Opacity property
+ * XplatUIWin32.cs (SystrayAdd): Removed bogus line of code
+
+2005-08-29 Alexander Olk <xenomorph2@onlinehome.de>
+ * ThemeNice.cs: New theme for MWF, based on ThemWin32Classic
+ use export MONO_THEME=nice to activate it.
+ Currently supported controls:
+ - Button
+ - ComboBox
+ - ScrollBar
+ - TabControl (TabAlignment.Top only, other will follow)
+ * ThemeEngine.cs: Add theme nice
+ * ButtonBase.cs: Redraw button on MouseEnter and MouseLeave everytime,
+ if enabled
+
+2005-08-25 Jonathan Chambers <jonathan.chambers@ansys.com>
+
+ * Splitter.cs: Resize docked control and its neighbor.
+
+2005-08-24 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
+ -- Making Windows with Menus layout correctly --
+ * Form.cs : The first leg of the fix
+ Menu setter - adjust Client Size as needed to make space for the menu
+ SetClientSizeCore - doesn't call base version to be able to pass the
+ menu handle to XplatUI.CalculateWindowRect
+ * Hwnd.cs: Fix for menu_height, now gets from MenuAPI.MENU
+ * XplatUIX11.cs: The critical second leg of the fix
+ GetWindowPos needs to use a recalculated client_rect
+ so that resizing the window doesn't break layout of child controls.
+ Also a more complete rule to avoid X Server roundtrips in SetWindowPos
+ Lots of \t\n killed
+
+2005-08-23 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Label.cs: Now properly recalculates width and height on Font and Text
+ changes if AutoSize is set
+
+2005-08-19 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
+ * TreeView.cs : Revamped drawing logic, and support for FullRowSelect
+
+2005-08-19 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ImageList.cs: Makes ToString method compatible with MS
+
+2005-08-18 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * MenuAPI.cs: fixes bug 75716
+
+2005-08-11 Umadevi S <sumadevi@novell.com>
+ * Control.cs: Fixed Remove & RemoveAt to make the parent of the control null.
+
+2005-08-11 Umadevi S <sumadevi@novell.com>
+ * Contorl.cs: Fixed ResetRightToLeft and ResetImeMode to work correctly
+
+2005-08-10 Umadevi S <sumadevi@novell.com>
+ * CheckedListBox.cs: Fixed event firing on Adding to the CheckedListBox
+
+2005-08-07 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * Menu.cs: fixes bug 75700
+ * MenuAPI.cs: fixes navigation issues
+
+2005-08-09 Umadevi S <sumadevi@novell.com>
+ * CheckedListBox.cs - simple fix for GetItemChecked.
+
+2005-08-08 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ComboBox.cs: Serveral fixes
+ * ListBox.cs: Serveral fixes
+
+2005-08-05 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ComboBox.cs: Fixes FindString methods and GetItemHeight
+ * ListBox.cs: Fixes FindString methods
+
+2005-08-05 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * DataGrid.cs: fixes bugs exposed by new tests
+
+2005-08-04 Peter Dennis Bartok <pbartok@novell.com>
+
+ * Mime.cs: Compile Mono assembly references only if compiling
+ with Mono (Allows to build with VS.Net again)
+
+2005-07-28 Marek Safar <marek.safar@seznam.cz>
+
+ * Control.cs (PaintControlBackground): Draw background image
+ corrrectly.
+ (CheckForIllegalCrossThreadCalls): Stubbed.
+
+ * Form.cs (OnCreateControl): Center when should be centered.
+
+ * ThemeWin32Classic.cs (DrawPictureBox): Pass size.
+
+2005-07-19 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * Binding.cs: Binding to properties should be case unsensitive
+
+2005-07-18 vlindos@nucleusys.com
+
+ * DataGrid.cs: fixes setmember order
+
+2005-07-07 Alexander Olk <xenomorph2@onlinehome.de>
+
+ * MimeIcon.cs: added MimeIcon stuff (MimeIconEngine)
+ * FileDialog.cs: FileDialog is now resizable and uses the new
+ MimeIconEngine
+
+2005-07-06 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * DataGridTextBoxColumn.cs: default value
+ * GridColumnStylesCollection.cs: fixes event firing, checking MappingName
+ * GridTableStylesCollection.cs: fixes checking MappingName
+ * DataGridDrawingLogic.cs: fixes drawing logic issues
+ * DataSourceHelper.cs: rewritten to make compatible with more data sources
+ * DataGrid.cs: fixes
+
+2005-07-06 Alexander Olk <xenomorph2@onlinehome.de>
+
+ * MimeGenerated.cs: Use case sensitive comparer for
+ NameValueCollections
+
+2005-07-01 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * DataGridTextBoxColumn.cs: bug fixes, code refactoring
+ * ThemeWin32Classic.cs: bug fixes, code refactoring
+ * DataGridDrawingLogic.cs: bug fixes, code refactoring
+ * DataGrid.cs: bug fixes, code refactoring
+ * DataGridTextBox.cs: bug fixes, code refactoring
+ * DataGridColumnStyle.cs: bug fixes, code refactoring
+ * Theme.cs: bug fixes, code refactoring
+
+2005-07-01 Peter Bartok <pbartok@novell.com>
+
+ * TextControl.cs: Quick fix for the reported crash on ColorDialog
+ and other text box usage
+
+2005-07-01 Jackson Harper <jackson@ximian.com>
+
+ * TabControl.cs: Make sure the bottom of the tab covers the pages
+ border.
+
+2005-06-30 Peter Bartok <pbartok@novell.com>
+
+ * Form.cs (ShowDialog): Assign owner of the dialog
+ * TextBoxBase.cs: Always refresh caret size when deleting, caret
+ might have been moved to a tag with different height
+
+2005-06-30 Jackson Harper <jackson@ximian.com>
+
+ * Form.cs: Don't create an infinite loop when setting focus
+ * MenuItem.cs: Don't dirty the parents if we don't have any
+
+2005-06-29 Ben Maurer <bmaurer@ximian.com>
+
+ * LibSupport.cs: Rename
+
+2005-06-29 Peter Bartok <pbartok@novell.com>
+
+ * TextBoxBase.cs: Re-align caret after deleting a character
+ * TextControl.cs:
+ - DeleteChars(): Ensure that tag covers the provided position
+ - StreamLine(): Drop reference for dropped tag
+
+2005-06-29 Peter Bartok <pbartok@novell.com>
+
+ * TextControl.cs:
+ - Selections now work properly, anchoring at the initial location
+ and properly extending in either direction (SetSelectionToCaret(),
+ SetSelectionStart() and SetSelectionEnd())
+ - No longer redraws the whole control on selection change, now
+ calculates delta between previous and new selection and only
+ invalidates/redraws that area
+ - Fixed FindPos() math off-by-one errors
+ - Changed DeleteChars() to verify the provided tag covers the
+ provided position, selections may have a tag that doesn't cover
+ the position if the selection is at a tag border
+ - Fixed off-by-one errors in DeleteChars()
+ - Added missing streamlining check in DeleteChars() to remove
+ zero-length tags
+ - Implemented Invalidate() method, now properly calculates exposures
+ between two given lines/positions
+ - Implemented SetSelection()
+ - Obsoleted and removed FixupSelection()
+ - Improved RecalculateDocument() logic, removing code duplication
+
+2005-06-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * LibSupport.cs: changes to match different input/output arguments.
+
+2005-06-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * LibSupport.cs: added libsupport.so init routine.
+
+2005-06-29 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ControlBindingsCollection.cs
+ - Throws an exception on null datasource when adding
+ - Checks for duplicated bindings when adding
+
+2005-06-28 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs (OnKeyDown): Support left and right properly
+ (navigates as well as expanding and collapsing.
+ - Add support for Multiply, this expands all the selected nodes
+ children.
+ - Fix some tabbing.
+
+2005-06-28 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Implement keyboard navigation, currently supports,
+ LEFT, RIGHT, UP, DOWN, PGUP, PGDOWN, HOME, END, ADD, SUBTRACT. Add
+ support for toggling checkboxes with the space bar.
+
+2005-06-28 Jackson Harper <jackson@ximian.com>
+
+ * OpenTreeNodeEnumerator.cs: Don't move past the begining of the
+ tree.
+
+2005-06-28 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Add missing event.
+
+2005-06-27 Peter Bartok <pbartok@novell.com>
+
+ * TextControl.cs:
+ - Made line ending size configurable (now allows for counting
+ lineendings as \n or \r\n)
+ - Added margin to viewport to keep caret visible on right side
+ - Fixed translation routines for line/pos to documentpos to consider
+ cr/lf when counting (Fixes RichTextBox.SelectionFont issues)
+ - Fixed some line-endings to be unix style
+ - Fixed Document.FormatText to perform it's calculations 1-based
+ - Added descriptions for a few methods that might otherwise get
+ used wrong
+ - Added NOTE section with some basic conventions to remember at
+ the top of the file
+ - Major fixup for RichTextBox selection drawing:
+ * Fixed crashes when multiple tags on a single line were selected
+ * fixed selection box drawing not overlaying text
+ * fixed bogus offset calculation for tags not starting at index 1
+ * Switched behaviour from using multiple Substrings of a
+ StringBuilder.ToString() to using multiple
+ StringBuilder.ToString(start, length) statements, hoping this is
+ faster (kept original version commented out in the code, in case
+ original version was faster)
+ * TextBox.cs (set_TextAlignment): TextBox always needs to wrap if
+ alignment != Left
+ * TextBoxBase.cs (CalculateDocument): Made protected so RichTextBox can
+ call it as well
+
+2005-06-27 Jackson Harper <jackson@ximian.com>
+
+ * TabControl.cs: Move to the left and right with the arrow
+ keys. These keys don't cycle beyond first and last like
+ tab. Refresh all the tabs when scrolling them to the left or
+ right.
+
+2005-06-27 Jackson Harper <jackson@ximian.com>
+
+ * TabControl.cs:
+ - ToString: Added method
+ - CreateParams: Remove TODO and comment
+ - OnKeyDown: Cycle through bounds properly.
+ - SelectedIndex: Scroll to the right or left if we need to
+ display the newly selected tab.
+
+2005-06-23 Jackson Harper <jackson@ximian.com>
+
+ * TabControl.cs: Stay in bounds when cycling. Make sure Handled is
+ set.
+
+2005-06-23 Jackson Harper <jackson@ximian.com>
+
+ * TabControl.cs: Keyboard handling. We now support CTRL-TAB,
+ CTRL-SHIFT-TAB, and HOME, END are there any others?
+
+2005-06-23 Jackson Harper <jackson@ximian.com>
+
+ * XplatUIX11.cs: Get the modifier keys from the keyboard driver.
+
+2005-06-22 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * DataGridTextBoxColumn.cs: fixes and enhancements
+ * ThemeWin32Classic.cs: fixes and enhancements
+ * DataGridBoolColumn.cs: fixes and enhancements
+ * DataGridDrawingLogic.cs: fixes and enhancements
+ * CurrencyManager.cs: fixes and enhancements
+ * DataGrid.cs: fixes and enhancements
+ * DataGridColumnStyle.cs: fixes and enhancements
+
+2005-06-22 Jackson Harper <jackson@ximian.com>
+
+ * TabControl.cs: Add some missing methods that just call into the
+ base. Make the TabPageCollection's IList interface behave in the
+ same manner as the MS implementation.
+
+2005-06-22 Peter Bartok <pbartok@novell.com>
+
+ * TextControl.cs: Added sanity check
+ * TextBoxBase.cs:
+ - Fixed wrapping behaviour, don't set wrap on single line controls
+ (this fixes the breakage of colordialog introduced in an earlier
+ checkin)
+ - Added rudimentary support for autoscrolling right-aligned controls
+ (still needs fixing, also, center alignment scroll is missing)
+
+2005-06-22 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ScrollBar.cs: Fixes thumbpos on Maximum values
+
+2005-06-21 Jonathan Chambers <jonathan.chambers@ansys.com>
+
+ * PropertyGridView.cs: Pass context information to UITypeEditors
+
+2005-06-21 Peter Bartok <pbartok@novell.com>
+
+ * TextBoxBase.cs:
+ - Now calling PositionCaret with absolute space coordinates
+ - Enabled vertical scrolling
+ - Better tracking of scrollbar changes, tied into WidthChange
+ event
+ - Improved cursor tracking
+ - Removed debug output
+ * TextControl.cs:
+ - PositionCaret coordinates are now works in absolute space, not
+ the canvas
+ - Improved tracking of document size
+ - Added events for width and height changes
+
+2005-06-21 Peter Bartok <pbartok@novell.com>
+
+ * Form.cs: Set focus to active control when form is activated
+ * TextControl.cs:
+ - Added word-wrap functionality to RecalculateLine()
+ - Added some short function descriptions for VS.Net to aid in
+ writing dependent controls
+ - Added Caret property, returning the current coords of the caret
+ - Added ViewPortWidth and ViewPortHeight properties
+ - Added Wrap property
+ - Added CaretMoved event
+ - Removed some old debug code
+ - Split() can now create soft splits
+ - Added PreviousTag()/NextTag() to allow walking "tag-lists"
+ - Added method to format existing text
+ - Fixed size/alignment calculations to use viewport
+ - RecalculateDocument now can handle changing line-numbers while
+ calculating lines
+
+ * TextBox.cs:
+ - Added some wrap logic, we don't wrap if alignment is not left
+ - Added casts for scrollbar var, base class switched types to
+ also support RichTextBoxA
+ - Implemented handling of scrollbar visibility flags
+
+ * TextBoxBase.cs:
+ - Switched scrollbars type to RichTextBoxScrollBars to support
+ RichTextBox
+ - Added tracking of canvas width/height
+ - Switched scrollbars to be not selectable (to keep focus on text)
+ - Added central CalculateDocument() method to handle all redraw
+ requirements
+ - Added ReadOnly support
+ - Added WordWrap support
+ - Fixed handling of Enter key (we now treat it as a DialogKey)
+ - Fixed caret positioning when h or v scroll is not zero
+ - Fixed placing/generation of vertical scrollbar
+ - Added CalculateScrollBars() method to allow updating scrollbar
+ limits and visibility
+ - Fixed handling of horizontal scroll
+ - Added handling of vertical scroll
+ - Implemented auto-'jump' when caret moves to close to a left or
+ right border and there is text to be scrolled into view (currently
+ there's the potential for a stack overflow, until a bug in
+ scrollbar is fixed)
+
+2005-06-21 Geoff Norton <gnorton@customerdna.com>
+
+ * XplatUIOSX.cs: Initial implementation of WM_ERASEBKGND
+
+2005-06-19 Alexander Olk <xenomorph2@onlinehome.de>
+
+ * Mime.cs:
+ - added inodes.
+ - return application/x-zerosize for files with size zero
+ (if no extension pattern matches).
+ - check matches collection for strings too.
+ - return only the first mime type if the name value
+ collection has more than one mime type.
+
+2005-06-18 Jonathan Chambers <jonathan.chambers@ansys.com>
+
+ * PropertyGrid.cs: Cleaned up some TODOs
+ * PropertyGridView.cs: Added support for UITypeEditors
+
+2005-06-17 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * DataGrid.cs: clears cached value
+
+2005-06-17 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * DataGridTextBoxColumn.cs: new rows, speed improvements, fixes, readonly prop.
+ * DataGridDrawingLogic.cs: new rows, speed improvements, fixes, readonly prop.
+ * DataGrid.cs: new rows, speed improvements, fixes, readonly prop.
+ * DataGridColumnStyle.cs: new rows, speed improvements, fixes, readonly prop.
+
+2005-06-16 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ThemeWin32Classic.cs: fixes colour
+
+2005-06-15 Peter Bartok <pbartok@novell.com>
+
+ * MWFCategoryAttribute.cs: Added (Needed for PropertyGrid designer support)
+ * MWFDescriptionAttribute.cs: Added (Needed for PropertyGrid designer support)
+ * ButtonBase.cs: Added MWFCategory and MWFDescription attributes
+ * Control.cs: Added some MWFCategory and MWFDescription attributes
+ * ScrollBar.cs: Added some MWFCategory and MWFDescription attributes
+
+2005-06-15 Alexander Olk <xenomorph2@onlinehome.de>
+
+ * Mime.cs, MimeGenerated.cs: First draft of MWF mime stuff, see Mime.cs for
+ usage
+
+2005-06-14 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * DataGridTextBoxColumn.cs: default datagrid settings for Default Styles, fixes
+ * DataGridTableStyle.cs: default datagrid settings for Default Styles, fixes
+ * DataGridDrawingLogic.cs: default datagrid settings for Default Styles, fixes
+ * DataGridBoolColumn.cs: default datagrid settings for Default Styles, fixes
+ * DataGrid.cs: default datagrid settings for Default Styles, fixes
+ * DataGridColumnStyle.cs: default datagrid settings for Default Styles, fixes
+
+2005-06-13 Jackson Harper <jackson@ximian.com>
+
+ * XplatUIX11.cs: Override SetAllowDrop on X11 so an error message
+ isn't printed when the user enables dropping. (X11 does accept
+ drops).
+
+2005-06-13 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Remove some TODOS.
+
+2005-06-13 Jackson Harper <jackson@ximian.com>
+
+ * Form.cs: Hook into the mdi framework.
+ * MdiClient.cs: Use the base control collections add method so
+ parents get setup correctly. Set the default back colour and dock
+ style.
+ * MdiChildContext.cs: New class, this bad actor handles an
+ instance of an MDI window. Right now there is only basic
+ support. You can drag, close, and resize windows. Minimize and
+ Maximize are partially implemented.
+
+2005-06-13 Jackson Harper <jackson@ximian.com>
+
+ * XplatUIX11.cs: Mash numbers together properly, otherwise we get
+ freaky when both vals are negative. NOTE: There are probably other
+ places in XplatUIX11 that this needs to be done.
+
+2005-06-13 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * DataGrid.cs: implement missing methods, move KeyboardNavigation
+ * DataGridColumnStyle.cs: fixes signature
+
+2005-06-12 Jackson Harper <jackson@ximian.com>
+
+ * XplatUIX11.cs: Use sizing cursors similar to the ones on
+ windows.
+
+2005-06-11 Jackson Harper <jackson@ximian.com>
+
+ * StatusBarPanel.cs: Signature cleanups. Implement
+ BeginInit/EndInit.
+
+2005-06-10 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * DataGridTextBoxColumn.cs: Honors aligment
+ * GridColumnStylesCollection.cs: Contains is case unsensitive
+ * GridTableStylesCollection.cs: several fixes
+ * DataGridTableStyle.cs: default column creation
+ * DataGridDrawingLogic.cs: fixes
+ * CurrencyManager.cs: ListName property
+ * DataGrid.cs: multiple styles support
+ * DataGridColumnStyle.cs: fixes
+
+
+2005-06-10 Peter Bartok <pbartok@novell.com>
+
+ * Control.cs(Select): Moved SetFocus call to avoid potential
+ loops if controls change the active control when getting focus
+ * UpDownBase.cs: Fixes to allow proper keyboard focus after clicking
+ the up/down buttons
+
+2005-06-10 Matthias Felgner <matthiasf@voelcker.ocm>
+
+ * ImageListConverter.cs: Implemented
+
+2005-06-10 John BouAntoun <jba-mono@optusnet.com.au>
+
+ * MonthCalendar.cs: Wired in NumericUpDown control for year
+
+2005-06-10 John BouAntoun <jba-mono@optusnet.com.au>
+
+ * MonthCalendar.cs: Removed MonoTodo attributes on Click and
+ DoubleClick events, since they are not meant to be fired.
+
+2005-06-09 Peter Bartok <pbartok@novell.com>
+
+ * UpDownBase.cs, NumericUpDown.cs, DomainUpDown.cs: Integrated
+ Jonathan's standalone controls into MWF, implemented missing
+ events, attributes and methods; added xxxAccessible classes
+ * AccessibleObject.cs: Made fields internal so other classes
+ can change them if needed
+
+2005-06-09 Jonathan Gilbert <2a5gjx302@sneakemail.com>
+
+ * UpDownBase.cs: Complete implementation
+ * NumericUpDown.cs: Complete implementation
+ * DomainUpDown.cs: Complete implementation
+
+2005-06-09 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * DataGridTextBoxColumn.cs: drawing fixes
+ * DataGridCell.cs: fixes ToString method to match MSNet
+ * DataGridTableStyle.cs: fixes
+ * DataGridBoolColumn.cs: fixes, drawing
+ * DataGridDrawingLogic.cs: fixes, new methods
+ * DataGridTextBox.cs: Keyboard and fixes
+ * DataGrid.cs:
+ - Keyboard navigation
+ - Scrolling fixes
+ - Row selection (single, multiple, deletion, etc)
+ - Lots of fixes
+
+2005-06-07 Jackson Harper <jackson@ximian.com>
+
+ * ThemeWin32Classic.cs: Clear the background area when drawing
+ buttons.
+
+2005-06-06 Peter Bartok <pbartok@novell.com>
+
+ * ImageListStreamer.cs: Fixed signature for GetData
+ * CheckBox.cs: Fixed base class for CheckBoxAccessibleObject
+ * ComboBox.cs:
+ - Added missing ChildAccessibleObject class
+ - Added missing OnXXXFocus overrides, switched to using those
+ instead of the event handler
+ * Control.cs:
+ - Added Parent property for ControlAccessibleObject
+ - Fixed signatures
+ - Fixed attributes
+ - Added ResetBindings()
+ * ListBindingConverter.cs: Implemented some methods
+ * ButtonBase.cs: Added missing ButtonBaseAccessibleObject class
+ * ImageList.cs: Implemented basic handle scheme, removed TODOs
+ * ContainerControl.cs: Fixed signature, now subscribing to the
+ ControlRemoved event instead of overriding the handler, LAMESPEC
+ * CurrencyManager.cs: Added missing attribute
+ * MonthCalendar.cs: Added missing properties
+
+2005-06-06 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * DataGridColumnStyle.cs: fixes for DataGridColumnStyle
+
+2005-06-06 Gaurav Vaish and Ankit Jain
+
+ * DataSourceHelper.cs: Gaurav Vaish and Ankit Jain patch for databinding
+ * DataGrid.cs: Gaurav Vaish and Ankit Jain patch for databinding
+
+2005-06-06 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * Control.cs: fixes CreateParams Width / Height.
+
+2005-06-05 Peter Bartok <pbartok@novell.com>
+
+ * Win32DnD.cs: Removed compilation warnings
+
+2005-06-05 Peter Bartok <pbartok@novell.com>
+
+ * Control.cs (CreateParams): Since we don't know if one of the
+ properties we use is overridden, lets make sure if we fail accessing
+ we continue with a backup plan
+
+2005-06-05 Peter Bartok <pbartok@novell.com>
+
+ * Win32DnD.cs:
+ - Removed debug output
+ - Added MarshalAs attribute to ensure proper marshalling of FORMATETC
+ struct
+ - Plugged resource leak
+ * XplatUIStructs.cs: Changed ClipboardFormats size to ushort, to match
+ MS size
+
+2005-06-05 Peter Bartok <pbartok@novell.com>
+
+ * XplatUIWin32.cs: Removed DnD code
+ * Win32DnD.cs: Implemented drop source and drop target functionality
+
+2005-06-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UpDownBase.cs: remove duplicate addition of event, enable some code
+ that was commented out.
+ * NumericUpDown.cs: added missing attributes and Hexadecimal property.
+ Validate input when a key is pressed. It works fine now for every
+ combination of Hexadecimal. Only missing some drawing love when sharing
+ space with other controls.
+
+2005-06-04 Peter Bartok <pbartok@novell.com>
+
+ * Control.cs:
+ - We need to pass a window for DragDrop, so enable callback events
+ - Added DnD callback events when being a DragSource
+ * XplatUI.cs (StartDrag): Added window handle argument
+ * XplatUIDriver.cs (StartDrag): Added window handle argument
+ * QueryContinueDragEventArgs: Made fields internally accessible so
+ drivers can set them
+ * GiveFeedbackEventArgs: Made fields internally accessible so drivers
+ can set them
+
+2005-06-03 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * DataGridTextBoxColumn.cs: column text editing
+ * DataGridTableStyle.cs: Respect columns styles created by the user
+ * DataGridDrawingLogic.cs: lots of drawing fixes and enhanments
+ * DataGridBoolColumn.cs: bool column editing
+ * DataGrid.cs: fixes to scrolling, properties, etc
+ * DataGridTextBox.cs: handle keyboard
+ * DataGridColumnStyle.cs: fixes
+
+2005-06-02 Jackson Harper <jackson@ximian.com>
+
+ * ImageListStreamer.cs: Somewhat broken implementation of
+ GetObjectData. The RLE needs some work to match MS properly.
+
+2005-06-02 Jackson Harper <jackson@ximian.com>
+
+ * X11Dnd.cs: Attempting to keep at least one file in MWF
+ monostyled.
+
+2005-06-02 Peter Bartok <pbartok@novell.com>
+
+ * X11DnD.cs: Use Marshal.SizeOf instead of sizeof, no /unsafe required
+ that way
+
+2005-06-02 Peter Bartok <pbartok@novell.com>
+
+ * Control.cs: Removed MonoTODO from DoDragDrop and added call to Xplat
+ * XplatUI.cs: Added DoDragDrop() method
+ * XplatUIDriver.cs: Added DoDragDrop() method
+
+2005-06-02 Jackson Harper <jackson@ximian.com>
+
+ * Splitter.cs: Implement BorderStyle.
+
+2005-06-02 Jackson Harper <jackson@ximian.com>
+
+ * XplatUIX11.cs: Tie into the X11Dnd subsystem.
+ * X11Dnd.cs: New file. A subsystem that handles drag and drop on
+ X11 using XDND.
+
+2005-06-02 Peter Bartok <pbartok@novell.com>
+
+ * DataObject.cs:
+ - Added Data setter
+ - Fixed broken insertion code for SetData, now also
+ overwrites any existing entry of the same format name
+ * Hwnd.cs: Added list of pointers that automatically gets
+ freed when the window is disposed
+ * XplatUI.cs: Call driver initialization method when loading
+ a driver
+ * Control.cs:
+ - OnDragLeave takes EventArgs, not DragEventArgs
+ - Added setting of WS_EX_ACCEPTFILES style when dropping is
+ supported
+ - Forces style update when drop state changes
+ * XplatUIWin32.cs: Implemented Drag'n'Drop (as good as possible,
+ not perfect since we cannot (yet) call the IDataObject.GetData()
+ method, we keep getting 0x80004005 error, dunno why)
+
+2005-06-02 Peter Bartok <pbartok@novell.com>
+
+ * DragEventArgs.cs: Make fields internal so we can cache the
+ object and re-set the fields from XplatUI
+
+2005-06-02 Jackson Harper <jackson@ximian.com>
+
+ * Control.cs: Add some internal methods so the DnD subsystem can
+ raise DnD events. Also call into the driver when AllowDrop is set.
+ * XplatUI.cs:
+ * XplatUIDriver.cs: New method for setting whether or not a window
+ is allowed to accept drag and drop messages.
+
+2005-06-01 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ScrollBar.cs: Make sure that values sent in Scroll events
+ are always between Maximum and Minimum.
+
+2005-06-01 Marek Safar <marek.safar@seznam.cz>
+
+ * Menu.cs: Call MenuChanged when menuitem visibility has been
+ changed.
+ * MenuItem.cs: Rebuild menu when item is (not) visible.
+ * MainMenu.cs: MainMenu has special MenuChanged.
+ * Theme.cs: Caption and FrameBorderSize are not fixed.
+ * XplatUI.cs: Added CaptionHeight,FrameBorderSize.
+ * XplatUIDriver.cs: Introduced Caption and FrameBorderSize.
+ * XplatUIX11.cs,
+ * XplatUIOSX: Caption and FrameBorderSize not implemented yet.
+ * XplatUIWin32.cs: Get Caption and FrameBorderSize from system.
+
+2005-05-30 Jackson Harper <jackson@ximian.com>
+
+ * DataFormat.cs: We can't statically initialize this stuff because
+ it calls into the xplatui and could create a loop. So we lazy init
+ it.
+
+2005-05-28 Jackson Harper <jackson@ximian.com>
+
+ * Control.cs: Proper implementation of Product(Name/Version).
+
+2005-05-27 Jackson Harper <jackson@ximian.com>
+
+ * DataObject.cs: Dont crash if no data is found.
+
+2005-05-26 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
+ * MdiClient.cs: Add missing Localizable attribute to BackgroundImage property
+ as per status page, guessing it should be set to true
+
+2005-05-26 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * DataGridTextBoxColumn.cs: Draws text and basic text formatting
+ * DataGridTableStyle.cs: set proper formatting text, def header text
+ * ThemeWin32Classic.cs: new themable paramaters
+ * DataGridBoolColumn.cs: paint check box, get data, fixes
+ * DataGridDrawingLogic.cs: huge improvements in painting, fixes, new methods
+ * DataGrid.cs: fixes properties, implements vertical and horizontal scrolling
+ * DataGridColumnStyle.cs: fixes
+ * Theme.cs: new themable paramaters
+
+2005-05-26 Peter Bartok <pbartok@novell.com>
+
+ * ContainerControl.cs: Pass AdjustFormScrollbars() call on to base
+
+2005-05-24 Jonathan S. Chambers <jonathan.chambers@ansys.com>
+ * Control.cs: Fixed LowOrder and HighOrder to preserve sign.
+
+2005-05-24 Peter Bartok <pbartok@novell.com>
+
+ * OpenFileDialog.cs, Form.cs, Menu.cs, GroupBox.cs, UserControl.cs,
+ Label.cs, DataGridTextBoxColumn.cs, PropertyGrid.cs, ErrorProvider.cs
+ Splitter.cs, Control.cs, FontDialog.cs, TabPage.cs,
+ FolderBrowserDialog.cs, HelpProvider.cs, DataGridTableStyle.cs,
+ NotifyIcon.cs, FileDialog.cs, ListView.cs, SaveFileDialog.cs,
+ ToolBarButton.cs, ImageList.cs, DataGridBoolColumn.cs, Panel.cs,
+ DataGrid.cs, DataGridTextBox.cs, ListBox.cs, TrackBar.cs,
+ AxHost.cs, TabControl.cs, ScrollableControl.cs, ToolBar.cs,
+ DataGridColumnStyle.cs, PictureBox.cs, DateTimePicker.cs,
+ StatusBar.cs, MonthCalendar.cs, TreeView.cs: Added
+ missing attributes, etc
+ * DataGridPreferredColumnWidthTypeConverter.cs: Added
+
+2005-05-24 Peter Bartok <pbartok@novell.com>
+
+ * Help.cs: Added, implemented trivial functions, throws up MessageBox
+ when user tries to get help
+ * DataObject.cs, DataFormats.cs, LinkArea.cs,
+ SelectionRangeConverter.cs, Clipboard.cs : Removed unused variables
+ to suppress warnings
+ * XplatUIWin32.cs, XplatUIOSX.cs, XplatUIX11.cs: Removed unused code to
+ avoid unreachable code warning
+
+2005-05-20 Peter Bartok <pbartok@novell.com>
+
+ * CursorConverter.cs (ConvertTo): Switched to use Cursor.GetObjectData
+
+2005-05-20 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * DataGridTextBoxColumn.cs: Basic painting methods
+ * DataGridTableStyle.cs: Set table style in the column
+ * ThemeWin32Classic.cs: Use Theme for colors
+ * DataGridDrawingLogic.cs: Implement more drawing
+ * DataGrid.cs: drawing, theming, enhacements, fixes
+ * DataGridColumnStyle.cs: fixes, drawing
+ * Theme.cs: theming for Datagrid
+
+2005-05-20 Peter Bartok <pbartok@novell.com>
+
+ * Cursor.cs: Implemented GetObjectData() method
+
+2005-05-20 Peter Bartok <pbartok@novell.com>
+
+ * Cursors.cs: Added setting of cursor name
+ * Cursor.cs:
+ - Implemented constructors
+ - Implemented Draw and DrawStretched
+ - Implemented Current property
+ - Implemented == and != operators
+ - Implemented Dispose()
+ - Implemented ToString
+ - Added missing attributes
+ * XplatUIX11.cs:
+ - Added missing reset for OverrideCursor when DoEvents is called
+ - Fixed creation of cursor, logic was wrong
+ * XplatUIWin32.cs:
+ - Added missing reset for OverrideCursor when DoEvents is called
+ - Fixed creation of cursor, bit arrays were swapped
+ * Clipboard.cs: Removed obsolete MonoTODO attribute
+
+2005-05-20 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ComboBox.cs: fixes OnSelectedItemChanged
+ * ControlBindingsCollection.cs: fixes item range check
+
+2005-05-20 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * UpDownBase.cs:
+ - Calc preferred height properly
+ - Implement missing properties
+
+ * NumericUpDown.cs: Implement missing events
+
+2005-05-19 Jackson Harper <jackson@ximian.com>
+
+ * TabControl.cs: New method that resizes the tab pages before
+ redrawing them. This as needed as the control is double buffered
+ and sizing will not be recalculated unless ResizeTabPages is
+ called.
+ * TabPage.cs: Set base.Text instead of Text in the constructor so
+ that UpdateOwner does not get called. Use the new Redraw method of
+ TabControl instead of Refresh so the sizing is recalculated.
+ * ThemeWin32Classic.cs: Draw the text for button tabs.
+
+2005-05-19 Jackson Harper <jackson@ximian.com>
+
+ * Control.cs: Paint control background images. Fix typo where
+ PaintControlBackground was not getting called correctly.
+
+2005-05-19 Peter Bartok <pbartok@novell.com>
+
+ * ScrollableControl.cs (DisplayRectangle): Undid my last change until
+ I can investigate, apparently I broke FileDialog
+
+2005-05-19 Marek Safar <marek.safar@seznam.cz>
+
+ * AxHost.cs: Some simple properties.
+ * Control.cs: window must be accessible after ctor.
+ * Form.cs: Added TransparencyKey property.
+ * TextBoxBase.cs: Implemented Clear. Text property can be null.
+ * XplatUIWin32.cs: SetBorderStyle implemented.
+
+2005-05-18 Peter Bartok <pbartok@novell.com>
+
+ * DataObject.cs: Entries are not global but particular to the
+ DataObject, now it behaves that way
+ * XplatUIWin32.cs: Implemented Clipboard methods
+ * Clipboard.cs: Implemented
+ * ScrollableControl.cs (DisplayRectangle): Fixed calculation
+ * XplatUIOSX.cs: Updated to final clipboard prototypes
+ * XplatUIX11.cs: Implemented Clipboard methods
+ * XplatUIDriver.cs: Updated to final clipboard prototypes
+ * XplatUIStructs.cs:
+ - Added BITMAPINFOHEADER struct
+ - Added ClipboardFormats enum
+ * X11Structs.cs:
+ - Added ClipboardStruct
+ - Added Atom enum items for clipboard types
+ - Fixed atom types for Selection event structures
+ * DataFormats.cs:
+ - Added internal properties and methods for drivers to enumerate
+ all known formats
+ - Switched initialization method to allow drivers to assign their
+ own IDs even for the MS predefined clipboard IDs
+ * XplatUI.cs: Updated to final clipboard interface
+
+2005-05-18 Jonathan S. Chambers <jonathan.chambers@ansys.com>
+ * PropertyGridView.cs: Fixed compiler warnings.
+
+2005-05-18 Jonathan S. Chambers <jonathan.chambers@ansys.com>
+ * PropertyGrid.cs: Added some event calls
+ * PropertyGridView.cs: Change drawing code to use double buffering
+ * PropertyGridTextBox.cs: Changed Text property name
+ * GridItem.cs: Added Bounds property.
+ * GridEntry.cs: Added Bounds property.
+
+2005-05-17 Lluis Sanchez Gual <lluis@novell.com>
+
+ * Binding.cs: Use IsInstanceOfType instead of IsAssignableFrom
+ since GetType() may not return the correct type if the object is
+ a remoting proxy.
+
+2005-05-17 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * TreeNodeCollection.cs: fixes get/set item ranges
+
+2005-05-15 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ListBox.cs: Kazuki Oikawa's PreferredHeight and ItemHeight fixes
+
+2005-05-15 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ComboBox.cs: Fix item range comparation
+ * ListView.cs: Fix item range comparation
+
+2005-05-03 Alexander Olk <xenomorph2@onlinehome.de>
+
+ * FontDialog.cs:
+ - Clear example panel when OnPaint is called
+ - Better solution for displaying the example panel text
+ - Select default indexes in the ListBoxes
+
+2005-05-11 Geoff Norton <gnorton@customerdna.com>
+
+ * XplatUIOSX.cs: Avoid painting into invisible views. Fixes #74926
+
+2005-05-11 Peter Bartok <pbartok@novell.com>
+
+ * LinkArea.cs: Added and implemented LinkAreaTypeConverter class
+ * SelectionRangeConverter.cs: Implemented
+ * PropertyGrid.cs: Fixed attribute value
+ * Control.cs:
+ - Invoke(): Don't call Begin/EndInvoke if it is not neccessary
+ - Added Sebastien Pouliot's CAS Stack Propagation fixes
+ * XplatUIDriver.cs: Added new XplatUIDriverSupport class, for code
+ that's common to all drivers. First methods to go there are
+ Sebastien Pouliot's CAS Stack Propagation helper methods
+ * XplatUIWin32.cs, XplatUIX11.cs, AsyncMethodData.cs: Fixes by
+ Sebastien Pouliot for CAS Stack Propagation
+
+2005-05-11 Geoff Norton <gnorton@customerdna.com>
+
+ * OSXStructs.cs:
+ XplatUIOSX.cs: More cosmetic cleanup courtesy of Artyom Tyazhelov (Artyom.Tyazhelov@helmes.ee)
+
+2005-05-12 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * DataGridTextBoxColumn.cs: fixed some members
+ * GridColumnStylesCollection.cs: indexed column is case insensitive
+ * DataGridTableStyle.cs: fixes
+ * ThemeWin32Classic.cs: add new theme parameter
+ * Theme.cs: add new theme parameter
+ * DataGridDrawingLogic.cs: Datagrid's drawing logic
+ * DataGrid.cs: fixes, new internal properties, etc.
+ * DataGridColumnStyle.cs: allows to set grid value
+ *
+
+2005-05-10 Peter Bartok <pbartok@novell.com>
+
+ * AccessibleObject.cs:
+ - Removed MonoTODO attribute on help, method is correct
+ - Fixed Bounds property
+ * AxHost.cs: Moved MonoTODO
+ * ButtonBase.cs: Now setting AccessibleObject properties
+ * RadioButton.cs: Setting proper AccessibleObject role
+ * CheckBox.cs: Setting proper AccessibleObject role
+ * ControlBindingsCollection.cs: Added properties, methods and attributes
+ * DataFormats.cs: Fixed awkward internal API, and changed to enable
+ userdefined DataFormats.Format items as well
+ * ListControl.cs: Removed data_member from the public eye
+ * OpenFileDialog.cs:
+ - Made class sealed
+ - Added missing attributes
+ * SaveFileDialog.cs: Added missing attributes
+ * ImageListStreamer.cs: Fixed code that caused warnings
+ * LinkLabel.cs: Removed unreachable code
+ * TreeView.cs: Fixed code that caused warnings
+ * PropertyGridView.cs: Fixed code that caused warnings
+ * GridColumnStylesCollection.cs: Added missing attributes
+ * GridTableStylesCollection: Added missing attribute
+ * PropertyManager: Added .ctor
+ * SecurityIDType: Added
+ * DataObject.cs: Implemented class
+ * LinkArea.cs: Added missing attribute
+
+2005-05-11 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * RadioButton.cs: call base method to allow to fire OnClick event
+ * UpDownBase.cs: OnMouseUp call base method
+ * CheckedListBox.cs: call base method before returning
+ * TrackBar.cs: call base method before returning
+
+
+2005-05-10 Peter Bartok <pbartok@novell.com>
+
+ * XplatUIX11.cs: Fix for #74902, check pending timers when peeking
+ for messages
+
+2005-05-10 Peter Bartok <pbartok@novell.com>
+
+ * DataFormats.cs: Implemented
+ * XplatUI.cs, XplatUIDriver.cs, XplatUIOSX.cs,
+ XplatUIX11.cs: Added Clipboard APIs
+ * XplatUIWin32.cs: Implemented Clipboard APIs
+ * FolderBrowserDialog.cs: Added missing event, attributes
+
+2005-05-10 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * CheckBox.cs: call base method to allow to fire OnClick event
+
+2005-05-09 Sebastien Pouliot <sebastien@ximian.com>
+
+ * XplatUI.cs: Use PlatformID.Unix under NET_2_0.
+
+2005-05-06 Peter Bartok <pbartok@novell.com>
+
+ * XplatUIX11.cs: Redid Jackson's fix, it was causing a busy loop
+ * Screen.cs: Implemented
+ * HelpNavigator.cs: Added
+ * XplatUIWin32.cs: Added SystemParametersInfo call, fixed WorkArea
+ property
+ * HelpProvider.cs: Implemented all we can do until we have a CHM
+ help library (which means that "What's This" does work now)
+
+2005-05-06 Jackson Harper <jackson@ximian.com>
+
+ * XplatUIX11.cs: Fix waking up the main loop.
+
+2005-05-05 Peter Bartok <pbartok@novell.com>
+
+ * XplatUI.cs: Updated revision
+ * Form.cs: Removed enless loop
+ * GroupBox.cs (OnPaint): Added call to base.OnPaint()
+ * Label.cs (OnPaint): Added call to base.OnPaint()
+ * ToolTip.cs: Made ToolTipWindow reusable for other controls
+ * LinkLabel.cs (OnPaint): Added call to base.OnPaint()
+ * UpDownBase.cs (OnPaint): Moved base.OnPaint() call to end of method
+ * AxHost.cs: Added
+ * ButtonBase.cs: Moved base.OnPaint() call to end of method
+ * ThemeWin32Classic.cs: Replaced references to ToolTip with references
+ to ToolTip.ToolTipWindow for drawing and size methods; this allows
+ reuse of ToolTipWindow by other controls
+ * SizeGrip.cs: Moved base.OnPaint() call to end of method
+ * XplatUIX11.cs: Now clipping drawing area (experimental)
+ * PictureBox.cs: Moved base.OnPaint() call to end of method
+ * Theme.cs: Fixed ToolTip abstracts to match new format
+ * ErrorProvider.cs: Implemented
+
+2005-05-05 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * Label.cs: fire events using OnAutoSizeChanged and OnTextAlignChanged
+ * LinkLabel.cs:
+ - Adds cursors
+ - Handles focus
+ - Implements LinkBehavior
+ - Fixes many issues
+
+2005-05-03 Jackson Harper <jackson@ximian.com>
+
+ * ListView.cs: Calculate the scrollbar positioning on resize and
+ paint, so they get put in the correct place.
+
+2005-05-03 Alexander Olk <xenomorph2@onlinehome.de>
+
+ * ColorDialogs.cs: The small color panels are now handled by
+ SmallColorControl. This fixes drawing of the focus rectangle
+ and adds a 3D border.
+
+2005-05-03 Peter Bartok <pbartok@novell.com>
+
+ * Control.cs: Modified version of Jonathan Chamber's fix for
+ double-buffering
+
+2005-05-03 Jackson Harper <jackson@ximian.com>
+
+ * ListView.cs: Remove redraw variable. Control now handles whether
+ or not a redraw needs to be done, and will only raise the paint
+ event if redrawing is needed.
+
+2005-05-03 Jackson Harper <jackson@ximian.com>
+
+ * Splitter.cs: No decorations for the splitter form. Cache the
+ hatch brush.
+
+2005-05-03 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Use dashed lines to connect nodes. Use the
+ ControlPaint method for drawing the focus rect instead of doing
+ that in treeview.
+
+2005-05-02 Peter Bartok <pbartok@novell.com>
+
+ * LinkLabel.cs: Fixed the fixes from r43566 and 43521
+
+2005-04-29 Jackson Harper <jackson@ximian.com>
+
+ * ThemeWin32Classic.cs: Don't clear the GC that will clear the
+ entire image buffer. Just clear the clipping rectangle.
+
+2005-04-29 Jackson Harper <jackson@ximian.com>
+
+ * ThemeWin32Classic.cs: Don't draw list view items that are
+ outside the clipping rectangle.
+
+2005-04-29 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ListBox.cs: added horizontal item scroll
+
+2005-04-29 Jackson Harper <jackson@ximian.com>
+
+ * ThemeWin32Classic.cs: Remove some old debug code that was
+ causing flicker with the new double buffering code.
+
+2005-04-29 John BouAntoun <jba-mono@optusnet.com.au>
+
+ * MonthCalendar.cs, DateTimePicker.cs: Made monthcalendar dropdwon
+ behave like combobox and comboboxlist (still not sure if this is
+ correct though).
+
+2005-04-28 Jackson Harper <jackson@ximian.com>
+
+ * ThemeWin32Classic.cs: Don't fill the middle of progress
+ bars. This fills areas outside of the clip bounds that don't need
+ to be filled.
+
+2005-04-28 Jackson Harper <jackson@ximian.com>
+
+ * Control.cs: Don't expose functionality to touch the image buffers.
+ * ProgressBar.cs:
+ * ListView.cs: We do not need to (and no longer can) manipulate
+ the image buffers directly. All of this is handled by Control.
+
+2005-04-28 Peter Bartok <pbartok@novell.com>
+
+ * RichTextBoxSelectionAttribute.cs, RichTextBoxSelectionTypes.cs,
+ RichTextBoxScrollBars.cs, RichTextBoxStreamType.cs,
+ RichTextBoxFinds.cs, RichTextBoxWordPunctuations.cs: Added
+
+2005-04-28 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * Combobox:
+ - Adjust control's height for non-simple comboboxes (bug fix)
+ - Remove dead code
+ * MenuAPI.cs: remove unused var
+ * ScrollBar.cs: remove unsed var
+
+ * ListBox.cs: unselect items when clearing
+
+2005-04-28 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ListControl.cs: honors OnPositionChanged and default Selected Item
+ * ListBox.cs: unselect items when clearing
+
+2005-04-27 Jackson Harper <jackson@ximian.com>
+
+ * X11Keyboard.cs: Initialize a default keyboard and give a warning
+ if a "correct" keyboard is not found. This will make us not crash,
+ but might give some users bad keyboard layouts...seems to be the
+ same thing rewind does.
+
+2005-04-27 Jackson Harper <jackson@ximian.com>
+
+ * BindingManagerBase.cs: Attach the current/position changed
+ handlers to their respective events.
+
+2005-04-27 Jackson Harper <jackson@ximian.com>
+
+ * Control.cs: Make sure that the first WM_PAINT does a full draw,
+ not just a blit.
+ * ThemeWin32Classic.cs: Don't fill the background for picture
+ boxes. This could overright user drawing.
+ * ComboBox.cs: Just fill the clipping rect not the entire client
+ rect when drawing the background. This prevents pieces of the
+ image buffer from getting overwritten and is theoretically faster.
+
+2005-04-26 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ComboBox.cs: Databinding support fixes, fire missing events
+ * ListControl.cs: implement missing methods and properties, fixes
+ * ThemeWin32Classic.cs: Databiding support on Drawing
+ * CheckedListBox.cs: Databinding support fixes, fire missing events
+ * ListBox.cs: Databinding support fixes, fire missing events
+
+2005-04-25 Peter Bartok <pbartok@novell.com>
+
+ * LinkLabel.cs: Length of LinkArea is not allowed to be negative
+
+2005-04-25 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Use the horizontal scrollbars height not width when
+ determining how much of the client area is available.
+
+2005-04-25 Jackson Harper <jackson@ximian.com>
+
+ * Control.cs: Double buffering is handled differently now. As per
+ the spec, the extra buffer is created in the WM_PAINT message and
+ passed down to the control's drawing code.
+ * GroupBox.cs:
+ * Label.cs:
+ * CheckBox.cs:
+ * ProgressBar.cs:
+ * RadioButton.cs:
+ * ColorDialog.cs:
+ * ComboBox.cs:
+ * PropertyGridView.cs:
+ * UpDownBase.cs:
+ * MessageBox.cs:
+ * MenuAPI.cs:
+ * ListView.cs:
+ * ButtonBase.cs:
+ * SizeGrip.cs:
+ * ScrollBar.cs:
+ * ListBox.cs:
+ * TrackBar.cs:
+ * ToolBar.cs:
+ * PictureBox.cs:
+ * DateTimePicker.cs:
+ * StatusBar.cs:
+ * TreeView.cs: Update to new double buffering system.
+ * MonthCalendar.cs: Uncomment block, as Capture is now
+ working. Update to new double buffering
+ * LinkLabel.cs: Lazy init the link collection. Update to new double buffering
+ * PaintEventArgs.cs: New internal method allows us to set the
+ graphics object. This is used for double buffering.
+ * ThemeWin32Classic.cs: Give the picture box drawing code a clip
+ rectangle. The internal paint_area var has been removed from
+ StatusBar. The clipping rect should be used instead.
+ * Theme.cs: Give the PictureBox drawing method a clipping rect.
+ * TabPage.cs: The RefreshTabs method was removed, so just call the
+ tab controls Refresh method now.
+ * TabControl.cs: Update to new double buffering. Make sure the
+ handle is created before sizing the tab pages, otherwise we will
+ get stuck in a loop.
+
+2005-04-24 Borja Sanchez Zamorano <borsanza@gmail.com>
+
+ * LinkLabel.cs: Fix typo, bug #74719; patch
+ from Borja Sanchez Zamorano
+
+2005-04-22 Jackson Harper <jackson@ximian.com>
+
+ * TreeNode.cs: Implement Handle stuff.
+ * TreeView.cs: Utility methods so nodes can get/lookup by handle.
+
+2005-04-22 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * DataGridTextBoxColumn.cs: call base constructors, fixes
+ * GridColumnStylesCollection.cs: missing events, methods, and functionality
+ * GridTableStylesCollection.cs: fixes, check duplicate mapping names
+ * DataGridTableStyle.cs: implements create default column styles
+ * DataGridBoolColumn.cs: which types can handle
+ * DataGrid.cs: missing methods, fixes, new functionality
+ * DataGridColumnStyle.cs: fixes
+
+2005-04-20 Alexander Olk <xenomorph2@onlinehome.de>
+ * FolderBrowserDialog.cs:
+ - Use a thread to fill the TreeView
+ - Adjusted some sizes
+
+2005-04-19 Peter Bartok <pbartok@novell.com>
+
+ * LinkLabel.cs: (Re-)create the pieces when setting the Text
+ property. Fixes #74360.
+
+2005-04-19 Jackson Harper <jackson@ximian.com>
+
+ * XEventQueue.cs: Lock when getting the lockqueue size.
+ * PictureBox.cs: Call base OnPaint
+
+2005-04-19 Peter Bartok <pbartok@novell.com>
+
+ * XplatUIX11.cs: Fixed bug introduced with the HWND rewrite, Async
+ messages were no longer being processed (this broke BeginInvoke)
+
+
+2005-04-18 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: buglet that caused node images to get drawn
+ regardless of whether or not they were in the clipping rectangle.
+
+2005-04-18 Jackson Harper <jackson@ximian.com>
+
+ * CurrencyManager.cs: There are four rules for GetItemProperties:
+ - If the type is an array use the element type of the array
+ - If the type is a typed list, use the type
+ - If the list contains an Item property that is not an object, use
+ that property
+ - use the first element of the list if there are any elements in
+ the list.
+
+2005-04-17 Jackson Harper <jackson@ximian.oom>
+
+ * TreeView.cs: Calculate plus minus and checkbox bounds when there is a
+ click. This handles offsets for scrolling properly and reduces
+ memory. Also fixed GetNode to not offset now that TopNode works
+ properly.
+ * TreeNode.cs: No longer need to track the plus minus or checkbox bounds.
+
+2005-04-17 Jackson Harper <jackson@ximian.com>
+
+ * CursorConverter.cs: Initial implementation.
+
+2005-04-15 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ListControl.cs: work towards complex data binding support on ListControl
+ * CurrencyManager.cs: work towards complex data binding support on ListControl
+ * ListBox.cs: work towards complex data binding support on ListControl
+
+
+2005-04-15 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * GridTableStylesCollection.cs: fixes name and constructor
+ * DataGridTableStyle.cs: fixes
+ * DataGridBoolColumn.cs: fixes names and constructors
+ * DataGrid.cs: define methods and properties. Some init implementations
+ * DataGridCell.cs: define methods and properties. Some init implementations
+ * GridTablesFactory.cs: Define methods and properties
+
+2005-04-15 Geoff Norton <gnorton@customerdna.com>
+
+ * XplatUIOSX.cs: Handle proper mouse tracking even if the current
+ graphics port changes. We still want the coordinates in global screen
+ coordinates.
+
+2005-04-14 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Handle clicks when plus minus is disabled. Don't
+ check plus minus or checkbox clicks unless those features are enabled.
+
+2005-04-14 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Add methods for setting the top and bottom visible
+ nodes. TreeNode::EnsureVisible uses these methods.
+ * TreeNode.cs: Implement EnsureVisible
+
+2005-04-13 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * Form.cs: Pospone menu assignation if the window has not been created yet
+ * XplatUIWin32.cs: Fixes Win32SetWindowPos, then does not change window
+ size and position
+
+2005-04-12 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Set the TopNode properly when scrolling
+ occurs. This has the added benifit of reducing the amount of
+ walking that needs to be done when drawing. Also removed an old
+ misleading TODO.
+ * OpenTreeNodeEnumerator.cs: Fix moving backwards.
+
+2005-04-11 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * Timer.cs: fixes interval setting when the timer is already enabled
+
+2005-04-10 Alexander Olk <xenomorph2@onlinehome.de>
+
+ * FolderBrowserDialog.cs: First approach
+
+2005-04-09 Peter Bartok <pbartok@novell.com>
+
+ * FolderBrowserDialog: Added
+
+2005-04-07 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * LinkLabel.cs: move drawing code into the theme
+ * ThemeWin32Classic.cs: drawing code and painting background bugfix
+ * Theme.cs: define DrawLinkLabel method
+
+2005-04-05 Jackson Harper <jackson@ximian.com>
+
+ * BindingContext.cs: Use weak references so these bad actors don't
+ stay alive longer then they need to.
+
+2005-04-05 Jackson Harper <jackson@ximian.com>
+
+ * ListControl.cs: Basic implementation of complex databinding.
+ * ComboBox.cs:
+ * ListBox.cs: Add calls to ListControl databinding methods.
+
+2005-04-05 Alexander Olk <xenomorph2@onlinehome.de>
+
+ * FileDialog.cs:
+ - Don't change PopupButtonState to Normal when the
+ PopupButton gets pressed several times.
+ - Renamed ButtonPanel to PopupButtonPanel
+
+2005-04-05 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ColorDialog.cs: Use cached objects instead of creating them
+ * LinkLabel.cs: Use cached objects instead of creating them
+ * Splitter.cs: Use cached objects instead of creating them
+ * FontDialog.cs: Use cached objects instead of creating them
+ * PropertyGridView.cs: Use cached objects instead of creating them
+ * MessageBox.cs: Use cached objects instead of creating them
+ * FileDialog.cs: Use cached objects instead of creating them
+ * ThemeWin32Classic.cs: Use cached objects instead of creating them
+ * TreeView.cs: Use cached objects instead of creating them
+
+2005-04-04 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * Control.cs: use Equals to compare the font since no == op
+ * ScrollBar.cs: use Equals to compare the font since no == op
+
+2005-04-04 Alexander Olk <xenomorph2@onlinehome.de>
+
+ * SaveFileDialog.cs: Open stream in OpenFile with FileMode Create
+
+2005-04-01 Jackson Harper <jackson@ximian.com>
+
+ * Binding.cs: Implement IsBinding.
+ * BindingManagerBase.cs:
+ * PropertyManager.cs:
+ * CurrencyManager.cs: Add IsSuspended property.
+
+2005-04-01 Jackson Harper <jackson@ximian.com>
+
+ * Binding.cs: Had some IsAssignableFrom calls backwards.
+
+2005-04-01 Jackson Harper <jackson@ximian.com>
+
+ * Binding.cs: Handle null data members when pulling data.
+ * PropertyManager.cs: Handle the data member being a property that
+ does not exist.
+
+2005-04-01 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * DataGridTextBoxColumn.cs: fixes signature
+ * DataGrid.cs: calls right constructor
+
+2005-04-01 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * DataGridTextBoxColumn.cs: implements DataGridTextBoxColumn class
+ * GridColumnStylesCollection.cs: implements GridColumnStylesCollection
+ * GridTableStylesCollection.cs: implements GridTableStylesCollection
+ * DataGridTableStyle.cs: implements DataGridTableStyle
+ * DataGridBoolColumn.cs: implements DataGridBoolColumn
+ * DataGridTextBox.cs: implements DataGridTextBox
+ * DataGridColumnStyle.cs: implements DataGridColumnStyle
+
+2005-03-31 Alexander Olk <xenomorph2@onlinehome.de>
+
+ * FileDialog.cs: Added simple PopupButton class for ButtonPanel
+
+2005-03-29 Peter Bartok <pbartok@novell.com>
+
+ * Application.cs:
+ - Properly implemented CompanyName property
+ - Fixed LocalUserAppDataPath and UserAppDataPath, now properly
+ returns a path that includes CompanyName, ProductName and
+ Version (fixes bug #70330)
+
+2005-03-29 Stefan Buehler <sbuehler@gmx.ch>
+
+ * TabPage.cs: Don't use Owner.DisplayRectangle unless owner is valid,
+ fixes bug #72588.
+
+2005-03-28 Alexander Olk <xenomorph2@onlinehome.de>
+
+ * FileDialog.cs, SaveFileDialog.cs OpenFileDialog.cs:
+
+ - Added ReadOnly CheckBox
+ - Further refactoring: moved some code from Open-/SaveFileDialog
+ to FileDialog
+
+2005-03-28 Alexander Olk <xenomorph2@onlinehome.de>
+
+ * OpenFileDialog.cs: Fixed CheckFileExists
+ * FileDialog.cs:
+ Moved FileView and DirComboBox outside FileDialog class.
+ They can now be used outside FileDialog
+
+2005-03-27 Alexander Olk <xenomorph2@onlinehome.de>
+
+ * FileDialog.cs: Added a contextmenu to change ShowHiddenFiles
+ * SaveDialog.cs, OpenFileDialog.cs: Fixes for Reset() method
+
+2005-03-27 Alexander Olk <xenomorph2@onlinehome.de>
+
+ * FileDialog.cs, OpenFileDialog.cs, SaveFileDialog.cs:
+ - Added missing CreatePrompt property in SaveDialog
+ - Overall SaveDialog handling should be better now
+ - Added non standard ShowHiddenFiles property
+ - Added extension, CreatePrompt and OverwritePrompt support in SaveDialog
+ - Added InitialDirectory and RestoreDirectory support
+
+2005-03-26 Alexander Olk <xenomorph2@onlinehome.de>
+
+ * FileDialog.cs: Made dirComboBox usable
+
+2005-03-24 Alexander Olk <xenomorph2@onlinehome.de>
+
+ * FileDialog.cs: Added Filter support (case sensitiv)
+
+2005-03-24 Jackson Harper <jackson@ximian.com>
+
+ * TabControl.cs: Need a couple more pixels for the lines.
+
+2005-03-23 Jackson Harper <jackson@ximian.com>
+
+ * TabControl.cs: Give the tab page focus when it is selected.
+
+2005-03-23 Jackson Harper <jackson@ximian.com>
+
+ * TabControl.cs: Account for the drawing of tabs borders when
+ invalidating. If the slider was clicked dont do click detection on
+ the tabs.
+
+2005-03-23 Jackson Harper <jackson@ximian.com>
+
+ * TabControl.cs: Fix typo, emilinates an unneeded expose event.
+
+2005-03-22 Jonathan Chambers <jonathan.chambers@ansys.com>
+
+ * CategoryGridEntry.cs: Added
+ * GridItem.cs: Added helper properties
+ * PropertyGridTextBox.cs: Custom textbox control for PropertyGrid.
+ * GridEntry.cs: Updated code for collection
+ * PropertyGrid.cs: Cleaned up some formatting
+ * PropertyGridView.cs: Added drop down functionality for enums.
+ * GridItemCollection.cs: Added enumerator logic
+ * PropertyGridEntry.cs: Added
+
+2005-03-19 Alexander Olk <xenomorph2@onlinehome.de>
+
+ * FileDialog.cs:
+ - Removed unnecessary commented code
+ - Fixed handling for entering the filename manually in the combobox
+
+2005-03-19 Alexander Olk <xenomorph2@onlinehome.de>
+
+ * FileDialog.cs, OpenFileDialog.cs: OpenFileDialog Multiselect now works
+
+2005-03-18 Peter Bartok <pbartok@novell.com>
+
+ * ThemeWin32Classic.cs: Moved listview column headers a bit, to avoid
+ them being touching the border
+
+2005-03-18 Peter Bartok <pbartok@novell.com>
+
+ * TextControl.cs: Quick hack to center text better
+
+2005-03-18 Peter Bartok <pbartok@novell.com>
+
+ * ControlPaint.cs:
+ - Don't throw NotImplemented exceptions, just print a notice once
+ instead (requested by Miguel). This makes running existing SWF
+ apps a bit easier
+ * Control.cs:
+ - Commented out Drag'N'Drop XplatUI call (no driver support yet)
+ - Added context menu trigger on right click
+ * Panel.cs: Trigger invalidate on resize
+ * StatusBar.cs:
+ - Removed old double-buffer drawing
+ - Added ResizeRedraw style to force proper update of statusbar
+ * ListView.cs:
+ - Removed debug output
+ * ThemeWin32Classic.cs:
+ - Fixed drawing of status bar, now draws Text property if there
+ are no defined panels
+
+2005-03-18 Jackson Harper <jackson@ximian.com>
+
+ * ImageList.cs: When the image stream is set pull all the images
+ from it.
+ * ImageListStreamer.cs: Implement reading image list streams.
+
+2005-03-18 Peter Bartok <pbartok@novell.com>
+
+ * ThemeWin32Classic.cs (DrawPictureBox):
+ - Fixed calculations for centered drawing
+ - Fixed drawing for normal mode, not scaling the image on normal
+
+2005-03-18 Peter Bartok <pbartok@novell.com>
+
+ * ComboBox.cs: Now also firing the OnKeyPress events for the embedded
+ textbox
+ * FileDialog.cs:
+ - Made Open/Save button the accept button for FileDialog
+ - Tied the cancel button to the IButtonControl cancel button
+ - Save/Open now properly builds the pathname
+ - Now handles user-entered text
+ - Preventing crash on right-click if no item is selected
+ - Fixed Text property, now uses contents of textbox
+ - Fixed SelectedText property, now just returns the text part that
+ is selected in the text box
+
+2005-03-18 Jackson Harper <jackson@ximian.com>
+
+ * ThemeWin32Classic.cs: Use the proper func for drawing the focus
+ rect, make sure to de-adjust the interior rect after drawing the
+ tab text.
+
+2005-03-18 Peter Bartok <pbartok@novell.com>
+
+ * MenuAPI.cs: Remove menu *before* executing selected action to
+ prevent the menu from 'hanging around'
+
+2005-03-17 Geoff Norton <gnorton@customerdna.com>
+
+ * XplatUIOSX.cs: Implemented WorkingArea property
+
+2005-03-17 Peter Bartok <pbartok@novell.com>
+
+ * XplatUIX11.cs: Fixed menu coord calculations
+ * MenuAPI.cs: Now using new ScreenToMenu()/MenuToScreen() methods
+ for calculating offsets
+
+2005-03-17 Peter Bartok <pbartok@novell.com>
+
+ * Hwnd.cs: Do not consider menu presence for default client
+ rectangle location/size
+ * XplatUI.cs, XplatUIDriver.cs, XplatUIX11.cs, XplatUIOSX.cs,
+ XplatUIWin32.cs: Added MenuToScreen() and ScreenToMenu() coord
+ translation functions
+ * FileDialog.cs: Fixed (what I presume is a) typo
+
+2005-03-17 Jonathan Gilbert <logic@deltaq.org>
+
+ * XplatUIX11.cs: Added call to XInitThreads() to allow multi-threaded
+ X access (avoids X-Async errors)
+
+2005-03-16 Jackson Harper <jackson@ximian.com>
+
+ * TabControl.cs: Raise the SelectedIndexChanged event.
+
+2005-03-16 Alexander Olk <xenomorph2@onlinehome.de>
+
+ * FileDialog.cs, OpenFileDialog.cs, SaveFileDialog.cs:
+ - Removed vertical ToolBar and replaced it with a custom panel
+ (desktop and home button already work)
+ - Added Help button (some controls get resized or relocated then)
+ - Draw correct text depending on Open or Save.
+ - Fixed some typos...
+
+2005-03-16 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ScrollBar.cs:
+ - Only change Maximum and Minimum when need it (bug fix)
+
+2005-03-15 Peter Bartok <pbartok@novell.com>
+
+ * Form.cs: Use Handle for icon, to trigger creation if
+ the window does not yet exist
+ * Control.cs:
+ - CanSelect: Slight performance improvement
+ - Focus(): Preventing possible recursion
+ - Invalidate(): Removed ControlStyle based clear flag setting
+ - WM_PAINT: fixed logic for calling OnPaintBackground
+ - WM_ERASEBKGND: Fixed logic, added call to new driver method
+ EraseWindowBackground if the control doesn't paint background
+ * XplatUIWin32.cs:
+ - Moved EraseWindowBackground() method to internal methods
+ - Removed unused WM_ERASEBKGND handling in GetMessage; msg never comes;
+ is sent via SendMessage on BeginPaint call on Win32
+ * XplatUIX11.cs:
+ - Added EraseWindowBackground() method
+ - No longer sends WM_ERASEBKGND on .Expose, but on call to
+ PaintEventStart, which more closely matches Win32 behaviour
+ - Fixed Invalidate() call, now updates new ErasePending Hwnd property
+ - Fixed SetFocus() to properly deal with client and whole windows
+ * Hwnd.cs: Added ErasePending property
+ * XplatUIOSX.cs: Stubbed EraseWindowBackground() method
+ * XplatUI.cs, XplatUIDriver.cs: Added EraseWindowBackground() method
+
+2005-03-12 Geoff Norton <gnorton@customerdna.com>
+
+ * XplatUIOSX.cs:
+ - Fix hard loop when timers exist.
+ - Fix bugs with middle and right click for 3 button mice.
+
+2005-03-11 Peter Bartok <pbartok@novell.com>
+
+ * XplatUIX11.cs:
+ - get_WorkingArea: Need to call X directly, GetWindowPos only
+ returns cached data now
+ - Added sanity check to GetWindowPos hwnd usage
+
+2005-03-11 Jackson Harper <jackson@ximian.com>
+
+ * BindingManagerBase.cs: This method isn't used anymore as
+ PullData now updates the data in the control.
+
+2005-03-11 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * Form.cs: fixes menu drawing on X11
+ * MenuAPI.cs: fixes menu drawing on X11
+
+2005-03-11 Peter Bartok <pbartok@novell.com>
+
+ * Control.cs: Changed OnCreateControl behaviour based on a suggestion
+ from Jonathan Gilbert; should fix bug #73606
+ * XplatUIX11.cs: Fixed NC Mouse message coordinates, they need to be
+ in Screen coordinates. Thanks, Jordi.
+ * Form.cs: Added missing attribute
+
+2005-03-11 Peter Bartok <pbartok@novell.com>
+
+ * Form.cs:
+ - Rudimentary Mdi support
+ - Removed outdated FormParent code
+ - Implemented lots of missing properties and methods, still missing
+ transparency support
+ - Added missing attributes
+ - Implemented support for MaximumBounds
+ - Added firing of various events
+ * XplatUI.cs: Added SetIcon() method
+ * XplatUIDriver.cs: Added SetIcon() abstract
+ * XplatUIOSX.cs: Stubbed out SetIcon() method
+ * XplatUIX11.cs:
+ - Implemented SetIcon() support
+ - Moved SetMenu() and SetBorderStyle() to proper alphabetical pos
+ - Switched to unix line endings
+ * XplatUIWin32.cs:
+ - Made POINT internal so for can access it as part of MINMAX
+ - Implemented SetIcon() support
+ - Implemented support for CLIENTCREATESTRUCT (but might have to drop
+ native Mdi support again, might have to go managed)
+ * Control.cs: Now fires the StyleChanged event
+ * MdiClient.cs: Added; still mostly empty
+
+2005-03-10 Peter Bartok <pbartok@novell.com>
+
+ * SaveFileDialog.cs: Added emtpy file
+
+2005-03-08 Peter Bartok <pbartok@novell.com>
+
+ * Control.cs: Fixed bug #73190; now invokes CreateControl (which
+ in turn triggers OnCreateContro) when creating a handle for the
+ first time.
+ * TextControl.cs: Fixed endless loop in certain cases when
+ replacing the current selection
+
+2005-03-08 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ScrollBar.cs:
+ - Honors NewValue changes in Scroll events allowing apps to change it
+ - Adds First and Last Scroll events
+ - Fixes Thumb events
+
+2005-03-07 Peter Bartok <pbartok@novell.com>
+
+ * Hwnd.cs: Added DefaultClientRectangle property
+ * XplatUI.cs: Now using the X11 driver Where() method, which provides
+ more detailed debug information
+ * XplatUIX11.cs:
+ - Fixed size-change feedback loop, where we would pull an old size
+ off the queue and mistakenly change our window's size to an
+ earlier value
+ - Now compressing ConfigureNotify events, to reduce looping and
+ redraw issues
+ * TextBoxBase.cs: Preventing crash when no text is set and ToString()
+ is called
+
+2005-03-07 Jackson Harper <jackson@ximian.com>
+
+ * Binding.cs: Push data pushes from data -> property. Check if the
+ property is readonly when attempting to set it.
+
+2005-03-07 Jackson Harper <jackson@ximian.com>
+
+ * Binding.cs: Format and parse data correctly. Use ASsignableFrom
+ instead of IsSubclassOf. Pulling data now sets the value on the
+ control.
+ * PropertyManager.cs:
+ * CurrencyManager.cs: Just need to pull data when updating now,
+ because PullData will set the value on the control.
+
+2005-03-04 Jackson Harper <jackson@ximian.com>
+
+ * Binding.cs: Implement data type parsing and converting on pulled
+ data. TODO: Are there more ways the data can be converted?
+
+2005-03-04 Jackson Harper <jackson@ximian.com>
+
+ * Binding.cs: Support <Property>IsNull checks. Also bind to the
+ controls Validating method so we can repull the data when the
+ control loses focus.
+
+2005-03-03 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ColumnHeader.cs:
+ - Fixes null string format
+
+ * ListView.cs:
+ - Adds enum type checks
+ - Fixes redrawing and recalc need after changing some properties
+ - Fixes on focus_item set after the event
+ - Fixes adding columns after the control has been created
+
+ * ThemeWin32Classic.cs:
+ - Fixes CheckBox focus rectangle
+ - Fixes ColumnHeader drawing
+
+
+2005-03-03 Jackson Harper <jackson@ximian.com>
+
+ * Binding.cs: Bind to <Property>Changed events so we can detect
+ when properties are changed and update the data.
+
+2005-03-02 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ImageList.cs:
+ - Changes 32-bit pixel format to Format32bppArgb to allow transparency
+ - Fixes ImageList constructor with ImageList container
+ - Fixes image scaling (wrong parameters at DrawImage)
+
+2005-02-02 Jackson Harper <jackson@ximian.com>
+
+ * Binding.cs: Make property searches case-insensitive. Eliminate
+ some duplicated code.
+
+2005-03-01 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ComboBox.cs:
+ - Handle focus event
+ - Fix scrollbar events
+ - Discard highlighted item if remove it
+ - Fixes SelectedItem with strings
+
+2005-03-01 Peter Bartok <pbartok@novell.com>
+
+ * Control.cs:
+ - Fixed Visible property, now follows (once again) parent chain
+ to return false if any control in the chain is visible=false
+ - Fixed OnParentVisibleChanged, now just calls OnVisibleChanged event
+ - Fixed several places where is_visible instead of Visible was used
+ - Implemented FIXME related to focus selection when setting focused
+ control to be invisible
+
+ * XplatUIWin32.cs: Now using proper method to find out if window is
+ visible. Thanks to Jordi for pointing it out
+
+2005-02-28 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ComboBox.cs: show/hide scrollbar instead of creating it
+
+2005-02-27 Jackson Harper <jackson@ximian.com>
+
+ * CurrencyManager.cs: Add PositionChanged stuff.
+
+2005-02-27 Peter Bartok <pbartok@novell.com>
+
+ * XplatUI.cs, XplatUIDriver.cs: Added new GetMenuOrigin() method
+ * XplatUIOSX.cs: Added GetMenuOrigin() stub
+ * XplatUIWin32.cs: Implemented GetMenuOrigin()
+ * XplatUIX11.cs:
+ - Implemented GetMenuDC()
+ - Implemented GetMenuOrigin()
+ - Implemented ReleaseMenuDC()
+ - Implemented generation of WM_NCPAINT message
+ - Implemented generation and handling of WM_NCCALCSIZE message
+ * Form.cs: Added debug helper message for Jordi's menu work
+ * Hwnd.cs:
+ - Modified ClientRect property; added setter, fixed getter to handle
+ setting of ClientRect
+ - Added MenuOrigin property
+
+2005-02-26 Peter Bartok <pbartok@novell.com>
+
+ * XplatUIX11.cs:
+ - Destroys the caret if a window that's being destroyed contains it
+ - Ignores expose events coming from the X11 queue for windows that
+ already are destroyed
+ - Now uses the proper variable for handling DestroyNotify, before we
+ marked the wrong window as destroyed
+ - Improved/added some debug output
+
+2005-02-26 Peter Bartok <pbartok@novell.com>
+
+ * X11Keyboard.cs: Fixes to work on 64bit systems
+
+2005-02-26 Peter Bartok <pbartok@novell.com>
+
+ * Control.cs:
+ - Now calling OnHandleDestroyed from DestroyHandle()
+ instead of Dispose()
+ - Removed bogus call to controls.Remove() from DestroyHandle()
+
+2005-02-26 Peter Bartok <pbartok@novell.com>
+
+ * Control.cs: Properly destroy child windows when our handle is
+ destroyed
+
+2005-02-25 Peter Bartok <pbartok@novell.com>
+
+ * XplatUI.cs:
+ - Added 'DriverDebug' define to allow tracing XplatUI API calls
+ - Alphabetized Static Methods and Subclasses
+
+ * XplatUIX11.cs:
+ - Added XException class to allow custom handling of X11 exceptions
+ - Created custom X11 error handler, tied into XException class
+ - Added support for MONO_XEXCEPTIONS env var to allow the user
+ to either throw an exception on X errors or continue running
+ after displaying the error
+ - Added handling of DestroyNotify message
+ - Added handler for CreateNotify message (still disabled)
+ - Improved (tried to at least) Where method to provide file and lineno
+ * X11Structs.cs:
+ - Added XErrorHandler delegate
+ - Added XRequest enumeration (to suppor translation of errors)
+
+2005-02-25 Jackson Harper <jackson@ximian.com>
+
+ * PropertyManager.cs: Implement editing features
+ * CurrencyManager.cs:
+ * Binding.cs: First attempt at UpdateIsBinding
+ * BindingManagerBase.cs: Call UpdateIsBinding before
+ pushing/pulling data.
+
+2005-02-25 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * MenuAPI.cs: Respect disabled items
+ * ThemeWin32Classic.cs
+ - Caches ImageAttributes creation for DrawImageDisabled
+ - Fixes vertical menu line drawing
+ - Draws disabled arrows in disable menu items
+
+2005-02-24 Peter Bartok <pbartok@novell.com>
+
+ * Hwnd.cs:
+ - Added UserData property to allow associating arbitrary objects
+ with the handle
+ - Fixed leak; now removing Hwnd references from static windows array
+ * XplatUIWin32.cs:
+ - Fixed Graphics leak in PaintEventEnd
+ - Removed usage of HandleData, switched over to Hwnd class
+ * HandleData.cs: Removed, obsoleted by Hwnd.cs
+
+2005-02-24 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ThemeWin32Classic.cs: Adds Cliping to TrackBar drawing
+ * ScrollBar.cs: Fixes bug
+ * TrackBar.cs: removes death code, clipping, mimize refreshes,
+ keyboard navigation enhancements
+
+2005-02-24 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * Control.cs: Call DefWndProc at WM_PAINT only if UserPaint not defined
+ * GroupBox.cs: Add control styles
+ * Label.cs: Add control styles
+ * UpDownBase.cs: Add control styles
+ * ListBox.cs: Add control styles
+ * XplatUIWin32.cs: Fixes wrong parameter order
+
+
+2005-02-23 Chris Bacon <chris.bacon@docobo.co.uk>
+
+ * ListView.cs: Assign owner for ColumnHeader. Patch by Chris Bacon
+
+2005-02-23 Jackson Harper <jackson@ximian.com>
+
+ * PropertyManager.cs: Implement property binding. This doesn't
+ seem to work yet though as (I think) there are some bugs in
+ System.ComponentModel.PropertyDescriptor.
+ * BindingContext.cs: Use new PropertyManager constructor.
+
+2005-02-23 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ProgressBar.cs: use clip region in ProgressBar
+ * ThemeWin32Classic.cs: use clip region in ProgressBar
+
+2004-02-22 Jackson Harper <jackson@ximian.com>
+
+ * BindingsCollection.cs: Remove some debug code.
+
+2005-02-22 Jackson Harper <jackson@ximian.com>
+
+ * BindingContext.cs:
+ * ControlBindingsCollection.cs:
+ * CurrencyManager.cs:
+ * Binding.cs:
+ * BindingManagerBase.cs: Initial implementation
+ * BindingsCollection.cs: Add an internal contains method that the
+ BindingManagerBase uses to ensure bindings aren't added twice to
+ the collection.
+ * PropertyManager.cs: Stubbed out.
+ * Control.cs:
+ * ContainerControl.cs: Hook up databinding
+
+2005-02-22 Geoff Norton <gnorton@customerdna.com>
+
+ * XplatUIOSX.cs:
+ OSXStructs.cs: Refactored to handle the new Hwnd NC logic area.
+ Fixed Invalidate/Update chain.
+ Fixed tons of other minor bugs (this is almost a complete rewrite).
+
+2005-02-22 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ComboBox.cs: do subcontrol creation when the control is created
+
+2005-02-19 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * Label.cs: fixes image drawing (image and imagelist)
+ * ThemeWin32Classic.cs: cache brushes
+
+2005-02-19 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * Form.cs: Move menu drawing code to Theme class
+ * ComboBox.cs: Move ComboBox drawing code to Theme class
+ * MenuItem.cs: Move menu drawing code to Theme class
+ * MenuAPI.cs: Move menu drawing code to Theme class
+ * ThemeWin32Classic.cs: New methods
+ * CheckedListBox.cs: Move CheckedListbox drawing code to Theme class
+ * ListBox.cs: Move Listbox drawing code to Theme class
+ * Theme.cs: New methods
+
+2005-02-20 Peter Bartok <pbartok@novell.com>
+
+ * Control.cs:
+ - Fixed ProcessKeyEventArgs to also handle WM_SYSKEY messages (and
+ only process mnemonics on those)
+ - Fixed event sequence for key handling; first calling
+ ProcessKeyEventArgs now
+ * TextBoxBase.cs:
+ - Removed WM_KEYDOWN hook, instead we now use ProcessDialogKey()
+ for processing non-character keys
+ - Fixed WM_CHAR to generate proper event sequence before processing
+ * XplatUIWin32.cs: Added ALT key state to ModifierKeys property
+ generation
+
+2005-02-19 Peter Bartok <pbartok@novell.com>
+
+ * UserControl.cs: Added TextChanged event; added attributes
+ * SizeGrip.cs: Implemented resizing and optional display of grip
+ * Form.cs: Fixed attribute
+ * XplatUI.cs, XplatUIDriver.cs, XplatUIOSX.cs, XplatUIWin32.cs:
+ Changed meaning of ScrollWindow bool argument; instead of the
+ clear attribute (which will be true usually anyway), it gives the
+ option of moving child controls as well.
+ * XplatUIX11.cs:
+ - Changed to match new ScrollWindow argument
+ - Fixed GetWindowPos/SetWindowPos behaviour for toplevel controls,
+ now handles the implicit parent window a WM puts around us
+ * ScrollableControl.cs: Implemented (not the prettiest, but it seems
+ to work)
+ * TextBoxBase.cs: Adjusted to new ScrollWindow arguments
+ * TreeView.cs: Adjusted to new ScrollWindow arguments
+
+2005-02-19 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * Form.cs: Menu integration with non-client area
+ * MenuItem.cs: Menu integration with non-client area
+ * MenuAPI.cs: Menu integration with non-client area
+
+2005-02-18 Peter Bartok <pbartok@novell.com>
+
+ * MethodInvoker.cs: Added
+ * MdiLayout.cs: Added
+ * SendKeys.cs: Started implementation
+ * ErrorIconAlignment.cs: Added
+
+2005-02-18 Peter Bartok <pbartok@novell.com>
+
+ * XplatUIWin32.cs: Implemented SetMenu(); fixed GetMenuDC()
+ * Form.cs: Added handling for Menu-related Non-client messages
+
+2005-02-17 Peter Bartok <pbartok@novell.com>
+
+ * UpDownBase.cs: Fixed typo, compilation errors
+ * DomainUpDown.cs: Fixed attribute value
+
+2005-02-16 Miguel de Icaza <miguel@novell.com>
+
+ * UpDownBase.cs: Attach entry events.
+ Propagate events.
+ Add ForeColor property, Focused, InterceptArrowKeys (interception
+ does not work yet).
+
+2005-02-17 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * Form.cs:
+ - Redraw non client are on Setmenu
+ - Calc proper menu starting point
+
+2005-02-17 Peter Bartok <pbartok@novell.com>
+
+ * Application.cs: Fixed message_filter check
+
+2005-02-17 Peter Bartok <pbartok@novell.com>
+
+ * Application.cs: Now calls registered message filters
+ * DockStyle.cs: Fixed attribute
+ * Form.cs: Fixed attribute
+ * Menu.cs: Fixed attribute
+ * ToolTip.cs: Fixed attribute
+ * TreeNode.cs: Added missing attributes and arranged in regions
+ * PropertyGrid.cs: Fixed signatures
+ * TreeNodeCollection.cs: Added attributes
+ * Splitter.cs: Added missing attributes; arranged into regions
+ * TabPage.cs: Added missing attributes; arranged into regions
+ * TextBoxBase.cs: Added missing attributes
+ * TextBox.cs: Added missing attributes
+ * ArrangeDirection.cs: Added missing attributes
+ * TreeNodeConverter.cs: Added stub (needed for TreeNode)
+ * ToolBarButton.cs: Fixed attributes
+ * AnchorStyles.cs: Fixed attribute
+ * TrackBar.cs: Fixed attributes
+ * TabControl.cs: Added missing attributes and arranged into regions
+ * ToolBar.cs: Fixed attribute
+ * StatusBar.cs: Fixed signature, organized into regions and added
+ attributes
+ * StatusBarPanel.cs: Fixed attributes
+ * ContentsResizedEventArgs.cs: Implemented
+ * ContentsResizedEventHandler.cs: Implemented
+ * DateBoldEventArgs.cs: Implemented
+ * DateBoldEventHandler.cs: Implemented
+ * UpDownEventArgs.cs: Implemented
+ * UpDownEventHandler.cs: Implemented
+
+2005-02-16 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * Form.cs: first Menu NC refactoring
+ * MenuAPI.cs: first Menu NC refactoring
+
+2005-02-16 Peter Bartok <pbartok@novell.com>
+
+ * ImeMode.cs: Added missing attributes
+ * Menu.cs: Fixed attribute
+ * GroupBox.cs: Fixed attribute
+ * Label.cs: Fixed attribute
+ * ColorDialog.cs (RunDialog): Removed TODO attribute
+ * ComboBox.cs: Fixed attributes
+ * ListControl.cs: Added missing attributes
+ * PropertyGrid.cs: Fixed attributes
+ * Control.cs: Fixed attributes
+ * ListViewItem.cs: Added TypeConverter attribute
+ * NotifyIcon.cs: Fixed attributes
+ * ListView.cs: Fixed attributes
+ * ButtonBase.cs: Fixed attribute
+ * ImageList.cs: Added missing attributes
+ * ContainerControl.cs: Fixed signature
+ * CheckedListBox.cs: Fixed attribute; added missing attributes
+ * Panel.cs: Fixed attributes
+ * PropertyTabChangedEventArgs.cs: Added missing attribute
+ * PropertyValueChangedEventArgs.cs: Added missing attribute
+ * Binding.cs: Fixed attribute
+ * ListViewItemConverter: Implemented ListViewSubItemConverter class
+ * ListBox.cs: Fixed attribute; added missing attributes;
+ * ScrollableControl.cs: Added missing attributes
+ * PictureBox.cs: Added missing attributes; implemented missing property
+ * DateTimePicker.cs: Added missing attributes
+ * Theme.cs (ToolWindowCaptionHeight): Fixed type
+ * MonthCalendar.cs: Fixed attributes
+ * StatusBarPanel.cs: Added missing attributes
+ * SystemInformation.cs (ToolWindowCaptionHeight): Fixed type
+
+2005-02-16 Peter Bartok <pbartok@novell.com>
+
+ * TextBoxBase.cs: The previous method to enforce height yet remember
+ the requested high was less than ideal, this is an attempt to do
+ it better.
+ * Control.cs: Added comment about possible problem
+ * Copyright: Updated format
+ * GridItemType.cs: Fixed swapped values
+
+2005-02-15 Jackson Harper <jackson@ximian.com>
+
+ * BaseCollection.cs: Use property so we never access an
+ uninitialized list. Also initialize the list in the property.
+
+2005-02-15 Peter Bartok <pbartok@novell.com>
+
+ * GroupBox.cs (ProcessMnemonic): Implemented
+ * Label.cs (ProcessMnemonic): Implemented
+ * ThemeWin32Classic.cs (DrawGroupBox): Added stringformat to show
+ hotkeys
+
+2005-02-15 Peter Bartok <pbartok@novell.com>
+
+ * RadioButton.cs (ProcessMnemonic): Implemented
+ * CheckBox.cs (ProcessMnemonic): Implemented
+ * Control.cs:
+ - Added handling of WM_SYSxxx keyboard messages to support mnemonic
+ handling
+ - Added internal method to allow calling ProcessMnemonic from other
+ controls
+ * ContainerControl.cs:
+ - Started support for handling validation chain handling
+ - Implemented ProcessMnemonic support
+ - Added Select() call to Active, to make sure the active control
+ receives focus
+ * Form.cs: Setting toplevel flag for Forms (this was lost in the
+ FormParent rewrite)
+ * ThemeWin32Classic.cs:
+ - DrawCheckBox(): Fixed stringformat to show hotkeys
+ - DrawRadioButton(): Fixed stringformat to show hotkeys
+ * CommonDialog.cs: Removed WndProc override, not needed
+
+2005-02-14 Peter Bartok <pbartok@novell.com>
+
+ * XplatUIX11.cs: Fixed NotImplemented exceptions for properties,
+ missed those in the rewrite
+
+2005-02-14 Miguel de Icaza <miguel@novell.com>
+
+ * NumericUpDown.cs (Increment, ToString): Add.
+ (DecimalPlaces): implement.
+
+ Add attributes.
+
+ * UpDownBase.cs: Add the designer attributes.
+
+2005-02-13 Peter Bartok <pbartok@novell.com>
+
+ * Panel.cs: Removed border_style, now in Control
+ * XplatUIDriver.cs: Added SetBorderStyle, SetMenu, GetMenuDC and
+ ReleaseMenuDC Methods; renmaed ReleaseWindow to UngrabWindow
+
+2005-02-13 Peter Bartok <pbartok@novell.com>
+
+ * MouseButtons.cs: Added missing attributes
+ * XplatUIStructs.cs: Added enumeration for title styles
+ * LeftRightAlignment.cs: Added missing attributes
+ * Hwnd.cs: Switched to use client_window as handle (slower, but makes
+ it compatible with Graphics.FromHwnd()
+ * SelectedGridItemChangedEventArgs.cs: Fixed property type
+ * Keys.cs: Added missing attributes
+ * SelectionRange.cs: Added missing attributes
+ * SelectionRangeConverter.cs: Added
+ * XplatUI.cs:
+ - Introduced SetBorderStyle, SetMenu, GetMenuDC and
+ ReleaseMenuDC methods
+ - Renamed ReleaseWindow to UngrabWindow
+ - Added proper startup notice to allow version identification
+ * Form.cs:
+ - Added missing attributes
+ - Removed FormParent concept
+ * Label.cs: Removed border_style field, now in Control
+ * RadioButton.cs: Now properly selects RadioButton when focus is
+ received
+ * ThemeGtk.cs: Fixed SetDisplay call to match new X11 behaviour
+ * Control.cs:
+ - Added missing attributes
+ - Added borderstyle handling
+ - Removed FormParent concept support
+ - Fixed calls to XplatUI to match changed APIs
+ - Fixed bug that would case us to use disposed Graphics objects
+ - Removed unneeded internal methods
+ - PerformLayout(): Fixed to handle DockStyle.Fill properly
+ - SelectNextControl(): Fixed to properly check common parents
+ * TextBoxBase.cs: Removed border_style field (now in Control)
+ * MessageBox.cs:
+ - Patch by Robert Thompson (rmt@corporatism.org): Added icon support,
+ fixed calculations for form size
+ - Added support for localized strings and icons
+ - Improved form size calculations, added border
+ * ListView.cs: Removed border_style field (now in Control)
+ * X11Structs.cs: Moved several structs from X11 driver here
+ * X11Keyboard.cs: Changed debug message
+ * Application.cs: Removed FormParent concept support
+ * CommonDialog.cs:
+ - Resetting end_modal flag
+ - Removed FormParent concept support
+ * NativeWindow.cs: Removed FormParent concept support
+ * XplatUIX11.cs: Rewritten, now using the new Hwnd class, implementing
+ Client area and Non-Client whole window to allow support for WM_NC
+ messages
+ * XplatUIOSX.cs: Updated to match latest driver spec; added exception
+ prevent using it until it supports Hwnd as per Geoff Norton's request
+ * ToolBar.cs: Fixed drawing, was not doing proper drawing
+ * PictureBox.cs: Removed border_style field, now in Control
+ * XplatUIWin32.cs: Added new driver methods
+
+2005-02-12 Peter Bartok <pbartok@novell.com>
+
+ * OpacityConverter.cs: Implemented
+ * Hwnd.cs: Internal class to support drivers that need to emulate
+ client area/non-client area window behaviour
+
+2005-02-11 Peter Bartok <pbartok@novell.com>
+
+ * KeysConverter.cs: Implemented
+
+2005-02-11 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * Menu.cs: fixes methods GetContextMenu, GetMainMenu, ToString
+ * LinkLabel: Added missing attributes
+ * MainMenu.cs: fixes ToString
+ * MenuItem.cs: fixes methods GetContextMenu, GetMainMenu
+ * ListBox.cs: fixes event position
+ * TrackBar.cs: adds missing attributes and events
+
+2005-02-10 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * MenuItem.cs: Use SystemInformation and bug fixes
+ * MenuAPI.cs: Use SystemInformation and bug fixes
+
+2005-02-09 Jackson Harper <jackson@ximian.com>
+
+ * X11Keyboard.cs: We ignore some keys, but still need to set/reset
+ their keystate otherwise things like VK_MENU get stuck "on".
+
+2005-02-09 Kazuki Oikawa <kazuki@panicode.com>
+
+ * ListBox.cs: Fixes AddRange bug
+
+2005-02-09 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ProgressBar.cs
+ - Add missing attributes
+ - Add missing method
+
+ * CheckedListBox.cs: Added missing attributes
+ - Add missing attributes
+ - Remove extra method
+
+ * ComboBox.cs: Added missing attributes
+ * VScrollBar.cs: Added missing attributes
+ * ScrollBar.cs: Added missing attributes
+ * ListBox.cs: Fixes signature, add missing consts
+ * LinkArea.cs: Added missing attributes
+
+
+2005-02-08 Peter Bartok <pbartok@novell.com>
+
+ * Menu.cs: Added missing attributes
+ * MainMenu.cs: Added missing attributes
+ * GroupBox.cs: Added missing attributes
+ * Label.cs: Added missing attributes
+ * CheckBox.cs: Implemented CheckBoxAccessibleObject class
+ * ColorDialog.cs:
+ - Added Instance and Options properties
+ - Added missing attributes
+ * Cursor.cs: Made Serializable
+ * NotifyIcon: Added missing attributes
+ * MenuItem.cs: Added missing attributes
+ * TextBoxBase.cs: Implemented AppendText() and Select() methods
+ * Panel.cs: Added Missing attributes
+ * MonthCalendar.cs: Fixed CreateParams
+
+2005-02-08 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * LinkLabel.cs:
+ - Fixes signature
+ - Fixes issues with links
+ - Adds the class attributes
+
+2005-02-08 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ComboBox.cs:
+ - Fixes button when no items available in dropdown
+ - Fixes repainting problems
+ - Adds the class attributes
+
+2005-02-07 Geoff Norton <gnorton@customerdna.com>
+
+ * XplatUIOSX.cs: Detect the menu bar and title bar height from
+ the current theme. Cache these on startup.
+
+2005-02-07 Jackson Harper <jackson@ximian.com>
+
+ * ScrollBar.cs: Give the correct clipping rect to the theme. Dirty
+ the scrollbar buttons when they are depressed.
+
+2005-02-07 Geoff Norton <gnorton@customerdna.com>
+
+ * XplatUIOSX.cs: Really fix working at resolutions not 1024x768.
+ Get the display size from the main displayid. We currently dont
+ support multiple display configurations.
+
+2005-02-07 Geoff Norton <gnorton@customerdna.com>
+
+ * XplatUIOSX.cs: Ensure the window doesn't get stuck behind the statusbar.
+
+2005-02-07 Miguel de Icaza <miguel@novell.com>
+
+ * UpDownBase.cs: Add ReadOnly and UpDownAlign properties.
+
+2005-02-05 Jonathan Chambers <jonathan.chambers@ansys.com>
+
+ * PropertyGrid.cs: Updated. Patch by Jonathan Chambers
+
+2005-02-04 Jackson Harper <jackson@ximian.com>
+
+ * ThemeWin32Classic.cs: Respect the clipping rect when
+ drawing. Only fill the intersection of clips and rects so there
+ isn't a lot of large fills.
+ * ScrollBar.cs: Pass the correct clipping rect to the theme
+ engine. Remove some debug code.
+
+2005-02-05 John BouAntoun <jba-mono@optusnet.com.au>
+
+ * DateTimePicker.cs:
+ - Fixed crash on DateTime.Parse, use Constructor instead
+
+2005-02-04 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * MenuItem.cs:
+ * MenuAPI.cs:
+ - Owner draw support (MeasureItem and DrawItem)
+
+2005-02-04 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * Menu.cs:
+ - Implements FindMergePosition and MergeMenu functions (very poor documented)
+ - Fixes MenuItems.Add range
+ * MenuItem.cs:
+ - MergeMenu and Clone and CloneMenu functions
+
+2005-02-03 Jackson Harper <jackson@ximian.com>
+
+ * ScrollBar.cs: Make abstract
+ * ScrollableControl.cs: Create H/V scrollbars now that scrollbar
+ is abstract.
+
+2005-02-03 Jackson Harper <jackson@ximian.com>
+
+ * ScrollBar.cs: First part of my scrollbar fixups. This removes
+ all the unneeded refreshes and uses invalidates with properly
+ computed rects.
+
+2005-02-03 Peter Bartok <pbartok@novell.com>
+
+ * ComponentModel.cs: Added
+ * IDataGridEditingService.cs: Added
+ * Timer.cs: Added missing attributes
+ * ToolTip.cs: Added missing attributes
+
+2005-02-03 Jonathan Chambers <jonathan.chambers@ansys.com>
+
+ * PropertyGridView.cs: Added. Patch by Jonathan Chambers
+
+2005-02-03 Peter Bartok <pbartok@novell.com>
+
+ * ListBox.cs: Added missing attributes
+
+2005-02-03 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ListBox.cs:
+ - Fixes font height after font change
+ - Avoid generating unnecesary OnSelectedIndexChanged on clearing
+
+2005-02-02 Peter Bartok <pbartok@novell.com>
+
+ * HandleData.cs: Introduced static methods to allow class
+ to be more self-contained and track it's own HandleData objects
+ * XplatUIOSX.cs, XplatUIWin32.cs, XplatUIX11.cs: Fixed usage of
+ HandleData to use new static methods
+
+2005-02-02 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * Combobox.cs:
+ - Fixes default size and PreferredHeight
+ - Missing events
+ - ObjectCollection.Insert implementation
+
+ * ListControl.cs
+ - Fixes signature
+ * ListBox.cs:
+ - Several fixes
+ - ObjectCollection.Insert implementation
+ - No selection after clean
+ - Small fixes
+
+2005-01-31 John BouAntoun <jba-mono@optusnet.com.au>
+
+ * ThemeWin32Classic.cs: quick fix to comboboxbutton pushed painting
+
+2005-02-01 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * Combobox.cs:
+ - Caches ItemHeight calculation for OwnerDrawVariable
+ - Handles dropdown properly
+ - Fixes several minor bugs
+
+2005-01-31 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ListBox.cs:
+ - Fixes 71946 and 71950
+ - Fixes changing Multicolumn on the fly
+ - Fixes keyboard navigation on Multicolumn listboxes
+
+2005-01-31 Geoff Norton <gnorton@customerdna.com>
+
+ * XplatUIOSX.cs: Call ExitToShell in our teardown to avoid a
+ crash reporter log.
+
+2005-01-31 Geoff Norton <gnorton@customerdna.com>
+
+ * XplatUIOSX.cs: Allow applications to actually exit.
+
+2005-01-31 Geoff Norton <gnorton@customerdna.com>
+
+ * XplatUIOSX.cs: SetWindowStyle implemented. Reposition views in
+ their parent at creation time rather than lazily later. Fixes a major
+ regression we were experiencing.
+
+2005-01-31 John BouAntoun <jba-mono@optusnet.com.au>
+
+ * ThemeWin32Classic.cs: more date time picker painting fixes
+ * DateTimePicker.cs: more monthcalendar drop down fixes
+ * MonthCalendar.cs: more CreateParams fixes to ensure correct drop down
+
+2005-01-31 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ScrollBar.cs:
+ - When moving the thumb going outside the control should stop the moving
+ - Adds the firing of missing events
+ - Fixes no button show if Size is not specified
+ - End / Home keys for keyboard navigation
+
+2005-01-30 Peter Bartok <pbartok@novell.com>
+
+ * NotifyIcon.cs (CalculateIconRect): Removed debug output and added
+ sanity check to prevent theoretical loop
+ * XplatUIWin32.cs (SetVisible): Removed debug output
+ * XplatUIX11.cs (SystrayChange): Added sanity check
+ * ScrollableControl.cs (OnVisibleChanged): Now calls base method
+ * Control.cs (OnVisibleChanged): Added workaround for ParentForm
+ behaviour, valid until the X11 client window rewrite is done
+ * TextBox.cs (ctor): Setting proper default foreground and background
+ colors
+
+2005-01-30 John BouAntoun <jba-mono@optusnet.com.au>
+
+ * Theme: Added DrawDateTimePicker to interface
+ * ThemeWin32Classic.cs: Added DrawDateTimePicker (incomplete)
+ * DateTimePicker.cs: Created (still needs keys and painting code)
+ * DateTimePickerFormat.cs: added
+ * MonthCalendar.cs: fixed CreateParams for popup window mode
+
+2005-01-29 Peter Bartok <pbartok@novell.com>
+
+ * ControlPaint.cs: Fixed luminace value returned on achromatic colors,
+ this should also the calculations for ligher/darker
+ * Theme.cs: Fixed defaults for ScrollBar widths/heights
+
+2005-01-29 Peter Bartok <pbartok@novell.com>
+
+ * ArrangeDirection.cs: Added
+ * ArrangeStartingPositon.cs: Added
+ * SystemInformation.cs: Implemented
+ * XplatUI.cs, XplatUIDriver.cs, XplatUIOSX.cs, XplatUIWin32.cs,
+ XplatUIX11.cs, Theme.cs: Added/implemented new static properties
+ used by SystemInformation class
+ * X11Strucs.cs: Added XSizeHints structure
+ * MenuAPI.cs:
+ - Fixed CreateParams to make sure the menu window is always visible
+ - TrackPopupMenu: Added check to make sure we don't draw the
+ menu offscreen
+
+2005-01-29 Peter Bartok <pbartok@novell.com>
+
+ * HandleData.cs: Added method for altering invalid area
+ * TextBoxBase.cs: Implemented TextLength
+
+2005-01-28 Peter Bartok <pbartok@novell.com>
+
+ * XplatUIX11.cs: Improvement over last patch, not sending
+ the WM_PAINT directly anymore, instead we scroll any pending
+ exposed areas and let the system pick out the WM_PAINT later
+
+2005-01-28 Peter Bartok <pbartok@novell.com>
+
+ * SWF.csproj: Deleted, no longer used. Instead,
+ Managed.Windows.Forms/SWF.csproj should be used
+ * XplatUIX11.cs: Instead of posting the WM_PAINT, we send it
+ directly, to avoid a potential race condition with the next
+ scroll
+
+2005-01-28 Peter Bartok <pbartok@novell.com>
+
+ * XplatUI.cs: Made class internal
+
+2005-01-28 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * CheckedListBox.cs:
+ - Draw focus
+ - Fixed Drawing
+ - Missing methods and events
+
+2005-01-27 Peter Bartok <pbartok@novell.com>
+
+ * Application.cs (Run): Don't use form if we don't have one
+
+2005-01-27 Peter Bartok <pbartok@novell.com>
+
+ * TextBoxBase.cs (get_Lines): Fixed index off by one error
+
+2005-01-27 Peter Bartok <pbartok@novell.com>
+
+ * GridEntry.cs: Added; Patch by Jonathan S. Chambers
+ * GridItem.cs: Added; Patch by Jonathan S. Chambers
+ * GridItemCollection.cs: Added; Patch by Jonathan S. Chambers
+ * GridItemType.cs: Added; Patch by Jonathan S. Chambers
+ * PropertyGrid.cs: Added; Patch by Jonathan S. Chambers
+ * PropertySort.cs: Added; Patch by Jonathan S. Chambers
+ * PropertyTabChangedEventArgs.cs: Added; Patch by Jonathan S. Chambers
+ * PropertyTabChangedEventHandler.cs: Added; Patch by Jonathan S. Chambers
+ * PropertyValueChangedEventArgs.cs: Added; Patch by Jonathan S. Chambers
+ * PropertyValueChangedEventArgs.cs: Added; Patch by Jonathan S. Chambers
+ * SelectedGridItemChangedEventArgs.cs: Added; Patch by Jonathan S. Chambers
+ * SelectedGridItemChangedEventHandler.cs: Added; Patch by Jonathan S. Chambers
+
+2005-01-27 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * Combobox.cs:
+ - Draw focus on Simple Combobox
+ - Fixes drawing issues
+ - fixes 71834
+
+2005-01-27 Peter Bartok <pbartok@novell.com>
+
+ * Form.cs:
+ - Place window in default location, instead of hardcoded 0/0
+ - Send initial LocationChanged event
+ * Control.cs:
+ - UpdateBounds after creation to find out where the WM placed us
+ - Make sure that if the ParentForm changes location the Form
+ is notified
+ * XplatUIX11.cs: XGetGeometry will not return the coords relative
+ to the root, but to whatever the WM placed around us.
+ Translate to root coordinates before returning toplevel
+ coordinates
+ * XplatUIWin32.cs: Removed debug output
+ * XplatUIOSX.cs, XplatUI.cs, XplatUIDriver.cs: Added toplevel
+ flag to GetWindowPos, to allow translation of coordinates on X11
+
+2005-01-27 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ListBox.cs: connect LostFocus Event
+
+2005-01-27 Peter Bartok <pbartok@novell.com>
+
+ * XplatUI.cs, XplatUIDriver.cs, XplatUIWin32.cs, XplatUIOSX.cs,
+ XplatUIX11.cs: Extended the Systray API
+ * Form.cs: Removed debug output
+ * Application.cs: Fixed focus assignment, always need to call
+ XplatUI.Activate() since Form.Activate() has rules that may
+ prevent activation
+ * NotifyIcon.cs: Should be complete now
+ * ToolTip.cs: Worked around possible timer bug
+
+2005-01-27 Jackson Harper <jackson@ximian.com>
+
+ * TabControl.cs:
+ - Only invalidate the effected tabs when the
+ selected index changes. This reduces drawing and gets rid of some
+ flicker.
+ - Only refresh if the tabs need to be shifted, otherwise only
+ invalidate the slider button.
+ - On windows the tabs are not filled to right if the slider is
+ visible.
+
+2005-01-27 Jackson Harper <jackson@ximian.com>
+
+ * TabControl.cs: Only refresh on mouseup if we are showing the
+ slider. Also only invalidate the button whose state has changed.
+
+2005-01-26 Peter Bartok <pbartok@novell.com>
+
+ * XplatUI.cs, XplatUIDriver.cs: Added Systray methods
+ * XplatUIWin32.cs: Implemented SystrayAdd(), SystrayChange()
+ and SystrayRemove() methods
+ * XplatUIOSX.cs: Stubbed Systray methods
+ * XplatUIX11.cs:
+ - Implemented SystrayAdd(), SystrayChange() and SystrayRemove()
+ methods
+ - Fixed broken XChangeProperty calls (marshalling messed up things)
+ * X11Structs.cs: Added enums and structs required for Size hinting
+ * NotifyIcon.cs: Added & implemented
+
+2005-01-26 Jackson Harper <jackson@ximian.com>
+
+ * TabControl.cs: Space vertically layed out tabs properly.
+
+2005-01-26 Peter Bartok <pbartok@novell.com>
+
+ * Form.cs (CreateClientParams): Always set the location to 0,0
+ since we're a child window.
+
+ * Control.cs (SetVisibleCore): Always explicitly setting the location
+ of a toplevel window, apparently X11 doesn't like to move windows
+ while they're not mapped.
+
+2005-01-26 Jackson Harper <jackson@ximian.com>
+
+ * TabControl.cs: Implement FillToRight size mode with vertically
+ rendered tabs.
+
+2005-01-26 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ControlPaint.cs, ThemeWin32Classic.cs
+ - Fixes DrawFocusRectangle
+
+2005-01-26 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * MenuAPI.cs:
+ - MenuBar tracking only starts when item is first clicked
+ - Fixes menu hidding for multiple subitems
+ - Unselect item in MenuBar when item Executed
+ - Fixes bug 71495
+
+2005-01-25 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ListControl.cs:
+ - IsInputKey for ListBox
+ * ListBox.cs:
+ - Focus item
+ - Shift and Control item selection
+ - Implement SelectionMode.MultiExtended
+ - Fixes RightToLeft
+ * ComboBox.cs:
+ - IsInputKey implemented
+ - Do not generate OnTextChangedEdit on internal txt changes
+
+2005-01-23 Peter Bartok <pbartok@novell.com>
+
+ * AccessibleObject.cs: Partially implemented Select()
+ * MonthCalendar.cs: Added missing attributes and events
+ * Form.cs: Fixed CreateParams behaviour, now controls derived from
+ form can properly override CreateParams.
+ * XplatUI.cs, XplatUIDriver.cs, XplatUIOSX.cs, XplatUIWin32.cs,
+ XplatUIX11.cs: Dropped RefreshWindow method, not needed if
+ Control performs Invalidate & Update
+ * NativeWindow (CreateHandle): Added special handling for Form
+ and Form.FormParent classes to allow overriding of From.CreateParams
+ * Control.cs:
+ - ControlNativeWindow: Renamed 'control' variable to more intuitive
+ name 'owner'
+ - ControlNativeWindow: Added Owner property
+ - Removed usage of Refresh() on property changes, changed into
+ Invalidate(), we need to wait until the queue is processed for
+ updates, direct calls might cause problems if not all vars for
+ Paint are initialized
+ - Added call to UpdateStyles() when creating the window, to set any
+ styles that CreateWindow might have ignored.
+ - Added support for Form CreateParent overrides to UpdateStyles()
+ * MessageBox.cs: Removed no longer needed FormParent override stuff,
+ CreateParams are now properly overridable
+ * CommonDialog.cs: Removed no longer needed FormParent override stuff,
+ CreateParams are now properly overridable
+
+2005-01-23 Miguel de Icaza <miguel@ximian.com>
+
+ * UpDownBase.cs (ctor): Connect TextChanged in the entry to the
+ OnTextBoxChanged.
+
+ Capture LostFocus and OnTextBoxChanged. The later introduces a
+ recursive invocation that I have not figured out yet.
+
+ Reset the timer when not using (it was accumulating).
+
+
+ (OnTextBoxChanged): Set UserEdit to true here to track whether the
+ user has made changes that require validation.
+
+ Reset changing to avoid loops.
+
+2005-01-22 Miguel de Icaza <miguel@ximian.com>
+
+ * NumericUpDown.cs: Display value at startup.
+
+ * UpDownBase.cs (Text): Do not call UpdateEditText here, only call
+ ValidateEditText.
+
+ * NumericUpDown.cs: Minimum, Maximum, Text, Value properties
+ filled in. Added some basic parsing of text.
+
+ Still missing the OnXXX method overrides, and figuring out the
+ events that must be emitted.
+
+ * UpDownBase.cs: Handle UserEdit on the Text property.
+
+2005-01-22 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ComboBox.cs:
+ - Fixes IntegralHeight
+ - ToString method
+
+2005-01-21 Jackson Harper <jackson@ximian.com>
+
+ * TabControl.cs: Set the SelectedIndex property when SelectedTab
+ is set so that the page visibility is updated and the tabs are
+ sized correctly.
+
+2005-01-21 Jackson Harper <jackson@ximian.com>
+
+ * TabControl.cs: Use cliping rectangle for blitting. Give the
+ theme the clipping rect so we can do clipping while
+ drawing. Remove some debug code.
+
+2005-01-21 Jackson Harper <jackson@ximian.com>
+
+ * TabPage.cs: Add a new method so tab pages can force the tab
+ control to recalculate the tab page sizes.
+ * TabControl.cs: UpdateOwner needs to make the tab control recalc
+ sizes.
+
+2005-01-20 Jackson Harper <jackson@ximian.com>
+
+ * ThemeWin32Classic.cs: Clip text to the staus bar panels rects.
+
+2005-01-20 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Set the bounds for nodes properly. They were
+ getting screwed up when checkboxes were not enabled, but images
+ were.
+
+2005-01-20 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ListBox.cs:
+ - Owner draw support
+ - Fixes
+
+2005-01-20 Jackson Harper <jackson@ximian.com>
+
+ * XplatUIStructs.cs: More misc keys
+ * X11Keyboard.cs: Ignore some control keys.
+
+2005-01-20 Jackson Harper <jackson@ximian.com>
+
+ * X11Structs.cs: Add the modmaps to the keymask struct and tabify.
+ * X11Keyboard.cs: Set the AltGr mask when we get a key event.
+
+2005-01-19 Peter Bartok <pbartok@novell.com>
+
+ * Control.cs: Un-selecting the control when it is loosing focus
+
+2005-01-19 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Hook up to the text controls leave event so we can
+ end editing when the users clicks outside the text box.
+
+2005-01-19 Jackson Harper <jackson@ximian.com>
+
+ * X11Keyboard.cs: Fix typo that was causing the wrong keycodes to
+ get set in the conversion array.
+
+2005-01-19 Peter Bartok <pbartok@novell.com>
+
+ * Application.cs (ModalRun): Added a call to CreateControl to ensure
+ focus is properly set
+ * Button.cs:
+ - Added missing attributes
+ - removed styles, those are already set in the base class
+ * ButtonBase.cs:
+ - Added missing attributes
+ - Added clip window styles
+ * CheckBox.cs: Added missing attributes
+ * CommonDialog.cs:
+ - FormParentWindow.CreateParams: Added required clip styles
+ * Form.cs (ProcessDialogKey): Fixed handling of Escape key, now
+ also filters modifier keys
+ * MessageBox.cs:
+ - Added assignment of Accept and Cancel button to enable Enter
+ and Esc keys in MessageBox dialogs
+ - FormParentWindow.CreateParams: Added required clip styles
+ * RadioButton.cs: Added missing attributes
+ * TextControl.cs: No longer draws selection if control does not
+ have focus
+ * TextBoxBase.cs:
+ - Now draws simple rectangle around test area to make it obvious
+ there's a control. This is a hack until we properly support borders
+ - A few simple fixes to support selections better, now erases selected
+ text when typing, and resets selection when using movement keys
+
+2005-01-19 Miguel de Icaza <miguel@ximian.com>
+
+ * UpDownBase.cs: Added some new properties.
+
+ * DomainUpDown.cs: Implement a lot to get my test working.
+
+2005-01-19 Geoff Norton <gnorton@customerdna.com>
+
+ * XplatUIOSX.cs: Fix a minor bug to bring the close box back
+
+2005-01-19 Geoff Norton <gnorton@customerdna.com>
+
+ * OSXStructs (WindowAttributes): Fixed csc complaints
+
+2005-01-19 Geoff Norton <gnorton@customerdna.com>
+
+ * XplayUIOSX.cs:
+ OSXStructs.cs: Initial refactor to move enums and consts into
+ OSXStructs and use them in the driver for greater readability.
+
+2005-01-19 Geoff Norton <gnorton@customerdna.com>
+
+ * XplatUIOSX.cs: Initial support for Standard Cursors.
+ * OSXStructs.cs: Move our structs here; added ThemeCursor enum
+
+2005-01-19 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ComboBox.cs: ability to change style when the ctrl is already
+ created, missing methods and events, bug fixes, signature fixes
+
+2005-01-19 Peter Bartok <pbartok@novell.com>
+
+ * Cursors.cs (ctor): Added ctor to fix signature
+
+2005-01-18 Peter Bartok <pbartok@novell.com>
+
+ * Button.cs: Implemented DoubleClick event
+ * ButtonBase.cs:
+ - Fixed keyboard handling to behave like MS, where the press of
+ Spacebar is equivalent to a mousedown, and the key release is
+ equivalent to mouseup. Now a spacebar push will give the same
+ visual feedback like a mouse click.
+ - Added missing attributes
+ - Added ImeModeChanged event
+ - Added support for generating DoubleClick event for derived classes
+ * CheckBox.cs:
+ - Implemented DoubleClick event
+ - Added missing attributes
+ * CommonDialog.cs: Added missing attribute
+ * ContextMenu.cs: Added missing attributes
+ * RadioButton.cs:
+ - AutoChecked buttons do not allow to be unselected when clicked
+ (otherwise we might end up with no selected buttons in a group)
+ - Added missing attributes
+ - Implemented DoubleClickEvent
+ * ThreadExceptionDialog.cs: Enabled TextBox code
+
+2005-01-18 Peter Bartok <pbartok@novell.com>
+
+ * Form.cs: Removed debug output
+ * Button.cs: Added support for DoubleClick method
+
+2005-01-18 Peter Bartok <pbartok@novell.com>
+
+ * Form.cs:
+ - Added method to parent window that allows triggering size
+ calculations when a menu is added/removed
+ - set_Menu: Cleaned up mess from early days of Form and Control,
+ now properly triggers a recalc when a menu is added/removed
+ - Added case to select form itself as focused form if no child
+ controls exist
+ - Added PerformLayout call when showing dialog, to ensure properly
+ placed controls
+ * Control.cs:
+ - Select(): Made internal so Form can access it
+ - Focus(): Only call Xplat layer if required (avoids loop), and sets
+ status
+ * Application.cs (Run): Removed hack and calls PerformLayout instead
+ to trigger calculation when Form becomes visible
+
+2005-01-18 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ComboBox.cs: fixes for ownerdraw
+
+2005-01-18 Peter Bartok <pbartok@novell.com>
+
+ * TextControl.cs:
+ - Sentinel is no longer static, each Document gets it's own, this
+ avoids locking or alternatively overwrite problems when more
+ than one text control is used simultaneously.
+ - Switched to use Hilight and HilightText brushes for text selection
+
+ * TextBoxBase.cs (PaintControl): Disabled AntiAliasing to improve looks
+
+2005-01-18 Peter Bartok <pbartok@novell.com>
+
+ * Control.cs:
+ - Hooked up the following events:
+ o ControlAdded
+ o ControlRemoved
+ o HandleDestroyed
+ o ImeModeChanged
+ o ParentChanged
+ o TabStopChanged
+ o Invalidated
+ o SystemColorsChanged
+ o ParentFontChanged
+ o Move
+ - Removed debug output
+ - Added a call to the current theme's ResetDefaults when a color change
+ is detected
+ * Form.cs: Now setting the proper ImeMode
+ * Theme.cs: Defined a method to force recreation of cached resources
+ and rereading of system defaults (ResetDefaults())
+ * ThemeWin32Classic.cs: Added ResetDefaults() stub
+
+2005-01-17 Peter Bartok <pbartok@novell.com>
+
+ * Control.cs: Added missing attributes
+
+2005-01-17 Jackson Harper <jackson@ximian.com>
+
+ * TreeNode.cs: Implement editing. Add missing properties selected
+ and visible.
+ * TreeView.cs: Implement node editing. Also some fixes to use
+ Invalidate (invalid area) instead of Refresh when selecting.
+
+2005-01-17 Peter Bartok <pbartok@novell.com>
+
+ * Control.cs:
+ - Implemented InvokeGotFocus() method
+ - Implemented InvokeLostFocus() method
+ - Implemented InvokePaint() method
+ - Implemented InvokePaintBackground() method
+ - Implemented InvokeClick() method
+ - Implemented FindForm() method
+ - Implemented RectangleToClient() method
+ - Implemented ClientToRectangle() method
+ - Implemented ResetBackColor() method
+ - Implemented ResetCursor() method
+ - Implemented ResetFont() method
+ - Implemented ResteForeColor() method
+ - Implemented ResetImeMode() method
+ - Implemented ResetLeftToRight() method
+ - Implemented ResetText() method
+ - Implemented Scale() methods
+ - Implemented ScaleCore() method
+ - Implemented Update() method
+ - Removed unused variables
+ - Stubbed AccessibilityNotifyClients and
+ ControlAccessibleObject.NotifyClients() methods (dunno what to do
+ with those yet)
+ - Now setting proper default for RightToLeft property
+ - Fixed bug in SetClientSizeCore that would cause windows to get
+ really big
+ - Now sending Click/DoubleClick events
+ - Now selecting controls when left mouse button is clicked on
+ selectable control
+ * AccessibleEvents.cs: Added
+ * XplatUI.cs, XplatUIDriver.cs: Added UpdateWindow() method
+ * XplatUIOSX.cs: Stubbed UpdateWindow() method
+ * XplatUIWin32.cs: Implemented UpdateWindow() method
+ * XplatUIX11.cs: Implemented UpdateWindow() method
+ * Form.cs: Removed stray semicolon causing CS0162 warning
+ * ThemeWin32Classic.cs: Fixed unused variable warnings
+ * ScrollableControl.cs: Now calls base method for ScaleCore
+ * ButtonBase.cs: Now disabling StandardClick and StandardDoubleClick
+ style to avoid interference with internal click handler (which is
+ different than standard Control click handling)
+ * RadioButton.cs:
+ - Now unchecks all sibling radio buttons when control is
+ selected (Fixes #68756)
+ - Removed internal tabstop variable, using the one inherited from
+ Control
+
+2005-01-17 Jackson Harper <jackson@ximian.com>
+
+ * NavigateEventArgs.cs: Fix base type.
+ * LinkLabel.cs: Sig fix
+
+2005-01-17 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Only invalidate the effected nodes bounds when
+ selecting nodes.
+
+2005-01-13 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * XplatUIWin32.cs: fixes Win32 marshaling
+ * XplatUIX11.cs: fixes method signature
+
+2005-01-17 Peter Bartok <pbartok@novell.com>
+
+ * XplatUIX11.cs: Clean up resources when we no longer need them
+
+2005-01-17 Peter Bartok <pbartok@novell.com>
+
+ * XplatUI.cs, XplatUIDriver.cs: Added SetCursor(), ShowCursor(),
+ OverrideCursor(), DefineCursor(), DefineStdCursor(), GetCursorInfo()
+ and DestroyCursor() methods.
+ * Cursor.cs: Partially implemented, now supports standard cursors;
+ still contains some debug code
+ * Cursors.cs: Implemented class
+ * Control.cs:
+ - WndProc(): Added handling of WM_SETCURSOR message, setting the
+ appropriate cursor
+ - Implemented Cursor property
+ - Replaced break; with return; more straightforwar and possibly
+ faster
+ - Now properly setting the result for WM_HELP
+ * X11Structs.cs: Added CursorFontShape enum
+ * XplatUIStructs.cs:
+ - Added StdCursor enum (to support DefineStdCursor() method)
+ - Added HitTest enum (to support sending WM_SETCURSOR message)
+ * XplatUIX11.cs:
+ - Now sends the WM_SETCURSOR message
+ - Implemented new cursor methods
+ * XplatUIOSX.cs: Stubbed new cursor methods
+ * XplatUIWin32.cs:
+ - Implemented new cursor methods
+ - Added GetSystemMetrics function and associated enumeration
+
+2005-01-15 Peter Bartok <pbartok@novell.com>
+
+ * Control.cs:
+ - WndProc(): Now handles EnableNotifyMessage
+ - SelectNextControl(): Fixed bug where if no child or sibling
+ controls exist we looped endlessly
+
+2005-01-14 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Recalculate the tab pages when a new one is added
+ so that the proper bounding rects are created.
+
+2005-01-14 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Draw a gray box instead of a grip in the lower
+ right hand corner when there are both horizontal and vertical
+ scroll bars.
+
+2005-01-14 Jackson Harper <jackson@ximian.com>
+
+ * Control.cs: When erasing backgrounds use FromHwnd instead of
+ FromHdc when there is a NULL wparam. This occurs on the X driver.
+ * XplatUIX11.cs: Set the wparam to NULL.
+
+2005-01-13 Jackson Harper <jackson@ximian.com>
+
+ * PictureBox.cs: Implement missing methods (except ToString, need
+ to test that on windows) and events. When visibility is changed we
+ need to redraw the image because the buffers are killed. When size
+ is changed refresh if the sizemode needs it.
+
+2005-01-13 Peter Bartok <pbartok@novell.com>
+
+ * Control.cs (SelectNextControl): Was using wrong method to select
+ a control
+
+2005-01-13 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ComboBox.cs: fixes dropstyle
+
+2005-01-13 Peter Bartok <pbartok@novell.com>
+
+ * Form.cs:
+ - Implemented Select() override
+ - Now handles WM_SETFOCUS/WM_KILLFOCUS messages
+ - Now sets keyboard focus on startup
+ * Control.cs (SelectNextControl): Now properly handles directed=true
+ * TextBoxBase.cs:
+ - WndProc: Now passes tab key on to base if AcceptTabChar=false
+ - Added (really bad) focus rectangle (mostly for testing)
+ * TextBox.cs: Added code to handle getting/loosing focus and invalidating
+ to enforce redraw on focus changes
+ * ContainerControl.cs:
+ - Fixed detection of Shift-Tab key presses
+ - Fixed traversal with arrow keys
+ * XplatUIX11.cs: Implemented simulated keyboard focus; not sure if we're
+ gonna keep this or if it's complete yet
+
+2005-01-13 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ComboBox.cs: missing properties, fixes
+
+2005-01-13 Peter Bartok <pbartok@novell.com>
+
+ * Panel.cs (ctor): Setting Selectable window style to off
+ * Splitter.cs (ctor): Setting Selectable window style to off
+ * GroupBox.cs (ctor): Setting Selectable window style to off
+ * Label.cs (ctor): Setting Selectable window style to off
+
+2005-01-12 Miguel de Icaza <miguel@ximian.com>
+
+ * UpDownBase.cs (InitTimer): If the timer has been already
+ created, enable it.
+
+ Use a TextBox instead of a Label.
+
+2005-01-12 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Refresh the tree after sorting the nodes. Always
+ draw the connecting node lines (when ShowLines is true).
+ * TreeNode.cs: The nodes index can now be updated. This is used
+ when a node collection is sorted.
+ * TreeNodeCollection.cs: Implement sorting. Nodes can be sorted on
+ insert or an existing unsorted node collection can be sorted.
+
+2005-01-12 Peter Bartok <pbartok@novell.com>
+
+ * ContainerControl.cs: Implemented ProcessDialogKeys()
+
+2005-01-12 Peter Bartok <pbartok@novell.com>
+
+ * Control.cs:
+ - Implemented SelectNextControl() method
+ - Several focus related bug fixes
+ - Fixed Docking calculations to match MS documentation and
+ behaviour
+
+2005-01-12 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ContainerControl.cs, ListControl.cs, ListBox.cs: keyboard navigation and
+ bug fixes
+
+2005-01-12 Peter Bartok <pbartok@novell.com>
+
+ * Control.cs:
+ - Fixed broken Contains() method
+ - Implemented GetNextControl() method. Finally. This is the pre-
+ requisite for focus handling.
+
+2005-01-12 Peter Bartok <pbartok@novell.com>
+
+ * OSXStrucs.cs: Added
+
+2005-01-12 Peter Bartok <pbartok@novell.com>
+
+ * XplatUIWin32.cs:
+ - Removed PeekMessageFlags
+ - Implemented SetWindowStyle() method
+ * XplatUIStructs.cs: Added PeekMessageFlags
+ * X11Structs: Added missing border_width field to XWindowChanges struct
+ * XplatUIX11.cs:
+ - PeekMessage: Now throws exception if flags which are not yet
+ supported are passed
+ - Implemented SetWindowStyle() method
+ - Fixed SetZOrder to handle AfterHwnd properly
+ * XplatUI.cs: Added SetWindowStyle() method
+ * XplatUIDriver.cs: Added SetWindowStyle() abstract
+ * Control.cs:
+ - Implemented UpdateStyles() method
+ - Implemented UpdateZOrder() method
+ * XplatUIOSX.cs: Added SetWindowStyle() stub
+
+2005-01-12 Geoff Norton <gnorton@customerdna.com>
+
+ * XplatUIOSX.cs: Fix SetZOrder (this needs more testing with a 3
+ button mouse).
+
+
+2005-01-11 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Still need to draw lines to siblings even if out of
+ the current node is out of the clip.
+
+2005-01-11 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: When setting the hbar/vbar/grip position use
+ SetBounds so that perform layout is only called once. Also suspend
+ and resume layout so layout is only done once for all controls.
+ - Removed some debug fluff
+ * SizeGrip.cs: Call base implmentation in overriding methods.
+ - When visibility is changed the drawing buffers are killed so we
+ need to redraw.
+
+2005-01-11 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Calculate the open node count while drawing. This
+ saves us an entire tree traversal for every paint operation. Use
+ a member var for the open node count so less vars are passed around.
+
+2005-01-11 John BouAntoun <jba-mono@optusnet.com.au>
+
+ * MonthCalendar.cs:
+ - fixed selection to use mousemove, not mouse polling on timer
+ * ThemeWin32Classic.cs
+ - removed redundant unused variable "no_more_content"
+
+2005-01-11 Peter Bartok <pbartok@novell.com>
+
+ * XplatUIX11.cs (DoEvents): Needs to return when no more events
+ are pending, so it now calls PeekMessage instead of GetMessage;
+ implemented a incomplete version of PeekMessage
+
+2005-01-11 Peter Bartok <pbartok@novell.com>
+
+ * XplatUIWin32.cs: Switched P/Invokes to unicode charset to avoid
+ I18n issues
+ * TextBoxBase.cs: Added sending of TextChanged event
+
+2005-01-10 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Try not to draw outside the clipping rectangle on
+ each node element.
+
+2005-01-10 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ComboBox.cs: keyboard navigation, item navigation, bug fixes
+
+2005-01-10 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs:
+ - Implement fast scrolling. Now only the newly
+ exposed nodes are drawn and the old image is moved using the
+ XplatUI::ScrollWindow method.
+ - Factor in height of nodes when calculating whether or not the
+ node is in the clipping rect.
+
+2005-01-10 Jackson Harper <jackson@ximian.com>
+
+ * TreeNodeCollection.cs: Refresh the tree when a new node is added.
+
+2005-01-10 Peter Bartok <pbartok@novell.com>
+
+ * Application.cs: Added temporary hack to resolve all our resize
+ required issues on startup. This will get fixed properly at
+ some point in the future
+
+2005-01-10 Jackson Harper <jackson@ximian.com>
+
+ * SizeGrip.cs: New internal class that is used as a sizing
+ grip control...hence the name.
+
+2005-01-10 Peter Bartok <pbartok@novell.com>
+
+ * Control.cs: Implemented proper TabIndex handling, now assigning
+ a tabindex when a control is added to a container
+ * GroupBox.cs (ctor): Now sets the Container style bit, required
+ for Control.GetNextControl()
+
+2005-01-09 Jackson Harper <jackson@ximian.com>
+
+ * TextBoxBase.cs: Clear window when scrolling (fixes build).
+
+2005-01-09 Peter Bartok <pbartok@novell.com>
+
+ * XplatUI.cs, XplatUIDriver.cs, XplatUIWin32.cs, XplatUIOSX.cs,
+ XplatUIX11.cs: Added ability to control ScrollWindow expose and
+ an overload for ScrollWindow to allow only scrolling a rectangle
+
+2005-01-09 Peter Bartok <pbartok@novell.com>
+
+ * Form.cs:
+ - Implemented SetDesktopBounds method
+ - Implemented SetDesktopLocation method
+
+2005-01-08 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Only set the vbar's Maximum and LargeChange when
+ the node count has changed, this removes to VScroll::Refresh calls
+ when drawing.
+
+2005-01-08 Geoff Norton <gnorton@customerdna.com>
+
+ * XplatUIOSX.cs: Fix GetWindowState & SetWindowState
+
+2005-01-07 Jackson Harper <jackson@ximian.com>
+
+ * TreeNode.cs: Just update the single node when it is
+ checked. Don't refresh after toggling, the Expand/Collapse already
+ handles this.
+ * TreeView.cs: Respect clipping a little more when drawing. Try
+ not to redraw things that don't need to be redrawn. Just hide the
+ scrollbars when they are no longer needed instead of removing
+ them, so they don't have to be created again and again.
+
+2005-01-07 Geoff Norton <gnorton@customerdna.com>
+
+ * XplatUIOSX.cs (SetCaretPos): We need to translate the view
+ coordinates to window space to place the caret properly, FIXED.
+ Implement GetWindowState & SetWindowState
+
+2005-01-06 Peter Bartok <pbartok@novell.com>
+
+ * Form.cs:
+ - Implemented ClientSize property
+ - Implemented DesktopBounds property
+ - Implemented DesktopLocation property
+ - Implemented IsRestrictedWindow property
+ - Implemented Size property
+ - Implemented TopLevel property
+ - Implemented FormWindowState property
+ * Control.cs:
+ - Implemented GetTopLevel() method
+ - Implemented SetTopLevel() method
+ * X11Structs.cs (Atom):
+ - Added AnyPropertyType definition
+ - Added MapState definiton and updated XWindowAttribute struct
+ * XplatUI.cs: Added GetWindowState() and SetWindowState() methods
+ * XplatUIDriver.cs: Added GetWindowState() and SetWindowState() methods
+ * XplatUIOSX.cs: Stubbed GetWindowState() and SetWindowState() methods
+ * XplatUIWin32.cs:
+ - Implemented GetWindowState() and SetWindowState() methods
+ - Fixed Win32GetWindowLong return type
+ * XplatUIX11.cs:
+ - Introduced central function for sending NET_WM messages
+ - Implemented GetWindowState() and SetWindowState() methods
+ * TextBoxBase.cs (set_Lines):
+ - Now uses Foreground color for text added via Text property (Duh!)
+ - Added code to remember programmatically requested size (fixes
+ behaviour when Multiline is set after Size)
+ - Added AutoSize logic
+
+2005-01-06 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Draw the image after the checkbox if checkboxes are enabled.
+
+2005-01-06 Jackson Harper <jackson@ximian.com>
+
+ * ListBox.cs: Don't allow the horizontal scrollbars maximum to be
+ set to less then 0.
+
+2005-01-06 Jackson Harper <jackson@ximian.com>
+
+ * ScrollableControl.cs: Lazy init the scrollbars.
+
+2005-01-06 Jackson Harper <jackson@ximian.com>
+
+ * Theme.cs: Speed up getting pens and solid brushes, by using
+ their ARGB as a hash instead of tostring and not calling Contains.
+
+2005-01-06 Peter Bartok <pbartok@novell.com>
+
+ * Form.cs:
+ - Implemented OnActivated and OnDeactivate event trigger
+ - Implemented Activate() method
+ - Fixed ShowDialog() to activate the form that was active before
+ the dialog was shown
+ * XplatUIX11.cs:
+ - Added global active_window var that tracks the currently active
+ X11 window
+ - Now always grabs Property changes from the root window to always
+ catch changes on the active window property
+ - Added code to PropertyNotify handler to send Active/Inactive
+ messages when state changes. This puts X11 and Win32 en par on
+ WM_ACTIVATE notifications (except for double notifications when
+ the user clicks away from our modal window to another one of our
+ windows)
+
+2005-01-05 Jackson Harper <jackson@ximian.com>
+
+ * ImageList.cs: Implment ctor
+
+2005-01-05 Geoff Norton <gnorton@customerdna.com>
+
+ * XplatUIOSX.cs: Implement Activate/SetTopmost
+
+2005-01-05 Geoff Norton <gnorton@customerdna.com>
+
+ * XplatUIOSX.cs: Implement SetZOrder, minor cleanup
+
+2005-01-05 Geoff Norton <gnorton@customerdna.com>
+
+ * XplatUIOSX.cs: Implement GetActive/SetFocus.
+
+2005-01-05 Peter Bartok <pbartok@novell.com>
+
+ * XplatUI.cs, XplatUIDriver.cs, XplatUIWin32.cs, XplatUIX11.cs,
+ XplatUIOSX.cs: Added GetActive method to return the currently
+ active window for the application (or null, if none is active)
+ * Form.cs:
+ - Implemented ActiveForm
+ - Commented out owner assignment for modal dialogs (causes problems
+ on Win32, since the owner will be disabled)
+ - Reworked some Active/Focus handling (still incomplete)
+ * CommonDialog.cs: Commented out owner assignment for modal dialogs
+ (causes problems on Win32, since the owner will be disabled)
+ * IWin32Window: Added ComVisible attribute
+
+2005-01-05 Peter Bartok <pbartok@novell.com>
+
+ * ToolTip.cs (WndProc): Enable setting focus now that we have the
+ required XplatUI functions.
+
+2005-01-05 Peter Bartok <pbartok@novell.com>
+
+ * XplatUI.cs, XplatUIOSX.cs, XplatUIWin32.cs, XplatUIDriver.cs,
+ XplatUIX11.cs, X11Structs.cs, Form.cs: Framework code required
+ to implement focus and activation handling; still incomplete and
+ with debug output
+
+2005-01-04 Peter Bartok <pbartok@novell.com>
+
+ * TextBoxBase.cs: Changed access level for Document property to
+ match switch to internal for TextControl
+
+2005-01-04 Peter Bartok <pbartok@novell.com>
+
+ * AccessibleObject: Added ComVisible attribute
+
+2005-01-04 Jackson Harper <jackson@ximian.com>
+
+ * X11Keyboard.cs: Remove unneeded var.
+
+2005-01-04 Jackson Harper <jackson@ximian.com>
+
+ * XplatUIX11.cs (DoEvents): Implement, Just cast aside all events
+ but PAINT.
+ * XplatUIX11.cs (GetMessage): Call Exit when we get an unknown
+ ClientMessage. This makes apps exit cleanly (more often).
+
+2005-01-04 Jackson Harper <jackson@ximian.com>
+
+ * TreeNode.cs: Patches by Kazuki Oikawa (kazuki@panicode.com) for
+ handling focus, return correct colors and fonts,
+ * TreeView.cs: Patches by Kazuki Oikawa (kazuki@panicode.com) to
+ handle selection, horizontal scrolling, and mouse interaction.
+
+2005-01-04 Peter Bartok <pbartok@novell.com>
+
+ * ICommandExecutor.cs: Added
+ * IDataGridColumnStyleEditingNotificationService.cs: Added
+ * IFeatureSupport.cs: Added
+ * IFileReaderService.cs: Added
+ * IDataObject.cs: Added ComVisible attribute
+ * AmbientProperties.cs: Added
+ * BaseCollection.cs: Added missing attributes
+ * ListBindingConverter.cs: Added (stubbed, required for certain attributes)
+ * BaseCollection.cs: Added missing attributes
+ * Binding.cs: Added TypeConverter attribute
+ * BindingContext.cs: Added DefaultEvent attribute
+ * BindingsCollection.cs: Added DefaultEvent attribute
+ * Button.cs: Added DefaultValue attribute
+ * DragEventArgs.cs: Added ComVisible attribute
+ * GiveFeedbackEventArgs.cs: Added ComVisible attribute
+ * KeyEventArgs.cs: Added ComVisible attribute
+ * KeyPressEventArgs.cs: Added ComVisible attribute
+ * MouseEventArgs.cs: Added ComVisible attribute
+ * NavigateEventArgs.cs: Added
+ * NavigateEventHandler.cs: Added
+ * FeatureSupport.cs: Added
+ * OSFeature.cs: Added
+ * Theme.cs: Added abstract Version property to support OSFeature
+ * ThemeWin32Classic.cs: Added Version property to
+ support OSFeature.Themes
+ * ProgressBar.cs: Removed OnPaintBackground override, not required since
+ the proper styles to avoid background drawing are set, also doesn't
+ match MS signature
+ * QueryAccessibilityHelpEventArgs.cs: Added ComVisible attribute
+ * QueryContinueDragEventArgs.cs: Added ComVisible attribute
+ * ScrollEventArgs.cs: Added ComVisible attribute
+ * SplitterEventArgs.cs: Added ComVisible attribute
+ * AccessibleSelection.cs: Added Flags attribute
+ * Appearance.cs: Added ComVisible attribute
+ * Border3DSide.cs: Added ComVisible attribute
+ * Border3DStyle.cs: Added ComVisible attribute
+ * BorderStyle.cs: Added ComVisible attribute
+ * DragAction.cs: Added ComVisible attribute
+ * ErrorBlinkStyle.cs: Added
+ * ScrollEventType.cs: Added ComVisible attribute
+ * AnchorStyles.cs: Added Editor attribute
+ * DockStyle.cs: Added Editor attribute
+ * HorizontalAlignment.cs: Added ComVisible attribute
+ * HelpEventArgs.cs: Added ComVisible attribute
+ * PaintEventArgs.cs: Added IDisposable
+
+2005-01-04 Peter Bartok <pbartok@novell.com>
+
+ * TextControl.cs: Switched Line, LineTag and Document classes to
+ internal
+
+2005-01-04 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ComboBox.cs, ThemeWin32Classic.cs, ListBox.cs, Theme.cs:
+ Simple mode, fixes, IntegralHeight, etc.
+
+2005-01-04 Peter Bartok <pbartok@novell.com>
+
+ * TextBoxBase.cs: Using proper font variable now
+
+2005-01-04 Peter Bartok <pbartok@novell.com>
+
+ * Form.cs (ShowDialog): Set parent to owner, if provided
+ * GroupBox.cs: Removed unused vars
+ * TextControl.cs:
+ - Added GetHashCode() for Document and LineTag classes
+ - Removed unused variables
+ - Added CharIndexToLineTag() and LineTagToCharIndex() methods
+ to allow translation between continuous char position and line/pos
+ * CheckBox.cs: Removed vars that are provided by base class
+ * RadioButton.cs: Removed vars that are provided by base class, added
+ new keyword where required
+ * LinkLabel.cs: Added new keyword where required
+ * Control.cs (WndProc): Removed unused variable
+ * TextBoxBase.cs:
+ - Finished SelectionLength property
+ - Implemented SelectionStart property
+ - Implemented Text property
+ - Removed unused vars
+ * MessageBox.cs: Added new keyword where required
+ * TextBox.cs: Removed Text property code (now in TextBoxBase), fixed
+ WndProc signature
+ * MenuAPI.cs: Added new keyword where required
+ * ButtonBase.cs: Removed vars that are provided by base class, added
+ new keyword where required
+ * ThemeWin32Classic.cs (DrawMonthCalendarDate): Now cast Math.Floor
+ argument to double, to allow compiling with csc 2.0 (Atsushi ran
+ into this)
+ * Application.cs (Run): Now triggers the ThreadExit event
+ * CommonDialog.cs: Added new keyword where required; now properly sets
+ parent (owner) for dialog
+ * XplatUIX11.cs: Commented out unused vars
+ * StatusBar.cs: Fixed signature for Text property
+ * TabPage.cs: Undid Jordi's removal of unused var, now using the var
+
+2005-01-04 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ComboBox.cs, TabPage.cs, MenuAPI.cs, ThemeWin32Classic.cs,
+ TrackBar.cs, MonthCalendar.cs: remove unused vars
+
+2005-01-03 Jackson Harper <jackson@ximian.com>
+
+ * ThemeWin32Classic.cs:
+ * X11Keyboard.cs: Remove unused vars.
+
+2005-01-03 Peter Bartok <pbartok@novell.com>
+
+ * TextBox.cs:
+ - set_Text: Tied into TextControl
+ - set_TextAlignment: Tied into TextControl
+ * TextControl.cs:
+ - Added alignment properties and implemented alignment handling
+ and drawing (still has a bug, not generating proper expose events)
+ - Added new Line() constructor to allow passing the line alignment
+ - Fixed selection setting, properly handling end<start now
+ - Added aligment considerations to RecalculateDocument()
+ * TextBoxBase.cs:
+ - Now properly enforces control height for single line controls
+ - Added support for CharacterCasing
+ - Added IsInputKey override
+ - Fixed Keys.Enter logic
+ - Added SetBoundsCore override
+ - Fixed mouse selection handling
+
+2005-01-03 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs:
+ - Collapse and uncheck all nodes when CheckBoxes is disabled.
+ - Checkboxes are always aligned to the bottom of the node,
+ regardless of item height.
+ - Use the node bounds to draw the text so we can center it when
+ the item height is greater then the font height.
+ - Node::Bounds are only the text part of the node.
+ * TreeNode.cs: New method to combine collapsing and unchecking all
+ nodes recursively.
+
+2005-01-02 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Draw checkmarks, handle detecting check mark clicks
+ * TreeNode.cs: Add a bounding box for the checkbox, refresh the
+ tree when a check is changed. TODO: Only refresh the checked node.
+
+2004-12-30 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Draw checkbox boxes when checkboxes are enabled.
+ * TreeNode.cs: When collapsing make sure to never collapse the
+ root node.
+
+2004-12-29 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Align lines to the bottom of plus minus boxes properly.
+
+2004-12-28 Zoltan Varga <vargaz@freemail.hu>
+
+ * X11Structs.cs X11Keyboard.cs XplatUIX11.cs: Fix 64 bit issues.
+
+2004-12-28 Peter Bartok <pbartok@novell.com>
+
+ * MessageBox.cs (get_CreateParams): Don't use owner var if it's
+ not yet assigned
+
+2004-12-28 Peter Bartok <pbartok@novell.com>
+
+ * Control.cs (WndProc): Added WM_HELP handler, now generates
+ HelpRequested event
+ * Form.cs: Added HelpButton property and required support code
+ * XplatUIStructs.cs: Added HELPINFO structure for WM_HELP handling
+
+2004-12-28 Peter Bartok <pbartok@novell.com>
+
+ * CommonDialog.cs:
+ - Made DialogForm.owner variable internal
+ - Added check to ensure owner form is set before setting
+ owner properties in CreateParams
+
+2004-12-28 Geoff Norton <gnorton@customerdna.com>
+
+ * XplatUIOSX.cs: Implement mouse hovering. Fix QDPoint struct to avoid
+ swizzling. Implement ClientToScreen and ScreenToClient. Implement
+ GetCursorPos. Fix major visibility issues. Rework the windowing
+ system to support borderless/titleless windows (implements menus).
+ Fix GetWindowPos. Implement initial background color support for
+ views.
+
+2004-12-28 Peter Bartok <pbartok@novell.com>
+
+ * Form.cs (get_CreateParams): Make sure we have an owner before using
+ the owner variable. Implement proper default if no owner exists
+
+2004-12-28 Peter Bartok <pbartok@novell.com>
+
+ * In preparation for making Managed.Windows.Forms the default build target
+ for System.Windows.Forms, the following stubbed files were added.
+ Dialogs are currently being implemented by contributors and are only
+ short-term place holders.
+ * ColorDialog.cs: Initial check-in (minmal stub)
+ * DataGrid.cs: Initial check-in (minimal stub)
+ * DataGridLineStyle.cs: Initial check-in (minimal stub)
+ * DataGridParentRowsLabelStyle.cs: Initial check-in (minimal stub)
+ * DataGridTableStyle.cs: Initial check-in (minimal stub)
+ * FontDialog.cs: Initial check-in (minimal stub)
+ * FileDialog.cs: Initial check-in (minimal stub)
+ * GridColumnStylesCollection.cs: Initial check-in (minimal stub)
+ * GridTableStylesCollection.cs: Initial check-in (minimal stub)
+ * OpenFileDialog: Initial check-in (minimal stub)
+ * IComponentEditorPageSite.cs: Initial check-in
+ * Splitter.cs: Initial check-in (for Jackson)
+ * SplitterEventArgs.cs: Initial check-in (for Jackson)
+ * SplitterEventHandler.cs: Initial check-in (for Jackson)
+ * TextBox.cs: Initial check-in; still needs some wiring to
+ TextControl backend
+ * Form.cs: Implemented ControlBox property
+ * MessageBox.cs: Added proper coding for Minimize/Maximize/ControlBox
+ * CommonDialog.cs: Added proper coding for Minimize/Maximize/ControlBox
+ * TextControl.cs: Added selection functionality; added todo header
+ * TextBoxBase.cs:
+ - Implemented Lines property
+ - Implemented TextHeight property
+ - Implemented SelectedText property
+ - Implemented SelectionLength property
+ - Implemented SelectAll method
+ - Implemented ToString method
+ - Removed and cleaned up some debug code
+ - Implemented (still buggy) mouse text selection
+
+2004-12-27 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ComboBox.cs: Complete DropDownList implementation, fixes.
+
+2004-12-26 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ThemeWin32Classic, Theme.cs: ComboBox drawing methods
+ * ComboBoxStyle.cs: ComboBoxStyle enum
+ * ComboBox.cs: Initial work on ComboBox control
+
+2004-12-21 Peter Bartok <pbartok@novell.com>
+
+ * Control.cs (ctor, CreateParams): Moved setting of is_visible
+ forward so that anything that creates a window gets the default,
+ also no longer uses Visible property in CreateParams to avoid
+ walking up the parent chain and possibly get the wrong visible
+ status. Fixed IsVisible to no longer walk up to the parent.
+
+2004-12-21 Peter Bartok <pbartok@novell.com>
+
+ * Form.cs (ShowDialog): Unset modality for the proper window
+
+2004-12-20 Peter Bartok <pbartok@novell.com>
+
+ * CommonDialog.cs: Initial check-in
+
+2004-12-20 Peter Bartok <pbartok@novell.com>
+
+ * Control.cs (Visible): Now uses the parent window instead of the
+ client area window for the property
+
+ * Form.cs
+ - ShowDialog(): Now uses the proper window for modality
+ - The default visibility state for the form parent is now false. This
+ will prevent the user from seeing all the changes to the form and
+ its controls before the application hits Application.Run()
+ - Removed some stale commented out code
+
+ * NativeWindow.cs:
+ - Added FindWindow() method to have a method to check for existence
+ of a window handle
+ - Added ability to override default exception handling (for example
+ when debugging with VS.Net; to do this the ExternalExceptionHandler
+ define must be set
+ - Removed some useless debug output
+
+ * XplatUIX11.cs:
+ - Removed r37929 (SetModal patch from Ashwin Bharambe), was
+ not working as expected
+ - Implemented modal_window stack and checking for _WM_ACTIVE_WINDOW
+ property to allow switching back to the modal window if focus is
+ given to another one of our windows (Application Modal)
+ - Now only sets override_redirect if we create a window
+ without WS_CAPTION
+ - Moved EventMask selection before mapping of newly created window
+ so we can catch the map event as well
+ - Implemented Activate() method via the _WM_ACTIVE_WINDOW property
+ - Added various Atom related DllImports
+ - Implemented Exit() method
+ - .ctor() : No longer shows window if WS_VISIBLE is not defined
+ in the CreateParams
+
+ * MessageBox.cs: Now properly deals with the FormParent window by
+ providing an override the FormParent CreateParams property to
+ set as POPUP instead of OVERLAPPED window.
+
+2004-12-19 Geoff Norton <gnorton@customerdna.com>
+
+ * XplatUIOSX.cs: Implement DestroyWindow. Implement ScrollWindow
+ Minor code cleanup.
+
+2004-12-19 Geoff Norton <gnorton@customerdna.com>
+
+ * XplatUIOSX.cs (SetModal): Implement this method on OSX.
+
+2004-12-18 Peter Bartok <pbartok@novell.com>
+
+ * XplatUIX11.cs (SetModal): Applied patch from Ashwin Bharambe,
+ implementing SetModal() method
+
+2004-12-18 Peter Bartok <pbartok@novell.com>
+
+ * X11Structs.cs (XGCValues): Fixed type of function element
+ * XplatUI.cs: Added ScrollWindow() method
+ * XplatUIDriver.cs: Added ScrollWindow() abstract
+ * XplatUIWin32.cs: Implemented ScrollWindow() method
+ * XplatUIX11.cs: Implemented ScrollWindow() method
+ * XplatUIOSX.cs: Stubbed out ScrollWindow() method
+
+2004-12-17 Geoff Norton <gnorton@customerdna.com>
+
+ * XplatUIOSX.cs: Fix cursor to use an Invert instead of drawing it
+ Some more keyboard support (INCOMPLETE)
+
+2004-12-17 Peter Bartok <pbartok@novell.com>
+
+ * TextControl.cs:
+ - Added color attribute to line tags.
+ - Added color argument to all functions dealing with tags
+ - Added color argument support to various functions
+ - Fixed miss-calculation of baseline/shift in certain circumstances
+
+ * TextBoxBase.cs: Added new color option to test code
+
+2004-12-17 Jackson Harper <jackson@ximian.com>
+
+ * TreeNode.cs:
+ * MonthCalendar.cs: Signature fixes
+
+2004-12-17 Geoff Norton <gnorton@customerdna.com>
+
+ * XplatUIOSX.cs: Find the missing caret; caret was dissappearing after a
+ keyboard event moved it. Create a new graphics context for each paint resolves this
+
+2004-12-17 Geoff Norton <gnorton@customerdna.com>
+
+ * XplatUIOSX.cs: Fix hard cpu eat on loop with existing timers,
+ Make caret exist and go blink blink. Initial keyboard support.
+ Fix exception handler, Add Invalidate support. Change way RefreshWindow
+ works.
+
+2004-12-17 Jackson Harper <jackson@ximian.com>
+
+ * XplatUIStructs.cs: Updated set of virtual keycodes.
+ * KeyboardLayouts.cs: SCROLL_LOCK is now SCROLL
+
+2004-12-17 Jackson Harper <jackson@ximian.com>
+
+ * XplatUIX11.cs: Prune old keyboard code.
+
+2004-12-17 Jackson Harper <jackson@ximian.com>
+
+ * XplatUIX11.cs: When generating mouse wparams get the modifier
+ keys from the ModifierKeys property.
+
+2004-12-17 Jackson Harper <jackson@ximian.com>
+
+ * X11Keyboard.cs: Send up/down input when generating
+ messages. Remove some unused vars.
+
+2004-12-17 Jackson Harper <jackson@ximian.com>
+
+ * TabControl.cs:
+ * TreeView.cs: get rid of warnings.
+
+2004-12-17 Jackson Harper <jackson@ximian.com>
+
+ * XplatUIStructs.cs: Fix a couple wrong virtual keycodes.
+
+2004-12-17 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ListBox.cs: bug fixes, changes for CheckedListBox.cs
+ CheckedListBox.cs: Implementation
+
+2004-12-17 Peter Bartok <pbartok@novell.com>
+
+ * TextControl.cs (RecalculateLine): Fixed baseline aligning calcs
+
+2004-12-16 Peter Bartok <pbartok@novell.com>
+
+ * TextControl.cs:
+ - InsertCharAtCaret(): Fixed start pos fixup
+ - CaretLine_get: No longer derives the line from the tag, the tag
+ could be stale if lines in the document have been added or deleted
+ - RebalanceAfterDelete(): Fixed bug in balancing code
+ - RebalanceAfterAdd(): Fixed really stupid bug in balancing code
+ - Line.Streamline(): Now can also elminate leading empty tags
+ - DumpTree(): Added a few more tests and prevented exception on
+ uninitialized data
+ - Added Debug section for Combining lines
+ - Delete(): Now copies all remaining properties of a line
+
+ * TextBoxBase.cs:
+ - Left mousebutton now sets the caret (and middle button still acts
+ as formatting tester, which must go away soon)
+ - Added Debug section for Deleting/Combining lines
+ - Fixed calculations for UpdateView after Combining lines
+
+2004-12-16 Peter Bartok <pbartok@novell.com>
+
+ * TextControl.cs: Now properly aligns text on a baseline, using the
+ new XplatUI.GetFontMetrics() method. Simplified several calculations
+ * TextBoxBase.cs: Moved #endif to allow compiling if Debug is not
+ defined
+
+2004-12-16 Peter Bartok <pbartok@novell.com>
+
+ * XplatUI.cs: Added GetFontMetrics() method
+ * XplatUIDriver.cs: Added GetFontMetrics() abstract
+ * XplatUIX11.cs: Implemented GetFontMetrics() method, now calls
+ into libgdiplus, our private GetFontMetrics function
+ * XplatUIOSX.cs: Implemented GetFontMetrics() method, same as X11
+ * XplatUIWin32.cs: Implemented GetFontMetrics() method
+
+2004-12-16 Jackson Harper <jackson@ximain.com>
+
+ * XplatUIStruct.cs: Add enum for dead keys
+ * X11Keyboard.cs: Map and unmap dead keys.
+
+2004-12-16 Jackson Harper <jackson@ximian.com>
+
+ * X11Keyboard.cs: Detect and use the num lock mask.
+
+2004-12-16 Peter Bartok <pbartok@novell.com>
+
+ * Control.cs (CreateGraphics): Added check to make sure the
+ handle of the window exists before calling Graphics.FromHwnd()
+
+2004-12-16 Peter Bartok <pbartok@novell.com>
+
+ * TextBoxBase.cs: Initial check-in. DO NOT TRY TO USE THIS YET. It
+ contains a lot of code that's not supposed to be there for the
+ real thing, but required for developing/testing the textbox
+ backend.
+
+2004-12-16 Peter Bartok <pbartok@novell.com>
+
+ * TextControl.cs:
+ - Fixed Streamline method
+ - Added FindTag method to Line
+ - Added DumpTree method for debugging
+ - Added DecrementLines() method for deleting lines
+ - Fixed UpdateView to update the cursor to end-of-line on single-line
+ updates
+ - Added PositionCaret() method
+ - Fixed MoveCaret(LineDown) to move into the last line, too
+ - Added InsertChar overload
+ - Fixed InsertChar tag offset calculations
+ - Added DeleteChar() method
+ - Added Combine() method for folding lines
+ - Fixed Delete() method, no longer allocates wasted Line object and
+ now copies all properties when swapping nodes
+ - Delete() method now updates document line counter
+
+2004-12-15 Jackson Harper <jackson@ximian.com>
+
+ * XplatUIX11.cs: Get the modifier keys from the keyboard driver
+ * X11Keyboard.cs: Expose the currently selected modifier keys
+ through a property.
+
+2004-12-15 Peter Bartok <pbartok@novell.com>
+
+ * TextControl.cs: Initial check-in. Still incomplete
+
+2004-12-15 Jackson Harper <jackson@ximian.com>
+
+ * TreeNode.cs:
+ * TreeView.cs: Fix build on csc (second time today ;-))
+
+2004-12-15 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Store the treenodes plus/minus box bounds when it
+ is calculated and use this for click testing.
+ * TreeNode.cs: Add functionality to store the nodes plus minus box bounds.
+
+2004-12-15 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Pass the nodes image index to the image list when
+ drawing that image.
+
+2004-12-15 Jackson Harper <jackson@ximian.com>
+
+ * X11Keyboard.cs: Set messages hwnd.
+ * XplatUIX11.cs: Pass proper hwnd wot keyboard driver. Set hwnd on
+ post_message calls.
+
+2004-12-15 Jackson Harper <jackson@ximian.com>
+
+ * X11Keyboard.cs: Fix to compile with csc.
+
+2004-12-15 Jackson Harper <jackson@ximian.com>
+
+ * X11Structs.cs: Add key mask values
+ * XplatUIStruct.cs: Add keyboard event flags, and keyboard definitions
+ * X11Keyboard.cs: New file - Extrapolates and interpolates key
+ down/up foo into WM_CHAR foo
+ * KeyboardLayouts.cs: Common keyboard layouts
+ * XplatUIX11.cs: Add the keyboard driver. Add functionality to
+ post messages into the main queue.
+
+2004-12-13 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * Button.cs: implement ProcessMnemonic
+ * ThemeWin32Classic.cs: use ResPool (caching) instead of creating
+ brushes everytime
+ * Control.cs: fixes IsMnemonic (support for &&, case insensitive, etc)
+ * ButtonBase.cs: Show HotkeyPrefix (not the &)
+
+2004-12-12 John BouAntoun <jba-mon@optusnet.com.au>
+
+ * MonthCalendar.cs: Implemented click-hold for next/previous month
+ and date selection
+
+2004-12-11 Peter Bartok <pbartok@novell.com>
+
+ * X11Structs.cs:
+ - Added XKeyboardState (moved from XplatUIX11.cs)
+ - Added XCreateGC related enums and structures
+ - Added GXFunction for XSetFunction
+
+ * XplatUIStructs.cs: Added missing WS_EX_xxx definitions
+
+ * XplatUI.cs: Added CreateCaret(), DestroyCaret(), SetCaretPos() and
+ CaretVisible() calls
+
+ * ToolTip.cs: Added code to prevent stealing focus from app windows
+
+ * XplatUIDriver.cs: Added abstracts for caret functions (CreateCaret,
+ DestroyCaret, SetCaretPos and CaretVisible)
+
+ * XplatUIX11.cs:
+ - Added implementation for caret functions
+ - Moved hover variables into a struct, to make it a bit easier
+ on the eyes and to debug
+ - Removed XKeyboardState (moved to XplatUIX11.cs)
+ - Moved Keyboard properties into the properties region
+
+ * Control.cs (get_Region): Control.CreateGraphics is the appropriate
+ call to get a graphics context for our control
+
+ * XplatUIOSX.cs: Added empty overrides for the new caret functions
+
+ * TreeView.cs: Fixed bug. No matter what color was set it would always
+ return SystemColors.Window
+
+ * XplatUIWin32.cs: Implemented caret overrides
+
+2004-12-10 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ListBox.cs: fire events, implement missing methods and properties,
+ sorting.
+
+2004-12-10 John BouAntoun <jba-mono@optusnet.com.au>
+
+ * MonthCalendar.cs: invalidation bug fixing
+ * ThemeWin32Classic.cs: paint fixing
+
+2004-12-09 Geoff Norton <gnorton@customerdna.com>
+
+ * XplatUIOSX.cs: Refactor to pass the real hwnd into Graphics.FromHwnd, we
+ prepare the CGContextRef there now.
+
+2004-12-09 John BouAntoun <jba-mono@optusnet.com.au>
+
+ * MonthCalendar.cs:
+ - optimisationL only invalidate areas that have changed
+ * ThemeWin32Classic.cs:
+ - only paint parts that intersect with clip_area
+
+2004-12-09 Peter Bartok <pbartok@novell.com>
+
+ * Application.cs: Undid changes from r37004 which cause problems
+ on X11
+
+2004-12-09 Ravindra <rkumar@novell.com>
+
+ * ToolBar.cs: Added support for displaying ContextMenu
+ attached to a button on ToolBar.
+ * ToolBarButton.cs: Uncomment/fixed the DropDownMenu
+ property.
+
+2004-12-09 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * Label.cs: autosize works in text change and removes unnecessary
+ invalidate
+
+2004-12-09 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ThemeWin32Classic.cs, XplatUIOSX.cs, XplatUIWin32.cs:
+ remove warnings
+
+2004-12-08 Geoff Norton <gnorton@customerdna.com>
+
+ * XplatUIOSX.cs: Added mouse move/click/grab support
+ Remove some debugging WriteLines not needed anymore.
+ Add window resizing/positioning.
+ Fix visibility on reparenting.
+
+2004-12-08 Peter Bartok <pbartok@novell.com>
+
+ * XplatUIOSX.cs: Added Idle event, now compiles on VS.Net
+
+2004-12-07 Geoff Norton <gnorton@customerdna.com>
+
+ * XplatUIOSX.cs: Initial checkin
+ * XplatUI.cs: Use the Quartz driver if the environment is set to use it
+
+2004-12-03 Ravindra <rkumar@novell.com>
+
+ * ListView.cs: Added some keybindings and fixed scrolling.
+ ScrollBars listen to ValueChanged event instead of Scroll
+ Event. This would let us take care of all changes being
+ done in the scrollbars' values programmatically or manually.
+ * ListView.cs (CanMultiselect): Added a check for shift key.
+ * ListView.cs (EnsureVisible): Fixed. Do proper scrolling.
+ * ListViewItem.cs (Clone): Fixed. We need to make a copy
+ of ListViewSubItemCollection as well.
+
+2004-12-06 Peter Bartok <pbartok@novell.com>
+
+ * Control.cs (Parent): Added check and exception to prevent
+ circular parenting
+
+2004-12-03 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ListBox.cs: implemented clipping, selection single and multiple,
+ bug fixing
+
+2004-12-03 Ravindra <rkumar@novell.com>
+
+ * ListView.cs (ListView_KeyDown):
+ * ListView.cs (ListView_KeyUp): Fixed multiple selection handling
+ when CTRL key is pressed.
+ * ListViewItem.cs (Selected): Fixed setting the property.
+
+2004-12-03 Marek Safar <marek.safar@seznam.cz>
+
+ * Application.cs (OnThreadException): Use ThreadExceptionDialog.
+
+ * Form.cs: Add ActiveForm, FormBorderStyle, MaximizeBox,
+ MinimizeBox, ShowInTaskbar, TopMost properties.
+
+ * ThreadExceptionDialog.cs: Implemented (disabled TextBox until
+ will be implemented).
+
+2004-12-03 Marek Safar <marek.safar@seznam.cz>
+
+ * OwnerDrawPropertyBag.cs: New internal parameterless ctor.
+
+ * TreeNode.cs: Implemented ICloneable, Fixed to pass my simple
+ tests.
+
+ * TreeNodeCollection.cs: Add exception throwing for Add,AddRange.
+
+ * TreeView.cs: BackColor is Colors.Window.
+
+2004-12-01 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: When resizing the tree if the user is making it
+ smaller we don't get expose events, so we need to handle adding
+ the horizontal scrollbar in the size changed handler as well as
+ the expose handler.
+
+2004-12-02 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * DrawItemState.cs: fixes wrong enum values
+
+2004-12-01 Jackson Harper <jackson@ximian.com>
+
+ * TreeView.cs: Resize the hbar as well as the vbar on resize.
+
+2004-12-01 Jackson Harper <jackson@ximian.com>
+
+ * NodeLabelEditEventArgs.cs:
+ * NodeLabelEditEventHandler.cs:
+ * OpenTreeNodeEnumerator.cs:
+ * TreeNode.cs:
+ * TreeNodeCollection.cs:
+ * TreeView.cs:
+ * TreeViewAction.cs:
+ * TreeViewCancelEventArgs.cs:
+ * TreeViewCancelEventHandler.cs:
+ * TreeViewEventArgs.cs:
+ * TreeViewEventHandler.cs: Initial implementation.
+
+2004-12-01 Ravindra <rkumar@novell.com>
+
+ * ListView.cs (CalculateListView): Fixed scrolling related
+ calculations. Also, removed some debug statements from other
+ places.
+ * ListViewItem.cs: Changed access to 'selected' instance variable
+ from private to internal.
+ * ThemeWin32Classic.cs (DrawListViewItem): Fixed SubItem drawing.
+
+2004-12-01 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ThemeWin32Classic.cs: remove cache of brush and pens for
+ specific controls and use the global system, fixes scrollbutton
+ bugs (for small sizes, disabled, etc)
+
+ * ScrollBar.cs: does not show the thumb for very small controls
+ (as MS) and allow smaller buttons that the regular size
+
+2004-12-01 Miguel de Icaza <miguel@ximian.com>
+
+ * UpDownBase.cs: Add abstract methods for the interface.
+ Add new virtual methods (need to be hooked up to TextEntry when it
+ exists).
+ Add override methods for most features.
+ Computes the size, forces the height of the text entry.
+
+ * NumericUpDown.cs: Put here the current testing code.
+
+ * Set eol-style property on all files that do not have mixed line
+ endings, to minimize the future problems. There are still a few
+ files with mixed endings, and someone should choose whether they
+ want to move it or not.
+
+2004-11-30 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * MonthCalendar.cs, ListView.cs: use Theme colours instead of
+ System.Colors
+
+2004-11-30 Ravindra <rkumar@novell.com>
+
+ * ThemeWin32Classic.cs (DrawListViewItem): Fixed selected item
+ drawing and replaced use of SystemColors by theme colors.
+ * ListView.cs (ListView_Paint): Fixed painting done during scrolling.
+ * ListView.cs (ListViewItemCollection.Add): Throw exception when
+ same ListViewItem is being added more than once.
+
+2004-11-30 John BouAntoun <jba-mono@optusnet.com.au>
+
+ * MonthCalendar.cs:
+ - ControlStyles love to make the control not flicker
+
+2004-11-30 Peter Bartok <pbartok@novell.com>
+
+ * CharacterCasing.cs: Added
+
+2004-11-29 Peter Bartok <pbartok@novell.com>
+
+ * TreeNode.cs, TreeNodeCollection.cs, TreeView.cs,
+ TreeViewAction.cs, TreeViewEventArgs.cs: Removed new files.
+ I am removing these files as they conflict with already completed
+ work. While it is fantastic to get contributions to MWF, I
+ respectfully ask that everyone please coordinate their contributions
+ through mono-winforms-list or #mono-winforms at this time. We're
+ explicitly avoiding stubbing and don't want controls that don't have
+ their basic functionality implemented in svn. Please also see
+ http://www.mono-project.com/contributing/winforms.html
+
+
+2004-11-29 Marek Safar <marek.safar@seznam.cz>
+
+ * Application.cs (ModalRun): Don't hang after exit.
+
+ * Theme.cs: New TreeViewDefaultSize property.
+
+ * ThemeWin32Classic.cs: Replaced hardcoded defaultWindowBackColor
+ with less hardcoded SystemColors constant.
+ Implemented TreeViewDefaultSize.
+
+ * TreeNode.cs, TreeNodeCollection.cs, TreeView.cs,
+ TreeViewAction.cs, TreeViewEventArgs.cs: New files.
+
+
+2004-11-29 John BouAntoun <jba-mono@optusnet.com.au>
+
+ * MonthCalendar.cs:
+ - Fix NextMonthDate and PrevMonthDate click moving calendar
+
+2004-11-26 John BouAntoun <jba-mono@optusnet.com.au>
+
+ * MonthCalendar.cs:
+ - Fix usage of ScrollChange Property when scrolling months
+
+2004-11-26 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * Menu.cs, MainMenu.cs, MenuItem.cs, MenuAPI.cs
+ - Fixes menu destroying
+ - Support adding and removing items on already created menus
+
+2004-11-26 John BouAntoun <jba-mono@optusnet.com.au>
+
+ * MonthCalendar.cs:
+ - Re-worked all bolded dates handling to match win32
+ * ThemeWin32Classic.cs:
+ - Fixed rendering with bolded dates
+
+2004-11-25 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ListBox.cs, Theme.cs, ThemeWin32Classic.cs:
+ - Horizontal scroolbar
+ - Multicolumn
+ - Fixes
+
+
+2004-11-25 John BouAntoun <jba-mono@optusnet.com.au>
+
+ * MonthCalendar.cs:
+ - Fix Usage of MaxSelectionCount from SelectionRange
+ - Fixed Shift + Cursor Selection
+ - Fixed Shift + (Pg up/Pg dn, Home/End) selection
+ - Fixed normal cursor selection to be compat with win32
+ - Fixed Shift + Mouse Click selection
+
+2004-11-24 Peter Bartok <pbartok@novell.com>
+
+ * XplatUI.cs (DispatchMessage): Switched to return IntPtr
+ * XplatUIDriver.cs (DispatchMessage): Switched to return IntPtr
+ * XplatUIX11.cs:
+ - CreatedKeyBoardMsg now updates keystate with Alt key
+ - Added workaround for timer crash to CheckTimers, Jackson will
+ develop a proper fix and check in later
+ - Implemented DispatchMessage
+ - Removed calling the native window proc from GetMessage (call
+ now moved to DispatchMessage)
+
+ * KeyEventArgs.cs (Constructor): Now combines modifierkeys into
+ the keydata (Fixes bug #69831)
+
+ * XplatUIWin32.cs:
+ - (DispatchMessage): Switched to return IntPtr
+ - Added DllImport for SetFocus
+
+2004-11-24 Ravindra <rkumar@novell.com>
+
+ * ThemeWin32Classic.cs: Fixed ListView border and checkbox
+ background drawing.
+ * ListViewItem.cs: Fixed various properties, calculations
+ and Clone() method. Fixed ListViewSubItemCollection.Clear() method.
+ * ListView.cs: Fixed calculations, BackColor, ForeColor properties
+ and some internal properties. Fixed MouseDown handler and Paint
+ method.
+
+2004-11-24 John BouAntoun <jba-mono@optusnet.com.au>
+
+ * MonthCalendar.cs: Add TitleMonth ContextMenu handling
+
+2004-11-24 John BouAntoun <jba-mono@optusnet.com.au>
+
+ * ContainerControl.cs: correct accidental check in of local changes
+
+2004-11-24 John BouAntoun <jba-mono@optusnet.com.au>
+
+ * ThemeWin32Classic.cs:
+ - Fixed Drawing Last month in grid (sometimes not showing)
+ * MonthCalendar.cs:
+ - Fixed title width calculation bug (makeing title small)
+
+2004-11-23 Peter Bartok <pbartok@novell.com>
+
+ * XplatUIX11.cs:
+ - Added generation of WM_MOUSEHOVER event
+ - Added missing assignment of async_method atom
+ - Fixed WM_ERASEBKGND; now only redraws the exposed area
+
+2004-11-23 John BouAntoun <jba-mono@optusnet.com.au>
+
+ * ThemeWin32Classic.cs:
+ - Fixed Drawing of today circle when showtodaycircle not set
+ - fixed drawing of first and last month in the grid (gay dates)
+ * MonthCalendar.cs:
+ - Fixed Drawing of today circle
+ - Fixed drawing of grady dates
+ - Fixed HitTest for today link when ShowToday set to false
+ - Fixed DefaultSize to obey ShowToday
+
+2004-11-23 John BouAntoun <jba-mono@optusnet.com.au>
+
+ * ThemeWin32Classic.cs: Fixed DrawMonthCalendar and private support methods
+ * System.Windows.Forms/Theme.cs
+ * MonthCalendar.cs: added for MonthCalendar
+ * SelectionRange.cs: added for MonthCalendar
+ * Day.cs: added for MonthCalendar: added for MonthCalendar
+ * DateRangeEventArgs.cs: added for MonthCalendar
+ * DateRangeEventHandler.cs: added for MonthCalendar
+
+2004-11-22 Ravindra <rkumar@novell.com>
+
+ * ThemeWin32Classic.cs: Fixed ListViewDrawing with 'UseItemStyleForSubItems'
+ property.
+
+2004-11-22 Miguel de Icaza <miguel@ximian.com>
+
+ * UpDownBase.cs (InitTimer): Use prehistoric C# 1.0 notation for
+ event handler.
+
+ * NumericUpDown.cs: Added new implementation.
+ * UpDownBase.cs: Added new implementation.
+
+ * XplatUIWin32.cs (KeyboardSpeed, KeyboardDelay): added default
+ implementations.
+
+ * XplatUIX11.cs (KeyboardSpeed, KeyboardDelay): added default
+ implementations.
+
+ * XplatUIDriver.cs ((KeyboardSpeed, KeyboardDelay): added new
+ methods.
+
+2004-11-21 Miguel de Icaza <miguel@ximian.com>
+
+ * Timer.cs (Dispose): Should call the base dispose when
+ overriding.
+
+2004-11-19 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ScrollBar.cs: updates thumb position when max, min or increment
+ is changed
+
+2004-11-21 Ravindra <rkumar@novell.com>
+
+ * ListView.cs: Implemented item selection, activation and
+ column header style. Fixed properties to do a redraw, if
+ required. Added support for MouseHover, DoubleClick, KeyDown
+ and KeyUp event handling and some minor fixes.
+ * ListViewItem.cs: Fixed constructor.
+ * ThemeWin32Classic.cs: Improved drawing for ListView.
+
+2004-11-19 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ThemeWin32Classic.cs: initial listbox drawing code
+ * DrawMode.cs: new enumerator
+ * ListControl.cs: stubbed class
+ * ListBox.cs: initial implementation
+ * Theme.cs: new methods definitions
+ * SelectionMode.cs: new enumerator
+
+2004-11-17 Peter Bartok <pbartok@novell.com>
+
+ * XplatUIWin32.cs: Added double-click events to the class style
+ * Control.cs (WndProc):
+ - Added handling of click-count to MouseDown/ MouseUp events.
+ - Added handling of middle and right mouse buttons
+ - Removed old debug code
+
+2004-11-17 Jackson Harper <jackson@ximian.com>
+
+ * XplatUIX11.cs: Use the new Mono.Unix namespace.
+
+2004-11-17 Ravindra <rkumar@novell.com>
+
+ * ListView.cs: Added event handling for MouseMove/Up/Down.
+ * ColumnHeader.cs: Added a read-only internal property 'Pressed'.
+ * ThemeWin32Classic.cs: We need to clear the graphics context and
+ draw column header in a proper state.
+
+
+2004-11-17 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * Menu.cs: fixes signature
+
+2004-11-16 Peter Bartok <pbartok@novell.com>
+
+ * XplatUIX11.cs (GetMessage): Implemented generation of
+ double click mouse messages
+
+2004-11-12 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * Form.cs, MainMenu.cs, MenuAPI.cs: tracker should be for tracking session
+ not by menu
+
+2004-11-11 Peter Bartok <pbartok@novell.com>
+
+ * HandleData.cs: Added Visible property
+ * XplatUIX11.cs (IsVisible): Now uses Visible property from
+ HandleData
+ * XplatUIX11.cs: Removed old debug leftovers
+ * XplatUIX11.cs (DefWndProc): Added WM_ERASEBKGND handler
+ * Control.cs (WndProc): Removed old debug leftovers,
+ streamlined handling of WM_WINDOWPOSCHANGED, removed un-
+ needed WM_SIZE handling
+
+2004-11-11 Jackson Harper <jackson@ximian.com>
+
+ * OwnerDrawPropertyBag.cs:
+ * TreeViewImageIndexConverter.cs: Initial implementation
+
+2004-11-10 Jackson Harper <jackson@ximian.com>
+
+ * ThemeWin32Classic.cs:
+ * TabControl.cs: instead of moving tabs by the slider pos just
+ start drawing at the tab that is offset by the slider. This way
+ scrolling always moves by exactly one tab.
+
+2004-11-10 Jackson Harper <jackson@ximian.com>
+
+ * TabControl.cs: You can only scroll left when the slider has
+ already ben moved right.
+
+2004-11-10 Jackson Harper <jackson@ximian.com>
+
+ * ThemeWin32Classic.cs: Do not draw the selected tab if its not in
+ the clip area.
+
+2004-11-10 Jackson Harper <jackson@ximian.com>
+
+ * ThemeWin32Classic.cs: Don't bother drawing tabs outside of the
+ clip area.
+
+2004-11-09 Jackson Harper <jackson@ximian.com>
+
+ * TabControl.cs (CalcXPos): New helper method so we can determine
+ the proper place to start drawing vertical tabs.
+ * ThemeWin32Classic.cs (DrawTab): Draw right aligned tabs.
+
+2004-11-09 Jackson Harper <jackson@ximian.com>
+
+ * TabControl.cs: Calculate sizing and rects for left aligned tabs.
+ * ThemeWin32Classic.cs (GetTabControl*ScrollRect): Only handle Top
+ and Bottom, left and right are illegal values for this and
+ multiline is enabled when the alignment is set to left or right.
+ (DrawTab): Each alignment block should draw the text itself now
+ because Left requires special love. Also add rendering for Left
+ aligned tabs.
+
+2004-11-09 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * Form.cs, MainMenu.cs, MenuAPI.cs: fixes menu navigation, fixes popups,
+ does not destroy the windows, removes debugging messages
+
+2004-11-09 jba <jba-mono@optusnet.com.au>
+
+ * ThemeWin32Classic.cs
+ (DrawButtonBase): Fix verticle text rect clipping in windows
+ (DrawCheckBox): Fix CheckAlign.TopCenter and CheckAlign.BottomCenter
+ rendering and incorrect text rect clipping
+ (DrawRadioButton): Fix CheckAlign.TopCenter and CheckAlign.BottomCenter
+ rendering and incorrect text rect clipping
+
+2004-11-08 Jackson Harper <jackson@ximian.com>
+
+ * ThemeWin32Classic.cs (DrawTabControl): Render tabs from top to
+ bottom when they are bottom aligned so the bottoms of the tabs get
+ displayed.
+ * TabControl.cs (DropRow): Move rows up instead of down when the
+ tab control is bottom aligned.
+
+2004-11-08 13:59 pbartok
+
+ * XplatUIX11.cs:
+ - Added handling for various window styles
+ - Added handling for popup windows
+ - Added SetTopmost handling
+
+2004-11-08 13:55 pbartok
+
+ * XplatUIWin32.cs:
+ - Added argument to SetTopmost method
+ - Fixed broken ClientToScreen function
+
+2004-11-08 13:53 pbartok
+
+ * XplatUIStructs.cs:
+ - Added missing WS_EX styles
+
+2004-11-08 13:53 pbartok
+
+ * XplatUI.cs, XplatUIDriver.cs:
+ - Added argument to SetTopmost
+
+2004-11-08 13:52 pbartok
+
+ * X11Structs.cs:
+ - Added XSetWindowAttributes structure
+ - Improved XWindowAttributes structure
+ - Added SetWindowValuemask enum
+ - Added window creation arguments enum
+ - Added gravity enum
+ - Added Motif hints structure
+ - Added various Motif flags and enums
+ - Added PropertyMode enum for property functions
+
+2004-11-08 13:50 pbartok
+
+ * Form.cs:
+ - Fixed arguments for updated SetTopmost method
+
+2004-11-08 13:49 pbartok
+
+ * ToolTip.cs:
+ - Fixed arguments for updated SetTopmost function
+ - Fixed usage of PointToClient
+
+2004-11-08 13:44 pbartok
+
+ * MenuAPI.cs:
+ - Added Clipping of children and siblings
+
+2004-11-08 13:41 pbartok
+
+ * MainMenu.cs:
+ - Removed SetMenuBarWindow call. We do this in Form.cs
+
+2004-11-08 13:40 jackson
+
+ * TabControl.cs, Theme.cs, ThemeWin32Classic.cs: Render the little
+ scrolling jimmi in the correct location with bottom aligned tabs
+
+2004-11-08 13:36 pbartok
+
+ * ContainerControl.cs:
+ - Implemented BindingContext
+ - Implemented ParentForm
+
+2004-11-08 12:46 jackson
+
+ * TabControl.cs: Put bottom rendered tabs in the right location
+
+2004-11-08 07:15 jordi
+
+ * ScrollBar.cs, ThemeWin32Classic.cs: fixes vertical scrollbar and
+ removes dead code
+
+2004-11-05 17:30 jackson
+
+ * TabControl.cs: When selected tabs are expanded make sure they
+ don't go beyond the edges of the tab control
+
+2004-11-05 14:57 jackson
+
+ * TabControl.cs: Reset show_slider so if the control is resized to
+ a size where it is no longer needed it's not displayed anymore
+
+2004-11-05 13:16 jackson
+
+ * TabControl.cs: Make tab pages non visible when added to the
+ control
+
+2004-11-05 12:42 jackson
+
+ * TabControl.cs: Implement SizeMode.FillToRight
+
+2004-11-05 12:16 jackson
+
+ * Control.cs: Do not call CreateHandle if the handle is already
+ created
+
+2004-11-05 11:46 jackson
+
+ * TabControl.cs: Remove superflous call to CalcTabRows
+
+2004-11-05 09:07 jackson
+
+ * XplatUIX11.cs: Update for Mono.Posix changes
+
+2004-11-05 07:00 ravindra
+
+ * ListView.cs, ListViewItem.cs: Implemented some methods and fixed
+ scrolling.
+
+2004-11-04 22:47 jba
+
+ * ThemeWin32Classic.cs:
+ - Fix Button rendering for FlatStyle = Flat or Popup
+ - Fix RadioButton and CheckBox rendering when Appearance = Button
+ (normal and flatstyle).
+ - Correct outer rectangle color when drawing focus rectangle
+ - Adjust button bounds to be 1 px smaller when focused
+ - Make button not draw sunken 3d border when pushed (windows compat)
+ - Fix CPDrawBorder3D to not make bottom right hand corner rounded
+ - Offset the text in RadioButton and Checkbox when being rendered as
+ a button.
+ - Hover and Click behaviour for Colored FlatStyle.Flat and Popup
+ radiobuttons
+ - Fixed disabled rendering for colored flatstyle radiobuttons (both)
+ - Fixed disabled text rendering for normally rendered radiobuttons
+
+2004-11-04 10:26 jackson
+
+ * TabControl.cs: Recalculate tab rows when resizing
+
+2004-11-04 07:47 jordi
+
+ * Form.cs, MainMenu.cs, Menu.cs, MenuAPI.cs, MenuItem.cs:
+ collection completion, drawing issues, missing features
+
+2004-11-04 05:03 ravindra
+
+ * ScrollBar.cs:
+ - We need to recalculate the Thumb area when
+ LargeChange/maximum/minimum values are changed.
+ - We set the 'pos' in UpdatePos() method to minimum, if it's less
+ than minimum. This is required to handle the case if large_change is
+ more than max, and use LargeChange property instead of large_change
+ variable.
+ - We return max+1 when large_change is more than max, like MS does.
+
+2004-11-04 04:29 ravindra
+
+ * ColumnHeader.cs, ListView.cs, ListViewItem.cs:
+ - Changed default value signatures (prefixed all with ListView).
+ - Fixed/implemented layout LargeIcon, SmallIcon and List views for
+ ListView.
+ - Fixed calculations for ListViewItem and implemented Clone()
+ method.
+
+2004-11-04 04:26 ravindra
+
+ * Theme.cs, ThemeWin32Classic.cs:
+ - Changed default ListView values signatures (prefixed all with
+ ListView).
+ - Fixed default size values for VScrollBar and HScrollBar.
+ - Fixed DrawListViewItem method.
+
+2004-11-04 04:05 ravindra
+
+ * ColumnHeaderStyle.cs: Typo. It should be Nonclickable.
+
+2004-11-04 04:04 ravindra
+
+ * ImageList.cs: Implemented the missing overload for Draw method.
+
+2004-11-03 19:29 jackson
+
+ * TabControl.cs: Handle dropping rows on selection properly
+
+2004-11-03 11:59 jackson
+
+ * TabControl.cs: remove debug code
+
+2004-11-03 11:52 jackson
+
+ * TabControl.cs, ThemeWin32Classic.cs: Initial implementation of
+ the scrolly widgerywoo
+
+2004-11-02 13:52 jackson
+
+ * TabControl.cs: Resize the tab pages and tabs when the tab control
+ is resized
+
+2004-11-02 13:40 jackson
+
+ * TabControl.cs, ThemeWin32Classic.cs: Move the row with the
+ selected tab to the bottom
+
+2004-11-02 13:39 jackson
+
+ * TabPage.cs: Store the tab pages row
+
+2004-11-02 12:33 jordi
+
+ * MenuItem.cs: fixes handle creation
+
+2004-11-02 11:42 jackson
+
+ * TabControl.cs: signature fix
+
+2004-11-02 08:56 jackson
+
+ * TabControl.cs: Calculate whether the tab is on an edge properly.
+ Remove top secret debugging code
+
+2004-11-01 19:57 jackson
+
+ * TabControl.cs: Add click handling, and proper sizing
+
+2004-11-01 19:47 jackson
+
+ * Theme.cs, ThemeWin32Classic.cs: New rendering and sizing code for
+ tab controls
+
+2004-11-01 19:39 jackson
+
+ * TabPage.cs: add internal property to store the bounds of a tab
+ page
+
+2004-10-30 04:23 ravindra
+
+ * Theme.cs, ThemeWin32Classic.cs: Drawing ListView and some default
+ values.
+
+2004-10-30 04:21 ravindra
+
+ * ListView.cs, ListViewItem.cs: Added support for scrolling and
+ fixed calculations.
+
+2004-10-30 03:06 pbartok
+
+ * XplatUIX11.cs:
+ - Removed extension of DllImported libs
+
+2004-10-29 09:55 jordi
+
+ * Form.cs, MainMenu.cs, Menu.cs, MenuAPI.cs, MenuItem.cs: Menu key
+ navigation, itemcollection completion, menu fixes
+
+2004-10-27 22:58 pbartok
+
+ * XplatUIX11.cs:
+ - Now throws a nice error message when no X display could be opened
+
+2004-10-26 13:51 jordi
+
+ * ListView.cs: removes warning
+
+2004-10-26 03:55 ravindra
+
+ * ColumnHeader.cs, ListView.cs, ListViewItem.cs,
+ ThemeWin32Classic.cs: Some formatting for my last checkins.
+
+2004-10-26 03:36 ravindra
+
+ * ThemeWin32Classic.cs: Implemented DetailView drawing for ListView
+ control and default values.
+
+2004-10-26 03:35 ravindra
+
+ * Theme.cs: Added some default values for ListView control.
+
+2004-10-26 03:33 ravindra
+
+ * ToolBar.cs: ToolBar should use the user specified button size, if
+ there is any. Added a size_specified flag for the same.
+
+2004-10-26 03:33 ravindra
+
+ * ColumnHeader.cs: Added some internal members and calculations for
+ ColumnHeader.
+
+2004-10-26 03:32 ravindra
+
+ * ListViewItem.cs: Calculations for ListViewItem.
+
+2004-10-26 03:31 ravindra
+
+ * ListView.cs: Added some internal members and calculations for
+ ListView.
+
+2004-10-22 13:31 jordi
+
+ * MenuAPI.cs: speedup menus drawing
+
+2004-10-22 13:16 jackson
+
+ * XplatUIX11.cs: Make sure to update exposed regions when adding an
+ expose event
+
+2004-10-22 11:49 jackson
+
+ * Control.cs: oops
+
+2004-10-22 11:41 jackson
+
+ * Control.cs: Check to see if the window should have its background
+ repainted by X when drawing.
+
+2004-10-22 11:31 jackson
+
+ * XplatUIX11.cs: When invalidating areas only use XClearArea if
+ clear is true, this way we do not get flicker from X repainting the
+ background
+
+2004-10-22 11:28 jackson
+
+ * XEventQueue.cs: Queue properly
+
+2004-10-21 09:38 jackson
+
+ * XEventQueue.cs: Fix access modifier
+
+2004-10-21 09:36 jackson
+
+ * XEventQueue.cs: Don't loose messages
+
+2004-10-21 09:22 jackson
+
+ * XEventQueue.cs: Don't loose messages
+
+2004-10-20 04:15 jordi
+
+ * BootMode.cs: enum need it by SystemInfo
+
+2004-10-19 21:58 pbartok
+
+ * XplatUIWin32.cs:
+ - Small sanity check
+
+2004-10-19 21:56 pbartok
+
+ * Form.cs:
+ - Added private FormParentWindow class which acts as the container
+ for our form and as the non-client area where menus are drawn
+ - Added/Moved required tie-ins to Jordi's menus
+ - Fixed/Implemented the FormStartPosition functionality
+
+2004-10-19 21:52 pbartok
+
+ * Control.cs:
+ - Removed unneeded locals
+ - Added code to all size and location properties to understand and
+ deal with the parent container of Form
+
+2004-10-19 21:33 pbartok
+
+ * Application.cs:
+ - Fixed to deal with new Form subclasses for menus
+
+2004-10-19 17:48 jackson
+
+ * XEventQueue.cs: commit correct version of file
+
+2004-10-19 16:50 jackson
+
+ * XEventQueue.cs, XplatUIX11.cs: New optimized event queue
+
+2004-10-19 16:15 jordi
+
+ * MenuAPI.cs: MenuBarCalcSize returns the height
+
+2004-10-19 08:31 pbartok
+
+ * Control.cs:
+ - Added missing call to PreProcessMessage before calling OnXXXKey
+ methods
+
+2004-10-19 00:04 ravindra
+
+ * ToolTip.cs: Fixed constructor.
+
+2004-10-18 09:31 jordi
+
+ * MenuAPI.cs: menuitems in menubars do not have shortcuts
+
+2004-10-18 09:26 jordi
+
+ * MenuItem.cs: fixes MenuItem class signature
+
+2004-10-18 08:56 jordi
+
+ * MenuAPI.cs: prevents windows from showing in the taskbar
+
+2004-10-18 00:28 ravindra
+
+ * ToolTip.cs: Suppressed a warning message.
+
+2004-10-18 00:27 ravindra
+
+ * Control.cs: Default value of visible property must be true.
+
+2004-10-17 23:19 pbartok
+
+ * ToolTip.cs:
+ - Complete implementation
+
+2004-10-17 23:19 pbartok
+
+ * XplatUIX11.cs:
+ - Added EnableWindow method
+ - Added SetModal stub
+ - Added generation of WM_ACTIVATE message (still needs testing)
+ - Added SetTopMost stub
+ - Changes to deal with VirtualKeys being moved to XplatUIStructs.cs
+
+2004-10-17 23:17 pbartok
+
+ * XplatUIWin32.cs:
+ - Removed VirtualKeys to XplatUIStructs
+ - Implemented SetTopMost method
+ - Implemented EnableWindow method
+ - Bugfix in ScreenToClient()
+ - Bugfixes in ClientToScreen()
+
+2004-10-17 22:51 pbartok
+
+ * XplatUIStructs.cs:
+ - Added WS_EX styles to WindowStyles enumeration
+
+2004-10-17 22:50 pbartok
+
+ * XplatUI.cs, XplatUIDriver.cs:
+ - Added method for enabling/disabling windows
+ - Added method for setting window modality
+ - Added method for setting topmost window
+
+2004-10-17 22:49 pbartok
+
+ * ThemeWin32Classic.cs:
+ - Added ToolTip drawing code
+
+2004-10-17 22:49 pbartok
+
+ * Theme.cs:
+ - Added ToolTip abstracts
+
+2004-10-17 22:47 pbartok
+
+ * Form.cs:
+ - Fixed Form.ControlCollection to handle owner relations
+ - Added Owner/OwnedForms handling
+ - Implemented Z-Ordering for owned forms
+ - Removed unneeded private overload of ShowDialog
+ - Fixed ShowDialog, added the X11 incarnation of modal handling (or
+ so I hope)
+ - Fixed Close(), had wrong default
+ - Added firing of OnLoad event
+ - Added some commented out debug code for Ownership handling
+
+2004-10-17 22:16 pbartok
+
+ * Control.cs:
+ - Fixed/implemented flat list of controls
+
+2004-10-17 22:14 pbartok
+
+ * Application.cs:
+ - Added code to simulate modal dialogs on Win32
+
+2004-10-17 16:11 jordi
+
+ * ScrollBar.cs: disabled scrollbar should not honor any keyboard or
+ mouse event
+
+2004-10-17 13:39 jordi
+
+ * MenuAPI.cs: menu drawing fixes
+
+2004-10-15 09:10 ravindra
+
+ * StructFormat.cs: General Enum.
+
+2004-10-15 09:09 ravindra
+
+ * SizeGripStyle.cs: Enum for Form.
+
+2004-10-15 09:08 ravindra
+
+ * Theme.cs, ThemeWin32Classic.cs: Added ColumnHeaderHeight property
+ in Theme for ListView.
+
+2004-10-15 09:06 ravindra
+
+ * ColumnHeader.cs: Flushing some formatting changes.
+
+2004-10-15 09:05 ravindra
+
+ * ListViewItem.cs: Implemented GetBounds method and fixed coding
+ style.
+
+2004-10-15 09:03 ravindra
+
+ * ListView.cs: Implemented Paint method and fixed coding style.
+
+2004-10-15 07:34 jordi
+
+ * MenuAPI.cs: fix for X11
+
+2004-10-15 07:32 ravindra
+
+ * ButtonBase.cs, CheckBox.cs, RadioButton.cs:
+ - Renamed Paint() method to Draw() for clarity. Also, moved
+ DrawImage() to OnPaint().
+
+2004-10-15 07:25 ravindra
+
+ * CheckBox.cs, RadioButton.cs:
+ - Removed Redraw (), we get it from ButtonBase.
+ - Implemented Paint (), to do class specific painting.
+
+2004-10-15 07:16 ravindra
+
+ * ButtonBase.cs:
+ - Redraw () is not virtual now.
+ - Added an internal virtual method Paint (), so that
+ derived classes can do their painting on their own.
+ - Modified OnPaint () to call Paint ().
+
+2004-10-15 06:43 jordi
+
+ * ContextMenu.cs, DrawItemEventHandler.cs, Form.cs, MainMenu.cs,
+ MenuAPI.cs, MenuItem.cs: menu work, mainmenu, subitems, etc
+
+2004-10-15 00:30 ravindra
+
+ * MessageBox.cs:
+ - MessageBox on windows does not have min/max buttons.
+ This change in CreateParams fixes this on Windows. We
+ still need to implement this windowstyle behavior in
+ our X11 driver.
+
+2004-10-14 05:14 ravindra
+
+ * ToolBar.cs:
+ - Changed Redraw () to do a Refresh () always.
+ - Fixed the MouseMove event handling when mouse is pressed,
+ ie drag event handling.
+ - Replaced the usage of ToolBarButton.Pressed property to
+ ToolBarButton.pressed internal variable.
+
+2004-10-14 05:10 ravindra
+
+ * ToolBarButton.cs:
+ - Added an internal member 'inside' to handle mouse move
+ with mouse pressed ie mouse drag event.
+ - Changed 'Pressed' property to return true only when
+ 'inside' and 'pressed' are both true.
+ - Some coding style love.
+
+2004-10-14 00:17 ravindra
+
+ * Form.cs: Fixed class signature. ShowDialog (Control) is not a
+ public method.
+
+2004-10-14 00:15 ravindra
+
+ * ButtonBase.cs: Redraw () related improvements.
+
+2004-10-14 00:14 ravindra
+
+ * MessageBox.cs: Moved InitFormSize () out of Paint method and
+ removed unnecessary calls to Button.Show () method.
+
+2004-10-13 17:50 pbartok
+
+ * XplatUIX11.cs:
+ - Formatting fix
+ - Removed destroying of window until we solve the problem of X
+ destroying the window before us on shutdown
+
+2004-10-13 16:32 pbartok
+
+ * ButtonBase.cs:
+ - Now Redraws on MouseUp for FlatStyle Flat and Popup
+
+2004-10-13 14:18 pbartok
+
+ * XplatUIX11.cs:
+ - Added code to destroy the X window
+
+2004-10-13 14:18 pbartok
+
+ * XplatUIWin32.cs:
+ - Added code to destroy a window
+
+2004-10-13 14:12 pbartok
+
+ * ButtonBase.cs:
+ - Added the Redraw on Resize that got dropped in the last rev
+
+2004-10-13 09:06 pbartok
+
+ * ThemeWin32Classic.cs:
+ - Path from John BouAntoun:
+ * Fix check rendering (centre correctly for normal style, offset
+ correctly for FlatStyle).
+ * Fix border color usage (use backcolor) for FlatStyle.Popup
+ * Use checkbox.Capture instead of checkbox.is_pressed when
+ rendering flatstyle states.
+
+2004-10-12 21:48 pbartok
+
+ * ThemeWin32Classic.cs:
+ - Removed all occurences of SystemColors and replaced them with the
+ matching theme color
+
+2004-10-12 21:41 pbartok
+
+ * ThemeWin32Classic.cs:
+ - From John BouAntoun: Added an overload to CPDrawBorder3D to allow
+ him using the function for flatstyle drawing
+ - Changed functions to use the new version of CPDrawBorder3D
+
+2004-10-12 21:15 pbartok
+
+ * ControlPaint.cs:
+ - Fixed Dark(), DarkDark(), Light() and LightLight() methods to
+ match MS documentation. They need to return defined colors if the
+ passed color matches the configured control color. Thanks to John
+ BouAntoun for pointing this out.
+
+2004-10-12 20:57 pbartok
+
+ * Control.cs:
+ - Fix from John BouAntoun: Raise ForeColorChanged event when text
+ color is changed
+
+2004-10-12 20:46 pbartok
+
+ * CheckBox.cs:
+ - Fix from John BouAntoun: Now properly sets the Appearance property
+
+2004-10-12 20:45 pbartok
+
+ * ThemeWin32Classic.cs:
+ - Fixes from John BouAntoun: now handles forecolors and backcolors
+ for flatstyle rendered controls much better; It also fixes normal
+ checkbox rendering when pushed or disabled.
+
+2004-10-08 02:50 jordi
+
+ * Form.cs, MainMenu.cs, Menu.cs, MenuAPI.cs, MenuItem.cs: more menu
+ work
+
+2004-10-07 08:56 jordi
+
+ * ThemeWin32Classic.cs: Removes deletion of cached brushes
+
+2004-10-06 03:59 jordi
+
+ * Control.cs, StatusBar.cs, ThemeWin32Classic.cs, ToolBar.cs,
+ XplatUIWin32.cs: removes warnings from compilation
+
+2004-10-05 12:23 jackson
+
+ * RadioButton.cs: Fix ctor
+
+2004-10-05 11:10 pbartok
+
+ * MessageBox.cs:
+ - Partial implementation by Benjamin Dasnois
+
+2004-10-05 10:15 jackson
+
+ * ThemeWin32Classic.cs: Improve rendering of the radio button patch
+ by John BouAntoun
+
+2004-10-05 03:07 ravindra
+
+ * ToolBar.cs:
+ - Removed a private method, Draw ().
+ - Fixed the ButtonDropDown event handling.
+ - Fixed MouseMove event handling.
+
+2004-10-05 03:04 ravindra
+
+ * ThemeWin32Classic.cs:
+ - Added DrawListView method and ListViewDefaultSize property.
+ - Changed ControlPaint method calls to CPDrawXXX wherever possible.
+ - Changed DOS style CRLF to Unix format (dos2unix).
+
+2004-10-05 03:03 ravindra
+
+ * Theme.cs:
+ - Added DrawListView method and ListViewDefaultSize property.
+
+2004-10-05 02:42 ravindra
+
+ * ToolBarButton.cs: Added an internal member dd_pressed to handle
+ clicks on DropDown arrow.
+
+2004-10-04 22:56 jackson
+
+ * ButtonBase.cs, Label.cs, MenuAPI.cs, ProgressBar.cs,
+ ScrollBar.cs, StatusBar.cs, ToolBar.cs, TrackBar.cs: Let the base
+ Control handle the buffers, derived classes should not have to
+ CreateBuffers themselves.
+
+2004-10-04 21:20 jackson
+
+ * StatusBar.cs: The control handles resizing the buffers now.
+
+2004-10-04 21:18 jackson
+
+ * Control.cs: When resizing the buffers should be invalidated. This
+ should be handled in Control not in derived classes.
+
+2004-10-04 14:45 jackson
+
+ * TabPage.cs: oops
+
+2004-10-04 02:14 pbartok
+
+ * LeftRightAlignment.cs:
+ - Initial check-in
+
+2004-10-04 01:09 jordi
+
+ * ThemeWin32Classic.cs: fixes right button position causing right
+ button not showing on horizontal scrollbars
+
+2004-10-02 13:12 pbartok
+
+ * XplatUIX11.cs:
+ - Simplified the Invalidate method by using an X call instead of
+ generating the expose ourselves
+ - Added an expose when the window background is changed
+ - Implemented ClientToScreen method
+
+2004-10-02 13:08 pbartok
+
+ * XplatUIWin32.cs:
+ - Added Win32EnableWindow method (test for implementing modal
+ dialogs)
+ - Added ClientToScreen method and imports
+
+2004-10-02 13:07 pbartok
+
+ * XplatUI.cs, XplatUIDriver.cs:
+ - Added ClientToScreen coordinate translation method
+
+2004-10-02 13:06 pbartok
+
+ * KeyPressEventArgs.cs:
+ - Fixed access level for constructor
+
+2004-10-02 13:06 pbartok
+
+ * NativeWindow.cs:
+ - Changed access level for the window_collection hash table
+
+2004-10-02 13:05 pbartok
+
+ * Form.cs:
+ - Added KeyPreview property
+ - Added Menu property (still incomplete, pending Jordi's menu work)
+ - Implemented ProcessCmdKey
+ - Implemented ProcessDialogKey
+ - Implemented ProcessKeyPreview
+
+2004-10-02 13:02 pbartok
+
+ * Control.cs:
+ - Added private method to get the Control object from the window
+ handle
+ - Implemented ContextMenu property
+ - Implemented PointToScreen
+ - Implemented PreProcessMessage
+ - Implemented IsInputChar
+ - Implemented IsInputKey
+ - Implemented ProcessCmdKey
+ - Completed ProcessKeyEventArgs
+ - Fixed message loop to call the proper chain of functions on key
+ events
+ - Implemented ProcessDialogChar
+ - Implemented ProcessDialogKey
+ - Implemented ProcessKeyMessage
+ - Implemented ProcessKeyPreview
+ - Added RaiseDragEvent stub (MS internal method)
+ - Added RaiseKeyEvent stub (MS internal method)
+ - Added RaiseMouseEvent stub (MS Internal method)
+ - Added RaisePaintEvent stub (MS Internal method)
+ - Added ResetMouseEventArgs stub (MS Internal method)
+ - Implemented RtlTranslateAlignment
+ - Implemented RtlTranslateContent
+ - Implemented RtlTranslateHorizontal
+ - Implemented RtlTranslateLeftRight
+ - Added generation of KeyPress event
+
+2004-10-02 05:57 ravindra
+
+ * ListViewItem.cs: Added attributes.
+
+2004-10-02 05:32 ravindra
+
+ * ListView.cs: Added attributes.
+
+2004-10-01 11:53 jackson
+
+ * Form.cs: Implement the Close method so work on MessageBox can
+ continue.
+
+2004-09-30 14:06 pbartok
+
+ * XplatUIX11.cs:
+ - Bug fixes
+
+2004-09-30 11:34 jackson
+
+ * RadioButton.cs: Fix typo. Patch by John BouAntoun.
+
+2004-09-30 07:26 ravindra
+
+ * ListViewItemConverter.cs: Converter for ListViewItem.
+
+2004-09-30 07:26 ravindra
+
+ * SortOrder.cs: Enum for ListView control.
+
+2004-09-30 07:25 ravindra
+
+ * ColumnHeader.cs: Supporting class for ListView control.
+
+2004-09-30 07:24 ravindra
+
+ * ListView.cs, ListViewItem.cs: Initial implementation.
+
+2004-09-30 07:20 ravindra
+
+ * ItemActivation.cs: Enum for ListView Control.
+
+2004-09-29 20:29 pbartok
+
+ * XplatUIX11.cs:
+ - Added lookup of pixel value for background color; tries to get a
+ color 'close' to the requested color, it avoids having to create a
+ colormap. Depending on the display this could mean the used color
+ is slightly off the desired color. Might have to change it to a more
+ resource intensive colormap approach, but it will work as a
+ workaround to avoid red screens.
+
+2004-09-29 14:27 jackson
+
+ * XplatUIX11.cs: Set the X DisplayHandle in System.Drawing
+
+2004-09-28 12:44 pbartok
+
+ * ButtonBase.cs, CheckBox.cs, ControlPaint.cs, GroupBox.cs,
+ HScrollBar.cs, Label.cs, LinkLabel.cs, Panel.cs, PictureBox.cs,
+ ProgressBar.cs, RadioButton.cs, ScrollBar.cs, StatusBar.cs,
+ Theme.cs, ThemeGtk.cs, ThemeWin32Classic.cs, ToolBar.cs,
+ TrackBar.cs, VScrollBar.cs:
+ - Streamlined Theme interfaces:
+ * Each DrawXXX method for a control now is passed the object for
+ the control to be drawn in order to allow accessing any state the
+ theme might require
+
+ * ControlPaint methods for the theme now have a CP prefix to avoid
+ name clashes with the Draw methods for controls
+
+ * Every control now retrieves it's DefaultSize from the current
+ theme
+
+2004-09-28 12:17 jackson
+
+ * Button.cs: Do not redraw OnClick MouseUp/Down will handle the
+ drawing
+
+2004-09-24 14:57 jackson
+
+ * XplatUIX11.cs: Don't lock/enqueue/dequeue for unhandled messages.
+ Gives us a nice little performance boost.
+
+2004-09-24 12:02 jackson
+
+ * TabAlignment.cs, TabAppearance.cs, TabControl.cs, TabDrawMode.cs,
+ TabPage.cs, TabSizeMode.cs: Partial implementation of the Tab
+ Control and supporting classes. Initial checkin
+
+2004-09-23 13:08 jackson
+
+ * Form.cs: Temp build fixage
+
+2004-09-23 01:39 ravindra
+
+ * ItemChangedEventArgs.cs, ItemChangedEventHandler.cs,
+ ItemCheckEventArgs.cs, ItemCheckEventHandler.cs,
+ ItemDragEventArgs.cs, ItemDragEventHandler.cs,
+ LabelEditEventArgs.cs, LabelEditEventHandler.cs: EventArgs and
+ EventHandlers needed by ListView Control.
+
+2004-09-22 14:12 pbartok
+
+ * ScrollableControl.cs:
+ - Implemented DockPadding property
+ - Implemented AutoScroll property
+ - Implemented AutoScrollMargin property
+ - Implemented AutoScrollMinSize property
+ - Implemented AutoScrollPosition property
+ - Implemented DisplayRectangle property (still incomplete)
+ - Implemented CreateParams property
+ - Implemented HScroll property
+ - Implemented VScroll property
+ - Implemented OnVisibleChanged property
+
+2004-09-22 14:09 pbartok
+
+ * Form.cs:
+ - Added Form.ControllCollection class
+ - Added handling for Form owners: Owner, OwnedForms, AddOwnedForm,
+ RemoveOwnedForm (still incomplete, missing on-top and common
+ minimize/maximize behaviour)
+ - Added StartPosition property (still incomplete, does not use when
+ creating the form)
+ - Added ShowDialog() methods (still incomplete, missing forcing the
+ dialog modal)
+
+2004-09-22 14:05 pbartok
+
+ * Application.cs:
+ - Added message loop for modal dialogs
+
+2004-09-22 14:02 pbartok
+
+ * GroupBox.cs:
+ - Fixed wrong types for events
+
+2004-09-22 14:00 pbartok
+
+ * Shortcut.cs, FormWindowState.cs:
+ - Fixed wrong values
+
+2004-09-22 12:01 jackson
+
+ * Control.cs: Text is never null
+
+2004-09-20 22:14 pbartok
+
+ * XplatUIWin32.cs:
+ - Fixed accessibility level for Idle handler
+
+2004-09-20 18:54 jackson
+
+ * Application.cs, XplatUI.cs, XplatUIDriver.cs, XplatUIWin32.cs,
+ XplatUIX11.cs: New message loop that uses poll so we don't get a
+ busy loop
+
+2004-09-17 10:43 pbartok
+
+ * ScrollBar.cs:
+ - Fixed behaviour of arrow buttons. Now properly behaves like
+ Buttons (and like Microsoft's scrollbar arrow buttons)
+
+2004-09-17 10:14 pbartok
+
+ * ScrollBar.cs:
+ - Added missing release of keyboard/mouse capture
+
+2004-09-17 06:18 jordi
+
+ * ContextMenu.cs, MainMenu.cs, Menu.cs, MenuAPI.cs, MenuItem.cs,
+ Theme.cs: Very early menu support
+
+2004-09-16 17:45 pbartok
+
+ * XplatUIWin32.cs:
+ - Fixed sending a window to the front
+ - Added overload for SetWindowPos to avoid casting
+
+2004-09-16 17:44 pbartok
+
+ * Control.cs:
+ - Added SendToBack and BringToFront methods
+
+2004-09-16 07:00 ravindra
+
+ * Copyright: Added Novell URL.
+
+2004-09-16 07:00 ravindra
+
+ * ToolBar.cs: Invalidate should be done before redrawing.
+
+2004-09-15 21:19 ravindra
+
+ * ColumnHeaderStyle.cs: Enum for ListView Control.
+
+2004-09-15 21:18 ravindra
+
+ * ColumnClickEventArgs.cs, ColumnClickEventHandler.cs: Event for
+ ListView Control.
+
+2004-09-13 18:26 jackson
+
+ * Timer.cs, XplatUIX11.cs: Remove test code so timers are updated
+ properly
+
+2004-09-13 18:13 jackson
+
+ * Timer.cs, X11Structs.cs, XplatUIX11.cs: Timers are now handled in
+ a second thread and post messages into the main threads message
+ queue. This makes timing much more consistent. Both win2K and XP
+ have a minimum timer value of 15 milliseconds, so we now do this
+ too.
+
+2004-09-13 15:18 pbartok
+
+ * X11Structs.cs, XplatUI.cs, XplatUIDriver.cs, XplatUIWin32.cs,
+ XplatUIX11.cs:
+ - Added Z-Ordering methods
+
+2004-09-13 10:56 pbartok
+
+ * Form.cs:
+ - Fixed #region names
+ - Moved properties and methods into their proper #regions
+
+2004-09-13 10:51 pbartok
+
+ * Form.cs:
+ - Added Accept and CancelButton properties
+ - Added ProcessDialogKey() method
+
+2004-09-13 08:18 pbartok
+
+ * IWindowTarget.cs:
+ - Initial check-in
+
+2004-09-10 21:50 pbartok
+
+ * Control.cs:
+ - Added DoDragDrop() [incomplete]
+ - Properly implemented 'Visible' handling
+ - Added SetVisibleCore()
+ - Implemented FindChildAtPoint()
+ - Implemented GetContainerControl()
+ - Implemented Hide()
+
+2004-09-10 19:28 pbartok
+
+ * Control.cs:
+ - Moved methods into their appropriate #regions
+ - Reordered methods within regions alphabetically
+
+2004-09-10 18:57 pbartok
+
+ * XplatUIX11.cs, XplatUI.cs, XplatUIDriver.cs, XplatUIWin32.cs:
+ - Added method to retrieve text from window
+
+2004-09-10 18:56 pbartok
+
+ * Control.cs:
+ - Moved some internal functions into the internal region
+ - Implemented FontHeight
+ - Implemented RenderRightToLeft
+ - Implemented ResizeRedraw
+ - Implemented ShowFocusCues
+ - Implemented ShowKeyboardCues
+ - Implemented FromChildHandle
+ - Implemented FromHandle
+ - Implemented IsMnemonic
+ - Implemented ReflectMessage
+ - All public and protected Static Methods are now complete
+
+2004-09-10 16:54 pbartok
+
+ * Control.cs:
+ - Implemented remaining missing public instance properties
+ - Alphabetized some out of order properties
+
+2004-09-10 05:51 ravindra
+
+ * PictureBox.cs: Added a check for null image.
+
+2004-09-10 00:59 jordi
+
+ * GroupBox.cs: remove cvs tag
+
+2004-09-09 05:25 ravindra
+
+ * ToolBar.cs: Make redraw accessible from ToolBarButton.
+
+2004-09-09 05:23 ravindra
+
+ * ToolBarButton.cs: Changes in ToolBarButton need to make it's
+ parent redraw.
+
+2004-09-09 02:28 pbartok
+
+ * ThemeWin32Classic.cs:
+ - Improve disabled string look
+
+2004-09-09 01:15 jordi
+
+ * MeasureItemEventArgs.cs, MeasureItemEventHandler.cs: measureitem
+ args and handler
+
+2004-09-08 23:56 ravindra
+
+ * ItemBoundsPortion.cs: It's enum, not a class!
+
+2004-09-08 23:47 ravindra
+
+ * FormBorderStyle.cs, FormStartPosition.cs, FormWindowState.cs:
+ Enums for Form.
+
+2004-09-08 21:13 ravindra
+
+ * ItemBoundsPortion.cs, ListViewAlignment.cs, View.cs: Enums for
+ ListView control.
+
+2004-09-08 21:03 ravindra
+
+ * ThemeWin32Classic.cs: PictureBox would not draw a null image to
+ avoid crash.
+
+2004-09-08 21:01 ravindra
+
+ * ScrollableControl.cs: Removed unreachable code.
+
+2004-09-08 06:45 jordi
+
+ * MenuMerge.cs, Shortcut.cs: enumerations need it by menus
+
+2004-09-08 01:00 jackson
+
+ * XplatUIX11.cs: Only run the timers when updating the message
+ queue. This effectively gives X messages a higher priority then
+ timer messages. Timers still need love though
+
+2004-09-07 14:01 jackson
+
+ * XplatUIX11.cs: Do not call XDestroyWindow, X has already done
+ this for us and the handle is no longer valid.
+
+2004-09-07 13:59 jackson
+
+ * HandleData.cs, XplatUIX11.cs: First steps towards a new X event
+ loop that manages to not crash. TODO: Add poll and cleanup timers
+
+2004-09-07 11:12 jordi
+
+ * GroupBox.cs, Theme.cs, ThemeWin32Classic.cs: GroupBox control
+
+2004-09-07 03:40 jordi
+
+ * Label.cs, LinkLabel.cs, Theme.cs, ThemeWin32Classic.cs: LinkLabel
+ fixes, methods, multiple links
+
+2004-09-06 06:55 jordi
+
+ * Control.cs: Caches ClientRectangle rectangle value
+
+2004-09-05 02:03 jordi
+
+ * ScrollBar.cs, ThemeWin32Classic.cs: fixes bugs, adds flashing on
+ certain situations
+
+2004-09-04 11:10 jordi
+
+ * Label.cs: Refresh when font changed
+
+2004-09-02 16:24 pbartok
+
+ * Control.cs:
+ - Added sanity check to creation of double buffer bitmap
+
+2004-09-02 16:24 pbartok
+
+ * ButtonBase.cs:
+ - Fixed selection of text color
+ - Fixed handling of resize event; now properly recreates double
+ buffering bitmap
+ - Added missing assignment of TextAlignment
+ - Added proper default for TextAlignment
+
+2004-09-02 14:26 pbartok
+
+ * RadioButton.cs:
+ - Added missing RadioButton.RadioButtonAccessibleObject class
+
+2004-09-02 14:26 pbartok
+
+ * Control.cs:
+ - Added missing Control.ControlAccessibleObject class
+ - Started to implement Select()ion mechanisms, still very incomplete
+
+2004-09-02 14:25 pbartok
+
+ * AccessibleObject.cs:
+ - Added missing methods
+
+2004-09-02 14:23 pbartok
+
+ * AccessibleNavigation.cs, AccessibleSelection.cs:
+ - Initial check-in
+
+2004-09-02 10:32 jordi
+
+ * Theme.cs, ThemeGtk.cs, ThemeWin32Classic.cs: implements resource
+ pool for pens, brushes, and hatchbruses
+
+2004-09-01 15:30 jackson
+
+ * StatusBar.cs: Fix typo
+
+2004-09-01 14:44 pbartok
+
+ * RadioButton.cs:
+ - Fixed state
+
+2004-09-01 14:39 pbartok
+
+ * Button.cs, RadioButton.cs:
+ - Functional initial check-in
+
+2004-09-01 14:01 pbartok
+
+ * CheckBox.cs:
+ - Added missing default
+ - Added missing region mark
+
+2004-09-01 09:10 jordi
+
+ * Label.cs: fixes method signatures, new methods, events, fixes
+ autosize
+
+2004-09-01 07:19 jordi
+
+ * Control.cs: Init string variables with an empty object
+
+2004-09-01 04:20 jordi
+
+ * Control.cs: fires OnFontChanged event
+
+2004-08-31 20:07 pbartok
+
+ * ButtonBase.cs:
+ - Enabled display of strings
+
+2004-08-31 20:05 pbartok
+
+ * Form.cs:
+ - Added (partial) implementation of DialogResult; rest needs to be
+ implemented when the modal loop code is done
+
+2004-08-31 19:55 pbartok
+
+ * CheckBox.cs:
+ - Fixed to match the removal of the needs_redraw concept
+
+2004-08-31 19:55 pbartok
+
+ * ButtonBase.cs:
+ - Removed the rather odd split between 'needs redraw' and redrawing
+ - Now handles the events that require regeneration (ambient
+ properties and size)
+
+2004-08-31 19:41 pbartok
+
+ * Control.cs:
+ - Added firing of BackColorChanged event
+ - Added TopLevelControl property
+ - Fixed handling of WM_ERASEBKGRND message
+
+2004-08-31 12:49 pbartok
+
+ * ButtonBase.cs:
+ - Removed debug
+ - Minor fixes
+
+2004-08-31 12:48 pbartok
+
+ * CheckBox.cs:
+ - Finished (famous last words)
+
+2004-08-31 04:35 jordi
+
+ * ScrollBar.cs: adds autorepeat timer, uses a single timer, fixes
+ scrolling bugs, adds new methods
+
+2004-08-30 14:42 pbartok
+
+ * CheckBox.cs:
+ - Implemented CheckBox drawing code
+
+2004-08-30 14:42 pbartok
+
+ * ButtonBase.cs:
+ - Made Redraw() and CheckRedraw() virtual
+ - Improved mouse up/down/move logic to properly track buttons
+
+2004-08-30 09:44 pbartok
+
+ * CheckBox.cs:
+ - Updated to fix broken build. Not complete yet.
+
+2004-08-30 09:28 pbartok
+
+ * CheckState.cs:
+ - Initial checkin
+
+2004-08-30 09:17 pbartok
+
+ * Appearance.cs:
+ - Initial check-in
+
+2004-08-27 16:12 ravindra
+
+ * ToolBarButton.cs: Added TypeConverter attribute.
+
+2004-08-27 16:07 ravindra
+
+ * ImageIndexConverter.cs: Implemented.
+
+2004-08-27 14:17 pbartok
+
+ * Control.cs:
+ - Removed unneeded stack vars
+ - First attempt to fix sizing issues when layout is suspended
+
+2004-08-25 15:35 jordi
+
+ * ScrollBar.cs: more fixes to scrollbar
+
+2004-08-25 14:04 ravindra
+
+ * Theme.cs, ThemeWin32Classic.cs, ToolBar.cs, ToolBarButton.cs:
+ Added the missing divider code and grip for ToolBar Control.
+
+2004-08-25 13:20 pbartok
+
+ * Control.cs:
+ - Control now properly passes the ambient background color to child
+ controls
+
+2004-08-25 13:20 jordi
+
+ * ScrollBar.cs: small bug fix regarding bar position
+
+2004-08-25 12:33 pbartok
+
+ * Timer.cs:
+ - Now only calls SetTimer or KillTimer if the enabled state has
+ changed
+
+2004-08-25 12:33 pbartok
+
+ * XplatUIWin32.cs:
+ - Fixed timer handling, now seems to work
+ - Improved error message for window creation
+
+2004-08-25 12:32 pbartok
+
+ * Control.cs:
+ - Fixed generation of MouseUp message
+
+2004-08-25 12:29 jordi
+
+ * ProgressBar.cs, ThemeWin32Classic.cs: new methods, properties,
+ and fixes for progressbar
+
+2004-08-24 18:43 ravindra
+
+ * ThemeWin32Classic.cs, ToolBar.cs: Fixed wrapping related issues
+ in ToolBar control.
+
+2004-08-24 17:15 pbartok
+
+ * Panel.cs:
+ - Added #region
+ - Added missing events
+ - Alphabetized
+
+2004-08-24 17:14 pbartok
+
+ * StatusBar.cs, PictureBox.cs:
+ - Now uses Control's CreateParams
+
+2004-08-24 16:36 pbartok
+
+ * XplatUIX11.cs:
+ - Fixed background color handling
+ - Fixed sending of enter/leave events on a grab
+
+2004-08-24 16:35 pbartok
+
+ * X11Structs.cs:
+ - Refined definitions for CrossingEvent
+
+2004-08-24 12:37 jordi
+
+ * ScrollBar.cs, Theme.cs, ThemeGtk.cs, ThemeWin32Classic.cs: fixes
+ formmating, methods signature, and adds missing events
+
+2004-08-24 12:24 jordi
+
+ * Control.cs: fire OnEnabledChanged event
+
+2004-08-24 11:17 pbartok
+
+ * XplatUIWin32.cs:
+ - Implemented SetTimer() and KillTimer()
+
+2004-08-24 11:16 pbartok
+
+ * XplatUIX11.cs:
+ - Now uses Remove instead of Add to kill the timer
+
+2004-08-24 10:16 jackson
+
+ * PictureBox.cs, Theme.cs, ThemeWin32Classic.cs: Handle drawing
+ picture boxes in the theme now. Draw picture box borders and obey
+ sizing modes
+
+2004-08-24 05:49 jackson
+
+ * Timer.cs: Remove top secret debugging code
+
+2004-08-24 05:34 jackson
+
+ * PictureBox.cs: Temp hack to make picture boxes draw their full
+ image
+
+2004-08-24 05:29 jackson
+
+ * Timer.cs, XplatUI.cs, XplatUIDriver.cs, XplatUIWin32.cs,
+ XplatUIX11.cs: Move timers to the driver level. On X they are
+ queued by the driver and checked on idle.
+
+2004-08-24 01:07 jackson
+
+ * XplatUIX11.cs: Use a queue for async messages instead of passing
+ them as ClientMessages since that was totally broken. Also simply
+ check for events and return an idle message if none are found. This
+ gives us an idle handler, and prevents deadlocking when no messages
+ are in the queue.
+
+2004-08-23 18:19 ravindra
+
+ * XplatUIWin32.cs: Removed the unwanted destructor.
+
+2004-08-23 17:27 pbartok
+
+ * ButtonBase.cs:
+ - Finishing touches. Works now, just needs some optimizations.
+
+2004-08-23 16:53 jordi
+
+ * ScrollBar.cs: small fix
+
+2004-08-23 16:45 pbartok
+
+ * Application.cs:
+ - Removed debug output
+ - Simplifications
+
+2004-08-23 16:43 jordi
+
+ * ScrollBar.cs: [no log message]
+
+2004-08-23 16:10 pbartok
+
+ * Form.cs:
+ - Fixed handling of WM_CLOSE message
+ - Removed debug output
+
+2004-08-23 16:09 pbartok
+
+ * Application.cs:
+ - Added handling of Idle event
+ - Added handling of form closing
+ - Fixed reporting of MessageLoop property
+ - Removed some unneeded code, should provide a bit of a speedup
+
+2004-08-23 15:22 pbartok
+
+ * Control.cs:
+ - Added InitLayout() method
+ - Added code to properly perform layout when Anchor or Dock property
+ is changed
+ - Changed 'interpretation' of ResumeLayout. MS seems to have a
+ LAMESPEC, tried to do it in a way that makes sense
+
+2004-08-23 14:10 jordi
+
+ * HScrollBar.cs, ScrollBar.cs, TrackBar.cs, VScrollBar.cs: fixes
+ properties and methods
+
+2004-08-23 13:55 pbartok
+
+ * Control.cs:
+ - Properly fixed Jordi's last fix
+ - Now uses Cursor's Position property instead of calling XplatUI
+ directly
+
+2004-08-23 13:44 jordi
+
+ * PaintEventHandler.cs: Adding missing attribute
+
+2004-08-23 13:39 pbartok
+
+ * Cursor.cs:
+ - Implemented Position property
+
+2004-08-23 13:39 pbartok
+
+ * XplatUI.cs, XplatUIDriver.cs, XplatUIWin32.cs:
+ - Added method to move mouse cursor
+
+2004-08-23 13:39 pbartok
+
+ * XplatUIX11.cs:
+ - Fixed setting of background color
+ - Added method to move mouse cursor
+
+2004-08-23 13:16 jordi
+
+ * Control.cs: avoids null exception
+
+2004-08-22 17:46 jackson
+
+ * PictureBox.cs, PictureBoxSizeMode.cs: Initial implementation of
+ PictureBox
+
+2004-08-22 17:40 jackson
+
+ * XplatUIX11.cs: Add some missing locks
+
+2004-08-22 15:10 pbartok
+
+ * Control.cs, Form.cs:
+ - Removed OverlappedWindow style from Control, instead it's default
+ now is child
+ - Made form windows OverlappedWindow by default
+
+2004-08-22 13:34 jackson
+
+ * ScrollBar.cs: Update the position through the Value property so
+ the OnValueChanged event is raised.
+
+2004-08-22 12:04 pbartok
+
+ * SWF.csproj:
+ - Added Cursor.cs and UserControl.cs
+
+2004-08-22 12:03 pbartok
+
+ * Cursor.cs:
+ - Started implementation, not usable yet
+
+2004-08-22 12:00 pbartok
+
+ * UserControl.cs:
+ - Implemented UserControl (complete)
+
+2004-08-21 19:20 ravindra
+
+ * ToolBar.cs: Correcting the formatting mess of VS.NET.
+
+2004-08-21 18:49 ravindra
+
+ * ToolBar.cs: Probably this completes the missing attributes in
+ toolbar control.
+
+2004-08-21 18:03 ravindra
+
+ * ToolBar.cs, ToolBarButton.cs, ToolBarButtonClickEventArgs.cs:
+ Fixed toolbar control signatures.
+
+2004-08-21 16:32 pbartok
+
+ * LinkLabel.cs:
+ - Signature Fixes
+
+2004-08-21 16:30 pbartok
+
+ * Label.cs:
+ - Signature fixes
+
+2004-08-21 16:19 pbartok
+
+ * Control.cs, Label.cs:
+ - Signature fixes
+
+2004-08-21 15:57 pbartok
+
+ * ButtonBase.cs:
+ - Added loads of debug output for development
+ - Fixed typo in method name
+
+2004-08-21 15:52 pbartok
+
+ * ToolBarButtonClickEventArgs.cs:
+ - Added missing base class
+
+2004-08-21 14:53 pbartok
+
+ * Control.cs:
+ - Updated to match new GrabWindow signature
+
+2004-08-21 14:51 pbartok
+
+ * XplatUI.cs, XplatUIDriver.cs, XplatUIWin32.cs, XplatUIX11.cs:
+ - Added method to get default display size
+
+2004-08-21 14:23 pbartok
+
+ * XplatUI.cs, XplatUIDriver.cs, XplatUIWin32.cs, XplatUIX11.cs:
+ - Added method to query current grab state
+ - Added argument to allow confining a grab to a window
+
+2004-08-21 14:22 pbartok
+
+ * Keys.cs:
+ - Added [Flags] attribute so that modifiers can be used in bitwise
+ ops
+
+2004-08-21 14:21 pbartok
+
+ * TrackBar.cs, ScrollBar.cs:
+ - Replaced direct XplatUI calls with their Control counterpart
+
+2004-08-21 13:32 pbartok
+
+ * Control.cs:
+ - Implemented Created property
+
+2004-08-21 13:28 pbartok
+
+ * Control.cs:
+ - Implemented ContainsFocus
+
+2004-08-21 13:26 pbartok
+
+ * Control.cs:
+ - Implemented CausesValidation
+
+2004-08-21 13:21 pbartok
+
+ * Control.cs:
+ - Implemented CanFocus
+ - Implemented CanSelect
+ - Implemented Capture
+
+2004-08-21 12:35 pbartok
+
+ * XplatUIWin32.cs:
+ - Fixed bug with Async message handling
+ - Implemented getting the ModifierKeys
+
+2004-08-21 12:32 jackson
+
+ * AsyncMethodResult.cs: Make sure we have the mutex before we
+ release it. Fixes BeginInvoke on windows
+
+2004-08-21 11:31 pbartok
+
+ * XplatUIWin32.cs, XplatUIX11.cs:
+ - Drivers now return proper mouse state
+
+2004-08-21 10:54 jackson
+
+ * Control.cs: Implement EndInvoke
+
+2004-08-21 10:48 jackson
+
+ * Timer.cs: Remove unneeded finalizer
+
+2004-08-20 19:52 ravindra
+
+ * ThemeWin32Classic.cs, ToolBar.cs, ToolBarButton.cs: Improvments
+ in mouse event handling in the ToolBar control.
+
+2004-08-20 19:50 ravindra
+
+ * ImageList.cs: Changed draw method to use the arguments passed in
+ to draw the image.
+
+2004-08-20 18:58 pbartok
+
+ * XplatUIStructs.cs:
+ - Added private message for async communication
+
+2004-08-20 17:38 ravindra
+
+ * Control.cs: Made RightToLeft property virtual and removed a
+ Console.WriteLine.
+
+2004-08-20 14:39 jordi
+
+ * ThemeGtk.cs: use style_attach
+
+2004-08-20 14:39 pbartok
+
+ * XplatUIWin32.cs:
+ - Added jackson's Async code from X11 to Win32
+
+2004-08-20 14:09 pbartok
+
+ * SWF.csproj:
+ - Added all new files
+
+2004-08-20 14:09 pbartok
+
+ * Control.cs:
+ - Added call to set window background color
+
+2004-08-20 14:03 pbartok
+
+ * XplatUI.cs, XplatUIDriver.cs, XplatUIX11.cs:
+ - Added method for setting the window background
+
+2004-08-20 14:02 pbartok
+
+ * XplatUIWin32.cs:
+ - Added method for setting the background color
+ - Added handling for erasing the window background
+
+2004-08-20 13:45 jordi
+
+ * TrackBar.cs: fixes timer, new properties and methods
+
+2004-08-20 13:34 jackson
+
+ * ScrollBar.cs: Use the SWF timer so callbacks are run in the
+ correct thread
+
+2004-08-20 13:22 jackson
+
+ * Timer.cs: Timer Tick events are now handed through Controls Async
+ mechanism so the callbacks are executed in the same thread as X
+
+2004-08-20 13:19 jackson
+
+ * XplatUIDriver.cs: Expose functionality to send async messages
+ through the driver
+
+2004-08-20 13:18 jackson
+
+ * Control.cs: Implement Begininvoke
+
+2004-08-20 13:14 jackson
+
+ * XplatUI.cs, XplatUIWin32.cs: Expose functionality to send async
+ messages through the driver
+
+2004-08-20 13:12 jackson
+
+ * XplatUIX11.cs: Lock before all X operations. Also added Async
+ method functionality through XSendEvent
+
+2004-08-20 13:11 jackson
+
+ * X11Structs.cs: Use IntPtrs for ClientMessage extra data (TODO:
+ This will screw up on 64 bit systems)
+
+2004-08-20 13:10 jackson
+
+ * AsyncMethodData.cs, AsyncMethodResult.cs: Classes for sending
+ Async messages through X/Win32
+
+2004-08-19 19:39 pbartok
+
+ * XplatUIX11.cs:
+ - Updated code to match new HandleData.DeviceContext type
+
+2004-08-19 19:38 pbartok
+
+ * HandleData.cs:
+ - Made DeviceContext a generic object to allow usage from various
+ drivers
+ - Added support for queueing Windows messages
+
+2004-08-19 19:37 pbartok
+
+ * XplatUIWin32.cs:
+ - Added generation of MouseEnter, MouseLeave and MouseHover events
+ - Added cleanup on EndPaint
+
+2004-08-19 19:17 pbartok
+
+ * Control.cs:
+ - Added handling of WM_MOUSEHOVER
+ - Worked around 'bug' in Win32 WM_MOUSE_ENTER/WM_MOUSE_LEAVE driver
+ code
+
+2004-08-19 18:55 jordi
+
+ * ThemeGtk.cs: fixes button order
+
+2004-08-19 18:12 jordi
+
+ * Theme.cs, ThemeWin32Classic.cs: fixes methods signature
+
+2004-08-19 17:09 pbartok
+
+ * Control.cs:
+ - Added Right property
+ - Added RightToLeft property
+
+2004-08-19 16:27 jordi
+
+ * ThemeGtk.cs: experimental GTK theme support
+
+2004-08-19 16:26 jordi
+
+ * ITheme.cs, Theme.cs: move themes from an interface to a class
+
+2004-08-19 16:25 jordi
+
+ * Control.cs, ScrollBar.cs, ThemeEngine.cs, ThemeWin32Classic.cs:
+ theme enhancaments
+
+2004-08-19 16:04 pbartok
+
+ * XplatUIX11.cs:
+ - Added colormap basics
+ - Added a way to re-initialize with a different display handle
+ - Fixed setting of the window background color
+ - Added various X11 imports related to colors and colormaps
+
+2004-08-19 15:51 pbartok
+
+ * X11Structs.cs:
+ - Removed packing hints (Paolo suggested this a while back)
+ - fixed colormap type
+ - Added default Atom types
+ - Added Screen and color structs and enums
+
+2004-08-19 15:39 pbartok
+
+ * ImageList.cs:
+ - Added missing Draw() method
+ - Added missing RecreateHandle event
+
+2004-08-19 15:30 pbartok
+
+ * Form.cs:
+ - Added handling of WM_CLOSE
+
+2004-08-18 13:16 jordi
+
+ * ITheme.cs, ThemeWin32Classic.cs, XplatUIWin32.cs: Move colors to
+ a table
+
+2004-08-18 09:56 jordi
+
+ * ScrollBar.cs: fixes to scrollbar: steps and multiple timers
+
+2004-08-17 15:31 ravindra
+
+ * SWF.csproj: Updated project.
+
+2004-08-17 15:25 pbartok
+
+ * Control.cs:
+ - Drawing improvement; don't call UpdateBounds if we are not visible
+ (or have been minimized)
+
+2004-08-17 15:24 pbartok
+
+ * XplatUIWin32.cs:
+ - Finished IsVisible
+ - Added Win32GetWindowPlacement
+
+2004-08-17 15:08 jackson
+
+ * Panel.cs: Initial checkin of the Panel
+
+2004-08-17 14:25 pbartok
+
+ * Control.cs:
+ - Fixed broken handling of default window sizes
+
+2004-08-17 13:29 jackson
+
+ * ThemeWin32Classic.cs: Don't use KnownColor to create colours. It
+ has a large startup time.
+
+2004-08-17 10:25 jackson
+
+ * HandleData.cs: union areas properly
+
+2004-08-17 10:12 jackson
+
+ * HandleData.cs: union areas properly
+
+2004-08-16 20:00 ravindra
+
+ * ToolBar.cs, ToolBarButton.cs: Added attributes.
+
+2004-08-16 18:48 ravindra
+
+ * ToolBar.cs: Added attributes.
+
+2004-08-16 17:17 ravindra
+
+ * SWF.csproj: Updated project.
+
+2004-08-16 17:16 jackson
+
+ * XplatUIX11.cs: Check for more expose events before sending a
+ WM_PAINT so they can all be grouped together. This makes dragging a
+ window across another window redraw in a sane way.
+
+2004-08-16 15:47 pbartok
+
+ * Control.cs:
+ - Added handling of WM_MOUSE_ENTER & WM_MOUSE_LEAVE to
+ support OnMouseEnter/Leave()
+ - Added WS_CLIPSIBLINGS and WS_CLIPCHILDREN window styles to improve
+ exposure handling
+
+2004-08-16 15:46 pbartok
+
+ * XplatUIStructs.cs, XplatUIX11.cs:
+ - Added WM_MOUSE_ENTER & WM_MOUSE_LEAVE to support
+ OnMouseEnter/Leave()
+
+2004-08-16 15:34 jackson
+
+ * XplatUIX11.cs: Group multiple expose events in HandleData, make
+ sure messages get the message field set to WM_NULL if they are not
+ handled.
+
+2004-08-16 15:24 jackson
+
+ * HandleData.cs: HandleData is used for storing message information
+ for window handles
+
+2004-08-15 17:23 ravindra
+
+ * ColorDepth.cs: Added attribute.
+
+2004-08-15 17:23 ravindra
+
+ * SWF.csproj: Updated project for ToolBar Control.
+
+2004-08-15 17:20 ravindra
+
+ * ITheme.cs, ThemeWin32Classic.cs: Changes to Theme for ToolBar
+ control and also dos2unix format.
+
+2004-08-15 17:13 ravindra
+
+ * ToolBar.cs, ToolBarAppearance.cs, ToolBarButton.cs,
+ ToolBarButtonClickEventArgs.cs,
+ ToolBarButtonClickEventHandler.cs, ToolBarButtonStyle.cs,
+ ToolBarTextAlign.cs: First Implementation of ToolBar control.
+
+2004-08-15 15:31 pbartok
+
+ * ButtonBase.cs:
+ - First (mostly) working version
+
+2004-08-13 16:15 pbartok
+
+ * Control.cs:
+ - Fixed Anchor default
+
+2004-08-13 15:43 pbartok
+
+ * Control.cs:
+ - Changed GetCursorPos signature
+
+2004-08-13 15:42 pbartok
+
+ * XplatUI.cs, XplatUIDriver.cs, XplatUIWin32.cs:
+ - Changed signature for GetCursorPos
+
+2004-08-13 15:25 pbartok
+
+ * XplatUIX11.cs:
+ - Cleanup
+ - Fixed resizing/exposure handling
+
+2004-08-13 15:22 jordi
+
+ * ThemeWin32Classic.cs: removes redundant code and fixes issues
+ with tickposition
+
+2004-08-13 14:55 jordi
+
+ * TrackBar.cs: change from wndproc to events
+
+2004-08-13 13:00 jordi
+
+ * Control.cs, XplatUI.cs, XplatUIDriver.cs, XplatUIWin32.cs,
+ XplatUIX11.cs: implements PointToClient (ScreenToClient)
+
+2004-08-13 12:53 pbartok
+
+ * XplatUIWin32.cs:
+ - Changed GetWindowPos to also provide client area size
+ - Fixed broken prototypes for several win32 functions
+
+2004-08-13 12:53 pbartok
+
+ * XplatUI.cs, XplatUIDriver.cs:
+ - Changed GetWindowPos to also provide client area size
+
+2004-08-13 12:52 pbartok
+
+ * XplatUIX11.cs:
+ - Added generation of WM_POSCHANGED
+ - Changed GetWindowPos to also provide client area size
+
+2004-08-13 12:52 pbartok
+
+ * Control.cs:
+ - Added Dispose() and destructor
+ - Fixed resizing and bounds calculation
+ - Fixed Layout
+ - Added memory savings for invisible windows
+
+2004-08-13 12:46 jordi
+
+ * TrackBar.cs: adds timer and grap window
+
+2004-08-13 10:25 jackson
+
+ * Timer.cs: SWF Timer
+
+2004-08-12 16:59 pbartok
+
+ * XplatUI.cs, XplatUIDriver.cs, XplatUIWin32.cs, XplatUIX11.cs:
+ - Implemented method to get current mouse position
+
+2004-08-12 14:29 jordi
+
+ * ITheme.cs, ThemeWin32Classic.cs, TrackBar.cs: Trackbar
+ enhancement, fix mouse problems, highli thumb, etc
+
+2004-08-12 13:31 pbartok
+
+ * Control.cs:
+ - Fixed Anchoring bugs
+
+2004-08-12 13:01 jackson
+
+ * StatusBar.cs: Don't forget things
+
+2004-08-12 12:54 jackson
+
+ * ThemeWin32Classic.cs: Handle owner draw status bars
+
+2004-08-12 12:54 jackson
+
+ * StatusBar.cs: Implement missing properties, events, and methods.
+ Handle mouse clicking
+
+2004-08-12 10:19 jackson
+
+ * StatusBarPanelClickEventArgs.cs,
+ StatusBarPanelClickEventHandler.cs: Classes for handling status
+ bar panel click events
+
+2004-08-12 10:10 jackson
+
+ * Control.cs: Add missing properties
+
+2004-08-12 09:46 pbartok
+
+ * BindingsManagerBase.cs:
+ - Name changed to BindingManagerBase.cs
+
+2004-08-12 09:25 jordi
+
+ * ScrollableControl.cs: calls ctrlbase instead of exeception
+
+2004-08-11 16:28 pbartok
+
+ * InputLanguageChangingEventArgs.cs:
+ - Never check in before compiling. Fixes the last check-in
+
+2004-08-11 16:26 pbartok
+
+ * InputLanguageChangingEventArgs.cs:
+ - More signature fixes
+
+2004-08-11 16:20 pbartok
+
+ * BindingManagerBase.cs, BindingMemberInfo.cs, ContainerControl.cs,
+ Control.cs, ControlEventArgs.cs, ControlPaint.cs, Form.cs,
+ ImageListStreamer.cs, InputLanguage.cs,
+ InputLanguageChangedEventArgs.cs,
+ InputLanguageChangingEventArgs.cs, Keys.cs, LayoutEventArgs.cs,
+ LinkArea.cs, Message.cs, MouseEventArgs.cs, NativeWindow.cs,
+ ScrollEventArgs.cs, ScrollableControl.cs, XplatUI.cs,
+ XplatUIDriver.cs, XplatUIWin32.cs, XplatUIX11.cs:
+ - Signature fixes
+
+2004-08-11 16:16 pbartok
+
+ * Application.cs:
+ - Fixed Signature
+ - Added .Net 1.1 method
+
+2004-08-11 15:25 pbartok
+
+ * SWF.csproj:
+ - Fixed BindingManagerBase.cs filename
+
+2004-08-11 15:22 pbartok
+
+ * BindingManagerBase.cs:
+ - Was checked in with wrong filename
+
+2004-08-11 14:50 pbartok
+
+ * SWF.csproj:
+ - Updated
+
+2004-08-11 13:41 jordi
+
+ * XplatUIWin32.cs: Fixes ClientRect
+
+2004-08-11 13:19 pbartok
+
+ * Control.cs, XplatUI.cs, XplatUIDriver.cs, XplatUIWin32.cs,
+ XplatUIX11.cs:
+ - We had SetWindowPos and MoveWindow to set window positions and
+ size, removed MoveWindow. We have GetWindowPos, so it made sense to
+ keep SetWindowPos as matching counterpart
+ - Added some X11 sanity checking
+
+2004-08-11 12:59 pbartok
+
+ * Control.cs:
+ - Major cleanup of my SetBounds/SetBoundsCore/UpdateBounds mess
+ (It seems that SetBounds is just a front for SetBoundsCore and
+ SetBoundsCore updates the underlying window system and
+ UpdateBounds is responsible for updating the variables associated
+ with the Control and sending the events)
+ - Major cleanup of Size handling; we now have two sizes, client_size
+ and bounds. Bounds defines the window with decorations, client_size
+ without them.
+
+2004-08-11 12:55 pbartok
+
+ * XplatUI.cs, XplatUIDriver.cs, XplatUIWin32.cs, XplatUIX11.cs:
+ - Added method to calculate difference between decorated window and
+ raw client area
+
+2004-08-11 12:54 pbartok
+
+ * Label.cs:
+ - Forcing redraw on resize
+
+2004-08-11 11:43 pbartok
+
+ * ImageList.cs:
+ - Removed disposing of the actual images when the list is disposed
+
+2004-08-11 09:13 pbartok
+
+ * Control.cs:
+ - Now properly reparents windows
+
+2004-08-11 08:37 pbartok
+
+ * Control.cs:
+ - Duh!
+
+2004-08-11 07:47 pbartok
+
+ * Control.cs:
+ - Rewrote the collection stuff. Might not be as fast now, not
+ keeping the number of children around and accessible directly, but
+ it's more straightforward
+
+2004-08-11 07:44 pbartok
+
+ * AccessibleObject.cs:
+ - Fixed to match ControlCollection rewrite
+
+2004-08-11 07:43 pbartok
+
+ * ImageList.cs:
+ - Added missing creation of the collection list
+
+2004-08-10 20:08 jackson
+
+ * StatusBar.cs: Get the paint message from WndProc
+
+2004-08-10 19:31 jackson
+
+ * ThemeWin32Classic.cs: Create Brushes as little as possible
+
+2004-08-10 19:20 jackson
+
+ * UICues.cs: Add Flags attribute
+
+2004-08-10 19:19 jackson
+
+ * StatusBarPanel.cs: Signature cleanup
+
+2004-08-10 19:10 jackson
+
+ * StatusBarDrawItemEventArgs.cs, StatusBarDrawItemEventHandler.cs:
+ Initial implementation of status bar item drawing
+
+2004-08-10 17:27 jordi
+
+ * TrackBar.cs: add missing methods, properties, and restructure to
+ hide extra ones
+
+2004-08-10 16:24 jackson
+
+ * AccessibleStates.cs, Border3DSide.cs, Border3DStyle.cs,
+ ButtonState.cs, ControlStyles.cs, DragDropEffects.cs: Add flags
+ attribute
+
+2004-08-10 13:21 jordi
+
+ * ITheme.cs, ScrollBar.cs, ThemeWin32Classic.cs: scrollbar
+ enhancements and standarize on win colors defaults
+
+2004-08-10 12:52 jackson
+
+ * DrawItemEventArgs.cs, DrawItemState.cs, ITheme.cs,
+ ThemeWin32Classic.cs: Implement DrawItem functionality
+
+2004-08-10 12:47 jordi
+
+ * XplatUIWin32.cs: Calls InvalidateRect before UpdateWindow
+
+2004-08-10 12:32 jordi
+
+ * Control.cs: throw ontextchange event
+
+2004-08-10 11:43 pbartok
+
+ * Control.cs:
+ - Added more to the still unfinished Dock/Anchor layout code
+
+2004-08-10 11:39 pbartok
+
+ * XplatUI.cs, XplatUIDriver.cs, XplatUIX11.cs:
+ - Added GetWindowPos method
+
+2004-08-10 11:36 pbartok
+
+ * XplatUIWin32.cs:
+ - Implemented several methods
+
+2004-08-10 09:47 jackson
+
+ * TrackBar.cs: Allow control to handle buffering
+
+2004-08-10 09:41 jackson
+
+ * ProgressBar.cs, ScrollBar.cs: Allow control to handle buffering
+
+2004-08-10 09:24 jackson
+
+ * Label.cs, LinkLabel.cs: Let Control handle buffering.
+
+2004-08-10 09:09 jackson
+
+ * StatusBar.cs: Let Control handle all the buffering.
+
+2004-08-10 09:08 jackson
+
+ * Control.cs: Control will now handle the buffering code, so each
+ control does not have to implement this.
+
+2004-08-10 08:34 jackson
+
+ * XplatUIDriver.cs: Use default colors from the theme
+
+2004-08-09 17:12 pbartok
+
+ * ImageList.cs:
+ - Fixed several bugs Ravindra pointed out
+
+2004-08-09 16:11 pbartok
+
+ * Control.cs:
+ - Added incomplete dock layout code
+ - Added support for mouse wheel
+
+2004-08-09 16:09 pbartok
+
+ * XplatUIX11.cs:
+ - Added handling for middle and right mousebutton
+ - Added handling for mouse wheel
+ - Added handling for key state and mouse state and position
+ - Now properly generates WM_xBUTTONx messages and WM_MOUSEWHEEL
+ messages
+
+2004-08-09 15:40 jackson
+
+ * StatusBarPanel.cs, StatusBarPanelAutoSize.cs,
+ StatusBarPanelBorderStyle.cs, StatusBarPanelStyle.cs: Initial
+ checkin
+
+2004-08-09 15:37 jackson
+
+ * StatusBar.cs: Initial implementation of StatusBar
+
+2004-08-09 15:36 jackson
+
+ * ITheme.cs: Add support for drawing status bar and getting status
+ bar item sizes
+
+2004-08-09 15:35 pbartok
+
+ * MouseButtons.cs:
+ - Fixed values
+
+2004-08-09 15:34 jackson
+
+ * ThemeWin32Classic.cs: Add support for drawing status bar and get
+ status bar item sizes
+
+2004-08-09 15:21 jackson
+
+ * ThemeWin32Classic.cs: Use known colors for default control
+ colours
+
+2004-08-09 15:12 jackson
+
+ * ThemeWin32Classic.cs: Make the default font static, it is static
+ in control so this doesn't change functionality and creating fonts
+ is sloooooow.
+
+2004-08-09 14:56 pbartok
+
+ * X11Structs.cs:
+ - Added GrabMode enum
+
+2004-08-09 14:55 pbartok
+
+ * XplatUI.cs, XplatUIDriver.cs, XplatUIWin32.cs, XplatUIX11.cs:
+ - Removed Run method, was only required for initial development
+
+2004-08-09 14:51 pbartok
+
+ * XplatUI.cs, XplatUIDriver.cs, XplatUIWin32.cs, XplatUIX11.cs:
+ - Implemented GrabWindow/ReleaseWindow methods to allow pointer
+ capture
+
+2004-08-09 13:48 pbartok
+
+ * XplatUIX11.cs:
+ - Fixed default sizing for child windows
+
+2004-08-09 12:56 pbartok
+
+ * XplatUIX11.cs:
+ - Added generation of WM_DESTROY message
+ - Added handling of window manager induced shutdown
+
+2004-08-09 11:31 jackson
+
+ * ThemeWin32Classic.cs: New names for control properties
+
+2004-08-09 11:25 jackson
+
+ * Control.cs: Use new color names
+
+2004-08-09 11:02 jackson
+
+ * XplatUI.cs: Get default window properties from the theme
+
+2004-08-09 11:01 jackson
+
+ * ITheme.cs: The theme engine now controls default window
+ properties
+
+2004-08-09 11:00 jackson
+
+ * ThemeWin32Classic.cs: Add default window color properties
+
+2004-08-09 10:17 jackson
+
+ * ThemeWin32Classic.cs: Use correct default back color
+
+2004-08-09 10:05 jackson
+
+ * XplatUIWin32.cs, XplatUIX11.cs: These properties are handled by
+ the theme now.
+
+2004-08-09 09:56 jackson
+
+ * XplatUI.cs: Remove defaults, these are handled by the theme now.
+
+2004-08-09 09:54 jackson
+
+ * Control.cs: Get default properties from the theme.
+
+2004-08-09 09:53 jackson
+
+ * ITheme.cs: Themes now handle default control properties
+
+2004-08-09 09:53 jackson
+
+ * ThemeWin32Classic.cs: Themes now handle default control
+ properties so coloring will be consistent
+
+2004-08-08 16:54 jordi
+
+ * ITheme.cs, ThemeWin32Classic.cs: Label BorderStyles
+
+2004-08-08 15:08 jordi
+
+ * XplatUIX11.cs: fixes keyboard crash
+
+2004-08-08 13:47 jordi
+
+ * Label.cs: add cvs header info
+
+2004-08-08 12:09 jackson
+
+ * ThemeWin32Classic.cs: Add pen_buttonface
+
+2004-08-08 11:52 jordi
+
+ * Label.cs, LinkLabel.cs: [no log message]
+
+2004-08-08 11:34 jordi
+
+ * ThemeWin32Classic.cs: Use Windows Standard Colours
+
+2004-08-07 17:32 jordi
+
+ * TrackBar.cs: throw exceptions of invalid enums values
+
+2004-08-07 17:31 jordi
+
+ * Label.cs, LinkLabel.cs, ThemeWin32Classic.cs: fixes label bug and
+ draw method name
+
+2004-08-07 16:56 jackson
+
+ * HorizontalAlignment.cs: Initial checkin
+
+2004-08-07 13:16 jordi
+
+ * Label.cs, LinkLabel.cs: throw exceptions, fixes events, missing
+ methods
+
+2004-08-07 13:05 jordi
+
+ * ITheme.cs, ThemeWin32Classic.cs: Theme colour support and
+ GetSysColor defines
+
+2004-08-06 18:01 pbartok
+
+ * ThemeWin32Classic.cs:
+ - Fixed some rounding issues with float/int
+
+2004-08-06 18:00 jackson
+
+ * DockStyle.cs, AnchorStyles.cs:
+
+ Add flags and serializable attributes.
+
+2004-08-06 17:46 pbartok
+
+ * XplatUIX11.cs:
+ - Implemented GetParent
+
+2004-08-06 17:18 pbartok
+
+ * TrackBar.cs:
+ - Fixed some rounding issues with float/int
+
+2004-08-06 17:17 pbartok
+
+ * X11Structs.cs, XplatUIX11.cs:
+ - Fixed Refresh and Invalidate
+
+2004-08-06 15:30 pbartok
+
+ * Control.cs, X11Structs.cs, XplatUIX11.cs:
+ - Fixed recursive loop when resizing
+ - Improved/fixed redrawing on expose messages
+
+2004-08-06 09:53 jordi
+
+ * Control.cs, X11Structs.cs, XplatUIWin32.cs, XplatUIX11.cs: X11
+ keyboard navigation
+
+2004-08-06 08:02 pbartok
+
+ * X11Structs.cs, XplatUIX11.cs:
+ - Fixed reparenting
+ - Fixed window border creation
+
+2004-08-05 15:38 pbartok
+
+ * XplatUIX11.cs:
+ - Attempted fix for reparenting problems
+
+2004-08-04 15:14 pbartok
+
+ * Control.cs:
+ - Fixed Invalidation bug (calculated wrong client area)
+ - Added ClientSize setter
+
+2004-08-04 15:13 pbartok
+
+ * Form.cs:
+ - Added AutoScale properties
+
+2004-08-04 15:13 pbartok
+
+ * SWF.csproj:
+ - Added latest files
+
+2004-08-04 14:11 pbartok
+
+ * Control.cs, XplatUI.cs, XplatUIDriver.cs, XplatUIWin32.cs,
+ XplatUIX11.cs:
+ - Added Invalidate handling
+
+2004-08-03 17:09 jordi
+
+ * XplatUIDriver.cs: fixes spelling mistake
+
+2004-07-27 09:53 jordi
+
+ * TrackBar.cs: fixes trackbar events, def classname, methods
+ signature
+
+2004-07-27 09:29 jordi
+
+ * ScrollBar.cs: fixes scrollbar events
+
+2004-07-27 04:38 jordi
+
+ * Control.cs: changes to be able to run winforms samples
+
+2004-07-26 11:42 jordi
+
+ * ControlPaint.cs, ITheme.cs, ProgressBar.cs, ScrollBar.cs,
+ ThemeEngine.cs, ThemeWin32Classic.cs, TrackBar.cs: Theme support
+
+2004-07-26 05:41 jordi
+
+ * MessageBox.cs, MessageBoxButtons.cs, MessageBoxDefaultButton.cs,
+ MessageBoxIcon.cs, MessageBoxOptions.cs: initial messagebox
+ implementation
+
+2004-07-22 09:22 jordi
+
+ * LinkLabel.cs, LinkLabelLinkClickedEventHandler.cs: link label:
+ check link overlapping, implement events, and fixes
+
+2004-07-21 10:28 jordi
+
+ * DialogResult.cs, IButtonControl.cs: fixes comments filenames
+
+2004-07-21 10:19 jordi
+
+ * DialogResult.cs, IButtonControl.cs, Label.cs, LinkArea.cs,
+ LinkBehavior.cs, LinkClickedEventArgs.cs, LinkLabel.cs,
+ LinkLabelLinkClickedEventArgs.cs,
+ LinkLabelLinkClickedEventHandler.cs, LinkState.cs,
+ XplatUIWin32.cs, LinkClickedEventHandler.cs: LinkLabel control
+ implementation
+
+2004-07-19 13:09 jordi
+
+ * Control.cs, Label.cs: label control re-written: added missing
+ functionlity, events, and properties
+
+2004-07-19 10:49 jordi
+
+ * Control.cs: fixes SetBounds logic
+
+2004-07-19 01:29 jordi
+
+ * Control.cs: Call RefreshWindow only if the window has created
+
+2004-07-15 14:05 pbartok
+
+ * ColorDepth.cs, ImageList.cs, ImageListStreamer.cs, SWF.csproj:
+ - Implemented ImageList and ImageList.ImageCollection classes
+ - Added ColorDepth enumeration
+ - Updated SWF VS.Net project
+
+2004-07-15 11:06 jordi
+
+ * XplatUIStructs.cs: added MsgButons enum
+
+2004-07-15 11:03 jordi
+
+ * Control.cs: added basic mouse handeling events
+
+2004-07-15 03:38 jordi
+
+ * Orientation.cs, TickStyle.cs, TrackBar.cs: Horizontal and
+ Vertical TrackBar control implementation
+
+2004-07-13 09:33 jordi
+
+ * HScrollBar.cs, VScrollBar.cs: vertical and hort. classes commit
+
+2004-07-13 09:31 jordi
+
+ * Control.cs, Form.cs: commit: new properties and fixes form size
+ problems
+
+2004-07-09 14:13 miguel
+
+ * ProgressBar.cs: Spelling
+
+2004-07-09 11:25 pbartok
+
+ * ProgressBar.cs:
+ - Removed usage of Rectangle for drawing. Miguel pointed out it's
+ faster
+
+2004-07-09 11:17 miguel
+
+ * ProgressBar.cs: 2004-07-09 Miguel de Icaza <miguel@ximian.com>
+
+ * ProgressBar.cs: Fixed spelling for `block'
+
+ drawProgressBar: renamed to `DrawProgressBar' to follow the coding
+ style guidelines.
+
+ Avoid using the += on rect.X, that exposed a bug in the compiler.
+
+2004-07-08 23:21 pbartok
+
+ * AccessibleObject.cs, AccessibleRole.cs, AccessibleStates.cs,
+ AnchorStyles.cs, Application.cs, ApplicationContext.cs,
+ BaseCollection.cs, Binding.cs, BindingContext.cs,
+ BindingMemberInfo.cs, BindingsCollection.cs,
+ BindingsManagerBase.cs, Border3DSide.cs, Border3DStyle.cs,
+ BorderStyle.cs, BoundsSpecified.cs, ButtonBorderStyle.cs,
+ ButtonState.cs, CaptionButton.cs, CheckBox.cs,
+ ContainerControl.cs, Control.cs, ControlEventArgs.cs,
+ ControlEventHandler.cs, ControlPaint.cs, ControlStyles.cs,
+ ConvertEventArgs.cs, ConvertEventHandler.cs, Copyright,
+ CreateParams.cs, DockStyle.cs, DragAction.cs, DragDropEffects.cs,
+ DragEventArgs.cs, DragEventHandler.cs, FlatStyle.cs, Form.cs,
+ FrameStyle.cs, GiveFeedbackEventArgs.cs,
+ GiveFeedbackEventHandler.cs, HelpEventArgs.cs,
+ HelpEventHandler.cs, IContainerControl.cs, IDataObject.cs,
+ IMessageFilter.cs, IWin32Window.cs, ImeMode.cs, InputLanguage.cs,
+ InputLanguageChangedEventArgs.cs,
+ InputLanguageChangedEventHandler.cs,
+ InputLanguageChangingEventArgs.cs,
+ InputLanguageChangingEventHandler.cs, InputLanguageCollection.cs,
+ InvalidateEventArgs.cs, InvalidateEventHandler.cs,
+ KeyEventArgs.cs, KeyEventHandler.cs, KeyPressEventArgs.cs,
+ KeyPressEventHandler.cs, Keys.cs, Label.cs, LayoutEventArgs.cs,
+ LayoutEventHandler.cs, MenuGlyph.cs, Message.cs, MouseButtons.cs,
+ MouseEventArgs.cs, MouseEventHandler.cs, NativeWindow.cs,
+ PaintEventArgs.cs, PaintEventHandler.cs, ProgressBar.cs,
+ QueryAccessibilityHelpEventArgs.cs,
+ QueryAccessibilityHelpEventHandler.cs,
+ QueryContinueDragEventArgs.cs, QueryContinueDragEventHandler.cs,
+ RightToLeft.cs, SWF.csproj, SWF.csproj.user, ScrollBar.cs,
+ ScrollBars.cs, ScrollButton.cs, ScrollEventArgs.cs,
+ ScrollEventHandler.cs, ScrollEventType.cs, ScrollableControl.cs,
+ TODO, TODOAttribute.cs, UICues.cs, UICuesEventArgs.cs,
+ UICuesEventHandler.cs, X11Structs.cs, XplatUI.cs,
+ XplatUIDriver.cs, XplatUIStructs.cs, XplatUIWin32.cs,
+ XplatUIX11.cs, lang.cs:
+ - Initial check-in
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CharacterCasing.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CharacterCasing.cs
new file mode 100644
index 00000000000..7556cd89b1a
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CharacterCasing.cs
@@ -0,0 +1,35 @@
+// 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 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public enum CharacterCasing {
+ Normal = 0,
+ Upper = 1,
+ Lower = 2
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CheckBox.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CheckBox.cs
new file mode 100644
index 00000000000..4f76fa7ddcc
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CheckBox.cs
@@ -0,0 +1,346 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Dennis Hayes dennish@raytek.com
+// Peter Bartok pbartok@novell.com
+//
+
+// COMPLETE
+
+using System;
+using System.ComponentModel;
+using System.Drawing;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [DefaultProperty("Checked")]
+ [DefaultEvent("CheckedChanged")]
+ public class CheckBox : ButtonBase {
+ #region Local Variables
+ internal Appearance appearance;
+ internal bool auto_check;
+ internal ContentAlignment check_alignment;
+ internal CheckState check_state;
+ internal bool three_state;
+ #endregion // Local Variables
+
+ #region CheckBoxAccessibleObject Subclass
+ [ComVisible(true)]
+ public class CheckBoxAccessibleObject : ButtonBaseAccessibleObject {
+ #region CheckBoxAccessibleObject Local Variables
+ private CheckBox owner;
+ #endregion // CheckBoxAccessibleObject Local Variables
+
+ #region CheckBoxAccessibleObject Constructors
+ public CheckBoxAccessibleObject(Control owner) : base(owner) {
+ this.owner = (CheckBox)owner;
+ }
+ #endregion // CheckBoxAccessibleObject Constructors
+
+ #region CheckBoxAccessibleObject Properties
+ public override string DefaultAction {
+ get {
+ return "Select";
+ }
+ }
+
+ public override AccessibleRole Role {
+ get {
+ return AccessibleRole.CheckButton;
+ }
+ }
+
+ public override AccessibleStates State {
+ get {
+ AccessibleStates retval;
+
+ retval = AccessibleStates.Default;
+
+ if (owner.check_state == CheckState.Checked) {
+ retval |= AccessibleStates.Checked;
+ }
+
+ if (owner.Focused) {
+ retval |= AccessibleStates.Focused;
+ }
+
+ if (owner.CanFocus) {
+ retval |= AccessibleStates.Focusable;
+ }
+
+ return retval;
+ }
+ }
+ #endregion // CheckBoxAccessibleObject Properties
+ }
+ #endregion // CheckBoxAccessibleObject Sub-class
+
+ #region Public Constructors
+ public CheckBox() {
+ appearance = Appearance.Normal;
+ auto_check = true;
+ check_alignment = ContentAlignment.MiddleLeft;
+ text_alignment = ContentAlignment.MiddleLeft;
+ SetStyle(ControlStyles.StandardDoubleClick, false);
+ }
+ #endregion // Public Constructors
+
+ #region Internal Methods
+ internal override void Draw (PaintEventArgs pe) {
+ ThemeEngine.Current.DrawCheckBox (pe.Graphics, this.ClientRectangle, this);
+ }
+
+ internal override void HaveDoubleClick() {
+ if (DoubleClick != null) DoubleClick(this, EventArgs.Empty);
+ }
+ #endregion // Internal Methods
+
+ #region Public Instance Properties
+ [DefaultValue(Appearance.Normal)]
+ [Localizable(true)]
+ public Appearance Appearance {
+ get {
+ return appearance;
+ }
+
+ set {
+ if (value != appearance) {
+ appearance = value;
+ if (AppearanceChanged != null) {
+ AppearanceChanged(this, EventArgs.Empty);
+ }
+ Redraw();
+ }
+ }
+ }
+
+ [DefaultValue(true)]
+ public bool AutoCheck {
+ get {
+ return auto_check;
+ }
+
+ set {
+ auto_check = value;
+ }
+ }
+
+ [Bindable(true)]
+ [Localizable(true)]
+ [DefaultValue(ContentAlignment.MiddleLeft)]
+ public ContentAlignment CheckAlign {
+ get {
+ return check_alignment;
+ }
+
+ set {
+ if (value != check_alignment) {
+ check_alignment = value;
+
+ Redraw();
+ }
+ }
+ }
+
+ [Bindable(true)]
+ [RefreshProperties(RefreshProperties.All)]
+ [DefaultValue(false)]
+ public bool Checked {
+ get {
+ if (check_state != CheckState.Unchecked) {
+ return true;
+ }
+ return false;
+ }
+
+ set {
+ if (value && (check_state != CheckState.Checked)) {
+ check_state = CheckState.Checked;
+ Redraw();
+ OnCheckedChanged(EventArgs.Empty);
+ } else if (!value && (check_state != CheckState.Unchecked)) {
+ check_state = CheckState.Unchecked;
+ Redraw();
+ OnCheckedChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ [DefaultValue(CheckState.Unchecked)]
+ [RefreshProperties(RefreshProperties.All)]
+ [Bindable(true)]
+ public CheckState CheckState {
+ get {
+ return check_state;
+ }
+
+ set {
+ if (value != check_state) {
+ bool was_checked = (check_state != CheckState.Unchecked);
+
+ check_state = value;
+
+ if (was_checked != (check_state != CheckState.Unchecked)) {
+ OnCheckedChanged(EventArgs.Empty);
+ }
+
+ OnCheckStateChanged(EventArgs.Empty);
+ Redraw();
+ }
+ }
+ }
+
+ [DefaultValue(ContentAlignment.MiddleLeft)]
+ [Localizable(true)]
+ public override ContentAlignment TextAlign {
+ get {
+ return text_alignment;
+ }
+
+ set {
+ if (value != text_alignment) {
+ text_alignment = value;
+ Redraw();
+ }
+ }
+ }
+
+
+ [DefaultValue(false)]
+ public bool ThreeState {
+ get {
+ return three_state;
+ }
+
+ set {
+ three_state = value;
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Protected Instance Properties
+ protected override CreateParams CreateParams {
+ get {
+ return base.CreateParams;
+ }
+ }
+
+ protected override Size DefaultSize {
+ get {
+ return new Size(104, 24);
+ }
+ }
+ #endregion // Protected Instance Properties
+
+ #region Public Instance Methods
+ public override string ToString() {
+ return base.ToString() + ", CheckState: " + (int)check_state;
+ }
+ #endregion // Public Instance Methods
+
+ #region Protected Instance Methods
+ protected override AccessibleObject CreateAccessibilityInstance() {
+ AccessibleObject ao;
+
+ ao = base.CreateAccessibilityInstance ();
+ ao.role = AccessibleRole.CheckButton;
+
+ return ao;
+ }
+
+ protected virtual void OnAppearanceChanged(EventArgs e) {
+ if (AppearanceChanged != null) {
+ AppearanceChanged(this, e);
+ }
+ }
+
+ protected virtual void OnCheckedChanged(EventArgs e) {
+ if (CheckedChanged != null) {
+ CheckedChanged(this, e);
+ }
+ }
+
+ protected virtual void OnCheckStateChanged(EventArgs e) {
+ if (CheckStateChanged != null) {
+ CheckStateChanged(this, e);
+ }
+ }
+
+ protected override void OnClick(EventArgs e) {
+ if (auto_check) {
+ switch(check_state) {
+ case CheckState.Unchecked: {
+ if (three_state) {
+ CheckState = CheckState.Indeterminate;
+ } else {
+ CheckState = CheckState.Checked;
+ }
+ break;
+ }
+
+ case CheckState.Indeterminate: {
+ CheckState = CheckState.Checked;
+ break;
+ }
+
+ case CheckState.Checked: {
+ CheckState = CheckState.Unchecked;
+ break;
+ }
+ }
+ }
+
+ base.OnClick (e);
+ }
+
+ protected override void OnHandleCreated(EventArgs e) {
+ base.OnHandleCreated (e);
+ }
+
+ protected override void OnMouseUp(MouseEventArgs mevent) {
+ base.OnMouseUp (mevent);
+ }
+
+ protected override bool ProcessMnemonic(char charCode) {
+ if (IsMnemonic(charCode, Text) == true) {
+ Select();
+ OnClick(EventArgs.Empty);
+ return true;
+ }
+
+ return base.ProcessMnemonic(charCode);
+ }
+ #endregion // Protected Instance Methods
+
+ #region Events
+ public event EventHandler AppearanceChanged;
+ public event EventHandler CheckedChanged;
+ public event EventHandler CheckStateChanged;
+ #endregion // Events
+
+ #region Events
+ [Browsable(false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public event EventHandler DoubleClick;
+ #endregion // Events
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CheckState.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CheckState.cs
new file mode 100644
index 00000000000..9267454ba3f
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CheckState.cs
@@ -0,0 +1,34 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public enum CheckState {
+ Unchecked = 0,
+ Checked = 1,
+ Indeterminate = 2
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CheckedListBox.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CheckedListBox.cs
new file mode 100644
index 00000000000..2e1e6e74345
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CheckedListBox.cs
@@ -0,0 +1,685 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+//
+
+// COMPLETE
+
+using System;
+using System.Drawing;
+using System.Collections;
+using System.ComponentModel;
+using System.Reflection;
+
+namespace System.Windows.Forms
+{
+
+ public class CheckedListBox : ListBox
+ {
+ private CheckedIndexCollection checked_indices;
+ private CheckedItemCollection checked_items;
+ private bool check_onclick;
+ private bool three_dcheckboxes;
+
+ public CheckedListBox ()
+ {
+ items = new CheckedListBox.ObjectCollection (this);
+ checked_indices = new CheckedIndexCollection (this);
+ checked_items = new CheckedItemCollection (this);
+ check_onclick = false;
+ three_dcheckboxes = false;
+ listbox_info.item_height = FontHeight + 2;
+ SetStyle (ControlStyles.ResizeRedraw, true);
+ }
+
+ #region events
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler Click;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler DataSourceChanged;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler DisplayMemberChanged;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event DrawItemEventHandler DrawItem;
+ public event ItemCheckEventHandler ItemCheck;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event MeasureItemEventHandler MeasureItem;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler ValueMemberChanged;
+ #endregion Events
+
+ #region Public Properties
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public CheckedListBox.CheckedIndexCollection CheckedIndices {
+ get {return checked_indices; }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public CheckedListBox.CheckedItemCollection CheckedItems {
+ get {return checked_items; }
+ }
+
+ [DefaultValue (false)]
+ public bool CheckOnClick {
+ get { return check_onclick; }
+ set { check_onclick = value; }
+ }
+
+ protected override CreateParams CreateParams {
+ get { return base.CreateParams;}
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ [Browsable (false)]
+ public new object DataSource {
+ get { return base.DataSource; }
+ set { base.DataSource = value; }
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ [Browsable (false)]
+ public new string DisplayMember {
+ get { return base.DisplayMember; }
+ set { base.DisplayMember = value; }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public override DrawMode DrawMode {
+ get { return DrawMode.Normal; }
+ set { /* Not possible */ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public override int ItemHeight {
+ get { return listbox_info.item_height; }
+ set { /* Not possible */ }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [Localizable (true)]
+ [Editor ("System.Windows.Forms.Design.ListControlStringCollectionEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public new CheckedListBox.ObjectCollection Items {
+ get { return (CheckedListBox.ObjectCollection) base.Items; }
+ }
+
+ public override SelectionMode SelectionMode {
+ get { return base.SelectionMode; }
+ set {
+ if (value == SelectionMode.MultiSimple || value == SelectionMode.MultiExtended)
+ throw new InvalidEnumArgumentException ("Multi selection modes not supported");
+
+ base.SelectionMode = value;
+ }
+ }
+
+ [DefaultValue (false)]
+ public bool ThreeDCheckBoxes {
+ get { return three_dcheckboxes; }
+ set {
+ if (three_dcheckboxes == value)
+ return;
+
+ three_dcheckboxes = value;
+ Refresh ();
+ }
+ }
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new string ValueMember {
+ get { return base.ValueMember; }
+ set { base.ValueMember = value; }
+ }
+
+ #endregion Public Properties
+
+ #region Public Methods
+
+ protected override AccessibleObject CreateAccessibilityInstance ()
+ {
+ return base.CreateAccessibilityInstance ();
+ }
+
+ protected override ListBox.ObjectCollection CreateItemCollection ()
+ {
+ return new ObjectCollection (this);
+ }
+
+ public bool GetItemChecked (int index)
+ {
+ return (GetItemCheckState (index) != CheckState.Unchecked);
+ }
+
+ public CheckState GetItemCheckState (int index)
+ {
+ if (index < 0 || index >= Items.Count)
+ throw new ArgumentOutOfRangeException ("Index of out range");
+
+ return (Items.GetListBoxItem (index)).State;
+ }
+
+ protected override void OnBackColorChanged (EventArgs e)
+ {
+ base.OnBackColorChanged (e);
+ }
+
+ protected override void OnClick (EventArgs e)
+ {
+ base.OnClick (e);
+
+ if (Click != null)
+ Click (this, EventArgs.Empty);
+ }
+
+ protected override void OnDrawItem (DrawItemEventArgs e)
+ {
+ ThemeEngine.Current.DrawCheckedListBoxItem (this, e);
+ }
+
+ protected override void OnFontChanged (EventArgs e)
+ {
+ base.OnFontChanged (e);
+ }
+
+ protected override void OnHandleCreated (EventArgs e)
+ {
+ base.OnHandleCreated (e);
+ }
+
+ protected virtual void OnItemCheck (ItemCheckEventArgs ice)
+ {
+ if (ItemCheck != null)
+ ItemCheck (this, ice);
+ }
+
+ protected override void OnKeyPress (KeyPressEventArgs e)
+ {
+ base.OnKeyPress (e);
+
+ if (e.KeyChar == ' ') { // Space should check focused item
+ if (focused_item != -1) {
+ SetItemChecked (focused_item, !GetItemChecked (focused_item));
+ }
+ }
+ }
+
+ protected override void OnMeasureItem (MeasureItemEventArgs e)
+ {
+ if (MeasureItem != null)
+ MeasureItem (this, e);
+ }
+
+ protected override void OnSelectedIndexChanged (EventArgs e)
+ {
+ base.OnSelectedIndexChanged (e);
+ }
+
+ public void SetItemChecked (int index, bool value)
+ {
+ SetItemCheckState (index, value ? CheckState.Checked : CheckState.Unchecked);
+ }
+
+ public void SetItemCheckState (int index, CheckState value)
+ {
+ if (index < 0 || index >= Items.Count)
+ throw new ArgumentOutOfRangeException ("Index of out range");
+
+ if (!Enum.IsDefined (typeof (CheckState), value))
+ throw new InvalidEnumArgumentException (string.Format("Enum argument value '{0}' is not valid for CheckState", value));
+
+ CheckState old_value = (Items.GetListBoxItem (index)).State;
+
+ if (old_value == value)
+ return;
+
+ (Items.GetListBoxItem (index)).State = value;
+
+ Rectangle invalidate = GetItemDisplayRectangle (index, LBoxInfo.top_item);
+
+ switch (value) {
+ case CheckState.Checked:
+ checked_indices.AddIndex (index);
+ checked_items.AddObject (Items[index]);
+ break;
+ case CheckState.Unchecked:
+ checked_indices.RemoveIndex (index);
+ checked_items.RemoveObject (Items[index]);
+ break;
+ case CheckState.Indeterminate:
+ default:
+ break;
+ }
+
+ OnItemCheck (new ItemCheckEventArgs (index, value, old_value));
+
+ if (ClientRectangle.Contains (invalidate))
+ Invalidate (invalidate);
+ }
+
+ protected override void WmReflectCommand (ref Message m)
+ {
+ base.WmReflectCommand (ref m);
+ }
+
+ protected override void WndProc (ref Message m)
+ {
+ base.WndProc (ref m);
+ }
+
+ #endregion Public Methods
+
+ #region Private Methods
+
+ internal override void OnMouseDownLB (object sender, MouseEventArgs e)
+ {
+ Rectangle hit_rect;
+ CheckState value = CheckState.Checked;
+ bool set_value = false;
+ int index = IndexFromPointDisplayRectangle (e.X, e.Y);
+
+ if (Click != null) {
+ if (e.Button == MouseButtons.Left) {
+ Click (this, e);
+ }
+ }
+
+ if (index == -1)
+ return;
+
+ /* CheckBox hit */
+ hit_rect = GetItemDisplayRectangle (index, LBoxInfo.top_item); // Full item rect
+ hit_rect.X += ThemeEngine.Current.CheckedListBoxCheckRectangle().X;
+ hit_rect.Y += ThemeEngine.Current.CheckedListBoxCheckRectangle().Y;
+ hit_rect.Width = ThemeEngine.Current.CheckedListBoxCheckRectangle().Width;
+ hit_rect.Height = ThemeEngine.Current.CheckedListBoxCheckRectangle().Height;
+
+ if ((Items.GetListBoxItem (index)).State == CheckState.Checked) { //From checked to unchecked
+ value = CheckState.Unchecked;
+ set_value = true;
+ } else {
+
+ if (check_onclick) {
+ set_value = true;
+ } else {
+ if ((Items.GetListBoxItem (index)).Selected == true)
+ set_value = true;
+ }
+ }
+
+ if (set_value)
+ SetItemCheckState (index, value);
+
+ SelectedItemFromNavigation (index);
+ SetFocusedItem (index);
+ }
+
+ internal override void UpdateItemInfo (UpdateOperation operation, int first, int last)
+ {
+ base.UpdateItemInfo (operation, first, last);
+ CheckedItems.ReCreate ();
+ CheckedIndices.ReCreate ();
+ }
+
+ #endregion Private Methods
+
+ public class ObjectCollection : ListBox.ObjectCollection
+ {
+ private CheckedListBox owner;
+
+ public ObjectCollection (CheckedListBox owner) : base (owner)
+ {
+ this.owner = owner;
+ }
+
+ public int Add (object item, bool isChecked)
+ {
+ if (isChecked)
+ return Add (item, CheckState.Checked);
+
+ return Add (item, CheckState.Unchecked);
+
+ }
+
+ public int Add (object item, CheckState check)
+ {
+ int cnt = object_items.Count;
+ ListBox.ListBoxItem box_item = new ListBox.ListBoxItem (cnt);
+ box_item.State = check;
+ object_items.Add (item);
+ listbox_items.Add (box_item);
+ if (check == CheckState.Checked)
+ owner.OnItemCheck (new ItemCheckEventArgs (cnt, check, CheckState.Unchecked));
+ owner.UpdateItemInfo (UpdateOperation.AddItems, cnt, cnt);
+ return cnt;
+ }
+ }
+
+ /*
+ CheckedListBox.CheckedIndexCollection
+ */
+ public class CheckedIndexCollection : IList, ICollection, IEnumerable
+ {
+ private CheckedListBox owner;
+ private ArrayList indices = new ArrayList ();
+
+ internal CheckedIndexCollection (CheckedListBox owner)
+ {
+ this.owner = owner;
+ }
+
+ #region Public Properties
+ public virtual int Count {
+ get { return indices.Count; }
+ }
+
+ public virtual bool IsReadOnly {
+ get { return true;}
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return false; }
+ }
+
+ bool IList.IsFixedSize{
+ get { return true; }
+ }
+
+ object ICollection.SyncRoot {
+ get { return this; }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int this[int index] {
+ get {
+ if (index < 0 || index >= Count)
+ throw new ArgumentOutOfRangeException ("Index of out range");
+
+ return (int) indices[index];
+ }
+ }
+ #endregion Public Properties
+
+ public bool Contains (int index)
+ {
+ return indices.Contains (index);
+ }
+
+
+ public virtual void CopyTo (Array dest, int index)
+ {
+ indices.CopyTo (dest, index);
+ }
+
+ public virtual IEnumerator GetEnumerator ()
+ {
+ return indices.GetEnumerator ();
+ }
+
+ int IList.Add (object value)
+ {
+ throw new NotSupportedException ();
+ }
+
+ void IList.Clear ()
+ {
+ throw new NotSupportedException ();
+ }
+
+ bool IList.Contains (object index)
+ {
+ return Contains ((int)index);
+ }
+
+ int IList.IndexOf (object index)
+ {
+ return IndexOf ((int) index);
+ }
+
+ void IList.Insert (int index, object value)
+ {
+ throw new NotSupportedException ();
+ }
+
+ void IList.Remove (object value)
+ {
+ throw new NotSupportedException ();
+ }
+
+ void IList.RemoveAt (int index)
+ {
+ throw new NotSupportedException ();
+ }
+
+ object IList.this[int index]{
+ get {return indices[index]; }
+ set {throw new NotImplementedException (); }
+ }
+
+ public int IndexOf (int index)
+ {
+ return indices.IndexOf (index);
+ }
+
+ #region Private Methods
+
+ internal void AddIndex (int index)
+ {
+ indices.Add (index);
+ }
+
+ internal void ClearIndices ()
+ {
+ indices.Clear ();
+ }
+
+ internal void RemoveIndex (int index)
+ {
+ indices.Remove (index);
+ }
+
+ internal void ReCreate ()
+ {
+ indices.Clear ();
+
+ for (int i = 0; i < owner.Items.Count; i++) {
+ ListBox.ListBoxItem item = owner.Items.GetListBoxItem (i);
+
+ if (item.State == CheckState.Checked)
+ indices.Add (item.Index);
+ }
+ }
+
+ #endregion Private Methods
+ }
+
+ /*
+ CheckedItemCollection
+ */
+ public class CheckedItemCollection : IList, ICollection, IEnumerable
+ {
+ private CheckedListBox owner;
+ private ArrayList object_items = new ArrayList ();
+
+ internal CheckedItemCollection (CheckedListBox owner)
+ {
+ this.owner = owner;
+ }
+
+ #region Public Properties
+ public virtual int Count {
+ get { return object_items.Count; }
+ }
+
+ public virtual bool IsReadOnly {
+ get { return true; }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public virtual object this [int index] {
+ get {
+ if (index < 0 || index >= Count)
+ throw new ArgumentOutOfRangeException ("Index of out range");
+
+ return object_items[index];
+ }
+ set {throw new NotSupportedException ();}
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return true; }
+ }
+
+ object ICollection.SyncRoot {
+ get { return this; }
+ }
+
+ bool IList.IsFixedSize {
+ get { return true; }
+ }
+
+ object IList.this[int index] {
+ get { return object_items[index]; }
+ set { throw new NotSupportedException (); }
+ }
+
+ #endregion Public Properties
+
+ #region Public Methods
+ public virtual bool Contains (object selectedObject)
+ {
+ return object_items.Contains (selectedObject);
+ }
+
+ public virtual void CopyTo (Array dest, int index)
+ {
+ object_items.CopyTo (dest, index);
+ }
+
+ int IList.Add (object value)
+ {
+ throw new NotSupportedException ();
+ }
+
+ void IList.Clear ()
+ {
+ throw new NotSupportedException ();
+ }
+
+ bool IList.Contains (object selectedIndex)
+ {
+ throw new NotImplementedException ();
+ }
+
+ void IList.Insert (int index, object value)
+ {
+ throw new NotSupportedException ();
+ }
+
+ void IList.Remove (object value)
+ {
+ throw new NotSupportedException ();
+ }
+
+ void IList.RemoveAt (int index)
+ {
+ throw new NotSupportedException ();
+ }
+
+ public int IndexOf (object item)
+ {
+ return object_items.IndexOf (item);
+ }
+
+ public virtual IEnumerator GetEnumerator ()
+ {
+ return object_items.GetEnumerator ();
+ }
+
+ #endregion Public Methods
+
+ #region Private Methods
+ internal void AddObject (object obj)
+ {
+ object_items.Add (obj);
+ }
+
+ internal void ClearObjects ()
+ {
+ object_items.Clear ();
+ }
+
+ internal void ReCreate ()
+ {
+ object_items.Clear ();
+
+ for (int i = 0; i < owner.Items.Count; i++) {
+ ListBox.ListBoxItem item = owner.Items.GetListBoxItem (i);
+
+ if (item.State == CheckState.Checked)
+ object_items.Add (owner.Items[item.Index]);
+ }
+ }
+
+ internal void RemoveObject (object obj)
+ {
+ object_items.Remove (obj);
+ }
+ #endregion Private Methods
+ }
+#if NET_2_0
+
+ public bool UseCompatibleTextRendering {
+ get {
+ return use_compatible_text_rendering;
+ }
+
+ set {
+ use_compatible_text_rendering = value;
+ }
+ }
+#endif
+
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Clipboard.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Clipboard.cs
new file mode 100644
index 00000000000..7dcd7f36cd3
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Clipboard.cs
@@ -0,0 +1,142 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+using System;
+using System.Drawing;
+using System.IO;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ public sealed class Clipboard {
+ #region Local Variables
+ #endregion // Local Variables
+
+ #region Constructors
+ private Clipboard() {
+ }
+ #endregion // Constructors
+
+ #region Private Methods
+ private static bool ConvertToClipboardData(ref int type, object obj, out byte[] data) {
+ data = null;
+ return false;
+ }
+
+ private static bool ConvertFromClipboardData(int type, IntPtr data, out object obj) {
+ obj = null;
+ if (data == IntPtr.Zero) {
+ return false;
+ }
+ return false;
+ }
+ #endregion // Private Methods
+
+ #region Public Static Methods
+ public static IDataObject GetDataObject() {
+ DataObject clipboard;
+ IntPtr clipboard_handle;
+ int[] native_formats;
+ DataFormats.Format item_format;
+ object managed_clipboard_item;
+ XplatUI.ClipboardToObject converter;
+
+ converter = new XplatUI.ClipboardToObject(ConvertFromClipboardData);
+
+ clipboard_handle = XplatUI.ClipboardOpen();
+ native_formats = XplatUI.ClipboardAvailableFormats(clipboard_handle);
+ if (native_formats == null) {
+ return null; // Clipboard empty
+ }
+
+ // Build the IDataObject
+ clipboard = new DataObject();
+ for (int i = 0; i < native_formats.Length; i++) {
+ // We might get a format we don't understand or know
+ item_format = DataFormats.GetFormat(native_formats[i]);
+
+ if (item_format != null) {
+ managed_clipboard_item = XplatUI.ClipboardRetrieve(clipboard_handle, native_formats[i], converter);
+
+ if (managed_clipboard_item != null) {
+ clipboard.SetData(item_format.Name, managed_clipboard_item);
+ // We don't handle 'bitmap' since it involves handles, so we'll equate it to dib
+ if (item_format.Name == DataFormats.Dib) {
+ clipboard.SetData(DataFormats.Bitmap, managed_clipboard_item);
+ }
+ }
+ }
+ }
+
+ XplatUI.ClipboardClose(clipboard_handle);
+
+ return clipboard;
+ }
+
+ public static void SetDataObject(object data) {
+ SetDataObject(data, true);
+
+ }
+
+ public static void SetDataObject(object data, bool copy) {
+ IntPtr clipboard_handle;
+ XplatUI.ObjectToClipboard converter;
+ int native_format;
+ DataFormats.Format item_format;
+
+ converter = new XplatUI.ObjectToClipboard(ConvertToClipboardData);
+
+ clipboard_handle = XplatUI.ClipboardOpen();
+ XplatUI.ClipboardStore(clipboard_handle, null, 0, null); // Empty clipboard
+
+ native_format = -1;
+
+ if (data is IDataObject) {
+ string[] formats;
+
+ formats = ((IDataObject)data).GetFormats();
+ for (int i = 0; i < formats.Length; i++) {
+ item_format = DataFormats.GetFormat(formats[i]);
+ if ((item_format != null) && (item_format.Name != DataFormats.StringFormat)) {
+ native_format = item_format.Id;
+ }
+
+ XplatUI.ClipboardStore(clipboard_handle, ((IDataObject)data).GetData(formats[i]), native_format, converter);
+ }
+ } else {
+ item_format = DataFormats.Format.Find(data.GetType().FullName);
+ if ((item_format != null) && (item_format.Name != DataFormats.StringFormat)) {
+ native_format = item_format.Id;
+ }
+
+ XplatUI.ClipboardStore(clipboard_handle, data, native_format, converter);
+ }
+ XplatUI.ClipboardClose(clipboard_handle);
+ }
+ #endregion // Public Static Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColorDepth.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColorDepth.cs
new file mode 100644
index 00000000000..60cfe634745
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColorDepth.cs
@@ -0,0 +1,38 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ [Serializable]
+ public enum ColorDepth {
+ Depth4Bit = 4,
+ Depth8Bit = 8,
+ Depth16Bit = 16,
+ Depth24Bit = 24,
+ Depth32Bit = 32
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColorDialog.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColorDialog.cs
new file mode 100644
index 00000000000..e5070fd0629
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColorDialog.cs
@@ -0,0 +1,2141 @@
+// 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-2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Alexander Olk xenomorph2@onlinehome.de
+//
+
+// COMPLETE
+
+using System.ComponentModel;
+using System.Drawing;
+using System.Globalization;
+using System.Resources;
+using System;
+
+namespace System.Windows.Forms
+{
+ [DefaultProperty( "Color" )]
+ public class ColorDialog : CommonDialog
+ {
+ #region Local Variables
+ private ColorDialogPanel colorDialogPanel = null;
+ private bool allowFullOpen = true;
+ private bool anyColor = false;
+ private Color color = Color.Black;
+ private int[] customColors = null;
+ private bool fullOpen = false;
+ private bool showHelp = false;
+ private bool solidColorOnly = false;
+ #endregion // Local Variables
+
+ #region Public Constructors
+ public ColorDialog( ) : base()
+ {
+ form.Text = "Color";
+
+ form.Size = new Size( 221, 332 ); // 300
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public Color Color
+ {
+ get
+ {
+ return color;
+ }
+
+ set
+ {
+ color = value;
+ }
+ }
+
+ [DefaultValue(true)]
+ public virtual bool AllowFullOpen
+ {
+ get
+ {
+ return allowFullOpen;
+ }
+
+ set
+ {
+ allowFullOpen = value;
+ }
+ }
+
+ // Currently AnyColor internally is always true
+ // Does really anybody still use 256 or less colors ???
+ // Naw, cairo only supports 24bit anyway - pdb
+ [DefaultValue(false)]
+ public virtual bool AnyColor
+ {
+ get
+ {
+ return anyColor;
+ }
+
+ set
+ {
+ anyColor = value;
+ }
+ }
+
+ [DefaultValue(false)]
+ public virtual bool FullOpen
+ {
+ get
+ {
+ return fullOpen;
+ }
+
+ set
+ {
+ fullOpen = value;
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public int[] CustomColors
+ {
+ get
+ {
+ return customColors;
+ }
+
+ set
+ {
+ customColors = value;
+ }
+ }
+
+ [DefaultValue(false)]
+ public virtual bool ShowHelp
+ {
+ get
+ {
+ return showHelp;
+ }
+
+ set
+ {
+ showHelp = value;
+ }
+ }
+
+ [DefaultValue(false)]
+ public virtual bool SolidColorOnly
+ {
+ get
+ {
+ return solidColorOnly;
+ }
+
+ set
+ {
+ solidColorOnly = value;
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Instance Methods
+ public override void Reset( )
+ {
+ allowFullOpen = true;
+ anyColor = false;
+ color = Color.Black;
+ customColors = null;
+ fullOpen = false;
+ showHelp = false;
+ solidColorOnly = false;
+ }
+
+ public override string ToString( )
+ {
+ return base.ToString( ) + ", Color: " + Color.ToString( );
+ }
+ #endregion // Public Instance Methods
+
+ #region Protected Instance Properties
+ protected virtual IntPtr Instance
+ {
+ get
+ {
+ // MS Internal
+ return (IntPtr)GetHashCode( );
+ }
+ }
+
+ protected virtual int Options
+ {
+ get
+ {
+ // MS Internal
+ return 0;
+ }
+ }
+ #endregion // Protected Instance Properties
+
+ #region Protected Instance Methods
+ protected override bool RunDialog( IntPtr hwndOwner )
+ {
+ colorDialogPanel = new ColorDialogPanel (this);
+
+ form.Controls.Clear ();
+ form.Controls.Add( colorDialogPanel );
+
+ if ( customColors != null )
+ colorDialogPanel.BaseColorControl.SetCustomColors( );
+
+ return true;
+ }
+ #endregion // Protected Instance Methods
+
+ #region Private Classes
+ internal class ColorDialogPanel : Panel
+ {
+ #region Local Variables
+ private Panel selectedColorPanel;
+ private BaseColorControl baseColorControl;
+ private ColorMatrixControl colorMatrixControl;
+ private BrightnessControl brightnessControl;
+ private TriangleControl triangleControl;
+
+ private Button okButton;
+ private Button cancelButton;
+ private Button helpButton;
+ private Button addColoursButton;
+ private Button defineColoursButton;
+
+ private TextBox hueTextBox;
+ private TextBox satTextBox;
+ private TextBox briTextBox;
+ private TextBox redTextBox;
+ private TextBox greenTextBox;
+ private TextBox blueTextBox;
+
+ private Label briLabel;
+ private Label satLabel;
+ private Label hueLabel;
+ private Label colorBaseLabel;
+ private Label greenLabel;
+ private Label blueLabel;
+ private Label redLabel;
+
+ private ColorDialog colorDialog;
+ #endregion // Local Variables
+
+ internal ColorDialogPanel( ColorDialog colorDialog )
+ {
+ this.colorDialog = colorDialog;
+
+ satTextBox = new TextBox( );
+ briTextBox = new TextBox( );
+ blueTextBox = new TextBox( );
+ greenTextBox = new TextBox( );
+ redTextBox = new TextBox( );
+ hueTextBox = new TextBox( );
+
+ redLabel = new Label( );
+ blueLabel = new Label( );
+ greenLabel = new Label( );
+ colorBaseLabel = new Label( );
+ hueLabel = new Label( );
+ satLabel = new Label( );
+ briLabel = new Label( );
+
+ okButton = new Button( );
+ cancelButton = new Button( );
+ if (colorDialog.ShowHelp)
+ helpButton = new Button( );
+ defineColoursButton = new Button( );
+ addColoursButton = new Button( );
+
+ baseColorControl = new BaseColorControl( this );
+ colorMatrixControl = new ColorMatrixControl( this );
+ brightnessControl = new BrightnessControl( this );
+ triangleControl = new TriangleControl( this );
+
+ selectedColorPanel = new Panel( );
+
+ SuspendLayout( );
+
+ // hueTextBox
+ hueTextBox.Location = new Point( 324, 203 );
+ hueTextBox.Size = new Size( 27, 21 );
+ hueTextBox.TabIndex = 11;
+ hueTextBox.TextAlign = HorizontalAlignment.Right;
+ hueTextBox.MaxLength = 3;
+ // satTextBox
+ satTextBox.Location = new Point( 324, 225 );
+ satTextBox.Size = new Size( 27, 21 );
+ satTextBox.TabIndex = 15;
+ satTextBox.TextAlign = HorizontalAlignment.Right;
+ satTextBox.MaxLength = 3;
+ // greenTextBox
+ greenTextBox.Location = new Point( 404, 225 );
+ greenTextBox.Size = new Size( 27, 21 );
+ greenTextBox.TabIndex = 18;
+ greenTextBox.TextAlign = HorizontalAlignment.Right;
+ greenTextBox.MaxLength = 3;
+ // briTextBox
+ briTextBox.Location = new Point( 324, 247 );
+ briTextBox.Size = new Size( 27, 21 );
+ briTextBox.TabIndex = 16;
+ briTextBox.TextAlign = HorizontalAlignment.Right;
+ briTextBox.MaxLength = 3;
+ // blueTextBox
+ blueTextBox.Location = new Point( 404, 247 );
+ blueTextBox.Size = new Size( 27, 21 );
+ blueTextBox.TabIndex = 19;
+ blueTextBox.TextAlign = HorizontalAlignment.Right;
+ blueTextBox.MaxLength = 3;
+ // redTextBox
+ redTextBox.Location = new Point( 404, 203 );
+ redTextBox.Size = new Size( 27, 21 );
+ redTextBox.TabIndex = 17;
+ redTextBox.TextAlign = HorizontalAlignment.Right;
+ redTextBox.MaxLength = 3;
+
+ // redLabel
+ redLabel.FlatStyle = FlatStyle.System;
+ redLabel.Location = new Point( 361, 206 );
+ redLabel.Size = new Size( 40, 16 );
+ redLabel.TabIndex = 25;
+ redLabel.Text = Locale.GetText( "Red" ) + ":";
+ redLabel.TextAlign = ContentAlignment.MiddleRight;
+ // blueLabel
+ blueLabel.FlatStyle = FlatStyle.System;
+ blueLabel.Location = new Point( 361, 250 );
+ blueLabel.Size = new Size( 40, 16 );
+ blueLabel.TabIndex = 26;
+ blueLabel.Text = Locale.GetText( "Blue" ) + ":";
+ blueLabel.TextAlign = ContentAlignment.MiddleRight;
+ // greenLabel
+ greenLabel.FlatStyle = FlatStyle.System;
+ greenLabel.Location = new Point( 361, 228 );
+ greenLabel.Size = new Size( 40, 16 );
+ greenLabel.TabIndex = 27;
+ greenLabel.Text = Locale.GetText( "Green" ) + ":";
+ greenLabel.TextAlign = ContentAlignment.MiddleRight;
+ // colorBaseLabel
+ colorBaseLabel.Location = new Point( 228, 247 );
+ colorBaseLabel.Size = new Size( 60, 25 );
+ colorBaseLabel.TabIndex = 28;
+ colorBaseLabel.Text = Locale.GetText( "Color" );
+ colorBaseLabel.TextAlign = ContentAlignment.MiddleCenter;
+ // hueLabel
+ hueLabel.FlatStyle = FlatStyle.System;
+ hueLabel.Location = new Point( 287, 206 );
+ hueLabel.Size = new Size( 36, 16 );
+ hueLabel.TabIndex = 23;
+ hueLabel.Text = Locale.GetText( "Hue" ) + ":";
+ hueLabel.TextAlign = ContentAlignment.MiddleRight;
+ // satLabel
+ satLabel.FlatStyle = FlatStyle.System;
+ satLabel.Location = new Point( 287, 228 );
+ satLabel.Size = new Size( 36, 16 );
+ satLabel.TabIndex = 22;
+ satLabel.Text = Locale.GetText( "Sat" ) + ":";
+ satLabel.TextAlign = ContentAlignment.MiddleRight;
+ // briLabel
+ briLabel.FlatStyle = FlatStyle.System;
+ briLabel.Location = new Point( 287, 250 );
+ briLabel.Size = new Size( 36, 16 );
+ briLabel.TabIndex = 24;
+ briLabel.Text = Locale.GetText( "Bri" ) + ":";
+ briLabel.TextAlign = ContentAlignment.MiddleRight;
+
+ // defineColoursButton
+ defineColoursButton.FlatStyle = FlatStyle.System;
+ defineColoursButton.Location = new Point( 5, 244 );
+ defineColoursButton.Size = new Size( 210, 22 );
+ defineColoursButton.TabIndex = 6;
+ defineColoursButton.Text = Locale.GetText( "Define Colours >>" );
+ // okButton
+ okButton.FlatStyle = FlatStyle.System;
+ okButton.Location = new Point( 5, 271 );
+ okButton.Size = new Size( 66, 22 );
+ okButton.TabIndex = 0;
+ okButton.Text = Locale.GetText( "OK" );
+ // cancelButton
+ cancelButton.FlatStyle = FlatStyle.System;
+ cancelButton.Location = new Point( 78, 271 );
+ cancelButton.Size = new Size( 66, 22 );
+ cancelButton.TabIndex = 1;
+ cancelButton.Text = Locale.GetText( "Cancel" );
+ // helpButton
+ if (colorDialog.ShowHelp) {
+ helpButton.FlatStyle = FlatStyle.System;
+ helpButton.Location = new Point( 149, 271 );
+ helpButton.Size = new Size( 66, 22 );
+ helpButton.TabIndex = 5;
+ helpButton.Text = Locale.GetText ( "Help" );
+ }
+
+ // addColoursButton
+ addColoursButton.FlatStyle = FlatStyle.System;
+ addColoursButton.Location = new Point( 227, 271 );
+ addColoursButton.Size = new Size( 213, 22 );
+ addColoursButton.TabIndex = 7;
+ addColoursButton.Text = Locale.GetText( "Add Colours" );
+
+ // baseColorControl
+ baseColorControl.Location = new Point( 3, 6 );
+ baseColorControl.Size = new Size( 212, 231 );
+ baseColorControl.TabIndex = 13;
+ // colorMatrixControl
+ colorMatrixControl.Location = new Point( 227, 7 );
+ colorMatrixControl.Size = new Size( 179, 190 );
+ colorMatrixControl.TabIndex = 14;
+ // triangleControl
+ triangleControl.Location = new Point( 432, 0 );
+ triangleControl.Size = new Size( 16, 204 );
+ triangleControl.TabIndex = 12;
+ // brightnessControl
+ brightnessControl.Location = new Point( 415, 7 );
+ brightnessControl.Size = new Size( 14, 190 );
+ brightnessControl.TabIndex = 20;
+
+ // selectedColorPanel
+ selectedColorPanel.BackColor = SystemColors.Desktop;
+ selectedColorPanel.BorderStyle = BorderStyle.Fixed3D;
+ selectedColorPanel.Location = new Point( 227, 202 );
+ selectedColorPanel.Size = new Size( 60, 42 );
+ selectedColorPanel.TabIndex = 10;
+
+ ClientSize = new Size( 448, 332 ); // 300
+ Controls.Add( hueTextBox );
+ Controls.Add( satTextBox );
+ Controls.Add( briTextBox );
+ Controls.Add( redTextBox );
+ Controls.Add( greenTextBox );
+ Controls.Add( blueTextBox );
+
+ Controls.Add( defineColoursButton );
+ Controls.Add( okButton );
+ Controls.Add( cancelButton );
+ if (colorDialog.ShowHelp)
+ Controls.Add( helpButton );
+ Controls.Add( addColoursButton );
+
+ Controls.Add( baseColorControl );
+ Controls.Add( colorMatrixControl );
+ Controls.Add( brightnessControl );
+ Controls.Add( triangleControl );
+
+ Controls.Add( colorBaseLabel );
+ Controls.Add( greenLabel );
+ Controls.Add( blueLabel );
+ Controls.Add( redLabel );
+ Controls.Add( briLabel );
+ Controls.Add( hueLabel );
+ Controls.Add( satLabel );
+
+ Controls.Add( selectedColorPanel );
+
+ ResumeLayout( false );
+
+ brightnessControl.ColorToShow = selectedColorPanel.BackColor;
+
+ redTextBox.Text = selectedColorPanel.BackColor.R.ToString( );
+ greenTextBox.Text = selectedColorPanel.BackColor.G.ToString( );
+ blueTextBox.Text = selectedColorPanel.BackColor.B.ToString( );
+
+ HSB hsb = HSB.RGB2HSB( selectedColorPanel.BackColor );
+ hueTextBox.Text = hsb.hue.ToString( );
+ satTextBox.Text = hsb.sat.ToString( );
+ briTextBox.Text = hsb.bri.ToString( );
+
+ if ( !colorDialog.AllowFullOpen )
+ defineColoursButton.Enabled = false;
+
+ if ( colorDialog.FullOpen )
+ DoButtonDefineColours( );
+
+ defineColoursButton.Click += new EventHandler( OnClickButtonDefineColours );
+ addColoursButton.Click += new EventHandler( OnClickButtonAddColours );
+ if (colorDialog.ShowHelp)
+ helpButton.Click += new EventHandler( OnClickHelpButton );
+ cancelButton.Click += new EventHandler( OnClickCancelButton );
+ okButton.Click += new EventHandler( OnClickOkButton );
+
+ hueTextBox.KeyPress += new KeyPressEventHandler( OnKeyPressTextBoxes );
+ satTextBox.KeyPress += new KeyPressEventHandler( OnKeyPressTextBoxes );
+ briTextBox.KeyPress += new KeyPressEventHandler( OnKeyPressTextBoxes );
+ redTextBox.KeyPress += new KeyPressEventHandler( OnKeyPressTextBoxes );
+ greenTextBox.KeyPress += new KeyPressEventHandler( OnKeyPressTextBoxes );
+ blueTextBox.KeyPress += new KeyPressEventHandler( OnKeyPressTextBoxes );
+
+ SetStyle( ControlStyles.DoubleBuffer, true );
+ }
+
+ public Panel SelectedColorPanel
+ {
+ set
+ {
+ selectedColorPanel = value;
+ }
+
+ get
+ {
+ return selectedColorPanel;
+ }
+ }
+
+ public BrightnessControl BrightnessControl
+ {
+ set
+ {
+ brightnessControl = value;
+ }
+
+ get
+ {
+ return brightnessControl;
+ }
+ }
+
+ public TextBox HueTextBox
+ {
+ set
+ {
+ hueTextBox = value;
+ }
+
+ get
+ {
+ return hueTextBox;
+ }
+ }
+
+ public ColorMatrixControl ColorMatrixControl
+ {
+ set
+ {
+ colorMatrixControl = value;
+ }
+
+ get
+ {
+ return colorMatrixControl;
+ }
+ }
+
+ public TriangleControl TriangleControl
+ {
+ set
+ {
+ triangleControl = value;
+ }
+
+ get
+ {
+ return triangleControl;
+ }
+ }
+
+ public TextBox RedTextBox
+ {
+ set
+ {
+ redTextBox = value;
+ }
+
+ get
+ {
+ return redTextBox;
+ }
+ }
+
+ public TextBox GreenTextBox
+ {
+ set
+ {
+ greenTextBox = value;
+ }
+
+ get
+ {
+ return greenTextBox;
+ }
+ }
+
+ public BaseColorControl BaseColorControl
+ {
+ set
+ {
+ baseColorControl = value;
+ }
+
+ get
+ {
+ return baseColorControl;
+ }
+ }
+
+ public TextBox BlueTextBox
+ {
+ set
+ {
+ blueTextBox = value;
+ }
+
+ get
+ {
+ return blueTextBox;
+ }
+ }
+
+ public TextBox SatTextBox
+ {
+ set
+ {
+ satTextBox = value;
+ }
+
+ get
+ {
+ return satTextBox;
+ }
+ }
+
+ public TextBox BriTextBox
+ {
+ set
+ {
+ briTextBox = value;
+ }
+
+ get
+ {
+ return briTextBox;
+ }
+ }
+
+ public ColorDialog ColorDialog
+ {
+ set
+ {
+ colorDialog = value;
+ }
+
+ get
+ {
+ return colorDialog;
+ }
+ }
+
+ void OnClickCancelButton( object sender, EventArgs e )
+ {
+ colorDialog.form.Controls.Remove( this );
+ colorDialog.form.DialogResult = DialogResult.Cancel;
+ }
+
+ void OnClickOkButton( object sender, EventArgs e )
+ {
+ colorDialog.form.Controls.Remove( this );
+ colorDialog.form.DialogResult = DialogResult.OK;
+ }
+
+ void OnClickButtonDefineColours( object sender, EventArgs e )
+ {
+ DoButtonDefineColours( );
+ }
+
+ private void DoButtonDefineColours( )
+ {
+ defineColoursButton.Enabled = false;
+
+ colorDialog.FullOpen = true;
+
+ colorMatrixControl.ColorToShow = baseColorControl.ColorToShow;
+
+ colorDialog.form.ClientSize = new Size( 448, 332 );
+ }
+
+ void OnClickButtonAddColours( object sender, EventArgs e )
+ {
+ baseColorControl.SetUserColor( selectedColorPanel.BackColor );
+ }
+
+ // FIXME: Is this correct ?
+ void OnClickHelpButton( object sender, EventArgs e )
+ {
+ colorDialog.OnHelpRequest( e );
+ }
+
+ // not working 100 %, S.W.F.TextBox isn't finished yet
+ void OnKeyPressTextBoxes( object sender, KeyPressEventArgs e )
+ {
+ // accept only '0', '1', ... , '9'
+ // 48 = '0', 57 = '9'
+ if ( e.KeyChar < (char)48 || e.KeyChar > (char)57 )
+ e.Handled = true;
+
+ TextChangedTextBoxes( sender );
+ }
+
+ // not working 100 %, S.W.F.TextBox isn't finished yet
+ void TextChangedTextBoxes( object sender )
+ {
+ if ( ( (TextBox)sender ).Text.Length == 0 )
+ return;
+
+ int val;
+
+ if ( sender == hueTextBox )
+ {
+ val = System.Convert.ToInt32( hueTextBox.Text );
+
+ if ( val > 240 )
+ {
+ val = 240;
+ hueTextBox.Text = val.ToString( );
+ }
+ else
+ if ( val < 0 )
+ {
+ val = 0;
+ hueTextBox.Text = val.ToString( );
+ }
+
+ UpdateFromHSBTextBoxes( );
+
+ UpdateControls( selectedColorPanel.BackColor );
+ }
+ else
+ if ( sender == satTextBox )
+ {
+ val = System.Convert.ToInt32( satTextBox.Text );
+
+ if ( val > 239 )
+ {
+ val = 239;
+ satTextBox.Text = val.ToString( );
+ }
+ else
+ if ( val < 0 )
+ {
+ val = 0;
+ satTextBox.Text = val.ToString( );
+ }
+
+ UpdateFromHSBTextBoxes( );
+
+ UpdateControls( selectedColorPanel.BackColor );
+ }
+ else
+ if ( sender == briTextBox )
+ {
+ val = System.Convert.ToInt32( briTextBox.Text );
+
+ if ( val > 239 )
+ {
+ val = 239;
+ briTextBox.Text = val.ToString( );
+ }
+ else
+ if ( val < 0 )
+ {
+ val = 0;
+ briTextBox.Text = val.ToString( );
+ }
+
+ UpdateFromHSBTextBoxes( );
+
+ UpdateControls( selectedColorPanel.BackColor );
+ }
+ else
+ if ( sender == redTextBox )
+ {
+ val = System.Convert.ToInt32( redTextBox.Text );
+
+ if ( val > 255 )
+ {
+ val = 255;
+ redTextBox.Text = val.ToString( );
+ }
+ else
+ if ( val < 0 )
+ {
+ val = 0;
+ redTextBox.Text = val.ToString( );
+ }
+
+ UpdateFromRGBTextBoxes( );
+ }
+ else
+ if ( sender == greenTextBox )
+ {
+ val = System.Convert.ToInt32( greenTextBox.Text );
+
+ if ( val > 255 )
+ {
+ val = 255;
+ greenTextBox.Text = val.ToString( );
+ }
+ else
+ if ( val < 0 )
+ {
+ val = 0;
+ greenTextBox.Text = val.ToString( );
+ }
+
+ UpdateFromRGBTextBoxes( );
+ }
+ else
+ if ( sender == blueTextBox )
+ {
+ val = System.Convert.ToInt32( blueTextBox.Text );
+
+ if ( val > 255 )
+ {
+ val = 255;
+ blueTextBox.Text = val.ToString( );
+ }
+ else
+ if ( val < 0 )
+ {
+ val = 0;
+ blueTextBox.Text = val.ToString( );
+ }
+
+ UpdateFromRGBTextBoxes( );
+ }
+ }
+
+ public void UpdateControls( Color color )
+ {
+ colorDialog.Color = color;
+ selectedColorPanel.BackColor = color;
+ colorMatrixControl.ColorToShow = color;
+ brightnessControl.ColorToShow = color;
+ triangleControl.ColorToShow = color;
+ }
+
+ public void UpdateRGBTextBoxes( Color color )
+ {
+ redTextBox.Text = color.R.ToString( );
+ greenTextBox.Text = color.G.ToString( );
+ blueTextBox.Text = color.B.ToString( );
+ }
+
+ public void UpdateHSBTextBoxes( Color color )
+ {
+ HSB hsb = HSB.RGB2HSB( color );
+
+ hueTextBox.Text = hsb.hue.ToString( );
+ satTextBox.Text = hsb.sat.ToString( );
+ briTextBox.Text = hsb.bri.ToString( );
+ }
+
+ public void UpdateFromHSBTextBoxes( )
+ {
+ Color col = HSB.HSB2RGB( System.Convert.ToInt32( hueTextBox.Text ),
+ System.Convert.ToInt32( satTextBox.Text ),
+ System.Convert.ToInt32( briTextBox.Text ) );
+
+ selectedColorPanel.BackColor = col;
+ UpdateRGBTextBoxes( col );
+ }
+
+ public void UpdateFromRGBTextBoxes( )
+ {
+ Color col = Color.FromArgb( System.Convert.ToInt32( redTextBox.Text ),
+ System.Convert.ToInt32( greenTextBox.Text ),
+ System.Convert.ToInt32( blueTextBox.Text ) );
+
+ selectedColorPanel.BackColor = col;
+
+ UpdateHSBTextBoxes( col );
+
+ UpdateFromHSBTextBoxes( );
+
+ UpdateControls( col );
+ }
+ }
+
+ internal struct HSB
+ {
+ public int hue;
+ public int sat;
+ public int bri;
+
+ public static HSB RGB2HSB( Color color )
+ {
+ HSB hsb = new HSB( );
+
+ hsb.hue = (int)( ( color.GetHue( ) / 360.0f ) * 241 );
+ hsb.sat = (int)( color.GetSaturation( ) * 241 );
+ hsb.bri = (int)( color.GetBrightness( ) * 240 );
+
+ if ( hsb.hue > 240 ) hsb.hue = 240;
+ if ( hsb.sat > 240 ) hsb.sat = 240;
+ if ( hsb.bri > 239 ) hsb.bri = 239;
+
+ return hsb;
+ }
+
+ // not using ControlPaint HBS2Color, this algo is more precise
+ public static Color HSB2RGB( int hue, int saturation, int brightness )
+ {
+ if ( hue > 240 )
+ hue = 240;
+ else
+ if ( hue < 0 )
+ hue = 0;
+
+ if ( saturation > 240 )
+ saturation = 240;
+ else
+ if ( saturation < 0 )
+ saturation = 0;
+
+ if ( brightness > 239 )
+ brightness = 239;
+ else
+ if ( brightness < 0 )
+ brightness = 0;
+
+ float H = hue / 240.0f;
+ float S = saturation / 240.0f;
+ float L = brightness / 239.0f;
+
+ float r = 0, g = 0, b = 0;
+ float d1, d2;
+
+ if ( L == 0 )
+ {
+ r = g = b = 0;
+ }
+ else
+ {
+ if ( S == 0 )
+ {
+ r = g = b = L;
+ }
+ else
+ {
+ d2 = ( L <= 0.5f ) ? L * ( 1.0f + S ) : L + S - ( L * S );
+ d1 = 2.0f * L - d2;
+
+ float[] d3 = new float[] { H + 1.0f / 3.0f , H, H - 1.0f / 3.0f };
+ float[] rgb = new float[] { 0,0,0 };
+
+ for ( int i = 0; i < 3; i++ )
+ {
+ if ( d3[ i ] < 0 )
+ d3[ i ] += 1.0f;
+ if ( d3[ i ] > 1.0f )
+ d3[ i ] -= 1.0f;
+
+ if ( 6.0f * d3[ i ] < 1.0f )
+ rgb[ i ] = d1 + ( d2 - d1 ) * d3[ i ] * 6.0f;
+ else
+ if ( 2.0f * d3[ i ] < 1.0f )
+ rgb[ i ] = d2;
+ else
+ if ( 3.0f * d3[ i ] < 2.0f )
+ rgb[ i ] = ( d1 + ( d2 - d1 ) * ( ( 2.0f / 3.0f ) - d3[ i ] ) * 6.0f );
+ else
+ rgb[ i ] = d1;
+ }
+
+ r = rgb[ 0 ];
+ g = rgb[ 1 ];
+ b = rgb[ 2 ];
+ }
+ }
+
+ r = 255.0f * r;
+ g = 255.0f * g;
+ b = 255.0f * b;
+
+ if ( r < 1 )
+ r = 0.0f;
+ else
+ if ( r > 255.0f )
+ r = 255.0f;
+
+ if ( g < 1 )
+ g = 0.0f;
+ else
+ if ( g > 255.0f )
+ g = 255.0f;
+
+ if ( b < 1 )
+ b = 0.0f;
+ else
+ if ( b > 255.0f )
+ b = 255.0f;
+
+ return Color.FromArgb( (int)r, (int)g, (int)b );
+ }
+
+ public static int Brightness( Color color )
+ {
+ return (int)( color.GetBrightness( ) * 240 );
+ }
+
+ public static void GetHueSaturation( Color color, out int hue, out int sat )
+ {
+ hue = (int)( ( color.GetHue( ) / 360.0f ) * 241 );
+ sat = (int)( color.GetSaturation( ) * 241 );
+ }
+
+ // only for testing
+ // there are some small glitches, but it is still better than ControlPaint implementation
+ public static void TestColor( Color color )
+ {
+ Console.WriteLine( "Color: " + color );
+ HSB hsb = HSB.RGB2HSB( color );
+ Console.WriteLine( "RGB2HSB: " + hsb.hue + ", " + hsb.sat + ", " + hsb.bri );
+ Console.WriteLine( "HSB2RGB: " + HSB.HSB2RGB( hsb.hue, hsb.sat, hsb.bri ) );
+ Console.WriteLine( );
+ }
+ }
+
+ internal class BaseColorControl : Control
+ {
+ internal class SmallColorControl : Control
+ {
+ private Color color;
+
+ private bool isSelected = false;
+
+ public SmallColorControl( Color color )
+ {
+ this.color = color;
+
+ Size = new Size( 25, 23 );
+
+ SetStyle( ControlStyles.DoubleBuffer, true );
+ SetStyle( ControlStyles.AllPaintingInWmPaint, true );
+ SetStyle( ControlStyles.UserPaint, true );
+ SetStyle( ControlStyles.Selectable, true );
+ }
+
+ public bool IsSelected
+ {
+ set
+ {
+ isSelected = value;
+ Invalidate( );
+ }
+
+ get
+ {
+ return isSelected;
+ }
+ }
+
+ public Color Color
+ {
+ set
+ {
+ color = value;
+ Invalidate( );
+ }
+
+ get
+ {
+ return color;
+ }
+ }
+
+ protected override void OnPaint( PaintEventArgs pe )
+ {
+ base.OnPaint( pe );
+
+ pe.Graphics.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush( BackColor ), 0, 0, 26, 23 );
+
+ pe.Graphics.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush( color ),
+ new Rectangle( 4, 4, 17, 15 ) );
+
+ DrawBorder( pe.Graphics, new Rectangle( 4, 4, 17, 15 ) );
+
+ if ( isSelected )
+ {
+ pe.Graphics.DrawRectangle( ThemeEngine.Current.ResPool.GetPen( Color.Black ),
+ new Rectangle( 2, 2, 20, 18 ) );
+ }
+
+ if ( Focused )
+ {
+ ControlPaint.DrawFocusRectangle(
+ pe.Graphics, new Rectangle( 0, 0, 25, 23 )
+ );
+ }
+ }
+
+ protected override void OnClick( EventArgs e ) {
+ Focus();
+ IsSelected = true;
+
+ base.OnClick( e );
+ }
+
+
+ protected override void OnLostFocus( EventArgs e )
+ {
+ Invalidate( );
+
+ base.OnLostFocus( e );
+ }
+
+ private void DrawBorder( Graphics dc, Rectangle rect )
+ {
+ Pen pen = ThemeEngine.Current.ResPool.GetPen( Color.Black );
+ dc.DrawLine( pen, rect.X, rect.Y, rect.X, rect.Bottom - 1 );
+ dc.DrawLine( pen, rect.X + 1, rect.Y, rect.Right - 1, rect.Y );
+ }
+ }
+
+ private SmallColorControl[] smallColorControl;
+
+ private SmallColorControl[] userSmallColorControl;
+
+ private Label userColorLabel;
+ private Label baseColorLabel;
+
+ private SmallColorControl selectedSmallColorControl;
+
+ private int currentlyUsedUserSmallColorControl = 0;
+ private int[] customColors = null;
+
+ private ColorDialogPanel colorDialogPanel = null;
+
+ public BaseColorControl( ColorDialogPanel colorDialogPanel )
+ {
+ this.colorDialogPanel = colorDialogPanel;
+
+ userSmallColorControl = new SmallColorControl[ 16 ];
+ userSmallColorControl[ 0 ] = new SmallColorControl( Color.White );
+ userSmallColorControl[ 1 ] = new SmallColorControl( Color.White );
+ userSmallColorControl[ 2 ] = new SmallColorControl( Color.White );
+ userSmallColorControl[ 3 ] = new SmallColorControl( Color.White );
+ userSmallColorControl[ 4 ] = new SmallColorControl( Color.White );
+ userSmallColorControl[ 5 ] = new SmallColorControl( Color.White );
+ userSmallColorControl[ 6 ] = new SmallColorControl( Color.White );
+ userSmallColorControl[ 7 ] = new SmallColorControl( Color.White );
+ userSmallColorControl[ 8 ] = new SmallColorControl( Color.White );
+ userSmallColorControl[ 9 ] = new SmallColorControl( Color.White );
+ userSmallColorControl[ 10 ] = new SmallColorControl( Color.White );
+ userSmallColorControl[ 11 ] = new SmallColorControl( Color.White );
+ userSmallColorControl[ 12 ] = new SmallColorControl( Color.White );
+ userSmallColorControl[ 13 ] = new SmallColorControl( Color.White );
+ userSmallColorControl[ 14 ] = new SmallColorControl( Color.White );
+ userSmallColorControl[ 15 ] = new SmallColorControl( Color.White );
+
+ smallColorControl = new SmallColorControl[ 48 ];
+ smallColorControl[ 0 ] = new SmallColorControl( Color.FromArgb( ( (Byte)( 255 ) ), ( (Byte)( 128 ) ), ( (Byte)( 138 ) ) ) );
+ smallColorControl[ 1 ] = new SmallColorControl( Color.FromArgb( ( (Byte)( 128 ) ), ( (Byte)( 128 ) ), ( (Byte)( 64 ) ) ) );
+ smallColorControl[ 2 ] = new SmallColorControl( Color.Gray );
+ smallColorControl[ 3 ] = new SmallColorControl( Color.FromArgb( ( (Byte)( 128 ) ), ( (Byte)( 0 ) ), ( (Byte)( 255 ) ) ) );
+ smallColorControl[ 4 ] = new SmallColorControl( Color.Silver );
+ smallColorControl[ 5 ] = new SmallColorControl( Color.FromArgb( ( (Byte)( 64 ) ), ( (Byte)( 128 ) ), ( (Byte)( 128 ) ) ) );
+ smallColorControl[ 6 ] = new SmallColorControl( Color.White );
+ smallColorControl[ 7 ] = new SmallColorControl( Color.FromArgb( ( (Byte)( 64 ) ), ( (Byte)( 0 ) ), ( (Byte)( 64 ) ) ) );
+ smallColorControl[ 8 ] = new SmallColorControl( Color.FromArgb( ( (Byte)( 255 ) ), ( (Byte)( 128 ) ), ( (Byte)( 64 ) ) ) );
+ smallColorControl[ 9 ] = new SmallColorControl( Color.FromArgb( ( (Byte)( 128 ) ), ( (Byte)( 64 ) ), ( (Byte)( 64 ) ) ) );
+ smallColorControl[ 10 ] = new SmallColorControl( Color.Teal );
+ smallColorControl[ 11 ] = new SmallColorControl( Color.Lime );
+ smallColorControl[ 12 ] = new SmallColorControl( Color.FromArgb( ( (Byte)( 128 ) ), ( (Byte)( 128 ) ), ( (Byte)( 255 ) ) ) );
+ smallColorControl[ 13 ] = new SmallColorControl( Color.FromArgb( ( (Byte)( 0 ) ), ( (Byte)( 64 ) ), ( (Byte)( 128 ) ) ) );
+ smallColorControl[ 14 ] = new SmallColorControl( Color.FromArgb( ( (Byte)( 255 ) ), ( (Byte)( 0 ) ), ( (Byte)( 128 ) ) ) );
+ smallColorControl[ 15 ] = new SmallColorControl( Color.FromArgb( ( (Byte)( 128 ) ), ( (Byte)( 255 ) ), ( (Byte)( 0 ) ) ) );
+ smallColorControl[ 16 ] = new SmallColorControl( Color.FromArgb( ( (Byte)( 0 ) ), ( (Byte)( 255 ) ), ( (Byte)( 64 ) ) ) );
+ smallColorControl[ 17 ] = new SmallColorControl( Color.Red );
+ smallColorControl[ 18 ] = new SmallColorControl( Color.FromArgb( ( (Byte)( 255 ) ), ( (Byte)( 128 ) ), ( (Byte)( 0 ) ) ) );
+ smallColorControl[ 19 ] = new SmallColorControl( Color.FromArgb( ( (Byte)( 255 ) ), ( (Byte)( 128 ) ), ( (Byte)( 255 ) ) ) );
+ smallColorControl[ 20 ] = new SmallColorControl( Color.Fuchsia );
+ smallColorControl[ 21 ] = new SmallColorControl( Color.Aqua );
+ smallColorControl[ 22 ] = new SmallColorControl( Color.FromArgb( ( (Byte)( 128 ) ), ( (Byte)( 255 ) ), ( (Byte)( 128 ) ) ) );
+ smallColorControl[ 23 ] = new SmallColorControl( Color.FromArgb( ( (Byte)( 128 ) ), ( (Byte)( 255 ) ), ( (Byte)( 255 ) ) ) );
+ smallColorControl[ 24 ] = new SmallColorControl( Color.FromArgb( ( (Byte)( 0 ) ), ( (Byte)( 128 ) ), ( (Byte)( 255 ) ) ) );
+ smallColorControl[ 25 ] = new SmallColorControl( Color.FromArgb( ( (Byte)( 128 ) ), ( (Byte)( 64 ) ), ( (Byte)( 0 ) ) ) );
+ smallColorControl[ 26 ] = new SmallColorControl( Color.FromArgb( ( (Byte)( 64 ) ), ( (Byte)( 0 ) ), ( (Byte)( 0 ) ) ) );
+ smallColorControl[ 27 ] = new SmallColorControl( Color.Maroon );
+ smallColorControl[ 28 ] = new SmallColorControl( Color.Purple );
+ smallColorControl[ 29 ] = new SmallColorControl( Color.FromArgb( ( (Byte)( 0 ) ), ( (Byte)( 0 ) ), ( (Byte)( 160 ) ) ) );
+ smallColorControl[ 30 ] = new SmallColorControl( Color.Blue );
+ smallColorControl[ 31 ] = new SmallColorControl( Color.FromArgb( ( (Byte)( 0 ) ), ( (Byte)( 128 ) ), ( (Byte)( 64 ) ) ) );
+ smallColorControl[ 32 ] = new SmallColorControl( Color.Green );
+ smallColorControl[ 33 ] = new SmallColorControl( Color.Yellow );
+ smallColorControl[ 34 ] = new SmallColorControl( Color.FromArgb( ( (Byte)( 128 ) ), ( (Byte)( 128 ) ), ( (Byte)( 192 ) ) ) );
+ smallColorControl[ 35 ] = new SmallColorControl( Color.FromArgb( ( (Byte)( 0 ) ), ( (Byte)( 128 ) ), ( (Byte)( 192 ) ) ) );
+ smallColorControl[ 36 ] = new SmallColorControl( Color.FromArgb( ( (Byte)( 128 ) ), ( (Byte)( 0 ) ), ( (Byte)( 64 ) ) ) );
+ smallColorControl[ 37 ] = new SmallColorControl( Color.FromArgb( ( (Byte)( 255 ) ), ( (Byte)( 128 ) ), ( (Byte)( 192 ) ) ) );
+ smallColorControl[ 38 ] = new SmallColorControl( Color.FromArgb( ( (Byte)( 0 ) ), ( (Byte)( 255 ) ), ( (Byte)( 128 ) ) ) );
+ smallColorControl[ 39 ] = new SmallColorControl( Color.FromArgb( ( (Byte)( 255 ) ), ( (Byte)( 255 ) ), ( (Byte)( 128 ) ) ) );
+ smallColorControl[ 40 ] = new SmallColorControl( Color.FromArgb( ( (Byte)( 0 ) ), ( (Byte)( 64 ) ), ( (Byte)( 0 ) ) ) );
+ smallColorControl[ 41 ] = new SmallColorControl( Color.FromArgb( ( (Byte)( 0 ) ), ( (Byte)( 64 ) ), ( (Byte)( 64 ) ) ) );
+ smallColorControl[ 42 ] = new SmallColorControl( Color.Navy );
+ smallColorControl[ 43 ] = new SmallColorControl( Color.FromArgb( ( (Byte)( 0 ) ), ( (Byte)( 0 ) ), ( (Byte)( 64 ) ) ) );
+ smallColorControl[ 44 ] = new SmallColorControl( Color.FromArgb( ( (Byte)( 64 ) ), ( (Byte)( 0 ) ), ( (Byte)( 64 ) ) ) );
+ smallColorControl[ 45 ] = new SmallColorControl( Color.FromArgb( ( (Byte)( 64 ) ), ( (Byte)( 0 ) ), ( (Byte)( 128 ) ) ) );
+ smallColorControl[ 46 ] = new SmallColorControl( Color.Black ); //Black
+ smallColorControl[ 47 ] = new SmallColorControl( Color.Olive );
+
+ baseColorLabel = new Label( );
+ userColorLabel = new Label( );
+
+ SuspendLayout( );
+
+ // colorPanel1
+ smallColorControl[ 0 ].Location = new Point( 0, 15 );
+ smallColorControl[ 0 ].TabIndex = 51;
+ smallColorControl[ 0 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel2
+ smallColorControl[ 1 ].Location = new Point( 50, 130 );
+ smallColorControl[ 1 ].TabIndex = 92;
+ smallColorControl[ 1 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel3
+ smallColorControl[ 2 ].Location = new Point( 75, 130 );
+ smallColorControl[ 2 ].TabIndex = 93;
+ smallColorControl[ 2 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel4
+ smallColorControl[ 3 ].Location = new Point( 175, 84 );
+ smallColorControl[ 3 ].TabIndex = 98;
+ smallColorControl[ 3 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel5
+ smallColorControl[ 4 ].Location = new Point( 125, 130 );
+ smallColorControl[ 4 ].TabIndex = 95;
+ smallColorControl[ 4 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel6
+ smallColorControl[ 5 ].Location = new Point( 100, 130 );
+ smallColorControl[ 5 ].TabIndex = 94;
+ smallColorControl[ 5 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel7
+ smallColorControl[ 6 ].Location = new Point( 175, 130 );
+ smallColorControl[ 6 ].TabIndex = 97;
+ smallColorControl[ 6 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel8
+ smallColorControl[ 7 ].Location = new Point( 150, 130 );
+ smallColorControl[ 7 ].TabIndex = 96;
+ smallColorControl[ 7 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel9
+ smallColorControl[ 8 ].Location = new Point( 25, 61 );
+ smallColorControl[ 8 ].TabIndex = 68;
+ smallColorControl[ 8 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel10
+ smallColorControl[ 9 ].Location = new Point( 0, 61 );
+ smallColorControl[ 9 ].TabIndex = 67;
+ smallColorControl[ 9 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel11
+ smallColorControl[ 10 ].Location = new Point( 75, 61 );
+ smallColorControl[ 10 ].TabIndex = 70;
+ smallColorControl[ 10 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel12
+ smallColorControl[ 11 ].Location = new Point( 50, 61 );
+ smallColorControl[ 11 ].TabIndex = 69;
+ smallColorControl[ 11 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel13
+ smallColorControl[ 12 ].Location = new Point( 125, 61 );
+ smallColorControl[ 12 ].TabIndex = 72;
+ smallColorControl[ 12 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel14
+ smallColorControl[ 13 ].Location = new Point( 100, 61 );
+ smallColorControl[ 13 ].TabIndex = 71;
+ smallColorControl[ 13 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel15
+ smallColorControl[ 14 ].Location = new Point( 175, 61 );
+ smallColorControl[ 14 ].TabIndex = 74;
+ smallColorControl[ 14 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel16
+ smallColorControl[ 15 ].Location = new Point( 50, 38 );
+ smallColorControl[ 15 ].TabIndex = 61;
+ smallColorControl[ 15 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel17
+ smallColorControl[ 16 ].Location = new Point( 75, 38 );
+ smallColorControl[ 16 ].TabIndex = 62;
+ smallColorControl[ 16 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel18
+ smallColorControl[ 17 ].Location = new Point( 0, 38 );
+ smallColorControl[ 17 ].TabIndex = 59;
+ smallColorControl[ 17 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel19
+ smallColorControl[ 18 ].Location = new Point( 25, 84 );
+ smallColorControl[ 18 ].TabIndex = 75;
+ smallColorControl[ 18 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel20
+ smallColorControl[ 19 ].Location = new Point( 175, 15 );
+ smallColorControl[ 19 ].TabIndex = 58;
+ smallColorControl[ 19 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel21
+ smallColorControl[ 20 ].Location = new Point( 175, 38 );
+ smallColorControl[ 20 ].TabIndex = 66;
+ smallColorControl[ 20 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel22
+ smallColorControl[ 21 ].Location = new Point( 100, 38 );
+ smallColorControl[ 21 ].TabIndex = 63;
+ smallColorControl[ 21 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel23
+ smallColorControl[ 22 ].Location = new Point( 50, 15 );
+ smallColorControl[ 22 ].TabIndex = 53;
+ smallColorControl[ 22 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel24
+ smallColorControl[ 23 ].Location = new Point( 100, 15 );
+ smallColorControl[ 23 ].TabIndex = 55;
+ smallColorControl[ 23 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel25
+ smallColorControl[ 24 ].Location = new Point( 125, 15 );
+ smallColorControl[ 24 ].TabIndex = 56;
+ smallColorControl[ 24 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel26
+ smallColorControl[ 25 ].Location = new Point( 25, 107 );
+ smallColorControl[ 25 ].TabIndex = 83;
+ smallColorControl[ 25 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel27
+ smallColorControl[ 26 ].Location = new Point( 0, 107 );
+ smallColorControl[ 26 ].TabIndex = 82;
+ smallColorControl[ 26 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel28
+ smallColorControl[ 27 ].Location = new Point( 0, 84 );
+ smallColorControl[ 27 ].TabIndex = 81;
+ smallColorControl[ 27 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel29
+ smallColorControl[ 28 ].Location = new Point( 150, 84 );
+ smallColorControl[ 28 ].TabIndex = 80;
+ smallColorControl[ 28 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel30
+ smallColorControl[ 29 ].Location = new Point( 125, 84 );
+ smallColorControl[ 29 ].TabIndex = 79;
+ smallColorControl[ 29 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel31
+ smallColorControl[ 30 ].Location = new Point( 100, 84 );
+ smallColorControl[ 30 ].TabIndex = 78;
+ smallColorControl[ 30 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel32
+ smallColorControl[ 31 ].Location = new Point( 75, 84 );
+ smallColorControl[ 31 ].TabIndex = 77;
+ smallColorControl[ 31 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel33
+ smallColorControl[ 32 ].Location = new Point( 50, 84 );
+ smallColorControl[ 32 ].TabIndex = 76;
+ smallColorControl[ 32 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel34
+ smallColorControl[ 33 ].Location = new Point( 25, 38 );
+ smallColorControl[ 33 ].TabIndex = 60;
+ smallColorControl[ 33 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel35
+ smallColorControl[ 34 ].Location = new Point( 150, 38 );
+ smallColorControl[ 34 ].TabIndex = 65;
+ smallColorControl[ 34 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel36
+ smallColorControl[ 35 ].Location = new Point( 125, 38 );
+ smallColorControl[ 35 ].TabIndex = 64;
+ smallColorControl[ 35 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel37
+ smallColorControl[ 36 ].Location = new Point( 150, 61 );
+ smallColorControl[ 36 ].TabIndex = 73;
+ smallColorControl[ 36 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel38
+ smallColorControl[ 37 ].Location = new Point( 150, 15 );
+ smallColorControl[ 37 ].TabIndex = 57;
+ smallColorControl[ 37 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel39
+ smallColorControl[ 38 ].Location = new Point( 75, 15 );
+ smallColorControl[ 38 ].TabIndex = 54;
+ smallColorControl[ 38 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel40
+ smallColorControl[ 39 ].Location = new Point( 25, 15 );
+ smallColorControl[ 39 ].TabIndex = 52;
+ smallColorControl[ 39 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel41
+ smallColorControl[ 40 ].Location = new Point( 50, 107 );
+ smallColorControl[ 40 ].TabIndex = 84;
+ smallColorControl[ 40 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel42
+ smallColorControl[ 41 ].Location = new Point( 75, 107 );
+ smallColorControl[ 41 ].TabIndex = 85;
+ smallColorControl[ 41 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel43
+ smallColorControl[ 42 ].Location = new Point( 100, 107 );
+ smallColorControl[ 42 ].TabIndex = 86;
+ smallColorControl[ 42 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel44
+ smallColorControl[ 43 ].Location = new Point( 125, 107 );
+ smallColorControl[ 43 ].TabIndex = 87;
+ smallColorControl[ 43 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel45
+ smallColorControl[ 44 ].Location = new Point( 150, 107 );
+ smallColorControl[ 44 ].TabIndex = 88;
+ smallColorControl[ 44 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel46
+ smallColorControl[ 45 ].Location = new Point( 175, 107 );
+ smallColorControl[ 45 ].TabIndex = 89;
+ smallColorControl[ 45 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel47
+ smallColorControl[ 46 ].Location = new Point( 0, 130 );
+ smallColorControl[ 46 ].TabIndex = 90;
+ smallColorControl[ 46 ].Click += new EventHandler( OnSmallColorControlClick );
+ // colorPanel48
+ smallColorControl[ 47 ].Location = new Point( 25, 130 );
+ smallColorControl[ 47 ].TabIndex = 91;
+ smallColorControl[ 47 ].Click += new EventHandler( OnSmallColorControlClick );
+
+ // userColorPane1
+ userSmallColorControl[ 0 ].Location = new Point( 0, 180 );
+ userSmallColorControl[ 0 ].TabIndex = 99;
+ userSmallColorControl[ 0 ].Click += new EventHandler( OnSmallColorControlClick );
+ // userColorPanel2
+ userSmallColorControl[ 1 ].Location = new Point( 0, 203 );
+ userSmallColorControl[ 1 ].TabIndex = 108;
+ userSmallColorControl[ 1 ].Click += new EventHandler( OnSmallColorControlClick );
+ // userColorPanel13
+ userSmallColorControl[ 2 ].Location = new Point( 25, 180 );
+ userSmallColorControl[ 2 ].TabIndex = 100;
+ userSmallColorControl[ 2 ].Click += new EventHandler( OnSmallColorControlClick );
+ // userColorPanel4
+ userSmallColorControl[ 3 ].Location = new Point( 25, 203 );
+ userSmallColorControl[ 3 ].TabIndex = 109;
+ userSmallColorControl[ 3 ].Click += new EventHandler( OnSmallColorControlClick );
+ // userColorPanel5
+ userSmallColorControl[ 4 ].Location = new Point( 50, 180 );
+ userSmallColorControl[ 4 ].TabIndex = 101;
+ userSmallColorControl[ 4 ].Click += new EventHandler( OnSmallColorControlClick );
+ // userColorPanel6
+ userSmallColorControl[ 5 ].Location = new Point( 50, 203 );
+ userSmallColorControl[ 5 ].TabIndex = 110;
+ userSmallColorControl[ 5 ].Click += new EventHandler( OnSmallColorControlClick );
+ // userColorPanel7
+ userSmallColorControl[ 6 ].Location = new Point( 75, 180 );
+ userSmallColorControl[ 6 ].TabIndex = 102;
+ userSmallColorControl[ 6 ].Click += new EventHandler( OnSmallColorControlClick );
+ // userColorPanel8
+ userSmallColorControl[ 7 ].Location = new Point( 75, 203 );
+ userSmallColorControl[ 7 ].TabIndex = 111;
+ userSmallColorControl[ 7 ].Click += new EventHandler( OnSmallColorControlClick );
+ // userColorPanel9
+ userSmallColorControl[ 8 ].Location = new Point( 100, 180 );
+ userSmallColorControl[ 8 ].TabIndex = 103;
+ userSmallColorControl[ 8 ].Click += new EventHandler( OnSmallColorControlClick );
+ // userColorPanel10
+ userSmallColorControl[ 9 ].Location = new Point( 100, 203 );
+ userSmallColorControl[ 9 ].TabIndex = 112;
+ userSmallColorControl[ 9 ].Click += new EventHandler( OnSmallColorControlClick );
+ // userColorPanel11
+ userSmallColorControl[ 10 ].Location = new Point( 125, 180 );
+ userSmallColorControl[ 10 ].TabIndex = 105;
+ userSmallColorControl[ 10 ].Click += new EventHandler( OnSmallColorControlClick );
+ // userColorPanel2
+ userSmallColorControl[ 11 ].Location = new Point( 125, 203 );
+ userSmallColorControl[ 11 ].TabIndex = 113;
+ userSmallColorControl[ 11 ].Click += new EventHandler( OnSmallColorControlClick );
+ // userColorPanel13
+ userSmallColorControl[ 12 ].Location = new Point( 150, 180 );
+ userSmallColorControl[ 12 ].TabIndex = 106;
+ userSmallColorControl[ 12 ].Click += new EventHandler( OnSmallColorControlClick );
+ // userColorPanel4
+ userSmallColorControl[ 13 ].Location = new Point( 150, 203 );
+ userSmallColorControl[ 13 ].TabIndex = 114;
+ userSmallColorControl[ 13 ].Click += new EventHandler( OnSmallColorControlClick );
+ // userColorPanel15
+ userSmallColorControl[ 14 ].Location = new Point( 175, 180 );
+ userSmallColorControl[ 14 ].TabIndex = 107;
+ userSmallColorControl[ 14 ].Click += new EventHandler( OnSmallColorControlClick );
+ // userColorPanel16
+ userSmallColorControl[ 15 ].Location = new Point( 175, 203 );
+ userSmallColorControl[ 15 ].TabIndex = 115;
+ userSmallColorControl[ 15 ].Click += new EventHandler( OnSmallColorControlClick );
+
+ // baseColorLabel
+ baseColorLabel.Location = new Point( 2, 0 );
+ baseColorLabel.Size = new Size( 200, 12 );
+ baseColorLabel.TabIndex = 5;
+ baseColorLabel.Text = Locale.GetText( "Base Colours" ) + ":";
+ // userColorLabel
+ userColorLabel.FlatStyle = FlatStyle.System;
+ userColorLabel.Location = new Point( 2, 164 );
+ userColorLabel.Size = new Size( 200, 14 );
+ userColorLabel.TabIndex = 104;
+ userColorLabel.Text = Locale.GetText( "User Colors" ) + ":";
+
+ Controls.Add( userSmallColorControl[ 7 ] );
+ Controls.Add( userSmallColorControl[ 6 ] );
+ Controls.Add( userSmallColorControl[ 5 ] );
+ Controls.Add( userSmallColorControl[ 4 ] );
+ Controls.Add( userSmallColorControl[ 3 ] );
+ Controls.Add( userSmallColorControl[ 2 ] );
+ Controls.Add( userSmallColorControl[ 1 ] );
+ Controls.Add( userSmallColorControl[ 0 ] );
+ Controls.Add( userSmallColorControl[ 15 ] );
+ Controls.Add( userSmallColorControl[ 14 ] );
+ Controls.Add( userSmallColorControl[ 13 ] );
+ Controls.Add( userSmallColorControl[ 12 ] );
+ Controls.Add( userSmallColorControl[ 11 ] );
+ Controls.Add( userSmallColorControl[ 10 ] );
+ Controls.Add( userSmallColorControl[ 9 ] );
+ Controls.Add( userSmallColorControl[ 8 ] );
+
+ Controls.Add( smallColorControl[ 0 ] );
+ Controls.Add( smallColorControl[ 3 ] );
+ Controls.Add( smallColorControl[ 6 ] );
+ Controls.Add( smallColorControl[ 7 ] );
+ Controls.Add( smallColorControl[ 4 ] );
+ Controls.Add( smallColorControl[ 5 ] );
+ Controls.Add( smallColorControl[ 2 ] );
+ Controls.Add( smallColorControl[ 1 ] );
+ Controls.Add( smallColorControl[ 47 ] );
+ Controls.Add( smallColorControl[ 46 ] );
+ Controls.Add( smallColorControl[ 45 ] );
+ Controls.Add( smallColorControl[ 44 ] );
+ Controls.Add( smallColorControl[ 43 ] );
+ Controls.Add( smallColorControl[ 42 ] );
+ Controls.Add( smallColorControl[ 41 ] );
+ Controls.Add( smallColorControl[ 40 ] );
+ Controls.Add( smallColorControl[ 25 ] );
+ Controls.Add( smallColorControl[ 26 ] );
+ Controls.Add( smallColorControl[ 27 ] );
+ Controls.Add( smallColorControl[ 28 ] );
+ Controls.Add( smallColorControl[ 29 ] );
+ Controls.Add( smallColorControl[ 30 ] );
+ Controls.Add( smallColorControl[ 31 ] );
+ Controls.Add( smallColorControl[ 32 ] );
+ Controls.Add( smallColorControl[ 18 ] );
+ Controls.Add( smallColorControl[ 14 ] );
+ Controls.Add( smallColorControl[ 36 ] );
+ Controls.Add( smallColorControl[ 12 ] );
+ Controls.Add( smallColorControl[ 13 ] );
+ Controls.Add( smallColorControl[ 10 ] );
+ Controls.Add( smallColorControl[ 11 ] );
+ Controls.Add( smallColorControl[ 8 ] );
+ Controls.Add( smallColorControl[ 9 ] );
+ Controls.Add( smallColorControl[ 20 ] );
+ Controls.Add( smallColorControl[ 34 ] );
+ Controls.Add( smallColorControl[ 35 ] );
+ Controls.Add( smallColorControl[ 21 ] );
+ Controls.Add( smallColorControl[ 16 ] );
+ Controls.Add( smallColorControl[ 15 ] );
+ Controls.Add( smallColorControl[ 33 ] );
+ Controls.Add( smallColorControl[ 17 ] );
+ Controls.Add( smallColorControl[ 19 ] );
+ Controls.Add( smallColorControl[ 37 ] );
+ Controls.Add( smallColorControl[ 24 ] );
+ Controls.Add( smallColorControl[ 23 ] );
+ Controls.Add( smallColorControl[ 38 ] );
+ Controls.Add( smallColorControl[ 22 ] );
+ Controls.Add( smallColorControl[ 39 ] );
+
+ Controls.Add( userColorLabel );
+ Controls.Add( baseColorLabel );
+
+ Size = new Size( 212, 238 );
+ ResumeLayout( false );
+
+ selectedSmallColorControl = smallColorControl[ 46 ]; // default, Black
+ selectedSmallColorControl.IsSelected = true;
+
+ CheckIfColorIsInPanel( );
+ }
+
+ private void CheckIfColorIsInPanel( )
+ {
+ if ( colorDialogPanel.ColorDialog.Color != Color.Black )
+ {
+ // check if we have a panel with a BackColor = ColorDialog.Color...
+ for ( int i = 0; i < smallColorControl.Length; i++ )
+ {
+ if ( smallColorControl[ i ].BackColor == colorDialogPanel.ColorDialog.Color )
+ {
+ selectedSmallColorControl = smallColorControl[ i ];
+ break;
+ }
+ }
+ }
+ }
+
+ void OnSmallColorControlClick( object sender, EventArgs e )
+ {
+ // previous selected smallcolorcontrol
+ if ( selectedSmallColorControl != (SmallColorControl)sender )
+ selectedSmallColorControl.IsSelected = false;
+
+ selectedSmallColorControl = (SmallColorControl)sender;
+
+ TriangleControl.CurrentBrightness = HSB.Brightness( selectedSmallColorControl.Color );
+
+ colorDialogPanel.UpdateControls( selectedSmallColorControl.Color );
+ colorDialogPanel.UpdateRGBTextBoxes( selectedSmallColorControl.Color );
+ colorDialogPanel.UpdateHSBTextBoxes( selectedSmallColorControl.Color );
+ }
+
+ public Color ColorToShow
+ {
+ get
+ {
+ return selectedSmallColorControl.Color;
+ }
+ }
+
+ public void SetUserColor( Color col )
+ {
+ userSmallColorControl[ currentlyUsedUserSmallColorControl ].Color = col;
+
+ // check if this.customColors already exists
+ if ( customColors == null )
+ {
+ customColors = new int[ 16 ];
+ int white = Color.White.ToArgb( );
+
+ for ( int i = 0; i < customColors.Length; i++ )
+ customColors[ i ] = white;
+ }
+
+ customColors[ currentlyUsedUserSmallColorControl ] = col.ToArgb( );
+
+ // update ColorDialog dialog property
+ colorDialogPanel.ColorDialog.CustomColors = customColors;
+
+ currentlyUsedUserSmallColorControl++;
+ if ( currentlyUsedUserSmallColorControl > 15 )
+ currentlyUsedUserSmallColorControl = 0;
+ }
+
+ public void SetCustomColors( )
+ {
+ int[] customColors = colorDialogPanel.ColorDialog.CustomColors;
+
+ for ( int i = 0; i < customColors.Length; i++ )
+ {
+ userSmallColorControl[ i ].Color = Color.FromArgb( customColors[ i ] );
+ }
+ }
+ }
+
+ internal class ColorMatrixControl : Panel
+ {
+ internal class DrawingBitmap
+ {
+ private Bitmap bitmap;
+
+ public DrawingBitmap( )
+ {
+ bitmap = new Bitmap( 180, 191 );
+
+ float hueadd = 241.0f / 178.0f;
+ float satsub = 241.0f / 189.0f;
+ float satpos = 240.0f;
+
+ // paint the matrix to the bitmap
+ for ( int height = 0; height < 191; height++ )
+ {
+ float huepos = 0.0f;
+
+ for ( int width = 0; width < 180; width++ )
+ {
+ HSB hsb = new HSB( );
+
+ hsb.hue = (int)huepos;
+ hsb.sat = (int)satpos;
+ hsb.bri = 120; // paint it with 120 to get a nice bitmap
+
+ bitmap.SetPixel( width, height, HSB.HSB2RGB( hsb.hue, hsb.sat, hsb.bri ) );
+
+ huepos += hueadd;
+ }
+
+ satpos -= satsub;
+ }
+ }
+
+ public Bitmap Bitmap
+ {
+ set
+ {
+ bitmap = value;
+ }
+
+ get
+ {
+ return bitmap;
+ }
+ }
+ }
+
+ internal class CrossCursor
+ {
+ private Bitmap bitmap;
+
+ private Color cursorColor;
+
+ public CrossCursor( )
+ {
+ bitmap = new Bitmap( 22, 22 );
+
+ cursorColor = Color.Black;
+
+ Draw( );
+ }
+
+ public void Draw( )
+ {
+ using( Pen pen = new Pen( ThemeEngine.Current.ResPool.GetSolidBrush( cursorColor ), 3 ) )
+ {
+ using( Graphics graphics = Graphics.FromImage( bitmap ) )
+ {
+ graphics.DrawLine( pen, 11, 0, 11, 7 );
+ graphics.DrawLine( pen, 11, 14, 11, 21 );
+ graphics.DrawLine( pen, 0, 11, 7, 11 );
+ graphics.DrawLine( pen, 14, 11, 21, 11 );
+ }
+ }
+ }
+
+ public Bitmap Bitmap
+ {
+ set
+ {
+ bitmap = value;
+ }
+
+ get
+ {
+ return bitmap;
+ }
+ }
+
+ public Color CursorColor
+ {
+ set
+ {
+ cursorColor = value;
+ }
+
+ get
+ {
+ return cursorColor;
+ }
+ }
+ }
+
+ private DrawingBitmap drawingBitmap = new DrawingBitmap( );
+
+ private CrossCursor crossCursor = new CrossCursor();
+
+ private bool mouseButtonDown = false;
+
+ private bool drawCross = true;
+
+ private Color color;
+
+ private int currentXPos;
+ private int currentYPos;
+
+ private const float xstep = 240.0f/178.0f;
+ private const float ystep = 240.0f/189.0f;
+
+ private ColorDialogPanel colorDialogPanel;
+
+ public ColorMatrixControl( ColorDialogPanel colorDialogPanel )
+ {
+ this.colorDialogPanel = colorDialogPanel;
+
+ SuspendLayout( );
+
+ BorderStyle = BorderStyle.Fixed3D;
+ Location = new Point( 0, 0 );
+ Size = new Size( 179, 190 );
+ TabIndex = 0;
+ TabStop = false;
+ //BackColor = SystemColors.Control;
+ Size = new Size( 179, 190 );
+
+ ResumeLayout( false );
+
+ SetStyle( ControlStyles.DoubleBuffer, true );
+ SetStyle( ControlStyles.AllPaintingInWmPaint, true );
+ SetStyle( ControlStyles.UserPaint, true );
+ }
+
+ protected override void OnPaint( PaintEventArgs e )
+ {
+ Draw( e );
+
+ base.OnPaint( e );
+ }
+
+ private void Draw( PaintEventArgs e )
+ {
+ e.Graphics.DrawImage( drawingBitmap.Bitmap, 0, 0 );
+
+ // drawCross is false if the mouse gets moved...
+ if ( drawCross )
+ {
+ e.Graphics.DrawImage( crossCursor.Bitmap, currentXPos - 11 , currentYPos - 11 );
+ }
+ }
+
+ protected override void OnMouseDown( MouseEventArgs e )
+ {
+ mouseButtonDown = true;
+ currentXPos = e.X;
+ currentYPos = e.Y;
+ if ( drawCross )
+ {
+ drawCross = false;
+ Invalidate( );
+ Update( );
+ }
+
+ UpdateControls( );
+
+ base.OnMouseDown( e );
+ }
+
+ protected override void OnMouseMove( MouseEventArgs e )
+ {
+ if ( mouseButtonDown )
+ if ( ( e.X < 178 && e.X >= 0 ) && ( e.Y < 189 && e.Y >= 0 ) ) // 177 189
+ {
+ currentXPos = e.X;
+ currentYPos = e.Y;
+ UpdateControls( );
+ }
+
+ base.OnMouseMove( e );
+ }
+
+ protected override void OnMouseUp( MouseEventArgs e )
+ {
+ mouseButtonDown = false;
+ drawCross = true;
+ Invalidate( );
+ Update( );
+ }
+
+ public Color ColorToShow
+ {
+ set
+ {
+ color = value;
+
+ HSB hsb = HSB.RGB2HSB( color );
+
+ currentXPos = (int)( (float)hsb.hue / xstep );
+ currentYPos = 189 - (int)( (float)hsb.sat / ystep );
+
+ if ( currentXPos < 0 )
+ currentXPos = 0;
+ if ( currentYPos < 0 )
+ currentYPos = 0;
+
+ Invalidate( );
+ Update( );
+
+ UpdateControls( );
+ }
+ }
+
+ private Color GetColorFromHSB( )
+ {
+ int hue = (int)( (float)currentXPos * xstep );
+ int sat = 240 - ( (int)( (float)currentYPos * ystep ) );
+ int bri = TriangleControl.CurrentBrightness;
+
+ return HSB.HSB2RGB( hue, sat, bri );
+ }
+
+ private void UpdateControls( )
+ {
+ Color tmpColor = GetColorFromHSB( );
+
+ // update the brightness control
+ colorDialogPanel.BrightnessControl.ShowColor( (int)( (float)currentXPos * xstep ), 240 - ( (int)( (float)currentYPos * ystep ) ) );
+
+ // update saturation text box
+ int satvalue = ( 240 - ( (int)( (float)currentYPos * ystep ) ) );
+ satvalue = satvalue == 240 ? 239 : satvalue;
+ colorDialogPanel.SatTextBox.Text = satvalue.ToString( );
+
+ // update hue text box
+ colorDialogPanel.HueTextBox.Text = ( (int)( (float)currentXPos * xstep ) ).ToString( );
+
+ // update the main selected color panel
+ colorDialogPanel.SelectedColorPanel.BackColor = tmpColor;
+
+ // and finally the rgb text boxes
+ colorDialogPanel.UpdateRGBTextBoxes( tmpColor );
+ }
+ }
+
+
+ internal class BrightnessControl : Panel
+ {
+ internal class DrawingBitmap
+ {
+ private Bitmap bitmap;
+
+ public DrawingBitmap( )
+ {
+ bitmap = new Bitmap( 14, 190 );
+ }
+
+ public Bitmap Bitmap
+ {
+ set
+ {
+ bitmap = value;
+ }
+
+ get
+ {
+ return bitmap;
+ }
+ }
+
+ // only hue and saturation are needed.
+ // color will be computed with an iteration
+ public void Draw( int hue, int sat )
+ {
+ float brisub = 240.0f / 190.0f;
+ float bri = 240.0f;
+
+ for ( int height = 0; height < 190; height++ )
+ {
+ for ( int width = 0; width < 14; width++ )
+ {
+ Color pixcolor = HSB.HSB2RGB( hue, sat, (int)bri );
+ bitmap.SetPixel( width, height, pixcolor );
+ }
+ bri = bri - brisub;
+ }
+ }
+ }
+
+ private const float step = 240.0f/189.0f;
+
+ private DrawingBitmap bitmap;
+
+ private Color color;
+
+ private ColorDialogPanel colorDialogPanel;
+
+ public BrightnessControl( ColorDialogPanel colorDialogPanel )
+ {
+ this.colorDialogPanel = colorDialogPanel;
+
+ SuspendLayout( );
+
+ BorderStyle = BorderStyle.Fixed3D;
+ Location = new Point( 0, 0 );
+ Size = new Size( 14, 190 );
+ TabIndex = 0;
+ TabStop = false;
+ Size = new Size( 14, 190 );
+ ResumeLayout( false );
+
+ bitmap = new DrawingBitmap( );
+
+ SetStyle( ControlStyles.DoubleBuffer, true );
+ SetStyle( ControlStyles.AllPaintingInWmPaint, true );
+ SetStyle( ControlStyles.UserPaint, true );
+ }
+
+
+ protected override void OnPaint( PaintEventArgs e )
+ {
+ e.Graphics.DrawImage( bitmap.Bitmap, 0, 0 );
+
+ base.OnPaint( e );
+ }
+
+ protected override void OnMouseDown( MouseEventArgs e )
+ {
+ colorDialogPanel.TriangleControl.TrianglePosition = (int)( (float)( 189 - e.Y ) * step );
+
+ base.OnMouseDown( e );
+ }
+
+ // this one is for ColorMatrixControl
+ public void ShowColor( int hue, int sat )
+ {
+ bitmap.Draw( hue, sat );
+ Invalidate( );
+ Update( );
+ }
+
+ // this one for the other controls
+ public Color ColorToShow
+ {
+ set
+ {
+ int hue, sat;
+ HSB.GetHueSaturation( value, out hue, out sat );
+ bitmap.Draw( hue, sat );
+ Invalidate( );
+ Update( );
+ }
+ }
+ }
+
+
+ internal class TriangleControl : Panel
+ {
+ private bool mouseButtonDown = false;
+
+ private int currentTrianglePosition = 195;
+// private Rectangle clipRectangle;
+
+ private const float briStep = 239.0f/186.0f;
+
+ private static int currentBrightness = 0;
+
+ private ColorDialogPanel colorDialogPanel;
+
+ public TriangleControl( ColorDialogPanel colorDialogPanel )
+ {
+ this.colorDialogPanel = colorDialogPanel;
+
+ Size = new Size( 16, 203 );
+
+ SetStyle( ControlStyles.DoubleBuffer, true );
+ SetStyle( ControlStyles.AllPaintingInWmPaint, true );
+ SetStyle( ControlStyles.UserPaint, true );
+ }
+
+ public static int CurrentBrightness
+ {
+ set
+ {
+ currentBrightness = value;
+ }
+
+ get
+ {
+ return currentBrightness;
+ }
+ }
+
+ protected override void OnPaint( PaintEventArgs e )
+ {
+ Draw( e );
+
+ base.OnPaint( e );
+ }
+
+ private void Draw( PaintEventArgs e )
+ {
+ e.Graphics.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush( BackColor ), new Rectangle( 0, 0, 16, 203 ) );
+
+ Point[] trianglePoints = new Point[ 3 ]
+ {
+ new Point( 0, currentTrianglePosition ),
+ new Point( 8, currentTrianglePosition - 8 ),
+ new Point( 8, currentTrianglePosition + 8 )
+ };
+
+ e.Graphics.FillPolygon( ThemeEngine.Current.ResPool.GetSolidBrush( Color.Black ), trianglePoints );
+ }
+
+ protected override void OnMouseDown( MouseEventArgs e )
+ {
+ if ( e.Y > 195 || e.Y < 9 ) return; // helper until Cursor.Clip works
+
+ mouseButtonDown = true;
+ currentTrianglePosition = e.Y;
+
+ // Cursor.Clip doesn't yet work in Managed.Windows.Forms
+// clipRectangle = Cursor.Clip;
+// Point p = Location;
+// p.Y += 8;
+// Size s = Size;
+// s.Width -= 5;
+// s.Height -= 16;
+// Cursor.Clip = new Rectangle( Parent.PointToScreen( p ), s );
+
+ colorDialogPanel.BriTextBox.Text = TrianglePosition.ToString( );
+ colorDialogPanel.UpdateFromHSBTextBoxes( );
+
+ Invalidate( );
+ Update( );
+
+ base.OnMouseDown( e );
+ }
+
+ protected override void OnMouseMove( MouseEventArgs e )
+ {
+ if ( mouseButtonDown )
+ if ( e.Y < 196 && e.Y > 8 )
+ {
+ currentTrianglePosition = e.Y;
+
+ colorDialogPanel.BriTextBox.Text = TrianglePosition.ToString( );
+ colorDialogPanel.UpdateFromHSBTextBoxes( );
+
+ Invalidate( );
+ Update( );
+ }
+
+ base.OnMouseMove( e );
+ }
+
+ protected override void OnMouseUp( MouseEventArgs e )
+ {
+ mouseButtonDown = false;
+// Cursor.Clip = clipRectangle;
+
+ base.OnMouseUp( e );
+ }
+
+ public int TrianglePosition
+ {
+ get
+ {
+ float tmp = (float)( currentTrianglePosition - 9 );
+ tmp = tmp * briStep;
+
+ int retval = 239 - (int)tmp;
+
+ TriangleControl.CurrentBrightness = retval;
+
+ return retval;
+ }
+
+ set
+ {
+ float tmp = (float)value / briStep;
+ currentTrianglePosition = 186 - (int)tmp + 9;
+
+ colorDialogPanel.BriTextBox.Text = TrianglePosition.ToString( );
+ colorDialogPanel.UpdateFromHSBTextBoxes( );
+
+ Invalidate( );
+ Update( );
+ }
+ }
+
+ public Color ColorToShow
+ {
+ set
+ {
+ TrianglePosition = HSB.Brightness( value );
+ }
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnClickEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnClickEventArgs.cs
new file mode 100644
index 00000000000..0cfa29b7059
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnClickEventArgs.cs
@@ -0,0 +1,52 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Ravindra (rkumar@novell.com)
+//
+
+
+// COMPLETE
+
+using System;
+
+namespace System.Windows.Forms
+{
+ public class ColumnClickEventArgs : EventArgs
+ {
+ private int column;
+
+ #region Public Constructors
+ public ColumnClickEventArgs (int column)
+ {
+ this.column = column;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public int Column {
+ get {
+ return column;
+ }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnClickEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnClickEventHandler.cs
new file mode 100644
index 00000000000..7ecd08627ad
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnClickEventHandler.cs
@@ -0,0 +1,34 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Ravindra (rkumar@novell.com)
+//
+
+
+// COMPLETE
+
+
+namespace System.Windows.Forms
+{
+ [Serializable]
+ public delegate void ColumnClickEventHandler (object sender, ColumnClickEventArgs e);
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnHeader.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnHeader.cs
new file mode 100644
index 00000000000..714a6e53690
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnHeader.cs
@@ -0,0 +1,206 @@
+// 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 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Ravindra (rkumar@novell.com)
+//
+
+
+// COMPLETE
+
+
+using System.ComponentModel;
+using System.Drawing;
+
+namespace System.Windows.Forms
+{
+ [DefaultProperty ("Text")]
+ [DesignTimeVisible (false)]
+ [ToolboxItem (false)]
+ public class ColumnHeader : Component, ICloneable
+ {
+ #region Instance Variables
+ private StringFormat format = new StringFormat ();
+ private string text = "ColumnHeader";
+ private HorizontalAlignment text_alignment = HorizontalAlignment.Left;
+ private int width = ThemeEngine.Current.ListViewDefaultColumnWidth;
+
+ // internal variables
+ internal Rectangle column_rect = Rectangle.Empty;
+ internal bool pressed = false;
+ internal ListView owner;
+ #endregion // Instance Variables
+
+ #region Internal Constructor
+ internal ColumnHeader (ListView owner, string text,
+ HorizontalAlignment alignment, int width)
+ {
+ this.owner = owner;
+ this.text = text;
+ this.width = width;
+ this.text_alignment = alignment;
+ CalcColumnHeader ();
+ }
+ #endregion // Internal Constructor
+
+ #region Public Constructors
+ public ColumnHeader () { }
+ #endregion // Public Constructors
+
+ #region Private Internal Methods Properties
+ // Since this class inherits from MarshalByRef,
+ // we can't do ColumnHeader.column_rect.XXX. Hence,
+ // we have some of the following properties to work around CS0197.
+ internal bool Pressed {
+ get { return this.pressed; }
+ }
+
+ internal int X {
+ get { return this.column_rect.X; }
+ set { this.column_rect.X = value; }
+ }
+
+ internal int Y {
+ get { return this.column_rect.Y; }
+ set { this.column_rect.Y = value; }
+ }
+
+ internal int Wd {
+ get { return this.column_rect.Width; }
+ set { this.column_rect.Width = value; }
+ }
+
+ internal int Ht {
+ get { return this.column_rect.Height; }
+ set { this.column_rect.Height = value; }
+ }
+
+ internal Rectangle Rect {
+ get { return this.column_rect; }
+ }
+
+ internal StringFormat Format {
+ get { return this.format; }
+ }
+
+ internal void CalcColumnHeader ()
+ {
+ if (text_alignment == HorizontalAlignment.Center)
+ format.Alignment = StringAlignment.Center;
+ else if (text_alignment == HorizontalAlignment.Right)
+ format.Alignment = StringAlignment.Far;
+ else
+ format.Alignment = StringAlignment.Near;
+ format.LineAlignment = StringAlignment.Center;
+ format.Trimming = StringTrimming.EllipsisWord;
+ // text is wrappable only in LargeIcon and SmallIcon views
+ format.FormatFlags = StringFormatFlags.NoWrap;
+
+ if (width >= 0) {
+ this.column_rect.Width = width;
+ if (owner != null)
+ this.column_rect.Height = owner.Font.Height + 5 ;
+ else
+ this.column_rect.Height = ThemeEngine.Current.DefaultFont.Height + 5;
+ }
+ else if (this.Index != -1)
+ this.column_rect.Size = owner.GetChildColumnSize (this.Index);
+ else
+ this.column_rect.Size = Size.Empty;
+ }
+ #endregion // Private Internal Methods Properties
+
+ #region Public Instance Properties
+ [Browsable (false)]
+ public int Index {
+ get {
+ if (owner != null && owner.Columns != null
+ && owner.Columns.Contains (this)) {
+ return owner.Columns.IndexOf (this);
+ }
+ return -1;
+ }
+ }
+
+ [Browsable (false)]
+ public ListView ListView {
+ get { return owner; }
+ }
+
+ [Localizable (true)]
+ public string Text {
+ get { return text; }
+ set {
+ text = value;
+ if (owner != null)
+ owner.Redraw (true);
+ }
+ }
+
+ [DefaultValue (HorizontalAlignment.Left)]
+ [Localizable (true)]
+ public HorizontalAlignment TextAlign {
+ get { return text_alignment; }
+ set {
+ text_alignment = value;
+ if (owner != null)
+ owner.Redraw (true);
+ }
+ }
+
+ [DefaultValue (60)]
+ [Localizable (true)]
+ public int Width {
+ get { return width; }
+ set {
+ width = value;
+ if (owner != null)
+ owner.Redraw (true);
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Methods
+ public virtual object Clone ()
+ {
+ ColumnHeader columnHeader = new ColumnHeader ();
+ columnHeader.text = text;
+ columnHeader.text_alignment = text_alignment;
+ columnHeader.width = width;
+ columnHeader.owner = owner;
+ columnHeader.column_rect = Rectangle.Empty;
+ return columnHeader;
+ }
+
+ public override string ToString ()
+ {
+ return string.Format ("ColumnHeader: Text: {0}", text);
+ }
+ #endregion // Public Methods
+
+ #region Protected Methods
+ protected override void Dispose (bool disposing)
+ {
+ base.Dispose (disposing);
+ }
+ #endregion // Protected Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnHeaderStyle.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnHeaderStyle.cs
new file mode 100644
index 00000000000..5be7b5887a5
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnHeaderStyle.cs
@@ -0,0 +1,36 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Ravindra (rkumar@novell.com)
+//
+// COMPLETE
+//
+
+namespace System.Windows.Forms
+{
+ public enum ColumnHeaderStyle
+ {
+ None = 0,
+ Nonclickable = 1,
+ Clickable = 2
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs
new file mode 100644
index 00000000000..01a48d3ce5e
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs
@@ -0,0 +1,2009 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+//
+
+// NOT COMPLETE
+
+using System;
+using System.Drawing;
+using System.Collections;
+using System.ComponentModel;
+using System.Reflection;
+using System.ComponentModel.Design;
+using System.ComponentModel.Design.Serialization;
+using System.Runtime.InteropServices;
+
+
+namespace System.Windows.Forms
+{
+
+ [DefaultProperty("Items")]
+ [DefaultEvent("SelectedIndexChanged")]
+ [Designer ("System.Windows.Forms.Design.ComboBoxDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+ public class ComboBox : ListControl
+ {
+ private DrawMode draw_mode;
+ private ComboBoxStyle dropdown_style;
+ private int dropdown_width;
+ private const int preferred_height = 20;
+ private int selected_index;
+ private object selected_item;
+ internal ObjectCollection items = null;
+ private bool suspend_ctrlupdate;
+ private int maxdrop_items;
+ private bool integral_height;
+ private bool sorted;
+ internal ComboBoxInfo combobox_info;
+ private readonly int def_button_width = 16;
+ private bool clicked;
+ private int max_length;
+ private ComboListBox listbox_ctrl;
+ private TextBox textbox_ctrl;
+ private bool process_textchanged_event;
+
+ [ComVisible(true)]
+ public class ChildAccessibleObject : AccessibleObject {
+ private ComboBox owner;
+ private IntPtr handle;
+
+ public ChildAccessibleObject (ComboBox owner, IntPtr handle) {
+ this.owner = owner;
+ this.handle = handle;
+ }
+
+ public override string Name {
+ get {
+ return base.Name;
+ }
+ }
+
+
+ }
+
+ internal class ComboBoxInfo
+ {
+ internal int item_height; /* Item's height */
+ internal Rectangle textarea; /* Rectangle of the editable text area */
+ internal Rectangle textarea_drawable; /* Rectangle of the editable text area - decorations - button if present*/
+ internal Rectangle button_rect;
+ internal bool show_button; /* Is the DropDown button shown? */
+ internal ButtonState button_status; /* Drop button status */
+ internal int original_height; /* Control's height is recalculated for not Simple Styles */
+ internal Rectangle listbox_area; /* ListBox area in Simple combox, not used in the rest */
+ internal bool droppeddown; /* Is the associated ListBox dropped down? */
+ internal int combosimple_height; /* Simple default height */
+
+ public ComboBoxInfo ()
+ {
+ button_status = ButtonState.Normal;
+ show_button = false;
+ item_height = 0;
+ droppeddown = false;
+ original_height = -1;
+ combosimple_height = 150;
+ }
+ }
+
+ internal class ComboBoxItem
+ {
+ internal int Index;
+ internal int ItemHeight; /* Only used for OwnerDrawVariable */
+
+ public ComboBoxItem (int index)
+ {
+ Index = index;
+ ItemHeight = -1;
+ }
+ }
+
+ public ComboBox ()
+ {
+ items = new ObjectCollection (this);
+ listbox_ctrl = null;
+ textbox_ctrl = null;
+ combobox_info = new ComboBoxInfo ();
+ combobox_info.item_height = FontHeight + 2;
+ dropdown_style = (ComboBoxStyle)(-1);
+ DropDownStyle = ComboBoxStyle.DropDown;
+ BackColor = ThemeEngine.Current.ColorWindow;
+ draw_mode = DrawMode.Normal;
+ selected_index = -1;
+ selected_item = null;
+ maxdrop_items = 8;
+ suspend_ctrlupdate = false;
+ clicked = false;
+ dropdown_width = -1;
+ max_length = 0;
+ integral_height = true;
+ process_textchanged_event = true;
+ has_focus = false;
+
+ /* Events */
+ MouseDown += new MouseEventHandler (OnMouseDownCB);
+ MouseUp += new MouseEventHandler (OnMouseUpCB);
+ MouseMove += new MouseEventHandler (OnMouseMoveCB);
+ KeyDown +=new KeyEventHandler(OnKeyDownCB);
+ }
+
+ #region events
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler BackgroundImageChanged;
+
+ public event DrawItemEventHandler DrawItem;
+ public event EventHandler DropDown;
+ public event EventHandler DropDownStyleChanged;
+ public event MeasureItemEventHandler MeasureItem;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event PaintEventHandler Paint;
+
+ public event EventHandler SelectedIndexChanged;
+ public event EventHandler SelectionChangeCommitted;
+ #endregion Events
+
+ #region Public Properties
+ public override Color BackColor {
+ get { return base.BackColor; }
+ set {
+ if (base.BackColor == value)
+ return;
+
+ base.BackColor = value;
+ Refresh ();
+ }
+ }
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public override Image BackgroundImage {
+ get { return base.BackgroundImage; }
+ set {
+ if (base.BackgroundImage == value)
+ return;
+
+ base.BackgroundImage = value;
+
+ if (BackgroundImageChanged != null)
+ BackgroundImageChanged (this, EventArgs.Empty);
+
+ Refresh ();
+ }
+ }
+
+ protected override CreateParams CreateParams {
+ get { return base.CreateParams;}
+ }
+
+ protected override Size DefaultSize {
+ get { return new Size (121, PreferredHeight); }
+ }
+
+ [RefreshProperties(RefreshProperties.Repaint)]
+ [DefaultValue (DrawMode.Normal)]
+ public DrawMode DrawMode {
+ get { return draw_mode; }
+
+ set {
+ if (!Enum.IsDefined (typeof (DrawMode), value))
+ throw new InvalidEnumArgumentException (string.Format("Enum argument value '{0}' is not valid for DrawMode", value));
+
+ if (draw_mode == value)
+ return;
+
+ draw_mode = value;
+ Refresh ();
+ }
+ }
+
+ [DefaultValue (ComboBoxStyle.DropDown)]
+ [RefreshProperties(RefreshProperties.Repaint)]
+ public ComboBoxStyle DropDownStyle {
+ get { return dropdown_style; }
+
+ set {
+
+ if (!Enum.IsDefined (typeof (ComboBoxStyle), value))
+ throw new InvalidEnumArgumentException (string.Format("Enum argument value '{0}' is not valid for ComboBoxStyle", value));
+
+ if (dropdown_style == value)
+ return;
+
+ if (dropdown_style == ComboBoxStyle.Simple) {
+ if (listbox_ctrl != null) {
+ Controls.RemoveImplicit (listbox_ctrl);
+ listbox_ctrl.Dispose ();
+ listbox_ctrl = null;
+ Height = combobox_info.original_height;
+ }
+ }
+
+ if (dropdown_style != ComboBoxStyle.DropDownList && value == ComboBoxStyle.DropDownList) {
+ if (textbox_ctrl != null) {
+ Controls.RemoveImplicit (textbox_ctrl);
+ textbox_ctrl.Dispose ();
+ textbox_ctrl = null;
+ }
+ }
+
+ dropdown_style = value;
+
+ if (dropdown_style == ComboBoxStyle.Simple) {
+ CBoxInfo.show_button = false;
+ combobox_info.original_height = Height;
+ Height = combobox_info.combosimple_height;
+
+ CreateComboListBox ();
+
+ if (IsHandleCreated == true) {
+ Controls.AddImplicit (listbox_ctrl);
+ }
+ }
+ else {
+ CBoxInfo.show_button = true;
+ CBoxInfo.button_status = ButtonState.Normal;
+ }
+
+ if (dropdown_style != ComboBoxStyle.DropDownList && textbox_ctrl == null) {
+ textbox_ctrl = new TextBox ();
+ textbox_ctrl.BorderStyle = BorderStyle.None;
+ textbox_ctrl.TextChanged += new EventHandler (OnTextChangedEdit);
+ textbox_ctrl.KeyPress += new KeyPressEventHandler(textbox_ctrl_KeyPress);
+ textbox_ctrl.KeyDown += new KeyEventHandler (OnKeyDownCB);
+ textbox_ctrl.GotFocus += new EventHandler(textbox_ctrl_GotFocus);
+ textbox_ctrl.LostFocus += new EventHandler(textbox_ctrl_LostFocus);
+
+ if (IsHandleCreated == true) {
+ Controls.AddImplicit (textbox_ctrl);
+ }
+ }
+
+ if (DropDownStyleChanged != null)
+ DropDownStyleChanged (this, EventArgs.Empty);
+
+ CalcTextArea ();
+ Refresh ();
+ }
+ }
+
+ public int DropDownWidth {
+ get {
+ if (dropdown_width == -1)
+ return Width;
+
+ return dropdown_width;
+ }
+ set {
+ if (dropdown_width == value)
+ return;
+
+ if (value < 1)
+ throw new ArgumentException ("The DropDownWidth value is less than one");
+
+ dropdown_width = value;
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public bool DroppedDown {
+ get {
+ if (dropdown_style == ComboBoxStyle.Simple)
+ return true;
+
+ return CBoxInfo.droppeddown;
+ }
+ set {
+ if (dropdown_style == ComboBoxStyle.Simple)
+ return;
+
+
+ if (value == true) {
+ DropDownListBox ();
+ }
+ else {
+ listbox_ctrl.Hide ();
+ }
+
+ if (DropDown != null)
+ DropDown (this, EventArgs.Empty);
+ }
+ }
+
+ public override bool Focused {
+ get { return base.Focused; }
+ }
+
+ public override Color ForeColor {
+ get { return base.ForeColor; }
+ set {
+ if (base.ForeColor == value)
+ return;
+
+ base.ForeColor = value;
+ Refresh ();
+ }
+ }
+
+ [DefaultValue (true)]
+ [Localizable (true)]
+ public bool IntegralHeight {
+ get { return integral_height; }
+ set {
+ if (integral_height == value)
+ return;
+
+ integral_height = value;
+ Refresh ();
+ }
+ }
+
+ [Localizable (true)]
+ public int ItemHeight {
+ get { return combobox_info.item_height; }
+ set {
+ if (value < 0)
+ throw new ArgumentException ("The item height value is less than zero");
+
+ combobox_info.item_height = value;
+ CalcTextArea ();
+ Refresh ();
+ }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [Localizable (true)]
+ [Editor ("System.Windows.Forms.Design.ListControlStringCollectionEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public ComboBox.ObjectCollection Items {
+ get { return items; }
+ }
+
+ [DefaultValue (8)]
+ [Localizable (true)]
+ public int MaxDropDownItems {
+ get { return maxdrop_items; }
+ set {
+ if (maxdrop_items == value)
+ return;
+
+ maxdrop_items = value;
+ }
+ }
+
+ [DefaultValue (0)]
+ [Localizable (true)]
+ public int MaxLength {
+ get { return max_length; }
+ set {
+ if (max_length == value)
+ return;
+
+ max_length = value;
+
+ if (dropdown_style != ComboBoxStyle.DropDownList) {
+
+ if (value < 0) {
+ value = 0;
+ }
+
+ textbox_ctrl.MaxLength = value;
+ }
+ }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ public int PreferredHeight {
+ get { return preferred_height; }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public override int SelectedIndex {
+ get { return selected_index; }
+ set {
+ if (value <= -2 || value >= Items.Count)
+ throw new ArgumentOutOfRangeException ("Index of out range");
+
+ if (selected_index == value)
+ return;
+
+ selected_index = value;
+
+ if (dropdown_style != ComboBoxStyle.DropDownList) {
+ SetControlText (GetItemText (Items[selected_index]));
+ }
+
+ OnSelectedIndexChanged (new EventArgs ());
+ OnSelectedValueChanged (new EventArgs ());
+ OnSelectedItemChanged (new EventArgs ());
+ Refresh ();
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Bindable(true)]
+ public object SelectedItem {
+ get {
+ if (selected_index !=-1 && Items !=null && Items.Count > 0)
+ return Items[selected_index];
+ else
+ return null;
+ }
+ set {
+ int index = Items.IndexOf (value);
+
+ if (index == -1)
+ return;
+
+ if (selected_index == index)
+ return;
+
+ selected_index = index;
+
+ if (dropdown_style != ComboBoxStyle.DropDownList) {
+ SetControlText (GetItemText (Items[selected_index]));
+ }
+
+ OnSelectedItemChanged (new EventArgs ());
+ Refresh ();
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public string SelectedText {
+ get {
+ if (dropdown_style == ComboBoxStyle.DropDownList)
+ return "";
+
+ return textbox_ctrl.SelectedText;
+ }
+ set {
+ if (dropdown_style == ComboBoxStyle.DropDownList) {
+ return;
+ }
+
+ textbox_ctrl.SelectedText = value;
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public int SelectionLength {
+ get {
+ if (dropdown_style == ComboBoxStyle.DropDownList)
+ return 0;
+
+ return textbox_ctrl.SelectionLength;
+ }
+ set {
+ if (dropdown_style == ComboBoxStyle.DropDownList)
+ return;
+
+ if (textbox_ctrl.SelectionLength == value)
+ return;
+
+ textbox_ctrl.SelectionLength = value;
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public int SelectionStart {
+ get {
+ if (dropdown_style == ComboBoxStyle.DropDownList)
+ return 0;
+
+ return textbox_ctrl.SelectionStart;
+ }
+ set {
+ if (dropdown_style == ComboBoxStyle.DropDownList)
+ return;
+
+ if (textbox_ctrl.SelectionStart == value)
+ return;
+
+ textbox_ctrl.SelectionStart = value;
+ }
+ }
+
+ [DefaultValue (false)]
+ public bool Sorted {
+ get { return sorted; }
+
+ set {
+ if (sorted == value)
+ return;
+
+ sorted = value;
+ }
+ }
+
+ [Bindable (true)]
+ [Localizable (true)]
+ public override string Text {
+ get {
+ if (dropdown_style != ComboBoxStyle.DropDownList) {
+ if (textbox_ctrl != null) {
+ return textbox_ctrl.Text;
+ }
+ }
+
+ if (SelectedItem != null) {
+ return GetItemText (SelectedItem);
+ }
+
+ return base.Text;
+ }
+ set {
+ if (value == null) {
+ SelectedIndex = -1;
+ return;
+ }
+
+ int index = FindString (value);
+
+ if (index != -1) {
+ SelectedIndex = index;
+ return;
+ }
+
+ if (dropdown_style != ComboBoxStyle.DropDownList) {
+ textbox_ctrl.Text = GetItemText (value);
+ }
+ }
+ }
+
+ #endregion Public Properties
+
+ #region Private Properties
+ internal ComboBoxInfo CBoxInfo {
+ get { return combobox_info; }
+ }
+
+ #endregion Private Properties
+
+ #region Public Methods
+ protected virtual void AddItemsCore (object[] value)
+ {
+
+ }
+
+ public void BeginUpdate ()
+ {
+ suspend_ctrlupdate = true;
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ if (disposing == true) {
+ if (listbox_ctrl != null) {
+ listbox_ctrl.Dispose ();
+ Controls.RemoveImplicit (listbox_ctrl);
+ listbox_ctrl = null;
+ }
+
+ if (textbox_ctrl != null) {
+ Controls.RemoveImplicit (textbox_ctrl);
+ textbox_ctrl.Dispose ();
+ textbox_ctrl = null;
+ }
+ }
+
+ base.Dispose (disposing);
+ }
+
+ public void EndUpdate ()
+ {
+ suspend_ctrlupdate = false;
+ UpdatedItems ();
+ }
+
+ public int FindString (string s)
+ {
+ return FindString (s, -1);
+ }
+
+ public int FindString (string s, int startIndex)
+ {
+ if (Items.Count == 0)
+ return -1; // No exception throwing if empty
+
+ if (startIndex < -1 || startIndex >= Items.Count - 1)
+ throw new ArgumentOutOfRangeException ("Index of out range");
+
+ startIndex++;
+ for (int i = startIndex; i < Items.Count; i++) {
+ if ((GetItemText (Items[i])).StartsWith (s))
+ return i;
+ }
+
+ return -1;
+ }
+
+ public int FindStringExact (string s)
+ {
+ return FindStringExact (s, -1);
+ }
+
+ public int FindStringExact (string s, int startIndex)
+ {
+ if (Items.Count == 0)
+ return -1; // No exception throwing if empty
+
+ if (startIndex < -1 || startIndex >= Items.Count - 1)
+ throw new ArgumentOutOfRangeException ("Index of out range");
+
+ startIndex++;
+ for (int i = startIndex; i < Items.Count; i++) {
+ if ((GetItemText (Items[i])).Equals (s))
+ return i;
+ }
+
+ return -1;
+ }
+
+ public int GetItemHeight (int index)
+ {
+ if (DrawMode == DrawMode.OwnerDrawVariable && IsHandleCreated == true) {
+
+ if (index < 0 || index >= Items.Count )
+ throw new ArgumentOutOfRangeException ("The item height value is less than zero");
+
+ if ((Items.GetComboBoxItem (index)).ItemHeight != -1) {
+ return (Items.GetComboBoxItem (index)).ItemHeight;
+ }
+
+ MeasureItemEventArgs args = new MeasureItemEventArgs (DeviceContext, index, ItemHeight);
+ OnMeasureItem (args);
+ (Items.GetComboBoxItem (index)).ItemHeight = args.ItemHeight;
+ return args.ItemHeight;
+ }
+
+ return ItemHeight;
+ }
+
+ protected override bool IsInputKey (Keys keyData)
+ {
+ switch (keyData) {
+ case Keys.Up:
+ case Keys.Down:
+ case Keys.PageUp:
+ case Keys.PageDown:
+ return true;
+
+ default:
+ return false;
+ }
+ }
+
+ protected override void OnBackColorChanged (EventArgs e)
+ {
+ base.OnBackColorChanged (e);
+ }
+
+ protected override void OnDataSourceChanged (EventArgs e)
+ {
+ base.OnDataSourceChanged (e);
+ BindDataItems (items);
+
+ if (DataSource == null || DataManager == null) {
+ SelectedIndex = -1;
+ }
+ else {
+ SelectedIndex = DataManager.Position;
+ }
+ }
+
+ protected override void OnDisplayMemberChanged (EventArgs e)
+ {
+ base.OnDisplayMemberChanged (e);
+
+ if (DataManager == null || !IsHandleCreated)
+ return;
+
+ BindDataItems (items);
+ SelectedIndex = DataManager.Position;
+ }
+
+ protected virtual void OnDrawItem (DrawItemEventArgs e)
+ {
+ if (DrawItem != null && (DrawMode == DrawMode.OwnerDrawFixed || DrawMode == DrawMode.OwnerDrawVariable)) {
+ DrawItem (this, e);
+ return;
+ }
+
+ ThemeEngine.Current.DrawComboBoxItem (this, e);
+ }
+
+ protected virtual void OnDropDown (EventArgs e)
+ {
+ if (DropDown != null)
+ DropDown (this, e);
+ }
+
+ protected virtual void OnDropDownStyleChanged (EventArgs e)
+ {
+ if (DropDownStyleChanged != null)
+ DropDownStyleChanged (this, e);
+ }
+
+ protected override void OnFontChanged (EventArgs e)
+ {
+ base.OnFontChanged (e);
+
+ if (textbox_ctrl != null) {
+ textbox_ctrl.Font = Font;
+ }
+
+ combobox_info.item_height = FontHeight + 2;
+ CalcTextArea ();
+ }
+
+ protected override void OnForeColorChanged (EventArgs e)
+ {
+ base.OnForeColorChanged (e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected override void OnGotFocus (EventArgs e) {
+ has_focus = true;
+ Invalidate ();
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected override void OnLostFocus (EventArgs e) {
+ has_focus = false;
+ Invalidate ();
+ }
+
+ protected override void OnHandleCreated (EventArgs e)
+ {
+ base.OnHandleCreated (e);
+
+ if (listbox_ctrl != null) {
+ Controls.AddImplicit (listbox_ctrl);
+
+ if (dropdown_style == ComboBoxStyle.Simple)
+ Height = combobox_info.combosimple_height;
+
+ }
+
+ if (textbox_ctrl != null) {
+ Controls.AddImplicit (textbox_ctrl);
+ }
+
+ CalcTextArea ();
+ }
+
+ protected override void OnHandleDestroyed (EventArgs e)
+ {
+ base.OnHandleDestroyed (e);
+ }
+
+ protected override void OnKeyPress (KeyPressEventArgs e)
+ {
+ base.OnKeyPress (e);
+ }
+
+ protected virtual void OnMeasureItem (MeasureItemEventArgs e)
+ {
+ if (MeasureItem != null)
+ MeasureItem (this, e);
+ }
+
+ protected override void OnParentBackColorChanged (EventArgs e)
+ {
+ base.OnParentBackColorChanged (e);
+ }
+
+ protected override void OnResize (EventArgs e)
+ {
+ base.OnResize (e);
+ AdjustHeightForDropDown ();
+
+ if (listbox_ctrl != null)
+ listbox_ctrl.CalcListBoxArea ();
+
+ CalcTextArea ();
+ }
+
+ protected override void OnSelectedIndexChanged (EventArgs e)
+ {
+ base.OnSelectedIndexChanged (e);
+
+ if (SelectedIndexChanged != null)
+ SelectedIndexChanged (this, e);
+ }
+
+ protected virtual void OnSelectedItemChanged (EventArgs e)
+ {
+
+ }
+
+ protected override void OnSelectedValueChanged (EventArgs e)
+ {
+ base.OnSelectedValueChanged (e);
+ }
+
+ protected virtual void OnSelectionChangeCommitted (EventArgs e)
+ {
+ if (SelectionChangeCommitted != null)
+ SelectionChangeCommitted (this, e);
+ }
+
+ protected override void RefreshItem (int index)
+ {
+ if (index < 0 || index >= Items.Count)
+ throw new ArgumentOutOfRangeException ("Index of out range");
+
+ if (draw_mode == DrawMode.OwnerDrawVariable) {
+ (Items.GetComboBoxItem (index)).ItemHeight = -1;
+ }
+ }
+
+ public void Select (int start, int lenght)
+ {
+ if (start < 0)
+ throw new ArgumentException ("Start cannot be less than zero");
+
+ if (lenght < 0)
+ throw new ArgumentException ("Start cannot be less than zero");
+
+ if (dropdown_style == ComboBoxStyle.DropDownList)
+ return;
+
+ textbox_ctrl.Select (start, lenght);
+ }
+
+ public void SelectAll ()
+ {
+ if (dropdown_style == ComboBoxStyle.DropDownList)
+ return;
+
+ textbox_ctrl.SelectAll ();
+ }
+
+ protected override void SetBoundsCore (int x, int y, int width, int height, BoundsSpecified specified)
+ {
+ base.SetBoundsCore (x, y, width, height, specified);
+ }
+
+ protected override void SetItemCore (int index, object value)
+ {
+ if (index < 0 || index >= Items.Count)
+ return;
+
+ Items[index] = value;
+ }
+
+ protected override void SetItemsCore (IList value)
+ {
+ Items.AddRange (value);
+ }
+
+ public override string ToString ()
+ {
+ return base.ToString () + ", Items.Count:" + Items.Count;
+ }
+
+ protected override void WndProc (ref Message m)
+ {
+
+ switch ((Msg) m.Msg) {
+
+ case Msg.WM_PAINT: {
+ PaintEventArgs paint_event;
+ paint_event = XplatUI.PaintEventStart (Handle, true);
+ OnPaintCB (paint_event);
+ XplatUI.PaintEventEnd (Handle, true);
+ return;
+ }
+
+ case Msg.WM_ERASEBKGND:
+ m.Result = (IntPtr) 1;
+ return;
+
+ default:
+ break;
+ }
+
+ base.WndProc (ref m);
+
+ }
+
+ #endregion Public Methods
+
+ #region Private Methods
+
+ private void AdjustHeightForDropDown ()
+ {
+ if (dropdown_style == ComboBoxStyle.Simple)
+ return;
+
+ int new_height = combobox_info.item_height + ThemeEngine.Current.DrawComboBoxEditDecorationTop () +
+ ThemeEngine.Current.DrawComboBoxEditDecorationBottom () + 2;
+
+ if (Height == new_height)
+ return;
+
+ combobox_info.original_height = Height;
+ Height = new_height;
+ }
+
+ private void textbox_ctrl_KeyPress(object sender, KeyPressEventArgs e)
+ {
+ OnKeyPress (e);
+ }
+
+ private void textbox_ctrl_GotFocus(object sender, EventArgs e )
+ {
+ OnGotFocus(e);
+ }
+
+ private void textbox_ctrl_LostFocus(object sender, EventArgs e )
+ {
+ OnLostFocus(e);
+ }
+
+ // Calcs the text area size
+ internal void CalcTextArea ()
+ {
+ combobox_info.textarea = ClientRectangle;
+
+ /* Edit area */
+ combobox_info.textarea.Height = ItemHeight + ThemeEngine.Current.DrawComboBoxEditDecorationTop () +
+ ThemeEngine.Current.DrawComboBoxEditDecorationBottom () + 2;
+ // TODO: Does the +2 change at different font resolutions?
+
+ /* Edit area - minus decorations (text drawable area) */
+ combobox_info.textarea_drawable = combobox_info.textarea;
+ combobox_info.textarea_drawable.Y += ThemeEngine.Current.DrawComboBoxEditDecorationTop ();
+ combobox_info.textarea_drawable.X += ThemeEngine.Current.DrawComboBoxEditDecorationLeft ();
+ combobox_info.textarea_drawable.Height -= ThemeEngine.Current.DrawComboBoxEditDecorationBottom ();
+ combobox_info.textarea_drawable.Height -= ThemeEngine.Current.DrawComboBoxEditDecorationTop();
+ combobox_info.textarea_drawable.Width -= ThemeEngine.Current.DrawComboBoxEditDecorationRight ();
+ combobox_info.textarea_drawable.Width -= ThemeEngine.Current.DrawComboBoxEditDecorationLeft ();
+
+ /* Non-drawable area */
+ Region area = new Region (ClientRectangle);
+ area.Exclude (combobox_info.textarea);
+ RectangleF bounds = area.GetBounds (DeviceContext);
+ combobox_info.listbox_area = new Rectangle ((int)bounds.X, (int)bounds.Y,
+ (int)bounds.Width, (int)bounds.Height);
+
+ if (CBoxInfo.show_button) {
+ combobox_info.textarea_drawable.Width -= def_button_width;
+
+ combobox_info.button_rect = new Rectangle (combobox_info.textarea_drawable.X + combobox_info.textarea_drawable.Width,
+ combobox_info.textarea_drawable.Y, def_button_width, combobox_info.textarea_drawable.Height);
+
+ }
+
+ if (dropdown_style != ComboBoxStyle.DropDownList) { /* There is an edit control*/
+ if (textbox_ctrl != null) {
+ textbox_ctrl.Location = new Point (combobox_info.textarea_drawable.X, combobox_info.textarea_drawable.Y);
+ textbox_ctrl.Size = new Size (combobox_info.textarea_drawable.Width, combobox_info.textarea_drawable.Height);
+ }
+ }
+
+ if (listbox_ctrl != null && dropdown_style == ComboBoxStyle.Simple) {
+ listbox_ctrl.Location = new Point (combobox_info.textarea.X, combobox_info.textarea.Y +
+ combobox_info.textarea.Height);
+ listbox_ctrl.CalcListBoxArea ();
+ }
+
+ area.Dispose ();
+ }
+
+ private void CreateComboListBox ()
+ {
+ listbox_ctrl = new ComboListBox (this);
+ }
+
+ internal void Draw (Rectangle clip, Graphics dc)
+ {
+ // No edit control, we paint the edit ourselfs
+ if (dropdown_style == ComboBoxStyle.DropDownList) {
+ DrawItemState state = DrawItemState.None;
+ Rectangle item_rect = combobox_info.textarea_drawable;
+ item_rect.Height = ItemHeight + 2;
+
+ if (has_focus == true) {
+ state = DrawItemState.Selected;
+ state |= DrawItemState.Focus;
+ }
+
+ state |= DrawItemState.ComboBoxEdit;
+ OnDrawItem (new DrawItemEventArgs (dc, Font, item_rect,
+ selected_index, state, ForeColor, BackColor));
+ }
+
+ if (DropDownStyle == ComboBoxStyle.Simple && clip.IntersectsWith (combobox_info.listbox_area) == true) {
+ dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (Parent.BackColor),
+ combobox_info.listbox_area);
+ }
+
+ if (CBoxInfo.show_button) {
+ dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (ThemeEngine.Current.ColorControl),
+ combobox_info.button_rect);
+
+ ThemeEngine.Current.CPDrawComboButton (dc,
+ combobox_info.button_rect, combobox_info.button_status);
+ }
+
+ ThemeEngine.Current.DrawComboBoxEditDecorations (dc, this, combobox_info.textarea);
+ }
+
+ internal void DropDownListBox ()
+ {
+ if (DropDownStyle == ComboBoxStyle.Simple)
+ return;
+
+ if (listbox_ctrl == null) {
+ CreateComboListBox ();
+ }
+
+ listbox_ctrl.Location = PointToScreen (new Point (combobox_info.textarea.X, combobox_info.textarea.Y +
+ combobox_info.textarea.Height));
+
+ if (listbox_ctrl.ShowWindow () == true) {
+ CBoxInfo.droppeddown = true;
+ }
+
+ combobox_info.button_status = ButtonState.Pushed;
+ if (dropdown_style == ComboBoxStyle.DropDownList) {
+ Invalidate (combobox_info.textarea_drawable);
+ }
+ }
+
+ internal void DropDownListBoxFinished ()
+ {
+ if (DropDownStyle == ComboBoxStyle.Simple)
+ return;
+
+ combobox_info.button_status = ButtonState.Normal;
+ Invalidate (combobox_info.button_rect);
+ CBoxInfo.droppeddown = false;
+ clicked = false;
+ }
+
+ private int FindStringCaseInsensitive (string search)
+ {
+ if (search.Length == 0) {
+ return -1;
+ }
+
+ for (int i = 0; i < Items.Count; i++)
+ {
+ if (String.Compare (GetItemText (Items[i]), 0, search, 0, search.Length, true) == 0)
+ return i;
+ }
+
+ return -1;
+ }
+
+ private void OnKeyDownCB(object sender, KeyEventArgs e)
+ {
+ switch (e.KeyCode)
+ {
+ case Keys.Up:
+ SelectedIndex = Math.Max(SelectedIndex-1, 0);
+ break;
+
+ case Keys.Down:
+ SelectedIndex = Math.Min(SelectedIndex+1, Items.Count-1);
+ break;
+
+ case Keys.PageUp:
+ if (listbox_ctrl != null)
+ SelectedIndex = Math.Max(SelectedIndex- (listbox_ctrl.page_size-1), 0);
+ break;
+
+ case Keys.PageDown:
+ if (listbox_ctrl != null)
+ SelectedIndex = Math.Min(SelectedIndex+(listbox_ctrl.page_size-1), Items.Count-1);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ internal virtual void OnMouseDownCB (object sender, MouseEventArgs e)
+ {
+ /* Click On button*/
+ Rectangle hit_rect;
+
+ if (dropdown_style == ComboBoxStyle.DropDownList) {
+ hit_rect = combobox_info.textarea;
+ } else {
+ hit_rect = combobox_info.button_rect;
+ }
+
+ if (hit_rect.Contains (e.X, e.Y)) {
+ if (clicked == false) {
+ clicked = true;
+ DropDownListBox ();
+ } else {
+ listbox_ctrl.Hide ();
+ DropDownListBoxFinished ();
+ }
+
+ Invalidate (combobox_info.button_rect);
+ }
+ }
+
+ internal virtual void OnMouseMoveCB (object sender, MouseEventArgs e)
+ {
+ /* When there are no items, act as a regular button */
+ if (clicked == true && Items.Count == 0 &&
+ combobox_info.button_rect.Contains (e.X, e.Y) == false) {
+ DropDownListBoxFinished ();
+ }
+ }
+
+ internal virtual void OnMouseUpCB (object sender, MouseEventArgs e)
+ {
+ /* Click on button*/
+ if (clicked == true && combobox_info.button_rect.Contains (e.X, e.Y)) {
+ DropDownListBoxFinished ();
+ }
+ }
+
+ private void OnPaintCB (PaintEventArgs pevent)
+ {
+ if (Width <= 0 || Height <= 0 || Visible == false || suspend_ctrlupdate == true)
+ return;
+
+ /* Copies memory drawing buffer to screen*/
+ Draw (ClientRectangle, pevent.Graphics);
+
+ if (Paint != null)
+ Paint (this, pevent);
+ }
+
+ private void OnTextChangedEdit (object sender, EventArgs e)
+ {
+ if (process_textchanged_event == false)
+ return;
+
+ int item = FindStringCaseInsensitive (textbox_ctrl.Text);
+
+ if (item == -1)
+ return;
+
+ listbox_ctrl.SetTopItem (item);
+ listbox_ctrl.SetHighLightedItem (Items[item]);
+ }
+
+ internal void SetControlText (string s)
+ {
+ process_textchanged_event = false;
+ textbox_ctrl.Text = s;
+ process_textchanged_event = true;
+ }
+
+ private void UpdatedItems ()
+ {
+ if (listbox_ctrl != null) {
+ listbox_ctrl.UpdateLastVisibleItem ();
+ listbox_ctrl.CalcListBoxArea ();
+ listbox_ctrl.Refresh ();
+ }
+ }
+
+ #endregion Private Methods
+
+
+ /*
+ ComboBox.ObjectCollection
+ */
+ [ListBindableAttribute (false)]
+ public class ObjectCollection : IList, ICollection, IEnumerable
+ {
+
+ private ComboBox owner;
+ internal ArrayList object_items = new ArrayList ();
+ internal ArrayList combobox_items = new ArrayList ();
+
+ public ObjectCollection (ComboBox owner)
+ {
+ this.owner = owner;
+ }
+
+ #region Public Properties
+ public virtual int Count {
+ get { return object_items.Count; }
+ }
+
+ public virtual bool IsReadOnly {
+ get { return false; }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public virtual object this [int index] {
+ get {
+ if (index < 0 || index >= Count)
+ throw new ArgumentOutOfRangeException ("Index of out range");
+
+ return object_items[index];
+ }
+ set {
+ if (index < 0 || index >= Count)
+ throw new ArgumentOutOfRangeException ("Index of out range");
+
+ object_items[index] = value;
+ }
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return false; }
+ }
+
+ object ICollection.SyncRoot {
+ get { return this; }
+ }
+
+ bool IList.IsFixedSize {
+ get { return false; }
+ }
+
+ #endregion Public Properties
+
+ #region Private Properties
+ internal ArrayList ObjectItems {
+ get { return object_items;}
+ set {
+ object_items = value;
+ }
+ }
+
+ internal ArrayList ListBoxItems {
+ get { return combobox_items;}
+ set {
+ combobox_items = value;
+ }
+ }
+ #endregion Private Properties
+
+ #region Public Methods
+ public int Add (object item)
+ {
+ int idx;
+
+ idx = AddItem (item);
+ owner.UpdatedItems ();
+ return idx;
+ }
+
+ public void AddRange (object[] items)
+ {
+ foreach (object mi in items)
+ AddItem (mi);
+
+ owner.UpdatedItems ();
+ }
+
+ public virtual void Clear ()
+ {
+ owner.selected_index = -1;
+ object_items.Clear ();
+ combobox_items.Clear ();
+ owner.UpdatedItems ();
+ owner.Refresh ();
+ }
+
+ public virtual bool Contains (object obj)
+ {
+ return object_items.Contains (obj);
+ }
+
+ public void CopyTo (object[] dest, int arrayIndex)
+ {
+ object_items.CopyTo (dest, arrayIndex);
+ }
+
+ void ICollection.CopyTo (Array dest, int index)
+ {
+ object_items.CopyTo (dest, index);
+ }
+
+ public virtual IEnumerator GetEnumerator ()
+ {
+ return object_items.GetEnumerator ();
+ }
+
+ int IList.Add (object item)
+ {
+ return Add (item);
+ }
+
+ public virtual int IndexOf (object value)
+ {
+ return object_items.IndexOf (value);
+ }
+
+ public virtual void Insert (int index, object item)
+ {
+ if (index < 0 || index > Count)
+ throw new ArgumentOutOfRangeException ("Index of out range");
+
+ ObjectCollection new_items = new ObjectCollection (owner);
+ object sel_item = owner.SelectedItem;
+
+ owner.BeginUpdate ();
+
+ for (int i = 0; i < index; i++) {
+ new_items.AddItem (ObjectItems[i]);
+ }
+
+ new_items.AddItem (item);
+
+ for (int i = index; i < Count; i++){
+ new_items.AddItem (ObjectItems[i]);
+ }
+
+ ObjectItems = new_items.ObjectItems;
+ ListBoxItems = new_items.ListBoxItems;
+
+ if (sel_item != null) {
+ int idx = IndexOf (sel_item);
+ owner.selected_index = idx;
+ owner.listbox_ctrl.SetHighLightedItem (owner.Items[idx]);
+ }
+
+ owner.EndUpdate (); // Calls UpdatedItems
+ }
+
+ public virtual void Remove (object value)
+ {
+ if (IndexOf (value) == owner.SelectedIndex)
+ owner.SelectedItem = null;
+
+ RemoveAt (IndexOf (value));
+
+ }
+
+ public virtual void RemoveAt (int index)
+ {
+ if (index < 0 || index >= Count)
+ throw new ArgumentOutOfRangeException ("Index of out range");
+
+ if (index == owner.SelectedIndex)
+ owner.SelectedItem = null;
+
+ object_items.RemoveAt (index);
+ combobox_items.RemoveAt (index);
+ owner.UpdatedItems ();
+ }
+ #endregion Public Methods
+
+ #region Private Methods
+ private int AddItem (object item)
+ {
+ int cnt = object_items.Count;
+ object_items.Add (item);
+ combobox_items.Add (new ComboBox.ComboBoxItem (cnt));
+ return cnt;
+ }
+
+ internal void AddRange (IList items)
+ {
+ foreach (object mi in items)
+ AddItem (mi);
+
+ owner.UpdatedItems ();
+ }
+
+ internal ComboBox.ComboBoxItem GetComboBoxItem (int index)
+ {
+ if (index < 0 || index >= Count)
+ throw new ArgumentOutOfRangeException ("Index of out range");
+
+ return (ComboBox.ComboBoxItem) combobox_items[index];
+ }
+
+ internal void SetComboBoxItem (ComboBox.ComboBoxItem item, int index)
+ {
+ if (index < 0 || index >= Count)
+ throw new ArgumentOutOfRangeException ("Index of out range");
+
+ combobox_items[index] = item;
+ }
+
+ #endregion Private Methods
+ }
+
+ /*
+ class ComboListBox
+ */
+ internal class ComboListBox : Control
+ {
+ private ComboBox owner;
+ private VScrollBarLB vscrollbar_ctrl;
+ private int top_item; /* First item that we show the in the current page */
+ private int last_item; /* Last visible item */
+ public object highlighted_item; /* Item that is currently selected */
+ internal int page_size; /* Number of listbox items per page */
+ private Rectangle textarea_drawable; /* Rectangle of the drawable text area */
+
+ internal enum ItemNavigation
+ {
+ First,
+ Last,
+ Next,
+ Previous,
+ NextPage,
+ PreviousPage,
+ }
+
+ class VScrollBarLB : VScrollBar
+ {
+ public VScrollBarLB ()
+ {
+ }
+
+ public void FireMouseDown (MouseEventArgs e)
+ {
+ OnMouseDown (e);
+ }
+
+ public void FireMouseUp (MouseEventArgs e)
+ {
+ OnMouseUp (e);
+ }
+
+ public void FireMouseMove (MouseEventArgs e)
+ {
+ OnMouseMove (e);
+ }
+
+ }
+
+ public ComboListBox (ComboBox owner) : base ()
+ {
+ this.owner = owner;
+ top_item = 0;
+ last_item = 0;
+ page_size = 0;
+ highlighted_item = null;
+
+ MouseDown += new MouseEventHandler (OnMouseDownPUW);
+ MouseUp += new MouseEventHandler (OnMouseUpPUW);
+ MouseMove += new MouseEventHandler (OnMouseMovePUW);
+ KeyDown += new KeyEventHandler (OnKeyDownPUW);
+ Paint += new PaintEventHandler (OnPaintPUW);
+ SetStyle (ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
+ SetStyle (ControlStyles.ResizeRedraw | ControlStyles.Opaque, true);
+ }
+
+ protected override CreateParams CreateParams
+ {
+ get {
+ CreateParams cp = base.CreateParams;
+ if (owner != null && owner.DropDownStyle != ComboBoxStyle.Simple) {
+ cp.Style = unchecked ((int)(WindowStyles.WS_POPUP | WindowStyles.WS_VISIBLE | WindowStyles.WS_CLIPSIBLINGS | WindowStyles.WS_CLIPCHILDREN));
+ cp.ExStyle |= (int)(WindowStyles.WS_EX_TOOLWINDOW | WindowStyles.WS_EX_TOPMOST);
+ }
+ return cp;
+ }
+ }
+
+ #region Private Methods
+ // Calcs the listbox area
+ internal void CalcListBoxArea ()
+ {
+ int width, height;
+ int item_height = owner.ItemHeight;
+ bool show_scrollbar = false;
+
+ if (owner.DropDownStyle == ComboBoxStyle.Simple) {
+ width = owner.CBoxInfo.listbox_area.Width;
+ height = owner.CBoxInfo.listbox_area.Height;
+
+ if (owner.IntegralHeight == true) {
+ int remaining = (height -
+ ThemeEngine.Current.DrawComboListBoxDecorationBottom (owner.DropDownStyle) -
+ ThemeEngine.Current.DrawComboListBoxDecorationTop (owner.DropDownStyle)) %
+ (item_height - 2);
+
+ if (remaining > 0) {
+ height -= remaining;
+ }
+ }
+ }
+ else { // DropDown or DropDownList
+
+ width = owner.DropDownWidth;
+ int count = (owner.Items.Count <= owner.MaxDropDownItems) ? owner.Items.Count : owner.MaxDropDownItems;
+
+ if (owner.DrawMode == DrawMode.OwnerDrawVariable) {
+ height = 0;
+ for (int i = 0; i < count; i++) {
+ height += owner.GetItemHeight (i);
+ }
+
+ } else {
+ height = (item_height - 2) * count;
+ }
+
+
+ height += ThemeEngine.Current.DrawComboListBoxDecorationBottom (owner.DropDownStyle);
+ height += ThemeEngine.Current.DrawComboListBoxDecorationTop (owner.DropDownStyle);
+ }
+
+ if (owner.Items.Count <= owner.MaxDropDownItems) {
+
+ /* Does not need vertical scrollbar*/
+ if (vscrollbar_ctrl != null) {
+ vscrollbar_ctrl.Visible = false;
+ }
+ }
+ else {
+ /* Need vertical scrollbar */
+ if (vscrollbar_ctrl == null) {
+ vscrollbar_ctrl = new VScrollBarLB ();
+ vscrollbar_ctrl.Minimum = 0;
+ vscrollbar_ctrl.SmallChange = 1;
+ vscrollbar_ctrl.LargeChange = 1;
+ vscrollbar_ctrl.Maximum = 0;
+ vscrollbar_ctrl.ValueChanged += new EventHandler (VerticalScrollEvent);
+
+ Controls.AddImplicit (vscrollbar_ctrl);
+ }
+
+ vscrollbar_ctrl.Height = height - ThemeEngine.Current.DrawComboListBoxDecorationBottom (owner.DropDownStyle) -
+ ThemeEngine.Current.DrawComboListBoxDecorationTop (owner.DropDownStyle);
+
+ vscrollbar_ctrl.Location = new Point (width - vscrollbar_ctrl.Width - ThemeEngine.Current.DrawComboListBoxDecorationRight (owner.DropDownStyle),
+ ThemeEngine.Current.DrawComboListBoxDecorationTop (owner.DropDownStyle));
+
+ vscrollbar_ctrl.Maximum = owner.Items.Count - (owner.DropDownStyle == ComboBoxStyle.Simple ? page_size : owner.maxdrop_items);
+ show_scrollbar = vscrollbar_ctrl.Visible = true;
+
+ int hli = GetHighLightedIndex ();
+ if (hli > 0)
+ vscrollbar_ctrl.Value = hli;
+ }
+
+ Size = new Size (width, height);
+ textarea_drawable = ClientRectangle;
+ textarea_drawable.Width = width;
+ textarea_drawable.Height = height;
+
+ // Exclude decorations
+ textarea_drawable.X += ThemeEngine.Current.DrawComboListBoxDecorationLeft (owner.DropDownStyle);
+ textarea_drawable.Y += ThemeEngine.Current.DrawComboListBoxDecorationTop (owner.DropDownStyle);
+ textarea_drawable.Width -= ThemeEngine.Current.DrawComboListBoxDecorationRight (owner.DropDownStyle);
+ textarea_drawable.Width -= ThemeEngine.Current.DrawComboListBoxDecorationLeft (owner.DropDownStyle);
+ textarea_drawable.Height -= ThemeEngine.Current.DrawComboListBoxDecorationBottom (owner.DropDownStyle);
+ textarea_drawable.Height -= ThemeEngine.Current.DrawComboListBoxDecorationTop (owner.DropDownStyle);
+
+ if (vscrollbar_ctrl != null && show_scrollbar)
+ textarea_drawable.Width -= vscrollbar_ctrl.Width;
+
+ last_item = LastVisibleItem ();
+ page_size = textarea_drawable.Height / (item_height - 2);
+ }
+
+ private void Draw (Rectangle clip, Graphics dc)
+ {
+ dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush
+ (owner.BackColor), clip);
+
+ if (owner.Items.Count > 0) {
+ Rectangle item_rect;
+ DrawItemState state = DrawItemState.None;
+
+ for (int i = top_item; i <= last_item; i++) {
+ item_rect = GetItemDisplayRectangle (i, top_item);
+
+ if (clip.IntersectsWith (item_rect) == false)
+ continue;
+
+ /* Draw item */
+ state = DrawItemState.None;
+
+ if (i == GetHighLightedIndex () ) {
+ state |= DrawItemState.Selected;
+
+ if (owner.DropDownStyle == ComboBoxStyle.DropDownList) {
+ state |= DrawItemState.Focus;
+ }
+ }
+
+ owner.OnDrawItem (new DrawItemEventArgs (dc, owner.Font, item_rect,
+ i, state, owner.ForeColor, owner.BackColor));
+ }
+ }
+
+ ThemeEngine.Current.DrawComboListBoxDecorations (dc, owner, ClientRectangle);
+ }
+
+ public int GetHighLightedIndex ()
+ {
+ return owner.Items.IndexOf (highlighted_item);
+ }
+
+ public object GetHighLightedItem ()
+ {
+ return highlighted_item;
+ }
+
+ private Rectangle GetItemDisplayRectangle (int index, int first_displayble)
+ {
+ if (index < 0 || index >= owner.Items.Count)
+ throw new ArgumentOutOfRangeException ("GetItemRectangle index out of range.");
+
+ Rectangle item_rect = new Rectangle ();
+ int height = owner.GetItemHeight (index);
+
+ item_rect.X = ThemeEngine.Current.DrawComboListBoxDecorationRight (owner.DropDownStyle);
+ item_rect.Width = textarea_drawable.Width;
+ item_rect.Y = ((height - 2) * (index - first_displayble));
+
+ if (owner.dropdown_style == ComboBoxStyle.Simple)
+ item_rect.Y += 2;
+
+ item_rect.Height = height;
+ return item_rect;
+ }
+
+ public void HideWindow ()
+ {
+ if (owner.DropDownStyle == ComboBoxStyle.Simple)
+ return;
+
+ Capture = false;
+ Hide ();
+ highlighted_item = -1;
+ owner.DropDownListBoxFinished ();
+ }
+
+ private int IndexFromPointDisplayRectangle (int x, int y)
+ {
+ for (int i = top_item; i <= last_item; i++) {
+ if (GetItemDisplayRectangle (i, top_item).Contains (x, y) == true)
+ return i;
+ }
+
+ return -1;
+ }
+
+ protected override bool IsInputKey (Keys keyData)
+ {
+ return owner.IsInputKey (keyData);
+ }
+
+ private int LastVisibleItem ()
+ {
+ Rectangle item_rect;
+ int top_y = textarea_drawable.Y + textarea_drawable.Height;
+ int i = 0;
+
+ for (i = top_item; i < owner.Items.Count; i++) {
+ item_rect = GetItemDisplayRectangle (i, top_item);
+ if (item_rect.Y + item_rect.Height > top_y) {
+ return i;
+ }
+ }
+ return i - 1;
+ }
+
+ private void NavigateItemVisually (ItemNavigation navigation)
+ {
+ int item = -1;
+
+ switch (navigation) {
+ case ItemNavigation.Next: {
+ if (GetHighLightedIndex () + 1 < owner.Items.Count) {
+
+ if (GetHighLightedIndex () + 1 > last_item) {
+ top_item++;
+ vscrollbar_ctrl.Value = top_item;
+ }
+ item = GetHighLightedIndex () + 1;
+ }
+ break;
+ }
+
+ case ItemNavigation.Previous: {
+ if (GetHighLightedIndex () > 0) {
+
+ if (GetHighLightedIndex () - 1 < top_item) {
+ top_item--;
+ vscrollbar_ctrl.Value = top_item;
+ }
+ item = GetHighLightedIndex () - 1;
+ }
+ break;
+ }
+
+ case ItemNavigation.NextPage: {
+ if (GetHighLightedIndex () + page_size - 1 >= owner.Items.Count) {
+ top_item = owner.Items.Count - page_size;
+ vscrollbar_ctrl.Value = top_item;
+ item = owner.Items.Count - 1;
+ }
+ else {
+ if (GetHighLightedIndex () + page_size - 1 > last_item) {
+ top_item = GetHighLightedIndex ();
+ vscrollbar_ctrl.Value = GetHighLightedIndex ();
+ }
+
+ item = GetHighLightedIndex () + page_size - 1;
+ }
+ break;
+ }
+
+ case ItemNavigation.PreviousPage: {
+
+ /* Go to the first item*/
+ if (GetHighLightedIndex () - (page_size - 1) <= 0) {
+
+ top_item = 0;
+ vscrollbar_ctrl.Value = top_item;
+ item = 0;
+ }
+ else { /* One page back */
+ if (GetHighLightedIndex () - (page_size - 1) < top_item) {
+ top_item = GetHighLightedIndex () - (page_size - 1);
+ vscrollbar_ctrl.Value = top_item;
+ }
+
+ item = GetHighLightedIndex () - (page_size - 1);
+ }
+
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ if (item != -1) {
+ SetHighLightedItem (owner.Items[item]);
+
+ owner.OnSelectionChangeCommitted (new EventArgs ());
+
+ if (owner.DropDownStyle == ComboBoxStyle.Simple) {
+ owner.SetControlText (owner.GetItemText (owner.Items[item]));
+ }
+ }
+ }
+
+ private void OnKeyDownPUW (object sender, KeyEventArgs e)
+ {
+ switch (e.KeyCode) {
+ case Keys.Up:
+ NavigateItemVisually (ItemNavigation.Previous);
+ break;
+
+ case Keys.Down:
+ NavigateItemVisually (ItemNavigation.Next);
+ break;
+
+ case Keys.PageUp:
+ NavigateItemVisually (ItemNavigation.PreviousPage);
+ break;
+
+ case Keys.PageDown:
+ NavigateItemVisually (ItemNavigation.NextPage);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ public void SetHighLightedItem (object item)
+ {
+ Rectangle invalidate = Rectangle.Empty;
+ int hli;
+
+ if (GetHighLightedItem () == item)
+ return;
+
+ /* Previous item */
+ hli = GetHighLightedIndex ();
+ if (hli != -1) {
+ invalidate = GetItemDisplayRectangle (hli, top_item);
+ }
+
+ highlighted_item = item;
+
+ if (highlighted_item != null) {
+ /* Current item */
+ invalidate = Rectangle.Union (invalidate,
+ GetItemDisplayRectangle (GetHighLightedIndex (), top_item));
+
+ }
+
+ if (ClientRectangle.IntersectsWith (invalidate))
+ Invalidate (invalidate);
+ }
+
+ public void SetTopItem (int item)
+ {
+ top_item = item;
+ UpdateLastVisibleItem ();
+ Refresh ();
+ }
+
+ private void OnMouseDownPUW (object sender, MouseEventArgs e)
+ {
+ Rectangle scrollbar_screenrect;
+ Point mouse_screen, scrollbar_screen;
+ mouse_screen = PointToScreen (new Point (e.X, e.Y));
+
+ /* Click on an element ? */
+ int index = IndexFromPointDisplayRectangle (e.X, e.Y);
+ if (index != -1) {
+ owner.SelectedIndex = index;
+ SetHighLightedItem (owner.Items[index]);
+ owner.OnSelectionChangeCommitted (new EventArgs ());
+ HideWindow ();
+ return;
+ }
+
+ if (owner.DropDownStyle == ComboBoxStyle.Simple)
+ return;
+
+ /* Reroute event to scrollbar */
+ if (vscrollbar_ctrl != null && vscrollbar_ctrl.Visible == true) {
+ scrollbar_screenrect = vscrollbar_ctrl.ClientRectangle;
+ scrollbar_screen = PointToScreen (vscrollbar_ctrl.Location);
+ scrollbar_screenrect.X = scrollbar_screen.X;
+ scrollbar_screenrect.Y = scrollbar_screen.Y;
+
+ if (scrollbar_screenrect.Contains (mouse_screen)){
+ Point pnt_client = vscrollbar_ctrl.PointToClient (mouse_screen);
+ vscrollbar_ctrl.FireMouseDown (new MouseEventArgs (e.Button, e.Clicks,
+ pnt_client.X, pnt_client.Y, e.Delta));
+ } else { /* Click in a non-client area*/
+ HideWindow ();
+ }
+ } else { /* Click in a non-client area*/
+ HideWindow ();
+ }
+ }
+
+ private void OnMouseMovePUW (object sender, MouseEventArgs e)
+ {
+ if (owner.DropDownStyle == ComboBoxStyle.Simple)
+ return;
+
+ int index = IndexFromPointDisplayRectangle (e.X, e.Y);
+
+ if (index != -1) {
+ SetHighLightedItem (owner.Items[index]);
+ return;
+ }
+
+ if (owner.DropDownStyle == ComboBoxStyle.Simple)
+ return;
+
+ /* Reroute event to scrollbar */
+ if (vscrollbar_ctrl != null && vscrollbar_ctrl.Visible == true) {
+ Rectangle scrollbar_screenrect;
+ Point mouse_screen, scrollbar_screen;
+ mouse_screen = PointToScreen (new Point (e.X, e.Y));
+
+ scrollbar_screenrect = vscrollbar_ctrl.ClientRectangle;
+ scrollbar_screen = PointToScreen (vscrollbar_ctrl.Location);
+ scrollbar_screenrect.X = scrollbar_screen.X;
+ scrollbar_screenrect.Y = scrollbar_screen.Y;
+
+ if (scrollbar_screenrect.Contains (mouse_screen)){
+ Point pnt_client = vscrollbar_ctrl.PointToClient (mouse_screen);
+
+ vscrollbar_ctrl.FireMouseMove (new MouseEventArgs (e.Button, e.Clicks,
+ pnt_client.X, pnt_client.Y, e.Delta));
+ }
+ }
+ }
+
+ private void OnMouseUpPUW (object sender, MouseEventArgs e)
+ {
+ if (owner.DropDownStyle == ComboBoxStyle.Simple)
+ return;
+
+ /* Reroute event to scrollbar */
+ Rectangle scrollbar_screenrect;
+ Point mouse_screen, scrollbar_screen;
+ mouse_screen = PointToScreen (new Point (e.X, e.Y));
+
+ if (vscrollbar_ctrl != null && vscrollbar_ctrl.Visible == true) {
+ scrollbar_screenrect = vscrollbar_ctrl.ClientRectangle;
+ scrollbar_screen = PointToScreen (vscrollbar_ctrl.Location);
+ scrollbar_screenrect.X = scrollbar_screen.X;
+ scrollbar_screenrect.Y = scrollbar_screen.Y;
+
+ if (scrollbar_screenrect.Contains (mouse_screen)){
+ Point pnt_client = vscrollbar_ctrl.PointToClient (mouse_screen);
+
+ vscrollbar_ctrl.FireMouseUp (new MouseEventArgs (e.Button, e.Clicks,
+ pnt_client.X, pnt_client.Y, e.Delta));
+ }
+ }
+ }
+
+ private void OnPaintPUW (Object o, PaintEventArgs pevent)
+ {
+ Draw (pevent.ClipRectangle,pevent.Graphics);
+ }
+
+ public bool ShowWindow ()
+ {
+ if (owner.DropDownStyle != ComboBoxStyle.Simple && owner.Items.Count == 0)
+ return false;
+
+ SetHighLightedItem (owner.SelectedItem);
+ int index = GetHighLightedIndex ();
+ top_item = (index == -1 ? 0 : index );
+
+ CalcListBoxArea ();
+ Show ();
+
+ if (owner.DropDownStyle != ComboBoxStyle.Simple) {
+ Capture = true;
+ }
+
+ Refresh ();
+
+ if (owner.DropDown != null) {
+ owner.DropDown (owner, EventArgs.Empty);
+ }
+
+ return true;
+ }
+
+ public void UpdateLastVisibleItem ()
+ {
+ last_item = LastVisibleItem ();
+ }
+
+ // Value Changed
+ private void VerticalScrollEvent (object sender, EventArgs e)
+ {
+ if (top_item == vscrollbar_ctrl.Value)
+ return;
+
+ top_item = vscrollbar_ctrl.Value;
+ UpdateLastVisibleItem ();
+ Refresh ();
+ }
+
+ #endregion Private Methods
+ }
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBoxStyle.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBoxStyle.cs
new file mode 100644
index 00000000000..d2c576bd751
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBoxStyle.cs
@@ -0,0 +1,37 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ public enum ComboBoxStyle
+ {
+ Simple = 0,
+ DropDown = 1,
+ DropDownList = 2,
+
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CommonDialog.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CommonDialog.cs
new file mode 100644
index 00000000000..dd201b049a4
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CommonDialog.cs
@@ -0,0 +1,142 @@
+// 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:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// NOT COMPLETE
+
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+ [ToolboxItemFilter("System.Windows.Forms")]
+ public abstract class CommonDialog : System.ComponentModel.Component {
+ #region DialogForm
+ internal class DialogForm : Form {
+ #region DialogForm Local Variables
+ protected CommonDialog owner;
+ #endregion DialogForm Local Variables
+
+ #region DialogForm Constructors
+ internal DialogForm(CommonDialog owner) {
+ this.owner = owner;
+ }
+ #endregion DialogForm Constructors
+
+ #region Protected Instance Properties
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams cp;
+
+ ControlBox = true;
+ MinimizeBox = false;
+ MaximizeBox = false;
+
+ cp = base.CreateParams;
+
+ cp.Style = (int)(WindowStyles.WS_POPUP | WindowStyles.WS_CAPTION | WindowStyles.WS_SYSMENU | WindowStyles.WS_CLIPCHILDREN | WindowStyles.WS_CLIPSIBLINGS);
+ if (!is_enabled) {
+ cp.Style |= (int)(WindowStyles.WS_DISABLED);
+ }
+
+ return cp;
+ }
+ }
+ #endregion // Protected Instance Properties
+
+ #region Internal Methods
+ internal DialogResult RunDialog () {
+ this.StartPosition = FormStartPosition.CenterScreen;
+
+ owner.InitFormsSize (this);
+
+ this.ShowDialog ();
+
+ return this.DialogResult;
+
+ }
+ #endregion Internal Methods
+ }
+ #endregion DialogForm
+
+ #region Local Variables
+ internal DialogForm form;
+ #endregion Local Variables
+
+ #region Public Constructors
+ public CommonDialog() {
+ form = new DialogForm(this);
+ }
+ #endregion Public Constructors
+
+ #region Internal Methods
+ internal virtual void InitFormsSize(Form form) {
+ // Override this to set a default size for the form
+ form.Width = 200;
+ form.Height = 200;
+ }
+ #endregion Internal Methods
+
+ #region Public Instance Methods
+ public abstract void Reset();
+
+ public DialogResult ShowDialog() {
+ return ShowDialog(null);
+ }
+
+ public DialogResult ShowDialog(IWin32Window ownerWin32) {
+ DialogResult result;
+
+ // Prep the dialog
+ RunDialog(form.Handle);
+
+ // Run
+ result = form.ShowDialog(ownerWin32);
+
+ return form.DialogResult;
+ }
+ #endregion // Public Instance Methods
+
+ #region Protected Instance Methods
+ protected virtual IntPtr HookProc(IntPtr hWnd, int msg, IntPtr wparam, IntPtr lparam) {
+ return IntPtr.Zero;
+ }
+
+ protected virtual void OnHelpRequest(EventArgs e) {
+ if (HelpRequest != null) {
+ HelpRequest(this, e);
+ }
+ }
+
+ protected virtual IntPtr OwnerWndProc(IntPtr hWnd, int msg, IntPtr wparam, IntPtr lparam) {
+ return IntPtr.Zero;
+ }
+
+ protected abstract bool RunDialog(IntPtr hwndOwner);
+ #endregion // Protected Instance Methods
+
+ #region Events
+ public event EventHandler HelpRequest;
+ #endregion // Events
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComponentModel.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComponentModel.cs
new file mode 100644
index 00000000000..4db46afe02c
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComponentModel.cs
@@ -0,0 +1,54 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+// NOT COMPLETE
+
+using System;
+using System.ComponentModel.Design;
+
+namespace System.Windows.Forms.ComponentModel.Com2Interop {
+ public class Com2Variant {
+ public Com2Variant() {
+ throw new NotImplementedException();
+ }
+ }
+
+ public interface ICom2PropertyPageDisplayService {
+ void ShowPropertyPage(string title, object component, int dispid, Guid pageGuid, IntPtr parentHandle);
+ }
+
+ public interface IComPropertyBrowser {
+ bool InPropertySet {
+ get ;
+ }
+ void DropDownDone();
+ bool EnsurePendingChangesCommitted();
+ void HandleF4();
+ void LoadState(Microsoft.Win32.RegistryKey key);
+ void SaveState(Microsoft.Win32.RegistryKey key);
+ event ComponentRenameEventHandler ComComponentNameChanged;
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ContainerControl.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ContainerControl.cs
new file mode 100644
index 00000000000..5d484aa6bf3
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ContainerControl.cs
@@ -0,0 +1,259 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+
+// NOT COMPLETE
+
+using System.ComponentModel;
+using System.ComponentModel.Design;
+
+namespace System.Windows.Forms {
+ public class ContainerControl : ScrollableControl, IContainerControl {
+ private Control active_control;
+ private Control focused_control;
+ private Control unvalidated_control;
+
+ #region Public Constructors
+ public ContainerControl() {
+ active_control = null;
+ focused_control = null;
+ unvalidated_control = null;
+ ControlRemoved += new ControlEventHandler(OnControlRemoved);
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ [Browsable (false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public Control ActiveControl {
+ get {
+ return active_control;
+ }
+
+ set {
+ if ((active_control==value) || (value==null)) {
+ return;
+ }
+
+ active_control = value;
+
+ if (!Contains(value) && this != value) {
+ throw new ArgumentException("Not a child control");
+ }
+
+ // Scroll control into view
+
+ // Let the control know it's selected
+ Select(value);
+ }
+ }
+
+ [Browsable (false)]
+ public override BindingContext BindingContext {
+ get {
+ if (base.BindingContext == null) {
+ base.BindingContext = new BindingContext();
+ }
+ return base.BindingContext;
+ }
+
+ set {
+ base.BindingContext = value;
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public Form ParentForm {
+ get {
+ Control parent;
+
+ parent = this.parent;
+
+ while (parent != null) {
+ if (parent is Form) {
+ return (Form)parent;
+ }
+ parent = parent.parent;
+ }
+
+ return null;
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Protected Instance Methods
+ protected override CreateParams CreateParams {
+ get {
+ return base.CreateParams;
+ }
+ }
+ #endregion // Public Instance Methods
+
+ #region Public Instance Methods
+ [MonoTODO]
+ static bool ValidateWarned;
+ public bool Validate() {
+ //throw new NotImplementedException();
+ if (!ValidateWarned) {
+ Console.WriteLine("ContainerControl.Validate is not yet implemented");
+ ValidateWarned = true;
+ }
+ return true;
+ }
+
+ bool IContainerControl.ActivateControl(Control control) {
+ return Select(control);
+ }
+ #endregion // Public Instance Methods
+
+ #region Protected Instance Methods
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ protected override void AdjustFormScrollbars(bool displayScrollbars) {
+ base.AdjustFormScrollbars(displayScrollbars);
+ }
+
+ protected override void Dispose(bool disposing) {
+ base.Dispose(disposing);
+ }
+
+ // LAMESPEC This used to be documented, but it's not in code
+ // and no longer listed in MSDN2
+ // [EditorBrowsable (EditorBrowsableState.Advanced)]
+ // protected override void OnControlRemoved(ControlEventArgs e) {
+ private void OnControlRemoved(object sender, ControlEventArgs e) {
+ if (e.Control == this.unvalidated_control) {
+ this.unvalidated_control = null;
+ }
+
+ if (e.Control == this.active_control) {
+ this.unvalidated_control = null;
+ }
+
+ // base.OnControlRemoved(e);
+ }
+
+ protected override void OnCreateControl() {
+ base.OnCreateControl();
+ // MS seems to call this here, it gets the whole databinding process started
+ OnBindingContextChanged (EventArgs.Empty);
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ protected override bool ProcessDialogChar(char charCode) {
+ if (GetTopLevel()) {
+ if (ProcessMnemonic(charCode)) {
+ return true;
+ }
+ }
+ return base.ProcessDialogChar(charCode);
+ }
+
+ protected override bool ProcessDialogKey(Keys keyData) {
+ Keys key;
+ bool forward;
+
+ key = keyData & Keys.KeyCode;
+ forward = true;
+
+ switch (key) {
+ case Keys.Tab: {
+ if (ProcessTabKey((Control.ModifierKeys & Keys.Shift) == 0)) {
+ return true;
+ }
+ break;
+ }
+
+ case Keys.Left: {
+ forward = false;
+ goto case Keys.Down;
+ }
+
+ case Keys.Up: {
+ forward = false;
+ goto case Keys.Down;
+ }
+
+ case Keys.Right: {
+ goto case Keys.Down;
+ }
+ case Keys.Down: {
+ if (SelectNextControl(active_control, forward, false, false, true)) {
+ return true;
+ }
+ break;
+ }
+
+
+ }
+ return base.ProcessDialogKey(keyData);
+ }
+
+ protected override bool ProcessMnemonic(char charCode) {
+ bool wrapped;
+ Control c;
+
+ wrapped = false;
+ c = active_control;
+
+ do {
+ c = GetNextControl(c, true);
+ if (c != null) {
+ // This is stupid. I want to be able to call c.ProcessMnemonic directly
+ if (c.ProcessControlMnemonic(charCode)) {
+ return(true);
+ }
+ continue;
+ } else {
+ if (wrapped) {
+ break;
+ }
+ wrapped = true;
+ }
+ } while (c != active_control);
+
+ return false;
+ }
+
+ protected virtual bool ProcessTabKey(bool forward) {
+ return SelectNextControl(active_control, forward, true, true, true);
+ }
+
+ protected override void Select(bool directed, bool forward) {
+ base.Select(directed, forward);
+ }
+
+ protected virtual void UpdateDefaultButton() {
+ // MS Internal
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ protected override void WndProc(ref Message m) {
+ base.WndProc(ref m);
+ }
+ #endregion // Protected Instance Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ContentsResizedEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ContentsResizedEventArgs.cs
new file mode 100644
index 00000000000..765276f6cda
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ContentsResizedEventArgs.cs
@@ -0,0 +1,51 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+using System.Drawing;
+
+namespace System.Windows.Forms {
+ public class ContentsResizedEventArgs : EventArgs {
+ #region Local Variables
+ Rectangle rect;
+ #endregion // Local Variables
+
+ #region Public Constructors
+ public ContentsResizedEventArgs(Rectangle newRectangle) {
+ rect = newRectangle;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public Rectangle NewRectangle {
+ get {
+ return rect;
+ }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ContentsResizedEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ContentsResizedEventHandler.cs
new file mode 100644
index 00000000000..6a9f6d840a0
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ContentsResizedEventHandler.cs
@@ -0,0 +1,31 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public delegate void ContentsResizedEventHandler(object sender, ContentsResizedEventArgs e);
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ContextMenu.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ContextMenu.cs
new file mode 100644
index 00000000000..84ae092b4ac
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ContextMenu.cs
@@ -0,0 +1,97 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+//
+
+
+// COMPLETE
+
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Drawing;
+
+namespace System.Windows.Forms
+{
+ [DefaultEvent("Popup")]
+ public class ContextMenu : Menu
+ {
+ private RightToLeft right_to_left;
+ private Control src_control;
+
+ #region Events
+ public event EventHandler Popup;
+ #endregion Events
+
+ public ContextMenu () : base (null)
+ {
+ right_to_left = RightToLeft.Inherit;
+ }
+
+ public ContextMenu (MenuItem[] items) : base (items)
+ {
+ right_to_left = RightToLeft.Inherit;
+ }
+
+ #region Public Properties
+ [Localizable(true)]
+ public virtual RightToLeft RightToLeft {
+ get { return right_to_left; }
+ set { right_to_left = value; }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public Control SourceControl {
+ get { return src_control; }
+ }
+
+ #endregion Public Properties
+
+ #region Public Methods
+
+ protected internal virtual void OnPopup (EventArgs e)
+ {
+ if (Popup != null)
+ Popup (this, e);
+ }
+
+ public void Show (Control control, Point pos)
+ {
+ if (control == null)
+ throw new ArgumentException ();
+
+ src_control = control;
+
+ OnPopup (EventArgs.Empty);
+ MenuTracker.TrackPopupMenu (this, Control.MousePosition);
+ }
+
+ #endregion Public Methods
+
+
+ }
+}
+
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
new file mode 100644
index 00000000000..deeade6c1a4
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
@@ -0,0 +1,4412 @@
+// 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.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+// Partially based on work by:
+// Aleksey Ryabchuk ryabchuk@yahoo.com
+// Alexandre Pigolkine pigolkine@gmx.de
+// Dennis Hayes dennish@raytek.com
+// Jaak Simm jaaksimm@firm.ee
+// John Sohn jsohn@columbus.rr.com
+//
+
+// COMPLETE
+
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.ComponentModel.Design.Serialization;
+using System.Collections;
+using System.Diagnostics;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Security;
+using System.Threading;
+
+
+namespace System.Windows.Forms
+{
+ [Designer("System.Windows.Forms.Design.ControlDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+ [DefaultProperty("Text")]
+ [DefaultEvent("Click")]
+ [DesignerSerializer("System.Windows.Forms.Design.ControlCodeDomSerializer, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.Serialization.CodeDomSerializer, " + Consts.AssemblySystem_Design)]
+ [ToolboxItemFilter("System.Windows.Forms")]
+ public class Control : Component, ISynchronizeInvoke, IWin32Window
+ {
+ #region Local Variables
+
+ // Basic
+ internal Rectangle bounds; // bounding rectangle for control (client area + decorations)
+ internal object creator_thread; // thread that created the control
+ internal ControlNativeWindow window; // object for native window handle
+ internal string name; // for object naming
+
+ // State
+ internal bool is_created; // true if OnCreateControl has been sent
+ internal bool has_focus; // true if control has focus
+ internal bool is_visible; // true if control is visible
+ internal bool is_entered; // is the mouse inside the control?
+ internal bool is_enabled; // true if control is enabled (usable/not grayed out)
+ internal bool is_selected; // true if control is selected
+ internal bool is_accessible; // true if the control is visible to accessibility applications
+ internal bool is_captured; // tracks if the control has captured the mouse
+ internal bool is_toplevel; // tracks if the control is a toplevel window
+ internal bool is_recreating; // tracks if the handle for the control is being recreated
+ internal bool causes_validation; // tracks if validation is executed on changes
+ internal int tab_index; // position in tab order of siblings
+ internal bool tab_stop = true; // is the control a tab stop?
+ internal bool is_disposed; // has the window already been disposed?
+ internal Size client_size; // size of the client area (window excluding decorations)
+ internal Rectangle client_rect; // rectangle with the client area (window excluding decorations)
+ internal ControlStyles control_style; // rather win32-specific, style bits for control
+ internal ImeMode ime_mode = ImeMode.Inherit;
+ internal bool layout_pending; // true if our parent needs to re-layout us
+ internal object control_tag; // object that contains data about our control
+ internal int mouse_clicks; // Counter for mouse clicks
+ internal Cursor cursor; // Cursor for the window
+ internal bool allow_drop; // true if the control accepts droping objects on it
+
+ // Visuals
+ internal Color foreground_color; // foreground color for control
+ internal Color background_color; // background color for control
+ internal Image background_image; // background image for control
+ internal Font font; // font for control
+ internal string text; // window/title text for control
+ internal BorderStyle border_style; // Border style of control
+
+ // Layout
+ internal AnchorStyles anchor_style; // anchoring requirements for our control
+ internal DockStyle dock_style; // docking requirements for our control (supercedes anchoring)
+ internal int dist_left; // distance to the left border of the parent
+ internal int dist_top; // distance to the top border of the parent
+ internal int dist_right; // distance to the right border of the parent
+ internal int dist_bottom; // distance to the bottom border of the parent
+
+ // to be categorized...
+ static internal ArrayList controls = new ArrayList(); // All of the application's controls, in a flat list
+ internal ControlCollection child_controls; // our children
+ internal Control parent; // our parent control
+ internal AccessibleObject accessibility_object; // object that contains accessibility information about our control
+ internal BindingContext binding_context; // TODO
+ internal RightToLeft right_to_left; // drawing direction for control
+ internal int layout_suspended;
+ internal ContextMenu context_menu; // Context menu associated with the control
+
+ private Graphics dc_mem; // Graphics context for double buffering
+ private Bitmap bmp_mem; // Bitmap for double buffering control
+ private bool needs_redraw = true;
+
+ private ControlBindingsCollection data_bindings;
+
+#if NET_2_0
+ internal bool use_compatible_text_rendering;
+#endif
+
+ #endregion // Local Variables
+
+ #region Private Classes
+ // This helper class allows us to dispatch messages to Control.WndProc
+ internal class ControlNativeWindow : NativeWindow {
+ private Control owner;
+
+ public ControlNativeWindow(Control control) : base() {
+ this.owner=control;
+ }
+
+
+ public Control Owner {
+ get {
+ return owner;
+ }
+ }
+
+ static internal Control ControlFromHandle(IntPtr hWnd) {
+ ControlNativeWindow window;
+
+ window = (ControlNativeWindow)window_collection[hWnd];
+ if (window != null) {
+ return window.owner;
+ }
+
+ return null;
+ }
+
+ protected override void WndProc(ref Message m) {
+ owner.WndProc(ref m);
+ }
+ }
+ #endregion
+
+ #region Public Classes
+ [ComVisible(true)]
+ public class ControlAccessibleObject : AccessibleObject {
+ #region ControlAccessibleObject Local Variables
+ private Control owner;
+ #endregion // ControlAccessibleObject Local Variables
+
+ #region ControlAccessibleObject Constructors
+ public ControlAccessibleObject(Control ownerControl) {
+ this.owner = ownerControl;
+ }
+ #endregion // ControlAccessibleObject Constructors
+
+ #region ControlAccessibleObject Public Instance Properties
+ public override string DefaultAction {
+ get {
+ return base.DefaultAction;
+ }
+ }
+
+ public override string Description {
+ get {
+ return base.Description;
+ }
+ }
+
+ public IntPtr Handle {
+ get {
+ return owner.Handle;
+ }
+
+ set {
+ // We don't want to let them set it
+ }
+ }
+
+ public override string Help {
+ get {
+ return base.Help;
+ }
+ }
+
+ public override string KeyboardShortcut {
+ get {
+ return base.KeyboardShortcut;
+ }
+ }
+
+ public override string Name {
+ get {
+ return base.Name;
+ }
+
+ set {
+ base.Name = value;
+ }
+ }
+
+ public Control Owner {
+ get {
+ return owner;
+ }
+ }
+
+ public override AccessibleObject Parent {
+ get {
+ return base.Parent;
+ }
+ }
+
+
+ public override AccessibleRole Role {
+ get {
+ return base.Role;
+ }
+ }
+ #endregion // ControlAccessibleObject Public Instance Properties
+
+ #region ControlAccessibleObject Public Instance Methods
+ public override int GetHelpTopic(out string FileName) {
+ return base.GetHelpTopic (out FileName);
+ }
+
+ [MonoTODO("Implement this and tie it into Control.AccessibilityNotifyClients")]
+ public void NotifyClients(AccessibleEvents accEvent) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO("Implement this and tie it into Control.AccessibilityNotifyClients")]
+ public void NotifyClients(AccessibleEvents accEvent, int childID) {
+ throw new NotImplementedException();
+ }
+
+ public override string ToString() {
+ return "ControlAccessibleObject: Owner = " + owner.ToString() + ", Text: " + owner.text;
+ }
+
+ #endregion // ControlAccessibleObject Public Instance Methods
+ }
+
+ [DesignerSerializer("System.Windows.Forms.Design.ControlCollectionCodeDomSerializer, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.Serialization.CodeDomSerializer, " + Consts.AssemblySystem_Design)]
+ [ListBindable(false)]
+ public class ControlCollection : IList, ICollection, ICloneable, IEnumerable {
+ #region ControlCollection Local Variables
+ private ArrayList list;
+ private ArrayList impl_list;
+ private Control [] all_controls;
+ internal Control owner;
+ #endregion // ControlCollection Local Variables
+
+ #region ControlCollection Public Constructor
+ public ControlCollection(Control owner) {
+ this.owner=owner;
+ this.list=new ArrayList();
+ }
+ #endregion
+
+ #region ControlCollection Public Instance Properties
+ public int Count {
+ get {
+ return list.Count;
+ }
+ }
+
+ public virtual bool IsReadOnly {
+ get {
+ return list.IsReadOnly;
+ }
+ }
+
+ public virtual Control this[int index] {
+ get {
+ if (index < 0 || index >= list.Count) {
+ throw new ArgumentOutOfRangeException("index", index, "ControlCollection does not have that many controls");
+ }
+ return (Control)list[index];
+ }
+ }
+ #endregion // ControlCollection Public Instance Properties
+
+ #region ControlCollection Private Instance Methods
+ public virtual void Add (Control value)
+ {
+ if (value == null)
+ return;
+
+ if (Contains (value)) {
+ owner.PerformLayout();
+ return;
+ }
+
+ if (value.tab_index == -1) {
+ int end;
+ int index;
+ int use;
+
+ use = 0;
+ end = owner.child_controls.Count;
+ for (int i = 0; i < end; i++) {
+ index = owner.child_controls[i].tab_index;
+ if (index >= use) {
+ use = index + 1;
+ }
+ }
+ value.tab_index = use;
+ }
+
+ if (value.parent != null) {
+ value.parent.Controls.Remove(value);
+ }
+
+ all_controls = null;
+ list.Add (value);
+
+ value.ChangeParent(owner);
+
+ value.InitLayout();
+
+ owner.UpdateZOrder();
+ owner.PerformLayout(value, "Parent");
+ owner.OnControlAdded(new ControlEventArgs(value));
+ }
+
+ internal void AddToList (Control c)
+ {
+ all_controls = null;
+ list.Add (c);
+ }
+
+ internal virtual void AddImplicit (Control control)
+ {
+ if (impl_list == null)
+ impl_list = new ArrayList ();
+ all_controls = null;
+ impl_list.Add (control);
+ control.ChangeParent (owner);
+ owner.UpdateZOrder ();
+ owner.PerformLayout (control, "Parent");
+ owner.OnControlAdded (new ControlEventArgs (control));
+ }
+
+ public virtual void AddRange (Control[] controls)
+ {
+ if (controls == null)
+ throw new ArgumentNullException ("controls");
+
+ owner.SuspendLayout ();
+
+ try {
+ for (int i = 0; i < controls.Length; i++)
+ Add (controls[i]);
+ } finally {
+ owner.ResumeLayout ();
+ }
+ }
+
+ internal virtual void AddRangeImplicit (Control [] controls)
+ {
+ if (controls == null)
+ throw new ArgumentNullException ("controls");
+
+ owner.SuspendLayout ();
+
+ try {
+ for (int i = 0; i < controls.Length; i++)
+ AddImplicit (controls [i]);
+ } finally {
+ owner.ResumeLayout ();
+ }
+ }
+
+ public virtual void Clear ()
+ {
+ all_controls = null;
+
+ // MS sends remove events in reverse order
+ while (list.Count > 0) {
+ RemoveAt(list.Count - 1);
+ }
+ }
+
+ internal virtual void ClearImplicit ()
+ {
+ if (impl_list == null)
+ return;
+ all_controls = null;
+ impl_list.Clear ();
+ }
+
+ public bool Contains (Control value)
+ {
+ for (int i = list.Count; i > 0; ) {
+ i--;
+
+ if (list [i] == value) {
+ // Do we need to do anything here?
+ return true;
+ }
+ }
+ return false;
+ }
+
+ internal bool ImplicitContains (Control value)
+ {
+ if (impl_list == null)
+ return false;
+
+ for (int i = impl_list.Count; i > 0; ) {
+ i--;
+
+ if (impl_list [i] == value) {
+ // Do we need to do anything here?
+ return true;
+ }
+ }
+ return false;
+ }
+
+ internal bool AllContains (Control value)
+ {
+ return Contains (value) || ImplicitContains (value);
+ }
+
+ public virtual void CopyTo (Array array, int index)
+ {
+ list.CopyTo(array, index);
+ }
+
+ public override bool Equals(object other) {
+ if (other is ControlCollection && (((ControlCollection)other).owner==this.owner)) {
+ return(true);
+ } else {
+ return(false);
+ }
+ }
+
+ public int GetChildIndex(Control child) {
+ return GetChildIndex(child, false);
+ }
+
+ public int GetChildIndex(Control child, bool throwException) {
+ int index;
+
+ index=list.IndexOf(child);
+
+ if (index==-1 && throwException) {
+ throw new ArgumentException("Not a child control", "child");
+ }
+ return index;
+ }
+
+ public IEnumerator GetEnumerator() {
+ return list.GetEnumerator();
+ }
+
+ internal IEnumerator GetAllEnumerator ()
+ {
+ Control [] res = GetAllControls ();
+ return res.GetEnumerator ();
+ }
+
+ internal Control [] GetAllControls ()
+ {
+ if (all_controls != null)
+ return all_controls;
+
+ if (impl_list == null)
+ return (Control []) list.ToArray (typeof (Control));
+ Control [] res = new Control [list.Count + impl_list.Count];
+ list.CopyTo (res);
+ impl_list.CopyTo (res, list.Count);
+ return res;
+ }
+
+ public override int GetHashCode() {
+ return base.GetHashCode();
+ }
+
+ public int IndexOf(Control control) {
+ return list.IndexOf(control);
+ }
+
+ public virtual void Remove(Control value) {
+ all_controls = null;
+
+ owner.PerformLayout(value, "Parent");
+ owner.OnControlRemoved(new ControlEventArgs(value));
+ list.Remove(value);
+
+ value.ChangeParent(null);
+
+ owner.UpdateZOrder();
+ }
+
+ internal virtual void RemoveImplicit (Control control)
+ {
+ if (impl_list != null) {
+ all_controls = null;
+ owner.PerformLayout (control, "Parent");
+ owner.OnControlRemoved (new ControlEventArgs (control));
+ impl_list.Remove (control);
+ }
+ control.ChangeParent (null);
+ owner.UpdateZOrder ();
+ }
+
+ public void RemoveAt(int index) {
+ if (index < 0 || index >= list.Count) {
+ throw new ArgumentOutOfRangeException("index", index, "ControlCollection does not have that many controls");
+ }
+ Remove ((Control)list[index]);
+ }
+
+ public void SetChildIndex(Control child, int newIndex) {
+ int old_index;
+
+ old_index=list.IndexOf(child);
+ if (old_index==-1) {
+ throw new ArgumentException("Not a child control", "child");
+ }
+
+ if (old_index==newIndex) {
+ return;
+ }
+
+ RemoveAt(old_index);
+
+ if (newIndex>list.Count) {
+ list.Add(child);
+ } else {
+ list.Insert(newIndex, child);
+ }
+ child.parent = owner;
+ owner.UpdateZOrder();
+ }
+ #endregion // ControlCollection Private Instance Methods
+
+ #region ControlCollection Interface Properties
+ object IList.this[int index] {
+ get {
+ if (index<0 || index>=list.Count) {
+ throw new ArgumentOutOfRangeException("index", index, "ControlCollection does not have that many controls");
+ }
+ return this[index];
+ }
+
+ set {
+ if (!(value is Control)) {
+ throw new ArgumentException("Object of type Control required", "value");
+ }
+
+ list[index]=(Control)value;
+ }
+ }
+
+ bool IList.IsFixedSize {
+ get {
+ return false;
+ }
+ }
+
+ bool IList.IsReadOnly {
+ get {
+ return list.IsReadOnly;
+ }
+ }
+
+ bool ICollection.IsSynchronized {
+ get {
+ return list.IsSynchronized;
+ }
+ }
+
+ object ICollection.SyncRoot {
+ get {
+ return list.SyncRoot;
+ }
+ }
+ #endregion // ControlCollection Interface Properties
+
+ #region ControlCollection Interface Methods
+ int IList.Add(object value) {
+ if (value == null) {
+ throw new ArgumentNullException("value", "Cannot add null controls");
+ }
+
+ if (!(value is Control)) {
+ throw new ArgumentException("Object of type Control required", "value");
+ }
+
+ return list.Add(value);
+ }
+
+ bool IList.Contains(object value) {
+ if (!(value is Control)) {
+ throw new ArgumentException("Object of type Control required", "value");
+ }
+
+ return this.Contains((Control) value);
+ }
+
+ int IList.IndexOf(object value) {
+ if (!(value is Control)) {
+ throw new ArgumentException("Object of type Control required", "value");
+ }
+
+ return this.IndexOf((Control) value);
+ }
+
+ void IList.Insert(int index, object value) {
+ if (!(value is Control)) {
+ throw new ArgumentException("Object of type Control required", "value");
+ }
+ all_controls = null;
+ list.Insert(index, value);
+ }
+
+ void IList.Remove(object value) {
+ if (!(value is Control)) {
+ throw new ArgumentException("Object of type Control required", "value");
+ }
+ all_controls = null;
+ list.Remove(value);
+ }
+
+ void ICollection.CopyTo(Array array, int index) {
+ if (list.Count>0) {
+ list.CopyTo(array, index);
+ }
+ }
+
+ Object ICloneable.Clone() {
+ ControlCollection clone = new ControlCollection(this.owner);
+ clone.list=(ArrayList)list.Clone(); // FIXME: Do we need this?
+ return clone;
+ }
+ #endregion // ControlCollection Interface Methods
+ }
+ #endregion // ControlCollection Class
+
+ #region Public Constructors
+ public Control() {
+
+ anchor_style = AnchorStyles.Top | AnchorStyles.Left;
+
+ is_created = false;
+ is_visible = true;
+ is_captured = false;
+ is_disposed = false;
+ is_enabled = true;
+ is_entered = false;
+ layout_pending = false;
+ is_toplevel = false;
+ causes_validation = true;
+ has_focus = false;
+ layout_suspended = 0;
+ mouse_clicks = 1;
+ tab_index = -1;
+ cursor = null;
+ right_to_left = RightToLeft.Inherit;
+ border_style = BorderStyle.None;
+ background_color = Color.Empty;
+ dist_left = 0;
+ dist_right = 0;
+ dist_top = 0;
+ dist_bottom = 0;
+
+#if NET_2_0
+ use_compatible_text_rendering = Application.use_compatible_text_rendering;
+#endif
+
+ control_style = ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint |
+ ControlStyles.Selectable | ControlStyles.StandardClick |
+ ControlStyles.StandardDoubleClick;
+
+ parent = null;
+ background_image = null;
+ text = string.Empty;
+ name = string.Empty;
+
+ window = new ControlNativeWindow(this);
+ child_controls = CreateControlsInstance();
+ client_size = new Size(DefaultSize.Width, DefaultSize.Height);
+ client_rect = new Rectangle(0, 0, DefaultSize.Width, DefaultSize.Height);
+ XplatUI.CalculateWindowRect(IntPtr.Zero, ref client_rect, CreateParams.Style, CreateParams.ExStyle, null, out bounds);
+ if ((CreateParams.Style & (int)WindowStyles.WS_CHILD) == 0) {
+ bounds.X=-1;
+ bounds.Y=-1;
+ }
+ }
+
+ public Control(Control parent, string text) : this() {
+ Text=text;
+ Parent=parent;
+ }
+
+ public Control(Control parent, string text, int left, int top, int width, int height) : this() {
+ Parent=parent;
+ bounds.X=left;
+ bounds.Y=top;
+ bounds.Width=width;
+ bounds.Height=height;
+ SetBoundsCore(left, top, width, height, BoundsSpecified.All);
+ Text=text;
+ }
+
+ public Control(string text) : this() {
+ Text=text;
+ }
+
+ public Control(string text, int left, int top, int width, int height) : this() {
+ bounds.X=left;
+ bounds.Y=top;
+ bounds.Width=width;
+ bounds.Height=height;
+ SetBoundsCore(left, top, width, height, BoundsSpecified.All);
+ Text=text;
+ }
+
+ private delegate void RemoveDelegate(object c);
+
+ protected override void Dispose(bool disposing) {
+ is_disposed = true;
+ if (dc_mem!=null) {
+ dc_mem.Dispose();
+ dc_mem=null;
+ }
+
+ if (bmp_mem!=null) {
+ bmp_mem.Dispose();
+ bmp_mem=null;
+ }
+
+ if (this.InvokeRequired) {
+ if (Application.MessageLoop) {
+ this.BeginInvokeInternal(new MethodInvoker(DestroyHandle), null, true);
+ this.BeginInvokeInternal(new RemoveDelegate(controls.Remove), new object[] {this}, true);
+ }
+ } else {
+ DestroyHandle();
+ controls.Remove(this);
+ }
+ }
+ #endregion // Public Constructors
+
+ #region Internal Properties
+ internal BorderStyle InternalBorderStyle {
+ get {
+ return border_style;
+ }
+
+ set {
+ if (!Enum.IsDefined (typeof (BorderStyle), value))
+ throw new InvalidEnumArgumentException (string.Format("Enum argument value '{0}' is not valid for BorderStyle", value));
+
+ if (border_style != value) {
+ border_style = value;
+
+ if (IsHandleCreated) {
+ XplatUI.SetBorderStyle(window.Handle, (FormBorderStyle)border_style);
+ Refresh();
+ }
+ }
+ }
+ }
+ #endregion // Internal Properties
+
+ #region Private & Internal Methods
+ internal IAsyncResult BeginInvokeInternal (Delegate method, object [] args, bool disposing) {
+ AsyncMethodResult result;
+ AsyncMethodData data;
+
+ if (!disposing) {
+ Control p;
+
+ p = this;
+ do {
+ if (!p.IsHandleCreated) {
+ throw new InvalidOperationException("Cannot call Invoke or InvokeAsync on a control until the window handle is created");
+ }
+ p = p.parent;
+ } while (p != null);
+ }
+
+ result = new AsyncMethodResult ();
+ data = new AsyncMethodData ();
+
+ data.Method = method;
+ data.Args = args;
+ data.Result = result;
+
+#if NET_2_0
+ if (!ExecutionContext.IsFlowSuppressed ()) {
+ data.Context = ExecutionContext.Capture ();
+ }
+#else
+#if !MWF_ON_MSRUNTIME
+ if (SecurityManager.SecurityEnabled) {
+ data.Stack = CompressedStack.GetCompressedStack ();
+ }
+#endif
+#endif
+
+ XplatUI.SendAsyncMethod (data);
+ return result;
+ }
+
+
+ internal void PointToClient (ref int x, ref int y)
+ {
+ XplatUI.ScreenToClient (Handle, ref x, ref y);
+ }
+
+ internal void PointToScreen (ref int x, ref int y)
+ {
+ XplatUI.ClientToScreen (Handle, ref x, ref y);
+ }
+
+ internal Graphics DeviceContext {
+ get {
+ if (dc_mem==null) {
+ CreateBuffers(this.Width, this.Height);
+ }
+ return dc_mem;
+ }
+ }
+
+ private Bitmap ImageBuffer {
+ get {
+ if (bmp_mem==null) {
+ CreateBuffers(this.Width, this.Height);
+ }
+ return bmp_mem;
+ }
+ }
+
+ internal void CreateBuffers (int width, int height) {
+ if (dc_mem != null) {
+ dc_mem.Dispose ();
+ }
+ if (bmp_mem != null)
+ bmp_mem.Dispose ();
+
+ if (width < 1) {
+ width = 1;
+ }
+
+ if (height < 1) {
+ height = 1;
+ }
+
+ bmp_mem = new Bitmap (width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
+ dc_mem = Graphics.FromImage (bmp_mem);
+ needs_redraw = true;
+ }
+
+ internal void InvalidateBuffers ()
+ {
+ if (dc_mem != null) {
+ dc_mem.Dispose ();
+ }
+ if (bmp_mem != null)
+ bmp_mem.Dispose ();
+
+ dc_mem = null;
+ bmp_mem = null;
+ needs_redraw = true;
+ }
+
+ internal static void SetChildColor(Control parent) {
+ Control child;
+
+ for (int i=0; i < parent.child_controls.Count; i++) {
+ child=parent.child_controls[i];
+ if (child.child_controls.Count>0) {
+ SetChildColor(child);
+ }
+ }
+
+ }
+
+ internal bool Select(Control control) {
+ Control parent;
+ IContainerControl container;
+
+ if (control == null) {
+ return false;
+ }
+
+ parent = control.parent;
+
+ if (((control.control_style & ControlStyles.Selectable) !=0) && (parent != null)) {
+ while (parent != null) {
+ if (!parent.Visible || !parent.is_enabled) {
+ return false;
+ }
+ parent = parent.parent;
+ }
+ }
+
+ control.is_selected = true;
+
+ container = GetContainerControl();
+ if (container != null) {
+ container.ActiveControl = control;
+ }
+ if (control.IsHandleCreated) {
+ XplatUI.SetFocus(control.window.Handle);
+ }
+ return true;
+ }
+
+ internal virtual void DoDefaultAction() {
+ // Only here to be overriden by our actual controls; this is needed by the accessibility class
+ }
+
+ internal static int LowOrder (int param) {
+ return ((int)(short)(param & 0xffff));
+ }
+
+ internal static int HighOrder (int param) {
+ return ((int)(short)(param >> 16));
+ }
+
+ // This method exists so controls overriding OnPaintBackground can have default background painting done
+ internal virtual void PaintControlBackground (PaintEventArgs pevent)
+ {
+ if (background_image == null) {
+ pevent.Graphics.FillRectangle(ThemeEngine.Current.ResPool.GetSolidBrush(BackColor), new Rectangle(pevent.ClipRectangle.X - 1, pevent.ClipRectangle.Y - 1, pevent.ClipRectangle.Width + 2, pevent.ClipRectangle.Height + 2));
+ return;
+ }
+
+ DrawBackgroundImage (pevent.Graphics);
+ }
+
+ void DrawBackgroundImage (Graphics g)
+ {
+ using (TextureBrush b = new TextureBrush (background_image, WrapMode.Tile)) {
+ g.FillRectangle (b, ClientRectangle);
+ }
+ }
+
+ internal virtual void DndEnter (DragEventArgs e)
+ {
+ try {
+ OnDragEnter (e);
+ } catch { }
+ }
+
+ internal virtual void DndOver (DragEventArgs e)
+ {
+ try {
+ OnDragOver (e);
+ } catch { }
+ }
+
+ internal virtual void DndDrop (DragEventArgs e)
+ {
+ try {
+ OnDragDrop (e);
+ } catch (Exception exc) {
+ Console.Error.WriteLine ("MWF: Exception while dropping:");
+ Console.Error.WriteLine (exc);
+ }
+ }
+
+ internal virtual void DndLeave (EventArgs e)
+ {
+ try {
+ OnDragLeave (e);
+ } catch { }
+ }
+
+ internal virtual void DndFeedback(GiveFeedbackEventArgs e)
+ {
+ try {
+ OnGiveFeedback(e);
+ } catch { }
+ }
+
+ internal virtual void DndContinueDrag(QueryContinueDragEventArgs e)
+ {
+ try {
+ OnQueryContinueDrag(e);
+ } catch { }
+ }
+
+ internal static MouseButtons FromParamToMouseButtons (int param) {
+ MouseButtons buttons = MouseButtons.None;
+
+ if ((param & (int) MsgButtons.MK_LBUTTON) != 0)
+ buttons |= MouseButtons.Left;
+
+ if ((param & (int) MsgButtons.MK_MBUTTON) != 0)
+ buttons |= MouseButtons.Middle;
+
+ if ((param & (int) MsgButtons.MK_RBUTTON) != 0)
+ buttons |= MouseButtons.Right;
+
+ return buttons;
+
+ }
+
+ internal virtual bool ProcessControlMnemonic(char charCode) {
+ return ProcessMnemonic(charCode);
+ }
+
+ private static Control FindFlatForward(Control container, Control start) {
+ Control found;
+ int index;
+ int end;
+
+ found = null;
+ end = container.child_controls.Count;
+
+ if (start != null) {
+ index = start.tab_index;
+ } else {
+ index = -1;
+ }
+
+ for (int i = 0; i < end; i++) {
+ if (found == null) {
+ if (container.child_controls[i].tab_index > index) {
+ found = container.child_controls[i];
+ }
+ } else if (found.tab_index > container.child_controls[i].tab_index) {
+ if (container.child_controls[i].tab_index > index) {
+ found = container.child_controls[i];
+ }
+ }
+ }
+ return found;
+ }
+
+ private static Control FindControlForward(Control container, Control start) {
+ Control found;
+ Control p;
+
+ found = null;
+
+ if (start != null) {
+ if ((start is IContainerControl) || start.GetStyle(ControlStyles.ContainerControl)) {
+ found = FindControlForward(start, null);
+ if (found != null) {
+ return found;
+ }
+ }
+
+ p = start.parent;
+ while (p != container) {
+ found = FindFlatForward(p, start);
+ if (found != null) {
+ return found;
+ }
+ start = p;
+ p = p.parent;
+ }
+ }
+ return FindFlatForward(container, start);
+ }
+
+ private static Control FindFlatBackward(Control container, Control start) {
+ Control found;
+ int index;
+ int end;
+
+ found = null;
+ end = container.child_controls.Count;
+
+ if (start != null) {
+ index = start.tab_index;
+ } else {
+ // FIXME: Possible speed-up: Keep the highest taborder index in the container
+ index = -1;
+ for (int i = 0; i < end; i++) {
+ if (container.child_controls[i].tab_index > index) {
+ index = container.child_controls[i].tab_index;
+ }
+ }
+ index++;
+ }
+
+ for (int i = 0; i < end; i++) {
+ if (found == null) {
+ if (container.child_controls[i].tab_index < index) {
+ found = container.child_controls[i];
+ }
+ } else if (found.tab_index < container.child_controls[i].tab_index) {
+ if (container.child_controls[i].tab_index < index) {
+ found = container.child_controls[i];
+ }
+ }
+ }
+ return found;
+ }
+
+ private static Control FindControlBackward(Control container, Control start) {
+ Control found;
+
+ found = null;
+
+ if (start != null) {
+ found = FindFlatBackward(start.parent, start);
+ if (found == null && start.parent != container) {
+ return start.parent;
+ }
+ }
+ if (found == null) {
+ found = FindFlatBackward(container, start);
+ }
+
+ while ((found != null) && ((found is IContainerControl) || found.GetStyle(ControlStyles.ContainerControl))) {
+ found = FindControlBackward(found, null);
+ if (found != null) {
+ return found;
+ }
+ }
+
+ return found;
+ }
+
+ private void HandleClick(int clicks) {
+ if (GetStyle(ControlStyles.StandardClick)) {
+ if (clicks > 1) {
+ if (GetStyle(ControlStyles.StandardDoubleClick)) {
+ OnDoubleClick(EventArgs.Empty);
+ } else {
+ OnClick(EventArgs.Empty);
+ }
+ } else {
+ OnClick(EventArgs.Empty);
+ }
+ }
+ }
+
+ private void CheckDataBindings ()
+ {
+ if (data_bindings == null)
+ return;
+
+ BindingContext binding_context = BindingContext;
+ foreach (Binding binding in data_bindings) {
+ binding.Check (binding_context);
+ }
+ }
+
+
+ private void ChangeParent(Control new_parent) {
+ bool pre_enabled;
+ bool pre_visible;
+ Font pre_font;
+ Color pre_fore_color;
+ Color pre_back_color;
+ RightToLeft pre_rtl;
+
+ // These properties are inherited from our parent
+ // Get them pre parent-change and then send events
+ // if they are changed after we have our new parent
+ pre_enabled = Enabled;
+ pre_visible = Visible;
+ pre_font = Font;
+ pre_fore_color = ForeColor;
+ pre_back_color = BackColor;
+ pre_rtl = RightToLeft;
+ // MS doesn't seem to send a CursorChangedEvent
+
+ parent = new_parent;
+
+ if (IsHandleCreated && (new_parent != null) && new_parent.IsHandleCreated) {
+ XplatUI.SetParent(Handle, new_parent.Handle);
+ }
+
+ OnParentChanged(EventArgs.Empty);
+
+ if (pre_enabled != Enabled) {
+ OnEnabledChanged(EventArgs.Empty);
+ }
+
+ if (pre_visible != Visible) {
+ OnVisibleChanged(EventArgs.Empty);
+ }
+
+ if (pre_font != Font) {
+ OnFontChanged(EventArgs.Empty);
+ }
+
+ if (pre_fore_color != ForeColor) {
+ OnForeColorChanged(EventArgs.Empty);
+ }
+
+ if (pre_back_color != BackColor) {
+ OnBackColorChanged(EventArgs.Empty);
+ }
+
+ if (pre_rtl != RightToLeft) {
+ // MS sneaks a OnCreateControl and OnHandleCreated in here, I guess
+ // because when RTL changes they have to recreate the win32 control
+ // We don't really need that (until someone runs into compatibility issues)
+ OnRightToLeftChanged(EventArgs.Empty);
+ }
+
+ if ((new_parent != null) && new_parent.Created && !Created) {
+ CreateControl();
+ }
+
+ if ((binding_context == null) && Created) {
+ OnBindingContextChanged(EventArgs.Empty);
+ }
+ }
+
+ private void UpdateDistances() {
+ dist_left = bounds.X;
+ dist_top = bounds.Y;
+ if ((parent != null) && (parent.layout_suspended == 0)) {
+ dist_right = parent.ClientSize.Width - bounds.X - bounds.Width;
+ dist_bottom = parent.ClientSize.Height - bounds.Y - bounds.Height;
+ }
+ }
+ #endregion // Private & Internal Methods
+
+ #region Public Static Properties
+ public static Color DefaultBackColor {
+ get {
+ return ThemeEngine.Current.DefaultControlBackColor;
+ }
+ }
+
+ public static Font DefaultFont {
+ get {
+ return ThemeEngine.Current.DefaultFont;
+ }
+ }
+
+ public static Color DefaultForeColor {
+ get {
+ return ThemeEngine.Current.DefaultControlForeColor;
+ }
+ }
+
+ public static Keys ModifierKeys {
+ get {
+ return XplatUI.State.ModifierKeys;
+ }
+ }
+
+ public static MouseButtons MouseButtons {
+ get {
+ return XplatUI.State.MouseButtons;
+ }
+ }
+
+ public static Point MousePosition {
+ get {
+ return Cursor.Position;
+ }
+ }
+
+#if NET_2_0
+ [MonoTODO]
+ public static bool CheckForIllegalCrossThreadCalls
+ {
+ set {
+ }
+ get {
+ return false;
+ }
+ }
+#endif
+ #endregion // Public Static Properties
+
+ #region Public Instance Properties
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public AccessibleObject AccessibilityObject {
+ get {
+ if (accessibility_object==null) {
+ accessibility_object=CreateAccessibilityInstance();
+ }
+ return accessibility_object;
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string AccessibleDefaultActionDescription {
+ get {
+ return AccessibilityObject.default_action;
+ }
+
+ set {
+ AccessibilityObject.default_action=value;
+ }
+ }
+
+ [Localizable(true)]
+ [DefaultValue(null)]
+ public string AccessibleDescription {
+ get {
+ return AccessibilityObject.description;
+ }
+
+ set {
+ AccessibilityObject.description=value;
+ }
+ }
+
+ [Localizable(true)]
+ [DefaultValue(null)]
+ public string AccessibleName {
+ get {
+ return AccessibilityObject.Name;
+ }
+
+ set {
+ AccessibilityObject.Name=value;
+ }
+ }
+
+ [DefaultValue(AccessibleRole.Default)]
+ [MWFDescription("Role of the control"), MWFCategory("Accessibility")]
+ public AccessibleRole AccessibleRole {
+ get {
+ return AccessibilityObject.role;
+ }
+
+ set {
+ AccessibilityObject.role=value;
+ }
+ }
+
+ [DefaultValue(false)]
+ public virtual bool AllowDrop {
+ get {
+ return allow_drop;
+ }
+
+ set {
+ if (allow_drop == value)
+ return;
+ allow_drop = value;
+ UpdateStyles();
+ XplatUI.SetAllowDrop (Handle, value);
+ }
+ }
+
+ [Localizable(true)]
+ [RefreshProperties(RefreshProperties.Repaint)]
+ [DefaultValue(AnchorStyles.Top | AnchorStyles.Left)]
+ public virtual AnchorStyles Anchor {
+ get {
+ return anchor_style;
+ }
+
+ set {
+ anchor_style=value;
+
+ if (parent != null) {
+ parent.PerformLayout(this, "Parent");
+ }
+ }
+ }
+
+ [DispId(-501)]
+ public virtual Color BackColor {
+ get {
+ if (background_color.IsEmpty) {
+ if (parent!=null) {
+ return parent.BackColor;
+ }
+ return DefaultBackColor;
+ }
+ return background_color;
+ }
+
+ set {
+ background_color=value;
+ SetChildColor(this);
+ OnBackColorChanged(EventArgs.Empty);
+ Invalidate();
+ }
+ }
+
+ [Localizable(true)]
+ [DefaultValue(null)]
+ public virtual Image BackgroundImage {
+ get {
+ return background_image;
+ }
+
+ set {
+ if (background_image!=value) {
+ background_image=value;
+ OnBackgroundImageChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public virtual BindingContext BindingContext {
+ get {
+ if (binding_context != null)
+ return binding_context;
+ if (Parent == null)
+ return null;
+ binding_context = Parent.BindingContext;
+ return binding_context;
+ }
+ set {
+ if (binding_context != value) {
+ binding_context = value;
+ OnBindingContextChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int Bottom {
+ get {
+ return bounds.Y+bounds.Height;
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public Rectangle Bounds {
+ get {
+ return this.bounds;
+ }
+
+ set {
+ SetBoundsCore(value.Left, value.Top, value.Width, value.Height, BoundsSpecified.All);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool CanFocus {
+ get {
+ if (Visible && is_enabled && GetStyle(ControlStyles.Selectable)) {
+ return true;
+ }
+ return false;
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool CanSelect {
+ get {
+ Control parent;
+
+ if (!GetStyle(ControlStyles.Selectable) || this.parent == null) {
+ return false;
+ }
+
+ parent = this.parent;
+ while (parent != null) {
+ if (!parent.is_visible || !parent.is_enabled) {
+ return false;
+ }
+
+ parent = parent.parent;
+ }
+ return true;
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool Capture {
+ get {
+ return this.is_captured;
+ }
+
+ set {
+ if (this.IsHandleCreated) {
+ if (value && !is_captured) {
+ is_captured = true;
+ XplatUI.GrabWindow(this.window.Handle, IntPtr.Zero);
+ } else if (!value && is_captured) {
+ XplatUI.UngrabWindow(this.window.Handle);
+ is_captured = false;
+ }
+ }
+ }
+ }
+
+ [DefaultValue(true)]
+ public bool CausesValidation {
+ get {
+ return this.causes_validation;
+ }
+
+ set {
+ if (this.causes_validation != value) {
+ causes_validation = value;
+ OnCausesValidationChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public Rectangle ClientRectangle {
+ get {
+ client_rect.Width = client_size.Width;
+ client_rect.Height = client_size.Height;
+ return client_rect;
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public Size ClientSize {
+ get {
+#if notneeded
+ if ((this is Form) && (((Form)this).form_parent_window != null)) {
+ return ((Form)this).form_parent_window.ClientSize;
+ }
+#endif
+
+ return client_size;
+ }
+
+ set {
+ this.SetClientSizeCore(value.Width, value.Height);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ [DescriptionAttribute("ControlCompanyNameDescr")]
+ public String CompanyName {
+ get {
+ return "Mono Project, Novell, Inc.";
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool ContainsFocus {
+ get {
+ if (this.Focused) {
+ return true;
+ }
+
+ for (int i=0; i < child_controls.Count; i++) {
+ if (child_controls[i].ContainsFocus) {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+
+ [DefaultValue(null)]
+ public virtual ContextMenu ContextMenu {
+ get {
+ return context_menu;
+ }
+
+ set {
+ if (context_menu != value) {
+ context_menu = value;
+ OnContextMenuChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
+ public ControlCollection Controls {
+ get {
+ return this.child_controls;
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool Created {
+ get {
+ if (!this.is_disposed && (this.window.Handle != IntPtr.Zero)) {
+ return true;
+ }
+ return false;
+ }
+ }
+
+ [AmbientValue(null)]
+ public virtual Cursor Cursor {
+ get {
+ if (cursor != null) {
+ return cursor;
+ }
+
+ if (parent != null) {
+ return parent.Cursor;
+ }
+
+ return Cursors.Default;
+ }
+
+ set {
+ if (cursor != value) {
+ Point pt;
+
+ cursor = value;
+
+ if (IsHandleCreated) {
+ pt = Cursor.Position;
+
+ if (bounds.Contains(pt)) {
+ if (GetChildAtPoint(pt) == null) {
+ if (cursor != null) {
+ XplatUI.SetCursor(window.Handle, cursor.handle);
+ } else {
+ if (parent != null) {
+ XplatUI.SetCursor(window.Handle, parent.Cursor.handle);
+ } else {
+ XplatUI.SetCursor(window.Handle, Cursors.def.handle);
+ }
+ }
+ }
+ }
+ }
+
+ OnCursorChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
+ [ParenthesizePropertyName(true)]
+ [RefreshProperties(RefreshProperties.All)]
+ public ControlBindingsCollection DataBindings {
+ get {
+ if (data_bindings == null)
+ data_bindings = new ControlBindingsCollection (this);
+ return data_bindings;
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public virtual Rectangle DisplayRectangle {
+ get {
+ return ClientRectangle;
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool Disposing {
+ get {
+ return is_disposed;
+ }
+ }
+
+ [Localizable(true)]
+ [RefreshProperties(RefreshProperties.Repaint)]
+ [DefaultValue(DockStyle.None)]
+ public virtual DockStyle Dock {
+ get {
+ return dock_style;
+ }
+
+ set {
+ if (dock_style == value) {
+ return;
+ }
+
+ dock_style = value;
+
+ if (parent != null) {
+ parent.PerformLayout(this, "Parent");
+ }
+
+ OnDockChanged(EventArgs.Empty);
+ }
+ }
+
+ [DispId(-514)]
+ [Localizable(true)]
+ public bool Enabled {
+ get {
+ if (!is_enabled) {
+ return false;
+ }
+
+ if (parent != null) {
+ return parent.Enabled;
+ }
+
+ return true;
+ }
+
+ set {
+ if (is_enabled == value) {
+ return;
+ }
+
+ if (IsHandleCreated) {
+ if (this is Form) {
+ if (((Form)this).context == null) {
+ XplatUI.EnableWindow(window.Handle, value);
+ }
+ } else {
+ XplatUI.EnableWindow(window.Handle, value);
+ }
+ }
+ is_enabled = value;
+ Refresh();
+ OnEnabledChanged (EventArgs.Empty);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public virtual bool Focused {
+ get {
+ return this.has_focus;
+ }
+ }
+
+ [DispId(-512)]
+ [AmbientValue(null)]
+ [Localizable(true)]
+ public virtual Font Font {
+ get {
+ if (font != null) {
+ return font;
+ }
+
+ if (Parent != null && Parent.Font != null) {
+ return Parent.Font;
+ }
+
+ return DefaultFont;
+ }
+
+ set {
+ if (font != null && font.Equals (value)) {
+ return;
+ }
+
+ font = value;
+ Invalidate();
+ OnFontChanged (EventArgs.Empty);
+ }
+ }
+
+ [DispId(-513)]
+ public virtual Color ForeColor {
+ get {
+ if (foreground_color.IsEmpty) {
+ if (parent!=null) {
+ return parent.ForeColor;
+ }
+ return DefaultForeColor;
+ }
+ return foreground_color;
+ }
+
+ set {
+ if (foreground_color != value) {
+ foreground_color=value;
+ Invalidate();
+ OnForeColorChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ [DispId(-515)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public IntPtr Handle { // IWin32Window
+ get {
+ if (!IsHandleCreated) {
+ CreateHandle();
+ }
+ return window.Handle;
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool HasChildren {
+ get {
+ if (this.child_controls.Count>0) {
+ return true;
+ }
+ return false;
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Always)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int Height {
+ get {
+ return this.bounds.Height;
+ }
+
+ set {
+ SetBoundsCore(bounds.X, bounds.Y, bounds.Width, value, BoundsSpecified.Height);
+ }
+ }
+
+ [AmbientValue(ImeMode.Inherit)]
+ [Localizable(true)]
+ public ImeMode ImeMode {
+ get {
+ if (ime_mode == DefaultImeMode) {
+ if (parent != null)
+ return parent.ImeMode;
+ else
+ return ImeMode.NoControl; // default value
+ }
+ return ime_mode;
+ }
+
+ set {
+ if (ime_mode != value) {
+ ime_mode = value;
+
+ OnImeModeChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool InvokeRequired { // ISynchronizeInvoke
+ get {
+ if (creator_thread != null && creator_thread!=Thread.CurrentThread) {
+ return true;
+ }
+ return false;
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool IsAccessible {
+ get {
+ return is_accessible;
+ }
+
+ set {
+ is_accessible = value;
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool IsDisposed {
+ get {
+ return this.is_disposed;
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool IsHandleCreated {
+ get {
+ if ((window!=null) && (window.Handle!=IntPtr.Zero)) {
+ return true;
+ }
+
+ return false;
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Always)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int Left {
+ get {
+ return this.bounds.X;
+ }
+
+ set {
+ SetBoundsCore(value, bounds.Y, bounds.Width, bounds.Height, BoundsSpecified.X);
+ }
+ }
+
+ [Localizable(true)]
+ public Point Location {
+ get {
+ return new Point(bounds.X, bounds.Y);
+ }
+
+ set {
+ SetBoundsCore(value.X, value.Y, bounds.Width, bounds.Height, BoundsSpecified.Location);
+ }
+ }
+
+ [Browsable(false)]
+ public string Name {
+ get {
+ return this.name;
+ }
+
+ set {
+ this.name=value;
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public Control Parent {
+ get {
+ return this.parent;
+ }
+
+ set {
+ if (value == this) {
+ throw new ArgumentException("A circular control reference has been made. A control cannot be owned or parented to itself.");
+ }
+
+ if (parent!=value) {
+ if (value==null) {
+ parent.Controls.Remove(this);
+ return;
+ }
+
+ value.Controls.Add(this);
+ }
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string ProductName {
+ get {
+ Type t = typeof (AssemblyProductAttribute);
+ Assembly assembly = GetType().Module.Assembly;
+ object [] attrs = assembly.GetCustomAttributes (t, false);
+ AssemblyProductAttribute a = null;
+ // On MS we get a NullRefException if product attribute is not
+ // set.
+ if (attrs != null && attrs.Length > 0)
+ a = (AssemblyProductAttribute) attrs [0];
+ return a.Product;
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string ProductVersion {
+ get {
+ Type t = typeof (AssemblyVersionAttribute);
+ Assembly assembly = GetType().Module.Assembly;
+ object [] attrs = assembly.GetCustomAttributes (t, false);
+ if (attrs == null || attrs.Length < 1)
+ return "1.0.0.0";
+ return ((AssemblyVersionAttribute)attrs [0]).Version;
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool RecreatingHandle {
+ get {
+ return is_recreating;
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public Region Region {
+ get {
+ return new Region(this.bounds);
+ }
+
+ set {
+ Graphics g;
+ RectangleF r;
+
+ g = this.CreateGraphics();
+ r = value.GetBounds(g);
+
+ SetBounds((int)r.X, (int)r.Y, (int)r.Width, (int)r.Height);
+
+ g.Dispose();
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int Right {
+ get {
+ return this.bounds.X+this.bounds.Width;
+ }
+ }
+
+ [AmbientValue(RightToLeft.Inherit)]
+ [Localizable(true)]
+ public virtual RightToLeft RightToLeft {
+ get {
+ if (right_to_left == RightToLeft.Inherit) {
+ if (parent != null)
+ return parent.RightToLeft;
+ else
+ return RightToLeft.No; // default value
+ }
+ return right_to_left;
+ }
+
+ set {
+ if (value != right_to_left) {
+ right_to_left = value;
+ OnRightToLeftChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public override ISite Site {
+ get {
+ return base.Site;
+ }
+
+ set {
+ base.Site = value;
+ }
+ }
+
+ [Localizable(true)]
+ public Size Size {
+ get {
+ return new Size(Width, Height);
+ }
+
+ set {
+ SetBoundsCore(bounds.X, bounds.Y, value.Width, value.Height, BoundsSpecified.Size);
+ }
+ }
+
+ [Localizable(true)]
+ [MergableProperty(false)]
+ public int TabIndex {
+ get {
+ if (tab_index != -1) {
+ return tab_index;
+ }
+ return 0;
+ }
+
+ set {
+ if (tab_index != value) {
+ tab_index = value;
+ OnTabIndexChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ [DispId(-516)]
+ [DefaultValue(true)]
+ public bool TabStop {
+ get {
+ return tab_stop;
+ }
+
+ set {
+ if (tab_stop != value) {
+ tab_stop = value;
+ OnTabStopChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ [Localizable(false)]
+ [Bindable(true)]
+ [TypeConverter(typeof(StringConverter))]
+ [DefaultValue(null)]
+ public object Tag {
+ get {
+ return control_tag;
+ }
+
+ set {
+ control_tag = value;
+ }
+ }
+
+ [DispId(-517)]
+ [Localizable(true)]
+ [BindableAttribute(true)]
+ public virtual string Text {
+ get {
+ // Our implementation ignores ControlStyles.CacheText - we always cache
+ return this.text;
+ }
+
+ set {
+ if (value == null) {
+ value = String.Empty;
+ }
+
+ if (text!=value) {
+ text=value;
+ if (IsHandleCreated) {
+ XplatUI.Text(Handle, text);
+ }
+ OnTextChanged (EventArgs.Empty);
+ }
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Always)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int Top {
+ get {
+ return this.bounds.Y;
+ }
+
+ set {
+ SetBoundsCore(bounds.X, value, bounds.Width, bounds.Height, BoundsSpecified.Y);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public Control TopLevelControl {
+ get {
+ Control p = this;
+
+ while (p.parent != null) {
+ p = p.parent;
+ }
+
+ return p;
+ }
+ }
+
+ [Localizable(true)]
+ public bool Visible {
+ get {
+ if (!is_visible) {
+ return false;
+ } else if (parent != null) {
+ return parent.Visible;
+ }
+
+ return true;
+ }
+
+ set {
+ SetVisibleCore(value);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Always)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int Width {
+ get {
+ return this.bounds.Width;
+ }
+
+ set {
+ SetBoundsCore(bounds.X, bounds.Y, value, bounds.Height, BoundsSpecified.Width);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public IWindowTarget WindowTarget {
+ get {
+ return null;
+ }
+
+ set {
+ ; // MS Internal
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Protected Instance Properties
+ protected virtual CreateParams CreateParams {
+ get {
+ CreateParams create_params = new CreateParams();
+
+ try {
+ create_params.Caption = Text;
+ }
+ catch {
+ create_params.Caption = text;
+ }
+
+ try {
+ create_params.X = Left;
+ }
+ catch {
+ create_params.X = this.bounds.X;
+ }
+
+ try {
+ create_params.Y = Top;
+ }
+ catch {
+ create_params.Y = this.bounds.Y;
+ }
+
+ try {
+ create_params.Width = Width;
+ }
+ catch {
+ create_params.Width = this.bounds.Width;
+ }
+
+ try {
+ create_params.Height = Height;
+ }
+ catch {
+ create_params.Height = this.bounds.Height;
+ }
+
+
+ create_params.ClassName = XplatUI.DefaultClassName;
+ create_params.ClassStyle = 0;
+ create_params.ExStyle = 0;
+ create_params.Param = 0;
+
+ if (allow_drop) {
+ create_params.ExStyle |= (int)WindowStyles.WS_EX_ACCEPTFILES;
+ }
+
+ if (parent!=null) {
+ create_params.Parent = parent.Handle;
+ }
+
+ create_params.Style = (int)WindowStyles.WS_CHILD | (int)WindowStyles.WS_CLIPCHILDREN | (int)WindowStyles.WS_CLIPSIBLINGS;
+
+ if (is_visible) {
+ create_params.Style |= (int)WindowStyles.WS_VISIBLE;
+ }
+
+ if (!is_enabled) {
+ create_params.Style |= (int)WindowStyles.WS_DISABLED;
+ }
+
+ switch (border_style) {
+ case BorderStyle.FixedSingle:
+ create_params.Style |= (int) WindowStyles.WS_BORDER;
+ break;
+ case BorderStyle.Fixed3D:
+ create_params.ExStyle |= (int) WindowStyles.WS_EX_CLIENTEDGE;
+ break;
+ }
+
+ return create_params;
+ }
+ }
+
+ protected virtual ImeMode DefaultImeMode {
+ get {
+ return ImeMode.Inherit;
+ }
+ }
+
+ protected virtual Size DefaultSize {
+ get {
+ return new Size(100, 23);
+ }
+ }
+
+ protected int FontHeight {
+ get {
+ return Font.Height;
+ }
+
+ set {
+ ;; // Nothing to do
+ }
+ }
+
+ protected bool RenderRightToLeft {
+ get {
+ return (this.right_to_left == RightToLeft.Yes);
+ }
+ }
+
+ protected bool ResizeRedraw {
+ get {
+ return GetStyle(ControlStyles.ResizeRedraw);
+ }
+
+ set {
+ SetStyle(ControlStyles.ResizeRedraw, value);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ protected virtual bool ShowFocusCues {
+ get {
+ return true;
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ protected bool ShowKeyboardCues {
+ get {
+ return true;
+ }
+ }
+ #endregion // Protected Instance Properties
+
+ #region Public Static Methods
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public static Control FromChildHandle(IntPtr handle) {
+ IEnumerator control = Control.controls.GetEnumerator();
+
+ while (control.MoveNext()) {
+ if (((Control)control.Current).window.Handle == handle) {
+ // Found it
+ if (((Control)control.Current).Parent != null) {
+ return ((Control)control.Current).Parent;
+ }
+ }
+ }
+ return null;
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public static Control FromHandle(IntPtr handle) {
+#if not
+ IEnumerator control = Control.controls.GetEnumerator();
+
+ while (control.MoveNext()) {
+ if (((Control)control.Current).window.Handle == handle) {
+ // Found it
+ return ((Control)control.Current);
+ }
+ }
+
+ return null;
+#else
+ return Control.ControlNativeWindow.ControlFromHandle(handle);
+#endif
+ }
+
+ public static bool IsMnemonic(char charCode, string text) {
+ int amp;
+
+ amp = text.IndexOf('&');
+
+ if (amp != -1) {
+ if (amp + 1 < text.Length) {
+ if (text[amp + 1] != '&') {
+ if (Char.ToUpper(charCode) == Char.ToUpper(text.ToCharArray(amp + 1, 1)[0])) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+ #endregion
+
+ #region Protected Static Methods
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected static bool ReflectMessage(IntPtr hWnd, ref Message m) {
+ Control c;
+
+ c = Control.FromHandle(hWnd);
+
+ if (c != null) {
+ c.WndProc(ref m);
+ return true;
+ }
+ return false;
+ }
+ #endregion
+
+ #region Public Instance Methods
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public IAsyncResult BeginInvoke(Delegate method) {
+ return BeginInvokeInternal(method, null, false);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public IAsyncResult BeginInvoke (Delegate method, object[] args) {
+ return BeginInvokeInternal (method, args, false);
+ }
+
+ public void BringToFront() {
+ if ((parent != null) && (parent.child_controls[0]!=this)) {
+ if (parent.child_controls.Contains(this)) {
+ parent.child_controls.SetChildIndex(this, 0);
+ }
+ }
+
+ XplatUI.SetZOrder(this.window.Handle, IntPtr.Zero, true, false);
+
+ if (parent != null) {
+ parent.Refresh();
+ }
+ }
+
+ public bool Contains(Control ctl) {
+ while (ctl != null) {
+ ctl = ctl.parent;
+ if (ctl == this) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void CreateControl() {
+ if (is_created) {
+ return;
+ }
+
+ if (!IsHandleCreated) {
+ CreateHandle();
+ }
+
+ if (!is_created) {
+ is_created = true;
+ }
+
+ Control [] controls = child_controls.GetAllControls ();
+ for (int i=0; i<controls.Length; i++) {
+ controls [i].CreateControl ();
+ }
+
+ UpdateZOrder();
+
+ if (binding_context == null) { // seem to be sent whenever it's null?
+ OnBindingContextChanged(EventArgs.Empty);
+ }
+
+ OnCreateControl();
+ }
+
+ public Graphics CreateGraphics() {
+ if (!IsHandleCreated) {
+ this.CreateHandle();
+ }
+ return Graphics.FromHwnd(this.window.Handle);
+ }
+
+ public DragDropEffects DoDragDrop(object data, DragDropEffects allowedEffects) {
+ return XplatUI.StartDrag(this.window.Handle, data, allowedEffects);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public object EndInvoke (IAsyncResult async_result) {
+ AsyncMethodResult result = (AsyncMethodResult) async_result;
+ return result.EndInvoke ();
+ }
+
+ public Form FindForm() {
+ Control c;
+
+ c = this;
+ while (c != null) {
+ if (c is Form) {
+ return (Form)c;
+ }
+ c = c.Parent;
+ }
+ return null;
+ }
+
+ public bool Focus() {
+ if (IsHandleCreated && !has_focus) {
+ has_focus = true;
+ XplatUI.SetFocus(window.Handle);
+ }
+ return true;
+ }
+
+ public Control GetChildAtPoint(Point pt) {
+ // Microsoft's version of this function doesn't seem to work, so I can't check
+ // if we only consider children or also grandchildren, etc.
+ // I'm gonna say 'children only'
+ for (int i=0; i<child_controls.Count; i++) {
+ if (child_controls[i].Bounds.Contains(pt)) {
+ return child_controls[i];
+ }
+ }
+ return null;
+ }
+
+ public IContainerControl GetContainerControl() {
+ Control current = this;
+
+ while (current!=null) {
+ if ((current is IContainerControl) && ((current.control_style & ControlStyles.ContainerControl)!=0)) {
+ return (IContainerControl)current;
+ }
+ current = current.parent;
+ }
+ return null;
+ }
+
+ public Control GetNextControl(Control ctl, bool forward) {
+ // If we're not a container we don't play
+ if (!(this is IContainerControl) && !this.GetStyle(ControlStyles.ContainerControl)) {
+ return null;
+ }
+
+ // If ctl is not contained by this, we start at the first child of this
+ if (!this.Contains(ctl)) {
+ ctl = null;
+ }
+
+ // Search through our controls, starting at ctl, stepping into children as we encounter them
+ // try to find the control with the tabindex closest to our own, or, if we're looking into
+ // child controls, the one with the smallest tabindex
+ if (forward) {
+ return FindControlForward(this, ctl);
+ }
+ return FindControlBackward(this, ctl);
+ }
+
+ public void Hide() {
+ this.Visible = false;
+ }
+
+ public void Invalidate() {
+ Invalidate(ClientRectangle, false);
+ }
+
+ public void Invalidate(bool invalidateChildren) {
+ Invalidate(ClientRectangle, invalidateChildren);
+ }
+
+ public void Invalidate(System.Drawing.Rectangle rc) {
+ Invalidate(rc, false);
+ }
+
+ public void Invalidate(System.Drawing.Rectangle rc, bool invalidateChildren) {
+ if (!IsHandleCreated || !Visible || rc.Width == 0 || rc.Height == 0) {
+ return;
+ }
+
+ NotifyInvalidate(rc);
+
+ XplatUI.Invalidate(Handle, rc, false);
+
+ if (invalidateChildren) {
+ Control [] controls = child_controls.GetAllControls ();
+ for (int i=0; i<controls.Length; i++)
+ controls [i].Invalidate ();
+ }
+ OnInvalidated(new InvalidateEventArgs(rc));
+ }
+
+ public void Invalidate(System.Drawing.Region region) {
+ Invalidate(region, false);
+ }
+
+ public void Invalidate(System.Drawing.Region region, bool invalidateChildren) {
+ RectangleF bounds = region.GetBounds (CreateGraphics ());
+ Invalidate (new Rectangle ((int) bounds.X, (int) bounds.Y, (int) bounds.Width, (int) bounds.Height),
+ invalidateChildren);
+ }
+
+ public object Invoke (Delegate method) {
+ object [] prms = null;
+ if (method is EventHandler)
+ prms = new object [] { this, EventArgs.Empty };
+
+ return Invoke(method, prms);
+ }
+
+ public object Invoke (Delegate method, object[] args) {
+ if (!this.InvokeRequired) {
+ return method.DynamicInvoke(args);
+ }
+
+ IAsyncResult result = BeginInvoke (method, args);
+ return EndInvoke(result);
+ }
+
+ internal object InvokeInternal (Delegate method, bool disposing) {
+ return InvokeInternal(method, null, disposing);
+ }
+
+ internal object InvokeInternal (Delegate method, object[] args, bool disposing) {
+ if (!this.InvokeRequired) {
+ return method.DynamicInvoke(args);
+ }
+
+ IAsyncResult result = BeginInvokeInternal (method, args, disposing);
+ return EndInvoke(result);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public void PerformLayout() {
+ PerformLayout(null, null);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public void PerformLayout(Control affectedControl, string affectedProperty) {
+ LayoutEventArgs levent = new LayoutEventArgs(affectedControl, affectedProperty);
+
+ if (layout_suspended > 0) {
+ layout_pending = true;
+ return;
+ }
+
+ layout_pending = false;
+
+ // Prevent us from getting messed up
+ layout_suspended++;
+
+ // Perform all Dock and Anchor calculations
+ try {
+ Control child;
+ AnchorStyles anchor;
+ Rectangle space;
+
+ space=this.DisplayRectangle;
+
+ // Deal with docking; go through in reverse, MS docs say that lowest Z-order is closest to edge
+ Control [] controls = child_controls.GetAllControls ();
+ for (int i = controls.Length - 1; i >= 0; i--) {
+ child = controls [i];
+ switch (child.Dock) {
+ case DockStyle.None: {
+ // Do nothing
+ break;
+ }
+
+ case DockStyle.Left: {
+ child.SetBounds(space.Left, space.Y, child.Width, space.Height);
+ space.X+=child.Width;
+ space.Width-=child.Width;
+ break;
+ }
+
+ case DockStyle.Top: {
+ child.SetBounds(space.Left, space.Y, space.Width, child.Height);
+ space.Y+=child.Height;
+ space.Height-=child.Height;
+ break;
+ }
+
+ case DockStyle.Right: {
+ child.SetBounds(space.Right-child.Width, space.Y, child.Width, space.Height);
+ space.Width-=child.Width;
+ break;
+ }
+
+ case DockStyle.Bottom: {
+ child.SetBounds(space.Left, space.Bottom-child.Height, space.Width, child.Height);
+ space.Height-=child.Height;
+ break;
+ }
+ }
+ }
+
+ for (int i = controls.Length - 1; i >= 0; i--) {
+ child=controls[i];
+
+ if (child.Dock == DockStyle.Fill) {
+ child.SetBounds(space.Left, space.Top, space.Width, space.Height);
+ space.Width=0;
+ space.Height=0;
+ }
+ }
+
+ space=this.DisplayRectangle;
+
+ for (int i=0; i < controls.Length; i++) {
+ int left;
+ int top;
+ int width;
+ int height;
+
+ child = controls[i];
+ anchor = child.Anchor;
+
+ left = child.Left;
+ top = child.Top;
+ width = child.Width;
+ height = child.Height;
+
+ // If the control is docked we don't need to do anything
+ if (child.Dock != DockStyle.None) {
+ continue;
+ }
+
+ if ((anchor & AnchorStyles.Left) !=0 ) {
+ if ((anchor & AnchorStyles.Right) != 0) {
+ width = client_size.Width - child.dist_right - left;
+ } else {
+ ; // Left anchored only, nothing to be done
+ }
+ } else if ((anchor & AnchorStyles.Right) != 0) {
+ left = client_size.Width - child.dist_right - width;
+ } else {
+ // left+=diff_width/2 will introduce rounding errors (diff_width removed from svn after r51780)
+ // This calculates from scratch every time:
+ left = child.dist_left + (client_size.Width - (child.dist_left + width + child.dist_right)) / 2;
+ }
+
+ if ((anchor & AnchorStyles.Top) !=0 ) {
+ if ((anchor & AnchorStyles.Bottom) != 0) {
+ height = client_size.Height - child.dist_bottom - top;
+ } else {
+ ; // Top anchored only, nothing to be done
+ }
+ } else if ((anchor & AnchorStyles.Bottom) != 0) {
+ top = client_size.Height - child.dist_bottom - height;
+ } else {
+ // top += diff_height/2 will introduce rounding errors (diff_height removed from after r51780)
+ // This calculates from scratch every time:
+ top = child.dist_top + (client_size.Height - (child.dist_top + height + child.dist_bottom)) / 2;
+ }
+
+ // Sanity
+ if (width < 0) {
+ width=0;
+ }
+
+ if (height < 0) {
+ height=0;
+ }
+
+ child.SetBounds(left, top, width, height);
+ }
+
+ // Let everyone know
+ OnLayout(levent);
+ }
+
+ // Need to make sure we decremend layout_suspended
+ finally {
+ layout_suspended--;
+ }
+ }
+
+ public Point PointToClient (Point p) {
+ int x = p.X;
+ int y = p.Y;
+
+ XplatUI.ScreenToClient (Handle, ref x, ref y);
+
+ return new Point (x, y);
+ }
+
+ public Point PointToScreen(Point p) {
+ int x = p.X;
+ int y = p.Y;
+
+ XplatUI.ClientToScreen(Handle, ref x, ref y);
+
+ return new Point(x, y);
+ }
+
+ public virtual bool PreProcessMessage(ref Message msg) {
+ Keys key_data;
+
+ if ((msg.Msg == (int)Msg.WM_KEYDOWN) || (msg.Msg == (int)Msg.WM_SYSKEYDOWN)) {
+ key_data = (Keys)msg.WParam.ToInt32() | XplatUI.State.ModifierKeys;
+
+ if (!ProcessCmdKey(ref msg, key_data)) {
+ if (IsInputKey(key_data)) {
+ return false;
+ }
+
+ return ProcessDialogKey(key_data);
+ }
+
+ return true;
+ } else if (msg.Msg == (int)Msg.WM_CHAR) {
+ if (IsInputChar((char)msg.WParam)) {
+ return false;
+ }
+ } else if (msg.Msg == (int)Msg.WM_SYSCHAR) {
+ if (IsInputChar((char)msg.WParam)) {
+ return false;
+ }
+ return ProcessDialogChar((char)msg.WParam);
+ }
+ return false;
+ }
+
+ public Rectangle RectangleToClient(Rectangle r) {
+ return new Rectangle(PointToClient(r.Location), r.Size);
+ }
+
+ public Rectangle RectangleToScreen(Rectangle r) {
+ return new Rectangle(PointToScreen(r.Location), r.Size);
+ }
+
+ public virtual void Refresh() {
+ if (IsHandleCreated == true) {
+
+ Invalidate();
+ XplatUI.UpdateWindow(window.Handle);
+
+ Control [] controls = child_controls.GetAllControls ();
+ for (int i=0; i < controls.Length; i++) {
+ controls[i].Refresh();
+ }
+
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual void ResetBackColor() {
+ background_color = Color.Empty;
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [MonoTODO]
+ public void ResetBindings() {
+ // Do something
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual void ResetCursor() {
+ Cursor = null;
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual void ResetFont() {
+ font = null;
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual void ResetForeColor() {
+ foreground_color = Color.Empty;
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void ResetImeMode() {
+ ime_mode = DefaultImeMode;
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual void ResetRightToLeft() {
+ right_to_left = RightToLeft.Inherit;
+ }
+
+ public virtual void ResetText() {
+ text = String.Empty;
+ }
+
+ public void ResumeLayout() {
+ ResumeLayout (true);
+ }
+
+ public void ResumeLayout(bool performLayout) {
+ layout_suspended--;
+
+ if (layout_suspended > 0) {
+ return;
+ }
+
+ Control [] controls = child_controls.GetAllControls ();
+ for (int i=0; i<controls.Length; i++) {
+ controls [i].UpdateDistances ();
+ }
+
+ if (performLayout || layout_pending) {
+ PerformLayout();
+ }
+ }
+
+ public void Scale(float ratio) {
+ ScaleCore(ratio, ratio);
+ }
+
+ public void Scale(float dx, float dy) {
+ ScaleCore(dx, dy);
+ }
+
+ public void Select() {
+ Select(false, false);
+ }
+
+ public bool SelectNextControl(Control ctl, bool forward, bool tabStopOnly, bool nested, bool wrap) {
+ Control c;
+
+ c = ctl;
+ do {
+ c = GetNextControl(c, forward);
+ if (c == null) {
+ if (wrap) {
+ wrap = false;
+ continue;
+ }
+ break;
+ }
+
+ if (c.CanSelect && ((c.parent == ctl.parent) || nested) && (c.tab_stop || !tabStopOnly)) {
+ Select(c);
+ return true;
+ }
+ } while (c != ctl); // If we wrap back to ourselves we stop
+
+ return false;
+ }
+
+ public void SendToBack() {
+ if ((parent != null) && (parent.child_controls[parent.child_controls.Count-1]!=this)) {
+ if (parent.child_controls.Contains(this)) {
+ parent.child_controls.SetChildIndex(this, parent.child_controls.Count);
+ }
+ }
+
+ XplatUI.SetZOrder(this.window.Handle, IntPtr.Zero, false, true);
+ if (parent != null) {
+ parent.Refresh();
+ }
+ }
+
+ public void SetBounds(int x, int y, int width, int height) {
+ SetBoundsCore(x, y, width, height, BoundsSpecified.All);
+ }
+
+ public void SetBounds(int x, int y, int width, int height, BoundsSpecified specified) {
+ SetBoundsCore(x, y, width, height, specified);
+ }
+
+ public void Show() {
+ if (!IsHandleCreated) {
+ this.CreateControl();
+ }
+
+ this.Visible=true;
+ }
+
+ public void SuspendLayout() {
+ layout_suspended++;
+ }
+
+ public void Update() {
+ needs_redraw = true;
+ if (IsHandleCreated) {
+ XplatUI.UpdateWindow(window.Handle);
+ }
+ }
+ #endregion // Public Instance Methods
+
+ #region Protected Instance Methods
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [MonoTODO("Implement this and tie it into Control.ControlAccessibleObject.NotifyClients")]
+ protected void AccessibilityNotifyClients(AccessibleEvents accEvent, int childID) {
+ throw new NotImplementedException();
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual AccessibleObject CreateAccessibilityInstance() {
+ return new Control.ControlAccessibleObject(this);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual ControlCollection CreateControlsInstance() {
+ return new ControlCollection(this);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void CreateHandle() {
+ if (IsDisposed) {
+ throw new ObjectDisposedException(Name);
+ }
+
+ if (IsHandleCreated) {
+ return;
+ }
+
+ window.CreateHandle(CreateParams);
+
+ if (window.Handle != IntPtr.Zero) {
+ if (!controls.Contains(window.Handle)) {
+ controls.Add(this);
+ }
+
+ creator_thread = Thread.CurrentThread;
+
+ XplatUI.EnableWindow(window.Handle, is_enabled);
+
+ // Set our handle with our parent
+ if ((parent != null) && (parent.IsHandleCreated)) {
+ XplatUI.SetParent(window.Handle, parent.Handle);
+ }
+
+ // Set our handle as parent for our children
+ Control [] children;
+
+ children = child_controls.GetAllControls ();
+ for (int i = 0; i < children.Length; i++ ) {
+ if (children[i].IsHandleCreated) {
+ XplatUI.SetParent(children[i].Handle, window.Handle);
+ }
+ }
+
+ // Find out where the window manager placed us
+ UpdateStyles();
+ if ((CreateParams.Style & (int)WindowStyles.WS_CHILD) != 0) {
+ XplatUI.SetBorderStyle(window.Handle, (FormBorderStyle)border_style);
+ }
+ UpdateBounds();
+
+ OnHandleCreated(EventArgs.Empty);
+ }
+
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void DefWndProc(ref Message m) {
+ window.DefWndProc(ref m);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void DestroyHandle() {
+ if (IsHandleCreated) {
+ if (window != null) {
+ window.DestroyHandle();
+ }
+ }
+ }
+
+ protected bool GetStyle(ControlStyles flag) {
+ return (control_style & flag) != 0;
+ }
+
+ protected bool GetTopLevel() {
+ return is_toplevel;
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void InitLayout() {
+ UpdateDistances();
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected void InvokeGotFocus(Control toInvoke, EventArgs e) {
+ toInvoke.OnGotFocus(e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected void InvokeLostFocus(Control toInvoke, EventArgs e) {
+ toInvoke.OnLostFocus(e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected void InvokeOnClick(Control toInvoke, EventArgs e) {
+ toInvoke.OnClick(e);
+ }
+
+ protected void InvokePaint(Control toInvoke, PaintEventArgs e) {
+ toInvoke.OnPaint(e);
+ }
+
+ protected void InvokePaintBackground(Control toInvoke, PaintEventArgs e) {
+ toInvoke.OnPaintBackground(e);
+ }
+
+ protected virtual bool IsInputChar (char charCode) {
+ return true;
+ }
+
+ protected virtual bool IsInputKey (Keys keyData) {
+ // Doc says this one calls IsInputChar; not sure what to do with that
+ return false;
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void NotifyInvalidate(Rectangle invalidatedArea) {
+ // override me?
+ }
+
+ protected virtual bool ProcessCmdKey(ref Message msg, Keys keyData) {
+ if ((context_menu != null) && context_menu.ProcessCmdKey(ref msg, keyData)) {
+ return true;
+ }
+
+ if (parent != null) {
+ return parent.ProcessCmdKey(ref msg, keyData);
+ }
+
+ return false;
+ }
+
+ protected virtual bool ProcessDialogChar(char charCode) {
+ if (parent != null) {
+ return parent.ProcessDialogChar (charCode);
+ }
+
+ return false;
+ }
+
+ protected virtual bool ProcessDialogKey (Keys keyData) {
+ if (parent != null) {
+ return parent.ProcessDialogKey (keyData);
+ }
+
+ return false;
+ }
+
+ protected virtual bool ProcessKeyEventArgs (ref Message msg)
+ {
+ KeyEventArgs key_event;
+
+ switch (msg.Msg) {
+ case (int)Msg.WM_SYSKEYDOWN:
+ case (int)Msg.WM_KEYDOWN: {
+ key_event = new KeyEventArgs ((Keys)msg.WParam.ToInt32 ());
+ OnKeyDown (key_event);
+ return key_event.Handled;
+ }
+
+ case (int)Msg.WM_SYSKEYUP:
+ case (int)Msg.WM_KEYUP: {
+ key_event = new KeyEventArgs ((Keys)msg.WParam.ToInt32 ());
+ OnKeyUp (key_event);
+ return key_event.Handled;
+ }
+
+ case (int)Msg.WM_SYSCHAR:
+ case (int)Msg.WM_CHAR: {
+ KeyPressEventArgs key_press_event;
+
+ key_press_event = new KeyPressEventArgs((char)msg.WParam);
+ OnKeyPress(key_press_event);
+ return key_press_event.Handled;
+ }
+
+ default: {
+ break;
+ }
+ }
+
+ return false;
+ }
+
+ protected internal virtual bool ProcessKeyMessage(ref Message msg) {
+ if (parent != null) {
+ if (parent.ProcessKeyPreview(ref msg)) {
+ return true;
+ }
+ }
+
+ return ProcessKeyEventArgs(ref msg);
+ }
+
+ protected virtual bool ProcessKeyPreview(ref Message msg) {
+ if (parent != null) {
+ return parent.ProcessKeyPreview(ref msg);
+ }
+
+ return false;
+ }
+
+ protected virtual bool ProcessMnemonic(char charCode) {
+ // override me
+ return false;
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected void RaiseDragEvent(object key, DragEventArgs e) {
+ // MS Internal
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected void RaiseKeyEvent(object key, KeyEventArgs e) {
+ // MS Internal
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected void RaiseMouseEvent(object key, MouseEventArgs e) {
+ // MS Internal
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected void RaisePaintEvent(object key, PaintEventArgs e) {
+ // MS Internal
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected void RecreateHandle() {
+ IEnumerator child = child_controls.GetAllEnumerator();
+
+ is_recreating=true;
+
+ if (IsHandleCreated) {
+ DestroyHandle();
+ CreateHandle();
+
+ // FIXME ZOrder?
+
+ while (child.MoveNext()) {
+ ((Control)child.Current).RecreateHandle();
+ }
+ } else {
+ CreateControl();
+ }
+
+ is_recreating = false;
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected void ResetMouseEventArgs() {
+ // MS Internal
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected ContentAlignment RtlTranslateAlignment(ContentAlignment align) {
+ if (right_to_left == RightToLeft.No) {
+ return align;
+ }
+
+ switch (align) {
+ case ContentAlignment.TopLeft: {
+ return ContentAlignment.TopRight;
+ }
+
+ case ContentAlignment.TopRight: {
+ return ContentAlignment.TopLeft;
+ }
+
+ case ContentAlignment.MiddleLeft: {
+ return ContentAlignment.MiddleRight;
+ }
+
+ case ContentAlignment.MiddleRight: {
+ return ContentAlignment.MiddleLeft;
+ }
+
+ case ContentAlignment.BottomLeft: {
+ return ContentAlignment.BottomRight;
+ }
+
+ case ContentAlignment.BottomRight: {
+ return ContentAlignment.BottomLeft;
+ }
+
+ default: {
+ // if it's center it doesn't change
+ return align;
+ }
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected HorizontalAlignment RtlTranslateAlignment(HorizontalAlignment align) {
+ if ((right_to_left == RightToLeft.No) || (align == HorizontalAlignment.Center)) {
+ return align;
+ }
+
+ if (align == HorizontalAlignment.Left) {
+ return HorizontalAlignment.Right;
+ }
+
+ // align must be HorizontalAlignment.Right
+ return HorizontalAlignment.Left;
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected LeftRightAlignment RtlTranslateAlignment(LeftRightAlignment align) {
+ if (right_to_left == RightToLeft.No) {
+ return align;
+ }
+
+ if (align == LeftRightAlignment.Left) {
+ return LeftRightAlignment.Right;
+ }
+
+ // align must be LeftRightAlignment.Right;
+ return LeftRightAlignment.Left;
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected ContentAlignment RtlTranslateContent(ContentAlignment align) {
+ return RtlTranslateAlignment(align);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected HorizontalAlignment RtlTranslateHorizontal(HorizontalAlignment align) {
+ return RtlTranslateAlignment(align);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected LeftRightAlignment RtlTranslateLeftRight(LeftRightAlignment align) {
+ return RtlTranslateAlignment(align);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void ScaleCore(float dx, float dy) {
+ Point location;
+ Size size;
+
+ SuspendLayout();
+
+ location = new Point((int)(Left * dx), (int)(Top * dy));
+ size = this.ClientSize;
+
+
+ if (!GetStyle(ControlStyles.FixedWidth)) {
+ size.Width = (int)(size.Width * dx);
+ }
+
+ if (!GetStyle(ControlStyles.FixedHeight)) {
+ size.Height = (int)(size.Height * dy);
+ }
+
+ Location = location;
+ ClientSize = size;
+
+ /* Now scale our children */
+ Control [] controls = child_controls.GetAllControls ();
+ for (int i=0; i < controls.Length; i++) {
+ controls[i].Scale(dx, dy);
+ }
+
+ ResumeLayout();
+ }
+
+ protected virtual void Select(bool directed, bool forward) {
+ int index;
+ bool result;
+
+ if (!directed) {
+ // Select this control
+ Select(this);
+ return;
+ }
+
+ if (parent == null) {
+ return;
+ }
+
+ // FIXME - this thing is doing the wrong stuff, needs to be similar to SelectNextControl
+
+ index = parent.child_controls.IndexOf(this);
+ result = false;
+
+ do {
+ if (forward) {
+ if ((index+1) < parent.child_controls.Count) {
+ index++;
+ } else {
+ index = 0;
+ }
+ } else {
+ if (index>0) {
+ index++;
+ } else {
+ index = parent.child_controls.Count-1;
+ }
+ }
+ result = Select(parent.child_controls[index]);
+ } while (!result && parent.child_controls[index] != this);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified) {
+ // SetBoundsCore updates the Win32 control itself. UpdateBounds updates the controls variables and fires events, I'm guessing - pdb
+ if ((specified & BoundsSpecified.X) != BoundsSpecified.X) {
+ x = Left;
+ }
+
+ if ((specified & BoundsSpecified.Y) != BoundsSpecified.Y) {
+ y = Top;
+ }
+
+ if ((specified & BoundsSpecified.Width) != BoundsSpecified.Width) {
+ width = Width;
+ }
+
+ if ((specified & BoundsSpecified.Height) != BoundsSpecified.Height) {
+ height = Height;
+ }
+
+ if (IsHandleCreated) {
+ XplatUI.SetWindowPos(Handle, x, y, width, height);
+ }
+
+ UpdateBounds(x, y, width, height);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void SetClientSizeCore(int x, int y) {
+ // Calculate the actual window size from the client size (it usually stays the same or grows)
+ Rectangle ClientRect;
+ Rectangle WindowRect;
+ CreateParams cp;
+
+ ClientRect = new Rectangle(0, 0, x, y);
+ cp = this.CreateParams;
+
+ if (XplatUI.CalculateWindowRect(Handle, ref ClientRect, cp.Style, cp.ExStyle, null, out WindowRect)==false) {
+ return;
+ }
+
+ SetBoundsCore(bounds.X, bounds.Y, WindowRect.Width, WindowRect.Height, BoundsSpecified.Size);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected void SetStyle(ControlStyles flag, bool value) {
+ if (value) {
+ control_style |= flag;
+ } else {
+ control_style &= ~flag;
+ }
+ OnStyleChanged(EventArgs.Empty);
+ }
+
+ protected void SetTopLevel(bool value) {
+ if ((GetTopLevel() != value) && (parent != null)) {
+ throw new Exception();
+ }
+
+ if (this is Form) {
+ if (value == true) {
+ if (!Visible) {
+ Visible = true;
+ }
+ } else {
+ if (Visible) {
+ Visible = false;
+ }
+ }
+ }
+ is_toplevel = value;
+ }
+
+ protected virtual void SetVisibleCore(bool value) {
+ if (value!=is_visible) {
+ is_visible=value;
+
+ if (IsHandleCreated) {
+ XplatUI.SetVisible(Handle, value);
+ // Explicitly move Toplevel windows to where we want them;
+ // apparently moving unmapped toplevel windows doesn't work
+ if (is_visible && (this is Form)) {
+ XplatUI.SetWindowPos(window.Handle, bounds.X, bounds.Y, bounds.Width, bounds.Height);
+ }
+ }
+
+ if (!is_visible) {
+ if (dc_mem != null) {
+ dc_mem.Dispose();
+ dc_mem = null;
+ }
+
+ if (bmp_mem != null) {
+ bmp_mem.Dispose();
+ bmp_mem = null;
+ }
+ } else {
+ this.CreateBuffers(bounds.Width, bounds.Height);
+ CreateControl();
+ }
+
+ OnVisibleChanged(EventArgs.Empty);
+
+ if (value == false && parent != null) {
+ Control container;
+
+ // Need to start at parent, GetContainerControl might return ourselves if we're a container
+ container = (Control)parent.GetContainerControl();
+ if (container != null) {
+ container.SelectNextControl(this, true, true, true, true);
+ }
+ }
+
+ if (parent != null) {
+ parent.PerformLayout(this, "visible");
+ } else {
+ PerformLayout(this, "visible");
+ }
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected void UpdateBounds() {
+ int x;
+ int y;
+ int width;
+ int height;
+ int client_width;
+ int client_height;
+
+ if (!IsHandleCreated) {
+ CreateHandle();
+ }
+
+ XplatUI.GetWindowPos(this.Handle, this is Form, out x, out y, out width, out height, out client_width, out client_height);
+
+ UpdateBounds(x, y, width, height, client_width, client_height);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected void UpdateBounds(int x, int y, int width, int height) {
+ // UpdateBounds only seems to set our sizes and fire events but not update the GUI window to match
+ bool moved = false;
+ bool resized = false;
+
+ int client_x_diff = this.bounds.Width-this.client_size.Width;
+ int client_y_diff = this.bounds.Height-this.client_size.Height;
+
+ // Needed to generate required notifications
+ if ((this.bounds.X!=x) || (this.bounds.Y!=y)) {
+ moved=true;
+ }
+
+ if ((this.Bounds.Width!=width) || (this.Bounds.Height!=height)) {
+ resized=true;
+ }
+
+ bounds.X=x;
+ bounds.Y=y;
+ bounds.Width=width;
+ bounds.Height=height;
+
+ // Update client rectangle as well
+ client_size.Width=width-client_x_diff;
+ client_size.Height=height-client_y_diff;
+
+ UpdateDistances();
+
+ if (moved) {
+ OnLocationChanged(EventArgs.Empty);
+ }
+
+ if (resized) {
+ OnSizeChanged(EventArgs.Empty);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected void UpdateBounds(int x, int y, int width, int height, int clientWidth, int clientHeight) {
+ UpdateBounds(x, y, width, height);
+
+ this.client_size.Width=clientWidth;
+ this.client_size.Height=clientHeight;
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected void UpdateStyles() {
+ if (!IsHandleCreated) {
+ return;
+ }
+
+ XplatUI.SetWindowStyle(window.Handle, CreateParams);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected void UpdateZOrder() {
+ Control [] controls;
+ if (!IsHandleCreated) {
+ return;
+ }
+
+ controls = child_controls.GetAllControls ();
+ for (int i = 1; i < controls.Length; i++ ) {
+ XplatUI.SetZOrder(controls[i].Handle, controls[i-1].Handle, false, false);
+ }
+ }
+
+ protected virtual void WndProc(ref Message m) {
+#if debug
+ Console.WriteLine("Control {0} received message {1}", window.Handle == IntPtr.Zero ? this.Text : XplatUI.Window(window.Handle), (Msg)m.Msg);
+#endif
+ if ((this.control_style & ControlStyles.EnableNotifyMessage) != 0) {
+ OnNotifyMessage(m);
+ }
+
+ switch((Msg)m.Msg) {
+ case Msg.WM_DESTROY: {
+ OnHandleDestroyed(EventArgs.Empty);
+ window.InvalidateHandle();
+ return;
+ }
+
+ case Msg.WM_WINDOWPOSCHANGED: {
+ if (Visible) {
+ UpdateBounds();
+ if (GetStyle(ControlStyles.ResizeRedraw)) {
+ Invalidate();
+ }
+ }
+ return;
+ }
+
+ case Msg.WM_PAINT: {
+ PaintEventArgs paint_event;
+
+ paint_event = XplatUI.PaintEventStart(Handle, true);
+
+ if (!needs_redraw) {
+ // Just blit the previous image
+ paint_event.Graphics.DrawImage (ImageBuffer, paint_event.ClipRectangle, paint_event.ClipRectangle, GraphicsUnit.Pixel);
+ XplatUI.PaintEventEnd(Handle, true);
+ return;
+ }
+
+ Graphics dc = null;
+ if (ThemeEngine.Current.DoubleBufferingSupported)
+ if ((control_style & ControlStyles.DoubleBuffer) != 0) {
+ dc = paint_event.SetGraphics (DeviceContext);
+ }
+
+ OnPaintBackground(paint_event);
+ // Leave out for now, our controls can do Paint += ... as well
+ //OnPaintInternal(paint_event);
+ OnPaint(paint_event);
+
+ if (ThemeEngine.Current.DoubleBufferingSupported)
+ if ((control_style & ControlStyles.DoubleBuffer) != 0) {
+ dc.DrawImage (ImageBuffer, paint_event.ClipRectangle, paint_event.ClipRectangle, GraphicsUnit.Pixel);
+ paint_event.SetGraphics (dc);
+ needs_redraw = false;
+ }
+
+ XplatUI.PaintEventEnd(Handle, true);
+
+ return;
+ }
+
+ case Msg.WM_ERASEBKGND: {
+ // The DefWndProc will never have to handle this, we always paint the background in managed code
+ m.Result = (IntPtr)1;
+ return;
+ }
+
+ case Msg.WM_LBUTTONUP: {
+ OnMouseUp (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()) | MouseButtons.Left,
+ mouse_clicks,
+ LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
+ 0));
+ HandleClick(mouse_clicks);
+ if (mouse_clicks > 1) {
+ mouse_clicks = 1;
+ }
+ return;
+ }
+
+ case Msg.WM_LBUTTONDOWN: {
+ if (CanSelect && !is_selected) {
+ Select(this);
+ }
+ OnMouseDown (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
+ mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
+ 0));
+
+ return;
+ }
+
+ case Msg.WM_LBUTTONDBLCLK: {
+ mouse_clicks++;
+ OnMouseDown (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
+ mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
+ 0));
+
+ return;
+ }
+
+ case Msg.WM_MBUTTONUP: {
+ HandleClick(mouse_clicks);
+ OnMouseUp (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()) | MouseButtons.Middle,
+ mouse_clicks,
+ LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
+ 0));
+ if (mouse_clicks > 1) {
+ mouse_clicks = 1;
+ }
+ return;
+ }
+
+ case Msg.WM_MBUTTONDOWN: {
+ OnMouseDown (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
+ mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
+ 0));
+
+ return;
+ }
+
+ case Msg.WM_MBUTTONDBLCLK: {
+ mouse_clicks++;
+ OnMouseDown (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
+ mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
+ 0));
+ return;
+ }
+
+ case Msg.WM_RBUTTONUP: {
+ if (context_menu != null) {
+ context_menu.Show(this, new Point(LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ())));
+ }
+
+ HandleClick(mouse_clicks);
+ OnMouseUp (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()) | MouseButtons.Right,
+ mouse_clicks,
+ LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
+ 0));
+ if (mouse_clicks > 1) {
+ mouse_clicks = 1;
+ }
+ return;
+ }
+
+ case Msg.WM_RBUTTONDOWN: {
+ OnMouseDown (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
+ mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
+ 0));
+ return;
+ }
+
+ case Msg.WM_RBUTTONDBLCLK: {
+ mouse_clicks++;
+ OnMouseDown (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
+ mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
+ 0));
+ return;
+ }
+
+ case Msg.WM_MOUSEWHEEL: {
+
+ OnMouseWheel (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
+ mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
+ HighOrder(m.WParam.ToInt32())));
+ return;
+ }
+
+
+ case Msg.WM_MOUSEMOVE: {
+ OnMouseMove (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
+ mouse_clicks,
+ LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
+ 0));
+ return;
+ }
+
+ case Msg.WM_MOUSE_ENTER: {
+ if (is_entered) {
+ return;
+ }
+ is_entered = true;
+ OnMouseEnter(EventArgs.Empty);
+ return;
+ }
+
+ case Msg.WM_MOUSE_LEAVE: {
+ is_entered=false;
+ OnMouseLeave(EventArgs.Empty);
+ return;
+ }
+
+ case Msg.WM_MOUSEHOVER: {
+ OnMouseHover(EventArgs.Empty);
+ return;
+ }
+
+ case Msg.WM_SYSKEYDOWN:
+ case Msg.WM_KEYDOWN:
+ case Msg.WM_SYSKEYUP:
+ case Msg.WM_KEYUP:
+ case Msg.WM_SYSCHAR:
+ case Msg.WM_CHAR: {
+ if (ProcessKeyMessage(ref m)) {
+ return;
+ }
+
+ if ((m.Msg == (int)Msg.WM_SYSKEYUP) && ((m.WParam.ToInt32() & (int)Keys.KeyCode) == (int)Keys.Menu)) {
+ Form form;
+
+ form = FindForm();
+ if (form != null && form.ActiveMenu != null) {
+ form.ActiveMenu.ProcessCmdKey(ref m, (Keys)m.WParam.ToInt32());
+ }
+ }
+
+ DefWndProc (ref m);
+ return;
+ }
+
+ case Msg.WM_HELP: {
+ Point mouse_pos;
+ if (m.LParam != IntPtr.Zero) {
+ HELPINFO hi;
+
+ hi = new HELPINFO();
+
+ hi = (HELPINFO) Marshal.PtrToStructure (m.LParam, typeof (HELPINFO));
+ mouse_pos = new Point(hi.MousePos.x, hi.MousePos.y);
+ } else {
+ mouse_pos = Control.MousePosition;
+ }
+ OnHelpRequested(new HelpEventArgs(mouse_pos));
+ m.Result = (IntPtr)1;
+ return;
+ }
+
+ case Msg.WM_KILLFOCUS: {
+ OnLeave(EventArgs.Empty);
+ if (CausesValidation) {
+ CancelEventArgs e;
+ e = new CancelEventArgs(false);
+
+ OnValidating(e);
+
+ if (e.Cancel) {
+ Focus();
+ return;
+ }
+
+ OnValidated(EventArgs.Empty);
+ }
+
+ this.has_focus = false;
+ this.is_selected = false;
+ OnLostFocus(EventArgs.Empty);
+ return;
+ }
+
+ case Msg.WM_SETFOCUS: {
+ OnEnter(EventArgs.Empty);
+ this.has_focus = true;
+ OnGotFocus(EventArgs.Empty);
+ return;
+ }
+
+
+ case Msg.WM_SYSCOLORCHANGE: {
+ ThemeEngine.Current.ResetDefaults();
+ OnSystemColorsChanged(EventArgs.Empty);
+ return;
+ }
+
+
+ case Msg.WM_SETCURSOR: {
+ if (cursor == null) {
+ DefWndProc(ref m);
+ return;
+ }
+
+ XplatUI.SetCursor(window.Handle, cursor.handle);
+ m.Result = (IntPtr)1;
+
+ return;
+ }
+
+ default: {
+ DefWndProc(ref m);
+ return;
+ }
+ }
+ }
+ #endregion // Public Instance Methods
+
+ #region OnXXX methods
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnBackColorChanged(EventArgs e) {
+ if (BackColorChanged!=null) BackColorChanged(this, e);
+ for (int i=0; i<child_controls.Count; i++) child_controls[i].OnParentBackColorChanged(e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnBackgroundImageChanged(EventArgs e) {
+ if (BackgroundImageChanged!=null) BackgroundImageChanged(this, e);
+ for (int i=0; i<child_controls.Count; i++) child_controls[i].OnParentBackgroundImageChanged(e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnBindingContextChanged(EventArgs e) {
+ CheckDataBindings ();
+ if (BindingContextChanged!=null) {
+ BindingContextChanged(this, e);
+ }
+ for (int i=0; i<child_controls.Count; i++) child_controls[i].OnParentBindingContextChanged(e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnCausesValidationChanged(EventArgs e) {
+ if (CausesValidationChanged!=null) CausesValidationChanged(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnChangeUICues(UICuesEventArgs e) {
+ if (ChangeUICues!=null) ChangeUICues(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnClick(EventArgs e) {
+ if (Click!=null) Click(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnContextMenuChanged(EventArgs e) {
+ if (ContextMenuChanged!=null) ContextMenuChanged(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnControlAdded(ControlEventArgs e) {
+ if (ControlAdded!=null) ControlAdded(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnControlRemoved(ControlEventArgs e) {
+ if (ControlRemoved!=null) ControlRemoved(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnCreateControl() {
+ // Override me!
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnCursorChanged(EventArgs e) {
+ if (CursorChanged!=null) CursorChanged(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnDockChanged(EventArgs e) {
+ if (DockChanged!=null) DockChanged(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnDoubleClick(EventArgs e) {
+ if (DoubleClick!=null) DoubleClick(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnDragDrop(DragEventArgs drgevent) {
+ if (DragDrop!=null) DragDrop(this, drgevent);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnDragEnter(DragEventArgs drgevent) {
+ if (DragEnter!=null) DragEnter(this, drgevent);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnDragLeave(EventArgs e) {
+ if (DragLeave!=null) DragLeave(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnDragOver(DragEventArgs drgevent) {
+ if (DragOver!=null) DragOver(this, drgevent);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnEnabledChanged(EventArgs e) {
+ if (EnabledChanged!=null) EnabledChanged(this, e);
+ for (int i=0; i<child_controls.Count; i++) child_controls[i].OnParentEnabledChanged(e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnEnter(EventArgs e) {
+ if (Enter!=null) Enter(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnFontChanged(EventArgs e) {
+ if (FontChanged!=null) FontChanged(this, e);
+ for (int i=0; i<child_controls.Count; i++) child_controls[i].OnParentFontChanged(e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnForeColorChanged(EventArgs e) {
+ if (ForeColorChanged!=null) ForeColorChanged(this, e);
+ for (int i=0; i<child_controls.Count; i++) child_controls[i].OnParentForeColorChanged(e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnGiveFeedback(GiveFeedbackEventArgs gfbevent) {
+ if (GiveFeedback!=null) GiveFeedback(this, gfbevent);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnGotFocus(EventArgs e) {
+ if (GotFocus!=null) GotFocus(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnHandleCreated(EventArgs e) {
+ if (HandleCreated!=null) HandleCreated(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnHandleDestroyed(EventArgs e) {
+ if (HandleDestroyed!=null) HandleDestroyed(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnHelpRequested(HelpEventArgs hevent) {
+ if (HelpRequested!=null) HelpRequested(this, hevent);
+ }
+
+ protected virtual void OnImeModeChanged(EventArgs e) {
+ if (ImeModeChanged!=null) ImeModeChanged(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnInvalidated(InvalidateEventArgs e) {
+ needs_redraw = true;
+ if (Invalidated!=null) Invalidated(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnKeyDown(KeyEventArgs e) {
+ if (KeyDown!=null) KeyDown(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnKeyPress(KeyPressEventArgs e) {
+ if (KeyPress!=null) KeyPress(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnKeyUp(KeyEventArgs e) {
+ if (KeyUp!=null) KeyUp(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnLayout(LayoutEventArgs levent) {
+ if (Layout!=null) Layout(this, levent);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnLeave(EventArgs e) {
+ if (Leave!=null) Leave(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnLocationChanged(EventArgs e) {
+ OnMove(e);
+ if (LocationChanged!=null) LocationChanged(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnLostFocus(EventArgs e) {
+ if (LostFocus!=null) LostFocus(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnMouseDown(MouseEventArgs e) {
+ if (MouseDown!=null) MouseDown(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnMouseEnter(EventArgs e) {
+ if (MouseEnter!=null) MouseEnter(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnMouseHover(EventArgs e) {
+ if (MouseHover!=null) MouseHover(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnMouseLeave(EventArgs e) {
+ if (MouseLeave!=null) MouseLeave(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnMouseMove(MouseEventArgs e) {
+ if (MouseMove!=null) MouseMove(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnMouseUp(MouseEventArgs e) {
+ if (MouseUp!=null) MouseUp(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnMouseWheel(MouseEventArgs e) {
+ if (MouseWheel!=null) MouseWheel(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnMove(EventArgs e) {
+ if (Move!=null) Move(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnNotifyMessage(Message m) {
+ // Override me!
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnPaint(PaintEventArgs e) {
+ if (Paint!=null) Paint(this, e);
+ }
+
+ internal virtual void OnPaintInternal(PaintEventArgs e) {
+ // Override me
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnPaintBackground(PaintEventArgs pevent) {
+ PaintControlBackground (pevent);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnParentBackColorChanged(EventArgs e) {
+ if (background_color.IsEmpty && background_image==null) {
+ Invalidate();
+ OnBackColorChanged(e);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnParentBackgroundImageChanged(EventArgs e) {
+ if (background_color.IsEmpty && background_image==null) {
+ Invalidate();
+ OnBackgroundImageChanged(e);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnParentBindingContextChanged(EventArgs e) {
+ if (binding_context==null) {
+ binding_context=Parent.binding_context;
+ OnBindingContextChanged(e);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnParentChanged(EventArgs e) {
+ if (ParentChanged!=null) ParentChanged(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnParentEnabledChanged(EventArgs e) {
+ if (is_enabled != Parent.is_enabled) {
+ is_enabled=Parent.is_enabled;
+ Invalidate();
+ if (EnabledChanged != null) {
+ EnabledChanged(this, e);
+ }
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnParentFontChanged(EventArgs e) {
+ if (font==null) {
+ Invalidate();
+ OnFontChanged(e);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnParentForeColorChanged(EventArgs e) {
+ if (foreground_color.IsEmpty) {
+ Invalidate();
+ OnForeColorChanged(e);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnParentRightToLeftChanged(EventArgs e) {
+ if (right_to_left==RightToLeft.Inherit) {
+ Invalidate();
+ OnRightToLeftChanged(e);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnParentVisibleChanged(EventArgs e) {
+ if (is_visible) {
+ OnVisibleChanged(e);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnQueryContinueDrag(QueryContinueDragEventArgs e) {
+ if (QueryContinueDrag!=null) QueryContinueDrag(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnResize(EventArgs e) {
+ if (Resize!=null) Resize(this, e);
+
+ PerformLayout(this, "bounds");
+
+ if (parent != null) {
+ parent.PerformLayout();
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnRightToLeftChanged(EventArgs e) {
+ if (RightToLeftChanged!=null) RightToLeftChanged(this, e);
+ for (int i=0; i<child_controls.Count; i++) child_controls[i].OnParentRightToLeftChanged(e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnSizeChanged(EventArgs e) {
+ InvalidateBuffers ();
+ OnResize(e);
+ if (SizeChanged!=null) SizeChanged(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnStyleChanged(EventArgs e) {
+ if (StyleChanged!=null) StyleChanged(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnSystemColorsChanged(EventArgs e) {
+ if (SystemColorsChanged!=null) SystemColorsChanged(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnTabIndexChanged(EventArgs e) {
+ if (TabIndexChanged!=null) TabIndexChanged(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnTabStopChanged(EventArgs e) {
+ if (TabStopChanged!=null) TabStopChanged(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnTextChanged(EventArgs e) {
+ if (TextChanged!=null) TextChanged(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnValidated(EventArgs e) {
+ if (Validated!=null) Validated(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnValidating(System.ComponentModel.CancelEventArgs e) {
+ if (Validating!=null) Validating(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnVisibleChanged(EventArgs e) {
+ if (!is_visible) {
+ if (dc_mem!=null) {
+ dc_mem.Dispose ();
+ dc_mem=null;
+ }
+
+ if (bmp_mem!=null) {
+ bmp_mem.Dispose();
+ bmp_mem=null;
+ }
+ } else {
+ if (!is_disposed) {
+ if (!this.IsHandleCreated) {
+ this.CreateControl();
+ }
+ PerformLayout();
+ }
+ }
+
+ if (VisibleChanged!=null) VisibleChanged(this, e);
+
+ // We need to tell our kids
+ for (int i=0; i<child_controls.Count; i++) {
+ child_controls[i].OnParentVisibleChanged(e);
+ }
+ }
+ #endregion // OnXXX methods
+
+ #region Events
+ public event EventHandler BackColorChanged;
+ public event EventHandler BackgroundImageChanged;
+ public event EventHandler BindingContextChanged;
+ public event EventHandler CausesValidationChanged;
+ public event UICuesEventHandler ChangeUICues;
+ public event EventHandler Click;
+ public event EventHandler ContextMenuChanged;
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ public event ControlEventHandler ControlAdded;
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ public event ControlEventHandler ControlRemoved;
+
+ [MWFDescription("Fired when the cursor for the control has been changed"), MWFCategory("PropertyChanged")]
+ public event EventHandler CursorChanged;
+ public event EventHandler DockChanged;
+ public event EventHandler DoubleClick;
+ public event DragEventHandler DragDrop;
+ public event DragEventHandler DragEnter;
+ public event EventHandler DragLeave;
+ public event DragEventHandler DragOver;
+ public event EventHandler EnabledChanged;
+ public event EventHandler Enter;
+ public event EventHandler FontChanged;
+ public event EventHandler ForeColorChanged;
+ public event GiveFeedbackEventHandler GiveFeedback;
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ public event EventHandler GotFocus;
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ public event EventHandler HandleCreated;
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ public event EventHandler HandleDestroyed;
+
+ public event HelpEventHandler HelpRequested;
+ public event EventHandler ImeModeChanged;
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ public event InvalidateEventHandler Invalidated;
+
+ public event KeyEventHandler KeyDown;
+ public event KeyPressEventHandler KeyPress;
+ public event KeyEventHandler KeyUp;
+ public event LayoutEventHandler Layout;
+ public event EventHandler Leave;
+ public event EventHandler LocationChanged;
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ public event EventHandler LostFocus;
+
+ public event MouseEventHandler MouseDown;
+ public event EventHandler MouseEnter;
+ public event EventHandler MouseHover;
+ public event EventHandler MouseLeave;
+ public event MouseEventHandler MouseMove;
+ public event MouseEventHandler MouseUp;
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [Browsable(false)]
+ public event MouseEventHandler MouseWheel;
+
+ public event EventHandler Move;
+ public event PaintEventHandler Paint;
+ public event EventHandler ParentChanged;
+ public event QueryAccessibilityHelpEventHandler QueryAccessibilityHelp;
+ public event QueryContinueDragEventHandler QueryContinueDrag;
+ public event EventHandler Resize;
+ public event EventHandler RightToLeftChanged;
+ public event EventHandler SizeChanged;
+ public event EventHandler StyleChanged;
+ public event EventHandler SystemColorsChanged;
+ public event EventHandler TabIndexChanged;
+ public event EventHandler TabStopChanged;
+ public event EventHandler TextChanged;
+ public event EventHandler Validated;
+ public event CancelEventHandler Validating;
+ public event EventHandler VisibleChanged;
+ #endregion // Events
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ControlBindingsCollection.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ControlBindingsCollection.cs
new file mode 100644
index 00000000000..162730e651b
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ControlBindingsCollection.cs
@@ -0,0 +1,143 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Reflection;
+
+
+namespace System.Windows.Forms {
+ [DefaultEvent("CollectionChanged")]
+ [Editor("System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing, typeof(System.Drawing.Design.UITypeEditor))]
+ [TypeConverter("System.Windows.Forms.Design.ControlBindingsConverter, " + Consts.AssemblySystem_Design)]
+ public class ControlBindingsCollection : BindingsCollection {
+ #region Fields
+ private Control control;
+ #endregion // Fields
+
+ #region Constructors
+ internal ControlBindingsCollection (Control control) {
+ this.control = control;
+ }
+ #endregion // Constructors
+
+ #region Public Instance Properties
+ public Control Control {
+ get {
+ return control;
+ }
+ }
+
+ public Binding this[string propertyName] {
+ get {
+ foreach (Binding b in base.List) {
+ if (b.PropertyName == propertyName) {
+ return b;
+ }
+ }
+ return null;
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Instance Methods
+ public new void Add (Binding binding)
+ {
+ AddCore (binding);
+ OnCollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Add, binding));
+ }
+
+ public Binding Add (string property_name, object data_source, string data_member)
+ {
+ if (data_source == null) {
+ throw new ArgumentNullException ("DataSource cannot be null.");
+ }
+
+ Binding res = new Binding (property_name, data_source, data_member);
+ Add (res);
+ return res;
+ }
+
+ public void Clear() {
+ base.Clear();
+ }
+
+ public void Remove(Binding binding) {
+ if (binding == null) {
+ throw new NullReferenceException("The binding is null");
+ }
+
+ base.Remove(binding);
+ }
+
+ public void RemoveAt(int index) {
+ if (index < 0 || index >= base.List.Count) {
+ throw new ArgumentOutOfRangeException("index");
+ }
+
+ base.RemoveAt(index);
+ }
+ #endregion // Public Instance Methods
+
+ #region Protected Instance Methods
+ protected override void AddCore (Binding binding)
+ {
+ if (binding == null)
+ throw new ArgumentNullException ("dataBinding");
+
+ if (binding.Control != null && binding.Control != control)
+ throw new ArgumentException ("dataBinding belongs to another BindingsCollection");
+
+ for (int i = 0; i < Count; i++) {
+ Binding bnd = this [i];
+ if (bnd == null || bnd.PropertyName.Length == 0 || binding.PropertyName.Length == 0) {
+ continue;
+ }
+
+ if (String.Compare (bnd.PropertyName, binding.PropertyName, true) == 0) {
+ throw new ArgumentException ("The binding is already in the collection");
+ }
+ }
+
+ binding.SetControl (control);
+ base.AddCore (binding);
+ }
+
+ protected override void ClearCore() {
+ base.ClearCore ();
+ }
+
+ protected override void RemoveCore(Binding dataBinding) {
+ if (dataBinding == null) {
+ throw new ArgumentNullException ("dataBinding");
+ }
+
+ base.RemoveCore (dataBinding);
+ }
+ #endregion // Protected Instance Methods
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ControlEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ControlEventArgs.cs
new file mode 100644
index 00000000000..8b055659f45
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ControlEventArgs.cs
@@ -0,0 +1,48 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public class ControlEventArgs : EventArgs {
+ private Control control;
+
+ #region Public Constructors
+ public ControlEventArgs(Control control) {
+ this.control=control;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public Control Control {
+ get {
+ return this.control;
+ }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ControlEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ControlEventHandler.cs
new file mode 100644
index 00000000000..56b3183fa67
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ControlEventHandler.cs
@@ -0,0 +1,32 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public delegate void ControlEventHandler (object sender, ControlEventArgs e);
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ControlPaint.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ControlPaint.cs
new file mode 100644
index 00000000000..5884d1c6d2b
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ControlPaint.cs
@@ -0,0 +1,466 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// NOT COMPLETE
+
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Drawing.Imaging;
+
+namespace System.Windows.Forms {
+ public sealed class ControlPaint {
+ #region Local Variables
+ static int RGBMax=255;
+ static int HLSMax=255;
+ #endregion // Local Variables
+
+ #region Private Enumerations
+
+
+ #region Constructor
+ // Prevent a public constructor from being created
+ private ControlPaint() {
+ }
+ #endregion // Constructor
+
+
+ #endregion // Private Enumerations
+
+ #region Helpers
+ private static Color Win32ToColor(int Win32Color) {
+ return(Color.FromArgb(
+ (int)(Win32Color) & 0xff0000 >> 16, // blue
+ (int)(Win32Color) & 0xff00 >> 8, // green
+ (int)(Win32Color) & 0xff // red
+ ));
+ }
+
+ internal static void Color2HBS(Color color, out int h, out int l, out int s) {
+ int r;
+ int g;
+ int b;
+ int cMax;
+ int cMin;
+ int rDelta;
+ int gDelta;
+ int bDelta;
+
+ r=color.R;
+ g=color.G;
+ b=color.B;
+
+ cMax = Math.Max(Math.Max(r, g), b);
+ cMin = Math.Min(Math.Min(r, g), b);
+
+ l = (((cMax+cMin)*HLSMax)+RGBMax)/(2*RGBMax);
+
+ if (cMax==cMin) { // Achromatic
+ h=0; // h undefined
+ s=0;
+ return;
+ }
+
+ /* saturation */
+ if (l<=(HLSMax/2)) {
+ s=(((cMax-cMin)*HLSMax)+((cMax+cMin)/2))/(cMax+cMin);
+ } else {
+ s=(((cMax-cMin)*HLSMax)+((2*RGBMax-cMax-cMin)/2))/(2*RGBMax-cMax-cMin);
+ }
+
+ /* hue */
+ rDelta=(((cMax-r)*(HLSMax/6))+((cMax-cMin)/2))/(cMax-cMin);
+ gDelta=(((cMax-g)*(HLSMax/6))+((cMax-cMin)/2))/(cMax-cMin);
+ bDelta=(((cMax-b)*(HLSMax/6))+((cMax-cMin)/2))/(cMax-cMin);
+
+ if (r == cMax) {
+ h=bDelta - gDelta;
+ } else if (g == cMax) {
+ h=(HLSMax/3) + rDelta - bDelta;
+ } else { /* B == cMax */
+ h=((2*HLSMax)/3) + gDelta - rDelta;
+ }
+
+ if (h<0) {
+ h+=HLSMax;
+ }
+
+ if (h>HLSMax) {
+ h-=HLSMax;
+ }
+ }
+
+ private static int HueToRGB(int n1, int n2, int hue) {
+ if (hue<0) {
+ hue+=HLSMax;
+ }
+
+ if (hue>HLSMax) {
+ hue -= HLSMax;
+ }
+
+ /* return r,g, or b value from this tridrant */
+ if (hue<(HLSMax/6)) {
+ return(n1+(((n2-n1)*hue+(HLSMax/12))/(HLSMax/6)));
+ }
+
+ if (hue<(HLSMax/2)) {
+ return(n2);
+ }
+
+ if (hue<((HLSMax*2)/3)) {
+ return(n1+(((n2-n1)*(((HLSMax*2)/3)-hue)+(HLSMax/12))/(HLSMax/6)));
+ } else {
+ return(n1);
+ }
+ }
+
+ internal static Color HBS2Color(int hue, int lum, int sat) {
+ int R;
+ int G;
+ int B;
+ int Magic1;
+ int Magic2;
+
+ if (sat == 0) { /* Achromatic */
+ R=G=B=(lum*RGBMax)/HLSMax;
+ // FIXME : Should throw exception if hue!=0
+ } else {
+ if (lum<=(HLSMax/2)) {
+ Magic2=(lum*(HLSMax+sat)+(HLSMax/2))/HLSMax;
+ } else {
+ Magic2=sat+lum-((sat*lum)+(HLSMax/2))/HLSMax;
+ }
+ Magic1=2*lum-Magic2;
+
+ R = Math.Min(255, (HueToRGB(Magic1,Magic2,hue+(HLSMax/3))*RGBMax+(HLSMax/2))/HLSMax);
+ G = Math.Min(255, (HueToRGB(Magic1,Magic2,hue)*RGBMax+(HLSMax/2))/HLSMax);
+ B = Math.Min(255, (HueToRGB(Magic1,Magic2,hue-(HLSMax/3))*RGBMax+(HLSMax/2))/HLSMax);
+ }
+ return(Color.FromArgb(R, G, B));
+ }
+ #endregion // Helpers
+
+ #region Public Static Properties
+ public static Color ContrastControlDark {
+ get { return(SystemColors.ControlDark); }
+ }
+ #endregion // Public Static Properties
+
+ #region Public Static Methods
+ public static IntPtr CreateHBitmap16Bit(Bitmap bitmap, Color background){
+ throw new NotImplementedException ();
+ }
+
+ public static IntPtr CreateHBitmapColorMask(Bitmap bitmap, IntPtr monochromeMask){
+ throw new NotImplementedException ();
+ }
+
+ public static IntPtr CreateHBitmapTransparencyMask(Bitmap bitmap){
+ throw new NotImplementedException ();
+ }
+
+ public static Color Light(Color baseColor) {
+ return Light(baseColor, 0.5f);
+ }
+
+ public static Color Light(Color baseColor,float per) {
+ if (baseColor == ThemeEngine.Current.ColorControl) {
+ int r_sub, g_sub, b_sub;
+ Color color;
+
+ if (per <= 0f)
+ return ThemeEngine.Current.ColorControlLight;
+
+ if (per == 1.0f)
+ return ThemeEngine.Current.ColorControlLightLight;
+
+ r_sub = ThemeEngine.Current.ColorControlLightLight.R - ThemeEngine.Current.ColorControlLight.R;
+ g_sub = ThemeEngine.Current.ColorControlLightLight.G - ThemeEngine.Current.ColorControlLight.G;
+ b_sub = ThemeEngine.Current.ColorControlLightLight.B - ThemeEngine.Current.ColorControlLight.B;
+
+ color = Color.FromArgb (ThemeEngine.Current.ColorControlLight.A,
+ (int) (ThemeEngine.Current.ColorControlLight.R + (r_sub * per)),
+ (int) (ThemeEngine.Current.ColorControlLight.G + (g_sub * per)),
+ (int) (ThemeEngine.Current.ColorControlLight.B + (b_sub * per)));
+
+ return color;
+ }
+
+ int H, I, S;
+
+ ControlPaint.Color2HBS(baseColor, out H, out I, out S);
+ int PreIntensity = Math.Min (255, I + (int) (I * 0.5f));
+ int NewIntensity = Math.Min (255, PreIntensity + (int) (PreIntensity * per));
+ return ControlPaint.HBS2Color(H, NewIntensity, S);
+ }
+
+ public static Color LightLight(Color baseColor) {
+ return Light(baseColor, 1.0f);
+ }
+
+ public static Color Dark(Color baseColor) {
+ return Dark(baseColor, 0.5f);
+ }
+
+ public static Color Dark(Color baseColor,float per) {
+
+ if (baseColor == ThemeEngine.Current.ColorControl) {
+
+ int r_sub, g_sub, b_sub;
+ Color color;
+
+ if (per <= 0f)
+ return ThemeEngine.Current.ColorControlDark;
+
+ if (per == 1.0f)
+ return ThemeEngine.Current.ColorControlDarkDark;
+
+ r_sub = ThemeEngine.Current.ColorControlDarkDark.R - ThemeEngine.Current.ColorControlDark.R;
+ g_sub = ThemeEngine.Current.ColorControlDarkDark.G - ThemeEngine.Current.ColorControlDark.G;
+ b_sub = ThemeEngine.Current.ColorControlDarkDark.B - ThemeEngine.Current.ColorControlDark.B;
+
+ color = Color.FromArgb (ThemeEngine.Current.ColorControlDark.A,
+ (int) (ThemeEngine.Current.ColorControlDark.R + (r_sub * per)),
+ (int) (ThemeEngine.Current.ColorControlDark.G + (g_sub * per)),
+ (int) (ThemeEngine.Current.ColorControlDark.B + (b_sub * per)));
+ return color;
+ }
+
+ int H, I, S;
+
+ ControlPaint.Color2HBS(baseColor, out H, out I, out S);
+ int PreIntensity = Math.Max (0, I - (int) (I * 0.333f));
+ int NewIntensity = Math.Max (0, PreIntensity - (int) (PreIntensity * per));
+ return ControlPaint.HBS2Color(H, NewIntensity, S);
+ }
+
+ public static Color DarkDark(Color baseColor) {
+ return Dark(baseColor, 1.0f);
+ }
+
+ public static void DrawBorder(Graphics graphics, Rectangle bounds, Color color, ButtonBorderStyle style) {
+ DrawBorder(graphics, bounds, color, 1, style, color, 1, style, color, 1, style, color, 1, style);
+ }
+
+ public static void DrawBorder( Graphics graphics, Rectangle bounds, Color leftColor, int leftWidth,
+ ButtonBorderStyle leftStyle, Color topColor, int topWidth, ButtonBorderStyle topStyle,
+ Color rightColor, int rightWidth, ButtonBorderStyle rightStyle, Color bottomColor, int bottomWidth,
+ ButtonBorderStyle bottomStyle) {
+
+ ThemeEngine.Current.CPDrawBorder (graphics, bounds, leftColor, leftWidth,
+ leftStyle, topColor, topWidth, topStyle, rightColor, rightWidth, rightStyle,
+ bottomColor, bottomWidth, bottomStyle);
+ }
+
+
+ public static void DrawBorder3D(Graphics graphics, Rectangle rectangle) {
+ DrawBorder3D(graphics, rectangle, Border3DStyle.Etched, Border3DSide.All);
+ }
+
+ public static void DrawBorder3D(Graphics graphics, Rectangle rectangle, Border3DStyle style) {
+ DrawBorder3D(graphics, rectangle, style, Border3DSide.All);
+ }
+
+ public static void DrawBorder3D(Graphics graphics, int x, int y, int width, int height) {
+ DrawBorder3D(graphics, new Rectangle(x, y, width, height), Border3DStyle.Etched, Border3DSide.All);
+ }
+
+ public static void DrawBorder3D(Graphics graphics, int x, int y, int width, int height, Border3DStyle style) {
+ DrawBorder3D(graphics, new Rectangle(x, y, width, height), style, Border3DSide.All);
+ }
+
+ public static void DrawBorder3D( Graphics graphics, int x, int y, int width, int height, Border3DStyle style,Border3DSide sides) {
+ DrawBorder3D( graphics, new Rectangle(x, y, width, height), style, sides);
+ }
+
+ public static void DrawBorder3D( Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides) {
+
+ ThemeEngine.Current.CPDrawBorder3D (graphics, rectangle, style, sides);
+ }
+
+ public static void DrawButton( Graphics graphics, int x, int y, int width, int height, ButtonState state) {
+ DrawButton(graphics, new Rectangle(x, y, width, height), state);
+ }
+
+ public static void DrawButton( Graphics graphics, Rectangle rectangle, ButtonState state) {
+
+ ThemeEngine.Current.CPDrawButton (graphics, rectangle, state);
+ }
+
+
+ public static void DrawCaptionButton(Graphics graphics, int x, int y, int width, int height, CaptionButton button, ButtonState state) {
+ DrawCaptionButton(graphics, new Rectangle(x, y, width, height), button, state);
+ }
+
+ public static void DrawCaptionButton(Graphics graphics, Rectangle rectangle, CaptionButton button, ButtonState state) {
+
+ ThemeEngine.Current.CPDrawCaptionButton (graphics, rectangle, button, state);
+ }
+
+ public static void DrawCheckBox(Graphics graphics, int x, int y, int width, int height, ButtonState state) {
+ DrawCheckBox(graphics, new Rectangle(x, y, width, height), state);
+ }
+
+ public static void DrawCheckBox(Graphics graphics, Rectangle rectangle, ButtonState state) {
+
+ ThemeEngine.Current.CPDrawCheckBox (graphics, rectangle, state);
+ }
+
+ public static void DrawComboButton(Graphics graphics, Rectangle rectangle, ButtonState state) {
+
+ ThemeEngine.Current.CPDrawComboButton (graphics, rectangle, state);
+ }
+
+ public static void DrawComboButton(Graphics graphics, int x, int y, int width, int height, ButtonState state) {
+ DrawComboButton(graphics, new Rectangle(x, y, width, height), state);
+ }
+
+ public static void DrawContainerGrabHandle(Graphics graphics, Rectangle bounds) {
+
+ ThemeEngine.Current.CPDrawContainerGrabHandle (graphics, bounds);
+ }
+
+ public static void DrawFocusRectangle( Graphics graphics, Rectangle rectangle) {
+ DrawFocusRectangle(graphics, rectangle, SystemColors.Control, SystemColors.ControlText);
+ }
+
+ public static void DrawFocusRectangle( Graphics graphics, Rectangle rectangle, Color foreColor, Color backColor) {
+
+ ThemeEngine.Current.CPDrawFocusRectangle (graphics, rectangle, foreColor, backColor);
+ }
+
+ public static void DrawGrabHandle(Graphics graphics, Rectangle rectangle, bool primary, bool enabled) {
+
+ ThemeEngine.Current.CPDrawGrabHandle (graphics, rectangle, primary, enabled);
+ }
+
+ public static void DrawGrid(Graphics graphics, Rectangle area, Size pixelsBetweenDots, Color backColor) {
+
+ ThemeEngine.Current.CPDrawGrid (graphics, area, pixelsBetweenDots, backColor);
+ }
+
+ public static void DrawImageDisabled(Graphics graphics, Image image, int x, int y, Color background) {
+
+ ThemeEngine.Current.CPDrawImageDisabled (graphics, image, x, y, background);
+ }
+
+ public static void DrawLockedFrame(Graphics graphics, Rectangle rectangle, bool primary) {
+
+ ThemeEngine.Current.CPDrawLockedFrame (graphics, rectangle, primary);
+ }
+
+ public static void DrawMenuGlyph(Graphics graphics, Rectangle rectangle, MenuGlyph glyph) {
+
+ ThemeEngine.Current.CPDrawMenuGlyph (graphics, rectangle, glyph);
+ }
+
+ public static void DrawMenuGlyph(Graphics graphics, int x, int y, int width, int height, MenuGlyph glyph) {
+ DrawMenuGlyph(graphics, new Rectangle(x, y, width, height), glyph);
+ }
+
+ public static void DrawMixedCheckBox(Graphics graphics, Rectangle rectangle, ButtonState state) {
+ DrawCheckBox(graphics, rectangle, state);
+ }
+
+ public static void DrawMixedCheckBox(Graphics graphics, int x, int y, int width, int height, ButtonState state) {
+ DrawMixedCheckBox(graphics, new Rectangle(x, y, width, height), state);
+ }
+
+
+ public static void DrawRadioButton(Graphics graphics, int x, int y, int width, int height, ButtonState state) {
+ DrawRadioButton(graphics, new Rectangle(x, y, width, height), state);
+ }
+
+ public static void DrawRadioButton(Graphics graphics, Rectangle rectangle, ButtonState state) {
+
+ ThemeEngine.Current.CPDrawRadioButton (graphics, rectangle, state);
+ }
+
+ [MonoTODO("Figure out a good System.Drawing way for XOR drawing")]
+ private static bool DRFNotImpl = false;
+ public static void DrawReversibleFrame(Rectangle rectangle, Color backColor, FrameStyle style) {
+ if (!DRFNotImpl) {
+ DRFNotImpl = true;
+ Console.WriteLine("NOT IMPLEMENTED: FillReversibleRectangle(Rectangle rectangle, Color backColor)");
+ }
+ //throw new NotImplementedException();
+ }
+
+ [MonoTODO("Figure out a good System.Drawing way for XOR drawing")]
+ private static bool DRLNotImpl = false;
+ public static void DrawReversibleLine(Point start, Point end, Color backColor) {
+ if (!DRLNotImpl) {
+ DRLNotImpl = true;
+ Console.WriteLine("NOT IMPLEMENTED: FillReversibleRectangle(Rectangle rectangle, Color backColor)");
+ }
+ //throw new NotImplementedException();
+ }
+
+ [MonoTODO("Figure out a good System.Drawing way for XOR drawing")]
+ private static bool FRRNotImpl = false;
+ public static void FillReversibleRectangle(Rectangle rectangle, Color backColor) {
+ if (!FRRNotImpl) {
+ FRRNotImpl = true;
+ Console.WriteLine("NOT IMPLEMENTED: FillReversibleRectangle(Rectangle rectangle, Color backColor)");
+ }
+ //throw new NotImplementedException();
+ }
+
+
+ public static void DrawScrollButton (Graphics graphics, int x, int y, int width, int height, ScrollButton button, ButtonState state) {
+ ThemeEngine.Current.CPDrawScrollButton (graphics, new Rectangle(x, y, width, height), button, state);
+ }
+
+ public static void DrawScrollButton (Graphics graphics, Rectangle rectangle, ScrollButton button, ButtonState state) {
+ ThemeEngine.Current.CPDrawScrollButton (graphics, rectangle, button, state);
+ }
+
+ [MonoTODO]
+ private static bool DSFNotImpl = false;
+ public static void DrawSelectionFrame(Graphics graphics, bool active, Rectangle outsideRect, Rectangle insideRect, Color backColor) {
+ if (!DSFNotImpl) {
+ DSFNotImpl = true;
+ Console.WriteLine("NOT IMPLEMENTED: DrawSelectionFrame(Graphics graphics, bool active, Rectangle outsideRect, Rectangle insideRect, Color backColor)");
+ }
+ //throw new NotImplementedException();
+ }
+
+ public static void DrawSizeGrip (Graphics graphics, Color backColor, Rectangle bounds)
+ {
+ ThemeEngine.Current.CPDrawSizeGrip (graphics, backColor, bounds);
+ }
+
+ public static void DrawSizeGrip(Graphics graphics, Color backColor, int x, int y, int width, int height) {
+ DrawSizeGrip(graphics, backColor, new Rectangle(x, y, width, height));
+ }
+
+ public static void DrawStringDisabled(Graphics graphics, string s, Font font, Color color, RectangleF layoutRectangle, StringFormat format) {
+
+ ThemeEngine.Current.CPDrawStringDisabled (graphics, s, font, color, layoutRectangle, format);
+ }
+ #endregion // Public Static Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ControlStyles.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ControlStyles.cs
new file mode 100644
index 00000000000..f483d2027f7
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ControlStyles.cs
@@ -0,0 +1,50 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+
+ [Flags]
+ public enum ControlStyles {
+ ContainerControl = 0x00000001,
+ UserPaint = 0x00000002,
+ Opaque = 0x00000004,
+ ResizeRedraw = 0x00000010,
+ FixedWidth = 0x00000020,
+ FixedHeight = 0x00000040,
+ StandardClick = 0x00000100,
+ Selectable = 0x00000200,
+ UserMouse = 0x00000400,
+ SupportsTransparentBackColor = 0x00000800,
+ StandardDoubleClick = 0x00001000,
+ AllPaintingInWmPaint = 0x00002000,
+ CacheText = 0x00004000,
+ EnableNotifyMessage = 0x00008000,
+ DoubleBuffer = 0x00010000
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ConvertEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ConvertEventArgs.cs
new file mode 100644
index 00000000000..7675c9f4283
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ConvertEventArgs.cs
@@ -0,0 +1,60 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public class ConvertEventArgs : EventArgs {
+ private object object_value;
+ private Type desired_type;
+
+ #region Public Constructors
+ public ConvertEventArgs(object value, Type desiredType) {
+ this.object_value=value;
+ this.desired_type=desiredType;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public Type DesiredType {
+ get {
+ return this.desired_type;
+ }
+ }
+
+ public object Value {
+ get {
+ return this.object_value;
+ }
+
+ set {
+ this.object_value=value;
+ }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ConvertEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ConvertEventHandler.cs
new file mode 100644
index 00000000000..f90c1c0cfc4
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ConvertEventHandler.cs
@@ -0,0 +1,31 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public delegate void ConvertEventHandler (object sender, ConvertEventArgs e);
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Copyright b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Copyright
new file mode 100644
index 00000000000..e35b81540f3
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Copyright
@@ -0,0 +1,40 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//
+//
+//
+
+// NOT COMPLETE
+
+namespace System.Windows.Forms {
+ public class CreateParams {
+ #region Public Constructors
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ #endregion // Public Instance Properties
+
+ #region Public Instance Methods
+ #endregion // Public Instance Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CreateParams.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CreateParams.cs
new file mode 100644
index 00000000000..a5d267cb842
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CreateParams.cs
@@ -0,0 +1,125 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+ public class CreateParams {
+ #region Local Variables
+ private string caption;
+ private string class_name;
+ private int class_style;
+ private int ex_style;
+ private int x;
+ private int y;
+ private int height;
+ private int width;
+ private int style;
+ private object param;
+ private IntPtr parent;
+ #endregion // Local variables
+
+ #region Public Constructors
+ public CreateParams() {
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public string Caption {
+ get { return caption; }
+ set { caption = value; }
+ }
+
+ public string ClassName {
+ get { return class_name; }
+ set { class_name = value; }
+ }
+
+ public int ClassStyle {
+ get { return class_style; }
+ set { class_style = value; }
+ }
+
+ public int ExStyle {
+ get { return ex_style; }
+ set { ex_style = value; }
+ }
+
+ public int X {
+ get { return x; }
+ set { x = value; }
+ }
+
+ public int Y {
+ get { return y; }
+ set { y = value; }
+ }
+
+ public int Width {
+ get { return width; }
+ set { width = value; }
+ }
+
+ public int Height {
+ get { return height; }
+ set { height = value; }
+ }
+
+ public int Style {
+ get { return style; }
+ set { style = value; }
+ }
+
+ public object Param {
+ get { return param; }
+ set { param = value; }
+ }
+
+ public IntPtr Parent {
+ get { return parent; }
+ set { parent = value; }
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Instance Methods
+ public override string ToString() {
+ return "CreateParams {'" + class_name +
+ "', '" + caption +
+ "', " + String.Format("0x{0:X}", class_style) +
+ ", " + String.Format("0x{0:X}", ex_style) +
+ ", {" + String.Format("{0}", x) +
+ ", " + String.Format("{0}", y) +
+ ", " + String.Format("{0}", width) +
+ ", " + String.Format("{0}", height) +
+ "}}";
+ }
+ #endregion // Public Instance Methods
+
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CurrencyManager.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CurrencyManager.cs
new file mode 100644
index 00000000000..23a214175fd
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CurrencyManager.cs
@@ -0,0 +1,289 @@
+// 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) 2005 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+//
+
+using System;
+using System.Data;
+using System.Reflection;
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+ [DefaultMember("Item")]
+ public class CurrencyManager : BindingManagerBase {
+
+ protected Type finalType;
+ protected int listposition;
+
+ private IList list;
+ private bool binding_suspended;
+
+ internal CurrencyManager (object data_source)
+ {
+ if (data_source is IListSource) {
+ list = ((IListSource) data_source).GetList ();
+ } else if (data_source is IList) {
+ list = (IList) data_source;
+ } else {
+ throw new Exception ("Attempted to create currency manager " +
+ "from invalid type: " + data_source.GetType ());
+ }
+
+ if (data_source as ArrayList != null) {
+ finalType = ((ArrayList)data_source).GetType ();
+ } else {
+ if (data_source as Array != null) {
+ finalType = ((Array) data_source).GetType ();
+ } else {
+ finalType = null;
+ }
+ }
+
+ DataTable table = data_source as DataTable;
+ if (table == null && data_source is DataView)
+ table = ((DataView) data_source).Table;
+
+ if (table != null) {
+ table.Columns.CollectionChanged += new CollectionChangeEventHandler (MetaDataChangedHandler);
+ table.ChildRelations.CollectionChanged += new CollectionChangeEventHandler (MetaDataChangedHandler);
+ table.ParentRelations.CollectionChanged += new CollectionChangeEventHandler (MetaDataChangedHandler);
+ table.Constraints.CollectionChanged += new CollectionChangeEventHandler (MetaDataChangedHandler);
+ }
+ }
+
+ public IList List {
+ get { return list; }
+ }
+
+ public override object Current {
+ get {
+ return list [listposition];
+ }
+ }
+
+ public override int Count {
+ get { return list.Count; }
+ }
+
+ public override int Position {
+ get {
+ return listposition;
+ }
+ set {
+ if (value < 0)
+ value = 0;
+ if (value == list.Count)
+ value = list.Count - 1;
+ if (listposition == value)
+ return;
+ listposition = value;
+ OnCurrentChanged (EventArgs.Empty);
+ OnPositionChanged (EventArgs.Empty);
+ }
+ }
+
+ internal string ListName {
+ get {
+ ITypedList typed = list as ITypedList;
+
+ if (typed == null) {
+ return finalType.Name;
+ } else {
+ return typed.GetListName (null);
+ }
+ }
+ }
+
+ public override PropertyDescriptorCollection GetItemProperties ()
+ {
+ ITypedList typed = list as ITypedList;
+
+ if (list is Array) {
+ Type element = list.GetType ().GetElementType ();
+ return TypeDescriptor.GetProperties (element);
+ }
+
+ if (typed != null) {
+ return typed.GetItemProperties (null);
+ }
+
+ PropertyInfo [] props = finalType.GetProperties ();
+ for (int i = 0; i < props.Length; i++) {
+ if (props [i].Name == "Item") {
+ Type t = props [i].PropertyType;
+ if (t == typeof (object))
+ continue;
+ return GetBrowsableProperties (t);
+ }
+ }
+
+ if (list.Count > 0) {
+ return GetBrowsableProperties (list [0].GetType ());
+ }
+
+ return new PropertyDescriptorCollection (null);
+ }
+
+ public override void RemoveAt (int index)
+ {
+ list.RemoveAt (index);
+ }
+
+ public override void SuspendBinding ()
+ {
+ binding_suspended = true;
+ }
+
+ public override void ResumeBinding ()
+ {
+ binding_suspended = false;
+ }
+
+ internal override bool IsSuspended {
+ get { return binding_suspended; }
+ }
+
+ internal bool CanAddRows {
+ get {
+ if (list as IBindingList == null) {
+ return false;
+ }
+
+ return true;
+ }
+ }
+
+ public override void AddNew ()
+ {
+ if (list as IBindingList == null)
+ throw new NotSupportedException ();
+
+ (list as IBindingList).AddNew ();
+ }
+
+ public override void CancelCurrentEdit ()
+ {
+ IEditableObject editable = Current as IEditableObject;
+
+ if (editable == null)
+ return;
+ editable.CancelEdit ();
+ OnItemChanged (new ItemChangedEventArgs (Position));
+ }
+
+ public override void EndCurrentEdit ()
+ {
+ IEditableObject editable = Current as IEditableObject;
+
+ if (editable == null)
+ return;
+ editable.EndEdit ();
+ }
+
+ public void Refresh ()
+ {
+ PullData ();
+ }
+
+ [MonoTODO ("This is just a guess, as I can't figure out how to test this method")]
+ protected void CheckEmpty ()
+ {
+ if (list == null || list.Count < 1)
+ throw new Exception ("List is empty.");
+
+ }
+
+ protected internal override void OnCurrentChanged (EventArgs e)
+ {
+ PullData ();
+
+ if (onCurrentChangedHandler != null) {
+ onCurrentChangedHandler (this, e);
+ }
+ }
+
+ protected virtual void OnItemChanged (ItemChangedEventArgs e)
+ {
+ PushData ();
+
+ if (ItemChanged != null)
+ ItemChanged (this, e);
+ }
+
+ protected virtual void OnPositionChanged (EventArgs e)
+ {
+ if (onPositionChangedHandler == null)
+ return;
+ onPositionChangedHandler (this, e);
+ }
+
+ protected internal override string GetListName (ArrayList accessors)
+ {
+ if (list is ITypedList) {
+ PropertyDescriptor [] pds;
+ pds = new PropertyDescriptor [accessors.Count];
+ accessors.CopyTo (pds, 0);
+ return ((ITypedList) list).GetListName (pds);
+ }
+ return String.Empty;
+ }
+
+ [MonoTODO ("Not totally sure how this works, its doesn't seemt to do a pull/push like i originally assumed")]
+ protected override void UpdateIsBinding ()
+ {
+ UpdateItem ();
+
+ foreach (Binding binding in Bindings)
+ binding.UpdateIsBinding ();
+ }
+
+ private void UpdateItem ()
+ {
+ // Probably should be validating or something here
+ EndCurrentEdit ();
+ }
+
+ internal object GetItem (int index)
+ {
+ return list [index];
+ }
+
+ private PropertyDescriptorCollection GetBrowsableProperties (Type t)
+ {
+ Attribute [] att = new System.Attribute [1];
+ att [0] = new BrowsableAttribute (true);
+ return TypeDescriptor.GetProperties (t, att);
+ }
+
+ private void MetaDataChangedHandler (object sender, CollectionChangeEventArgs e)
+ {
+ if (MetaDataChanged != null)
+ MetaDataChanged (this, EventArgs.Empty);
+ }
+
+ public event ItemChangedEventHandler ItemChanged;
+ public event EventHandler MetaDataChanged;
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Cursor.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Cursor.cs
new file mode 100644
index 00000000000..08efb1401c6
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Cursor.cs
@@ -0,0 +1,729 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// NOT COMPLETE
+
+using System;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.IO;
+using System.ComponentModel;
+using System.Runtime.InteropServices;
+using System.Runtime.Serialization;
+
+namespace System.Windows.Forms {
+ [Editor("System.Drawing.Design.CursorEditor, " + Consts.AssemblySystem_Drawing_Design, typeof(System.Drawing.Design.UITypeEditor))]
+ [Serializable]
+ [TypeConverter(typeof(CursorConverter))]
+ public sealed class Cursor : IDisposable, ISerializable {
+ #region Internal Structs
+ [StructLayout(LayoutKind.Sequential)]
+ private struct CursorDir {
+ internal ushort idReserved; // Reserved
+ internal ushort idType; // resource type (2 for cursors)
+ internal ushort idCount; // how many cursors
+ internal CursorEntry[] idEntries; // the entries for each cursor
+ };
+
+ [StructLayout(LayoutKind.Sequential)]
+ private struct CursorEntry {
+ internal byte width; // Width of cursor
+ internal byte height; // Height of cursor
+ internal byte colorCount; // colors in cursor
+ internal byte reserved; // Reserved
+ internal ushort xHotspot; // Hotspot X
+ internal ushort yHotspot; // Hotspot Y
+ internal ushort bitCount; // Bits per pixel
+ internal uint sizeInBytes; // size of (CursorInfoHeader + ANDBitmap + ORBitmap)
+ internal uint fileOffset; // position in file
+ };
+
+ [StructLayout(LayoutKind.Sequential)]
+ private struct CursorInfoHeader {
+ internal uint biSize;
+ internal int biWidth;
+ internal int biHeight;
+ internal ushort biPlanes;
+ internal ushort biBitCount;
+ internal uint biCompression;
+ internal uint biSizeImage;
+ internal int biXPelsPerMeter;
+ internal int biYPelsPerMeter;
+ internal uint biClrUsed;
+ internal uint biClrImportant;
+ };
+
+ [StructLayout(LayoutKind.Sequential)]
+ private struct CursorImage {
+ internal CursorInfoHeader cursorHeader; // image header
+ internal uint[] cursorColors; // colors table
+ internal byte[] cursorXOR; // bits for XOR mask
+ internal byte[] cursorAND; // bits for AND mask
+ };
+ #endregion // Internal structs
+
+ #region Local Variables
+ private static Cursor current;
+ private CursorDir cursor_dir;
+ private CursorImage[] cursor_data;
+ private int id;
+
+ internal IntPtr handle;
+ private Size size;
+ private Bitmap shape;
+ private Bitmap mask;
+ private Bitmap cursor;
+ internal string name;
+ #endregion // Local Variables
+
+ #region Public Constructors
+ private void CreateCursor(System.IO.Stream stream) {
+ InitFromStream(stream);
+ this.shape = ToBitmap(true, false);
+ this.mask = ToBitmap(false, false);
+ handle = XplatUI.DefineCursor(shape, mask, Color.FromArgb(255, 255, 255), Color.FromArgb(255, 255, 255), cursor_dir.idEntries[id].xHotspot, cursor_dir.idEntries[id].yHotspot);
+ this.shape.Dispose();
+ this.shape = null;
+ this.mask.Dispose();
+ this.mask = null;
+
+ if (handle != IntPtr.Zero) {
+ this.cursor = ToBitmap(true, true);
+ }
+ }
+
+ private Cursor(SerializationInfo info, StreamingContext context) {
+ }
+
+ private Cursor() {
+ }
+
+ ~Cursor() {
+ Dispose();
+ }
+
+ // This is supposed to take a Win32 handle
+ public Cursor(IntPtr handle) {
+ this.handle = handle;
+ }
+
+ public Cursor(System.IO.Stream stream) {
+ CreateCursor(stream);
+ }
+
+ public Cursor(string fileName) : this (new FileStream (fileName, FileMode.Open)) {
+ }
+
+ public Cursor(Type type, string resource) {
+ using (Stream s = type.Assembly.GetManifestResourceStream (type, resource)) {
+ if (s == null) {
+ throw new FileNotFoundException ("Resource name was not found: `" + resource + "'");
+ }
+ CreateCursor(s);
+ }
+ }
+ #endregion // Public Constructors
+
+ #region Public Static Properties
+ public static Rectangle Clip {
+ get {
+ IntPtr handle;
+ bool confined;
+ Rectangle rect;
+ Size size;
+
+ XplatUI.GrabInfo(out handle, out confined, out rect);
+ if (handle != IntPtr.Zero) {
+ return rect;
+ }
+
+ XplatUI.GetDisplaySize(out size);
+ rect.X = 0;
+ rect.Y = 0;
+ rect.Width = size.Width;
+ rect.Height = size.Height;
+ return rect;
+ }
+
+ [MonoTODO("First need to add ability to set cursor clip rectangle to XplatUI drivers to implement this property")]
+ set {
+ ;
+ }
+ }
+
+ [MonoTODO("Implement setting a null cursor, and add XplatUI method to get current cursor")]
+ public static Cursor Current {
+ get {
+ if (current != null) {
+ return current;
+ }
+ return Cursors.Default;
+ }
+
+ set {
+ if (current != value) {
+ current = value;
+ if (value != null){
+ // FIXME - define and set empty cursor
+ current = null;
+ XplatUI.OverrideCursor(IntPtr.Zero);
+ } else
+ XplatUI.OverrideCursor(current.handle);
+ }
+ }
+ }
+
+ public static Point Position {
+ get {
+ int x;
+ int y;
+
+ XplatUI.GetCursorPos (IntPtr.Zero, out x, out y);
+ return new Point (x, y);
+ }
+
+ set {
+ XplatUI.SetCursorPos(IntPtr.Zero, value.X, value.Y);
+ }
+ }
+ #endregion // Public Static Properties
+
+ #region Public Instance Properties
+ public IntPtr Handle {
+ get {
+ return handle;
+ }
+ }
+
+ public Size Size {
+ get {
+ return size;
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Static Methods
+ public static void Hide() {
+ XplatUI.ShowCursor(false);
+ }
+
+ public static void Show() {
+ XplatUI.ShowCursor(false);
+ }
+
+ public static bool operator !=(Cursor left, Cursor right) {
+ if ((object)left == (object)right) {
+ return false;
+ }
+
+ if ((object)left == null || (object)right == null) {
+ return true;
+ }
+
+ if (left.handle == right.handle) {
+ return false;
+ }
+ return true;
+ }
+
+
+ public static bool operator ==(Cursor left, Cursor right) {
+ if ((object)left == (object)right) {
+ return true;
+ }
+
+ if ((object)left == null || (object)right == null) {
+ return false;
+ }
+
+ if (left.handle == right.handle) {
+ return true;
+ }
+ return false;
+ }
+ #endregion // Public Static Methods
+
+ #region Public Instance Methods
+ public IntPtr CopyHandle() {
+ return handle;
+ }
+
+ public void Dispose() {
+ if (this.cursor != null) {
+ this.cursor.Dispose();
+ this.cursor = null;
+ }
+
+ if (this.shape != null) {
+ this.shape.Dispose();
+ this.shape = null;
+ }
+
+ if (this.mask != null) {
+ this.mask.Dispose();
+ this.mask = null;
+ }
+
+ GC.SuppressFinalize (this);
+ }
+
+ public void Draw(Graphics g, Rectangle targetRect) {
+ if (this.cursor != null) {
+ g.DrawImage(this.cursor, targetRect);
+ }
+ }
+
+ public void DrawStretched(Graphics g, Rectangle targetRect) {
+ if (this.cursor != null) {
+ g.DrawImage(this.cursor, targetRect, new Rectangle(0, 0, this.cursor.Width, this.cursor.Height), GraphicsUnit.Pixel);
+ }
+ }
+
+ public override bool Equals(object obj) {
+ if ( !(obj is Cursor)) {
+ return false;
+ }
+
+ if (((Cursor)obj).handle == this.handle) {
+ return true;
+ }
+
+ return false;
+ }
+
+ public override int GetHashCode() {
+ return base.GetHashCode ();
+ }
+
+ public override string ToString() {
+ if (name != null) {
+ return "[Cursor:" + name + "]";
+ }
+
+ throw new FormatException("Cannot convert custom cursors to string.");
+ }
+
+ void ISerializable.GetObjectData(SerializationInfo si, StreamingContext context) {
+ MemoryStream ms;
+ BinaryWriter wr;
+ CursorImage ci;
+
+ ms = new MemoryStream();
+ wr = new BinaryWriter(ms);
+ ci = cursor_data[this.id];
+
+ // Build the headers, first the CursorDir
+ wr.Write((ushort)0); // Reserved
+ wr.Write((ushort)2); // Resource type
+ wr.Write((ushort)1); // Count
+
+ // Next the CursorEntry
+ wr.Write((byte)cursor_dir.idEntries[this.id].width);
+ wr.Write((byte)cursor_dir.idEntries[this.id].height);
+ wr.Write((byte)cursor_dir.idEntries[this.id].colorCount);
+ wr.Write((byte)cursor_dir.idEntries[this.id].reserved);
+ wr.Write((ushort)cursor_dir.idEntries[this.id].xHotspot);
+ wr.Write((ushort)cursor_dir.idEntries[this.id].yHotspot);
+ wr.Write((uint)(40 + (ci.cursorColors.Length * 4) + ci.cursorXOR.Length + ci.cursorAND.Length));
+ wr.Write((uint)(6 + 16)); // CursorDir + CursorEntry size
+
+ // Then the CursorInfoHeader
+ wr.Write(ci.cursorHeader.biSize);
+ wr.Write(ci.cursorHeader.biWidth);
+ wr.Write(ci.cursorHeader.biHeight);
+ wr.Write(ci.cursorHeader.biPlanes);
+ wr.Write(ci.cursorHeader.biBitCount);
+ wr.Write(ci.cursorHeader.biCompression);
+ wr.Write(ci.cursorHeader.biSizeImage);
+ wr.Write(ci.cursorHeader.biXPelsPerMeter);
+ wr.Write(ci.cursorHeader.biYPelsPerMeter);
+ wr.Write(ci.cursorHeader.biClrUsed);
+ wr.Write(ci.cursorHeader.biClrImportant);
+ for (int i = 0; i < ci.cursorColors.Length; i++) {
+ wr.Write(ci.cursorColors[i]);
+ }
+ wr.Write(ci.cursorXOR);
+ wr.Write(ci.cursorAND);
+ wr.Flush();
+
+ si.AddValue ("CursorData", ms.ToArray());
+ }
+ #endregion // Public Instance Methods
+
+ #region Private Methods w
+ private void InitFromStream(Stream stream) {
+ ushort entry_count;
+ CursorEntry ce;
+ uint largest;
+
+ //read the cursor header
+ if (stream == null || stream.Length == 0) {
+ throw new System.ArgumentException ("The argument 'stream' must be a picture that can be used as a cursor", "stream");
+ }
+
+ BinaryReader reader = new BinaryReader (stream);
+
+ cursor_dir = new CursorDir ();
+ cursor_dir.idReserved = reader.ReadUInt16();
+ cursor_dir.idType = reader.ReadUInt16();
+ if (cursor_dir.idReserved != 0 || !(cursor_dir.idType == 2 || cursor_dir.idType == 1))
+ throw new System.ArgumentException ("Invalid Argument, format error", "stream");
+
+ entry_count = reader.ReadUInt16();
+ cursor_dir.idCount = entry_count;
+ cursor_dir.idEntries = new CursorEntry[entry_count];
+ cursor_data = new CursorImage[entry_count];
+
+ //now read in the CursorEntry structures
+ for (int i=0; i < entry_count; i++){
+ ce = new CursorEntry();
+
+ ce.width = reader.ReadByte();
+ ce.height = reader.ReadByte();
+ ce.colorCount = reader.ReadByte();
+ ce.reserved = reader.ReadByte();
+ ce.xHotspot = reader.ReadUInt16();
+ ce.yHotspot = reader.ReadUInt16();
+ ce.sizeInBytes = reader.ReadUInt32();
+ ce.fileOffset = reader.ReadUInt32();
+
+ cursor_dir.idEntries[i] = ce;
+ }
+
+ // If we have more than one pick the largest cursor
+ largest = 0;
+ for (int j=0; j < entry_count; j++){
+ if (cursor_dir.idEntries[j].sizeInBytes >= largest) {
+ largest = cursor_dir.idEntries[j].sizeInBytes;
+ this.id = (ushort)j;
+ this.size.Height = cursor_dir.idEntries[j].height;
+ this.size.Width = cursor_dir.idEntries[j].width;
+ }
+ }
+
+ //now read in the cursor data
+ for (int j = 0; j < entry_count; j++) {
+ CursorImage curdata;
+ CursorInfoHeader cih;
+ byte[] buffer;
+ BinaryReader cih_reader;
+ int num_colors;
+ int cursor_height;
+ int bytes_per_line;
+ int xor_size;
+ int and_size;
+
+ curdata = new CursorImage();
+ cih = new CursorInfoHeader();
+
+ stream.Seek (cursor_dir.idEntries[j].fileOffset, SeekOrigin.Begin);
+ buffer = new byte [cursor_dir.idEntries[j].sizeInBytes];
+ stream.Read (buffer, 0, buffer.Length);
+
+ cih_reader = new BinaryReader(new MemoryStream(buffer));
+
+ cih.biSize = cih_reader.ReadUInt32 ();
+ if (cih.biSize != 40) {
+ throw new System.ArgumentException ("Invalid cursor file", "stream");
+ }
+ cih.biWidth = cih_reader.ReadInt32 ();
+ cih.biHeight = cih_reader.ReadInt32 ();
+ cih.biPlanes = cih_reader.ReadUInt16 ();
+ cih.biBitCount = cih_reader.ReadUInt16 ();
+ cih.biCompression = cih_reader.ReadUInt32 ();
+ cih.biSizeImage = cih_reader.ReadUInt32 ();
+ cih.biXPelsPerMeter = cih_reader.ReadInt32 ();
+ cih.biYPelsPerMeter = cih_reader.ReadInt32 ();
+ cih.biClrUsed = cih_reader.ReadUInt32 ();
+ cih.biClrImportant = cih_reader.ReadUInt32 ();
+
+ curdata.cursorHeader = cih;
+
+ //Read the number of colors used and corresponding memory occupied by
+ //color table. Fill this memory chunk into rgbquad[]
+ switch (cih.biBitCount){
+ case 1: num_colors = 2; break;
+ case 4: num_colors = 16; break;
+ case 8: num_colors = 256; break;
+ default: num_colors = 0; break;
+ }
+
+ curdata.cursorColors = new uint[num_colors];
+ for (int i = 0; i < num_colors; i++) {
+ curdata.cursorColors[i] = cih_reader.ReadUInt32 ();
+ }
+
+ //XOR mask is immediately after ColorTable and its size is
+ //icon height* no. of bytes per line
+
+ //cursor height is half of BITMAPINFOHEADER.biHeight, since it contains
+ //both XOR as well as AND mask bytes
+ cursor_height = cih.biHeight/2;
+
+ //bytes per line should should be uint aligned
+ bytes_per_line = ((((cih.biWidth * cih.biPlanes * cih.biBitCount)+ 31)>>5)<<2);
+
+ //Determine the XOR array Size
+ xor_size = bytes_per_line * cursor_height;
+ curdata.cursorXOR = new byte[xor_size];
+ for (int i = 0; i < xor_size; i++) {
+ curdata.cursorXOR[i] = cih_reader.ReadByte();
+ }
+
+ //Determine the AND array size
+ and_size = (int)(cih_reader.BaseStream.Length - cih_reader.BaseStream.Position);
+ curdata.cursorAND = new byte[and_size];
+ for (int i = 0; i < and_size; i++) {
+ curdata.cursorAND[i] = cih_reader.ReadByte();
+ }
+
+ cursor_data[j] = curdata;
+ cih_reader.Close();
+ }
+
+ reader.Close();
+ }
+
+ private Bitmap ToBitmapOld(bool xor, bool transparent) {
+ Bitmap bmp;
+
+ if (cursor_data != null) {
+ MemoryStream stream;
+ BinaryWriter writer;
+ CursorImage ci;
+ uint offset;
+ uint filesize;
+ ushort reserved12;
+ CursorInfoHeader cih;
+ int color_count;
+
+ stream = new MemoryStream();
+ writer = new BinaryWriter (stream);
+
+ ci = cursor_data[this.id];
+
+ try {
+ // write bitmap file header
+ writer.Write ('B');
+ writer.Write ('M');
+
+ // write the file size
+ // file size = bitmapfileheader + bitmapinfo + colorpalette + image bits
+ // sizeof bitmapfileheader = 14 bytes
+ // sizeof bitmapinfo = 40 bytes
+ if (xor) {
+ offset = (uint)(14 + 40 + ci.cursorColors.Length * 4);
+ filesize = (uint)(offset + ci.cursorXOR.Length);
+ } else {
+ offset = (uint)(14 + 40 + 8); // AND mask is always monochrome
+ filesize = (uint)(offset + ci.cursorAND.Length);
+ }
+ writer.Write(filesize);
+
+ // write reserved words
+ reserved12 = 0;
+ writer.Write(reserved12);
+ writer.Write(reserved12);
+
+ // write offset
+ writer.Write (offset);
+
+ // write bitmapfile header
+ cih = ci.cursorHeader;
+ writer.Write(cih.biSize);
+ writer.Write(cih.biWidth);
+ writer.Write(cih.biHeight/2);
+ writer.Write(cih.biPlanes);
+ if (xor) {
+ writer.Write(cih.biBitCount);
+ } else {
+ writer.Write((ushort)1);
+ }
+ writer.Write(cih.biCompression);
+ if (xor) {
+ writer.Write(ci.cursorXOR.Length);
+ } else {
+ writer.Write(ci.cursorAND.Length);
+ }
+ writer.Write(cih.biXPelsPerMeter);
+ writer.Write(cih.biYPelsPerMeter);
+
+ // write color table
+ if (xor) {
+ writer.Write(cih.biClrUsed);
+ writer.Write(cih.biClrImportant);
+ color_count = ci.cursorColors.Length;
+ for (int j = 0; j < color_count; j++) {
+ writer.Write (ci.cursorColors[j]);
+ }
+ } else {
+ // 2 used colors
+ writer.Write(2);
+ // 2 important colors
+ writer.Write(2);
+
+ writer.Write((uint)0x00000000);
+ writer.Write((uint)0x00ffffff);
+ }
+
+ // write image bits
+ if (xor)
+ writer.Write(ci.cursorXOR);
+ else
+ writer.Write(ci.cursorAND);
+
+ writer.Flush();
+
+ bmp = new Bitmap(stream);
+
+ if (transparent) {
+ bmp = new Bitmap(bmp); // This makes a 32bpp image out of an indexed one
+ // Apply the mask to make properly transparent
+ for (int y = 0; y < cih.biHeight/2; y++) {
+ for (int x = 0; x < cih.biWidth / 8; x++) {
+ for (int bit = 7; bit >= 0; bit--) {
+ if (((ci.cursorAND[y * cih.biWidth / 8 +x] >> bit) & 1) != 0) {
+ bmp.SetPixel(x*8 + 7-bit, cih.biHeight/2 - y - 1, Color.Transparent);
+ }
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ throw e;
+ } finally {
+ writer.Close();
+ }
+ } else {
+ bmp = new Bitmap (32, 32);
+ }
+
+ return bmp;
+ }
+
+ private Bitmap ToBitmap(bool xor, bool transparent) {
+ CursorImage ci;
+ CursorInfoHeader cih;
+ int ncolors;
+ Bitmap bmp;
+ BitmapData bits;
+ ColorPalette pal;
+ int biHeight;
+ int bytesPerLine;
+
+ if (cursor_data == null) {
+ return new Bitmap(32, 32);
+ }
+
+ ci = cursor_data[this.id];
+ cih = ci.cursorHeader;
+ biHeight = cih.biHeight / 2;
+
+ if (!xor) {
+ // The AND mask is 1bit - very straightforward
+ bmp = new Bitmap(cih.biWidth, biHeight, PixelFormat.Format1bppIndexed);
+ pal = bmp.Palette;
+ pal.Entries[0] = Color.FromArgb(0, 0, 0);
+ pal.Entries[1] = Color.FromArgb(unchecked((int)0xffffffffff));
+ bits = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.WriteOnly, bmp.PixelFormat);
+
+ for (int y = 0; y < biHeight; y++) {
+ Marshal.Copy(ci.cursorAND, bits.Stride * y, (IntPtr)((int)bits.Scan0 + bits.Stride * (biHeight - 1 - y)), bits.Stride);
+ }
+
+ bmp.UnlockBits(bits);
+ } else {
+ ncolors = (int)cih.biClrUsed;
+ if (ncolors == 0) {
+ if (cih.biBitCount < 24) {
+ ncolors = (int)(1 << cih.biBitCount);
+ }
+ }
+
+ switch(cih.biBitCount) {
+ case 1: { // Monochrome
+ bmp = new Bitmap(cih.biWidth, biHeight, PixelFormat.Format1bppIndexed);
+ break;
+ }
+
+ case 4: { // 4bpp
+ bmp = new Bitmap(cih.biWidth, biHeight, PixelFormat.Format4bppIndexed);
+ break;
+ }
+
+ case 8: { // 8bpp
+ bmp = new Bitmap(cih.biWidth, biHeight, PixelFormat.Format8bppIndexed);
+ break;
+ }
+
+ case 24:
+ case 32: { // 32bpp
+ bmp = new Bitmap(cih.biWidth, biHeight, PixelFormat.Format32bppArgb);
+ break;
+ }
+
+ default: {
+ throw new Exception("Unexpected number of bits:" + cih.biBitCount.ToString());
+ }
+ }
+
+ if (cih.biBitCount < 24) {
+ pal = bmp.Palette; // Managed palette
+
+ for (int i = 0; i < ci.cursorColors.Length; i++) {
+ pal.Entries[i] = Color.FromArgb((int)ci.cursorColors[i] & unchecked((int)0xff000000));
+ }
+ }
+
+ bytesPerLine = (int)((((cih.biWidth * cih.biBitCount) + 31) & ~31) >> 3);
+ bits = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.WriteOnly, bmp.PixelFormat);
+
+ for (int y = 0; y < biHeight; y++) {
+ Marshal.Copy(ci.cursorXOR, bytesPerLine * y, (IntPtr)((int)bits.Scan0 + bits.Stride * (biHeight - 1 - y)), bytesPerLine);
+ }
+
+ bmp.UnlockBits(bits);
+ }
+
+ if (transparent) {
+ bmp = new Bitmap(bmp); // This makes a 32bpp image out of an indexed one
+ // Apply the mask to make properly transparent
+ for (int y = 0; y < biHeight; y++) {
+ for (int x = 0; x < cih.biWidth / 8; x++) {
+ for (int bit = 7; bit >= 0; bit--) {
+ if (((ci.cursorAND[y * cih.biWidth / 8 +x] >> bit) & 1) != 0) {
+ bmp.SetPixel(x*8 + 7-bit, biHeight - y - 1, Color.Transparent);
+ }
+ }
+ }
+ }
+ }
+
+ return bmp;
+ }
+ #endregion // Private Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CursorConverter.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CursorConverter.cs
new file mode 100644
index 00000000000..3f85767bd2e
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CursorConverter.cs
@@ -0,0 +1,116 @@
+// 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) 2005 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+
+using System;
+using System.IO;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.Collections;
+using System.ComponentModel;
+using System.Globalization;
+using System.Runtime.InteropServices;
+using System.Runtime.Serialization;
+
+
+namespace System.Windows.Forms {
+
+ public class CursorConverter : TypeConverter {
+
+ public CursorConverter ()
+ {
+ }
+
+ public override bool CanConvertFrom (ITypeDescriptorContext context, Type source_type)
+ {
+ if (source_type == typeof (byte []))
+ return true;
+ return base.CanConvertFrom (context, source_type);
+ }
+
+ public override bool CanConvertTo (ITypeDescriptorContext context, Type dest_type)
+ {
+ if (dest_type == typeof (byte []))
+ return true;
+ return base.CanConvertTo (context, dest_type);
+ }
+
+ public override object ConvertFrom (ITypeDescriptorContext context,
+ CultureInfo culture, object value)
+ {
+ byte [] val = value as byte [];
+ if (val == null)
+ return base.ConvertFrom (context, culture, value);
+
+ using (MemoryStream s = new MemoryStream (val)) {
+ return new Cursor (s);
+ }
+ }
+
+ public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture,
+ object value, Type dest_type)
+ {
+ if (dest_type == null)
+ throw new ArgumentNullException ("destinationType");
+
+ if ( !(value is Cursor)) {
+ throw new ArgumentException("object must be of class Cursor", "value");
+ }
+
+ if (dest_type == typeof (byte [])) {
+ Cursor c;
+ SerializationInfo si;
+
+ if (value == null) {
+ return new byte [0];
+ }
+
+ c = (Cursor)value;
+
+ si = new SerializationInfo(typeof(Cursor), new FormatterConverter());
+ ((ISerializable)c).GetObjectData(si, new StreamingContext(StreamingContextStates.Remoting));
+
+ return (byte[])si.GetValue("CursorData", typeof(byte[]));
+ }
+ return base.ConvertTo (context, culture, value, dest_type);
+ }
+
+ public override StandardValuesCollection GetStandardValues (ITypeDescriptorContext context)
+ {
+ PropertyDescriptorCollection props = TypeDescriptor.GetProperties (typeof (Cursors));
+ ArrayList vals = new ArrayList ();
+
+ for (int i = 0; i < props.Count; i++)
+ vals.Add (props [i].GetValue (null));
+ return new StandardValuesCollection (vals);
+ }
+
+ public override bool GetStandardValuesSupported (ITypeDescriptorContext context)
+ {
+ return true;
+ }
+ }
+
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Cursors.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Cursors.cs
new file mode 100644
index 00000000000..37decfc21c3
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Cursors.cs
@@ -0,0 +1,353 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public sealed class Cursors {
+ #region Local Variables
+ internal static Cursor app_starting;
+ internal static Cursor arrow;
+ internal static Cursor cross;
+ internal static Cursor def;
+ internal static Cursor hand;
+ internal static Cursor help;
+ internal static Cursor hsplit;
+ internal static Cursor ibeam;
+ internal static Cursor no;
+ internal static Cursor no_move_2d;
+ internal static Cursor no_move_horiz;
+ internal static Cursor no_move_vert;
+ internal static Cursor pan_east;
+ internal static Cursor pan_ne;
+ internal static Cursor pan_north;
+ internal static Cursor pan_nw;
+ internal static Cursor pan_se;
+ internal static Cursor pan_south;
+ internal static Cursor pan_sw;
+ internal static Cursor pan_west;
+ internal static Cursor size_all;
+ internal static Cursor size_nesw;
+ internal static Cursor size_ns;
+ internal static Cursor size_nwse;
+ internal static Cursor size_we;
+ internal static Cursor up_arrow;
+ internal static Cursor vsplit;
+ internal static Cursor wait_cursor;
+ #endregion // Local Variables
+
+ #region Constructors
+ private Cursors() {
+ }
+ #endregion // Constructors
+
+ #region Public Static Properties
+ public static Cursor AppStarting {
+ get {
+ if (app_starting == null) {
+ app_starting = new Cursor(XplatUI.DefineStdCursor(StdCursor.AppStarting));
+ app_starting.name = "AppStarting";
+ }
+ return app_starting;
+ }
+ }
+
+ public static Cursor Arrow {
+ get {
+ if (arrow == null) {
+ arrow = new Cursor(XplatUI.DefineStdCursor(StdCursor.Arrow));
+ arrow.name = "Arrow";
+ }
+ return arrow;
+ }
+ }
+
+ public static Cursor Cross {
+ get {
+ if (cross == null) {
+ cross = new Cursor(XplatUI.DefineStdCursor(StdCursor.Cross));
+ cross.name = "Cross";
+ }
+ return cross;
+ }
+ }
+
+ public static Cursor Default {
+ get {
+ if (def == null) {
+ def = new Cursor(XplatUI.DefineStdCursor(StdCursor.Default));
+ def.name = "Default";
+ }
+ return def;
+ }
+ }
+
+ public static Cursor Hand {
+ get {
+ if (hand == null) {
+ hand = new Cursor(XplatUI.DefineStdCursor(StdCursor.Hand));
+ hand.name = "Hand";
+ }
+ return hand;
+ }
+ }
+
+ public static Cursor Help {
+ get {
+ if (help == null) {
+ help = new Cursor(XplatUI.DefineStdCursor(StdCursor.Help));
+ help.name = "Help";
+ }
+ return help;
+ }
+ }
+
+ public static Cursor HSplit {
+ get {
+ if (hsplit == null) {
+ hsplit = new Cursor(XplatUI.DefineStdCursor(StdCursor.HSplit));
+ hsplit.name = "HSplit";
+ }
+ return hsplit;
+ }
+ }
+
+ public static Cursor IBeam {
+ get {
+ if (ibeam == null) {
+ ibeam = new Cursor(XplatUI.DefineStdCursor(StdCursor.IBeam));
+ ibeam.name = "IBeam";
+ }
+ return ibeam;
+ }
+ }
+
+ public static Cursor No {
+ get {
+ if (no == null) {
+ no = new Cursor(XplatUI.DefineStdCursor(StdCursor.No));
+ no.name = "No";
+ }
+ return no;
+ }
+ }
+
+ public static Cursor NoMove2D {
+ get {
+ if (no_move_2d == null) {
+ no_move_2d = new Cursor(XplatUI.DefineStdCursor(StdCursor.NoMove2D));
+ no_move_2d.name = "NoMove2D";
+ }
+ return no_move_2d;
+ }
+ }
+
+ public static Cursor NoMoveHoriz {
+ get {
+ if (no_move_horiz == null) {
+ no_move_horiz = new Cursor(XplatUI.DefineStdCursor(StdCursor.NoMoveHoriz));
+ no_move_horiz.name = "NoMoveHoriz";
+ }
+ return no_move_horiz;
+ }
+ }
+
+ public static Cursor NoMoveVert {
+ get {
+ if (no_move_vert == null) {
+ no_move_vert = new Cursor(XplatUI.DefineStdCursor(StdCursor.NoMoveVert));
+ no_move_vert.name = "NoMoveVert";
+ }
+ return no_move_vert;
+ }
+ }
+
+ public static Cursor PanEast {
+ get {
+ if (pan_east == null) {
+ pan_east = new Cursor(XplatUI.DefineStdCursor(StdCursor.PanEast));
+ pan_east.name = "PanEast";
+ }
+ return pan_east;
+ }
+ }
+
+
+
+
+ public static Cursor PanNE {
+ get {
+ if (pan_ne == null) {
+ pan_ne = new Cursor(XplatUI.DefineStdCursor(StdCursor.PanNE));
+ pan_ne.name = "PanNE";
+ }
+ return pan_ne;
+ }
+ }
+
+
+ public static Cursor PanNorth {
+ get {
+ if (pan_north == null) {
+ pan_north = new Cursor(XplatUI.DefineStdCursor(StdCursor.PanNorth));
+ pan_north.name = "PanNorth";
+ }
+ return pan_north;
+ }
+ }
+
+ public static Cursor PanNW {
+ get {
+ if (pan_nw == null) {
+ pan_nw = new Cursor(XplatUI.DefineStdCursor(StdCursor.PanNW));
+ pan_nw.name = "PanNW";
+ }
+ return pan_nw;
+ }
+ }
+
+ public static Cursor PanSE {
+ get {
+ if (pan_se == null) {
+ pan_se = new Cursor(XplatUI.DefineStdCursor(StdCursor.PanSE));
+ pan_se.name = "PanSE";
+ }
+ return pan_se;
+ }
+ }
+
+ public static Cursor PanSouth {
+ get {
+ if (pan_south == null) {
+ pan_south = new Cursor(XplatUI.DefineStdCursor(StdCursor.PanSouth));
+ pan_south.name = "PanSouth";
+ }
+ return pan_south;
+ }
+ }
+
+ public static Cursor PanSW {
+ get {
+ if (pan_sw == null) {
+ pan_sw = new Cursor(XplatUI.DefineStdCursor(StdCursor.PanSW));
+ pan_sw.name = "PanSW";
+ }
+ return pan_sw;
+ }
+ }
+
+ public static Cursor PanWest {
+ get {
+ if (pan_west == null) {
+ pan_west = new Cursor(XplatUI.DefineStdCursor(StdCursor.PanWest));
+ pan_west.name = "PanWest";
+ }
+ return pan_west;
+ }
+ }
+
+ public static Cursor SizeAll {
+ get {
+ if (size_all == null) {
+ size_all = new Cursor(XplatUI.DefineStdCursor(StdCursor.SizeAll));
+ size_all.name = "SizeAll";
+ }
+ return size_all;
+ }
+ }
+
+ public static Cursor SizeNESW {
+ get {
+ if (size_nesw == null) {
+ size_nesw = new Cursor(XplatUI.DefineStdCursor(StdCursor.SizeNESW));
+ size_nesw.name = "SizeNESW";
+ }
+ return size_nesw;
+ }
+ }
+
+ public static Cursor SizeNS {
+ get {
+ if (size_ns == null) {
+ size_ns = new Cursor(XplatUI.DefineStdCursor(StdCursor.SizeNS));
+ size_ns.name = "SizeNS";
+ }
+ return size_ns;
+ }
+ }
+
+ public static Cursor SizeNWSE {
+ get {
+ if (size_nwse == null) {
+ size_nwse = new Cursor(XplatUI.DefineStdCursor(StdCursor.SizeNWSE));
+ size_nwse.name = "SizeNWSE";
+ }
+ return size_nwse;
+ }
+ }
+
+ public static Cursor SizeWE {
+ get {
+ if (size_we == null) {
+ size_we = new Cursor(XplatUI.DefineStdCursor(StdCursor.SizeWE));
+ size_we.name = "SizeWE";
+ }
+ return size_we;
+ }
+ }
+
+ public static Cursor UpArrow {
+ get {
+ if (up_arrow == null) {
+ up_arrow = new Cursor(XplatUI.DefineStdCursor(StdCursor.UpArrow));
+ up_arrow.name = "UpArrow";
+ }
+ return up_arrow;
+ }
+ }
+
+ public static Cursor VSplit {
+ get {
+ if (vsplit == null) {
+ vsplit = new Cursor(XplatUI.DefineStdCursor(StdCursor.VSplit));
+ vsplit.name = "VSplit";
+ }
+ return vsplit;
+ }
+ }
+
+ public static Cursor WaitCursor {
+ get {
+ if (wait_cursor == null) {
+ wait_cursor = new Cursor(XplatUI.DefineStdCursor(StdCursor.WaitCursor));
+ wait_cursor.name = "WaitCursor";
+ }
+ return wait_cursor;
+ }
+ }
+ #endregion // Public Static Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataFormats.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataFormats.cs
new file mode 100644
index 00000000000..2ddf19f3898
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataFormats.cs
@@ -0,0 +1,215 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+using System;
+using System.Collections;
+using System.Text;
+
+namespace System.Windows.Forms {
+ public class DataFormats {
+ public class Format {
+ static readonly object lockobj = new object ();
+
+ private static Format formats;
+ private string name;
+ private int id;
+ private Format next;
+
+ public Format (string name, int ID)
+ {
+ this.name = name;
+ this.id = ID;
+
+ lock (lockobj) {
+ if (formats == null)
+ formats = this;
+ else {
+ Format f = formats;
+ while (f.next != null)
+ f = f.next;
+ f.next = this;
+ }
+ }
+ }
+
+ #region Public Instance Properties
+ public int Id {
+ get {
+ return this.id;
+ }
+ }
+
+ public string Name {
+ get {
+ return this.name;
+ }
+ }
+
+ internal Format Next {
+ get {
+ return this.next;
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Private Methods
+ internal static Format Add(string name) {
+ Format f;
+
+ f = Find(name);
+ if (f == null) {
+ IntPtr cliphandle;
+
+ cliphandle = XplatUI.ClipboardOpen();
+ f = new Format(name, XplatUI.ClipboardGetID(cliphandle, name));
+ XplatUI.ClipboardClose(cliphandle);
+ }
+ return f;
+ }
+
+ internal static Format Add(int id) {
+ Format f;
+
+ f = Find(id);
+ if (f == null) {
+ f = new Format("Format"+id.ToString(), id);
+ }
+ return f;
+ }
+
+ internal static Format Find(int id) {
+ Format f;
+
+ f = formats;
+ while ((f != null) && (f.Id != id)) {
+ f = f.next;
+ }
+ return f;
+ }
+
+ internal static Format Find(string name) {
+ Format f;
+
+ f = formats;
+ while ((f != null) && (!f.Name.Equals(name))) {
+ f = f.next;
+ }
+ return f;
+ }
+
+ internal static Format List {
+ get {
+ return formats;
+ }
+ }
+ #endregion // Private Methods
+
+ }
+
+ private DataFormats () {}
+
+ #region Public Static Fields
+ public static readonly string Bitmap = "Bitmap";
+ public static readonly string CommaSeparatedValue = "Csv";
+ public static readonly string Dib = "DeviceIndependentBitmap";
+ public static readonly string Dif = "DataInterchangeFormat";
+ public static readonly string EnhancedMetafile = "EnhancedMetafile";
+ public static readonly string FileDrop = "FileDrop";
+ public static readonly string Html = "HTML Format";
+ public static readonly string Locale = "Locale";
+ public static readonly string MetafilePict = "MetaFilePict";
+ public static readonly string OemText = "OEMText";
+ public static readonly string Palette = "Palette";
+ public static readonly string PenData = "PenData";
+ public static readonly string Riff = "RiffAudio";
+ public static readonly string Rtf = "Rich Text Format";
+ public static readonly string Serializable = "WindowsForms10PersistentObject";
+ public static readonly string StringFormat = "System.String";
+ public static readonly string SymbolicLink = "SymbolicLink";
+ public static readonly string Text = "Text";
+ public static readonly string Tiff = "Tiff";
+ public static readonly string UnicodeText = "UnicodeText";
+ public static readonly string WaveAudio = "WaveAudio";
+ #endregion // Public Static Fields
+
+ private static object lock_object = new object ();
+ private static bool initialized;
+
+ public static Format GetFormat (int ID)
+ {
+ lock (lock_object) {
+ if (!initialized)
+ Init ();
+ return Format.Find (ID);
+ }
+ }
+
+ public static Format GetFormat (string format)
+ {
+ lock (lock_object) {
+ if (!initialized)
+ Init ();
+ return Format.Add (format);
+ }
+ }
+
+ // Assumes we are locked on the lock_object when it is called
+ private static void Init ()
+ {
+ if (initialized)
+ return;
+ IntPtr cliphandle = XplatUI.ClipboardOpen();
+
+ new Format (Text, XplatUI.ClipboardGetID (cliphandle, Text));
+ new Format (Bitmap, XplatUI.ClipboardGetID (cliphandle, Bitmap));
+ new Format (MetafilePict, XplatUI.ClipboardGetID (cliphandle, MetafilePict));
+ new Format (SymbolicLink, XplatUI.ClipboardGetID (cliphandle, SymbolicLink));
+ new Format (Dif, XplatUI.ClipboardGetID (cliphandle, Dif)) ;
+ new Format (Tiff, XplatUI.ClipboardGetID (cliphandle, Tiff));
+ new Format (OemText, XplatUI.ClipboardGetID (cliphandle, OemText));
+ new Format (Dib, XplatUI.ClipboardGetID (cliphandle, Dib));
+ new Format (Palette, XplatUI.ClipboardGetID (cliphandle, Palette));
+ new Format (PenData, XplatUI.ClipboardGetID (cliphandle, PenData));
+ new Format (Riff, XplatUI.ClipboardGetID (cliphandle, Riff));
+ new Format (WaveAudio, XplatUI.ClipboardGetID (cliphandle, WaveAudio));
+ new Format (UnicodeText, XplatUI.ClipboardGetID (cliphandle, UnicodeText));
+ new Format (EnhancedMetafile, XplatUI.ClipboardGetID (cliphandle, EnhancedMetafile));
+ new Format (FileDrop, XplatUI.ClipboardGetID (cliphandle, FileDrop));
+ new Format (Locale, XplatUI.ClipboardGetID (cliphandle, Locale));
+ new Format (CommaSeparatedValue, XplatUI.ClipboardGetID (cliphandle, CommaSeparatedValue));
+ new Format (Html, XplatUI.ClipboardGetID (cliphandle, Html));
+ new Format (Rtf, XplatUI.ClipboardGetID (cliphandle, Rtf));
+ new Format (Serializable, XplatUI.ClipboardGetID (cliphandle, Serializable));
+ new Format (StringFormat, XplatUI.ClipboardGetID (cliphandle, StringFormat));
+
+ XplatUI.ClipboardClose (cliphandle);
+
+ initialized = true;
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGrid.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGrid.cs
new file mode 100644
index 00000000000..03d6d49d3d4
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGrid.cs
@@ -0,0 +1,2190 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Jordi Mas i Hernandez <jordi@ximian.com>
+//
+//
+
+// NOT COMPLETE
+
+
+using System;
+using System.ComponentModel;
+using System.Drawing;
+using System.Runtime.InteropServices;
+using System.Collections;
+
+namespace System.Windows.Forms
+{
+ [DefaultEvent("Navigate")]
+ [DefaultProperty("DataSource")]
+ [Designer("System.Windows.Forms.Design.DataGridDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+ public class DataGrid : Control, ISupportInitialize, IDataGridEditingService
+ {
+ [Flags]
+ [Serializable]
+ public enum HitTestType
+ {
+ None = 0,
+ Cell = 1,
+ ColumnHeader = 2,
+ RowHeader = 4,
+ ColumnResize = 8,
+ RowResize = 16,
+ Caption = 32,
+ ParentRows = 64
+ }
+
+ public sealed class HitTestInfo
+ {
+ public static readonly HitTestInfo Nowhere = null;
+
+ #region Local Variables
+ internal int column;
+ internal int row;
+ internal HitTestType type;
+ #endregion // Local Variables
+
+ #region Private Constructors
+ internal HitTestInfo ()
+ {
+ column = -1;
+ row = -1;
+ type = HitTestType.None;
+ }
+ #endregion
+
+
+ #region Public Instance Properties
+ public int Column {
+ get { return column; }
+ }
+
+ public int Row {
+ get { return row; }
+ }
+ public DataGrid.HitTestType Type {
+ get { return type; }
+ }
+ #endregion //Public Instance Properties
+
+ public override bool Equals (object o)
+ {
+ if (!(o is HitTestInfo))
+ return false;
+
+ HitTestInfo obj = (HitTestInfo) o;
+ return (obj.Column == column && obj.Row == row && obj.Type ==type);
+ }
+
+ public override int GetHashCode ()
+ {
+ return row ^ column;
+ }
+
+ public override string ToString ()
+ {
+ return "{ " + type + "," + row + "," + column + "}";
+ }
+
+ }
+
+ #region Local Variables
+ private static readonly Color def_alternating_backcolor = ThemeEngine.Current.DataGridAlternatingBackColor;
+ private static readonly Color def_background_color = ThemeEngine.Current.DataGridBackgroundColor;
+ private static readonly Color def_caption_backcolor = ThemeEngine.Current.DataGridCaptionBackColor;
+ private static readonly Color def_caption_forecolor = ThemeEngine.Current.DataGridCaptionForeColor;
+ private static readonly Color def_gridline_color = ThemeEngine.Current.DataGridGridLineColor;
+ private static readonly Color def_header_backcolor = ThemeEngine.Current.DataGridHeaderBackColor;
+ private static readonly Font def_header_font = ThemeEngine.Current.DefaultFont;
+ private static readonly Color def_header_forecolor = ThemeEngine.Current.DataGridHeaderForeColor;
+ private static readonly Color def_link_hovercolor = ThemeEngine.Current.DataGridLinkHoverColor;
+ private static readonly Color def_parentrowsback_color = ThemeEngine.Current.DataGridParentRowsBackColor;
+ private static readonly Color def_parentrowsfore_color = ThemeEngine.Current.DataGridParentRowsForeColor;
+ private static readonly Color def_selection_backcolor = ThemeEngine.Current.DataGridSelectionBackColor;
+ private static readonly Color def_selection_forecolor = ThemeEngine.Current.DataGridSelectionForeColor;
+ private static readonly Color def_link_color = ThemeEngine.Current.DataGridLinkColor;
+ internal readonly int def_preferredrow_height;
+
+ private bool allow_navigation;
+ private bool allow_sorting;
+ private Color alternating_backcolor;
+ private Color backColor;
+ private Color background_color;
+ private Color caption_backcolor;
+ private Font caption_font;
+ private Color caption_forecolor;
+ private string caption_text;
+ internal bool caption_visible;
+ internal bool columnheaders_visible;
+ private object datasource;
+ private object real_datasource;
+ private string datamember;
+ private int firstvisible_column;
+ private bool flatmode;
+ private Color gridline_color;
+ private DataGridLineStyle gridline_style;
+ private Color header_backcolor;
+ private Color header_forecolor;
+ private Font header_font;
+ private Color link_color;
+ private Color link_hovercolor;
+ private Color parentrowsback_color;
+ private Color parentrowsfore_color;
+ private bool parentrows_visible;
+ private int preferredcolumn_width;
+ private int preferredrow_height;
+ private bool _readonly;
+ internal bool rowheaders_visible;
+ private Color selection_backcolor;
+ private Color selection_forecolor;
+ private int rowheaders_width;
+ internal int visiblecolumn_count;
+ internal int visiblerow_count;
+ internal int first_visiblecolumn;
+ private GridTableStylesCollection styles_collection;
+ private DataGridParentRowsLabelStyle parentrowslabel_style;
+ internal DataGridCell current_cell;
+ private DataGridTableStyle default_style;
+ private DataGridTableStyle current_style;
+ internal HScrollBar horiz_scrollbar;
+ internal VScrollBar vert_scrollbar;
+ internal DataGridDrawing grid_drawing;
+ internal int first_visiblerow;
+ internal int horz_pixeloffset;
+ internal bool is_editing; // Current cell is edit mode
+ internal bool is_changing; // Indicates if current cell is been changed (in edit mode)
+ internal bool is_adding; // Indicates when we are adding a row
+ private Hashtable selected_rows;
+ private bool ctrl_pressed;
+ private bool shift_pressed;
+ private bool begininit;
+ private CurrencyManager cached_currencymgr;
+ private CurrencyManager cached_currencymgr_events;
+ private bool accept_listmgrevents;
+ #endregion // Local Variables
+
+ #region Public Constructors
+ public DataGrid ()
+ {
+ grid_drawing = new DataGridDrawing (this);
+ allow_navigation = true;
+ allow_sorting = true;
+ begininit = false;
+ backColor = ThemeEngine.Current.DataGridBackColor;
+ alternating_backcolor = def_alternating_backcolor;
+ background_color = def_background_color;
+ border_style = BorderStyle.Fixed3D;
+ caption_backcolor = def_caption_backcolor;
+ caption_font = null;
+ caption_forecolor = def_caption_forecolor;
+ caption_text = string.Empty;
+ caption_visible = true;
+ columnheaders_visible = true;
+ datasource = null;
+ real_datasource = null;
+ datamember = string.Empty;
+ firstvisible_column = 0;
+ flatmode = false;
+ gridline_color = def_gridline_color;
+ gridline_style = DataGridLineStyle.Solid;
+ header_backcolor = def_header_backcolor;
+ header_forecolor = def_header_forecolor;
+ header_font = def_header_font;
+ link_color = def_link_color;
+ link_hovercolor = def_link_hovercolor;
+ parentrowsback_color = def_parentrowsback_color;
+ parentrowsfore_color = def_parentrowsfore_color;
+ parentrows_visible = true;
+ preferredcolumn_width = ThemeEngine.Current.DataGridPreferredColumnWidth;
+ _readonly = false;
+ rowheaders_visible = true;
+ selection_backcolor = def_selection_backcolor;
+ selection_forecolor = def_selection_forecolor;
+ rowheaders_width = 35;
+ visiblecolumn_count = 0;
+ visiblerow_count = 0;
+ current_cell = new DataGridCell ();
+ first_visiblerow = 0;
+ first_visiblecolumn = 0;
+ horz_pixeloffset = 0;
+ is_editing = false;
+ is_changing = false;
+ is_adding = false;
+ parentrowslabel_style = DataGridParentRowsLabelStyle.Both;
+ selected_rows = new Hashtable ();
+ ctrl_pressed = false;
+ shift_pressed = false;
+ preferredrow_height = def_preferredrow_height = FontHeight + 3;
+ cached_currencymgr_events = cached_currencymgr = null;
+ accept_listmgrevents = true;
+
+ default_style = new DataGridTableStyle (true);
+ styles_collection = new GridTableStylesCollection (this);
+ styles_collection.CollectionChanged += new CollectionChangeEventHandler (OnTableStylesCollectionChanged);
+
+ CurrentTableStyle = default_style;
+
+ horiz_scrollbar = new HScrollBar ();
+ horiz_scrollbar.Scroll += new ScrollEventHandler (GridHScrolled);
+ vert_scrollbar = new VScrollBar ();
+ vert_scrollbar.Scroll += new ScrollEventHandler (GridVScrolled);
+ KeyUp += new KeyEventHandler (OnKeyUpDG);
+
+ SetStyle (ControlStyles.UserMouse, true);
+
+ }
+
+ #endregion // Public Constructor
+
+ #region Public Instance Properties
+
+ [DefaultValue(true)]
+ public bool AllowNavigation {
+ get {
+ return allow_navigation;
+ }
+
+ set {
+ if (allow_navigation != value) {
+ allow_navigation = value;
+ OnAllowNavigationChanged (EventArgs.Empty);
+ }
+ }
+ }
+
+ [DefaultValue(true)]
+ public bool AllowSorting {
+ get {
+ return allow_sorting;
+ }
+
+ set {
+ if (allow_sorting != value) {
+ allow_sorting = value;
+ }
+ }
+ }
+
+ public Color AlternatingBackColor {
+ get {
+ return alternating_backcolor;
+ }
+
+ set {
+ if (alternating_backcolor != value) {
+ alternating_backcolor = value;
+ Refresh ();
+ }
+ }
+ }
+
+ public override Color BackColor {
+ get {
+ return backColor;
+ }
+ set {
+ backColor = value;
+ }
+ }
+
+ public Color BackgroundColor {
+ get {
+ return background_color;
+ }
+ set {
+ if (background_color != value) {
+ background_color = value;
+ OnBackgroundColorChanged (EventArgs.Empty);
+ Refresh ();
+ }
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override Image BackgroundImage {
+ get {
+ return base.BackgroundImage;
+ }
+
+ set {
+ base.BackgroundImage = value;
+ }
+ }
+
+ [DispId(-504)]
+ [DefaultValue(BorderStyle.Fixed3D)]
+ public BorderStyle BorderStyle {
+ get { return InternalBorderStyle; }
+ set {
+ InternalBorderStyle = value;
+ CalcAreasAndInvalidate ();
+ OnBorderStyleChanged (EventArgs.Empty);
+ }
+ }
+
+ public Color CaptionBackColor {
+ get {
+ return caption_backcolor;
+ }
+
+ set {
+ if (caption_backcolor != value) {
+ caption_backcolor = value;
+ grid_drawing.InvalidateCaption ();
+ }
+ }
+ }
+
+ [Localizable(true)]
+ [AmbientValue(null)]
+ public Font CaptionFont {
+ get {
+ if (caption_font == null) {
+ return Font;
+ }
+
+ return caption_font;
+ }
+
+ set {
+ if (caption_font != null && caption_font.Equals (value)) {
+ return;
+ }
+
+ caption_font = value;
+ CalcAreasAndInvalidate ();
+ }
+ }
+
+ public Color CaptionForeColor {
+ get {
+ return caption_forecolor;
+ }
+
+ set {
+ if (caption_forecolor != value) {
+ caption_forecolor = value;
+ grid_drawing.InvalidateCaption ();
+ }
+ }
+ }
+
+ [Localizable(true)]
+ [DefaultValue("")]
+ public string CaptionText {
+ get {
+ return caption_text;
+ }
+
+ set {
+ if (caption_text != value) {
+ caption_text = value;
+ grid_drawing.InvalidateCaption ();
+ }
+ }
+ }
+
+ [DefaultValue(true)]
+ public bool CaptionVisible {
+ get {
+ return caption_visible;
+ }
+
+ set {
+ if (caption_visible != value) {
+ caption_visible = value;
+ CalcAreasAndInvalidate ();
+ OnCaptionVisibleChanged (EventArgs.Empty);
+ }
+ }
+ }
+
+ [DefaultValue(true)]
+ public bool ColumnHeadersVisible {
+ get {
+ return columnheaders_visible;
+ }
+
+ set {
+ if (columnheaders_visible != value) {
+ columnheaders_visible = value;
+ CalcAreasAndInvalidate ();
+ }
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public DataGridCell CurrentCell {
+ get {
+ return current_cell;
+ }
+
+ set {
+ if (!current_cell.Equals (value)) {
+ CancelEditing ();
+
+ int old_row = current_cell.RowNumber;
+
+ if (value.RowNumber >= RowsCount) {
+ value.RowNumber = RowsCount == 0 ? 0 : RowsCount - 1;
+ }
+
+ if (value.ColumnNumber >= CurrentTableStyle.GridColumnStyles.Count) {
+ value.ColumnNumber = CurrentTableStyle.GridColumnStyles.Count == 0 ? 0: CurrentTableStyle.GridColumnStyles.Count - 1;
+ }
+
+ EnsureCellVisilibility (value);
+ current_cell = value;
+
+ if (current_cell.RowNumber != old_row) {
+ grid_drawing.InvalidateRowHeader (old_row);
+ }
+
+ accept_listmgrevents = false;
+
+ if (cached_currencymgr_events != null) {
+ cached_currencymgr_events.Position = current_cell.RowNumber;
+ }
+ accept_listmgrevents = true;
+ InvalidateCurrentRowHeader ();
+ OnCurrentCellChanged (EventArgs.Empty);
+ }
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int CurrentRowIndex {
+ get {
+ if (ListManager == null) {
+ return -1;
+ }
+
+ return current_cell.RowNumber;
+ }
+
+ set {
+ if (current_cell.RowNumber != value) {
+ CurrentCell = new DataGridCell (value, current_cell.ColumnNumber);
+ }
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override Cursor Cursor {
+ get {
+ return base.Cursor;
+ }
+ set {
+ base.Cursor = value;
+ }
+ }
+
+ [DefaultValue(null)]
+ [Editor ("System.Windows.Forms.Design.DataMemberListEditor, " + Consts.AssemblySystem_Design, "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)]
+ public string DataMember {
+ get { return datamember; }
+ set {
+ if (SetDataMember (value)) {
+ SetDataSource (datasource);
+ if (styles_collection.Contains (value) == true) {
+ CurrentTableStyle = styles_collection[value];
+ current_style.CreateColumnsForTable (false);
+ } else {
+ CurrentTableStyle = default_style;
+ current_style.GridColumnStyles.Clear ();
+ current_style.CreateColumnsForTable (false);
+ }
+ }
+ }
+ }
+
+ [DefaultValue(null)]
+ [RefreshProperties(RefreshProperties.Repaint)]
+ [TypeConverter("System.Windows.Forms.Design.DataSourceConverter, " + Consts.AssemblySystem_Design)]
+ public object DataSource {
+ get {
+ return datasource;
+ }
+
+ set {
+ if (SetDataSource (value)) {
+ SetNewDataSource ();
+ }
+ }
+ }
+
+ protected override Size DefaultSize {
+ get {
+ return new Size (130, 80);
+ }
+ }
+
+ [Browsable(false)]
+ public int FirstVisibleColumn {
+ get {
+ return firstvisible_column;
+ }
+ }
+
+ [DefaultValue(false)]
+ public bool FlatMode {
+ get {
+ return flatmode;
+ }
+
+ set {
+ if (flatmode != value) {
+ flatmode = value;
+ OnFlatModeChanged (EventArgs.Empty);
+ Refresh ();
+ }
+ }
+ }
+
+ public override Color ForeColor {
+ get {
+ return base.ForeColor;
+ }
+
+ set {
+ base.ForeColor = value;
+ }
+ }
+
+ public Color GridLineColor {
+ get {
+ return gridline_color;
+ }
+
+ set {
+ if (value == Color.Empty) {
+ throw new ArgumentException ("Color.Empty value is invalid.");
+ }
+
+ if (gridline_color != value) {
+ gridline_color = value;
+ Refresh ();
+ }
+ }
+ }
+
+ [DefaultValue(DataGridLineStyle.Solid)]
+ public DataGridLineStyle GridLineStyle {
+ get {
+ return gridline_style;
+ }
+
+ set {
+ if (gridline_style != value) {
+ gridline_style = value;
+ Refresh ();
+ }
+ }
+ }
+
+ public Color HeaderBackColor {
+ get {
+ return header_backcolor;
+ }
+
+ set {
+ if (value == Color.Empty) {
+ throw new ArgumentException ("Color.Empty value is invalid.");
+ }
+
+ if (header_backcolor != value) {
+ header_backcolor = value;
+ Refresh ();
+ }
+ }
+ }
+
+ public Font HeaderFont {
+ get {
+ return header_font;
+ }
+
+ set {
+ if (header_font != null && !header_font.Equals (value)) {
+ header_font = value;
+ CalcAreasAndInvalidate ();
+ }
+ }
+ }
+
+ public Color HeaderForeColor {
+ get {
+ return header_forecolor;
+ }
+
+ set {
+ if (header_forecolor != value) {
+ header_forecolor = value;
+ Refresh ();
+ }
+ }
+ }
+
+ protected ScrollBar HorizScrollBar {
+ get {
+ return horiz_scrollbar;
+ }
+ }
+
+ public object this [DataGridCell cell] {
+ get {
+ return this [cell.RowNumber, cell.ColumnNumber];
+ }
+
+ set {
+ this [cell.RowNumber, cell.ColumnNumber] = value;
+ }
+ }
+
+ public object this [int rowIndex, int columnIndex] {
+ get {
+ return CurrentTableStyle.GridColumnStyles[columnIndex].GetColumnValueAtRow (ListManager,
+ rowIndex);
+ }
+
+ set {
+ CurrentTableStyle.GridColumnStyles[columnIndex].SetColumnValueAtRow (ListManager,
+ rowIndex, value);
+ }
+ }
+
+ public Color LinkColor {
+ get {
+ return link_color;
+ }
+ set {
+ if (link_color != value) {
+ link_color = value;
+ Refresh ();
+ }
+ }
+ }
+
+ [ComVisible(false)]
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Color LinkHoverColor {
+ get {
+ return link_hovercolor;
+ }
+
+ set {
+ if (link_hovercolor != value) {
+ link_hovercolor = value;
+ Refresh ();
+ }
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected internal CurrencyManager ListManager {
+ get {
+ if (BindingContext == null || DataSource == null) {
+ return null;
+ }
+
+ if (cached_currencymgr != null) {
+ return cached_currencymgr;
+ }
+
+ // If we bind real_datasource object we do not get the events from ListManger
+ // since the object is not the datasource and does not match
+ cached_currencymgr = (CurrencyManager) BindingContext [real_datasource, DataMember];
+ cached_currencymgr_events = (CurrencyManager) BindingContext [datasource, DataMember];
+ ConnectListManagerEvents ();
+ return cached_currencymgr;
+ }
+
+ set {
+ throw new NotSupportedException ("Operation is not supported.");
+ }
+ }
+
+ public Color ParentRowsBackColor {
+ get {
+ return parentrowsback_color;
+ }
+
+ set {
+ if (parentrowsback_color != value) {
+ parentrowsback_color = value;
+ if (parentrows_visible) {
+ Refresh ();
+ }
+ }
+ }
+ }
+
+ public Color ParentRowsForeColor {
+ get {
+ return parentrowsfore_color;
+ }
+
+ set {
+ if (parentrowsfore_color != value) {
+ parentrowsfore_color = value;
+ if (parentrows_visible) {
+ Refresh ();
+ }
+ }
+ }
+ }
+
+ [DefaultValue(DataGridParentRowsLabelStyle.Both)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public DataGridParentRowsLabelStyle ParentRowsLabelStyle {
+ get {
+ return parentrowslabel_style;
+ }
+
+ set {
+ if (parentrowslabel_style != value) {
+ parentrowslabel_style = value;
+ if (parentrows_visible) {
+ Refresh ();
+ }
+
+ OnParentRowsLabelStyleChanged (EventArgs.Empty);
+ }
+ }
+ }
+
+ [DefaultValue(true)]
+ public bool ParentRowsVisible {
+ get {
+ return parentrows_visible;
+ }
+
+ set {
+ if (parentrows_visible != value) {
+ parentrows_visible = value;
+ CalcAreasAndInvalidate ();
+ OnParentRowsVisibleChanged (EventArgs.Empty);
+ }
+ }
+ }
+
+ // Settting this property seems to have no effect.
+ [DefaultValue(75)]
+ [TypeConverter(typeof(DataGridPreferredColumnWidthTypeConverter))]
+ public int PreferredColumnWidth {
+ get {
+ return preferredcolumn_width;
+ }
+
+ set {
+ if (value < 0) {
+ throw new ArgumentException ("PreferredColumnWidth is less than 0");
+ }
+
+ if (preferredcolumn_width != value) {
+ preferredcolumn_width = value;
+ Refresh ();
+ }
+ }
+ }
+
+ public int PreferredRowHeight {
+ get {
+ return preferredrow_height;
+ }
+
+ set {
+ if (preferredrow_height != value) {
+ preferredrow_height = value;
+ CalcAreasAndInvalidate ();
+ }
+ }
+ }
+
+ [DefaultValue(false)]
+ public bool ReadOnly {
+ get {
+ return _readonly;
+ }
+
+ set {
+ if (_readonly != value) {
+ _readonly = value;
+ OnReadOnlyChanged (EventArgs.Empty);
+ CalcAreasAndInvalidate ();
+ }
+ }
+ }
+
+ [DefaultValue(true)]
+ public bool RowHeadersVisible {
+ get {
+ return rowheaders_visible;
+ }
+
+ set {
+ if (rowheaders_visible != value) {
+ rowheaders_visible = value;
+ CalcAreasAndInvalidate ();
+ }
+ }
+ }
+
+ [DefaultValue(35)]
+ public int RowHeaderWidth {
+ get {
+ return rowheaders_width;
+ }
+
+ set {
+ if (rowheaders_width != value) {
+ rowheaders_width = value;
+ CalcAreasAndInvalidate ();
+ }
+ }
+ }
+
+ public Color SelectionBackColor {
+ get {
+ return selection_backcolor;
+ }
+
+ set {
+ if (selection_backcolor != value) {
+ selection_backcolor = value;
+ Refresh ();
+ }
+ }
+ }
+
+ public Color SelectionForeColor {
+ get {
+ return selection_forecolor;
+ }
+
+ set {
+ if (selection_forecolor != value) {
+ selection_forecolor = value;
+ Refresh ();
+ }
+ }
+ }
+
+ public override ISite Site {
+ get {
+ return base.Site;
+ }
+ set {
+ base.Site = value;
+ }
+ }
+
+ [Localizable(true)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
+ public GridTableStylesCollection TableStyles {
+ get { return styles_collection; }
+ }
+
+ [Bindable(false)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override string Text {
+ get {
+ return base.Text;
+ }
+ set {
+ base.Text = value;
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected ScrollBar VertScrollBar {
+ get {
+ return vert_scrollbar;
+ }
+ }
+
+ [Browsable(false)]
+ public int VisibleColumnCount {
+ get {
+ return visiblecolumn_count;
+ }
+ }
+
+ // Calculated at DataGridDrawing.CalcRowsHeaders
+ [Browsable(false)]
+ public int VisibleRowCount {
+ get {
+ return visiblerow_count;
+ }
+ }
+
+ #endregion // Public Instance Properties
+
+ #region Private Instance Properties
+ internal DataGridTableStyle CurrentTableStyle {
+ get {
+ return current_style;
+ }
+ set {
+ current_style = value;
+ current_style.DataGrid = this;
+ CalcAreasAndInvalidate ();
+ }
+ }
+
+ internal int FirstVisibleRow {
+ get { return first_visiblerow; }
+ set { first_visiblerow = value;}
+ }
+
+ internal int RowsCount {
+ get {
+ if (ListManager != null) {
+ return ListManager.Count;
+ }
+
+ return 0;
+ }
+ }
+
+ internal int RowHeight {
+ get {
+ if (CurrentTableStyle.CurrentPreferredRowHeight > Font.Height + 3 + 1 /* line */) {
+ return CurrentTableStyle.CurrentPreferredRowHeight;
+
+ } else {
+ return Font.Height + 3 + 1 /* line */;
+ }
+ }
+ }
+
+ internal bool ShowEditRow {
+ get {
+ if (ListManager != null && ListManager.CanAddRows == false) {
+ return false;
+ }
+
+ return _readonly == false;
+ }
+ }
+
+ // It should only be shown if there are relations that
+ // we do not support right now
+ internal bool ShowParentRowsVisible {
+ get {
+ //See parentrows_visible;
+ return false;
+ }
+ }
+
+ #endregion Private Instance Properties
+
+ #region Public Instance Methods
+
+ [MonoTODO]
+ public virtual bool BeginEdit (DataGridColumnStyle gridColumn, int rowNumber)
+ {
+ return false;
+ }
+
+ public virtual void BeginInit ()
+ {
+ begininit = true;
+ }
+
+ protected virtual void CancelEditing ()
+ {
+ if (current_cell.ColumnNumber < CurrentTableStyle.GridColumnStyles.Count) {
+ CurrentTableStyle.GridColumnStyles[current_cell.ColumnNumber].Abort (current_cell.RowNumber);
+ }
+
+ if (is_adding == true) {
+ ListManager.RemoveAt (RowsCount - 1);
+ is_adding = false;
+ }
+
+ is_editing = false;
+ is_changing = false;
+ InvalidateCurrentRowHeader ();
+ }
+
+ [MonoTODO]
+ public void Collapse (int row)
+ {
+
+ }
+
+ protected internal virtual void ColumnStartedEditing (Control editingControl)
+ {
+
+ }
+
+ protected internal virtual void ColumnStartedEditing (Rectangle bounds)
+ {
+
+ }
+
+ protected override AccessibleObject CreateAccessibilityInstance ()
+ {
+ return base.CreateAccessibilityInstance ();
+ }
+
+ protected virtual DataGridColumnStyle CreateGridColumn (PropertyDescriptor prop)
+ {
+ return CreateGridColumn (prop, false);
+ }
+
+ protected virtual DataGridColumnStyle CreateGridColumn (PropertyDescriptor prop, bool isDefault)
+ {
+ throw new NotImplementedException();
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ base.Dispose (disposing);
+ }
+
+ public virtual bool EndEdit (DataGridColumnStyle gridColumn, int rowNumber, bool shouldAbort)
+ {
+ if (is_adding == true) {
+ if (shouldAbort) {
+ ListManager.CancelCurrentEdit ();
+ } else {
+ ListManager.EndCurrentEdit ();
+ CalcAreasAndInvalidate ();
+ }
+ is_adding = false;
+ }
+
+ if (shouldAbort || gridColumn.ParentReadOnly ==true) {
+ gridColumn.Abort (rowNumber);
+ } else {
+ gridColumn.Commit (ListManager, rowNumber);
+ }
+
+ is_editing = false;
+ is_changing = false;
+ InvalidateCurrentRowHeader ();
+ return true;
+ }
+
+ public virtual void EndInit ()
+ {
+ begininit = false;
+ }
+
+ public void Expand (int row)
+ {
+
+ }
+
+ public Rectangle GetCellBounds (DataGridCell cell)
+ {
+ return GetCellBounds (cell.RowNumber, cell.ColumnNumber);
+ }
+
+ public Rectangle GetCellBounds (int row, int col)
+ {
+ return grid_drawing.GetCellBounds (row, col);
+ }
+
+ public Rectangle GetCurrentCellBounds ()
+ {
+ return GetCellBounds (current_cell.RowNumber, current_cell.ColumnNumber);
+ }
+
+ protected virtual string GetOutputTextDelimiter ()
+ {
+ return string.Empty;
+ }
+
+ protected virtual void GridHScrolled (object sender, ScrollEventArgs se)
+ {
+ if (se.NewValue == horz_pixeloffset ||
+ se.Type == ScrollEventType.EndScroll) {
+ return;
+ }
+
+ ScrollToColumnInPixels (se.NewValue);
+ }
+
+ protected virtual void GridVScrolled (object sender, ScrollEventArgs se)
+ {
+ int old_first_visiblerow = first_visiblerow;
+ first_visiblerow = se.NewValue;
+ grid_drawing.UpdateVisibleRowCount ();
+
+ if (first_visiblerow == old_first_visiblerow) {
+ return;
+ }
+ ScrollToRow (old_first_visiblerow, first_visiblerow);
+ }
+
+ public HitTestInfo HitTest (Point position)
+ {
+ return HitTest (position.X, position.Y);
+ }
+
+ public HitTestInfo HitTest (int x, int y)
+ {
+ return grid_drawing.HitTest (x, y);
+ }
+
+ [MonoTODO]
+ public bool IsExpanded (int rowNumber)
+ {
+ return false;
+ }
+
+ public bool IsSelected (int row)
+ {
+ return selected_rows[row] != null;
+ }
+
+ [MonoTODO]
+ public void NavigateBack ()
+ {
+
+ }
+
+ [MonoTODO]
+ public void NavigateTo (int rowNumber, string relationName)
+ {
+
+ }
+
+ protected virtual void OnAllowNavigationChanged (EventArgs e)
+ {
+ if (AllowNavigationChanged != null) {
+ AllowNavigationChanged (this, e);
+ }
+ }
+
+ protected void OnBackButtonClicked (object sender, EventArgs e)
+ {
+ if (BackButtonClick != null) {
+ BackButtonClick (sender, e);
+ }
+ }
+
+ protected override void OnBackColorChanged (EventArgs e)
+ {
+ base.OnBackColorChanged (e);
+ }
+
+ protected virtual void OnBackgroundColorChanged (EventArgs e)
+ {
+ if (BackgroundColorChanged != null) {
+ BackgroundColorChanged (this, e);
+ }
+ }
+
+ protected override void OnBindingContextChanged( EventArgs e)
+ {
+ base.OnBindingContextChanged (e);
+ }
+
+ protected virtual void OnBorderStyleChanged (EventArgs e)
+ {
+ if (BorderStyleChanged != null) {
+ BorderStyleChanged (this, e);
+ }
+ }
+
+ protected virtual void OnCaptionVisibleChanged (EventArgs e)
+ {
+ if (CaptionVisibleChanged != null) {
+ CaptionVisibleChanged (this, e);
+ }
+ }
+
+ protected virtual void OnCurrentCellChanged (EventArgs e)
+ {
+ if (CurrentCellChanged != null) {
+ CurrentCellChanged (this, e);
+ }
+ }
+
+ protected virtual void OnDataSourceChanged (EventArgs e)
+ {
+ if (DataSourceChanged != null) {
+ DataSourceChanged (this, e);
+ }
+ }
+
+ protected override void OnEnter (EventArgs e)
+ {
+ base.OnEnter (e);
+ }
+
+ protected virtual void OnFlatModeChanged (EventArgs e)
+ {
+ if (FlatModeChanged != null) {
+ FlatModeChanged (this, e);
+ }
+ }
+
+ protected override void OnFontChanged (EventArgs e)
+ {
+ grid_drawing.CalcGridAreas ();
+ base.OnFontChanged (e);
+ }
+
+ protected override void OnForeColorChanged (EventArgs e)
+ {
+ base.OnForeColorChanged (e);
+ }
+
+ protected override void OnHandleCreated (EventArgs e)
+ {
+ base.OnHandleCreated (e);
+ grid_drawing.CalcGridAreas ();
+ }
+
+ protected override void OnHandleDestroyed (EventArgs e)
+ {
+ base.OnHandleDestroyed (e);
+ }
+
+ protected override void OnKeyDown (KeyEventArgs ke)
+ {
+ base.OnKeyDown (ke);
+
+ if (ProcessGridKey (ke) == true) {
+ ke.Handled = true;
+ }
+
+ if (CurrentTableStyle.GridColumnStyles.Count > 0) {
+ CurrentTableStyle.GridColumnStyles[current_cell.ColumnNumber].OnKeyDown
+ (ke, current_cell.RowNumber, current_cell.ColumnNumber);
+ }
+ }
+
+ protected override void OnKeyPress (KeyPressEventArgs kpe)
+ {
+ base.OnKeyPress (kpe);
+ }
+
+ protected override void OnLayout (LayoutEventArgs levent)
+ {
+ base.OnLayout (levent);
+ CalcAreasAndInvalidate ();
+ }
+
+ protected override void OnLeave (EventArgs e)
+ {
+ base.OnLeave (e);
+ }
+
+ protected override void OnMouseDown (MouseEventArgs e)
+ {
+ base.OnMouseDown (e);
+
+ HitTestInfo testinfo;
+ testinfo = grid_drawing.HitTest (e.X, e.Y);
+
+ switch (testinfo.type) {
+ case HitTestType.Cell:
+ {
+ if (testinfo.Row < 0 || testinfo.Column < 0)
+ break;
+
+ DataGridCell new_cell = new DataGridCell (testinfo.Row, testinfo.Column);
+
+ if (new_cell.Equals (current_cell) == false) {
+ CancelEditing ();
+ CurrentCell = new_cell;
+ EditCell (current_cell);
+
+ } else {
+ CurrentTableStyle.GridColumnStyles[testinfo.Column].OnMouseDown (e, testinfo.Row, testinfo.Column);
+ }
+
+ break;
+ }
+ case HitTestType.RowHeader:
+ {
+ if (ctrl_pressed == false && shift_pressed == false) {
+ ResetSelection (); // Invalidates selected rows
+ }
+
+ if (shift_pressed == true) {
+ ShiftSelection (testinfo.Row);
+ } else { // ctrl_pressed or single item
+ Select (testinfo.Row);
+ }
+
+ CancelEditing ();
+ CurrentCell = new DataGridCell (testinfo.Row, current_cell.ColumnNumber);
+ OnRowHeaderClick (EventArgs.Empty);
+ break;
+ }
+
+ case HitTestType.ColumnHeader:
+ {
+ if (CurrentTableStyle.GridColumnStyles.Count == 0)
+ break;
+
+ if (allow_sorting == false)
+ break;
+
+ if (ListManager.List is IBindingList == false)
+ break;
+
+ ListSortDirection direction = ListSortDirection.Ascending;
+ PropertyDescriptor prop = CurrentTableStyle.GridColumnStyles[testinfo.Column].PropertyDescriptor;
+ IBindingList list = (IBindingList) ListManager.List;
+
+ if (list.SortProperty != null) {
+ CurrentTableStyle.GridColumnStyles[list.SortProperty].ArrowDrawingMode
+ = DataGridColumnStyle.ArrowDrawing.No;
+ }
+
+ if (prop == list.SortProperty && list.SortDirection == ListSortDirection.Ascending) {
+ direction = ListSortDirection.Descending;
+ }
+
+ CurrentTableStyle.GridColumnStyles[testinfo.Column].ArrowDrawingMode =
+ direction == ListSortDirection.Ascending ?
+ DataGridColumnStyle.ArrowDrawing.Ascending : DataGridColumnStyle.ArrowDrawing.Descending;
+
+ list.ApplySort (prop, direction);
+ Refresh ();
+ break;
+ }
+
+ default:
+ break;
+ }
+ }
+
+ protected override void OnMouseLeave (EventArgs e)
+ {
+ base.OnMouseLeave (e);
+ }
+
+ protected override void OnMouseMove (MouseEventArgs e)
+ {
+ base.OnMouseMove (e);
+ }
+
+ protected override void OnMouseUp (MouseEventArgs e)
+ {
+ base.OnMouseUp (e);
+ }
+
+ protected override void OnMouseWheel (MouseEventArgs e)
+ {
+ base.OnMouseWheel (e);
+
+ if (ctrl_pressed == false) { // scroll horizontal
+ if (e.Delta > 0) {
+ if (current_cell.RowNumber > 0) {
+ CurrentCell = new DataGridCell (current_cell.RowNumber - 1, current_cell.ColumnNumber);
+ }
+ }
+ else {
+ if (current_cell.RowNumber < RowsCount - 1) {
+ CurrentCell = new DataGridCell (current_cell.RowNumber + 1, current_cell.ColumnNumber);
+ }
+ }
+ } else {
+ if (e.Delta > 0) {
+ if (current_cell.ColumnNumber > 0) {
+ CurrentCell = new DataGridCell (current_cell.RowNumber, current_cell.ColumnNumber - 1);
+ }
+ }
+ else {
+ if (current_cell.ColumnNumber < CurrentTableStyle.GridColumnStyles.Count - 1) {
+ CurrentCell = new DataGridCell (current_cell.RowNumber, current_cell.ColumnNumber + 1);
+ }
+ }
+ }
+ }
+
+ protected void OnNavigate (NavigateEventArgs e)
+ {
+ if (Navigate != null) {
+ Navigate (this, e);
+ }
+ }
+
+ protected override void OnPaint (PaintEventArgs pe)
+ {
+ ThemeEngine.Current.DataGridPaint (pe, this);
+ }
+
+ protected override void OnPaintBackground (PaintEventArgs ebe)
+ {
+ }
+
+ protected virtual void OnParentRowsLabelStyleChanged (EventArgs e)
+ {
+ if (ParentRowsLabelStyleChanged != null) {
+ ParentRowsLabelStyleChanged (this, e);
+ }
+ }
+
+ protected virtual void OnParentRowsVisibleChanged (EventArgs e)
+ {
+ if (ParentRowsVisibleChanged != null) {
+ ParentRowsVisibleChanged (this, e);
+ }
+ }
+
+ protected virtual void OnReadOnlyChanged (EventArgs e)
+ {
+ if (ReadOnlyChanged != null) {
+ ReadOnlyChanged (this, e);
+ }
+ }
+
+ protected override void OnResize (EventArgs e)
+ {
+ base.OnResize (e);
+ }
+
+ protected void OnRowHeaderClick (EventArgs e)
+ {
+ if (RowHeaderClick != null) {
+ RowHeaderClick (this, e);
+ }
+ }
+
+ protected void OnScroll (EventArgs e)
+ {
+ if (Scroll != null) {
+ Scroll (this, e);
+ }
+ }
+
+ protected void OnShowParentDetailsButtonClicked (object sender, EventArgs e)
+ {
+ if (ShowParentDetailsButtonClick != null) {
+ ShowParentDetailsButtonClick (sender, e);
+ }
+ }
+
+ protected override bool ProcessDialogKey (Keys keyData)
+ {
+ return base.ProcessDialogKey (keyData);
+ }
+
+ protected bool ProcessGridKey (KeyEventArgs ke)
+ {
+ if (RowsCount == 0) {
+ return false;
+ }
+
+ switch (ke.KeyCode) {
+ case Keys.ControlKey:
+ ctrl_pressed = true;
+ break;
+ case Keys.ShiftKey:
+ shift_pressed = true;
+ break;
+ case Keys.Up:
+ {
+ if (current_cell.RowNumber > 0) {
+ CurrentCell = new DataGridCell (current_cell.RowNumber - 1, current_cell.ColumnNumber);
+ EditCell (current_cell);
+ }
+ break;
+ }
+ case Keys.Down:
+ {
+ if (current_cell.RowNumber < RowsCount - 1) {
+ CurrentCell = new DataGridCell (current_cell.RowNumber + 1, current_cell.ColumnNumber);
+ EditCell (current_cell);
+ }
+ break;
+ }
+ case Keys.Tab:
+ case Keys.Right:
+ {
+ if (current_cell.ColumnNumber + 1 < CurrentTableStyle.GridColumnStyles.Count) {
+ CurrentCell = new DataGridCell (current_cell.RowNumber, current_cell.ColumnNumber + 1);
+ EditCell (current_cell);
+ }
+ break;
+ }
+ case Keys.Left:
+ {
+ if (current_cell.ColumnNumber > 0) {
+ CurrentCell = new DataGridCell (current_cell.RowNumber, current_cell.ColumnNumber - 1);
+ EditCell (current_cell);
+ }
+ break;
+ }
+ case Keys.PageUp:
+ {
+ if (current_cell.RowNumber > grid_drawing.VLargeChange) {
+ CurrentCell = new DataGridCell (current_cell.RowNumber - grid_drawing.VLargeChange, current_cell.ColumnNumber);
+ } else {
+ CurrentCell = new DataGridCell (0, current_cell.ColumnNumber);
+ }
+
+ EditCell (current_cell);
+ break;
+ }
+ case Keys.PageDown:
+ {
+ if (current_cell.RowNumber + grid_drawing.VLargeChange < RowsCount) {
+ CurrentCell = new DataGridCell (current_cell.RowNumber + grid_drawing.VLargeChange, current_cell.ColumnNumber);
+ } else {
+ CurrentCell = new DataGridCell (RowsCount - 1, current_cell.ColumnNumber);
+ }
+
+ EditCell (current_cell);
+ break;
+ }
+ case Keys.Home:
+ {
+ CurrentCell = new DataGridCell (0, current_cell.ColumnNumber);
+ EditCell (current_cell);
+ break;
+ }
+ case Keys.End:
+ {
+ CurrentCell = new DataGridCell (RowsCount - 1, current_cell.ColumnNumber);
+ EditCell (current_cell);
+ break;
+ }
+ case Keys.Delete:
+ {
+ foreach (int row in selected_rows.Keys) {
+ ListManager.RemoveAt (row);
+ }
+ selected_rows.Clear ();
+ CalcAreasAndInvalidate ();
+ break;
+ }
+ default:
+ return false; // message not processed
+ }
+
+ return true; // message processed
+ }
+
+ // Called from DataGridTextBox
+ protected override bool ProcessKeyPreview (ref Message m)
+ {
+ Keys key = (Keys) m.WParam.ToInt32 ();
+ KeyEventArgs ke = new KeyEventArgs (key);
+ if (ProcessGridKey (ke) == true) {
+ return true;
+ }
+
+ return base.ProcessKeyPreview (ref m);
+ }
+
+ protected bool ProcessTabKey (Keys keyData)
+ {
+ return false;
+ }
+
+ public void ResetAlternatingBackColor ()
+ {
+ alternating_backcolor = def_alternating_backcolor;
+ }
+
+ public override void ResetBackColor ()
+ {
+ backColor = ThemeEngine.Current.DataGridBackColor;
+ }
+
+ public override void ResetForeColor ()
+ {
+ base.ResetForeColor ();
+ }
+
+ public void ResetGridLineColor ()
+ {
+ gridline_color = def_gridline_color;
+ }
+
+ public void ResetHeaderBackColor ()
+ {
+ header_backcolor = def_header_backcolor;
+ }
+
+ public void ResetHeaderFont ()
+ {
+ header_font = def_header_font;
+ }
+
+ public void ResetHeaderForeColor ()
+ {
+ header_forecolor = def_header_forecolor;
+ }
+
+ public void ResetLinkColor ()
+ {
+ link_color = def_link_color;
+ }
+
+ public void ResetLinkHoverColor ()
+ {
+ link_hovercolor = def_link_hovercolor;
+ }
+
+ protected void ResetSelection ()
+ {
+ foreach (int row in selected_rows.Keys) {
+ grid_drawing.InvalidateRow (row);
+ grid_drawing.InvalidateRowHeader (row);
+ }
+
+ selected_rows.Clear ();
+ }
+
+ public void ResetSelectionBackColor ()
+ {
+ selection_backcolor = def_selection_backcolor;
+ }
+
+ public void ResetSelectionForeColor ()
+ {
+ selection_forecolor = def_selection_forecolor;
+ }
+
+ public void Select (int row)
+ {
+ if (selected_rows[row] == null) {
+ selected_rows.Add (row, true);
+ } else {
+ selected_rows[row] = true;
+ }
+
+ grid_drawing.InvalidateRow (row);
+ }
+
+ public void SetDataBinding (object dataSource, string dataMember)
+ {
+ dataMember = null;
+ SetDataSource (dataSource);
+ SetDataMember (dataMember);
+ SetNewDataSource ();
+ }
+
+ protected virtual bool ShouldSerializeAlternatingBackColor ()
+ {
+ return (alternating_backcolor != def_alternating_backcolor);
+ }
+
+ protected virtual bool ShouldSerializeBackgroundColor ()
+ {
+ return (background_color != def_background_color);
+ }
+
+ protected virtual bool ShouldSerializeCaptionBackColor ()
+ {
+ return (caption_backcolor != def_caption_backcolor);
+ }
+
+ protected virtual bool ShouldSerializeCaptionForeColor ()
+ {
+ return (caption_forecolor != def_caption_forecolor);
+ }
+
+ protected virtual bool ShouldSerializeGridLineColor ()
+ {
+ return (gridline_color != def_gridline_color);
+ }
+
+ protected virtual bool ShouldSerializeHeaderBackColor ()
+ {
+ return (header_backcolor != def_header_backcolor);
+ }
+
+ protected bool ShouldSerializeHeaderFont ()
+ {
+ return (header_font != def_header_font);
+ }
+
+ protected virtual bool ShouldSerializeHeaderForeColor ()
+ {
+ return (header_forecolor != def_header_forecolor);
+ }
+
+ protected virtual bool ShouldSerializeLinkHoverColor ()
+ {
+ return (link_hovercolor != def_link_hovercolor);
+ }
+
+ protected virtual bool ShouldSerializeParentRowsBackColor ()
+ {
+ return (parentrowsback_color != def_parentrowsback_color);
+ }
+
+ protected virtual bool ShouldSerializeParentRowsForeColor ()
+ {
+ return (parentrowsback_color != def_parentrowsback_color);
+ }
+
+ protected bool ShouldSerializePreferredRowHeight ()
+ {
+ return (preferredrow_height != def_preferredrow_height);
+ }
+
+ protected bool ShouldSerializeSelectionBackColor ()
+ {
+ return (selection_backcolor != def_selection_backcolor);
+ }
+
+ protected virtual bool ShouldSerializeSelectionForeColor ()
+ {
+ return (selection_forecolor != def_selection_forecolor);
+ }
+
+ public void SubObjectsSiteChange (bool site)
+ {
+
+ }
+
+ public void UnSelect (int row)
+ {
+ selected_rows.Remove (row);
+ grid_drawing.InvalidateRow (row);
+
+ }
+ #endregion // Public Instance Methods
+
+ #region Private Instance Methods
+
+ internal void CalcAreasAndInvalidate ()
+ {
+ grid_drawing.CalcGridAreas ();
+ Invalidate ();
+ }
+
+ private void ConnectListManagerEvents ()
+ {
+ cached_currencymgr_events.CurrentChanged += new EventHandler (OnListManagerCurrentChanged);
+ }
+
+ private void DisconnectListManagerEvents ()
+ {
+
+ }
+
+ // EndEdit current editing operation
+ internal virtual bool EndEdit (bool shouldAbort)
+ {
+ return EndEdit (CurrentTableStyle.GridColumnStyles[current_cell.ColumnNumber],
+ current_cell.RowNumber, shouldAbort);
+ }
+
+ private void EnsureCellVisilibility (DataGridCell cell)
+ {
+ if (cell.ColumnNumber <= first_visiblecolumn ||
+ cell.ColumnNumber + 1 >= first_visiblecolumn + visiblecolumn_count) {
+
+ first_visiblecolumn = grid_drawing.GetFirstColumnForColumnVisilibility (first_visiblecolumn, cell.ColumnNumber);
+
+ int pixel = grid_drawing.GetColumnStartingPixel (first_visiblecolumn);
+ ScrollToColumnInPixels (pixel);
+ }
+
+ if (cell.RowNumber < first_visiblerow ||
+ cell.RowNumber + 1 >= first_visiblerow + visiblerow_count) {
+
+ if (cell.RowNumber + 1 >= first_visiblerow + visiblerow_count) {
+ int old_first_visiblerow = first_visiblerow;
+ first_visiblerow = 1 + cell.RowNumber - visiblerow_count;
+ grid_drawing.UpdateVisibleRowCount ();
+ ScrollToRow (old_first_visiblerow, first_visiblerow);
+ }else {
+ int old_first_visiblerow = first_visiblerow;
+ first_visiblerow = cell.RowNumber;
+ grid_drawing.UpdateVisibleRowCount ();
+ ScrollToRow (old_first_visiblerow, first_visiblerow);
+ }
+
+ vert_scrollbar.Value = first_visiblerow;
+ }
+ }
+
+ internal IEnumerable GetDataSource (object source, string member)
+ {
+ IListSource src = (IListSource) source;
+ IList list = src.GetList();
+ IListSource listsource;
+ ITypedList typedlist;
+
+ if (source is IEnumerable) {
+ return (IEnumerable) source;
+ }
+
+ if(src.ContainsListCollection == false) {
+ return list;
+ }
+
+ listsource = (IListSource) source;
+
+ if (listsource == null) {
+ return null;
+ }
+
+ list = src.GetList ();
+
+ if (list == null) {
+ return null;
+ }
+
+ typedlist = (ITypedList) list;
+
+ if (typedlist == null) {
+ return null;
+ }
+
+ PropertyDescriptorCollection col = typedlist.GetItemProperties (new PropertyDescriptor [0]);
+ PropertyDescriptor prop = col.Find (member, true);
+
+ if (prop == null) {
+ if (col.Count > 0) {
+ prop = col[0];
+
+ if (prop == null) {
+ return null;
+ }
+ }
+ }
+
+ IEnumerable result = (IEnumerable)(prop.GetValue (list[0]));
+ return result;
+
+ }
+
+ internal void InvalidateCurrentRowHeader ()
+ {
+ grid_drawing.InvalidateRowHeader (current_cell.RowNumber);
+ }
+
+ private bool SetDataMember (string member)
+ {
+ if (member == datamember) {
+ return false;
+ }
+
+ datamember = member;
+ real_datasource = GetDataSource (datasource, member);
+ DisconnectListManagerEvents ();
+ cached_currencymgr = cached_currencymgr_events = null;
+ return true;
+ }
+
+ private bool SetDataSource (object source)
+ {
+
+ if (source != null && source as IListSource != null && source as IList != null) {
+ throw new Exception ("Wrong complex data binding source");
+ }
+
+ current_cell = new DataGridCell ();
+ datasource = source;
+ DisconnectListManagerEvents ();
+ cached_currencymgr = cached_currencymgr_events = null;
+ try {
+ real_datasource = GetDataSource (datasource, DataMember);
+ }catch (Exception e) {
+ real_datasource = source;
+ }
+
+ OnDataSourceChanged (EventArgs.Empty);
+ return true;
+ }
+
+ private void SetNewDataSource ()
+ {
+ if (ListManager != null && TableStyles[datamember] == null) {
+ current_style.GridColumnStyles.Clear ();
+ }
+ current_style.CreateColumnsForTable (false);
+ CalcAreasAndInvalidate ();
+ }
+
+ private void OnKeyUpDG (object sender, KeyEventArgs e)
+ {
+ switch (e.KeyCode) {
+ case Keys.ControlKey:
+ ctrl_pressed = false;
+ break;
+ case Keys.ShiftKey:
+ shift_pressed = false;
+ break;
+ default:
+ break;
+ }
+ }
+
+ private void OnListManagerCurrentChanged (object sender, EventArgs e)
+ {
+ if (accept_listmgrevents == false) {
+ return;
+ }
+
+ CurrentCell = new DataGridCell (cached_currencymgr_events.Position, current_cell.RowNumber);
+ }
+
+ private void OnTableStylesCollectionChanged (object sender, CollectionChangeEventArgs e)
+ {
+ if (ListManager == null)
+ return;
+
+ switch (e.Action){
+ case CollectionChangeAction.Add: {
+ if (e.Element != null && String.Compare (ListManager.ListName, ((DataGridTableStyle)e.Element).MappingName, true) == 0) {
+ CurrentTableStyle = (DataGridTableStyle)e.Element;
+ ((DataGridTableStyle) e.Element).CreateColumnsForTable (false);
+ }
+ break;
+ }
+
+ case CollectionChangeAction.Remove: {
+ if (e.Element != null && String.Compare (ListManager.ListName, ((DataGridTableStyle)e.Element).MappingName, true) == 0) {
+ CurrentTableStyle = default_style;
+ current_style.GridColumnStyles.Clear ();
+ current_style.CreateColumnsForTable (false);
+ }
+ break;
+ }
+
+
+ case CollectionChangeAction.Refresh: {
+ if (e.Element != null && String.Compare (ListManager.ListName, ((DataGridTableStyle)e.Element).MappingName, true) == 0) {
+ CurrentTableStyle = (DataGridTableStyle)e.Element;
+ ((DataGridTableStyle) e.Element).CreateColumnsForTable (false);
+ } else {
+ CurrentTableStyle = default_style;
+ current_style.GridColumnStyles.Clear ();
+ current_style.CreateColumnsForTable (false);
+
+ }
+ break;
+
+ }
+ }
+ CalcAreasAndInvalidate ();
+ }
+
+ private void EditCell (DataGridCell cell)
+ {
+ ResetSelection (); // Invalidates selected rows
+ is_editing = false;
+ is_changing = false;
+
+ if (ShowEditRow && is_adding == false && cell.RowNumber >= RowsCount) {
+ ListManager.AddNew ();
+ is_adding = true;
+ Invalidate (); // We have just added a new row
+ }
+
+ CurrentTableStyle.GridColumnStyles[cell.ColumnNumber].Edit (ListManager,
+ cell.RowNumber, GetCellBounds (cell.RowNumber, cell.ColumnNumber),
+ _readonly, string.Empty, true);
+ }
+
+ private void ShiftSelection (int index)
+ {
+ int shorter_item = -1, dist = RowsCount + 1, cur_dist;
+
+ foreach (int row in selected_rows.Keys) {
+
+ if (row > index) {
+ cur_dist = row - index;
+ }
+ else {
+ cur_dist = index - row;
+ }
+
+ if (cur_dist < dist) {
+ dist = cur_dist;
+ shorter_item = row;
+ }
+ }
+
+ if (shorter_item != -1) {
+ int start, end;
+
+ if (shorter_item > index) {
+ start = index;
+ end = shorter_item;
+ } else {
+ start = shorter_item;
+ end = index;
+ }
+
+ ResetSelection ();
+ for (int idx = start; idx <= end; idx++) {
+ Select (idx);
+ }
+ }
+ }
+
+ private void ScrollToColumnInPixels (int pixel)
+ {
+ Rectangle invalidate = new Rectangle ();
+ Rectangle invalidate_column = new Rectangle ();
+
+ if (pixel > horz_pixeloffset) { // ScrollRight
+ int pixels = pixel - horz_pixeloffset;
+
+ horz_pixeloffset = horiz_scrollbar.Value = pixel;
+ grid_drawing.UpdateVisibleColumn ();
+
+ // Columns header
+ invalidate_column.X = grid_drawing.ColumnsHeadersArea.X + grid_drawing.ColumnsHeadersArea.Width - pixels;
+ invalidate_column.Y = grid_drawing.ColumnsHeadersArea.Y;
+ invalidate_column.Width = pixels;
+ invalidate_column.Height = grid_drawing.ColumnsHeadersArea.Height;
+ XplatUI.ScrollWindow (Handle, grid_drawing.ColumnsHeadersArea, -pixels, 0, false);
+
+ // Cells
+ invalidate.X = grid_drawing.CellsArea.X + grid_drawing.CellsArea.Width - pixels;
+ invalidate.Y = grid_drawing.CellsArea.Y;
+ invalidate.Width = pixels;
+ invalidate.Height = grid_drawing.CellsArea.Height;
+
+
+ if (columnheaders_visible == true) {
+ invalidate.Y -= grid_drawing.ColumnsHeadersArea.Height;
+ invalidate.Height += grid_drawing.ColumnsHeadersArea.Height;
+ }
+
+ XplatUI.ScrollWindow (Handle, grid_drawing.CellsArea, -pixels, 0, false);
+ Invalidate (invalidate_column);
+ Invalidate (invalidate);
+
+
+ } else {
+ int pixels = horz_pixeloffset - pixel;
+ Rectangle area = grid_drawing.CellsArea;
+
+ horz_pixeloffset = horiz_scrollbar.Value = pixel;
+ grid_drawing.UpdateVisibleColumn ();
+
+ // Columns header
+ invalidate_column.X = grid_drawing.ColumnsHeadersArea.X;
+ invalidate_column.Y = grid_drawing.ColumnsHeadersArea.Y;
+ invalidate_column.Width = pixels;
+ invalidate_column.Height = grid_drawing.ColumnsHeadersArea.Height;
+ //XplatUI.ScrollWindow (Handle, grid_drawing.ColumnsHeadersArea, pixels, 0, false);
+
+ // Cells
+ invalidate.X = grid_drawing.CellsArea.X;
+ invalidate.Y = grid_drawing.CellsArea.Y;
+ invalidate.Width = pixels;
+ invalidate.Height = grid_drawing.CellsArea.Height;
+
+ if (columnheaders_visible == true) {
+ invalidate.Y -= grid_drawing.ColumnsHeadersArea.Height;
+ invalidate.Height += grid_drawing.ColumnsHeadersArea.Height;
+ area.Y -= grid_drawing.ColumnsHeadersArea.Height;
+ area.Height += grid_drawing.ColumnsHeadersArea.Height;
+ }
+
+ XplatUI.ScrollWindow (Handle, area, pixels, 0, false);
+ Invalidate (invalidate);
+ }
+
+ }
+
+ private void ScrollToRow (int old_row, int new_row)
+ {
+ Rectangle invalidate = new Rectangle ();
+
+ if (new_row > old_row) { // Scrolldown
+ int scrolled_rows = new_row - old_row;
+ int pixels = scrolled_rows * RowHeight;
+ Rectangle rows_area = grid_drawing.CellsArea; // Cells area - partial rows space
+ rows_area.Height = grid_drawing.CellsArea.Height - grid_drawing.CellsArea.Height % RowHeight;
+
+ invalidate.X = grid_drawing.CellsArea.X;
+ invalidate.Y = grid_drawing.CellsArea.Y + rows_area.Height - pixels;
+ invalidate.Width = grid_drawing.CellsArea.Width;
+ invalidate.Height = pixels;
+
+ XplatUI.ScrollWindow (Handle, rows_area, 0, -pixels, false);
+
+ } else { // ScrollUp
+ int scrolled_rows = old_row - new_row;
+ int pixels = scrolled_rows * RowHeight;
+
+ invalidate.X = grid_drawing.CellsArea.X;
+ invalidate.Y = grid_drawing.CellsArea.Y;
+ invalidate.Width = grid_drawing.CellsArea.Width;
+ invalidate.Height = pixels;
+ XplatUI.ScrollWindow (Handle, grid_drawing.CellsArea, 0, pixels, false);
+ }
+
+ // Right now we use ScrollWindow Invalidate, let's leave remarked it here for X11 if need it
+ //Invalidate (invalidate);
+ Invalidate (grid_drawing.RowsHeadersArea);
+ }
+
+ #endregion Private Instance Methods
+
+
+ #region Events
+ public event EventHandler AllowNavigationChanged;
+ public event EventHandler BackButtonClick;
+ public event EventHandler BackgroundColorChanged;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler BackgroundImageChanged;
+
+ public event EventHandler BorderStyleChanged;
+ public event EventHandler CaptionVisibleChanged;
+ public event EventHandler CurrentCellChanged;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler CursorChanged;
+
+ public event EventHandler DataSourceChanged;
+ public event EventHandler FlatModeChanged;
+ public event NavigateEventHandler Navigate;
+ public event EventHandler ParentRowsLabelStyleChanged;
+ public event EventHandler ParentRowsVisibleChanged;
+ public event EventHandler ReadOnlyChanged;
+ protected event EventHandler RowHeaderClick;
+ public event EventHandler Scroll;
+ public event EventHandler ShowParentDetailsButtonClick;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler TextChanged;
+ #endregion // Events
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridBoolColumn.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridBoolColumn.cs
new file mode 100644
index 00000000000..06358d1202b
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridBoolColumn.cs
@@ -0,0 +1,384 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Jordi Mas i Hernandez <jordi@ximian.com>
+//
+//
+
+// NOT COMPLETE
+
+using System.ComponentModel;
+using System.Drawing;
+using System.Runtime.InteropServices;
+using System.Diagnostics;
+using System.Collections;
+
+namespace System.Windows.Forms
+{
+ public class DataGridBoolColumn : DataGridColumnStyle
+ {
+ [Flags]
+ private enum CheckState {
+ Checked = 0x00000001,
+ UnChecked = 0x00000002,
+ Null = 0x00000004,
+ Selected = 0x00000008
+ }
+
+ #region Local Variables
+ private bool allownull;
+ private object falsevalue;
+ private object nullvalue;
+ private object truevalue;
+ private Hashtable checkboxes_state;
+ #endregion // Local Variables
+
+ #region Constructors
+ public DataGridBoolColumn () : base ()
+ {
+ CommonConstructor ();
+ }
+
+ public DataGridBoolColumn (PropertyDescriptor prop) : base (prop)
+ {
+ CommonConstructor ();
+ }
+
+ public DataGridBoolColumn (PropertyDescriptor prop, bool isDefault) : base (prop)
+ {
+ CommonConstructor ();
+ is_default = isDefault;
+ }
+
+ private void CommonConstructor ()
+ {
+ allownull = true;
+ falsevalue = false;
+ nullvalue = null;
+ truevalue = true;
+ checkboxes_state = new Hashtable ();
+ }
+
+ #endregion
+
+ #region Public Instance Properties
+ [DefaultValue(true)]
+ public bool AllowNull {
+ get {
+ return allownull;
+ }
+ set {
+ if (value != allownull) {
+ allownull = value;
+
+ if (AllowNullChanged != null) {
+ AllowNullChanged (this, EventArgs.Empty);
+ }
+ }
+ }
+ }
+
+ [TypeConverter(typeof(System.ComponentModel.StringConverter))]
+ public object FalseValue {
+ get {
+ return falsevalue;
+ }
+ set {
+ if (value != falsevalue) {
+ falsevalue = value;
+
+ if (FalseValueChanged != null) {
+ FalseValueChanged (this, EventArgs.Empty);
+ }
+ }
+ }
+ }
+
+ [TypeConverter(typeof(System.ComponentModel.StringConverter))]
+ public object NullValue {
+ get {
+ return nullvalue;
+ }
+ set {
+ if (value != nullvalue) {
+ nullvalue = value;
+ }
+ }
+ }
+
+ [TypeConverter(typeof(System.ComponentModel.StringConverter))]
+ public object TrueValue {
+ get {
+ return truevalue;
+ }
+ set {
+ if (value != truevalue) {
+ truevalue = value;
+
+ if (TrueValueChanged != null) {
+ TrueValueChanged (this, EventArgs.Empty);
+ }
+ }
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Instance Methods
+ protected internal override void Abort (int rowNum)
+ {
+ SetState (rowNum, GetState (null, rowNum) & ~CheckState.Selected);
+ grid.Invalidate (grid.GetCurrentCellBounds ());
+ }
+
+ protected internal override bool Commit (CurrencyManager source, int rowNum)
+ {
+ SetColumnValueAtRow (source, rowNum, FromStateToValue (GetState (source, rowNum)));
+ SetState (rowNum, GetState (source, rowNum) & ~CheckState.Selected);
+ grid.Invalidate (grid.GetCurrentCellBounds ());
+ return true;
+ }
+
+ [MonoTODO]
+ protected internal override void ConcedeFocus ()
+ {
+
+ }
+
+ protected internal override void Edit (CurrencyManager source, int rowNum, Rectangle bounds, bool readOnly, string instantText, bool cellIsVisible)
+ {
+ SetState (rowNum, GetState (source, rowNum) | CheckState.Selected);
+ grid.Invalidate (grid.GetCurrentCellBounds ());
+ }
+
+ [MonoTODO]
+ protected internal override void EnterNullValue ()
+ {
+
+ }
+
+ protected internal override object GetColumnValueAtRow (CurrencyManager lm, int row)
+ {
+ object obj = base.GetColumnValueAtRow (lm, row);
+
+ if (obj.Equals (nullvalue)) {
+ return Convert.DBNull;
+ }
+
+ if (obj.Equals (truevalue)) {
+ return true;
+ }
+
+ return false;
+ }
+
+ protected internal override int GetMinimumHeight ()
+ {
+ return ThemeEngine.Current.DataGridMinimumColumnCheckBoxHeight;
+ }
+
+ protected internal override int GetPreferredHeight (Graphics g, object value)
+ {
+ return ThemeEngine.Current.DataGridMinimumColumnCheckBoxHeight;
+ }
+
+ protected internal override Size GetPreferredSize (Graphics g, object value)
+ {
+ return new Size (ThemeEngine.Current.DataGridMinimumColumnCheckBoxWidth, ThemeEngine.Current.DataGridMinimumColumnCheckBoxHeight);
+ }
+
+ protected internal override void Paint (Graphics g, Rectangle bounds, CurrencyManager source, int rowNum)
+ {
+ Paint (g, bounds, source, rowNum, false);
+ }
+
+ protected internal override void Paint (Graphics g, Rectangle bounds, CurrencyManager source, int rowNum, bool alignToRight)
+ {
+ Paint (g, bounds, source, rowNum, ThemeEngine.Current.ResPool.GetSolidBrush (DataGridTableStyle.BackColor),
+ ThemeEngine.Current.ResPool.GetSolidBrush (DataGridTableStyle.ForeColor), alignToRight);
+ }
+
+ protected internal override void Paint (Graphics g, Rectangle bounds, CurrencyManager source, int rowNum, Brush backBrush, Brush foreBrush, bool alignToRight)
+ {
+ Size chkbox_size = GetPreferredSize (g, null);
+ Rectangle rect = new Rectangle ();
+ ButtonState state;
+ chkbox_size.Width -= 2;
+ chkbox_size.Height -= 2;
+ rect.X = bounds.X + ((bounds.Width - chkbox_size.Width) / 2);
+ rect.Y = bounds.Y + ((bounds.Height - chkbox_size.Height) / 2);
+ rect.Width = chkbox_size.Width;
+ rect.Height = chkbox_size.Height;
+
+ // If the cell is selected
+ if ((GetState (source, rowNum) & CheckState.Selected) == CheckState.Selected) {
+ backBrush = ThemeEngine.Current.ResPool.GetSolidBrush (grid.SelectionBackColor);
+ }
+
+ g.FillRectangle (backBrush, bounds);
+
+ switch (GetState (source, rowNum) & ~CheckState.Selected) {
+ case CheckState.Checked:
+ state = ButtonState.Checked;
+ break;
+ case CheckState.Null:
+ state = ButtonState.Inactive;
+ break;
+ case CheckState.UnChecked:
+ default:
+ state = ButtonState.Normal;
+ break;
+ }
+
+ ThemeEngine.Current.CPDrawCheckBox (g, rect, state);
+ PaintGridLine (g, bounds);
+ }
+
+ protected internal override void SetColumnValueAtRow (CurrencyManager lm, int row, object obj)
+ {
+ object value = null;
+
+ if (obj.Equals (nullvalue)) {
+ value = Convert.DBNull;
+ } else {
+ if (obj.Equals (truevalue)) {
+ value = true;
+ }
+ }
+
+ base.SetColumnValueAtRow (lm, row, value);
+ }
+ #endregion // Public Instance Methods
+
+ #region Private Instance Methods
+ internal static bool CanRenderType (Type type)
+ {
+ return (type == typeof (Boolean));
+ }
+
+ private object FromStateToValue (CheckState state)
+ {
+ state = state & ~CheckState.Selected;
+
+ if ((state & CheckState.Checked) == CheckState.Checked) {
+ return truevalue;
+ }
+
+ if ((state & CheckState.Null) == CheckState.Null) {
+ return nullvalue;
+ }
+
+ return falsevalue;
+ }
+
+ private CheckState FromValueToState (object obj)
+ {
+ if (obj.Equals (truevalue)) {
+ return CheckState.Checked;
+ }
+
+ if (obj.Equals (nullvalue)) {
+ return CheckState.Null;
+ }
+
+ return CheckState.UnChecked;
+ }
+
+ private CheckState GetState (CurrencyManager source, int row)
+ {
+ CheckState state;
+
+ if (checkboxes_state[row] == null) {
+ object value = GetColumnValueAtRow (source, row);
+ state = FromValueToState (value);
+ checkboxes_state.Add (row, state);
+ } else {
+ state = (CheckState) checkboxes_state[row];
+ }
+
+ return state;
+ }
+
+ private CheckState GetNextState (CheckState state)
+ {
+ CheckState new_state;
+ bool selected = ((state & CheckState.Selected) == CheckState.Selected);
+
+ switch (state & ~CheckState.Selected) {
+ case CheckState.Checked:
+ new_state = CheckState.Null;
+ break;
+ case CheckState.Null:
+ new_state = CheckState.UnChecked;
+ break;
+ case CheckState.UnChecked:
+ default:
+ new_state = CheckState.Checked;
+ break;
+ }
+
+ if (selected) {
+ new_state = new_state | CheckState.Selected;
+ }
+
+ return new_state;
+ }
+
+ internal override void OnKeyDown (KeyEventArgs ke, int row, int column)
+ {
+ CheckState state = GetNextState (GetState (null, row));
+
+ if (ke.KeyCode == Keys.Space) {
+ grid.is_changing = true;
+ grid.InvalidateCurrentRowHeader ();
+ checkboxes_state[row] = state;
+ grid.Invalidate (grid.GetCellBounds (row, column));
+ }
+ }
+
+ internal override void OnMouseDown (MouseEventArgs e, int row, int column)
+ {
+ CheckState state = GetNextState (GetState (null, row));
+
+ grid.is_changing = true;
+ grid.InvalidateCurrentRowHeader ();
+ SetState (row, state);
+ grid.Invalidate (grid.GetCellBounds (row, column));
+ }
+
+ private void SetState (int row, CheckState state)
+ {
+ if (checkboxes_state[row] == null) {
+ checkboxes_state.Add (row, state);
+ } else {
+ checkboxes_state[row] = state;
+ }
+ }
+
+ #endregion Private Instance Methods
+
+ #region Events
+ public event EventHandler AllowNullChanged;
+ public event EventHandler FalseValueChanged;
+ public event EventHandler TrueValueChanged;
+ #endregion // Events
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridCell.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridCell.cs
new file mode 100644
index 00000000000..5249b6e5743
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridCell.cs
@@ -0,0 +1,85 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Jordi Mas i Hernandez <jordi@ximian.com>
+//
+//
+
+using System.ComponentModel;
+using System.Drawing;
+using System.Runtime.InteropServices;
+using System.Diagnostics;
+
+namespace System.Windows.Forms
+{
+ public struct DataGridCell
+ {
+ #region Local Variables
+ private int row;
+ private int column;
+ #endregion // Local Variables
+
+ #region Constructors
+ public DataGridCell (int r, int c)
+ {
+ row = r;
+ column = c;
+ }
+ #endregion
+
+ #region Public Instance Properties
+ public int ColumnNumber {
+ get { return column; }
+ set { column = value; }
+ }
+
+ public int RowNumber {
+ get { return row; }
+ set { row = value; }
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Instance Methods
+ public override bool Equals (object o)
+ {
+ if (!(o is DataGridCell))
+ return false;
+
+ DataGridCell obj = (DataGridCell) o;
+ return (obj.ColumnNumber == column && obj.RowNumber == row);
+
+ }
+
+ public override int GetHashCode ()
+ {
+ return row ^ column;
+ }
+
+ public override string ToString ()
+ {
+ return "DataGridCell {RowNumber = " + row +", ColumnNumber = " + column + "}";
+ }
+
+ #endregion // Public Instance Methods
+
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridColumnStyle.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridColumnStyle.cs
new file mode 100644
index 00000000000..a2993173201
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridColumnStyle.cs
@@ -0,0 +1,602 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Jordi Mas i Hernandez <jordi@ximian.com>
+//
+//
+
+// NOT COMPLETE
+
+using System.Drawing;
+using System.ComponentModel;
+using System.Runtime.InteropServices;
+using System.Diagnostics;
+
+namespace System.Windows.Forms
+{
+ [DesignTimeVisible(false)]
+ [DefaultProperty("Header")]
+ [ToolboxItem(false)]
+ public abstract class DataGridColumnStyle : Component, IDataGridColumnStyleEditingNotificationService
+ {
+ [ComVisible(true)]
+ protected class DataGridColumnHeaderAccessibleObject : AccessibleObject
+ {
+ #region Local Variables
+ private DataGridColumnStyle owner;
+ #endregion
+
+ #region Constructors
+ public DataGridColumnHeaderAccessibleObject (DataGridColumnStyle columnstyle)
+ {
+ owner = columnstyle;
+ }
+ #endregion //Constructors
+
+ #region Public Instance Properties
+ [MonoTODO]
+ public override Rectangle Bounds {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public override string Name {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ protected DataGridColumnStyle Owner {
+ get { return owner; }
+ }
+
+ public override AccessibleObject Parent {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public override AccessibleRole Role {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ #endregion
+
+ #region Public Instance Methods
+ [MonoTODO]
+ public override AccessibleObject Navigate (AccessibleNavigation navdir)
+ {
+ throw new NotImplementedException ();
+ }
+ #endregion Public Instance Methods
+ }
+
+ protected class CompModSwitches
+ {
+ public CompModSwitches ()
+ {
+ }
+
+ #region Public Instance Methods
+ [MonoTODO]
+ public static TraceSwitch DGEditColumnEditing {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ #endregion Public Instance Methods
+ }
+
+ internal enum ArrowDrawing
+ {
+ No = 0,
+ Ascending = 1,
+ Descending = 2
+ }
+
+ #region Local Variables
+ internal HorizontalAlignment alignment;
+ private int fontheight;
+ internal DataGridTableStyle table_style;
+ private string header_text;
+ private string mapping_name;
+ private string null_text;
+ private PropertyDescriptor property_descriptor;
+ private bool _readonly;
+ private int width;
+ internal bool is_default;
+ internal DataGrid grid;
+ private DataGridColumnHeaderAccessibleObject accesible_object;
+ private StringFormat string_format_hdr;
+ static string def_null_text = "(null)";
+ private ArrowDrawing arrow_drawing = ArrowDrawing.No;
+ #endregion // Local Variables
+
+ #region Constructors
+ public DataGridColumnStyle ()
+ {
+ CommmonConstructor ();
+ property_descriptor = null;
+ }
+
+ public DataGridColumnStyle (PropertyDescriptor prop)
+ {
+ CommmonConstructor ();
+ property_descriptor = prop;
+ }
+
+ private void CommmonConstructor ()
+ {
+ fontheight = -1;
+ table_style = null;
+ header_text = string.Empty;
+ mapping_name = string.Empty;
+ null_text = def_null_text;
+ accesible_object = new DataGridColumnHeaderAccessibleObject (this);
+ _readonly = false;
+ width = -1;
+ grid = null;
+ is_default = false;
+ alignment = HorizontalAlignment.Left;
+ string_format_hdr = new StringFormat ();
+ string_format_hdr.FormatFlags |= StringFormatFlags.NoWrap;
+ string_format_hdr.LineAlignment = StringAlignment.Center;
+ }
+
+ #endregion
+
+ #region Public Instance Properties
+ [Localizable(true)]
+ [DefaultValue(HorizontalAlignment.Left)]
+ public virtual HorizontalAlignment Alignment {
+ get {
+ return alignment;
+ }
+ set {
+ if (value != alignment) {
+ alignment = value;
+
+ if (table_style != null && table_style.DataGrid != null) {
+ table_style.DataGrid.Invalidate ();
+ }
+
+ if (AlignmentChanged != null) {
+ AlignmentChanged (this, EventArgs.Empty);
+ }
+ }
+ }
+ }
+
+ [Browsable(false)]
+ public virtual DataGridTableStyle DataGridTableStyle {
+ get {
+ return table_style;
+ }
+ }
+
+ protected int FontHeight {
+ get {
+ if (fontheight != -1) {
+ return fontheight;
+ }
+
+ if (table_style != null) {
+ //return table_style.DataGrid.FontHeight
+ return -1;
+ }
+
+ // TODO: Default Datagrid font height
+ return -1;
+ }
+ }
+
+ [Browsable(false)]
+ public AccessibleObject HeaderAccessibleObject {
+ get {
+ return accesible_object;
+ }
+ }
+
+ [Localizable(true)]
+ public virtual string HeaderText {
+ get {
+ return header_text;
+ }
+ set {
+ if (value != header_text) {
+ header_text = value;
+
+ if (table_style != null && table_style.DataGrid != null) {
+ table_style.DataGrid.Invalidate ();
+ }
+
+ if (HeaderTextChanged != null) {
+ HeaderTextChanged (this, EventArgs.Empty);
+ }
+ }
+ }
+ }
+
+ [Editor("System.Windows.Forms.Design.DataGridColumnStyleMappingNameEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
+ [Localizable(true)]
+ public string MappingName {
+ get {
+ return mapping_name;
+ }
+ set {
+ if (value != mapping_name) {
+ mapping_name = value;
+
+ if (MappingNameChanged != null) {
+ MappingNameChanged (this, EventArgs.Empty);
+ }
+ }
+ }
+ }
+
+ [Localizable(true)]
+ public virtual string NullText {
+ get {
+ return null_text;
+ }
+ set {
+ if (value != null_text) {
+ null_text = value;
+
+ if (table_style != null && table_style.DataGrid != null) {
+ table_style.DataGrid.Invalidate ();
+ }
+
+ if (NullTextChanged != null) {
+ NullTextChanged (this, EventArgs.Empty);
+ }
+ }
+ }
+ }
+
+ [Browsable(false)]
+ [DefaultValue(null)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public virtual PropertyDescriptor PropertyDescriptor {
+ get {
+ return property_descriptor;
+ }
+ set {
+ if (value != property_descriptor) {
+ property_descriptor = value;
+
+ if (PropertyDescriptorChanged != null) {
+ PropertyDescriptorChanged (this, EventArgs.Empty);
+ }
+ }
+ }
+ }
+
+ [DefaultValue(false)]
+ public virtual bool ReadOnly {
+ get {
+ return _readonly;
+ }
+ set {
+ if (value != _readonly) {
+ _readonly = value;
+
+ if (table_style != null && table_style.DataGrid != null) {
+ table_style.DataGrid.CalcAreasAndInvalidate ();
+ }
+
+ if (ReadOnlyChanged != null) {
+ ReadOnlyChanged (this, EventArgs.Empty);
+ }
+ }
+ }
+ }
+
+ [DefaultValue(100)]
+ [Localizable(true)]
+ public virtual int Width {
+ get {
+ return width;
+ }
+ set {
+ if (value != width) {
+ width = value;
+
+ if (table_style != null && table_style.DataGrid != null) {
+ table_style.DataGrid.CalcAreasAndInvalidate ();
+ }
+
+ if (WidthChanged != null) {
+ WidthChanged (this, EventArgs.Empty);
+ }
+ }
+ }
+ }
+
+ #endregion // Public Instance Properties
+
+ #region Private Instance Properties
+
+ internal ArrowDrawing ArrowDrawingMode {
+ get { return arrow_drawing; }
+ set { arrow_drawing = value; }
+ }
+
+ // The logic seems to be that:
+ // - If DataGrid.ReadOnly is true all the tables and columns are readonly ignoring other settings
+ // - If DataGridTableStyle.ReadOnly is true all columns are readonly ignoring other settings
+ // - If DataGrid.ReadOnly and DataGridTableStyle.ReadOnly are false, the columns settings are mandatory
+ //
+ internal bool ParentReadOnly {
+ get {
+ if (grid != null) {
+ if (grid.ReadOnly == true) {
+ return true;
+ }
+
+ if (grid.ListManager != null && grid.ListManager.CanAddRows == false) {
+ return true;
+ }
+ }
+
+ if (table_style != null) {
+ if (table_style.ReadOnly == true) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+ }
+
+ internal DataGridTableStyle TableStyle {
+ set { table_style = value; }
+ }
+
+ internal bool IsDefault {
+ get { return is_default; }
+ }
+ #endregion Private Instance Properties
+
+ #region Public Instance Methods
+ protected internal abstract void Abort (int rowNum);
+
+ [MonoTODO]
+ protected void BeginUpdate ()
+ {
+
+ }
+
+ protected void CheckValidDataSource (CurrencyManager value)
+ {
+ if (value == null) {
+ throw new ArgumentNullException ("CurrencyManager cannot be null");
+ }
+
+ if (property_descriptor == null) {
+ throw new ApplicationException ("The PropertyDescriptor for this column is a null reference");
+ }
+ }
+
+ [MonoTODO]
+ protected internal virtual void ColumnStartedEditing (Control editingControl)
+ {
+
+ }
+
+ protected internal abstract bool Commit (CurrencyManager dataSource, int rowNum);
+
+
+ protected internal virtual void ConcedeFocus ()
+ {
+
+ }
+
+ protected virtual AccessibleObject CreateHeaderAccessibleObject ()
+ {
+ return new DataGridColumnHeaderAccessibleObject (this);
+ }
+
+ protected internal virtual void Edit (CurrencyManager source, int rowNum, Rectangle bounds, bool readOnly)
+ {
+ Edit (source, rowNum, bounds, readOnly, string.Empty);
+ }
+
+ protected internal virtual void Edit (CurrencyManager source, int rowNum, Rectangle bounds, bool readOnly, string instantText)
+ {
+ Edit (source, rowNum, bounds, readOnly, instantText, true);
+ }
+
+ protected internal abstract void Edit (CurrencyManager source, int rowNum, Rectangle bounds, bool readOnly, string instantText, bool cellIsVisible);
+
+
+ [MonoTODO]
+ protected void EndUpdate ()
+ {
+
+ }
+
+ protected internal virtual void EnterNullValue () {}
+
+ protected internal virtual object GetColumnValueAtRow (CurrencyManager source, int rowNum)
+ {
+ CheckValidDataSource (source);
+ return property_descriptor.GetValue (source.GetItem (rowNum));
+ }
+
+ protected internal abstract int GetMinimumHeight ();
+
+ protected internal abstract int GetPreferredHeight (Graphics g, object value);
+
+ protected internal abstract Size GetPreferredSize (Graphics g, object value);
+
+ void IDataGridColumnStyleEditingNotificationService.ColumnStartedEditing (Control editingControl)
+ {
+
+ }
+
+ protected virtual void Invalidate ()
+ {
+ grid.grid_drawing.InvalidateColumn (this);
+ }
+
+ protected internal abstract void Paint (Graphics g, Rectangle bounds, CurrencyManager source, int rowNum);
+ protected internal abstract void Paint (Graphics g, Rectangle bounds, CurrencyManager source, int rowNum, bool alignToRight);
+
+ protected internal virtual void Paint (Graphics g, Rectangle bounds, CurrencyManager source, int rowNum,
+ Brush backBrush, Brush foreBrush, bool alignToRight) {}
+
+ protected internal virtual void ReleaseHostedControl () {}
+
+ public void ResetHeaderText ()
+ {
+ HeaderText = string.Empty;
+ }
+
+ protected internal virtual void SetColumnValueAtRow (CurrencyManager source, int rowNum, object value)
+ {
+ CheckValidDataSource (source);
+ property_descriptor.SetValue (source.GetItem (rowNum), value);
+ }
+
+ protected virtual void SetDataGrid (DataGrid value)
+ {
+ grid = value;
+
+ if (property_descriptor != null || value == null || value.ListManager == null) {
+ return;
+ }
+
+ PropertyDescriptorCollection propcol = value.ListManager.GetItemProperties ();
+ for (int i = 0; i < propcol.Count ; i++) {
+ if (propcol[i].Name == mapping_name) {
+ property_descriptor = propcol[i];
+ break;
+ }
+ }
+ }
+
+ protected virtual void SetDataGridInColumn (DataGrid value)
+ {
+ SetDataGrid (value);
+ }
+
+ internal void SetDataGridInternal (DataGrid value)
+ {
+ SetDataGridInColumn (value);
+ }
+
+ protected internal virtual void UpdateUI (CurrencyManager source, int rowNum, string instantText)
+ {
+
+ }
+ #endregion // Public Instance Methods
+
+ #region Private Instance Methods
+ virtual internal void OnMouseDown (MouseEventArgs e, int row, int column) {}
+ virtual internal void OnKeyDown (KeyEventArgs ke, int row, int column) {}
+
+ internal void PaintHeader (Graphics g, Rectangle bounds, int colNum)
+ {
+ // Background
+ g.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (DataGridTableStyle.CurrentHeaderBackColor),
+ bounds);
+
+ if (grid.FlatMode == false) {
+
+ // Paint Borders
+ g.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorControlLight),
+ bounds.X, bounds.Y, bounds.X + bounds.Width, bounds.Y);
+
+ if (colNum == 0) {
+ g.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorControlLight),
+ bounds.X, bounds.Y, bounds.X, bounds.Y + bounds.Height);
+ } else {
+ g.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorControlLight),
+ bounds.X, bounds.Y + 2, bounds.X, bounds.Y + bounds.Height - 2);
+ }
+
+ g.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorControlDark),
+ bounds.X + bounds.Width - 1, bounds.Y + 2 , bounds.X + bounds.Width - 1, bounds.Y + bounds.Height - 2);
+ }
+
+ bounds.X += 2;
+ bounds.Width -= 2;
+ g.DrawString (HeaderText, DataGridTableStyle.HeaderFont, ThemeEngine.Current.ResPool.GetSolidBrush (DataGridTableStyle.CurrentHeaderForeColor),
+ bounds, string_format_hdr);
+
+ if (arrow_drawing != ArrowDrawing.No) {
+ // Draw 6 x 6
+ Point pnt = new Point (bounds.X + bounds.Width - 12, bounds.Y + ((bounds.Height - 6)/2));
+
+ if (arrow_drawing == ArrowDrawing.Ascending) {
+ g.DrawLine (SystemPens.ControlLightLight, pnt.X + 6, pnt.Y + 6, pnt.X + 3, pnt.Y);
+ g.DrawLine (SystemPens.ControlDark, pnt.X, pnt.Y + 6, pnt.X + 6, pnt.Y + 6);
+ g.DrawLine (SystemPens.ControlDark, pnt.X, pnt.Y + 6, pnt.X + 3, pnt.Y);
+ } else {
+ g.DrawLine (SystemPens.ControlLightLight, pnt.X + 6, pnt.Y, pnt.X + 3, pnt.Y + 6);
+ g.DrawLine (SystemPens.ControlDark, pnt.X, pnt.Y, pnt.X + 6, pnt.Y);
+ g.DrawLine (SystemPens.ControlDark, pnt.X, pnt.Y, pnt.X + 3, pnt.Y + 6);
+ }
+
+ }
+ }
+
+ internal void PaintNewRow (Graphics g, Rectangle bounds, Brush backBrush, Brush foreBrush)
+ {
+ g.FillRectangle (backBrush, bounds);
+ PaintGridLine (g, bounds);
+ }
+
+ internal void PaintGridLine (Graphics g, Rectangle bounds)
+ {
+ if (table_style.CurrentGridLineStyle != DataGridLineStyle.Solid) {
+ return;
+ }
+
+ g.DrawLine (ThemeEngine.Current.ResPool.GetPen (table_style.CurrentGridLineColor),
+ bounds.X, bounds.Y + bounds.Height - 1, bounds.X + bounds.Width - 1, bounds.Y + bounds.Height - 1);
+
+ g.DrawLine (ThemeEngine.Current.ResPool.GetPen (table_style.CurrentGridLineColor),
+ bounds.X + bounds.Width - 1, bounds.Y , bounds.X + bounds.Width - 1, bounds.Y + bounds.Height);
+ }
+
+ #endregion Private Instance Methods
+
+
+ #region Events
+ public event EventHandler AlignmentChanged;
+ public event EventHandler FontChanged;
+ public event EventHandler HeaderTextChanged;
+ public event EventHandler MappingNameChanged;
+ public event EventHandler NullTextChanged;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public event EventHandler PropertyDescriptorChanged;
+ public event EventHandler ReadOnlyChanged;
+ public event EventHandler WidthChanged;
+ #endregion // Events
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridDrawingLogic.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridDrawingLogic.cs
new file mode 100644
index 00000000000..392b8d49312
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridDrawingLogic.cs
@@ -0,0 +1,616 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Jordi Mas i Hernandez <jordi@ximian.com>
+//
+// Datagrid drawing logic
+//
+
+// NOT COMPLETE
+
+using System.Drawing;
+using System.Drawing.Drawing2D;
+
+namespace System.Windows.Forms
+{
+ internal class DataGridDrawing
+ {
+ #region Local Variables
+
+ private DataGrid grid;
+
+ // Areas
+ internal Rectangle caption_area;
+ internal Rectangle parent_rows;
+ internal Rectangle columnshdrs_area; // Used columns header area
+ internal int columnshdrs_maxwidth; // Total width (max width) for columns headrs
+ internal Rectangle rowshdrs_area; // Used Headers rows area
+ internal int rowshdrs_maxheight; // Total height for rows (max height)
+ internal Rectangle cells_area;
+ internal Font font_newrow = new Font (FontFamily.GenericSansSerif, 16);
+ #endregion // Local Variables
+
+
+ public DataGridDrawing (DataGrid datagrid)
+ {
+ grid = datagrid;
+ }
+
+ #region Public Instance Methods
+
+ // Calc the max with of all columns
+ internal int CalcAllColumnsWidth ()
+ {
+ int width = 0;
+ int cnt = grid.CurrentTableStyle.GridColumnStyles.Count;
+
+ for (int col = 0; col < cnt; col++) {
+ width += grid.CurrentTableStyle.GridColumnStyles[col].Width;
+ }
+
+ return width;
+ }
+
+ // Gets a column from a pixel
+ public int FromPixelToColumn (int pixel)
+ {
+ int width = 0;
+ int cnt = grid.CurrentTableStyle.GridColumnStyles.Count;
+
+ if (cnt == 0)
+ return 0;
+
+ if (grid.CurrentTableStyle.CurrentRowHeadersVisible)
+ width += rowshdrs_area.X + rowshdrs_area.Width;
+
+ for (int col = 0; col < cnt; col++) {
+ width += grid.CurrentTableStyle.GridColumnStyles[col].Width;
+
+ if (pixel < width)
+ return col;
+ }
+
+ return cnt - 1;
+ }
+
+ //
+ public int GetColumnStartingPixel (int my_col)
+ {
+ int width = 0;
+ int cnt = grid.CurrentTableStyle.GridColumnStyles.Count;
+
+ for (int col = 0; col < cnt; col++) {
+
+ if (my_col == col)
+ return width;
+
+ width += grid.CurrentTableStyle.GridColumnStyles[col].Width;
+ }
+
+ return 0;
+ }
+
+ // Which column has to be the first visible column to ensure a column visibility
+ public int GetFirstColumnForColumnVisilibility (int current_first_visiblecolumn, int column)
+ {
+ int new_col = column;
+ int width = 0;
+
+ if (column > current_first_visiblecolumn) { // Going forward
+ for (new_col = column; new_col >= 0; new_col--){
+ width += grid.CurrentTableStyle.GridColumnStyles[new_col].Width;
+
+ if (width >= cells_area.Width)
+ return new_col + 1;
+ //return new_col < grid.CurrentTableStyle.GridColumnStyles.Count ? new_col + 1 : grid.CurrentTableStyle.GridColumnStyles.Count;
+ }
+ return 0;
+ } else {
+ return column;
+ }
+ }
+
+ public void CalcGridAreas ()
+ {
+ if (grid.IsHandleCreated == false) // Delay calculations until the handle is created
+ return;
+
+ /* Order is important. E.g. row headers max. height depends on caption */
+ grid.horz_pixeloffset = 0;
+ CalcCaption ();
+ CalcParentRows ();
+ CalcRowsHeaders ();
+ CalcColumnsHeader ();
+ CalcCellsArea ();
+
+ UpdateVisibleRowCount (); // need it to be able to calcultate the need of horz scrollbar
+ if (SetUpVerticalScrollBar ()) { // We need a Vertical ScrollBar
+
+ if (grid.ShowParentRowsVisible) {
+ parent_rows.Width -= grid.vert_scrollbar.Width;
+ }
+
+ if (grid.columnheaders_visible) {
+ if (columnshdrs_area.X + columnshdrs_area.Width > grid.vert_scrollbar.Location.X) {
+ columnshdrs_area.Width -= grid.vert_scrollbar.Width;
+ }
+ }
+
+ if (cells_area.X + cells_area.Width >= grid.vert_scrollbar.Location.X) {
+ cells_area.Width -= grid.vert_scrollbar.Width;
+ }
+ }
+
+ if (SetUpHorizontalScrollBar ()) { // We need a Horizontal ScrollBar
+ cells_area.Height -= grid.horiz_scrollbar.Height;
+
+ if (rowshdrs_area.Y + rowshdrs_area.Height > grid.ClientRectangle.Y + grid.ClientRectangle.Height) {
+ rowshdrs_area.Height -= grid.horiz_scrollbar.Height;
+ rowshdrs_maxheight -= grid.horiz_scrollbar.Height;
+ }
+ }
+
+ // Reajust scrollbars to avoid overlapping at the corners
+ if (grid.vert_scrollbar.Visible && grid.horiz_scrollbar.Visible) {
+ grid.horiz_scrollbar.Width -= grid.vert_scrollbar.Width;
+ grid.vert_scrollbar.Height -= grid.horiz_scrollbar.Height;
+ }
+
+ UpdateVisibleColumn ();
+ UpdateVisibleRowCount ();
+
+ //Console.WriteLine ("DataGridDrawing.CalcGridAreas cells:{0}", cells_area);
+ }
+
+ public void CalcCaption ()
+ {
+ if (grid.caption_visible == false) {
+ caption_area = Rectangle.Empty;
+ return;
+ }
+
+ caption_area.X = grid.ClientRectangle.X;
+ caption_area.Y = grid.ClientRectangle.Y;
+ caption_area.Width = grid.ClientRectangle.Width;
+ caption_area.Height = grid.CaptionFont.Height + 6;
+
+ //Console.WriteLine ("DataGridDrawing.CalcCaption {0}", caption_area);
+ }
+
+ public void CalcCellsArea ()
+ {
+ if (grid.caption_visible) {
+ cells_area.Y = caption_area.Y + caption_area.Height;
+ } else {
+ cells_area.Y = grid.ClientRectangle.Y;
+ }
+
+ if (grid.ShowParentRowsVisible) {
+ cells_area.Y += parent_rows.Height;
+ }
+
+ if (grid.columnheaders_visible) {
+ cells_area.Y += columnshdrs_area.Height;
+ }
+
+ cells_area.X = grid.ClientRectangle.X + rowshdrs_area.Width;
+ cells_area.Width = grid.ClientRectangle.X + grid.ClientRectangle.Width - cells_area.X;
+ cells_area.Height = grid.ClientRectangle.Y + grid.ClientRectangle.Height - cells_area.Y;
+
+ //Console.WriteLine ("DataGridDrawing.CalcCellsArea {0}", cells_area);
+ }
+
+ public void CalcColumnsHeader ()
+ {
+ int width_all_cols, max_width_cols;
+
+ if (grid.columnheaders_visible == false) {
+ columnshdrs_area = Rectangle.Empty;
+ return;
+ }
+
+ if (grid.caption_visible) {
+ columnshdrs_area.Y = caption_area.Y + caption_area.Height;
+ } else {
+ columnshdrs_area.Y = grid.ClientRectangle.Y;
+ }
+
+ if (grid.ShowParentRowsVisible) {
+ columnshdrs_area.Y += parent_rows.Height;
+ }
+
+ columnshdrs_area.X = grid.ClientRectangle.X;
+ columnshdrs_area.Height = ColumnsHeaderHeight;
+ width_all_cols = CalcAllColumnsWidth ();
+
+ // TODO: take into account Scrollbars
+ columnshdrs_maxwidth = grid.ClientRectangle.X + grid.ClientRectangle.Width - columnshdrs_area.X;
+ max_width_cols = columnshdrs_maxwidth;
+
+ if (grid.CurrentTableStyle.CurrentRowHeadersVisible) {
+ max_width_cols -= grid.RowHeaderWidth;
+ }
+
+ if (width_all_cols > max_width_cols) {
+ columnshdrs_area.Width = columnshdrs_maxwidth;
+ } else {
+ columnshdrs_area.Width = width_all_cols;
+
+ if (grid.CurrentTableStyle.CurrentRowHeadersVisible) {
+ columnshdrs_area.Width += grid.RowHeaderWidth;
+ }
+ }
+
+ //Console.WriteLine ("DataGridDrawing.CalcColumnsHeader {0}", columnshdrs_area);
+ }
+
+ public void CalcParentRows ()
+ {
+ if (grid.ShowParentRowsVisible == false) {
+ parent_rows = Rectangle.Empty;
+ return;
+ }
+
+ if (grid.caption_visible) {
+ parent_rows.Y = caption_area.Y + caption_area.Height;
+
+ } else {
+ parent_rows.Y = grid.ClientRectangle.Y;
+ }
+
+ parent_rows.X = grid.ClientRectangle.X;
+ parent_rows.Width = grid.ClientRectangle.Width;
+ parent_rows.Height = grid.CaptionFont.Height + 3;
+
+ //Console.WriteLine ("DataGridDrawing.CalcParentRows {0}", parent_rows);
+ }
+
+ public void CalcRowsHeaders ()
+ {
+ if (grid.CurrentTableStyle.CurrentRowHeadersVisible == false) {
+ rowshdrs_area = Rectangle.Empty;
+ return;
+ }
+
+ if (grid.caption_visible) {
+ rowshdrs_area.Y = caption_area.Y + caption_area.Height;
+ } else {
+ rowshdrs_area.Y = grid.ClientRectangle.Y;
+ }
+
+ if (grid.ShowParentRowsVisible) {
+ rowshdrs_area.Y += parent_rows.Height;
+ }
+
+ if (grid.columnheaders_visible) { // first block is painted by ColumnHeader
+ rowshdrs_area.Y += ColumnsHeaderHeight;
+ }
+
+ rowshdrs_area.X = grid.ClientRectangle.X;
+ rowshdrs_area.Width = grid.RowHeaderWidth;
+ rowshdrs_area.Height = grid.visiblerow_count * grid.RowHeight;
+ rowshdrs_maxheight = grid.ClientRectangle.Height + grid.ClientRectangle.Y - rowshdrs_area.Y;
+
+ //Console.WriteLine ("DataGridDrawing.CalcRowsHeaders {0} {1}", rowshdrs_area,
+ // rowshdrs_maxheight);
+ }
+
+ public void UpdateVisibleColumn ()
+ {
+ if (grid.CurrentTableStyle.GridColumnStyles.Count == 0) {
+ grid.visiblecolumn_count = 0;
+ return;
+ }
+
+ int col;
+ int max_pixel = grid.horz_pixeloffset + cells_area.Width;
+ grid.first_visiblecolumn = FromPixelToColumn (grid.horz_pixeloffset);
+
+ col = FromPixelToColumn (max_pixel);
+
+ grid.visiblecolumn_count = 1 + col - grid.first_visiblecolumn;
+
+ if (grid.first_visiblecolumn + grid.visiblecolumn_count + 1 < grid.CurrentTableStyle.GridColumnStyles.Count) {
+ grid.visiblecolumn_count++; // Partially visible column
+ }
+ }
+
+ public void UpdateVisibleRowCount ()
+ {
+ int max_height = cells_area.Height;
+ int total_rows = grid.RowsCount;
+
+ if (grid.ShowEditRow) {
+ total_rows++;
+ }
+
+ int rows_height = (total_rows - grid.first_visiblerow) * grid.RowHeight;
+ int max_rows = max_height / grid.RowHeight;
+
+ //Console.WriteLine ("UpdateVisibleRowCount {0} {1}/{2} (row h) {3}",
+ // max_rows, max_height, grid.RowHeight, cells_area.Height);
+
+ if (max_rows > total_rows) {
+ max_rows = total_rows;
+ }
+
+ if (rows_height > cells_area.Height) {
+ grid.visiblerow_count = max_rows;
+ } else {
+ grid.visiblerow_count = total_rows;
+ }
+
+ CalcRowsHeaders (); // Height depends on num of visible rows
+
+ if (grid.visiblerow_count + grid.first_visiblerow > total_rows)
+ grid.visiblerow_count = total_rows - grid.first_visiblerow;
+
+ if (grid.visiblerow_count < max_rows) {
+ grid.visiblerow_count = max_rows;
+ grid.first_visiblerow = total_rows - max_rows;
+ grid.Invalidate ();
+ }
+
+ }
+
+ // From Point to Cell
+ public DataGrid.HitTestInfo HitTest (int x, int y)
+ {
+ DataGrid.HitTestInfo hit = new DataGrid.HitTestInfo ();
+
+ // TODO: Add missing ColumnResize and RowResize checks
+ if (columnshdrs_area.Contains (x, y)) {
+ hit.type = DataGrid.HitTestType.ColumnHeader;
+ hit.column = FromPixelToColumn (x + grid.horz_pixeloffset);
+ return hit;
+ }
+
+ if (rowshdrs_area.Contains (x, y)) {
+ hit.type = DataGrid.HitTestType.RowHeader;
+ int posy;
+ int rcnt = grid.FirstVisibleRow + grid.VisibleRowCount;
+ for (int r = grid.FirstVisibleRow; r < rcnt; r++) {
+ posy = cells_area.Y + ((r - grid.FirstVisibleRow) * grid.RowHeight);
+ if (y <= posy + grid.RowHeight) { // Found row
+ hit.row = r;
+ break;
+ }
+ }
+ return hit;
+ }
+
+ if (caption_area.Contains (x, y)) {
+ hit.type = DataGrid.HitTestType.Caption;
+ return hit;
+ }
+
+ if (parent_rows.Contains (x, y)) {
+ hit.type = DataGrid.HitTestType.ParentRows;
+ return hit;
+ }
+
+ int pos_y, pos_x, width;
+ int rowcnt = grid.FirstVisibleRow + grid.VisibleRowCount;
+ for (int row = grid.FirstVisibleRow; row < rowcnt; row++) {
+ pos_y = cells_area.Y + ((row - grid.FirstVisibleRow) * grid.RowHeight);
+
+ if (y <= pos_y + grid.RowHeight) { // Found row
+ hit.row = row;
+ hit.type = DataGrid.HitTestType.Cell;
+ int col_pixel;
+ int column_cnt = grid.first_visiblecolumn + grid.visiblecolumn_count;
+ for (int column = grid.first_visiblecolumn; column < column_cnt; column++) {
+
+ col_pixel = GetColumnStartingPixel (column);
+ pos_x = cells_area.X + col_pixel - grid.horz_pixeloffset;
+ width = grid.CurrentTableStyle.GridColumnStyles[column].Width;
+
+ if (x <= pos_x + width) { // Column found
+ hit.column = column;
+ break;
+ }
+ }
+
+ break;
+ }
+ }
+
+ return hit;
+ }
+
+ public Rectangle GetCellBounds (int row, int col)
+ {
+ Rectangle bounds = new Rectangle ();
+ int col_pixel;
+
+ bounds.Width = grid.CurrentTableStyle.GridColumnStyles[col].Width;
+ bounds.Height = grid.RowHeight;
+ bounds.Y = cells_area.Y + ((row - grid.FirstVisibleRow) * grid.RowHeight);
+ col_pixel = GetColumnStartingPixel (col);
+ bounds.X = cells_area.X + col_pixel - grid.horz_pixeloffset;
+ return bounds;
+ }
+
+ public void InvalidateCaption ()
+ {
+ if (caption_area.IsEmpty)
+ return;
+
+ grid.Invalidate (caption_area);
+ }
+
+
+ public void InvalidateRow (int row)
+ {
+ if (row < grid.FirstVisibleRow || row > grid.FirstVisibleRow + grid.VisibleRowCount) {
+ return;
+ }
+
+ Rectangle rect_row = new Rectangle ();
+
+ rect_row.X = cells_area.X;
+ rect_row.Width = cells_area.Width;
+ rect_row.Height = grid.RowHeight;
+ rect_row.Y = cells_area.Y + ((row - grid.FirstVisibleRow) * grid.RowHeight);
+ grid.Invalidate (rect_row);
+ }
+
+ public void InvalidateRowHeader (int row)
+ {
+ Rectangle rect_rowhdr = new Rectangle ();
+ rect_rowhdr.X = rowshdrs_area.X;
+ rect_rowhdr.Width = rowshdrs_area.Width;
+ rect_rowhdr.Height = grid.RowHeight;
+ rect_rowhdr.Y = rowshdrs_area.Y + ((row - grid.FirstVisibleRow) * grid.RowHeight);
+ grid.Invalidate (rect_rowhdr);
+ }
+
+ public void InvalidateColumn (DataGridColumnStyle column)
+ {
+ Rectangle rect_col = new Rectangle ();
+ int col_pixel;
+ int col = -1;
+
+ col = grid.CurrentTableStyle.GridColumnStyles.IndexOf (column);
+
+ if (col == -1) {
+ return;
+ }
+
+ rect_col.Width = column.Width;
+ col_pixel = GetColumnStartingPixel (col);
+ rect_col.X = cells_area.X + col_pixel - grid.horz_pixeloffset;
+ rect_col.Y = cells_area.Y;
+ rect_col.Height = cells_area.Height;
+ grid.Invalidate (rect_col);
+ }
+
+ // Return true if the scrollbar is needed
+ public bool SetUpHorizontalScrollBar ()
+ {
+ int width_all = CalcAllColumnsWidth ();
+
+ if (width_all <= cells_area.Width) {
+ grid.horiz_scrollbar.Visible = false;
+ grid.Controls.Remove (grid.horiz_scrollbar);
+ return false;
+ }
+
+ grid.horiz_scrollbar.Location = new Point (grid.ClientRectangle.X, grid.ClientRectangle.Y +
+ grid.ClientRectangle.Height - grid.horiz_scrollbar.Height);
+
+ grid.horiz_scrollbar.Size = new Size (grid.ClientRectangle.Width,
+ grid.horiz_scrollbar.Height);
+
+ grid.horiz_scrollbar.Maximum = width_all;// - cells_area.Width;
+ grid.horiz_scrollbar.LargeChange = cells_area.Width;
+ grid.Controls.Add (grid.horiz_scrollbar);
+ grid.horiz_scrollbar.Visible = true;
+ return true;
+ }
+
+ // Return true if the scrollbar is needed
+ public bool SetUpVerticalScrollBar ()
+ {
+ int y, height;
+ int allrows = grid.RowsCount;
+
+ if (grid.ShowEditRow) {
+ allrows++;
+ }
+
+ if (grid.visiblerow_count == allrows) {
+ grid.vert_scrollbar.Visible = false;
+ grid.Controls.Remove (grid.vert_scrollbar);
+ return false;
+ }
+
+ if (grid.caption_visible) {
+ y = grid.ClientRectangle.Y + caption_area.Height;
+ height = grid.ClientRectangle.Height - caption_area.Height;
+ } else {
+ y = grid.ClientRectangle.Y;
+ height = grid.ClientRectangle.Height;
+ }
+
+ grid.vert_scrollbar.Location = new Point (grid.ClientRectangle.X +
+ grid.ClientRectangle.Width - grid.vert_scrollbar.Width, y);
+
+ grid.vert_scrollbar.Size = new Size (grid.vert_scrollbar.Width,
+ height);
+
+ grid.vert_scrollbar.Maximum = grid.RowsCount;
+
+ if (grid.ShowEditRow) {
+ grid.vert_scrollbar.Maximum++;
+ }
+
+ grid.vert_scrollbar.LargeChange = VLargeChange;
+
+ grid.Controls.Add (grid.vert_scrollbar);
+ grid.vert_scrollbar.Visible = true;
+ return true;
+ }
+
+ #endregion // Public Instance Methods
+
+ #region Instance Properties
+ public Rectangle CellsArea {
+ get {
+ return cells_area;
+ }
+ }
+
+ // Returns the ColumnsHeader area excluding the rectangle shared with RowsHeader
+ public Rectangle ColumnsHeadersArea {
+ get {
+ Rectangle columns_area = columnshdrs_area;
+
+ if (grid.CurrentTableStyle.CurrentRowHeadersVisible) {
+ columns_area.X += grid.RowHeaderWidth;
+ columns_area.Width -= grid.RowHeaderWidth;
+ }
+ return columns_area;
+ }
+ }
+
+ public int ColumnsHeaderHeight {
+ get {
+ return grid.CurrentTableStyle.HeaderFont.Height + 6;
+ }
+ }
+
+ public Rectangle RowsHeadersArea {
+ get {
+ return rowshdrs_area;
+ }
+ }
+
+ public int VLargeChange {
+ get {
+ return cells_area.Height / grid.RowHeight;
+ }
+ }
+
+ #endregion Instance Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridLineStyle.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridLineStyle.cs
new file mode 100644
index 00000000000..64c554a6882
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridLineStyle.cs
@@ -0,0 +1,33 @@
+// 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 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public enum DataGridLineStyle {
+ None = 0,
+ Solid = 1
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridParentRowsLabelStyle.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridParentRowsLabelStyle.cs
new file mode 100644
index 00000000000..1cbab2626de
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridParentRowsLabelStyle.cs
@@ -0,0 +1,35 @@
+// 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 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public enum DataGridParentRowsLabelStyle {
+ None = 0,
+ TableName = 1,
+ ColumnName = 2,
+ Both = 3
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridPreferredColumnWidthTypeConverter.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridPreferredColumnWidthTypeConverter.cs
new file mode 100644
index 00000000000..f5b31089298
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridPreferredColumnWidthTypeConverter.cs
@@ -0,0 +1,69 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+using System;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+ public class DataGridPreferredColumnWidthTypeConverter : TypeConverter {
+ #region Public Constructors
+ public DataGridPreferredColumnWidthTypeConverter() {
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Methods
+ public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) {
+ if ((sourceType == typeof(string)) || (sourceType == typeof(int))) {
+ return true;
+ }
+ return base.CanConvertFrom (context, sourceType);
+ }
+
+ public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) {
+ if (value is string) {
+ if (((string)value).Equals("AutoColumnResize (-1)")) {
+ return -1;
+ }
+
+ return Int32.Parse((string)value);
+ }
+ return base.ConvertFrom (context, culture, value);
+ }
+
+ public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) {
+ if (destinationType == typeof(String)) {
+ if ((int)value == -1) {
+ return "AutoColumnResize (-1)";
+ }
+
+ }
+ return base.ConvertTo (context, culture, value, destinationType);
+ }
+ #endregion // Public Instance Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridTableStyle.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridTableStyle.cs
new file mode 100644
index 00000000000..0adef2569a5
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridTableStyle.cs
@@ -0,0 +1,937 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+//
+// Peter Bartok <pbartok@novell.com>
+// Jordi Mas i Hernandez <jordi@ximian.com>
+//
+//
+// NOT COMPLETE
+//
+
+using System.ComponentModel;
+using System.Drawing;
+using System.Runtime.InteropServices;
+using System.Data;
+using System.Xml;
+using System.Runtime.Serialization;
+
+namespace System.Windows.Forms
+{
+ [DesignTimeVisible(false)]
+ [ToolboxItem(false)]
+ public class DataGridTableStyle : Component, IDataGridEditingService
+ {
+ public static DataGridTableStyle DefaultTableStyle = new DataGridTableStyle (true);
+
+ #region Local Variables
+ private static readonly Color def_alternating_backcolor = SystemColors.Window;
+ private static readonly Color def_backcolor = SystemColors.Window;
+ private static readonly Color def_forecolor = SystemColors.WindowText;
+ private static readonly Color def_gridline_color = SystemColors.Control;
+ private static readonly Color def_header_backcolor = SystemColors.Control;
+ private static readonly Font def_header_font = null;
+ private static readonly Color def_header_forecolor = SystemColors.ControlText;
+ private static readonly Color def_link_color = SystemColors.HotTrack;
+ private static readonly Color def_link_hovercolor = SystemColors.HotTrack;
+ private static readonly Color def_selection_backcolor = SystemColors.ActiveCaption;
+ private static readonly Color def_selection_forecolor = SystemColors.ActiveCaptionText;
+
+ private bool allow_sorting;
+ private DataGrid datagrid;
+ private Color header_forecolor;
+ private string mapping_name;
+ private Color alternating_backcolor;
+ private bool columnheaders_visible;
+ private GridColumnStylesCollection column_styles;
+ private Color gridline_color;
+ private DataGridLineStyle gridline_style;
+ private Color header_backcolor;
+ private Font header_font;
+ private Color link_color;
+ private Color link_hovercolor;
+ private int preferredcolumn_width;
+ private int preferredrow_height;
+ private bool _readonly;
+ private bool rowheaders_visible;
+ private Color selection_backcolor;
+ private Color selection_forecolor;
+ private int rowheaders_width;
+ private Color backcolor;
+ private Color forecolor;
+ private bool is_default;
+ CurrencyManager manager;
+ #endregion // Local Variables
+
+ #region Constructors
+ public DataGridTableStyle ()
+ {
+ CommonConstructor ();
+ is_default = false;
+ }
+
+ public DataGridTableStyle (bool isDefaultTableStyle)
+ {
+ CommonConstructor ();
+ is_default = isDefaultTableStyle;
+ }
+
+ // TODO: What to do with the CurrencyManager
+ public DataGridTableStyle (CurrencyManager listManager)
+ {
+ CommonConstructor ();
+ is_default = false;
+ manager = listManager;
+ }
+
+ private void CommonConstructor ()
+ {
+ allow_sorting = true;
+ datagrid = null;
+ header_forecolor = def_header_forecolor;
+ mapping_name = string.Empty;
+ column_styles = new GridColumnStylesCollection (this);
+
+ alternating_backcolor = def_alternating_backcolor;
+ columnheaders_visible = true;
+ gridline_color = def_gridline_color;
+ gridline_style = DataGridLineStyle.Solid;
+ header_backcolor = def_header_backcolor;
+ header_font = def_header_font;
+ link_color = def_link_color;
+ link_hovercolor = def_link_hovercolor;
+ preferredcolumn_width = ThemeEngine.Current.DataGridPreferredColumnWidth;
+ preferredrow_height = ThemeEngine.Current.DefaultFont.Height + 3;
+ _readonly = false;
+ rowheaders_visible = true;
+ selection_backcolor = def_selection_backcolor;
+ selection_forecolor = def_selection_forecolor;
+ rowheaders_width = 35;
+ backcolor = def_backcolor;
+ forecolor = def_forecolor;
+ }
+ #endregion
+
+ #region Public Instance Properties
+ [DefaultValue(true)]
+ public bool AllowSorting {
+ get {
+ return allow_sorting;
+ }
+
+ set {
+ if (allow_sorting != value) {
+ allow_sorting = value;
+ OnAllowSortingChanged (EventArgs.Empty);
+
+ if (datagrid != null) {
+ datagrid.Refresh ();
+ }
+ }
+ }
+ }
+
+ public Color AlternatingBackColor {
+ get {
+ return alternating_backcolor;
+ }
+
+ set {
+ if (alternating_backcolor != value) {
+ alternating_backcolor = value;
+ OnAlternatingBackColorChanged (EventArgs.Empty);
+
+ if (datagrid != null) {
+ datagrid.Refresh ();
+ }
+ }
+ }
+ }
+
+ public Color BackColor {
+ get {
+ return backcolor;
+ }
+
+ set {
+ if (backcolor != value) {
+ backcolor = value;
+ OnBackColorChanged (EventArgs.Empty);
+
+ if (datagrid != null) {
+ datagrid.Refresh ();
+ }
+ }
+ }
+ }
+
+ [DefaultValue(true)]
+ public bool ColumnHeadersVisible {
+ get {
+ return columnheaders_visible;
+ }
+
+ set {
+ if (columnheaders_visible != value) {
+ columnheaders_visible = value;
+ OnColumnHeadersVisibleChanged (EventArgs.Empty);
+
+ if (datagrid != null) {
+ datagrid.Refresh ();
+ }
+ }
+ }
+ }
+
+ [Browsable(false)]
+ public virtual DataGrid DataGrid {
+ get {
+ return datagrid;
+ }
+
+ set {
+ if (datagrid != value) {
+ datagrid = value;
+ }
+ }
+ }
+
+ public Color ForeColor {
+ get {
+ return forecolor;
+ }
+
+ set {
+ if (forecolor != value) {
+ forecolor = value;
+ OnForeColorChanged (EventArgs.Empty);
+
+ if (datagrid != null) {
+ datagrid.Refresh ();
+ }
+ }
+ }
+ }
+
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
+ [Localizable(true)]
+ public virtual GridColumnStylesCollection GridColumnStyles {
+ get { return column_styles; }
+ }
+
+ public Color GridLineColor {
+ get {
+ return gridline_color;
+ }
+
+ set {
+ if (gridline_color != value) {
+ gridline_color = value;
+ OnGridLineColorChanged (EventArgs.Empty);
+
+ if (datagrid != null) {
+ datagrid.Refresh ();
+ }
+ }
+ }
+ }
+
+ [DefaultValue(DataGridLineStyle.Solid)]
+ public DataGridLineStyle GridLineStyle {
+ get {
+ return gridline_style;
+ }
+
+ set {
+ if (gridline_style != value) {
+ gridline_style = value;
+ OnGridLineStyleChanged (EventArgs.Empty);
+
+ if (datagrid != null) {
+ datagrid.Refresh ();
+ }
+ }
+ }
+ }
+
+ public Color HeaderBackColor {
+ get {
+ return header_backcolor;
+ }
+
+ set {
+ if (value == Color.Empty) {
+ throw new ArgumentNullException ("Color.Empty value is invalid.");
+ }
+
+ if (header_backcolor != value) {
+ header_backcolor = value;
+ OnHeaderBackColorChanged (EventArgs.Empty);
+
+ if (datagrid != null) {
+ datagrid.Refresh ();
+ }
+ }
+ }
+ }
+
+ [AmbientValue(null)]
+ [Localizable(true)]
+ public Font HeaderFont {
+ get {
+ if (header_font != null)
+ return header_font;
+
+ if (datagrid != null)
+ return datagrid.HeaderFont;
+
+ return ThemeEngine.Current.DefaultFont;
+ }
+
+ set {
+ if (header_font != value) {
+ header_font = value;
+ OnHeaderFontChanged (EventArgs.Empty);
+
+ if (datagrid != null) {
+ datagrid.Refresh ();
+ }
+ }
+ }
+ }
+
+ public Color HeaderForeColor {
+ get {
+ return header_forecolor;
+ }
+
+ set {
+
+ if (header_forecolor != value) {
+ header_forecolor = value;
+
+ if (datagrid != null) {
+ datagrid.Refresh ();
+ }
+
+ OnHeaderForeColorChanged (EventArgs.Empty);
+ }
+ }
+ }
+
+ public Color LinkColor {
+ get {
+ return link_color;
+ }
+
+ set {
+ if (link_color != value) {
+ link_color = value;
+
+ if (datagrid != null) {
+ datagrid.Refresh ();
+ }
+
+ OnLinkColorChanged (EventArgs.Empty);
+ }
+ }
+ }
+
+ [ComVisible(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [Browsable(false)]
+ public Color LinkHoverColor {
+ get {
+ return link_hovercolor;
+ }
+
+ set {
+ if (link_hovercolor != value) {
+ link_hovercolor = value;
+ OnLinkHoverColorChanged (EventArgs.Empty);
+ }
+ }
+ }
+
+ [Editor("System.Windows.Forms.Design.DataGridTableStyleMappingNameEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
+ public string MappingName {
+ get {
+ return mapping_name;
+ }
+
+ set {
+ if (mapping_name != value) {
+ mapping_name = value;
+ OnMappingNameChanged (EventArgs.Empty);
+ }
+ }
+ }
+
+ [DefaultValue(75)]
+ [TypeConverter(typeof(DataGridPreferredColumnWidthTypeConverter))]
+ [Localizable(true)]
+ public int PreferredColumnWidth {
+ get {
+ return preferredcolumn_width;
+ }
+
+ set {
+ if (value < 0) {
+ throw new ArgumentException ("PreferredColumnWidth is less than 0");
+ }
+
+ if (preferredcolumn_width != value) {
+ preferredcolumn_width = value;
+ OnPreferredColumnWidthChanged (EventArgs.Empty);
+ }
+ }
+ }
+
+ [Localizable(true)]
+ public int PreferredRowHeight {
+ get {
+ return preferredrow_height;
+ }
+
+ set {
+ if (preferredrow_height != value) {
+ preferredrow_height = value;
+ OnPreferredRowHeightChanged (EventArgs.Empty);
+ }
+ }
+ }
+
+ [DefaultValue(false)]
+ public virtual bool ReadOnly {
+ get {
+ return _readonly;
+ }
+
+ set {
+ if (_readonly != value) {
+ _readonly = value;
+ OnReadOnlyChanged (EventArgs.Empty);
+ }
+ }
+ }
+
+ [DefaultValue(true)]
+ public bool RowHeadersVisible {
+ get {
+ return rowheaders_visible;
+ }
+
+ set {
+ if (rowheaders_visible != value) {
+ rowheaders_visible = value;
+ OnRowHeadersVisibleChanged (EventArgs.Empty);
+ }
+ }
+ }
+
+ [DefaultValue(35)]
+ [Localizable(true)]
+ public int RowHeaderWidth {
+ get {
+ return rowheaders_width;
+ }
+
+ set {
+ if (rowheaders_width != value) {
+ rowheaders_width = value;
+ OnRowHeaderWidthChanged (EventArgs.Empty);
+ }
+ }
+ }
+
+ public Color SelectionBackColor {
+ get {
+ return selection_backcolor;
+ }
+
+ set {
+ if (selection_backcolor != value) {
+ selection_backcolor = value;
+ OnSelectionBackColorChanged (EventArgs.Empty);
+ }
+ }
+ }
+
+ [Description("The foreground color for the current data grid row")]
+ public Color SelectionForeColor {
+ get {
+ return selection_forecolor;
+ }
+
+ set {
+ if (selection_forecolor != value) {
+ selection_forecolor = value;
+ OnSelectionForeColorChanged (EventArgs.Empty);
+ }
+ }
+ }
+
+ #endregion // Public Instance Properties
+
+ #region Private Instance Properties
+ internal DataGridLineStyle CurrentGridLineStyle {
+ get {
+ if (is_default && datagrid != null) {
+ return datagrid.GridLineStyle;
+ }
+
+ return gridline_style;
+ }
+ }
+
+ internal Color CurrentGridLineColor {
+ get {
+ if (is_default && datagrid != null) {
+ return datagrid.GridLineColor;
+ }
+
+ return gridline_color;
+ }
+ }
+
+ internal Color CurrentHeaderBackColor {
+ get {
+ if (is_default && datagrid != null) {
+ return datagrid.HeaderBackColor;
+ }
+
+ return header_backcolor;
+ }
+ }
+
+ internal Color CurrentHeaderForeColor {
+ get {
+ if (is_default && datagrid != null) {
+ return datagrid.HeaderForeColor;
+ }
+
+ return header_forecolor;
+ }
+ }
+
+ internal int CurrentPreferredColumnWidth {
+ get {
+ if (is_default && datagrid != null) {
+ return datagrid.PreferredColumnWidth;
+ }
+
+ return preferredcolumn_width;
+ }
+ }
+
+ internal int CurrentPreferredRowHeight {
+ get {
+ if (is_default && datagrid != null) {
+ return datagrid.PreferredRowHeight;
+ }
+
+ return preferredrow_height;
+ }
+ }
+
+ internal bool CurrentRowHeadersVisible {
+ get {
+ if (is_default && datagrid != null) {
+ return datagrid.RowHeadersVisible;
+ }
+
+ return rowheaders_visible;
+ }
+ }
+
+
+ #endregion Private Instance Properties
+
+ #region Public Instance Methods
+
+ [MonoTODO]
+ public virtual bool BeginEdit (DataGridColumnStyle gridColumn, int rowNumber)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected internal virtual DataGridColumnStyle CreateGridColumn (PropertyDescriptor prop)
+ {
+ return CreateGridColumn (prop, false);
+ }
+
+ protected internal virtual DataGridColumnStyle CreateGridColumn (PropertyDescriptor prop, bool isDefault)
+ {
+ if (DataGridBoolColumn.CanRenderType (prop.PropertyType)) {
+ return new DataGridBoolColumn (prop, isDefault);
+ }
+
+ if (DataGridTextBoxColumn.CanRenderType (prop.PropertyType)) {
+
+ // At least to special cases with formats
+ if (prop.PropertyType.Equals (typeof (DateTime))) {
+ return new DataGridTextBoxColumn (prop, "d", isDefault);
+ }
+
+ if (prop.PropertyType.Equals (typeof (Int32)) ||
+ prop.PropertyType.Equals (typeof (Int16))) {
+ return new DataGridTextBoxColumn (prop, "G", isDefault);
+ }
+
+ return new DataGridTextBoxColumn (prop, isDefault);
+ }
+
+ throw new NotImplementedException ();
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ base.Dispose (disposing);
+ }
+
+ [MonoTODO]
+ public virtual bool EndEdit ( DataGridColumnStyle gridColumn, int rowNumber, bool shouldAbort)
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected virtual void OnAllowSortingChanged (EventArgs e)
+ {
+ if (AllowSortingChanged != null) {
+ AllowSortingChanged (this, e);
+ }
+ }
+
+ protected virtual void OnAlternatingBackColorChanged (EventArgs e)
+ {
+ if (AlternatingBackColorChanged != null) {
+ AlternatingBackColorChanged (this, e);
+ }
+ }
+
+ protected virtual void OnBackColorChanged (EventArgs e)
+ {
+ if (BackColorChanged != null) {
+ BackColorChanged (this, e);
+ }
+ }
+
+ protected virtual void OnColumnHeadersVisibleChanged (EventArgs e)
+ {
+ if (ColumnHeadersVisibleChanged != null) {
+ ColumnHeadersVisibleChanged (this, e);
+ }
+ }
+
+ protected virtual void OnForeColorChanged (EventArgs e)
+ {
+ if (ForeColorChanged != null) {
+ ForeColorChanged (this, e);
+ }
+ }
+
+ protected virtual void OnGridLineColorChanged (EventArgs e)
+ {
+ if (GridLineColorChanged != null) {
+ GridLineColorChanged (this, e);
+ }
+ }
+
+ protected virtual void OnGridLineStyleChanged (EventArgs e)
+ {
+ if (GridLineStyleChanged != null) {
+ GridLineStyleChanged (this, e);
+ }
+ }
+
+ protected virtual void OnHeaderBackColorChanged (EventArgs e)
+ {
+ if (HeaderBackColorChanged != null) {
+ HeaderBackColorChanged (this, e);
+ }
+ }
+
+ protected virtual void OnHeaderFontChanged (EventArgs e)
+ {
+ if (HeaderFontChanged != null) {
+ HeaderFontChanged (this, e);
+ }
+ }
+
+ protected virtual void OnHeaderForeColorChanged (EventArgs e)
+ {
+ if (HeaderForeColorChanged != null) {
+ HeaderForeColorChanged (this, e);
+ }
+ }
+
+ protected virtual void OnLinkColorChanged (EventArgs e)
+ {
+ if (LinkColorChanged != null) {
+ LinkColorChanged (this, e);
+ }
+ }
+
+ protected virtual void OnLinkHoverColorChanged (EventArgs e)
+ {
+ if (LinkHoverColorChanged != null) {
+ LinkHoverColorChanged (this, e);
+ }
+ }
+
+ protected virtual void OnMappingNameChanged (EventArgs e)
+ {
+ if (MappingNameChanged != null) {
+ MappingNameChanged(this, e);
+ }
+ }
+
+ protected virtual void OnPreferredColumnWidthChanged (EventArgs e)
+ {
+ if (PreferredColumnWidthChanged != null) {
+ PreferredColumnWidthChanged (this, e);
+ }
+ }
+
+ protected virtual void OnPreferredRowHeightChanged (EventArgs e)
+ {
+ if (PreferredRowHeightChanged != null) {
+ PreferredRowHeightChanged (this, e);
+ }
+ }
+
+ protected virtual void OnReadOnlyChanged (EventArgs e)
+ {
+ if (ReadOnlyChanged != null) {
+ ReadOnlyChanged (this, e);
+ }
+ }
+
+ protected virtual void OnRowHeadersVisibleChanged (EventArgs e)
+ {
+ if (RowHeadersVisibleChanged != null) {
+ RowHeadersVisibleChanged (this, e);
+ }
+ }
+
+ protected virtual void OnRowHeaderWidthChanged (EventArgs e)
+ {
+ if (RowHeaderWidthChanged != null) {
+ RowHeaderWidthChanged (this, e);
+ }
+ }
+
+ protected virtual void OnSelectionBackColorChanged (EventArgs e)
+ {
+ if (SelectionBackColorChanged != null) {
+ SelectionBackColorChanged (this, e);
+ }
+ }
+
+ protected virtual void OnSelectionForeColorChanged (EventArgs e)
+ {
+ if (SelectionForeColorChanged != null) {
+ SelectionForeColorChanged (this, e);
+ }
+ }
+
+ public void ResetAlternatingBackColor ()
+ {
+ AlternatingBackColor = def_alternating_backcolor;
+ }
+
+ public void ResetBackColor ()
+ {
+ BackColor = def_backcolor;
+ }
+
+ public void ResetForeColor ()
+ {
+ ForeColor = def_forecolor;
+ }
+
+ public void ResetGridLineColor ()
+ {
+ GridLineColor = def_gridline_color;
+ }
+
+ public void ResetHeaderBackColor ()
+ {
+ HeaderBackColor = def_header_backcolor;
+ }
+
+ public void ResetHeaderFont ()
+ {
+ HeaderFont = def_header_font;
+ }
+
+ public void ResetHeaderForeColor ()
+ {
+ HeaderForeColor = def_header_forecolor;
+ }
+
+ public void ResetLinkColor ()
+ {
+ LinkColor = def_link_color;
+ }
+
+ public void ResetLinkHoverColor ()
+ {
+ LinkHoverColor = def_link_hovercolor;
+ }
+
+ public void ResetSelectionBackColor ()
+ {
+ SelectionBackColor = def_selection_backcolor;
+ }
+
+ public void ResetSelectionForeColor ()
+ {
+ SelectionForeColor = def_selection_forecolor;
+ }
+
+ protected virtual bool ShouldSerializeAlternatingBackColor ()
+ {
+ return (alternating_backcolor != def_alternating_backcolor);
+ }
+
+ protected bool ShouldSerializeBackColor ()
+ {
+ return (backcolor != def_backcolor);
+ }
+
+ protected bool ShouldSerializeForeColor ()
+ {
+ return (forecolor != def_forecolor);
+ }
+
+ protected virtual bool ShouldSerializeGridLineColor ()
+ {
+ return (gridline_color != def_gridline_color);
+ }
+
+ protected virtual bool ShouldSerializeHeaderBackColor ()
+ {
+ return (header_backcolor != def_header_backcolor);
+ }
+
+ protected virtual bool ShouldSerializeHeaderForeColor ()
+ {
+ return (header_forecolor != def_header_forecolor);
+ }
+
+ protected virtual bool ShouldSerializeLinkColor ()
+ {
+ return (link_color != def_link_color);
+ }
+
+ protected virtual bool ShouldSerializeLinkHoverColor ()
+ {
+ return (link_hovercolor != def_link_hovercolor);
+ }
+
+ protected bool ShouldSerializePreferredRowHeight ()
+ {
+ return (preferredrow_height != datagrid.def_preferredrow_height);
+ }
+
+ protected bool ShouldSerializeSelectionBackColor ()
+ {
+ return (selection_backcolor != def_selection_backcolor);
+ }
+
+ protected virtual bool ShouldSerializeSelectionForeColor ()
+ {
+ return (selection_forecolor != def_selection_forecolor);
+ }
+ #endregion // Protected Instance Methods
+
+ #region Private Instance Properties
+ // Create column styles for this TableStyle
+ internal void CreateColumnsForTable (bool onlyBind)
+ {
+ CurrencyManager mgr = null;
+ mgr = datagrid.ListManager;
+
+ if (mgr == null) {
+ return;
+ }
+
+ PropertyDescriptorCollection propcol = mgr.GetItemProperties ();
+
+ for (int i = 0; i < propcol.Count; i++)
+ {
+ // The column style is already provided by the user
+ if (column_styles[propcol[i].Name] != null) {
+ column_styles[propcol[i].Name].table_style = this;
+ column_styles[propcol[i].Name].SetDataGridInternal (datagrid);
+ continue;
+ }
+
+ if (onlyBind == true) {
+ continue;
+ }
+
+
+ // TODO: What to do with relations?
+ if (propcol[i].ComponentType.ToString () == "System.Data.DataTablePropertyDescriptor") {
+ Console.WriteLine ("CreateColumnsForTable::System.Data.DataTablePropertyDescriptor");
+
+ } else {
+ DataGridColumnStyle st = CreateGridColumn (propcol[i], true);
+ st.grid = datagrid;
+ st.MappingName = propcol[i].Name;
+ st.HeaderText = propcol[i].Name;
+ st.Width = CurrentPreferredColumnWidth;
+ column_styles.Add (st);
+ }
+ }
+
+ }
+
+ #endregion Private Instance Properties
+
+ #region Events
+ public event EventHandler AllowSortingChanged;
+ public event EventHandler AlternatingBackColorChanged;
+ public event EventHandler BackColorChanged;
+ public event EventHandler ColumnHeadersVisibleChanged;
+ public event EventHandler ForeColorChanged;
+ public event EventHandler GridLineColorChanged;
+ public event EventHandler GridLineStyleChanged;
+ public event EventHandler HeaderBackColorChanged;
+ public event EventHandler HeaderFontChanged;
+ public event EventHandler HeaderForeColorChanged;
+ public event EventHandler LinkColorChanged;
+ public event EventHandler LinkHoverColorChanged;
+ public event EventHandler MappingNameChanged;
+ public event EventHandler PreferredColumnWidthChanged;
+ public event EventHandler PreferredRowHeightChanged;
+ public event EventHandler ReadOnlyChanged;
+ public event EventHandler RowHeadersVisibleChanged;
+ public event EventHandler RowHeaderWidthChanged;
+ public event EventHandler SelectionBackColorChanged;
+ public event EventHandler SelectionForeColorChanged;
+ #endregion // Events
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridTextBox.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridTextBox.cs
new file mode 100644
index 00000000000..d7b88104bc5
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridTextBox.cs
@@ -0,0 +1,130 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Jordi Mas i Hernandez <jordi@ximian.com>
+//
+//
+
+// NOT COMPLETE
+
+using System.ComponentModel;
+using System.Drawing;
+using System.Runtime.InteropServices;
+using System.Diagnostics;
+
+namespace System.Windows.Forms
+{
+ [DefaultProperty("GridEditName")]
+ [DesignTimeVisible(false)]
+ [ToolboxItem(false)]
+ public class DataGridTextBox : TextBox
+ {
+
+ #region Local Variables
+ private bool isedit;
+ private DataGrid grid;
+ #endregion // Local Variables
+
+ #region Constructors
+ public DataGridTextBox ()
+ {
+ isedit = true;
+ grid = null;
+
+ SetStyle (ControlStyles.UserPaint | ControlStyles.StandardClick | ControlStyles.StandardDoubleClick, false);
+ SetStyle (ControlStyles.FixedHeight, true);
+ }
+ #endregion
+
+ #region Public Instance Properties
+ public bool IsInEditOrNavigateMode {
+ get {
+ return isedit;
+ }
+ set {
+ if (value != isedit) {
+ isedit = value;
+ }
+ }
+ }
+
+ #endregion // Public Instance Properties
+
+ #region Public Instance Methods
+ protected override void OnKeyPress (KeyPressEventArgs e)
+ {
+ grid.is_changing = true;
+ grid.InvalidateCurrentRowHeader ();
+ base.OnKeyPress (e);
+ }
+
+ protected override void OnMouseWheel (MouseEventArgs e)
+ {
+ base.OnMouseWheel (e);
+ }
+
+ protected internal override bool ProcessKeyMessage (ref Message m)
+ {
+ Keys key = (Keys) m.WParam.ToInt32 ();
+
+ switch (key) {
+ case Keys.Return:
+ grid.EndEdit (false);
+ return true;
+
+ case Keys.Escape:
+ grid.EndEdit (true);
+ return true;
+
+ case Keys.Right:
+ case Keys.Tab:
+ case Keys.Up:
+ case Keys.Down:
+ case Keys.PageUp:
+ case Keys.PageDown:
+ case Keys.Home:
+ case Keys.End:
+ grid.EndEdit (false);
+ break;
+
+ default:
+ break;
+ }
+
+ isedit = false;
+ return base.ProcessKeyMessage (ref m);
+ }
+
+ public void SetDataGrid (DataGrid parentGrid)
+ {
+ grid = parentGrid;
+ }
+
+ protected override void WndProc (ref Message m)
+ {
+ base.WndProc (ref m);
+ }
+
+ #endregion // Public Instance Methods
+
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridTextBoxColumn.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridTextBoxColumn.cs
new file mode 100644
index 00000000000..0ede05c1625
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridTextBoxColumn.cs
@@ -0,0 +1,339 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Jordi Mas i Hernandez <jordi@ximian.com>
+//
+//
+
+// NOT COMPLETE
+
+using System.ComponentModel;
+using System.Drawing;
+using System.Runtime.InteropServices;
+using System.Diagnostics;
+
+namespace System.Windows.Forms
+{
+ public class DataGridTextBoxColumn : DataGridColumnStyle
+ {
+ #region Local Variables
+ private string format;
+ private IFormatProvider format_provider = null;
+ private StringFormat string_format = new StringFormat ();
+ private DataGridTextBox textbox = null;
+ private static readonly int offset_x = 2;
+ private static readonly int offset_y = 2;
+ #endregion // Local Variables
+
+ #region Constructors
+ public DataGridTextBoxColumn ()
+ {
+ format = string.Empty;
+ }
+
+ public DataGridTextBoxColumn (PropertyDescriptor prop) : base (prop)
+ {
+ format = string.Empty;
+ }
+
+ public DataGridTextBoxColumn (PropertyDescriptor prop, bool isDefault) : base (prop)
+ {
+ format = string.Empty;
+ is_default = isDefault;
+ }
+
+ public DataGridTextBoxColumn (PropertyDescriptor prop, string format) : base (prop)
+ {
+ this.format = format;
+ }
+
+ public DataGridTextBoxColumn (PropertyDescriptor prop, string format, bool isDefault) : base (prop)
+ {
+ this.format = format;
+ is_default = isDefault;
+ }
+
+ #endregion
+
+ #region Public Instance Properties
+ [Editor("System.Windows.Forms.Design.DataGridColumnStyleFormatEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
+ public string Format {
+ get {
+ return format;
+ }
+ set {
+ if (value != format) {
+ format = value;
+ }
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public IFormatProvider FormatInfo {
+ get {
+ return format_provider;
+ }
+ set {
+ if (value != format_provider) {
+ format_provider = value;
+ }
+ }
+ }
+
+ [DefaultValue(null)]
+ public override PropertyDescriptor PropertyDescriptor {
+ set {
+ base.PropertyDescriptor = value;
+ }
+ }
+
+ public override bool ReadOnly {
+ get {
+ return base.ReadOnly;
+ }
+ set {
+ base.ReadOnly = value;
+ }
+ }
+
+ [Browsable(false)]
+ public virtual TextBox TextBox {
+ get {
+ return textbox;
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Instance Methods
+
+
+ protected internal override void Abort (int rowNum)
+ {
+ EndEdit ();
+ }
+
+ protected internal override bool Commit (CurrencyManager dataSource, int rowNum)
+ {
+ string text;
+
+ if (textbox.Text == NullText) {
+ text = string.Empty;
+ } else {
+ text = textbox.Text;
+ }
+
+ try {
+ SetColumnValueAtRow (dataSource, rowNum, text);
+ }
+
+ catch (Exception e) {
+ string message = "The data entered in column ["+ MappingName +"] has an invalid format.";
+ MessageBox.Show( message);
+ }
+
+
+ EndEdit ();
+ return true;
+ }
+
+ [MonoTODO]
+ protected internal override void ConcedeFocus ()
+ {
+
+ }
+
+ protected internal override void Edit (CurrencyManager source, int rowNum, Rectangle bounds, bool _ro, string instantText, bool cellIsVisible)
+ {
+ object obj;
+ bool newctrl = false;
+
+ if (textbox == null) {
+ textbox = new DataGridTextBox ();
+ textbox.SetDataGrid (DataGridTableStyle.DataGrid);
+ newctrl = true;
+ textbox.Multiline = true;
+ textbox.BorderStyle = BorderStyle.None;
+ }
+
+ textbox.TextAlign = alignment;
+ textbox.Visible = cellIsVisible;
+
+ if ((ParentReadOnly == true) ||
+ (ParentReadOnly == false && ReadOnly == true) ||
+ (ParentReadOnly == false && _ro == true)) {
+ textbox.ReadOnly = true;
+ } else {
+ textbox.ReadOnly = false;
+ }
+
+ textbox.Location = new Point (bounds.X + offset_x, bounds.Y + offset_y);
+ textbox.Size = new Size (bounds.Width - offset_x, bounds.Height - offset_y);
+
+ obj = GetColumnValueAtRow (source, rowNum);
+ textbox.Text = GetFormattedString (obj);
+
+ if (newctrl == true)
+ DataGridTableStyle.DataGrid.Controls.Add (textbox);
+
+ textbox.Focus ();
+ textbox.SelectAll ();
+ }
+
+ protected void EndEdit ()
+ {
+ ReleaseHostedControl ();
+ grid.Invalidate (grid.GetCurrentCellBounds ());
+ }
+
+ protected internal override void EnterNullValue ()
+ {
+ if (textbox != null) {
+ textbox.Text = NullText;
+ }
+ }
+
+ protected internal override int GetMinimumHeight ()
+ {
+ return FontHeight + 3;
+ }
+
+ [MonoTODO]
+ protected internal override int GetPreferredHeight (Graphics g, object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected internal override Size GetPreferredSize (Graphics g, object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void HideEditBox ()
+ {
+
+ }
+
+ protected internal override void Paint (Graphics g, Rectangle bounds, CurrencyManager source, int rowNum)
+ {
+ Paint (g, bounds, source, rowNum, false);
+ }
+
+ protected internal override void Paint (Graphics g, Rectangle bounds, CurrencyManager source, int rowNum, bool alignToRight)
+ {
+ Paint (g, bounds, source, rowNum, ThemeEngine.Current.ResPool.GetSolidBrush (DataGridTableStyle.BackColor),
+ ThemeEngine.Current.ResPool.GetSolidBrush (DataGridTableStyle.ForeColor), alignToRight);
+ }
+
+ protected internal override void Paint (Graphics g, Rectangle bounds, CurrencyManager source, int rowNum, Brush backBrush, Brush foreBrush, bool alignToRight)
+ {
+ object obj;
+ obj = GetColumnValueAtRow (source, rowNum);
+
+ PaintText (g, bounds, GetFormattedString (obj), backBrush, foreBrush, alignToRight);
+ }
+
+ protected void PaintText (Graphics g, Rectangle bounds, string text, bool alignToRight)
+ {
+ PaintText (g, bounds, text, ThemeEngine.Current.ResPool.GetSolidBrush (DataGridTableStyle.BackColor),
+ ThemeEngine.Current.ResPool.GetSolidBrush (DataGridTableStyle.ForeColor), alignToRight);
+ }
+
+ protected void PaintText (Graphics g, Rectangle textBounds, string text, Brush backBrush, Brush foreBrush, bool alignToRight)
+ {
+ if (alignToRight == true) {
+ string_format.FormatFlags |= StringFormatFlags.DirectionRightToLeft;
+ } else {
+ string_format.FormatFlags &= ~StringFormatFlags.DirectionRightToLeft;
+ }
+
+ switch (alignment) {
+ case HorizontalAlignment.Center:
+ string_format.Alignment = StringAlignment.Center;
+ break;
+ case HorizontalAlignment.Right:
+ string_format.Alignment = StringAlignment.Far;
+ break;
+ default:
+ string_format.Alignment = StringAlignment.Near;
+ break;
+ }
+
+ g.FillRectangle (backBrush, textBounds);
+ PaintGridLine (g, textBounds);
+
+ textBounds.Y += offset_y;
+ textBounds.Height -= offset_y;
+
+ string_format.FormatFlags |= StringFormatFlags.NoWrap;
+ g.DrawString (text, DataGridTableStyle.DataGrid.Font, foreBrush, textBounds, string_format);
+
+ }
+
+ protected internal override void ReleaseHostedControl ()
+ {
+ if (textbox != null) {
+ DataGridTableStyle.DataGrid.Controls.Remove (textbox);
+ textbox.Dispose ();
+ textbox = null;
+ }
+ }
+
+ protected override void SetDataGridInColumn (DataGrid value)
+ {
+ base.SetDataGridInColumn (value);
+ }
+
+ protected internal override void UpdateUI (CurrencyManager source, int rowNum, string instantText)
+ {
+
+ }
+
+ #endregion // Public Instance Methods
+
+
+ #region Private Instance Methods
+
+ // We use DataGridTextBox to render everything that DataGridBoolColumn does not
+ internal static bool CanRenderType (Type type)
+ {
+ return (type != typeof (Boolean));
+ }
+
+ private string GetFormattedString (object obj)
+ {
+ if (obj == DBNull.Value) {
+ return NullText;
+ }
+
+ if (format != null && obj as IFormattable != null) {
+ return ((IFormattable)obj).ToString (format, format_provider);
+ }
+
+ return obj.ToString ();
+
+ }
+ #endregion Private Instance Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs
new file mode 100644
index 00000000000..4ec44b314cc
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs
@@ -0,0 +1,2985 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System;
+using System.ComponentModel;
+using System.Runtime.InteropServices;
+using System.Drawing;
+using System.Collections;
+
+namespace System.Windows.Forms {
+
+ [ComVisibleAttribute(true)]
+ [ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)]
+ public class DataGridView : Control, ISupportInitialize {
+
+ private DataGridViewAdvancedBorderStyle adjustedTopLeftHeaderBorderStyle;
+ private DataGridViewAdvancedBorderStyle advancedCellBorderStyle;
+ private DataGridViewAdvancedBorderStyle advancedColumnHeadersBorderStyle;
+ private DataGridViewAdvancedBorderStyle advancedRowHeadersBorderStyle;
+ private bool allowUserToAddRows;
+ private bool allowUserToDeleteRows;
+ private bool allowUserToOrderColumns;
+ private bool allowUserToResizeColumns;
+ private bool allowUserToResizeRows;
+ private DataGridViewCellStyle alternatingRowsDefaultCellStyle;
+ private bool autoGenerateColumns;
+ private bool autoSize;
+ private DataGridViewAutoSizeColumnsMode autoSizeColumnsMode;
+ private DataGridViewAutoSizeRowsMode autoSizeRowsMode;
+ private Color backColor;
+ private Color backgroundColor;
+ private Image backgroundImage;
+ private ImageLayout backgroundImageLayout;
+ private BorderStyle borderStyle;
+ private DataGridViewCellBorderStyle cellBorderStyle;
+ private DataGridViewClipboardCopyMode clipboardCopyMode;
+ private DataGridViewHeaderBorderStyle columnHeadersBorderStyle;
+ private DataGridViewCellStyle columnHeadersDefaultCellStyle;
+ private int columnHeadersHeight;
+ private DataGridViewColumnHeadersHeightSizeMode columnHeadersHeightSizeMode;
+ private bool columnHeadersVisible;
+ private DataGridViewColumnCollection columns;
+ private DataGridViewCell currentCell;
+ private Point currentCellAddress;
+ private DataGridViewRow currentRow;
+ private string dataMember;
+ private object dataSource;
+ private DataGridViewCellStyle defaultCellStyle;
+ private Control editingControl;
+ private DataGridViewEditMode editMode;
+ private bool enableHeadersVisualStyles;
+ private DataGridViewCell firstDisplayedCell;
+ private int firstDisplayedScrollingColumnHiddenWidth;
+ private int firstDisplayedScrollingColumnIndex;
+ private int firstDisplayedScrollingRowIndex;
+ private Font font = Control.DefaultFont;
+ private Color foreColor = Control.DefaultForeColor;
+ private Color gridColor = Color.FromKnownColor(KnownColor.ControlDarkDark);
+ private int horizontalScrollingOffset;
+ private bool isCurrentCellDirty;
+ private bool isCurrentRowDirty;
+ private bool multiSelect;
+ private bool readOnly;
+ private DataGridViewHeaderBorderStyle rowHeadersBorderStyle;
+ private DataGridViewCellStyle rowHeadersDefaultCellStyle;
+ private bool rowHeadersVisible;
+ private int rowHeadersWidth;
+ private DataGridViewRowHeadersWidthSizeMode rowHeadersWidthSizeMode;
+ private DataGridViewRowCollection rows;
+ private DataGridViewCellStyle rowsDefaultCellStyle;
+ private DataGridViewRow rowTemplate;
+ private ScrollBars scrollBars;
+ private DataGridViewSelectionMode selectionMode;
+ private bool showCellErrors;
+ private bool showCellToolTips;
+ private bool showEditingIcon;
+ private bool showRowErrors;
+ private DataGridViewColumn sortedColumn = null;
+ private SortOrder sortOrder;
+ private bool standardTab;
+ private string text;
+ private DataGridViewHeaderCell topLeftHeaderCell;
+ private Cursor userSetCursor;
+ private int verticalScrollingOffset;
+ private bool virtualMode;
+ private Size defaultSize;
+ private HScrollBar horizontalScrollBar;
+ private VScrollBar verticalScrollBar;
+
+ internal int gridWidth;
+ internal int gridHeight;
+
+ public DataGridView () {
+ adjustedTopLeftHeaderBorderStyle = new DataGridViewAdvancedBorderStyle();
+ adjustedTopLeftHeaderBorderStyle.All = DataGridViewAdvancedCellBorderStyle.Single;
+ advancedCellBorderStyle = new DataGridViewAdvancedBorderStyle();
+ advancedCellBorderStyle.All = DataGridViewAdvancedCellBorderStyle.Single;
+ advancedColumnHeadersBorderStyle = new DataGridViewAdvancedBorderStyle();
+ advancedColumnHeadersBorderStyle.All = DataGridViewAdvancedCellBorderStyle.Single;
+ advancedRowHeadersBorderStyle = new DataGridViewAdvancedBorderStyle();
+ advancedRowHeadersBorderStyle.All = DataGridViewAdvancedCellBorderStyle.Single;
+ alternatingRowsDefaultCellStyle = new DataGridViewCellStyle();
+ allowUserToAddRows = true;
+ allowUserToDeleteRows = true;
+ allowUserToOrderColumns = false;
+ allowUserToResizeColumns = true;
+ allowUserToResizeRows = true;
+ autoGenerateColumns = true;
+ autoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None;
+ autoSizeRowsMode = DataGridViewAutoSizeRowsMode.None;
+ backColor = Control.DefaultBackColor;
+ backgroundColor = SystemColors.AppWorkspace;
+ borderStyle = BorderStyle.FixedSingle;
+ cellBorderStyle = DataGridViewCellBorderStyle.None;
+ clipboardCopyMode = DataGridViewClipboardCopyMode.EnableWithAutoHeaderText;
+ columnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single;
+ columnHeadersDefaultCellStyle = new DataGridViewCellStyle();
+ columnHeadersDefaultCellStyle.BackColor = SystemColors.Control;
+ columnHeadersDefaultCellStyle.ForeColor = SystemColors.WindowText;
+ columnHeadersDefaultCellStyle.SelectionBackColor = SystemColors.Highlight;
+ columnHeadersDefaultCellStyle.SelectionForeColor = SystemColors.HighlightText;
+ columnHeadersDefaultCellStyle.Font = this.Font;
+ columnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
+ columnHeadersDefaultCellStyle.WrapMode = DataGridViewTriState.True;
+ columnHeadersHeight = 23;
+ columnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing;
+ columnHeadersVisible = true;
+ columns = CreateColumnsInstance();
+ columns.CollectionChanged += OnColumnCollectionChanged;
+ dataMember = String.Empty;
+ defaultCellStyle = (DataGridViewCellStyle) columnHeadersDefaultCellStyle.Clone();
+ editMode = DataGridViewEditMode.EditOnKeystrokeOrF2;
+ multiSelect = true;
+ readOnly = false;
+ rowHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single;
+ rowHeadersDefaultCellStyle = (DataGridViewCellStyle) defaultCellStyle.Clone();
+ rowHeadersVisible = true;
+ rowHeadersWidth = 43;
+ rowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.EnableResizing;
+ rows = CreateRowsInstance();
+ rowsDefaultCellStyle = new DataGridViewCellStyle();
+ selectionMode = DataGridViewSelectionMode.RowHeaderSelect;
+ showCellErrors = true;
+ showEditingIcon = true;
+ userSetCursor = Cursor.Current;
+ virtualMode = false;
+
+ horizontalScrollBar = new HScrollBar();
+ horizontalScrollBar.Dock = DockStyle.Bottom;
+ horizontalScrollBar.Scroll += OnHScrollBarScroll;
+ horizontalScrollBar.Visible = false;
+ verticalScrollBar = new VScrollBar();
+ verticalScrollBar.Dock = DockStyle.Right;
+ verticalScrollBar.Scroll += OnVScrollBarScroll;
+ verticalScrollBar.Visible = false;
+ }
+
+ public void BeginInit () {
+ }
+
+ public void EndInit () {
+ }
+
+ // Propiedades
+
+ public virtual DataGridViewAdvancedBorderStyle AdjustedTopLeftHeaderBorderStyle {
+ get { return adjustedTopLeftHeaderBorderStyle; }
+ }
+
+ public DataGridViewAdvancedBorderStyle AdvancedCellBorderStyle {
+ get { return advancedCellBorderStyle; }
+ }
+
+ public DataGridViewAdvancedBorderStyle AdvancedColumnHeadersBorderStyle {
+ get { return advancedColumnHeadersBorderStyle; }
+ }
+
+ public DataGridViewAdvancedBorderStyle AdvancedRowHeadersBorderStyle {
+ get { return advancedRowHeadersBorderStyle; }
+ }
+
+ public bool AllowUserToAddRows {
+ get { return allowUserToAddRows; }
+ set {
+ if (allowUserToAddRows != value) {
+ allowUserToAddRows = value;
+ OnAllowUserToAddRowsChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ public bool AllowUserToDeleteRows {
+ get { return allowUserToDeleteRows; }
+ set {
+ if (allowUserToDeleteRows != value) {
+ allowUserToDeleteRows = value;
+ OnAllowUserToDeleteRowsChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ public bool AllowUserToOrderColumns {
+ get { return allowUserToOrderColumns; }
+ set {
+ if (allowUserToOrderColumns != value) {
+ allowUserToOrderColumns = value;
+ OnAllowUserToOrderColumnsChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ public bool AllowUserToResizeColumns {
+ get { return allowUserToResizeColumns; }
+ set {
+ if (allowUserToResizeColumns != value) {
+ allowUserToResizeColumns = value;
+ OnAllowUserToResizeColumnsChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ public bool AllowUserToResizeRows {
+ get { return allowUserToResizeRows; }
+ set {
+ if (allowUserToResizeRows != value) {
+ allowUserToResizeRows = value;
+ OnAllowUserToResizeRowsChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ public DataGridViewCellStyle AlternatingRowsDefaultCellStyle {
+ get { return alternatingRowsDefaultCellStyle; }
+ set {
+ if (alternatingRowsDefaultCellStyle != value) {
+ alternatingRowsDefaultCellStyle = value;
+ OnAlternatingRowsDefaultCellStyleChanged(EventArgs.Empty);
+ Invalidate();
+ }
+ }
+ }
+
+ public bool AutoGenerateColumns {
+ get { return autoGenerateColumns; }
+ set {
+ if (autoGenerateColumns != value) {
+ autoGenerateColumns = value;
+ OnAutoGenerateColumnsChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ //public override bool AutoSize {
+ public bool AutoSize {
+ get { return autoSize; }
+ set {
+ if (autoSize != value) {
+ autoSize = value;
+ //OnAutoSizeChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ public DataGridViewAutoSizeColumnsMode AutoSizeColumnsMode {
+ get { return autoSizeColumnsMode; }
+ set {
+ if (!Enum.IsDefined(typeof(DataGridViewAutoSizeColumnsMode), value)) {
+ throw new InvalidEnumArgumentException("Value is not valid DataGridViewAutoSizeColumnsMode.");
+ }
+ if (value == DataGridViewAutoSizeColumnsMode.ColumnHeader && columnHeadersVisible == false) {
+ foreach (DataGridViewColumn col in columns) {
+ if (col.AutoSizeMode == DataGridViewAutoSizeColumnMode.NotSet) {
+ throw new InvalidOperationException("Cant set this property to ColumnHeader in this DataGridView.");
+ }
+ }
+ }
+ if (value == DataGridViewAutoSizeColumnsMode.Fill) {
+ foreach (DataGridViewColumn col in columns) {
+ if (col.AutoSizeMode == DataGridViewAutoSizeColumnMode.NotSet) {
+ if (col.Frozen) {
+ throw new InvalidOperationException("Cant set this property to Fill in this DataGridView.");
+ }
+ }
+ }
+ }
+ autoSizeColumnsMode = value;
+ }
+ }
+
+ public DataGridViewAutoSizeRowsMode AutoSizeRowsMode {
+ get { return autoSizeRowsMode; }
+ set {
+ if (autoSizeRowsMode != value) {
+ if (!Enum.IsDefined(typeof(DataGridViewAutoSizeRowsMode), value)) {
+ throw new InvalidEnumArgumentException("Value is not valid DataGridViewRowsMode.");
+ }
+ if ((value == DataGridViewAutoSizeRowsMode.AllHeaders || value == DataGridViewAutoSizeRowsMode.DisplayedHeaders) && rowHeadersVisible == false) {
+ throw new InvalidOperationException("Cant set this property to AllHeaders or DisplayedHeaders in this DataGridView.");
+ }
+ autoSizeRowsMode = value;
+ OnAutoSizeRowsModeChanged(new DataGridViewAutoSizeModeEventArgs(false));
+ ////////////////////////////////////////////////////////////////
+ }
+ }
+ }
+
+ public override Color BackColor {
+ get { return backColor; }
+ set {
+ if (backColor != value) {
+ backColor = value;
+ OnBackColorChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ public Color BackgroundColor {
+ get { return backgroundColor; }
+ set {
+ if (backgroundColor != value) {
+ if (value == Color.Empty) {
+ throw new ArgumentException("Cant set an Empty color.");
+ }
+ backgroundColor = value;
+ OnBackgroundColorChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ public override Image BackgroundImage {
+ get { return backgroundImage; }
+ set {
+ if (backgroundImage != value) {
+ backgroundImage = value;
+ OnBackgroundImageChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ //public override ImageLayout BackgroundImageLayout {
+ public ImageLayout BackgroundImageLayout {
+ get { return backgroundImageLayout; }
+ set {
+ if (backgroundImageLayout != value) {
+ backgroundImageLayout = value;
+ //OnBackgroundImageLayoutChanged(EventArg.Empty);
+ }
+ }
+ }
+
+ public BorderStyle BorderStyle {
+ get { return borderStyle; }
+ set {
+ if (borderStyle != value) {
+ if (!Enum.IsDefined(typeof(BorderStyle), value)) {
+ throw new InvalidEnumArgumentException("Invalid border style.");
+ }
+ borderStyle = value;
+ OnBorderStyleChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ public DataGridViewCellBorderStyle CellBorderStyle {
+ get { return cellBorderStyle; }
+ set {
+ if (cellBorderStyle != value) {
+ cellBorderStyle = value;
+ OnCellBorderStyleChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ public DataGridViewClipboardCopyMode ClipboardCopyMode {
+ get { return clipboardCopyMode; }
+ set { clipboardCopyMode = value; }
+ }
+
+ public int ColumnCount {
+ get { return columns.Count; }
+ set {
+ if (value < 0) {
+ throw new ArgumentException("ColumnCount must be >= 0.");
+ }
+ if (dataSource != null) {
+ throw new InvalidOperationException("Cant change column count if DataSource is set.");
+ }
+ if (value < columns.Count) {
+ for (int i = value; i < columns.Count; i++) {
+ columns.RemoveAt(i);
+ }
+ }
+ else if (value > columns.Count) {
+ for (int i = 0; i < value; i++) {
+ DataGridViewColumn col = new DataGridViewColumn();
+ columns.Add(col);
+ }
+ }
+ }
+ }
+
+ public DataGridViewHeaderBorderStyle ColumnHeadersBorderStyle {
+ get { return columnHeadersBorderStyle; }
+ set {
+ if (columnHeadersBorderStyle != value) {
+ columnHeadersBorderStyle = value;
+ OnColumnHeadersBorderStyleChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ public DataGridViewCellStyle ColumnHeadersDefaultCellStyle {
+ get { return columnHeadersDefaultCellStyle; }
+ set {
+ if (columnHeadersDefaultCellStyle != value) {
+ columnHeadersDefaultCellStyle = value;
+ OnColumnHeadersDefaultCellStyleChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ public int ColumnHeadersHeight {
+ get { return columnHeadersHeight; }
+ set {
+ if (columnHeadersHeight != value) {
+ if (value < 4) {
+ throw new ArgumentException("Column headers height cant be less than 4.");
+ }
+ columnHeadersHeight = value;
+ OnColumnHeadersHeightChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ public DataGridViewColumnHeadersHeightSizeMode ColumnHeadersHeightSizeMode {
+ get { return columnHeadersHeightSizeMode; }
+ set {
+ if (columnHeadersHeightSizeMode != value) {
+ if (!Enum.IsDefined(typeof(DataGridViewColumnHeadersHeightSizeMode), value)) {
+ throw new InvalidEnumArgumentException("Value is not a valid DataGridViewColumnHeadersHeightSizeMode.");
+ }
+ columnHeadersHeightSizeMode = value;
+ OnColumnHeadersHeightSizeModeChanged(new DataGridViewAutoSizeModeEventArgs(false));
+ }
+ }
+ }
+
+ public bool ColumnHeadersVisible {
+ get { return columnHeadersVisible; }
+ set { columnHeadersVisible = value; }
+ }
+
+ public DataGridViewColumnCollection Columns {
+ get { return columns; }
+ }
+
+ public DataGridViewCell CurrentCell {
+ get { return currentCell; }
+ set {
+ /////////////////////////////////////////////////////
+ /// *** InvalidOperationException ***
+ /// Changes to the specified cell cannot be committed
+ /// to the data cache, or the new cell is in a hidden
+ /// row.
+ /////////////////////////////////////////////////////
+ if (value.DataGridView != this) {
+ throw new ArgumentException("The cell is not in this DataGridView.");
+ }
+ currentCell = value;
+ }
+ }
+
+ public Point CurrentCellAddress {
+ get { return currentCellAddress; }
+ }
+
+ public DataGridViewRow CurrentRow {
+ get { return currentRow; }
+ }
+
+ public string DataMember {
+ get { return dataMember; }
+ set {
+ if (dataMember != value) {
+ dataMember = value;
+ OnDataMemberChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ public object DataSource {
+ get { return dataSource; }
+ set {
+ if (dataSource != value) {
+ /* The System.Windows.Forms.DataGridView class supports the standard Windows Forms data-binding model. This means the data source can be of any type that implements:
+ - the System.Collections.IList interface, including one-dimensional arrays.
+ - the System.ComponentModel.IListSource interface, such as the System.Data.DataTable and System.Data.DataSet classes.
+ - the System.ComponentModel.IBindingList interface, such as the System.ComponentModel.Collections.BindingList<> class.
+ - the System.ComponentModel.IBindingListView interface, such as the System.Windows.Forms.BindingSource class.
+ */
+ if (!(value is IList) && !(value is IListSource) && !(value is IBindingList) && !(value is IBindingListView)) {
+ throw new NotSupportedException("Type cant be binded.");
+ }
+ dataSource = value;
+ OnDataSourceChanged(EventArgs.Empty);
+ // DataBinding
+ if (value is IList) {
+ BindIList(value as IList);
+ }
+ else if (value is IListSource) {
+ BindIListSource(value as IListSource);
+ }
+ else if (value is IBindingList) {
+ BindIBindingList(value as IBindingList);
+ }
+ else if (value is IBindingListView) {
+ BindIBindingListView(value as IBindingListView);
+ //bool cosa = ((value as IBindingListView).SortDescriptions as IList).IsFixedSize;
+ }
+ OnDataBindingComplete(new DataGridViewBindingCompleteEventArgs(ListChangedType.Reset));
+ }
+ }
+ }
+
+ public DataGridViewCellStyle DefaultCellStyle {
+ get { return defaultCellStyle; }
+ set {
+ if (defaultCellStyle != value) {
+ defaultCellStyle = value;
+ OnDefaultCellStyleChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ public override Rectangle DisplayRectangle {
+ get { return base.DisplayRectangle; }
+ }
+
+ public Control EditingControl {
+ get {
+ if (currentCell == null || !currentCell.IsInEditMode) {
+ return null;
+ }
+ return (Control) Activator.CreateInstance(currentCell.EditType);
+ }
+ }
+
+ public Panel EditingPanel {
+ get { throw new NotImplementedException(); }
+ }
+
+ public DataGridViewEditMode EditMode {
+ get { return editMode; }
+ set {
+ if (editMode != value) {
+ editMode = value;
+ OnEditModeChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ public bool EnableHeadersVisualStyles {
+ get { return enableHeadersVisualStyles; }
+ set { enableHeadersVisualStyles = value; }
+ }
+
+ public DataGridViewCell FirstDisplayedCell {
+ get { return firstDisplayedCell; }
+ set {
+ if (value.DataGridView != this) {
+ throw new ArgumentException("The cell is not in this DataGridView.");
+ }
+ firstDisplayedCell = value;
+ }
+ }
+
+ public int FirstDisplayedScrollingColumnHiddenWidth {
+ get { return firstDisplayedScrollingColumnHiddenWidth; }
+ }
+
+ public int FirstDisplayedScrollingColumnIndex {
+ get { return firstDisplayedScrollingColumnIndex; }
+ set { firstDisplayedScrollingColumnIndex = value; }
+ }
+
+ public int FirstDisplayedScrollingRowIndex {
+ get { return firstDisplayedScrollingRowIndex; }
+ set { firstDisplayedScrollingRowIndex = value; }
+ }
+
+ public override Font Font {
+ get { return font; }
+ set {
+ if (font != value) {
+ font = value;
+ OnFontChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ public override Color ForeColor {
+ get { return foreColor; }
+ set {
+ if (foreColor != value) {
+ foreColor = value;
+ OnForeColorChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ public Color GridColor {
+ get { return gridColor; }
+ set {
+ if (gridColor != value) {
+ if (value == Color.Empty) {
+ throw new ArgumentException("Cant set an Empty color.");
+ }
+ gridColor = value;
+ OnGridColorChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ public int HorizontalScrollingOffset {
+ get { return horizontalScrollingOffset; }
+ set { horizontalScrollingOffset = value; }
+ }
+
+ public bool IsCurrentCellDirty {
+ get { return isCurrentCellDirty; }
+ }
+
+ public bool IsCurrentCellInEditMode {
+ get {
+ if (currentCell == null) {
+ return false;
+ }
+ return currentCell.IsInEditMode;
+ }
+ }
+
+ public bool IsCurrentRowDirty {
+ get {
+ if (!virtualMode) {
+ return IsCurrentCellDirty;
+ }
+ // Calcular
+ throw new NotImplementedException();
+ }
+ }
+
+ public DataGridViewCell this [int columnIndex, int rowIndex] {
+ get { return rows[rowIndex].Cells[columnIndex]; }
+ set { rows[rowIndex].Cells[columnIndex] = value; }
+ }
+
+ public DataGridViewCell this [string columnName, int rowIndex] {
+ get {
+ int columnIndex = -1;
+ foreach (DataGridViewColumn col in columns) {
+ if (col.Name == columnName) {
+ columnIndex = col.Index;
+ break;
+ }
+ }
+ return this[columnIndex, rowIndex];
+ }
+ set {
+ int columnIndex = -1;
+ foreach (DataGridViewColumn col in columns) {
+ if (col.Name == columnName) {
+ columnIndex = col.Index;
+ break;
+ }
+ }
+ this[columnIndex, rowIndex] = value;
+ }
+ }
+
+ public bool MultiSelect {
+ get { return multiSelect; }
+ set {
+ if (multiSelect != value) {
+ multiSelect = value;
+ OnMultiSelectChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ public int NewRowIndex {
+ get {
+ if (!allowUserToAddRows) {
+ return -1;
+ }
+ return rows.Count - 1;
+ }
+ }
+
+ public new Padding Padding {
+ get { return Padding.Empty; }
+ set { }
+ }
+
+ public bool ReadOnly {
+ get { return readOnly; }
+ set {
+ if (readOnly != value) {
+ readOnly = value;
+ OnReadOnlyChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ public int RowCount {
+ get { return rows.Count; }
+ set {
+ if (value < 0) {
+ throw new ArgumentException("RowCount must be >= 0.");
+ }
+ if (value < 1 && allowUserToAddRows) {
+ throw new ArgumentException("RowCount must be >= 1 if AllowUserToAddRows is true.");
+ }
+ if (dataSource != null) {
+ throw new InvalidOperationException("Cant change row count if DataSource is set.");
+ }
+ if (value < rows.Count) {
+ for (int i = value; i < rows.Count; i++) {
+ rows.RemoveAt(i);
+ }
+ }
+ else if (value > rows.Count) {
+ for (int i = 0; i < value; i++) {
+ // DataGridViewRow row = new DataGridViewRow(); //(DataGridViewRow) rowTemplate.Clone();
+ DataGridViewRow row = (DataGridViewRow) rowTemplate.Clone();
+ rows.Add(row);
+ foreach (DataGridViewColumn col in columns) {
+ row.Cells.Add(col.CellTemplate.Clone() as DataGridViewCell);
+ }
+ }
+ }
+ if (ColumnCount == 0) {
+ ///////////////////////////////////////////////////////////////
+ //columns.Add(new DataGridViewTextBoxColumn());
+ throw new NotImplementedException();
+ }
+ }
+ }
+
+ public DataGridViewHeaderBorderStyle RowHeadersBorderStyle {
+ get { return rowHeadersBorderStyle; }
+ set {
+ if (rowHeadersBorderStyle != value) {
+ rowHeadersBorderStyle = value;
+ OnRowHeadersBorderStyleChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ public DataGridViewCellStyle RowHeadersDefaultCellStyle {
+ get { return rowHeadersDefaultCellStyle; }
+ set {
+ if (rowHeadersDefaultCellStyle != value) {
+ rowHeadersDefaultCellStyle = value;
+ OnRowHeadersDefaultCellStyleChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ public bool RowHeadersVisible {
+ get { return rowHeadersVisible; }
+ set { rowHeadersVisible = value; }
+ }
+
+ public int RowHeadersWidth {
+ get { return rowHeadersWidth; }
+ set {
+ if (rowHeadersWidth != value) {
+ if (value < 4) {
+ throw new ArgumentException("RowHeadersWidth cant be less than 4.");
+ }
+ rowHeadersWidth = value;
+ OnRowHeadersWidthChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ public DataGridViewRowHeadersWidthSizeMode RowHeadersWidthSizeMode {
+ get { return rowHeadersWidthSizeMode; }
+ set {
+ if (rowHeadersWidthSizeMode != value) {
+ if (!Enum.IsDefined(typeof(DataGridViewRowHeadersWidthSizeMode), value)) {
+ throw new InvalidEnumArgumentException("Value is not valid DataGridViewRowHeadersWidthSizeMode.");
+ }
+ rowHeadersWidthSizeMode = value;
+ OnRowHeadersWidthSizeModeChanged(new DataGridViewAutoSizeModeEventArgs(false));
+ }
+ }
+ }
+
+ public DataGridViewRowCollection Rows {
+ get { return rows; }
+ }
+
+ public DataGridViewCellStyle RowsDefaultCellStyle {
+ get { return rowsDefaultCellStyle; }
+ set {
+ if (rowsDefaultCellStyle != value) {
+ rowsDefaultCellStyle = value;
+ OnRowsDefaultCellStyleChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ public DataGridViewRow RowTemplate {
+ get {
+ if (rowTemplate == null) {
+ return new DataGridViewRow();
+ }
+ return rowTemplate;
+ }
+ set {
+ rowTemplate = value;
+ rowTemplate.SetDataGridView(this);
+ }
+ }
+
+ public ScrollBars ScrollBars {
+ get { return scrollBars; }
+ set {
+ if (!Enum.IsDefined(typeof(ScrollBars), value)) {
+ throw new InvalidEnumArgumentException("Invalid ScrollBars value.");
+ }
+ ////////////////////////////////////////////////////////////
+ /// *** InvalidOperationException ***
+ /// The System.Windows.Forms.DataGridView is unable to
+ /// scroll due to a cell change that cannot be committed
+ /// or canceled.
+ ///////////////////////////////////////////////////////////
+ scrollBars = value;
+ }
+ }
+
+ public DataGridViewSelectedCellCollection SelectedCells {
+ get {
+ DataGridViewSelectedCellCollection selectedCells = new DataGridViewSelectedCellCollection();
+ foreach (DataGridViewRow row in rows) {
+ foreach (DataGridViewCell cell in row.Cells) {
+ if (cell.Selected) {
+ selectedCells.InternalAdd(cell);
+ }
+ }
+ }
+ return selectedCells;
+ }
+ }
+
+ public DataGridViewSelectedColumnCollection SelectedColumns {
+ get {
+ DataGridViewSelectedColumnCollection selectedColumns = new DataGridViewSelectedColumnCollection();
+ if (selectionMode == DataGridViewSelectionMode.FullColumnSelect || selectionMode == DataGridViewSelectionMode.ColumnHeaderSelect) {
+ foreach (DataGridViewColumn col in columns) {
+ if (col.Selected) {
+ selectedColumns.InternalAdd(col);
+ }
+ }
+ }
+ return selectedColumns;
+ }
+ }
+
+ public DataGridViewSelectedRowCollection SelectedRows {
+ get {
+ DataGridViewSelectedRowCollection selectedRows = new DataGridViewSelectedRowCollection();
+ if (selectionMode == DataGridViewSelectionMode.FullColumnSelect || selectionMode == DataGridViewSelectionMode.RowHeaderSelect) {
+ foreach (DataGridViewRow row in rows) {
+ if (row.Selected) {
+ selectedRows.InternalAdd(row);
+ }
+ }
+ }
+ return selectedRows;
+ }
+ }
+
+ public DataGridViewSelectionMode SelectionMode {
+ get { return selectionMode; }
+ set {
+ if (!Enum.IsDefined(typeof(DataGridViewSelectionMode), value)) {
+ throw new InvalidEnumArgumentException("Value is not valid DataGridViewSelectionMode.");
+ }
+ selectionMode = value;
+ }
+ }
+
+ public bool ShowCellErrors {
+ get { return showCellErrors; }
+ set { showCellErrors = value; }
+ }
+
+ public bool ShowCellToolTips {
+ get { return showCellToolTips; }
+ set { showCellToolTips = value; }
+ }
+
+ public bool ShowEditingIcon {
+ get { return showEditingIcon; }
+ set { showEditingIcon = value; }
+ }
+
+ public bool ShowRowErrors {
+ get { return showRowErrors; }
+ set { showRowErrors = value; }
+ }
+
+ public DataGridViewColumn SortedColumn {
+ get { return sortedColumn; }
+ }
+
+ public SortOrder SortOrder {
+ get { return sortOrder; }
+ }
+
+ public bool StandardTab {
+ get { return standardTab; }
+ set { standardTab = value; }
+ }
+
+ public override string Text {
+ get { return text; }
+ set { text = value; }
+ }
+
+ public DataGridViewHeaderCell TopLeftHeaderCell {
+ get { return topLeftHeaderCell; }
+ set { topLeftHeaderCell = value; }
+ }
+
+ public Cursor UserSetCursor {
+ get { return userSetCursor; }
+ }
+
+ public int VerticalScrollingOffset {
+ get { return verticalScrollingOffset; }
+ }
+
+ public bool VirtualMode {
+ get { return virtualMode; }
+ set { virtualMode = value; }
+ }
+
+ public event EventHandler AllowUserToAddRowsChanged;
+
+ public event EventHandler AllowUserToDeleteRowsChanged;
+
+ public event EventHandler AllowUserToOrderColumnsChanged;
+
+ public event EventHandler AllowUserToResizeColumnsChanged;
+
+ public event EventHandler AllowUserToResizeRowsChanged;
+
+ public event EventHandler AlternatingRowsDefaultCellStyleChanged;
+
+ public event EventHandler AutoGenerateColumnsChanged;
+
+ public new event EventHandler AutoSizeChanged;
+
+ public event DataGridViewAutoSizeColumnModeEventHandler AutoSizeColumnModeChanged;
+
+ public event DataGridViewAutoSizeColumnsModeEventHandler AutoSizeColumnsModeChanged;
+
+ public event DataGridViewAutoSizeModeEventHandler AutoSizeRowsModeChanged;
+
+ public new event EventHandler BackColorChanged;
+
+ public event EventHandler BackgroundColorChanged;
+
+ public new event EventHandler BackgroundImageChanged;
+
+ public new event EventHandler BackgroundImageLayoutChanged;
+
+ public event EventHandler BorderStyleChanged;
+
+ public event QuestionEventHandler CancelRowEdit;
+
+ public event DataGridViewCellCancelEventHandler CellBeginEdit;
+
+ public event EventHandler CellBorderStyleChanged;
+
+ public event DataGridViewCellEventHandler CellClick;
+
+ public event DataGridViewCellEventHandler CellContentClick;
+
+ public event DataGridViewCellEventHandler CellContentDoubleClick;
+
+ public event DataGridViewCellEventHandler CellContextMenuStripChanged;
+
+ public event DataGridViewCellContextMenuStripNeededEventHandler CellContextMenuStripNeeded;
+
+ public event DataGridViewCellEventHandler CellDoubleClick;
+
+ public event DataGridViewCellEventHandler CellEndEdit;
+
+ public event DataGridViewCellEventHandler CellEnter;
+
+ public event DataGridViewCellEventHandler CellErrorTextChanged;
+
+ public event DataGridViewCellErrorTextNeededEventHandler CellErrorTextNeeded;
+
+ public event DataGridViewCellFormattingEventHandler CellFormatting;
+
+ public event DataGridViewCellEventHandler CellLeave;
+
+ public event DataGridViewCellMouseEventHandler CellMouseClick;
+
+ public event DataGridViewCellMouseEventHandler CellMouseDoubleClick;
+
+ public event DataGridViewCellMouseEventHandler CellMouseDown;
+
+ public event DataGridViewCellEventHandler CellMouseEnter;
+
+ public event DataGridViewCellEventHandler CellMouseLeave;
+
+ public event DataGridViewCellMouseEventHandler CellMouseMove;
+
+ public event DataGridViewCellMouseEventHandler CellMouseUp;
+
+ public event DataGridViewCellPaintingEventHandler CellPainting;
+
+ public event DataGridViewCellParsingEventHandler CellParsing;
+
+ public event DataGridViewCellStateChangedEventHandler CellStateChanged;
+
+ public event DataGridViewCellEventHandler CellStyleChanged;
+
+ public event DataGridViewCellStyleContentChangedEventHandler CellStyleContentChanged;
+
+ public event DataGridViewCellEventHandler CellToolTipTextChanged;
+
+ public event DataGridViewCellToolTipTextNeededEventHandler CellToolTipTextNeeded;
+
+ public event DataGridViewCellEventHandler CellValidated;
+
+ public event DataGridViewCellValidatingEventHandler CellValidating;
+
+ public event DataGridViewCellEventHandler CellValueChanged;
+
+ public event DataGridViewCellValueEventHandler CellValueNeeded;
+
+ public event DataGridViewCellValueEventHandler CellValuePushed;
+
+ public event DataGridViewColumnEventHandler ColumnAdded;
+
+ public event DataGridViewColumnEventHandler ColumnContextMenuStripChanged;
+
+ public event DataGridViewColumnEventHandler ColumnDataPropertyNameChanged;
+
+ public event DataGridViewColumnEventHandler ColumnDefaultCellStyleChanged;
+
+ public event DataGridViewColumnEventHandler ColumnDisplayIndexChanged;
+
+ public event DataGridViewColumnDividerDoubleClickEventHandler ColumnDividerDoubleClick;
+
+ public event DataGridViewColumnEventHandler ColumnDividerWidthChanged;
+
+ public event DataGridViewColumnEventHandler ColumnHeaderCellChanged;
+
+ public event DataGridViewCellMouseEventHandler ColumnHeaderMouseClick;
+
+ public event DataGridViewCellMouseEventHandler ColumnHeaderMouseDoubleClick;
+
+ public event EventHandler ColumnHeadersBorderStyleChanged;
+
+ public event EventHandler ColumnHeadersDefaultCellStyleChanged;
+
+ public event EventHandler ColumnHeadersHeightChanged;
+
+ public event DataGridViewAutoSizeModeEventHandler ColumnHeadersHeightSizeModeChanged;
+
+ public event DataGridViewColumnEventHandler ColumnMinimumWidthChanged;
+
+ public event DataGridViewColumnEventHandler ColumnNameChanged;
+
+ public event DataGridViewColumnEventHandler ColumnRemoved;
+
+ public event DataGridViewColumnEventHandler ColumnSortModeChanged;
+
+ public event DataGridViewColumnStateChangedEventHandler ColumnStateChanged;
+
+ public event DataGridViewColumnEventHandler ColumnToolTipTextChanged;
+
+ public event DataGridViewColumnEventHandler ColumnWidthChanged;
+
+ public event EventHandler CurrentCellChanged;
+
+ public event EventHandler CurrentCellDirtyStateChanged;
+
+ public event DataGridViewBindingCompleteEventHandler DataBindingComplete;
+
+ public event DataGridViewDataErrorEventHandler DataError;
+
+ public event EventHandler DataMemberChanged;
+
+ public event EventHandler DataSourceChanged;
+
+ public event EventHandler DefaultCellStyleChanged;
+
+ public event DataGridViewRowEventHandler DefaultValuesNeeded;
+
+ public event DataGridViewEditingControlShowingEventHandler EditingControlShowing;
+
+ public event EventHandler EditModeChanged;
+
+ public new event EventHandler FontChanged;
+
+ public new event EventHandler ForeColorChanged;
+
+ public event EventHandler GridColorChanged;
+
+ public event EventHandler MultiSelectChanged;
+
+ public event DataGridViewRowEventHandler NewRowNeeded;
+
+ public event EventHandler ReadOnlyChanged;
+
+ public event DataGridViewRowEventHandler RowContextMenuStripChanged;
+
+ public event DataGridViewRowContextMenuStripNeededEventHandler RowContextMenuStripNeeded;
+
+ public event DataGridViewRowEventHandler RowDefaultCellStyleChanged;
+
+ public event QuestionEventHandler RowDirtyStateNeeded;
+
+ public event DataGridViewRowDividerDoubleClickEventHandler RowDividerDoubleClick;
+
+ public event DataGridViewRowEventHandler RowDividerHeightChanged;
+
+ public event DataGridViewCellEventHandler RowEnter;
+
+ public event DataGridViewRowEventHandler RowErrorTextChanged;
+
+ public event DataGridViewRowErrorTextNeededEventHandler RowErrorTextNeeded;
+
+ public event DataGridViewRowEventHandler RowHeaderCellChanged;
+
+ public event DataGridViewCellMouseEventHandler RowHeaderMouseClick;
+
+ public event DataGridViewCellMouseEventHandler RowHeaderMouseDoubleClick;
+
+ public event EventHandler RowHeadersBorderStyleChanged;
+
+ public event EventHandler RowHeadersDefaultCellStyleChanged;
+
+ public event EventHandler RowHeadersWidthChanged;
+
+ public event DataGridViewAutoSizeModeEventHandler RowHeadersWidthSizeModeChanged;
+
+ public event DataGridViewRowEventHandler RowHeightChanged;
+
+ public event DataGridViewRowHeightInfoNeededEventHandler RowHeightInfoNeeded;
+
+ public event DataGridViewRowHeightInfoPushedEventHandler RowHeightInfoPushed;
+
+ public event DataGridViewCellEventHandler RowLeave;
+
+ public event DataGridViewRowEventHandler RowMinimumHeightChanged;
+
+ public event DataGridViewRowPostPaintEventHandler RowPostPaint;
+
+ public event DataGridViewRowPrePaintEventHandler RowPrePaint;
+
+ public event DataGridViewRowsAddedEventHandler RowsAdded;
+
+ public event EventHandler RowsDefaultCellStyleChanged;
+
+ public event DataGridViewRowsRemovedEventHandler RowsRemoved;
+
+ public event DataGridViewRowStateChangedEventHandler RowStateChanged;
+
+ public event DataGridViewRowEventHandler RowUnshared;
+
+ public event DataGridViewCellEventHandler RowValidated;
+
+ public event DataGridViewCellCancelEventHandler RowValidating;
+
+ public event ScrollEventHandler Scroll;
+
+ public event EventHandler SelectionChanged;
+
+ public event DataGridViewSortCompareEventHandler SortCompare;
+
+ public event EventHandler Sorted;
+
+ public event DataGridViewRowEventHandler UserAddedRow;
+
+ public event DataGridViewRowEventHandler UserDeletedRow;
+
+ public event DataGridViewRowCancelEventHandler UserDeletingRow;
+
+ public new event EventHandler StyleChanged;
+
+ public new event EventHandler TextChanged;
+
+ public virtual DataGridViewAdvancedBorderStyle AdjustColumnHeaderBorderStyle (DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStyleInput, DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStylePlaceholder, bool isFirstDisplayedColumn, bool isLastVisibleColumn) {
+ return (DataGridViewAdvancedBorderStyle) dataGridViewAdvancedBorderStyleInput.Clone();
+ }
+
+ public bool AreAllCellsSelected (bool includeInvisibleCells) {
+ foreach (DataGridViewRow row in rows) {
+ foreach (DataGridViewCell cell in row.Cells) {
+ if (includeInvisibleCells == false && cell.Visible == false) {
+ continue;
+ }
+ if (!cell.Selected) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ public void AutoResizeColumn (int columnIndex) {
+ throw new NotImplementedException();
+ }
+
+ public void AutoResizeColumn (int columnIndex, DataGridViewAutoSizeColumnMode autoSizeColumnMode) {
+ throw new NotImplementedException();
+ }
+
+ public void AutoResizeColumnHeadersHeight () {
+ throw new NotImplementedException();
+ }
+
+ public void AutoResizeColumnHeadersHeight (int columnIndex) {
+ throw new NotImplementedException();
+ }
+
+ public void AutoResizeColumns () {
+ throw new NotImplementedException();
+ }
+
+ public void AutoResizeColumns (DataGridViewAutoSizeColumnsMode autoSizeColumnsMode) {
+ throw new NotImplementedException();
+ }
+
+ public void AutoResizeRow (int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ public void AutoResizeRow (int rowIndex, DataGridViewAutoSizeRowMode autoSizeRowMode) {
+ throw new NotImplementedException();
+ }
+
+ public void AutoResizeRowHeadersWidth (DataGridViewRowHeadersWidthSizeMode rowHeadersWidthSizeMode) {
+ throw new NotImplementedException();
+ }
+
+ public void AutoResizeRowHeadersWidth (int rowIndex, DataGridViewRowHeadersWidthSizeMode rowHeadersWidthSizeMode) {
+ throw new NotImplementedException();
+ }
+
+ public void AutoResizeRows () {
+ throw new NotImplementedException();
+ }
+
+ public void AutoResizeRows (DataGridViewAutoSizeRowsMode autoSizeRowsMode) {
+ if (!Enum.IsDefined(typeof(DataGridViewAutoSizeRowsMode), autoSizeRowsMode)) {
+ throw new InvalidEnumArgumentException("Parameter AutoSizeRowsMode is not valid DataGridViewRowsMode.");
+ }
+ if ((autoSizeRowsMode == DataGridViewAutoSizeRowsMode.AllHeaders || autoSizeRowsMode == DataGridViewAutoSizeRowsMode.DisplayedHeaders) && rowHeadersVisible == false) {
+ throw new InvalidOperationException("Parameter AutoSizeRowsMode cant be AllHeaders or DisplayedHeaders in this DataGridView.");
+ }
+ if (autoSizeRowsMode == DataGridViewAutoSizeRowsMode.None) {
+ throw new ArgumentException("Parameter AutoSieRowsMode cant be None.");
+ }
+ }
+
+ public virtual bool BeginEdit (bool selectAll) {
+ throw new NotImplementedException();
+ }
+
+ public bool CancelEdit () {
+ throw new NotImplementedException();
+ }
+
+ public void ClearSelection () {
+ foreach (DataGridViewCell cell in SelectedCells) {
+ cell.Selected = false;
+ }
+ }
+
+ public bool CommitEdit (DataGridViewDataErrorContexts context) {
+ throw new NotImplementedException();
+ }
+
+ public int DisplayedColumnCount (bool includePartialColumns) {
+ /////////////////////// PartialColumns?
+ int result = 0;
+ foreach (DataGridViewColumn col in columns) {
+ if (col.Visible) {
+ result++;
+ }
+ }
+ return result;
+ }
+
+ public int DisplayedRowCount (bool includePartialRow) {
+ /////////////////////// PartialRows?
+ int result = 0;
+ foreach (DataGridViewRow row in rows) {
+ if (row.Visible) {
+ result++;
+ }
+ }
+ return result;
+ }
+
+ public bool EndEdit () {
+ throw new NotImplementedException();
+ }
+
+ public bool EndEdit (DataGridViewDataErrorContexts context) {
+ throw new NotImplementedException();
+ }
+
+ public int GetCellCount (DataGridViewElementStates includeFilter) {
+ int result = 0;
+ foreach (DataGridViewRow row in rows) {
+ foreach (DataGridViewCell cell in row.Cells) {
+ if ((cell.State & includeFilter) != 0) {
+ result++;
+ }
+ }
+ }
+ return result;
+ }
+
+ public Rectangle GetCellDisplayRectangle (int columnIndex, int rowIndex, bool cutOverflow) {
+ if (columnIndex < 0 || columnIndex >= columns.Count) {
+ throw new ArgumentOutOfRangeException("Column index is out of range.");
+ }
+ throw new NotImplementedException();
+ }
+
+ public virtual DataObject GetClipboardContent () {
+ throw new NotImplementedException();
+ }
+
+ public Rectangle GetColumnDisplayRectangle (int columnIndex, bool cutOverflow) {
+ throw new NotImplementedException();
+ }
+
+ public Rectangle GetRowDisplayRectangle (int rowIndex, bool cutOverflow) {
+ throw new NotImplementedException();
+ }
+
+ public HitTestInfo HitTest (int x, int y) {
+ ///////////////////////////////////////////////////////
+ x += horizontalScrollingOffset;
+ y += verticalScrollingOffset;
+ int rowIndex = -1;
+ int totalHeight = (columnHeadersVisible)? 1 + columnHeadersHeight : 1;
+ if (columnHeadersVisible && y <= totalHeight) {
+ rowIndex = -1;
+ }
+ else {
+ foreach (DataGridViewRow row in rows.RowIndexSortedArrayList) {
+ totalHeight += row.Height;
+ if (y <= totalHeight) {
+ rowIndex = row.Index;
+ break;
+ }
+ totalHeight++; // sumar el ancho de las lineas...
+ }
+ }
+ int colIndex = -1;
+ int totalWidth = (rowHeadersVisible)? 1 + rowHeadersWidth : 1;
+ if (rowHeadersVisible && x <= totalWidth) {
+ colIndex = -1;
+ }
+ else {
+ foreach (DataGridViewColumn col in columns.ColumnDisplayIndexSortedArrayList) {
+ totalWidth += col.Width;
+ if (x <= totalWidth) {
+ colIndex = col.Index;
+ break;
+ }
+ totalWidth++;
+ }
+ }
+ HitTestInfo result = new HitTestInfo(colIndex, x, rowIndex, y, (colIndex >= 0 && rowIndex >= 0)? DataGridViewHitTestType.Cell : DataGridViewHitTestType.None);
+ return result;
+ }
+
+ public void InvalidateCell (DataGridViewCell dataGridViewCell) {
+ if (dataGridViewCell == null) {
+ throw new ArgumentNullException("Cell is null");
+ }
+ if (dataGridViewCell.DataGridView != this) {
+ throw new ArgumentException("The specified cell does not belong to this DataGridView.");
+ }
+ throw new NotImplementedException();
+ }
+
+ public void InvalidateCell (int columnIndex, int rowIndex) {
+ if (columnIndex < 0 || columnIndex >= columns.Count) {
+ throw new ArgumentOutOfRangeException("Column index is out of range.");
+ }
+ if (rowIndex < 0 || rowIndex >= rows.Count) {
+ throw new ArgumentOutOfRangeException("Row index is out of range.");
+ }
+ foreach (DataGridViewRow row in rows) {
+ foreach (DataGridViewCell cell in row.Cells) {
+ if (cell.RowIndex == rowIndex && cell.ColumnIndex == columnIndex) {
+ InvalidateCell(cell); //// O al revés, que el otro llame a este !!!
+ return;
+ }
+ }
+ }
+ }
+
+ public void InvalidateColumn (int columnIndex) {
+ if (columnIndex < 0 || columnIndex >= columns.Count) {
+ throw new ArgumentOutOfRangeException("Column index is out of range.");
+ }
+ throw new NotImplementedException();
+ }
+
+ public void InvalidateRow (int rowIndex) {
+ if (rowIndex < 0 || rowIndex >= rows.Count) {
+ throw new ArgumentOutOfRangeException("Row index is out of range.");
+ }
+ throw new NotImplementedException();
+ }
+
+ public virtual void NotifyCurrentCellDirty (bool dirty) {
+ throw new NotImplementedException();
+ }
+
+ public bool RefreshEdit () {
+ throw new NotImplementedException();
+ }
+
+ public override void ResetText () {
+ throw new NotImplementedException();
+ }
+
+ public void SelectAll () {
+ switch (selectionMode) {
+ case DataGridViewSelectionMode.FullRowSelect:
+ foreach (DataGridViewRow row in rows) {
+ (row as DataGridViewBand).Selected = true;
+ }
+ break;
+ case DataGridViewSelectionMode.FullColumnSelect:
+ foreach (DataGridViewColumn col in columns) {
+ (col as DataGridViewBand).Selected = true;
+ }
+ break;
+ default:
+ foreach (DataGridViewRow row in rows) {
+ foreach (DataGridViewCell cell in row.Cells) {
+ cell.Selected = true;
+ }
+ }
+ break;
+ }
+ }
+
+ public virtual void Sort (IComparer comparer) {
+ throw new NotImplementedException();
+ }
+
+ public virtual void Sort (DataGridViewColumn dataGridViewColumn, ListSortDirection direction) {
+ throw new NotImplementedException();
+ }
+
+ public void UpdateCellErrorText (int columnIndex, int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ public void UpdateRowErrorText (int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ public void UpdateRowErrorText (int rowIndexStart, int rowIndexEnd) {
+ throw new NotImplementedException();
+ }
+
+ public void UpdateRowHeightInfo (int rowIndex, bool updateToEnd) {
+ throw new NotImplementedException();
+ }
+
+ protected override Size DefaultSize {
+ get { return defaultSize; }
+ }
+
+ protected ScrollBar HorizontalScrollBar {
+ get { return horizontalScrollBar; }
+ }
+
+ protected ScrollBar VerticalScrollBar {
+ get { return verticalScrollBar; }
+ }
+
+ protected void AutoResizeColumn (int columnIndex, DataGridViewAutoSizeColumnMode autoSizeColumnMode, bool fixedHeight) {
+ throw new NotImplementedException();
+ }
+
+ protected void AutoResizeColumnHeadersHeight (bool fixedRowHeadersWidth, bool fixedColumnsWidth) {
+ throw new NotImplementedException();
+ }
+
+ protected void AutoResizeColumnHeadersHeight (int columnIndex, bool fixedRowHeadersWidth, bool fixedColumnWidth) {
+ throw new NotImplementedException();
+ }
+
+ protected void AutoResizeColumns (DataGridViewAutoSizeColumnsMode autoSizeColumnsMode, bool fixedHeight) {
+ throw new NotImplementedException();
+ }
+
+ protected void AutoResizeRow (int rowIndex, DataGridViewAutoSizeRowMode autoSizeRowMode, bool fixedWidth) {
+ throw new NotImplementedException();
+ }
+
+ protected void AutoResizeRowHeadersWidth (DataGridViewRowHeadersWidthSizeMode rowHeadersWidthSizeMode, bool fixedColumnHeadersHeight, bool fixedRowsHeight) {
+ throw new NotImplementedException();
+ }
+
+ protected void AutoResizeRowHeadersWidth (int rowIndex, DataGridViewRowHeadersWidthSizeMode rowHeadersWidthSizeMode, bool fixedColumnHeadersHeight, bool fixedRowHeight) {
+ throw new NotImplementedException();
+ }
+
+ protected void AutoResizeRows (DataGridViewAutoSizeRowsMode autoSizeRowsMode, bool fixedWidth) {
+ throw new NotImplementedException();
+ }
+
+ protected void AutoResizeRows (int rowIndexStart, int rowsCount, DataGridViewAutoSizeRowMode autoSizeRowMode, bool fixedWidth) {
+ throw new NotImplementedException();
+ }
+
+ protected void ClearSelection (int columnIndexException, int rowIndexException, bool selectExceptionElement) {
+ if (columnIndexException >= columns.Count) {
+ throw new ArgumentOutOfRangeException("ColumnIndexException is greater than the highest column index.");
+ }
+ if (selectionMode == DataGridViewSelectionMode.FullRowSelect) {
+ if (columnIndexException < -1) {
+ throw new ArgumentOutOfRangeException("ColumnIndexException is less than -1.");
+ }
+ }
+ else {
+ if (columnIndexException < 0) {
+ throw new ArgumentOutOfRangeException("ColumnIndexException is less than 0.");
+ }
+ }
+ if (rowIndexException >= rows.Count) {
+ throw new ArgumentOutOfRangeException("RowIndexException is greater than the highest row index.");
+ }
+ if (selectionMode == DataGridViewSelectionMode.FullColumnSelect) {
+ if (rowIndexException < -1) {
+ throw new ArgumentOutOfRangeException("RowIndexException is less than -1.");
+ }
+ }
+ else {
+ if (rowIndexException < 0) {
+ throw new ArgumentOutOfRangeException("RowIndexException is less than 0.");
+ }
+ }
+ switch (selectionMode) {
+ case DataGridViewSelectionMode.FullRowSelect:
+ foreach (DataGridViewRow row in rows) {
+ if (selectExceptionElement && row.Index == rowIndexException) {
+ continue;
+ }
+ row.Selected = false;
+ }
+ break;
+ case DataGridViewSelectionMode.FullColumnSelect:
+ foreach (DataGridViewColumn col in columns) {
+ if (selectExceptionElement && col.Index == columnIndexException) {
+ continue;
+ }
+ col.Selected = false;
+ }
+ break;
+ default:
+ foreach (DataGridViewCell cell in SelectedCells) {
+ if (selectExceptionElement && cell.RowIndex == rowIndexException && cell.ColumnIndex == columnIndexException) {
+ continue;
+ }
+ cell.Selected = false;
+ }
+ break;
+ }
+ }
+
+ protected override AccessibleObject CreateAccessibilityInstance () {
+ return new DataGridViewAccessibleObject(this);
+ }
+
+ protected virtual DataGridViewColumnCollection CreateColumnsInstance () {
+ return new DataGridViewColumnCollection(this);
+ }
+
+ protected override Control.ControlCollection CreateControlsInstance () {
+ return base.CreateControlsInstance(); //new Control.ControlCollection(this);
+ }
+
+ protected virtual DataGridViewRowCollection CreateRowsInstance () {
+ return new DataGridViewRowCollection(this);
+ }
+
+ protected override void Dispose (bool disposing) {
+ }
+
+ //protected override AccessibleObject GetAccessibilityObjectById (int objectId) {
+ protected AccessibleObject GetAccessibilityObjectById (int objectId) {
+ throw new NotImplementedException();
+ }
+
+ protected override bool IsInputChar (char charCode) {
+ return base.IsInputChar(charCode);
+ //throw new NotImplementedException();
+ }
+
+ protected override bool IsInputKey (Keys keyData) {
+ return base.IsInputKey(keyData);
+ //throw new NotImplementedException();
+ }
+
+ protected virtual void OnAllowUserToAddRowsChanged (EventArgs e) {
+ if (AllowUserToAddRowsChanged != null) {
+ AllowUserToAddRowsChanged(this, e);
+ }
+ }
+
+ protected virtual void OnAllowUserToDeleteRowsChanged (EventArgs e) {
+ if (AllowUserToDeleteRowsChanged != null) {
+ AllowUserToDeleteRowsChanged(this, e);
+ }
+ }
+
+ protected virtual void OnAllowUserToOrderColumnsChanged (EventArgs e) {
+ if (AllowUserToOrderColumnsChanged != null) {
+ AllowUserToOrderColumnsChanged(this, e);
+ }
+ }
+
+ protected virtual void OnAllowUserToResizeColumnsChanged (EventArgs e) {
+ if (AllowUserToResizeColumnsChanged != null) {
+ AllowUserToResizeColumnsChanged(this, e);
+ }
+ }
+
+ protected virtual void OnAllowUserToResizeRowsChanged (EventArgs e) {
+ if (AllowUserToResizeRowsChanged != null) {
+ AllowUserToResizeRowsChanged(this, e);
+ }
+ }
+
+ protected virtual void OnAlternatingRowsDefaultCellStyleChanged (EventArgs e) {
+ if (AlternatingRowsDefaultCellStyleChanged != null) {
+ AlternatingRowsDefaultCellStyleChanged(this, e);
+ }
+ }
+
+ protected virtual void OnAutoGenerateColumnsChanged (EventArgs e) {
+ if (AutoGenerateColumnsChanged != null) {
+ AutoGenerateColumnsChanged(this, e);
+ }
+ }
+
+ protected virtual void OnAutoSizeColumnModeChanged (DataGridViewAutoSizeColumnModeEventArgs e) {
+ if (AutoSizeColumnModeChanged != null) {
+ AutoSizeColumnModeChanged(this, e);
+ }
+ }
+
+ protected virtual void OnAutoSizeColumnsModeChanged (DataGridViewAutoSizeColumnsModeEventArgs e) {
+ if (AutoSizeColumnsModeChanged != null) {
+ AutoSizeColumnsModeChanged(this, e);
+ }
+ }
+
+ protected virtual void OnAutoSizeRowsModeChanged (DataGridViewAutoSizeModeEventArgs e) {
+ if (AutoSizeRowsModeChanged != null) {
+ AutoSizeRowsModeChanged(this, e);
+ }
+ }
+
+ protected virtual void OnBackgroundColorChanged (EventArgs e) {
+ if (BackgroundColorChanged != null) {
+ BackgroundColorChanged(this, e);
+ }
+ }
+
+ protected override void OnBindingContextChanged (EventArgs e) {
+ base.OnBindingContextChanged(e);
+ }
+
+ protected virtual void OnBorderStyleChanged (EventArgs e) {
+ if (BorderStyleChanged != null) {
+ BorderStyleChanged(this, e);
+ }
+ }
+
+ protected virtual void OnCancelRowEdit (QuestionEventArgs e) {
+ if (CancelRowEdit != null) {
+ CancelRowEdit(this, e);
+ }
+ }
+
+ protected virtual void OnCellBeginEdit (DataGridViewCellCancelEventArgs e) {
+ if (CellBeginEdit != null) {
+ CellBeginEdit(this, e);
+ }
+ }
+
+ protected virtual void OnCellBorderStyleChanged (EventArgs e) {
+ if (CellBorderStyleChanged != null) {
+ CellBorderStyleChanged(this, e);
+ }
+ }
+
+ protected virtual void OnCellClick (DataGridViewCellEventArgs e) {
+ if (CellClick != null) {
+ CellClick(this, e);
+ }
+ }
+
+ protected virtual void OnCellContentClick (DataGridViewCellEventArgs e) {
+ if (CellContentClick != null) {
+ CellContentClick(this, e);
+ }
+ }
+
+ protected virtual void OnCellContentDoubleClick (DataGridViewCellEventArgs e) {
+ if (CellContentDoubleClick != null) {
+ CellContentDoubleClick(this, e);
+ }
+ }
+
+ protected virtual void OnCellContextMenuStripChanged (DataGridViewCellEventArgs e) {
+ if (CellContextMenuStripChanged != null) {
+ CellContextMenuStripChanged(this, e);
+ }
+ }
+
+ protected virtual void OnCellContextMenuStripNeeded (DataGridViewCellContextMenuStripNeededEventArgs e) {
+ if (CellContextMenuStripNeeded != null) {
+ CellContextMenuStripNeeded(this, e);
+ }
+ }
+
+ protected virtual void OnCellDoubleClick (DataGridViewCellEventArgs e) {
+ if (CellDoubleClick != null) {
+ CellDoubleClick(this, e);
+ }
+ }
+
+ protected virtual void OnCellEndEdit (DataGridViewCellEventArgs e) {
+ if (CellEndEdit != null) {
+ CellEndEdit(this, e);
+ }
+ }
+
+ protected virtual void OnCellEnter (DataGridViewCellEventArgs e) {
+ if (CellEnter != null) {
+ CellEnter(this, e);
+ }
+ }
+
+ // In MSDN2 documentation there's no internal here
+ protected internal virtual void OnCellErrorTextChanged (DataGridViewCellEventArgs e) {
+ if (CellErrorTextChanged != null) {
+ CellErrorTextChanged(this, e);
+ }
+ }
+
+ protected virtual void OnCellErrorTextNeeded (DataGridViewCellErrorTextNeededEventArgs e) {
+ if (CellErrorTextNeeded != null) {
+ CellErrorTextNeeded(this, e);
+ }
+ }
+
+ protected virtual void OnCellFormatting (DataGridViewCellFormattingEventArgs e) {
+ if (CellFormatting != null) {
+ CellFormatting(this, e);
+ }
+ }
+
+ protected virtual void OnCellLeave (DataGridViewCellEventArgs e) {
+ if (CellLeave != null) {
+ CellLeave(this, e);
+ }
+ }
+
+ protected virtual void OnCellMouseClick (DataGridViewCellMouseEventArgs e) {
+ if (CellMouseClick != null) {
+ CellMouseClick(this, e);
+ }
+ }
+
+ protected virtual void OnCellMouseDoubleClick (DataGridViewCellMouseEventArgs e) {
+ if (CellMouseDoubleClick != null) {
+ CellMouseDoubleClick(this, e);
+ }
+ }
+
+ protected virtual void OnCellMouseDown (DataGridViewCellMouseEventArgs e) {
+ if (CellMouseDown != null) {
+ CellMouseDown(this, e);
+ }
+ }
+
+ protected virtual void OnCellMouseEnter (DataGridViewCellEventArgs e) {
+ if (CellMouseEnter != null) {
+ CellMouseEnter(this, e);
+ }
+ }
+
+ protected virtual void OnCellMouseLeave (DataGridViewCellEventArgs e) {
+ if (CellMouseLeave != null) {
+ CellMouseLeave(this, e);
+ }
+ }
+
+ protected virtual void OnCellMouseMove (DataGridViewCellMouseEventArgs e) {
+ if (CellMouseMove != null) {
+ CellMouseMove(this, e);
+ }
+ }
+
+ protected virtual void OnCellMouseUp (DataGridViewCellMouseEventArgs e) {
+ if (CellMouseUp != null) {
+ CellMouseUp(this, e);
+ }
+ }
+
+ protected virtual void OnCellPainting (DataGridViewCellPaintingEventArgs e) {
+ if (CellPainting != null) {
+ CellPainting(this, e);
+ }
+ }
+
+ protected internal virtual void OnCellParsing (DataGridViewCellParsingEventArgs e) {
+ if (CellParsing != null) {
+ CellParsing(this, e);
+ }
+ }
+
+ protected virtual void OnCellStateChanged (DataGridViewCellStateChangedEventArgs e) {
+ if (CellStateChanged != null) {
+ CellStateChanged(this, e);
+ }
+ }
+
+ protected virtual void OnCellStyleChanged (DataGridViewCellEventArgs e) {
+ if (CellStyleChanged != null) {
+ CellStyleChanged(this, e);
+ }
+ }
+
+ protected virtual void OnCellStyleContentChanged (DataGridViewCellStyleContentChangedEventArgs e) {
+ if (CellStyleContentChanged != null) {
+ CellStyleContentChanged(this, e);
+ }
+ }
+
+ protected virtual void OnCellToolTipTextChanged (DataGridViewCellEventArgs e) {
+ if (CellToolTipTextChanged != null) {
+ CellToolTipTextChanged(this, e);
+ }
+ }
+
+ protected virtual void OnCellToolTipTextNeeded (DataGridViewCellToolTipTextNeededEventArgs e) {
+ if (CellToolTipTextNeeded != null) {
+ CellToolTipTextNeeded(this, e);
+ }
+ }
+
+ protected virtual void OnCellValidated (DataGridViewCellEventArgs e) {
+ if (CellValidated != null) {
+ CellValidated(this, e);
+ }
+ }
+
+ protected virtual void OnCellValidating (DataGridViewCellValidatingEventArgs e) {
+ if (CellValidating != null) {
+ CellValidating(this, e);
+ }
+ }
+
+ protected virtual void OnCellValueChanged (DataGridViewCellEventArgs e) {
+ if (CellValueChanged != null) {
+ CellValueChanged(this, e);
+ }
+ }
+
+ protected virtual void OnCellValueNeeded (DataGridViewCellValueEventArgs e) {
+ if (CellValueNeeded != null) {
+ CellValueNeeded(this, e);
+ }
+ }
+
+ protected virtual void OnCellValuePushed (DataGridViewCellValueEventArgs e) {
+ if (CellValuePushed != null) {
+ CellValuePushed(this, e);
+ }
+ }
+
+ protected virtual void OnColumnAdded (DataGridViewColumnEventArgs e) {
+ if (ColumnAdded != null) {
+ ColumnAdded(this, e);
+ }
+ }
+
+ // In MSDN2 documentation there's no internal here
+ protected internal virtual void OnColumnContextMenuStripChanged (DataGridViewColumnEventArgs e) {
+ if (ColumnContextMenuStripChanged != null) {
+ ColumnContextMenuStripChanged(this, e);
+ }
+ }
+
+ // In MSDN2 documentation there's no internal here
+ protected internal virtual void OnColumnDataPropertyNameChanged (DataGridViewColumnEventArgs e) {
+ if (ColumnDataPropertyNameChanged != null) {
+ ColumnDataPropertyNameChanged(this, e);
+ }
+ }
+
+ // In MSDN2 documentation there's no internal here
+ protected internal virtual void OnColumnDefaultCellStyleChanged (DataGridViewColumnEventArgs e) {
+ if (ColumnDefaultCellStyleChanged != null) {
+ ColumnDefaultCellStyleChanged(this, e);
+ }
+ }
+
+ // In MSDN2 documentation there's no internal here
+ protected internal virtual void OnColumnDisplayIndexChanged (DataGridViewColumnEventArgs e) {
+ if (ColumnDisplayIndexChanged != null) {
+ ColumnDisplayIndexChanged(this, e);
+ }
+ }
+
+ protected virtual void OnColumnDividerDoubleClick (DataGridViewColumnDividerDoubleClickEventArgs e) {
+ if (ColumnDividerDoubleClick != null) {
+ ColumnDividerDoubleClick(this, e);
+ }
+ }
+
+ // In MSDN2 documentation there's no internal here
+ protected internal virtual void OnColumnDividerWidthChanged (DataGridViewColumnEventArgs e) {
+ if (ColumnDividerWidthChanged != null) {
+ ColumnDividerWidthChanged(this, e);
+ }
+ }
+
+ // In MSDN2 documentation there's no internal here
+ protected internal virtual void OnColumnHeaderCellChanged (DataGridViewColumnEventArgs e) {
+ if (ColumnHeaderCellChanged != null) {
+ ColumnHeaderCellChanged(this, e);
+ }
+ }
+
+ protected virtual void OnColumnHeaderMouseClick (DataGridViewCellMouseEventArgs e) {
+ if (ColumnHeaderMouseClick != null) {
+ ColumnHeaderMouseClick(this, e);
+ }
+ }
+
+ protected virtual void OnColumnHeaderMouseDoubleClick (DataGridViewCellMouseEventArgs e) {
+ if (ColumnHeaderMouseDoubleClick != null) {
+ ColumnHeaderMouseDoubleClick(this, e);
+ }
+ }
+
+ protected virtual void OnColumnHeadersBorderStyleChanged (EventArgs e) {
+ if (ColumnHeadersBorderStyleChanged != null) {
+ ColumnHeadersBorderStyleChanged(this, e);
+ }
+ }
+
+ protected virtual void OnColumnHeadersDefaultCellStyleChanged (EventArgs e) {
+ if (ColumnHeadersDefaultCellStyleChanged != null) {
+ ColumnHeadersDefaultCellStyleChanged(this, e);
+ }
+ }
+
+ protected virtual void OnColumnHeadersHeightChanged (EventArgs e) {
+ if (ColumnHeadersHeightChanged != null) {
+ ColumnHeadersHeightChanged(this, e);
+ }
+ }
+
+ protected virtual void OnColumnHeadersHeightSizeModeChanged (DataGridViewAutoSizeModeEventArgs e) {
+ if (ColumnHeadersHeightSizeModeChanged != null) {
+ ColumnHeadersHeightSizeModeChanged(this, e);
+ }
+ }
+
+ // In MSDN2 documentation there's no internal here
+ protected internal virtual void OnColumnMinimumWidthChanged (DataGridViewColumnEventArgs e) {
+ if (ColumnMinimumWidthChanged != null) {
+ ColumnMinimumWidthChanged(this, e);
+ }
+ }
+
+ // In MSDN2 documentation there's no internal here
+ protected internal virtual void OnColumnNameChanged (DataGridViewColumnEventArgs e) {
+ if (ColumnNameChanged != null) {
+ ColumnNameChanged(this, e);
+ }
+ }
+
+ protected virtual void OnColumnRemoved (DataGridViewColumnEventArgs e) {
+ if (ColumnRemoved != null) {
+ ColumnRemoved(this, e);
+ }
+ }
+
+ // In MSDN2 documentation there's no internal here
+ protected internal virtual void OnColumnSortModeChanged (DataGridViewColumnEventArgs e) {
+ if (ColumnSortModeChanged != null) {
+ ColumnSortModeChanged(this, e);
+ }
+ }
+
+ // In MSDN2 documentation there's no internal here
+ protected internal virtual void OnColumnStateChanged (DataGridViewColumnStateChangedEventArgs e) {
+ if (ColumnStateChanged != null) {
+ ColumnStateChanged(this, e);
+ }
+ }
+
+ // In MSDN2 documentation there's no internal here
+ protected internal virtual void OnColumnToolTipTextChanged (DataGridViewColumnEventArgs e) {
+ if (ColumnToolTipTextChanged != null) {
+ ColumnToolTipTextChanged(this, e);
+ }
+ }
+
+ // In MSDN2 documentation there's no internal here
+ protected internal virtual void OnColumnWidthChanged (DataGridViewColumnEventArgs e) {
+ if (ColumnWidthChanged != null) {
+ ColumnWidthChanged(this, e);
+ }
+ }
+
+ protected virtual void OnCurrentCellChanged (EventArgs e) {
+ if (CurrentCellChanged != null) {
+ CurrentCellChanged(this, e);
+ }
+ }
+
+ protected virtual void OnCurrentCellDirtyStateChanged (EventArgs e) {
+ if (CurrentCellDirtyStateChanged != null) {
+ CurrentCellDirtyStateChanged(this, e);
+ }
+ }
+
+ protected virtual void OnDataBindingComplete (DataGridViewBindingCompleteEventArgs e) {
+ if (DataBindingComplete != null) {
+ DataBindingComplete(this, e);
+ }
+ }
+
+ protected virtual void OnDataError (bool displayErrorDialogIfNoHandler, DataGridViewDataErrorEventArgs e) {
+ if (DataError != null) {
+ DataError(this, e);
+ }
+ else {
+ if (displayErrorDialogIfNoHandler) {
+ /////////////////////////////////// ERROR DIALOG //////////////////////////////////7
+ }
+ }
+ }
+ protected virtual void OnDataMemberChanged (EventArgs e) {
+ if (DataMemberChanged != null) {
+ DataMemberChanged(this, e);
+ }
+ }
+
+ protected virtual void OnDataSourceChanged (EventArgs e) {
+ if (DataSourceChanged != null) {
+ DataSourceChanged(this, e);
+ }
+ }
+
+ protected virtual void OnDefaultCellStyleChanged (EventArgs e) {
+ if (DefaultCellStyleChanged != null) {
+ DefaultCellStyleChanged(this, e);
+ }
+ }
+
+ protected virtual void OnDefaultValuesNeeded (DataGridViewRowEventArgs e) {
+ if (DefaultValuesNeeded != null) {
+ DefaultValuesNeeded(this, e);
+ }
+ }
+
+ protected override void OnDoubleClick (EventArgs e) {
+ base.OnDoubleClick(e);
+ }
+
+ protected virtual void OnEditingControlShowing (DataGridViewEditingControlShowingEventArgs e) {
+ if (EditingControlShowing != null) {
+ EditingControlShowing(this, e);
+ }
+ }
+
+ protected virtual void OnEditModeChanged (EventArgs e) {
+ if (EditModeChanged != null) {
+ EditModeChanged(this, e);
+ }
+ }
+
+ protected override void OnEnabledChanged (EventArgs e) {
+ base.OnEnabledChanged(e);
+ }
+
+ protected override void OnEnter (EventArgs e ) {
+ base.OnEnter(e);
+ }
+
+ protected override void OnFontChanged (EventArgs e) {
+ base.OnFontChanged(e);
+ if (FontChanged != null) {
+ FontChanged(this, e);
+ }
+ }
+
+ protected override void OnForeColorChanged (EventArgs e) {
+ base.OnForeColorChanged(e);
+ if (ForeColorChanged != null) {
+ ForeColorChanged(this, e);
+ }
+ }
+
+ protected virtual void OnGridColorChanged (EventArgs e) {
+ if (GridColorChanged != null) {
+ GridColorChanged(this, e);
+ }
+ }
+
+ protected override void OnHandleCreated (EventArgs e) {
+ base.OnHandleCreated(e);
+ }
+
+ protected override void OnKeyDown (KeyEventArgs e) {
+ base.OnKeyDown(e);
+ }
+
+ protected override void OnKeyPress (KeyPressEventArgs e) {
+ base.OnKeyPress(e);
+ }
+
+ protected override void OnKeyUp (KeyEventArgs e) {
+ base.OnKeyUp(e);
+ }
+
+ protected override void OnLayout (LayoutEventArgs e) {
+ base.OnLayout(e);
+ }
+
+ protected override void OnLeave (EventArgs e) {
+ base.OnLeave(e);
+ }
+
+ //protected override void OnMouseClick (MouseEventArgs e) {
+ protected void OnMouseClick (MouseEventArgs e) {
+ //base.OnMouseClick(e);
+ //Console.WriteLine("Mouse: Clicks: {0}; Delta: {1}; X: {2}; Y: {3};", e.Clicks, e.Delta, e.X, e.Y);
+ }
+
+ //protected override void OnMouseDoubleClick (MouseEventArgs e) {
+ protected void OnMouseDoubleClick (MouseEventArgs e) {
+ //base.OnMouseDoubleClick(e);
+ }
+
+ protected override void OnMouseDown (MouseEventArgs e) {
+ base.OnMouseDown(e);
+ //Console.WriteLine("Mouse: Clicks: {0}; Delta: {1}; X: {2}; Y: {3};", e.Clicks, e.Delta, e.X, e.Y);
+ HitTestInfo hitTest = HitTest(e.X, e.Y);
+ //Console.WriteLine("HitTest: Column: {0}; Row: {1};", hitTest.ColumnIndex, hitTest.RowIndex);
+ if (hitTest.RowIndex < 0 || hitTest.ColumnIndex < 0) {
+ return;
+ }
+ OnCellClick(new DataGridViewCellEventArgs(hitTest.ColumnIndex, hitTest.RowIndex));
+ DataGridViewRow row = rows[hitTest.RowIndex];
+ DataGridViewCell cell = row.Cells[hitTest.ColumnIndex];
+ ClearSelection(0, 0, false);
+ switch (selectionMode) {
+ case DataGridViewSelectionMode.FullRowSelect:
+ row.Selected = true;
+ break;
+ case DataGridViewSelectionMode.FullColumnSelect:
+ //////////////////
+ break;
+ default:
+ cell.Selected = true;
+ break;
+ }
+ if (cell == currentCell) {
+ currentCell.SetIsInEditMode(true);
+ OnCellBeginEdit(new DataGridViewCellCancelEventArgs(currentCell.ColumnIndex, currentCell.RowIndex));
+ Invalidate();
+ return;
+ }
+ if (currentCell != null) {
+ if (currentCell.IsInEditMode) {
+ currentCell.SetIsInEditMode(false);
+ currentCell.DetachEditingControl();
+ OnCellEndEdit(new DataGridViewCellEventArgs(currentCell.ColumnIndex, currentCell.RowIndex));
+ }
+ OnCellLeave(new DataGridViewCellEventArgs(currentCell.ColumnIndex, currentCell.RowIndex));
+ }
+ currentCell = cell;
+ OnCurrentCellChanged(EventArgs.Empty);
+ OnCellEnter(new DataGridViewCellEventArgs(cell.ColumnIndex, cell.RowIndex));
+ if (editMode == DataGridViewEditMode.EditOnEnter) {
+ currentCell.SetIsInEditMode(true);
+ OnCellBeginEdit(new DataGridViewCellCancelEventArgs(currentCell.ColumnIndex, currentCell.RowIndex));
+ }
+ Invalidate();
+ return;
+ }
+
+ protected override void OnMouseEnter (EventArgs e) {
+ base.OnMouseEnter(e);
+ }
+
+ protected override void OnMouseLeave (EventArgs e) {
+ base.OnMouseLeave(e);
+ }
+
+ protected override void OnMouseMove (MouseEventArgs e) {
+ base.OnMouseMove(e);
+ }
+
+ protected override void OnMouseUp (MouseEventArgs e) {
+ base.OnMouseUp(e);
+ }
+
+ protected override void OnMouseWheel (MouseEventArgs e) {
+ base.OnMouseWheel(e);
+ }
+
+ protected virtual void OnMultiSelectChanged (EventArgs e) {
+ if (MultiSelectChanged != null) {
+ MultiSelectChanged(this, e);
+ }
+ }
+
+ protected virtual void OnNewRowNeeded (DataGridViewRowEventArgs e) {
+ if (NewRowNeeded != null) {
+ NewRowNeeded(this, e);
+ }
+ }
+
+ protected override void OnPaint (PaintEventArgs e) {
+ base.OnPaint(e);
+ Console.WriteLine(e.ClipRectangle);
+ Rectangle bounds = ClientRectangle; //e.ClipRectangle;
+ e.Graphics.FillRectangle(new SolidBrush(backgroundColor), bounds);
+ Pen pen = new Pen(gridColor);
+ pen.Width = 1;
+ int i = 0;
+ ArrayList sortedColumns = columns.ColumnDisplayIndexSortedArrayList;
+ bounds.Y = -verticalScrollingOffset;
+ bounds.X = -horizontalScrollingOffset;
+ gridWidth = 0;
+ foreach (DataGridViewColumn col in sortedColumns) {
+ gridWidth += col.Width;
+ }
+ if (columnHeadersVisible) {
+ Rectangle headerBounds = bounds;
+ if (rowHeadersVisible) {
+ headerBounds.X += rowHeadersWidth;
+ }
+ headerBounds.Height = columnHeadersHeight;
+ int j = 0;
+ foreach (DataGridViewColumn col in sortedColumns) {
+ headerBounds.Width = col.Width;
+ DataGridViewCell cell = col.HeaderCell;
+ DataGridViewCellStyle style = columnHeadersDefaultCellStyle;
+ DataGridViewAdvancedBorderStyle intermediateBorderStyle = (DataGridViewAdvancedBorderStyle) this.AdvancedColumnHeadersBorderStyle.Clone();;
+ DataGridViewAdvancedBorderStyle borderStyle = AdjustColumnHeaderBorderStyle(this.AdvancedColumnHeadersBorderStyle, intermediateBorderStyle, j == 0, j == columns.Count - 1);
+ cell.InternalPaint(e.Graphics, e.ClipRectangle, headerBounds, cell.RowIndex, cell.State, cell.Value, cell.FormattedValue, cell.ErrorText, style, borderStyle, DataGridViewPaintParts.All);
+ headerBounds.X += col.Width;
+ j++;
+ }
+ bounds.Y += columnHeadersHeight;
+ }
+ gridHeight = 0;
+ foreach (DataGridViewRow row in rows) {
+ gridHeight += row.Height;
+ if (rowHeadersVisible) {
+ Rectangle rowHeaderBounds = bounds;
+ rowHeaderBounds.Height = row.Height;
+ rowHeaderBounds.Width = rowHeadersWidth;
+ DataGridViewCell cell = row.HeaderCell;
+ DataGridViewCellStyle style = rowHeadersDefaultCellStyle;
+ DataGridViewAdvancedBorderStyle intermediateBorderStyle = (DataGridViewAdvancedBorderStyle) this.AdvancedRowHeadersBorderStyle.Clone();;
+ DataGridViewAdvancedBorderStyle borderStyle = cell.AdjustCellBorderStyle(this.AdvancedRowHeadersBorderStyle, intermediateBorderStyle, true, true, false, cell.RowIndex == 0);
+ cell.InternalPaint(e.Graphics, e.ClipRectangle, rowHeaderBounds, cell.RowIndex, cell.State, cell.Value, cell.FormattedValue, cell.ErrorText, style, borderStyle, DataGridViewPaintParts.All);
+ //e.Graphics.FillRectangle(new SolidBrush(rowHeadersDefaultCellStyle.BackColor), rowHeadersBounds);
+ bounds.X += rowHeadersWidth;
+ }
+ bounds.Height = row.Height;
+ for (int j = 0; j < sortedColumns.Count; j++) {
+ DataGridViewColumn col = (DataGridViewColumn) sortedColumns[j];
+ foreach (DataGridViewCell cell in row.Cells) {
+ if (cell.ColumnIndex == col.Index) {
+ bounds.Width = col.Width;
+ cell.SetSize(new Size(bounds.Width, bounds.Height));
+ DataGridViewCellStyle style = cell.InheritedStyle;
+ if (cell == currentCell && cell.IsInEditMode) {
+ cell.InitializeEditingControl(cell.RowIndex, cell.FormattedValue, style);
+ cell.PositionEditingControl(true, true, bounds, e.ClipRectangle, style, false, false, (columns[currentCell.ColumnIndex].DisplayIndex == 0), (currentCell.RowIndex == 0));
+ }
+ else {
+ DataGridViewAdvancedBorderStyle intermediateBorderStyle = (DataGridViewAdvancedBorderStyle) this.AdvancedCellBorderStyle.Clone();;
+ DataGridViewAdvancedBorderStyle borderStyle = cell.AdjustCellBorderStyle(this.AdvancedCellBorderStyle, intermediateBorderStyle, true, true, j == 0, cell.RowIndex == 0);
+ OnCellFormatting(new DataGridViewCellFormattingEventArgs(cell.ColumnIndex, cell.RowIndex, cell.Value, cell.FormattedValueType, style));
+ DataGridViewCellPaintingEventArgs args = new DataGridViewCellPaintingEventArgs (this, e.Graphics, e.ClipRectangle, bounds, cell.RowIndex, cell.ColumnIndex, cell.State, cell.Value, cell.FormattedValue, cell.ErrorText, style, borderStyle, DataGridViewPaintParts.All);
+ OnCellPainting(args);
+ if (!args.Handled) {
+ cell.InternalPaint(e.Graphics, e.ClipRectangle, bounds, cell.RowIndex, cell.State, cell.Value, cell.FormattedValue, cell.ErrorText, style, borderStyle, DataGridViewPaintParts.All);
+ }
+ }
+ bounds.X += bounds.Width;
+ }
+ }
+ }
+ bounds.Y += bounds.Height;
+ bounds.X = -horizontalScrollingOffset;
+ i++;
+ }
+ if (rowHeadersVisible) {
+ gridWidth += rowHeadersWidth;
+ }
+ if (columnHeadersVisible) {
+ gridHeight += columnHeadersHeight;
+ }
+ horizontalScrollBar.Visible = false;
+ verticalScrollBar.Visible = false;
+ if (AutoSize) {
+ if (gridWidth > Size.Width || gridHeight > Size.Height) {
+ Size = new Size(gridWidth, gridHeight);
+ }
+ }
+ else {
+ if (gridWidth > Size.Width) {
+ horizontalScrollBar.Visible = true;
+ }
+ if (gridHeight > Size.Height) {
+ verticalScrollBar.Visible = true;
+ }
+ if (horizontalScrollBar.Visible && (gridHeight + horizontalScrollBar.Height) > Size.Height) {
+ verticalScrollBar.Visible = true;
+ }
+ if (verticalScrollBar.Visible && (gridWidth + horizontalScrollBar.Width) > Size.Width) {
+ horizontalScrollBar.Visible = true;
+ }
+ if (horizontalScrollBar.Visible) {
+ horizontalScrollBar.Minimum = 0;
+ if (verticalScrollBar.Visible) {
+ horizontalScrollBar.Maximum = gridWidth - ClientRectangle.Width + verticalScrollBar.Width;
+ }
+ else {
+ horizontalScrollBar.Maximum = gridWidth - ClientRectangle.Width;
+ }
+ horizontalScrollBar.LargeChange = horizontalScrollBar.Maximum / 10;
+ horizontalScrollBar.SmallChange = horizontalScrollBar.Maximum / 20;
+ }
+ if (verticalScrollBar.Visible) {
+ verticalScrollBar.Minimum = 0;
+ if (horizontalScrollBar.Visible) {
+ verticalScrollBar.Maximum = gridHeight - ClientRectangle.Height + horizontalScrollBar.Height;
+ }
+ else {
+ verticalScrollBar.Maximum = gridHeight - ClientRectangle.Height;
+ }
+ verticalScrollBar.LargeChange = verticalScrollBar.Maximum / 10;
+ verticalScrollBar.SmallChange = verticalScrollBar.Maximum / 20;
+ }
+ }
+ if (horizontalScrollBar.Visible && !this.Controls.Contains(horizontalScrollBar)) {
+ this.Controls.Add(horizontalScrollBar);
+ }
+ else if (!horizontalScrollBar.Visible && this.Controls.Contains(horizontalScrollBar)) {
+ this.Controls.Remove(horizontalScrollBar);
+ }
+ if (verticalScrollBar.Visible && !this.Controls.Contains(verticalScrollBar)) {
+ this.Controls.Add(verticalScrollBar);
+ }
+ else if (!verticalScrollBar.Visible && this.Controls.Contains(verticalScrollBar)) {
+ this.Controls.Remove(verticalScrollBar);
+ }
+ }
+
+ protected virtual void OnReadOnlyChanged (EventArgs e) {
+ if (ReadOnlyChanged != null) {
+ ReadOnlyChanged(this, e);
+ }
+ }
+
+ protected override void OnResize (EventArgs e) {
+ base.OnResize(e);
+ horizontalScrollingOffset = ((gridWidth - Size.Width) > 0)? (gridWidth - Size.Width) : 0;
+ verticalScrollingOffset = ((gridHeight - Size.Height) > 0)? (gridHeight - Size.Height) : 0;
+
+ }
+
+ protected override void OnRightToLeftChanged (EventArgs e) {
+ base.OnRightToLeftChanged(e);
+ }
+
+ // In MSDN2 documentation there's no internal here
+ protected internal virtual void OnRowContextMenuStripChanged (DataGridViewRowEventArgs e) {
+ if (RowContextMenuStripChanged != null) {
+ RowContextMenuStripChanged(this, e);
+ }
+ }
+
+ protected virtual void OnRowContextMenuStripNeeded (DataGridViewRowContextMenuStripNeededEventArgs e) {
+ if (RowContextMenuStripNeeded != null) {
+ RowContextMenuStripNeeded(this, e);
+ }
+ }
+
+ // In MSDN2 documentation there's no internal here
+ protected internal virtual void OnRowDefaultCellStyleChanged (DataGridViewRowEventArgs e) {
+ if (RowDefaultCellStyleChanged != null) {
+ RowDefaultCellStyleChanged(this, e);
+ }
+ }
+
+ protected virtual void OnRowDirtyStateNeeded (QuestionEventArgs e) {
+ if (RowDirtyStateNeeded != null) {
+ RowDirtyStateNeeded(this, e);
+ }
+ }
+
+ protected virtual void OnRowDividerDoubleClick (DataGridViewRowDividerDoubleClickEventArgs e) {
+ if (RowDividerDoubleClick != null) {
+ RowDividerDoubleClick(this, e);
+ }
+ }
+
+ protected virtual void OnRowDividerHeightChanged (DataGridViewRowEventArgs e) {
+ if (RowDividerHeightChanged != null) {
+ RowDividerHeightChanged(this, e);
+ }
+ }
+
+ protected virtual void OnRowEnter (DataGridViewCellEventArgs e) {
+ if (RowEnter != null) {
+ RowEnter(this, e);
+ }
+ }
+
+ // In MSDN2 documentation there's no internal here
+ protected internal virtual void OnRowErrorTextChanged (DataGridViewRowEventArgs e) {
+ if (RowErrorTextChanged != null) {
+ RowErrorTextChanged(this, e);
+ }
+ }
+
+ protected virtual void OnRowErrorTextNeeded (DataGridViewRowErrorTextNeededEventArgs e) {
+ if (RowErrorTextNeeded != null) {
+ RowErrorTextNeeded(this, e);
+ }
+ }
+
+ // In MSDN2 documentation there's no internal here
+ protected internal virtual void OnRowHeaderCellChanged (DataGridViewRowEventArgs e) {
+ if (RowHeaderCellChanged != null) {
+ RowHeaderCellChanged(this, e);
+ }
+ }
+
+ protected virtual void OnRowHeaderMouseClick (DataGridViewCellMouseEventArgs e) {
+ if (RowHeaderMouseClick != null) {
+ RowHeaderMouseClick(this, e);
+ }
+ }
+
+ protected virtual void OnRowHeaderMouseDoubleClick (DataGridViewCellMouseEventArgs e) {
+ if (RowHeaderMouseDoubleClick != null) {
+ RowHeaderMouseDoubleClick(this, e);
+ }
+ }
+
+ protected virtual void OnRowHeadersBorderStyleChanged (EventArgs e) {
+ if (RowHeadersBorderStyleChanged != null) {
+ RowHeadersBorderStyleChanged(this, e);
+ }
+ }
+
+ protected virtual void OnRowHeadersDefaultCellStyleChanged (EventArgs e) {
+ if (RowHeadersDefaultCellStyleChanged != null) {
+ RowHeadersDefaultCellStyleChanged(this, e);
+ }
+ }
+
+ protected virtual void OnRowHeadersWidthChanged (EventArgs e) {
+ if (RowHeadersWidthChanged != null) {
+ RowHeadersWidthChanged(this, e);
+ }
+ }
+
+ protected virtual void OnRowHeadersWidthSizeModeChanged (DataGridViewAutoSizeModeEventArgs e) {
+ if (RowHeadersWidthSizeModeChanged != null) {
+ RowHeadersWidthSizeModeChanged(this, e);
+ }
+ }
+
+ // In MSDN2 documentation there's no internal here
+ protected internal virtual void OnRowHeightChanged (DataGridViewRowEventArgs e) {
+ if (RowHeightChanged != null) {
+ RowHeightChanged(this, e);
+ }
+ }
+
+ protected virtual void OnRowHeightInfoNeeded (DataGridViewRowHeightInfoNeededEventArgs e) {
+ if (RowHeightInfoNeeded != null) {
+ RowHeightInfoNeeded(this, e);
+ }
+ }
+
+ protected virtual void OnRowHeightInfoPushed (DataGridViewRowHeightInfoPushedEventArgs e) {
+ if (RowHeightInfoPushed != null) {
+ RowHeightInfoPushed(this, e);
+ }
+ }
+
+ protected virtual void OnRowLeave (DataGridViewCellEventArgs e) {
+ if (RowLeave != null) {
+ RowLeave(this, e);
+ }
+ }
+
+ // In MSDN2 documentation there's no internal here
+ protected internal virtual void OnRowMinimumHeightChanged (DataGridViewRowEventArgs e) {
+ if (RowMinimumHeightChanged != null) {
+ RowMinimumHeightChanged(this, e);
+ }
+ }
+
+ protected internal virtual void OnRowPostPaint (DataGridViewRowPostPaintEventArgs e) {
+ if (RowPostPaint != null) {
+ RowPostPaint(this, e);
+ }
+ }
+
+ protected internal virtual void OnRowPrePaint (DataGridViewRowPrePaintEventArgs e) {
+ if (RowPrePaint != null) {
+ RowPrePaint(this, e);
+ }
+ }
+
+ // In MSDN2 documentation there's no internal here
+ protected internal virtual void OnRowsAdded (DataGridViewRowsAddedEventArgs e) {
+ if (RowsAdded != null) {
+ RowsAdded(this, e);
+ }
+ }
+
+ protected virtual void OnRowsDefaultCellStyleChanged (EventArgs e) {
+ if (RowsDefaultCellStyleChanged != null) {
+ RowsDefaultCellStyleChanged(this, e);
+ }
+ }
+
+ // In MSDN2 documentation there's no internal here
+ protected internal virtual void OnRowsRemoved (DataGridViewRowsRemovedEventArgs e) {
+ if (RowsRemoved != null) {
+ RowsRemoved(this, e);
+ }
+ }
+
+ // In MSDN2 documentation there's no internal here
+ protected internal virtual void OnRowStateChanged (int rowIndex, DataGridViewRowStateChangedEventArgs e) {
+ if (RowStateChanged != null) {
+ RowStateChanged(this, e);
+ }
+ }
+
+ protected virtual void OnRowUnshared (DataGridViewRowEventArgs e) {
+ if (RowUnshared != null) {
+ RowUnshared(this, e);
+ }
+ }
+
+ protected virtual void OnRowValidated (DataGridViewCellEventArgs e) {
+ if (RowValidated != null) {
+ RowValidated(this, e);
+ }
+ }
+
+ protected virtual void OnRowValidating (DataGridViewCellCancelEventArgs e) {
+ if (RowValidating != null) {
+ RowValidating(this, e);
+ }
+ }
+
+ protected virtual void OnScroll (ScrollEventArgs e) {
+ if (Scroll != null) {
+ Scroll(this, e);
+ }
+ }
+
+ protected virtual void OnSelectionChanged (EventArgs e) {
+ if (SelectionChanged != null) {
+ SelectionChanged(this, e);
+ }
+ }
+
+ protected virtual void OnSortCompare (DataGridViewSortCompareEventArgs e) {
+ if (SortCompare != null) {
+ SortCompare(this, e);
+ }
+ }
+
+ protected virtual void OnSorted (EventArgs e) {
+ if (Sorted != null) {
+ Sorted(this, e);
+ }
+ }
+
+ protected virtual void OnUserAddedRow (DataGridViewRowEventArgs e) {
+ if (UserAddedRow != null) {
+ UserAddedRow(this, e);
+ }
+ }
+
+ protected virtual void OnUserDeletedRow (DataGridViewRowEventArgs e) {
+ if (UserDeletedRow != null) {
+ UserDeletedRow(this, e);
+ }
+ }
+
+ protected virtual void OnUserDeletingRow (DataGridViewRowCancelEventArgs e) {
+ if (UserDeletingRow != null) {
+ UserDeletingRow(this, e);
+ }
+ }
+
+ protected override void OnValidating (CancelEventArgs e) {
+ base.OnValidating(e);
+ }
+
+ protected override void OnVisibleChanged (EventArgs e) {
+ base.OnVisibleChanged(e);
+ }
+
+ protected virtual void PaintBackground (Graphics graphics, Rectangle clipBounds, Rectangle gridBounds) {
+ }
+
+ protected bool ProcessAKey (Keys keyData) {
+ throw new NotImplementedException();
+ }
+
+ protected bool ProcessDataGridViewKey (KeyEventArgs e) {
+ throw new NotImplementedException();
+ }
+
+ protected bool ProcessDeleteKey (Keys keyData) {
+ throw new NotImplementedException();
+ }
+
+ protected override bool ProcessDialogKey (Keys keyData) {
+ return base.ProcessDialogKey(keyData);
+ //throw new NotImplementedException();
+ }
+
+ protected bool ProcessDownKey (Keys keyData) {
+ throw new NotImplementedException();
+ }
+
+ protected bool ProcessEndKey (Keys keyData) {
+ throw new NotImplementedException();
+ }
+
+ protected bool ProcessEnterKey (Keys keyData) {
+ throw new NotImplementedException();
+ }
+
+ protected bool ProcessEscapeKey (Keys keyData) {
+ throw new NotImplementedException();
+ }
+
+ protected bool ProcessF2Key (Keys keyData) {
+ throw new NotImplementedException();
+ }
+
+ protected bool ProcessHomeKey (Keys keyData) {
+ throw new NotImplementedException();
+ }
+
+ protected bool ProcessInsertKey (Keys keyData) {
+ throw new NotImplementedException();
+ }
+
+ protected override bool ProcessKeyEventArgs (ref Message m) {
+ return base.ProcessKeyEventArgs(ref m);
+ //throw new NotImplementedException();
+ }
+
+ protected override bool ProcessKeyPreview (ref Message m) {
+ return base.ProcessKeyPreview(ref m);
+ //throw new NotImplementedException();
+ }
+
+ protected bool ProcessLeftKey (Keys keyData) {
+ throw new NotImplementedException();
+ }
+
+ protected bool ProcessNextKey (Keys keyData) {
+ // PAGE DOWN
+ throw new NotImplementedException();
+ }
+
+ protected bool ProcessPriorKey (Keys keyData) {
+ // PAGE UP
+ throw new NotImplementedException();
+ }
+
+ protected bool ProcessRightKey (Keys keyData) {
+ throw new NotImplementedException();
+ }
+
+ protected bool ProcessSpaceKey (Keys keyData) {
+ throw new NotImplementedException();
+ }
+
+ protected bool ProcessTabKey (Keys keyData) {
+ throw new NotImplementedException();
+ }
+
+ protected bool ProcessUpKey (Keys keyData) {
+ throw new NotImplementedException();
+ }
+
+ protected bool ProcessZeroKey (Keys keyData) {
+ throw new NotImplementedException();
+ }
+
+ protected override void SetBoundsCore (int x, int y, int width, int height, BoundsSpecified specified) {
+ base.SetBoundsCore(x, y, width, height, specified);
+ }
+
+ protected virtual bool SetCurrentCellAddressCore (int columnIndex, int rowIndex, bool setAnchorCellAddress, bool validateCurrentCell, bool throughMouseClick) {
+ throw new NotImplementedException();
+ }
+
+ protected virtual void SetSelectedCellCore (int columnIndex, int rowIndex, bool selected) {
+ throw new NotImplementedException();
+ }
+
+ protected virtual void SetSelectedColumnCore (int columnIndex, bool selected) {
+ throw new NotImplementedException();
+ }
+
+ protected virtual void SetSelectedRowCore (int rowIndex, bool selected) {
+ throw new NotImplementedException();
+ }
+
+ protected override void WndProc (ref Message m) {
+ base.WndProc(ref m);
+ }
+
+ internal void InternalOnCellClick (DataGridViewCellEventArgs e) {
+ OnCellClick(e);
+ }
+
+ internal void InternalOnCellContentClick (DataGridViewCellEventArgs e) {
+ OnCellContentClick(e);
+ }
+
+ internal void InternalOnCellContentDoubleClick (DataGridViewCellEventArgs e) {
+ OnCellContentDoubleClick(e);
+ }
+
+ internal void InternalOnCellValueChanged (DataGridViewCellEventArgs e) {
+ OnCellValueChanged(e);
+ }
+
+ internal void InternalOnDataError (DataGridViewDataErrorEventArgs e) {
+ /////////////// false? ////////////
+ OnDataError(false, e);
+ }
+
+ internal void InternalOnMouseWheel (MouseEventArgs e) {
+ OnMouseWheel(e);
+ }
+
+ internal void OnHScrollBarScroll (object sender, ScrollEventArgs e) {
+ horizontalScrollingOffset = e.NewValue;
+ Invalidate();
+ OnScroll(e);
+ }
+
+ internal void OnVScrollBarScroll (object sender, ScrollEventArgs e) {
+ verticalScrollingOffset = e.NewValue;
+ Invalidate();
+ OnScroll(e);
+ }
+
+ internal void RaiseCellStyleChanged (DataGridViewCellEventArgs e) {
+ OnCellStyleChanged(e);
+ }
+
+ internal void OnColumnCollectionChanged (object sender, CollectionChangeEventArgs e) {
+ switch (e.Action) {
+ case CollectionChangeAction.Add:
+ OnColumnAdded(new DataGridViewColumnEventArgs(e.Element as DataGridViewColumn));
+ break;
+ case CollectionChangeAction.Remove:
+ OnColumnRemoved(new DataGridViewColumnEventArgs(e.Element as DataGridViewColumn));
+ break;
+ case CollectionChangeAction.Refresh:
+ break;
+ }
+ }
+
+ private void BindIList (IList list) {
+ if (list.Count > 0) {
+ DataGridViewCell template = new DataGridViewTextBoxCell();
+ foreach (PropertyDescriptor property in TypeDescriptor.GetProperties(list[0])) {
+ DataGridViewColumn col = new DataGridViewColumn(template);
+ col.Name = property.DisplayName;
+ columns.Add(col);
+ }
+ }
+ foreach (object element in list) {
+ DataGridViewRow row = new DataGridViewRow();
+ rows.InternalAdd(row);
+ PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(element);
+ foreach (PropertyDescriptor property in properties) {
+ DataGridViewTextBoxCell cell = new DataGridViewTextBoxCell();
+ cell.Value = property.GetValue(element);
+ cell.ValueType = property.PropertyType;
+ row.Cells.Add(cell);
+ }
+ }
+ }
+
+ private void BindIListSource (IListSource list) {
+ BindIList(list.GetList());
+ }
+
+ private void BindIBindingList (IBindingList list) {
+ BindIList(list);
+ }
+
+ private void BindIBindingListView (IBindingListView list) {
+ BindIList(list);
+ }
+
+ public sealed class HitTestInfo {
+
+ public static readonly HitTestInfo Nowhere = new HitTestInfo(-1, -1, -1, -1, DataGridViewHitTestType.None);
+
+ private int columnIndex;
+ private int columnX;
+ private int rowIndex;
+ private int rowY;
+ private DataGridViewHitTestType type;
+
+ internal HitTestInfo (int columnIndex, int columnX, int rowIndex, int rowY, DataGridViewHitTestType type) {
+ this.columnIndex = columnIndex;
+ this.columnX = columnX;
+ this.rowIndex = rowIndex;
+ this.rowY = rowY;
+ this.type = type;
+ }
+
+ public int ColumnIndex {
+ get { return columnIndex; }
+ }
+
+ public int ColumnX {
+ get { return columnX; }
+ }
+
+ public int RowIndex {
+ get { return rowIndex; }
+ }
+
+ public int RowY {
+ get { return rowY; }
+ }
+
+ public DataGridViewHitTestType Type {
+ get { return type; }
+ }
+
+ public override bool Equals (object value) {
+ if (value is HitTestInfo) {
+ HitTestInfo aux = (HitTestInfo) value;
+ if (aux.columnIndex == columnIndex && aux.columnX == columnX && aux.rowIndex == rowIndex && aux.rowY == rowY && aux.type == type) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public override int GetHashCode () {
+ return base.GetHashCode();
+ }
+
+ public override string ToString () {
+ return GetType().Name;
+ }
+
+ }
+
+ [ComVisibleAttribute(true)]
+ protected class DataGridViewAccessibleObject : ControlAccessibleObject {
+
+ public DataGridViewAccessibleObject (DataGridView owner) : base (owner){
+ }
+
+ public override AccessibleRole Role {
+ get { return base.Role; }
+ }
+
+ public override AccessibleObject GetChild (int index) {
+ return base.GetChild(index);
+ }
+
+ public override int GetChildCount () {
+ return base.GetChildCount();
+ }
+
+ public override AccessibleObject GetFocused () {
+ return base.GetFocused();
+ }
+
+ public override AccessibleObject GetSelected () {
+ return base.GetSelected();
+ }
+
+ public override AccessibleObject HitTest (int x, int y) {
+ return base.HitTest(x, y);
+ }
+
+ public override AccessibleObject Navigate( AccessibleNavigation navigationDirection) {
+ return base.Navigate(navigationDirection);
+ }
+
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAdvancedBorderStyle.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAdvancedBorderStyle.cs
new file mode 100644
index 00000000000..4c926ba19ac
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAdvancedBorderStyle.cs
@@ -0,0 +1,154 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ public sealed class DataGridViewAdvancedBorderStyle : ICloneable {
+
+ private DataGridViewAdvancedCellBorderStyle bottom;
+ private DataGridViewAdvancedCellBorderStyle left;
+ private DataGridViewAdvancedCellBorderStyle right;
+ private DataGridViewAdvancedCellBorderStyle top;
+
+ public DataGridViewAdvancedBorderStyle () {
+ All = DataGridViewAdvancedCellBorderStyle.None;
+ }
+
+ public DataGridViewAdvancedCellBorderStyle All {
+ get {
+ if (bottom == left && left == right && right == top) {
+ return bottom;
+ }
+ return DataGridViewAdvancedCellBorderStyle.NotSet;
+ }
+ set {
+ if (!Enum.IsDefined(typeof(DataGridViewAdvancedCellBorderStyle), value)) {
+ throw new InvalidEnumArgumentException("Value is not valid DataGridViewAdvancedCellBorderStyle.");
+ }
+ bottom = left = right = top = value;
+ }
+ }
+
+ public DataGridViewAdvancedCellBorderStyle Bottom {
+ get { return bottom; }
+ set {
+ if (!Enum.IsDefined(typeof(DataGridViewAdvancedCellBorderStyle), value)) {
+ throw new InvalidEnumArgumentException("Value is not valid DataGridViewAdvancedCellBorderStyle.");
+ }
+ if (value == DataGridViewAdvancedCellBorderStyle.NotSet) {
+ throw new ArgumentException("Invlid Bottom value.");
+ }
+ bottom = value;
+ }
+ }
+
+ public DataGridViewAdvancedCellBorderStyle Left {
+ get { return left; }
+ set {
+ if (!Enum.IsDefined(typeof(DataGridViewAdvancedCellBorderStyle), value)) {
+ throw new InvalidEnumArgumentException("Value is not valid DataGridViewAdvancedCellBorderStyle.");
+ }
+ if (value == DataGridViewAdvancedCellBorderStyle.NotSet) {
+ throw new ArgumentException("Invlid Left value.");
+ }
+ /*
+ if (Control.RightToLeft == true && (value == DataGridViewAdvancedCellBorderStyle.InsetDouble || value == DataGridViewAdvancedCellBorderStyle.OutsetDouble)) {
+ throw new ArgumentException("Invlid Left value.");
+ }
+ */
+ left = value;
+ }
+ }
+
+ public DataGridViewAdvancedCellBorderStyle Right {
+ get { return right; }
+ set {
+ if (!Enum.IsDefined(typeof(DataGridViewAdvancedCellBorderStyle), value)) {
+ throw new InvalidEnumArgumentException("Value is not valid DataGridViewAdvancedCellBorderStyle.");
+ }
+ if (value == DataGridViewAdvancedCellBorderStyle.NotSet) {
+ throw new ArgumentException("Invlid Right value.");
+ }
+ /*
+ if (Control.RightToLeft == false && (value == DataGridViewAdvancedCellBorderStyle.InsetDouble || value == DataGridViewAdvancedCellBorderStyle.OutsetDouble)) {
+ throw new ArgumentException("Invlid Right value.");
+ }
+ */
+ right = value;
+ }
+ }
+
+ public DataGridViewAdvancedCellBorderStyle Top {
+ get { return top; }
+ set {
+ if (!Enum.IsDefined(typeof(DataGridViewAdvancedCellBorderStyle), value)) {
+ throw new InvalidEnumArgumentException("Value is not valid DataGridViewAdvancedCellBorderStyle.");
+ }
+ if (value == DataGridViewAdvancedCellBorderStyle.NotSet) {
+ throw new ArgumentException("Invlid Top value.");
+ }
+ top = value;
+ }
+ }
+
+ public override bool Equals (object other) {
+ if (other is DataGridViewAdvancedBorderStyle) {
+ DataGridViewAdvancedBorderStyle otherAux = (DataGridViewAdvancedBorderStyle) other;
+ return bottom == otherAux.bottom &&
+ left == otherAux.left &&
+ right == otherAux.right &&
+ top == otherAux.top;
+ }
+ return false;
+ }
+
+ public override int GetHashCode () {
+ return base.GetHashCode();
+ }
+
+ public override string ToString () {
+ return String.Format("DataGridViewAdvancedBorderStyle { All={0}, Left={1}, Right={2}, Top={3}, Bottom={4} }", All, Left, Right, Top, Bottom);
+ }
+
+ public object Clone () {
+ DataGridViewAdvancedBorderStyle result = new DataGridViewAdvancedBorderStyle();
+ result.bottom = this.bottom;
+ result.left = this.left;
+ result.right = this.right;
+ result.top = this.top;
+ return result;
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAdvancedCellBorderStyle.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAdvancedCellBorderStyle.cs
new file mode 100644
index 00000000000..80df6be7000
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAdvancedCellBorderStyle.cs
@@ -0,0 +1,43 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public enum DataGridViewAdvancedCellBorderStyle {
+ NotSet = 0,
+ None = 1,
+ Single = 2,
+ Inset = 3,
+ InsetDouble = 4,
+ Outset = 5,
+ OutsetDouble = 6,
+ OutsetPartial = 7
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeColumnMode.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeColumnMode.cs
new file mode 100644
index 00000000000..2317b1acdb6
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeColumnMode.cs
@@ -0,0 +1,44 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public enum DataGridViewAutoSizeColumnMode {
+ NotSet = 0,
+ None = 1,
+ ColumnHeader = 2,
+ AllCellsExceptHeader = 4,
+ AllCells = 6,
+ DisplayedCellsExceptHeader = 8,
+ DisplayedCells = 10,
+ Fill = 16
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeColumnModeEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeColumnModeEventArgs.cs
new file mode 100644
index 00000000000..f53b5648af6
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeColumnModeEventArgs.cs
@@ -0,0 +1,53 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewAutoSizeColumnModeEventArgs : EventArgs {
+
+ private DataGridViewColumn dataGridViewColumn;
+ private DataGridViewAutoSizeColumnMode previousMode;
+
+ public DataGridViewAutoSizeColumnModeEventArgs (DataGridViewColumn dataGridViewColumn, DataGridViewAutoSizeColumnMode previousMode) {
+ this.dataGridViewColumn = dataGridViewColumn;
+ this.previousMode = previousMode;
+ }
+
+ public DataGridViewColumn Column {
+ get { return dataGridViewColumn; }
+ }
+
+ public DataGridViewAutoSizeColumnMode PreviousMode {
+ get { return previousMode; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeColumnModeEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeColumnModeEventHandler.cs
new file mode 100644
index 00000000000..4dace6a5858
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeColumnModeEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewAutoSizeColumnModeEventHandler (object sender, DataGridViewAutoSizeColumnModeEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeColumnsMode.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeColumnsMode.cs
new file mode 100644
index 00000000000..b36b34de0cc
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeColumnsMode.cs
@@ -0,0 +1,43 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public enum DataGridViewAutoSizeColumnsMode {
+ None = 1,
+ ColumnHeader = 2,
+ AllCellsExceptHeader = 4,
+ AllCells = 6,
+ DisplayedCellsExceptHeader = 8,
+ DisplayedCells = 10,
+ Fill = 16
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeColumnsModeEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeColumnsModeEventArgs.cs
new file mode 100644
index 00000000000..6742b3aa187
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeColumnsModeEventArgs.cs
@@ -0,0 +1,47 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewAutoSizeColumnsModeEventArgs : EventArgs {
+
+ private DataGridViewAutoSizeColumnMode[] previousModes;
+
+ public DataGridViewAutoSizeColumnsModeEventArgs (DataGridViewAutoSizeColumnMode[] previousModes) {
+ this.previousModes = previousModes;
+ }
+
+ public DataGridViewAutoSizeColumnMode[] PreviousModes {
+ get { return previousModes; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeColumnsModeEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeColumnsModeEventHandler.cs
new file mode 100644
index 00000000000..83229f27e2b
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeColumnsModeEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewAutoSizeColumnsModeEventHandler (object sender, DataGridViewAutoSizeColumnsModeEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeModeEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeModeEventArgs.cs
new file mode 100644
index 00000000000..88ce4d7b91e
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeModeEventArgs.cs
@@ -0,0 +1,47 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewAutoSizeModeEventArgs : EventArgs {
+
+ private bool previousModeAutoSized;
+
+ public DataGridViewAutoSizeModeEventArgs (bool previousModeAutoSized) {
+ this.previousModeAutoSized = previousModeAutoSized;
+ }
+
+ public bool PreviousModeAutoSized {
+ get { return previousModeAutoSized; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeModeEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeModeEventHandler.cs
new file mode 100644
index 00000000000..0e9e703ebfc
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeModeEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewAutoSizeModeEventHandler (object sender, DataGridViewAutoSizeModeEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeRowMode.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeRowMode.cs
new file mode 100644
index 00000000000..ad3667651ac
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeRowMode.cs
@@ -0,0 +1,39 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public enum DataGridViewAutoSizeRowMode {
+ RowHeader = 1,
+ AllCellsExceptHeader = 2,
+ AllCells = 3
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeRowsMode.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeRowsMode.cs
new file mode 100644
index 00000000000..7656a3c8f99
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewAutoSizeRowsMode.cs
@@ -0,0 +1,43 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public enum DataGridViewAutoSizeRowsMode {
+ None = 0,
+ AllHeaders = 5,
+ AllCellsExceptHeaders = 6,
+ AllCells = 7,
+ DisplayedHeaders = 9,
+ DisplayedCellsExceptHeaders = 10,
+ DisplayedCells = 11
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewBand.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewBand.cs
new file mode 100644
index 00000000000..b65e61559d9
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewBand.cs
@@ -0,0 +1,164 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewBand : DataGridViewElement, ICloneable, IDisposable {
+
+ // private ContextMenuStrip contextMenuStrip = null;
+ private DataGridViewCellStyle defaultCellStyle;
+ private Type defaultHeaderCellType;
+ private bool displayed;
+ private bool frozen = false;
+ private int index = -1;
+ private bool readOnly = false;
+ private DataGridViewTriState resizable = DataGridViewTriState.True;
+ private bool selected = false;
+ private object tag = null;
+ private bool visible = true;
+ private DataGridViewHeaderCell headerCellCore;
+ private bool isRow;
+ private DataGridViewCellStyle inheritedStyle = null;
+
+ ~DataGridViewBand () {
+ Dispose();
+ }
+
+ /*
+ public virtual ContextMenuStrip ContextMenuStrip {get; set;}
+ */
+
+ public virtual DataGridViewCellStyle DefaultCellStyle {
+ get {
+ if (defaultCellStyle == null) {
+ defaultCellStyle = new DataGridViewCellStyle();
+ }
+ return defaultCellStyle;
+ }
+ set { defaultCellStyle = value; }
+ }
+
+ public Type DefaultHeaderCellType {
+ get { return defaultHeaderCellType; }
+ set {
+ if (value.IsSubclassOf(typeof(DataGridViewHeaderCell))) {
+ throw new ArgumentException("Type is not DataGridViewHeaderCell or a derived type.");
+ }
+ defaultHeaderCellType = value;
+ }
+ }
+
+ public virtual bool Displayed {
+ get { return displayed; }
+ }
+
+ public virtual bool Frozen {
+ get { return frozen; }
+ set { frozen = value; }
+ }
+
+ public bool HasDefaultCellStyle {
+ get { return (defaultCellStyle != null); }
+ }
+
+ public int Index {
+ get { return index; }
+ }
+
+ public virtual DataGridViewCellStyle InheritedStyle {
+ get { return inheritedStyle; }
+ }
+
+ public virtual bool ReadOnly {
+ get { return readOnly; }
+ set { readOnly = value; }
+ }
+
+ public virtual DataGridViewTriState Resizable {
+ get { return resizable; }
+ set { resizable = value; }
+ }
+
+ public virtual bool Selected {
+ get { return selected; }
+ set {
+ if (DataGridView == null) {
+ throw new InvalidOperationException("Cant select a row non associated with a DataGridView.");
+ }
+ selected = value;
+ }
+ }
+
+ public object Tag {
+ get { return tag; }
+ set { tag = value; }
+ }
+
+ public virtual bool Visible {
+ get { return visible; }
+ set { visible = value; }
+ }
+
+ public virtual object Clone () {
+ DataGridViewBand result = new DataGridViewBand();
+ //////////////////////////////
+ return result;
+ }
+
+ //public sealed void Dispose () {
+ public void Dispose () {
+ }
+
+ public override string ToString () {
+ return this.GetType().Name + ": " + index.ToString() + ".";
+ }
+
+ protected DataGridViewHeaderCell HeaderCellCore {
+ get { return headerCellCore; }
+ set { headerCellCore = value; }
+ }
+
+ protected bool IsRow {
+ get { return isRow; }
+ }
+
+ protected virtual void Dispose (bool disposing) {
+ }
+
+ protected override void OnDataGridViewChanged () {
+ }
+
+ internal virtual void SetIndex (int index) {
+ this.index = index;
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewBindingCompleteEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewBindingCompleteEventArgs.cs
new file mode 100644
index 00000000000..74eca197157
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewBindingCompleteEventArgs.cs
@@ -0,0 +1,49 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewBindingCompleteEventArgs : EventArgs {
+
+ private ListChangedType listChangedType;
+
+ public DataGridViewBindingCompleteEventArgs (ListChangedType listChangedType) {
+ this.listChangedType = listChangedType;
+ }
+
+ public ListChangedType ListChangedType {
+ get { return listChangedType; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewBindingCompleteEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewBindingCompleteEventHandler.cs
new file mode 100644
index 00000000000..09784515740
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewBindingCompleteEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewBindingCompleteEventHandler (object sender, DataGridViewBindingCompleteEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewButtonCell.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewButtonCell.cs
new file mode 100644
index 00000000000..f786ac3a6e0
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewButtonCell.cs
@@ -0,0 +1,199 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+#if NET_2_0
+
+using System.Drawing;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewButtonCell : DataGridViewCell {
+
+ private FlatStyle flatStyle;
+ private bool useColumnTextForButtonValue;
+
+ public DataGridViewButtonCell () {
+ useColumnTextForButtonValue = false;
+ }
+
+ public override Type EditType {
+ get { return null; }
+ }
+
+ public FlatStyle FlatStyle {
+ get { return flatStyle; }
+ set {
+ if (!Enum.IsDefined(typeof(FlatStyle), value)) {
+ throw new InvalidEnumArgumentException("Value is not valid FlatStyle.");
+ }
+ if (value == FlatStyle.Popup) {
+ throw new Exception("FlatStyle cannot be set to Popup in this control.");
+ }
+ }
+ }
+
+ public override Type FormattedValueType {
+ get { return base.FormattedValueType; }
+ }
+
+ public bool UseColumnTextForButtonValue {
+ get { return useColumnTextForButtonValue; }
+ set { useColumnTextForButtonValue = value; }
+ }
+
+ public override Type ValueType {
+ get { return base.ValueType; }
+ }
+
+ public override object Clone () {
+ DataGridViewButtonCell result = (DataGridViewButtonCell) base.Clone();
+ result.flatStyle = this.flatStyle;
+ result.useColumnTextForButtonValue = this.useColumnTextForButtonValue;
+ return result;
+ }
+
+ public override string ToString () {
+ return GetType().Name + ": RowIndex: " + RowIndex.ToString() + "; ColumnIndex: " + ColumnIndex.ToString() + ";";
+ }
+
+ protected override AccessibleObject CreateAccessibilityInstance () {
+ return new DataGridViewButtonCellAccessibleObject(this);
+ }
+
+ protected override Rectangle GetContentBounds (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected override Rectangle GetErrorIconBounds (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected override Size GetPreferredSize (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex, Size constraintSize) {
+ throw new NotImplementedException();
+ }
+
+ protected override object GetValue (int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected override bool KeyDownUnsharesRow (KeyEventArgs e, int rowIndex) {
+ // true if the user pressed the SPACE key without modifier keys; otherwise, false
+ throw new NotImplementedException();
+ }
+
+ protected override bool KeyUpUnsharesRow (KeyEventArgs e, int rowIndex) {
+ // true if the user released the SPACE key; otherwise false
+ throw new NotImplementedException();
+
+ }
+
+ protected override bool MouseDownUnsharesRow (DataGridViewCellMouseEventArgs e) {
+ return (e.Button == MouseButtons.Left);
+ }
+
+ protected override bool MouseEnterUnsharesRow (int rowIndex) {
+ // true if the cell was the last cell receiving a mouse click; otherwise, false.
+ throw new NotImplementedException();
+ }
+
+ protected override bool MouseLeaveUnsharesRow (int rowIndex) {
+ // true if the button displayed by the cell is in the pressed state; otherwise, false.
+ throw new NotImplementedException();
+ }
+
+ protected override bool MouseUpUnsharesRow (DataGridViewCellMouseEventArgs e) {
+ // true if the mouse up was caused by the release of the left mouse button; otherwise false.
+ throw new NotImplementedException();
+ }
+
+ protected override void OnKeyDown (KeyEventArgs e, int rowIndex) {
+ // when activated by the SPACE key, this method updates the cell's user interface
+ throw new NotImplementedException();
+ }
+
+ protected override void OnKeyUp (KeyEventArgs e, int rowIndex) {
+ // when activated by the SPACE key, this method updates the cell's user interface
+ throw new NotImplementedException();
+ }
+
+ protected override void OnLeave (int rowIndex, bool throughMouseClick) {
+ throw new NotImplementedException();
+ }
+
+ protected override void OnMouseDown (DataGridViewCellMouseEventArgs e) {
+ // if activated by depresing the left mouse button, this method updates the cell's user interface
+ throw new NotImplementedException();
+ }
+
+ protected override void OnMouseEnter (int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected override void OnMouseLeave (int rowIndex) {
+ // if the cell's button is not in its normal state, this method causes the cell's user interface to be updated.
+ throw new NotImplementedException();
+ }
+
+ protected override void OnMouseUp (DataGridViewCellMouseEventArgs e) {
+ // if activated by the left mouse button, this method updates the cell's user interface
+ throw new NotImplementedException();
+ }
+
+ protected override void Paint (Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) {
+ throw new NotImplementedException();
+ }
+
+ protected class DataGridViewButtonCellAccessibleObject : DataGridViewCellAccessibleObject {
+
+ public DataGridViewButtonCellAccessibleObject (DataGridViewCell owner) : base(owner) {
+ }
+
+ public override string DefaultAction {
+ get {
+ if (Owner.ReadOnly) {
+ return "Press";
+ }
+ else {
+ return "";
+ }
+ }
+ }
+
+ public override void DoDefaultAction () {
+ // causes the button in the ButtonCell to be clicked
+ }
+
+ public override int GetChildCount () {
+ return -1;
+ }
+
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewButtonColumn.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewButtonColumn.cs
new file mode 100644
index 00000000000..cce58ec1af2
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewButtonColumn.cs
@@ -0,0 +1,92 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewButtonColumn : DataGridViewColumn {
+
+ private FlatStyle flatStyle;
+ private string text;
+
+ public DataGridViewButtonColumn () {
+ base.CellTemplate = new DataGridViewButtonCell();
+ flatStyle = FlatStyle.Standard;
+ text = String.Empty;
+ }
+
+ public override DataGridViewCell CellTemplate {
+ get { return base.CellTemplate; }
+ set { base.CellTemplate = value as DataGridViewButtonCell; }
+ }
+
+ public override DataGridViewCellStyle DefaultCellStyle {
+ get { return base.DefaultCellStyle; }
+ set { base.DefaultCellStyle = value; }
+ }
+
+ public FlatStyle FlatStyle {
+ get { return flatStyle; }
+ set { flatStyle = value; }
+ }
+
+ public string Text {
+ get { return text; }
+ set { text = value; }
+ }
+
+ public bool UseColumnTextForButtonValue {
+ get {
+ if (base.CellTemplate == null) {
+ throw new InvalidOperationException("CellTemplate is null when getting this property.");
+ }
+ return (base.CellTemplate as DataGridViewButtonCell).UseColumnTextForButtonValue;
+ }
+ set {
+ if (base.CellTemplate == null) {
+ throw new InvalidOperationException("CellTemplate is null when setting this property.");
+ }
+ (base.CellTemplate as DataGridViewButtonCell).UseColumnTextForButtonValue = value;
+ }
+ }
+
+ public override object Clone () {
+ DataGridViewButtonColumn col = (DataGridViewButtonColumn) base.Clone();
+ col.flatStyle = this.flatStyle;
+ col.text = this.text;
+ return col;
+ }
+
+ public override string ToString () {
+ throw new NotImplementedException();
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCell.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCell.cs
new file mode 100644
index 00000000000..24fd6a4bd02
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCell.cs
@@ -0,0 +1,1074 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System;
+using System.Drawing;
+using System.ComponentModel;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+
+ public abstract class DataGridViewCell : DataGridViewElement, ICloneable, IDisposable {
+
+ private DataGridView dataGridViewOwner;
+
+ private AccessibleObject accessibilityObject;
+ private int columnIndex;
+ private Rectangle contentBounds;
+ // private ContextMenuStrip contextMenuStrip;
+ private object defaultNewRowValue;
+ private bool displayed;
+ private object editedFormattedValue;
+ private Type editType;
+ private Rectangle errorIconBounds;
+ private string errorText;
+ private Type formattedValueType;
+ private bool frozen;
+ private DataGridViewElementStates inheritedState;
+ private bool isInEditMode;
+ private DataGridViewColumn owningColumn;
+ private DataGridViewRow owningRow;
+ private Size preferredSize;
+ private bool readOnly;
+ private bool resizable;
+ private bool selected;
+ private Size size;
+ private DataGridViewCellStyle style;
+ private object tag;
+ private string toolTipText;
+ private object valuex;
+ private Type valueType;
+ private bool visible;
+
+ protected DataGridViewCell () {
+ columnIndex = -1;
+ }
+
+ ~DataGridViewCell () {
+ Dispose(false);
+ }
+
+ public AccessibleObject AccessibilityObject {
+ get {
+ if (accessibilityObject == null) {
+ accessibilityObject = CreateAccessibilityInstance();
+ }
+ return accessibilityObject;
+ }
+ }
+
+ public int ColumnIndex {
+ get { return columnIndex; }
+ }
+
+ public Rectangle ContentBounds {
+ get { return contentBounds; }
+ }
+
+ /*
+ public virtual ContextMenuStrip ContextMenuStrip {
+ get { return contextMenuStrip; }
+ set { contextMenuStrip = value; }
+ }
+ */
+
+ public virtual object DefaultNewRowValue {
+ get { return defaultNewRowValue; }
+ }
+
+ public virtual bool Displayed {
+ get { return displayed; }
+ }
+
+ public object EditedFormattedValue {
+ get { return editedFormattedValue; }
+ }
+
+ public virtual Type EditType {
+ get { return editType; }
+ }
+
+ public Rectangle ErrorIconBounds {
+ get { return errorIconBounds; }
+ }
+
+ public string ErrorText {
+ get { return errorText; }
+ set {
+ if (errorText != value) {
+ errorText = value;
+ OnErrorTextChanged(new DataGridViewCellEventArgs(ColumnIndex, RowIndex));
+ }
+ }
+ }
+
+ public object FormattedValue {
+ get {
+ DataGridViewCellStyle style = InheritedStyle;
+ if (style.Format != String.Empty && FormattedValueType == typeof(string)) {
+ return String.Format("{0:" + style.Format + "}", Value);
+ }
+ return Convert.ChangeType(Value, FormattedValueType, style.FormatProvider);
+ }
+ }
+
+ public virtual Type FormattedValueType {
+ get { return formattedValueType; }
+ }
+
+ public virtual bool Frozen {
+ get { return frozen; }
+ }
+
+ public bool HasStyle {
+ get { return style != null; }
+ }
+
+ public DataGridViewElementStates InheritedState {
+ get { return inheritedState; }
+ }
+
+ public DataGridViewCellStyle InheritedStyle {
+ get {
+ DataGridViewCellStyle result = new DataGridViewCellStyle();
+ if (style != null && style.Alignment != DataGridViewContentAlignment.NotSet) {
+ result.Alignment = style.Alignment;
+ }
+ else if (OwningRow != null && OwningRow.DefaultCellStyle.Alignment != DataGridViewContentAlignment.NotSet) {
+ result.Alignment = OwningRow.DefaultCellStyle.Alignment;
+ }
+ else if (DataGridView != null) {
+ if ((RowIndex % 2) == 1 && DataGridView.AlternatingRowsDefaultCellStyle.Alignment != DataGridViewContentAlignment.NotSet) {
+ result.Alignment = DataGridView.AlternatingRowsDefaultCellStyle.Alignment;
+ }
+ else if (DataGridView.RowsDefaultCellStyle.Alignment != DataGridViewContentAlignment.NotSet) {
+ result.Alignment = DataGridView.RowsDefaultCellStyle.Alignment;
+ }
+ else if (ColumnIndex >= 0 && DataGridView.Columns[ColumnIndex].DefaultCellStyle.Alignment != DataGridViewContentAlignment.NotSet) {
+ result.Alignment = DataGridView.Columns[ColumnIndex].DefaultCellStyle.Alignment;
+ }
+ else {
+ result.Alignment = DataGridView.DefaultCellStyle.Alignment;
+ }
+ }
+ if (style != null && style.BackColor != Color.Empty) {
+ result.BackColor = style.BackColor;
+ }
+ else if (OwningRow != null && OwningRow.DefaultCellStyle.BackColor != Color.Empty) {
+ result.BackColor = OwningRow.DefaultCellStyle.BackColor;
+ }
+ else if (DataGridView != null) {
+ if ((RowIndex % 2) == 1 && DataGridView.AlternatingRowsDefaultCellStyle.BackColor != Color.Empty) {
+ result.BackColor = DataGridView.AlternatingRowsDefaultCellStyle.BackColor;
+ }
+ else if (DataGridView.RowsDefaultCellStyle.BackColor != Color.Empty) {
+ result.BackColor = DataGridView.RowsDefaultCellStyle.BackColor;
+ }
+ else if (ColumnIndex >= 0 && DataGridView.Columns[ColumnIndex].DefaultCellStyle.BackColor != Color.Empty) {
+ result.BackColor = DataGridView.Columns[ColumnIndex].DefaultCellStyle.BackColor;
+ }
+ else {
+ result.BackColor = DataGridView.DefaultCellStyle.BackColor;
+ }
+ }
+ if (style != null && style.Font != null) {
+ result.Font = style.Font;
+ }
+ else if (OwningRow != null && OwningRow.DefaultCellStyle.Font != null) {
+ result.Font = OwningRow.DefaultCellStyle.Font;
+ }
+ else if (DataGridView != null) {
+ if ((RowIndex % 2) == 1 && DataGridView.AlternatingRowsDefaultCellStyle.Font != null) {
+ result.Font = DataGridView.AlternatingRowsDefaultCellStyle.Font;
+ }
+ else if (DataGridView.RowsDefaultCellStyle.Font != null) {
+ result.Font = DataGridView.RowsDefaultCellStyle.Font;
+ }
+ else if (ColumnIndex >= 0 && DataGridView.Columns[ColumnIndex].DefaultCellStyle.Font != null) {
+ result.Font = DataGridView.Columns[ColumnIndex].DefaultCellStyle.Font;
+ }
+ else {
+ result.Font = DataGridView.DefaultCellStyle.Font;
+ }
+ }
+ if (style != null && style.ForeColor != Color.Empty) {
+ result.ForeColor = style.ForeColor;
+ }
+ else if (OwningRow != null && OwningRow.DefaultCellStyle.ForeColor != Color.Empty) {
+ result.ForeColor = OwningRow.DefaultCellStyle.ForeColor;
+ }
+ else if (DataGridView != null) {
+ if ((RowIndex % 2) == 1 && DataGridView.AlternatingRowsDefaultCellStyle.ForeColor != Color.Empty) {
+ result.ForeColor = DataGridView.AlternatingRowsDefaultCellStyle.ForeColor;
+ }
+ else if (DataGridView.RowsDefaultCellStyle.ForeColor != Color.Empty) {
+ result.ForeColor = DataGridView.RowsDefaultCellStyle.ForeColor;
+ }
+ else if (ColumnIndex >= 0 && DataGridView.Columns[ColumnIndex].DefaultCellStyle.ForeColor != Color.Empty) {
+ result.ForeColor = DataGridView.Columns[ColumnIndex].DefaultCellStyle.ForeColor;
+ }
+ else {
+ result.ForeColor = DataGridView.DefaultCellStyle.ForeColor;
+ }
+ }
+ if (style != null && style.Format != String.Empty) {
+ result.Format = style.Format;
+ }
+ else if (OwningRow != null && OwningRow.DefaultCellStyle.Format != String.Empty) {
+ result.Format = OwningRow.DefaultCellStyle.Format;
+ }
+ else if (DataGridView != null) {
+ if ((RowIndex % 2) == 1 && DataGridView.AlternatingRowsDefaultCellStyle.Format != String.Empty) {
+ result.Format = DataGridView.AlternatingRowsDefaultCellStyle.Format;
+ }
+ else if (DataGridView.RowsDefaultCellStyle.Format != String.Empty) {
+ result.Format = DataGridView.RowsDefaultCellStyle.Format;
+ }
+ else if (ColumnIndex >= 0 && DataGridView.Columns[ColumnIndex].DefaultCellStyle.Format != String.Empty) {
+ result.Format = DataGridView.Columns[ColumnIndex].DefaultCellStyle.Format;
+ }
+ else {
+ result.Format = DataGridView.DefaultCellStyle.Format;
+ }
+ }
+ if (style != null && style.FormatProvider != System.Globalization.CultureInfo.CurrentUICulture) {
+ result.FormatProvider = style.FormatProvider;
+ }
+ else if (OwningRow != null && OwningRow.DefaultCellStyle.FormatProvider != System.Globalization.CultureInfo.CurrentUICulture) {
+ result.FormatProvider = OwningRow.DefaultCellStyle.FormatProvider;
+ }
+ else if (DataGridView != null) {
+ if ((RowIndex % 2) == 1 && DataGridView.AlternatingRowsDefaultCellStyle.FormatProvider != System.Globalization.CultureInfo.CurrentUICulture) {
+ result.FormatProvider = DataGridView.AlternatingRowsDefaultCellStyle.FormatProvider;
+ }
+ else if (DataGridView.RowsDefaultCellStyle.FormatProvider != System.Globalization.CultureInfo.CurrentUICulture) {
+ result.FormatProvider = DataGridView.RowsDefaultCellStyle.FormatProvider;
+ }
+ else if (ColumnIndex >= 0 && DataGridView.Columns[ColumnIndex].DefaultCellStyle.FormatProvider != System.Globalization.CultureInfo.CurrentUICulture) {
+ result.FormatProvider = DataGridView.Columns[ColumnIndex].DefaultCellStyle.FormatProvider;
+ }
+ else {
+ result.FormatProvider = DataGridView.DefaultCellStyle.FormatProvider;
+ }
+ }
+ if (style != null && style.NullValue != "(null)") {
+ result.NullValue = style.NullValue;
+ }
+ else if (OwningRow != null && OwningRow.DefaultCellStyle.NullValue != "(null)") {
+ result.NullValue = OwningRow.DefaultCellStyle.NullValue;
+ }
+ else if (DataGridView != null) {
+ if ((RowIndex % 2) == 1 && DataGridView.AlternatingRowsDefaultCellStyle.NullValue != "(null)") {
+ result.NullValue = DataGridView.AlternatingRowsDefaultCellStyle.NullValue;
+ }
+ else if (DataGridView.RowsDefaultCellStyle.NullValue != "(null)") {
+ result.NullValue = DataGridView.RowsDefaultCellStyle.NullValue;
+ }
+ else if (ColumnIndex >= 0 && DataGridView.Columns[ColumnIndex].DefaultCellStyle.NullValue != "(null)") {
+ result.NullValue = DataGridView.Columns[ColumnIndex].DefaultCellStyle.NullValue;
+ }
+ else {
+ result.NullValue = DataGridView.DefaultCellStyle.NullValue;
+ }
+ }
+ if (style != null && style.Padding != Padding.Empty) {
+ result.Padding = style.Padding;
+ }
+ else if (OwningRow != null && OwningRow.DefaultCellStyle.Padding != Padding.Empty) {
+ result.Padding = OwningRow.DefaultCellStyle.Padding;
+ }
+ else if (DataGridView != null) {
+ if ((RowIndex % 2) == 1 && DataGridView.AlternatingRowsDefaultCellStyle.Padding != Padding.Empty) {
+ result.Padding = DataGridView.AlternatingRowsDefaultCellStyle.Padding;
+ }
+ else if (DataGridView.RowsDefaultCellStyle.Padding != Padding.Empty) {
+ result.Padding = DataGridView.RowsDefaultCellStyle.Padding;
+ }
+ else if (ColumnIndex >= 0 && DataGridView.Columns[ColumnIndex].DefaultCellStyle.Padding != Padding.Empty) {
+ result.Padding = DataGridView.Columns[ColumnIndex].DefaultCellStyle.Padding;
+ }
+ else {
+ result.Padding = DataGridView.DefaultCellStyle.Padding;
+ }
+ }
+ if (style != null && style.SelectionBackColor != Color.Empty) {
+ result.SelectionBackColor = style.SelectionBackColor;
+ }
+ else if (OwningRow != null && OwningRow.DefaultCellStyle.SelectionBackColor != Color.Empty) {
+ result.SelectionBackColor = OwningRow.DefaultCellStyle.SelectionBackColor;
+ }
+ else if (DataGridView != null) {
+ if ((RowIndex % 2) == 1 && DataGridView.AlternatingRowsDefaultCellStyle.SelectionBackColor != Color.Empty) {
+ result.SelectionBackColor = DataGridView.AlternatingRowsDefaultCellStyle.SelectionBackColor;
+ }
+ else if (DataGridView.RowsDefaultCellStyle.SelectionBackColor != Color.Empty) {
+ result.SelectionBackColor = DataGridView.RowsDefaultCellStyle.SelectionBackColor;
+ }
+ else if (ColumnIndex >= 0 && DataGridView.Columns[ColumnIndex].DefaultCellStyle.SelectionBackColor != Color.Empty) {
+ result.SelectionBackColor = DataGridView.Columns[ColumnIndex].DefaultCellStyle.SelectionBackColor;
+ }
+ else {
+ result.SelectionBackColor = DataGridView.DefaultCellStyle.SelectionBackColor;
+ }
+ }
+ if (style != null && style.SelectionForeColor != Color.Empty) {
+ result.SelectionForeColor = style.SelectionForeColor;
+ }
+ else if (OwningRow != null && OwningRow.DefaultCellStyle.SelectionForeColor != Color.Empty) {
+ result.SelectionForeColor = OwningRow.DefaultCellStyle.SelectionForeColor;
+ }
+ else if (DataGridView != null) {
+ if ((RowIndex % 2) == 1 && DataGridView.AlternatingRowsDefaultCellStyle.SelectionForeColor != Color.Empty) {
+ result.SelectionForeColor = DataGridView.AlternatingRowsDefaultCellStyle.SelectionForeColor;
+ }
+ else if (DataGridView.RowsDefaultCellStyle.SelectionForeColor != Color.Empty) {
+ result.SelectionForeColor = DataGridView.RowsDefaultCellStyle.SelectionForeColor;
+ }
+ else if (ColumnIndex >= 0 && DataGridView.Columns[ColumnIndex].DefaultCellStyle.SelectionForeColor != Color.Empty) {
+ result.SelectionForeColor = DataGridView.Columns[ColumnIndex].DefaultCellStyle.SelectionForeColor;
+ }
+ else {
+ result.SelectionForeColor = DataGridView.DefaultCellStyle.SelectionForeColor;
+ }
+ }
+ if (style != null && style.Tag != null) {
+ result.Tag = style.Tag;
+ }
+ else if (OwningRow != null && OwningRow.DefaultCellStyle.Tag != null) {
+ result.Tag = OwningRow.DefaultCellStyle.Tag;
+ }
+ else if (DataGridView != null) {
+ if ((RowIndex % 2) == 1 && DataGridView.AlternatingRowsDefaultCellStyle.Tag != null) {
+ result.Tag = DataGridView.AlternatingRowsDefaultCellStyle.Tag;
+ }
+ else if (DataGridView.RowsDefaultCellStyle.Tag != null) {
+ result.Tag = DataGridView.RowsDefaultCellStyle.Tag;
+ }
+ else if (ColumnIndex >= 0 && DataGridView.Columns[ColumnIndex].DefaultCellStyle.Tag != null) {
+ result.Tag = DataGridView.Columns[ColumnIndex].DefaultCellStyle.Tag;
+ }
+ else {
+ result.Tag = DataGridView.DefaultCellStyle.Tag;
+ }
+ }
+ if (style != null && style.WrapMode != DataGridViewTriState.NotSet) {
+ result.WrapMode = style.WrapMode;
+ }
+ else if (OwningRow != null && OwningRow.DefaultCellStyle.WrapMode != DataGridViewTriState.NotSet) {
+ result.WrapMode = OwningRow.DefaultCellStyle.WrapMode;
+ }
+ else if (DataGridView != null) {
+ if ((RowIndex % 2) == 1 && DataGridView.AlternatingRowsDefaultCellStyle.WrapMode != DataGridViewTriState.NotSet) {
+ result.WrapMode = DataGridView.AlternatingRowsDefaultCellStyle.WrapMode;
+ }
+ else if (DataGridView.RowsDefaultCellStyle.WrapMode != DataGridViewTriState.NotSet) {
+ result.WrapMode = DataGridView.RowsDefaultCellStyle.WrapMode;
+ }
+ else if (ColumnIndex >= 0 && DataGridView.Columns[ColumnIndex].DefaultCellStyle.WrapMode != DataGridViewTriState.NotSet) {
+ result.WrapMode = DataGridView.Columns[ColumnIndex].DefaultCellStyle.WrapMode;
+ }
+ else {
+ result.WrapMode = DataGridView.DefaultCellStyle.WrapMode;
+ }
+ }
+ return result;
+ }
+ }
+
+ public bool IsInEditMode {
+ get { return isInEditMode; }
+ }
+
+ public DataGridViewColumn OwningColumn {
+ get { return owningColumn; }
+ }
+
+ public DataGridViewRow OwningRow {
+ get { return owningRow; }
+ }
+
+ public Size PreferredSize {
+ get { return preferredSize; }
+ }
+
+ public virtual bool ReadOnly {
+ get { return readOnly; }
+ set { readOnly = value; }
+ }
+
+ public virtual bool Resizable {
+ get { return resizable; }
+ }
+
+ public int RowIndex {
+ get {
+ if (owningRow == null) {
+ return -1;
+ }
+ return owningRow.Index;
+ }
+ }
+
+ public virtual bool Selected {
+ get { return selected; }
+ set {
+ if (value != ((State & DataGridViewElementStates.Selected) != 0)) {
+ SetState(State ^ DataGridViewElementStates.Selected);
+ }
+ selected = value;
+ }
+ }
+
+ public Size Size {
+ get { return size; }
+ }
+
+ public DataGridViewCellStyle Style {
+ get {
+ if (style != null) {
+ style = new DataGridViewCellStyle();
+ style.StyleChanged += OnStyleChanged;
+ }
+ return style;
+ }
+ set { style = value; }
+ }
+
+ public object Tag {
+ get { return tag; }
+ set { tag = value; }
+ }
+
+ public string ToolTipText {
+ get { return toolTipText; }
+ set { toolTipText = value; }
+ }
+
+ public object Value {
+ get { return valuex; }
+ set {
+ if (valuex != value) {
+ valuex = value;
+ RaiseCellValueChanged(new DataGridViewCellEventArgs(ColumnIndex, RowIndex));
+ }
+ }
+ }
+
+ public virtual Type ValueType {
+ get { return valueType; }
+ set { valueType = value; }
+ }
+
+ public virtual bool Visible {
+ get { return visible; }
+ }
+
+ public virtual DataGridViewAdvancedBorderStyle AdjustCellBorderStyle (DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStyleInput, DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStylePlaceholder, bool singleVerticalBorderAdded, bool singleHorizontalBorderAdded, bool isFirstDisplayedColumn, bool isFirstDisplayedRow) {
+ return dataGridViewAdvancedBorderStyleInput;
+ }
+
+ public virtual object Clone () {
+ return this.MemberwiseClone();
+ /*
+ DataGridViewCell result = null; // = new DataGridViewCell();
+ result.accessibilityObject = this.accessibilityObject;
+ result.columnIndex = this.columnIndex;
+ result.contentBounds = this.contentBounds;
+ //result.contextMenuStrip = this.contextMenuStrip;
+ result.defaultNewRowValue = this.defaultNewRowValue;
+ result.displayed = this.displayed;
+ result.editedFormattedValue = this.editedFormattedValue;
+ result.editType = this.editType;
+ result.errorIconBounds = this.errorIconBounds;
+ result.errorText = this.errorText;
+ result.formattedValueType = this.formattedValueType;
+ result.frozen = this.frozen;
+ result.hasStyle = this.hasStyle;
+ result.inheritedState = this.inheritedState;
+ result.inheritedStyle = this.inheritedStyle;
+ result.isInEditMode = this.isInEditMode;
+ result.owningColumn = this.owningColumn;
+ result.owningRow = this.owningRow;
+ result.preferredSize = this.preferredSize;
+ result.readOnly = this.readOnly;
+ result.resizable = this.resizable;
+ result.selected = this.selected;
+ result.size = this.size;
+ result.style = this.style;
+ result.tag = this.tag;
+ result.toolTipText = this.toolTipText;
+ result.valuex = this.valuex;
+ result.valueType = this.valueType;
+ result.visible = this.visible;
+ return result;
+ */
+ }
+
+ public virtual void DetachEditingControl () {
+ }
+
+ //public sealed void Dispose () {
+ public void Dispose () {
+ }
+
+ public Rectangle GetContentBounds (int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ public object GetEditedFormattedValue (int rowIndex, DataGridViewDataErrorContexts context) {
+ throw new NotImplementedException();
+ }
+
+ /*
+ public virtual ContextMenuStrip GetInheritedContextMenuStrip (int rowIndex) {
+ }
+ */
+
+ public virtual DataGridViewElementStates GetInheritedState (int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ public virtual DataGridViewCellStyle GetInheritedStyle (DataGridViewCellStyle inheritedCellStyle, int rowIndex, bool includeColors) {
+ /*
+ * System.InvalidOperationException :: The cell has no associated System.Windows.Forms.DataGridView, or the cell's System.Windows.Forms.DataGridViewCell.ColumnIndex is less than 0.
+ * System.ArgumentOutOfRangeException :: rowIndex is less than 0, or greater than or equal to the number of rows in the parent System.Windows.Forms.DataGridView.
+ * */
+ throw new NotImplementedException();
+ }
+
+ public virtual void InitializeEditingControl (int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle) {
+ if (DataGridView == null || DataGridView.EditingControl == null) {
+ throw new InvalidOperationException("No editing control defined");
+ }
+ }
+
+ public virtual bool KeyEntersEditMode (KeyEventArgs e) {
+ throw new NotImplementedException();
+ }
+
+ public static int MeasureTextHeight (Graphics graphics, string text, Font font, int maxWidth, TextFormatFlags flags) {
+ if (graphics == null) {
+ throw new ArgumentNullException("Graphics argument null");
+ }
+ if (font == null) {
+ throw new ArgumentNullException("Font argument null");
+ }
+ if (maxWidth < 1) {
+ throw new ArgumentOutOfRangeException("maxWidth is less than 1.");
+ }
+ // if (flags ---> InvalidEnumArgumentException
+ throw new NotImplementedException();
+ }
+
+ public static int MeasureTextHeight (Graphics graphics, string text, Font font, int maxWidth, TextFormatFlags flags, out bool widthTruncated) {
+ throw new NotImplementedException();
+ }
+
+ public static Size MeasureTextPreferredSize (Graphics graphics, string text, Font font, float maxRatio, TextFormatFlags flags) {
+ if (graphics == null) {
+ throw new ArgumentNullException("Graphics argument null");
+ }
+ if (font == null) {
+ throw new ArgumentNullException("Font argument null");
+ }
+ if (maxRatio <= 0) {
+ throw new ArgumentOutOfRangeException("maxRatio is less than or equals to 0.");
+ }
+ throw new NotImplementedException();
+ }
+
+ public static Size MeasureTextSize (Graphics graphics, string text, Font font, TextFormatFlags flags) {
+ /////////////////////////// ¿flags?
+ return graphics.MeasureString(text, font).ToSize();
+ }
+
+ public static int MeasureTextWidth (Graphics graphics, string text, Font font, int maxHeight, TextFormatFlags flags) {
+ if (graphics == null) {
+ throw new ArgumentNullException("Graphics argument null");
+ }
+ if (font == null) {
+ throw new ArgumentNullException("Font argument null");
+ }
+ if (maxHeight < 1) {
+ throw new ArgumentOutOfRangeException("maxHeight is less than 1.");
+ }
+ throw new NotImplementedException();
+ }
+
+ public virtual object ParseFormattedValue (object formattedValue, DataGridViewCellStyle cellStyle, TypeConverter formattedValueTypeConverter, TypeConverter valueTypeConverter) {
+ if (cellStyle == null) {
+ throw new ArgumentNullException("cellStyle is null.");
+ }
+ if (formattedValueType == null) {
+ throw new FormatException("The System.Windows.Forms.DataGridViewCell.FormattedValueType property value is null.");
+ }
+ if (formattedValue == null) {
+ throw new ArgumentException("formattedValue is null.");
+ }
+ if (formattedValue.GetType() != formattedValueType) {
+ }
+ return null;
+ }
+
+ public virtual void PositionEditingControl (bool setLocation, bool setSize, Rectangle cellBounds, Rectangle cellClip, DataGridViewCellStyle cellStyle, bool singleVerticalBorderAdded, bool singleHorizontalBorderAdded, bool isFirstDisplayedColumn, bool isFirstDisplayedRow) {
+ throw new NotImplementedException();
+ }
+
+ public virtual Rectangle PositionEditingPanel (Rectangle cellBounds, Rectangle cellClip, DataGridViewCellStyle cellStyle, bool singleVerticalBorderAdded, bool singleHorizontalBorderAdded, bool isFirstDisplayedColumn, bool isFirstDisplayedRow) {
+ throw new NotImplementedException();
+ }
+
+ public override string ToString () {
+ return String.Format("{0} {RowIndex = {1}, ColumnIndex = {2}}", this.GetType().FullName, RowIndex, columnIndex);
+ }
+
+ protected virtual Rectangle BorderWidths (DataGridViewAdvancedBorderStyle advancedBorderStyle) {
+ throw new NotImplementedException();
+ }
+
+ protected virtual bool ClickUnsharesRow (DataGridViewCellEventArgs e) {
+ throw new NotImplementedException();
+ }
+
+ protected virtual bool ContentClickUnsharesRow (DataGridViewCellEventArgs e) {
+ throw new NotImplementedException();
+ }
+
+ protected virtual bool ContentDoubleClickUnsharesRow (DataGridViewCellEventArgs e) {
+ throw new NotImplementedException();
+ }
+
+ protected virtual AccessibleObject CreateAccessibilityInstance () {
+ return new DataGridViewCellAccessibleObject(this);
+ }
+
+ protected virtual void Dispose (bool disposing) {
+ }
+
+ protected virtual bool DoubleClickUnsharesRow (DataGridViewCellEventArgs e) {
+ throw new NotImplementedException();
+ }
+
+ protected virtual bool EnterUnsharesRow (int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected virtual object GetClipboardContent (int rowIndex, bool firstCell, bool lastCell, bool inFirstRow, bool inLastRow, string format) {
+ throw new NotImplementedException();
+ }
+
+ protected virtual Rectangle GetContentBounds (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected virtual Rectangle GetErrorIconBounds (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected internal virtual string GetErrorText (int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected virtual object GetFormattedValue (object value, int rowIndex, ref DataGridViewCellStyle cellStyle, TypeConverter valueTypeConverter, TypeConverter formattedValueTypeConverter, DataGridViewDataErrorContexts context) {
+ throw new NotImplementedException();
+ }
+
+ protected virtual Size GetPreferredSize (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex, Size constraintSize) {
+ throw new NotImplementedException();
+ }
+
+ protected virtual Size GetSize (int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected virtual object GetValue (int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected virtual bool KeyDownUnsharesRow (KeyEventArgs e, int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected virtual bool KeyPressUnsharesRow (KeyPressEventArgs e, int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected virtual bool KeyUpUnsharesRow (KeyEventArgs e, int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected virtual bool LeaveUnsharesRow ( int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected virtual bool MouseClickUnsharesRow (DataGridViewCellMouseEventArgs e) {
+ throw new NotImplementedException();
+ }
+
+ protected virtual bool MouseDoubleClickUnsharesRow (DataGridViewCellMouseEventArgs e) {
+ throw new NotImplementedException();
+ }
+
+ protected virtual bool MouseDownUnsharesRow (DataGridViewCellMouseEventArgs e) {
+ throw new NotImplementedException();
+ }
+
+ protected virtual bool MouseEnterUnsharesRow (int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected virtual bool MouseLeaveUnsharesRow (int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected virtual bool MouseMoveUnsharesRow (DataGridViewCellMouseEventArgs e) {
+ throw new NotImplementedException();
+ }
+
+ protected virtual bool MouseUpUnsharesRow (DataGridViewCellMouseEventArgs e) {
+ throw new NotImplementedException();
+ }
+
+ protected virtual void OnClick (DataGridViewCellEventArgs e) {
+ }
+
+ protected virtual void OnContentClick (DataGridViewCellEventArgs e) {
+ }
+
+ protected virtual void OnContentDoubleClick (DataGridViewCellEventArgs e) {
+ }
+
+ protected override void OnDataGridViewChanged () {
+ }
+
+ protected virtual void OnDoubleClick (DataGridViewCellEventArgs e) {
+ }
+
+ protected virtual void OnEnter (int rowIndex, bool throughMouseClick) {
+ }
+
+ protected virtual void OnKeyDown (KeyEventArgs e, int rowIndex) {
+ }
+
+ protected virtual void OnKeyPress (KeyPressEventArgs e, int rowIndex) {
+ }
+
+ protected virtual void OnKeyUp (KeyEventArgs e, int rowIndex) {
+ }
+
+ protected virtual void OnLeave (int rowIndex, bool throughMouseClick) {
+ }
+
+ protected virtual void OnMouseClick (DataGridViewCellMouseEventArgs e) {
+ }
+
+ protected virtual void OnMouseDoubleClick (DataGridViewCellMouseEventArgs e) {
+ }
+
+ protected virtual void OnMouseDown (DataGridViewCellMouseEventArgs e) {
+ }
+
+ protected virtual void OnMouseEnter (int rowIndex) {
+ }
+
+ protected virtual void OnMouseLeave (int rowIndex) {
+ }
+
+ protected virtual void OnMouseMove (DataGridViewCellMouseEventArgs e) {
+ }
+
+ protected virtual void OnMouseUp (DataGridViewCellMouseEventArgs e) {
+ }
+
+ protected virtual void Paint (Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) {
+ throw new NotImplementedException();
+ }
+
+ protected virtual void PaintBorder (Graphics graphics, Rectangle clipBounds, Rectangle bounds, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle) {
+ Pen pen = new Pen(DataGridView.GridColor);
+ /*
+ switch (advancedBorderStyle.All) {
+ case DataGridViewAdvancedCellBorderStyle.None:
+ break;
+ case DataGridViewAdvancedCellBorderStyle.Single:
+ graphics.DrawRectangle(pen, bounds);
+ break;
+ case DataGridViewAdvancedCellBorderStyle.Inset:
+ bounds.X += 1;
+ bounds.Y += 1;
+ bounds.Width -= 2;
+ bounds.Height -= 2;
+ graphics.DrawRectangle(pen, bounds);
+ break;
+ case DataGridViewAdvancedCellBorderStyle.InsetDouble:
+ case DataGridViewAdvancedCellBorderStyle.Outset:
+ case DataGridViewAdvancedCellBorderStyle.OutsetDouble:
+ case DataGridViewAdvancedCellBorderStyle.OutsetPartial:
+ break;
+ case DataGridViewAdvancedCellBorderStyle.NotSet:
+ */
+ switch (advancedBorderStyle.Left) {
+ case DataGridViewAdvancedCellBorderStyle.None:
+ break;
+ case DataGridViewAdvancedCellBorderStyle.Single:
+ graphics.DrawLine(pen, bounds.X, bounds.Y, bounds.X, bounds.Y + bounds.Height - 1);
+ break;
+ case DataGridViewAdvancedCellBorderStyle.Inset:
+ graphics.DrawLine(pen, bounds.X + 2, bounds.Y, bounds.X + 2, bounds.Y + bounds.Height - 1);
+ break;
+ case DataGridViewAdvancedCellBorderStyle.InsetDouble:
+ case DataGridViewAdvancedCellBorderStyle.Outset:
+ case DataGridViewAdvancedCellBorderStyle.OutsetDouble:
+ graphics.DrawLine(pen, bounds.X, bounds.Y, bounds.X, bounds.Y + bounds.Height - 1);
+ graphics.DrawLine(pen, bounds.X + 2, bounds.Y, bounds.X + 2, bounds.Y + bounds.Height - 1);
+ break;
+ case DataGridViewAdvancedCellBorderStyle.OutsetPartial:
+ break;
+ }
+ switch (advancedBorderStyle.Right) {
+ case DataGridViewAdvancedCellBorderStyle.None:
+ break;
+ case DataGridViewAdvancedCellBorderStyle.Single:
+ graphics.DrawLine(pen, bounds.X + bounds.Width - 1, bounds.Y, bounds.X + bounds.Width - 1, bounds.Y + bounds.Height - 1);
+ break;
+ case DataGridViewAdvancedCellBorderStyle.Inset:
+ graphics.DrawLine(pen, bounds.X + bounds.Width + 1, bounds.Y, bounds.X + bounds.Width - 3, bounds.Y + bounds.Height - 1);
+ break;
+ case DataGridViewAdvancedCellBorderStyle.InsetDouble:
+ case DataGridViewAdvancedCellBorderStyle.Outset:
+ case DataGridViewAdvancedCellBorderStyle.OutsetDouble:
+ case DataGridViewAdvancedCellBorderStyle.OutsetPartial:
+ break;
+ }
+ switch (advancedBorderStyle.Top) {
+ case DataGridViewAdvancedCellBorderStyle.None:
+ break;
+ case DataGridViewAdvancedCellBorderStyle.Single:
+ graphics.DrawLine(pen, bounds.X, bounds.Y, bounds.X + bounds.Width - 1, bounds.Y);
+ break;
+ case DataGridViewAdvancedCellBorderStyle.Inset:
+ graphics.DrawLine(pen, bounds.X, bounds.Y + 2, bounds.X + bounds.Width - 1, bounds.Y + bounds.Height + 1);
+ break;
+ case DataGridViewAdvancedCellBorderStyle.InsetDouble:
+ case DataGridViewAdvancedCellBorderStyle.Outset:
+ case DataGridViewAdvancedCellBorderStyle.OutsetDouble:
+ case DataGridViewAdvancedCellBorderStyle.OutsetPartial:
+ break;
+ }
+ switch (advancedBorderStyle.Bottom) {
+ case DataGridViewAdvancedCellBorderStyle.None:
+ break;
+ case DataGridViewAdvancedCellBorderStyle.Single:
+ graphics.DrawLine(pen, bounds.X, bounds.Y + bounds.Height - 1, bounds.X + bounds.Width - 1, bounds.Y + bounds.Height - 1);
+ break;
+ case DataGridViewAdvancedCellBorderStyle.Inset:
+ case DataGridViewAdvancedCellBorderStyle.InsetDouble:
+ case DataGridViewAdvancedCellBorderStyle.Outset:
+ case DataGridViewAdvancedCellBorderStyle.OutsetDouble:
+ case DataGridViewAdvancedCellBorderStyle.OutsetPartial:
+ break;
+ }
+ // break;
+ //}
+ }
+
+ protected virtual void PaintErrorIcon (Graphics graphics, Rectangle clipBounds, Rectangle cellValueBounds, string errorText) {
+ throw new NotImplementedException();
+ }
+
+ protected virtual bool SetValue (int rowIndex, object value) {
+ throw new NotImplementedException();
+ }
+
+ private void OnStyleChanged (object sender, EventArgs args) {
+ if (DataGridView != null) {
+ DataGridView.RaiseCellStyleChanged(new DataGridViewCellEventArgs(ColumnIndex, RowIndex));
+ }
+ }
+
+ internal void InternalPaint (Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) {
+ Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts);
+ }
+
+ internal void SetOwningRow (DataGridViewRow row) {
+ owningRow = row;
+ }
+
+ internal void SetColumnIndex (int index) {
+ columnIndex = index;
+ }
+
+ internal void SetContentBounds (Rectangle bounds) {
+ contentBounds = bounds;
+ }
+
+ internal void SetIsInEditMode (bool isInEditMode) {
+ this.isInEditMode = isInEditMode;
+ }
+
+ internal void SetSize (Size size) {
+ this.size = size;
+ }
+
+ internal void OnErrorTextChanged (DataGridViewCellEventArgs args) {
+ if (DataGridView != null) {
+ DataGridView.OnCellErrorTextChanged(args);
+ }
+ }
+
+ [ComVisibleAttribute(true)]
+ protected class DataGridViewCellAccessibleObject : AccessibleObject {
+
+ private DataGridViewCell dataGridViewCell;
+
+ public DataGridViewCellAccessibleObject () {
+ }
+
+ public DataGridViewCellAccessibleObject (DataGridViewCell cell) {
+ this.dataGridViewCell = cell;
+ }
+
+ public override Rectangle Bounds {
+ get { throw new NotImplementedException(); }
+ }
+
+ public override string DefaultAction {
+ get { return "Edit"; }
+ }
+
+ public override string Name {
+ get { return dataGridViewCell.OwningColumn.HeaderText + ": " + dataGridViewCell.RowIndex.ToString(); }
+ }
+
+ public DataGridViewCell Owner {
+ get { return dataGridViewCell; }
+ set { dataGridViewCell = value; }
+ }
+
+ public override AccessibleObject Parent {
+ get { return dataGridViewCell.OwningRow.AccessibilityObject; }
+ }
+
+ public override AccessibleRole Role {
+ get { return AccessibleRole.Cell; }
+ }
+
+ public override AccessibleStates State {
+ get {
+ if (dataGridViewCell.Selected) {
+ return AccessibleStates.Selected;
+ }
+ else {
+ return AccessibleStates.Focused;
+ }
+ }
+ }
+
+ public override string Value {
+ get {
+ if (dataGridViewCell.FormattedValue == null) {
+ return "(null)";
+ }
+ return dataGridViewCell.FormattedValue.ToString();
+ }
+ }
+
+ public override void DoDefaultAction () {
+ if (dataGridViewCell.DataGridView.EditMode != DataGridViewEditMode.EditProgrammatically) {
+ if (dataGridViewCell.IsInEditMode) {
+ // commit edit
+ }
+ else {
+ // begin edit
+ }
+ }
+ }
+
+ public override AccessibleObject GetChild (int index) {
+ throw new NotImplementedException();
+ }
+
+ public override int GetChildCount () {
+ if (dataGridViewCell.IsInEditMode) {
+ return 1;
+ }
+ return -1;
+ }
+
+ public override AccessibleObject GetFocused () {
+ return null;
+ }
+
+ public override AccessibleObject GetSelected () {
+ return null;
+ }
+
+ public override AccessibleObject Navigate (AccessibleNavigation navigationDirection) {
+ switch (navigationDirection) {
+ case AccessibleNavigation.Right:
+ break;
+ case AccessibleNavigation.Left:
+ break;
+ case AccessibleNavigation.Next:
+ break;
+ case AccessibleNavigation.Previous:
+ break;
+ case AccessibleNavigation.Up:
+ break;
+ case AccessibleNavigation.Down:
+ break;
+ default:
+ return null;
+ }
+ return null;
+ }
+
+ public override void Select (AccessibleSelection flags) {
+ switch (flags) {
+ case AccessibleSelection.TakeFocus:
+ dataGridViewCell.dataGridViewOwner.Focus();
+ break;
+ case AccessibleSelection.TakeSelection:
+ //dataGridViewCell.Focus();
+ break;
+ case AccessibleSelection.AddSelection:
+ dataGridViewCell.dataGridViewOwner.SelectedCells.InternalAdd(dataGridViewCell);
+ break;
+ case AccessibleSelection.RemoveSelection:
+ dataGridViewCell.dataGridViewOwner.SelectedCells.InternalRemove(dataGridViewCell);
+ break;
+ }
+ }
+
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellBorderStyle.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellBorderStyle.cs
new file mode 100644
index 00000000000..bac099e8b83
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellBorderStyle.cs
@@ -0,0 +1,47 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public enum DataGridViewCellBorderStyle {
+ Custom = 0,
+ Single = 1,
+ Raised = 2,
+ Sunken = 3,
+ None = 4,
+ SingleVertical = 5,
+ RaisedVertical = 6,
+ SunkenVertical = 7,
+ SingleHorizontal = 8,
+ RaisedHorizontal = 9,
+ SunkenHorizontal = 10
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellCancelEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellCancelEventArgs.cs
new file mode 100644
index 00000000000..8f009afe0d1
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellCancelEventArgs.cs
@@ -0,0 +1,55 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewCellCancelEventArgs : CancelEventArgs {
+
+ private int columnIndex;
+ private int rowIndex;
+
+ public DataGridViewCellCancelEventArgs (int columnIndex, int rowIndex) {
+ this.columnIndex = columnIndex;
+ this.rowIndex = rowIndex;
+ }
+
+ public int ColumnIndex {
+ get { return columnIndex; }
+ }
+
+ public int RowIndex {
+ get { return rowIndex; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellCancelEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellCancelEventHandler.cs
new file mode 100644
index 00000000000..f98ab541fa7
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellCancelEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewCellCancelEventHandler (object sender, DataGridViewCellCancelEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellCollection.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellCollection.cs
new file mode 100644
index 00000000000..0e696eecde7
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellCollection.cs
@@ -0,0 +1,164 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System.ComponentModel;
+using System.Collections;
+
+namespace System.Windows.Forms {
+
+
+ public class DataGridViewCellCollection : BaseCollection, IList, ICollection, IEnumerable {
+
+ private DataGridViewRow dataGridViewRow;
+
+ public DataGridViewCellCollection (DataGridViewRow dataGridViewRow) : base() {
+ this.dataGridViewRow = dataGridViewRow;
+ }
+
+ public bool IsFixedSize {
+ get { return base.List.IsFixedSize; }
+ }
+
+ object IList.this [int index] {
+ get { return this[index]; }
+ set { this[index] = value as DataGridViewCell; }
+ }
+
+ public DataGridViewCell this [int index] {
+ get { return (DataGridViewCell) base.List[index]; }
+ set { Insert(index, value); }
+ }
+
+ public DataGridViewCell this [string columnName] {
+ get {
+ foreach (DataGridViewCell cell in base.List) {
+ if (cell.OwningColumn.Name == columnName) {
+ return cell;
+ }
+ }
+ return null;
+ }
+ set {
+ for (int i = 0; i < base.List.Count; i++) {
+ DataGridViewCell cell = (DataGridViewCell) base.List[i];
+ if (cell.OwningColumn.Name == columnName) {
+ Insert(i, value);
+ return;
+ }
+ }
+ Add(value);
+ }
+ }
+
+ public event CollectionChangeEventHandler CollectionChanged;
+
+ int IList.Add (object o) {
+ return Add(o as DataGridViewCell);
+ }
+
+ public virtual int Add (DataGridViewCell dataGridViewCell) {
+ dataGridViewCell.SetOwningRow(dataGridViewRow);
+ dataGridViewCell.SetColumnIndex(base.List.Count);
+ dataGridViewCell.SetDataGridView(dataGridViewRow.DataGridView);
+ int result = base.List.Add(dataGridViewCell);
+ OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Add, dataGridViewCell));
+ return result;
+ }
+
+ public virtual void AddRange (params DataGridViewCell[] dataGridViewCells) {
+ foreach (DataGridViewCell cell in dataGridViewCells) {
+ this.Add(cell);
+ }
+ }
+
+ public virtual void Clear () {
+ base.List.Clear();
+ }
+
+ bool IList.Contains (object o) {
+ return Contains(o as DataGridViewCell);
+ }
+
+ public virtual bool Contains (DataGridViewCell dataGridViewCell) {
+ return base.List.Contains(dataGridViewCell);
+ }
+
+ public void CopyTo (DataGridViewCell[] array, int index) {
+ base.List.CopyTo(array, index);
+ }
+
+ int IList.IndexOf (object o) {
+ return IndexOf(o as DataGridViewCell);
+ }
+
+ public int IndexOf (DataGridViewCell dataGridViewCell) {
+ return base.List.IndexOf(dataGridViewCell);
+ }
+
+ void IList.Insert (int index, object o) {
+ Insert(index, o as DataGridViewCell);
+ }
+
+ public virtual void Insert (int index, DataGridViewCell dataGridViewCell) {
+ dataGridViewCell.SetOwningRow(dataGridViewRow);
+ dataGridViewCell.SetColumnIndex(index);
+ dataGridViewCell.SetDataGridView(dataGridViewRow.DataGridView);
+ base.List.Insert(index, dataGridViewCell);
+ OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Add, dataGridViewCell));
+ }
+
+ void IList.Remove (object o) {
+ Remove(o as DataGridViewCell);
+ }
+
+ public virtual void Remove (DataGridViewCell dataGridViewCell) {
+ base.List.Remove(dataGridViewCell);
+ OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Remove, dataGridViewCell));
+ }
+
+ public virtual void RemoveAt (int index) {
+ DataGridViewCell cell = this[index];
+ base.List.RemoveAt(index);
+ OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Remove, cell));
+ }
+
+ protected override ArrayList List {
+ get { return base.List; }
+ }
+
+ protected void OnCollectionChanged (CollectionChangeEventArgs e) {
+ if (CollectionChanged != null) {
+ CollectionChanged(this, e);
+ }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellContextMenuStripNeededEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellContextMenuStripNeededEventArgs.cs
new file mode 100644
index 00000000000..facb7d14c7a
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellContextMenuStripNeededEventArgs.cs
@@ -0,0 +1,49 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewCellContextMenuStripNeededEventArgs : DataGridViewCellEventArgs {
+
+ //private ContextMenuStrip contextMenuStrip;
+
+ public DataGridViewCellContextMenuStripNeededEventArgs (int columnIndex, int rowIndex) : base (columnIndex, rowIndex) {
+ }
+
+ /*
+ public ContextMenuStrip ContextMenuStrip {
+ get { return contextMenuStrip; }
+ set { contextMenuStrip = value; }
+ }
+ */
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellContextMenuStripNeededEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellContextMenuStripNeededEventHandler.cs
new file mode 100644
index 00000000000..f5f1c54a549
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellContextMenuStripNeededEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewCellContextMenuStripNeededEventHandler (object sender, DataGridViewCellContextMenuStripNeededEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellErrorTextNeededEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellErrorTextNeededEventArgs.cs
new file mode 100644
index 00000000000..47e641fc4e2
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellErrorTextNeededEventArgs.cs
@@ -0,0 +1,48 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewCellErrorTextNeededEventArgs : DataGridViewCellEventArgs {
+
+ private string errorText;
+
+ internal DataGridViewCellErrorTextNeededEventArgs (string errorText, int rowIndex, int columnIndex) : base (columnIndex, rowIndex) {
+ this.errorText = errorText;
+ }
+
+ public string ErrorText {
+ get { return errorText; }
+ set { errorText = value; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellErrorTextNeededEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellErrorTextNeededEventHandler.cs
new file mode 100644
index 00000000000..feea38e6e77
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellErrorTextNeededEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewCellErrorTextNeededEventHandler (object sender, DataGridViewCellErrorTextNeededEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellEventArgs.cs
new file mode 100644
index 00000000000..489be1db6e7
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellEventArgs.cs
@@ -0,0 +1,53 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewCellEventArgs : EventArgs {
+
+ private int columnIndex;
+ private int rowIndex;
+
+ public DataGridViewCellEventArgs (int columnIndex, int rowIndex) {
+ this.columnIndex = columnIndex;
+ this.rowIndex = rowIndex;
+ }
+
+ public int ColumnIndex {
+ get { return columnIndex; }
+ }
+
+ public int RowIndex {
+ get { return rowIndex; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellEventHandler.cs
new file mode 100644
index 00000000000..1e73b3f65d9
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewCellEventHandler (object sender, DataGridViewCellEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellFormattingEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellFormattingEventArgs.cs
new file mode 100644
index 00000000000..e822d9d491a
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellFormattingEventArgs.cs
@@ -0,0 +1,69 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewCellFormattingEventArgs : ConvertEventArgs {
+
+ private int columnIndex;
+ private DataGridViewCellStyle cellStyle;
+ private bool formattingApplied = false;
+ private int rowIndex;
+
+ public DataGridViewCellFormattingEventArgs (int columnIndex, int rowIndex, object value, Type desiredType, DataGridViewCellStyle cellStyle) : base (value, desiredType) {
+ this.columnIndex = columnIndex;
+ this.rowIndex = rowIndex;
+ this.cellStyle = cellStyle;
+ }
+
+ public DataGridViewCellStyle CellStyle {
+ get { return cellStyle; }
+ set {
+ cellStyle = value;
+ }
+ }
+
+ public int ColumnIndex {
+ get { return columnIndex; }
+ }
+
+ ////////////////////////////////////////////////
+ public bool FormattingApplied {
+ get { return formattingApplied; }
+ set { formattingApplied = value; }
+ }
+
+ public int RowIndex {
+ get { return rowIndex; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellFormattingEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellFormattingEventHandler.cs
new file mode 100644
index 00000000000..c2f1980a0da
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellFormattingEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewCellFormattingEventHandler (object sender, DataGridViewCellFormattingEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellMouseEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellMouseEventArgs.cs
new file mode 100644
index 00000000000..7f2fa85d9e7
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellMouseEventArgs.cs
@@ -0,0 +1,53 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewCellMouseEventArgs : MouseEventArgs {
+
+ private int columnIndex;
+ private int rowIndex;
+
+ public DataGridViewCellMouseEventArgs (int columnIndex, int rowIndex, int localX, int localY, MouseEventArgs e) : base (e.Button, e.Clicks, localX, localY, e.Delta) {
+ this.columnIndex = columnIndex;
+ this.rowIndex = rowIndex;
+ }
+
+ public int ColumnIndex {
+ get { return columnIndex; }
+ }
+
+ public int RowIndex {
+ get { return rowIndex; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellMouseEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellMouseEventHandler.cs
new file mode 100644
index 00000000000..1a04249fa4b
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellMouseEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewCellMouseEventHandler (object sender, DataGridViewCellMouseEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellPaintingEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellPaintingEventArgs.cs
new file mode 100644
index 00000000000..468fa255f0d
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellPaintingEventArgs.cs
@@ -0,0 +1,130 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System.ComponentModel;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewCellPaintingEventArgs : HandledEventArgs {
+
+ private DataGridView dataGridView;
+ private Graphics graphics;
+ private Rectangle clipBounds;
+ private Rectangle cellBounds;
+ private int rowIndex;
+ private int columnIndex;
+ private DataGridViewElementStates cellState;
+ private object cellValue;
+ private object formattedValue;
+ private string errorText;
+ private DataGridViewCellStyle cellStyle;
+ private DataGridViewAdvancedBorderStyle advancedBorderStyle;
+ private DataGridViewPaintParts paintParts;
+
+ public DataGridViewCellPaintingEventArgs (DataGridView dataGridView, Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, int columnIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) {
+ this.dataGridView = dataGridView;
+ this.graphics = graphics;
+ this.clipBounds = clipBounds;
+ this.cellBounds = cellBounds;
+ this.rowIndex = rowIndex;
+ this.columnIndex = columnIndex;
+ this.cellState = cellState;
+ this.cellValue = value;
+ this.formattedValue = formattedValue;
+ this.errorText = errorText;
+ this.cellStyle = cellStyle;
+ this.advancedBorderStyle = advancedBorderStyle;
+ this.paintParts = paintParts;
+ }
+
+ public DataGridViewAdvancedBorderStyle AdvancedBorderStyle {
+ get { return advancedBorderStyle; }
+ }
+
+ public Rectangle CellBounds {
+ get { return cellBounds; }
+ }
+
+ public DataGridViewCellStyle CellStyle {
+ get { return cellStyle; }
+ }
+
+ public Rectangle ClipBounds {
+ get { return clipBounds; }
+ }
+
+ public int ColumnIndex {
+ get { return columnIndex; }
+ }
+
+ public string ErrorText {
+ get { return errorText; }
+ }
+
+ public object FormattedValue {
+ get { return formattedValue; }
+ }
+
+ public Graphics Graphics {
+ get { return graphics; }
+ }
+
+ public DataGridViewPaintParts PaintParts {
+ get { return paintParts; }
+ }
+
+ public int RowIndex {
+ get { return rowIndex; }
+ }
+
+ public DataGridViewElementStates State {
+ get { return cellState; }
+ }
+
+ public object Value {
+ get { return cellValue; }
+ }
+
+ public void Paint (Rectangle clipBounds, DataGridViewPaintParts paintParts) {
+ throw new NotImplementedException();
+ }
+
+ public void PaintBackground( Rectangle clipBounds, bool cellsPaintSelectionBackground) {
+ throw new NotImplementedException();
+ }
+
+ public void PaintContent (Rectangle clipBounds) {
+ throw new NotImplementedException();
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellPaintingEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellPaintingEventHandler.cs
new file mode 100644
index 00000000000..a84e57b4420
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellPaintingEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewCellPaintingEventHandler (object sender, DataGridViewCellPaintingEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellParsingEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellParsingEventArgs.cs
new file mode 100644
index 00000000000..ce491c8b521
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellParsingEventArgs.cs
@@ -0,0 +1,66 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewCellParsingEventArgs : ConvertEventArgs {
+
+ private int columnIndex;
+ private DataGridViewCellStyle inheritedCellStyle;
+ private bool parsingApplied = false;
+ private int rowIndex;
+
+ public DataGridViewCellParsingEventArgs (int columnIndex, int rowIndex, object value, Type desiredType, DataGridViewCellStyle inheritedCellStyle) : base (value, desiredType) {
+ this.columnIndex = columnIndex;
+ this.rowIndex = rowIndex;
+ this.inheritedCellStyle = inheritedCellStyle;
+ }
+
+ public DataGridViewCellStyle InheritedCellStyle {
+ get { return inheritedCellStyle; }
+ set { inheritedCellStyle = value; }
+ }
+
+ public int ColumnIndex {
+ get { return columnIndex; }
+ }
+
+ public bool ParsingApplied {
+ get { return parsingApplied; }
+ set { parsingApplied = value; }
+ }
+
+ public int RowIndex {
+ get { return rowIndex; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellParsingEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellParsingEventHandler.cs
new file mode 100644
index 00000000000..657446250ab
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellParsingEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewCellParsingEventHandler (object sender, DataGridViewCellParsingEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStateChangedEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStateChangedEventArgs.cs
new file mode 100644
index 00000000000..19e0c261469
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStateChangedEventArgs.cs
@@ -0,0 +1,53 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewCellStateChangedEventArgs : EventArgs {
+
+ private DataGridViewCell dataGridViewCell;
+ private DataGridViewElementStates stateChanged;
+
+ public DataGridViewCellStateChangedEventArgs (DataGridViewCell dataGridViewCell, DataGridViewElementStates stateChanged) {
+ this.dataGridViewCell = dataGridViewCell;
+ this.stateChanged = stateChanged;
+ }
+
+ public DataGridViewCell Cell {
+ get { return dataGridViewCell; }
+ }
+
+ public DataGridViewElementStates StateChanged {
+ get { return stateChanged; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStateChangedEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStateChangedEventHandler.cs
new file mode 100644
index 00000000000..3f648ab7601
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStateChangedEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewCellStateChangedEventHandler (object sender, DataGridViewCellStateChangedEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStyle.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStyle.cs
new file mode 100644
index 00000000000..9e0cb067571
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStyle.cs
@@ -0,0 +1,286 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System.Drawing;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewCellStyle : ICloneable {
+
+ private DataGridViewContentAlignment alignment;
+ private Color backColor;
+ private object dataSourceNullValue;
+ private Font font;
+ private Color foreColor;
+ private string format;
+ private IFormatProvider formatProvider;
+ private object nullValue;
+ private Padding padding;
+ private Color selectionBackColor;
+ private Color selectionForeColor;
+ private object tag;
+ private DataGridViewTriState wrapMode;
+
+ public DataGridViewCellStyle () {
+ alignment = DataGridViewContentAlignment.NotSet;
+ backColor = Color.Empty;
+ font = null;
+ foreColor = Color.Empty;
+ format = String.Empty;
+ formatProvider = System.Globalization.CultureInfo.CurrentUICulture;
+ nullValue = "(null)";
+ padding = Padding.Empty;
+ selectionBackColor = Color.Empty;
+ selectionForeColor = Color.Empty;
+ tag = null;
+ wrapMode = DataGridViewTriState.NotSet;
+ }
+
+ public DataGridViewCellStyle (DataGridViewCellStyle dataGridViewCellStyle) {
+ ApplyStyle(dataGridViewCellStyle);
+ }
+
+ public DataGridViewContentAlignment Alignment {
+ get { return alignment; }
+ set {
+ if (!Enum.IsDefined(typeof(DataGridViewContentAlignment), value)) {
+ throw new InvalidEnumArgumentException("Value is not valid DataGridViewContentAlignment.");
+ }
+ if (alignment != value) {
+ alignment = value;
+ OnStyleChanged();
+ }
+ }
+ }
+
+ public Color BackColor {
+ get { return backColor; }
+ set {
+ if (backColor != value) {
+ backColor = value;
+ OnStyleChanged();
+ }
+ }
+ }
+
+ public object DataSourceNullValue {
+ get { return dataSourceNullValue; }
+ set {
+ if (dataSourceNullValue != value) {
+ dataSourceNullValue = value;
+ OnStyleChanged();
+ }
+ }
+ }
+
+ public Font Font {
+ get { return font; }
+ set {
+ if (font != value) {
+ font = value;
+ OnStyleChanged();
+ }
+ }
+ }
+
+ public Color ForeColor {
+ get { return foreColor; }
+ set {
+ if (foreColor != value) {
+ foreColor = value;
+ OnStyleChanged();
+ }
+ }
+ }
+
+ public string Format {
+ get { return format; }
+ set {
+ if (format != value) {
+ format = value;
+ OnStyleChanged();
+ }
+ }
+ }
+
+ public IFormatProvider FormatProvider {
+ get { return formatProvider; }
+ set {
+ if (formatProvider != value) {
+ formatProvider = value;
+ OnStyleChanged();
+ }
+ }
+ }
+
+ public bool IsDataSourceNullValueDefault {
+ get { return dataSourceNullValue != null; }
+ }
+
+ public bool IsFormatProviderDefault {
+ get { return formatProvider == System.Globalization.CultureInfo.CurrentUICulture; }
+ }
+
+ public bool IsNullValueDefault {
+ get {
+ if (nullValue is string) {
+ return (string) nullValue == "(null)";
+ }
+ return false;
+ }
+ }
+
+ public object NullValue {
+ get { return nullValue; }
+ set {
+ if (nullValue != value) {
+ nullValue = value;
+ OnStyleChanged();
+ }
+ }
+ }
+
+ public Padding Padding {
+ get { return padding; }
+ set {
+ if (padding != value) {
+ padding = value;
+ OnStyleChanged();
+ }
+ }
+ }
+
+ public Color SelectionBackColor {
+ get { return selectionBackColor; }
+ set {
+ if (value != Color.Empty && (int) value.A != 255) {
+ throw new ArgumentException("BackColor can't have alpha transparency component.");
+ }
+ if (selectionBackColor != value) {
+ selectionBackColor = value;
+ OnStyleChanged();
+ }
+ }
+ }
+
+ public Color SelectionForeColor {
+ get { return selectionForeColor; }
+ set {
+ if (selectionForeColor != value) {
+ selectionForeColor = value;
+ OnStyleChanged();
+ }
+ }
+ }
+
+ public object Tag {
+ get { return tag; }
+ set {
+ if (tag != value) {
+ tag = value;
+ OnStyleChanged();
+ }
+ }
+ }
+
+ public DataGridViewTriState WrapMode {
+ get { return wrapMode; }
+ set {
+ if (!Enum.IsDefined(typeof(DataGridViewTriState), value)) {
+ throw new InvalidEnumArgumentException("Value is not valid DataGridViewTriState.");
+ }
+ if (wrapMode != value) {
+ wrapMode = value;
+ OnStyleChanged();
+ }
+ }
+ }
+
+ public virtual void ApplyStyle (DataGridViewCellStyle dataGridViewCellStyle) {
+ this.alignment = dataGridViewCellStyle.alignment;
+ this.backColor = dataGridViewCellStyle.backColor;
+ this.dataSourceNullValue = dataGridViewCellStyle.dataSourceNullValue;
+ this.font = dataGridViewCellStyle.font;
+ this.foreColor = dataGridViewCellStyle.foreColor;
+ this.format = dataGridViewCellStyle.format;
+ this.formatProvider = dataGridViewCellStyle.formatProvider;
+ this.nullValue = dataGridViewCellStyle.nullValue;
+ this.padding = dataGridViewCellStyle.padding;
+ this.selectionBackColor = dataGridViewCellStyle.selectionBackColor;
+ this.selectionForeColor = dataGridViewCellStyle.selectionForeColor;
+ this.tag = dataGridViewCellStyle.tag;
+ this.wrapMode = dataGridViewCellStyle.wrapMode;
+ }
+
+ public virtual object Clone () {
+ return new DataGridViewCellStyle(this);
+ }
+
+ public override bool Equals (object o) {
+ if (o is DataGridViewCellStyle) {
+ DataGridViewCellStyle o_aux = (DataGridViewCellStyle) o;
+ return this.alignment == o_aux.alignment &&
+ this.backColor == o_aux.backColor &&
+ this.dataSourceNullValue == o_aux.dataSourceNullValue &&
+ this.font == o_aux.font &&
+ this.foreColor == o_aux.foreColor &&
+ this.format == o_aux.format &&
+ this.formatProvider == o_aux.formatProvider &&
+ this.nullValue == o_aux.nullValue &&
+ this.padding == o_aux.padding &&
+ this.selectionBackColor == o_aux.selectionBackColor &&
+ this.selectionForeColor == o_aux.selectionForeColor &&
+ this.tag == o_aux.tag &&
+ this.wrapMode == o_aux.wrapMode;
+ }
+ return false;
+ }
+
+ public override int GetHashCode () {
+ return base.GetHashCode();
+ }
+
+ public override string ToString () {
+ /////////////////////////////////////// COMPROBAR EN Windows ////////////////////////////////
+ return "";
+ }
+
+ internal event EventHandler StyleChanged;
+
+ internal void OnStyleChanged () {
+ if (StyleChanged != null) {
+ StyleChanged(this, EventArgs.Empty);
+ }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStyleContentChangedEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStyleContentChangedEventArgs.cs
new file mode 100644
index 00000000000..32a1b187e3a
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStyleContentChangedEventArgs.cs
@@ -0,0 +1,53 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewCellStyleContentChangedEventArgs : EventArgs {
+
+ private DataGridViewCellStyle cellStyle;
+ private DataGridViewCellStyleScopes cellStyleScope;
+
+ internal DataGridViewCellStyleContentChangedEventArgs (DataGridViewCellStyle cellStyle, DataGridViewCellStyleScopes cellStyleScope) {
+ this.cellStyle = cellStyle;
+ this.cellStyleScope = cellStyleScope;
+ }
+
+ public DataGridViewCellStyle CellStyle {
+ get { return cellStyle; }
+ }
+
+ public DataGridViewCellStyleScopes CellStyleScope {
+ get { return cellStyleScope; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStyleContentChangedEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStyleContentChangedEventHandler.cs
new file mode 100644
index 00000000000..939ba993f1f
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStyleContentChangedEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewCellStyleContentChangedEventHandler (object sender, DataGridViewCellStyleContentChangedEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStyleConverter.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStyleConverter.cs
new file mode 100644
index 00000000000..623a5b9daae
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStyleConverter.cs
@@ -0,0 +1,50 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+#if NET_2_0
+
+using System.ComponentModel;
+using System.Globalization;
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewCellStyleConverter : TypeConverter {
+
+ public DataGridViewCellStyleConverter () {
+ }
+
+ public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType) {
+ throw new NotImplementedException();
+ }
+
+ public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) {
+ throw new NotImplementedException();
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStyleScopes.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStyleScopes.cs
new file mode 100644
index 00000000000..ca3c58a6ed8
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellStyleScopes.cs
@@ -0,0 +1,45 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ [FlagsAttribute()]
+ public enum DataGridViewCellStyleScopes {
+ None = 0,
+ Cell = 1,
+ Column = 2,
+ Row = 4,
+ DataGridView = 8,
+ ColumnHeaders = 16,
+ RowHeaders = 32,
+ Rows = 64,
+ AlternatingRows = 128
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellToolTipTextNeededEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellToolTipTextNeededEventArgs.cs
new file mode 100644
index 00000000000..5397a381425
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellToolTipTextNeededEventArgs.cs
@@ -0,0 +1,48 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewCellToolTipTextNeededEventArgs : DataGridViewCellEventArgs {
+
+ private string toolTipText;
+
+ internal DataGridViewCellToolTipTextNeededEventArgs (string toolTipText, int rowIndex, int columnIndex) : base (columnIndex, rowIndex) {
+ this.toolTipText = toolTipText;
+ }
+
+ public string ToolTipText {
+ get { return toolTipText; }
+ set { toolTipText = value; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellToolTipTextNeededEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellToolTipTextNeededEventHandler.cs
new file mode 100644
index 00000000000..a0f7334b15a
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellToolTipTextNeededEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewCellToolTipTextNeededEventHandler (object sender, DataGridViewCellToolTipTextNeededEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellValidatingEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellValidatingEventArgs.cs
new file mode 100644
index 00000000000..a182080a3fb
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellValidatingEventArgs.cs
@@ -0,0 +1,60 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewCellValidatingEventArgs : CancelEventArgs {
+
+ private int columnIndex;
+ private object formattedValue;
+ private int rowIndex;
+
+ public DataGridViewCellValidatingEventArgs (int columnIndex, int rowIndex, object formattedValue) {
+ this.columnIndex = columnIndex;
+ this.rowIndex = rowIndex;
+ }
+
+ public int ColumnIndex {
+ get { return columnIndex; }
+ }
+
+ public object FormattedValue {
+ get { return formattedValue; }
+ }
+
+ public int RowIndex {
+ get { return rowIndex; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellValidatingEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellValidatingEventHandler.cs
new file mode 100644
index 00000000000..0c83d637184
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellValidatingEventHandler.cs
@@ -0,0 +1,34 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewCellValidatingEventHandler (object sender, DataGridViewCellValidatingEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellValueEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellValueEventArgs.cs
new file mode 100644
index 00000000000..eeb39b855fa
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellValueEventArgs.cs
@@ -0,0 +1,59 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewCellValueEventArgs : EventArgs {
+
+ private int columnIndex;
+ private int rowIndex;
+ private object cellValue;
+
+ public DataGridViewCellValueEventArgs (int columnIndex, int rowIndex) {
+ this.columnIndex = columnIndex;
+ this.rowIndex = rowIndex;
+ }
+
+ public int ColumnIndex {
+ get { return columnIndex; }
+ }
+
+ public int RowIndex {
+ get { return rowIndex; }
+ }
+
+ public object Value {
+ get { return cellValue; }
+ set { cellValue = value; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellValueEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellValueEventHandler.cs
new file mode 100644
index 00000000000..e48dc062f1a
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCellValueEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewCellValueEventHandler (object sender, DataGridViewCellValueEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCheckBoxCell.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCheckBoxCell.cs
new file mode 100644
index 00000000000..3ee310891ac
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCheckBoxCell.cs
@@ -0,0 +1,322 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System;
+using System.ComponentModel;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewCheckBoxCell : DataGridViewCell, IDataGridViewEditingCell {
+
+ private object editingCellFormattedValue;
+ private bool editingCellValueChanged;
+ private object falseValue;
+ private FlatStyle flatStyle;
+ private object indeterminateValue;
+ private bool threeState;
+ private object trueValue;
+ private Type valueType;
+
+ public DataGridViewCheckBoxCell () {
+ editingCellValueChanged = false;
+ falseValue = null;
+ flatStyle = FlatStyle.Standard;
+ indeterminateValue = null;
+ threeState = false;
+ trueValue = null;
+ valueType = null;
+ }
+
+ public DataGridViewCheckBoxCell (bool threeState) : this() {
+ }
+
+ public virtual object EditingCellFormattedValue {
+ get { return editingCellFormattedValue; }
+ set {
+ if (FormattedValueType == null || value == null || value.GetType() != FormattedValueType || !(value is Boolean) || !(value is CheckState)) {
+ throw new ArgumentException("Cannot set this property.");
+ }
+ editingCellFormattedValue = value;
+ }
+ }
+
+ public virtual bool EditingCellValueChanged {
+ get { return editingCellValueChanged; }
+ set { editingCellValueChanged = value; }
+ }
+
+ public override Type EditType {
+ get { return null; }
+ }
+
+ public object FalseValue {
+ get { return falseValue; }
+ set { falseValue = value; }
+ }
+
+ public FlatStyle FlatStyle {
+ get { return flatStyle; }
+ set {
+ if (!Enum.IsDefined(typeof(FlatStyle), value)) {
+ throw new InvalidEnumArgumentException("Value is not valid FlatStyle.");
+ }
+ if (value == FlatStyle.Popup) {
+ throw new Exception("FlatStyle cannot be set to Popup in this control.");
+ }
+ }
+ }
+
+ public override Type FormattedValueType {
+ get {
+ if (ThreeState) {
+ return typeof(CheckState);
+ }
+ return typeof(Boolean);
+ }
+ }
+
+ public object IndeterminateValue {
+ get { return indeterminateValue; }
+ set { indeterminateValue = value; }
+ }
+
+ public bool ThreeState {
+ get { return threeState; }
+ set { threeState = value; }
+ }
+
+ public object TrueValue {
+ get { return trueValue; }
+ set { trueValue = value; }
+ }
+
+ public override Type ValueType {
+ get {
+ if (valueType == null) {
+ if (OwningColumn != null) {
+ return OwningColumn.ValueType;
+ }
+ if (ThreeState) {
+ return typeof(CheckState);
+ }
+ return typeof(Boolean);
+ }
+ return valueType;
+ }
+ set { valueType = value; }
+ }
+
+ public override object Clone () {
+ DataGridViewCheckBoxCell cell = (DataGridViewCheckBoxCell) base.Clone();
+ cell.editingCellValueChanged = this.editingCellValueChanged;
+ cell.falseValue = this.falseValue;
+ cell.flatStyle = this.flatStyle;
+ cell.indeterminateValue = this.indeterminateValue;
+ cell.threeState = this.threeState;
+ cell.trueValue = this.trueValue;
+ cell.valueType = this.valueType;
+ return cell;
+ }
+
+ public virtual object GetEditingCellFormattedValue (DataGridViewDataErrorContexts context) {
+ if (FormattedValueType == null) {
+ throw new InvalidOperationException("FormattedValueType is null.");
+ }
+ if ((context & DataGridViewDataErrorContexts.ClipboardContent) != 0) {
+ return Convert.ToString(Value);
+ }
+ if (ThreeState) {
+ return (CheckState) Value;
+ }
+ return (Boolean) Value;
+ }
+
+ public override object ParseFormattedValue (object formattedValue, DataGridViewCellStyle cellStyle, TypeConverter formattedValueTypeConverter, TypeConverter valueTypeConverter) {
+ if (cellStyle == null) {
+ throw new ArgumentNullException("CellStyle is null");
+ }
+ if (FormattedValueType == null) {
+ throw new FormatException("FormattedValueType is null.");
+ }
+ if (formattedValue == null || formattedValue.GetType() != FormattedValueType) {
+ throw new ArgumentException("FormattedValue is null or is not instance of FormattedValueType.");
+ }
+ throw new NotImplementedException();
+ }
+
+ public virtual void PrepareEditingCellForEdit (bool selectAll) {
+ }
+
+ public override string ToString () {
+ return GetType().Name + ": RowIndex: " + RowIndex.ToString() + "; ColumnIndex: " + ColumnIndex.ToString() + ";";
+ }
+
+ protected override bool ContentClickUnsharesRow (DataGridViewCellEventArgs e) {
+ return this.IsInEditMode;
+ }
+
+ //protected override bool ContentDoubleClickUnsaresRow (DataGridViewCellEventArgs e) {
+ protected bool ContentDoubleClickUnsaresRow (DataGridViewCellEventArgs e) {
+ return this.IsInEditMode;
+ }
+
+ protected override AccessibleObject CreateAccessibilityInstance () {
+ return new DataGridViewCheckBoxCellAccessibleObject(this);
+ }
+
+ protected override Rectangle GetContentBounds (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected override Rectangle GetErrorIconBounds (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ //protected override object GetFormttedValue (object value, int rowIndex, ref DataGridViewCellStyle cellStyle, TypeConverter valueTypeConverter, TypeConverter formattedValueTypeConverter, DataGridViewDataErrorContexts context) {
+ protected object GetFormttedValue (object value, int rowIndex, ref DataGridViewCellStyle cellStyle, TypeConverter valueTypeConverter, TypeConverter formattedValueTypeConverter, DataGridViewDataErrorContexts context) {
+ if (DataGridView == null) {
+ return null;
+ }
+ throw new NotImplementedException();
+ }
+
+ protected override Size GetPreferredSize (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex, Size constraintSize) {
+ throw new NotImplementedException();
+ }
+
+ protected override object GetValue (int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected override bool KeyDownUnsharesRow (KeyEventArgs e, int rowIndex) {
+ // true if the user pressed the SPACE key without modifier keys; otherwise, false
+ throw new NotImplementedException();
+ }
+
+ protected override bool KeyUpUnsharesRow (KeyEventArgs e, int rowIndex) {
+ // true if the user released the SPACE key; otherwise false
+ throw new NotImplementedException();
+
+ }
+
+ protected override bool MouseDownUnsharesRow (DataGridViewCellMouseEventArgs e) {
+ return (e.Button == MouseButtons.Left);
+ }
+
+ protected override bool MouseEnterUnsharesRow (int rowIndex) {
+ // true if the cell was the last cell receiving a mouse click; otherwise, false.
+ throw new NotImplementedException();
+ }
+
+ protected override bool MouseLeaveUnsharesRow (int rowIndex) {
+ // true if the button displayed by the cell is in the pressed state; otherwise, false.
+ throw new NotImplementedException();
+ }
+
+ protected override bool MouseUpUnsharesRow (DataGridViewCellMouseEventArgs e) {
+ // true if the mouse up was caused by the release of the left mouse button; otherwise false.
+ throw new NotImplementedException();
+ }
+
+ protected override void OnContentClick (DataGridViewCellEventArgs e) {
+ throw new NotImplementedException();
+ }
+
+ protected override void OnContentDoubleClick (DataGridViewCellEventArgs e) {
+ throw new NotImplementedException();
+ }
+
+ protected override void OnKeyDown (KeyEventArgs e, int rowIndex) {
+ // when activated by the SPACE key, this method updates the cell's user interface
+ throw new NotImplementedException();
+ }
+
+ protected override void OnKeyUp (KeyEventArgs e, int rowIndex) {
+ // when activated by the SPACE key, this method updates the cell's user interface
+ throw new NotImplementedException();
+ }
+
+ protected override void OnLeave (int rowIndex, bool throughMouseClick) {
+ throw new NotImplementedException();
+ }
+
+ protected override void OnMouseDown (DataGridViewCellMouseEventArgs e) {
+ // if activated by depresing the left mouse button, this method updates the cell's user interface
+ throw new NotImplementedException();
+ }
+
+ protected override void OnMouseEnter (int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected override void OnMouseLeave (int rowIndex) {
+ // if the cell's button is not in its normal state, this method causes the cell's user interface to be updated.
+ throw new NotImplementedException();
+ }
+
+ protected override void OnMouseUp (DataGridViewCellMouseEventArgs e) {
+ // if activated by the left mouse button, this method updates the cell's user interface
+ throw new NotImplementedException();
+ }
+
+ protected override void Paint (Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) {
+ throw new NotImplementedException();
+ }
+
+ protected class DataGridViewCheckBoxCellAccessibleObject : DataGridViewCellAccessibleObject {
+
+ public DataGridViewCheckBoxCellAccessibleObject (DataGridViewCell owner) : base(owner) {
+ }
+
+ public override string DefaultAction {
+ get {
+ if (Owner.ReadOnly) {
+ return "";
+ }
+ // return "Press to check" if the check box is not selected
+ // and "Press to uncheck" if the check box is selected
+ throw new NotImplementedException();
+ }
+ }
+
+ public override void DoDefaultAction () {
+ // change the state of the check box
+ }
+
+ public override int GetChildCount () {
+ return -1;
+ }
+
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCheckBoxColumn.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCheckBoxColumn.cs
new file mode 100644
index 00000000000..13004b293b9
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewCheckBoxColumn.cs
@@ -0,0 +1,134 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewCheckBoxColumn : DataGridViewColumn {
+
+ public DataGridViewCheckBoxColumn (bool threeState) {
+ CellTemplate = new DataGridViewCheckBoxCell();
+ (CellTemplate as DataGridViewCheckBoxCell).ThreeState = threeState;
+ }
+
+ public DataGridViewCheckBoxColumn () : this (false) {
+ }
+
+ public override DataGridViewCell CellTemplate {
+ get { return base.CellTemplate; }
+ set { base.CellTemplate = value as DataGridViewCheckBoxCell; }
+ }
+
+ public override DataGridViewCellStyle DefaultCellStyle {
+ get { return base.DefaultCellStyle; }
+ set { base.DefaultCellStyle = value; }
+ }
+
+ public object FalseValue {
+ get {
+ if (base.CellTemplate == null) {
+ throw new InvalidOperationException("CellTemplate is null.");
+ }
+ return (base.CellTemplate as DataGridViewCheckBoxCell).FalseValue;
+ }
+ set {
+ if (base.CellTemplate == null) {
+ throw new InvalidOperationException("CellTemplate is null.");
+ }
+ (base.CellTemplate as DataGridViewCheckBoxCell).FalseValue = value;
+ }
+ }
+
+ public FlatStyle FlatStyle {
+ get {
+ if (base.CellTemplate == null) {
+ throw new InvalidOperationException("CellTemplate is null.");
+ }
+ return (base.CellTemplate as DataGridViewCheckBoxCell).FlatStyle;
+ }
+ set {
+ if (base.CellTemplate == null) {
+ throw new InvalidOperationException("CellTemplate is null.");
+ }
+ (base.CellTemplate as DataGridViewCheckBoxCell).FlatStyle = value;
+ }
+ }
+
+ public object IndeterminateValue {
+ get {
+ if (base.CellTemplate == null) {
+ throw new InvalidOperationException("CellTemplate is null.");
+ }
+ return (base.CellTemplate as DataGridViewCheckBoxCell).IndeterminateValue;
+ }
+ set {
+ if (base.CellTemplate == null) {
+ throw new InvalidOperationException("CellTemplate is null.");
+ }
+ (base.CellTemplate as DataGridViewCheckBoxCell).IndeterminateValue = value;
+ }
+ }
+
+ public bool ThreeState {
+ get {
+ if (base.CellTemplate == null) {
+ throw new InvalidOperationException("CellTemplate is null.");
+ }
+ return (base.CellTemplate as DataGridViewCheckBoxCell).ThreeState;
+ }
+ set {
+ if (base.CellTemplate == null) {
+ throw new InvalidOperationException("CellTemplate is null.");
+ }
+ (base.CellTemplate as DataGridViewCheckBoxCell).ThreeState = value;
+ }
+ }
+
+ public object TrueValue {
+ get {
+ if (base.CellTemplate == null) {
+ throw new InvalidOperationException("CellTemplate is null.");
+ }
+ return (base.CellTemplate as DataGridViewCheckBoxCell).TrueValue;
+ }
+ set {
+ if (base.CellTemplate == null) {
+ throw new InvalidOperationException("CellTemplate is null.");
+ }
+ (base.CellTemplate as DataGridViewCheckBoxCell).TrueValue = value;
+ }
+ }
+
+ public override string ToString () {
+ throw new NotImplementedException();
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewClipboardCopyMode.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewClipboardCopyMode.cs
new file mode 100644
index 00000000000..9eef1304a7f
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewClipboardCopyMode.cs
@@ -0,0 +1,40 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public enum DataGridViewClipboardCopyMode {
+ Disable = 0,
+ EnableWithAutoHeaderText = 1,
+ EnableWithoutHeaderText = 2,
+ EnableAlwaysIncludeHeaderText = 3
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumn.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumn.cs
new file mode 100644
index 00000000000..59f4669d6fe
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumn.cs
@@ -0,0 +1,387 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewColumn : DataGridViewBand, IComponent, IDisposable {
+
+ private DataGridViewAutoSizeColumnMode autoSizeMode;
+ private DataGridViewCell cellTemplate;
+ //private ContextMenuStrip contextMenuStrip;
+ private string dataPropertyName;
+ private int displayIndex;
+ private int dividerWidth;
+ private float fillWeight;
+ private bool frozen;
+ private DataGridViewColumnHeaderCell headerCell;
+ private string headerText = "";
+ private DataGridViewAutoSizeColumnMode inheritedAutoSizeMode;
+ private bool isDataBound;
+ private int minimumWidth = 5;
+ private string name = "";
+ private bool readOnly;
+ private DataGridViewTriState resizable = DataGridViewTriState.True;
+ private ISite site;
+ private DataGridViewColumnSortMode sortMode;
+ private string toolTipText;
+ private Type valueType;
+ private bool visible = true;
+ private int width = 100;
+
+ public DataGridViewColumn () {
+ cellTemplate = null;
+ base.DefaultCellStyle = new DataGridViewCellStyle();
+ readOnly = false;
+ headerCell = new DataGridViewColumnHeaderCell();
+ headerCell.SetColumnIndex(Index);
+ displayIndex = -1;
+ }
+
+ public DataGridViewColumn (DataGridViewCell cellTemplate) : this () {
+ this.cellTemplate = (DataGridViewCell) cellTemplate.Clone();
+ }
+
+ public DataGridViewAutoSizeColumnMode AutoSizeMode {
+ get { return autoSizeMode; }
+ set { autoSizeMode = value; }
+ }
+
+ public virtual DataGridViewCell CellTemplate {
+ get { return cellTemplate; }
+ set {
+ cellTemplate = value;
+ if (DataGridView != null) {
+ cellTemplate.SetDataGridView(DataGridView);
+ }
+ }
+ }
+
+ public Type CellType {
+ get {
+ if (cellTemplate == null) {
+ return null;
+ }
+ return cellTemplate.GetType();
+ }
+ }
+
+ /*
+ public override ContextMenuStrip ContextMenuStrip {
+ get { return contextMenuStrip; }
+ set {
+ if (contextMenuStrip != value) {
+ contextMenuStrip = value;
+ if (DataGridView != null) {
+ DataGridView.OnColumnContextMenuStripChanged(new DataGridViewColumnEventArgs(this));
+ }
+ }
+ }
+ }
+ */
+
+ public string DataPropertyName {
+ get { return dataPropertyName; }
+ set {
+ if (dataPropertyName != value) {
+ dataPropertyName = value;
+ if (DataGridView != null) {
+ DataGridView.OnColumnDataPropertyNameChanged(new DataGridViewColumnEventArgs(this));
+ }
+ }
+ }
+ }
+
+ public override DataGridViewCellStyle DefaultCellStyle {
+ get {
+ return base.DefaultCellStyle;
+ }
+ set {
+ if (DefaultCellStyle != value) {
+ base.DefaultCellStyle = value;
+ if (DataGridView != null) {
+ DataGridView.OnColumnDefaultCellStyleChanged(new DataGridViewColumnEventArgs(this));
+ }
+ }
+ }
+ }
+
+ public int DisplayIndex {
+ get {
+ if (displayIndex < 0) {
+ return Index;
+ }
+ return displayIndex;
+ }
+ set {
+ if (displayIndex != value) {
+ if (value < 0 || value > Int32.MaxValue) {
+ throw new ArgumentOutOfRangeException("DisplayIndex is out of range");
+ }
+ displayIndex = value;
+ if (DataGridView != null) {
+ DataGridView.OnColumnDisplayIndexChanged(new DataGridViewColumnEventArgs(this));
+ }
+ }
+ }
+ }
+
+ public int DividerWidth {
+ get { return dividerWidth; }
+ set {
+ if (dividerWidth != value) {
+ dividerWidth = value;
+ if (DataGridView != null) {
+ DataGridView.OnColumnDividerWidthChanged(new DataGridViewColumnEventArgs(this));
+ }
+ }
+ }
+ }
+
+ public float FillWeight {
+ get { return fillWeight; }
+ set {
+ fillWeight = value;
+ /* When the System.Windows.Forms.DataGridViewColumn.InheritedAutoSizeMode property value is System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill, the column is resized along with other columns in that mode so that all visible columns in the control exactly fill the horizontal width of the available display area. All fill-mode columns in the control divide the available space in proportions determined by their System.Windows.Forms.DataGridViewColumn.FillWeight property values. For more information about column fill mode, see Column Fill Mode in the Windows Forms DataGridView Control.
+
+The maximum sum of System.Windows.Forms.DataGridViewColumn.FillWeight values for all columns in a System.Windows.Forms.DataGridView control is 65535.
+ */
+ }
+ }
+
+ public override bool Frozen {
+ get { return frozen; }
+ set { frozen = value; }
+ }
+ /* When a column is frozen, all the columns to its left (or to its right in right-to-left languages) are frozen as well. The frozen and unfrozen columns form two groups. If column repositioning is enabled by setting the System.Windows.Forms.DataGridView.AllowUserToOrderColumns property to true, the user cannot drag a column from one group to the other.
+Example */
+
+ public DataGridViewColumnHeaderCell HeaderCell {
+ get { return headerCell; }
+ set {
+ if (headerCell != value) {
+ headerCell = value;
+ if (DataGridView != null) {
+ DataGridView.OnColumnHeaderCellChanged(new DataGridViewColumnEventArgs(this));
+ }
+ }
+ }
+ }
+
+ public string HeaderText {
+ get { return headerText; }
+ set { headerText = value; }
+ }
+
+ public DataGridViewAutoSizeColumnMode InheritedAutoSizeMode {
+ get { return inheritedAutoSizeMode; }
+ }
+
+ public override DataGridViewCellStyle InheritedStyle {
+ get {
+ if (DataGridView == null) {
+ return base.DefaultCellStyle;
+ }
+ else {
+ if (base.DefaultCellStyle == null) {
+ return DataGridView.DefaultCellStyle;
+ }
+ else {
+ DataGridViewCellStyle style = (DataGridViewCellStyle) base.DefaultCellStyle.Clone();
+ /////// Combination with dataGridView.DefaultCellStyle
+ return style;
+ }
+ }
+ }
+ }
+
+ public bool IsDataBound {
+ get { return isDataBound; }
+ }
+
+ public int MinimumWidth {
+ get { return minimumWidth; }
+ set {
+ if (minimumWidth != value) {
+ if (value < 2 || value > Int32.MaxValue) {
+ throw new ArgumentOutOfRangeException("MinimumWidth is out of range");
+ }
+ minimumWidth = value;
+ if (DataGridView != null) {
+ DataGridView.OnColumnMinimumWidthChanged(new DataGridViewColumnEventArgs(this));
+ }
+ }
+ }
+ }
+
+ public string Name {
+ get { return name; }
+ set {
+ if (name != value) {
+ name = value;
+ headerCell.Value = value;
+ if (DataGridView != null) {
+ DataGridView.OnColumnNameChanged(new DataGridViewColumnEventArgs(this));
+ }
+ }
+ }
+ }
+
+ public override bool ReadOnly {
+ get { return readOnly; }
+ set { readOnly = value; }
+ }
+
+ public override DataGridViewTriState Resizable {
+ get { return resizable; }
+ set { resizable = value; }
+ }
+
+ public virtual ISite Site {
+ get { return site; }
+ set { site = value; }
+ }
+
+ public DataGridViewColumnSortMode SortMode {
+ get { return sortMode; }
+ set {
+ // System.InvalidOperationException: The value assigned to the property conflicts with System.Windows.Forms.DataGridView.SelectionMode.
+ if (sortMode != value) {
+ sortMode = value;
+ if (DataGridView != null) {
+ DataGridView.OnColumnSortModeChanged(new DataGridViewColumnEventArgs(this));
+ }
+ }
+ }
+ }
+
+ public string ToolTipText {
+ get { return toolTipText; }
+ set {
+ if (toolTipText != value) {
+ toolTipText = value;
+ if (DataGridView != null) {
+ DataGridView.OnColumnToolTipTextChanged(new DataGridViewColumnEventArgs(this));
+ }
+ }
+ }
+ }
+
+ public Type ValueType {
+ get { return valueType; }
+ set { valueType = value; }
+ }
+
+ public override bool Visible {
+ get { return visible; }
+ set { visible = value; }
+ }
+
+ public int Width {
+ get { return width; }
+ set {
+ if (width != value) {
+ if (value < minimumWidth) {
+ throw new ArgumentOutOfRangeException("Width is less than MinimumWidth");
+ }
+ width = value;
+ if (DataGridView != null) {
+ DataGridView.OnColumnWidthChanged(new DataGridViewColumnEventArgs(this));
+ }
+
+ }
+ }
+ }
+
+ //public sealed event EventHandler Disposed;
+ public event EventHandler Disposed;
+
+ public override object Clone () {
+ return this.MemberwiseClone();
+ /*
+ DataGridViewColumn result = new DataGridViewColumn();
+ return result;
+ */
+ }
+
+ //public sealed void Dispose () {
+ //}
+
+ public virtual int GetPreferredWidth (DataGridViewAutoSizeColumnMode autoSizeColumnMode, bool fixedHeight) {
+ switch (autoSizeColumnMode) {
+ case DataGridViewAutoSizeColumnMode.NotSet:
+ case DataGridViewAutoSizeColumnMode.None:
+ case DataGridViewAutoSizeColumnMode.Fill:
+ throw new ArgumentException("AutoSizeColumnMode is invalid");
+ }
+ if (fixedHeight) {
+ return 0;
+ }
+ else {
+ return 0;
+ }
+ }
+
+ public override string ToString () {
+ return Name + ", Index: " + base.Index.ToString() + ".";
+ }
+
+ protected override void Dispose (bool disposing) {
+ if (disposing) {
+ }
+ }
+
+ internal override void SetDataGridView (DataGridView dataGridView) {
+ base.SetDataGridView(dataGridView);
+ if (cellTemplate != null) {
+ cellTemplate.SetDataGridView(dataGridView);
+ }
+ headerCell.SetDataGridView(dataGridView);
+ }
+
+ internal override void SetIndex (int index) {
+ base.SetIndex(index);
+ headerCell.SetColumnIndex(Index);
+ }
+
+ internal override void SetState (DataGridViewElementStates state) {
+ if (State != state) {
+ base.SetState(state);
+ if (DataGridView != null) {
+ DataGridView.OnColumnStateChanged(new DataGridViewColumnStateChangedEventArgs(this, state));
+ }
+ }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnCollection.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnCollection.cs
new file mode 100644
index 00000000000..1904d2d5b0f
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnCollection.cs
@@ -0,0 +1,237 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System.ComponentModel;
+using System.Collections;
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewColumnCollection : BaseCollection, IList, ICollection, IEnumerable {
+
+ private DataGridView dataGridView;
+
+ public DataGridViewColumnCollection (DataGridView dataGridView) {
+ this.dataGridView = dataGridView;
+ }
+
+ public bool IsFixedSize {
+ get { return base.List.IsFixedSize; }
+ }
+
+ object IList.this [int index] {
+ get { return this[index]; }
+ set { throw new NotSupportedException(); }
+ }
+
+ public DataGridViewColumn this [int index] {
+ get { return (DataGridViewColumn) base.List[index]; }
+ }
+
+ public DataGridViewColumn this [string columnName] {
+ get {
+ foreach (DataGridViewColumn col in base.List) {
+ if (col.Name == columnName) {
+ return col;
+ }
+ }
+ return null;
+ }
+ }
+
+ public event CollectionChangeEventHandler CollectionChanged;
+
+ int IList.Add (object o) {
+ return Add(o as DataGridViewColumn);
+ }
+
+ public virtual int Add (DataGridViewColumn dataGridViewColumn) {
+ dataGridViewColumn.SetIndex(base.List.Count);
+ dataGridViewColumn.SetDataGridView(dataGridView);
+ int result = base.List.Add(dataGridViewColumn);
+ OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Add, dataGridViewColumn));
+ return result;
+ }
+
+ public virtual int Add (string columnName, string headerText) {
+ DataGridViewColumn col = new DataGridViewColumn();
+ col.Name = columnName;
+ col.HeaderText = headerText;
+ return Add(col);
+ }
+
+ public virtual void AddRange (params DataGridViewColumn[] dataGridViewColumns) {
+ foreach (DataGridViewColumn col in dataGridViewColumns) {
+ Add(col);
+ }
+ }
+
+ public virtual void Clear () {
+ base.List.Clear();
+ }
+
+ bool IList.Contains (object o) {
+ return Contains(o as DataGridViewColumn);
+ }
+
+ public virtual bool Contains (DataGridViewColumn dataGridViewColumn) {
+ return base.List.Contains(dataGridViewColumn);
+ }
+
+ public virtual bool Contains (string columnName) {
+ foreach (DataGridViewColumn col in base.List) {
+ if (col.Name == columnName) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void CopyTo (DataGridViewColumn[] array, int index) {
+ base.List.CopyTo(array, index);
+ }
+
+ public int GetColumnCount (DataGridViewElementStates includeFilter) {
+ return 0;
+ }
+
+ public int GetColumnsWidth (DataGridViewElementStates includeFilter) {
+ return 0;
+ }
+
+ public DataGridViewColumn GetFirstColumn (DataGridViewElementStates includeFilter) {
+ return null;
+ }
+
+ public DataGridViewColumn GetFirstColumn (DataGridViewElementStates includeFilter, DataGridViewElementStates excludeFilter) {
+ return null;
+ }
+
+ public DataGridViewColumn GetLastColumn (DataGridViewElementStates includeFilter, DataGridViewElementStates excludeFilter) {
+ return null;
+ }
+
+ public DataGridViewColumn GetNextColumn (DataGridViewColumn dataGridViewColumnStart, DataGridViewElementStates includeFilter, DataGridViewElementStates excludeFilter) {
+ return null;
+ }
+
+ public DataGridViewColumn GetPreviousColumn (DataGridViewColumn dataGridViewColumnStart, DataGridViewElementStates includeFilter, DataGridViewElementStates excludeFilter) {
+ return null;
+ }
+
+ int IList.IndexOf (object o) {
+ return IndexOf(o as DataGridViewColumn);
+ }
+
+ public int IndexOf (DataGridViewColumn dataGridViewColumn) {
+ return base.List.IndexOf(dataGridViewColumn);
+ }
+
+ void IList.Insert (int columnIndex, object o) {
+ Insert(columnIndex, o as DataGridViewColumn);
+ }
+
+ public virtual void Insert (int columnIndex, DataGridViewColumn dataGridViewColumn) {
+ dataGridViewColumn.SetIndex(columnIndex);
+ base.List.Insert(columnIndex, dataGridViewColumn);
+ OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Add, dataGridViewColumn));
+ }
+
+ void IList.Remove (object o) {
+ Remove(o as DataGridViewColumn);
+ }
+
+ public virtual void Remove (DataGridViewColumn dataGridViewColumn) {
+ base.List.Remove(dataGridViewColumn);
+ OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Remove, dataGridViewColumn));
+ }
+
+ public virtual void Remove (string columnName) {
+ foreach (DataGridViewColumn col in base.List) {
+ if (col.Name == columnName) {
+ Remove(col);
+ return;
+ }
+ }
+ }
+
+ public virtual void RemoveAt (int index) {
+ DataGridViewColumn col = this[index];
+ base.List.RemoveAt(index);
+ OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Add, col));
+ }
+
+ protected DataGridView DataGridView {
+ get { return dataGridView; }
+ }
+
+ protected virtual void OnCollectionChanged (CollectionChangeEventArgs e) {
+ if (CollectionChanged != null) {
+ CollectionChanged(this, e);
+ }
+ }
+
+ protected override ArrayList List {
+ get { return base.List; }
+ }
+
+ /************************/
+
+ internal ArrayList ColumnDisplayIndexSortedArrayList {
+ get {
+ ArrayList result = (ArrayList) base.List.Clone();
+ result.Sort(new ColumnDisplayIndexComparator());
+ return result;
+ }
+ }
+
+ private class ColumnDisplayIndexComparator : IComparer {
+
+ public int Compare (object o1, object o2) {
+ DataGridViewColumn col1 = (DataGridViewColumn) o1;
+ DataGridViewColumn col2 = (DataGridViewColumn) o2;
+ if (col1.DisplayIndex < col2.DisplayIndex) {
+ return -1;
+ }
+ else if (col1.DisplayIndex > col2.DisplayIndex) {
+ return 1;
+ }
+ else {
+ return 0;
+ }
+ }
+
+ }
+
+ /************************/
+
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnDesignTimeVisibleAttribute.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnDesignTimeVisibleAttribute.cs
new file mode 100644
index 00000000000..e50881d0935
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnDesignTimeVisibleAttribute.cs
@@ -0,0 +1,75 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public sealed class DataGridViewColumnDesignTimeVisibleAttribute : Attribute {
+
+ public static readonly DataGridViewColumnDesignTimeVisibleAttribute Default = new DataGridViewColumnDesignTimeVisibleAttribute(true);
+
+ public static readonly DataGridViewColumnDesignTimeVisibleAttribute No = new DataGridViewColumnDesignTimeVisibleAttribute(false);
+
+ public static readonly DataGridViewColumnDesignTimeVisibleAttribute Yes = new DataGridViewColumnDesignTimeVisibleAttribute(true);
+
+ private bool visible;
+
+ public DataGridViewColumnDesignTimeVisibleAttribute () {
+ }
+
+ public DataGridViewColumnDesignTimeVisibleAttribute (bool visible) {
+ this.visible = visible;
+ }
+
+ public bool Visible {
+ get { return visible; }
+ set { visible = value; }
+ }
+
+ public override bool Equals (object o) {
+ if (!(o is DataGridViewColumnDesignTimeVisibleAttribute)) {
+ return false;
+ }
+ if ((o as DataGridViewColumnDesignTimeVisibleAttribute).visible != this.visible) {
+ return false;
+ }
+ return base.Equals(o);
+ }
+
+ public override int GetHashCode () {
+ throw new NotImplementedException();
+ }
+
+ public override bool IsDefaultAttribute () {
+ return this.Equals(Default);
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnDividerDoubleClickEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnDividerDoubleClickEventArgs.cs
new file mode 100644
index 00000000000..811621bd7f6
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnDividerDoubleClickEventArgs.cs
@@ -0,0 +1,47 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewColumnDividerDoubleClickEventArgs : HandledMouseEventArgs {
+
+ private int columnIndex;
+
+ public DataGridViewColumnDividerDoubleClickEventArgs (int columnIndex, HandledMouseEventArgs e) : base (e.Button, e.Clicks, e.X, e.Y, e.Delta) {
+ this.columnIndex = columnIndex;
+ }
+
+ public int ColumnIndex {
+ get { return columnIndex; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnDividerDoubleClickEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnDividerDoubleClickEventHandler.cs
new file mode 100644
index 00000000000..1bb1292c922
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnDividerDoubleClickEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewColumnDividerDoubleClickEventHandler (object sender, DataGridViewColumnDividerDoubleClickEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnEventArgs.cs
new file mode 100644
index 00000000000..d452db3bd20
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnEventArgs.cs
@@ -0,0 +1,47 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewColumnEventArgs : EventArgs {
+
+ private DataGridViewColumn dataGridViewColumn;
+
+ public DataGridViewColumnEventArgs (DataGridViewColumn dataGridViewColumn) {
+ this.dataGridViewColumn = dataGridViewColumn;
+ }
+
+ public DataGridViewColumn Column {
+ get { return dataGridViewColumn; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnEventHandler.cs
new file mode 100644
index 00000000000..31a00e315c4
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewColumnEventHandler (object sender, DataGridViewColumnEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnHeaderCell.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnHeaderCell.cs
new file mode 100644
index 00000000000..48286259c21
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnHeaderCell.cs
@@ -0,0 +1,144 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewColumnHeaderCell : DataGridViewHeaderCell {
+
+ private SortOrder sortGlyphDirection = SortOrder.None;
+
+ public DataGridViewColumnHeaderCell () {
+ }
+
+ public SortOrder SortGlyphDirection {
+ get { return sortGlyphDirection; }
+ set { sortGlyphDirection = value; }
+ }
+
+ public override object Clone () {
+ return MemberwiseClone();
+ }
+
+ /*
+ public override ContextMenuStrip GetInheritedContextMenuStrip (int rowIndex) {
+ if (rowIndex != -1) {
+ throw new ArgumentOutOfRangeException("RowIndex is not -1");
+ }
+ if (base.ContextMenuStrip != null) {
+ return base.ContextMenuStrip;
+ }
+ return base.GetInheritedContextMenuStrip(rowIndex); //////////////////////////////
+ }
+ */
+
+ public override DataGridViewCellStyle GetInheritedStyle (DataGridViewCellStyle inheritedCellStyle, int rowIndex, bool includeColors) {
+ throw new NotImplementedException();
+ }
+
+ public override string ToString () {
+ return GetType().Name;
+ }
+
+ protected override AccessibleObject CreateAccessibilityInstance () {
+ return new DataGridViewColumnHeaderCellAccessibleObject(this);
+ }
+
+ protected override object GetClipboardContent (int rowIndex, bool firstCell, bool lastCell, bool inFirstRow, bool inLastRow, string format) {
+ throw new NotImplementedException();
+ //////////////////////////////////////////
+ }
+
+ protected override Rectangle GetContentBounds (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex) {
+ return new Rectangle();
+ }
+
+ protected override Size GetPreferredSize (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex, Size constraintSize) {
+ throw new NotImplementedException();
+ }
+
+ protected override object GetValue (int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected override void Paint (Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates dataGridViewElementState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) {
+ graphics.FillRectangle(new SolidBrush(cellStyle.BackColor), cellBounds);
+ graphics.DrawString((string) formattedValue, cellStyle.Font, new SolidBrush(cellStyle.ForeColor), cellBounds, StringFormat.GenericDefault);
+ PaintBorder(graphics, clipBounds, cellBounds, cellStyle, advancedBorderStyle);
+ }
+
+ protected override bool SetValue (int rowIndex, object value) {
+ throw new NotImplementedException();
+ }
+
+ protected class DataGridViewColumnHeaderCellAccessibleObject : DataGridViewCellAccessibleObject {
+
+ public DataGridViewColumnHeaderCellAccessibleObject (DataGridViewColumnHeaderCell owner) : base (owner) {
+ }
+
+ public override Rectangle Bounds {
+ get { return base.Bounds; }
+ }
+
+ public override string DefaultAction {
+ get { return base.DefaultAction; }
+ }
+
+ public override string Name {
+ get { return base.Name; }
+ }
+
+ public override AccessibleObject Parent {
+ get { return base.Parent; }
+ }
+
+ public override AccessibleRole Role {
+ get { return base.Role; }
+ }
+
+ public override string Value {
+ get { return base.Value; }
+ }
+
+ public override void DoDefaultAction () {
+ base.DoDefaultAction();
+ }
+
+ public override AccessibleObject Navigate (AccessibleNavigation navigationDirection) {
+ return base.Navigate(navigationDirection);
+ }
+
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnHeadersHeightSizeMode.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnHeadersHeightSizeMode.cs
new file mode 100644
index 00000000000..ef5a845ed30
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnHeadersHeightSizeMode.cs
@@ -0,0 +1,39 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public enum DataGridViewColumnHeadersHeightSizeMode {
+ EnableResizing = 0,
+ DisableResizing = 1,
+ AutoSize = 2
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnSortMode.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnSortMode.cs
new file mode 100644
index 00000000000..ccf6f73294e
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnSortMode.cs
@@ -0,0 +1,39 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public enum DataGridViewColumnSortMode {
+ NotSortable = 0,
+ Automatic = 1,
+ Programmatic = 2
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnStateChangedEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnStateChangedEventArgs.cs
new file mode 100644
index 00000000000..215741f96a1
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnStateChangedEventArgs.cs
@@ -0,0 +1,53 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewColumnStateChangedEventArgs : EventArgs {
+
+ private DataGridViewColumn dataGridViewColumn;
+ private DataGridViewElementStates stateChanged;
+
+ public DataGridViewColumnStateChangedEventArgs (DataGridViewColumn dataGridViewColumn, DataGridViewElementStates stateChanged) {
+ this.dataGridViewColumn = dataGridViewColumn;
+ this.stateChanged = stateChanged;
+ }
+
+ public DataGridViewColumn Column {
+ get { return dataGridViewColumn; }
+ }
+
+ public DataGridViewElementStates StateChanged {
+ get { return stateChanged; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnStateChangedEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnStateChangedEventHandler.cs
new file mode 100644
index 00000000000..ca041f87ce8
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnStateChangedEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewColumnStateChangedEventHandler (object sender, DataGridViewColumnStateChangedEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewComboBoxCell.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewComboBoxCell.cs
new file mode 100644
index 00000000000..a68a21dbdcd
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewComboBoxCell.cs
@@ -0,0 +1,330 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System.Collections;
+using System.ComponentModel;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewComboBoxCell : DataGridViewCell {
+
+ private bool autoComplete;
+ private object dataSource;
+ private string displayMember;
+ private DataGridViewComboBoxDisplayStyle displayStyle;
+ private bool displayStyleForCurrentCellOnly;
+ private int dropDownWidth;
+ private FlatStyle flatStyle;
+ private ObjectCollection items;
+ private int maxDropDownItems;
+ private bool sorted;
+ private string valueMember;
+
+ public DataGridViewComboBoxCell () : base() {
+ autoComplete = true;
+ dataSource = null;
+ displayStyle = DataGridViewComboBoxDisplayStyle.DropDownButton;
+ displayStyleForCurrentCellOnly = false;
+ dropDownWidth = 1;
+ flatStyle = FlatStyle.Standard;
+ items = new ObjectCollection(this);
+ maxDropDownItems = 8;
+ sorted = false;
+ }
+
+ public virtual bool AutoComplete {
+ get { return autoComplete; }
+ set { autoComplete = value; }
+ }
+
+ public virtual object DataSource {
+ get { return dataSource; }
+ set {
+ if (value is IList || value is IListSource || value == null) {
+ dataSource = value;
+ return;
+ }
+ throw new Exception("Value is no IList, IListSource or null.");
+ }
+ }
+
+ public virtual string DisplayMember {
+ get { return displayMember; }
+ set { displayMember = value; }
+ }
+
+ public DataGridViewComboBoxDisplayStyle DisplayStyle {
+ get { return displayStyle; }
+ set { displayStyle = value; }
+ }
+
+ public bool DisplayStyleForCurrentCellOnly {
+ get { return displayStyleForCurrentCellOnly; }
+ set { displayStyleForCurrentCellOnly = value; }
+ }
+
+ public virtual int DropDownWidth {
+ get { return dropDownWidth; }
+ set {
+ if (value < 1) {
+ throw new ArgumentOutOfRangeException("Value is less than 1.");
+ }
+ dropDownWidth = value;
+ }
+ }
+
+ public override Type EditType {
+ get { return typeof(DataGridViewComboBoxEditingControl); }
+ }
+
+ public FlatStyle FlatStyle {
+ get { return flatStyle; }
+ set {
+ if (!Enum.IsDefined(typeof(FlatStyle), value)) {
+ throw new InvalidEnumArgumentException("Value is not valid FlatStyle.");
+ }
+ flatStyle = value;
+ }
+ }
+
+ public override Type FormattedValueType {
+ get { return typeof(string); }
+ }
+
+ public virtual ObjectCollection Items {
+ get { return items; }
+ }
+
+ public virtual int MaxDropDownItems {
+ get { return maxDropDownItems; }
+ set {
+ if (value < 1 || value > 100) {
+ throw new ArgumentOutOfRangeException("Value is less than 1 or greater than 100.");
+ }
+ maxDropDownItems = value;
+ }
+ }
+
+ public virtual bool Sorted {
+ get { return sorted; }
+ set {
+ /*
+ if () {
+ throw new ArgumentException("Cannot sort a cell attached to a data source.");
+ }
+ */
+ sorted = value;
+ }
+ }
+
+ public virtual string ValueMember {
+ get { return valueMember; }
+ set { valueMember = value; }
+ }
+
+ public override Type ValueType {
+ get { return typeof(string); }
+ }
+
+ public override object Clone () {
+ DataGridViewComboBoxCell cell = (DataGridViewComboBoxCell) base.Clone();
+ cell.autoComplete = this.autoComplete;
+ cell.dataSource = this.dataSource;
+ cell.displayStyle = this.displayStyle;
+ cell.displayStyleForCurrentCellOnly = this.displayStyleForCurrentCellOnly;
+ cell.dropDownWidth = this.dropDownWidth;
+ cell.flatStyle = this.flatStyle;
+ cell.items.AddRange(this.items);
+ cell.maxDropDownItems = this.maxDropDownItems;
+ cell.sorted = this.sorted;
+ return cell;
+ }
+
+ public override void DetachEditingControl () {
+ throw new NotImplementedException();
+ }
+
+ public override void InitializeEditingControl (int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle) {
+ throw new NotImplementedException();
+ }
+
+ public override bool KeyEntersEditMode (KeyEventArgs e) {
+ throw new NotImplementedException();
+ }
+
+ public override object ParseFormattedValue (object formattedValue, DataGridViewCellStyle cellStyle, TypeConverter formattedValueTypeConverter, TypeConverter valueTypeConverter) {
+ throw new NotImplementedException();
+ }
+
+ public override string ToString () {
+ throw new NotImplementedException();
+ }
+
+ protected override Rectangle GetContentBounds (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected override Rectangle GetErrorIconBounds (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected override object GetFormattedValue (object value, int rowIndex, ref DataGridViewCellStyle cellStyle, TypeConverter valueTypeConverter, TypeConverter formattedValueTypeConverter, DataGridViewDataErrorContexts context) {
+ throw new NotImplementedException();
+ }
+
+ protected override Size GetPreferredSize (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex, Size constraintSize) {
+ throw new NotImplementedException();
+ }
+
+ protected override void OnDataGridViewChanged () {
+ throw new NotImplementedException();
+ }
+
+ protected override void OnEnter (int rowIndex, bool throughMouseClick) {
+ throw new NotImplementedException();
+ }
+
+ protected override void OnLeave (int rowIndex, bool throughMouseClick) {
+ throw new NotImplementedException();
+ }
+
+ protected override void OnMouseClick (DataGridViewCellMouseEventArgs e) {
+ throw new NotImplementedException();
+ }
+
+ protected override void OnMouseEnter (int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected override void OnMouseLeave (int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected override void OnMouseMove (DataGridViewCellMouseEventArgs e) {
+ throw new NotImplementedException();
+ }
+
+ protected override void Paint (Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates elementeState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) {
+ throw new NotImplementedException();
+ }
+
+ public class ObjectCollection : IList, ICollection, IEnumerable {
+
+ private ArrayList list;
+
+ private DataGridViewComboBoxCell owner;
+
+ public ObjectCollection (DataGridViewComboBoxCell owner) {
+ this.owner = owner;
+ list = new ArrayList();
+ }
+
+ public virtual int Count {
+ get { return list.Count; }
+ }
+
+ public virtual bool IsFixedSize {
+ get { return list.IsFixedSize; }
+ }
+
+ public virtual bool IsReadOnly {
+ get { return list.IsReadOnly; }
+ }
+
+ public virtual bool IsSynchronized {
+ get { return list.IsSynchronized; }
+ }
+
+ public virtual object SyncRoot {
+ get { return list.SyncRoot; }
+ }
+
+ public virtual object this [int index] {
+ get { return list[index]; }
+ set { list[index] = value; }
+ }
+
+ public int Add (object item) {
+ return list.Add(item);
+ }
+
+ public void AddRange (ObjectCollection value) {
+ list.AddRange(value.list);
+ }
+
+ public void AddRange (object[] items) {
+ list.AddRange(items);
+ }
+
+ //public sealed void Clear () {
+ public void Clear () {
+ list.Clear();
+ }
+
+ //public sealed bool Contains (object value) {
+ public bool Contains (object value) {
+ return list.Contains(value);
+ }
+
+ public void CopyTo (Array destination, int arrayIndex) {
+ list.CopyTo(destination, arrayIndex);
+ }
+
+ //public sealed IEnumerator GetEnumerator () {
+ public IEnumerator GetEnumerator () {
+ return list.GetEnumerator();
+ }
+
+ //public sealed int IndexOf (object value) {
+ public int IndexOf (object value) {
+ return list.IndexOf(value);
+ }
+
+ //public sealed void Insert (int index, object item) {
+ public void Insert (int index, object item) {
+ list.Insert(index, item);
+ }
+
+ //public sealed void Remove (object value) {
+ public void Remove (object value) {
+ list.Remove(value);
+ }
+
+ //public sealed void RemoveAt (int index) {
+ public void RemoveAt (int index) {
+ list.RemoveAt(index);
+ }
+
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewComboBoxColumn.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewComboBoxColumn.cs
new file mode 100644
index 00000000000..ab1b4e8fd68
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewComboBoxColumn.cs
@@ -0,0 +1,190 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewComboBoxColumn : DataGridViewColumn {
+
+ private bool autoComplete;
+ private DataGridViewComboBoxDisplayStyle displayStyle;
+ private bool displayStyleForCurrentCellsOnly;
+ private FlatStyle flatStyle;
+
+ public DataGridViewComboBoxColumn () {
+ CellTemplate = new DataGridViewComboBoxCell();
+ SortMode = DataGridViewColumnSortMode.NotSortable;
+ autoComplete = true;
+ displayStyle = DataGridViewComboBoxDisplayStyle.DropDownButton;
+ displayStyleForCurrentCellsOnly = false;
+ }
+
+ public bool AutoComplete {
+ get { return autoComplete; }
+ set { autoComplete = value; }
+ }
+
+ public override DataGridViewCell CellTemplate {
+ get { return base.CellTemplate; }
+ set { base.CellTemplate = value as DataGridViewComboBoxCell; }
+ }
+
+ public object DataSource {
+ get {
+ if (base.CellTemplate == null) {
+ throw new InvalidOperationException("CellTemplate is null.");
+ }
+ return (base.CellTemplate as DataGridViewComboBoxCell).DataSource; }
+ set {
+ if (base.CellTemplate == null) {
+ throw new InvalidOperationException("CellTemplate is null.");
+ }
+ (base.CellTemplate as DataGridViewComboBoxCell).DataSource = value;
+ }
+ }
+
+ public string DisplayMember {
+ get {
+ if (base.CellTemplate == null) {
+ throw new InvalidOperationException("CellTemplate is null.");
+ }
+ return (base.CellTemplate as DataGridViewComboBoxCell).DisplayMember;
+ }
+ set {
+ if (base.CellTemplate == null) {
+ throw new InvalidOperationException("CellTemplate is null.");
+ }
+ (base.CellTemplate as DataGridViewComboBoxCell).DisplayMember = value;
+ }
+ }
+
+ public DataGridViewComboBoxDisplayStyle DisplayStyle {
+ get { return displayStyle; }
+ set { displayStyle = value; }
+ }
+
+ public bool DisplayStyleForCurrentCellsOnly {
+ get { return displayStyleForCurrentCellsOnly; }
+ set { displayStyleForCurrentCellsOnly = value; }
+ }
+
+ public int DropDownWidth {
+ get {
+ if (base.CellTemplate == null) {
+ throw new InvalidOperationException("CellTemplate is null.");
+ }
+ return (base.CellTemplate as DataGridViewComboBoxCell).DropDownWidth;
+ }
+ set {
+ if (value < 1) {
+ throw new ArgumentException("Value is less than 1.");
+ }
+ if (base.CellTemplate == null) {
+ throw new InvalidOperationException("CellTemplate is null.");
+ }
+ (base.CellTemplate as DataGridViewComboBoxCell).DropDownWidth = value;
+ }
+ }
+
+ public FlatStyle FlatStyle {
+ get { return flatStyle; }
+ set { flatStyle = value; }
+ }
+
+ public DataGridViewComboBoxCell.ObjectCollection Items {
+ get {
+ if (base.CellTemplate == null) {
+ throw new InvalidOperationException("CellTemplate is null.");
+ }
+ return (base.CellTemplate as DataGridViewComboBoxCell).Items;
+ }
+ }
+
+ public int MaxDropDownItems {
+ get {
+ if (base.CellTemplate == null) {
+ throw new InvalidOperationException("CellTemplate is null.");
+ }
+ return (base.CellTemplate as DataGridViewComboBoxCell).MaxDropDownItems;
+ }
+ set {
+ if (base.CellTemplate == null) {
+ throw new InvalidOperationException("CellTemplate is null.");
+ }
+ (base.CellTemplate as DataGridViewComboBoxCell).MaxDropDownItems = value;
+ }
+ }
+
+ public bool Sorted {
+ get {
+ if (base.CellTemplate == null) {
+ throw new InvalidOperationException("CellTemplate is null.");
+ }
+ return (base.CellTemplate as DataGridViewComboBoxCell).Sorted;
+ }
+ set {
+ if (base.CellTemplate == null) {
+ throw new InvalidOperationException("CellTemplate is null.");
+ }
+ (base.CellTemplate as DataGridViewComboBoxCell).Sorted = value;
+ }
+ }
+
+ public string ValueMember {
+ get {
+ if (base.CellTemplate == null) {
+ throw new InvalidOperationException("CellTemplate is null.");
+ }
+ return (base.CellTemplate as DataGridViewComboBoxCell).ValueMember;
+ }
+ set {
+ if (base.CellTemplate == null) {
+ throw new InvalidOperationException("CellTemplate is null.");
+ }
+ (base.CellTemplate as DataGridViewComboBoxCell).ValueMember = value;
+ }
+ }
+
+ public override object Clone () {
+ DataGridViewComboBoxColumn col = (DataGridViewComboBoxColumn) base.Clone();
+ col.autoComplete = this.autoComplete;
+ col.displayStyle = this.displayStyle;
+ col.displayStyleForCurrentCellsOnly = this.displayStyleForCurrentCellsOnly;
+ col.flatStyle = this.flatStyle;
+ col.CellTemplate = (DataGridViewComboBoxCell) this.CellTemplate.Clone();
+ return col;
+ }
+
+ public override string ToString () {
+ return GetType().Name;
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewComboBoxDisplayStyle.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewComboBoxDisplayStyle.cs
new file mode 100644
index 00000000000..6f19fb10706
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewComboBoxDisplayStyle.cs
@@ -0,0 +1,39 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public enum DataGridViewComboBoxDisplayStyle {
+ ComboBox = 0,
+ DropDownButton = 1,
+ Nothing = 2
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewComboBoxEditingControl.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewComboBoxEditingControl.cs
new file mode 100644
index 00000000000..ee9cf5cda8e
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewComboBoxEditingControl.cs
@@ -0,0 +1,102 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+
+ [ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)]
+ [ComVisibleAttribute(true)]
+ public class DataGridViewComboBoxEditingControl : ComboBox, IDataGridViewEditingControl {
+
+ //private bool tabStop;
+ private DataGridView editingControlDataGridView;
+ private object editingControlFormattedValue;
+ private int editingControlRowIndex;
+ private bool editingControlValueChanged;
+ private Cursor editingPanelCursor;
+
+ public DataGridViewComboBoxEditingControl () {
+ //tabStop = false;
+ editingControlValueChanged = false;
+ }
+
+ public virtual DataGridView EditingControlDataGridView {
+ get { return editingControlDataGridView; }
+ set { editingControlDataGridView = value; }
+ }
+
+ public virtual object EditingControlFormattedValue {
+ get { return editingControlFormattedValue; }
+ set { editingControlFormattedValue = value; }
+ }
+
+ public virtual int EditingControlRowIndex {
+ get { return editingControlRowIndex; }
+ set { editingControlRowIndex = value; }
+ }
+
+ public virtual bool EditingControlValueChanged {
+ get { return editingControlValueChanged; }
+ set { editingControlValueChanged = value; }
+ }
+
+ public virtual Cursor EditingPanelCursor {
+ get { return editingPanelCursor; }
+ }
+
+ public virtual bool RepositionEditingControlOnValueChange {
+ get { return false; }
+ }
+
+ public virtual void ApplyCellStyleToEditingControl (DataGridViewCellStyle dataGridViewCellStyle) {
+ throw new NotImplementedException();
+ }
+
+ public virtual bool EditingControlWantsInputKey (Keys keyData, bool dataGridViewWantsInputKey) {
+ // true if the specified key is a regular key that should be handled by the editing control; otherwise, false
+ throw new NotImplementedException();
+ }
+
+ public virtual object GetEditingControlFormattedValue (DataGridViewDataErrorContexts context) {
+ throw new NotImplementedException();
+ }
+
+ public virtual void PrepareEditingControlForEdit (bool selectAll) {
+ throw new NotImplementedException();
+ }
+
+ protected override void OnSelectedIndexChanged (EventArgs e) {
+ throw new NotImplementedException();
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewContentAlignment.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewContentAlignment.cs
new file mode 100644
index 00000000000..cb077223a7b
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewContentAlignment.cs
@@ -0,0 +1,45 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public enum DataGridViewContentAlignment {
+ NotSet = 0,
+ TopLeft = 1,
+ TopCenter = 2,
+ TopRight = 4,
+ MiddleLeft = 16,
+ MiddleCenter = 32,
+ MiddleRight = 64,
+ BottomLeft = 256,
+ BottomCenter = 512,
+ BottomRight = 1024
+ }
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewDataErrorContexts.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewDataErrorContexts.cs
new file mode 100644
index 00000000000..df316f0d19f
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewDataErrorContexts.cs
@@ -0,0 +1,48 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ [FlagsAttribute()]
+ public enum DataGridViewDataErrorContexts {
+ Formatting = 1,
+ Display = 2,
+ PreferredSize = 4,
+ RowDeletion = 8,
+ Parsing = 256,
+ Commit = 512,
+ InitialValueRestoration = 1024,
+ LeaveControl = 2048,
+ CurrentCellChange = 4096,
+ Scroll = 8192,
+ ClipboardContent = 16384
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewDataErrorEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewDataErrorEventArgs.cs
new file mode 100644
index 00000000000..b1c47b60d47
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewDataErrorEventArgs.cs
@@ -0,0 +1,62 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System;
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewDataErrorEventArgs : DataGridViewCellCancelEventArgs {
+
+ Exception exception;
+ DataGridViewDataErrorContexts context;
+ bool throwException;
+
+ public DataGridViewDataErrorEventArgs (Exception exception, int columnIndex, int rowIndex, DataGridViewDataErrorContexts context) : base(columnIndex, rowIndex) {
+ this.exception = exception;
+ this.context = context;
+ this.throwException = false;
+ }
+
+ public DataGridViewDataErrorContexts Context {
+ get { return context; }
+ }
+
+ public Exception Exception {
+ get { return exception; }
+ }
+
+ public bool ThrowException {
+ get { return throwException; }
+ set { throwException = value; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewDataErrorEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewDataErrorEventHandler.cs
new file mode 100644
index 00000000000..edf2e482b51
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewDataErrorEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewDataErrorEventHandler (object sender, DataGridViewDataErrorEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewEditMode.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewEditMode.cs
new file mode 100644
index 00000000000..0fb63ea4b35
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewEditMode.cs
@@ -0,0 +1,41 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public enum DataGridViewEditMode {
+ EditOnEnter = 0,
+ EditOnKeystroke = 1,
+ EditOnKeystrokeOrF2 = 2,
+ EditOnF2 = 3,
+ EditProgrammatically = 4
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewEditingControlShowingEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewEditingControlShowingEventArgs.cs
new file mode 100644
index 00000000000..bc0563c9646
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewEditingControlShowingEventArgs.cs
@@ -0,0 +1,54 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewEditingControlShowingEventArgs : EventArgs {
+
+ private Control control;
+ private DataGridViewCellStyle cellStyle;
+
+ public DataGridViewEditingControlShowingEventArgs (Control control, DataGridViewCellStyle cellStyle) {
+ this.control = control;
+ this.cellStyle = cellStyle;
+ }
+
+ public DataGridViewCellStyle CellStyle {
+ get { return cellStyle; }
+ set { cellStyle = value; }
+ }
+
+ public Control Control {
+ get { return control; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewEditingControlShowingEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewEditingControlShowingEventHandler.cs
new file mode 100644
index 00000000000..78864d6d21a
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewEditingControlShowingEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewEditingControlShowingEventHandler (object sender, DataGridViewEditingControlShowingEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewElement.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewElement.cs
new file mode 100644
index 00000000000..d539fedd4b2
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewElement.cs
@@ -0,0 +1,110 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewElement {
+
+ private DataGridView dataGridView;
+ private DataGridViewElementStates state;
+
+ public DataGridViewElement () {
+ dataGridView = null;
+ state = DataGridViewElementStates.None;
+ }
+
+ public DataGridView DataGridView {
+ get { return dataGridView; }
+ }
+
+ public virtual DataGridViewElementStates State {
+ get { return state; }
+ }
+
+ protected virtual void OnDataGridViewChanged () {
+ throw new NotImplementedException();
+ }
+
+ protected void RaiseCellClick (DataGridViewCellEventArgs e) {
+ if (dataGridView != null) {
+ dataGridView.InternalOnCellClick(e);
+ }
+ }
+
+ protected void RaiseCellContentClick (DataGridViewCellEventArgs e) {
+ if (dataGridView != null) {
+ dataGridView.InternalOnCellContentClick(e);
+ }
+ }
+
+ protected void RaiseCellContentDoubleClick (DataGridViewCellEventArgs e) {
+ if (dataGridView != null) {
+ dataGridView.InternalOnCellContentDoubleClick(e);
+ }
+ }
+
+ protected void RaiseCellValueChanged (DataGridViewCellEventArgs e) {
+ if (dataGridView != null) {
+ dataGridView.InternalOnCellValueChanged(e);
+ }
+ }
+
+ protected void RaiseDataError (DataGridViewDataErrorEventArgs e) {
+ if (dataGridView != null) {
+ dataGridView.InternalOnDataError(e);
+ }
+ }
+
+ protected void RaiseMouseWheel (MouseEventArgs e) {
+ if (dataGridView != null) {
+ dataGridView.InternalOnMouseWheel(e);
+ }
+ }
+
+ internal virtual void SetDataGridView (DataGridView dataGridView) {
+ if (this.DataGridView == null && dataGridView != null) {
+ this.dataGridView = dataGridView;
+ return;
+ }
+ if (dataGridView != this.DataGridView) {
+ this.dataGridView = dataGridView;
+ OnDataGridViewChanged();
+ }
+ }
+
+ internal virtual void SetState (DataGridViewElementStates state) {
+ this.state = state;
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewElementStates.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewElementStates.cs
new file mode 100644
index 00000000000..f00d4e45dec
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewElementStates.cs
@@ -0,0 +1,49 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+
+ [FlagsAttribute()]
+ [ComVisibleAttribute(true)]
+ public enum DataGridViewElementStates {
+ None = 0,
+ Displayed = 1,
+ Frozen = 2,
+ ReadOnly = 4,
+ Resizable = 8,
+ ResizableSet = 16,
+ Selected = 32,
+ Visible = 64
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewHeaderBorderStyle.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewHeaderBorderStyle.cs
new file mode 100644
index 00000000000..bd3aa5afea6
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewHeaderBorderStyle.cs
@@ -0,0 +1,41 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public enum DataGridViewHeaderBorderStyle {
+ Custom = 0,
+ Single = 1,
+ Raised = 2,
+ Sunken = 3,
+ None = 4
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewHeaderCell.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewHeaderCell.cs
new file mode 100644
index 00000000000..c3ddffa4fe3
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewHeaderCell.cs
@@ -0,0 +1,98 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+ public class DataGridViewHeaderCell : DataGridViewCell {
+
+ private ButtonState buttonState;
+
+ public DataGridViewHeaderCell () {
+ }
+
+ public override bool Displayed {
+ get { return base.Displayed; }
+ }
+
+ public override Type FormattedValueType {
+ get { return typeof(string); } //base.FormattedValueType; }
+ }
+
+ public override bool Frozen {
+ get { return base.Frozen; }
+ }
+
+ public override bool ReadOnly {
+ get { return base.ReadOnly; }
+ set { base.ReadOnly = value; }
+ }
+
+ public override bool Resizable {
+ get { return base.Resizable; }
+ }
+
+ public override bool Selected {
+ get { return base.Selected; }
+ set { base.Selected = value; }
+ }
+
+ public override Type ValueType {
+ get { return base.ValueType; }
+ set { base.ValueType = value; }
+ }
+
+ public override bool Visible {
+ get { return base.Visible; }
+ }
+
+ public override object Clone () {
+ DataGridViewHeaderCell result = new DataGridViewHeaderCell();
+ return result;
+ }
+
+ /*
+ public override ContextMenuStrip GetInheritedContextMenuStrip (int rowIndex) {
+ }
+ */
+
+ public override DataGridViewElementStates GetInheritedState (int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ public override string ToString () {
+ return "";
+ }
+
+ protected ButtonState ButtonState {
+ get { return buttonState; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewHitTestType.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewHitTestType.cs
new file mode 100644
index 00000000000..28d05f6d845
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewHitTestType.cs
@@ -0,0 +1,43 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public enum DataGridViewHitTestType {
+ None = 0,
+ Cell = 1,
+ ColumnHeader = 2,
+ RowHeader = 3,
+ TopLeftHeader = 4,
+ HorizontalScrollBar = 5,
+ VerticalScrollBar = 6
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewImageCell.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewImageCell.cs
new file mode 100644
index 00000000000..ca350e8ed29
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewImageCell.cs
@@ -0,0 +1,174 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System.Drawing;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewImageCell : DataGridViewCell {
+
+ private object defaultNewRowValue;
+ private string description;
+ private DataGridViewImageCellLayout imageLayout;
+ private bool valueIsIcon;
+
+ public DataGridViewImageCell (bool valueIsIcon) {
+ this.valueIsIcon = valueIsIcon;
+ this.imageLayout = DataGridViewImageCellLayout.NotSet;
+ }
+
+ public DataGridViewImageCell () : this(false) {
+ }
+
+ public override object DefaultNewRowValue {
+ get { return defaultNewRowValue; }
+ }
+
+ public string Description {
+ get { return description; }
+ set { description = value; }
+ }
+
+ public override Type EditType {
+ get { return null; }
+ }
+
+ public override Type FormattedValueType {
+ get { return (valueIsIcon)? typeof(Icon) : typeof(Image); }
+ }
+
+ public DataGridViewImageCellLayout ImageLayout {
+ get { return imageLayout; }
+ set {
+ if (!Enum.IsDefined(typeof(DataGridViewImageCellLayout), value)) {
+ throw new InvalidEnumArgumentException("Value is invalid image cell layout.");
+ }
+ imageLayout = value;
+ }
+ }
+
+ public bool ValueIsIcon {
+ get { return valueIsIcon; }
+ set { valueIsIcon = value; }
+ }
+
+ public override Type ValueType {
+ get {
+ if (base.ValueType != null) {
+ return base.ValueType;
+ }
+ if (OwningColumn != null) {
+ return OwningColumn.ValueType;
+ }
+ if (valueIsIcon) {
+ return typeof(Icon);
+ }
+ else {
+ return typeof(Image);
+ }
+ }
+ set { base.ValueType = value; }
+ }
+
+ public override object Clone () {
+ DataGridViewImageCell cell = (DataGridViewImageCell) base.Clone();
+ cell.defaultNewRowValue = this.defaultNewRowValue;
+ cell.description = this.description;
+ cell.valueIsIcon = this.valueIsIcon;
+ return cell;
+ }
+
+ public override string ToString () {
+ return GetType().Name;
+ }
+
+ protected override AccessibleObject CreateAccessibilityInstance () {
+ return new DataGridViewImageCellAccessibleObject(this);
+ }
+
+ protected override Rectangle GetContentBounds (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected override Rectangle GetErrorIconBounds (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected override object GetFormattedValue (object value, int rowIndex, ref DataGridViewCellStyle cellStyle, TypeConverter valueTypeConverter, TypeConverter formattedValueTypeConverter, DataGridViewDataErrorContexts context) {
+ throw new NotImplementedException();
+ }
+
+ protected override Size GetPreferredSize (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex, Size constraintSize) {
+ throw new NotImplementedException();
+ }
+
+ protected override object GetValue (int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected override void OnMouseEnter (int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected override void OnMouseLeave (int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected override void Paint (Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates elementeState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) {
+ throw new NotImplementedException();
+ }
+
+ protected class DataGridViewImageCellAccessibleObject : DataGridViewCellAccessibleObject {
+
+ public DataGridViewImageCellAccessibleObject (DataGridViewCell owner) : base(owner) {
+ }
+
+ public override string DefaultAction {
+ get { return ""; }
+ }
+
+ public override string Description {
+ get { return (Owner as DataGridViewImageCell).Description; }
+ }
+
+ public override void DoDefaultAction () {
+ // The DataGridViewImageCell has no default action.
+ }
+
+ public override int GetChildCount () {
+ return -1;
+ }
+
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewImageCellLayout.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewImageCellLayout.cs
new file mode 100644
index 00000000000..933e831bad0
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewImageCellLayout.cs
@@ -0,0 +1,40 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public enum DataGridViewImageCellLayout {
+ Normal,
+ NotSet,
+ Stretch,
+ Zoom
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewImageColumn.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewImageColumn.cs
new file mode 100644
index 00000000000..4ed6bef247b
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewImageColumn.cs
@@ -0,0 +1,94 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewImageColumn : DataGridViewColumn {
+
+ private Icon icon;
+ private Image image;
+
+ public DataGridViewImageColumn () : this(false) {
+ }
+
+ public DataGridViewImageColumn (bool valuesAreIcons) {
+ //this.valuesAreIcons = valuesAreIcons;
+ base.CellTemplate = new DataGridViewImageCell(valuesAreIcons);
+ (base.CellTemplate as DataGridViewImageCell).ImageLayout = DataGridViewImageCellLayout.Normal;
+ icon = null;
+ image = null;
+ }
+
+ public override DataGridViewCell CellTemplate {
+ get { return base.CellTemplate; }
+ set { base.CellTemplate = value as DataGridViewImageCell; }
+ }
+
+ public override DataGridViewCellStyle DefaultCellStyle {
+ get { return base.DefaultCellStyle; }
+ set { base.DefaultCellStyle = value; }
+ }
+
+ public string Description {
+ get { return (base.CellTemplate as DataGridViewImageCell).Description; }
+ set { (base.CellTemplate as DataGridViewImageCell).Description = value; }
+ }
+
+ public Icon Icon {
+ get { return icon; }
+ set { icon = value; }
+ }
+
+ public Image Image {
+ get { return image; }
+ set { image = value; }
+ }
+
+ public DataGridViewImageCellLayout ImageLayout {
+ get { return (base.CellTemplate as DataGridViewImageCell).ImageLayout; }
+ set { (base.CellTemplate as DataGridViewImageCell).ImageLayout = value; }
+ }
+
+ public override object Clone () {
+ DataGridViewImageColumn col = (DataGridViewImageColumn) base.Clone();
+ col.icon = this.icon;
+ col.image = this.image;
+ return col;
+ }
+
+ public override string ToString () {
+ return GetType().Name;
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewPaintParts.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewPaintParts.cs
new file mode 100644
index 00000000000..f3fb1697684
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewPaintParts.cs
@@ -0,0 +1,46 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ [FlagsAttribute()]
+ public enum DataGridViewPaintParts {
+ None = 0,
+ Background = 1,
+ Border = 2,
+ ContentBackground = 4,
+ ContentForeground = 8,
+ ErrorIcon = 16,
+ Focus = 32,
+ SelectionBackground = 64,
+ All = 127
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRow.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRow.cs
new file mode 100644
index 00000000000..0ca311b69e1
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRow.cs
@@ -0,0 +1,484 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System.Drawing;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewRow : DataGridViewBand {
+
+ private AccessibleObject accessibilityObject;
+ private DataGridViewCellCollection cells;
+ //private ContextMenuStrip contextMenuStrip;
+ private object dataBoundItem;
+ private int dividerHeight;
+ private string errorText;
+ private DataGridViewRowHeaderCell headerCell;
+ private int height;
+ private int minimumHeight;
+
+ public DataGridViewRow () {
+ cells = new DataGridViewCellCollection(this);
+ minimumHeight = 3;
+ height = -1;
+ headerCell = new DataGridViewRowHeaderCell();
+ }
+
+ public AccessibleObject AccessibilityObject {
+ get { return accessibilityObject; }
+ }
+
+ public DataGridViewCellCollection Cells {
+ get { return cells; }
+ }
+
+ /*
+ public override ContextMenuStrip ContextMenuStrip {
+ get { return contextMenuStrip; }
+ set {
+ if (contextMenuStrip != value) {
+ contextMenuStrip = value;
+ if (DataGridView != null) {
+ DataGridView.OnRowContextMenuStripChanged(new DataGridViewRowEventArgs(this));
+ }
+ }
+ }
+ }
+ */
+
+ public object DataBoundItem {
+ get { return dataBoundItem; }
+ }
+
+ public override DataGridViewCellStyle DefaultCellStyle {
+ get { return base.DefaultCellStyle; }
+ set {
+ if (DefaultCellStyle != value) {
+ base.DefaultCellStyle = value;
+ if (DataGridView != null) {
+ DataGridView.OnRowDefaultCellStyleChanged(new DataGridViewRowEventArgs(this));
+ }
+ }
+ }
+ }
+
+ public override bool Displayed {
+ get { return base.Displayed; }
+ }
+
+ public int DividerHeight {
+ get { return dividerHeight; }
+ set { dividerHeight = value; }
+ }
+
+ public string ErrorText {
+ get { return errorText; }
+ set {
+ if (errorText != value) {
+ errorText = value;
+ if (DataGridView != null) {
+ DataGridView.OnRowErrorTextChanged(new DataGridViewRowEventArgs(this));
+ }
+ }
+ }
+ }
+
+ public override bool Frozen {
+ get { return base.Frozen; }
+ set { base.Frozen = value; }
+ }
+
+ public DataGridViewRowHeaderCell HeaderCell {
+ get { return headerCell; }
+ set {
+ if (headerCell != value) {
+ headerCell = value;
+ if (DataGridView != null) {
+ DataGridView.OnRowHeaderCellChanged(new DataGridViewRowEventArgs(this));
+ }
+ }
+ }
+ }
+
+ public int Height {
+ get {
+ if (height < 0) {
+ if (DefaultCellStyle != null && DefaultCellStyle.Font != null) {
+ return DefaultCellStyle.Font.Height + 9;
+ }
+ if (InheritedStyle != null && InheritedStyle.Font != null) {
+ return InheritedStyle.Font.Height + 9;
+ }
+ return System.Windows.Forms.Control.DefaultFont.Height + 9;
+ }
+ return height;
+ }
+ set {
+ if (height != value) {
+ if (height < minimumHeight) {
+ throw new ArgumentOutOfRangeException("Height can't be less than MinimumHeight.");
+ }
+ height = value;
+ if (DataGridView != null) {
+ DataGridView.OnRowHeightChanged(new DataGridViewRowEventArgs(this));
+ }
+ }
+ }
+ }
+
+ public override DataGridViewCellStyle InheritedStyle {
+ get {
+ if (DataGridView == null) {
+ return DefaultCellStyle;
+ }
+ else {
+ if (DefaultCellStyle == null) {
+ return DataGridView.DefaultCellStyle;
+ }
+ else {
+ DataGridViewCellStyle style = (DataGridViewCellStyle) DefaultCellStyle.Clone();
+ /////// Combination with dataGridView.DefaultCellStyle
+ return style;
+ }
+ }
+ }
+ }
+
+ public bool IsNewRow {
+ get {
+ if (DataGridView != null && DataGridView.Rows[DataGridView.Rows.Count - 1] == this) {
+ return true;
+ }
+ return false;
+ }
+ }
+
+ public int MinimumHeight {
+ get { return minimumHeight; }
+ set {
+ if (minimumHeight != value) {
+ if (value < 2 || value > Int32.MaxValue) {
+ throw new ArgumentOutOfRangeException("MinimumHeight should be between 2 and Int32.MaxValue.");
+ }
+ minimumHeight = value;
+ if (DataGridView != null) {
+ DataGridView.OnRowMinimumHeightChanged(new DataGridViewRowEventArgs(this));
+ }
+ }
+ }
+ }
+
+ public override bool ReadOnly {
+ get { return base.ReadOnly; }
+ set { base.ReadOnly = value; }
+ }
+
+ public override DataGridViewTriState Resizable {
+ get { return base.Resizable; }
+ set { base.Resizable = value; }
+ }
+
+ public override bool Selected {
+ get {
+ if (Index == -1) {
+ throw new InvalidOperationException("The row is a shared row.");
+ }
+ if (DataGridView == null) {
+ throw new InvalidOperationException("The row has not been added to a DataGridView control.");
+ }
+ return base.Selected;
+ }
+ set {
+ if (Index == -1) {
+ throw new InvalidOperationException("The row is a shared row.");
+ }
+ if (DataGridView == null) {
+ throw new InvalidOperationException("The row has not been added to a DataGridView control.");
+ }
+ base.Selected = value;
+ foreach (DataGridViewCell cell in cells) {
+ cell.Selected = value;
+ }
+ }
+ }
+
+ public override DataGridViewElementStates State {
+ get { return base.State; }
+ }
+
+ public override bool Visible {
+ get { return base.Visible; }
+ set {
+ if (IsNewRow && value == false) {
+ throw new InvalidOperationException("Cant make invisible a new row.");
+ }
+ base.Visible = value;
+ }
+ }
+
+ public virtual DataGridViewAdvancedBorderStyle AdjustRowHeaderBorderStyle (DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStyleInput, DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStylePlaceholder, bool singleVerticalBorderAdded, bool singleHorizontalBorderAdded, bool isFirstDisplayedRow, bool isLastVisibleRow) {
+ throw new NotImplementedException();
+ }
+
+ public override object Clone () {
+ DataGridViewRow row = (DataGridViewRow) MemberwiseClone();
+ row.cells = new DataGridViewCellCollection(row);
+ foreach (DataGridViewCell cell in cells) {
+ row.cells.Add(cell.Clone() as DataGridViewCell);
+ }
+ return row;
+ }
+
+ public void CreateCells (DataGridView dataGridView) {
+ if (dataGridView == null) {
+ throw new ArgumentNullException("DataGridView is null.");
+ }
+ if (dataGridView.Rows.Contains(this)) {
+ throw new InvalidOperationException("The row already exists in the DataGridView.");
+ }
+ DataGridViewCellCollection newCellCollection = new DataGridViewCellCollection(this);
+ foreach (DataGridViewColumn column in dataGridView.Columns) {
+ if (column.CellTemplate == null) {
+ throw new InvalidOperationException("Cell template not set in column: " + column.Index.ToString() + ".");
+ }
+ newCellCollection.Add((DataGridViewCell) column.CellTemplate.Clone());
+ }
+ cells = newCellCollection;
+ }
+
+ public void CreateCells (DataGridView dataGridView, params object[] values) {
+ if (values == null) {
+ throw new ArgumentNullException("values is null");
+ }
+ CreateCells(dataGridView);
+ for (int i = 0; i < values.Length; i++) {
+ cells[i].Value = values[i];
+ }
+ }
+
+ /*
+ public ContextMenuStrip GetContextMenuStrip (int rowIndex) {
+ if (rowIndex == -1) {
+ throw new InvalidOperationException("rowIndex is -1");
+ }
+ if (rowIndex < 0 || rowIndex >= dataGridView.Rows.Count) {
+ throw new ArgumentOutOfRangeException("rowIndex is out of range");
+ }
+ }
+ */
+
+ public string GetErrorText (int rowIndex) {
+ return "";
+ }
+
+ public virtual int GetPreferredHeight (int rowIndex, DataGridViewAutoSizeRowMode autoSizeRowMode, bool fixedWidth) {
+ throw new NotImplementedException();
+ }
+
+ public virtual DataGridViewElementStates GetState (int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ public void SetValues (params object[] values) {
+ if (values == null) {
+ throw new ArgumentNullException("vues is null");
+ }
+ if (DataGridView != null && DataGridView.VirtualMode) {
+ throw new InvalidOperationException("DataGridView is operating in virtual mode");
+ }
+ /////// COLUMNAS //////////
+ for (int i = 0; i < values.Length; i++) {
+ DataGridViewCell cell = new DataGridViewTextBoxCell();
+ cell.Value = values[i];
+ cells.Add(cell);
+ }
+ }
+
+ public override string ToString () {
+ return this.GetType().Name + ", Band Index: " + base.Index.ToString();
+ }
+
+ protected virtual AccessibleObject CreateAccessibilityInstance () {
+ return new DataGridViewRowAccessibleObject(this);
+ }
+
+ protected virtual DataGridViewCellCollection CreateCellsInstance () {
+ cells = new DataGridViewCellCollection(this);
+ return cells;
+ }
+
+ protected internal virtual void DrawFocus (Graphics graphics, Rectangle clipBounds, Rectangle bounds, int rowIndex, DataGridViewElementStates rowState, DataGridViewCellStyle cellStyle, bool cellsPaintSelectionBackground) {
+ }
+
+ protected internal virtual void Paint (Graphics graphics, Rectangle clipBounds, Rectangle rowBounds, int rowIndex, DataGridViewElementStates rowState, bool isFirstDisplayedRow, bool isLastVisibleRow) {
+ }
+
+ protected internal virtual void PaintCells (Graphics graphics, Rectangle clipBounds, Rectangle rowBounds, int rowIndex, DataGridViewElementStates rowState, bool isFirstDisplayedRow, bool isLastVisibleRow, DataGridViewPaintParts paintParts) {
+ }
+
+ protected internal virtual void PaintHeader (Graphics graphics, Rectangle clipBounds, Rectangle rowBounds, int rowIndex, DataGridViewElementStates rowState, bool isFirstDisplayedRow, bool isLastVisibleRow, DataGridViewPaintParts paintParts) {
+ }
+
+ internal override void SetDataGridView (DataGridView dataGridView) {
+ base.SetDataGridView(dataGridView);
+ headerCell.SetDataGridView(dataGridView);
+ }
+
+ internal override void SetState (DataGridViewElementStates state) {
+ if (State != state) {
+ base.SetState(state);
+ if (DataGridView != null) {
+ DataGridView.OnRowStateChanged(this.Index, new DataGridViewRowStateChangedEventArgs(this, state));
+ }
+ }
+ }
+
+ [ComVisibleAttribute(true)]
+ protected class DataGridViewRowAccessibleObject : AccessibleObject {
+
+ private DataGridViewRow dataGridViewRow;
+
+ public DataGridViewRowAccessibleObject () {
+ }
+
+ public DataGridViewRowAccessibleObject (DataGridViewRow row) {
+ this.dataGridViewRow = row;
+ }
+
+ public override Rectangle Bounds {
+ get { throw new NotImplementedException(); }
+ }
+
+ public override string DefaultAction {
+ get { return "Edit"; }
+ }
+
+ public override string Name {
+ get { return "Index: " + dataGridViewRow.Index.ToString(); }
+ }
+
+ public DataGridViewRow Owner {
+ get { return dataGridViewRow; }
+ set { dataGridViewRow = value; }
+ }
+
+ public override AccessibleObject Parent {
+ get { return dataGridViewRow.AccessibilityObject; }
+ }
+
+ public override AccessibleRole Role {
+ get { return AccessibleRole.Row; }
+ }
+
+ public override AccessibleStates State {
+ get {
+ if (dataGridViewRow.Selected) {
+ return AccessibleStates.Selected;
+ }
+ else {
+ return AccessibleStates.Focused;
+ }
+ }
+ }
+
+ public override string Value {
+ get {
+ if (dataGridViewRow.Cells.Count == 0) {
+ return "(Create New)";
+ }
+ string result = "";
+ foreach (DataGridViewCell cell in dataGridViewRow.Cells) {
+ result += cell.AccessibilityObject.Value;
+ }
+ return result;
+ }
+ }
+
+ public override AccessibleObject GetChild (int index) {
+ throw new NotImplementedException();
+ }
+
+ public override int GetChildCount () {
+ throw new NotImplementedException();
+ }
+
+ public override AccessibleObject GetFocused () {
+ return null;
+ }
+
+ public override AccessibleObject GetSelected () {
+ return null;
+ }
+
+ public override AccessibleObject Navigate (AccessibleNavigation navigationDirection) {
+ switch (navigationDirection) {
+ case AccessibleNavigation.Right:
+ break;
+ case AccessibleNavigation.Left:
+ break;
+ case AccessibleNavigation.Next:
+ break;
+ case AccessibleNavigation.Previous:
+ break;
+ case AccessibleNavigation.Up:
+ break;
+ case AccessibleNavigation.Down:
+ break;
+ default:
+ return null;
+ }
+ return null;
+ }
+
+ public override void Select (AccessibleSelection flags) {
+ switch (flags) {
+ case AccessibleSelection.TakeFocus:
+ dataGridViewRow.DataGridView.Focus();
+ break;
+ case AccessibleSelection.TakeSelection:
+ //dataGridViewRow.Focus();
+ break;
+ case AccessibleSelection.AddSelection:
+ dataGridViewRow.DataGridView.SelectedRows.InternalAdd(dataGridViewRow);
+ break;
+ case AccessibleSelection.RemoveSelection:
+ dataGridViewRow.DataGridView.SelectedRows.InternalRemove(dataGridViewRow);
+ break;
+ }
+ }
+
+ }
+
+
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowCancelEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowCancelEventArgs.cs
new file mode 100644
index 00000000000..5f8a3e9ce48
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowCancelEventArgs.cs
@@ -0,0 +1,49 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewRowCancelEventArgs : CancelEventArgs {
+
+ DataGridViewRow dataGridViewRow;
+
+ public DataGridViewRowCancelEventArgs (DataGridViewRow dataGridViewRow) {
+ this.dataGridViewRow = dataGridViewRow;
+ }
+
+ public DataGridViewRow Row {
+ get { return dataGridViewRow; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowCancelEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowCancelEventHandler.cs
new file mode 100644
index 00000000000..da05cc6224c
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowCancelEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewRowCancelEventHandler (object sender, DataGridViewRowCancelEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowCollection.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowCollection.cs
new file mode 100644
index 00000000000..e8722f9c31b
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowCollection.cs
@@ -0,0 +1,434 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System.ComponentModel;
+using System.Collections;
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewRowCollection : IList, ICollection, IEnumerable {
+
+ private ArrayList list;
+ private DataGridView dataGridView;
+
+ private bool raiseEvent = true;
+
+ public DataGridViewRowCollection (DataGridView dataGridView) {
+ if (dataGridView == null) {
+ throw new ArgumentException("DataGridView is null.");
+ }
+ this.dataGridView = dataGridView;
+ list = new ArrayList();
+ }
+
+ public int Count {
+ get { return list.Count; }
+ }
+
+ public bool IsFixedSize {
+ get { return list.IsFixedSize; }
+ }
+
+ public bool IsReadOnly {
+ get { return list.IsReadOnly; }
+ }
+
+ public bool IsSynchronized {
+ get { return list.IsSynchronized; }
+ }
+
+ object IList.this [int index] {
+ get {
+ Console.WriteLine("acceso");
+ return this[index];
+ }
+ set { list[index] = value as DataGridViewRow; }
+ }
+
+ public DataGridViewRow this [int index] {
+ get {
+ // Accessing a System.Windows.Forms.DataGridViewRow with this indexer causes the row to become unshared. To keep the row shared, use the System.Windows.Forms.DataGridViewRowCollection.SharedRow method. For more information, see Best Practices for Scaling the Windows Forms DataGridView Control.
+ return (DataGridViewRow) list[index];
+ }
+ }
+
+ public object SyncRoot {
+ get { return list.SyncRoot; }
+ }
+
+ public event CollectionChangeEventHandler CollectionChange;
+
+ public virtual int Add () {
+ return Add(dataGridView.RowTemplate.Clone() as DataGridViewRow);
+ }
+
+ int IList.Add(object o) {
+ return Add(o as DataGridViewRow);
+ }
+
+ public virtual int Add (DataGridViewRow dataGridViewRow) {
+ if (dataGridView.DataSource != null) {
+ throw new InvalidOperationException("DataSource of DataGridView is not null.");
+ }
+ if (dataGridView.Columns.Count == 0) {
+ throw new InvalidOperationException("DataGridView has no columns.");
+ }
+ dataGridViewRow.SetIndex(list.Count);
+ dataGridViewRow.SetDataGridView(dataGridView);
+ int result = list.Add(dataGridViewRow);
+ OnCollectionChange(new CollectionChangeEventArgs(CollectionChangeAction.Add, dataGridViewRow));
+ if (raiseEvent) {
+ DataGridView.OnRowsAdded(new DataGridViewRowsAddedEventArgs(result, 1));
+ }
+ return result;
+ }
+
+ public virtual int Add (int count) {
+ if (count <= 0) {
+ throw new ArgumentOutOfRangeException("Count is less than or equeal to 0.");
+ }
+ if (dataGridView.DataSource != null) {
+ throw new InvalidOperationException("DataSource of DataGridView is not null.");
+ }
+ if (dataGridView.Columns.Count == 0) {
+ throw new InvalidOperationException("DataGridView has no columns.");
+ }
+ raiseEvent = false;
+ int result = 0;
+ for (int i = 0; i < count; i++) {
+ result = Add(dataGridView.RowTemplate.Clone() as DataGridViewRow);
+ }
+ DataGridView.OnRowsAdded(new DataGridViewRowsAddedEventArgs(result - count + 1, count));
+ raiseEvent = true;
+ return result;
+ }
+
+ public virtual int Add (params object[] values) {
+ if (values == null) {
+ throw new ArgumentNullException("values is null.");
+ }
+ if (dataGridView.VirtualMode) {
+ throw new InvalidOperationException("DataGridView is in virtual mode.");
+ }
+ DataGridViewRow row = new DataGridViewRow();
+ int result = Add(row);
+ row.SetValues(values);
+ return result;
+ }
+
+ public virtual int AddCopies (int indexSource, int count) {
+ raiseEvent = false;
+ int lastIndex = 0;
+ for (int i = 0; i < count; i++) {
+ lastIndex = AddCopy(indexSource);
+ }
+ DataGridView.OnRowsAdded(new DataGridViewRowsAddedEventArgs(lastIndex - count + 1, count));
+ raiseEvent = true;
+ return lastIndex;
+ }
+
+ public virtual int AddCopy (int indexSource) {
+ return Add((list[indexSource] as DataGridViewRow).Clone() as DataGridViewRow);
+ }
+
+ public virtual void AddRange (params DataGridViewRow[] dataGridViewRows) {
+ raiseEvent = false;
+ int count = 0;
+ int lastIndex = -1;
+ foreach (DataGridViewRow row in dataGridViewRows) {
+ lastIndex = Add(row);
+ count++;
+ }
+ DataGridView.OnRowsAdded(new DataGridViewRowsAddedEventArgs(lastIndex - count + 1, count));
+ raiseEvent = true;
+ }
+
+ public virtual void Clear () {
+ list.Clear();
+ }
+
+ bool IList.Contains (object o) {
+ return Contains(o as DataGridViewRow);
+ }
+
+ public virtual bool Contains (DataGridViewRow dataGridViewRow) {
+ return list.Contains(dataGridViewRow);
+ }
+
+ public void CopyTo (Array array, int index) {
+ list.CopyTo(array, index);
+ }
+
+ public void CopyTo (DataGridViewRow[] array, int index) {
+ list.CopyTo(array, index);
+ }
+
+ public IEnumerator GetEnumerator () {
+ return list.GetEnumerator();
+ }
+
+ public int GetFirstRow (DataGridViewElementStates includeFilter) {
+ for (int i = 0; i < list.Count; i++) {
+ DataGridViewRow row = (DataGridViewRow) list[i];
+ if ((row.State & includeFilter) != 0) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ public int GetFirstRow (DataGridViewElementStates includeFilter, DataGridViewElementStates excludeFilter) {
+ for (int i = 0; i < list.Count; i++) {
+ DataGridViewRow row = (DataGridViewRow) list[i];
+ if (((row.State & includeFilter) != 0) && ((row.State & excludeFilter) == 0)) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ public int GetLastRow (DataGridViewElementStates includeFilter) {
+ for (int i = list.Count - 1; i >= 0; i--) {
+ DataGridViewRow row = (DataGridViewRow) list[i];
+ if ((row.State & includeFilter) != 0) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ public int GetNextRow (int indexStart, DataGridViewElementStates includeFilter) {
+ for (int i = indexStart + 1; i < list.Count; i++) {
+ DataGridViewRow row = (DataGridViewRow) list[i];
+ if ((row.State & includeFilter) != 0) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ public int GetNextRow (int indexStart, DataGridViewElementStates includeFilter, DataGridViewElementStates excludeFilter) {
+ for (int i = indexStart + 1; i < list.Count; i++) {
+ DataGridViewRow row = (DataGridViewRow) list[i];
+ if (((row.State & includeFilter) != 0) && ((row.State & excludeFilter) == 0)) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ public int GetPreviousRow (int indexStart, DataGridViewElementStates includeFilter) {
+ for (int i = indexStart - 1; i >= 0; i--) {
+ DataGridViewRow row = (DataGridViewRow) list[i];
+ if ((row.State & includeFilter) != 0) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ public int GetPreviousRow (int indexStart, DataGridViewElementStates includeFilter, DataGridViewElementStates excludeFilter) {
+ for (int i = indexStart - 1; i >= 0; i--) {
+ DataGridViewRow row = (DataGridViewRow) list[i];
+ if (((row.State & includeFilter) != 0) && ((row.State & excludeFilter) == 0)) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ public int GetRowCount (DataGridViewElementStates includeFilter) {
+ int result = 0;
+ foreach (DataGridViewRow row in list) {
+ if ((row.State & includeFilter) != 0) {
+ result ++;
+ }
+ }
+ return result;
+ }
+
+ public int GetRowsHeight (DataGridViewElementStates includeFilter) {
+ int result = 0;
+ foreach (DataGridViewRow row in list) {
+ if ((row.State & includeFilter) != 0) {
+ result += row.Height;
+ }
+ }
+ return result;
+ }
+
+ public virtual DataGridViewElementStates GetRowState (int rowIndex) {
+ return (list[rowIndex] as DataGridViewRow).State;
+ }
+
+ int IList.IndexOf (object o) {
+ return IndexOf(o as DataGridViewRow);
+ }
+
+ public int IndexOf (DataGridViewRow dataGridViewRow) {
+ return list.IndexOf(dataGridViewRow);
+ }
+
+ void IList.Insert (int rowIndex, object o) {
+ Insert(rowIndex, o as DataGridViewRow);
+ }
+
+ public virtual void Insert (int rowIndex, DataGridViewRow dataGridViewRow) {
+ dataGridViewRow.SetIndex(rowIndex);
+ dataGridViewRow.SetDataGridView(dataGridView);
+ list[rowIndex] = dataGridViewRow;
+ OnCollectionChange(new CollectionChangeEventArgs(CollectionChangeAction.Add, dataGridViewRow));
+ if (raiseEvent) {
+ DataGridView.OnRowsAdded(new DataGridViewRowsAddedEventArgs(rowIndex, 1));
+ }
+ }
+
+ public virtual void Insert (int rowIndex, int count) {
+ int index = rowIndex;
+ raiseEvent = false;
+ for (int i = 0; i < count; i++) {
+ Insert(index++, dataGridView.RowTemplate.Clone());
+ }
+ DataGridView.OnRowsAdded(new DataGridViewRowsAddedEventArgs(rowIndex, count));
+ raiseEvent = true;
+ }
+
+ public virtual void Insert (int rowIndex, params object[] values) {
+ if (values == null) {
+ throw new ArgumentNullException("Values is null.");
+ }
+ if (dataGridView.VirtualMode || dataGridView.DataSource != null) {
+ throw new InvalidOperationException();
+ }
+ DataGridViewRow row = new DataGridViewRow();
+ row.SetValues(values);
+ Insert(rowIndex, row);
+ }
+
+ public virtual void InsertCopies (int indexSource, int indexDestination, int count) {
+ raiseEvent = false;
+ int index = indexDestination;
+ for (int i = 0; i < count; i++) {
+ InsertCopy(indexSource, index++);
+ }
+ DataGridView.OnRowsAdded(new DataGridViewRowsAddedEventArgs(indexDestination, count));
+ raiseEvent = true;
+ }
+
+ public virtual void InsertCopy (int indexSource, int indexDestination) {
+ Insert(indexDestination, (list[indexSource] as DataGridViewRow).Clone());
+ }
+
+ public virtual void InsertRange (int rowIndex, params DataGridViewRow[] dataGridViewRows) {
+ raiseEvent = false;
+ int index = rowIndex;
+ int count = 0;
+ foreach (DataGridViewRow row in dataGridViewRows) {
+ Insert(index++, row);
+ count++;
+ }
+ DataGridView.OnRowsAdded(new DataGridViewRowsAddedEventArgs(rowIndex, count));
+ raiseEvent = true;
+ }
+
+ void IList.Remove (object o) {
+ Remove(o as DataGridViewRow);
+ }
+
+ public virtual void Remove (DataGridViewRow dataGridViewRow) {
+ list.Remove(dataGridViewRow);
+ OnCollectionChange(new CollectionChangeEventArgs(CollectionChangeAction.Remove, dataGridViewRow));
+ DataGridView.OnRowsRemoved(new DataGridViewRowsRemovedEventArgs(dataGridViewRow.Index, 1));
+ }
+
+ public virtual void RemoveAt (int index) {
+ DataGridViewRow row = this[index];
+ list.RemoveAt(index);
+ OnCollectionChange(new CollectionChangeEventArgs(CollectionChangeAction.Remove, row));
+ DataGridView.OnRowsRemoved(new DataGridViewRowsRemovedEventArgs(index, 1));
+ }
+
+ public DataGridViewRow SharedRow (int rowIndex) {
+ return (DataGridViewRow) list[rowIndex];
+ }
+
+ protected DataGridView DataGridView {
+ get { return dataGridView; }
+ }
+
+ protected ArrayList List {
+ get { return list; }
+ }
+
+ protected virtual void OnCollectionChange (CollectionChangeEventArgs e) {
+ if (CollectionChange != null) {
+ CollectionChange(this, e);
+ }
+ }
+
+ /************************/
+
+ internal void InternalAdd (DataGridViewRow dataGridViewRow) {
+ dataGridViewRow.SetIndex(list.Count);
+ dataGridViewRow.SetDataGridView(dataGridView);
+ int result = list.Add(dataGridViewRow);
+ }
+
+ internal ArrayList RowIndexSortedArrayList {
+ get {
+ ArrayList result = (ArrayList) list.Clone();
+ result.Sort(new RowIndexComparator());
+ return result;
+ }
+ }
+
+ private class RowIndexComparator : IComparer {
+
+ public int Compare (object o1, object o2) {
+ DataGridViewRow row1 = (DataGridViewRow) o1;
+ DataGridViewRow row2 = (DataGridViewRow) o2;
+ if (row1.Index < row2.Index) {
+ return -1;
+ }
+ else if (row1.Index > row2.Index) {
+ return 1;
+ }
+ else {
+ return 0;
+ }
+ }
+
+ }
+
+ /************************/
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowContextMenuStripNeededEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowContextMenuStripNeededEventArgs.cs
new file mode 100644
index 00000000000..96f09f2e67f
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowContextMenuStripNeededEventArgs.cs
@@ -0,0 +1,55 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewRowContextMenuStripNeededEventArgs : EventArgs {
+
+ private int rowIndex;
+ //private ContextMenuStrip contextMenuStrip;
+
+ public DataGridViewRowContextMenuStripNeededEventArgs (int rowIndex) {
+ this.rowIndex = rowIndex;
+ }
+
+ /*
+ public ContextMenuStrip ContextMenuStrip {
+ get { return contextMenuStrip; }
+ set { contextMenuStrip = value; }
+ }
+ */
+
+ public int RowIndex {
+ get { return rowIndex; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowContextMenuStripNeededEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowContextMenuStripNeededEventHandler.cs
new file mode 100644
index 00000000000..67fae9c98aa
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowContextMenuStripNeededEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewRowContextMenuStripNeededEventHandler (object sender, DataGridViewRowContextMenuStripNeededEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowDividerDoubleClickEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowDividerDoubleClickEventArgs.cs
new file mode 100644
index 00000000000..72ef21a5ec2
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowDividerDoubleClickEventArgs.cs
@@ -0,0 +1,47 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewRowDividerDoubleClickEventArgs : HandledMouseEventArgs {
+
+ private int rowIndex;
+
+ public DataGridViewRowDividerDoubleClickEventArgs (int rowIndex, HandledMouseEventArgs e) : base(e.Button, e.Clicks, e.X, e.Y, e.Delta) {
+ this.rowIndex = rowIndex;
+ }
+
+ public int RowIndex {
+ get { return rowIndex; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowDividerDoubleClickEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowDividerDoubleClickEventHandler.cs
new file mode 100644
index 00000000000..7a4605e2ef4
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowDividerDoubleClickEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewRowDividerDoubleClickEventHandler (object sender, DataGridViewRowDividerDoubleClickEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowErrorTextNeededEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowErrorTextNeededEventArgs.cs
new file mode 100644
index 00000000000..2a5734a1412
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowErrorTextNeededEventArgs.cs
@@ -0,0 +1,54 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewRowErrorTextNeededEventArgs : EventArgs {
+
+ private int rowIndex;
+ private string errorText;
+
+ internal DataGridViewRowErrorTextNeededEventArgs (int rowIndex, string errorText) {
+ this.rowIndex = rowIndex;
+ this.errorText = errorText;
+ }
+
+ public string ErrorText {
+ get { return errorText; }
+ set { errorText = value; }
+ }
+
+ public int RowIndex {
+ get { return rowIndex; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowErrorTextNeededEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowErrorTextNeededEventHandler.cs
new file mode 100644
index 00000000000..052a4cb3319
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowErrorTextNeededEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewRowErrorTextNeededEventHandler (object sender, DataGridViewRowErrorTextNeededEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowEventArgs.cs
new file mode 100644
index 00000000000..18b28444417
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowEventArgs.cs
@@ -0,0 +1,47 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewRowEventArgs : EventArgs {
+
+ private DataGridViewRow dataGridViewRow;
+
+ public DataGridViewRowEventArgs (DataGridViewRow dataGridViewRow) {
+ this.dataGridViewRow = dataGridViewRow;
+ }
+
+ public DataGridViewRow Row {
+ get { return dataGridViewRow; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowEventHandler.cs
new file mode 100644
index 00000000000..a67cd6a3add
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewRowEventHandler (object sender, DataGridViewRowEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowHeaderCell.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowHeaderCell.cs
new file mode 100644
index 00000000000..363366e19f5
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowHeaderCell.cs
@@ -0,0 +1,144 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewRowHeaderCell : DataGridViewHeaderCell {
+
+ public DataGridViewRowHeaderCell () {
+ }
+
+ public override object Clone () {
+ return MemberwiseClone();
+ }
+
+ /*
+ public override ContextMenuStrip GetInheritedContextMenuStrip (int rowIndex) {
+ }
+ */
+
+ public override DataGridViewCellStyle GetInheritedStyle (DataGridViewCellStyle inheritedCellStyle, int rowIndex, bool includeColors) {
+ throw new NotImplementedException();
+ }
+
+ public override string ToString () {
+ return base.ToString();
+ }
+
+ protected override AccessibleObject CreateAccessibilityInstance () {
+ return new DataGridViewRowHeaderCellAccessibleObject(this);
+ }
+
+ protected override object GetClipboardContent (int rowIndex, bool firstCell, bool lastCell, bool inFirstRow, bool inLastRow, string format) {
+ throw new NotImplementedException();
+ }
+
+ protected override Rectangle GetContentBounds (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected override Rectangle GetErrorIconBounds (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected internal override string GetErrorText (int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected override Size GetPreferredSize (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex, Size constraintSize) {
+ throw new NotImplementedException();
+ }
+
+ protected override object GetValue (int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected override void OnMouseEnter (int rowIndex) {
+ }
+
+ protected override void OnMouseLeave (int rowIndex) {
+ }
+
+ protected override void Paint (Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) {
+ graphics.FillRectangle(new SolidBrush(cellStyle.BackColor), cellBounds);
+ if ((cellState & DataGridViewElementStates.Selected) != 0) {
+ graphics.DrawString("*", cellStyle.Font, new SolidBrush(cellStyle.ForeColor), cellBounds, StringFormat.GenericDefault);
+ }
+ PaintBorder(graphics, clipBounds, cellBounds, cellStyle, advancedBorderStyle);
+ }
+
+ protected override bool SetValue (int rowIndex, object value) {
+ throw new NotImplementedException();
+ }
+
+ protected class DataGridViewRowHeaderCellAccessibleObject : DataGridViewCellAccessibleObject {
+
+ public DataGridViewRowHeaderCellAccessibleObject (DataGridViewRowHeaderCell owner) : base(owner) {
+ }
+
+ public override Rectangle Bounds {
+ get { return base.Bounds; }
+ }
+
+ public override string DefaultAction {
+ get { return base.DefaultAction; }
+ }
+
+ public override string Name {
+ get { return base.Name; }
+ }
+
+ public override AccessibleObject Parent {
+ get { return base.Parent; }
+ }
+
+ public override AccessibleRole Role {
+ get { return base.Role; }
+ }
+
+ public override string Value {
+ get { return base.Value; }
+ }
+
+ public override void DoDefaultAction () {
+ base.DoDefaultAction();
+ }
+
+ public override AccessibleObject Navigate (AccessibleNavigation navigationDirection) {
+ return base.Navigate(navigationDirection);
+ }
+
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowHeadersWidthSizeMode.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowHeadersWidthSizeMode.cs
new file mode 100644
index 00000000000..6bf0613ef78
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowHeadersWidthSizeMode.cs
@@ -0,0 +1,41 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public enum DataGridViewRowHeadersWidthSizeMode {
+ EnableResizing = 0,
+ DisableResizing = 1,
+ AutoSizeToAllHeaders = 2,
+ AutoSizeToDisplayedHeaders = 3,
+ AutoSizeToFirstHeader = 4
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowHeightInfoNeededEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowHeightInfoNeededEventArgs.cs
new file mode 100644
index 00000000000..8e120be8447
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowHeightInfoNeededEventArgs.cs
@@ -0,0 +1,59 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewRowHeightInfoNeededEventArgs : EventArgs {
+
+ private int height;
+ private int minimumHeight;
+ private int rowIndex;
+
+ internal DataGridViewRowHeightInfoNeededEventArgs (int rowIndex, int height, int minimumHeight) {
+ this.rowIndex = rowIndex;
+ this.height = height;
+ this.minimumHeight = minimumHeight;
+ }
+
+ public int Height {
+ get { return height; }
+ }
+
+ public int MinimumHeight {
+ get { return minimumHeight; }
+ }
+
+ public int RowIndex {
+ get { return rowIndex; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowHeightInfoNeededEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowHeightInfoNeededEventHandler.cs
new file mode 100644
index 00000000000..c60d955df4e
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowHeightInfoNeededEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewRowHeightInfoNeededEventHandler (object sender, DataGridViewRowHeightInfoNeededEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowHeightInfoPushedEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowHeightInfoPushedEventArgs.cs
new file mode 100644
index 00000000000..cd97dffa295
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowHeightInfoPushedEventArgs.cs
@@ -0,0 +1,61 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewRowHeightInfoPushedEventArgs : HandledEventArgs {
+
+ private int height;
+ private int minimumHeight;
+ private int rowIndex;
+
+ internal DataGridViewRowHeightInfoPushedEventArgs (int rowIndex, int height, int minimumHeight) {
+ this.rowIndex = rowIndex;
+ this.height = height;
+ this.minimumHeight = minimumHeight;
+ }
+
+ public int Height {
+ get { return height; }
+ }
+
+ public int MinimumHeight {
+ get { return minimumHeight; }
+ }
+
+ public int RowIndex {
+ get { return rowIndex; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowHeightInfoPushedEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowHeightInfoPushedEventHandler.cs
new file mode 100644
index 00000000000..e0cb9ac0d39
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowHeightInfoPushedEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewRowHeightInfoPushedEventHandler (object sender, DataGridViewRowHeightInfoPushedEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowPostPaintEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowPostPaintEventArgs.cs
new file mode 100644
index 00000000000..55e4b23231c
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowPostPaintEventArgs.cs
@@ -0,0 +1,125 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System.ComponentModel;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewRowPostPaintEventArgs : HandledEventArgs {
+
+ private DataGridView dataGridView;
+ private Graphics graphics;
+ private Rectangle clipBounds;
+ private Rectangle rowBounds;
+ private int rowIndex;
+ private DataGridViewElementStates rowState;
+ private string errorText;
+ private DataGridViewCellStyle inheritedRowStyle;
+ private bool isFirstDisplayedRow;
+ private bool isLastVisibleRow;
+
+ public DataGridViewRowPostPaintEventArgs (DataGridView dataGridView, Graphics graphics, Rectangle clipBounds, Rectangle rowBounds, int rowIndex, DataGridViewElementStates rowState, string errorText, DataGridViewCellStyle inheritedRowStyle, bool isFirstDisplayedRow, bool isLastVisibleRow) {
+ this.dataGridView = dataGridView;
+ this.graphics = graphics;
+ this.clipBounds = clipBounds;
+ this.rowBounds = rowBounds;
+ this.rowIndex = rowIndex;
+ this.rowState = rowState;
+ this.errorText = errorText;
+ this.inheritedRowStyle = inheritedRowStyle;
+ this.isFirstDisplayedRow = isFirstDisplayedRow;
+ this.isLastVisibleRow = isLastVisibleRow;
+ }
+
+ public Rectangle ClipBounds {
+ get { return clipBounds; }
+ set { clipBounds = value; }
+ }
+
+ public string ErrorText {
+ get { return errorText; }
+ }
+
+ public Graphics Graphics {
+ get { return graphics; }
+ }
+
+ public DataGridViewCellStyle InheritedRowStyle {
+ get { return inheritedRowStyle; }
+ }
+
+ public bool IsFirstDisplayedRow {
+ get { return isFirstDisplayedRow; }
+ }
+
+ public bool IsLastVisibleRow {
+ get { return isLastVisibleRow; }
+ }
+
+ public Rectangle RowBounds {
+ get { return rowBounds; }
+ }
+
+ public int RowIndex {
+ get { return rowIndex; }
+ }
+
+ public DataGridViewElementStates State {
+ get { return rowState; }
+ }
+
+ public void DrawFocus (Rectangle bounds, bool cellsPaintSelectionBackground) {
+ throw new NotImplementedException();
+ }
+
+ public void PaintCells (Rectangle clipBounds, DataGridViewPaintParts paintParts) {
+ throw new NotImplementedException();
+ }
+
+ public void PaintCellsBackground (Rectangle clipBounds, bool cellsPaintSelectionBackground) {
+ throw new NotImplementedException();
+ }
+
+ public void PaintCellsContent (Rectangle clipBounds) {
+ throw new NotImplementedException();
+ }
+
+ public void PaintHeader (bool paintSelectionBackground) {
+ throw new NotImplementedException();
+ }
+
+ public void PaintHeader (DataGridViewPaintParts paintParts) {
+ throw new NotImplementedException();
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowPostPaintEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowPostPaintEventHandler.cs
new file mode 100644
index 00000000000..8b2d61d5aec
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowPostPaintEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewRowPostPaintEventHandler (object sender, DataGridViewRowPostPaintEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowPrePaintEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowPrePaintEventArgs.cs
new file mode 100644
index 00000000000..e153a302f5f
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowPrePaintEventArgs.cs
@@ -0,0 +1,131 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System.ComponentModel;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewRowPrePaintEventArgs : HandledEventArgs {
+
+ private DataGridView dataGridView;
+ private Graphics graphics;
+ private Rectangle clipBounds;
+ private Rectangle rowBounds;
+ private int rowIndex;
+ private DataGridViewElementStates rowState;
+ private string errorText;
+ private DataGridViewCellStyle inheritedRowStyle;
+ private bool isFirstDisplayedRow;
+ private bool isLastVisibleRow;
+ private DataGridViewPaintParts paintParts;
+
+ public DataGridViewRowPrePaintEventArgs (DataGridView dataGridView, Graphics graphics, Rectangle clipBounds, Rectangle rowBounds, int rowIndex, DataGridViewElementStates rowState, string errorText, DataGridViewCellStyle inheritedRowStyle, bool isFirstDisplayedRow, bool isLastVisibleRow) {
+ this.dataGridView = dataGridView;
+ this.graphics = graphics;
+ this.clipBounds = clipBounds;
+ this.rowBounds = rowBounds;
+ this.rowIndex = rowIndex;
+ this.rowState = rowState;
+ this.errorText = errorText;
+ this.inheritedRowStyle = inheritedRowStyle;
+ this.isFirstDisplayedRow = isFirstDisplayedRow;
+ this.isLastVisibleRow = isLastVisibleRow;
+ }
+
+ public Rectangle ClipBounds {
+ get { return clipBounds; }
+ set { clipBounds = value; }
+ }
+
+ public string ErrorText {
+ get { return errorText; }
+ }
+
+ public Graphics Graphics {
+ get { return graphics; }
+ }
+
+ public DataGridViewCellStyle InheritedRowStyle {
+ get { return inheritedRowStyle; }
+ }
+
+ public bool IsFirstDisplayedRow {
+ get { return isFirstDisplayedRow; }
+ }
+
+ public bool IsLastVisibleRow {
+ get { return isLastVisibleRow; }
+ }
+
+ public DataGridViewPaintParts PaintParts {
+ get { return paintParts; }
+ set { paintParts = value; }
+ }
+
+ public Rectangle RowBounds {
+ get { return rowBounds; }
+ }
+
+ public int RowIndex {
+ get { return rowIndex; }
+ }
+
+ public DataGridViewElementStates State {
+ get { return rowState; }
+ }
+
+ public void DrawFocus (Rectangle bounds, bool cellsPaintSelectionBackground) {
+ throw new NotImplementedException();
+ }
+
+ public void PaintCells (Rectangle clipBounds, DataGridViewPaintParts paintParts) {
+ throw new NotImplementedException();
+ }
+
+ public void PaintCellsBackground (Rectangle clipBounds, bool cellsPaintSelectionBackground) {
+ throw new NotImplementedException();
+ }
+
+ public void PaintCellsContent (Rectangle clipBounds) {
+ throw new NotImplementedException();
+ }
+
+ public void PaintHeader (bool paintSelectionBackground) {
+ throw new NotImplementedException();
+ }
+
+ public void PaintHeader (DataGridViewPaintParts paintParts) {
+ throw new NotImplementedException();
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowPrePaintEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowPrePaintEventHandler.cs
new file mode 100644
index 00000000000..5b70ad76ebe
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowPrePaintEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewRowPrePaintEventHandler (object sender, DataGridViewRowPrePaintEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowStateChangedEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowStateChangedEventArgs.cs
new file mode 100644
index 00000000000..0c1076112a4
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowStateChangedEventArgs.cs
@@ -0,0 +1,53 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewRowStateChangedEventArgs : EventArgs {
+
+ private DataGridViewRow dataGridViewRow;
+ private DataGridViewElementStates stateChanged;
+
+ public DataGridViewRowStateChangedEventArgs (DataGridViewRow dataGridViewRow, DataGridViewElementStates stateChanged) {
+ this.dataGridViewRow = dataGridViewRow;
+ this.stateChanged = stateChanged;
+ }
+
+ public DataGridViewRow Row {
+ get { return dataGridViewRow; }
+ }
+
+ public DataGridViewElementStates StateChanged {
+ get { return stateChanged; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowStateChangedEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowStateChangedEventHandler.cs
new file mode 100644
index 00000000000..da4b1e46947
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowStateChangedEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewRowStateChangedEventHandler (object sender, DataGridViewRowStateChangedEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowsAddedEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowsAddedEventArgs.cs
new file mode 100644
index 00000000000..bdc620b9e22
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowsAddedEventArgs.cs
@@ -0,0 +1,53 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewRowsAddedEventArgs : EventArgs {
+
+ private int rowIndex;
+ private int rowCount;
+
+ public DataGridViewRowsAddedEventArgs (int rowIndex, int rowCount) {
+ this.rowIndex = rowIndex;
+ this.rowCount = rowCount;
+ }
+
+ public int RowCount {
+ get { return rowCount; }
+ }
+
+ public int RowIndex {
+ get { return rowIndex; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowsAddedEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowsAddedEventHandler.cs
new file mode 100644
index 00000000000..035ec129d8b
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowsAddedEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewRowsAddedEventHandler (object sender, DataGridViewRowsAddedEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowsDeletedEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowsDeletedEventArgs.cs
new file mode 100644
index 00000000000..24aea6e21c5
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowsDeletedEventArgs.cs
@@ -0,0 +1,53 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewRowsDeletedEventArgs : EventArgs {
+
+ private int rowCount;
+ private int rowIndex;
+
+ public DataGridViewRowsDeletedEventArgs (int rowIndex, int rowCount) {
+ this.rowIndex = rowIndex;
+ this.rowCount = rowCount;
+ }
+
+ public int RowCount {
+ get { return rowCount; }
+ }
+
+ public int RowIndex {
+ get { return rowIndex; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowsRemovedEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowsRemovedEventArgs.cs
new file mode 100644
index 00000000000..d0383c07340
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowsRemovedEventArgs.cs
@@ -0,0 +1,53 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewRowsRemovedEventArgs : EventArgs {
+
+ private int rowIndex;
+ private int rowCount;
+
+ public DataGridViewRowsRemovedEventArgs (int rowIndex, int rowCount) {
+ this.rowIndex = rowIndex;
+ this.rowCount = rowCount;
+ }
+
+ public int RowCount {
+ get { return rowCount; }
+ }
+
+ public int RowIndex {
+ get { return rowIndex; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowsRemovedEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowsRemovedEventHandler.cs
new file mode 100644
index 00000000000..8368976ef09
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowsRemovedEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewRowsRemovedEventHandler (object sender, DataGridViewRowsRemovedEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewSelectedCellCollection.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewSelectedCellCollection.cs
new file mode 100644
index 00000000000..9ad2a8df63f
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewSelectedCellCollection.cs
@@ -0,0 +1,118 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewSelectedCellCollection : BaseCollection, IList, ICollection, IEnumerable {
+
+ public DataGridViewSelectedCellCollection () {
+ }
+
+ public bool IsFixedSize {
+ get { return base.List.IsFixedSize; }
+ }
+
+ object IList.this [int index] {
+ get { return this[index]; }
+ set { throw new NotSupportedException(); }
+ }
+
+ public DataGridViewCell this [int index] {
+ get { return (DataGridViewCell) base.List[index]; }
+ }
+
+ public int Add (object o) {
+ throw new NotSupportedException();
+ }
+
+ public void Clear () {
+ throw new NotSupportedException("Cannot clear this base.List");
+ }
+
+ public bool Contains (object o) {
+ return Contains(o as DataGridViewCell);
+ }
+
+ public bool Contains (DataGridViewCell dataGridViewCell) {
+ return base.List.Contains(dataGridViewCell);
+ }
+
+ public void CopyTo (DataGridViewCell[] array, int index) {
+ base.List.CopyTo(array, index);
+ /*
+ if (array == null) {
+ throw new ArgumentNullException("array is null");
+ }
+ if (index < 0) {
+ throw new IndexOutOfRangeException("index is out of range");
+ }
+ if (index >= arrayl.Length) {
+ throw new ArgumentException("index is equal or greater than the length of the array");
+ }
+ if ((array.Length - index) < base.List.Count) {
+ throw new ArgumentException("not enought space for the elements from index to the end");
+ }
+ */
+ }
+
+ public int IndexOf (object o) {
+ return base.List.IndexOf(o as DataGridViewCell);
+ }
+
+ public void Insert (int index, object o) {
+ Insert(index, o as DataGridViewCell);
+ }
+
+ public void Insert (int index, DataGridViewCell dataGridViewCell) {
+ throw new NotSupportedException("Can't insert to selected cell base.List");
+ }
+
+ public void Remove (object o) {
+ throw new NotSupportedException("Can't remove elements of selected cell base.List.");
+ }
+
+ public void RemoveAt (int index) {
+ throw new NotSupportedException("Can't remove elements of selected cell base.List.");
+ }
+
+ internal void InternalAdd (DataGridViewCell dataGridViewCell) {
+ base.List.Add(dataGridViewCell);
+ }
+
+ internal void InternalRemove (DataGridViewCell dataGridViewCell) {
+ base.List.Remove(dataGridViewCell);
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewSelectedColumnCollection.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewSelectedColumnCollection.cs
new file mode 100644
index 00000000000..2260d487388
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewSelectedColumnCollection.cs
@@ -0,0 +1,104 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System.Collections;
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewSelectedColumnCollection : BaseCollection, IList, ICollection, IEnumerable {
+
+ public bool IsFixedSize {
+ get { return base.List.IsFixedSize; }
+ }
+
+ object IList.this [int index] {
+ get { return this[index]; }
+ set { throw new NotSupportedException("Can't insert or modify this collection."); }
+ }
+
+ public DataGridViewColumn this [int index] {
+ get { return (DataGridViewColumn) base.List[index]; }
+ }
+
+ public int Add (object o) {
+ throw new NotSupportedException("Can't add elements to this collection.");
+ }
+
+ public void Clear () {
+ throw new NotSupportedException("This collection cannot be cleared.");
+ }
+
+ public bool Contains (object o) {
+ return Contains(o as DataGridViewColumn);
+ }
+
+ public bool Contains (DataGridViewColumn dataGridViewColumn) {
+ return base.List.Contains(dataGridViewColumn);
+ }
+
+ public void CopyTo (DataGridViewColumn[] array, int index) {
+ base.List.CopyTo(array, index);
+ }
+
+ public int IndexOf (object o) {
+ return base.List.IndexOf(o);
+ }
+
+ public void Insert (int index, object o) {
+ Insert(index, o as DataGridViewColumn);
+ }
+
+ public void Insert (int index, DataGridViewColumn dataGridViewColumn) {
+ throw new NotSupportedException("Insert is not allowed.");
+ }
+
+ public void Remove (object o) {
+ throw new NotSupportedException("Can't remove elements of this collection.");
+ }
+
+ public void RemoveAt (int index) {
+ throw new NotSupportedException("Can't remove elements of this collection.");
+ }
+
+ protected override ArrayList List {
+ get { return base.List; }
+ }
+
+ internal void InternalAdd (DataGridViewColumn dataGridViewColumn) {
+ base.List.Add(dataGridViewColumn);
+ }
+
+ internal void InternalRemove (DataGridViewColumn dataGridViewColumn) {
+ base.List.Remove(dataGridViewColumn);
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewSelectedRowCollection.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewSelectedRowCollection.cs
new file mode 100644
index 00000000000..2a7b89eb4ee
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewSelectedRowCollection.cs
@@ -0,0 +1,104 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System.Collections;
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewSelectedRowCollection : BaseCollection, IList, ICollection, IEnumerable {
+
+ public bool IsFixedSize {
+ get { return base.List.IsFixedSize; }
+ }
+
+ object IList.this [int index] {
+ get { return this[index]; }
+ set { throw new NotSupportedException("Can't insert or modify this collection."); }
+ }
+
+ public DataGridViewRow this [int index] {
+ get { return (DataGridViewRow) base.List[index]; }
+ }
+
+ public int Add (object o) {
+ throw new NotSupportedException("Can't add elements to this collection.");
+ }
+
+ public void Clear () {
+ throw new NotSupportedException("This collection cannot be cleared.");
+ }
+
+ public bool Contains (object o) {
+ return Contains(o as DataGridViewRow);
+ }
+
+ public bool Contains (DataGridViewRow dataGridViewRow) {
+ return base.List.Contains(dataGridViewRow);
+ }
+
+ public void CopyTo (DataGridViewRow[] array, int index) {
+ base.List.CopyTo(array, index);
+ }
+
+ public int IndexOf (object o) {
+ return base.List.IndexOf(o);
+ }
+
+ public void Insert (int index, object o) {
+ Insert(index, o as DataGridViewRow);
+ }
+
+ public void Insert (int index, DataGridViewRow dataGridViewRow) {
+ throw new NotSupportedException("Insert is not allowed.");
+ }
+
+ public void Remove (object o) {
+ throw new NotSupportedException("Can't remove elements of this collection.");
+ }
+
+ public void RemoveAt (int index) {
+ throw new NotSupportedException("Can't remove elements of this collection.");
+ }
+
+ protected override ArrayList List {
+ get { return base.List; }
+ }
+
+ internal void InternalAdd (DataGridViewRow dataGridViewRow) {
+ base.List.Add(dataGridViewRow);
+ }
+
+ internal void InternalRemove (DataGridViewRow dataGridViewRow) {
+ base.List.Remove(dataGridViewRow);
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewSelectionMode.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewSelectionMode.cs
new file mode 100644
index 00000000000..5016dea816c
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewSelectionMode.cs
@@ -0,0 +1,41 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public enum DataGridViewSelectionMode {
+ CellSelect = 0,
+ FullRowSelect = 1,
+ FullColumnSelect = 2,
+ RowHeaderSelect = 3,
+ ColumnHeaderSelect = 4
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewSortCompareEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewSortCompareEventArgs.cs
new file mode 100644
index 00000000000..9b915574335
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewSortCompareEventArgs.cs
@@ -0,0 +1,79 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewSortCompareEventArgs : HandledEventArgs {
+
+ private DataGridViewColumn dataGridViewColumn;
+ private object cellValue1;
+ private object cellValue2;
+ private int rowIndex1;
+ private int rowIndex2;
+ private int sortResult = 0;
+
+ public DataGridViewSortCompareEventArgs (DataGridViewColumn dataGridViewColumn, object cellValue1, object cellValue2, int rowIndex1, int rowIndex2) {
+ this.dataGridViewColumn = dataGridViewColumn;
+ this.cellValue1 = cellValue1;
+ this.cellValue2 = cellValue2;
+ this.rowIndex1 = rowIndex1;
+ this.rowIndex2 = rowIndex2;
+ }
+
+ public object CellValue1 {
+ get { return cellValue1; }
+ }
+
+ public object CellValue2 {
+ get { return cellValue2; }
+ }
+
+ public DataGridViewColumn Column {
+ get { return dataGridViewColumn; }
+ }
+
+ public int RowIndex1 {
+ get { return rowIndex1; }
+ }
+
+ public int RowIndex2 {
+ get { return rowIndex2; }
+ }
+
+ public int SortResult {
+ get { return sortResult; }
+ set { sortResult = value; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewSortCompareEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewSortCompareEventHandler.cs
new file mode 100644
index 00000000000..316a0d6b1ee
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewSortCompareEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void DataGridViewSortCompareEventHandler (object sender, DataGridViewSortCompareEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewTextBoxCell.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewTextBoxCell.cs
new file mode 100644
index 00000000000..7394d7f18ee
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewTextBoxCell.cs
@@ -0,0 +1,176 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewTextBoxCell : DataGridViewCell {
+
+ private int maxInputLength = 32767;
+ private static DataGridViewTextBoxEditingControl editingControl;
+
+ static DataGridViewTextBoxCell () {
+ editingControl = new DataGridViewTextBoxEditingControl();
+ editingControl.Multiline = false;
+ editingControl.BorderStyle = BorderStyle.None;
+ }
+
+ public DataGridViewTextBoxCell () {
+ }
+
+ public override Type FormattedValueType {
+ get { return typeof(string); }
+ }
+
+ public virtual int MaxInputLength {
+ get { return maxInputLength; }
+ set {
+ if (value < 0) {
+ throw new ArgumentOutOfRangeException("MaxInputLength coudn't be less than 0.");
+ }
+ maxInputLength = value;
+ }
+ }
+
+ public override Type ValueType {
+ get { return typeof(string); }
+ }
+
+ public override object Clone () {
+ DataGridViewTextBoxCell result = (DataGridViewTextBoxCell) base.Clone();
+ result.maxInputLength = maxInputLength;
+ return result;
+ }
+
+ public override void DetachEditingControl () {
+ if (DataGridView == null) {
+ throw new InvalidOperationException("There is no associated DataGridView.");
+ }
+ if (DataGridView.Controls.Contains(editingControl)) {
+ DataGridView.Controls.Remove(editingControl);
+ }
+ Console.WriteLine("Detached: ({0}, {1});", RowIndex, ColumnIndex);
+ }
+
+ public override void InitializeEditingControl (int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle) {
+ if (DataGridView == null) {
+ throw new InvalidOperationException("There is no associated DataGridView.");
+ }
+ if (!DataGridView.Controls.Contains(editingControl)) {
+ DataGridView.Controls.Add(editingControl);
+ }
+ editingControl.EditingControlDataGridView = DataGridView;
+ editingControl.MaxLength = maxInputLength;
+ if (initialFormattedValue == null || (string) initialFormattedValue == "") {
+ editingControl.Text = "";
+ }
+ else {
+ editingControl.Text = (string) initialFormattedValue;
+ }
+ editingControl.ApplyCellStyleToEditingControl(dataGridViewCellStyle);
+ editingControl.PrepareEditingControlForEdit(true);
+ }
+
+ public override bool KeyEntersEditMode (KeyEventArgs e) {
+ throw new NotImplementedException();
+ }
+
+ public override void PositionEditingControl (bool setLocation, bool setSize, Rectangle cellBounds, Rectangle cellClip, DataGridViewCellStyle cellStyle, bool singleVerticalBorderAdded, bool singleHorizontalBorderAdded, bool isFirstDisplayedColumn, bool isFirstDisplayedRow) {
+ if (setSize) {
+ editingControl.Size = new Size(cellBounds.Width, cellBounds.Height + 2);
+ }
+ if (setLocation) {
+ editingControl.Location = new Point(cellBounds.X, cellBounds.Y);
+ }
+ editingControl.Invalidate();
+ }
+
+ public override string ToString () {
+ return this.GetType().Name;
+ }
+
+ protected override Rectangle GetContentBounds (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected override Rectangle GetErrorIconBounds (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected override Size GetPreferredSize (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex, Size constraintSize) {
+ throw new NotImplementedException();
+ }
+
+ protected override void OnEnter (int rowIndex, bool throughMouseClick) {
+ }
+
+ protected override void OnLeave (int rowIndex, bool throughMouseClick) {
+ }
+
+ protected override void OnMouseClick (DataGridViewCellMouseEventArgs e) {
+ }
+
+ protected override void OnMouseEnter (int rowIndex) {
+ }
+
+ protected override void OnMouseLeave (int rowIndex) {
+ }
+
+ protected override void Paint (Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) {
+ //////////////////
+ /*
+ Size size = DataGridViewCell.MeasureTextSize(graphics, (string) formattedValue, cellStyle.Font, TextFormatFlags.Default);
+ switch (cellStyle.Alignment) {
+ case DataGridViewContentAlignment.TopLeft:
+ break;
+ }
+ //cell.SetContentBounds(cellBounds);
+ */
+ //////////////////
+ if ((cellState & DataGridViewElementStates.Selected) != 0) {
+ graphics.FillRectangle(new SolidBrush(cellStyle.SelectionBackColor), cellBounds);
+ graphics.DrawString((string) formattedValue, cellStyle.Font, new SolidBrush(cellStyle.SelectionForeColor), cellBounds, StringFormat.GenericDefault);
+ }
+ else {
+ graphics.FillRectangle(new SolidBrush(cellStyle.BackColor), cellBounds);
+ graphics.DrawString((string) formattedValue, cellStyle.Font, new SolidBrush(cellStyle.ForeColor), cellBounds, StringFormat.GenericDefault);
+ }
+ PaintBorder(graphics, clipBounds, cellBounds, cellStyle, advancedBorderStyle);
+ }
+
+ protected override void OnDataGridViewChanged () {
+ editingControl.EditingControlDataGridView = DataGridView;
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewTextBoxColumn.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewTextBoxColumn.cs
new file mode 100644
index 00000000000..ea72209975d
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewTextBoxColumn.cs
@@ -0,0 +1,77 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewTextBoxColumn : DataGridViewColumn {
+
+ private int maxInputLength;
+ private DataGridViewColumnSortMode sortMode;
+
+ public DataGridViewTextBoxColumn () {
+ base.CellTemplate = new DataGridViewTextBoxCell();
+ maxInputLength = 32767;
+ sortMode = DataGridViewColumnSortMode.Automatic;
+ }
+
+ public override DataGridViewCell CellTemplate {
+ get { return base.CellTemplate; }
+ set { base.CellTemplate = value as DataGridViewTextBoxCell; }
+ }
+
+ public int MaxInputLength {
+ get { return maxInputLength; }
+ set {
+ if (value < 0) {
+ throw new ArgumentOutOfRangeException("Value is less than 0.");
+ }
+ maxInputLength = value;
+ }
+ }
+
+ public new DataGridViewColumnSortMode SortMode {
+ get { return sortMode; }
+ set {
+ if (DataGridView != null && DataGridView.SelectionMode == DataGridViewSelectionMode.FullRowSelect && value != DataGridViewColumnSortMode.NotSortable) {
+ throw new InvalidOperationException("Value conflicts with DataGridView.SelectionMode.");
+ }
+ sortMode = value;
+ }
+ }
+
+ public override string ToString () {
+ return GetType().Name;
+ }
+
+
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewTextBoxEditingControl.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewTextBoxEditingControl.cs
new file mode 100644
index 00000000000..48de9d9cb0d
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewTextBoxEditingControl.cs
@@ -0,0 +1,117 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+
+ [ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)]
+ [ComVisibleAttribute(true)]
+ public class DataGridViewTextBoxEditingControl : TextBox, IDataGridViewEditingControl {
+
+ private DataGridView editingControlDataGridView;
+ private int rowIndex;
+ private bool editingControlValueChanged;
+ private Cursor editingPanelCursor;
+ private bool repositionEditingControlOnValueChange;
+
+ public DataGridViewTextBoxEditingControl () {
+ }
+
+ public DataGridView EditingControlDataGridView {
+ get { return editingControlDataGridView; }
+ set { editingControlDataGridView = value; }
+ }
+
+ public object EditingControlFormattedValue {
+ get { return base.Text; }
+ set { base.Text = (string) value; }
+ }
+
+ public int EditingControlRowIndex {
+ get { return rowIndex; }
+ set { rowIndex = value; }
+ }
+
+ public bool EditingControlValueChanged {
+ get { return editingControlValueChanged; }
+ set { editingControlValueChanged = value; }
+ }
+
+ public Cursor EditingPanelCursor {
+ get { return editingPanelCursor; }
+ }
+
+ public bool RepositionEditingControlOnValueChange {
+ get { return repositionEditingControlOnValueChange; }
+ }
+
+ public void ApplyCellStyleToEditingControl (DataGridViewCellStyle dataGridViewCellStyle) {
+ Font = dataGridViewCellStyle.Font;
+ BackColor = dataGridViewCellStyle.BackColor;
+ ForeColor = dataGridViewCellStyle.ForeColor;
+ }
+
+ public bool EditingControlWantsInputKey (Keys keyData, bool dataGridViewWantsInputKey) {
+ return true;
+ }
+
+ public object GetEditingControlFormattedValue (DataGridViewDataErrorContexts context) {
+ return EditingControlFormattedValue;
+ }
+
+ public void PrepareEditingControlForEdit (bool selectAll) {
+ Focus();
+ if (selectAll) {
+ SelectAll();
+ }
+ editingControlValueChanged = false;
+ }
+
+ protected override void OnMouseWheel (MouseEventArgs e) {
+ base.OnMouseWheel(e);
+ }
+
+ protected override void OnTextChanged (EventArgs e) {
+ base.OnTextChanged(e);
+ editingControlValueChanged = true;
+ Console.WriteLine("OnTextChanged: {0};", Text);
+ if (editingControlDataGridView != null) {
+ editingControlDataGridView.CurrentCell.Value = Text;
+ }
+ }
+
+ protected override bool ProcessKeyEventArgs (ref Message m) {
+ return base.ProcessKeyEventArgs(ref m);
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewTopLeftHeaderCell.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewTopLeftHeaderCell.cs
new file mode 100644
index 00000000000..15319056b3a
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewTopLeftHeaderCell.cs
@@ -0,0 +1,100 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ public class DataGridViewTopLeftHeaderCell : DataGridViewColumnHeaderCell {
+
+ public DataGridViewTopLeftHeaderCell () {
+ }
+
+ public override string ToString () {
+ return GetType().Name;
+ }
+
+ protected override AccessibleObject CreateAccessibilityInstance () {
+ return new DataGridViewTopLeftHeaderCellAccessibleObject(this);
+ }
+
+ protected override Rectangle GetContentBounds (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected override Rectangle GetErrorIconBounds (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex) {
+ throw new NotImplementedException();
+ }
+
+ protected override Size GetPreferredSize (Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex, Size constraintSize) {
+ throw new NotImplementedException();
+ }
+
+ protected override void Paint (Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) {
+ throw new NotImplementedException();
+ }
+
+ protected override void PaintBorder (Graphics graphics, Rectangle clipBounds, Rectangle bounds, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle) {
+ throw new NotImplementedException();
+ }
+
+ protected class DataGridViewTopLeftHeaderCellAccessibleObject : DataGridViewColumnHeaderCellAccessibleObject {
+
+ public DataGridViewTopLeftHeaderCellAccessibleObject (DataGridViewTopLeftHeaderCell owner) : base (owner) {
+ }
+
+ public override Rectangle Bounds {
+ get { throw new NotImplementedException(); }
+ }
+
+ public override string DefaultAction {
+ get {
+ if (Owner.DataGridView != null && Owner.DataGridView.MultiSelect) {
+ return "Press to Select All";
+ }
+ return "";
+ }
+ }
+
+ public override void DoDefaultAction () {
+ if (Owner.DataGridView != null) {
+ Owner.DataGridView.SelectAll();
+ }
+ }
+
+ public override AccessibleObject Navigate (AccessibleNavigation navigationDirection) {
+ throw new NotImplementedException();
+ }
+
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewTriState.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewTriState.cs
new file mode 100644
index 00000000000..1513ab03d9e
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewTriState.cs
@@ -0,0 +1,39 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public enum DataGridViewTriState {
+ NotSet = 0,
+ True = 1,
+ False = 2
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataObject.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataObject.cs
new file mode 100644
index 00000000000..3a011d6fc3e
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataObject.cs
@@ -0,0 +1,288 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+using System;
+using System.Collections;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [ClassInterface(ClassInterfaceType.None)]
+ public class DataObject : IDataObject {
+ #region DataObject.Entry Class
+ private class Entry {
+ #region Local Variables
+ private string type;
+ private object data;
+ private bool autoconvert;
+ internal Entry next;
+ #endregion // Local Variables
+
+ #region Constructors
+ internal Entry(string type, object data, bool autoconvert) {
+ this.type = type;
+ this.data = data;
+ this.autoconvert = autoconvert;
+ }
+ #endregion // Constructors
+
+ #region Properties
+ public object Data {
+ get {
+ return data;
+ }
+
+ set {
+ data = value;
+ }
+ }
+ #endregion // Properties
+
+ #region Methods
+ public static int Count(Entry entries) {
+ int result;
+
+ result = 0;
+
+ while (entries != null) {
+ result++;
+ entries = entries.next;
+ }
+
+ return result;
+ }
+
+ public static Entry Find(Entry entries, string type) {
+ while (entries != null) {
+ if (entries.type.Equals(type)) {
+ return entries;
+ }
+ entries = entries.next;
+ }
+
+ return null;
+ }
+
+ public static Entry FindConvertible(Entry entries, string type) {
+ Entry e;
+
+ e = Find(entries, type);
+ if (e != null) {
+ return e;
+ }
+
+ e = entries;
+ while (e != null) {
+ if (type == DataFormats.Text) {
+ if (e.type == DataFormats.UnicodeText) {
+ return e;
+ }
+ } else if (type == DataFormats.UnicodeText) {
+ if (e.type == DataFormats.Text) {
+ return e;
+ }
+ } else if (type == DataFormats.StringFormat) {
+ if (e.type == DataFormats.Text) {
+ return e;
+ } else if (e.type == DataFormats.UnicodeText) {
+ return e;
+ }
+ }
+ e = e.next;
+ }
+
+ return null;
+ }
+
+ public static string[] Entries(Entry entries, bool convertible) {
+ Entry e;
+ ArrayList list;
+ string[] result;
+
+ // Initially store into something that we can grow easily
+ list = new ArrayList(Entry.Count(entries));
+ e = entries;
+
+ while (e != null) {
+ list.Add(e.type);
+ e = e.next;
+ }
+
+ if (convertible) {
+ // Add the convertibles
+ if ((Entry.Find(entries, DataFormats.Text) != null) && (Entry.Find(entries, DataFormats.UnicodeText) == null)) {
+ list.Add(DataFormats.UnicodeText);
+ }
+
+ if ((Entry.Find(entries, DataFormats.Text) == null) && (Entry.Find(entries, DataFormats.UnicodeText) != null)) {
+ list.Add(DataFormats.Text);
+ }
+
+ if (((Entry.Find(entries, DataFormats.Text) != null) || (Entry.Find(entries, DataFormats.UnicodeText) != null)) && (Entry.Find(entries, DataFormats.StringFormat) == null)) {
+ list.Add(DataFormats.StringFormat);
+ }
+ }
+
+ // Copy the results into a string array
+ result = new string[list.Count];
+ for (int i = 0; i < list.Count; i++) {
+ result[i] = (string)list[i];
+ }
+
+ return result;
+ }
+ #endregion // Methods
+ }
+ #endregion // DataObject.Entry class
+
+ #region Local Variables
+ private Entry entries;
+ #endregion // Local Variables
+
+ #region Public Constructors
+ public DataObject() {
+ entries = null;
+ }
+
+ public DataObject(object data) {
+ SetData(data);
+ }
+
+ public DataObject(string format, object data) {
+ SetData(format, data);
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public virtual object GetData(string format) {
+ return GetData(format, true);
+ }
+
+ public virtual object GetData(string format, bool autoConvert) {
+ Entry e;
+ if (autoConvert) {
+ e = Entry.FindConvertible(entries, format);
+ } else {
+ e = Entry.Find(entries, format);
+ }
+ if (e == null)
+ return null;
+ return e.Data;
+ }
+
+ public virtual object GetData(Type format) {
+ return GetData(format.FullName, true);
+ }
+
+ public virtual bool GetDataPresent(string format) {
+ return GetDataPresent(format, true);
+ }
+
+ public virtual bool GetDataPresent(string format, bool autoConvert) {
+ if (autoConvert) {
+ return Entry.FindConvertible(entries, format) != null;
+ } else {
+ return Entry.Find(entries, format) != null;
+ }
+ }
+
+ public virtual bool GetDataPresent(Type format) {
+ return GetDataPresent(format.FullName, true);
+ }
+
+ public virtual string[] GetFormats() {
+ return GetFormats(true);
+ }
+
+ public virtual string[] GetFormats(bool autoConvert) {
+ return Entry.Entries(entries, autoConvert);
+ }
+
+ public virtual void SetData(object data) {
+ SetData(data.GetType(), data);
+ }
+
+ public virtual void SetData(string format, bool autoConvert, object data) {
+ Entry entry;
+ Entry e;
+
+ entry = Entry.Find(entries, format);
+
+ if (entry == null) {
+ entry = new DataObject.Entry(format, data, autoConvert);
+ } else {
+ entry.Data = data;
+ return;
+ }
+
+ lock (this) {
+ if (entries == null) {
+ entries = entry;
+ } else {
+ // Insert into the list of known/defined formats
+ e = entries;
+
+ while (e.next != null) {
+ e = e.next;
+ }
+ e.next = entry;
+ }
+ }
+ }
+
+ public virtual void SetData(string format, object data) {
+ SetData(format, true, data);
+ }
+
+ public virtual void SetData(Type format, object data) {
+ SetData(EnsureFormat(format), true, data);
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Instance Methods
+ #endregion // Public Instance Methods
+
+ #region Private Methods
+ internal string EnsureFormat(string name) {
+ DataFormats.Format f;
+
+ f = DataFormats.Format.Find(name);
+ if (f == null) {
+ // Register the format
+ f = DataFormats.Format.Add(name);
+ }
+
+ return f.Name;
+ }
+
+ internal string EnsureFormat(Type type) {
+ return EnsureFormat(type.FullName);
+ }
+
+ #endregion // Private Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DateBoldEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DateBoldEventArgs.cs
new file mode 100644
index 00000000000..755c21340b8
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DateBoldEventArgs.cs
@@ -0,0 +1,69 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public class DateBoldEventArgs : EventArgs {
+ #region Local Variables
+ private int size;
+ private DateTime start;
+ private int[] days_to_bold;
+ #endregion // Local Variables
+
+ #region Internal Constructor
+ DateBoldEventArgs(DateTime start, int size, int[] daysToBold) {
+ this.start = start;
+ this.size = size;
+ this.days_to_bold = daysToBold;
+ }
+ #endregion
+
+ #region Public Instance Properties
+ public int[] DaysToBold {
+ get {
+ return days_to_bold;
+ }
+
+ set {
+ days_to_bold = value;
+ }
+ }
+
+ public int Size {
+ get {
+ return size;
+ }
+ }
+
+ public DateTime StartDate {
+ get {
+ return start;
+ }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DateBoldEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DateBoldEventHandler.cs
new file mode 100644
index 00000000000..3d1e5d54e59
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DateBoldEventHandler.cs
@@ -0,0 +1,31 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public delegate void DateBoldEventHandler (object sender, DateBoldEventArgs e);
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DateRangeEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DateRangeEventArgs.cs
new file mode 100644
index 00000000000..066d1dd4f4c
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DateRangeEventArgs.cs
@@ -0,0 +1,67 @@
+//
+// 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 Novell, Inc.
+//
+// Authors:
+// John BouAntoun jba-mono@optusnet.com.au
+//
+
+using System;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+ public class DateRangeEventArgs : EventArgs {
+ #region local members
+
+ DateTime end;
+ DateTime start;
+
+ #endregion // local members
+
+ #region public constructors
+
+ // constructor that receives two dates, uses the lower of the two as start
+ public DateRangeEventArgs (DateTime start, DateTime end) {
+ this.start = start;
+ this.end = end;
+ }
+
+ #endregion // public constructors
+
+ #region public properties
+
+ // end date of this range
+ public DateTime End {
+ get {
+ return end;
+ }
+ }
+
+ // start date of this range
+ public DateTime Start {
+ get {
+ return start;
+ }
+ }
+
+ #endregion // public properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DateRangeEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DateRangeEventHandler.cs
new file mode 100644
index 00000000000..b217cd302e7
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DateRangeEventHandler.cs
@@ -0,0 +1,31 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// John BouAntoun jba-mono@optusnet.com.au
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ // event handler for when a daterange event is fired (datechanged or dateselected)
+ public delegate void DateRangeEventHandler(object sender, DateRangeEventArgs e);
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DateTimePicker.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DateTimePicker.cs
new file mode 100644
index 00000000000..8cf35bcfb78
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DateTimePicker.cs
@@ -0,0 +1,829 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// John BouAntoun jba-mono@optusnet.com.au
+//
+// TODO:
+// - implement custom formatting of the date time value
+// - implement any behaviour associate with UseUpDown (painting, key and mouse)
+// - implement key processing and responding
+// - fix MonthCalendar Popdown on form move
+// - wire in all events from monthcalendar
+
+
+using System;
+using System.Drawing;
+using System.Collections;
+using System.ComponentModel;
+using System.Runtime.InteropServices;
+using System.Windows.Forms;
+
+namespace System.Windows.Forms {
+ [DefaultEvent("ValueChanged")]
+ [DefaultProperty("Value")]
+ [Designer("System.Windows.Forms.Design.DateTimePickerDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+ public class DateTimePicker : Control {
+
+ #region Public variables
+
+ // this class has to have the specified hour, minute and second, as it says in msdn
+ public static readonly DateTime MaxDateTime = new DateTime (9998, 12, 31, 23, 59, 59);
+ public static readonly DateTime MinDateTime = new DateTime (1753, 1, 1);
+
+ #endregion // Public variables
+
+ #region Local variables
+
+ protected static readonly Color DefaultMonthBackColor = ThemeEngine.Current.ColorWindow;
+ protected static readonly Color DefaultTitleBackColor = ThemeEngine.Current.ColorActiveCaption;
+ protected static readonly Color DefaultTitleForeColor = ThemeEngine.Current.ColorActiveCaptionText;
+ protected static readonly Color DefaultTrailingForeColor = Color.Gray;
+
+ internal MonthCalendar month_calendar;
+ bool is_checked;
+ string custom_format;
+ LeftRightAlignment drop_down_align;
+ DateTimePickerFormat format;
+ DateTime max_date;
+ DateTime min_date;
+ bool show_check_box;
+ bool show_up_down;
+ string text;
+ DateTime date_value;
+
+ // variables used for drawing and such
+ internal int up_down_width;
+ internal bool is_drop_down_visible;
+
+ #endregion // Local variables
+
+ #region DateTimePickerAccessibleObject Subclass
+ [ComVisible(true)]
+ public class DateTimePickerAccessibleObject : ControlAccessibleObject {
+ #region DateTimePickerAccessibleObject Local Variables
+ private DateTimePicker owner;
+ #endregion // DateTimePickerAccessibleObject Local Variables
+
+ #region DateTimePickerAccessibleObject Constructors
+ public DateTimePickerAccessibleObject(DateTimePicker owner) : base(owner) {
+ this.owner = owner;
+ }
+ #endregion // DateTimePickerAccessibleObject Constructors
+
+ #region DateTimePickerAccessibleObject Properties
+ public override AccessibleStates State {
+ get {
+ AccessibleStates retval;
+
+ retval = AccessibleStates.Default;
+
+ if (owner.Checked) {
+ retval |= AccessibleStates.Checked;
+ }
+
+ return retval;
+ }
+ }
+
+ public override string Value {
+ get {
+ return owner.text;
+ }
+ }
+ #endregion // DateTimePickerAccessibleObject Properties
+ }
+ #endregion // DateTimePickerAccessibleObject Sub-class
+
+ #region public constructors
+
+ // only public constructor
+ public DateTimePicker () {
+
+ // initialise the month calendar
+ month_calendar = new MonthCalendar (this);
+ month_calendar.CalendarDimensions = new Size (1, 1);
+ month_calendar.MaxSelectionCount = 1;
+ month_calendar.ForeColor = Control.DefaultForeColor;
+ month_calendar.BackColor = DefaultMonthBackColor;
+ month_calendar.TitleBackColor = DefaultTitleBackColor;
+ month_calendar.TitleForeColor = DefaultTitleForeColor;
+ month_calendar.TrailingForeColor = DefaultTrailingForeColor;
+ month_calendar.Visible = false;
+
+
+ // initialise other variables
+ is_checked = false;
+ custom_format = string.Empty;
+ drop_down_align = LeftRightAlignment.Left;
+ format = DateTimePickerFormat.Long;
+ max_date = MaxDateTime;
+ min_date = MinDateTime;
+ show_check_box = false;
+ show_up_down = false;
+ date_value = DateTime.Now;
+ text = FormatValue ();
+
+ up_down_width = 10;
+ is_drop_down_visible = false;
+
+ month_calendar.DateSelected += new DateRangeEventHandler (MonthCalendarDateSelectedHandler);
+ KeyPress += new KeyPressEventHandler (KeyPressHandler);
+// LostFocus += new EventHandler (LostFocusHandler);
+ MouseDown += new MouseEventHandler (MouseDownHandler);
+ Paint += new PaintEventHandler (PaintHandler);
+
+ SetStyle (ControlStyles.UserPaint | ControlStyles.StandardClick, false);
+ SetStyle (ControlStyles.FixedHeight, true);
+ }
+
+ #endregion
+
+ #region public properties
+
+ // no reason why this is overridden
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override Color BackColor {
+ set {
+ base.BackColor = value;
+ }
+ get {
+ return base.BackColor;
+ }
+ }
+
+ // no reason why this is overridden
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override Image BackgroundImage {
+ set {
+ base.BackgroundImage = value;
+ }
+ get {
+ return base.BackgroundImage;
+ }
+ }
+
+ [AmbientValue(null)]
+ [Localizable(true)]
+ public Font CalendarFont {
+ set {
+ month_calendar.Font = value;
+ }
+ get {
+ return month_calendar.Font;
+ }
+ }
+
+ public Color CalendarForeColor {
+ set {
+ month_calendar.ForeColor = value;
+ }
+ get {
+ return month_calendar.ForeColor;
+ }
+ }
+
+ public Color CalendarMonthBackground {
+ set {
+ month_calendar.BackColor = value;
+ }
+ get {
+ return month_calendar.BackColor;
+ }
+ }
+
+ public Color CalendarTitleBackColor {
+ set {
+ month_calendar.TitleBackColor = value;
+ }
+ get {
+ return month_calendar.TitleBackColor;
+ }
+ }
+
+ public Color CalendarTitleForeColor {
+ set {
+ month_calendar.TitleForeColor = value;
+ }
+ get {
+ return month_calendar.TitleForeColor;
+ }
+ }
+
+ public Color CalendarTrailingForeColor {
+ set {
+ month_calendar.TrailingForeColor = value;
+ }
+ get {
+ return month_calendar.TrailingForeColor;
+ }
+ }
+
+ // when checked the value is grayed out
+ [Bindable(true)]
+ [DefaultValue(true)]
+ public bool Checked {
+ set {
+ if (is_checked != value) {
+ is_checked = value;
+ // invalidate the value inside this control
+ this.Invalidate (date_area_rect);
+ }
+ }
+ get {
+ return is_checked;
+ }
+ }
+
+ // the custom format string to format this control with
+ [DefaultValue(null)]
+ [RefreshProperties(RefreshProperties.Repaint)]
+ public string CustomFormat {
+ set {
+ if (custom_format != value) {
+ custom_format = value;
+ if (this.Format == DateTimePickerFormat.Custom) {
+ // TODO: change the text value of the dtp
+ }
+ }
+ }
+ get {
+ return custom_format;
+ }
+ }
+
+ // which side the drop down is to be aligned on
+ [DefaultValue(LeftRightAlignment.Left)]
+ [Localizable(true)]
+ public LeftRightAlignment DropDownAlign {
+ set {
+ if (drop_down_align != value) {
+ drop_down_align = value;
+ }
+ }
+ get {
+ return drop_down_align;
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override Color ForeColor {
+ set {
+ base.ForeColor = value;
+ }
+ get {
+ return base.ForeColor;
+ }
+ }
+
+ // the format of the date time picker text, default is long
+ [RefreshProperties(RefreshProperties.Repaint)]
+ public DateTimePickerFormat Format {
+ set {
+ if (format != value) {
+ format = value;
+ this.OnFormatChanged (EventArgs.Empty);
+ // invalidate the value inside this control
+ this.Invalidate (date_area_rect);
+ }
+ }
+ get {
+ return format;
+ }
+ }
+
+ public DateTime MaxDate {
+ set {
+ if (value < min_date) {
+ throw new ArgumentException ();
+ }
+ if (value > MaxDateTime) {
+ throw new SystemException ();
+ }
+ if (max_date != value) {
+ max_date = value;
+
+ // TODO: verify this is correct behaviour when value > max date
+ if (Value > max_date) {
+ Value = max_date;
+ // invalidate the value inside this control
+ this.Invalidate (date_area_rect);
+ }
+ }
+ }
+ get {
+ return max_date;
+ }
+ }
+
+ public DateTime MinDate {
+ set {
+ if (value < min_date) {
+ throw new ArgumentException ();
+ }
+ if (value < MinDateTime) {
+ throw new SystemException ();
+ }
+ if (min_date != value) {
+ min_date = value;
+
+ // TODO: verify this is correct behaviour when value > max date
+ if (Value < min_date) {
+ Value = min_date;
+ // invalidate the value inside this control
+ this.Invalidate (date_area_rect);
+ }
+ }
+ }
+ get {
+ return min_date;
+ }
+ }
+
+ // the prefered height to draw this control using current font
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int PreferredHeight {
+ get {
+ return this.Font.Height + 7;
+ }
+ }
+
+ // whether or not the check box is shown
+ [DefaultValue(false)]
+ public bool ShowCheckBox {
+ set {
+ if (show_check_box != value) {
+ show_check_box = value;
+ // invalidate the value inside this control
+ this.Invalidate (date_area_rect);
+ }
+ }
+ get {
+ return show_check_box;
+ }
+ }
+
+ // if true show the updown control, else popup the monthcalendar
+ [DefaultValue(false)]
+ public bool ShowUpDown {
+ set {
+ if (show_up_down != value) {
+ show_up_down = value;
+ // need to invalidate the whole control
+ this.Invalidate ();
+ }
+ }
+ get {
+ return show_up_down;
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public override string Text {
+ set {
+ // TODO: if the format is a custom format we need to do a custom parse here
+ DateTime parsed_value = DateTime.Parse (value);
+ if (date_value != parsed_value) {
+ Value = parsed_value;
+ }
+ text = FormatValue ();
+ }
+ get {
+ return text;
+ }
+ }
+
+ [Bindable(true)]
+ [RefreshProperties(RefreshProperties.All)]
+ public DateTime Value {
+ set {
+ if (date_value != value) {
+ date_value = value;
+ text = FormatValue ();
+ this.OnValueChanged (EventArgs.Empty);
+ this.Invalidate (date_area_rect);
+ }
+ }
+ get {
+ return date_value;
+ }
+ }
+
+ #endregion // public properties
+
+ #region public methods
+
+ // just return the text value
+ public override string ToString () {
+ return this.Text;
+ }
+
+ #endregion // public methods
+
+ #region public events
+
+ // raised when the monthcalendar is closed
+ public event EventHandler CloseUp;
+
+ // raised when the monthcalendar is opened
+ public event EventHandler DropDown;
+
+ // raised when the format of the value is changed
+ public event EventHandler FormatChanged;
+
+ // raised when the date Value is changed
+ public event EventHandler ValueChanged;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler BackColorChanged {
+ add {
+ base.BackColorChanged += value;
+ }
+
+ remove {
+ base.BackColorChanged -= value;
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler BackgroundImageChanged {
+ add {
+ base.BackgroundImageChanged += value;
+ }
+
+ remove {
+ base.BackgroundImageChanged -= value;
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler ForeColorChanged {
+ add {
+ base.ForeColorChanged += value;
+ }
+
+ remove {
+ base.ForeColorChanged -= value;
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event PaintEventHandler Paint {
+ add {
+ base.Paint += value;
+ }
+
+ remove {
+ base.Paint -= value;
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public new event EventHandler TextChanged {
+ add {
+ base.TextChanged += value;
+ }
+
+ remove {
+ base.TextChanged -= value;
+ }
+ }
+ #endregion // public events
+
+ #region protected properties
+
+ // not sure why we're overriding this one
+ protected override CreateParams CreateParams {
+ get {
+ return base.CreateParams;
+ }
+ }
+
+ // specify the default size for this control
+ protected override Size DefaultSize {
+ get {
+ // todo actually measure this properly
+ return new Size (200, PreferredHeight);
+ }
+ }
+
+ #endregion // protected properties
+
+ #region protected methods
+
+ // not sure why we're overriding this one
+ protected override AccessibleObject CreateAccessibilityInstance () {
+ return base.CreateAccessibilityInstance ();
+ }
+
+ // not sure why we're overriding this one
+ protected override void CreateHandle () {
+ base.CreateHandle ();
+ }
+
+ // not sure why we're overriding this one
+ protected override void DestroyHandle () {
+ base.DestroyHandle ();
+ }
+
+ // not sure why we're overriding this one
+ protected override void Dispose (bool disposing) {
+ base.Dispose (disposing);
+ }
+
+ // find out if this key is an input key for us, depends on which date part is focused
+ protected override bool IsInputKey (Keys keyData) {
+ // TODO: fix this implementation of IsInputKey
+ return false;
+ }
+
+ // raises the CloseUp event
+ protected virtual void OnCloseUp (EventArgs eventargs) {
+ if (this.CloseUp != null) {
+ this.CloseUp (this, eventargs);
+ }
+ }
+
+ // raise the drop down event
+ protected virtual void OnDropDown (EventArgs eventargs) {
+ if (this.DropDown != null) {
+ this.DropDown (this, eventargs);
+ }
+ }
+
+ protected override void OnFontChanged(EventArgs e) {
+ // FIXME - do we need to update/invalidate/recalc our stuff?
+ base.OnFontChanged (e);
+ }
+
+ // raises the format changed event
+ protected virtual void OnFormatChanged (EventArgs e) {
+ if (this.FormatChanged != null) {
+ this.FormatChanged (this, e);
+ }
+ }
+
+ // not sure why we're overriding this one
+ protected override void OnSystemColorsChanged (EventArgs e) {
+ base.OnSystemColorsChanged (e);
+ }
+
+ // raise the ValueChanged event
+ protected virtual void OnValueChanged (EventArgs eventargs) {
+ if (this.ValueChanged != null) {
+ this.ValueChanged (this, eventargs);
+ }
+ }
+
+ // overridden to set the bounds of this control properly
+ protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified) {
+ // TODO: ensure I implemented the bounds core setting properly.
+ if ((specified & BoundsSpecified.Height) == BoundsSpecified.Height ||
+ (specified & BoundsSpecified.Size) == BoundsSpecified.Size) {
+ base.SetBoundsCore (x, y, width, DefaultSize.Height, specified);
+ } else {
+ base.SetBoundsCore (x, y, width, height, specified);
+ }
+
+ // need to set the rectangles for all the support internal rects
+ // this is done here as a optimisation since this is an array of rects
+ if ((specified & BoundsSpecified.X) == BoundsSpecified.X ||
+ (specified & BoundsSpecified.Y) == BoundsSpecified.Y) {
+ // TODO set up all the datepart rects
+ }
+ }
+
+ // not sure why we're overriding this
+ protected override void WndProc (ref Message m) {
+ base.WndProc (ref m);
+ }
+
+ #endregion // protected methods
+
+ #region internal / private properties
+
+ // this is the region that the date and the check box is drawn on
+ internal Rectangle date_area_rect {
+ get {
+ Rectangle rect = this.ClientRectangle;
+ if (ShowUpDown) {
+ // set the space to the left of the up/down button
+ if (rect.Width > (up_down_width + 4)) {
+ rect.Width -= (up_down_width + 4);
+ } else {
+ rect.Width = 0;
+ }
+ } else {
+ // set the space to the left of the up/down button
+ // TODO make this use up down button
+ if (rect.Width > (SystemInformation.VerticalScrollBarWidth + 4)) {
+ rect.Width -= SystemInformation.VerticalScrollBarWidth;
+ } else {
+ rect.Width = 0;
+ }
+ }
+
+ rect.Inflate (-2, -2);
+ return rect;
+ }
+ }
+
+ // the rectangle for the drop down arrow
+ internal Rectangle drop_down_arrow_rect {
+ get {
+ Rectangle rect = this.ClientRectangle;
+ rect.X = rect.Right - SystemInformation.VerticalScrollBarWidth - 2;
+ if (rect.Width > (SystemInformation.VerticalScrollBarWidth + 2)) {
+ rect.Width = SystemInformation.VerticalScrollBarWidth;
+ } else {
+ rect.Width = Math.Max (rect.Width - 2, 0);
+ }
+
+ rect.Inflate (0, -2);
+ return rect;
+ }
+ }
+
+ // the part of the date that is currently hilighted
+ internal Rectangle hilight_date_area {
+ get {
+ // TODO: put hilighted part calculation in here
+ return Rectangle.Empty;
+ }
+ }
+
+ #endregion
+
+ #region internal / private methods
+
+ private Point CalculateDropDownLocation (Rectangle parent_control_rect, Size child_size, bool align_left)
+ {
+ // default bottom left
+ Point location = new Point(parent_control_rect.Left + 5, parent_control_rect.Bottom);
+ // now adjust the alignment
+ if (!align_left) {
+ location.X = parent_control_rect.Right - child_size.Width;
+ }
+
+ Point screen_location = PointToScreen (location);
+ Rectangle working_area = Screen.FromControl(this).WorkingArea;
+ // now adjust if off the right side of the screen
+ if (screen_location.X < working_area.X) {
+ screen_location.X = working_area.X;
+ }
+ // now adjust if it should be displayed above control
+ if (screen_location.Y + child_size.Height > working_area.Bottom) {
+ screen_location.Y -= (parent_control_rect.Height + child_size.Height);
+ }
+ return screen_location;
+ }
+
+ // actually draw this control
+ internal void Draw (Rectangle clip_rect, Graphics dc)
+ {
+ ThemeEngine.Current.DrawDateTimePicker (dc, clip_rect, this);
+ }
+
+ // drop the calendar down
+ internal void DropDownMonthCalendar ()
+ {
+ // ensure the right date is set for the month_calendar
+ month_calendar.SetDate (this.date_value);
+ // get a rectangle that has the dimensions of the text area,
+ // but the height of the dtp control.
+ Rectangle align_area = this.date_area_rect;
+ align_area.Y = this.ClientRectangle.Y;
+ align_area.Height = this.ClientRectangle.Height;
+
+ // establish the month calendar's location
+ month_calendar.Location = CalculateDropDownLocation (
+ align_area,
+ month_calendar.Size,
+ (this.DropDownAlign == LeftRightAlignment.Left));
+ month_calendar.Show ();
+ month_calendar.Focus ();
+ month_calendar.Capture = true;
+
+ // fire any registered events
+ if (this.DropDown != null) {
+ this.DropDown (this, EventArgs.Empty);
+ }
+ }
+
+ // hide the month calendar
+ internal void HideMonthCalendar ()
+ {
+ this.is_drop_down_visible = false;
+ Invalidate (drop_down_arrow_rect);
+ month_calendar.Capture = false;
+ if (month_calendar.Visible) {
+ month_calendar.Hide ();
+ }
+ }
+
+ // raised by any key down events
+ private void KeyPressHandler (object sender, KeyPressEventArgs e) {
+ switch (e.KeyChar) {
+ default:
+ break;
+ }
+ e.Handled = true;
+ }
+
+// // if we lose focus and the drop down is up, then close it
+// private void LostFocusHandler (object sender, EventArgs e)
+// {
+// if (is_drop_down_visible && !month_calendar.Focused) {
+// this.HideMonthCalendar ();
+// }
+// }
+
+ // fired when a user clicks on the month calendar to select a date
+ private void MonthCalendarDateSelectedHandler (object sender, DateRangeEventArgs e)
+ {
+ this.Value = e.Start.Date.Add (this.Value.TimeOfDay);
+ this.HideMonthCalendar ();
+ this.Focus ();
+ }
+
+ // to check if the mouse has come down on this control
+ private void MouseDownHandler (object sender, MouseEventArgs e)
+ {
+ /* Click On button*/
+ if (ShowUpDown) {
+ // TODO: Process clicking for UPDown
+ } else {
+ if (is_drop_down_visible == false && drop_down_arrow_rect.Contains (e.X, e.Y)) {
+ is_drop_down_visible = true;
+ Invalidate (drop_down_arrow_rect);
+ DropDownMonthCalendar ();
+ } else {
+ // mouse down on this control anywhere else collapses it
+ if (is_drop_down_visible) {
+ HideMonthCalendar ();
+ }
+ }
+ }
+ }
+
+
+ // paint this control now
+ private void PaintHandler (object sender, PaintEventArgs pe) {
+ if (Width <= 0 || Height <= 0 || Visible == false)
+ return;
+
+ Draw (pe.ClipRectangle, pe.Graphics);
+ }
+
+ private string FormatValue () {
+ string ret_value = string.Empty;
+ switch (format) {
+ case DateTimePickerFormat.Custom:
+ // TODO implement custom text formatting
+ ret_value = date_value.ToString ();
+ break;
+ case DateTimePickerFormat.Short:
+ ret_value = date_value.ToShortDateString ();
+ break;
+ case DateTimePickerFormat.Time:
+ ret_value = date_value.ToLongTimeString ();
+ break;
+ default:
+ ret_value = date_value.ToLongDateString ();
+ break;
+ }
+ return ret_value;
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DateTimePickerFormat.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DateTimePickerFormat.cs
new file mode 100644
index 00000000000..9b284d7498a
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DateTimePickerFormat.cs
@@ -0,0 +1,33 @@
+// 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 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// John BouAntoun jba-mono@optusnet.com.au
+//
+
+namespace System.Windows.Forms {
+ public enum DateTimePickerFormat {
+ Custom = 8,
+ Long = 1,
+ Short = 2,
+ Time = 4
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Day.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Day.cs
new file mode 100644
index 00000000000..baebc9be345
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Day.cs
@@ -0,0 +1,39 @@
+//
+// 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 Novell, Inc.
+//
+// Authors:
+// John BouAntoun jba-mono@optusnet.com.au
+//
+
+namespace System.Windows.Forms {
+ // used mainly by monthcalendar
+ public enum Day {
+ Monday,
+ Tuesday,
+ Wednesday,
+ Thursday,
+ Friday,
+ Saturday,
+ Sunday,
+ Default
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DialogResult.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DialogResult.cs
new file mode 100644
index 00000000000..a956b43b857
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DialogResult.cs
@@ -0,0 +1,46 @@
+//
+// System.Windows.Forms.DialogResult.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.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+
+// COMPLETE
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+
+ [ComVisible(true)]
+ public enum DialogResult
+ {
+ None = 0,
+ OK = 1,
+ Cancel = 2,
+ Abort = 3,
+ Retry = 4,
+ Ignore = 5,
+ Yes = 6,
+ No = 7
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DockStyle.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DockStyle.cs
new file mode 100644
index 00000000000..2176ceff218
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DockStyle.cs
@@ -0,0 +1,41 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+ [Editor("System.Windows.Forms.Design.DockEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
+ public enum DockStyle {
+ None = 0,
+ Top = 1,
+ Bottom = 2,
+ Left = 3,
+ Right = 4,
+ Fill = 5
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DomainUpDown.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DomainUpDown.cs
new file mode 100644
index 00000000000..06d8c3d61b3
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DomainUpDown.cs
@@ -0,0 +1,572 @@
+// 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) 2005 Novell, Inc.
+//
+// Authors:
+// Jonathan Gilbert <logic@deltaq.org>
+//
+// Integration into MWF:
+// Peter Bartok <pbartok@novell.com>
+//
+
+// COMPLETE
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Drawing;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Windows.Forms;
+
+namespace System.Windows.Forms
+{
+ [DefaultProperty("Items")]
+ [DefaultEvent("SelectedItemChanged")]
+ [MonoTODO("Figure out what to do with the DomainItemAccessibleObject and DomainUpDownAccessibleObject classes")]
+ public class DomainUpDown : UpDownBase {
+ #region Local Variables
+ private DomainUpDownItemCollection items;
+ private int selected_index = -1;
+ private bool sorted;
+ private bool wrap;
+ private int typed_to_index = -1;
+ #endregion // Local Variables
+
+ #region DomainUpDownAccessibleObject sub-class
+ [ComVisible(true)]
+ public class DomainItemAccessibleObject : AccessibleObject {
+ #region DomainItemAccessibleObject Local Variables
+ private AccessibleObject parent;
+ #endregion // DomainItemAccessibleObject Local Variables
+
+ #region DomainItemAccessibleObject Constructors
+ public DomainItemAccessibleObject(string name, AccessibleObject parent) {
+ this.name = name;
+ this.parent = parent;
+ }
+ #endregion // DomainItemAccessibleObject Constructors
+
+ #region DomainItemAccessibleObject Properties
+ public override string Name {
+ get {
+ return base.Name;
+ }
+
+ set {
+ base.Name = value;
+ }
+ }
+
+ public override AccessibleObject Parent {
+ get {
+ return parent;
+ }
+ }
+
+ public override AccessibleRole Role {
+ get {
+ return base.Role;
+ }
+ }
+
+ public override AccessibleStates State {
+ get {
+ return base.State;
+ }
+ }
+
+ public override string Value {
+ get {
+ return base.Value;
+ }
+ }
+ #endregion // DomainItemAccessibleObject Properties
+ }
+ #endregion // DomainItemAccessibleObject sub-class
+
+ #region DomainUpDownAccessibleObject sub-class
+ [ComVisible(true)]
+ public class DomainUpDownAccessibleObject : ControlAccessibleObject {
+ #region DomainUpDownAccessibleObject Local Variables
+ private Control owner;
+ #endregion // DomainUpDownAccessibleObject Local Variables
+
+ #region DomainUpDownAccessibleObject Constructors
+ public DomainUpDownAccessibleObject(Control owner) : base(owner) {
+ this.owner = owner;
+ }
+ #endregion // DomainUpDownAccessibleObject Constructors
+
+ #region DomainUpDownAccessibleObject Properties
+ public override AccessibleRole Role {
+ get {
+ return base.Role;
+ }
+ }
+ #endregion // DomainUpDownAccessibleObject Properties
+
+ #region DomainUpDownAccessibleObject Methods
+ public override AccessibleObject GetChild(int index) {
+ return base.GetChild (index);
+ }
+
+ public override int GetChildCount() {
+ return base.GetChildCount ();
+ }
+ #endregion // DomainUpDownAccessibleObject Methods
+ }
+ #endregion // DomainUpDownAccessibleObject sub-class
+
+ #region DomainUpDownItemCollection sub-class
+ public class DomainUpDownItemCollection : ArrayList {
+ internal ArrayList string_cache = new ArrayList();
+
+ #region Local Variables
+ #endregion // Local Variables
+
+ #region Constructors
+ internal DomainUpDownItemCollection() {}
+ #endregion // Constructors
+
+ #region Public Instance Properties
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public override object this[int index] {
+ get {
+ return base[index];
+ }
+
+ set {
+ if (value == null) {
+ throw new ArgumentNullException("value", "Cannot add null values to a DomainUpDownItemCollection");
+ }
+
+ base[index] = value;
+ string_cache[index] = value.ToString();
+ OnCollectionChanged(index, 0);
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Instance Methods
+ public override int Add(object value) {
+ if (value == null)
+ throw new ArgumentNullException("value", "Cannot add null values to a DomainUpDownItemCollection");
+
+ int ret = base.Add(value);
+ string_cache.Add(value.ToString());
+ OnCollectionChanged(Count - 1, +1);
+ return ret;
+ }
+
+ public override void Insert(int index, object value) {
+ if (value == null)
+ throw new ArgumentNullException("value", "Cannot add null values to a DomainUpDownItemCollection");
+
+ base.Insert(index, value);
+ string_cache.Insert(index, value.ToString());
+ OnCollectionChanged(index, +1);
+ }
+
+ public override void Remove(object obj) {
+ int index = IndexOf(obj);
+
+ if (index >= 0)
+ RemoveAt(index);
+ }
+
+ public override void RemoveAt(int index) {
+ base.RemoveAt(index);
+ string_cache.RemoveAt(index);
+ OnCollectionChanged(index, -1);
+ }
+ #endregion // Public Instance Methods
+
+ #region Internal Methods and Events
+ internal void OnCollectionChanged(int index, int size_delta) {
+ CollectionChangedEventHandler handler = CollectionChanged;
+
+ if (handler != null) {
+ handler(index, size_delta);
+ }
+ }
+
+ internal void PrivSort() {
+ PrivSort(0, Count, Comparer.Default);
+ }
+
+ internal void PrivSort(int index, int count, IComparer comparer) {
+ object[] base_items = null; // this will refer to the base ArrayList private _items member
+ object[] string_cache_items = null; // and this will refer to that of the string_cache
+
+ FieldInfo items_field = null;
+
+ try {
+ items_field = typeof(ArrayList).GetField("_items", BindingFlags.NonPublic | BindingFlags.Instance);
+ }
+ catch {} // security exceptions, perhaps...
+
+ if (items_field != null) {
+ base_items = items_field.GetValue(this) as object[];
+ string_cache_items = items_field.GetValue(string_cache) as object[];
+ }
+
+ if ((base_items == null) || (string_cache_items == null)) {
+ // oh poop =/ guess we have to completely repopulate the string cache
+ base.Sort(index, count, comparer);
+
+ for (int i=0; i < count; i++)
+ string_cache[i + index] = base[i + index].ToString();
+ }
+ else {
+ // yay, this will be much faster than creating a whole bunch more items
+ Array.Sort(string_cache_items, base_items, index, count, comparer);
+
+ OnCollectionChanged(-1, 0);
+ }
+ }
+
+ internal void PrivSort(IComparer comparer) {
+ PrivSort(0, Count, comparer);
+ }
+
+ internal event CollectionChangedEventHandler CollectionChanged;
+ #endregion // Internal Methods and Events
+ }
+ #endregion // DomainUpDownItemCollection sub-class
+
+ #region Private Methods
+ // normally I'd use an EventArgs class, but I don't want to create spurious objects here
+ internal delegate void CollectionChangedEventHandler(int index, int size_delta);
+
+ internal void items_CollectionChanged(int index, int size_delta) {
+ bool new_item = false;
+
+ if ((index == selected_index) && (size_delta <= 0))
+ new_item = true;
+ else if (index <= selected_index)
+ selected_index += size_delta;
+
+ if (sorted && (index >= 0)) // index < 0 means it is already sorting
+ items.PrivSort();
+
+ UpdateEditText();
+
+ if (new_item) {
+ OnSelectedItemChanged(this, EventArgs.Empty);
+ }
+ }
+
+ void go_to_user_input() {
+ UserEdit = false;
+
+ if (typed_to_index >= 0) {
+ selected_index = typed_to_index;
+ OnSelectedItemChanged(this, EventArgs.Empty);
+ }
+ }
+
+ private void TextBoxLostFocus(object source, EventArgs e) {
+ Select(base.txtView.SelectionStart + base.txtView.SelectionLength, 0);
+ }
+
+ private void TextBoxKeyDown(object source, KeyPressEventArgs e) {
+ if (!UserEdit) {
+ base.txtView.SelectionLength = 0;
+ typed_to_index = -1;
+ }
+
+ if (base.txtView.SelectionLength == 0) {
+ base.txtView.SelectionStart = 0;
+ }
+
+ if (base.txtView.SelectionStart != 0) {
+ return;
+ }
+
+ if (e.KeyChar == '\b') { // backspace
+ if (base.txtView.SelectionLength > 0) {
+ string prefix = base.txtView.SelectedText.Substring(0, base.txtView.SelectionLength - 1);
+
+ bool found = false;
+
+ if (typed_to_index < 0) {
+ typed_to_index = 0;
+ }
+
+ if (sorted) {
+ for (int i=typed_to_index; i >= 0; i--) {
+ int difference = string.Compare(prefix, 0, items.string_cache[i].ToString(), 0, prefix.Length, true);
+
+ if (difference == 0) {
+ found = true;
+ typed_to_index = i;
+ }
+
+ if (difference > 0) { // since it is sorted, no strings after this point will match
+ break;
+ }
+ }
+ } else {
+ for (int i=0; i < items.Count; i++) {
+ if (0 == string.Compare(prefix, 0, items.string_cache[i].ToString(), 0, prefix.Length, true)) {
+ found = true;
+ typed_to_index = i;
+ break;
+ }
+ }
+ }
+
+ ChangingText = true;
+
+ if (found)
+ Text = items.string_cache[typed_to_index].ToString();
+ else
+ Text = prefix;
+
+ Select(0, prefix.Length);
+
+ UserEdit = true;
+
+ e.Handled = true;
+ }
+ }
+ else {
+ char key_char = e.KeyChar;
+
+ if (char.IsLetterOrDigit(key_char)
+ || char.IsNumber(key_char)
+ || char.IsPunctuation(key_char)
+ || char.IsSymbol(key_char)
+ || char.IsWhiteSpace(key_char)) {
+ string prefix = base.txtView.SelectedText + key_char;
+
+ bool found = false;
+
+ if (typed_to_index < 0) {
+ typed_to_index = 0;
+ }
+
+ if (sorted) {
+ for (int i=typed_to_index; i < items.Count; i++) {
+ int difference = string.Compare(prefix, 0, items.string_cache[i].ToString(), 0, prefix.Length, true);
+
+ if (difference == 0) {
+ found = true;
+ typed_to_index = i;
+ }
+
+ if (difference <= 0) { // since it is sorted, no strings after this point will match
+ break;
+ }
+ }
+ } else {
+ for (int i=0; i < items.Count; i++) {
+ if (0 == string.Compare(prefix, 0, items.string_cache[i].ToString(), 0, prefix.Length, true)) {
+ found = true;
+ typed_to_index = i;
+ break;
+ }
+ }
+ }
+
+ ChangingText = true;
+
+ if (found) {
+ Text = items.string_cache[typed_to_index].ToString();
+ } else {
+ Text = prefix;
+ }
+
+ Select(0, prefix.Length);
+
+ UserEdit = true;
+
+ e.Handled = true;
+ }
+ }
+ }
+ #endregion // Private Methods
+
+ #region Public Constructors
+ public DomainUpDown() {
+ selected_index = -1;
+ sorted = false;
+ wrap = false;
+ typed_to_index = -1;
+
+ items = new DomainUpDownItemCollection();
+ items.CollectionChanged += new CollectionChangedEventHandler(items_CollectionChanged);
+
+ this.txtView.LostFocus +=new EventHandler(TextBoxLostFocus);
+ this.txtView.KeyPress += new KeyPressEventHandler(TextBoxKeyDown);
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
+ [Editor("System.Windows.Forms.Design.StringCollectionEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ [Localizable(true)]
+ public DomainUpDownItemCollection Items {
+ get {
+ return items;
+ }
+ }
+
+ [Browsable(false)]
+ [DefaultValue(-1)]
+ public int SelectedIndex {
+ get {
+ return selected_index;
+ }
+ set {
+ object before = (selected_index >= 0) ? items[selected_index] : null;
+
+ selected_index = value;
+ UpdateEditText();
+
+ object after = (selected_index >= 0) ? items[selected_index] : null;
+
+ if (!ReferenceEquals(before, after)) {
+ OnSelectedItemChanged(this, EventArgs.Empty);
+ }
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public object SelectedItem {
+ get {
+ if (selected_index >= 0) {
+ return items[selected_index];
+ } else {
+ return null;
+ }
+ }
+
+ set {
+ SelectedIndex = items.IndexOf(value);
+ }
+ }
+
+ [DefaultValue(false)]
+ public bool Sorted {
+ get {
+ return sorted;
+ }
+ set {
+ sorted = value;
+
+ if (sorted)
+ items.PrivSort();
+ }
+ }
+
+ [DefaultValue(false)]
+ [Localizable(true)]
+ public bool Wrap {
+ get {
+ return wrap;
+ }
+ set {
+ wrap = value;
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Instance Methods
+ public override void DownButton() {
+ if (UserEdit)
+ go_to_user_input();
+
+ int new_index = selected_index + 1;
+
+ if (new_index >= items.Count) {
+ if (!wrap)
+ return;
+
+ new_index = 0;
+ }
+
+ SelectedIndex = new_index;
+ }
+
+ public override string ToString() {
+ return base.ToString() + ", Items.Count: " + items.Count + ", SelectedIndex: " + selected_index;
+ }
+
+ public override void UpButton() {
+ if (UserEdit)
+ go_to_user_input();
+
+ int new_index = selected_index - 1;
+
+ if (new_index < 0) {
+ if (!wrap) {
+ return;
+ }
+
+ new_index = items.Count - 1;
+ }
+
+ SelectedIndex = new_index;
+ }
+ #endregion // Public Instance Methods
+
+ #region Protected Instance Methods
+ protected override AccessibleObject CreateAccessibilityInstance() {
+ AccessibleObject acc;
+
+ acc = new AccessibleObject(this);
+ acc.role = AccessibleRole.SpinButton;
+
+ return acc;
+ }
+
+ protected override void OnChanged(object source, EventArgs e) {
+ base.OnChanged (source, e);
+ }
+
+ protected void OnSelectedItemChanged(object source, EventArgs e) {
+ EventHandler handler = SelectedItemChanged;
+
+ if (handler != null)
+ handler(source, e);
+ }
+
+ protected override void UpdateEditText() {
+ if ((selected_index >= 0) && (selected_index < items.Count)) {
+ ChangingText = true;
+ Text = items.string_cache[selected_index].ToString();
+ }
+ }
+
+ protected override void OnTextBoxKeyDown(object source, KeyEventArgs e) {
+ base.OnTextBoxKeyDown (source, e);
+ }
+
+ #endregion // Protected Instance Methods
+
+ #region Events
+ public event EventHandler SelectedItemChanged;
+ #endregion // Events
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DragAction.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DragAction.cs
new file mode 100644
index 00000000000..73313e26f1d
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DragAction.cs
@@ -0,0 +1,39 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+
+// COMPLETE
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [ComVisible(true)]
+ public enum DragAction {
+ Continue = 0,
+ Drop = 1,
+ Cancel = 2
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DragDropEffects.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DragDropEffects.cs
new file mode 100644
index 00000000000..66cdc6df821
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DragDropEffects.cs
@@ -0,0 +1,41 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+
+ [Flags]
+ public enum DragDropEffects {
+ None = 0x00000000,
+ Copy = 0x00000001,
+ Move = 0x00000002,
+ Link = 0x00000004,
+ Scroll = unchecked((int)0x80000000),
+ All = unchecked((int)0x80000003)
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DragEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DragEventArgs.cs
new file mode 100644
index 00000000000..ea6ccc20222
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DragEventArgs.cs
@@ -0,0 +1,97 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+
+// COMPLETE
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [ComVisible(true)]
+ public class DragEventArgs : EventArgs {
+ internal int x;
+ internal int y;
+ internal int keystate;
+ internal DragDropEffects allowed_effect;
+ internal DragDropEffects current_effect;
+ internal IDataObject data_object;
+
+ #region Public Constructors
+ public DragEventArgs(IDataObject data, int keyState, int x, int y, DragDropEffects allowedEffect, DragDropEffects effect) {
+ this.x=x;
+ this.y=y;
+ this.keystate=keyState;
+ this.allowed_effect=allowedEffect;
+ this.current_effect=effect;
+ this.data_object=data;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public DragDropEffects AllowedEffect {
+ get {
+ return this.allowed_effect;
+ }
+ }
+
+ public IDataObject Data {
+ get {
+ return this.data_object;
+ }
+ }
+
+ public DragDropEffects Effect {
+ get {
+ return this.current_effect;
+ }
+
+ set {
+ if ((value & this.allowed_effect)!=0) {
+ this.current_effect=value;
+ }
+ }
+ }
+
+ public int KeyState {
+ get {
+ return this.keystate;
+ }
+ }
+
+ public int X {
+ get {
+ return this.x;
+ }
+ }
+
+ public int Y {
+ get {
+ return this.y;
+ }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DragEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DragEventHandler.cs
new file mode 100644
index 00000000000..c2c4d1e0bd0
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DragEventHandler.cs
@@ -0,0 +1,31 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public delegate void DragEventHandler (object sender, DragEventArgs e);
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DrawItemEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DrawItemEventArgs.cs
new file mode 100644
index 00000000000..5ef247df86e
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DrawItemEventArgs.cs
@@ -0,0 +1,101 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+
+using System;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ public class DrawItemEventArgs : EventArgs {
+
+ Graphics graphics;
+ Font font;
+ Rectangle rect;
+ int index;
+ DrawItemState state;
+ Color fore_color;
+ Color back_color;
+
+ public DrawItemEventArgs (Graphics graphics, Font font,
+ Rectangle rect, int index, DrawItemState state) :
+ this (graphics, font, rect, index, state,
+ Control.DefaultForeColor, Control.DefaultBackColor)
+ {
+
+ }
+
+ public DrawItemEventArgs (Graphics graphics, Font font,
+ Rectangle rect, int index, DrawItemState state,
+ Color fore_color, Color back_color)
+ {
+ this.graphics = graphics;
+ this.font = font;
+ this.rect = rect;
+ this.index = index;
+ this.state = state;
+ this.fore_color = fore_color;
+ this.back_color = back_color;
+ }
+
+ public Graphics Graphics {
+ get { return graphics; }
+ }
+
+ public Font Font {
+ get { return font; }
+ }
+
+ public Rectangle Bounds {
+ get { return rect; }
+ }
+
+ public int Index {
+ get { return index; }
+ }
+
+ public DrawItemState State {
+ get { return state; }
+ }
+
+ public Color BackColor {
+ get { return back_color; }
+ }
+
+ public Color ForeColor {
+ get { return fore_color; }
+ }
+
+ public virtual void DrawBackground ()
+ {
+ ThemeEngine.Current.DrawOwnerDrawBackground (this);
+ }
+
+ public virtual void DrawFocusRectangle ()
+ {
+ ThemeEngine.Current.DrawOwnerDrawFocusRectangle (this);
+ }
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DrawItemEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DrawItemEventHandler.cs
new file mode 100644
index 00000000000..697783cdce3
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DrawItemEventHandler.cs
@@ -0,0 +1,32 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+//
+// COMPLETE
+
+namespace System.Windows.Forms
+{
+ [Serializable]
+ public delegate void DrawItemEventHandler (object sender, DrawItemEventArgs e);
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DrawItemState.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DrawItemState.cs
new file mode 100644
index 00000000000..0b2a8b1c99a
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DrawItemState.cs
@@ -0,0 +1,44 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+
+namespace System.Windows.Forms {
+
+ [Flags]
+ public enum DrawItemState {
+ None = 0,
+ Selected = 1,
+ Grayed = 2,
+ Disabled = 4,
+ Checked = 8,
+ Focus = 16,
+ Default = 32,
+ HotLight = 64,
+ Inactive = 128,
+ NoAccelerator = 256,
+ NoFocusRect = 512,
+ ComboBoxEdit = 4096
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DrawMode.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DrawMode.cs
new file mode 100644
index 00000000000..073bca003b7
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DrawMode.cs
@@ -0,0 +1,37 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+//
+
+namespace System.Windows.Forms
+{
+ [Serializable]
+ public enum DrawMode
+ {
+ Normal = 0,
+ OwnerDrawFixed = 1,
+ OwnerDrawVariable = 2,
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ErrorBlinkStyle.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ErrorBlinkStyle.cs
new file mode 100644
index 00000000000..8115a3d0b42
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ErrorBlinkStyle.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public enum ErrorBlinkStyle {
+ BlinkIfDifferentError = 0,
+ AlwaysBlink = 1,
+ NeverBlink = 2
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ErrorIconAlignment.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ErrorIconAlignment.cs
new file mode 100644
index 00000000000..0539a3af2e3
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ErrorIconAlignment.cs
@@ -0,0 +1,38 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public enum ErrorIconAlignment {
+ TopLeft = 0,
+ TopRight = 1,
+ MiddleLeft = 2,
+ MiddleRight = 3,
+ BottomLeft = 4,
+ BottomRight = 5
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ErrorProvider.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ErrorProvider.cs
new file mode 100644
index 00000000000..450e975a883
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ErrorProvider.cs
@@ -0,0 +1,440 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+ [ToolboxItemFilter("System.Windows.Forms")]
+ [ProvideProperty("IconAlignment", "System.Windows.Forms.Control, " + Consts.AssemblySystem_Windows_Forms)]
+ [ProvideProperty("IconPadding", "System.Windows.Forms.Control, " + Consts.AssemblySystem_Windows_Forms)]
+ [ProvideProperty("Error", "System.Windows.Forms.Control, " + Consts.AssemblySystem_Windows_Forms)]
+ public class ErrorProvider : Component, IExtenderProvider {
+ #region Private Classes
+ private class ErrorProperty {
+ public ErrorIconAlignment alignment;
+ public int padding;
+ public string text;
+ public Control control;
+ public ErrorProvider ep;
+ private UserControl window;
+ private bool visible;
+ private int blink_count;
+ private EventHandler tick;
+ private System.Windows.Forms.Timer timer;
+
+ public ErrorProperty(ErrorProvider ep, Control control) {
+ this.ep = ep;
+ this.control = control;
+
+ alignment = ErrorIconAlignment.MiddleRight;
+ padding = 0;
+ text = string.Empty;
+ blink_count = 0;
+
+ tick = new EventHandler(window_Tick);
+
+ window = new UserControl();
+ window.Visible = false;
+ window.Width = ep.icon.Width;
+ window.Height = ep.icon.Height;
+
+ if (ep.container != null) {
+ ep.container.Controls.Add(window);
+ ep.container.Controls.SetChildIndex(window, 0);
+ } else {
+ control.parent.Controls.Add(window);
+ control.parent.Controls.SetChildIndex(window, 0);
+ }
+
+ window.Paint += new PaintEventHandler(window_Paint);
+ window.MouseEnter += new EventHandler(window_MouseEnter);
+ window.MouseLeave += new EventHandler(window_MouseLeave);
+ control.SizeChanged += new EventHandler(control_SizeLocationChanged);
+ control.LocationChanged += new EventHandler(control_SizeLocationChanged);
+ // Do we want to block mouse clicks? if so we need a few more events handled
+
+ CalculateAlignment();
+ }
+
+ public string Text {
+ get {
+ return text;
+ }
+
+ set {
+ text = value;
+ if (text != String.Empty) {
+ window.Visible = true;
+ } else {
+ window.Visible = false;
+ }
+
+ if (ep.blinkstyle != ErrorBlinkStyle.NeverBlink) {
+ if (timer == null) {
+ timer = new System.Windows.Forms.Timer();
+ }
+ timer.Interval = ep.blinkrate;
+ timer.Tick += tick;
+ blink_count = 0;
+ timer.Enabled = true;
+ }
+ }
+ }
+
+ public ErrorIconAlignment Alignment {
+ get {
+ return alignment;
+ }
+
+ set {
+ if (alignment != value) {
+ alignment = value;
+ CalculateAlignment();
+ }
+ }
+ }
+
+ public int Padding {
+ get {
+ return padding;
+ }
+
+ set {
+ if (padding != value) {
+ padding = value;
+ CalculateAlignment();
+ }
+ }
+ }
+
+ private void CalculateAlignment() {
+ if (visible) {
+ visible = false;
+ ep.tooltip.Visible = false;
+ }
+
+ switch (alignment) {
+ case ErrorIconAlignment.TopLeft: {
+ window.Left = control.Left - ep.icon.Width - padding;
+ window.Top = control.Top;
+ break;
+ }
+
+ case ErrorIconAlignment.TopRight: {
+ window.Left = control.Left + control.Width + padding;
+ window.Top = control.Top;
+ break;
+ }
+
+ case ErrorIconAlignment.MiddleLeft: {
+ window.Left = control.Left - ep.icon.Width - padding;
+ window.Top = control.Top + (control.Height - ep.icon.Height) / 2;
+ break;
+ }
+
+ case ErrorIconAlignment.MiddleRight: {
+ window.Left = control.Left + control.Width + padding;
+ window.Top = control.Top + (control.Height - ep.icon.Height) / 2;
+ break;
+ }
+
+ case ErrorIconAlignment.BottomLeft: {
+ window.Left = control.Left - ep.icon.Width - padding;
+ window.Top = control.Top + control.Height - ep.icon.Height;
+ break;
+ }
+
+ case ErrorIconAlignment.BottomRight: {
+ window.Left = control.Left + control.Width + padding;
+ window.Top = control.Top + control.Height - ep.icon.Height;
+ break;
+ }
+ }
+ }
+
+ private void window_Paint(object sender, PaintEventArgs e) {
+ if (text != string.Empty) {
+ e.Graphics.DrawIcon(this.ep.icon, 0, 0);
+ }
+ }
+
+ private void window_MouseEnter(object sender, EventArgs e) {
+ if (!visible) {
+ Size size;
+ Point pt;
+
+ visible = true;
+
+ pt = Control.MousePosition;
+
+ size = ThemeEngine.Current.ToolTipSize(ep.tooltip, text);
+ ep.tooltip.Width = size.Width;
+ ep.tooltip.Height = size.Height;
+ ep.tooltip.Text = text;
+
+ if ((pt.X + size.Width) < SystemInformation.WorkingArea.Width) {
+ ep.tooltip.Left = pt.X;
+ } else {
+ ep.tooltip.Left = pt.X - size.Width;
+ }
+
+ if ((pt.Y + size.Height) < (SystemInformation.WorkingArea.Height - 16)) {
+ ep.tooltip.Top = pt.Y + 16;
+ } else {
+ ep.tooltip.Top = pt.Y - size.Height;
+ }
+ ep.tooltip.Visible = true;
+ }
+ }
+
+ private void window_MouseLeave(object sender, EventArgs e) {
+ if (visible) {
+ visible = false;
+ ep.tooltip.Visible = false;
+ }
+ }
+
+ private void control_SizeLocationChanged(object sender, EventArgs e) {
+ if (visible) {
+ visible = false;
+ ep.tooltip.Visible = false;
+ }
+ CalculateAlignment();
+ }
+
+ private void window_Tick(object sender, EventArgs e) {
+ if (timer.Enabled) {
+ Graphics g;
+
+ blink_count++;
+
+ // Dunno why this POS doesn't reliably blink
+ g = window.CreateGraphics();
+ if ((blink_count % 2) == 0) {
+ g.FillRectangle(ThemeEngine.Current.ResPool.GetSolidBrush(window.parent.BackColor), window.ClientRectangle);
+ } else {
+ g.DrawIcon(this.ep.icon, 0, 0);
+ }
+ g.Dispose();
+
+ if ((blink_count > 6) && (ep.blinkstyle == ErrorBlinkStyle.BlinkIfDifferentError)) {
+ timer.Stop();
+ blink_count = 0;
+ }
+ }
+ }
+ }
+ #endregion
+
+ #region Local Variables
+ private int blinkrate;
+ private ErrorBlinkStyle blinkstyle;
+ private string datamember;
+ private object datasource;
+ private ContainerControl container;
+ private Icon icon;
+ private Hashtable controls;
+ private ToolTip.ToolTipWindow tooltip;
+ #endregion // Local Variables
+
+ #region Public Constructors
+ public ErrorProvider() {
+ controls = new Hashtable();
+
+ blinkrate = 250;
+ blinkstyle = ErrorBlinkStyle.BlinkIfDifferentError;
+
+ icon = (Icon)Locale.GetResource("errorProvider.ico");
+ tooltip = new ToolTip.ToolTipWindow(null);
+ }
+
+ public ErrorProvider(ContainerControl parentControl) : this() {
+ container = parentControl;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ [DefaultValue(250)]
+ [RefreshProperties(RefreshProperties.Repaint)]
+ public int BlinkRate {
+ get {
+ return blinkrate;
+ }
+
+ set {
+ blinkrate = value;
+ }
+ }
+
+ [DefaultValue(ErrorBlinkStyle.BlinkIfDifferentError)]
+ public ErrorBlinkStyle BlinkStyle {
+ get {
+ return blinkstyle;
+ }
+
+ set {
+ blinkstyle = value;
+ }
+ }
+
+ [DefaultValue(null)]
+ public ContainerControl ContainerControl {
+ get {
+ return container;
+ }
+
+ set {
+ container = value;
+ }
+ }
+
+ [MonoTODO]
+ [DefaultValue(null)]
+ [Editor ("System.Windows.Forms.Design.DataMemberListEditor, " + Consts.AssemblySystem_Design, "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)]
+ public string DataMember {
+ get {
+ return datamember;
+ }
+
+ set {
+ datamember = value;
+ // FIXME - add binding magic and also update BindToDataAndErrors with it
+ }
+ }
+
+ [MonoTODO]
+ [DefaultValue(null)]
+ [TypeConverter("System.Windows.Forms.Design.DataSourceConverter, " + Consts.AssemblySystem_Design)]
+ public object DataSource {
+ get {
+ return datasource;
+ }
+
+ set {
+ datasource = value;
+ // FIXME - add binding magic and also update BindToDataAndErrors with it
+ }
+ }
+
+ [Localizable(true)]
+ public Icon Icon {
+ get {
+ return icon;
+ }
+
+ set {
+ icon = value;
+ }
+ }
+
+ public override ISite Site {
+ set {
+ base.Site = value;
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Instance Methods
+ [MonoTODO]
+ public void BindToDataAndErrors(object newDataSource, string newDataMember) {
+ datasource = newDataSource;
+ datamember = newDataMember;
+ // FIXME - finish
+ }
+
+ public bool CanExtend(object extendee) {
+ if (!(extendee is Control)) {
+ return false;
+ }
+
+ if ((extendee is Form) || (extendee is ToolBar)) {
+ return false;
+ }
+
+ return true;
+ }
+
+ [Localizable(true)]
+ [DefaultValue("")]
+ public string GetError(Control control) {
+ return GetErrorProperty(control).Text;
+ }
+
+ [Localizable(true)]
+ [DefaultValue(ErrorIconAlignment.MiddleRight)]
+ public ErrorIconAlignment GetIconAlignment(Control control) {
+ return GetErrorProperty(control).Alignment;
+ }
+
+ [Localizable(true)]
+ [DefaultValue(0)]
+ public int GetIconPadding(Control control) {
+ return GetErrorProperty(control).padding;
+ }
+
+ public void SetError(Control control, string value) {
+ GetErrorProperty(control).Text = value;
+ }
+
+ public void SetIconAlignment(Control control, ErrorIconAlignment value) {
+ GetErrorProperty(control).Alignment = value;
+ }
+
+ public void SetIconPadding(Control control, int padding) {
+ GetErrorProperty(control).Padding = padding;
+ }
+
+ [MonoTODO]
+ public void UpdateBinding() {
+ }
+ #endregion // Public Instance Methods
+
+ #region Protected Instance Methods
+ protected override void Dispose(bool disposing) {
+ base.Dispose (disposing);
+ }
+ #endregion // Protected Instance Methods
+
+ #region Private Methods
+ private ErrorProperty GetErrorProperty(Control control) {
+ ErrorProperty ep;
+
+ ep = (ErrorProperty)controls[control];
+ if (ep == null) {
+ ep = new ErrorProperty(this, control);
+ controls[control] = ep;
+ }
+
+ return ep;
+ }
+ #endregion // Private Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FeatureSupport.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FeatureSupport.cs
new file mode 100644
index 00000000000..3420d69ef39
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FeatureSupport.cs
@@ -0,0 +1,116 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+using System.Reflection;
+
+namespace System.Windows.Forms {
+ public abstract class FeatureSupport : IFeatureSupport {
+ #region Public Constructors
+ protected FeatureSupport() {
+ }
+ #endregion // Public Constructors
+
+ #region Private and Internal Methods
+ private static IFeatureSupport FeatureObject(string class_name) {
+ Type class_type;
+
+ class_type = Type.GetType(class_name);
+ if ((class_type != null) && (typeof(IFeatureSupport).IsAssignableFrom(class_type))) {
+ ConstructorInfo ctor;
+
+ ctor = class_type.GetConstructor(Type.EmptyTypes);
+ if (ctor != null) {
+ return ((IFeatureSupport)ctor.Invoke(new Object[0]));
+ }
+ }
+
+ return null;
+ }
+ #endregion // Private and Internal Methods
+
+ #region Public Static Methods
+ public static Version GetVersionPresent(string featureClassName, string featureConstName) {
+ IFeatureSupport obj;
+
+ obj = FeatureObject(featureClassName);
+ if (obj != null) {
+ return obj.GetVersionPresent(featureConstName);
+ }
+ return null;
+ }
+
+ public static bool IsPresent(string featureClassName, string featureConstName) {
+ IFeatureSupport obj;
+
+ obj = FeatureObject(featureClassName);
+ if (obj != null) {
+ return obj.IsPresent(featureConstName);
+ }
+
+ return false;
+ }
+
+ public static bool IsPresent(string featureClassName, string featureConstName, Version minimumVersion) {
+ IFeatureSupport obj;
+
+ obj = FeatureObject(featureClassName);
+ if (obj != null) {
+ return obj.IsPresent(featureConstName, minimumVersion);
+ }
+
+ return false;
+ }
+ #endregion // Public Static Methods
+
+ #region Public Instance Methods
+ public abstract Version GetVersionPresent(object feature);
+
+ public virtual bool IsPresent(object feature) {
+ if (GetVersionPresent(feature) != null) {
+ return true;
+ }
+
+ return false;
+ }
+
+ public virtual bool IsPresent(object feature, Version minimumVersion) {
+ Version version;
+ bool retval;
+
+ retval = false;
+ version = GetVersionPresent(feature);
+
+ if ((version != null) && (version >= minimumVersion)) {
+ retval = true;
+ }
+
+ return retval;
+ }
+ #endregion // Public Instance Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs
new file mode 100644
index 00000000000..063596ce2d9
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs
@@ -0,0 +1,2584 @@
+// 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 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//
+// Alexander Olk xenomorph2@onlinehome.de
+//
+
+// NOT COMPLETE - work in progress
+
+using System;
+using System.Drawing;
+using System.ComponentModel;
+using System.Resources;
+using System.IO;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Xml;
+
+namespace System.Windows.Forms
+{
+ [DefaultProperty( "FileName" )]
+ [DefaultEvent( "FileOk" )]
+ public abstract class FileDialog : CommonDialog
+ {
+ protected static readonly object EventFileOk = new object ();
+
+ internal enum FileDialogType
+ {
+ OpenFileDialog,
+ SaveFileDialog
+ }
+
+ internal FileDialogPanel fileDialogPanel;
+
+ private bool addExtension = true;
+ internal bool checkFileExists = false;
+ private bool checkPathExists = true;
+ private string defaultExt = "";
+ private bool dereferenceLinks = true;
+ private string fileName = "";
+ private string[] fileNames;
+ private string filter;
+ private int filterIndex = 1;
+ private string initialDirectory = "";
+ private bool restoreDirectory = false;
+ private bool showHelp = false;
+ private string title = "";
+ private bool validateNames = true;
+
+ //protected bool readOnlyChecked = false;
+
+ internal string openSaveButtonText;
+ internal string searchSaveLabelText;
+ internal bool showReadOnly = false;
+ internal bool readOnlyChecked = false;
+ internal bool multiSelect = false;
+ internal bool createPrompt = false;
+ internal bool overwritePrompt = true;
+
+ private bool showHiddenFiles = false;
+
+ internal FileDialogType fileDialogType;
+
+ internal FileDialog( ) : base()
+ {
+ form.MaximizeBox = true;
+ }
+
+ [DefaultValue(true)]
+ public bool AddExtension
+ {
+ get {
+ return addExtension;
+ }
+
+ set {
+ addExtension = value;
+ }
+ }
+
+ [DefaultValue(false)]
+ public virtual bool CheckFileExists
+ {
+ get {
+ return checkFileExists;
+ }
+
+ set {
+ checkFileExists = value;
+ }
+ }
+
+ [DefaultValue(true)]
+ public bool CheckPathExists
+ {
+ get {
+ return checkPathExists;
+ }
+
+ set {
+ checkPathExists = value;
+ }
+ }
+
+ [DefaultValue("")]
+ public string DefaultExt
+ {
+ get {
+ return defaultExt;
+ }
+
+ set {
+ defaultExt = value;
+
+ // if there is a dot remove it and everything before it
+ if ( defaultExt.LastIndexOf( '.' ) != - 1 )
+ {
+ string[] split = defaultExt.Split( new char[] { '.' } );
+ defaultExt = split[ split.Length - 1 ];
+ }
+ }
+ }
+
+ // in MS.NET it doesn't make a difference if
+ // DerefenceLinks is true or false
+ // if the selected file is a link FileDialog
+ // always returns the link
+ [DefaultValue(true)]
+ public bool DereferenceLinks
+ {
+ get {
+ return dereferenceLinks;
+ }
+
+ set {
+ dereferenceLinks = value;
+ }
+ }
+
+ [DefaultValue("")]
+ public string FileName
+ {
+ get {
+ return fileName;
+ }
+
+ set {
+ fileName = value;
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string[] FileNames
+ {
+ get {
+ if ( multiSelect )
+ return fileNames;
+
+ return null;
+ }
+ }
+
+ [DefaultValue("")]
+ [Localizable(true)]
+ public string Filter
+ {
+ get {
+ return filter;
+ }
+
+ set {
+ if ( value == null )
+ throw new NullReferenceException( "Filter" );
+
+ filter = value;
+
+ fileFilter = new FileFilter( filter );
+
+ fileDialogPanel.UpdateFilters( );
+ }
+ }
+
+ [DefaultValue(1)]
+ public int FilterIndex
+ {
+ get {
+ return filterIndex;
+ }
+
+ set {
+ filterIndex = value;
+ }
+ }
+
+ [DefaultValue("")]
+ public string InitialDirectory
+ {
+ get {
+ return initialDirectory;
+ }
+
+ set {
+ if (Directory.Exists (value)) {
+ initialDirectory = value;
+
+ fileDialogPanel.ChangeDirectory( null, initialDirectory );
+ }
+ }
+ }
+
+ [DefaultValue(false)]
+ public bool RestoreDirectory
+ {
+ get {
+ return restoreDirectory;
+ }
+
+ set {
+ restoreDirectory = value;
+ }
+ }
+
+ [DefaultValue(false)]
+ public bool ShowHelp
+ {
+ get {
+ return showHelp;
+ }
+
+ set {
+ showHelp = value;
+ fileDialogPanel.ResizeAndRelocateForHelpOrReadOnly( );
+ }
+ }
+
+ [DefaultValue("")]
+ [Localizable(true)]
+ public string Title
+ {
+ get {
+ return title;
+ }
+
+ set {
+ title = value;
+
+ form.Text = title;
+ }
+ }
+
+ // this one is a hard one ;)
+ // Win32 filename:
+ // - up to MAX_PATH characters (windef.h) = 260
+ // - no trailing dots or spaces
+ // - case preserving
+ // - etc...
+ // NTFS/Posix filename:
+ // - up to 32,768 Unicode characters
+ // - trailing periods or spaces
+ // - case sensitive
+ // - etc...
+ [DefaultValue(true)]
+ public bool ValidateNames
+ {
+ get {
+ return validateNames;
+ }
+
+ set {
+ validateNames = value;
+ }
+ }
+
+ internal string OpenSaveButtonText
+ {
+ set {
+ openSaveButtonText = value;
+ }
+
+ get {
+ return openSaveButtonText;
+ }
+ }
+
+ internal string SearchSaveLabelText
+ {
+ set {
+ searchSaveLabelText = value;
+ }
+
+ get {
+ return searchSaveLabelText;
+ }
+ }
+
+ internal virtual bool ShowReadOnly
+ {
+ set {
+ showReadOnly = value;
+ fileDialogPanel.ResizeAndRelocateForHelpOrReadOnly( );
+ }
+
+ get {
+ return showReadOnly;
+ }
+ }
+
+ internal virtual bool ReadOnlyChecked
+ {
+ set {
+ readOnlyChecked = value;
+ fileDialogPanel.CheckBox.Checked = value;
+ }
+
+ get {
+ return readOnlyChecked;
+ }
+ }
+
+ internal virtual bool Multiselect
+ {
+ set {
+ multiSelect = value;
+ fileDialogPanel.MultiSelect = value;
+ }
+
+ get {
+ return multiSelect;
+ }
+ }
+
+ // extension to MS.NET framework...
+ // Must keep this internal, otherwise our signature doesn't match MS
+ internal bool ShowHiddenFiles
+ {
+ set {
+ showHiddenFiles = value;
+ }
+
+ get {
+ return showHiddenFiles;
+ }
+ }
+
+ internal virtual bool CreatePrompt
+ {
+ set {
+ createPrompt = value;
+ }
+
+ get {
+ return createPrompt;
+ }
+ }
+
+ internal virtual bool OverwritePrompt
+ {
+ set {
+ overwritePrompt = value;
+ }
+
+ get {
+ return overwritePrompt;
+ }
+ }
+
+ internal FileFilter FileFilter
+ {
+ set {
+ fileFilter = value;
+ }
+
+ get {
+ return fileFilter;
+ }
+ }
+
+ public override void Reset( )
+ {
+ addExtension = true;
+ checkFileExists = false;
+ checkPathExists = true;
+ defaultExt = "";
+ dereferenceLinks = true;
+ fileName = "";
+ fileNames = null;
+ Filter = "";
+ filterIndex = 1;
+ initialDirectory = "";
+ restoreDirectory = false;
+ ShowHelp = false;
+ Title = "";
+ validateNames = true;
+
+ fileDialogPanel.UpdateFilters( );
+ }
+
+ public override string ToString( )
+ {
+ return base.ToString( );
+ }
+
+ public event CancelEventHandler FileOk {
+ add { Events.AddHandler (EventFileOk, value); }
+ remove { Events.RemoveHandler (EventFileOk, value); }
+ }
+
+ protected virtual IntPtr Instance {
+ get {
+ if (fileDialogPanel == null)
+ return IntPtr.Zero;
+ return fileDialogPanel.Handle;
+ }
+ }
+
+ // This is just for internal use with MSs version, so it doesn't need to be implemented
+ // as it can't really be accessed anyways
+ protected int Options {
+ get { return -1; }
+ }
+
+ [MonoTODO]
+ protected override IntPtr HookProc( IntPtr hWnd, int msg, IntPtr wparam, IntPtr lparam )
+ {
+ throw new NotImplementedException( );
+ }
+
+ protected void OnFileOk( CancelEventArgs e )
+ {
+ CancelEventHandler fo = (CancelEventHandler) Events [EventFileOk];
+ if (fo != null)
+ fo (this, e);
+ }
+
+ [MonoTODO]
+ protected override bool RunDialog( IntPtr hWndOwner )
+ {
+ form.Controls.Add( fileDialogPanel );
+
+ return true;
+ }
+
+ internal void SendHelpRequest( EventArgs e )
+ {
+ OnHelpRequest( e );
+ }
+
+ internal void SetFilenames( string[] filenames )
+ {
+ fileNames = filenames;
+ }
+
+ internal FileFilter fileFilter;
+
+ internal class FileDialogPanel : Panel
+ {
+ private Button cancelButton;
+ private ToolBarButton upToolBarButton;
+ private PopupButtonPanel popupButtonPanel;
+ private Button openSaveButton;
+ private Button helpButton;
+ private Label fileTypeLabel;
+ private ToolBarButton menueToolBarButton;
+ private ContextMenu menueToolBarButtonContextMenu;
+ private ToolBar smallButtonToolBar;
+ private DirComboBox dirComboBox;
+ private ComboBox fileNameComboBox;
+ private Label fileNameLabel;
+ private MWFFileView mwfFileView;
+ private Label searchSaveLabel;
+ private ToolBarButton newdirToolBarButton;
+ private ToolBarButton backToolBarButton;
+ private ComboBox fileTypeComboBox;
+ private ImageList imageListTopToolbar;
+ private ContextMenu contextMenu;
+ private CheckBox checkBox;
+
+ internal FileDialog fileDialog;
+
+ private string currentDirectoryName;
+
+ internal string currentFileName = "";
+
+ // store current directoryInfo
+ private DirectoryInfo currentDirectoryInfo;
+
+ // store DirectoryInfo for backButton
+ internal Stack directoryStack = new Stack();
+
+ private MenuItem previousCheckedMenuItem;
+
+ private bool multiSelect = false;
+
+ private string restoreDirectory = "";
+
+ private bool show_special_case = false;
+
+ internal static readonly string recently_string = "[recently/recently]";
+
+ private string current_special_case;
+
+ public FileDialogPanel( FileDialog fileDialog )
+ {
+ this.fileDialog = fileDialog;
+
+ fileTypeComboBox = new ComboBox( );
+ backToolBarButton = new ToolBarButton( );
+ newdirToolBarButton = new ToolBarButton( );
+ searchSaveLabel = new Label( );
+ mwfFileView = new MWFFileView( );
+ fileNameLabel = new Label( );
+ fileNameComboBox = new ComboBox( );
+ dirComboBox = new DirComboBox( );
+ smallButtonToolBar = new ToolBar( );
+ menueToolBarButton = new ToolBarButton( );
+ fileTypeLabel = new Label( );
+ openSaveButton = new Button( );
+ fileDialog.form.AcceptButton = openSaveButton;
+ helpButton = new Button( );
+ popupButtonPanel = new PopupButtonPanel( this );
+ upToolBarButton = new ToolBarButton( );
+ cancelButton = new Button( );
+ fileDialog.form.CancelButton = cancelButton;
+ imageListTopToolbar = new ImageList( );
+ menueToolBarButtonContextMenu = new ContextMenu( );
+ contextMenu = new ContextMenu( );
+ checkBox = new CheckBox( );
+
+ SuspendLayout( );
+
+ //imageListTopToolbar
+ imageListTopToolbar.ColorDepth = ColorDepth.Depth32Bit;
+ imageListTopToolbar.ImageSize = new Size( 16, 16 ); // 16, 16
+ imageListTopToolbar.Images.Add( (Image)Locale.GetResource( "back_arrow" ) );
+ imageListTopToolbar.Images.Add( (Image)Locale.GetResource( "folder_arrow_up" ) );
+ imageListTopToolbar.Images.Add( (Image)Locale.GetResource( "folder_star" ) );
+ imageListTopToolbar.Images.Add( (Image)Locale.GetResource( "window" ) );
+ imageListTopToolbar.TransparentColor = Color.Transparent;
+
+ // searchLabel
+ searchSaveLabel.FlatStyle = FlatStyle.System;
+ searchSaveLabel.Location = new Point( 7, 8 );
+ searchSaveLabel.Size = new Size( 72, 21 );
+ searchSaveLabel.TabIndex = 0;
+ searchSaveLabel.Text = fileDialog.SearchSaveLabelText;
+ searchSaveLabel.TextAlign = ContentAlignment.MiddleRight;
+
+ // dirComboBox
+ dirComboBox.Anchor = ( (AnchorStyles)( ( ( AnchorStyles.Top | AnchorStyles.Left ) | AnchorStyles.Right ) ) );
+ dirComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
+ dirComboBox.Location = new Point( 99, 8 );
+ dirComboBox.Size = new Size( 260, 21 );
+ dirComboBox.TabIndex = 1;
+
+ // smallButtonToolBar
+ smallButtonToolBar.Anchor = ( (AnchorStyles)( ( AnchorStyles.Top | AnchorStyles.Right ) ) );
+ smallButtonToolBar.Appearance = ToolBarAppearance.Flat;
+ smallButtonToolBar.AutoSize = false;
+ smallButtonToolBar.Buttons.AddRange( new ToolBarButton[] {
+ backToolBarButton,
+ upToolBarButton,
+ newdirToolBarButton,
+ menueToolBarButton} );
+ smallButtonToolBar.ButtonSize = new Size( 21, 16 ); // 21, 16
+ smallButtonToolBar.Divider = false;
+ smallButtonToolBar.Dock = DockStyle.None;
+ smallButtonToolBar.DropDownArrows = true;
+ smallButtonToolBar.ImageList = imageListTopToolbar;
+ smallButtonToolBar.Location = new Point( 372, 8 );
+ smallButtonToolBar.ShowToolTips = true;
+ smallButtonToolBar.Size = new Size( 110, 20 );
+ smallButtonToolBar.TabIndex = 2;
+ smallButtonToolBar.TextAlign = ToolBarTextAlign.Right;
+
+ // buttonPanel
+ popupButtonPanel.Dock = DockStyle.None;
+ popupButtonPanel.Location = new Point( 7, 37 );
+ popupButtonPanel.TabIndex = 3;
+
+ // mwfFileView
+ mwfFileView.Anchor = ( (AnchorStyles)( ( ( ( AnchorStyles.Top | AnchorStyles.Bottom ) | AnchorStyles.Left ) | AnchorStyles.Right ) ) );
+ mwfFileView.Location = new Point( 99, 37 );
+ mwfFileView.Size = new Size( 449, 282 );
+ mwfFileView.Columns.Add( " Name", 170, HorizontalAlignment.Left );
+ mwfFileView.Columns.Add( "Size ", 80, HorizontalAlignment.Right );
+ mwfFileView.Columns.Add( " Type", 100, HorizontalAlignment.Left );
+ mwfFileView.Columns.Add( " Last Access", 150, HorizontalAlignment.Left );
+ mwfFileView.AllowColumnReorder = true;
+ mwfFileView.MultiSelect = false;
+ mwfFileView.TabIndex = 4;
+ mwfFileView.FilterIndex = fileDialog.FilterIndex;
+
+ // fileNameLabel
+ fileNameLabel.Anchor = ( (AnchorStyles)( ( AnchorStyles.Bottom | AnchorStyles.Left ) ) );
+ fileNameLabel.FlatStyle = FlatStyle.System;
+ fileNameLabel.Location = new Point( 102, 330 );
+ fileNameLabel.Size = new Size( 70, 21 );
+ fileNameLabel.TabIndex = 5;
+ fileNameLabel.Text = "Filename:";
+ fileNameLabel.TextAlign = ContentAlignment.MiddleLeft;
+
+ // fileNameComboBox
+ fileNameComboBox.Anchor = ( (AnchorStyles)( ( ( AnchorStyles.Bottom | AnchorStyles.Left ) | AnchorStyles.Right ) ) );
+ fileNameComboBox.Location = new Point( 195, 330 );
+ fileNameComboBox.Size = new Size( 245, 21 );
+ fileNameComboBox.TabIndex = 6;
+ fileNameComboBox.Items.Add( " " );
+
+ // fileTypeLabel
+ fileTypeLabel.Anchor = ( (AnchorStyles)( ( AnchorStyles.Bottom | AnchorStyles.Left ) ) );
+ fileTypeLabel.FlatStyle = FlatStyle.System;
+ fileTypeLabel.Location = new Point( 102, 356 );
+ fileTypeLabel.Size = new Size( 70, 21 );
+ fileTypeLabel.TabIndex = 7;
+ fileTypeLabel.Text = "Filetype:";
+ fileTypeLabel.TextAlign = ContentAlignment.MiddleLeft;
+
+ // fileTypeComboBox
+ fileTypeComboBox.Anchor = ( (AnchorStyles)( ( ( AnchorStyles.Bottom | AnchorStyles.Left ) | AnchorStyles.Right ) ) );
+ fileTypeComboBox.Location = new Point( 195, 356 );
+ fileTypeComboBox.Size = new Size( 245, 21 );
+ fileTypeComboBox.TabIndex = 8;
+
+ // backToolBarButton
+ backToolBarButton.ImageIndex = 0;
+ backToolBarButton.Enabled = false;
+ backToolBarButton.Style = ToolBarButtonStyle.ToggleButton;
+
+ // upToolBarButton
+ upToolBarButton.ImageIndex = 1;
+ upToolBarButton.Style = ToolBarButtonStyle.ToggleButton;
+
+ // newdirToolBarButton
+ newdirToolBarButton.ImageIndex = 2;
+ newdirToolBarButton.Style = ToolBarButtonStyle.ToggleButton;
+
+ // menueToolBarButton
+ menueToolBarButton.ImageIndex = 3;
+ menueToolBarButton.DropDownMenu = menueToolBarButtonContextMenu;
+ menueToolBarButton.Style = ToolBarButtonStyle.DropDownButton;
+
+ // menueToolBarButtonContextMenu
+ MenuItem mi = new MenuItem( "Small Icon", new EventHandler( OnClickMenuToolBarContextMenu ) );
+ menueToolBarButtonContextMenu.MenuItems.Add( mi );
+ mi = new MenuItem( "Tiles", new EventHandler( OnClickMenuToolBarContextMenu ) );
+ menueToolBarButtonContextMenu.MenuItems.Add( mi );
+ mi = new MenuItem( "Large Icon", new EventHandler( OnClickMenuToolBarContextMenu ) );
+ menueToolBarButtonContextMenu.MenuItems.Add( mi );
+ mi = new MenuItem( "List", new EventHandler( OnClickMenuToolBarContextMenu ) );
+ mi.Checked = true;
+ previousCheckedMenuItem = mi;
+ menueToolBarButtonContextMenu.MenuItems.Add( mi );
+ mi = new MenuItem( "Details", new EventHandler( OnClickMenuToolBarContextMenu ) );
+ menueToolBarButtonContextMenu.MenuItems.Add( mi );
+
+ // contextMenu
+ mi = new MenuItem( "Show hidden files", new EventHandler( OnClickContextMenu ) );
+ mi.Checked = fileDialog.ShowHiddenFiles;
+ mwfFileView.ShowHiddenFiles = fileDialog.ShowHiddenFiles;
+ contextMenu.MenuItems.Add( mi );
+
+ // openSaveButton
+ openSaveButton.Anchor = ( (AnchorStyles)( ( AnchorStyles.Bottom | AnchorStyles.Right ) ) );
+ openSaveButton.FlatStyle = FlatStyle.System;
+ openSaveButton.Location = new Point( 475, 330 );
+ openSaveButton.Size = new Size( 72, 21 );
+ openSaveButton.TabIndex = 9;
+ openSaveButton.Text = fileDialog.OpenSaveButtonText;
+ openSaveButton.FlatStyle = FlatStyle.System;
+
+ // cancelButton
+ cancelButton.Anchor = ( (AnchorStyles)( ( AnchorStyles.Bottom | AnchorStyles.Right ) ) );
+ cancelButton.FlatStyle = FlatStyle.System;
+ cancelButton.Location = new Point( 475, 356 );
+ cancelButton.Size = new Size( 72, 21 );
+ cancelButton.TabIndex = 10;
+ cancelButton.Text = "Cancel";
+ cancelButton.FlatStyle = FlatStyle.System;
+
+ // helpButton
+ helpButton.Anchor = ( (AnchorStyles)( ( AnchorStyles.Bottom | AnchorStyles.Right ) ) );
+ helpButton.FlatStyle = FlatStyle.System;
+ helpButton.Location = new Point( 475, 350 );
+ helpButton.Size = new Size( 72, 21 );
+ helpButton.TabIndex = 11;
+ helpButton.Text = "Help";
+ helpButton.FlatStyle = FlatStyle.System;
+
+ // checkBox
+ checkBox.Anchor = ( (AnchorStyles)( ( ( AnchorStyles.Bottom | AnchorStyles.Left ) | AnchorStyles.Right ) ) );
+ checkBox.Text = "Open Readonly";
+ checkBox.Location = new Point( 195, 350 );
+ checkBox.Size = new Size( 245, 21 );
+ checkBox.FlatStyle = FlatStyle.System;
+ checkBox.TabIndex = 12;
+
+ ClientSize = new Size( 554, 405 ); // 384
+
+ ContextMenu = contextMenu;
+
+ Dock = DockStyle.Fill;
+
+ Controls.Add( smallButtonToolBar );
+ Controls.Add( cancelButton );
+ Controls.Add( openSaveButton );
+ Controls.Add( mwfFileView );
+ Controls.Add( fileTypeLabel );
+ Controls.Add( fileNameLabel );
+ Controls.Add( fileTypeComboBox );
+ Controls.Add( fileNameComboBox );
+ Controls.Add( dirComboBox );
+ Controls.Add( searchSaveLabel );
+ Controls.Add( popupButtonPanel );
+
+ ResumeLayout( false );
+
+ currentDirectoryName = Environment.CurrentDirectory;
+
+ currentDirectoryInfo = new DirectoryInfo( currentDirectoryName );
+
+ if ( fileDialog.RestoreDirectory )
+ restoreDirectory = currentDirectoryName;
+
+ openSaveButton.Click += new EventHandler( OnClickOpenSaveButton );
+ cancelButton.Click += new EventHandler( OnClickCancelButton );
+ helpButton.Click += new EventHandler( OnClickHelpButton );
+
+ smallButtonToolBar.ButtonClick += new ToolBarButtonClickEventHandler( OnClickSmallButtonToolBar );
+
+ fileTypeComboBox.SelectedIndexChanged += new EventHandler( OnSelectedIndexChangedFileTypeComboBox );
+
+ mwfFileView.SelectedFileChanged += new EventHandler( OnSelectedFileChangedFileView );
+ mwfFileView.DirectoryChanged += new EventHandler( OnDirectoryChangedFileView );
+ mwfFileView.ForceDialogEnd += new EventHandler( OnForceDialogEndFileView );
+ mwfFileView.SelectedFilesChanged += new EventHandler( OnSelectedFilesChangedFileView );
+ mwfFileView.OnDirectoryUp += new EventHandler( OnDirectoryUp );
+
+ dirComboBox.DirectoryChanged += new EventHandler( OnDirectoryChangedDirComboBox );
+
+ checkBox.CheckedChanged += new EventHandler( OnCheckCheckChanged );
+
+ ChangeDirectory (null,currentDirectoryName);
+ }
+
+ public bool MultiSelect
+ {
+ set {
+ multiSelect = value;
+ mwfFileView.MultiSelect = value;
+ }
+
+ get {
+ return multiSelect;
+ }
+ }
+
+ public CheckBox CheckBox
+ {
+ set {
+ checkBox = value;
+ }
+
+ get {
+ return checkBox;
+ }
+ }
+
+ void OnClickContextMenu( object sender, EventArgs e )
+ {
+ MenuItem senderMenuItem = sender as MenuItem;
+
+ if ( senderMenuItem.Index == 0 )
+ {
+ senderMenuItem.Checked = !senderMenuItem.Checked;
+ fileDialog.ShowHiddenFiles = senderMenuItem.Checked;
+ mwfFileView.ShowHiddenFiles = fileDialog.ShowHiddenFiles;
+ mwfFileView.UpdateFileView( currentDirectoryInfo_or_current_special_case );
+ }
+ }
+
+ void OnClickOpenSaveButton( object sender, EventArgs e )
+ {
+ if ( !multiSelect )
+ {
+ if ( !show_special_case )
+ {
+ string fileFromComboBox = fileNameComboBox.Text.Trim( );
+
+ if ( fileFromComboBox.Length > 0 )
+ {
+ if (!Path.IsPathRooted (fileFromComboBox))
+ fileFromComboBox = Path.Combine( currentDirectoryName, fileFromComboBox );
+
+ FileInfo fileInfo = new FileInfo (fileFromComboBox);
+ if (fileInfo.Exists)
+ currentFileName = fileFromComboBox;
+ else
+ {
+ DirectoryInfo dirInfo = new DirectoryInfo ( fileFromComboBox );
+ if (dirInfo.Exists)
+ {
+ ChangeDirectory( null, dirInfo.FullName );
+
+ currentFileName = "";
+
+ fileNameComboBox.Text = " ";
+ return;
+ }
+ }
+ }
+ else
+ return;
+ }
+ else
+ {
+ if ( currentFileName == null || currentFileName == String.Empty )
+ {
+ currentFileName = fileNameComboBox.Text.Trim( );
+
+ if ( currentFileName.Length > 0 )
+ {
+ FileInfo fileInfo = new FileInfo (currentFileName);
+ if (!fileInfo.Exists)
+ {
+ DirectoryInfo dirInfo = new DirectoryInfo ( currentFileName );
+ if (dirInfo.Exists)
+ {
+ ChangeDirectory( null, dirInfo.FullName );
+
+ currentFileName = "";
+
+ fileNameComboBox.Text = " ";
+ return;
+ }
+ }
+ }
+ else
+ return;
+ }
+
+ if ( currentDirectoryName == String.Empty )
+ currentDirectoryName = Path.GetDirectoryName( currentFileName );
+ }
+
+ if ( fileDialog.fileDialogType == FileDialogType.OpenFileDialog )
+ {
+ if ( fileDialog.CheckFileExists )
+ {
+ if ( !File.Exists( currentFileName ) )
+ {
+ string message = "\"" + currentFileName + "\" doesn't exist. Please verify that you have entered the correct file name.";
+ MessageBox.Show( message, fileDialog.OpenSaveButtonText, MessageBoxButtons.OK, MessageBoxIcon.Warning );
+
+ currentFileName = "";
+
+ return;
+ }
+ }
+ }
+ else // FileDialogType == SaveFileDialog
+ {
+ if ( fileDialog.OverwritePrompt )
+ {
+ if ( File.Exists( currentFileName ) )
+ {
+ string message = "\"" + currentFileName + "\" exists. Overwrite ?";
+ DialogResult dr = MessageBox.Show( message, fileDialog.OpenSaveButtonText, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning );
+
+ if ( dr == DialogResult.Cancel )
+ {
+ currentFileName = "";
+
+ return;
+ }
+ }
+ }
+
+ if ( fileDialog.CreatePrompt )
+ {
+ if ( !File.Exists( currentFileName ) )
+ {
+ string message = "\"" + currentFileName + "\" doesn't exist. Create ?";
+ DialogResult dr = MessageBox.Show( message, fileDialog.OpenSaveButtonText, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning );
+
+ if ( dr == DialogResult.Cancel )
+ {
+ currentFileName = "";
+
+ return;
+ }
+ }
+ }
+ }
+
+ if ( fileDialog.fileDialogType == FileDialogType.SaveFileDialog )
+ {
+ if ( fileDialog.AddExtension && fileDialog.DefaultExt.Length > 0 )
+ {
+ if ( !currentFileName.EndsWith( fileDialog.DefaultExt ) )
+ {
+ currentFileName += "." + fileDialog.DefaultExt;
+ }
+ }
+ }
+
+ fileDialog.FileName = currentFileName;
+
+ WriteRecentlyUsed();
+ }
+ else // multiSelect = true
+ if ( fileDialog.fileDialogType != FileDialogType.SaveFileDialog )
+ {
+ if ( mwfFileView.SelectedItems.Count > 0 )
+ {
+ // first remove all selected directories
+ ArrayList al = new ArrayList( );
+
+ foreach ( ListViewItem lvi in mwfFileView.SelectedItems )
+ {
+ FileStruct fileStruct = (FileStruct)mwfFileView.FileHashtable[ lvi.Text ];
+
+ if ( fileStruct.attributes != FileAttributes.Directory )
+ {
+ al.Add( fileStruct );
+ }
+ }
+
+ fileDialog.FileName = ( (FileStruct)al[ 0 ] ).fullname;
+
+ string[] filenames = new string[ al.Count ];
+
+ for ( int i = 0; i < al.Count; i++ )
+ {
+ filenames[ i ] = ( (FileStruct)al[ i ] ).fullname;
+ }
+
+ fileDialog.SetFilenames( filenames );
+ }
+ }
+
+ if ( fileDialog.CheckPathExists )
+ {
+ if ( !Directory.Exists( currentDirectoryName ) )
+ {
+ string message = "\"" + currentDirectoryName + "\" doesn't exist. Please verify that you have entered the correct directory name.";
+ MessageBox.Show( message, fileDialog.OpenSaveButtonText, MessageBoxButtons.OK, MessageBoxIcon.Warning );
+
+ if ( fileDialog.InitialDirectory == String.Empty )
+ currentDirectoryName = Environment.CurrentDirectory;
+ else
+ currentDirectoryName = fileDialog.InitialDirectory;
+
+ return;
+ }
+ }
+
+ if ( fileDialog.RestoreDirectory )
+ currentDirectoryName = restoreDirectory;
+
+ CancelEventArgs cancelEventArgs = new CancelEventArgs( );
+
+ cancelEventArgs.Cancel = false;
+
+ fileDialog.OnFileOk( cancelEventArgs );
+
+ fileDialog.form.Controls.Remove( this );
+ fileDialog.form.DialogResult = DialogResult.OK;
+ }
+
+ void OnClickCancelButton( object sender, EventArgs e )
+ {
+ if ( fileDialog.RestoreDirectory )
+ currentDirectoryName = restoreDirectory;
+
+ CancelEventArgs cancelEventArgs = new CancelEventArgs( );
+
+ cancelEventArgs.Cancel = true;
+
+ fileDialog.OnFileOk( cancelEventArgs );
+
+ fileDialog.form.Controls.Remove( this );
+ fileDialog.form.DialogResult = DialogResult.Cancel;
+ }
+
+ void OnClickHelpButton( object sender, EventArgs e )
+ {
+ fileDialog.SendHelpRequest( e );
+ }
+
+ void OnClickSmallButtonToolBar( object sender, ToolBarButtonClickEventArgs e )
+ {
+ if ( e.Button == upToolBarButton )
+ {
+ if ( currentDirectoryInfo != null && currentDirectoryInfo.Parent != null )
+ ChangeDirectory( null, currentDirectoryInfo.Parent.FullName );
+ }
+ else
+ if ( e.Button == backToolBarButton )
+ {
+ PopDirectory( );
+ }
+ else
+ if ( e.Button == newdirToolBarButton )
+ {
+
+ }
+ }
+
+ void OnClickMenuToolBarContextMenu( object sender, EventArgs e )
+ {
+ MenuItem senderMenuItem = (MenuItem)sender;
+
+ previousCheckedMenuItem.Checked = false;
+ senderMenuItem.Checked = true;
+ previousCheckedMenuItem = senderMenuItem;
+
+ // FIXME...
+
+ switch ( senderMenuItem.Index )
+ {
+ case 0:
+ mwfFileView.View = View.SmallIcon;
+ break;
+ case 1:
+ mwfFileView.View = View.LargeIcon;
+ break;
+ case 2:
+ mwfFileView.View = View.LargeIcon;
+ break;
+ case 3:
+ mwfFileView.View = View.List;
+ break;
+ case 4:
+ mwfFileView.View = View.Details;
+ break;
+ default:
+ break;
+ }
+
+
+ mwfFileView.UpdateFileView( currentDirectoryInfo_or_current_special_case );
+ }
+
+ void OnSelectedIndexChangedFileTypeComboBox( object sender, EventArgs e )
+ {
+ fileDialog.FilterIndex = fileTypeComboBox.SelectedIndex + 1;
+
+ mwfFileView.FilterIndex = fileDialog.FilterIndex;
+
+ mwfFileView.UpdateFileView( currentDirectoryInfo_or_current_special_case );
+ }
+
+ void OnSelectedFileChangedFileView( object sender, EventArgs e )
+ {
+ fileNameComboBox.Text = mwfFileView.FileName;
+ currentFileName = mwfFileView.FullFileName;
+ }
+
+ void OnDirectoryChangedFileView( object sender, EventArgs e )
+ {
+ ChangeDirectory( sender, mwfFileView.FullFileName );
+ }
+
+ void OnForceDialogEndFileView( object sender, EventArgs e )
+ {
+ ForceDialogEnd( );
+ }
+
+ void OnSelectedFilesChangedFileView( object sender, EventArgs e )
+ {
+ fileNameComboBox.Text = mwfFileView.SelectedFilesString;
+ }
+
+ void OnDirectoryChangedDirComboBox( object sender, EventArgs e )
+ {
+ ChangeDirectory( sender, dirComboBox.CurrentPath );
+ }
+
+ void OnCheckCheckChanged( object sender, EventArgs e )
+ {
+ fileDialog.ReadOnlyChecked = checkBox.Checked;
+ }
+
+ void OnDirectoryUp (Object sender, EventArgs e)
+ {
+ if (currentDirectoryInfo != null && currentDirectoryInfo.Parent != null)
+ ChangeDirectory (null, currentDirectoryInfo.Parent.FullName);
+ }
+
+ public void UpdateFilters( )
+ {
+ ArrayList filters = fileDialog.FileFilter.FilterArrayList;
+
+ fileTypeComboBox.Items.Clear( );
+
+ fileTypeComboBox.BeginUpdate( );
+
+ foreach ( FilterStruct fs in filters )
+ {
+ fileTypeComboBox.Items.Add( fs.filterName );
+ }
+
+ fileTypeComboBox.SelectedIndex = fileDialog.FilterIndex - 1;
+
+ fileTypeComboBox.EndUpdate( );
+
+ mwfFileView.FilterArrayList = filters;
+
+ mwfFileView.FilterIndex = fileDialog.FilterIndex;
+
+ mwfFileView.UpdateFileView( currentDirectoryInfo_or_current_special_case );
+ }
+
+ public void ChangeDirectory( object sender, string path_or_special_case )
+ {
+ show_special_case = false;
+
+ if ( sender != dirComboBox )
+ dirComboBox.CurrentPath = path_or_special_case;
+
+ if ( sender != popupButtonPanel )
+ popupButtonPanel.SetPopupButtonStateByPath( path_or_special_case );
+
+ if ( currentDirectoryInfo != null )
+ PushDirectory( currentDirectoryInfo );
+ else
+ PushDirectory( current_special_case );
+
+ if ( path_or_special_case == recently_string )
+ {
+ currentDirectoryName = String.Empty;
+
+ currentDirectoryInfo = null;
+ show_special_case = true;
+
+ current_special_case = recently_string;
+
+ mwfFileView.UpdateFileView( recently_string );
+ }
+ else
+ {
+ currentDirectoryName = path_or_special_case;
+
+ currentDirectoryInfo = new DirectoryInfo( path_or_special_case );
+
+ mwfFileView.UpdateFileView( currentDirectoryInfo );
+ }
+ }
+
+ public void ForceDialogEnd( )
+ {
+ OnClickOpenSaveButton( this, EventArgs.Empty );
+ }
+
+ private void PushDirectory( object directoryInfo_or_string )
+ {
+ directoryStack.Push( directoryInfo_or_string );
+ backToolBarButton.Enabled = true;
+ }
+
+ private void PopDirectory( )
+ {
+ if ( directoryStack.Count == 0 )
+ return;
+
+ show_special_case = false;
+
+ object directoryInfo_or_string = directoryStack.Pop( );
+
+ if ( directoryInfo_or_string is DirectoryInfo )
+ {
+ currentDirectoryInfo = directoryInfo_or_string as DirectoryInfo;
+
+ currentDirectoryName = currentDirectoryInfo.FullName;
+
+ current_special_case = String.Empty;
+ }
+ else
+ if ( directoryInfo_or_string is string )
+ {
+ currentDirectoryInfo = null;
+ currentDirectoryName = String.Empty;
+ show_special_case = true;
+ current_special_case = directoryInfo_or_string as string;
+ }
+
+ if ( directoryStack.Count == 0 )
+ backToolBarButton.Enabled = false;
+
+ dirComboBox.CurrentPath = currentDirectoryName_or_special_case;
+
+ popupButtonPanel.SetPopupButtonStateByPath( currentDirectoryName_or_special_case );
+
+ mwfFileView.UpdateFileView( currentDirectoryInfo_or_current_special_case );
+ }
+
+ public void ResizeAndRelocateForHelpOrReadOnly( )
+ {
+ if ( fileDialog.ShowHelp || fileDialog.ShowReadOnly )
+ {
+ mwfFileView.Size = new Size( 449, 250 );
+ fileNameLabel.Location = new Point( 102, 298 );
+ fileNameComboBox.Location = new Point( 195, 298 );
+ fileTypeLabel.Location = new Point( 102, 324 );
+ fileTypeComboBox.Location = new Point( 195, 324 );
+ openSaveButton.Location = new Point( 475, 298 );
+ cancelButton.Location = new Point( 475, 324 );
+ }
+ else
+ {
+ mwfFileView.Size = new Size( 449, 282 );
+ fileNameLabel.Location = new Point( 102, 330 );
+ fileNameComboBox.Location = new Point( 195, 330 );
+ fileTypeLabel.Location = new Point( 102, 356 );
+ fileTypeComboBox.Location = new Point( 195, 356 );
+ openSaveButton.Location = new Point( 475, 330 );
+ cancelButton.Location = new Point( 475, 356 );
+ }
+
+ if ( fileDialog.ShowHelp )
+ Controls.Add( helpButton );
+ else
+ Controls.Remove( helpButton );
+
+ if ( fileDialog.ShowReadOnly )
+ Controls.Add( checkBox );
+ else
+ Controls.Remove( checkBox );
+ }
+
+ private void WriteRecentlyUsed( )
+ {
+ int platform = (int) Environment.OSVersion.Platform;
+
+ // on a *nix platform we use "$HOME/.recently-used" to store our recently used files (GNOME, libegg like)
+ if ((platform == 4) || (platform == 128))
+ {
+ string personal_folder = ThemeEngine.Current.Places(UIIcon.PlacesPersonal);
+ string recently_used_path = Path.Combine( personal_folder, ".recently-used" );
+
+ if ( File.Exists( recently_used_path ) )
+ {
+ XmlDocument xml_doc = new XmlDocument( );
+ xml_doc.Load( recently_used_path );
+
+ XmlNode grand_parent_node = xml_doc.SelectSingleNode( "RecentFiles" );
+
+ if ( grand_parent_node != null )
+ {
+ // create a new element
+ XmlElement new_recent_item_node = xml_doc.CreateElement( "RecentItem" );
+
+ XmlElement new_child = xml_doc.CreateElement( "URI" );
+ UriBuilder ub = new UriBuilder( );
+ ub.Path = currentFileName;
+ ub.Host = null;
+ ub.Scheme = "file";
+ XmlText new_text_child = xml_doc.CreateTextNode( ub.ToString() );
+ new_child.AppendChild( new_text_child );
+
+ new_recent_item_node.AppendChild( new_child );
+
+ new_child = xml_doc.CreateElement( "Mime-Type" );
+ new_text_child = xml_doc.CreateTextNode( Mime.GetMimeTypeForFile( currentFileName ) );
+ new_child.AppendChild( new_text_child );
+
+ new_recent_item_node.AppendChild( new_child );
+
+ new_child = xml_doc.CreateElement( "Timestamp" );
+ long seconds = (long)( DateTime.UtcNow - new DateTime( 1970, 1, 1 ) ).TotalSeconds;
+ new_text_child = xml_doc.CreateTextNode( seconds.ToString( ) );
+ new_child.AppendChild( new_text_child );
+
+ new_recent_item_node.AppendChild( new_child );
+
+ new_child = xml_doc.CreateElement( "Groups" );
+
+ new_recent_item_node.AppendChild( new_child );
+
+ // now search the nodes in grand_parent_node for another instance of the new uri and if found remove it
+ // so that the new node is the first one
+ foreach ( XmlNode n in grand_parent_node.ChildNodes )
+ {
+ XmlNode uri_node = n.SelectSingleNode( "URI" );
+ if ( uri_node != null )
+ {
+ XmlNode uri_node_child = uri_node.FirstChild;
+ if ( uri_node_child is XmlText )
+ if ( ub.ToString() == ((XmlText)uri_node_child).Data )
+ {
+ grand_parent_node.RemoveChild( n );
+ break;
+ }
+ }
+ }
+
+ // prepend the new recent item to the grand parent node list
+ grand_parent_node.PrependChild( new_recent_item_node );
+
+ // limit the # of RecentItems to 10
+ if ( grand_parent_node.ChildNodes.Count > 10 )
+ {
+ while( grand_parent_node.ChildNodes.Count > 10 )
+ grand_parent_node.RemoveChild( grand_parent_node.LastChild );
+ }
+
+ try {
+ xml_doc.Save( recently_used_path );
+ } catch ( Exception e ) {
+ }
+ }
+ }
+ else // create a new .recently-used file
+ {
+ XmlDocument xml_doc = new XmlDocument();
+ xml_doc.AppendChild( xml_doc.CreateXmlDeclaration( "1.0", "", "" ) );
+
+ XmlElement recentFiles_element = xml_doc.CreateElement( "RecentFiles" );
+
+ XmlElement new_recent_item_node = xml_doc.CreateElement( "RecentItem" );
+
+ XmlElement new_child = xml_doc.CreateElement( "URI" );
+ UriBuilder ub = new UriBuilder( );
+ ub.Path = currentFileName;
+ ub.Host = null;
+ ub.Scheme = "file";
+ XmlText new_text_child = xml_doc.CreateTextNode( ub.ToString() );
+ new_child.AppendChild( new_text_child );
+
+ new_recent_item_node.AppendChild( new_child );
+
+ new_child = xml_doc.CreateElement( "Mime-Type" );
+ new_text_child = xml_doc.CreateTextNode( Mime.GetMimeTypeForFile( currentFileName ) );
+ new_child.AppendChild( new_text_child );
+
+ new_recent_item_node.AppendChild( new_child );
+
+ new_child = xml_doc.CreateElement( "Timestamp" );
+ long seconds = (long)( DateTime.UtcNow - new DateTime( 1970, 1, 1 ) ).TotalSeconds;
+ new_text_child = xml_doc.CreateTextNode( seconds.ToString( ) );
+ new_child.AppendChild( new_text_child );
+
+ new_recent_item_node.AppendChild( new_child );
+
+ new_child = xml_doc.CreateElement( "Groups" );
+
+ new_recent_item_node.AppendChild( new_child );
+
+ recentFiles_element.AppendChild( new_recent_item_node );
+
+ xml_doc.AppendChild( recentFiles_element );
+
+ try {
+ xml_doc.Save( recently_used_path );
+ } catch ( Exception e ) {
+ }
+ }
+ }
+ }
+
+ private object currentDirectoryInfo_or_current_special_case
+ {
+ get {
+ if ( currentDirectoryInfo != null )
+ return currentDirectoryInfo;
+ else
+ return current_special_case;
+ }
+ }
+
+ private string currentDirectoryName_or_special_case
+ {
+ get {
+ if ( currentDirectoryName != String.Empty )
+ return currentDirectoryName;
+ else
+ return current_special_case;
+ }
+ }
+
+ internal class PopupButtonPanel : Panel
+ {
+ internal class PopupButton : Control
+ {
+ internal enum PopupButtonState
+ { Normal, Down, Up}
+
+ private Image image = null;
+ private PopupButtonState popupButtonState = PopupButtonState.Normal;
+ private StringFormat text_format = new StringFormat();
+
+ public PopupButton( )
+ {
+ text_format.Alignment = StringAlignment.Center;
+ text_format.LineAlignment = StringAlignment.Far;
+
+ SetStyle( ControlStyles.DoubleBuffer, true );
+ SetStyle( ControlStyles.AllPaintingInWmPaint, true );
+ SetStyle( ControlStyles.UserPaint, true );
+ }
+
+ public Image Image
+ {
+ set {
+ image = value;
+ Refresh( );
+ }
+
+ get {
+ return image;
+ }
+ }
+
+ public PopupButtonState ButtonState
+ {
+ set {
+ popupButtonState = value;
+ Refresh( );
+ }
+
+ get {
+ return popupButtonState;
+ }
+ }
+
+ protected override void OnPaint( PaintEventArgs pe )
+ {
+ Draw( pe );
+
+ base.OnPaint( pe );
+ }
+
+ private void Draw( PaintEventArgs pe )
+ {
+ Graphics gr = pe.Graphics;
+
+ gr.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush( BackColor ), ClientRectangle );
+
+ // draw image
+ if ( image != null )
+ {
+ int i_x = ( ClientSize.Width - image.Width ) / 2;
+ int i_y = 4;
+ gr.DrawImage( image, i_x, i_y );
+ }
+
+ if ( Text != String.Empty )
+ {
+ Rectangle text_rect = Rectangle.Inflate( ClientRectangle, -4, -4 );
+
+ gr.DrawString( Text, Font, ThemeEngine.Current.ResPool.GetSolidBrush( ForeColor ), text_rect, text_format );
+ }
+
+ switch ( popupButtonState )
+ {
+ case PopupButtonState.Up:
+ gr.DrawLine( ThemeEngine.Current.ResPool.GetPen( Color.White ), 0, 0, ClientSize.Width - 1, 0 );
+ gr.DrawLine( ThemeEngine.Current.ResPool.GetPen( Color.White ), 0, 0, 0, ClientSize.Height - 1 );
+ gr.DrawLine( ThemeEngine.Current.ResPool.GetPen( Color.Black ), ClientSize.Width - 1, 0, ClientSize.Width - 1, ClientSize.Height - 1 );
+ gr.DrawLine( ThemeEngine.Current.ResPool.GetPen( Color.Black ), 0, ClientSize.Height - 1, ClientSize.Width - 1, ClientSize.Height - 1 );
+ break;
+
+ case PopupButtonState.Down:
+ gr.DrawLine( ThemeEngine.Current.ResPool.GetPen( Color.Black ), 0, 0, ClientSize.Width - 1, 0 );
+ gr.DrawLine( ThemeEngine.Current.ResPool.GetPen( Color.Black ), 0, 0, 0, ClientSize.Height - 1 );
+ gr.DrawLine( ThemeEngine.Current.ResPool.GetPen( Color.White ), ClientSize.Width - 1, 0, ClientSize.Width - 1, ClientSize.Height - 1 );
+ gr.DrawLine( ThemeEngine.Current.ResPool.GetPen( Color.White ), 0, ClientSize.Height - 1, ClientSize.Width - 1, ClientSize.Height - 1 );
+ break;
+ }
+ }
+
+ protected override void OnMouseEnter( EventArgs e )
+ {
+ if ( popupButtonState != PopupButtonState.Down )
+ popupButtonState = PopupButtonState.Up;
+ Refresh( );
+ base.OnMouseEnter( e );
+ }
+
+ protected override void OnMouseLeave( EventArgs e )
+ {
+ if ( popupButtonState != PopupButtonState.Down )
+ popupButtonState = PopupButtonState.Normal;
+ Refresh( );
+ base.OnMouseLeave( e );
+ }
+
+ protected override void OnClick( EventArgs e )
+ {
+ popupButtonState = PopupButtonState.Down;
+ Refresh( );
+ base.OnClick( e );
+ }
+ }
+
+ private FileDialogPanel fileDialogPanel;
+
+ private PopupButton lastOpenButton;
+ private PopupButton desktopButton;
+ private PopupButton homeButton;
+ private PopupButton workplaceButton;
+ private PopupButton networkButton;
+
+ private PopupButton lastPopupButton = null;
+
+ private int platform = (int) Environment.OSVersion.Platform;
+
+ public PopupButtonPanel( FileDialogPanel fileDialogPanel )
+ {
+ this.fileDialogPanel = fileDialogPanel;
+
+ BorderStyle = BorderStyle.Fixed3D;
+ BackColor = Color.FromArgb( 128, 128, 128 );
+ Size = new Size( 85, 336 );
+
+ lastOpenButton = new PopupButton( );
+ desktopButton = new PopupButton( );
+ homeButton = new PopupButton( );
+ workplaceButton = new PopupButton( );
+ networkButton = new PopupButton( );
+
+ lastOpenButton.Size = new Size( 82, 64 );
+ lastOpenButton.Image = ThemeEngine.Current.Images(UIIcon.PlacesRecentDocuments, 38);
+ lastOpenButton.BackColor = BackColor;
+ lastOpenButton.ForeColor = Color.White;
+ lastOpenButton.Location = new Point( 2, 2 );
+ lastOpenButton.Text = "Last Open";
+ lastOpenButton.Click += new EventHandler( OnClickButton );
+
+ desktopButton.Image = ThemeEngine.Current.Images(UIIcon.PlacesDesktop, 38);
+ desktopButton.BackColor = BackColor;
+ desktopButton.ForeColor = Color.White;
+ desktopButton.Size = new Size( 82, 64 );
+ desktopButton.Location = new Point( 2, 66 );
+ desktopButton.Text = "Desktop";
+ desktopButton.Click += new EventHandler( OnClickButton );
+
+ homeButton.Image = ThemeEngine.Current.Images(UIIcon.PlacesPersonal, 38);
+ homeButton.BackColor = BackColor;
+ homeButton.ForeColor = Color.White;
+ homeButton.Size = new Size( 82, 64 );
+ homeButton.Location = new Point( 2, 130 );
+ homeButton.Text = "Home";
+ homeButton.Click += new EventHandler( OnClickButton );
+
+ workplaceButton.Image = ThemeEngine.Current.Images(UIIcon.PlacesMyComputer, 38);
+ workplaceButton.BackColor = BackColor;
+ workplaceButton.ForeColor = Color.White;
+ workplaceButton.Size = new Size( 82, 64 );
+ workplaceButton.Location = new Point( 2, 194 );
+ workplaceButton.Text = "Workplace";
+ workplaceButton.Click += new EventHandler( OnClickButton );
+
+ networkButton.Image = ThemeEngine.Current.Images(UIIcon.PlacesMyNetwork, 38);
+ networkButton.BackColor = BackColor;
+ networkButton.ForeColor = Color.White;
+ networkButton.Size = new Size( 82, 64 );
+ networkButton.Location = new Point( 2, 258 );
+ networkButton.Text = "Network";
+ networkButton.Click += new EventHandler( OnClickButton );
+
+ Controls.Add( lastOpenButton );
+ Controls.Add( desktopButton );
+ Controls.Add( homeButton );
+ Controls.Add( workplaceButton );
+ Controls.Add( networkButton );
+ }
+
+ void OnClickButton( object sender, EventArgs e )
+ {
+ if ( lastPopupButton != null && (PopupButton)sender != lastPopupButton )
+ lastPopupButton.ButtonState = PopupButton.PopupButtonState.Normal;
+ lastPopupButton = sender as PopupButton;
+
+ if ( sender == lastOpenButton )
+ {
+ if ((platform == 4) || (platform == 128))
+ // do NOT change the following line!
+ // FileDialog uses a special handling for recently used files on *nix
+ // recently used files are not stored as links in a directory but
+ // as a xml file called .recently-used in the users home dir
+ // This matches the Freedesktop.org spec which gnome uses
+ fileDialogPanel.ChangeDirectory( this, FileDialog.FileDialogPanel.recently_string );
+ else
+ fileDialogPanel.ChangeDirectory(this, ThemeEngine.Current.Places(UIIcon.PlacesRecentDocuments));
+ }
+ else
+ if ( sender == desktopButton )
+ {
+ fileDialogPanel.ChangeDirectory(this, ThemeEngine.Current.Places(UIIcon.PlacesDesktop));
+ }
+ else
+ if ( sender == homeButton )
+ {
+ fileDialogPanel.ChangeDirectory(this, ThemeEngine.Current.Places(UIIcon.PlacesPersonal));
+ }
+ else
+ if ( sender == workplaceButton )
+ {
+ if ((platform == 4) || (platform == 128))
+ // do NOT change the following line!
+ // on *nix we do not have a special folder MyComputer
+ // so we use the root dir
+ // FIXME: the output should be the same as in gnome's Places->Computer
+ fileDialogPanel.ChangeDirectory(this, "/" );
+ else
+ fileDialogPanel.ChangeDirectory(this, ThemeEngine.Current.Places(UIIcon.PlacesMyComputer));
+ }
+ else
+ if ( sender == networkButton )
+ {
+ // FIXME: only available on win, see Theme.cs, MonoTodo
+ fileDialogPanel.ChangeDirectory(this, ThemeEngine.Current.Places(UIIcon.PlacesMyNetwork));
+ }
+ }
+
+ public void SetPopupButtonStateByPath( string path )
+ {
+ if ( path == FileDialog.FileDialogPanel.recently_string ||
+ path == ThemeEngine.Current.Places(UIIcon.PlacesRecentDocuments) )
+ {
+ if ( lastPopupButton != lastOpenButton )
+ {
+ if ( lastPopupButton != null )
+ lastPopupButton.ButtonState = PopupButton.PopupButtonState.Normal;
+ lastOpenButton.ButtonState = PopupButton.PopupButtonState.Down;
+ lastPopupButton = lastOpenButton;
+ }
+ }
+ else
+ if ( path == ThemeEngine.Current.Places(UIIcon.PlacesDesktop) )
+ {
+ if ( lastPopupButton != desktopButton )
+ {
+ if ( lastPopupButton != null )
+ lastPopupButton.ButtonState = PopupButton.PopupButtonState.Normal;
+ desktopButton.ButtonState = PopupButton.PopupButtonState.Down;
+ lastPopupButton = desktopButton;
+ }
+ }
+ else
+ if ( path == ThemeEngine.Current.Places(UIIcon.PlacesPersonal) )
+ {
+ if ( lastPopupButton != homeButton )
+ {
+ if ( lastPopupButton != null )
+ lastPopupButton.ButtonState = PopupButton.PopupButtonState.Normal;
+ homeButton.ButtonState = PopupButton.PopupButtonState.Down;
+ lastPopupButton = homeButton;
+ }
+ }
+ else
+ if ( path == "/" ||
+ path == ThemeEngine.Current.Places(UIIcon.PlacesMyComputer) )
+ {
+ if ( lastPopupButton != workplaceButton )
+ {
+ if ( lastPopupButton != null )
+ lastPopupButton.ButtonState = PopupButton.PopupButtonState.Normal;
+ workplaceButton.ButtonState = PopupButton.PopupButtonState.Down;
+ lastPopupButton = workplaceButton;
+ }
+ }
+ // TODO: add networkPopupButton
+ else
+ {
+ if ( lastPopupButton != null )
+ {
+ lastPopupButton.ButtonState = PopupButton.PopupButtonState.Normal;
+ lastPopupButton = null;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ internal struct FilterStruct
+ {
+ public string filterName;
+ public StringCollection filters;
+
+ public FilterStruct( string filterName, string filter )
+ {
+ this.filterName = filterName;
+
+ filters = new StringCollection( );
+
+ SplitFilters( filter );
+ }
+
+ private void SplitFilters( string filter )
+ {
+ string[] split = filter.Split( new Char[] {';'} );
+
+ filters.AddRange( split );
+ }
+ }
+
+ internal struct FileStruct
+ {
+ public FileStruct( string fullname, FileAttributes attributes, long size )
+ {
+ this.fullname = fullname;
+ this.attributes = attributes;
+ this.size = size;
+ }
+
+ public string fullname;
+ public FileAttributes attributes;
+ public long size;
+ }
+
+ // MWFFileView
+ internal class MWFFileView : ListView
+ {
+ private ArrayList filterArrayList;
+
+ // store the FileStruct of all files in the current directory
+ private Hashtable fileHashtable = new Hashtable();
+
+ private bool showHiddenFiles = false;
+
+ private EventHandler on_selected_file_changed;
+ private EventHandler on_selected_files_changed;
+ private EventHandler on_directory_changed;
+ private EventHandler on_force_dialog_end;
+ private EventHandler on_one_directory_up;
+
+ private string fileName;
+ private string fullFileName;
+ private string selectedFilesString;
+
+ private int filterIndex;
+
+ private ToolTip toolTip;
+ private int oldItemIndexForToolTip = -1;
+
+ public MWFFileView( )
+ {
+ toolTip = new ToolTip ();
+ toolTip.InitialDelay = 300;
+ toolTip.ReshowDelay = 0;
+
+ LabelWrap = true;
+
+ SmallImageList = MimeIconEngine.SmallIcons;
+ LargeImageList = MimeIconEngine.LargeIcons;
+
+ View = View.List;
+
+ KeyUp += new KeyEventHandler (MWF_KeyUp);
+ }
+
+ public ArrayList FilterArrayList
+ {
+ set {
+ filterArrayList = value;
+ }
+
+ get {
+ return filterArrayList;
+ }
+ }
+
+ public Hashtable FileHashtable
+ {
+ set {
+ fileHashtable = value;
+ }
+
+ get {
+ return fileHashtable;
+ }
+ }
+
+ public bool ShowHiddenFiles
+ {
+ set {
+ showHiddenFiles = value;
+ }
+
+ get {
+ return showHiddenFiles;
+ }
+ }
+
+ public string FileName
+ {
+ set {
+ fileName = value;
+ }
+
+ get {
+ return fileName;
+ }
+ }
+
+ public string FullFileName
+ {
+ set {
+ fullFileName = value;
+ }
+
+ get {
+ return fullFileName;
+ }
+ }
+
+ public int FilterIndex
+ {
+ set {
+ filterIndex = value;
+ }
+
+ get {
+ return filterIndex;
+ }
+ }
+
+ public string SelectedFilesString
+ {
+ set {
+ selectedFilesString = value;
+ }
+
+ get {
+ return selectedFilesString;
+ }
+ }
+
+ private ArrayList GetFileInfoArrayList( DirectoryInfo directoryInfo )
+ {
+ ArrayList arrayList = new ArrayList( );
+
+ if ( filterArrayList != null && filterArrayList.Count != 0 )
+ {
+ FilterStruct fs = (FilterStruct)filterArrayList[ filterIndex - 1 ];
+
+ foreach ( string s in fs.filters )
+ arrayList.AddRange( directoryInfo.GetFiles( s ) );
+ }
+ else
+ arrayList.AddRange( directoryInfo.GetFiles( ) );
+
+ return arrayList;
+ }
+
+ private ArrayList GetFileInfoArrayListByArrayList( ArrayList al )
+ {
+ ArrayList arrayList = new ArrayList( );
+
+ foreach ( string path in al )
+ {
+ if ( File.Exists( path ) )
+ {
+ FileInfo fi = new FileInfo( path );
+ arrayList.Add( fi );
+ }
+ }
+
+ return arrayList;
+ }
+
+ public void UpdateFileView( object directoryInfo_or_string )
+ {
+ if ( directoryInfo_or_string is DirectoryInfo )
+ UpdateFileViewByDirectoryInfo( directoryInfo_or_string as DirectoryInfo);
+ else
+ UpdateFileViewByString( directoryInfo_or_string as string );
+
+ if (Items.Count > 0) {
+ ListViewItem item = Items [0];
+ item.Selected = true;
+ }
+ }
+
+ private void UpdateFileViewByDirectoryInfo( DirectoryInfo inputDirectoryInfo )
+ {
+ DirectoryInfo directoryInfo = inputDirectoryInfo;
+
+ DirectoryInfo[] directoryInfoArray = directoryInfo.GetDirectories( );
+
+ ArrayList fileInfoArrayList = GetFileInfoArrayList( directoryInfo );
+
+ fileHashtable.Clear( );
+
+ BeginUpdate( );
+
+ Items.Clear( );
+ SelectedItems.Clear( );
+
+ foreach ( DirectoryInfo directoryInfoi in directoryInfoArray ) {
+ if ( !ShowHiddenFiles )
+ if ( directoryInfoi.Name.StartsWith( "." ) || directoryInfoi.Attributes == FileAttributes.Hidden )
+ continue;
+
+ FileStruct fileStruct = new FileStruct( );
+
+ fileStruct.fullname = directoryInfoi.FullName;
+
+ ListViewItem listViewItem = new ListViewItem( directoryInfoi.Name );
+
+ int index = MimeIconEngine.GetIconIndexForMimeType( "inode/directory" );
+
+ listViewItem.ImageIndex = index;
+
+ listViewItem.SubItems.Add( "" );
+ listViewItem.SubItems.Add( "Directory" );
+ listViewItem.SubItems.Add( directoryInfoi.LastAccessTime.ToShortDateString( ) + " " + directoryInfoi.LastAccessTime.ToShortTimeString( ) );
+
+ fileStruct.attributes = FileAttributes.Directory;
+
+ fileHashtable.Add( directoryInfoi.Name, fileStruct );
+
+ Items.Add( listViewItem );
+ }
+
+ foreach ( FileInfo fileInfo in fileInfoArrayList ) {
+ DoOneFileInfo( fileInfo );
+ }
+
+ EndUpdate( );
+ }
+
+ private void UpdateFileViewByString( string kind )
+ {
+ if ( kind == FileDialog.FileDialogPanel.recently_string )
+ {
+ ArrayList fileInfoArrayList = GetFileInfoArrayListByArrayList( GetFreedesktopSpecRecentlyUsed() );
+
+ fileHashtable.Clear( );
+
+ BeginUpdate( );
+
+ Items.Clear( );
+ SelectedItems.Clear( );
+
+ foreach ( FileInfo fileInfo in fileInfoArrayList )
+ {
+ DoOneFileInfo(fileInfo);
+ }
+
+ EndUpdate( );
+ }
+ }
+
+ private void DoOneFileInfo( FileInfo fileInfo )
+ {
+ if ( !ShowHiddenFiles )
+ if ( fileInfo.Name.StartsWith( "." ) || fileInfo.Attributes == FileAttributes.Hidden )
+ return;
+
+ FileStruct fileStruct = new FileStruct( );
+
+ fileStruct.fullname = fileInfo.FullName;
+
+ string fileName = fileInfo.Name;
+
+ if (fileHashtable.ContainsKey (fileName)) {
+ int i = 1;
+ while(fileHashtable.ContainsKey (fileName + "[" + i + "]")) {
+ i++;
+ }
+ fileName += "[" + i + "]";
+ }
+
+ ListViewItem listViewItem = new ListViewItem( fileName );
+
+ listViewItem.ImageIndex = MimeIconEngine.GetIconIndexForFile( fileStruct.fullname );
+
+ long fileLen = 1;
+ try {
+ if ( fileInfo.Length > 1024 )
+ fileLen = fileInfo.Length / 1024;
+ } catch ( Exception e ) {
+ fileLen = 1;
+ }
+
+ fileStruct.size = fileLen;
+
+ listViewItem.SubItems.Add( fileLen.ToString( ) + " KB" );
+ listViewItem.SubItems.Add( "File" );
+ listViewItem.SubItems.Add( fileInfo.LastAccessTime.ToShortDateString( ) + " " + fileInfo.LastAccessTime.ToShortTimeString( ) );
+
+ fileStruct.attributes = FileAttributes.Normal;
+
+ fileHashtable.Add( fileName, fileStruct );
+
+ Items.Add( listViewItem );
+ }
+
+ private ArrayList GetFreedesktopSpecRecentlyUsed( )
+ {
+ // check for GNOME and KDE
+ string personal_folder = ThemeEngine.Current.Places(UIIcon.PlacesPersonal);
+ string recently_used_path = Path.Combine( personal_folder, ".recently-used" );
+
+ ArrayList files_al = new ArrayList( );
+
+ // GNOME
+ if ( File.Exists( recently_used_path ) )
+ {
+ try
+ {
+ XmlTextReader xtr = new XmlTextReader( recently_used_path );
+ while ( xtr.Read( ) )
+ {
+ if ( xtr.NodeType == XmlNodeType.Element && xtr.Name.ToUpper() == "URI" )
+ {
+ xtr.Read();
+ Uri uri = new Uri( xtr.Value );
+ if ( !files_al.Contains( uri.LocalPath ) )
+ files_al.Add( uri.LocalPath );
+ }
+ }
+ xtr.Close();
+ } catch ( Exception e )
+ {
+
+ }
+ }
+
+ // KDE
+ string full_kde_recent_document_dir = personal_folder
+ + "/"
+ + ".kde/share/apps/RecentDocuments";
+
+ if ( Directory.Exists( full_kde_recent_document_dir ) )
+ {
+ string[] files = Directory.GetFiles( full_kde_recent_document_dir, "*.desktop" );
+
+ foreach( string file_name in files )
+ {
+ StreamReader sr = new StreamReader( file_name );
+
+ string line = sr.ReadLine();
+
+ while (line != null)
+ {
+ line = line.Trim();
+
+ if ( line.StartsWith( "URL=" ) )
+ {
+ line = line.Replace( "URL=", "" );
+ line = line.Replace( "$HOME", personal_folder );
+
+ Uri uri = new Uri( line );
+ if ( !files_al.Contains( uri.LocalPath ) )
+ files_al.Add( uri.LocalPath );
+ break;
+ }
+
+ line = sr.ReadLine();
+ }
+
+ sr.Close();
+ }
+ }
+
+
+ return files_al;
+ }
+
+ protected override void OnClick( EventArgs e )
+ {
+ if ( !MultiSelect )
+ {
+ if ( SelectedItems.Count > 0 )
+ {
+ ListViewItem listViewItem = SelectedItems[ 0 ];
+
+ FileStruct fileStruct = (FileStruct)fileHashtable[ listViewItem.Text ];
+
+ if ( fileStruct.attributes != FileAttributes.Directory )
+ {
+ fileName = listViewItem.Text;
+ fullFileName = fileStruct.fullname;
+
+ if ( on_selected_file_changed != null )
+ on_selected_file_changed( this, EventArgs.Empty );
+ }
+ }
+ }
+
+ base.OnClick( e );
+ }
+
+ protected override void OnDoubleClick( EventArgs e )
+ {
+ if ( SelectedItems.Count > 0 )
+ {
+ ListViewItem listViewItem = SelectedItems[ 0 ];
+
+ FileStruct fileStruct = (FileStruct)fileHashtable[ listViewItem.Text ];
+
+ if ( fileStruct.attributes == FileAttributes.Directory )
+ {
+ fullFileName = fileStruct.fullname;
+
+ if ( on_directory_changed != null )
+ on_directory_changed( this, EventArgs.Empty );
+ }
+ else
+ {
+ fileName = listViewItem.Text;
+ fullFileName = fileStruct.fullname;
+
+ if ( on_selected_file_changed != null )
+ on_selected_file_changed( this, EventArgs.Empty );
+
+ if ( on_force_dialog_end != null )
+ on_force_dialog_end( this, EventArgs.Empty );
+
+ return;
+ }
+ }
+
+ base.OnDoubleClick( e );
+ }
+
+ protected override void OnSelectedIndexChanged( EventArgs e )
+ {
+ if ( MultiSelect )
+ {
+ if ( SelectedItems.Count > 0 )
+ {
+ selectedFilesString = "";
+
+ if ( SelectedItems.Count == 1 )
+ {
+ FileStruct fileStruct = (FileStruct)fileHashtable[ SelectedItems[ 0 ].Text ];
+
+ if ( fileStruct.attributes != FileAttributes.Directory )
+ selectedFilesString = SelectedItems[ 0 ].Text;
+ }
+ else
+ {
+ foreach ( ListViewItem lvi in SelectedItems )
+ {
+ FileStruct fileStruct = (FileStruct)fileHashtable[ lvi.Text ];
+
+ if ( fileStruct.attributes != FileAttributes.Directory )
+ selectedFilesString += "\"" + lvi.Text + "\" ";
+ }
+ }
+
+ if ( on_selected_files_changed != null )
+ on_selected_files_changed( this, EventArgs.Empty );
+ }
+ }
+
+ base.OnSelectedIndexChanged( e );
+ }
+
+ protected override void OnMouseMove (MouseEventArgs e)
+ {
+ ListViewItem item = GetItemAt (e.X, e.Y);
+
+ if (item != null) {
+ int currentItemIndex = item.Index;
+
+ if (currentItemIndex != oldItemIndexForToolTip) {
+ oldItemIndexForToolTip = currentItemIndex;
+
+ if (toolTip != null && toolTip.Active)
+ toolTip.Active = false;
+
+ FileStruct fileStruct = (FileStruct)fileHashtable [item.Text];
+
+ string output = String.Empty;
+
+ if (fileStruct.attributes != FileAttributes.Directory) {
+ output = String.Format ("File: {0}", fileStruct.fullname);
+ }
+ else
+ output = String.Format ("Directory: {0}\n", fileStruct.fullname);
+
+ toolTip.SetToolTip (this, output);
+
+ toolTip.Active = true;
+ }
+ }
+
+ base.OnMouseMove (e);
+ }
+
+ private void MWF_KeyUp (object sender, KeyEventArgs e)
+ {
+ if (e.KeyCode == Keys.Back) {
+ if (on_one_directory_up != null)
+ on_one_directory_up (this, EventArgs.Empty);
+ }
+ }
+
+ public event EventHandler SelectedFileChanged
+ {
+ add { on_selected_file_changed += value; }
+ remove { on_selected_file_changed -= value; }
+ }
+
+ public event EventHandler SelectedFilesChanged
+ {
+ add { on_selected_files_changed += value; }
+ remove { on_selected_files_changed -= value; }
+ }
+
+ public event EventHandler DirectoryChanged
+ {
+ add { on_directory_changed += value; }
+ remove { on_directory_changed -= value; }
+ }
+
+ public event EventHandler ForceDialogEnd
+ {
+ add { on_force_dialog_end += value; }
+ remove { on_force_dialog_end -= value; }
+ }
+
+ public event EventHandler OnDirectoryUp
+ {
+ add { on_one_directory_up += value; }
+ remove { on_one_directory_up -= value; }
+ }
+ }
+
+ internal class FileFilter
+ {
+ private ArrayList filterArrayList = new ArrayList();
+
+ private string filter;
+
+ public FileFilter( )
+ {}
+
+ public FileFilter( string filter )
+ {
+ this.filter = filter;
+
+ SplitFilter( );
+ }
+
+ public ArrayList FilterArrayList
+ {
+ set {
+ filterArrayList = value;
+ }
+
+ get {
+ return filterArrayList;
+ }
+ }
+
+ public string Filter
+ {
+ set {
+ filter = value;
+
+ SplitFilter( );
+ }
+
+ get {
+ return filter;
+ }
+ }
+
+ private void SplitFilter( )
+ {
+ filterArrayList.Clear( );
+
+ if ( filter == null )
+ throw new NullReferenceException( "Filter" );
+
+ if ( filter.Length == 0 )
+ return;
+
+ string[] filters = filter.Split( new Char[] {'|'} );
+
+ if ( ( filters.Length % 2 ) != 0 )
+ throw new ArgumentException( "Filter" );
+
+ for ( int i = 0; i < filters.Length; i += 2 )
+ {
+ FilterStruct filterStruct = new FilterStruct( filters[ i ], filters[ i + 1 ] );
+
+ filterArrayList.Add( filterStruct );
+ }
+ }
+ }
+
+ internal class DirComboBox : ComboBox
+ {
+ internal class DirComboBoxItem
+ {
+ private int imageIndex;
+ private string name;
+ private string path;
+ private int xPos;
+
+ public DirComboBoxItem( int imageIndex, string name, string path, int xPos )
+ {
+ this.imageIndex = imageIndex;
+ this.name = name;
+ this.path = path;
+ this.xPos = xPos;
+ }
+
+ public int ImageIndex
+ {
+ set {
+ imageIndex = value;
+ }
+
+ get {
+ return imageIndex;
+ }
+ }
+
+ public string Name
+ {
+ set {
+ name = value;
+ }
+
+ get {
+ return name;
+ }
+ }
+
+ public string Path
+ {
+ set {
+ path = value;
+ }
+
+ get {
+ return path;
+ }
+ }
+
+ public int XPos
+ {
+ set {
+ xPos = value;
+ }
+
+ get {
+ return xPos;
+ }
+ }
+ }
+
+ private ImageList imageList = new ImageList();
+
+ private string currentPath;
+
+ private EventHandler on_directory_changed;
+
+ private bool currentpath_internal_change = false;
+
+ private int platform = (int) Environment.OSVersion.Platform;
+ private string recently_tmp;
+ private string workplace_tmp;
+ private Stack dirStack = new Stack();
+
+ public DirComboBox( )
+ {
+ DrawMode = DrawMode.OwnerDrawFixed;
+
+ imageList.ColorDepth = ColorDepth.Depth32Bit;
+ imageList.ImageSize = new Size( 16, 16 );
+ imageList.Images.Add(ThemeEngine.Current.Images(UIIcon.PlacesRecentDocuments, 16));
+ imageList.Images.Add(ThemeEngine.Current.Images(UIIcon.PlacesDesktop, 16));
+ imageList.Images.Add(ThemeEngine.Current.Images(UIIcon.PlacesPersonal, 16));
+ imageList.Images.Add(ThemeEngine.Current.Images(UIIcon.PlacesMyComputer, 16));
+ imageList.Images.Add(ThemeEngine.Current.Images(UIIcon.PlacesMyNetwork, 16));
+ imageList.Images.Add(ThemeEngine.Current.Images(UIIcon.NormalFolder, 16));
+ imageList.TransparentColor = Color.Transparent;
+
+ if ((platform == 4) || (platform == 128))
+ {
+ recently_tmp = FileDialog.FileDialogPanel.recently_string;
+ workplace_tmp = "/";
+ }
+ else
+ {
+ recently_tmp = ThemeEngine.Current.Places(UIIcon.PlacesRecentDocuments);
+ workplace_tmp = ThemeEngine.Current.Places(UIIcon.PlacesMyComputer);
+ }
+
+ Items.AddRange( new object[] {
+ new DirComboBoxItem( 0, "Recently used", recently_tmp, 0 ),
+ new DirComboBoxItem( 1, "Desktop", ThemeEngine.Current.Places(UIIcon.PlacesDesktop), 0),
+ new DirComboBoxItem( 2, "Home", ThemeEngine.Current.Places(UIIcon.PlacesPersonal), 0 ),
+ new DirComboBoxItem( 3, "Workplace", workplace_tmp, 0 )
+ }
+ );
+ }
+
+ public string CurrentPath
+ {
+ set {
+ currentPath = value;
+
+ currentpath_internal_change = true;
+
+ CreateComboList( );
+ }
+ get {
+ return currentPath;
+ }
+ }
+
+ private void CreateComboList( )
+ {
+ int selection = -1;
+ int child_of = - 1;
+
+ if ( currentPath == recently_tmp ||
+ currentPath == ThemeEngine.Current.Places(UIIcon.PlacesDesktop) ||
+ currentPath == ThemeEngine.Current.Places(UIIcon.PlacesPersonal) ||
+ currentPath == workplace_tmp )
+ {
+ if ( currentPath == recently_tmp )
+ selection = 0;
+ else
+ if ( currentPath == ThemeEngine.Current.Places(UIIcon.PlacesDesktop) )
+ selection = 1;
+ else
+ if ( currentPath == ThemeEngine.Current.Places(UIIcon.PlacesPersonal) )
+ selection = 2;
+ else
+ if( currentPath == workplace_tmp )
+ selection = 3;
+ }
+
+ child_of = CheckChildOf();
+
+ BeginUpdate( );
+
+ Items.Clear( );
+
+ Items.Add( new DirComboBoxItem( 0, "Recently used", recently_tmp, 0 ) );
+
+ Items.Add( new DirComboBoxItem( 1, "Desktop", ThemeEngine.Current.Places(UIIcon.PlacesDesktop), 0 ) );
+ if ( child_of == 1 )
+ selection = AppendToParent();
+
+ Items.Add( new DirComboBoxItem( 2, "Home", ThemeEngine.Current.Places(UIIcon.PlacesPersonal), 0 ) );
+ if ( child_of == 2 )
+ selection = AppendToParent();
+
+ Items.Add( new DirComboBoxItem( 3, "Workplace", workplace_tmp, 0 ) );
+ if ( child_of == 3 )
+ selection = AppendToParent();
+
+ if ( selection != -1 )
+ SelectedIndex = selection;
+
+ EndUpdate( );
+ }
+
+ private int CheckChildOf()
+ {
+ dirStack.Clear();
+ DirectoryInfo di = new DirectoryInfo( currentPath );
+
+ dirStack.Push( di );
+
+ while ( di.Parent != null )
+ {
+ di = di.Parent;
+ if ( di.FullName == ThemeEngine.Current.Places(UIIcon.PlacesDesktop) )
+ return 1;
+ else
+ if ( di.FullName == ThemeEngine.Current.Places(UIIcon.PlacesPersonal) )
+ return 2;
+ else
+ if ( di.FullName == workplace_tmp )
+ return 3;
+
+ dirStack.Push( di );
+ }
+
+ return -1;
+ }
+
+ private int AppendToParent()
+ {
+ int xPos = 0;
+ int selection = -1;
+
+ while ( dirStack.Count != 0 )
+ {
+ DirectoryInfo dii = dirStack.Pop( ) as DirectoryInfo;
+ selection = Items.Add( new DirComboBoxItem( 5, dii.Name, dii.FullName, xPos + 4 ) );
+ xPos += 4;
+ }
+
+ return selection;
+ }
+
+ protected override void OnDrawItem( DrawItemEventArgs e )
+ {
+ if ( e.Index == -1 )
+ return;
+
+ Bitmap bmp = new Bitmap( e.Bounds.Width, e.Bounds.Height, e.Graphics );
+ Graphics gr = Graphics.FromImage( bmp );
+
+ DirComboBoxItem dcbi = Items[ e.Index ] as DirComboBoxItem;
+
+ Color backColor = e.BackColor;
+ Color foreColor = e.ForeColor;
+
+ int xPos = dcbi.XPos;
+
+ if ( ( e.State & DrawItemState.ComboBoxEdit ) != 0 )
+ xPos = 0;
+ else
+ if ( ( e.State & DrawItemState.Selected ) == DrawItemState.Selected )
+ {
+ backColor = ThemeEngine.Current.ColorHighlight;
+ foreColor = ThemeEngine.Current.ColorHighlightText;
+ }
+
+ gr.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush( backColor ), new Rectangle( 0, 0, bmp.Width, bmp.Height ) );
+
+ gr.DrawString( dcbi.Name, e.Font , ThemeEngine.Current.ResPool.GetSolidBrush( foreColor ), new Point( 24 + xPos, ( bmp.Height - e.Font.Height ) / 2 ) );
+ gr.DrawImage( imageList.Images[ dcbi.ImageIndex ], new Rectangle( new Point( xPos + 2, 0 ), new Size( 16, 16 ) ) );
+
+ e.Graphics.DrawImage( bmp, e.Bounds.X, e.Bounds.Y );
+ gr.Dispose ();
+ bmp.Dispose ();
+ }
+
+ protected override void OnSelectedIndexChanged( EventArgs e )
+ {
+ if ( Items.Count > 0 )
+ {
+ DirComboBoxItem dcbi = Items[ SelectedIndex ] as DirComboBoxItem;
+
+ currentPath = dcbi.Path;
+
+ // call DirectoryChange event only if the user changes the index with the ComboBox
+ if ( !currentpath_internal_change )
+ {
+ if ( on_directory_changed != null )
+ on_directory_changed( this, EventArgs.Empty );
+ }
+ }
+
+ currentpath_internal_change = false;
+ }
+
+ public event EventHandler DirectoryChanged
+ {
+ add { on_directory_changed += value; }
+ remove { on_directory_changed -= value; }
+ }
+ }
+}
+
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FlatStyle.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FlatStyle.cs
new file mode 100644
index 00000000000..662a2c1f666
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FlatStyle.cs
@@ -0,0 +1,36 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public enum FlatStyle {
+ Flat = 0,
+ Popup = 1,
+ Standard = 2,
+ System = 3
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FolderBrowserDialog.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FolderBrowserDialog.cs
new file mode 100644
index 00000000000..9ccc5954d4c
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FolderBrowserDialog.cs
@@ -0,0 +1,442 @@
+// 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) 2005-2006 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Alexander Olk (xenomorph2@onlinehome.de)
+//
+//
+
+// NOT COMPLETE
+// TODO:
+// - create new folder if NewFolderButton is pressed
+// - better handling of Environment.SpecialFolders
+// - fix: if SelectedPath != "" and it is beyond RootFolder then show it (currently TreeNode.EnsureVisible() is missing...)
+
+using System;
+using System.Drawing;
+using System.ComponentModel;
+using System.Resources;
+using System.IO;
+using System.Collections;
+
+namespace System.Windows.Forms
+{
+ [DefaultEvent("HelpRequest")]
+ [DefaultProperty("SelectedPath")]
+ [Designer("System.Windows.Forms.Design.FolderBrowserDialogDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+ public sealed class FolderBrowserDialog : CommonDialog
+ {
+ #region Local Variables
+ private string description = "";
+ private Environment.SpecialFolder rootFolder = Environment.SpecialFolder.Desktop;
+ private string selectedPath = "";
+ private bool showNewFolderButton = true;
+
+ #endregion // Local Variables
+
+ #region Public Constructors
+ public FolderBrowserDialog( )
+ {
+ form = new FolderBrowserDialogForm( this );
+ form.Size = new Size( 322, 288 );
+ form.MinimumSize = new Size( 322, 288 );
+ form.Text = "Search Folder";
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ [Browsable(true)]
+ [DefaultValue("")]
+ [Localizable(true)]
+ public string Description
+ {
+ set
+ {
+ description = value;
+ }
+
+ get
+ {
+ return description;
+ }
+ }
+
+ [Browsable(true)]
+ [DefaultValue(Environment.SpecialFolder.Desktop)]
+ [Localizable(false)]
+ public Environment.SpecialFolder RootFolder
+ {
+ set
+ {
+ rootFolder = value;
+ }
+
+ get
+ {
+ return rootFolder;
+ }
+ }
+
+ [Browsable(true)]
+ [DefaultValue("")]
+ [Editor("System.Windows.Forms.Design.SelectedPathEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
+ [Localizable(true)]
+ public string SelectedPath
+ {
+ set
+ {
+ selectedPath = value;
+ }
+
+ get
+ {
+ return selectedPath;
+ }
+ }
+
+ [Browsable(true)]
+ [DefaultValue(true)]
+ [Localizable(false)]
+ public bool ShowNewFolderButton
+ {
+ set
+ {
+ showNewFolderButton = value;
+ }
+
+ get
+ {
+ return showNewFolderButton;
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Instance Methods
+ public override void Reset( )
+ {
+ description = "";
+ rootFolder = Environment.SpecialFolder.Desktop;
+ selectedPath = "";
+ showNewFolderButton = true;
+ }
+
+ protected override bool RunDialog( IntPtr hwndOwner )
+ {
+ FolderBrowserDialogPanel fb = new FolderBrowserDialogPanel (this);
+ form.Controls.Add (fb);
+ return true;
+ }
+ #endregion // Public Instance Methods
+
+ #region Internal Methods
+ internal class FolderBrowserDialogForm : DialogForm
+ {
+ internal FolderBrowserDialogForm( CommonDialog owner )
+ : base( owner )
+ {}
+
+ protected override CreateParams CreateParams
+ {
+ get
+ {
+ CreateParams cp;
+
+ ControlBox = true;
+ MinimizeBox = false;
+ MaximizeBox = false;
+
+ cp = base.CreateParams;
+ cp.Style = (int)( WindowStyles.WS_POPUP | WindowStyles.WS_CAPTION | WindowStyles.WS_SYSMENU | WindowStyles.WS_CLIPCHILDREN | WindowStyles.WS_CLIPSIBLINGS );
+ cp.Style |= (int)WindowStyles.WS_OVERLAPPEDWINDOW;
+
+ if (!is_enabled) {
+ cp.Style |= (int)(WindowStyles.WS_DISABLED);
+ }
+
+ return cp;
+ }
+ }
+ }
+
+ internal class FolderBrowserDialogPanel : Panel
+ {
+ private Label descriptionLabel;
+ private Button cancelButton;
+ private Button okButton;
+ private TreeView folderBrowserTreeView;
+ private Button newFolderButton;
+
+ private FolderBrowserDialog folderBrowserDialog;
+ private string selectedPath;
+
+ private ImageList imageList;
+ private TreeNode selectedPathNode = null;
+ private TreeNode root_node;
+
+ public FolderBrowserDialogPanel (FolderBrowserDialog folderBrowserDialog)
+ {
+ this.folderBrowserDialog = folderBrowserDialog;
+
+ newFolderButton = new Button( );
+ folderBrowserTreeView = new TreeView( );
+ okButton = new Button( );
+ cancelButton = new Button( );
+ descriptionLabel = new Label( );
+
+ imageList = new ImageList( );
+
+ folderBrowserDialog.form.AcceptButton = okButton;
+ folderBrowserDialog.form.CancelButton = cancelButton;
+
+ SuspendLayout( );
+
+ // descriptionLabel
+ descriptionLabel.Anchor = ( (AnchorStyles)( ( ( AnchorStyles.Top | AnchorStyles.Left )
+ | AnchorStyles.Right ) ) );
+ descriptionLabel.Location = new Point( 17, 14 );
+ descriptionLabel.Size = new Size( 290, 40 );
+ descriptionLabel.TabIndex = 0;
+ descriptionLabel.Text = folderBrowserDialog.Description;
+
+ // folderBrowserTreeView
+ folderBrowserTreeView.Anchor = ( (AnchorStyles)( ( ( ( AnchorStyles.Top | AnchorStyles.Bottom )
+ | AnchorStyles.Left )
+ | AnchorStyles.Right ) ) );
+ folderBrowserTreeView.ImageIndex = -1;
+ folderBrowserTreeView.Location = new Point( 20, 61 );
+ folderBrowserTreeView.SelectedImageIndex = -1;
+ folderBrowserTreeView.Size = new Size( 278, 153 );
+ folderBrowserTreeView.TabIndex = 1;
+ folderBrowserTreeView.ImageList = imageList;
+ folderBrowserTreeView.ShowLines = false;
+ folderBrowserTreeView.ShowPlusMinus = true;
+ folderBrowserTreeView.HotTracking = true;
+ //folderBrowserTreeView.Indent = 2;
+
+ // newFolderButton
+ newFolderButton.Anchor = ( (AnchorStyles)( ( AnchorStyles.Bottom | AnchorStyles.Left ) ) );
+ newFolderButton.FlatStyle = FlatStyle.System;
+ newFolderButton.Location = new Point( 14, 230 );
+ newFolderButton.Size = new Size( 125, 23 );
+ newFolderButton.TabIndex = 2;
+ newFolderButton.Text = "New Folder";
+ newFolderButton.Enabled = folderBrowserDialog.ShowNewFolderButton;
+
+ // okButton
+ okButton.Anchor = ( (AnchorStyles)( ( AnchorStyles.Bottom | AnchorStyles.Right ) ) );
+ okButton.FlatStyle = FlatStyle.System;
+ okButton.Location = new Point( 142, 230 );
+ okButton.Size = new Size( 80, 23 );
+ okButton.TabIndex = 3;
+ okButton.Text = "OK";
+
+ // cancelButton
+ cancelButton.Anchor = ( (AnchorStyles)( ( AnchorStyles.Bottom | AnchorStyles.Right ) ) );
+ cancelButton.DialogResult = DialogResult.Cancel;
+ cancelButton.FlatStyle = FlatStyle.System;
+ cancelButton.Location = new Point( 226, 230 );
+ cancelButton.Size = new Size( 80, 23 );
+ cancelButton.TabIndex = 4;
+ cancelButton.Text = "Cancel";
+
+ // FolderBrowserDialog
+ ClientSize = new Size( 322, 288 );
+ Dock = DockStyle.Fill;
+
+ Controls.Add( cancelButton );
+ Controls.Add( okButton );
+ Controls.Add( newFolderButton );
+ Controls.Add( folderBrowserTreeView );
+ Controls.Add( descriptionLabel );
+ ResumeLayout( false );
+
+ SetupImageList( );
+
+ okButton.Click += new EventHandler( OnClickOKButton );
+ cancelButton.Click += new EventHandler( OnClickCancelButton );
+
+ string root_path = Environment.GetFolderPath (folderBrowserDialog.RootFolder);
+ root_node = new TreeNode (Path.GetFileName (root_path));
+ root_node.Tag = root_path;
+ root_node.ImageIndex = NodeImageIndex (root_path);
+
+ // If we add the sub nodes before the root is added to the
+ // tree no refreshing will be done whil adding
+ if (folderBrowserDialog.RootFolder == Environment.SpecialFolder.Desktop) {
+
+
+ // Add something similar to 'My Computer'
+ TreeNode mycomp = new TreeNode ("My Computer");
+ if (Path.DirectorySeparatorChar == '/')
+ mycomp.Tag = "/";
+ else
+ mycomp.Tag = Environment.GetFolderPath (Environment.SpecialFolder.MyComputer);
+ mycomp.ImageIndex = NodeImageIndex ((string) mycomp.Tag);
+
+ // A home directory
+ string home_path = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
+ TreeNode home = new TreeNode (Path.GetFileName (home_path));
+ home.Tag = home_path;
+ home.ImageIndex = NodeImageIndex (home_path);
+
+ // This is so we get the expand box
+ mycomp.Nodes.Add (new TreeNode (String.Empty));
+ home.Nodes.Add (new TreeNode (String.Empty));
+
+ root_node.Nodes.Add (mycomp);
+ root_node.Nodes.Add (home);
+ root_node.Expand ();
+ } else {
+ FillNode (root_node);
+ }
+
+ folderBrowserTreeView.Nodes.Add (root_node);
+
+ folderBrowserTreeView.BeforeExpand += new TreeViewCancelEventHandler (OnBeforeExpand);
+ folderBrowserTreeView.AfterSelect += new TreeViewEventHandler( OnAfterSelectFolderBrowserTreeView );
+ }
+
+ public string SelectedPath
+ {
+ set
+ {
+ selectedPath = value;
+ }
+
+ get
+ {
+ return selectedPath;
+ }
+ }
+
+ void OnClickOKButton( object sender, EventArgs e )
+ {
+ folderBrowserDialog.SelectedPath = selectedPath;
+
+ folderBrowserDialog.form.Controls.Remove( this );
+ folderBrowserDialog.form.DialogResult = DialogResult.OK;
+ }
+
+ void OnClickCancelButton( object sender, EventArgs e )
+ {
+ folderBrowserDialog.form.Controls.Remove( this );
+ folderBrowserDialog.form.DialogResult = DialogResult.Cancel;
+ }
+
+ void OnAfterSelectFolderBrowserTreeView( object sender, TreeViewEventArgs e )
+ {
+ if (e.Node == null)
+ return;
+ selectedPath = (string) e.Node.Tag;
+ }
+
+ private void OnBeforeExpand (object sender, TreeViewCancelEventArgs e)
+ {
+ if (e.Node == root_node)
+ return;
+ FillNode (e.Node);
+ }
+
+ private void OnAfterCollapse (object sender, TreeViewCancelEventArgs e)
+ {
+ if (e.Node == root_node)
+ return;
+ e.Node.Nodes.Clear ();
+ }
+
+ private void FillNode (TreeNode node)
+ {
+ Cursor old = folderBrowserTreeView.Cursor;
+ folderBrowserTreeView.Cursor = Cursors.WaitCursor;
+
+ folderBrowserTreeView.BeginUpdate ();
+
+ node.Nodes.Clear ();
+ string path = node.Tag as string;
+ string [] dirs = Directory.GetDirectories (path);
+
+ foreach (string s in dirs) {
+ string name = Path.GetFileName (s);
+ // filter out . directories
+ if (name.StartsWith ("."))
+ continue;
+ TreeNode child = new TreeNode (name);
+ child.Tag = s;
+ child.ImageIndex = NodeImageIndex (s);
+
+ try {
+ // so we get the plus
+ string [] subdirs = Directory.GetDirectories (s);
+ foreach (string subdir in subdirs) {
+ // filter out . directories (le sigh)
+ string subdirname = Path.GetFileName (subdir);
+ if (!subdirname.StartsWith (".")) {
+ child.Nodes.Add (new TreeNode (String.Empty));
+ break;
+ }
+ }
+ } catch {
+ // Probably don't have access
+ }
+
+ node.Nodes.Add (child);
+ }
+
+ folderBrowserTreeView.EndUpdate ();
+ folderBrowserTreeView.Cursor = old;
+ }
+
+ private int NodeImageIndex( string path )
+ {
+ int index = 5;
+
+ if ( path == Environment.GetFolderPath( Environment.SpecialFolder.Desktop ) )
+ index = 1;
+ else
+ if ( path == Environment.GetFolderPath( Environment.SpecialFolder.Personal ) )
+ index = 2;
+
+ return index;
+ }
+
+ private void SetupImageList( )
+ {
+ imageList.ColorDepth = ColorDepth.Depth32Bit;
+ imageList.ImageSize = new Size( 16, 16 );
+ imageList.Images.Add( (Image)Locale.GetResource( "last_open" ) );
+ imageList.Images.Add( (Image)Locale.GetResource( "desktop" ) );
+ imageList.Images.Add( (Image)Locale.GetResource( "folder_with_paper" ) );
+ imageList.Images.Add( (Image)Locale.GetResource( "monitor-computer" ) );
+ imageList.Images.Add( (Image)Locale.GetResource( "monitor-planet" ) );
+ imageList.Images.Add( (Image)Locale.GetResource( "folder" ) );
+ imageList.Images.Add( (Image)Locale.GetResource( "paper" ) );
+ imageList.TransparentColor = Color.Transparent;
+ }
+ }
+ #endregion // Internal Methods
+
+ #region Events
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler HelpRequest;
+ #endregion
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FontDialog.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FontDialog.cs
new file mode 100644
index 00000000000..e31f17a3753
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FontDialog.cs
@@ -0,0 +1,897 @@
+// 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 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Alexander Olk xenomorph2@onlinehome.de
+//
+//
+
+// NOT COMPLETE - work in progress
+
+// TODO:
+// - select values for font/style/size via the TextBoxes
+// - etc
+
+using System.ComponentModel;
+using System.Drawing;
+using System.Text.RegularExpressions;
+
+namespace System.Windows.Forms
+{
+ [DefaultProperty( "Font" )]
+ [DefaultEvent("Apply")]
+ public class FontDialog : CommonDialog
+ {
+ protected static readonly object EventApply = new object ();
+
+ private FontDialogPanel fontDialogPanel;
+
+ private Font font;
+ private Color color = Color.Black;
+ private bool allowSimulations = true;
+ private bool allowVectorFonts = true;
+ private bool allowVerticalFonts = true;
+ private bool allowScriptChange = true;
+ private bool fixedPitchOnly = false;
+ private int maxSize = 0;
+ private int minSize = 0;
+ private bool scriptsOnly = false;
+ private bool showApply = false;
+ private bool showColor = false;
+ private bool showEffects = true;
+ private bool showHelp = false;
+
+ private bool fontMustExist = false;
+
+ #region Public Constructors
+ public FontDialog( )
+ {
+ form.ClientSize = new Size( 430, 318 );
+
+ form.Size = new Size( 430, 318 );
+
+ form.Text = "Font";
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public Font Font
+ {
+ get {
+ return font;
+ }
+
+ set {
+ font = value;
+ }
+ }
+
+ [DefaultValue(false)]
+ public bool FontMustExist
+ {
+ get {
+ return fontMustExist;
+ }
+
+ set {
+ fontMustExist = value;
+ }
+ }
+
+ public Color Color
+ {
+ set {
+ color = value;
+ }
+
+ get {
+ return color;
+ }
+ }
+
+ [DefaultValue(true)]
+ public bool AllowSimulations
+ {
+ set {
+ allowSimulations = value;
+ }
+
+ get {
+ return allowSimulations;
+ }
+ }
+
+ [DefaultValue(true)]
+ public bool AllowVectorFonts
+ {
+ set {
+ allowVectorFonts = value;
+ }
+
+ get {
+ return allowVectorFonts;
+ }
+ }
+
+ [DefaultValue(true)]
+ public bool AllowVerticalFonts
+ {
+ set {
+ allowVerticalFonts = value;
+ }
+
+ get {
+ return allowVerticalFonts;
+ }
+ }
+
+ [DefaultValue(true)]
+ public bool AllowScriptChange
+ {
+ set {
+ allowScriptChange = value;
+ }
+
+ get {
+ return allowScriptChange;
+ }
+ }
+
+ [DefaultValue(false)]
+ public bool FixedPitchOnly
+ {
+ set {
+ fixedPitchOnly = value;
+ }
+
+ get {
+ return fixedPitchOnly;
+ }
+ }
+
+ [DefaultValue(0)]
+ public int MaxSize
+ {
+ set {
+ maxSize = value;
+ }
+
+ get {
+ return maxSize;
+ }
+ }
+
+ [DefaultValue(0)]
+ public int MinSize
+ {
+ set {
+ minSize = value;
+ }
+
+ get {
+ return minSize;
+ }
+ }
+
+ [DefaultValue(false)]
+ public bool ScriptsOnly
+ {
+ set {
+ scriptsOnly = value;
+ }
+
+ get {
+ return scriptsOnly;
+ }
+ }
+
+ [DefaultValue(false)]
+ public bool ShowApply
+ {
+ set {
+ showApply = value;
+ }
+
+ get {
+ return showApply;
+ }
+ }
+
+ [DefaultValue(false)]
+ public bool ShowColor
+ {
+ set {
+ showColor = value;
+ }
+
+ get {
+ return showColor;
+ }
+ }
+
+ [DefaultValue(true)]
+ public bool ShowEffects
+ {
+ set {
+ showEffects = value;
+ }
+
+ get {
+ return showEffects;
+ }
+ }
+
+ [DefaultValue(false)]
+ public bool ShowHelp
+ {
+ set {
+ showHelp = value;
+ }
+
+ get {
+ return showHelp;
+ }
+ }
+
+ #endregion // Public Instance Properties
+
+ #region Protected Instance Properties
+ #endregion // Protected Instance Properties
+
+ #region Public Instance Methods
+ [MonoTODO]
+ public override void Reset( )
+ {
+ color = Color.Black;
+ allowSimulations = true;
+ allowVectorFonts = true;
+ allowVerticalFonts = true;
+ allowScriptChange = true;
+ fixedPitchOnly = false;
+ maxSize = 0;
+ minSize = 0;
+ scriptsOnly = false;
+ showApply = false;
+ showColor = false;
+ showEffects = true;
+ showHelp = false;
+ }
+
+ public override string ToString ()
+ {
+ if (font == null)
+ return base.ToString ();
+ return String.Concat (base.ToString (), ", Font: ", font.ToString ());
+ }
+ #endregion // Public Instance Methods
+
+ #region Protected Instance Methods
+ [MonoTODO]
+ protected override bool RunDialog( IntPtr hwndOwner )
+ {
+ fontDialogPanel = new FontDialogPanel (this);
+ form.Controls.Add( fontDialogPanel );
+
+ return true;
+ }
+
+ internal void OnApplyButton (object sender, EventArgs e)
+ {
+ OnApply (e);
+ }
+
+ protected virtual void OnApply (EventArgs e)
+ {
+ EventHandler apply = (EventHandler) Events [EventApply];
+ if (apply != null)
+ apply (this, e);
+ }
+ #endregion // Protected Instance Methods
+
+ public event EventHandler Apply {
+ add { Events.AddHandler (EventApply, value); }
+ remove { Events.RemoveHandler (EventApply, value); }
+ }
+ }
+
+ internal class FontDialogPanel : Panel
+ {
+ private Panel examplePanel;
+
+ private Button okButton;
+ private Button cancelButton;
+ private Button applyButton;
+ private Button helpButton;
+
+ private TextBox fontTextBox;
+ private TextBox fontstyleTextBox;
+ private TextBox sizeTextBox;
+
+ private ListBox fontListBox;
+ private ListBox fontstyleListBox;
+ private ListBox sizeListBox;
+
+ private GroupBox effectsGroupBox;
+ private CheckBox strikethroughCheckBox;
+ private CheckBox underlinedCheckBox;
+ private ComboBox scriptComboBox;
+
+ private Label fontLabel;
+ private Label fontstyleLabel;
+ private Label sizeLabel;
+ private Label scriptLabel;
+
+ private GroupBox exampleGroupBox;
+
+ private ColorComboBox colorComboBox;
+
+ private FontFamily[] fontFamilies;
+
+ private string currentFontName;
+
+ private Font currentFont;
+
+ private int currentSize;
+
+ private FontFamily currentFamily;
+
+ private Color currentColor;
+
+ private FontStyle currentFontStyle;
+
+ private FontDialog fontDialog;
+
+ private System.Collections.ArrayList fontStyleArray = new System.Collections.ArrayList();
+
+ private System.Collections.Hashtable fontHash = new System.Collections.Hashtable();
+
+ public FontDialogPanel( FontDialog fontDialog )
+ {
+ this.fontDialog = fontDialog;
+
+ okButton = new Button( );
+ cancelButton = new Button( );
+ applyButton = new Button( );
+ helpButton = new Button( );
+
+ fontTextBox = new TextBox( );
+ fontstyleTextBox = new TextBox( );
+ sizeTextBox = new TextBox( );
+
+ fontListBox = new ListBox( );
+ sizeListBox = new ListBox( );
+
+ fontLabel = new Label( );
+ fontstyleLabel = new Label( );
+ sizeLabel = new Label( );
+ scriptLabel = new Label( );
+
+ exampleGroupBox = new GroupBox( );
+ fontstyleListBox = new ListBox( );
+
+ effectsGroupBox = new GroupBox( );
+ underlinedCheckBox = new CheckBox( );
+ strikethroughCheckBox = new CheckBox( );
+ scriptComboBox = new ComboBox( );
+
+ examplePanel = new Panel( );
+
+ colorComboBox = new ColorComboBox( this );
+
+ exampleGroupBox.SuspendLayout( );
+ effectsGroupBox.SuspendLayout( );
+ SuspendLayout( );
+
+ // typesizeListBox
+ sizeListBox.Location = new Point( 284, 47 );
+ sizeListBox.Size = new Size( 52, 95 );
+ sizeListBox.TabIndex = 10;
+ // fontTextBox
+ fontTextBox.Location = new Point( 16, 26 );
+ fontTextBox.Size = new Size( 140, 21 );
+ fontTextBox.TabIndex = 5;
+ fontTextBox.Text = "";
+ // fontstyleLabel
+ fontstyleLabel.Location = new Point( 164, 10 );
+ fontstyleLabel.Size = new Size( 100, 16 );
+ fontstyleLabel.TabIndex = 1;
+ fontstyleLabel.Text = "Font Style:";
+ // typesizeTextBox
+ sizeTextBox.Location = new Point( 284, 26 );
+ sizeTextBox.Size = new Size( 52, 21 );
+ sizeTextBox.TabIndex = 7;
+ sizeTextBox.Text = "";
+ // schriftartListBox
+ fontListBox.Location = new Point( 16, 47 );
+ fontListBox.Size = new Size( 140, 95 );
+ fontListBox.TabIndex = 8;
+ fontListBox.Sorted = true;
+ // exampleGroupBox
+ exampleGroupBox.Controls.Add( examplePanel );
+ exampleGroupBox.FlatStyle = FlatStyle.System;
+ exampleGroupBox.Location = new Point( 164, 158 );
+ exampleGroupBox.Size = new Size( 172, 70 );
+ exampleGroupBox.TabIndex = 12;
+ exampleGroupBox.TabStop = false;
+ exampleGroupBox.Text = "Example";
+ // fontstyleListBox
+ fontstyleListBox.Location = new Point( 164, 47 );
+ fontstyleListBox.Size = new Size( 112, 95 );
+ fontstyleListBox.TabIndex = 9;
+ // schriftartLabel
+ fontLabel.Location = new Point( 16, 10 );
+ fontLabel.Size = new Size( 88, 16 );
+ fontLabel.TabIndex = 0;
+ fontLabel.Text = "Font:";
+ // effectsGroupBox
+ effectsGroupBox.Controls.Add( underlinedCheckBox );
+ effectsGroupBox.Controls.Add( strikethroughCheckBox );
+ effectsGroupBox.Controls.Add( colorComboBox );
+ effectsGroupBox.FlatStyle = FlatStyle.System;
+ effectsGroupBox.Location = new Point( 16, 158 );
+ effectsGroupBox.Size = new Size( 140, 116 );
+ effectsGroupBox.TabIndex = 11;
+ effectsGroupBox.TabStop = false;
+ effectsGroupBox.Text = "Effects";
+ // strikethroughCheckBox
+ strikethroughCheckBox.FlatStyle = FlatStyle.System;
+ strikethroughCheckBox.Location = new Point( 8, 16 );
+ strikethroughCheckBox.TabIndex = 0;
+ strikethroughCheckBox.Text = "Strikethrough";
+ // colorComboBox
+ colorComboBox.Location = new Point( 8, 70 );
+ colorComboBox.Size = new Size( 130, 21 );
+ // sizeLabel
+ sizeLabel.Location = new Point( 284, 10 );
+ sizeLabel.Size = new Size( 100, 16 );
+ sizeLabel.TabIndex = 2;
+ sizeLabel.Text = "Size:";
+ // scriptComboBox
+ scriptComboBox.Location = new Point( 164, 253 );
+ scriptComboBox.Size = new Size( 172, 21 );
+ scriptComboBox.TabIndex = 14;
+ scriptComboBox.Text = "-/-";
+ // okButton
+ okButton.FlatStyle = FlatStyle.System;
+ okButton.Location = new Point( 352, 26 );
+ okButton.Size = new Size( 70, 23 );
+ okButton.TabIndex = 3;
+ okButton.Text = "OK";
+ // cancelButton
+ cancelButton.FlatStyle = FlatStyle.System;
+ cancelButton.Location = new Point( 352, 52 );
+ cancelButton.Size = new Size( 70, 23 );
+ cancelButton.TabIndex = 4;
+ cancelButton.Text = "Cancel";
+ // applyButton
+ applyButton.FlatStyle = FlatStyle.System;
+ applyButton.Location = new Point( 352, 78 );
+ applyButton.Size = new Size( 70, 23 );
+ applyButton.TabIndex = 5;
+ applyButton.Text = "Apply";
+ // helpButton
+ helpButton.FlatStyle = FlatStyle.System;
+ helpButton.Location = new Point( 352, 104 );
+ helpButton.Size = new Size( 70, 23 );
+ helpButton.TabIndex = 6;
+ helpButton.Text = "Help";
+ // underlinedCheckBox
+ underlinedCheckBox.FlatStyle = FlatStyle.System;
+ underlinedCheckBox.Location = new Point( 8, 36 );
+ underlinedCheckBox.TabIndex = 1;
+ underlinedCheckBox.Text = "Underlined";
+ // fontstyleTextBox
+ fontstyleTextBox.Location = new Point( 164, 26 );
+ fontstyleTextBox.Size = new Size( 112, 21 );
+ fontstyleTextBox.TabIndex = 6;
+ fontstyleTextBox.Text = "";
+ // scriptLabel
+ scriptLabel.Location = new Point( 164, 236 );
+ scriptLabel.Size = new Size( 100, 16 );
+ scriptLabel.TabIndex = 13;
+ scriptLabel.Text = "Script:";
+ // examplePanel
+ examplePanel.Location = new Point( 8, 20 );
+ examplePanel.TabIndex = 0;
+ examplePanel.BorderStyle = BorderStyle.Fixed3D;
+ examplePanel.Size = new Size( 156, 40 );
+
+ ClientSize = new Size( 430, 318 );
+
+ Controls.Add( scriptComboBox );
+ Controls.Add( scriptLabel );
+ Controls.Add( exampleGroupBox );
+ Controls.Add( effectsGroupBox );
+ Controls.Add( sizeListBox );
+ Controls.Add( fontstyleListBox );
+ Controls.Add( fontListBox );
+ Controls.Add( sizeTextBox );
+ Controls.Add( fontstyleTextBox );
+ Controls.Add( fontTextBox );
+ Controls.Add( cancelButton );
+ Controls.Add( okButton );
+ Controls.Add( sizeLabel );
+ Controls.Add( fontstyleLabel );
+ Controls.Add( fontLabel );
+ Controls.Add( applyButton );
+ Controls.Add( helpButton );
+
+ exampleGroupBox.ResumeLayout( false );
+ effectsGroupBox.ResumeLayout( false );
+
+ ResumeLayout( false );
+
+ fontFamilies = FontFamily.Families;
+
+ fontListBox.BeginUpdate( );
+ foreach ( FontFamily ff in fontFamilies )
+ {
+ if ( !fontHash.ContainsKey (ff.Name) ) {
+ fontListBox.Items.Add( ff.Name );
+ fontHash.Add( ff.Name, ff );
+ }
+ }
+ fontListBox.EndUpdate( );
+
+ fontListBox.SelectedIndex = 0;
+
+ // TODO: If Font is provided via FontDialog.Font property set correct font in FontListBox
+ currentFontName = fontListBox.Items[ 0 ].ToString( );
+ fontTextBox.Text = currentFontName;
+
+ // default 12 ?!?
+ currentSize = 12;
+
+ currentFamily = FindByName( currentFontName );
+
+ currentFontStyle = FontStyle.Regular;
+
+ currentFont = new Font( currentFamily, currentSize, currentFontStyle );
+
+ currentColor = fontDialog.Color;
+
+ UpdateFontStyleListBox( );
+
+ fontstyleTextBox.Text = "Regular";
+
+ fontstyleListBox.SelectedIndex = 0 ;
+
+ sizeTextBox.Text = currentSize.ToString( );
+
+ sizeListBox.Items.AddRange( new object[] {
+ "8",
+ "9",
+ "10",
+ "11",
+ "12",
+ "14",
+ "16",
+ "18",
+ "20",
+ "22",
+ "24",
+ "26",
+ "28",
+ "36",
+ "48",
+ "72" } );
+
+ sizeListBox.SelectedIndex = 4;
+
+ if ( !fontDialog.ShowApply )
+ applyButton.Hide( );
+ if ( !fontDialog.ShowHelp )
+ helpButton.Hide( );
+ if ( !fontDialog.ShowEffects )
+ effectsGroupBox.Hide( );
+ if ( !fontDialog.ShowColor )
+ colorComboBox.Hide( );
+
+ cancelButton.Click += new EventHandler( OnClickCancelButton );
+ okButton.Click += new EventHandler( OnClickOkButton );
+ applyButton.Click += new EventHandler (fontDialog.OnApplyButton);
+ examplePanel.Paint += new PaintEventHandler( OnPaintExamplePanel );
+ fontListBox.SelectedIndexChanged += new EventHandler( OnSelectedIndexChangedFontListBox );
+ sizeListBox.SelectedIndexChanged += new EventHandler( OnSelectedIndexChangedSizeListBox );
+ fontstyleListBox.SelectedIndexChanged += new EventHandler( OnSelectedIndexChangedFontStyleListBox );
+ underlinedCheckBox.CheckedChanged += new EventHandler( OnCheckedChangedUnderlinedCheckBox );
+ strikethroughCheckBox.CheckedChanged += new EventHandler( OnCheckedChangedStrikethroughCheckBox );
+ }
+
+ public Color CurrentColor
+ {
+ set {
+ currentColor = value;
+ examplePanel.Invalidate( );
+ }
+
+ get {
+ return currentColor;
+ }
+ }
+
+ private void UpdateFontStyleListBox( )
+ {
+ // don't know if that works, IsStyleAvailable returns true for all styles under X
+
+ fontStyleArray.Clear( );
+
+ fontstyleListBox.BeginUpdate( );
+
+ fontstyleListBox.Items.Clear( );
+
+ if ( currentFamily.IsStyleAvailable( FontStyle.Regular ) )
+ {
+ fontstyleListBox.Items.Add( "Regular" );
+ fontStyleArray.Add( 0 );
+ }
+
+ if ( currentFamily.IsStyleAvailable( FontStyle.Bold ) )
+ {
+ fontstyleListBox.Items.Add( "Bold" );
+ fontStyleArray.Add( 1 );
+ }
+
+ if ( currentFamily.IsStyleAvailable( FontStyle.Italic ) )
+ {
+ fontstyleListBox.Items.Add( "Italic" );
+ fontStyleArray.Add( 2 );
+ }
+
+ if ( currentFamily.IsStyleAvailable( FontStyle.Bold ) && currentFamily.IsStyleAvailable( FontStyle.Italic ) )
+ {
+ fontstyleListBox.Items.Add( "Bold Italic" );
+ fontStyleArray.Add( 3 );
+ }
+
+ fontstyleListBox.EndUpdate( );
+ }
+
+ private FontFamily FindByName( string name )
+ {
+ return fontHash[ name ] as FontFamily;
+ }
+
+ void OnClickCancelButton( object sender, EventArgs e )
+ {
+ fontDialog.form.Controls.Remove( this );
+ fontDialog.form.DialogResult = DialogResult.Cancel;
+ }
+
+ void OnClickOkButton( object sender, EventArgs e )
+ {
+ fontDialog.form.Controls.Remove( this );
+ fontDialog.Font = currentFont;
+ fontDialog.Color = currentColor;
+ fontDialog.form.DialogResult = DialogResult.OK;
+ }
+
+ void OnPaintExamplePanel( object sender, PaintEventArgs e )
+ {
+ SolidBrush brush = ThemeEngine.Current.ResPool.GetSolidBrush( currentColor );
+
+ e.Graphics.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush( SystemColors.Control ), 0, 0, 156, 40 );
+
+ string text = "AaBbYyZz";
+
+ SizeF fontSizeF = e.Graphics.MeasureString( text, currentFont );
+
+ int text_width = (int)fontSizeF.Width;
+ int text_height = (int)fontSizeF.Height;
+
+ int x = ( examplePanel.Width / 2 ) - ( text_width / 2 );
+ if ( x < 0 ) x = 0;
+
+ int y = ( examplePanel.Height / 2 ) - ( text_height / 2 );
+
+ e.Graphics.DrawString( text, currentFont, brush, new Point( x, y ) );
+ }
+
+ void OnSelectedIndexChangedFontListBox( object sender, EventArgs e )
+ {
+ if ( fontListBox.SelectedIndex != -1 )
+ {
+ currentFamily = FindByName( fontListBox.Items[ fontListBox.SelectedIndex ].ToString( ) );
+
+ fontTextBox.Text = currentFamily.Name;
+
+ UpdateFontStyleListBox( );
+
+ UpdateExamplePanel( );
+ }
+ }
+
+ void OnSelectedIndexChangedSizeListBox( object sender, EventArgs e )
+ {
+ if ( sizeListBox.SelectedIndex != -1 )
+ {
+ currentSize = System.Convert.ToInt32( sizeListBox.Items[ sizeListBox.SelectedIndex ] );
+
+ sizeTextBox.Text = currentSize.ToString( );
+
+ UpdateExamplePanel( );
+ }
+ }
+
+ void OnSelectedIndexChangedFontStyleListBox( object sender, EventArgs e )
+ {
+ if ( fontstyleListBox.SelectedIndex != -1 )
+ {
+ switch ( (int)fontStyleArray[ fontstyleListBox.SelectedIndex ] )
+ {
+ case 0:
+ currentFontStyle = FontStyle.Regular;
+ break;
+ case 1:
+ currentFontStyle = FontStyle.Bold;
+ break;
+ case 2:
+ currentFontStyle = FontStyle.Italic;
+ break;
+ case 3:
+ currentFontStyle = FontStyle.Bold | FontStyle.Italic;
+ break;
+ default:
+ currentFontStyle = FontStyle.Regular;
+ break;
+ }
+
+ fontstyleTextBox.Text = fontstyleListBox.Items[ fontstyleListBox.SelectedIndex ].ToString( );
+
+ UpdateExamplePanel( );
+ }
+ }
+
+ void OnCheckedChangedUnderlinedCheckBox( object sender, EventArgs e )
+ {
+ if ( underlinedCheckBox.Checked )
+ currentFontStyle = currentFontStyle | FontStyle.Underline;
+ else
+ currentFontStyle = currentFontStyle ^ FontStyle.Underline;
+
+ UpdateExamplePanel( );
+ }
+
+ void OnCheckedChangedStrikethroughCheckBox( object sender, EventArgs e )
+ {
+ if ( strikethroughCheckBox.Checked )
+ currentFontStyle = currentFontStyle | FontStyle.Strikeout;
+ else
+ currentFontStyle = currentFontStyle ^ FontStyle.Strikeout;
+
+ UpdateExamplePanel( );
+ }
+
+ private void UpdateExamplePanel( )
+ {
+ currentFont = new Font( currentFamily, currentSize, currentFontStyle );
+
+ examplePanel.Invalidate( );
+ examplePanel.Update( );
+ }
+
+ internal class ColorComboBox : ComboBox
+ {
+ internal class ColorComboBoxItem
+ {
+ private Color color;
+ private string name;
+
+ public ColorComboBoxItem( Color color, string name )
+ {
+ this.color = color;
+ this.name = name;
+ }
+
+ public Color Color
+ {
+ set {
+ color = value;
+ }
+
+ get {
+ return color;
+ }
+ }
+
+ public string Name
+ {
+ set {
+ name = value;
+ }
+
+ get {
+ return name;
+ }
+ }
+ }
+
+ private Color selectedColor;
+
+ private FontDialogPanel fontDialogPanel;
+
+ // FIXME: TextBox backcolor shouldn't be the same as the selected item in the ListBox/ListCtrl
+
+ public ColorComboBox( FontDialogPanel fontDialogPanel )
+ {
+ this.fontDialogPanel = fontDialogPanel;
+
+ DropDownStyle = ComboBoxStyle.DropDownList;
+ DrawMode = DrawMode.OwnerDrawFixed;
+
+ Items.AddRange( new object[] {
+ new ColorComboBoxItem( Color.Black, "Black" ),
+ new ColorComboBoxItem( Color.DarkRed, "Dark-Red" ),
+ new ColorComboBoxItem( Color.Green, "Green" ),
+ new ColorComboBoxItem( Color.Olive, "Olive-Green" ), // color not correct
+ new ColorComboBoxItem( Color.Aquamarine, "Aquamarine" ), // color not correct
+ new ColorComboBoxItem( Color.Crimson, "Crimson" ),
+ new ColorComboBoxItem( Color.Cyan, "Cyan" ),
+ new ColorComboBoxItem( Color.Gray, "Gray" ),
+ new ColorComboBoxItem( Color.Silver, "Silver" ),
+ new ColorComboBoxItem( Color.Red, "Red" ),
+ new ColorComboBoxItem( Color.YellowGreen, "Yellow-Green" ),
+ new ColorComboBoxItem( Color.Yellow, "Yellow" ),
+ new ColorComboBoxItem( Color.Blue, "Blue" ),
+ new ColorComboBoxItem( Color.Purple, "Purple" ),
+ new ColorComboBoxItem( Color.Aquamarine, "Aquamarine" ),
+ new ColorComboBoxItem( Color.White, "White" ) }
+ );
+
+ SelectedIndex = 0;
+ }
+
+ protected override void OnDrawItem( DrawItemEventArgs e )
+ {
+ if ( e.Index == -1 )
+ return;
+
+ ColorComboBoxItem ccbi = Items[ e.Index ] as ColorComboBoxItem;
+
+ Rectangle r = e.Bounds;
+ r.X = r.X + 24;
+
+ if ( ( e.State & DrawItemState.Selected ) == DrawItemState.Selected )
+ {
+ e.Graphics.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush( Color.Blue ), e.Bounds ); // bot blue
+ e.Graphics.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush( ccbi.Color ), e.Bounds.X + 3, e.Bounds.Y + 3, e.Bounds.X + 16, e.Bounds.Y + e.Bounds.Height - 2 );
+ e.Graphics.DrawRectangle( ThemeEngine.Current.ResPool.GetPen( Color.Black ), e.Bounds.X + 2, e. Bounds.Y + 2, e.Bounds.X + 17, e.Bounds.Y + e.Bounds.Height - 1 );
+ e.Graphics.DrawString( ccbi.Name, this.Font, ThemeEngine.Current.ResPool.GetSolidBrush( Color.White ), r );
+ }
+ else
+ {
+ e.Graphics.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush( Color.White ), e.Bounds );
+ e.Graphics.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush( ccbi.Color ), e.Bounds.X + 3, e.Bounds.Y + 3, e.Bounds.X + 16, e.Bounds.Y + e.Bounds.Height - 2 );
+ e.Graphics.DrawRectangle( ThemeEngine.Current.ResPool.GetPen( Color.Black ), e.Bounds.X + 2, e. Bounds.Y + 2, e.Bounds.X + 17, e.Bounds.Y + e.Bounds.Height - 1 );
+ e.Graphics.DrawString( ccbi.Name, this.Font, ThemeEngine.Current.ResPool.GetSolidBrush( Color.Black ), r );
+ }
+ }
+
+ protected override void OnSelectedIndexChanged( EventArgs e )
+ {
+ ColorComboBoxItem ccbi = Items[ SelectedIndex ] as ColorComboBoxItem;
+ selectedColor = ccbi.Color;
+
+ fontDialogPanel.CurrentColor = selectedColor;
+ }
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
new file mode 100644
index 00000000000..d7029a893a7
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
@@ -0,0 +1,1609 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+// NOT COMPLETE
+
+using System;
+using System.Drawing;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.ComponentModel.Design.Serialization;
+using System.Collections;
+using System.Runtime.InteropServices;
+using System.Threading;
+
+namespace System.Windows.Forms {
+ [DesignerCategory("Form")]
+ [DesignTimeVisible(false)]
+ [Designer("System.Windows.Forms.Design.FormDocumentDesigner, " + Consts.AssemblySystem_Design, typeof(IRootDesigner))]
+ [DefaultEvent("Load")]
+ [ToolboxItem(false)]
+ public class Form : ContainerControl {
+ #region Local Variables
+ internal static Form active_form;
+ internal bool closing;
+ FormBorderStyle form_border_style;
+ private bool autoscale;
+ private Size autoscale_base_size;
+ private bool allow_transparency;
+ private static Icon default_icon;
+ internal bool is_modal;
+ private bool control_box;
+ private bool minimize_box;
+ private bool maximize_box;
+ private bool help_button;
+ private bool show_in_taskbar;
+ private bool topmost;
+ private IButtonControl accept_button;
+ private IButtonControl cancel_button;
+ private DialogResult dialog_result;
+ private FormStartPosition start_position;
+ private Form owner;
+ private Form.ControlCollection owned_forms;
+ private MdiClient mdi_container;
+ private InternalWindowManager window_manager;
+ private Form mdi_parent;
+ private bool key_preview;
+ private MainMenu menu;
+ private Icon icon;
+ private Size maximum_size;
+ private Size minimum_size;
+ private SizeGripStyle size_grip_style;
+ private Rectangle maximized_bounds;
+ private Rectangle default_maximized_bounds;
+ private double opacity;
+ internal ApplicationContext context;
+ Color transparency_key;
+
+ #endregion // Local Variables
+
+ #region Private & Internal Methods
+ static Form ()
+ {
+ default_icon = (Icon)Locale.GetResource("mono.ico");
+ }
+ #endregion // Private & Internal Methods
+
+ #region Public Classes
+ public new class ControlCollection : Control.ControlCollection {
+ Form form_owner;
+
+ public ControlCollection(Form owner) : base(owner) {
+ this.form_owner = owner;
+ }
+
+ public override void Add(Control value) {
+ if (Contains (value))
+ return;
+ AddToList (value);
+ ((Form)value).owner=(Form)owner;
+ }
+
+ public override void Remove(Control value) {
+ ((Form)value).owner = null;
+ base.Remove (value);
+ }
+ }
+ #endregion // Public Classes
+
+ #region Public Constructor & Destructor
+ public Form ()
+ {
+ SizeF current_scale = GetAutoScaleSize (DeviceContext, Font);
+
+ autoscale = true;
+ autoscale_base_size = new Size ((int)current_scale.Width, (int) current_scale.Height);
+ allow_transparency = false;
+ closing = false;
+ is_modal = false;
+ dialog_result = DialogResult.None;
+ start_position = FormStartPosition.WindowsDefaultLocation;
+ form_border_style = FormBorderStyle.Sizable;
+ key_preview = false;
+ opacity = 1D;
+ menu = null;
+ icon = default_icon;
+ minimum_size = new Size(0, 0);
+ maximum_size = new Size(0, 0);
+ control_box = true;
+ minimize_box = true;
+ maximize_box = true;
+ help_button = false;
+ show_in_taskbar = true;
+ ime_mode = ImeMode.NoControl;
+ is_visible = false;
+ is_toplevel = true;
+ size_grip_style = SizeGripStyle.Auto;
+ maximized_bounds = Rectangle.Empty;
+ default_maximized_bounds = Rectangle.Empty;
+ owned_forms = new Form.ControlCollection(this);
+ transparency_key = Color.Empty;
+ }
+ #endregion // Public Constructor & Destructor
+
+ #region Public Static Properties
+
+ public static Form ActiveForm {
+ get {
+ Control active;
+
+ active = FromHandle(XplatUI.GetActive());
+
+ if (active != null) {
+ if ( !(active is Form)) {
+ Control parent;
+
+ parent = active.Parent;
+ while (parent != null) {
+ if (parent is Form) {
+ return (Form)parent;
+ }
+ parent = parent.Parent;
+ }
+ } else {
+ return (Form)active;
+ }
+ }
+ return null;
+ }
+ }
+
+ #endregion // Public Static Properties
+
+ #region Public Instance Properties
+ [DefaultValue(null)]
+ public IButtonControl AcceptButton {
+ get {
+ return accept_button;
+ }
+
+ set {
+ accept_button = value;
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool AllowTransparency {
+ get {
+ return allow_transparency;
+ }
+
+ set {
+ if (XplatUI.SupportsTransparency()) {
+ allow_transparency = value;
+
+ if (value) {
+ XplatUI.SetWindowTransparency(Handle, Opacity, TransparencyKey);
+ } else {
+ UpdateStyles(); // Remove the WS_EX_LAYERED style
+ }
+ }
+ }
+ }
+
+ [DefaultValue(true)]
+ public bool AutoScale {
+ get {
+ return autoscale;
+ }
+
+ set {
+ autoscale = value;
+ }
+ }
+
+ [Localizable(true)]
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public virtual Size AutoScaleBaseSize {
+ get {
+ return autoscale_base_size;
+ }
+
+ set {
+ autoscale_base_size = value;
+ }
+ }
+
+ [Localizable(true)]
+ public override bool AutoScroll {
+ get {
+ return base.AutoScroll;
+ }
+ set {
+ base.AutoScroll = value;
+ }
+ }
+
+ public override Color BackColor {
+ get {
+ return base.BackColor;
+ }
+ set {
+ base.BackColor = value;
+ }
+ }
+
+ [DefaultValue(null)]
+ public IButtonControl CancelButton {
+ get {
+ return cancel_button;
+ }
+
+ set {
+ cancel_button = value;
+ }
+ }
+
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ [Localizable(true)]
+ public Size ClientSize {
+ get {
+ return base.ClientSize;
+ }
+
+ set {
+ base.ClientSize = value;
+ }
+ }
+
+ [DefaultValue(true)]
+ public bool ControlBox {
+ get {
+ return control_box;
+ }
+
+ set {
+ if (control_box != value) {
+ control_box = value;
+ UpdateStyles();
+ }
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public Rectangle DesktopBounds {
+ get {
+ return new Rectangle(Location, Size);
+ }
+
+ set {
+ Bounds = value;
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public Point DesktopLocation {
+ get {
+ return Location;
+ }
+
+ set {
+ Location = value;
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public DialogResult DialogResult {
+ get {
+ return dialog_result;
+ }
+
+ set {
+ dialog_result = value;
+ if (is_modal) {
+ closing = true;
+ }
+ }
+ }
+
+ [DefaultValue(FormBorderStyle.Sizable)]
+ [DispId(-504)]
+ public FormBorderStyle FormBorderStyle {
+ get {
+ return form_border_style;
+ }
+ set {
+ form_border_style = value;
+
+ if (window_manager == null) {
+ if (IsHandleCreated) {
+ XplatUI.SetBorderStyle(window.Handle, form_border_style);
+ }
+
+ if (value == FormBorderStyle.FixedToolWindow ||
+ value == FormBorderStyle.SizableToolWindow)
+ window_manager = new InternalWindowManager (this);
+ } else {
+ window_manager.UpdateBorderStyle (value);
+ }
+
+ UpdateStyles();
+ }
+ }
+
+ [DefaultValue(false)]
+ public bool HelpButton {
+ get {
+ return help_button;
+ }
+
+ set {
+ if (help_button != value) {
+ help_button = value;
+ UpdateStyles();
+ }
+ }
+ }
+
+ [Localizable(true)]
+ [AmbientValue(null)]
+ public Icon Icon {
+ get {
+ return icon;
+ }
+
+ set {
+ if (icon != value) {
+ icon = value;
+
+ if (IsHandleCreated) {
+ XplatUI.SetIcon(Handle, icon == null ? default_icon : icon);
+ }
+ }
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool IsMdiChild {
+ get {
+ return mdi_parent != null;
+ }
+ }
+
+ [DefaultValue(false)]
+ public bool IsMdiContainer {
+ get {
+ return mdi_container != null;
+ }
+
+ set {
+ if (value && mdi_container == null) {
+ mdi_container = new MdiClient();
+ Controls.Add(mdi_container);
+ } else if (!value && mdi_container != null) {
+ Controls.Remove(mdi_container);
+ mdi_container.Dispose();
+ }
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public Form ActiveMdiChild {
+ get {
+ if (!IsMdiContainer)
+ return null;
+ return (Form) mdi_container.ActiveMdiChild;
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public bool IsRestrictedWindow {
+ get {
+ return false;
+ }
+ }
+
+ [DefaultValue(false)]
+ public bool KeyPreview {
+ get {
+ return key_preview;
+ }
+
+ set {
+ key_preview = value;
+ }
+ }
+
+ [DefaultValue(true)]
+ public bool MaximizeBox {
+ get {
+ return maximize_box;
+ }
+ set {
+ if (maximize_box != value) {
+ maximize_box = value;
+ UpdateStyles();
+ }
+ }
+ }
+
+ [DefaultValue("{Width=0, Height=0}")]
+ [Localizable(true)]
+ [RefreshProperties(RefreshProperties.Repaint)]
+ public Size MaximumSize {
+ get {
+ return maximum_size;
+ }
+
+ set {
+ if (maximum_size != value) {
+ maximum_size = value;
+ OnMaximumSizeChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public Form[] MdiChildren {
+ get {
+ if (mdi_container != null) {
+ Form[] form_list;
+
+ form_list = new Form[mdi_container.Controls.Count];
+ for (int i = 0; i < mdi_container.Controls.Count; i++) {
+ form_list[i] = (Form)mdi_container.Controls[i];
+ }
+ return form_list;
+ } else {
+ return new Form[0];
+ }
+ }
+ }
+
+ [MonoTODO("Finish setter")]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public Form MdiParent {
+ get {
+ return mdi_parent;
+ }
+
+ set {
+ SuspendLayout ();
+
+ // TopLevel = true;
+
+ if (!value.IsMdiContainer)
+ throw new ArgumentException ();
+
+ if (mdi_parent != null) {
+ mdi_parent.MdiContainer.Controls.Remove (this);
+ }
+
+ mdi_parent = value;
+ if (mdi_parent != null) {
+ window_manager = new MdiWindowManager (this,
+ mdi_parent.MdiContainer);
+ mdi_parent.MdiContainer.Controls.Add (this);
+ }
+
+ ResumeLayout ();
+ }
+ }
+
+ internal MdiClient MdiContainer {
+ get { return mdi_container; }
+ }
+
+ internal InternalWindowManager WindowManager {
+ get { return window_manager; }
+ }
+
+ [DefaultValue(null)]
+ public MainMenu Menu {
+ get {
+ return menu;
+ }
+
+ set {
+ if (menu != value) {
+ menu = value;
+
+ if (menu != null && !IsMdiChild) {
+ menu.SetForm (this);
+
+ if (IsHandleCreated) {
+ XplatUI.SetMenu (window.Handle, menu);
+ }
+
+ UpdateBounds (bounds.X, bounds.Y, bounds.Width, bounds.Height, ClientSize.Width, ClientSize.Height -
+ ThemeEngine.Current.CalcMenuBarSize (DeviceContext, menu, ClientSize.Width));
+ } else
+ UpdateBounds ();
+ }
+ }
+ }
+
+ public MainMenu MergedMenu {
+ get {
+ if (!IsMdiChild || window_manager == null)
+ return null;
+ return ((MdiWindowManager) window_manager).MergedMenu;
+ }
+ }
+
+ // This is the menu in display and being used because of merging this can
+ // be different then the menu that is actually assosciated with the form
+ internal MainMenu ActiveMenu {
+ get {
+ if (IsMdiChild)
+ return null;
+
+ Form amc = ActiveMdiChild;
+ if (amc == null || amc.Menu == null)
+ return menu;
+ return amc.MergedMenu;
+ }
+ }
+
+ [DefaultValue(true)]
+ public bool MinimizeBox {
+ get {
+ return minimize_box;
+ }
+ set {
+ if (minimize_box != value) {
+ minimize_box = value;
+ UpdateStyles();
+ }
+ }
+ }
+
+ [DefaultValue("{Width=0, Height=0}")]
+ [Localizable(true)]
+ [RefreshProperties(RefreshProperties.Repaint)]
+ public Size MinimumSize {
+ get {
+ return minimum_size;
+ }
+
+ set {
+ if (minimum_size != value) {
+ minimum_size = value;
+ OnMinimumSizeChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool Modal {
+ get {
+ return is_modal;
+ }
+ }
+
+ [DefaultValue(1D)]
+ [TypeConverter(typeof(OpacityConverter))]
+ public double Opacity {
+ get {
+ return opacity;
+ }
+
+ set {
+ opacity = value;
+
+ AllowTransparency = true;
+ UpdateStyles();
+ XplatUI.SetWindowTransparency(Handle, opacity, TransparencyKey);
+ }
+ }
+
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public Form[] OwnedForms {
+ get {
+ Form[] form_list;
+
+ form_list = new Form[owned_forms.Count];
+
+ for (int i=0; i<owned_forms.Count; i++) {
+ form_list[i] = (Form)owned_forms[i];
+ }
+
+ return form_list;
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public Form Owner {
+ get {
+ return owner;
+ }
+
+ set {
+ if (owner != value) {
+ if (owner != null) {
+ owner.RemoveOwnedForm(this);
+ }
+ owner = value;
+ owner.AddOwnedForm(this);
+ if (owner != null) {
+ XplatUI.SetTopmost(this.window.Handle, owner.window.Handle, true);
+ } else {
+ XplatUI.SetTopmost(this.window.Handle, IntPtr.Zero, false);
+ }
+ }
+ }
+ }
+
+ [DefaultValue(true)]
+ public bool ShowInTaskbar {
+ get {
+ return show_in_taskbar;
+ }
+ set {
+ if (show_in_taskbar != value) {
+ show_in_taskbar = value;
+ if (IsHandleCreated) {
+ RecreateHandle();
+ }
+ UpdateStyles();
+ }
+ }
+ }
+
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ [Localizable(false)]
+ public Size Size {
+ get {
+ return base.Size;
+ }
+
+ set {
+ base.Size = value;
+ }
+ }
+
+ [MonoTODO("Trigger something when GripStyle is set")]
+ [DefaultValue(SizeGripStyle.Auto)]
+ public SizeGripStyle SizeGripStyle {
+ get {
+ return size_grip_style;
+ }
+
+ set {
+ size_grip_style = value;
+ }
+ }
+
+ [DefaultValue(FormStartPosition.WindowsDefaultLocation)]
+ [Localizable(true)]
+ public FormStartPosition StartPosition {
+ get {
+ return start_position;
+ }
+
+ set {
+ if (start_position == FormStartPosition.WindowsDefaultLocation) { // Only do this if it's not set yet
+ start_position = value;
+ if (IsHandleCreated) {
+ switch(start_position) {
+ case FormStartPosition.CenterParent: {
+ CenterToParent();
+ break;
+ }
+
+ case FormStartPosition.CenterScreen: {
+ CenterToScreen();
+ break;
+ }
+
+ default: {
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int TabIndex {
+ get {
+ return base.TabIndex;
+ }
+
+ set {
+ base.TabIndex = value;
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public bool TopLevel {
+ get {
+ return GetTopLevel();
+ }
+
+ set {
+ if (!value && IsMdiContainer)
+ throw new ArgumentException ("MDI Container forms must be top level.");
+ SetTopLevel(value);
+ }
+ }
+
+ [DefaultValue(false)]
+ public bool TopMost {
+ get {
+ return topmost;
+ }
+
+ set {
+ if (topmost != value) {
+ topmost = value;
+ XplatUI.SetTopmost(window.Handle, owner != null ? owner.window.Handle : IntPtr.Zero, value);
+ }
+ }
+ }
+
+ public Color TransparencyKey {
+ get {
+ return transparency_key;
+ }
+
+ set {
+ transparency_key = value;
+
+ AllowTransparency = true;
+ UpdateStyles();
+ XplatUI.SetWindowTransparency(Handle, Opacity, transparency_key);
+ }
+ }
+
+ [DefaultValue(FormWindowState.Normal)]
+ public FormWindowState WindowState {
+ get {
+ return XplatUI.GetWindowState(Handle);
+ }
+
+ set {
+ XplatUI.SetWindowState(Handle, value);
+ }
+ }
+
+ #endregion // Public Instance Properties
+
+ #region Protected Instance Properties
+ [MonoTODO("Need to set start position properly")]
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams cp = new CreateParams ();
+
+ cp.Caption = Text;
+ cp.ClassName = XplatUI.DefaultClassName;
+ cp.ClassStyle = 0;
+ cp.Style = 0;
+ cp.ExStyle = 0;
+ cp.Param = 0;
+ cp.Parent = IntPtr.Zero;
+
+// if (start_position == FormStartPosition.WindowsDefaultLocation) {
+ cp.X = unchecked((int)0x80000000);
+ cp.Y = unchecked((int)0x80000000);
+// } else {
+// cp.X = Left;
+// cp.Y = Top;
+// }
+ cp.Width = Width;
+ cp.Height = Height;
+
+ cp.Style = (int)(WindowStyles.WS_CLIPCHILDREN | WindowStyles.WS_CLIPSIBLINGS | WindowStyles.WS_CAPTION);
+
+ if (IsMdiChild) {
+ cp.Style |= (int)WindowStyles.WS_CHILD;
+ cp.Parent = Parent.Handle;
+
+ cp.ExStyle |= (int) (WindowStyles.WS_EX_WINDOWEDGE | WindowStyles.WS_EX_MDICHILD);
+ switch (FormBorderStyle) {
+ case FormBorderStyle.None:
+ break;
+ case FormBorderStyle.FixedToolWindow:
+ case FormBorderStyle.SizableToolWindow:
+ cp.ExStyle |= (int) WindowStyles.WS_EX_TOOLWINDOW;
+ goto default;
+ default:
+ cp.Style |= (int) WindowStyles.WS_OVERLAPPEDWINDOW;
+ break;
+ }
+
+ } else {
+ switch (FormBorderStyle) {
+ case FormBorderStyle.Fixed3D: {
+ cp.Style |= (int)WindowStyles.WS_CAPTION;
+ cp.ExStyle |= (int)WindowStyles.WS_EX_OVERLAPPEDWINDOW;
+ break;
+ }
+
+ case FormBorderStyle.FixedDialog: {
+ cp.Style |= (int)WindowStyles.WS_CAPTION;
+ cp.ExStyle |= (int)(WindowStyles.WS_EX_DLGMODALFRAME | WindowStyles.WS_EX_WINDOWEDGE);
+ break;
+ }
+
+ case FormBorderStyle.FixedSingle: {
+ cp.Style |= (int)WindowStyles.WS_CAPTION;
+ cp.ExStyle |= (int)(WindowStyles.WS_EX_WINDOWEDGE);
+ break;
+ }
+
+ case FormBorderStyle.FixedToolWindow: {
+ cp.Style |= (int)WindowStyles.WS_CAPTION;
+ cp.ExStyle |= (int)(WindowStyles.WS_EX_WINDOWEDGE | WindowStyles.WS_EX_TOOLWINDOW);
+ break;
+ }
+
+ case FormBorderStyle.Sizable: {
+ cp.Style |= (int)WindowStyles.WS_OVERLAPPEDWINDOW;
+ cp.ExStyle |= (int)(WindowStyles.WS_EX_WINDOWEDGE);
+ break;
+ }
+
+ case FormBorderStyle.SizableToolWindow: {
+ cp.Style |= (int)WindowStyles.WS_OVERLAPPEDWINDOW;
+ cp.ExStyle |= (int)(WindowStyles.WS_EX_WINDOWEDGE | WindowStyles.WS_EX_TOOLWINDOW);
+ break;
+ }
+ }
+ }
+
+ if (ShowInTaskbar) {
+ cp.ExStyle |= (int)WindowStyles.WS_EX_APPWINDOW;
+ }
+
+ if (MaximizeBox) {
+ cp.Style |= (int)WindowStyles.WS_MAXIMIZEBOX;
+ }
+
+ if (MinimizeBox) {
+ cp.Style |= (int)WindowStyles.WS_MINIMIZEBOX;
+ }
+
+ if (ControlBox) {
+ cp.Style |= (int)WindowStyles.WS_SYSMENU;
+ }
+
+ if (HelpButton && !MaximizeBox && !MinimizeBox) {
+ cp.ExStyle |= (int)WindowStyles.WS_EX_CONTEXTHELP;
+ }
+
+ if (Visible)
+ cp.Style |= (int)WindowStyles.WS_VISIBLE;
+
+ if (Opacity < 1.0 || TransparencyKey != Color.Empty) {
+ cp.ExStyle |= (int)WindowStyles.WS_EX_LAYERED;
+ }
+
+ if (!is_enabled && context == null) {
+ cp.Style |= (int)(WindowStyles.WS_DISABLED);
+ }
+
+ return cp;
+ }
+ }
+
+ protected override ImeMode DefaultImeMode {
+ get {
+ return ImeMode.NoControl;
+ }
+ }
+
+ protected override Size DefaultSize {
+ get {
+ return new Size (250, 250);
+ }
+ }
+
+ protected Rectangle MaximizedBounds {
+ get {
+ if (maximized_bounds != Rectangle.Empty) {
+ return maximized_bounds;
+ }
+ return default_maximized_bounds;
+ }
+
+ set {
+ maximized_bounds = value;
+ OnMaximizedBoundsChanged(EventArgs.Empty);
+ }
+ }
+ #endregion // Protected Instance Properties
+
+ #region Public Static Methods
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public static SizeF GetAutoScaleSize (Font font)
+ {
+ return XplatUI.GetAutoScaleSize(font);
+ }
+
+ #endregion // Public Static Methods
+
+ #region Public Instance Methods
+ internal SizeF GetAutoScaleSize (Graphics g, Font font)
+ {
+ //
+ // The following constants come from the dotnet mailing list
+ // discussion: http://discuss.develop.com/archives/wa.exe?A2=ind0203A&L=DOTNET&P=R3655
+ //
+ // The magic number is "Its almost the length
+ // of the string with a smattering added in
+ // for compat with earlier code".
+ //
+
+ string magic_string = "The quick brown fox jumped over the lazy dog.";
+ double magic_number = 44.549996948242189;
+ float width = (float) (g.MeasureString (magic_string, font).Width / magic_number);
+
+ return new SizeF (width, font.Height);
+ }
+
+ public void Activate() {
+ Form active;
+
+ // The docs say activate only activates if our app is already active
+ active = ActiveForm;
+ if ((active != null) && (this != active)) {
+ XplatUI.Activate(window.Handle);
+ }
+ }
+
+ public void AddOwnedForm(Form ownedForm) {
+ owned_forms.Add(ownedForm);
+ }
+
+ public void Close () {
+ if (!IsDisposed) {
+ XplatUI.SendMessage(this.Handle, Msg.WM_CLOSE, IntPtr.Zero, IntPtr.Zero);
+ }
+ }
+
+ public void LayoutMdi(MdiLayout value) {
+ if (mdi_container != null) {
+ mdi_container.LayoutMdi(value);
+ }
+ }
+
+ public void RemoveOwnedForm(Form ownedForm) {
+ owned_forms.Remove(ownedForm);
+ }
+
+ public void SetDesktopBounds(int x, int y, int width, int height) {
+ DesktopBounds = new Rectangle(x, y, width, height);
+ }
+
+ public void SetDesktopLocation(int x, int y) {
+ DesktopLocation = new Point(x, y);
+ }
+
+ public DialogResult ShowDialog() {
+ return ShowDialog(null);
+ }
+
+ public DialogResult ShowDialog(IWin32Window ownerWin32) {
+ Form previous;
+
+ if (ownerWin32 != null) {
+ owner = (Form)Control.FromHandle(ownerWin32.Handle);
+ }
+
+ if (owner == this) {
+ throw new InvalidOperationException("The 'ownerWin32' cannot be the form being shown.");
+ }
+
+ if (is_modal) {
+ throw new InvalidOperationException("The form is already displayed as a modal dialog.");
+ }
+
+ if (Visible) {
+ throw new InvalidOperationException("Already visible forms cannot be displayed as a modal dialog. Set the Visible property to 'false' prior to calling Form.ShowDialog.");
+ }
+
+ if (!Enabled) {
+ throw new InvalidOperationException("Cannot display a disabled form as modal dialog.");
+ }
+
+ if (TopLevelControl != this) {
+ throw new InvalidOperationException("Can only display TopLevel forms as modal dialog.");
+ }
+
+ #if broken
+ // Can't do this, will screw us in the modal loop
+ form_parent_window.Parent = this.owner;
+ #endif
+
+ previous = Form.ActiveForm;
+
+ if (!IsHandleCreated) {
+ CreateControl();
+ }
+
+ Application.RunLoop(true, new ApplicationContext(this));
+
+ if (previous != null) {
+ // Cannot use Activate(), it has a check for the current active window...
+ XplatUI.Activate(previous.window.Handle);
+ }
+
+ return DialogResult;
+ }
+
+ public override string ToString() {
+ return GetType().FullName.ToString() + ", Text: " + Text;
+ }
+ #endregion // Public Instance Methods
+
+ #region Protected Instance Methods
+ [MonoTODO("Finish when MDI is more complete")]
+ protected void ActivateMdiChild(Form form) {
+ OnMdiChildActivate(EventArgs.Empty);
+ throw new NotImplementedException();
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected override void AdjustFormScrollbars(bool displayScrollbars) {
+ base.AdjustFormScrollbars (displayScrollbars);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected void ApplyAutoScaling()
+ {
+ SizeF current_size_f = GetAutoScaleSize (DeviceContext, Font);
+ Size current_size = new Size ((int) current_size_f.Width, (int) current_size_f.Height);
+
+ if (current_size == autoscale_base_size)
+ return;
+
+ if (Environment.GetEnvironmentVariable ("MONO_MWF_SCALING") == "disable"){
+ Console.WriteLine ("Not scaling");
+ return;
+ }
+
+ //
+ // I tried applying the Fudge height factor from:
+ // http://blogs.msdn.com/mharsh/archive/2004/01/25/62621.aspx
+ // but it makes things larger without looking better.
+ //
+ Scale (current_size_f.Width / AutoScaleBaseSize.Width,
+ current_size_f.Height / AutoScaleBaseSize.Height);
+
+ AutoScaleBaseSize = current_size;
+ }
+
+ protected void CenterToParent() {
+ Control ctl;
+ int w;
+ int h;
+
+ if (Width > 0) {
+ w = Width;
+ } else {
+ w = DefaultSize.Width;
+ }
+
+ if (Height > 0) {
+ h = Height;
+ } else {
+ h = DefaultSize.Height;
+ }
+
+ ctl = null;
+ if (parent != null) {
+ ctl = parent;
+ } else if (owner != null) {
+ ctl = owner;
+ }
+
+ if (owner != null) {
+ this.Location = new Point(ctl.Left + ctl.Width / 2 - w /2, ctl.Top + ctl.Height / 2 - h / 2);
+ }
+ }
+
+ protected void CenterToScreen() {
+ Size DisplaySize;
+ int w;
+ int h;
+
+ if (Width > 0) {
+ w = Width;
+ } else {
+ w = DefaultSize.Width;
+ }
+
+ if (Height > 0) {
+ h = Height;
+ } else {
+ h = DefaultSize.Height;
+ }
+
+ XplatUI.GetDisplaySize(out DisplaySize);
+ this.Location = new Point(DisplaySize.Width / 2 - w / 2, DisplaySize.Height / 2 - h / 2);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected override Control.ControlCollection CreateControlsInstance() {
+ return base.CreateControlsInstance ();
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected override void CreateHandle() {
+ base.CreateHandle ();
+ if (icon != null) {
+ XplatUI.SetIcon(window.Handle, icon);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected override void DefWndProc(ref Message m) {
+ base.DefWndProc (ref m);
+ }
+
+ protected override void Dispose(bool disposing) {
+ base.Dispose (disposing);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnActivated(EventArgs e) {
+ if (Activated != null) {
+ Activated(this, e);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnClosed(EventArgs e) {
+ if (Closed != null) {
+ Closed(this, e);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnClosing(System.ComponentModel.CancelEventArgs e) {
+ if (Closing != null) {
+ Closing(this, e);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected override void OnCreateControl() {
+ base.OnCreateControl ();
+ if (this.ActiveControl == null) {
+ bool visible;
+
+ // This visible hack is to work around CanSelect always being false if one of the parents
+ // is not visible; and we by default create Form invisible...
+ visible = this.is_visible;
+ this.is_visible = true;
+
+ if (SelectNextControl(this, true, true, true, true) == false) {
+ Select(this);
+ }
+
+ this.is_visible = visible;
+ }
+
+ if (!IsMdiChild) {
+ switch (StartPosition) {
+ case FormStartPosition.CenterScreen:
+ this.CenterToScreen();
+ break;
+ case FormStartPosition.CenterParent:
+ this.CenterToParent ();
+ break;
+ }
+ } else {
+ Left = 25 * MdiParent.MdiContainer.ChildrenCreated + 1;
+ Top = 25 * MdiParent.MdiContainer.ChildrenCreated + 1;
+ MdiParent.MdiContainer.ChildrenCreated++;
+ }
+
+ if (menu != null) {
+ XplatUI.SetMenu(window.Handle, menu);
+ }
+
+ OnLoad(EventArgs.Empty);
+
+ // Send initial location
+ OnLocationChanged(EventArgs.Empty);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnDeactivate(EventArgs e) {
+ if (Deactivate != null) {
+ Deactivate(this, e);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected override void OnFontChanged(EventArgs e) {
+ base.OnFontChanged (e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected override void OnHandleCreated(EventArgs e) {
+ XplatUI.SetBorderStyle(window.Handle, form_border_style);
+ base.OnHandleCreated (e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected override void OnHandleDestroyed(EventArgs e) {
+ base.OnHandleDestroyed (e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnInputLanguageChanged(InputLanguageChangedEventArgs e) {
+ if (InputLanguageChanged!=null) {
+ InputLanguageChanged(this, e);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnInputLanguageChanging(InputLanguageChangingEventArgs e) {
+ if (InputLanguageChanging!=null) {
+ InputLanguageChanging(this, e);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnLoad(EventArgs e) {
+ if (Load != null) {
+ Load(this, e);
+ }
+ if (AutoScale){
+ ApplyAutoScaling ();
+ AutoScale = false;
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnMaximizedBoundsChanged(EventArgs e) {
+ if (MaximizedBoundsChanged != null) {
+ MaximizedBoundsChanged(this, e);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnMaximumSizeChanged(EventArgs e) {
+ if (MaximumSizeChanged != null) {
+ MaximumSizeChanged(this, e);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnMdiChildActivate(EventArgs e) {
+ if (MdiChildActivate != null) {
+ MdiChildActivate(this, e);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnMenuComplete(EventArgs e) {
+ if (MenuComplete != null) {
+ MenuComplete(this, e);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnMenuStart(EventArgs e) {
+ if (MenuStart != null) {
+ MenuStart(this, e);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnMinimumSizeChanged(EventArgs e) {
+ if (MinimumSizeChanged != null) {
+ MinimumSizeChanged(this, e);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected override void OnPaint (PaintEventArgs pevent) {
+ base.OnPaint (pevent);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected override void OnResize(EventArgs e) {
+ base.OnResize(e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected override void OnStyleChanged(EventArgs e) {
+ base.OnStyleChanged (e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected override void OnTextChanged(EventArgs e) {
+ base.OnTextChanged (e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected override void OnVisibleChanged(EventArgs e) {
+ base.OnVisibleChanged (e);
+ }
+
+ protected override bool ProcessCmdKey(ref Message msg, Keys keyData) {
+ if (base.ProcessCmdKey (ref msg, keyData)) {
+ return true;
+ }
+
+ // Give our menu a shot
+ if (ActiveMenu != null) {
+ return ActiveMenu.ProcessCmdKey(ref msg, keyData);
+ }
+
+ return false;
+ }
+
+ // LAMESPEC - Not documented that Form overrides ProcessDialogChar; class-status showed
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ protected override bool ProcessDialogChar(char charCode) {
+ return base.ProcessDialogChar (charCode);
+ }
+
+ protected override bool ProcessDialogKey(Keys keyData) {
+ if ((keyData & Keys.Modifiers) == 0) {
+ if (keyData == Keys.Enter && accept_button != null) {
+ accept_button.PerformClick();
+ return true;
+ } else if (keyData == Keys.Escape && cancel_button != null) {
+ cancel_button.PerformClick();
+ return true;
+ }
+ }
+ return base.ProcessDialogKey(keyData);
+ }
+
+ protected override bool ProcessKeyPreview(ref Message msg) {
+ if (key_preview) {
+ if (ProcessKeyEventArgs(ref msg)) {
+ return true;
+ }
+ }
+ return base.ProcessKeyPreview (ref msg);
+ }
+
+ protected override bool ProcessTabKey(bool forward) {
+ return SelectNextControl(ActiveControl, forward, true, true, true);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected override void ScaleCore(float dx, float dy) {
+ base.ScaleCore (dx, dy);
+ }
+
+ protected override void Select(bool directed, bool forward) {
+ Form parent;
+
+ if (directed) {
+ base.SelectNextControl(null, forward, true, true, true);
+ }
+
+ parent = this.ParentForm;
+ if (parent != null) {
+ parent.ActiveControl = this;
+ }
+
+ Activate();
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified) {
+ base.SetBoundsCore (x, y, width, height, specified);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected override void SetClientSizeCore(int x, int y) {
+ if ((minimum_size.Width != 0) && (x < minimum_size.Width)) {
+ x = minimum_size.Width;
+ } else if ((maximum_size.Width != 0) && (x > maximum_size.Width)) {
+ x = maximum_size.Width;
+ }
+
+ if ((minimum_size.Height != 0) && (y < minimum_size.Height)) {
+ y = minimum_size.Height;
+ } else if ((maximum_size.Height != 0) && (y > maximum_size.Height)) {
+ y = maximum_size.Height;
+ }
+
+ Rectangle ClientRect = new Rectangle(0, 0, x, y);
+ Rectangle WindowRect;
+ CreateParams cp = this.CreateParams;
+
+ if (XplatUI.CalculateWindowRect(Handle, ref ClientRect, cp.Style, cp.ExStyle, ActiveMenu, out WindowRect) )
+ SetBoundsCore(bounds.X, bounds.Y, WindowRect.Width, WindowRect.Height, BoundsSpecified.Size);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected override void SetVisibleCore(bool value) {
+ base.SetVisibleCore (value);
+ }
+
+ protected override void UpdateDefaultButton() {
+ base.UpdateDefaultButton ();
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected override void WndProc(ref Message m) {
+
+ if (window_manager != null && window_manager.HandleMessage (ref m)) {
+ return;
+ }
+
+ switch((Msg)m.Msg) {
+ case Msg.WM_DESTROY: {
+ base.WndProc(ref m);
+ this.closing = true;
+ return;
+ }
+
+ case Msg.WM_CLOSE_INTERNAL: {
+ DestroyHandle();
+ break;
+ }
+
+ case Msg.WM_CLOSE: {
+ if (!is_modal) {
+ CancelEventArgs args = new CancelEventArgs ();
+
+ OnClosing (args);
+ if (!args.Cancel) {
+ OnClosed (EventArgs.Empty);
+ DestroyHandle();
+ }
+ return;
+ } else {
+ closing = true;
+ }
+ return;
+ }
+
+ case Msg.WM_ACTIVATE: {
+ if (m.WParam != (IntPtr)WindowActiveFlags.WA_INACTIVE) {
+ OnActivated(EventArgs.Empty);
+ } else {
+ OnDeactivate(EventArgs.Empty);
+ }
+ return;
+ }
+
+ case Msg.WM_KILLFOCUS: {
+ base.WndProc(ref m);
+ return;
+ }
+
+ case Msg.WM_SETFOCUS: {
+ if (ActiveControl != null && ActiveControl != this) {
+ ActiveControl.Focus();
+ return; // FIXME - do we need to run base.WndProc, even though we just changed focus?
+ }
+ base.WndProc(ref m);
+ return;
+ }
+
+ // Menu drawing
+ case Msg.WM_NCLBUTTONDOWN: {
+ if (ActiveMenu != null) {
+ ActiveMenu.OnMouseDown(this, new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()), mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()), 0));
+ }
+ base.WndProc(ref m);
+ return;
+ }
+
+ case Msg.WM_NCMOUSEMOVE: {
+ if (ActiveMenu != null) {
+ ActiveMenu.OnMouseMove(this, new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()), mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()), 0));
+ }
+ base.WndProc(ref m);
+ return;
+ }
+
+ case Msg.WM_NCPAINT: {
+ if (ActiveMenu != null) {
+ Point pnt = XplatUI.GetMenuOrigin(window.Handle);
+
+ ActiveMenu.Draw (new Rectangle (pnt.X, pnt.Y, ClientSize.Width, 0));
+ }
+
+ base.WndProc(ref m);
+ return;
+ }
+
+ case Msg.WM_NCCALCSIZE: {
+ XplatUIWin32.NCCALCSIZE_PARAMS ncp;
+
+ if ((ActiveMenu != null) && (m.WParam == (IntPtr)1)) {
+ ncp = (XplatUIWin32.NCCALCSIZE_PARAMS)Marshal.PtrToStructure(m.LParam, typeof(XplatUIWin32.NCCALCSIZE_PARAMS));
+
+ // Adjust for menu
+ ncp.rgrc1.top += ThemeEngine.Current.CalcMenuBarSize (DeviceContext, menu, ClientSize.Width);
+ Marshal.StructureToPtr(ncp, m.LParam, true);
+ }
+ DefWndProc(ref m);
+ break;
+ }
+
+ case Msg.WM_GETMINMAXINFO: {
+ XplatUIWin32.MINMAXINFO mmi;
+
+ if (m.LParam != IntPtr.Zero) {
+ mmi = (XplatUIWin32.MINMAXINFO)Marshal.PtrToStructure(m.LParam, typeof(XplatUIWin32.MINMAXINFO));
+ default_maximized_bounds = new Rectangle(mmi.ptMaxPosition.x, mmi.ptMaxPosition.y, mmi.ptMaxSize.x, mmi.ptMaxSize.y);
+ if (maximized_bounds != Rectangle.Empty) {
+ mmi.ptMaxSize.x = maximized_bounds.Width;
+ mmi.ptMaxSize.y = maximized_bounds.Height;
+ }
+
+ Marshal.StructureToPtr(mmi, m.LParam, false);
+ }
+ break;
+ }
+
+ default: {
+ base.WndProc (ref m);
+ break;
+ }
+ }
+ }
+ #endregion // Protected Instance Methods
+
+ internal void RemoveWindowManager ()
+ {
+ window_manager = null;
+ }
+
+ #region Events
+ public event EventHandler Activated;
+ public event EventHandler Closed;
+ public event CancelEventHandler Closing;
+ public event EventHandler Deactivate;
+ public event InputLanguageChangedEventHandler InputLanguageChanged;
+ public event InputLanguageChangingEventHandler InputLanguageChanging;
+ public event EventHandler Load;
+ public event EventHandler MaximizedBoundsChanged;
+ public event EventHandler MaximumSizeChanged;
+ public event EventHandler MdiChildActivate;
+ public event EventHandler MenuComplete;
+ public event EventHandler MenuStart;
+ public event EventHandler MinimumSizeChanged;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler TabIndexChanged;
+ #endregion // Events
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FormBorderStyle.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FormBorderStyle.cs
new file mode 100644
index 00000000000..5429f7468ec
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FormBorderStyle.cs
@@ -0,0 +1,43 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Ravindra (rkumar@novell.com)
+//
+
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms
+{
+ [ComVisible (true)]
+ [Serializable]
+ public enum FormBorderStyle
+ {
+ None = 0,
+ FixedSingle = 1,
+ Fixed3D = 2,
+ FixedDialog = 3,
+ Sizable = 4,
+ FixedToolWindow = 5,
+ SizableToolWindow = 6
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FormStartPosition.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FormStartPosition.cs
new file mode 100644
index 00000000000..7c98700d80b
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FormStartPosition.cs
@@ -0,0 +1,40 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Ravindra (rkumar@novell.com)
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms
+{
+ [ComVisible (true)]
+ [Serializable]
+ public enum FormStartPosition
+ {
+ Manual = 0,
+ CenterScreen = 1,
+ WindowsDefaultLocation = 2,
+ WindowsDefaultBounds = 3,
+ CenterParent = 4
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FormWindowState.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FormWindowState.cs
new file mode 100644
index 00000000000..84145d246ef
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FormWindowState.cs
@@ -0,0 +1,39 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Ravindra (rkumar@novell.com)
+//
+
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms
+{
+ [ComVisible (true)]
+ [Serializable]
+ public enum FormWindowState
+ {
+ Normal = 0,
+ Minimized = 1,
+ Maximized = 2
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FrameStyle.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FrameStyle.cs
new file mode 100644
index 00000000000..f80ef0b655f
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FrameStyle.cs
@@ -0,0 +1,34 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public enum FrameStyle {
+ Dashed = 0,
+ Thick = 1
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GiveFeedbackEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GiveFeedbackEventArgs.cs
new file mode 100644
index 00000000000..940259e1d10
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GiveFeedbackEventArgs.cs
@@ -0,0 +1,62 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [ComVisible(true)]
+ public class GiveFeedbackEventArgs : EventArgs {
+ internal DragDropEffects effect;
+ internal bool use_default_cursors;
+
+ #region Public Constructors
+ public GiveFeedbackEventArgs(DragDropEffects effect, bool useDefaultCursors) {
+ this.effect=effect;
+ this.use_default_cursors=useDefaultCursors;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public DragDropEffects Effect {
+ get {
+ return this.effect;
+ }
+ }
+
+ public bool UseDefaultCursors {
+ get {
+ return this.use_default_cursors;
+ }
+
+ set {
+ this.use_default_cursors=value;
+ }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GiveFeedbackEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GiveFeedbackEventHandler.cs
new file mode 100644
index 00000000000..3ffd9e29531
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GiveFeedbackEventHandler.cs
@@ -0,0 +1,32 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public delegate void GiveFeedbackEventHandler (object sender, GiveFeedbackEventArgs e);
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridColumnStylesCollection.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridColumnStylesCollection.cs
new file mode 100644
index 00000000000..ed3aa7982bf
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridColumnStylesCollection.cs
@@ -0,0 +1,273 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Jordi Mas i Hernandez <jordi@ximian.com>
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Windows.Forms
+{
+ [Editor("System.Windows.Forms.Design.DataGridColumnCollectionEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
+ [ListBindable(false)]
+ public class GridColumnStylesCollection : BaseCollection, IList
+ {
+ private ArrayList items;
+ private DataGridTableStyle owner;
+ private bool fire_event;
+
+ internal GridColumnStylesCollection (DataGridTableStyle tablestyle)
+ {
+ items = new ArrayList ();
+ owner = tablestyle;
+ fire_event = true;
+ }
+
+ #region Public Instance Properties
+ public DataGridColumnStyle this [string columnName] {
+ get {
+ int idx = FromColumnNameToIndex (columnName);
+ return idx == -1 ? null : this [idx];
+ }
+ }
+
+ public DataGridColumnStyle this [int index] {
+ get {
+ return (DataGridColumnStyle) items[index];
+ }
+ }
+
+
+ public DataGridColumnStyle this [PropertyDescriptor propDesc] {
+ get {
+ for (int i = 0; i < items.Count; i++) {
+ DataGridColumnStyle column = (DataGridColumnStyle) items[i];
+ if (column.PropertyDescriptor.Equals (propDesc)) {
+ return column;
+ }
+ }
+
+ return null;
+ }
+ }
+
+ protected override ArrayList List {
+ get { return items; }
+ }
+
+ int ICollection.Count {
+ get { return items.Count;}
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return false; }
+ }
+
+ object ICollection.SyncRoot {
+ get { return this;}
+ }
+
+ bool IList.IsFixedSize {
+ get { return false; }
+ }
+
+ bool IList.IsReadOnly {
+ get { return false;}
+ }
+
+ object IList.this [int index] {
+ get {
+ return items[index];
+ }
+ set {
+ throw new NotSupportedException ();
+ }
+ }
+
+ #endregion Public Instance Properties
+
+ #region Private Instance Properties
+ internal bool FireEvents {
+ get { return fire_event;}
+ set { fire_event = value;}
+ }
+ #endregion Private Instance Properties
+
+ #region Public Instance Methods
+ public virtual int Add (DataGridColumnStyle column)
+ {
+ int cnt = AddInternal (column);
+ return cnt;
+ }
+
+ public void AddRange (DataGridColumnStyle[] columns)
+ {
+ foreach (DataGridColumnStyle mi in columns)
+ AddInternal (mi);
+ }
+
+ public void Clear ()
+ {
+ items.Clear ();
+ OnCollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Refresh , null));
+ }
+
+ public bool Contains (DataGridColumnStyle column)
+ {
+ return (FromColumnNameToIndex (column.MappingName) != -1);
+ }
+
+ public bool Contains (PropertyDescriptor propDesc)
+ {
+ return (this [propDesc] != null);
+ }
+
+ public bool Contains (string name)
+ {
+ return (FromColumnNameToIndex (name) != -1);
+ }
+
+ void ICollection.CopyTo (Array dest, int index)
+ {
+ items.CopyTo (dest, index);
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return items.GetEnumerator ();
+ }
+
+ int IList.Add (object value)
+ {
+ return AddInternal ((DataGridColumnStyle)value);
+ }
+
+ void IList.Clear ()
+ {
+ items.Clear ();
+ OnCollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Refresh , null));
+ }
+
+ bool IList.Contains (object value)
+ {
+ return items.Contains (value);
+ }
+
+ int IList.IndexOf (object value)
+ {
+ return items.IndexOf (value);
+ }
+
+ void IList.Insert (int index, object value)
+ {
+ throw new NotSupportedException ();
+ }
+
+ void IList.Remove (object value)
+ {
+ items.Remove (value);
+ }
+
+ void IList.RemoveAt (int index)
+ {
+ object item = items[index];
+
+ items.RemoveAt (index);
+ OnCollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Remove, item));
+ }
+
+ public int IndexOf (DataGridColumnStyle element)
+ {
+ return items.IndexOf (element);
+ }
+
+ protected void OnCollectionChanged (CollectionChangeEventArgs ccevent)
+ {
+ if (fire_event == true && CollectionChanged != null) {
+ CollectionChanged (this, ccevent);
+ }
+ }
+
+ public void Remove (DataGridColumnStyle column)
+ {
+ items.Remove (column);
+ OnCollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Remove, column));
+ }
+
+ public void RemoveAt (int index)
+ {
+ object item = items[index];
+ items.RemoveAt (index);
+ OnCollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Remove, item));
+ }
+
+ public void ResetPropertyDescriptors ()
+ {
+ for (int i = 0; i < items.Count; i++) {
+ DataGridColumnStyle column = (DataGridColumnStyle) items[i];
+ if (column.PropertyDescriptor != null) {
+ column.PropertyDescriptor = null;
+ }
+ }
+ }
+
+ #endregion Public Instance Methods
+
+ #region Events
+ public event CollectionChangeEventHandler CollectionChanged;
+ #endregion Events
+
+ #region Private Instance Methods
+ private int AddInternal (DataGridColumnStyle column)
+ {
+ // TODO: MS allows duplicate columns. How they diferenciate between them?
+ if (FromColumnNameToIndex (column.MappingName) != -1) {
+ throw new ArgumentException ("The ColumnStyles collection already has a column with this mapping name");
+ }
+
+ column.TableStyle = owner;
+ int cnt = items.Add (column);
+ OnCollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Add, column));
+ return cnt;
+ }
+
+ private int FromColumnNameToIndex (string columnName)
+ {
+ for (int i = 0; i < items.Count; i++) {
+ DataGridColumnStyle column = (DataGridColumnStyle) items[i];
+
+ if (column.MappingName == null || column.MappingName == string.Empty)
+ continue;
+
+ if (String.Compare (column.MappingName, columnName, true) == 0) {
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+ #endregion Private Instance Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridEntry.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridEntry.cs
new file mode 100644
index 00000000000..cc8e38950b4
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridEntry.cs
@@ -0,0 +1,167 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Jonathan Chambers (jonathan.chambers@ansys.com)
+//
+
+// NOT COMPLETE
+
+using System;
+using System.Windows.Forms;
+using System.ComponentModel;
+using System.Drawing;
+
+namespace System.Windows.Forms.PropertyGridInternal
+{
+ internal class GridEntry : GridItem
+ {
+ #region Local Variables
+ private bool expanded = true;
+ private GridItemCollection grid_items;
+ private GridItem parent;
+ private PropertyDescriptor property_descriptor;
+ private object selected_object;
+ private string label;
+ private int top;
+ private Rectangle plus_minus_bounds;
+ private Rectangle bounds;
+ #endregion // Local Variables
+
+ #region Contructors
+ public GridEntry() : base() {
+ plus_minus_bounds = new Rectangle(0,0,0,0);
+ bounds = new Rectangle(0,0,0,0);
+ top = -1;
+ grid_items = new GridItemCollection();
+ }
+
+ public GridEntry(object obj, PropertyDescriptor prop_desc) : this() {
+ selected_object = obj;
+ property_descriptor = prop_desc;
+ }
+ #endregion // Constructors
+
+ #region Public Instance Properties
+ public override bool Expandable
+ {
+ get {
+ return grid_items.Count > 0;
+ }
+ }
+
+ public override bool Expanded
+ {
+ get {
+ return expanded;
+ }
+
+ set {
+ expanded = value;
+ }
+ }
+
+ public override System.Windows.Forms.GridItemCollection GridItems
+ {
+ get {
+ return grid_items;
+ }
+ }
+
+ public override System.Windows.Forms.GridItemType GridItemType
+ {
+ get {
+ return GridItemType.Property;
+ }
+ }
+
+ public override string Label
+ {
+ get {
+ return property_descriptor.Name;
+ }
+ }
+
+ public override System.Windows.Forms.GridItem Parent
+ {
+ get {
+ return parent;
+ }
+ }
+
+ public override System.ComponentModel.PropertyDescriptor PropertyDescriptor
+ {
+ get {
+ return property_descriptor;
+ }
+ }
+
+ public override object Value
+ {
+ get {
+ object return_value = null;
+ if (selected_object != null)
+ return_value = property_descriptor.GetValue(selected_object);
+ return return_value;
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Instance Methods
+ [MonoTODO]
+ public override bool Select () {
+ throw new NotImplementedException();
+ }
+ #endregion // Public Instance Methods
+
+ internal override int Top {
+ get {
+ return top;
+ }
+ set {
+ top = value;
+ }
+ }
+
+ internal override Rectangle PlusMinusBounds {
+ get{
+ return plus_minus_bounds;
+ }
+ set{
+ plus_minus_bounds = value;
+ }
+ }
+
+ internal override Rectangle Bounds
+ {
+ get
+ {
+ return bounds;
+ }
+ set
+ {
+ bounds = value;
+ }
+ }
+
+
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridItem.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridItem.cs
new file mode 100644
index 00000000000..246ec173cf8
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridItem.cs
@@ -0,0 +1,120 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Jonathan Chambers (jonathan.chambers@ansys.com)
+//
+
+// NOT COMPLETE
+
+using System;
+using System.Drawing;
+
+namespace System.Windows.Forms
+{
+ public abstract class GridItem
+ {
+
+ #region Fields
+ private bool expanded;
+ #endregion Fields
+
+ #region Constructors
+ protected GridItem()
+ {
+ expanded = false;
+ }
+ #endregion // Constructors
+
+ #region Public Instance Properties
+ public virtual bool Expandable
+ {
+ get {
+ return GridItems.Count > 1;
+ }
+ }
+
+ public virtual bool Expanded
+ {
+ get {
+ return expanded;
+ }
+
+ set {
+ expanded = value;
+ }
+ }
+
+ public abstract new System.Windows.Forms.GridItemCollection GridItems
+ {
+ get;
+ }
+
+ public abstract new System.Windows.Forms.GridItemType GridItemType
+ {
+ get;
+ }
+
+ public abstract new string Label
+ {
+ get;
+ }
+
+
+ public abstract new System.Windows.Forms.GridItem Parent
+ {
+ get;
+ }
+
+
+ public abstract new System.ComponentModel.PropertyDescriptor PropertyDescriptor
+ {
+ get;
+ }
+
+ public abstract new object Value
+ {
+ get;
+ }
+ #endregion
+
+ #region Public Instance Methods
+ public abstract new bool Select ();
+ #endregion // Public Instance Methods
+
+ internal abstract int Top {
+ get;
+ set;
+ }
+
+ internal abstract Rectangle PlusMinusBounds {
+ get;
+ set;
+ }
+
+ internal abstract Rectangle Bounds
+ {
+ get;
+ set;
+ }
+
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridItemCollection.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridItemCollection.cs
new file mode 100644
index 00000000000..fd222e75b0f
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridItemCollection.cs
@@ -0,0 +1,141 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Jonathan Chambers (jonathan.chambers@ansys.com)
+//
+
+// COMPLETE
+
+using System;
+using System.Collections;
+
+namespace System.Windows.Forms
+{
+ public class GridItemCollection : IEnumerable, ICollection
+ {
+ #region Local Variables
+ private System.Collections.SortedList list;
+ #endregion // Local Variables
+
+ #region Public Static Fields
+ public static GridItemCollection Empty = new GridItemCollection();
+ #endregion // Public Static Fields
+
+ #region Constructors
+ internal GridItemCollection()
+ {
+ list = new SortedList();
+ }
+ #endregion // Constructors
+
+ #region Internal Properties and Methods
+ internal void Add(string key, GridItem grid_item)
+ {
+ list.Add(key,grid_item);
+ }
+ #endregion // Internal Properties and Methods
+
+ #region Public Instance Properties
+ public int Count
+ {
+ get {
+ return list.Count;
+ }
+ }
+
+ public GridItem this [int index]
+ {
+ get {
+ if (index>=list.Count) {
+ throw new ArgumentOutOfRangeException("index");
+ }
+ return (GridItem)list.GetByIndex(index);
+ }
+ }
+
+ public GridItem this [string key]
+ {
+ get {
+ return (GridItem)list[key];
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region IEnumerable Members
+ public IEnumerator GetEnumerator()
+ {
+ return new GridItemEnumerator(this);
+ }
+ #endregion
+
+ #region Enumerator Class
+ internal class GridItemEnumerator : IEnumerator{
+ int nIndex;
+ GridItemCollection collection;
+ public GridItemEnumerator(GridItemCollection coll) {
+ collection = coll;
+ nIndex = -1;
+ }
+
+ public bool MoveNext() {
+ nIndex++;
+ return(nIndex < collection.Count);
+ }
+
+ public void Reset() {
+ nIndex = -1;
+ }
+
+ object System.Collections.IEnumerator.Current {
+ get {
+ return(collection[nIndex]);
+ }
+ }
+ }
+ #endregion
+
+ #region ICollection Members
+
+ bool ICollection.IsSynchronized
+ {
+ get
+ {
+ return list.IsSynchronized;
+ }
+ }
+
+ void ICollection.CopyTo(Array array, int index)
+ {
+ list.CopyTo(array, index);
+ }
+
+ object ICollection.SyncRoot
+ {
+ get
+ {
+ return list.SyncRoot;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridItemType.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridItemType.cs
new file mode 100644
index 00000000000..2d9636215fb
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridItemType.cs
@@ -0,0 +1,39 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jonathan Chambers (jonathan.chambers@ansys.com)
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms
+{
+ [Serializable]
+ public enum GridItemType
+ {
+ Property = 0,
+ Category = 1,
+ ArrayValue = 2,
+ Root = 3
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridTableStylesCollection.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridTableStylesCollection.cs
new file mode 100644
index 00000000000..26c1116a49b
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridTableStylesCollection.cs
@@ -0,0 +1,237 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Jordi Mas i Hernandez <jordi@ximian.com>
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Windows.Forms
+{
+ [ListBindable(false)]
+ public class GridTableStylesCollection : BaseCollection, IList
+ {
+ private ArrayList items;
+ private DataGrid owner;
+
+ internal GridTableStylesCollection (DataGrid grid)
+ {
+ items = new ArrayList ();
+ owner = grid;
+ }
+
+ #region Public Instance Properties
+ public DataGridTableStyle this[string tableName] {
+ get {
+ int idx = FromTableNameToIndex (tableName);
+ return idx == -1 ? null : this [idx];
+ }
+ }
+
+ public DataGridTableStyle this[int index] {
+ get {
+ return (DataGridTableStyle) items[index];
+ }
+ }
+
+ protected override ArrayList List {
+ get { return items; }
+ }
+
+ int ICollection.Count {
+ get { return items.Count;}
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return false; }
+ }
+
+ object ICollection.SyncRoot {
+ get { return this;}
+ }
+
+ bool IList.IsFixedSize {
+ get { return false; }
+ }
+
+ bool IList.IsReadOnly {
+ get { return false;}
+ }
+
+ object IList.this [int index] {
+ get {
+ return items[index];
+ }
+ set {
+ throw new NotSupportedException ();
+ }
+ }
+
+ #endregion Public Instance Properties
+
+ #region Public Instance Methods
+ public virtual int Add (DataGridTableStyle table)
+ {
+ int cnt = AddInternal (table);
+ OnCollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Add, table));
+ return cnt;
+ }
+
+ public virtual void AddRange (DataGridTableStyle[] tables)
+ {
+ foreach (DataGridTableStyle mi in tables)
+ AddInternal (mi);
+
+ OnCollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Refresh, null));
+ }
+
+ public void Clear ()
+ {
+ items.Clear ();
+ OnCollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Refresh , null));
+ }
+
+ public bool Contains (DataGridTableStyle table)
+ {
+ return (FromTableNameToIndex (table.MappingName) != -1);
+ }
+
+ public bool Contains (string name)
+ {
+ return (FromTableNameToIndex (name) != -1);
+ }
+
+ void ICollection.CopyTo (Array dest, int index)
+ {
+ items.CopyTo (dest, index);
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return items.GetEnumerator ();
+ }
+
+ int IList.Add (object value)
+ {
+ int cnt = AddInternal ((DataGridTableStyle)value);
+
+ OnCollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Add, null));
+ return cnt;
+ }
+
+ void IList.Clear ()
+ {
+ items.Clear ();
+ OnCollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Refresh , null));
+ }
+
+ bool IList.Contains (object value)
+ {
+ return items.Contains (value);
+ }
+
+ int IList.IndexOf (object value)
+ {
+ return items.IndexOf (value);
+ }
+
+ void IList.Insert (int index, object value)
+ {
+ throw new NotSupportedException ();
+ }
+
+ void IList.Remove (object value)
+ {
+ items.Remove (value);
+ OnCollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Remove, value));
+ }
+
+ void IList.RemoveAt (int index)
+ {
+ object item = items[index];
+ items.RemoveAt (index);
+ OnCollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Remove, item));
+ }
+
+ protected void OnCollectionChanged (CollectionChangeEventArgs ccevent)
+ {
+ if (CollectionChanged != null) {
+ CollectionChanged (this, ccevent);
+ }
+ }
+
+ public void Remove (DataGridTableStyle table)
+ {
+ items.Remove (table);
+ OnCollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Remove, table));
+ }
+
+ public void RemoveAt (int index)
+ {
+ object item = items[index];
+
+ items.RemoveAt (index);
+ OnCollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Remove, item));
+ }
+
+ #endregion Public Instance Methods
+
+ #region Events
+ public event CollectionChangeEventHandler CollectionChanged;
+ #endregion Events
+
+
+ #region Private Instance Methods
+ private int AddInternal (DataGridTableStyle table)
+ {
+ // TODO: MS allows duplicate columns. How they diferenciate between them?
+ if (FromTableNameToIndex (table.MappingName) != -1) {
+ throw new ArgumentException ("The TableStyles collection already has a TableStyle with this mapping name");
+ }
+
+ table.DataGrid = owner;
+ int cnt = items.Add (table);
+ return cnt;
+ }
+
+ private int FromTableNameToIndex (string tableName)
+ {
+ for (int i = 0; i < items.Count; i++) {
+ DataGridTableStyle table = (DataGridTableStyle) items[i];
+
+ if (table.MappingName == null || table.MappingName == string.Empty)
+ continue;
+
+ if (String.Compare (table.MappingName, tableName, true) == 0) {
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+ #endregion Private Instance Methods
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridTablesFactory.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridTablesFactory.cs
new file mode 100644
index 00000000000..4ecbeab0e75
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridTablesFactory.cs
@@ -0,0 +1,54 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Jordi Mas i Hernandez <jordi@ximian.com>
+//
+//
+// NOT COMPLETE
+
+using System.ComponentModel;
+using System.Drawing;
+using System.Runtime.InteropServices;
+using System.Diagnostics;
+
+namespace System.Windows.Forms
+{
+ public class GridTablesFactory
+ {
+
+ #region Constructors
+ internal GridTablesFactory ()
+ {
+
+ }
+ #endregion
+
+
+ #region Public Instance Properties
+ [MonoTODO]
+ public static DataGridTableStyle[] CreateGridTables (DataGridTableStyle gridTable, object dataSource, string dataMember, BindingContext bindingManager)
+ {
+ throw new NotImplementedException ();
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GroupBox.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GroupBox.cs
new file mode 100644
index 00000000000..879ecb9545c
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GroupBox.cs
@@ -0,0 +1,221 @@
+//
+// System.Windows.Forms.GroupBox.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.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+// TODO:
+//
+// Copyright (C) Novell Inc., 2004-2005
+//
+//
+
+// COMPLETE
+
+using System.Drawing;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+
+namespace System.Windows.Forms
+{
+ [DefaultProperty("Text")]
+ [DefaultEvent("Enter")]
+ [Designer ("System.Windows.Forms.Design.GroupBoxDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+ public class GroupBox : Control
+ {
+ private FlatStyle flat_style;
+ private Rectangle display_rectangle = new Rectangle ();
+
+ #region Events
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public new event EventHandler Click;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public new event EventHandler DoubleClick;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public new event KeyEventHandler KeyDown;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public new event KeyPressEventHandler KeyPress;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public new event KeyEventHandler KeyUp;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public new event MouseEventHandler MouseDown;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public new event EventHandler MouseEnter;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public new event EventHandler MouseLeave;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public new event MouseEventHandler MouseMove;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public new event MouseEventHandler MouseUp;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public new event EventHandler TabStopChanged;
+ #endregion Events
+
+ public GroupBox ()
+ {
+ TabStop = false;
+ flat_style = FlatStyle.Standard;
+
+ SetStyle(ControlStyles.ContainerControl | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor, true);
+ SetStyle(ControlStyles.Selectable, false);
+ }
+
+ #region Public Properties
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public override bool AllowDrop {
+ get { return base.AllowDrop; }
+ set { base.AllowDrop = value; }
+ }
+
+ protected override CreateParams CreateParams {
+ get { return base.CreateParams; }
+ }
+
+ protected override Size DefaultSize {
+ get { return ThemeEngine.Current.GroupBoxDefaultSize;}
+ }
+
+ public override Rectangle DisplayRectangle {
+ get {
+ display_rectangle.X = 3;
+ display_rectangle.Y = Font.Height + 3;
+ display_rectangle.Width = Width - 6;
+ display_rectangle.Height = Height - Font.Height - 6;
+ return display_rectangle;
+ }
+ }
+
+ [DefaultValue(FlatStyle.Standard)]
+ public FlatStyle FlatStyle {
+ get { return flat_style; }
+ set {
+ if (!Enum.IsDefined (typeof (FlatStyle), value))
+ new InvalidEnumArgumentException (string.Format("Enum argument value '{0}' is not valid for FlatStyle", value));
+
+ if (flat_style == value)
+ return;
+
+ flat_style = value;
+ Refresh ();
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public new bool TabStop {
+ get { return base.TabStop; }
+ set { base.TabStop = value; }
+ }
+
+ [Localizable(true)]
+ public override string Text {
+ get { return base.Text; }
+ set {
+ if (base.Text == value)
+ return;
+
+ base.Text = value;
+ Refresh ();
+ }
+ }
+
+ #endregion //Public Properties
+
+ #region Public Methods
+ protected override void OnFontChanged (EventArgs e)
+ {
+ base.OnFontChanged (e);
+ Refresh ();
+ }
+
+ protected override void OnPaint (PaintEventArgs pevent)
+ {
+ ThemeEngine.Current.DrawGroupBox (pevent.Graphics, ClientRectangle, this);
+ base.OnPaint(pevent);
+ }
+
+ protected override bool ProcessMnemonic (char charCode)
+ {
+ if (IsMnemonic(charCode, Text) == true) {
+ // Select item next in line in tab order
+ if (this.parent != null) {
+ parent.SelectNextControl(this, true, false, true, false);
+ }
+ return true;
+ }
+
+ return base.ProcessMnemonic (charCode);
+ }
+
+ public override string ToString()
+ {
+ return GetType ().FullName.ToString () + ", Text: " + Text;
+ }
+
+ protected override void WndProc(ref Message m) {
+ switch ((Msg) m.Msg) {
+ case Msg.WM_ERASEBKGND:
+ m.Result = (IntPtr)1;
+ break;
+ default:
+ base.WndProc (ref m);
+ break;
+ }
+ }
+
+ #endregion Public Methods
+#if NET_2_0
+
+ public bool UseCompatibleTextRendering {
+ get {
+ return use_compatible_text_rendering;
+ }
+
+ set {
+ use_compatible_text_rendering = value;
+ }
+ }
+#endif
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HScrollBar.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HScrollBar.cs
new file mode 100644
index 00000000000..b67a95b011c
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HScrollBar.cs
@@ -0,0 +1,51 @@
+//
+// System.Windows.Forms.HScrollBar.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, Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez jordi@ximian.com
+//
+//
+
+
+using System.Drawing;
+
+namespace System.Windows.Forms
+{
+
+ public class HScrollBar : ScrollBar
+ {
+ public HScrollBar()
+ {
+ vert = false;
+ }
+
+ protected override Size DefaultSize {
+ get { return ThemeEngine.Current.HScrollBarDefaultSize;}
+ }
+
+ protected override CreateParams CreateParams {
+ get { return base.CreateParams; }
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HandledMouseEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HandledMouseEventArgs.cs
new file mode 100644
index 00000000000..4ee42e7be38
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HandledMouseEventArgs.cs
@@ -0,0 +1,52 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public class HandledMouseEventArgs : MouseEventArgs {
+
+ private bool handled;
+
+ public HandledMouseEventArgs (MouseButtons button, int clicks, int x, int y, int delta) : base (button, clicks, x, y, delta) {
+ handled = false;
+ }
+
+ public HandledMouseEventArgs( MouseButtons button, int clicks, int x, int y, int delta, bool defaultHandledValue) : base (button, clicks, x, y, delta) {
+ this.handled = defaultHandledValue;
+ }
+
+ public bool Handled {
+ get { return handled; }
+ set { handled = value; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Help.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Help.cs
new file mode 100644
index 00000000000..5b4a31329bd
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Help.cs
@@ -0,0 +1,70 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// NOT COMPLETE
+
+using System;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+ public class Help {
+ #region Constructor
+ private Help() {
+ }
+ #endregion
+
+ #region Public Static Methods
+ public static void ShowHelp(Control parent, string url) {
+ ShowHelp(parent, url, HelpNavigator.TableOfContents, null);
+ }
+
+ public static void ShowHelp(Control parent, string url, HelpNavigator navigator) {
+ ShowHelp(parent, url, navigator, null);
+ }
+
+ [MonoTODO("Create glue code to tie into libCHM")]
+ public static void ShowHelp(Control parent, string url, HelpNavigator command, object param) {
+ MessageBox.Show(parent, (string)Locale.GetText("Help (" + command + "(" + param.ToString() + ")) not yet implemented"), (string)Locale.GetText("Popup Help"), MessageBoxButtons.OK, MessageBoxIcon.Stop);
+ }
+
+ public static void ShowHelp(Control parent, string url, string keyword) {
+ if (keyword == null || keyword == String.Empty) {
+ ShowHelp(parent, url, HelpNavigator.TableOfContents, null);
+ }
+ ShowHelp(parent, url, HelpNavigator.Topic, keyword);
+ }
+
+ public static void ShowHelpIndex(Control parent, string url) {
+ ShowHelp(parent, url, HelpNavigator.Index, null);
+ }
+
+ [MonoTODO("Create glue code to tie into libCHM")]
+ public static void ShowPopup(Control parent, string caption, Point location) {
+ MessageBox.Show(parent, (string)Locale.GetText("Popup Help not yet implemented"), (string)Locale.GetText("Popup Help"), MessageBoxButtons.OK, MessageBoxIcon.Stop);
+ }
+ #endregion // Public Static Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HelpEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HelpEventArgs.cs
new file mode 100644
index 00000000000..5c635b0123b
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HelpEventArgs.cs
@@ -0,0 +1,64 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+using System.Drawing;
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [ComVisible(true)]
+ public class HelpEventArgs : EventArgs {
+ private Point mouse_position;
+ private bool event_handled;
+
+ #region Public Constructors
+ public HelpEventArgs(System.Drawing.Point mousePos) {
+ this.mouse_position=mousePos;
+ this.event_handled=false;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public bool Handled {
+ get {
+ return this.event_handled;
+ }
+
+ set {
+ this.event_handled=value;
+ }
+ }
+
+ public Point MousePos {
+ get {
+ return this.mouse_position;
+ }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HelpEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HelpEventHandler.cs
new file mode 100644
index 00000000000..3893dafbe2a
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HelpEventHandler.cs
@@ -0,0 +1,30 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public delegate void HelpEventHandler (object sender, HelpEventArgs e);
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HelpNavigator.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HelpNavigator.cs
new file mode 100644
index 00000000000..201f6de6c03
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HelpNavigator.cs
@@ -0,0 +1,38 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public enum HelpNavigator {
+ Topic = -2147483647,
+ TableOfContents = -2147483646,
+ Index = -2147483645,
+ Find = -2147483644,
+ AssociateIndex = -2147483643,
+ KeywordIndex = -2147483642
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HelpProvider.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HelpProvider.cs
new file mode 100644
index 00000000000..a73876b703e
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HelpProvider.cs
@@ -0,0 +1,279 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// NOT COMPLETE
+// Still missing: Tie-in to HTML help when the user presses F1 on the control
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+ [ToolboxItemFilter("System.Windows.Forms")]
+ [ProvideProperty("ShowHelp", "System.Windows.Forms.Control, " + Consts.AssemblySystem_Windows_Forms)]
+ [ProvideProperty("HelpNavigator", "System.Windows.Forms.Control, " + Consts.AssemblySystem_Windows_Forms)]
+ [ProvideProperty("HelpKeyword", "System.Windows.Forms.Control, " + Consts.AssemblySystem_Windows_Forms)]
+ [ProvideProperty("HelpString", "System.Windows.Forms.Control, " + Consts.AssemblySystem_Windows_Forms)]
+ public class HelpProvider : Component, IExtenderProvider {
+ #region HelpProperty Class
+ private class HelpProperty {
+ internal string keyword;
+ internal HelpNavigator navigator;
+ internal string text;
+ internal bool show;
+ internal Control control;
+ internal HelpProvider hp;
+
+ public HelpProperty(HelpProvider hp, Control control) {
+ this.control = control;
+ this.hp = hp;
+
+ keyword = null;
+ navigator = HelpNavigator.AssociateIndex;
+ text = null;
+ show = false;
+
+ control.HelpRequested += hp.HelpRequestHandler;
+ }
+
+ public string Keyword {
+ get { return keyword; }
+ set { keyword = value; }
+ }
+
+ public HelpNavigator Navigator {
+ get { return navigator; }
+ set { navigator = value; }
+ }
+
+ public string Text {
+ get { return text; }
+ set { text = value; }
+ }
+
+ public bool Show {
+ get { return show; }
+ set { show = value; }
+ }
+ }
+ #endregion // HelpProperty Class
+
+ #region Local Variables
+ private string helpnamespace;
+ private Hashtable controls;
+ private ToolTip.ToolTipWindow tooltip;
+ private EventHandler HideToolTipHandler;
+ private KeyPressEventHandler HideToolTipKeyHandler;
+ private MouseEventHandler HideToolTipMouseHandler;
+ private HelpEventHandler HelpRequestHandler;
+ #endregion // Local Variables
+
+ #region Public Constructors
+ public HelpProvider() {
+ controls = new Hashtable();
+ tooltip = new ToolTip.ToolTipWindow(null);
+
+ HideToolTipHandler = new EventHandler(HideToolTip);
+ HideToolTipKeyHandler = new KeyPressEventHandler(HideToolTipKey);
+ HideToolTipMouseHandler = new MouseEventHandler(HideToolTipMouse);
+ HelpRequestHandler = new HelpEventHandler(HelpRequested);
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ [DefaultValue(null)]
+ [Editor ("System.Windows.Forms.Design.HelpNamespaceEditor, " + Consts.AssemblySystem_Design, "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)]
+ [Localizable(true)]
+ public virtual string HelpNamespace {
+ get {
+ return helpnamespace;
+ }
+
+ set {
+ helpnamespace = value;
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Instance Methods
+ public bool CanExtend(object extendee) {
+ if (!(extendee is Control)) {
+ return false;
+ }
+
+ if ((extendee is Form) || (extendee is ToolBar)) {
+ return false;
+ }
+
+ return true;
+ }
+
+ [DefaultValue(null)]
+ [Localizable(true)]
+ public virtual string GetHelpKeyword(Control ctl) {
+ return GetHelpProperty(ctl).Keyword;
+ }
+
+ [DefaultValue(HelpNavigator.AssociateIndex)]
+ [Localizable(true)]
+ public virtual HelpNavigator GetHelpNavigator(Control ctl) {
+ return GetHelpProperty(ctl).Navigator;
+ }
+
+ [DefaultValue(null)]
+ [Localizable(true)]
+ public virtual string GetHelpString(Control ctl) {
+ return GetHelpProperty(ctl).Text;
+ }
+
+ [Localizable(true)]
+ public virtual bool GetShowHelp(Control ctl) {
+ return GetHelpProperty(ctl).Show;
+ }
+
+ public virtual void ResetShowHelp(Control ctl) {
+ HelpProperty hp;
+
+ hp = GetHelpProperty(ctl);
+
+ if ((hp.Keyword != null) || (hp.Text != null)) {
+ hp.Show = true;
+ } else {
+ hp.Show = false;
+ }
+ }
+
+ public virtual void SetHelpKeyword(Control ctl, string keyword) {
+ GetHelpProperty(ctl).Keyword = keyword;
+ }
+
+ public virtual void SetHelpNavigator(Control ctl, HelpNavigator navigator) {
+ GetHelpProperty(ctl).Navigator = navigator;
+ }
+
+ public virtual void SetHelpString(Control ctl, string helpString) {
+ GetHelpProperty(ctl).Text = helpString;
+ }
+
+ public virtual void SetShowHelp(Control ctl, bool value) {
+ GetHelpProperty(ctl).Show = value;
+ }
+
+ public override string ToString() {
+ return base.ToString() + ", HelpNameSpace: " + helpnamespace;
+ }
+
+ #endregion // Public Instance Methods
+
+ #region Private Methods
+ private HelpProperty GetHelpProperty(Control control) {
+ HelpProperty hp;
+
+ hp = (HelpProperty)controls[control];
+ if (hp == null) {
+ hp = new HelpProperty(this, control);
+ controls[control] = hp;
+ }
+
+ return hp;
+ }
+
+ private void HideToolTip(object Sender, EventArgs e) {
+ Control control;
+
+ control = (Control)Sender;
+ control.LostFocus -= HideToolTipHandler;
+
+ this.tooltip.Visible = false;
+ }
+
+ private void HideToolTipKey(object Sender, KeyPressEventArgs e) {
+ Control control;
+
+ control = (Control)Sender;
+ control.KeyPress -= HideToolTipKeyHandler;
+
+ this.tooltip.Visible = false;
+ }
+
+ private void HideToolTipMouse(object Sender, MouseEventArgs e) {
+ Control control;
+
+ control = (Control)Sender;
+ control.MouseDown -= HideToolTipMouseHandler;
+
+ this.tooltip.Visible = false;
+ }
+
+
+ // This is called when the user does a "what's this" style lookup. It uses the 'text' property
+ private void HelpRequested(object sender, HelpEventArgs e) {
+ Size size;
+ Point pt;
+ Control control;
+
+ control = (Control)sender;
+
+ if (GetHelpProperty(control).Text == null) {
+ return;
+ }
+
+ pt = e.MousePos;
+
+ // Display Tip
+ tooltip.Text = GetHelpProperty(control).Text;
+ size = ThemeEngine.Current.ToolTipSize(tooltip, tooltip.Text);
+ tooltip.Width = size.Width;
+ tooltip.Height = size.Height;
+ pt.X -= size.Width / 2;
+
+ if (pt.X < 0) {
+ pt.X += size.Width / 2;
+ }
+
+ if ((pt.X + size.Width) < SystemInformation.WorkingArea.Width) {
+ tooltip.Left = pt.X;
+ } else {
+ tooltip.Left = pt.X - size.Width;
+ }
+
+ if ((pt.Y + size.Height) < (SystemInformation.WorkingArea.Height - 16)) {
+ tooltip.Top = pt.Y;
+ } else {
+ tooltip.Top = pt.Y - size.Height;
+ }
+
+
+ tooltip.Visible = true;
+ control.KeyPress += HideToolTipKeyHandler;
+ control.MouseDown += HideToolTipMouseHandler;
+ control.LostFocus += HideToolTipHandler;
+ e.Handled = true;
+ }
+ #endregion // Private Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HorizontalAlignment.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HorizontalAlignment.cs
new file mode 100644
index 00000000000..ce577bc0f74
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HorizontalAlignment.cs
@@ -0,0 +1,37 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+//
+
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [ComVisible(true)]
+ public enum HorizontalAlignment {
+ Left,
+ Right,
+ Center
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Hwnd.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Hwnd.cs
new file mode 100644
index 00000000000..88aa0da9ca0
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Hwnd.cs
@@ -0,0 +1,557 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// NOT COMPLETE
+
+using System;
+using System.Collections;
+using System.Drawing;
+using System.Runtime.InteropServices;
+
+// NOTE: Possible optimization:
+// Several properties calculate dimensions on the fly; instead; they can
+// be stored in a field and only be recalculated when a style is changed (DefaultClientRect, for example)
+
+namespace System.Windows.Forms {
+ internal class Hwnd : IDisposable {
+ #region Local Variables
+ private static Hashtable windows = new Hashtable(100, 0.5f);
+ //private const int menu_height = 14; // FIXME - Read this value from somewhere
+
+ private IntPtr handle;
+ internal IntPtr client_window;
+ internal IntPtr whole_window;
+ internal Menu menu;
+ internal TitleStyle title_style;
+ internal FormBorderStyle border_style;
+ internal int x;
+ internal int y;
+ internal int width;
+ internal int height;
+ internal bool allow_drop;
+ internal Hwnd parent;
+ internal bool visible;
+ internal uint opacity;
+ internal bool enabled;
+ internal bool zero_sized;
+ internal Rectangle invalid;
+ internal bool expose_pending;
+ internal bool destroy_pending;
+ internal bool nc_expose_pending;
+ internal bool configure_pending;
+ internal bool reparented;
+ internal Graphics client_dc;
+ internal object user_data;
+ internal Rectangle client_rectangle;
+ internal ArrayList marshal_free_list;
+ internal int caption_height;
+ internal int tool_caption_height;
+ #endregion // Local Variables
+
+ #region Constructors and destructors
+ public Hwnd() {
+ x = 0;
+ y = 0;
+ width = 0;
+ height = 0;
+ visible = false;
+ menu = null;
+ border_style = FormBorderStyle.None;
+ client_window = IntPtr.Zero;
+ whole_window = IntPtr.Zero;
+ handle = IntPtr.Zero;
+ parent = null;
+ invalid = Rectangle.Empty;
+ expose_pending = false;
+ destroy_pending = false;
+ nc_expose_pending = false;
+ enabled = true;
+ reparented = false;
+ client_rectangle = Rectangle.Empty;
+ marshal_free_list = new ArrayList(2);
+ opacity = 0xffffffff;
+ }
+
+ public void Dispose() {
+ windows[client_window] = null;
+ windows[whole_window] = null;
+ for (int i = 0; i < marshal_free_list.Count; i++) {
+ Marshal.FreeHGlobal((IntPtr)marshal_free_list[i]);
+ }
+ marshal_free_list.Clear();
+ }
+ #endregion
+
+ #region Static Methods
+ public void SetObjectWindow(Hwnd obj, IntPtr window) {
+ windows[window] = obj;
+ }
+
+ public static Hwnd ObjectFromWindow(IntPtr window) {
+ return (Hwnd)windows[window];
+ }
+
+ public static Hwnd ObjectFromHandle(IntPtr handle) {
+ //return (Hwnd)(((GCHandle)handle).Target);
+ return (Hwnd)windows[handle];
+ }
+
+ public static IntPtr HandleFromObject(Hwnd obj) {
+ return obj.handle;
+ }
+
+ public static Hwnd GetObjectFromWindow(IntPtr window) {
+ return (Hwnd)windows[window];
+ }
+
+ public static IntPtr GetHandleFromWindow(IntPtr window) {
+ Hwnd hwnd;
+
+ hwnd = (Hwnd)windows[window];
+ if (hwnd != null) {
+ return hwnd.handle;
+ } else {
+ return IntPtr.Zero;
+ }
+ }
+
+ public static Rectangle GetWindowRectangle(FormBorderStyle border_style,
+ Menu menu, TitleStyle title_style, int caption_height,
+ int tool_caption_height, Rectangle client_rect)
+ {
+ Rectangle rect;
+
+ rect = new Rectangle(client_rect.Location, client_rect.Size);
+
+ if (menu != null) {
+ int menu_height = menu.Rect.Height;
+ rect.Y -= menu_height;
+ rect.Height += menu_height;
+ }
+
+ if (border_style == FormBorderStyle.Fixed3D) {
+ Size border_3D_size = ThemeEngine.Current.Border3DSize;
+
+ rect.X -= border_3D_size.Width;
+ rect.Y -= border_3D_size.Height;
+ rect.Width += border_3D_size.Width * 2;
+ rect.Height += border_3D_size.Height * 2;
+ } else if (border_style == FormBorderStyle.FixedSingle) {
+ rect.X -= 1;
+ rect.Y -= 1;
+ rect.Width += 2;
+ rect.Height += 2;
+ } else if ((int) border_style == 0xFFFF) {
+ rect.X -= 3;
+ rect.Y -= 3;
+ rect.Width += 6;
+ rect.Height += 6;
+ }
+
+ if (title_style == TitleStyle.Normal) {
+ rect.Y -= caption_height;
+ rect.Height += caption_height;
+ } else if (title_style == TitleStyle.Tool) {
+ rect.Y -= tool_caption_height;
+ rect.Height += tool_caption_height;
+ }
+
+ return rect;
+ }
+
+ public static Rectangle GetClientRectangle(FormBorderStyle border_style, Menu menu, TitleStyle title_style, int caption_height, int tool_caption_height, int width, int height) {
+ Rectangle rect;
+
+ rect = new Rectangle(0, 0, width, height);
+
+ if (menu != null) {
+ int menu_height = menu.Rect.Height;
+ rect.Y += menu_height;
+ rect.Height -= menu_height;
+ }
+
+ if (border_style == FormBorderStyle.Fixed3D) {
+ Size border_3D_size = ThemeEngine.Current.Border3DSize;
+
+ rect.X += border_3D_size.Width;
+ rect.Y += border_3D_size.Height;
+ rect.Width -= border_3D_size.Width * 2;
+ rect.Height -= border_3D_size.Height * 2;
+ } else if (border_style == FormBorderStyle.FixedSingle) {
+ rect.X += 1;
+ rect.Y += 1;
+ rect.Width -= 2;
+ rect.Height -= 2;
+ } else if ((int) border_style == 0xFFFF) {
+ rect.X += 3;
+ rect.Y += 3;
+ rect.Width -= 6;
+ rect.Height -= 6;
+ }
+
+ if (title_style == TitleStyle.Normal) {
+ rect.Y += caption_height;
+ rect.Height -= caption_height;
+ } else if (title_style == TitleStyle.Tool) {
+ rect.Y += tool_caption_height;
+ rect.Height -= tool_caption_height;
+ }
+
+ return rect;
+ }
+ #endregion // Static Methods
+
+ #region Instance Properties
+ public FormBorderStyle BorderStyle {
+ get {
+ return border_style;
+ }
+
+ set {
+ border_style = value;
+ }
+ }
+
+ public Graphics ClientDC {
+ get {
+ return client_dc;
+ }
+
+ set {
+ client_dc = value;
+ }
+ }
+
+ public Rectangle ClientRect {
+ get {
+ if (client_rectangle == Rectangle.Empty) {
+ return DefaultClientRect;
+ }
+ return client_rectangle;
+ }
+
+ set {
+ client_rectangle = value;
+ }
+ }
+
+ public IntPtr ClientWindow {
+ get {
+ return client_window;
+ }
+
+ set {
+ client_window = value;
+ handle = value;
+
+ if (windows[client_window] == null) {
+ windows[client_window] = this;
+ }
+ }
+ }
+
+ public Rectangle DefaultClientRect {
+ get {
+ // We pass a Zero for the menu handle so the menu size is
+ // not computed this is done via an WM_NCCALC
+ return GetClientRectangle (border_style, null, title_style,
+ caption_height, tool_caption_height, width, height);
+ }
+ }
+
+ public bool DestroyPending {
+ get {
+ return destroy_pending;
+ }
+
+ set {
+ destroy_pending = value;
+ }
+ }
+
+ public bool ExposePending {
+ get {
+ return expose_pending;
+ }
+
+ set {
+ expose_pending = value;
+ }
+ }
+
+ public IntPtr Handle {
+ get {
+ if (handle == IntPtr.Zero) {
+ throw new ArgumentNullException("Handle", "Handle is not yet assigned, need a ClientWindow");
+ }
+ return handle;
+ }
+ }
+
+ public int Height {
+ get {
+ return height;
+ }
+
+ set {
+ height = value;
+ }
+ }
+
+ public Menu Menu {
+ get {
+ return menu;
+ }
+
+ set {
+ menu = value;
+ }
+ }
+
+ public bool Reparented {
+ get {
+ return reparented;
+ }
+
+ set {
+ reparented = value;
+ }
+ }
+
+ public uint Opacity {
+ get {
+ return opacity;
+ }
+
+ set {
+ opacity = value;
+ }
+ }
+
+ public bool Enabled {
+ get {
+ if (!enabled) {
+ return false;
+ }
+
+ if (parent != null) {
+ return parent.Enabled;
+ }
+
+ return true;
+ }
+
+ set {
+ enabled = value;
+ }
+ }
+
+ public IntPtr EnabledHwnd {
+ get {
+ if (Enabled || parent == null) {
+ return Handle;
+ }
+
+ return parent.EnabledHwnd;
+ }
+ }
+
+ public Point MenuOrigin {
+ get {
+ Point pt;
+ Size border_3D_size = ThemeEngine.Current.Border3DSize;
+
+ pt = new Point(0, 0);
+
+ if (border_style == FormBorderStyle.Fixed3D) {
+ pt.X += border_3D_size.Width;
+ pt.Y += border_3D_size.Height;
+ } else if (border_style == FormBorderStyle.FixedSingle) {
+ pt.X += 1;
+ pt.Y += 1;
+ }
+
+ if (this.title_style == TitleStyle.Normal) {
+ pt.Y += caption_height;
+ } else if (this.title_style == TitleStyle.Normal) {
+ pt.Y += tool_caption_height;
+ }
+
+ return pt;
+ }
+ }
+ public Rectangle Invalid {
+ get {
+ return invalid;
+ }
+
+ set {
+ invalid = value;
+ }
+ }
+
+ public bool NCExposePending {
+ get {
+ return nc_expose_pending;
+ }
+
+ set {
+ nc_expose_pending = value;
+ }
+ }
+
+ public Hwnd Parent {
+ get {
+ return parent;
+ }
+
+ set {
+ parent = value;
+ }
+ }
+
+ public int CaptionHeight {
+ get { return caption_height; }
+ set { caption_height = value; }
+ }
+
+ public int ToolCaptionHeight {
+ get { return tool_caption_height; }
+ set { tool_caption_height = value; }
+ }
+
+ public TitleStyle TitleStyle {
+ get {
+ return title_style;
+ }
+
+ set {
+ title_style = value;
+ }
+ }
+
+ public object UserData {
+ get {
+ return user_data;
+ }
+
+ set {
+ user_data = value;
+ }
+ }
+
+ public IntPtr WholeWindow {
+ get {
+ return whole_window;
+ }
+
+ set {
+ whole_window = value;
+
+ if (windows[whole_window] == null) {
+ windows[whole_window] = this;
+ }
+ }
+ }
+
+ public int Width {
+ get {
+ return width;
+ }
+
+ set {
+ width = value;
+ }
+ }
+
+ public bool Visible {
+ get {
+ return visible;
+ }
+
+ set {
+ visible = value;
+ }
+ }
+
+ public int X {
+ get {
+ return x;
+ }
+
+ set {
+ x = value;
+ }
+ }
+
+ public int Y {
+ get {
+ return y;
+ }
+
+ set {
+ y = value;
+ }
+ }
+ #endregion // Instance properties
+
+ #region Methods
+ public void AddInvalidArea(int x, int y, int width, int height) {
+ if (invalid == Rectangle.Empty) {
+ invalid = new Rectangle (x, y, width, height);
+ return;
+ }
+
+ int right, bottom;
+ right = Math.Max (invalid.Right, x + width);
+ bottom = Math.Max (invalid.Bottom, y + height);
+ invalid.X = Math.Min (invalid.X, x);
+ invalid.Y = Math.Min (invalid.Y, y);
+
+ invalid.Width = right - invalid.X;
+ invalid.Height = bottom - invalid.Y;
+ }
+
+ public void AddInvalidArea(Rectangle rect) {
+ if (invalid == Rectangle.Empty) {
+ invalid = rect;
+ return;
+ }
+ invalid = Rectangle.Union (invalid, rect);
+ }
+
+ public void ClearInvalidArea() {
+ invalid = Rectangle.Empty;
+ expose_pending = false;
+ }
+
+ public override string ToString() {
+ return String.Format("Hwnd, ClientWindow:0x{0:X}, WholeWindow:0x{1:X}, Handle:0x{2:X}", client_window.ToInt32(), whole_window.ToInt32(), handle.ToInt32());
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IButtonControl.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IButtonControl.cs
new file mode 100644
index 00000000000..9c28ce6b75e
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IButtonControl.cs
@@ -0,0 +1,40 @@
+//
+// System.Windows.Forms.IButtonControl.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.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms
+{
+
+ public interface IButtonControl
+ {
+ DialogResult DialogResult {get; set;}
+ void NotifyDefault (bool value);
+ void PerformClick ();
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ICommandExecutor.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ICommandExecutor.cs
new file mode 100644
index 00000000000..0a8b7610bcb
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ICommandExecutor.cs
@@ -0,0 +1,34 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public interface ICommandExecutor {
+ #region Public Instance Methods
+ void Execute();
+ #endregion // Public Instance Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IComponentEditorPageSite.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IComponentEditorPageSite.cs
new file mode 100644
index 00000000000..3e1b7b1996d
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IComponentEditorPageSite.cs
@@ -0,0 +1,34 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com);
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+
+ public interface IComponentEditorPageSite {
+ Control GetControl();
+ void SetDirty();
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IContainerControl.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IContainerControl.cs
new file mode 100644
index 00000000000..4208e3cc757
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IContainerControl.cs
@@ -0,0 +1,39 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public interface IContainerControl {
+ #region Public Instance Properties
+ Control ActiveControl {get; set;}
+ #endregion // Public Instance Properties
+
+ #region Public Instance Methods
+ bool ActivateControl(Control active);
+ #endregion // Public Instance Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IDataGridColumnStyleEditingNotificationService.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IDataGridColumnStyleEditingNotificationService.cs
new file mode 100644
index 00000000000..20a89016ddd
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IDataGridColumnStyleEditingNotificationService.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public interface IDataGridColumnStyleEditingNotificationService {
+ #region Public Instance Methods
+ void ColumnStartedEditing(Control editingControl);
+ #endregion // Public Instance Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IDataGridEditingService.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IDataGridEditingService.cs
new file mode 100644
index 00000000000..9f491287838
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IDataGridEditingService.cs
@@ -0,0 +1,36 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//
+// Peter Bartok pbartok@novell.com
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public interface IDataGridEditingService {
+ #region Public Instance Methods
+ bool BeginEdit(DataGridColumnStyle gridColumn, int rowNumber);
+ bool EndEdit(DataGridColumnStyle gridColumn, int rowNumber, bool shouldAbort);
+ #endregion // Public Instance Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IDataGridViewEditingCell.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IDataGridViewEditingCell.cs
new file mode 100644
index 00000000000..aadf51ad3f3
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IDataGridViewEditingCell.cs
@@ -0,0 +1,45 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public interface IDataGridViewEditingCell {
+
+ object EditingCellFormattedValue { get; set; }
+
+ bool EditingCellValueChanged { get; set; }
+
+ object GetEditingCellFormattedValue (DataGridViewDataErrorContexts context);
+
+ void PrepareEditingCellForEdit (bool selectAll);
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IDataGridViewEditingControl.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IDataGridViewEditingControl.cs
new file mode 100644
index 00000000000..aa3bf7c175a
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IDataGridViewEditingControl.cs
@@ -0,0 +1,57 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public interface IDataGridViewEditingControl {
+
+ DataGridView EditingControlDataGridView {get; set;}
+
+ object EditingControlFormattedValue {get; set;}
+
+ int EditingControlRowIndex {get; set;}
+
+ bool EditingControlValueChanged {get; set;}
+
+ Cursor EditingPanelCursor {get;}
+
+ bool RepositionEditingControlOnValueChange {get;}
+
+ void ApplyCellStyleToEditingControl (DataGridViewCellStyle dataGridViewCellStyle);
+
+ bool EditingControlWantsInputKey (Keys keyData, bool dataGridViewWantsInputKey);
+
+ object GetEditingControlFormattedValue (DataGridViewDataErrorContexts context);
+
+ void PrepareEditingControlForEdit (bool selectAll);
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IDataObject.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IDataObject.cs
new file mode 100644
index 00000000000..4a975a13dc5
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IDataObject.cs
@@ -0,0 +1,53 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+
+// COMPLETE
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [ComVisible(true)]
+ public interface IDataObject {
+ #region Public Instance Methods
+ object GetData(string format);
+ object GetData(string format, bool autoConvert);
+ object GetData(Type format);
+
+ bool GetDataPresent(string format);
+ bool GetDataPresent(string format, bool autoConvert);
+ bool GetDataPresent(Type format);
+
+ string[] GetFormats();
+ string[] GetFormats(bool autoConvert);
+
+ void SetData(object data);
+ void SetData(string format, bool autoConvert, object data);
+ void SetData(string format, object data);
+ void SetData(Type format, object data);
+ #endregion // Public Instance Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IFeatureSupport.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IFeatureSupport.cs
new file mode 100644
index 00000000000..45717a902a8
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IFeatureSupport.cs
@@ -0,0 +1,37 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public interface IFeatureSupport {
+ #region Public Instance Methods
+ Version GetVersionPresent(object feature);
+ bool IsPresent(object feature);
+ bool IsPresent(object feature, Version minimumVersion);
+ #endregion // Public Instance Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IFileReaderService.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IFileReaderService.cs
new file mode 100644
index 00000000000..fd276f74ee8
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IFileReaderService.cs
@@ -0,0 +1,37 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+using System.IO;
+
+namespace System.Windows.Forms {
+ public interface IFileReaderService {
+ #region Public Instance Methods
+ Stream OpenFileFromSource(string relativePath);
+ #endregion // Public Instance Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IMessageFilter.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IMessageFilter.cs
new file mode 100644
index 00000000000..66990357c88
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IMessageFilter.cs
@@ -0,0 +1,34 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public interface IMessageFilter {
+ bool PreFilterMessage(ref Message m);
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IRootGridEntry.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IRootGridEntry.cs
new file mode 100755
index 00000000000..1f7cac35ab5
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IRootGridEntry.cs
@@ -0,0 +1,40 @@
+// 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) 2005 Novell, Inc.
+//
+// Authors:
+// Jonathan Chambers jonathan.chambers@ansys.com
+//
+
+
+// COMPLETE
+
+using System;
+namespace System.Windows.Forms.PropertyGridInternal
+{
+ public interface IRootGridEntry
+ {
+ System.ComponentModel.AttributeCollection BrowsableAttributes { get; set; }
+
+ void ShowCategories ( bool showCategories );
+
+ void ResetBrowsableAttributes ();
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IWin32Window.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IWin32Window.cs
new file mode 100644
index 00000000000..2296f2d7b69
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IWin32Window.cs
@@ -0,0 +1,43 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+
+// COMPLETE
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [ComVisible(true)]
+ [Guid("458AB8A2-A1EA-4d7b-8EBE-DEE5D3D9442C")]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ public interface IWin32Window {
+ #region Public Instance Properties
+ IntPtr Handle {
+ get;
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IWindowTarget.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IWindowTarget.cs
new file mode 100644
index 00000000000..71c70d58ae0
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/IWindowTarget.cs
@@ -0,0 +1,34 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+namespace System.Windows.Forms {
+ public interface IWindowTarget {
+ #region Public Instance Methods
+ void OnHandleChange(IntPtr newHandle);
+ void OnMessage(ref Message m);
+ #endregion // Public Instance Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImageIndexConverter.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImageIndexConverter.cs
new file mode 100644
index 00000000000..36b8e6522e1
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImageIndexConverter.cs
@@ -0,0 +1,98 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Ravindra rkumar@novell.com
+//
+
+
+// COMPLETE
+
+using System.Drawing;
+using System.ComponentModel;
+using System.Collections;
+using System.Diagnostics;
+using System.Globalization;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms
+{
+ public class ImageIndexConverter : Int32Converter
+ {
+ #region Constructors
+
+ public ImageIndexConverter () { }
+
+ #endregion Constructors
+
+ #region Protected Properties
+
+ protected virtual bool IncludeNoneAsStandardValue {
+ get { return true; }
+ }
+
+ #endregion Protected Properties
+
+ #region Public Methods
+
+ public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value)
+ {
+ string indexStr;
+ if (value != null && value is string) {
+ indexStr = (string) value;
+ return Int32.Parse (indexStr);
+ }
+ else
+ return base.ConvertFrom (context, culture, value);
+ }
+
+ public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture,
+ object value, Type destinationType)
+ {
+ if (value != null && destinationType == typeof (string)) {
+ if (value is int && (int) value == -1)
+ return "(none)";
+ else
+ return value.ToString ();
+ }
+ else
+ return base.ConvertTo (context, culture, value, destinationType);
+ }
+
+ public override StandardValuesCollection GetStandardValues (ITypeDescriptorContext context)
+ {
+ int [] stdVal = new int [] {-1};
+ return new TypeConverter.StandardValuesCollection (stdVal);
+ }
+
+ public override bool GetStandardValuesExclusive (ITypeDescriptorContext context)
+ {
+ return false;
+ }
+
+ public override bool GetStandardValuesSupported (ITypeDescriptorContext context)
+ {
+ return true;
+ }
+
+ #endregion Public Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImageLayout.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImageLayout.cs
new file mode 100644
index 00000000000..7b2f4574b45
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImageLayout.cs
@@ -0,0 +1,41 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public enum ImageLayout {
+ None = 0,
+ Tile = 1,
+ Center = 2,
+ Stretch = 3,
+ Zoom = 4
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImageList.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImageList.cs
new file mode 100644
index 00000000000..a4dcd9e548c
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImageList.cs
@@ -0,0 +1,1159 @@
+//
+// System.Windows.Forms.ImageList.cs
+//
+// Authors:
+// Peter Bartok <pbartok@novell.com>
+// Kornél Pál <http://www.kornelpal.hu/>
+//
+// Copyright (C) 2004-2005 Novell, Inc.
+// Copyright (C) 2005 Kornél Pál
+//
+
+//
+// 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.
+//
+
+// COMPLETE
+
+//
+// Differences between MS.NET ImageList and this implementation:
+//
+// This is a fully managed image list implementation.
+//
+// Images are stored as Format32bppArgb internally but ColorDepth is applied
+// to the colors of images. Images[index] returns a Format32bppArgb copy of
+// the image so this difference is only internal.
+//
+// MS.NET has no alpha channel support (except for icons in 32-bit mode with
+// comctl32.dll version 6.0) but this implementation has full alpha channel
+// support in 32-bit mode.
+//
+// Handle should be an HIMAGELIST returned by ImageList_Create. This
+// implementation uses (IntPtr)(-1) that is a non-zero but invalid handle.
+//
+// MS.NET destroys handles using the garbage collector this implementation
+// does the same with Image objects stored in an ArrayList.
+//
+// MS.NET 1.x shares the same HIMAGELIST between ImageLists that were
+// initialized from the same ImageListStreamer and doesn't update ImageSize
+// and ColorDepth that are treated as bugs and MS.NET 2.0 behavior is
+// implemented.
+//
+// MS.NET 2.0 initializes TransparentColor to Color.Transparent in
+// constructors but ResetTransparentColor and ShouldSerializeTransparentColor
+// default to Color.LightGray that is treated as a bug.
+//
+// MS.NET 2.0 does not clear keys when handle is destroyed that is treated as
+// a bug.
+//
+
+using System.Collections;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.ComponentModel.Design.Serialization;
+using System.Drawing;
+using System.Drawing.Design;
+using System.Drawing.Imaging;
+using System.Globalization;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms
+{
+ [DefaultProperty("Images")]
+ [Designer("System.Windows.Forms.Design.ImageListDesigner, " + Consts.AssemblySystem_Design)]
+#if NET_2_0
+ [DesignerSerializer("System.Windows.Forms.Design.ImageListCodeDomSerializer, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.Serialization.CodeDomSerializer, " + Consts.AssemblySystem_Design)]
+#endif
+ [ToolboxItemFilter("System.Windows.Forms")]
+ [TypeConverter(typeof(ImageListConverter))]
+ public sealed class ImageList : System.ComponentModel.Component
+ {
+ #region Private Fields
+ private const ColorDepth DefaultColorDepth = ColorDepth.Depth8Bit;
+ private static readonly Size DefaultImageSize = new Size(16, 16);
+ private static readonly Color DefaultTransparentColor = Color.Transparent;
+
+#if NET_2_0
+ private object tag;
+#endif
+ private EventHandler recreateHandle;
+ private readonly ImageCollection images;
+ #endregion // Private Fields
+
+ #region Sub-classes
+ [Editor("System.Windows.Forms.Design.ImageCollectionEditor, " + Consts.AssemblySystem_Design, typeof(UITypeEditor))]
+ public sealed class ImageCollection : IList, ICollection, IEnumerable
+ {
+ private const int AlphaMask = unchecked((int)0xFF000000);
+
+ private
+#if NET_2_0
+ static
+#else
+ sealed
+#endif
+ class IndexedColorDepths
+ {
+#if !NET_2_0
+ private IndexedColorDepths()
+ {
+ }
+#endif
+ internal static readonly ColorPalette Palette4Bit;
+ internal static readonly ColorPalette Palette8Bit;
+ private static readonly int[] squares;
+
+ static IndexedColorDepths()
+ {
+ Bitmap bitmap;
+ int index;
+
+ bitmap = new Bitmap(1, 1, PixelFormat.Format4bppIndexed);
+ Palette4Bit = bitmap.Palette;
+ bitmap.Dispose();
+
+ bitmap = new Bitmap(1, 1, PixelFormat.Format8bppIndexed);
+ Palette8Bit = bitmap.Palette;
+ bitmap.Dispose();
+
+ squares = new int[511];
+ for (index = 0; index < 256; index++)
+ squares[255 + index] = squares[255 - index] = index * index;
+ }
+
+ internal static int GetNearestColor(Color[] palette, int color)
+ {
+ int index;
+ int count;
+ int red;
+ int green;
+ int blue;
+ int nearestColor;
+ int minDistance;
+ int distance;
+
+ count = palette.Length;
+ for (index = 0; index < count; index++)
+ if (palette[index].ToArgb() == color)
+ return color;
+
+ red = unchecked((int)(unchecked((uint)color) >> 16) & 0xFF);
+ green = unchecked((int)(unchecked((uint)color) >> 8) & 0xFF);
+ blue = color & 0xFF;
+ nearestColor = AlphaMask;
+ minDistance = int.MaxValue;
+
+ for (index = 0; index < count; index++)
+ if ((distance = squares[255 + palette[index].R - red] + squares[255 + palette[index].G - green] + squares[255 + palette[index].B - blue]) < minDistance) {
+ nearestColor = palette[index].ToArgb();
+ minDistance = distance;
+ }
+
+ return nearestColor;
+ }
+ }
+
+ [Flags()]
+ private enum ItemFlags
+ {
+ None = 0,
+ UseTransparentColor = 1,
+ ImageStrip = 2
+ }
+
+ private sealed class ImageListItem
+ {
+ internal readonly object Image;
+ internal readonly ItemFlags Flags;
+ internal readonly Color TransparentColor;
+ internal readonly int ImageCount = 1;
+
+ internal ImageListItem(Icon value)
+ {
+ if (value == null)
+ throw new ArgumentNullException("value");
+
+ // Icons are cloned.
+ this.Image = (Icon)value.Clone();
+ }
+
+ internal ImageListItem(Image value)
+ {
+ if (value == null)
+ throw new ArgumentNullException("value");
+
+ if (!(value is Bitmap))
+ throw new ArgumentException("Image must be a Bitmap.");
+
+ // Images are not cloned.
+ this.Image = value;
+ }
+
+ internal ImageListItem(Image value, Color transparentColor) : this(value)
+ {
+ this.Flags = ItemFlags.UseTransparentColor;
+ this.TransparentColor = transparentColor;
+ }
+
+ internal ImageListItem(Image value, int imageCount) : this(value)
+ {
+ this.Flags = ItemFlags.ImageStrip;
+ this.ImageCount = imageCount;
+ }
+ }
+
+ #region ImageCollection Private Fields
+ private ColorDepth colorDepth = DefaultColorDepth;
+ private Size imageSize = DefaultImageSize;
+ private Color transparentColor = DefaultTransparentColor;
+ private ArrayList list = new ArrayList();
+#if NET_2_0
+ private ArrayList keys = new ArrayList();
+#endif
+ private int count;
+ private bool handleCreated;
+#if NET_2_0
+ private int lastKeyIndex = -1;
+#endif
+ private readonly ImageList owner;
+ #endregion // ImageCollection Private Fields
+
+ #region ImageCollection Internal Constructors
+ // For use in ImageList
+ internal ImageCollection(ImageList owner)
+ {
+ this.owner = owner;
+ }
+ #endregion // ImageCollection Internal Constructor
+
+ #region ImageCollection Internal Instance Properties
+ // For use in ImageList
+ internal ColorDepth ColorDepth {
+ get {
+ return this.colorDepth;
+ }
+
+ set {
+ if (!Enum.IsDefined(typeof(ColorDepth), value))
+ throw new InvalidEnumArgumentException("value", (int)value, typeof(ColorDepth));
+
+ if (this.colorDepth != value) {
+ this.colorDepth = value;
+ RecreateHandle();
+ }
+ }
+ }
+
+ // For use in ImageList
+ internal IntPtr Handle {
+ get {
+ CreateHandle();
+ return (IntPtr)(-1);
+ }
+ }
+
+ // For use in ImageList
+ internal bool HandleCreated {
+ get {
+ return this.handleCreated;
+ }
+ }
+
+ // For use in ImageList
+ internal Size ImageSize {
+ get {
+ return this.imageSize;
+ }
+
+ set {
+ if (value.Width < 1 || value.Width > 256 || value.Height < 1 || value.Height > 256)
+ throw new ArgumentException("ImageSize.Width and Height must be between 1 and 256", "value");
+
+ if (this.imageSize != value) {
+ this.imageSize = value;
+ RecreateHandle();
+ }
+ }
+ }
+
+ // For use in ImageList
+ internal ImageListStreamer ImageStream {
+ get {
+ return this.Empty ? null : new ImageListStreamer(this);
+ }
+
+ set {
+ int index;
+ Image[] streamImages;
+
+ if (value == null) {
+#if NET_2_0
+ if (this.handleCreated)
+ DestroyHandle();
+ else
+ this.Clear();
+#endif
+ }
+ // Only deserialized ImageListStreamers are used.
+ else if ((streamImages = value.Images) != null) {
+ this.list = new ArrayList(streamImages.Length);
+ this.count = 0;
+ this.handleCreated = true;
+#if NET_2_0
+ this.keys = new ArrayList(streamImages.Length);
+#endif
+
+ for (index = 0; index < streamImages.Length; index++) {
+ list.Add((Image)streamImages[index].Clone());
+#if NET_2_0
+ keys.Add(null);
+#endif
+ }
+
+ // Invalid ColorDepth values are ignored.
+ if (Enum.IsDefined(typeof(ColorDepth), value.ColorDepth))
+ this.colorDepth = (ColorDepth)value.ColorDepth;
+ this.imageSize = value.ImageSize;
+
+#if NET_2_0
+ // Event is raised even when handle was not created yet.
+ owner.OnRecreateHandle();
+#endif
+ }
+ }
+ }
+
+ // For use in ImageList
+ internal Color TransparentColor {
+ get {
+ return this.transparentColor;
+ }
+
+ set {
+ this.transparentColor = value;
+ }
+ }
+ #endregion // ImageCollection Internal Instance Properties
+
+ #region ImageCollection Public Instance Properties
+ [Browsable(false)]
+ public int Count {
+ get {
+ return this.handleCreated ? list.Count : this.count;
+ }
+ }
+
+ public bool Empty {
+ get {
+ return this.Count == 0;
+ }
+ }
+
+ public bool IsReadOnly {
+ get {
+ return false;
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public Image this[int index] {
+ get {
+ return (Image)GetImage(index).Clone();
+ }
+
+ set {
+ Image image;
+
+ if (index < 0 || index >= this.Count)
+ throw new ArgumentOutOfRangeException("index");
+
+ if (value == null)
+ throw new ArgumentNullException("value");
+
+ if (!(value is Bitmap))
+ throw new ArgumentException("Image must be a Bitmap.");
+
+ image = CreateImage(value, this.transparentColor);
+ CreateHandle();
+ list[index] = image;
+ }
+ }
+
+#if NET_2_0
+ public Image this[string key] {
+ get {
+ int index;
+
+ return (index = IndexOfKey(key)) == -1 ? null : this[index];
+ }
+ }
+
+ public StringCollection Keys {
+ get {
+ int index;
+ string key;
+ StringCollection keyCollection;
+
+ // Returns all keys even when there are more keys than
+ // images. Null keys are returned as empty strings.
+
+ keyCollection = new StringCollection();
+ for (index = 0; index < keys.Count; index++)
+ keyCollection.Add(((key = (string)keys[index]) == null || key.Length == 0) ? string.Empty : key);
+
+ return keyCollection;
+ }
+ }
+#endif
+ #endregion // ImageCollection Public Instance Properties
+
+ #region ImageCollection Private Static Methods
+#if NET_2_0
+ private static bool CompareKeys(string key1, string key2)
+ {
+ // Keys are case-insensitive and keys with different length
+ // are not equal even when string.Compare treats them equal.
+
+ if (key1 == null || key2 == null || key1.Length != key2.Length)
+ return false;
+
+ return string.Compare(key1, key2, true, CultureInfo.InvariantCulture) == 0;
+ }
+#endif
+ #endregion // ImageCollection Private Static Methods
+
+ #region ImageCollection Private Instance Methods
+#if NET_2_0
+ private int AddItem(string key, ImageListItem item)
+#else
+ private int AddItem(ImageListItem item)
+#endif
+ {
+ int itemIndex;
+#if NET_2_0
+ int index;
+#endif
+
+ if (this.handleCreated)
+ itemIndex = AddItemInternal(item);
+ else {
+ // Image strips are counted as a single item in the return
+ // value of Add and AddStrip until handle is created.
+
+ itemIndex = list.Add(item);
+ this.count += item.ImageCount;
+ }
+
+#if NET_2_0
+ if ((item.Flags & ItemFlags.ImageStrip) == 0)
+ keys.Add(key);
+ else
+ for (index = 0; index < item.ImageCount; index++)
+ keys.Add(null);
+#endif
+
+ return itemIndex;
+ }
+
+ private int AddItemInternal(ImageListItem item)
+ {
+ if (item.Image is Icon) {
+ int imageWidth;
+ int imageHeight;
+ Bitmap bitmap;
+ Graphics graphics;
+
+ bitmap = new Bitmap(imageWidth = this.imageSize.Width, imageHeight = this.imageSize.Height, PixelFormat.Format32bppArgb);
+ graphics = Graphics.FromImage(bitmap);
+ graphics.DrawIcon((Icon)item.Image, new Rectangle(0, 0, imageWidth, imageHeight));
+ graphics.Dispose();
+
+ ReduceColorDepth(bitmap);
+ return list.Add(bitmap);
+ }
+ else if ((item.Flags & ItemFlags.ImageStrip) == 0)
+ return list.Add(CreateImage((Image)item.Image, (item.Flags & ItemFlags.UseTransparentColor) == 0 ? this.transparentColor : item.TransparentColor));
+ else {
+ int imageX;
+ int width;
+ int imageWidth;
+ int imageHeight;
+ int index;
+ Image image;
+ Bitmap bitmap;
+ Graphics graphics;
+ Rectangle imageRect;
+ ImageAttributes imageAttributes;
+
+ // When ImageSize was changed after adding image strips
+ // Count will return invalid values based on old ImageSize
+ // but when creating handle either ArgumentException will
+ // be thrown or image strip will be added according to the
+ // new ImageSize. This can result in image count
+ // difference that can result in exceptions in methods
+ // that use Count before creating handle. In addition this
+ // can result in the loss of sync with keys. When doing
+ // the same after handle was created there are no problems
+ // as handle will be recreated after changing ImageSize
+ // that results in the loss of images added previously.
+
+ if ((width = (image = (Image)item.Image).Width) == 0 || (width % (imageWidth = this.imageSize.Width)) != 0)
+ throw new ArgumentException("Width of image strip must be a positive multiple of ImageSize.Width.", "value");
+
+ if (image.Height != (imageHeight = this.imageSize.Height))
+ throw new ArgumentException("Height of image strip must be equal to ImageSize.Height.", "value");
+
+ imageRect = new Rectangle(0, 0, imageWidth, imageHeight);
+ if (this.transparentColor.A == 0)
+ imageAttributes = null;
+ else {
+ imageAttributes = new ImageAttributes();
+ imageAttributes.SetColorKey(this.transparentColor, this.transparentColor);
+ }
+
+ index = list.Count;
+ for (imageX = 0; imageX < width; imageX += imageWidth) {
+ bitmap = new Bitmap(imageWidth, imageHeight, PixelFormat.Format32bppArgb);
+ graphics = Graphics.FromImage(bitmap);
+ graphics.DrawImage(image, imageRect, imageX, 0, imageWidth, imageHeight, GraphicsUnit.Pixel, imageAttributes);
+ graphics.Dispose();
+
+ ReduceColorDepth(bitmap);
+ list.Add(bitmap);
+ }
+
+ if (imageAttributes != null)
+ imageAttributes.Dispose();
+
+ return index;
+ }
+ }
+
+ private void CreateHandle()
+ {
+ int index;
+ ArrayList items;
+
+ if (!this.handleCreated) {
+ items = this.list;
+ this.list = new ArrayList(this.count);
+ this.count = 0;
+ this.handleCreated = true;
+
+ for (index = 0; index < items.Count; index++)
+ AddItemInternal((ImageListItem)items[index]);
+ }
+ }
+
+ private Image CreateImage(Image value, Color transparentColor)
+ {
+ int imageWidth;
+ int imageHeight;
+ Bitmap bitmap;
+ Graphics graphics;
+ ImageAttributes imageAttributes;
+
+ if (transparentColor.A == 0)
+ imageAttributes = null;
+ else {
+ imageAttributes = new ImageAttributes();
+ imageAttributes.SetColorKey(transparentColor, transparentColor);
+ }
+
+ bitmap = new Bitmap(imageWidth = this.imageSize.Width, imageHeight = this.imageSize.Height, PixelFormat.Format32bppArgb);
+ graphics = Graphics.FromImage(bitmap);
+ graphics.DrawImage(value, new Rectangle(0, 0, imageWidth, imageHeight), 0, 0, value.Width, value.Height, GraphicsUnit.Pixel, imageAttributes);
+ graphics.Dispose();
+
+ if (imageAttributes != null)
+ imageAttributes.Dispose();
+
+ ReduceColorDepth(bitmap);
+ return bitmap;
+ }
+
+ private void RecreateHandle()
+ {
+ if (this.handleCreated) {
+ DestroyHandle();
+ this.handleCreated = true;
+ owner.OnRecreateHandle();
+ }
+ }
+
+ private unsafe void ReduceColorDepth(Bitmap bitmap)
+ {
+ byte* pixelPtr;
+ byte* lineEndPtr;
+ byte* linePtr;
+ int line;
+ int pixel;
+ int height;
+ int widthBytes;
+ int stride;
+ BitmapData bitmapData;
+ Color[] palette;
+
+ if (this.colorDepth < ColorDepth.Depth32Bit) {
+ bitmapData = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
+ try {
+ linePtr = (byte*)bitmapData.Scan0;
+ height = bitmapData.Height;
+ widthBytes = bitmapData.Width << 2;
+ stride = bitmapData.Stride;
+
+ if (this.colorDepth < ColorDepth.Depth16Bit) {
+ palette = (this.colorDepth < ColorDepth.Depth8Bit ? IndexedColorDepths.Palette4Bit : IndexedColorDepths.Palette8Bit).Entries;
+
+ for (line = 0; line < height; line++) {
+ lineEndPtr = linePtr + widthBytes;
+ for (pixelPtr = linePtr; pixelPtr < lineEndPtr; pixelPtr += 4)
+ *(int*)pixelPtr = ((pixel = *(int*)pixelPtr) & AlphaMask) == 0 ? 0x00000000 : IndexedColorDepths.GetNearestColor(palette, pixel | AlphaMask);
+ linePtr += stride;
+ }
+ }
+ else if (this.colorDepth < ColorDepth.Depth24Bit) {
+ for (line = 0; line < height; line++) {
+ lineEndPtr = linePtr + widthBytes;
+ for (pixelPtr = linePtr; pixelPtr < lineEndPtr; pixelPtr += 4)
+ *(int*)pixelPtr = ((pixel = *(int*)pixelPtr) & AlphaMask) == 0 ? 0x00000000 : (pixel & 0x00F8F8F8) | AlphaMask;
+ linePtr += stride;
+ }
+ }
+ else {
+ for (line = 0; line < height; line++) {
+ lineEndPtr = linePtr + widthBytes;
+ for (pixelPtr = linePtr; pixelPtr < lineEndPtr; pixelPtr += 4)
+ *(int*)pixelPtr = ((pixel = *(int*)pixelPtr) & AlphaMask) == 0 ? 0x00000000 : pixel | AlphaMask;
+ linePtr += stride;
+ }
+ }
+ }
+ finally {
+ bitmap.UnlockBits(bitmapData);
+ }
+ }
+ }
+ #endregion // ImageCollection Private Instance Methods
+
+ #region ImageCollection Internal Instance Methods
+ // For use in ImageList
+ internal void DestroyHandle()
+ {
+ if (this.handleCreated) {
+ this.list = new ArrayList();
+ this.count = 0;
+ this.handleCreated = false;
+#if NET_2_0
+ keys = new ArrayList();
+#endif
+ }
+ }
+
+ // For use in ImageList
+ internal Image GetImage(int index)
+ {
+ if (index < 0 || index >= this.Count)
+ throw new ArgumentOutOfRangeException("index");
+
+ CreateHandle();
+ return (Image)list[index];
+ }
+
+ // For use in ImageListStreamer
+ internal Image[] ToArray()
+ {
+ Image[] images;
+
+ // Handle is created even when the list is empty.
+ CreateHandle();
+ images = new Image[list.Count];
+ list.CopyTo(images);
+ return images;
+ }
+ #endregion // ImageCollection Internal Instance Methods
+
+ #region ImageCollection Public Instance Methods
+ public void Add(Icon value)
+ {
+#if NET_2_0
+ Add(null, value);
+#else
+ AddItem(new ImageListItem(value));
+#endif
+ }
+
+ public void Add(Image value)
+ {
+#if NET_2_0
+ Add(null, value);
+#else
+ AddItem(new ImageListItem(value));
+#endif
+ }
+
+ public int Add(Image value, Color transparentColor)
+ {
+#if NET_2_0
+ return AddItem(null, new ImageListItem(value, transparentColor));
+#else
+ return AddItem(new ImageListItem(value, transparentColor));
+#endif
+ }
+
+#if NET_2_0
+ public void Add(string key, Icon icon)
+ {
+ // Argument has name icon but exceptions use name value.
+ AddItem(key, new ImageListItem(icon));
+ }
+
+ public void Add(string key, Image image)
+ {
+ // Argument has name image but exceptions use name value.
+ AddItem(key, new ImageListItem(image));
+ }
+
+ public void AddRange(Image[] images)
+ {
+ int index;
+
+ if (images == null)
+ throw new ArgumentNullException("images");
+
+ for (index = 0; index < images.Length; index++)
+ Add(images[index]);
+ }
+#endif
+
+ public int AddStrip(Image value)
+ {
+ int width;
+ int imageWidth;
+
+ if (value == null)
+ throw new ArgumentNullException("value");
+
+ if ((width = value.Width) == 0 || (width % (imageWidth = this.imageSize.Width)) != 0)
+ throw new ArgumentException("Width of image strip must be a positive multiple of ImageSize.Width.", "value");
+
+ if (value.Height != this.imageSize.Height)
+ throw new ArgumentException("Height of image strip must be equal to ImageSize.Height.", "value");
+
+#if NET_2_0
+ return AddItem(null, new ImageListItem(value, width / imageWidth));
+#else
+ return AddItem(new ImageListItem(value, width / imageWidth));
+#endif
+ }
+
+ public void Clear()
+ {
+ list.Clear();
+ if (this.handleCreated)
+ this.count = 0;
+#if NET_2_0
+ keys.Clear();
+#endif
+ }
+
+#if NET_2_0
+ [EditorBrowsable(EditorBrowsableState.Never)]
+#endif
+ public bool Contains(Image image)
+ {
+ throw new NotSupportedException();
+ }
+
+#if NET_2_0
+ public bool ContainsKey(string key)
+ {
+ return IndexOfKey(key) != -1;
+ }
+#endif
+
+ public IEnumerator GetEnumerator()
+ {
+ Image[] images = new Image[this.Count];
+ int index;
+
+ if (images.Length != 0) {
+ // Handle is created only when there are images.
+ CreateHandle();
+
+ for (index = 0; index < images.Length; index++)
+ images[index] = (Image)((Image)list[index]).Clone();
+ }
+
+ return images.GetEnumerator();
+ }
+
+#if NET_2_0
+ [EditorBrowsable(EditorBrowsableState.Never)]
+#endif
+ public int IndexOf(Image image)
+ {
+ throw new NotSupportedException();
+ }
+
+#if NET_2_0
+ public int IndexOfKey(string key)
+ {
+ int index;
+
+ if (key != null && key.Length != 0) {
+ // When last IndexOfKey was successful and the same key was
+ // assigned to an image with a lower index than the last
+ // result and the key of the last result equals to key
+ // argument the last result is returned.
+
+ if (this.lastKeyIndex >= 0 && this.lastKeyIndex < this.Count && CompareKeys((string)keys[this.lastKeyIndex], key))
+ return this.lastKeyIndex;
+
+ // Duplicate keys are allowed and first match is returned.
+ for (index = 0; index < this.Count; index++)
+ if (CompareKeys((string)keys[index], key))
+ return this.lastKeyIndex = index;
+ }
+
+ return this.lastKeyIndex = -1;
+ }
+#endif
+
+#if NET_2_0
+ [EditorBrowsable(EditorBrowsableState.Never)]
+#endif
+ public void Remove(Image image)
+ {
+ throw new NotSupportedException();
+ }
+
+ public void RemoveAt(int index)
+ {
+ if (index < 0 || index >= this.Count)
+ throw new ArgumentOutOfRangeException("index");
+
+ CreateHandle();
+ list.RemoveAt(index);
+#if NET_2_0
+ keys.RemoveAt(index);
+#endif
+ }
+
+#if NET_2_0
+ public void RemoveByKey(string key)
+ {
+ int index;
+
+ if ((index = IndexOfKey(key)) != -1)
+ RemoveAt(index);
+ }
+
+ public void SetKeyName(int index, string name)
+ {
+ // Only SetKeyName throws IndexOutOfRangeException.
+ if (index < 0 || index >= this.Count)
+ throw new IndexOutOfRangeException();
+
+ keys[index] = name;
+ }
+#endif
+ #endregion // ImageCollection Public Instance Methods
+
+ #region ImageCollection Interface Properties
+ object IList.this[int index] {
+ get {
+ return this[index];
+ }
+
+ set {
+ if (!(value is Image))
+ throw new ArgumentException("value");
+
+ this[index] = (Image)value;
+ }
+ }
+
+ bool IList.IsFixedSize {
+ get {
+ return false;
+ }
+ }
+
+ bool ICollection.IsSynchronized {
+ get {
+ return false;
+ }
+ }
+
+ object ICollection.SyncRoot {
+ get {
+ return this;
+ }
+ }
+ #endregion // ImageCollection Interface Properties
+
+ #region ImageCollection Interface Methods
+ int IList.Add(object value)
+ {
+ int index;
+
+ if (!(value is Image))
+ throw new ArgumentException("value");
+
+ index = this.Count;
+ this.Add((Image)value);
+ return index;
+ }
+
+ bool IList.Contains(object value)
+ {
+ return value is Image ? this.Contains((Image)value) : false;
+ }
+
+ int IList.IndexOf(object value)
+ {
+ return value is Image ? this.IndexOf((Image)value) : -1;
+ }
+
+ void IList.Insert(int index, object value)
+ {
+ throw new NotSupportedException();
+ }
+
+ void IList.Remove(object value)
+ {
+ if (value is Image)
+ this.Remove((Image)value);
+ }
+
+ void ICollection.CopyTo(Array array, int index)
+ {
+ int imageIndex;
+
+ for (imageIndex = 0; imageIndex < this.Count; imageIndex++)
+ array.SetValue(this[index], index++);
+ }
+ #endregion // ImageCollection Interface Methods
+ }
+ #endregion // Sub-classes
+
+ #region Public Constructors
+ public ImageList()
+ {
+ images = new ImageCollection(this);
+ }
+
+ public ImageList(System.ComponentModel.IContainer container) : this()
+ {
+ container.Add(this);
+ }
+ #endregion // Public Constructors
+
+ #region Private Instance Methods
+ private void OnRecreateHandle()
+ {
+ if (this.recreateHandle != null)
+ this.recreateHandle(this, EventArgs.Empty);
+ }
+
+#if NET_2_0
+ // For use in Designers
+ private void ResetColorDepth()
+ {
+ this.ColorDepth = DefaultColorDepth;
+ }
+
+ // For use in Designers
+ private void ResetImageSize()
+ {
+ this.ImageSize = DefaultImageSize;
+ }
+
+ // For use in Designers
+ private void ResetTransparentColor()
+ {
+ this.TransparentColor = DefaultTransparentColor;
+ }
+
+ // For use in Designers
+ private bool ShouldSerializeColorDepth()
+ {
+ // ColorDepth is serialized in ImageStream when non-empty.
+ // It is serialized even if it has its default value when empty.
+ return images.Empty;
+ }
+
+ // For use in Designers
+ private bool ShouldSerializeImageSize()
+ {
+ // ImageSize is serialized in ImageStream when non-empty.
+ // It is serialized even if it has its default value when empty.
+ return images.Empty;
+ }
+
+ // For use in Designers
+ private bool ShouldSerializeTransparentColor()
+ {
+ return this.TransparentColor != DefaultTransparentColor;
+ }
+#endif
+ #endregion // Private Instance Methods
+
+ #region Public Instance Properties
+#if !NET_2_0
+ [DefaultValue(DefaultColorDepth)]
+#endif
+ public ColorDepth ColorDepth {
+ get {
+ return images.ColorDepth;
+ }
+
+ set {
+ images.ColorDepth = value;
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public IntPtr Handle {
+ get {
+ return images.Handle;
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool HandleCreated {
+ get {
+ return images.HandleCreated;
+ }
+ }
+
+ [DefaultValue(null)]
+ [MergableProperty(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public ImageCollection Images {
+ get {
+ return this.images;
+ }
+ }
+
+ [Localizable(true)]
+ public Size ImageSize {
+ get {
+ return images.ImageSize;
+ }
+
+ set {
+ images.ImageSize = value;
+ }
+ }
+
+ [Browsable(false)]
+ [DefaultValue(null)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public ImageListStreamer ImageStream {
+ get {
+ return images.ImageStream;
+ }
+
+ set {
+ images.ImageStream = value;
+ }
+ }
+
+#if NET_2_0
+ [Bindable(true)]
+ [DefaultValue(null)]
+ [Localizable(false)]
+ [TypeConverter(typeof(StringConverter))]
+ public object Tag {
+ get {
+ return this.tag;
+ }
+
+ set {
+ this.tag = value;
+ }
+ }
+#endif
+
+ public Color TransparentColor {
+ get {
+ return images.TransparentColor;
+ }
+
+ set {
+ images.TransparentColor = value;
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Instance Methods
+ public void Draw(Graphics g, Point pt, int index)
+ {
+ this.Draw(g, pt.X, pt.Y, index);
+ }
+
+ public void Draw(Graphics g, int x, int y, int index)
+ {
+ g.DrawImage(images.GetImage(index), x, y);
+ }
+
+ public void Draw(Graphics g, int x, int y, int width, int height, int index)
+ {
+ g.DrawImage(images.GetImage(index), x, y, width, height);
+ }
+
+ public override string ToString()
+ {
+ return base.ToString() + " Images.Count: " + images.Count.ToString() + ", ImageSize: " + this.ImageSize.ToString();
+ }
+ #endregion // Public Instance Methods
+
+ #region Protected Instance Methods
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ images.DestroyHandle();
+
+ base.Dispose(disposing);
+ }
+ #endregion // Protected Instance Methods
+
+ #region Events
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public event EventHandler RecreateHandle {
+ add {
+ this.recreateHandle += value;
+ }
+
+ remove {
+ this.recreateHandle -= value;
+ }
+ }
+ #endregion // Events
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImageListConverter.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImageListConverter.cs
new file mode 100644
index 00000000000..937df964561
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImageListConverter.cs
@@ -0,0 +1,44 @@
+// 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) 2005 Novell, Inc.
+//
+// Authors:
+// Matthias Felgner matthiasf@voelcker.com
+//
+
+// COMPLETE
+
+using System.ComponentModel;
+
+
+namespace System.Windows.Forms {
+ internal class ImageListConverter : ComponentConverter {
+ #region Constructors
+ public ImageListConverter() : base(typeof(ImageList)) {
+ }
+ #endregion Constructors
+
+ #region Public Methods
+ public override bool GetPropertiesSupported(ITypeDescriptorContext context){
+ return true;
+ }
+ #endregion Public Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImageListStreamer.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImageListStreamer.cs
new file mode 100644
index 00000000000..6f5fae74117
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImageListStreamer.cs
@@ -0,0 +1,226 @@
+// 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) 2002-2005 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+//
+// Based on work done by:
+// Dennis Hayes (dennish@Raytek.com)
+// Aleksey Ryabchuk (ryabchuk@yahoo.com)
+
+using System.IO;
+using System.Drawing;
+using System.Collections;
+using System.Drawing.Imaging;
+using System.Runtime.Serialization;
+using System.Runtime.InteropServices;
+
+
+namespace System.Windows.Forms {
+
+ [Serializable]
+ public sealed class ImageListStreamer : ISerializable {
+
+ private static byte [] signature = new byte [] {77 , 83 , 70 , 116};
+
+ private readonly ImageList.ImageCollection imageCollection;
+ private Image [] images;
+ private Size image_size;
+ private Color back_color;
+
+ internal ImageListStreamer (ImageList.ImageCollection imageCollection) {
+ this.imageCollection = imageCollection;
+ }
+
+ private ImageListStreamer (SerializationInfo info, StreamingContext context) {
+
+ byte [] data = (byte [])info.GetValue ("Data", typeof (byte []));
+ if (data == null || data.Length <= signature.Length)
+ return;
+ // check the signature ( 'MSFt' )
+ if (data [0] != signature [0] || data [1] != signature [1] ||
+ data [2] != signature [2] || data [3] != signature [3])
+ return;
+
+ // calulate size of array needed for decomressed data
+ int i = 0;
+ int real_byte_count = 0;
+ for (i = signature.Length; i < data.Length; i += 2)
+ real_byte_count += data [i];
+
+ if (real_byte_count == 0)
+ return;
+
+ int j = 0;
+ byte [] decompressed = new byte [real_byte_count];
+
+ for (i = signature.Length; i < data.Length; i += 2) {
+ for (int k = 0; k < data [i]; k++)
+ decompressed [j++] = data [i + 1];
+ }
+
+ MemoryStream stream = new MemoryStream (decompressed);
+ BinaryReader reader = new BinaryReader (stream);
+
+ try {
+ // read image list header
+ reader.ReadUInt16 (); // usMagic
+ reader.ReadUInt16 (); // usVersion
+ ushort cCurImage = reader.ReadUInt16 ();
+ reader.ReadUInt16 (); // cMaxImage
+ reader.ReadUInt16 (); // cGrow
+ ushort cx = reader.ReadUInt16 ();
+ ushort cy = reader.ReadUInt16 ();
+ uint bkcolor = reader.ReadUInt32 ();
+ reader.ReadUInt16 (); // flags
+
+ short [] ovls = new short [4];
+ for (i = 0; i < ovls.Length; i++) {
+ ovls[i] = reader.ReadInt16 ();
+ }
+
+ image_size = new Size (cx, cy);
+ back_color = Color.FromArgb ((int) bkcolor);
+
+ MemoryStream start = new MemoryStream (decompressed,
+ (int) stream.Position,
+ (int) stream.Length - (int) stream.Position,
+ false);
+
+ Image image = Image.FromStream (start);
+
+ // Holy calamity. This is what happens on MS
+ // if the background colour is 0xFFFFFFFF (CLR_NONE)
+ // the mask is set to the color at pixel 0, 0
+ Bitmap bmp = image as Bitmap;
+ if (bkcolor == 0xFFFFFFFF && bmp != null)
+ back_color = bmp.GetPixel (0, 0);
+
+ int step = image.Width / cx;
+ images = new Image [cCurImage];
+
+ Rectangle dest_rect = new Rectangle (0, 0, cx, cy);
+ for (int r = 0 ; r < cCurImage ; r++) {
+ Rectangle area = new Rectangle (
+ (r % step) * cx,
+ (r / step) * cy,
+ cx, cy);
+ Bitmap b = new Bitmap (cx, cy);
+ using (Graphics g = Graphics.FromImage (b)) {
+ g.DrawImage (image, dest_rect, area,
+ GraphicsUnit.Pixel);
+ }
+ b.MakeTransparent (back_color);
+ images [r] = b;
+ }
+
+ } catch (Exception e) {
+
+ }
+ }
+
+ [MonoTODO ("RLE is broken")]
+ public void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ MemoryStream stream = new MemoryStream ();
+ BinaryWriter writer = new BinaryWriter (stream);
+
+ writer.Write (signature);
+ writer.Write (GetStreamData ());
+
+ info.AddValue ("Data", stream.ToArray (), typeof (byte []));
+ }
+
+ [MonoTODO ("Images should be written to the stream")]
+ private byte [] GetStreamData ()
+ {
+ MemoryStream stream = new MemoryStream ();
+ BinaryWriter writer = new BinaryWriter (stream);
+ Image [] images = (imageCollection != null) ? imageCollection.ToArray () : this.images;
+
+ int cols = 4;
+ int rows = images.Length / cols;
+ if (images.Length % cols > 0)
+ ++rows;
+
+ Bitmap main = new Bitmap (cols * ImageSize.Width, rows * ImageSize.Height);
+ using (Graphics g = Graphics.FromImage (main)) {
+ g.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (BackColor), 0, 0, cols * ImageSize.Width, rows * ImageSize.Height);
+ for (int i = 0; i < images.Length; i++) {
+ g.DrawImage (images [i], (i % cols) * ImageSize.Width,
+ (i / cols) * ImageSize.Height);
+ }
+ }
+
+ writer.Write ((ushort) (('L' << 8) | 'I')); // magic
+ writer.Write ((ushort) 0x101); // version
+ writer.Write ((ushort) images.Length);
+ writer.Write ((ushort) images.Length);
+ writer.Write ((ushort) (rows * cols));
+ writer.Write ((ushort) 0x4); // grow....not sure this should be hard coded
+ writer.Write ((ushort) image_size.Width);
+ writer.Write ((ushort) image_size.Height);
+ writer.Write (BackColor.ToArgb ());
+ writer.Write ((ushort) 0x1009); // flags
+
+ for (int i = 0; i < 4; i++)
+ writer.Write ((short) -1); // ovls
+
+ return RLEncodeData (stream.ToArray ());
+ }
+
+ // TODO: This is broken
+ private byte [] RLEncodeData (byte [] data)
+ {
+ MemoryStream stream = new MemoryStream ();
+ BinaryWriter writer = new BinaryWriter (stream);
+
+ for (int i = 0; i < data.Length; i += 2) {
+ int seq = 0;
+ byte item = data [i];
+ while (data [i++] == item && i < data.Length)
+ seq++;
+ writer.Write ((byte) seq);
+ writer.Write (item);
+ }
+
+ return stream.ToArray ();
+
+ }
+
+ internal Image [] Images {
+ get { return images; }
+ }
+
+ internal Size ImageSize {
+ get { return image_size; }
+ }
+
+ internal ColorDepth ColorDepth {
+ get { return ColorDepth.Depth32Bit; }
+ }
+
+ internal Color BackColor {
+ get { return back_color; }
+ }
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImeMode.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImeMode.cs
new file mode 100644
index 00000000000..5adad1fcbce
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImeMode.cs
@@ -0,0 +1,47 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [ComVisible(true)]
+ public enum ImeMode {
+ NoControl = 0,
+ On = 1,
+ Off = 2,
+ Disable = 3,
+ Hiragana = 4,
+ Katakana = 5,
+ KatakanaHalf = 6,
+ AlphaFull = 7,
+ Alpha = 8,
+ HangulFull = 9,
+ Hangul = 10,
+ Inherit = -1
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImplicitHScrollBar.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImplicitHScrollBar.cs
new file mode 100644
index 00000000000..cd3345f914c
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImplicitHScrollBar.cs
@@ -0,0 +1,47 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+// Partially based on work by:
+// Aleksey Ryabchuk ryabchuk@yahoo.com
+// Alexandre Pigolkine pigolkine@gmx.de
+// Dennis Hayes dennish@raytek.com
+// Jaak Simm jaaksimm@firm.ee
+// John Sohn jsohn@columbus.rr.com
+//
+
+// COMPLETE
+
+using System;
+
+namespace System.Windows.Forms {
+
+ internal class ImplicitHScrollBar : HScrollBar {
+
+ public ImplicitHScrollBar ()
+ {
+ SetStyle (ControlStyles.Selectable, false);
+ }
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImplicitVScrollBar.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImplicitVScrollBar.cs
new file mode 100644
index 00000000000..ca731d3df0f
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ImplicitVScrollBar.cs
@@ -0,0 +1,47 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+// Partially based on work by:
+// Aleksey Ryabchuk ryabchuk@yahoo.com
+// Alexandre Pigolkine pigolkine@gmx.de
+// Dennis Hayes dennish@raytek.com
+// Jaak Simm jaaksimm@firm.ee
+// John Sohn jsohn@columbus.rr.com
+//
+
+// COMPLETE
+
+using System;
+
+namespace System.Windows.Forms {
+
+ internal class ImplicitVScrollBar : VScrollBar {
+
+ public ImplicitVScrollBar ()
+ {
+ SetStyle (ControlStyles.Selectable, false);
+ }
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/InputLanguage.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/InputLanguage.cs
new file mode 100644
index 00000000000..7cc4fc85657
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/InputLanguage.cs
@@ -0,0 +1,137 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// NOT COMPLETE
+
+using System.Globalization;
+
+namespace System.Windows.Forms {
+ public sealed class InputLanguage {
+ internal static InputLanguageCollection all;
+ private IntPtr handle;
+ private CultureInfo culture;
+ private string layout_name;
+ private static InputLanguage current_input;
+ private static InputLanguage default_input;
+
+ #region Private Constructor
+ [MonoTODO("Pull Microsofts InputLanguages and enter them here")]
+ internal InputLanguage() {
+ if (all == null) {
+ all = new InputLanguageCollection();
+
+ all.Add(new InputLanguage(IntPtr.Zero, new CultureInfo(""), "US"));
+ }
+ if (default_input == null) {
+ default_input=InputLanguage.FromCulture(CultureInfo.CurrentUICulture);
+ }
+
+ if (current_input == null) {
+ current_input=InputLanguage.FromCulture(CultureInfo.CurrentUICulture);
+ }
+ }
+
+ internal InputLanguage(IntPtr handle, CultureInfo culture, string layout_name) : this() {
+ this.handle=handle;
+ this.culture=culture;
+ this.layout_name=layout_name;
+ }
+ #endregion // Private Constructor
+
+ #region Public Static Properties
+ public static InputLanguage CurrentInputLanguage {
+ get {
+ return current_input;
+ }
+
+ set {
+ if (all.Contains(value)) {
+ current_input=value;
+ }
+ }
+ }
+
+ public static InputLanguage DefaultInputLanguage {
+ get {
+ return default_input;
+ }
+ }
+
+ public static InputLanguageCollection InstalledInputLanguages {
+ get {
+ return all;
+ }
+ }
+ #endregion // Public Static Properties
+
+ #region Public Instance Properties
+ public CultureInfo Culture {
+ get {
+ return this.culture;
+ }
+ }
+
+ public IntPtr Handle {
+ get {
+ return this.handle;
+ }
+ }
+
+ public string LayoutName {
+ get {
+ return this.layout_name;
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Static Methods
+ public static InputLanguage FromCulture(System.Globalization.CultureInfo culture) {
+ foreach (InputLanguage c in all) {
+ if (culture.EnglishName==c.culture.EnglishName) {
+ return new InputLanguage(c.handle, c.culture, c.layout_name);
+ }
+ }
+
+ return new InputLanguage(all[0].handle, all[0].culture, all[0].layout_name);
+ }
+ #endregion // Public Static Methods
+
+ #region Public Instance Methods
+ public override bool Equals(object value) {
+ if (value is InputLanguage) {
+ if ((((InputLanguage)value).culture==this.culture) && (((InputLanguage)value).handle==this.handle) && (((InputLanguage)value).layout_name==this.layout_name)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public override int GetHashCode() {
+ return base.GetHashCode();
+ }
+ #endregion // Public Instance Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/InputLanguageChangedEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/InputLanguageChangedEventArgs.cs
new file mode 100644
index 00000000000..ea16f810bbc
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/InputLanguageChangedEventArgs.cs
@@ -0,0 +1,72 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+
+// COMPLETE
+
+using System.Globalization;
+
+namespace System.Windows.Forms {
+ public class InputLanguageChangedEventArgs : EventArgs {
+ private CultureInfo culture;
+ private byte charset;
+ private InputLanguage input_language;
+
+ #region Public Constructors
+ public InputLanguageChangedEventArgs(System.Globalization.CultureInfo culture, byte charSet) {
+ this.culture = culture;
+ this.charset = charSet;
+ this.input_language = InputLanguage.FromCulture(culture);
+ }
+
+ public InputLanguageChangedEventArgs(InputLanguage inputLanguage, byte charSet) {
+ this.culture = inputLanguage.Culture;
+ this.charset = charSet;
+ this.input_language = inputLanguage;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public byte CharSet {
+ get {
+ return this.charset;
+ }
+ }
+
+ public CultureInfo Culture {
+ get {
+ return this.culture;
+ }
+ }
+
+ public InputLanguage InputLanguage {
+ get {
+ return this.input_language;
+ }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/InputLanguageChangedEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/InputLanguageChangedEventHandler.cs
new file mode 100644
index 00000000000..807dce30b19
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/InputLanguageChangedEventHandler.cs
@@ -0,0 +1,31 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public delegate void InputLanguageChangedEventHandler(object sender, InputLanguageChangedEventArgs e);
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/InputLanguageChangingEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/InputLanguageChangingEventArgs.cs
new file mode 100644
index 00000000000..643e3394db7
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/InputLanguageChangingEventArgs.cs
@@ -0,0 +1,74 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+
+// COMPLETE
+
+using System;
+using System.ComponentModel;
+using System.Globalization;
+
+namespace System.Windows.Forms {
+ public class InputLanguageChangingEventArgs : System.ComponentModel.CancelEventArgs {
+ private CultureInfo culture;
+ private bool system_charset;
+ private InputLanguage input_language;
+
+ #region Public Constructors
+ public InputLanguageChangingEventArgs (System.Globalization.CultureInfo culture, bool sysCharSet) {
+ this.culture = culture;
+ this.system_charset = sysCharSet;
+ this.input_language = InputLanguage.FromCulture(culture);
+ }
+
+ public InputLanguageChangingEventArgs (InputLanguage inputLanguage, bool sysCharSet) {
+ this.culture = inputLanguage.Culture;
+ this.system_charset = sysCharSet;
+ this.input_language = inputLanguage;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public bool SysCharSet {
+ get {
+ return this.system_charset;
+ }
+ }
+
+ public CultureInfo Culture {
+ get {
+ return this.culture;
+ }
+ }
+
+ public InputLanguage InputLanguage {
+ get {
+ return this.input_language;
+ }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/InputLanguageChangingEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/InputLanguageChangingEventHandler.cs
new file mode 100644
index 00000000000..10a81b03e88
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/InputLanguageChangingEventHandler.cs
@@ -0,0 +1,31 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public delegate void InputLanguageChangingEventHandler(object sender, InputLanguageChangingEventArgs e);
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/InputLanguageCollection.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/InputLanguageCollection.cs
new file mode 100644
index 00000000000..a2f990cb366
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/InputLanguageCollection.cs
@@ -0,0 +1,84 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+using System.Collections;
+using System.Globalization;
+
+namespace System.Windows.Forms {
+ public class InputLanguageCollection : ReadOnlyCollectionBase {
+ #region Local Variables
+ internal InputLanguage[] list;
+ #endregion // Local Variables
+
+ #region Private Constructor
+ internal InputLanguageCollection() {
+ }
+ #endregion // Private Constructor
+
+ #region Internal Instance Methods
+ internal void Add(InputLanguage value) {
+ list[list.Length]=value;
+ }
+ #endregion
+
+ #region Public Instance Methods
+ public InputLanguage this [int index] {
+ get {
+ if (index>=list.Length) {
+ throw new ArgumentOutOfRangeException("index");
+ }
+ return list[index];
+ }
+ }
+
+ public bool Contains(InputLanguage value) {
+ for (int i=0; i<list.Length; i++) {
+ if ((list[i].Culture==value.Culture) && (list[i].LayoutName==value.LayoutName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void CopyTo(InputLanguage[] dest, int index) {
+ if (list.Length>0) {
+ Array.Copy(list, 0, dest, index, list.Length);
+ }
+ }
+
+ public int IndexOf(InputLanguage value) {
+ for (int i=0; i<list.Length; i++) {
+ if ((list[i].Culture==value.Culture) && (list[i].LayoutName==value.LayoutName)) {
+ return i;
+ }
+ }
+ return -1;
+ }
+ #endregion // Public Instance Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/InternalWindowManager.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/InternalWindowManager.cs
new file mode 100644
index 00000000000..f0484ca1dcd
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/InternalWindowManager.cs
@@ -0,0 +1,639 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+//
+//
+
+
+using System;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ internal class InternalWindowManager {
+
+ private static Color titlebar_color;
+
+ private int BorderWidth = 3;
+ private Size MinTitleBarSize = new Size (115, 25);
+
+ internal Form form;
+
+ private TitleButton close_button;
+ private TitleButton maximize_button;
+ private TitleButton minimize_button;
+
+ private TitleButton [] title_buttons = new TitleButton [3];
+
+ // moving windows
+ internal Point start;
+ private State state;
+ private FormPos sizing_edge;
+ internal Rectangle virtual_position;
+ private Rectangle prev_virtual_position;
+ private Rectangle prev_bounds;
+ private bool maximized;
+
+ private class TitleButton {
+ public Rectangle Rectangle;
+ public ButtonState State;
+ public CaptionButton Caption;
+ public EventHandler Clicked;
+
+ public TitleButton (CaptionButton caption, EventHandler clicked)
+ {
+ Caption = caption;
+ Clicked = clicked;
+ }
+ }
+
+ private enum State {
+ Idle,
+ Moving,
+ Sizing,
+ }
+
+ [Flags]
+ private enum FormPos {
+ None,
+
+ TitleBar = 1,
+
+ Top = 2,
+ Left = 4,
+ Right = 8,
+ Bottom = 16,
+
+ TopLeft = Top | Left,
+ TopRight = Top | Right,
+
+ BottomLeft = Bottom | Left,
+ BottomRight = Bottom | Right,
+
+ AnyEdge = Top | Left | Right | Bottom,
+ }
+
+ public InternalWindowManager (Form form)
+ {
+ titlebar_color = Color.FromArgb (255, 0, 0, 255);
+ this.form = form;
+
+ CreateButtons ();
+ }
+
+ public Form Form {
+ get { return form; }
+ }
+
+ public bool Maximized {
+ get { return maximized; }
+ }
+
+ public bool HandleMessage (ref Message m)
+ {
+ switch ((Msg)m.Msg) {
+
+
+ // The mouse handling messages are actually
+ // not WM_NC* messages except for the first button and NCMOVEs
+ // down because we capture on the form
+
+ case Msg.WM_MOUSEMOVE:
+ return HandleMouseMove (form, ref m);
+
+ case Msg.WM_LBUTTONUP:
+ HandleLButtonUp (ref m);
+ break;
+
+ case Msg.WM_RBUTTONDOWN:
+ case Msg.WM_LBUTTONDOWN:
+ return HandleButtonDown (ref m);
+
+ case Msg.WM_NCMOUSEMOVE:
+ return HandleNCMouseMove (form, ref m);
+
+ case Msg.WM_NCLBUTTONUP:
+ return HandleNCLButtonUp (ref m);
+
+ case Msg.WM_NCLBUTTONDOWN:
+ return HandleNCLButtonDown (ref m);
+
+ case Msg.WM_MOUSE_LEAVE:
+ FormMouseLeave (ref m);
+ break;
+
+ case Msg.WM_NCPAINT:
+ PaintWindowDecorations ();
+ break;
+ }
+ return false;
+ }
+
+ public virtual void UpdateBorderStyle (FormBorderStyle border_style)
+ {
+ XplatUI.SetBorderStyle (form.Handle, border_style);
+
+ if (ShouldRemoveWindowManager (border_style)) {
+ form.RemoveWindowManager ();
+ return;
+ }
+
+ CreateButtons ();
+ }
+
+ public virtual void PointToClient (ref int x, ref int y)
+ {
+ // toolwindows stay in screencoords
+ }
+
+ public virtual void PointToScreen (ref int x, ref int y)
+ {
+ XplatUI.ClientToScreen (form.Handle, ref x, ref y);
+ }
+
+ protected virtual bool ShouldRemoveWindowManager (FormBorderStyle style)
+ {
+ return style != FormBorderStyle.FixedToolWindow && style != FormBorderStyle.SizableToolWindow;
+ }
+
+ private void CreateButtons ()
+ {
+ switch (form.FormBorderStyle) {
+ case FormBorderStyle.None:
+ close_button = null;
+ minimize_button = null;
+ maximize_button = null;
+ break;
+ case FormBorderStyle.FixedSingle:
+ case FormBorderStyle.Fixed3D:
+ case FormBorderStyle.FixedDialog:
+ case FormBorderStyle.Sizable:
+ close_button = new TitleButton (CaptionButton.Close, new EventHandler (CloseClicked));
+ minimize_button = new TitleButton (CaptionButton.Minimize, new EventHandler (MinimizeClicked));
+ maximize_button = new TitleButton (CaptionButton.Maximize, new EventHandler (MaximizeClicked));
+ break;
+ case FormBorderStyle.FixedToolWindow:
+ case FormBorderStyle.SizableToolWindow:
+ close_button = new TitleButton (CaptionButton.Close, new EventHandler (CloseClicked));
+ break;
+ }
+
+ title_buttons [0] = close_button;
+ title_buttons [1] = minimize_button;
+ title_buttons [2] = maximize_button;
+ }
+
+ protected virtual bool HandleButtonDown (ref Message m)
+ {
+ form.BringToFront ();
+ return false;
+ }
+
+ protected virtual bool HandleNCLButtonDown (ref Message m)
+ {
+ form.BringToFront ();
+
+ int x = Control.LowOrder ((int) m.LParam.ToInt32 ());
+ int y = Control.HighOrder ((int) m.LParam.ToInt32 ());
+
+ start = Cursor.Position;
+ virtual_position = form.Bounds;
+
+ form.PointToClient (ref x, ref y);
+ // Need to adjust because we are in NC land
+ y += TitleBarHeight;
+ FormPos pos = FormPosForCoords (x, y);
+
+ if (pos == FormPos.TitleBar) {
+ HandleTitleBarDown (x, y);
+ return true;
+ }
+
+ if (IsSizable) {
+ SetCursorForPos (pos);
+
+ if ((pos & FormPos.AnyEdge) == 0)
+ return false;
+
+ state = State.Sizing;
+ sizing_edge = pos;
+ form.Capture = true;
+ return true;
+ }
+
+ return false;
+ }
+
+ private void HandleTitleBarDown (int x, int y)
+ {
+ foreach (TitleButton button in title_buttons) {
+ if (button != null && button.Rectangle.Contains (x, y)) {
+ button.State = ButtonState.Pushed;
+ return;
+ }
+ }
+
+ if (maximized)
+ return;
+
+ state = State.Moving;
+ form.Capture = true;
+ }
+
+ private bool HandleMouseMove (Form form, ref Message m)
+ {
+ switch (state) {
+ case State.Moving:
+ HandleWindowMove (m);
+ return true;
+ case State.Sizing:
+ HandleSizing (m);
+ return true;
+ }
+
+ /*
+ if (IsSizable) {
+ int x = Control.LowOrder ((int) m.LParam.ToInt32 ());
+ int y = Control.HighOrder ((int) m.LParam.ToInt32 ());
+ FormPos pos = FormPosForCoords (x, y);
+ Console.WriteLine ("position: " + pos);
+ SetCursorForPos (pos);
+
+ ClearVirtualPosition ();
+ state = State.Idle;
+ }
+ */
+
+ return false;
+ }
+
+ private bool HandleNCMouseMove (Form form, ref Message m)
+ {
+ if (IsSizable) {
+ int x = Control.LowOrder ((int) m.LParam.ToInt32 ());
+ int y = Control.HighOrder ((int) m.LParam.ToInt32 ());
+ FormPos pos = FormPosForCoords (x, y);
+
+ SetCursorForPos (pos);
+
+ ClearVirtualPosition ();
+ state = State.Idle;
+ }
+
+ return false;
+ }
+
+ private void FormMouseLeave (ref Message m)
+ {
+ form.ResetCursor ();
+ }
+
+ private void SetCursorForPos (FormPos pos)
+ {
+ switch (pos) {
+ case FormPos.TopLeft:
+ case FormPos.BottomRight:
+ form.Cursor = Cursors.SizeNWSE;
+ break;
+ case FormPos.TopRight:
+ case FormPos.BottomLeft:
+ form.Cursor = Cursors.SizeNESW;
+ break;
+ case FormPos.Top:
+ case FormPos.Bottom:
+ form.Cursor = Cursors.SizeNS;
+ break;
+ case FormPos.Left:
+ case FormPos.Right:
+ form.Cursor = Cursors.SizeWE;
+ break;
+ default:
+ form.ResetCursor ();
+ break;
+ }
+ }
+
+ protected virtual void HandleWindowMove (Message m)
+ {
+ Point move = MouseMove (m);
+
+ UpdateVP (virtual_position.X + move.X, virtual_position.Y + move.Y,
+ virtual_position.Width, virtual_position.Height);
+ }
+
+ private void HandleSizing (Message m)
+ {
+ Point move = MouseMove (m);
+ Rectangle pos = virtual_position;
+ int mw = MinTitleBarSize.Width + (BorderWidth * 2);
+ int mh = MinTitleBarSize.Height + (BorderWidth * 2);
+
+ if ((sizing_edge & FormPos.Top) != 0) {
+ int height = form.Height - move.Y;
+ if (height <= mh) {
+ move.Y += height - mh;
+ height = mh;
+ }
+ pos.Y = form.Top + move.Y;
+ pos.Height = height;
+ } else if ((sizing_edge & FormPos.Bottom) != 0) {
+ int height = form.Height + move.Y;
+ if (height <= mh)
+ move.Y -= height - mh;
+ pos.Height = form.Height + move.Y;
+ }
+
+ if ((sizing_edge & FormPos.Left) != 0) {
+ int width = form.Width - move.X;
+ if (width <= mw) {
+ move.X += width - mw;
+ width = mw;
+ }
+ pos.X = form.Left + move.X;
+ pos.Width = width;
+ } else if ((sizing_edge & FormPos.Right) != 0) {
+ int width = form.Width + move.X;
+ if (width <= mw)
+ move.X -= width - mw;
+ pos.Width = form.Width + move.X;
+ }
+
+ UpdateVP (pos);
+ }
+
+ private bool IsSizable {
+ get {
+ switch (form.FormBorderStyle) {
+ case FormBorderStyle.Sizable:
+ case FormBorderStyle.SizableToolWindow:
+ return true;
+ default:
+ return false;
+ }
+ }
+ }
+
+ private bool HasBorders {
+ get {
+ return form.FormBorderStyle != FormBorderStyle.None;
+ }
+ }
+
+ private bool IsToolWindow {
+ get {
+ if (form.FormBorderStyle == FormBorderStyle.SizableToolWindow ||
+ form.FormBorderStyle == FormBorderStyle.FixedToolWindow)
+ return true;
+ return false;
+ }
+ }
+
+ private int TitleBarHeight {
+ get {
+ if (IsToolWindow)
+ return 19;
+ if (form.FormBorderStyle == FormBorderStyle.None)
+ return 0;
+ return 26;
+ }
+ }
+
+ protected void UpdateVP (Rectangle r)
+ {
+ UpdateVP (r.X, r.Y, r.Width, r.Height);
+ }
+
+ protected void UpdateVP (Point loc, int w, int h)
+ {
+ UpdateVP (loc.X, loc.Y, w, h);
+ }
+
+ protected void UpdateVP (int x, int y, int w, int h)
+ {
+ virtual_position.X = x;
+ virtual_position.Y = y;
+ virtual_position.Width = w;
+ virtual_position.Height = h;
+
+ DrawVirtualPosition (virtual_position);
+ }
+
+ private void HandleLButtonUp (ref Message m)
+ {
+ if (state == State.Idle)
+ return;
+
+ ClearVirtualPosition ();
+
+ form.Capture = false;
+ form.Bounds = virtual_position;
+ state = State.Idle;
+ }
+
+ private bool HandleNCLButtonUp (ref Message m)
+ {
+ int x = Control.LowOrder ((int) m.LParam.ToInt32 ());
+ int y = Control.HighOrder ((int) m.LParam.ToInt32 ());
+
+ form.PointToClient (ref x, ref y);
+
+ // Need to adjust because we are in NC land
+ y += TitleBarHeight;
+
+ foreach (TitleButton button in title_buttons) {
+ if (button != null && button.Rectangle.Contains (x, y)) {
+ button.Clicked (this, EventArgs.Empty);
+ return true;
+ }
+ }
+
+ return true;
+ }
+
+ private void PaintWindowDecorations ()
+ {
+ Graphics dc = XplatUI.GetMenuDC (form.Handle, IntPtr.Zero);
+
+ if (HasBorders) {
+ Rectangle borders = new Rectangle (0, 0, form.Width, form.Height);
+
+ ControlPaint.DrawBorder3D (dc, borders, Border3DStyle.Raised);
+
+ if (IsSizable) {
+ borders.Inflate (-1, -1);
+ ControlPaint.DrawFocusRectangle (dc, borders);
+ }
+ }
+
+ Color color = ThemeEngine.Current.ColorControlDark;
+
+ if (form.Focused && !maximized)
+ color = titlebar_color;
+
+ Rectangle tb = new Rectangle (BorderWidth, BorderWidth,
+ form.Width - (BorderWidth * 2), TitleBarHeight - 1);
+
+ dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (color), tb);
+
+ dc.DrawLine (new Pen (Color.White, 1), BorderWidth,
+ TitleBarHeight + BorderWidth, form.Width - BorderWidth,
+ TitleBarHeight + BorderWidth);
+
+ if (!IsToolWindow) {
+ tb.X += 18; // Room for the icon and the buttons
+ tb.Width = (form.Width - 62) - tb.X;
+ }
+
+ if (form.Text != null) {
+ StringFormat format = new StringFormat ();
+ format.FormatFlags = StringFormatFlags.NoWrap;
+ format.Trimming = StringTrimming.EllipsisCharacter;
+ format.LineAlignment = StringAlignment.Center;
+ dc.DrawString (form.Text, form.Font,
+ ThemeEngine.Current.ResPool.GetSolidBrush (Color.White),
+ tb, format);
+ }
+
+ if (!IsToolWindow && HasBorders) {
+ if (form.Icon != null) {
+ dc.DrawIcon (form.Icon, new Rectangle (BorderWidth + 3,
+ BorderWidth + 3, 16, 16));
+ }
+
+ minimize_button.Rectangle = new Rectangle (form.Width - 62,
+ BorderWidth + 2, 18, 22);
+
+ maximize_button.Rectangle = new Rectangle (form.Width - 44,
+ BorderWidth + 2, 18, 22);
+
+ close_button.Rectangle = new Rectangle (form.Width - 24,
+ BorderWidth + 2, 18, 22);
+
+ DrawTitleButton (dc, minimize_button);
+ DrawTitleButton (dc, maximize_button);
+ DrawTitleButton (dc, close_button);
+ } else if (IsToolWindow) {
+ close_button.Rectangle = new Rectangle (form.Width - BorderWidth - 2 - 13,
+ BorderWidth + 2, 13, 13);
+ DrawTitleButton (dc, close_button);
+ }
+ }
+
+ private void DrawTitleButton (Graphics dc, TitleButton button)
+ {
+ dc.FillRectangle (SystemBrushes.Control, button.Rectangle);
+
+ ControlPaint.DrawCaptionButton (dc, button.Rectangle,
+ button.Caption, ButtonState.Normal);
+ }
+
+ private void CloseClicked (object sender, EventArgs e)
+ {
+ form.Close ();
+ // form.Close should set visibility to false somewhere
+ // in it's closing chain but currently does not.
+ form.Visible = false;
+ }
+
+ private void MinimizeClicked (object sender, EventArgs e)
+ {
+ form.SuspendLayout ();
+ form.Width = MinTitleBarSize.Width + (BorderWidth * 2);
+ form.Height = MinTitleBarSize.Height + (BorderWidth * 2);
+ form.ResumeLayout ();
+ }
+
+ private void MaximizeClicked (object sender, EventArgs e)
+ {
+ if (maximized) {
+ form.Bounds = prev_bounds;
+ maximized = false;
+ } else {
+ prev_bounds = form.Bounds;
+ form.Bounds = form.Parent.Bounds;
+ maximized = true;
+ }
+ }
+
+ protected Point MouseMove (Message m)
+ {
+ Point cp = Cursor.Position;
+ return new Point (cp.X - start.X, cp.Y - start.Y);
+ }
+
+ protected virtual void DrawVirtualPosition (Rectangle virtual_position)
+ {
+ form.Location = virtual_position.Location;
+ start = Cursor.Position;
+ }
+
+ protected virtual void ClearVirtualPosition ()
+ {
+
+ }
+
+ private FormPos FormPosForCoords (int x, int y)
+ {
+ if (y < TitleBarHeight + BorderWidth) {
+
+ if (y > BorderWidth && x > BorderWidth &&
+ x < form.Width - BorderWidth)
+ return FormPos.TitleBar;
+
+ if (x < BorderWidth || (x < 20 && y < BorderWidth))
+ return FormPos.TopLeft;
+
+ if (x > form.Width - BorderWidth ||
+ (x > form.Width - 20 && y < BorderWidth))
+ return FormPos.TopRight;
+
+ if (y < BorderWidth)
+ return FormPos.Top;
+
+ } else if (y > form.Height - 20) {
+
+ if (x < BorderWidth ||
+ (x < 20 && y > form.Height - BorderWidth))
+ return FormPos.BottomLeft;
+
+ if (x > form.Width - BorderWidth ||
+ (x > form.Width - 20 &&
+ y > form.Height - BorderWidth))
+ return FormPos.BottomRight;
+
+ if (y > form.Height - BorderWidth)
+ return FormPos.Bottom;
+
+
+ } else if (x < BorderWidth) {
+ return FormPos.Left;
+ } else if (x > form.Width - BorderWidth) {
+ return FormPos.Right;
+ }
+
+ return FormPos.None;
+ }
+ }
+}
+
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/InvalidateEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/InvalidateEventArgs.cs
new file mode 100644
index 00000000000..3280911fd78
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/InvalidateEventArgs.cs
@@ -0,0 +1,49 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+using System.Drawing;
+
+namespace System.Windows.Forms {
+ public class InvalidateEventArgs : EventArgs {
+ private Rectangle invalidated_rectangle;
+
+ #region Public Constructors
+ public InvalidateEventArgs(System.Drawing.Rectangle invalidRect) {
+ this.invalidated_rectangle=invalidRect;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public Rectangle InvalidRect {
+ get {
+ return this.invalidated_rectangle;
+ }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/InvalidateEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/InvalidateEventHandler.cs
new file mode 100644
index 00000000000..3755a18b370
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/InvalidateEventHandler.cs
@@ -0,0 +1,32 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public delegate void InvalidateEventHandler (object sender, InvalidateEventArgs e);
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ItemActivation.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ItemActivation.cs
new file mode 100644
index 00000000000..7eb27a1304b
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ItemActivation.cs
@@ -0,0 +1,40 @@
+// 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 Kevin Rector
+//
+// Copyright (c) 2004 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Kevin Rector (krector@nazmail.com)
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms
+{
+ [Serializable]
+ public enum ItemActivation
+ {
+ OneClick = 1,
+ Standard = 0,
+ TwoClick = 2
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ItemBoundsPortion.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ItemBoundsPortion.cs
new file mode 100644
index 00000000000..70cf9daa4da
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ItemBoundsPortion.cs
@@ -0,0 +1,37 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Ravindra (rkumar@novell.com)
+//
+
+
+namespace System.Windows.Forms
+{
+ [Serializable]
+ public enum ItemBoundsPortion
+ {
+ Entire = 0,
+ Icon = 1,
+ Label = 2,
+ ItemOnly = 3
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ItemChangedEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ItemChangedEventArgs.cs
new file mode 100644
index 00000000000..4c6408870b6
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ItemChangedEventArgs.cs
@@ -0,0 +1,50 @@
+// 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 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Ravindra (rkumar@novell.com)
+//
+
+// COMPLETE
+
+
+using System;
+
+namespace System.Windows.Forms
+{
+ public class ItemChangedEventArgs : EventArgs
+ {
+ private int index;
+
+ #region Internal Constructors
+ internal ItemChangedEventArgs (int index)
+ {
+ this.index = index;
+ }
+ #endregion // Internal Constructors
+
+ #region Public Instance Properties
+ public int Index {
+ get { return index; }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ItemChangedEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ItemChangedEventHandler.cs
new file mode 100644
index 00000000000..fef3ef453c4
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ItemChangedEventHandler.cs
@@ -0,0 +1,34 @@
+// 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 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Ravindra (rkumar@novell.com)
+//
+
+
+// COMPLETE
+
+
+namespace System.Windows.Forms
+{
+ [Serializable]
+ public delegate void ItemChangedEventHandler (object sender, ItemChangedEventArgs e);
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ItemCheckEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ItemCheckEventArgs.cs
new file mode 100644
index 00000000000..7ae0369c444
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ItemCheckEventArgs.cs
@@ -0,0 +1,65 @@
+// 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 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Ravindra (rkumar@novell.com)
+//
+
+// COMPLETE
+
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms
+{
+ [ComVisible (true)]
+ public class ItemCheckEventArgs : EventArgs
+ {
+ private CheckState currentValue;
+ private int index;
+ private CheckState newValue;
+
+ #region Public Constructors
+ public ItemCheckEventArgs (int index, CheckState newCheckValue, CheckState currentValue)
+ {
+ this.index = index;
+ this.newValue = newCheckValue;
+ this.currentValue = currentValue;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public CheckState CurrentValue {
+ get { return currentValue; }
+ }
+
+ public int Index {
+ get { return index; }
+ }
+
+ public CheckState NewValue {
+ get { return newValue; }
+ set { newValue = value; }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ItemCheckEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ItemCheckEventHandler.cs
new file mode 100644
index 00000000000..abd41083e63
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ItemCheckEventHandler.cs
@@ -0,0 +1,34 @@
+// 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 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Ravindra (rkumar@novell.com)
+//
+
+
+// COMPLETE
+
+
+namespace System.Windows.Forms
+{
+ [Serializable]
+ public delegate void ItemCheckEventHandler (object sender, ItemCheckEventArgs e);
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ItemDragEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ItemDragEventArgs.cs
new file mode 100644
index 00000000000..ec591761781
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ItemDragEventArgs.cs
@@ -0,0 +1,63 @@
+// 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 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Ravindra (rkumar@novell.com)
+//
+
+// COMPLETE
+
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms
+{
+ [ComVisible (true)]
+ public class ItemDragEventArgs : EventArgs
+ {
+ private MouseButtons button;
+ private object item;
+
+ #region Public Constructors
+ public ItemDragEventArgs (MouseButtons button)
+ {
+ this.button = button;
+ }
+
+ public ItemDragEventArgs (MouseButtons button, object item)
+ {
+ this.button = button;
+ this.item = item;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public MouseButtons Button {
+ get { return button; }
+ }
+
+ public object Item {
+ get { return item; }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ItemDragEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ItemDragEventHandler.cs
new file mode 100644
index 00000000000..508c3848e39
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ItemDragEventHandler.cs
@@ -0,0 +1,34 @@
+// 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 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Ravindra (rkumar@novell.com)
+//
+
+
+// COMPLETE
+
+
+namespace System.Windows.Forms
+{
+ [Serializable]
+ public delegate void ItemDragEventHandler (object sender, ItemDragEventArgs e);
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/KeyEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/KeyEventArgs.cs
new file mode 100644
index 00000000000..acc4fa00588
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/KeyEventArgs.cs
@@ -0,0 +1,111 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+
+// COMPLETE
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [ComVisible(true)]
+ public class KeyEventArgs : EventArgs {
+ private Keys key_data;
+ private bool event_handled;
+
+ #region Public Constructors
+ public KeyEventArgs(Keys keyData) {
+ this.key_data=keyData | XplatUI.State.ModifierKeys;
+ this.event_handled=false;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public virtual bool Alt {
+ get {
+ if ((this.key_data & Keys.Alt)==0) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+ }
+
+ public bool Control {
+ get {
+ if ((this.key_data & Keys.Control)==0) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+ }
+
+ public bool Handled {
+ get {
+ return this.event_handled;
+ }
+
+ set {
+ this.event_handled=value;
+ }
+ }
+
+ public Keys KeyCode {
+ get {
+ return (this.key_data & Keys.KeyCode);
+ }
+ }
+
+ public Keys KeyData {
+ get {
+ return this.key_data;
+ }
+ }
+
+ public int KeyValue {
+ get {
+ return Convert.ToInt32(this.key_data);
+ }
+ }
+
+ public Keys Modifiers {
+ get {
+ return (this.key_data & Keys.Modifiers);
+ }
+ }
+
+ public virtual bool Shift {
+ get {
+ if ((this.key_data & Keys.Shift)==0) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/KeyEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/KeyEventHandler.cs
new file mode 100644
index 00000000000..ff67a7f80ea
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/KeyEventHandler.cs
@@ -0,0 +1,33 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public delegate void KeyEventHandler (object sender, KeyEventArgs e);
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/KeyPressEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/KeyPressEventArgs.cs
new file mode 100644
index 00000000000..6907480be21
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/KeyPressEventArgs.cs
@@ -0,0 +1,63 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+
+// COMPLETE
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [ComVisible(true)]
+ public class KeyPressEventArgs : EventArgs {
+ private char key_char;
+ private bool event_handled;
+
+ #region Public Constructors
+ public KeyPressEventArgs(char keyChar) {
+ this.key_char=keyChar;
+ this.event_handled=false;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public bool Handled {
+ get {
+ return this.event_handled;
+ }
+
+ set {
+ this.event_handled=value;
+ }
+ }
+
+ public char KeyChar {
+ get {
+ return this.key_char;
+ }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/KeyPressEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/KeyPressEventHandler.cs
new file mode 100644
index 00000000000..3d259159715
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/KeyPressEventHandler.cs
@@ -0,0 +1,31 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public delegate void KeyPressEventHandler (object sender, KeyPressEventArgs e);
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/KeyboardLayouts.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/KeyboardLayouts.cs
new file mode 100644
index 00000000000..da4f5689331
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/KeyboardLayouts.cs
@@ -0,0 +1,697 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+//
+//
+
+// TODO:
+// - Move these tables into unmanaged code (libgdiplus) and access with a pointer
+//
+
+
+using System;
+
+namespace System.Windows.Forms {
+
+ internal class KeyboardLayout {
+ public string Comment;
+ public int CodePage;
+ public string [] Key;
+ public short [] Scan;
+ public VirtualKeys [] VKey;
+
+ public KeyboardLayout (string comment, int code_page, string [] key, short [] scan, VirtualKeys [] vkey)
+ {
+ Comment = comment;
+ CodePage = code_page;
+ Key = key;
+ Scan = scan;
+ VKey = vkey;
+ }
+ }
+
+ internal class KeyboardLayouts {
+
+ public static readonly int MainLen = 48;
+ private static readonly string [] main_key_US = new string []
+ {
+ "`~","1!","2@","3#","4$","5%","6^","7&","8*","9(","0)","-_","=+",
+ "qQ","wW","eE","rR","tT","yY","uU","iI","oO","pP","[{","]}",
+ "aA","sS","dD","fF","gG","hH","jJ","kK","lL",";:","'\"","\\|",
+ "zZ","xX","cC","vV","bB","nN","mM",",<",".>","/?"
+ };
+
+ private static string [] main_key_US_phantom = new string []
+ {
+ "`~","1!","2@","3#","4$","5%","6^","7&","8*","9(","0)","-_","=+",
+ "qQ","wW","eE","rR","tT","yY","uU","iI","oO","pP","[{","]}",
+ "aA","sS","dD","fF","gG","hH","jJ","kK","lL",";:","'\"","\\|",
+ "zZ","xX","cC","vV","bB","nN","mM",",<",".>","/?",
+ "<>" /* the phantom key */
+ };
+
+ /*** United States keyboard layout (dvorak version) */
+ private static readonly string [] main_key_US_dvorak = new string []
+ {
+ "`~","1!","2@","3#","4$","5%","6^","7&","8*","9(","0)","[{","]}",
+ "'\"",",<",".>","pP","yY","fF","gG","cC","rR","lL","/?","=+",
+ "aA","oO","eE","uU","iI","dD","hH","tT","nN","sS","-_","\\|",
+ ";:","qQ","jJ","kK","xX","bB","mM","wW","vV","zZ"
+ };
+
+ /*** British keyboard layout */
+ private static readonly string [] main_key_UK = new string []
+ {
+ "`","1!","2\"","3£","4$","5%","6^","7&","8*","9(","0)","-_","=+",
+ "qQ","wW","eE","rR","tT","yY","uU","iI","oO","pP","[{","]}",
+ "aA","sS","dD","fF","gG","hH","jJ","kK","lL",";:","'@","#~",
+ "zZ","xX","cC","vV","bB","nN","mM",",<",".>","/?",
+ "\\|"
+ };
+
+ /*** French keyboard layout (contributed by Eric Pouech) */
+ private static readonly string [] main_key_FR = new string []
+ {
+ "²","&1","é2~","\"3#","'4{","(5[","-6|","è7","_8\\","ç9^±","à0@",")°]","=+}",
+ "aA","zZ","eE","rR","tT","yY","uU","iI","oO","pP","^¨","$£¤",
+ "qQ","sSß","dD","fF","gG","hH","jJ","kK","lL","mM","ù%","*µ",
+ "wW","xX","cC","vV","bB","nN",",?",";.",":/","!§",
+ "<>"
+ };
+
+ /*** Icelandic keyboard layout (contributed by Ríkharður Egilsson) */
+ private static readonly string [] main_key_IS = new string []
+ {
+ "°","1!","2\"","3#","4$","5%","6&","7/{","8([","9)]","0=}","öÖ\\","-_",
+ "qQ@","wW","eE","rR","tT","yY","uU","iI","oO","pP","ðÃ","'?~",
+ "aA","sS","dD","fF","gG","hH","jJ","kK","lL","æÆ","´^","+*`",
+ "zZ","xX","cC","vV","bB","nN","mM",",;",".:","þÞ",
+ "<>|"
+ };
+
+ /*** German keyboard layout (contributed by Ulrich Weigand) */
+ private static readonly string [] main_key_DE = new string []
+ {
+ "^°","1!","2\"²","3§³","4$","5%","6&","7/{","8([","9)]","0=}","ß?\\","'`",
+ "qQ@","wW","eE€","rR","tT","zZ","uU","iI","oO","pP","üÜ","+*~",
+ "aA","sS","dD","fF","gG","hH","jJ","kK","lL","öÖ","äÄ","#´",
+ "yY","xX","cC","vV","bB","nN","mMµ",",;",".:","-_",
+ "<>|"
+ };
+
+ /*** German keyboard layout without dead keys */
+ private static readonly string [] main_key_DE_nodead = new string []
+ {
+ "^°","1!","2\"","3§","4$","5%","6&","7/{","8([","9)]","0=}","ß?\\","´",
+ "qQ","wW","eE","rR","tT","zZ","uU","iI","oO","pP","üÜ","+*~",
+ "aA","sS","dD","fF","gG","hH","jJ","kK","lL","öÖ","äÄ","#'",
+ "yY","xX","cC","vV","bB","nN","mM",",;",".:","-_",
+ "<>"
+ };
+
+ /*** Swiss German keyboard layout (contributed by Jonathan Naylor) */
+ private static readonly string [] main_key_SG = new string []
+ {
+ "§°","1+|","2\"@","3*#","4ç","5%","6&¬","7/¦","8(¢","9)","0=","'?´","^`~",
+ "qQ","wW","eE","rR","tT","zZ","uU","iI","oO","pP","üè[","¨!]",
+ "aA","sS","dD","fF","gG","hH","jJ","kK","lL","öé","äà{","$£}",
+ "yY","xX","cC","vV","bB","nN","mM",",;",".:","-_",
+ "<>\\"
+ };
+
+ /*** Swiss French keyboard layout (contributed by Philippe Froidevaux) */
+ private static readonly string [] main_key_SF = new string []
+ {
+ "§°","1+|","2\"@","3*#","4ç","5%","6&¬","7/¦","8(¢","9)","0=","'?´","^`~",
+ "qQ","wW","eE","rR","tT","zZ","uU","iI","oO","pP","èü[","¨!]",
+ "aA","sS","dD","fF","gG","hH","jJ","kK","lL","éö","àä{","$£}",
+ "yY","xX","cC","vV","bB","nN","mM",",;",".:","-_",
+ "<>\\"
+ };
+
+ /*** Norwegian keyboard layout (contributed by Ove KÃ¥ven) */
+ private static readonly string [] main_key_NO = new string []
+ {
+ "|§","1!","2\"@","3#£","4¤$","5%","6&","7/{","8([","9)]","0=}","+?","\\`´",
+ "qQ","wW","eE","rR","tT","yY","uU","iI","oO","pP","åÅ","¨^~",
+ "aA","sS","dD","fF","gG","hH","jJ","kK","lL","øØ","æÆ","'*",
+ "zZ","xX","cC","vV","bB","nN","mM",",;",".:","-_",
+ "<>"
+ };
+
+ /*** Danish keyboard layout (contributed by Bertho Stultiens) */
+ private static readonly string [] main_key_DA = new string []
+ {
+ "½§","1!","2\"@","3#£","4¤$","5%","6&","7/{","8([","9)]","0=}","+?","´`|",
+ "qQ","wW","eE","rR","tT","yY","uU","iI","oO","pP","åÅ","¨^~",
+ "aA","sS","dD","fF","gG","hH","jJ","kK","lL","æÆ","øØ","'*",
+ "zZ","xX","cC","vV","bB","nN","mM",",;",".:","-_",
+ "<>\\"
+ };
+
+ /*** Swedish keyboard layout (contributed by Peter Bortas) */
+ private static readonly string [] main_key_SE = new string []
+ {
+ "§½","1!","2\"@","3#£","4¤$","5%","6&","7/{","8([","9)]","0=}","+?\\","´`",
+ "qQ","wW","eE","rR","tT","yY","uU","iI","oO","pP","åÅ","¨^~",
+ "aA","sS","dD","fF","gG","hH","jJ","kK","lL","öÖ","äÄ","'*",
+ "zZ","xX","cC","vV","bB","nN","mM",",;",".:","-_",
+ "<>|"
+ };
+
+ /*** Canadian French keyboard layout */
+ private static readonly string [] main_key_CF = new string []
+ {
+ "#|\\","1!±","2\"@","3/£","4$¢","5%¤","6?¬","7&¦","8*²","9(³","0)¼","-_½","=+¾",
+ "qQ","wW","eE","rR","tT","yY","uU","iI","oO§","pP¶","^^[","¸¨]",
+ "aA","sS","dD","fF","gG","hH","jJ","kK","lL",";:~","``{","<>}",
+ "zZ","xX","cC","vV","bB","nN","mM",",'-",".","éÉ",
+ "«»°"
+ };
+
+ /*** Portuguese keyboard layout */
+ private static readonly string [] main_key_PT = new string []
+ {
+ "\\¦","1!","2\"@","3#£","4$§","5%","6&","7/{","8([","9)]","0=}","'?","«»",
+ "qQ", "wW","eE", "rR", "tT", "yY", "uU", "iI", "oO", "pP", "+*\\¨","\\'\\`",
+ "aA", "sS","dD", "fF", "gG", "hH", "jJ", "kK", "lL", "çÇ", "ºª", "\\~\\^",
+ "zZ", "xX","cC", "vV", "bB", "nN", "mM", ",;", ".:", "-_",
+ "<>"
+ };
+
+ /*** Italian keyboard layout */
+ private static readonly string [] main_key_IT = new string []
+ {
+ "\\|","1!¹","2\"²","3£³","4$¼","5%½","6&¾","7/{","8([","9)]","0=}","'?`","ì^~",
+ "qQ@","wW","eE","rR","tT","yY","uU","iI","oOø","pPþ","èé[","+*]",
+ "aA","sSß","dDð","fF","gG","hH","jJ","kK","lL","òç@","à°#","ù§",
+ "zZ","xX","cC","vV","bB","nN","mMµ",",;",".:·","-_",
+ "<>|"
+ };
+
+ /*** Finnish keyboard layout */
+ private static readonly string [] main_key_FI = new string []
+ {
+ "","1!","2\"@","3#","4$","5%","6&","7/{","8([","9)]","0=}","+?\\","\'`",
+ "qQ","wW","eE","rR","tT","yY","uU","iI","oO","pP","","\"^~",
+ "aA","sS","dD","fF","gG","hH","jJ","kK","lL","","","'*",
+ "zZ","xX","cC","vV","bB","nN","mM",",;",".:","-_",
+ "<>|"
+ };
+
+ /*** Russian keyboard layout (contributed by Pavel Roskin) */
+ private static readonly string [] main_key_RU = new string []
+ {
+ "`~","1!","2@","3#","4$","5%","6^","7&","8*","9(","0)","-_","=+",
+ "qQÊê","wWÃã","eEÕõ","rRËë","tTÃ…Ã¥","yYÎî","uUÇç","iIÛû","oOÃý","pPÚú","[{Èè","]}ßÿ",
+ "aAÆæ","sSÙù","dD×÷","fFÃá","gGÃð","hHÒò","jJÃï","kKÌì","lLÄä",";:Öö","'\"Üü","\\|",
+ "zZÑñ","xXÞþ","cCÓó","vVÃí","bBÉé","nNÔô","mMØø",",<Ââ",".>Àà","/?"
+ };
+
+ /*** Russian keyboard layout (phantom key version) */
+ private static readonly string [] main_key_RU_phantom = new string []
+ {
+ "`~","1!","2@","3#","4$","5%","6^","7&","8*","9(","0)","-_","=+",
+ "qQÊê","wWÃã","eEÕõ","rRËë","tTÃ…Ã¥","yYÎî","uUÇç","iIÛû","oOÃý","pPÚú","[{Èè","]}ßÿ",
+ "aAÆæ","sSÙù","dD×÷","fFÃá","gGÃð","hHÒò","jJÃï","kKÌì","lLÄä",";:Öö","'\"Üü","\\|",
+ "zZÑñ","xXÞþ","cCÓó","vVÃí","bBÉé","nNÔô","mMØø",",<Ââ",".>Àà","/?",
+ "<>" /* the phantom key */
+ };
+
+ /*** Russian keyboard layout KOI8-R */
+ private static readonly string [] main_key_RU_koi8r = new string []
+ {
+ "()","1!","2\"","3/","4$","5:","6,","7.","8;","9?","0%","-_","=+",
+ "Êê","Ãã","Õõ","Ëë","Ã…Ã¥","Îî","Çç","Ûû","Ãý","Úú","Èè","ßÿ",
+ "Ææ","Ùù","×÷","Ãá","Ãð","Òò","Ãï","Ìì","Ää","Öö","Üü","\\|",
+ "Ññ","Þþ","Óó","Ãí","Éé","Ôô","Øø","Ââ","Àà","/?",
+ "<>" /* the phantom key */
+ };
+
+ /*** Ukrainian keyboard layout KOI8-U */
+ private static readonly string [] main_key_UA = new string []
+ {
+ "`~­½","1!1!","2@2\"","3#3'","4$4*","5%5:","6^6,","7&7.","8*8;","9(9(","0)0)","-_-_","=+=+",
+ "qQÊê","wWÃã","eEÕõ","rRËë","tTÃ…Ã¥","yYÎî","uUÇç","iIÛû","oOÃý","pPÚú","[{Èè","]}§·",
+ "aAÆæ","sS¦¶","dD×÷","fFÃá","gGÃð","hHÒò","jJÃï","kKÌì","lLÄä",";:Öö","'\"¤´","\\|\\|",
+ "zZÑñ","xXÞþ","cCÓó","vVÃí","bBÉé","nNÔô","mMØø",",<Ââ",".>Àà","/?/?",
+ "<>" /* the phantom key */
+ };
+
+ /*** Spanish keyboard layout (contributed by José Marcos López) */
+ private static readonly string [] main_key_ES = new string []
+ {
+ "ºª\\","1!|","2\"@","3·#","4$","5%","6&¬","7/","8(","9)","0=","'?","¡¿",
+ "qQ","wW","eE","rR","tT","yY","uU","iI","oO","pP","`^[","+*]",
+ "aA","sS","dD","fF","gG","hH","jJ","kK","lL","ñÑ","'¨{","çÇ}",
+ "zZ","xX","cC","vV","bB","nN","mM",",;",".:","-_",
+ "<>"
+ };
+
+ /*** Belgian keyboard layout ***/
+ private static readonly string [] main_key_BE = new string []
+ {
+ "","&1|","é2@","\"3#","'4","(5","§6^","è7","!8","ç9{","à0}",")°","-_",
+ "aA","zZ","eE¤","rR","tT","yY","uU","iI","oO","pP","^¨[","$*]",
+ "qQ","sSß","dD","fF","gG","hH","jJ","kK","lL","mM","ù%´","µ£`",
+ "wW","xX","cC","vV","bB","nN",",?",";.",":/","=+~",
+ "<>\\"
+ };
+
+ /*** Hungarian keyboard layout (contributed by Zoltán Kovács) */
+ private static readonly string [] main_key_HU = new string []
+ {
+ "0§","1'~","2\"·","3+^","4!¢","5%°","6/²","7=`","8(ÿ","9)´","öÖ½","üܨ","óÓ¸",
+ "qQ\\","wW|","eE","rR","tT","zZ","uU","iIÃ","oOø","pP","õÕ÷","úÚ×",
+ "aA","sSð","dDÃ","fF[","gG]","hH","jJí","kK³","lL£","éÉ$","áÃß","ûÛ¤",
+ "yY>","xX#","cC&","vV@","bB{","nN}","mM",",?;",".:·","-_*",
+ "íÃ<"
+ };
+
+ /*** Polish (programmer's) keyboard layout ***/
+ private static readonly string [] main_key_PL = new string []
+ {
+ "`~","1!","2@","3#","4$","5%","6^","7&§","8*","9(","0)","-_","=+",
+ "qQ","wW","eEêÊ","rR","tT","yY","uU","iI","oOóÓ","pP","[{","]}",
+ "aA±¡","sS¶¦","dD","fF","gG","hH","jJ","kK","lL³£",";:","'\"","\\|",
+ "zZ¿¯","xX¼¬","cCæÆ","vV","bB","nNñÑ","mM",",<",".>","/?",
+ "<>|"
+ };
+
+ /*** Croatian keyboard layout ***/
+ private static readonly string [] main_key_HR = new string []
+ {
+ "¸¨","1!","2\"·","3#^","4$¢","5%°","6&²","7/`","8(ÿ","9)´","0=½","'?¨","+*¸",
+ "qQ\\","wW|","eE","rR","tT","zZ","uU","iI","oO","pP","¹©÷","ðÃ×",
+ "aA","sS","dD","fF[","gG]","hH","jJ","kK³","lL£","èÈ","æÆß","¾®¤",
+ "yY","xX","cC","vV@","bB{","nN}","mM§",",;",".:","-_/",
+ "<>"
+ };
+
+ /*** Japanese 106 keyboard layout ***/
+ private static readonly string [] main_key_JA_jp106 = new string []
+ {
+ "1!","2\"","3#","4$","5%","6&","7'","8(","9)","0~","-=","^~","\\|",
+ "qQ","wW","eE","rR","tT","yY","uU","iI","oO","pP","@`","[{",
+ "aA","sS","dD","fF","gG","hH","jJ","kK","lL",";+",":*","]}",
+ "zZ","xX","cC","vV","bB","nN","mM",",<",".>","/?",
+ "\\_",
+ };
+
+ /*** Japanese pc98x1 keyboard layout ***/
+ private static readonly string [] main_key_JA_pc98x1 = new string []
+ {
+ "1!","2\"","3#","4$","5%","6&","7'","8(","9)","0","-=","^`","\\|",
+ "qQ","wW","eE","rR","tT","yY","uU","iI","oO","pP","@~","[{",
+ "aA","sS","dD","fF","gG","hH","jJ","kK","lL",";+",":*","]}",
+ "zZ","xX","cC","vV","bB","nN","mM",",<",".>","/?",
+ "\\_",
+ };
+
+ /*** Brazilian ABNT-2 keyboard layout (contributed by Raul Gomes Fernandes) */
+ private static readonly string [] main_key_PT_br = new string []
+ {
+ "'\"","1!","2@","3#","4$","5%","6\"","7&","8*","9(","0)","-_","=+",
+ "qQ","wW","eE","rR","tT","yY","uU","iI","oO","pP","'`","[{",
+ "aA","sS","dD","fF","gG","hH","jJ","kK","lL","çÇ","~^","]}",
+ "zZ","xX","cC","vV","bB","nN","mM",",<",".>","/?"
+ };
+
+ /*** US international keyboard layout (contributed by Gustavo Noronha (kov@debian.org)) */
+ private static readonly string [] main_key_US_intl = new string []
+ {
+ "`~", "1!", "2@", "3#", "4$", "5%", "6^", "7&", "8*", "9(", "0)", "-_", "=+", "\\|",
+ "qQ", "wW", "eE", "rR", "tT", "yY", "uU", "iI", "oO", "pP", "[{", "]}",
+ "aA", "sS", "dD", "fF", "gG", "hH", "jJ", "kK", "lL", ";:", "'\"",
+ "zZ", "xX", "cC", "vV", "bB", "nN", "mM", ",<", ".>", "/?"
+ };
+
+ /*** Slovak keyboard layout (see cssk_ibm(sk_qwerty) in xkbsel)
+ - dead_abovering replaced with degree - no symbol in iso8859-2
+ - brokenbar replaced with bar */
+ private static readonly string [] main_key_SK = new string []
+ {
+ ";°`'","+1","µ2","¹3","è4","»5","¾6","ý7","á8","í9","é0)","=%","",
+ "qQ\\","wW|","eE","rR","tT","yY","uU","iI","oO","pP","ú/÷","ä(×",
+ "aA","sSð","dDÃ","fF[","gG]","hH","jJ","kK³","lL£","ô\"$","§!ß","ò)¤",
+ "zZ>","xX#","cC&","vV@","bB{","nN}","mM",",?<",".:>","-_*",
+ "<>\\|"
+ };
+
+ /*** Slovak and Czech (programmer's) keyboard layout (see cssk_dual(cs_sk_ucw)) */
+ private static readonly string [] main_key_SK_prog = new string []
+ {
+ "`~","1!","2@","3#","4$","5%","6^","7&","8*","9(","0)","-_","=+",
+ "qQäÄ","wWìÌ","eEéÉ","rRøØ","tT»«","yYýÃ","uUùÙ","iIíÃ","oOóÓ","pPöÖ","[{","]}",
+ "aAáÃ","sS¹©","dDïÃ","fFëË","gGàÀ","hHúÚ","jJüÜ","kKôÔ","lLµ¥",";:","'\"","\\|",
+ "zZ¾®","xX¤","cCèÈ","vVçÇ","bB","nNòÒ","mMåÅ",",<",".>","/?",
+ "<>"
+ };
+
+ /*** Czech keyboard layout (see cssk_ibm(cs_qwerty) in xkbsel) */
+ private static readonly string [] main_key_CS = new string []
+ {
+ ";","+1","ì2","¹3","è4","ø5","¾6","ý7","á8","í9","é0½)","=%","",
+ "qQ\\","wW|","eE","rR","tT","yY","uU","iI","oO","pP","ú/[{",")(]}",
+ "aA","sSð","dDÃ","fF[","gG]","hH","jJ","kK³","lL£","ù\"$","§!ß","¨'",
+ "zZ>","xX#","cC&","vV@","bB{","nN}","mM",",?<",".:>","-_*",
+ "<>\\|"
+ };
+
+ /*** Latin American keyboard layout (contributed by Gabriel Orlando Garcia) */
+ private static readonly string [] main_key_LA = new string []
+ {
+ "|°¬","1!","2\"","3#","4$","5%","6&","7/","8(","9)","0=","'?\\","¡¿",
+ "qQ@","wW","eE","rR","tT","yY","uU","iI","oO","pP","´¨","+*~",
+ "aA","sS","dD","fF","gG","hH","jJ","kK","lL","ñÑ","{[^","}]`",
+ "zZ","xX","cC","vV","bB","nN","mM",",;",".:","-_",
+ "<>"
+ };
+
+ /*** Lithuanian (Baltic) keyboard layout (contributed by Nerijus Baliûnas) */
+ private static readonly string [] main_key_LT_B = new string []
+ {
+ "`~","àÀ","èÈ","æÆ","ëË","áÃ","ðÃ","øØ","ûÛ","((","))","-_","þÞ",
+ "qQ","wW","eE","rR","tT","yY","uU","iI","oO","pP","[{","]}",
+ "aA","sS","dD","fF","gG","hH","jJ","kK","lL",";:","'\"","\\|",
+ "zZ","xX","cC","vV","bB","nN","mM",",<",".>","/?"
+ };
+
+ /*** Turkish keyboard Layout */
+ private static readonly string [] main_key_TK = new string []
+ {
+ "\"é","1!","2'","3^#","4+$","5%","6&","7/{","8([","9)]","0=}","*?\\","-_",
+ "qQ@","wW","eE","rR","tT","yY","uU","ýIî","oO","pP","ðÃ","üÜ~",
+ "aAæ","sSß","dD","fF","gG","hH","jJ","kK","lL","þÞ","iÃ",",;`",
+ "zZ","xX","cC","vV","bB","nN","mM","öÖ","çÇ",".:"
+ };
+
+ private static readonly string [] main_key_vnc = new string []
+ {
+ "1!","2@","3#","4$","5%","6^","7&","8*","9(","0)","-_","=+","[{","]}",";:","'\"","`~",",<",".>","/?","\\|",
+ "aA","bB","cC","dD","eE","fF","gG","hH","iI","jJ","kK","lL","mM","nN","oO","pP","qQ","rR","sS","tT","uU","vV","wW","xX","yY","zZ"
+ };
+
+ /*** VNC keyboard layout */
+ private static readonly short [] main_key_scan_vnc = new short []
+ {
+ 0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x1A,0x1B,0x27,0x28,0x29,0x33,0x34,0x35,0x2B,
+ 0x1E,0x30,0x2E,0x20,0x12,0x21,0x22,0x23,0x17,0x24,0x25,0x26,0x32,0x31,0x18,0x19,0x10,0x13,0x1F,0x14,0x16,0x2F,0x11,0x2D,0x15,0x2C,
+ 0x56
+ };
+
+ private static readonly VirtualKeys [] main_key_vkey_vnc = new VirtualKeys []
+ {
+ VirtualKeys.VK_1, VirtualKeys.VK_2, VirtualKeys.VK_3, VirtualKeys.VK_4, VirtualKeys.VK_5, VirtualKeys.VK_6,
+ VirtualKeys.VK_7, VirtualKeys.VK_8, VirtualKeys.VK_9, VirtualKeys.VK_0, VirtualKeys.VK_OEM_MINUS,
+ VirtualKeys.VK_OEM_PLUS, VirtualKeys.VK_OEM_4, VirtualKeys.VK_OEM_6, VirtualKeys.VK_OEM_1,
+ VirtualKeys.VK_OEM_7, VirtualKeys.VK_OEM_3, VirtualKeys.VK_OEM_COMMA, VirtualKeys.VK_OEM_PERIOD,
+ VirtualKeys.VK_OEM_2, VirtualKeys.VK_OEM_5, VirtualKeys.VK_A, VirtualKeys.VK_B, VirtualKeys.VK_C,
+ VirtualKeys.VK_D, VirtualKeys.VK_E, VirtualKeys.VK_F, VirtualKeys.VK_G, VirtualKeys.VK_H,
+ VirtualKeys.VK_I, VirtualKeys.VK_J, VirtualKeys.VK_K, VirtualKeys.VK_L, VirtualKeys.VK_M,
+ VirtualKeys.VK_N, VirtualKeys.VK_O, VirtualKeys.VK_P, VirtualKeys.VK_Q, VirtualKeys.VK_R,
+ VirtualKeys.VK_S, VirtualKeys.VK_T, VirtualKeys.VK_U, VirtualKeys.VK_V, VirtualKeys.VK_W,
+ VirtualKeys.VK_X, VirtualKeys.VK_Y, VirtualKeys.VK_Z, VirtualKeys.VK_OEM_102
+ };
+
+ private static readonly short [] main_key_scan_qwerty = new short []
+ {
+ /* this is my (102-key) keyboard layout, sorry if it doesn't quite match yours */
+ /* ` 1 2 3 4 5 6 7 8 9 0 - = */
+ 0x29,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,
+ /* q w e r t y u i o p [ ] */
+ 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,
+ /* a s d f g h j k l ; ' \ */
+ 0x1E,0x1F,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x2B,
+ /* z x c v b n m , . / */
+ 0x2C,0x2D,0x2E,0x2F,0x30,0x31,0x32,0x33,0x34,0x35,
+ 0x56 /* the 102nd key (actually to the right of l-shift) */
+ };
+
+ private static readonly short [] main_key_scan_dvorak = new short []
+ {
+ /* ` 1 2 3 4 5 6 7 8 9 0 [ ] */
+ 0x29,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x1A,0x1B,
+ /* ' , . p y f g c r l / = */
+ 0x28,0x33,0x34,0x19,0x15,0x21,0x22,0x2E,0x13,0x26,0x35,0x0D,
+ /* a o e u i d h t n s - \ */
+ 0x1E,0x18,0x12,0x16,0x17,0x20,0x23,0x14,0x31,0x1F,0x0C,0x2B,
+ /* ; q j k x b m w v z */
+ 0x27,0x10,0x24,0x25,0x2D,0x30,0x32,0x11,0x2F,0x2C,
+ 0x56 /* the 102nd key (actually to the right of l-shift) */
+ };
+
+ private static readonly VirtualKeys [] main_key_vkey_qwerty = new VirtualKeys []
+ {
+ // NOTE: this layout must concur with the scan codes layout above
+ VirtualKeys.VK_OEM_3, VirtualKeys.VK_1, VirtualKeys.VK_2, VirtualKeys.VK_3, VirtualKeys.VK_4,
+ VirtualKeys.VK_5, VirtualKeys.VK_6, VirtualKeys.VK_7, VirtualKeys.VK_8, VirtualKeys.VK_9,
+ VirtualKeys.VK_0, VirtualKeys.VK_OEM_MINUS, VirtualKeys.VK_OEM_PLUS, VirtualKeys.VK_Q,
+ VirtualKeys.VK_W, VirtualKeys.VK_E, VirtualKeys.VK_R, VirtualKeys.VK_T, VirtualKeys.VK_Y,
+ VirtualKeys.VK_U, VirtualKeys.VK_I, VirtualKeys.VK_O, VirtualKeys.VK_P, VirtualKeys.VK_OEM_4,
+ VirtualKeys.VK_OEM_6, VirtualKeys.VK_A, VirtualKeys.VK_S, VirtualKeys.VK_D, VirtualKeys.VK_F,
+ VirtualKeys.VK_G, VirtualKeys.VK_H, VirtualKeys.VK_J, VirtualKeys.VK_K, VirtualKeys.VK_L,
+ VirtualKeys.VK_OEM_1, VirtualKeys.VK_OEM_7, VirtualKeys.VK_OEM_5, VirtualKeys.VK_Z,
+ VirtualKeys.VK_X, VirtualKeys.VK_C, VirtualKeys.VK_V, VirtualKeys.VK_B, VirtualKeys.VK_N,
+ VirtualKeys.VK_M, VirtualKeys.VK_OEM_COMMA, VirtualKeys.VK_OEM_PERIOD, VirtualKeys.VK_OEM_2,
+ VirtualKeys.VK_OEM_102 // the 102nd key (actually to the right of l-shift)
+ };
+
+ private static readonly VirtualKeys [] main_key_vkey_dvorak = new VirtualKeys []
+ {
+ // NOTE: this layout must concur with the scan codes layout above
+ VirtualKeys.VK_OEM_3, VirtualKeys.VK_1, VirtualKeys.VK_2, VirtualKeys.VK_3, VirtualKeys.VK_4,
+ VirtualKeys.VK_5, VirtualKeys.VK_6, VirtualKeys.VK_7, VirtualKeys.VK_8, VirtualKeys.VK_9,
+ VirtualKeys.VK_0, VirtualKeys.VK_OEM_4, VirtualKeys.VK_OEM_6, VirtualKeys.VK_OEM_7,
+ VirtualKeys.VK_OEM_COMMA, VirtualKeys.VK_OEM_PERIOD, VirtualKeys.VK_P, VirtualKeys.VK_Y,
+ VirtualKeys.VK_F, VirtualKeys.VK_G, VirtualKeys.VK_C, VirtualKeys.VK_R, VirtualKeys.VK_L,
+ VirtualKeys.VK_OEM_2, VirtualKeys.VK_OEM_PLUS, VirtualKeys.VK_A, VirtualKeys.VK_O,
+ VirtualKeys.VK_E, VirtualKeys.VK_U, VirtualKeys.VK_I, VirtualKeys.VK_D, VirtualKeys.VK_H,
+ VirtualKeys.VK_T, VirtualKeys.VK_N, VirtualKeys.VK_S, VirtualKeys.VK_OEM_MINUS, VirtualKeys.VK_OEM_5,
+ VirtualKeys.VK_OEM_1, VirtualKeys.VK_Q, VirtualKeys.VK_J, VirtualKeys.VK_K, VirtualKeys.VK_X,
+ VirtualKeys.VK_B, VirtualKeys.VK_M, VirtualKeys.VK_W, VirtualKeys.VK_V, VirtualKeys.VK_Z,
+ VirtualKeys.VK_OEM_102 // the 102nd key (actually to the right of l-shift)
+ };
+
+ private static readonly VirtualKeys [] main_key_vkey_azerty = new VirtualKeys []
+ {
+ // NOTE: this layout must concur with the scan codes layout above
+ VirtualKeys.VK_OEM_7, VirtualKeys.VK_1, VirtualKeys.VK_2, VirtualKeys.VK_3, VirtualKeys.VK_4,
+ VirtualKeys.VK_5, VirtualKeys.VK_6, VirtualKeys.VK_7, VirtualKeys.VK_8, VirtualKeys.VK_9,
+ VirtualKeys.VK_0, VirtualKeys.VK_OEM_4, VirtualKeys.VK_OEM_PLUS, VirtualKeys.VK_A, VirtualKeys.VK_Z,
+ VirtualKeys.VK_E, VirtualKeys.VK_R, VirtualKeys.VK_T, VirtualKeys.VK_Y, VirtualKeys.VK_U,
+ VirtualKeys.VK_I, VirtualKeys.VK_O, VirtualKeys.VK_P, VirtualKeys.VK_OEM_6, VirtualKeys.VK_OEM_1,
+ VirtualKeys.VK_Q, VirtualKeys.VK_S, VirtualKeys.VK_D, VirtualKeys.VK_F, VirtualKeys.VK_G,
+ VirtualKeys.VK_H, VirtualKeys.VK_J, VirtualKeys.VK_K, VirtualKeys.VK_L, VirtualKeys.VK_M,
+ VirtualKeys.VK_OEM_3, VirtualKeys.VK_OEM_5, VirtualKeys.VK_W, VirtualKeys.VK_X, VirtualKeys.VK_C,
+ VirtualKeys.VK_V, VirtualKeys.VK_B, VirtualKeys.VK_N, VirtualKeys.VK_OEM_COMMA, VirtualKeys.VK_OEM_PERIOD,
+ VirtualKeys.VK_OEM_2, VirtualKeys.VK_OEM_8,
+ VirtualKeys.VK_OEM_102 // the 102nd key (actually to the right of l-shift)
+ };
+
+ public static int [] nonchar_key_vkey = new int []
+ {
+ /* unused */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* FF00 */
+ /* special keys */
+ (int) VirtualKeys.VK_BACK, (int) VirtualKeys.VK_TAB, 0, (int) VirtualKeys.VK_CLEAR, 0, (int) VirtualKeys.VK_RETURN, 0, 0, /* FF08 */
+ 0, 0, 0, (int) VirtualKeys.VK_PAUSE, (int) VirtualKeys.VK_SCROLL, 0, 0, 0, /* FF10 */
+ 0, 0, 0, (int) VirtualKeys.VK_ESCAPE, 0, 0, 0, 0, /* FF18 */
+ /* unused */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* FF20 */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* FF28 */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* FF30 */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* FF38 */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* FF40 */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* FF48 */
+ /* cursor keys */
+ (int) VirtualKeys.VK_HOME, (int) VirtualKeys.VK_LEFT, (int) VirtualKeys.VK_UP, (int) VirtualKeys.VK_RIGHT, /* FF50 */
+ (int) VirtualKeys.VK_DOWN, (int) VirtualKeys.VK_PRIOR, (int) VirtualKeys.VK_NEXT, (int) VirtualKeys.VK_END,
+ 0, 0, 0, 0, 0, 0, 0, 0, /* FF58 */
+ /* misc keys */
+ (int) VirtualKeys.VK_SELECT, (int) VirtualKeys.VK_SNAPSHOT, (int) VirtualKeys.VK_EXECUTE, (int) VirtualKeys.VK_INSERT, 0, 0, 0, 0, /* FF60 */
+ (int) VirtualKeys.VK_CANCEL, (int) VirtualKeys.VK_HELP, (int) VirtualKeys.VK_CANCEL, (int) VirtualKeys.VK_CANCEL, 0, 0, 0, 0, /* FF68 */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* FF70 */
+ /* keypad keys */
+ 0, 0, 0, 0, 0, 0, 0, (int) VirtualKeys.VK_NUMLOCK, /* FF78 */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* FF80 */
+ 0, 0, 0, 0, 0, (int) VirtualKeys.VK_RETURN, 0, 0, /* FF88 */
+ 0, 0, 0, 0, 0, (int) VirtualKeys.VK_HOME, (int) VirtualKeys.VK_LEFT, (int) VirtualKeys.VK_UP, /* FF90 */
+ (int) VirtualKeys.VK_RIGHT, (int) VirtualKeys.VK_DOWN, (int) VirtualKeys.VK_PRIOR, (int) VirtualKeys.VK_NEXT, /* FF98 */
+ (int) VirtualKeys.VK_END, 0, (int) VirtualKeys.VK_INSERT, (int) VirtualKeys.VK_DELETE,
+ 0, 0, 0, 0, 0, 0, 0, 0, /* FFA0 */
+ 0, 0, (int) VirtualKeys.VK_MULTIPLY, (int) VirtualKeys.VK_ADD, /* FFA8 */
+ (int) VirtualKeys.VK_SEPARATOR, (int) VirtualKeys.VK_SUBTRACT, (int) VirtualKeys.VK_DECIMAL, (int) VirtualKeys.VK_DIVIDE,
+ (int) VirtualKeys.VK_NUMPAD0, (int) VirtualKeys.VK_NUMPAD1, (int) VirtualKeys.VK_NUMPAD2, (int) VirtualKeys.VK_NUMPAD3, /* FFB0 */
+ (int) VirtualKeys.VK_NUMPAD4, (int) VirtualKeys.VK_NUMPAD5, (int) VirtualKeys.VK_NUMPAD6, (int) VirtualKeys.VK_NUMPAD7,
+ (int) VirtualKeys.VK_NUMPAD8, (int) VirtualKeys.VK_NUMPAD9, 0, 0, 0, 0, /* FFB8 */
+ /* function keys */
+ (int) VirtualKeys.VK_F1, (int) VirtualKeys.VK_F2,
+ (int) VirtualKeys.VK_F3, (int) VirtualKeys.VK_F4, (int) VirtualKeys.VK_F5, (int) VirtualKeys.VK_F6, (int) VirtualKeys.VK_F7, (int) VirtualKeys.VK_F8, (int) VirtualKeys.VK_F9, (int) VirtualKeys.VK_F10, /* FFC0 */
+ (int) VirtualKeys.VK_F11, (int) VirtualKeys.VK_F12, (int) VirtualKeys.VK_F13, (int) VirtualKeys.VK_F14, (int) VirtualKeys.VK_F15, (int) VirtualKeys.VK_F16, 0, 0, /* FFC8 */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* FFD0 */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* FFD8 */
+ /* modifier keys */
+ 0, (int) VirtualKeys.VK_SHIFT, (int) VirtualKeys.VK_SHIFT, (int) VirtualKeys.VK_CONTROL, /* FFE0 */
+ (int) VirtualKeys.VK_CONTROL, (int) VirtualKeys.VK_CAPITAL, 0, (int) VirtualKeys.VK_MENU,
+ (int) VirtualKeys.VK_MENU, (int) VirtualKeys.VK_MENU, (int) VirtualKeys.VK_MENU, 0, 0, 0, 0, 0, /* FFE8 */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* FFF0 */
+ 0, 0, 0, 0, 0, 0, 0, (int) VirtualKeys.VK_DELETE /* FFF8 */
+ };
+
+ public static readonly int [] nonchar_key_scan = new int []
+ {
+ /* unused */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FF00 */
+ /* special keys */
+ 0x0E, 0x0F, 0x00, /*?*/ 0, 0x00, 0x1C, 0x00, 0x00, /* FF08 */
+ 0x00, 0x00, 0x00, 0x45, 0x46, 0x00, 0x00, 0x00, /* FF10 */
+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, /* FF18 */
+ /* unused */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FF20 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FF28 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FF30 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FF38 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FF40 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FF48 */
+ /* cursor keys */
+ 0x147, 0x14B, 0x148, 0x14D, 0x150, 0x149, 0x151, 0x14F, /* FF50 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FF58 */
+ /* misc keys */
+ /*?*/ 0, 0x137, /*?*/ 0, 0x152, 0x00, 0x00, 0x00, 0x00, /* FF60 */
+ /*?*/ 0, /*?*/ 0, 0x38, 0x146, 0x00, 0x00, 0x00, 0x00, /* FF68 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FF70 */
+ /* keypad keys */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x138, 0x145, /* FF78 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FF80 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x11C, 0x00, 0x00, /* FF88 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x4B, 0x48, /* FF90 */
+ 0x4D, 0x50, 0x49, 0x51, 0x4F, 0x4C, 0x52, 0x53, /* FF98 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FFA0 */
+ 0x00, 0x00, 0x37, 0x4E, /*?*/ 0, 0x4A, 0x53, 0x135, /* FFA8 */
+ 0x52, 0x4F, 0x50, 0x51, 0x4B, 0x4C, 0x4D, 0x47, /* FFB0 */
+ 0x48, 0x49, 0x00, 0x00, 0x00, 0x00, /* FFB8 */
+ /* function keys */
+ 0x3B, 0x3C,
+ 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, /* FFC0 */
+ 0x57, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FFC8 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FFD0 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FFD8 */
+ /* modifier keys */
+ 0x00, 0x2A, 0x36, 0x1D, 0x11D, 0x3A, 0x00, 0x38, /* FFE0 */
+ 0x138, 0x38, 0x138, 0x00, 0x00, 0x00, 0x00, 0x00, /* FFE8 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* FFF0 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x153 /* FFF8 */
+ };
+
+ public static readonly KeyboardLayout US = new KeyboardLayout ("United States keyboard layout", 28591,
+ main_key_US, main_key_scan_qwerty, main_key_vkey_qwerty);
+ public static readonly KeyboardLayout US_phantom = new KeyboardLayout ("United States keyboard layout (phantom key version)", 28591,
+ main_key_US_phantom, main_key_scan_qwerty, main_key_vkey_qwerty);
+ public static readonly KeyboardLayout US_dvorak = new KeyboardLayout ("United States keyboard layout (dvorak)", 28591,
+ main_key_US_dvorak, main_key_scan_dvorak, main_key_vkey_dvorak);
+ public static readonly KeyboardLayout UK = new KeyboardLayout ("British keyboard layout", 28591,
+ main_key_UK, main_key_scan_qwerty, main_key_vkey_qwerty);
+ public static readonly KeyboardLayout German = new KeyboardLayout ("German keyboard layout", 28591,
+ main_key_DE, main_key_scan_qwerty, main_key_vkey_qwerty);
+ public static readonly KeyboardLayout German_nodead = new KeyboardLayout ("German keyboard layout without dead keys", 28591,
+ main_key_DE_nodead, main_key_scan_qwerty, main_key_vkey_qwerty);
+ public static readonly KeyboardLayout SwissGerman = new KeyboardLayout ("Swiss German keyboard layout", 28591,
+ main_key_SG, main_key_scan_qwerty, main_key_vkey_qwerty);
+ public static readonly KeyboardLayout Se = new KeyboardLayout ("Swedish keyboard layout", 28591,
+ main_key_SE, main_key_scan_qwerty, main_key_vkey_qwerty);
+ public static readonly KeyboardLayout No = new KeyboardLayout ("Norwegian keyboard layout", 28591,
+ main_key_NO, main_key_scan_qwerty, main_key_vkey_qwerty);
+ public static readonly KeyboardLayout Da = new KeyboardLayout ("Danish keyboard layout", 28591,
+ main_key_DA, main_key_scan_qwerty, main_key_vkey_qwerty);
+ public static readonly KeyboardLayout Fr = new KeyboardLayout ("French keyboard layout", 28591,
+ main_key_FR, main_key_scan_qwerty, main_key_vkey_azerty);
+ public static readonly KeyboardLayout CF = new KeyboardLayout ("Canadian French keyboard layout", 28591,
+ main_key_CF, main_key_scan_qwerty, main_key_vkey_qwerty);
+ public static readonly KeyboardLayout Be = new KeyboardLayout ("Belgian keyboard layout", 28591,
+ main_key_BE, main_key_scan_qwerty, main_key_vkey_azerty);
+ public static readonly KeyboardLayout SF = new KeyboardLayout ("Swiss French keyboard layout", 28591,
+ main_key_SF, main_key_scan_qwerty, main_key_vkey_qwerty);
+ public static readonly KeyboardLayout Pt = new KeyboardLayout ("Portuguese keyboard layout", 28591,
+ main_key_PT, main_key_scan_qwerty, main_key_vkey_qwerty);
+ public static readonly KeyboardLayout Pt_br = new KeyboardLayout ("Brazilian ABNT-2 keyboard layout", 28591,
+ main_key_PT_br, main_key_scan_qwerty, main_key_vkey_qwerty);
+ public static readonly KeyboardLayout US_intl = new KeyboardLayout ("United States International keyboard layout", 28591,
+ main_key_US_intl, main_key_scan_qwerty, main_key_vkey_qwerty);
+ public static readonly KeyboardLayout Fi = new KeyboardLayout ("Finnish keyboard layout", 28591,
+ main_key_FI, main_key_scan_qwerty, main_key_vkey_qwerty);
+ public static readonly KeyboardLayout Ru = new KeyboardLayout ("Russian keyboard layout", 20866,
+ main_key_RU, main_key_scan_qwerty, main_key_vkey_qwerty);
+ public static readonly KeyboardLayout Ru_phantom = new KeyboardLayout ("Russian keyboard layout (phantom key version)", 20866,
+ main_key_RU_phantom, main_key_scan_qwerty, main_key_vkey_qwerty);
+ public static readonly KeyboardLayout Ru_koi8r = new KeyboardLayout ("Russian keyboard layout KOI8-R", 20866,
+ main_key_RU_koi8r, main_key_scan_qwerty, main_key_vkey_qwerty);
+ public static readonly KeyboardLayout Ua = new KeyboardLayout ("Ukrainian keyboard layout KOI8-U", 20866,
+ main_key_UA, main_key_scan_qwerty, main_key_vkey_qwerty);
+ public static readonly KeyboardLayout Es = new KeyboardLayout ("Spanish keyboard layout", 28591,
+ main_key_ES, main_key_scan_qwerty, main_key_vkey_qwerty);
+ public static readonly KeyboardLayout It = new KeyboardLayout ("Italian keyboard layout", 28591,
+ main_key_IT, main_key_scan_qwerty, main_key_vkey_qwerty);
+ public static readonly KeyboardLayout Is = new KeyboardLayout ("Icelandic keyboard layout", 28591,
+ main_key_IS, main_key_scan_qwerty, main_key_vkey_qwerty);
+ public static readonly KeyboardLayout Hu = new KeyboardLayout ("Hungarian keyboard layout", 28592,
+ main_key_HU, main_key_scan_qwerty, main_key_vkey_qwerty);
+ public static readonly KeyboardLayout Pl = new KeyboardLayout ("Polish (programmer's) keyboard layout", 28592,
+ main_key_PL, main_key_scan_qwerty, main_key_vkey_qwerty);
+ public static readonly KeyboardLayout Hr = new KeyboardLayout ("Croatian keyboard layout", 28592,
+ main_key_HR, main_key_scan_qwerty, main_key_vkey_qwerty);
+ public static readonly KeyboardLayout Ja_jp106 = new KeyboardLayout ("Japanese 106 keyboard layout", 932,
+ main_key_JA_jp106, main_key_scan_qwerty, main_key_vkey_qwerty);
+ public static readonly KeyboardLayout Ja_pc98x1 = new KeyboardLayout ("Japanese pc98x1 keyboard layout", 932,
+ main_key_JA_pc98x1, main_key_scan_qwerty, main_key_vkey_qwerty);
+ public static readonly KeyboardLayout Sk = new KeyboardLayout ("Slovak keyboard layout", 28592,
+ main_key_SK, main_key_scan_qwerty, main_key_vkey_qwerty);
+ public static readonly KeyboardLayout Sk_prog = new KeyboardLayout ("Slovak and Czech keyboard layout without dead keys", 28592,
+ main_key_SK_prog, main_key_scan_qwerty, main_key_vkey_qwerty);
+ public static readonly KeyboardLayout Cz = new KeyboardLayout ("Czech keyboard layout", 28592,
+ main_key_CS, main_key_scan_qwerty, main_key_vkey_qwerty);
+ public static readonly KeyboardLayout LA = new KeyboardLayout ("Latin American keyboard layout", 28591,
+ main_key_LA, main_key_scan_qwerty, main_key_vkey_qwerty);
+ public static readonly KeyboardLayout LT_B = new KeyboardLayout ("Lithuanian (Baltic) keyboard layout", 28603,
+ main_key_LT_B, main_key_scan_qwerty, main_key_vkey_qwerty);
+ public static readonly KeyboardLayout Tk = new KeyboardLayout ("Turkish keyboard layout", 28599,
+ main_key_TK, main_key_scan_qwerty, main_key_vkey_qwerty);
+ public static readonly KeyboardLayout Vnc = new KeyboardLayout ("VNC keyboard layout", 28591,
+ main_key_vnc, main_key_scan_vnc, main_key_vkey_vnc);
+
+
+ public static readonly KeyboardLayout [] layouts = new KeyboardLayout []
+ {
+ US, US_phantom, US_dvorak, UK, German, German_nodead, SwissGerman, Se, No, Da, Fr, CF, Be, SF, Pt,
+ Pt_br, US_intl, Fi, Ru, Ru_phantom, Ru_koi8r, Ua, Es, It, Is, Hu, Pl, Hr, Ja_jp106, Ja_pc98x1, Sk,
+ Sk_prog, Cz, LA, LT_B, Tk, Vnc
+ };
+
+ public static KeyboardLayout [] Layouts {
+ get {
+ return layouts;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Keys.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Keys.cs
new file mode 100644
index 00000000000..2f3278417b8
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Keys.cs
@@ -0,0 +1,221 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+// COMPLETE
+
+using System.ComponentModel;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [Flags]
+ [ComVisible(true)]
+ [TypeConverter(typeof(KeysConverter))]
+ public enum Keys {
+ None = 0x00000000,
+ LButton = 0x00000001,
+ RButton = 0x00000002,
+ Cancel = 0x00000003,
+ MButton = 0x00000004,
+ XButton1 = 0x00000005,
+ XButton2 = 0x00000006,
+ Back = 0x00000008,
+ Tab = 0x00000009,
+ LineFeed = 0x0000000A,
+ Clear = 0x0000000C,
+ Return = 0x0000000D,
+ Enter = 0x0000000D,
+ ShiftKey = 0x00000010,
+ ControlKey = 0x00000011,
+ Menu = 0x00000012,
+ Pause = 0x00000013,
+ CapsLock = 0x00000014,
+ Capital = 0x00000014,
+ KanaMode = 0x00000015,
+ HanguelMode = 0x00000015,
+ HangulMode = 0x00000015,
+ JunjaMode = 0x00000017,
+ FinalMode = 0x00000018,
+ KanjiMode = 0x00000019,
+ HanjaMode = 0x00000019,
+ Escape = 0x0000001B,
+ IMEConvert = 0x0000001C,
+ IMENonconvert = 0x0000001D,
+ IMEAceept = 0x0000001E,
+ IMEModeChange = 0x0000001F,
+ Space = 0x00000020,
+ PageUp = 0x00000021,
+ Prior = 0x00000021,
+ PageDown = 0x00000022,
+ Next = 0x00000022,
+ End = 0x00000023,
+ Home = 0x00000024,
+ Left = 0x00000025,
+ Up = 0x00000026,
+ Right = 0x00000027,
+ Down = 0x00000028,
+ Select = 0x00000029,
+ Print = 0x0000002A,
+ Execute = 0x0000002B,
+ PrintScreen = 0x0000002C,
+ Snapshot = 0x0000002C,
+ Insert = 0x0000002D,
+ Delete = 0x0000002E,
+ Help = 0x0000002F,
+ D0 = 0x00000030,
+ D1 = 0x00000031,
+ D2 = 0x00000032,
+ D3 = 0x00000033,
+ D4 = 0x00000034,
+ D5 = 0x00000035,
+ D6 = 0x00000036,
+ D7 = 0x00000037,
+ D8 = 0x00000038,
+ D9 = 0x00000039,
+ A = 0x00000041,
+ B = 0x00000042,
+ C = 0x00000043,
+ D = 0x00000044,
+ E = 0x00000045,
+ F = 0x00000046,
+ G = 0x00000047,
+ H = 0x00000048,
+ I = 0x00000049,
+ J = 0x0000004A,
+ K = 0x0000004B,
+ L = 0x0000004C,
+ M = 0x0000004D,
+ N = 0x0000004E,
+ O = 0x0000004F,
+ P = 0x00000050,
+ Q = 0x00000051,
+ R = 0x00000052,
+ S = 0x00000053,
+ T = 0x00000054,
+ U = 0x00000055,
+ V = 0x00000056,
+ W = 0x00000057,
+ X = 0x00000058,
+ Y = 0x00000059,
+ Z = 0x0000005A,
+ LWin = 0x0000005B,
+ RWin = 0x0000005C,
+ Apps = 0x0000005D,
+ NumPad0 = 0x00000060,
+ NumPad1 = 0x00000061,
+ NumPad2 = 0x00000062,
+ NumPad3 = 0x00000063,
+ NumPad4 = 0x00000064,
+ NumPad5 = 0x00000065,
+ NumPad6 = 0x00000066,
+ NumPad7 = 0x00000067,
+ NumPad8 = 0x00000068,
+ NumPad9 = 0x00000069,
+ Multiply = 0x0000006A,
+ Add = 0x0000006B,
+ Separator = 0x0000006C,
+ Subtract = 0x0000006D,
+ Decimal = 0x0000006E,
+ Divide = 0x0000006F,
+ F1 = 0x00000070,
+ F2 = 0x00000071,
+ F3 = 0x00000072,
+ F4 = 0x00000073,
+ F5 = 0x00000074,
+ F6 = 0x00000075,
+ F7 = 0x00000076,
+ F8 = 0x00000077,
+ F9 = 0x00000078,
+ F10 = 0x00000079,
+ F11 = 0x0000007A,
+ F12 = 0x0000007B,
+ F13 = 0x0000007C,
+ F14 = 0x0000007D,
+ F15 = 0x0000007E,
+ F16 = 0x0000007F,
+ F17 = 0x00000080,
+ F18 = 0x00000081,
+ F19 = 0x00000082,
+ F20 = 0x00000083,
+ F21 = 0x00000084,
+ F22 = 0x00000085,
+ F23 = 0x00000086,
+ F24 = 0x00000087,
+ NumLock = 0x00000090,
+ Scroll = 0x00000091,
+ LShiftKey = 0x000000A0,
+ RShiftKey = 0x000000A1,
+ LControlKey = 0x000000A2,
+ RControlKey = 0x000000A3,
+ LMenu = 0x000000A4,
+ RMenu = 0x000000A5,
+ BrowserBack = 0x000000A6,
+ BrowserForward = 0x000000A7,
+ BrowserRefresh = 0x000000A8,
+ BrowserStop = 0x000000A9,
+ BrowserSearch = 0x000000AA,
+ BrowserFavorites= 0x000000AB,
+ BrowserHome = 0x000000AC,
+ VolumeMute = 0x000000AD,
+ VolumeDown = 0x000000AE,
+ VolumeUp = 0x000000AF,
+ MediaNextTrack = 0x000000B0,
+ MediaPreviousTrack= 0x000000B1,
+ MediaStop = 0x000000B2,
+ MediaPlayPause = 0x000000B3,
+ LaunchMail = 0x000000B4,
+ SelectMedia = 0x000000B5,
+ LaunchApplication1= 0x000000B6,
+ LaunchApplication2= 0x000000B7,
+ OemSemicolon = 0x000000BA,
+ Oemplus = 0x000000BB,
+ Oemcomma = 0x000000BC,
+ OemMinus = 0x000000BD,
+ OemPeriod = 0x000000BE,
+ OemQuestion = 0x000000BF,
+ Oemtilde = 0x000000C0,
+ OemOpenBrackets = 0x000000DB,
+ OemPipe = 0x000000DC,
+ OemCloseBrackets= 0x000000DD,
+ OemQuotes = 0x000000DE,
+ Oem8 = 0x000000DF,
+ OemBackslash = 0x000000E2,
+ ProcessKey = 0x000000E5,
+ Attn = 0x000000F6,
+ Crsel = 0x000000F7,
+ Exsel = 0x000000F8,
+ EraseEof = 0x000000F9,
+ Play = 0x000000FA,
+ Zoom = 0x000000FB,
+ NoName = 0x000000FC,
+ Pa1 = 0x000000FD,
+ OemClear = 0x000000FE,
+ KeyCode = 0x0000FFFF,
+ Shift = 0x00010000,
+ Control = 0x00020000,
+ Alt = 0x00040000,
+ Modifiers = unchecked((int)0xFFFF0000)
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/KeysConverter.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/KeysConverter.cs
new file mode 100644
index 00000000000..ed419607262
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/KeysConverter.cs
@@ -0,0 +1,126 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+using System.Collections;
+using System.ComponentModel;
+using System.Text;
+
+namespace System.Windows.Forms {
+ public class KeysConverter : TypeConverter, IComparer {
+ #region Public Constructors
+ public KeysConverter() {
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Methods
+ public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) {
+ if (sourceType == typeof(string)) {
+ return true;
+ }
+ return false;
+ }
+
+ public int Compare(object a, object b) {
+ if (a is string && b is string) {
+ return String.Compare((string) a, (string)b);
+ }
+ return String.Compare(a.ToString(), b.ToString());
+ }
+
+ public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) {
+ if (value is string) {
+ string[] keys;
+ Keys key;
+
+ keys = ((string)value).Split(new char[] {'+'});
+ key = Keys.None;
+
+ if (keys.Length > 1) {
+ for (int i = 0; i < keys.Length - 1; i++) {
+ if (keys[i].Equals("Ctrl")) {
+ key |= Keys.Control;
+ } else {
+ key |= (Keys)Enum.Parse(typeof(Keys), keys[i], true);
+ }
+ }
+ }
+ key |= (Keys)Enum.Parse(typeof(Keys), keys[keys.Length - 1], true);
+ return key;
+ }
+ return base.ConvertFrom (context, culture, value);
+ }
+
+ public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) {
+ if (destinationType == typeof(string)) {
+ StringBuilder sb;
+ Keys key;
+
+ sb = new StringBuilder();
+ key = (Keys)value;
+
+ // Modifiers first
+ if ((key & Keys.Control) != 0) {
+ sb.Append("Ctrl+");
+ }
+
+ if ((key & Keys.Alt) != 0) {
+ sb.Append("Alt+");
+ }
+
+ if ((key & Keys.Shift) != 0) {
+ sb.Append("Shift+");
+ }
+
+ // Keycode last
+ sb.Append(Enum.GetName(typeof(Keys), key & Keys.KeyCode));
+
+ return sb.ToString();
+ }
+ return base.ConvertTo (context, culture, value, destinationType);
+ }
+
+ public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) {
+ string [] stdVal = new string [] {
+ "Alt", "Back", "Control", "Delete", "End", "Enter", "F1", "F10", "F11", "F12", "F2",
+ "F3", "F4", "F5", "F6", "F7", "F8", "F9", "Home", "Insert", "Next", "Prior", "Shift"};
+
+ return new TypeConverter.StandardValuesCollection (stdVal);
+ }
+
+ public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) {
+
+ return false;
+ }
+
+ public override bool GetStandardValuesSupported(ITypeDescriptorContext context) {
+ return true;
+ }
+
+ #endregion // Public Instance Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Label.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Label.cs
new file mode 100644
index 00000000000..d82870b312c
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Label.cs
@@ -0,0 +1,657 @@
+// 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.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+// Peter Bartok, pbartok@novell.com
+//
+//
+
+// COMPLETE
+
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Drawing;
+using System.Drawing.Text;
+using System.Drawing.Imaging;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms
+{
+ [DefaultProperty("Text")]
+ [Designer ("System.Windows.Forms.Design.LabelDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+ public class Label : Control
+ {
+ private bool autosize;
+ private Image image;
+ private bool render_transparent;
+ private FlatStyle flat_style;
+ private int preferred_height;
+ private int preferred_width;
+ private bool use_mnemonic;
+ private int image_index = -1;
+ private ImageList image_list;
+ internal ContentAlignment image_align;
+ internal StringFormat string_format;
+ internal ContentAlignment text_align;
+ static SizeF req_witdthsize = new SizeF (0,0);
+
+ #region Events
+ public event EventHandler AutoSizeChanged;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler BackgroundImageChanged {
+ add {
+ base.BackgroundImageChanged += value;
+ }
+ remove {
+ base.BackgroundImageChanged -= value;
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler ImeModeChanged {
+ add {
+ base.ImeModeChanged += value;
+ }
+ remove {
+ base.ImeModeChanged -= value;
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event KeyEventHandler KeyDown {
+ add {
+ base.KeyDown += value;
+ }
+ remove {
+ base.KeyDown -= value;
+ }
+ }
+
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event KeyPressEventHandler KeyPress {
+ add {
+ base.KeyPress += value;
+ }
+ remove {
+ base.KeyPress -= value;
+ }
+ }
+
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event KeyEventHandler KeyUp {
+ add {
+ base.KeyUp += value;
+ }
+ remove {
+ base.KeyUp -= value;
+ }
+ }
+
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler TabStopChanged {
+ add {
+ base.TabStopChanged += value;
+ }
+ remove {
+ base.TabStopChanged -= value;
+ }
+ }
+
+ public event EventHandler TextAlignChanged;
+ #endregion
+
+ public Label ()
+ {
+ // Defaults in the Spec
+ autosize = false;
+ tab_stop = false;
+ string_format = new StringFormat();
+ TextAlign = ContentAlignment.TopLeft;
+ image = null;
+ UseMnemonic = true;
+ image_list = null;
+ image_align = ContentAlignment.MiddleCenter;
+ SetUseMnemonic (UseMnemonic);
+ flat_style = FlatStyle.Standard;
+
+ CalcPreferredHeight ();
+ CalcPreferredWidth ();
+
+ AutoSizeChanged = null;
+ TextAlignChanged = null;
+
+ SetStyle (ControlStyles.Selectable, false);
+ SetStyle (ControlStyles.ResizeRedraw |
+ ControlStyles.UserPaint |
+ ControlStyles.AllPaintingInWmPaint |
+ ControlStyles.SupportsTransparentBackColor |
+ ControlStyles.DoubleBuffer, true);
+
+ HandleCreated += new EventHandler (OnHandleCreatedLB);
+ }
+
+ #region Public Properties
+ [DefaultValue(false)]
+ [Localizable(true)]
+ [RefreshProperties(RefreshProperties.All)]
+ public virtual bool AutoSize {
+ get { return autosize; }
+ set {
+ if (autosize == value)
+ return;
+
+ autosize = value;
+ CalcAutoSize ();
+ Refresh ();
+
+ OnAutoSizeChanged (EventArgs.Empty);
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override Image BackgroundImage {
+ get {
+ return base.BackgroundImage;
+ }
+ set {
+ base.BackgroundImage = value;
+ Refresh ();
+ }
+ }
+
+ [DefaultValue(BorderStyle.None)]
+ [DispId(-504)]
+ public virtual BorderStyle BorderStyle {
+ get { return InternalBorderStyle; }
+ set { InternalBorderStyle = value; }
+ }
+
+ protected override CreateParams CreateParams {
+ get { return base.CreateParams;}
+ }
+
+ protected override ImeMode DefaultImeMode {
+ get { return ImeMode.Disable;}
+ }
+
+ protected override Size DefaultSize {
+ get {return ThemeEngine.Current.LabelDefaultSize;}
+ }
+
+ [DefaultValue(FlatStyle.Standard)]
+ public FlatStyle FlatStyle {
+ get {
+ return flat_style;
+ }
+ set {
+ if (!Enum.IsDefined (typeof (FlatStyle), value))
+ throw new InvalidEnumArgumentException (string.Format("Enum argument value '{0}' is not valid for FlatStyle", value));
+
+ if (flat_style == value)
+ return;
+
+ flat_style = value;
+ Refresh ();
+ }
+ }
+
+ [Localizable(true)]
+ public Image Image {
+ get {
+ if (image != null) {
+ return image;
+ }
+
+ if (image_list != null && ImageIndex >= 0) {
+ return image_list.Images[ImageIndex];
+ }
+
+ return null;
+ }
+ set {
+ if (image == value)
+ return;
+
+ image = value;
+ Refresh ();
+ }
+ }
+
+ [DefaultValue(ContentAlignment.MiddleCenter)]
+ [Localizable(true)]
+ public ContentAlignment ImageAlign {
+ get {
+ return image_align;
+ }
+ set {
+ if (!Enum.IsDefined (typeof (ContentAlignment), value))
+ throw new InvalidEnumArgumentException (string.Format("Enum argument value '{0}' is not valid for ContentAlignment", value));
+
+ if (image_align == value)
+ return;
+
+ image_align = value;
+ Refresh ();
+ }
+ }
+
+ [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 {
+ if (ImageList == null) {
+ return -1;
+ }
+
+ if (image_index >= image_list.Images.Count) {
+ return image_list.Images.Count - 1;
+ }
+
+ return image_index;
+ }
+ set {
+
+ if (value < -1)
+ throw new ArgumentException ();
+
+ if (image_index == value)
+ return;
+
+ image_index = value;
+
+ if (ImageList != null && image_index !=-1)
+ Image = null;
+
+ Refresh ();
+ }
+ }
+
+ [DefaultValue(null)]
+ public ImageList ImageList {
+ get { return image_list;}
+ set {
+ if (image_list == value)
+ return;
+
+ image_list = value;
+
+ if (image_list != null && image_index !=-1)
+ Image = null;
+
+ Refresh ();
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new ImeMode ImeMode {
+ get { return base.ImeMode; }
+ set { base.ImeMode = value; }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public virtual int PreferredHeight {
+ get { return preferred_height; }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public virtual int PreferredWidth {
+ get {return preferred_width; }
+ }
+
+ protected virtual bool RenderTransparent {
+ get { return render_transparent; }
+ set { render_transparent = value;}
+ }
+
+ [Browsable(false)]
+ [DefaultValue(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new bool TabStop {
+ get { return base.TabStop; }
+ set { base.TabStop = value; }
+ }
+
+ [DefaultValue(ContentAlignment.TopLeft)]
+ [Localizable(true)]
+ public virtual ContentAlignment TextAlign {
+ get { return text_align; }
+
+ set {
+ if (!Enum.IsDefined (typeof (ContentAlignment), value))
+ throw new InvalidEnumArgumentException (string.Format("Enum argument value '{0}' is not valid for ContentAlignment", value));
+
+ if (text_align != value) {
+
+ text_align = value;
+
+ switch (value) {
+
+ case ContentAlignment.BottomLeft:
+ string_format.LineAlignment = StringAlignment.Far;
+ string_format.Alignment = StringAlignment.Near;
+ break;
+ case ContentAlignment.BottomCenter:
+ string_format.LineAlignment = StringAlignment.Far;
+ string_format.Alignment = StringAlignment.Center;
+ break;
+ case ContentAlignment.BottomRight:
+ string_format.LineAlignment = StringAlignment.Far;
+ string_format.Alignment = StringAlignment.Far;
+ break;
+ case ContentAlignment.TopLeft:
+ string_format.LineAlignment = StringAlignment.Near;
+ string_format.Alignment = StringAlignment.Near;
+ break;
+ case ContentAlignment.TopCenter:
+ string_format.LineAlignment = StringAlignment.Near;
+ string_format.Alignment = StringAlignment.Center;
+ break;
+ case ContentAlignment.TopRight:
+ string_format.LineAlignment = StringAlignment.Near;
+ string_format.Alignment = StringAlignment.Far;
+ break;
+ case ContentAlignment.MiddleLeft:
+ string_format.LineAlignment = StringAlignment.Center;
+ string_format.Alignment = StringAlignment.Near;
+ break;
+ case ContentAlignment.MiddleRight:
+ string_format.LineAlignment = StringAlignment.Center;
+ string_format.Alignment = StringAlignment.Far;
+ break;
+ case ContentAlignment.MiddleCenter:
+ string_format.LineAlignment = StringAlignment.Center;
+ string_format.Alignment = StringAlignment.Center;
+ break;
+ default:
+ break;
+ }
+
+ OnTextAlignChanged (EventArgs.Empty);
+ Refresh();
+ }
+ }
+ }
+
+ [DefaultValue(true)]
+ public bool UseMnemonic {
+ get { return use_mnemonic; }
+ set {
+ if (use_mnemonic != value) {
+ use_mnemonic = value;
+ SetUseMnemonic (use_mnemonic);
+ Refresh ();
+ }
+ }
+ }
+
+ #endregion
+
+
+ #region Public Methods
+
+ protected Rectangle CalcImageRenderBounds (Image image, Rectangle area, ContentAlignment img_align)
+ {
+ Rectangle rcImageClip = area;
+ rcImageClip.Inflate (-2,-2);
+
+ int X = area.X;
+ int Y = area.Y;
+
+ if (img_align == ContentAlignment.TopCenter ||
+ img_align == ContentAlignment.MiddleCenter ||
+ img_align == ContentAlignment.BottomCenter) {
+ X += (area.Width - image.Width) / 2;
+ }
+ else if (img_align == ContentAlignment.TopRight ||
+ img_align == ContentAlignment.MiddleRight||
+ img_align == ContentAlignment.BottomRight) {
+ X += (area.Width - image.Width);
+ }
+
+ if( img_align == ContentAlignment.BottomCenter ||
+ img_align == ContentAlignment.BottomLeft ||
+ img_align == ContentAlignment.BottomRight) {
+ Y += area.Height - image.Height;
+ }
+ else if(img_align == ContentAlignment.MiddleCenter ||
+ img_align == ContentAlignment.MiddleLeft ||
+ img_align == ContentAlignment.MiddleRight) {
+ Y += (area.Height - image.Height) / 2;
+ }
+
+ rcImageClip.X = X;
+ rcImageClip.Y = Y;
+ rcImageClip.Width = image.Width;
+ rcImageClip.Height = image.Height;
+
+ return rcImageClip;
+ }
+
+
+ protected override AccessibleObject CreateAccessibilityInstance ()
+ {
+ return base.CreateAccessibilityInstance ();
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ base.Dispose (disposing);
+
+ if (disposing)
+ string_format.Dispose ();
+ }
+
+ protected void DrawImage (Graphics g, Image image, Rectangle area, ContentAlignment img_align)
+ {
+ if (image == null || g == null)
+ return;
+
+ Rectangle rcImageClip = CalcImageRenderBounds (image, area, img_align);
+
+ if (Enabled)
+ g.DrawImage (image, rcImageClip.X, rcImageClip.Y, rcImageClip.Width, rcImageClip.Height);
+ else
+ ControlPaint.DrawImageDisabled (g, image, rcImageClip.X, rcImageClip.Y, BackColor);
+ }
+
+ protected virtual void OnAutoSizeChanged (EventArgs e)
+ {
+ if (AutoSizeChanged != null)
+ AutoSizeChanged (this, e);
+ }
+
+ protected override void OnEnabledChanged (EventArgs e)
+ {
+ base.OnEnabledChanged (e);
+ }
+
+ protected override void OnFontChanged (EventArgs e)
+ {
+ base.OnFontChanged (e);
+ if (autosize) {
+ CalcAutoSize();
+ } else {
+ CalcPreferredHeight ();
+ }
+ Refresh ();
+ }
+
+ protected override void OnPaint (PaintEventArgs pevent)
+ {
+ ThemeEngine.Current.DrawLabel (pevent.Graphics, ClientRectangle, this);
+ DrawImage (pevent.Graphics, Image, ClientRectangle, image_align);
+ base.OnPaint(pevent);
+ }
+
+ protected override void OnParentChanged (EventArgs e)
+ {
+ base.OnParentChanged (e);
+ }
+
+ protected virtual void OnTextAlignChanged (EventArgs e)
+ {
+ if (TextAlignChanged != null)
+ TextAlignChanged (this, e);
+ }
+
+ protected override void OnTextChanged (EventArgs e)
+ {
+ base.OnTextChanged (e);
+ if (autosize) {
+ CalcAutoSize ();
+ } else {
+ CalcPreferredWidth ();
+ }
+ Refresh ();
+ }
+
+ protected override void OnVisibleChanged (EventArgs e)
+ {
+ base.OnVisibleChanged (e);
+ }
+
+ protected override bool ProcessMnemonic (char charCode)
+ {
+ if (IsMnemonic(charCode, Text) == true) {
+ // Select item next in line in tab order
+ if (this.parent != null) {
+ parent.SelectNextControl(this, true, false, false, false);
+ }
+ return true;
+ }
+
+ return base.ProcessMnemonic (charCode);
+ }
+
+ protected override void SetBoundsCore (int x, int y, int width, int height, BoundsSpecified specified)
+ {
+ base.SetBoundsCore (x, y, width, height, specified);
+ }
+
+ public override string ToString()
+ {
+ return base.ToString () + ", Text: " + Text;
+ }
+
+ protected override void WndProc (ref Message m)
+ {
+ switch ((Msg) m.Msg) {
+ case Msg.WM_DRAWITEM: {
+ m.Result = (IntPtr)1;
+ }
+ break;
+ default:
+ base.WndProc (ref m);
+ break;
+ }
+ }
+
+ #endregion Public Methods
+
+ #region Private Methods
+
+ private void CalcAutoSize ()
+ {
+ if (IsHandleCreated == false || AutoSize == false)
+ return;
+
+ CalcPreferredWidth ();
+ CalcPreferredHeight ();
+
+ Width = PreferredWidth;
+ Height = PreferredHeight;
+ }
+
+ private void CalcPreferredHeight ()
+ {
+ preferred_height = Font.Height;
+
+ switch (border_style) {
+ case BorderStyle.None:
+ preferred_height += 3;
+ break;
+ case BorderStyle.FixedSingle:
+ case BorderStyle.Fixed3D:
+ preferred_height += 6;
+ break;
+ default:
+ break;
+ }
+
+ }
+
+ private void CalcPreferredWidth ()
+ {
+ SizeF size;
+ size = DeviceContext.MeasureString (Text, Font, req_witdthsize, string_format);
+ preferred_width = (int) size.Width + 3;
+ }
+
+ private void OnHandleCreatedLB (Object o, EventArgs e)
+ {
+ if (autosize)
+ CalcAutoSize ();
+ }
+
+ private void SetUseMnemonic (bool use)
+ {
+ if (use)
+ string_format.HotkeyPrefix = HotkeyPrefix.Show;
+ else
+ string_format.HotkeyPrefix = HotkeyPrefix.None;
+ }
+
+ #endregion Private Methods
+#if NET_2_0
+
+ public bool UseCompatibleTextRendering {
+ get {
+ return use_compatible_text_rendering;
+ }
+
+ set {
+ use_compatible_text_rendering = value;
+ }
+ }
+#endif
+
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LabelEditEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LabelEditEventArgs.cs
new file mode 100644
index 00000000000..3a899ec30bc
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LabelEditEventArgs.cs
@@ -0,0 +1,68 @@
+// 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 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Ravindra (rkumar@novell.com)
+//
+
+
+// COMPLETE
+
+
+using System;
+
+namespace System.Windows.Forms
+{
+ public class LabelEditEventArgs : EventArgs
+ {
+ private int item;
+ private string label;
+ private bool cancelEdit = false;
+
+ #region Public Constructors
+ public LabelEditEventArgs (int item)
+ {
+ this.item = item;
+ }
+
+ public LabelEditEventArgs (int item, string label)
+ {
+ this.item = item;
+ this.label = label;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public bool CancelEdit {
+ get { return cancelEdit; }
+ set { cancelEdit = value; }
+ }
+
+ public int Item {
+ get { return item; }
+ }
+
+ public string Label {
+ get { return label; }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LabelEditEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LabelEditEventHandler.cs
new file mode 100644
index 00000000000..756eebe081f
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LabelEditEventHandler.cs
@@ -0,0 +1,35 @@
+// 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 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Ravindra (rkumar@novell.com)
+//
+
+
+
+// COMPLETE
+
+
+namespace System.Windows.Forms
+{
+ [Serializable]
+ public delegate void LabelEditEventHandler (object sender, LabelEditEventArgs e);
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LayoutEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LayoutEventArgs.cs
new file mode 100644
index 00000000000..7a81edd1e4f
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LayoutEventArgs.cs
@@ -0,0 +1,56 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public sealed class LayoutEventArgs : EventArgs {
+ private Control affected_control;
+ private string affected_property;
+
+ #region Public Constructors
+ public LayoutEventArgs(Control affectedControl, string affectedProperty) {
+ this.affected_control = affectedControl;
+ this.affected_property = affectedProperty;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public Control AffectedControl {
+ get {
+ return this.affected_control;
+ }
+ }
+
+ public string AffectedProperty {
+ get {
+ return this.affected_property;
+ }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LayoutEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LayoutEventHandler.cs
new file mode 100644
index 00000000000..208c9d8d132
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LayoutEventHandler.cs
@@ -0,0 +1,32 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public delegate void LayoutEventHandler (object sender, LayoutEventArgs e);
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LeftRightAlignment.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LeftRightAlignment.cs
new file mode 100644
index 00000000000..e775a94a9e7
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LeftRightAlignment.cs
@@ -0,0 +1,37 @@
+// 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-2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+// COMPLETE
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [ComVisible(true)]
+ public enum LeftRightAlignment {
+ Left = 0,
+ Right = 1
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LibSupport.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LibSupport.cs
new file mode 100644
index 00000000000..4445ca5c5cb
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LibSupport.cs
@@ -0,0 +1,56 @@
+// 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) 2005 Novell, Inc.
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+
+using System.Collections;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms
+{
+ class LibSupport {
+ static ArrayList list = new ArrayList ();
+
+ public static void Register ()
+ {
+ FindWindowExW fw = new FindWindowExW (FindWindow);
+ list.Add (fw);
+ support_register_delegate ("FindWindowExW", fw);
+ }
+
+ static IntPtr FindWindow (IntPtr hWnd)
+ {
+ NativeWindow nw = NativeWindow.FindWindow (hWnd);
+ if (nw == null)
+ return IntPtr.Zero;
+
+ return nw.Handle;
+ }
+
+ delegate IntPtr FindWindowExW (IntPtr hWnd);
+
+ [DllImport ("MonoSupportW")]
+ extern static void support_register_delegate (string fmt, Delegate d);
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkArea.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkArea.cs
new file mode 100644
index 00000000000..16b69546353
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkArea.cs
@@ -0,0 +1,168 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+//
+// Dennis Hayes, dennish@raytek.com
+// Andreas Nahr, ClassDevelopment@A-SoftTech.com
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+
+
+// COMPLETE
+
+using System.ComponentModel;
+using System.Globalization;
+
+namespace System.Windows.Forms
+{
+ [Serializable]
+ [TypeConverter(typeof(LinkArea.LinkAreaConverter))]
+ public struct LinkArea
+ {
+ #region LinkAreaConverter Class
+ public class LinkAreaConverter : TypeConverter {
+ public LinkAreaConverter() {
+ }
+
+ public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) {
+ if (sourceType == typeof(string)) {
+ return true;
+ }
+ return base.CanConvertFrom(context, sourceType);
+ }
+
+ public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) {
+ if (destinationType == typeof(string)) {
+ return true;
+ }
+ return base.CanConvertTo(context, destinationType);
+ }
+
+ public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) {
+ string[] parts;
+ int start;
+ int length;
+
+ if ((value == null) || !(value is String)) {
+ return base.ConvertFrom (context, culture, value);
+ }
+
+ if (culture == null) {
+ culture = CultureInfo.CurrentCulture;
+ }
+
+ parts = ((string)value).Split(culture.TextInfo.ListSeparator.ToCharArray());
+ start = int.Parse(parts[0].Trim());
+ length = int.Parse(parts[1].Trim());
+ return new LinkArea(start, length);
+ }
+
+ public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) {
+ LinkArea l;
+
+ if ((value == null) || !(value is LinkArea) || (destinationType != typeof(string))) {
+ return base.ConvertTo (context, culture, value, destinationType);
+ }
+
+ if (culture == null) {
+ culture = CultureInfo.CurrentCulture;
+ }
+
+ l = (LinkArea)value;
+
+
+ return l.Start.ToString() + culture.TextInfo.ListSeparator + l.Length.ToString();
+ }
+
+ public override object CreateInstance(ITypeDescriptorContext context, System.Collections.IDictionary propertyValues) {
+ return new LinkArea((int)propertyValues["Start"], (int)propertyValues["Length"]);
+ }
+
+ public override bool GetCreateInstanceSupported(ITypeDescriptorContext context) {
+ return true;
+ }
+
+ public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes) {
+ return TypeDescriptor.GetProperties(typeof(LinkArea), attributes);
+ }
+
+ public override bool GetPropertiesSupported(ITypeDescriptorContext context) {
+ return true;
+ }
+ }
+ #endregion // LinkAreaConverter Class
+
+ private int start;
+ private int length;
+
+ public LinkArea (int start, int length)
+ {
+ this.start = start;
+ this.length = length;
+ }
+
+ #region Public Properties
+
+ public int Start {
+ get { return start; }
+ set { start = value; }
+ }
+
+ public int Length {
+ get { return length; }
+ set { length = value; }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public bool IsEmpty {
+ get {
+ if (start == 0 && length == 0)
+ return true;
+ else
+ return false;
+
+ }
+ }
+
+ #endregion //Public Properties
+
+ #region Methods
+
+ public override bool Equals (object o)
+ {
+ if (!(o is LinkArea))
+ return false;
+
+ LinkArea comp = (LinkArea) o;
+ return (comp.Start == start && comp.Length == length);
+ }
+
+ public override int GetHashCode ()
+ {
+ return start << 4 | length;
+ }
+
+ #endregion //Methods
+
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkBehavior.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkBehavior.cs
new file mode 100644
index 00000000000..99ab9c69d8d
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkBehavior.cs
@@ -0,0 +1,39 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms
+{
+ public enum LinkBehavior
+ {
+ SystemDefault = 0,
+ AlwaysUnderline = 1,
+ HoverUnderline = 2,
+ NeverUnderline = 3,
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkClickedEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkClickedEventArgs.cs
new file mode 100644
index 00000000000..9a6efb082c8
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkClickedEventArgs.cs
@@ -0,0 +1,48 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+
+
+// COMPLETE
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms
+{
+ [ComVisible(true)]
+ public class LinkClickedEventArgs : EventArgs
+ {
+ private string link_text;
+
+ public LinkClickedEventArgs (string link_text)
+ {
+ this.link_text = link_text;
+ }
+
+ public string LinkText
+ {
+ get { return link_text; }
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkClickedEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkClickedEventHandler.cs
new file mode 100644
index 00000000000..c303262d657
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkClickedEventHandler.cs
@@ -0,0 +1,34 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+// COMPLETE
+
+namespace System.Windows.Forms
+{
+ [Serializable]
+ public delegate void LinkClickedEventHandler (object sender, LinkClickedEventArgs e);
+}
+
+
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkLabel.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkLabel.cs
new file mode 100644
index 00000000000..33ae9a1001a
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkLabel.cs
@@ -0,0 +1,895 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+// Based on work by:
+// Daniel Carrera, dcarrera@math.toronto.edu (stubbed out)
+// Jaak Simm (jaaksimm@firm.ee) (stubbed out)
+//
+
+// COMPLETE
+
+
+using System.ComponentModel;
+using System.Collections;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+
+namespace System.Windows.Forms
+{
+ [DefaultEvent("LinkClicked")]
+ public class LinkLabel : Label, IButtonControl
+ {
+ /* Encapsulates a piece of text (regular or link)*/
+ internal class Piece
+ {
+ public string text;
+ public int start;
+ public int end;
+ public LinkLabel.Link link; // Empty link indicates regular text
+ public Rectangle rect;
+ public bool clicked;
+ public bool focused;
+
+ public Piece ()
+ {
+ start = end = 0;
+ link = null;
+ clicked = false;
+ focused = false;
+ }
+ }
+
+ private Color active_link;
+ private Color disabled_link;
+ private Color link_color;
+ private Color visited_color;
+ private LinkArea link_area;
+ private LinkBehavior link_behavior;
+ private LinkCollection link_collection;
+ private bool link_visited;
+ private bool link_click;
+ internal Piece[] pieces;
+ internal int num_pieces;
+ internal Font link_font;
+ private Cursor override_cursor;
+ private DialogResult dialog_result;
+
+ #region Events
+ public event LinkLabelLinkClickedEventHandler LinkClicked;
+ #endregion // Events
+
+ public LinkLabel ()
+ {
+ LinkArea = new LinkArea (0, -1);
+ link_behavior = LinkBehavior.SystemDefault;
+ link_visited = false;
+ link_click = false;
+ pieces = null;
+ num_pieces = 0;
+ link_font = null;
+
+ ActiveLinkColor = Color.Red;
+ DisabledLinkColor = ThemeEngine.Current.ColorGrayText;
+ LinkColor = Color.FromArgb (255, 0, 0, 255);
+ VisitedLinkColor = Color.FromArgb (255, 128, 0, 128);
+ SetStyle (ControlStyles.Selectable, false);
+ SetStyle (ControlStyles.Opaque, true);
+ }
+
+ #region Public Properties
+
+ public Color ActiveLinkColor {
+ get { return active_link;}
+ set {
+ if (active_link == value)
+ return;
+
+ active_link = value;
+ Refresh ();
+ }
+ }
+
+ public Color DisabledLinkColor {
+
+ get { return disabled_link;}
+ set {
+ if (disabled_link == value)
+ return;
+
+ disabled_link = value;
+ Refresh ();
+ }
+ }
+
+ public Color LinkColor {
+ get { return link_color;}
+ set {
+ if (link_color == value)
+ return;
+
+ link_color = value;
+ Refresh ();
+ }
+ }
+
+ public Color VisitedLinkColor {
+ get { return visited_color;}
+ set {
+ if (visited_color == value)
+ return;
+
+ visited_color = value;
+ Refresh ();
+ }
+ }
+
+ [Localizable (true)]
+ [Editor ("System.Windows.Forms.Design.LinkAreaEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public LinkArea LinkArea {
+ get { return link_area;}
+ set {
+
+ if (value.Start <0 || value.Length < -1)
+ throw new ArgumentException ();
+
+ if (!value.IsEmpty)
+ Links.Add (value.Start, value.Length);
+
+ link_area = value;
+ Refresh ();
+ }
+ }
+
+ [DefaultValue (LinkBehavior.SystemDefault)]
+ public LinkBehavior LinkBehavior {
+
+ get { return link_behavior;}
+ set {
+ if (link_behavior == value)
+ return;
+
+ link_behavior = value;
+ Refresh ();
+ }
+ }
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public LinkLabel.LinkCollection Links {
+ get {
+ if (link_collection == null)
+ link_collection = new LinkCollection (this);
+
+ return link_collection;
+ }
+ }
+
+ [DefaultValue (false)]
+ public bool LinkVisited {
+ get { return link_visited;}
+ set {
+ if (link_visited == value)
+ return;
+
+ link_visited = value;
+ Refresh ();
+ }
+ }
+
+ protected Cursor OverrideCursor {
+ get { return override_cursor;}
+ set { override_cursor = value;}
+ }
+
+ [RefreshProperties(RefreshProperties.Repaint)]
+ public override string Text {
+ get { return base.Text; }
+ set {
+ if (base.Text == value)
+ return;
+
+ base.Text = value;
+ CreateLinkPieces ();
+ }
+ }
+
+ #endregion // Public Properties
+
+ DialogResult IButtonControl.DialogResult {
+ get { return dialog_result; }
+ set { dialog_result = value; }
+ }
+
+
+ void IButtonControl.NotifyDefault (bool value)
+ {
+
+ }
+
+ void IButtonControl.PerformClick ()
+ {
+
+ }
+
+ #region Public Methods
+ protected override AccessibleObject CreateAccessibilityInstance ()
+ {
+ return base.CreateAccessibilityInstance();
+ }
+
+ protected override void CreateHandle ()
+ {
+ base.CreateHandle ();
+ CreateLinkFont ();
+ CreateLinkPieces ();
+ }
+
+ protected override void OnEnabledChanged (EventArgs e)
+ {
+ base.OnEnabledChanged (e);
+ Refresh ();
+ }
+
+ protected override void OnFontChanged (EventArgs e)
+ {
+ base.OnFontChanged (e);
+ CreateLinkFont ();
+ CreateLinkPieces ();
+ }
+
+ protected override void OnGotFocus (EventArgs e)
+ {
+ base.OnGotFocus (e);
+
+ // Set focus to the first enabled link piece
+ for (int i = 0; i < num_pieces; i++) {
+ if (pieces[i].link != null && pieces[i].link.Enabled) {
+ pieces[i].focused = true;
+ Invalidate (pieces[i].rect);
+ break;
+ }
+ }
+ }
+
+ protected override void OnKeyDown (KeyEventArgs e)
+ {
+ base.OnKeyDown(e);
+
+ // Set focus to the next link piece
+ if (e.KeyCode == Keys.Tab || e.KeyCode == Keys.Right) {
+ for (int i = 0; i < num_pieces; i++) {
+ if (pieces[i].focused) {
+ pieces[i].focused = false;
+ Invalidate (pieces[i].rect);
+
+ for (int n = i + 1; n < num_pieces; n++) {
+ if (pieces[n].link != null && pieces[n].link.Enabled) {
+ pieces[n].focused = true;
+ e.Handled = true;
+ Invalidate (pieces[n].rect);
+ return;
+ }
+ }
+ }
+ }
+ } else if (e.KeyCode == Keys.Return) {
+ for (int i = 0; i < num_pieces; i++) {
+ if (pieces[i].focused && pieces[i].link != null) {
+ OnLinkClicked (new LinkLabelLinkClickedEventArgs (pieces[i].link));
+ break;
+ }
+ }
+ }
+ }
+
+ protected virtual void OnLinkClicked (LinkLabelLinkClickedEventArgs e)
+ {
+ if (LinkClicked != null)
+ LinkClicked (this, e);
+ }
+
+ protected override void OnLostFocus (EventArgs e)
+ {
+ base.OnLostFocus (e);
+
+ // Clean focus in link pieces
+ for (int i = 0; i < num_pieces; i++) {
+ if (pieces[i].focused) {
+ pieces[i].focused = false;
+ }
+ }
+
+ Refresh ();
+ }
+
+ protected override void OnMouseDown (MouseEventArgs e)
+ {
+ if (!Enabled) return;
+
+ base.OnMouseDown (e);
+ this.Capture = true;
+
+ for (int i = 0; i < num_pieces; i++) {
+ if (pieces[i].rect.Contains (e.X, e.Y)) {
+ if (pieces[i].link!= null) {
+ pieces[i].clicked = true;
+ Invalidate (pieces[i].rect);
+ }
+ break;
+ }
+ }
+ }
+
+ protected override void OnMouseLeave(EventArgs e)
+ {
+ if (!Enabled) return;
+ base.OnMouseLeave (e);
+ UpdateHover(null);
+ }
+
+ private bool UpdateHover(Link link) {
+ bool changed;
+
+ changed = false;
+ if (link == null) {
+ Cursor = Cursors.Default;
+
+ if (link_behavior == LinkBehavior.HoverUnderline) {
+ for (int i = 0; i < Links.Count; i++) {
+ if (Links[i].Hoovered == true) {
+ changed = true;
+ Links[i].Hoovered = false;
+ }
+ }
+ }
+ } else {
+ if (link_behavior == LinkBehavior.HoverUnderline) {
+ Cursor = Cursors.Hand;
+
+ if (link.Hoovered != true) {
+ link.Hoovered = true;
+ changed = true;
+ }
+ }
+ }
+
+ if (changed == true) {
+ Refresh ();
+ }
+
+
+ return changed;
+ }
+
+ protected override void OnMouseMove (MouseEventArgs e)
+ {
+ base.OnMouseMove (e);
+ UpdateHover(PointInLink (e.X, e.Y));
+ }
+
+ protected override void OnMouseUp (MouseEventArgs e)
+ {
+ if (!Enabled) return;
+
+ base.OnMouseUp (e);
+ this.Capture = false;
+
+ for (int i = 0; i < num_pieces; i++) {
+ if (pieces[i].link!= null && pieces[i].clicked == true) {
+ OnLinkClicked (new LinkLabelLinkClickedEventArgs (pieces[i].link));
+ pieces[i].clicked = false;
+ Invalidate (pieces[i].rect);
+ break;
+ }
+ }
+ }
+
+ protected override void OnPaint (PaintEventArgs pevent)
+ {
+ ThemeEngine.Current.DrawLinkLabel (pevent.Graphics, pevent.ClipRectangle, this);
+ DrawImage (pevent.Graphics, Image, ClientRectangle, image_align);
+ // Do not call base.OnPaint since it's the Label class
+ }
+
+ protected override void OnPaintBackground (PaintEventArgs e)
+ {
+ base.OnPaintBackground (e);
+ }
+
+ protected override void OnTextAlignChanged (EventArgs e)
+ {
+ base.OnTextAlignChanged (e);
+ CreateLinkPieces ();
+ }
+
+ protected override void OnTextChanged (EventArgs e)
+ {
+ base.OnTextChanged (e);
+ }
+
+ protected Link PointInLink (int x, int y)
+ {
+ for (int i = 0; i < num_pieces; i++) {
+ if (pieces[i].rect.Contains (x,y) && pieces[i].link != null)
+ return pieces[i].link;
+ }
+
+ return null;
+ }
+
+ protected override bool ProcessDialogKey (Keys keyData)
+ {
+ return base.ProcessDialogKey (keyData);
+ }
+
+ protected override void Select (bool directed, bool forward)
+ {
+ base.Select (directed, forward);
+ }
+
+ protected override void SetBoundsCore (int x, int y, int width, int height, BoundsSpecified specified)
+ {
+ base.SetBoundsCore (x, y, width, height, specified);
+ }
+
+ protected override void WndProc (ref Message m)
+ {
+ base.WndProc (ref m);
+ }
+
+ #endregion //Public Methods
+
+ #region Private Methods
+
+ internal void CreateLinkPieces ()
+ {
+ if (Links.Count == 0 || IsHandleCreated == false || Text.Length == 0)
+ return;
+
+ int cur_piece = 0;
+ num_pieces = 0;
+
+ if (Links.Count == 1 && Links[0].Start == 0 && Links[0].Length == -1) {
+ Links[0].Length = Text.Length;
+ }
+
+ pieces = new Piece [(Links.Count * 2) + 1];
+ pieces[cur_piece] = new Piece();
+ pieces[cur_piece].start = 0;
+
+ for (int i = 0; i < Text.Length; i++) { /* Every char on the text*/
+ for (int l = 0; l < Links.Count; l++) { /* Every link that we know of*/
+ if (Links[l].Start == i) {
+ if (i > 0) {
+ /*Push prev. regular text*/
+ pieces[cur_piece].end = i;
+ pieces[cur_piece].text = Text.Substring (pieces[cur_piece].start,
+ pieces[cur_piece].end - pieces[cur_piece].start);
+
+ cur_piece++;
+
+ /* New link*/
+ pieces[cur_piece] = new Piece ();
+ }
+
+ int end;
+
+ if (Links[l].Start + Links[l].Length > Text.Length) {
+ end = Text.Length - Links[l].Start;
+ }
+ else {
+ end = Links[l].Length;
+ }
+
+ pieces[cur_piece].start = Links[l].Start;
+ pieces[cur_piece].end = Links[l].Start + end;
+ pieces[cur_piece].link = Links[l];
+
+ pieces[cur_piece].text = Text.Substring (pieces[cur_piece].start, end);
+
+ cur_piece++; /* Push link*/
+ pieces[cur_piece] = new Piece();
+ i+= Links[l].Length;
+ pieces[cur_piece].start = i;
+ }
+ }
+ }
+
+ if (pieces[cur_piece].end == 0 && pieces[cur_piece].start < Text.Length) {
+ pieces[cur_piece].end = Text.Length;
+ pieces[cur_piece].text = Text.Substring (pieces[cur_piece].start, pieces[cur_piece].end - pieces[cur_piece].start);
+ cur_piece++;
+ }
+
+ num_pieces = cur_piece;
+
+ CharacterRange[] charRanges = new CharacterRange [num_pieces];
+
+ for (int i = 0; i < num_pieces; i++)
+ charRanges[i] = new CharacterRange (pieces[i].start, pieces[i].end - pieces[i].start);
+
+ Region[] charRegions = new Region [num_pieces];
+ string_format.SetMeasurableCharacterRanges (charRanges);
+
+ // BUG: This sizes do not match the ones used later when drawing
+ charRegions = DeviceContext.MeasureCharacterRanges (Text, link_font, ClientRectangle, string_format);
+
+ RectangleF rect;
+ for (int i = 0; i < num_pieces; i++) {
+ rect = charRegions[i].GetBounds (DeviceContext);
+ pieces[i].rect = Rectangle.Ceiling (rect);
+ charRegions[i].Dispose ();
+ }
+
+ if (Visible && IsHandleCreated)
+ Refresh ();
+
+ }
+
+ /* Check if the links overlap */
+ internal void CheckLinks ()
+ {
+ for (int i = 0; i < Links.Count; i++) {
+ for (int l = 0; l < Links.Count; l++) {
+ if (i==l) continue;
+
+ if (((Links[i].Start + Links[i].Length) >= Links[l].Start &&
+ Links[i].Start + Links[i].Length <= Links[l].Start + Links[l].Length) ||
+ (Links[i].Start >= Links[l].Start &&
+ Links[i].Start <= Links[l].Start + Links[l].Length))
+ throw new InvalidOperationException ("Overlapping link regions.");
+ }
+ }
+ }
+
+ internal Font GetPieceFont (Piece piece)
+ {
+ switch (link_behavior) {
+ case LinkBehavior.AlwaysUnderline:
+ case LinkBehavior.SystemDefault: // Depends on IE configuration
+ {
+ if (piece.link == null) {
+ return Font;
+ } else {
+ return link_font;
+ }
+ }
+ case LinkBehavior.HoverUnderline:
+ {
+ if (piece.link != null && piece.link.Hoovered) {
+ return link_font;
+ } else {
+ return Font;
+ }
+ }
+
+ case LinkBehavior.NeverUnderline:
+ default:
+ return Font;
+ }
+
+ }
+
+
+ internal Color GetLinkColor (Piece piece, int i)
+ {
+ Color color;
+
+ if (Enabled == false ||
+ (piece.link != null && piece.link.Enabled == false))
+ color = DisabledLinkColor;
+ else
+ if (piece.clicked == true)
+ color = ActiveLinkColor;
+ else
+ if ((LinkVisited == true && i == 0) ||
+ (piece.link != null && piece.link.Visited == true))
+ color = VisitedLinkColor;
+ else
+ color = LinkColor;
+
+ return color;
+ }
+
+ private void CreateLinkFont ()
+ {
+ if (link_font != null)
+ link_font.Dispose ();
+
+ link_font = new Font (Font.FontFamily, Font.Size, Font.Style | FontStyle.Underline,
+ Font.Unit);
+ }
+
+ #endregion // Private Methods
+
+ //
+ // System.Windows.Forms.LinkLabel.Link
+ //
+ public class Link
+ {
+ private bool enabled;
+ internal int length;
+ private object linkData;
+ private int start;
+ private bool visited;
+ private LinkLabel owner;
+ private bool hoovered;
+
+ internal Link ()
+ {
+ enabled = true;
+ visited = false;
+ length = start = 0;
+ linkData = null;
+ owner = null;
+ }
+
+ internal Link (LinkLabel owner)
+ {
+ enabled = true;
+ visited = false;
+ length = start = 0;
+ linkData = null;
+ this.owner = owner;
+ }
+
+ public bool Enabled {
+ get { return enabled; }
+ set {
+ if (enabled == value)
+ return;
+
+ enabled = value;
+
+ if (owner != null)
+ owner.Refresh ();
+ }
+ }
+
+ public int Length {
+ get {
+ if (length == -1) {
+ return owner.Text.Length;
+ }
+
+ return length;
+ }
+ set {
+ if (length == value)
+ return;
+
+ length = value;
+
+ if (owner != null)
+ owner.CreateLinkPieces ();
+ }
+ }
+
+ public object LinkData {
+ get { return linkData; }
+ set { linkData = value; }
+ }
+
+ public int Start {
+ get { return start; }
+ set {
+ if (start == value)
+ return;
+
+ start = value;
+
+ if (owner != null)
+ owner.CreateLinkPieces ();
+ }
+ }
+
+ public bool Visited {
+ get { return visited; }
+ set {
+ if (visited == value)
+ return;
+
+ visited = value;
+
+ if (owner != null)
+ owner.Refresh ();
+ }
+ }
+
+ internal bool Hoovered {
+ get { return hoovered; }
+ set { hoovered = value; }
+ }
+ }
+
+ //
+ // System.Windows.Forms.LinkLabel.Link
+ //
+ public class LinkCollection : IList, ICollection, IEnumerable
+ {
+ private LinkLabel owner;
+ private ArrayList collection = new ArrayList();
+
+ public LinkCollection (LinkLabel owner)
+ {
+ if (owner==null)
+ throw new ArgumentNullException ();
+
+ this.owner = owner;
+ }
+
+ [Browsable (false)]
+ public int Count {
+ get { return collection.Count; }
+ }
+
+ public bool IsReadOnly {
+ get { return false; }
+ }
+
+ public virtual LinkLabel.Link this[int index] {
+ get {
+ if (index < 0 || index >= Count)
+ throw new ArgumentOutOfRangeException();
+
+ return (LinkLabel.Link) collection[index];
+ }
+ set {
+ if (index < 0 || index >= Count)
+ throw new ArgumentOutOfRangeException();
+
+ collection[index] = value;
+ }
+ }
+
+ public Link Add (int start, int length)
+ {
+ return Add (start, length, null);
+ }
+
+
+ public Link Add (int start, int length, object o)
+ {
+ Link link = new Link (owner);
+ int idx;
+
+ if (Count == 1 && this[0].Start == 0
+ && this[0].length == -1) {
+ Clear ();
+ }
+
+ link.Length = length;
+ link.Start = start;
+ link.LinkData = o;
+ idx = collection.Add (link);
+
+ owner.CheckLinks ();
+ owner.CreateLinkPieces ();
+ return (Link) collection[idx];
+ }
+
+ public virtual void Clear ()
+ {
+ collection.Clear();
+ owner.CreateLinkPieces ();
+ }
+
+ public bool Contains (LinkLabel.Link link)
+ {
+ return collection.Contains (link);
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return collection.GetEnumerator ();
+ }
+
+ public int IndexOf (LinkLabel.Link link)
+ {
+ return collection.IndexOf (link);
+ }
+
+ public void Remove (LinkLabel.Link value)
+ {
+ collection.Remove (value);
+ owner.CreateLinkPieces ();
+ }
+
+ public void RemoveAt (int index)
+ {
+ if (index >= Count)
+ throw new ArgumentOutOfRangeException ("Invalid value for array index");
+
+ collection.Remove (collection[index]);
+ owner.CreateLinkPieces ();
+ }
+
+ bool IList.IsFixedSize {
+ get {return false;}
+ }
+
+ object IList.this[int index] {
+ get { return collection[index]; }
+ set { collection[index] = value; }
+ }
+
+ object ICollection.SyncRoot {
+ get {return this;}
+ }
+
+ bool ICollection.IsSynchronized {
+ get {return false;}
+ }
+
+ void ICollection.CopyTo (Array dest, int index)
+ {
+ collection.CopyTo (dest, index);
+ }
+
+ int IList.Add (object control)
+ {
+ int idx = collection.Add (control);
+ owner.CheckLinks ();
+ owner.CreateLinkPieces ();
+ return idx;
+ }
+
+ bool IList.Contains (object control)
+ {
+ return collection.Contains (control);
+ }
+
+ int IList.IndexOf (object control)
+ {
+ return collection.IndexOf (control);
+ }
+
+ void IList.Insert (int index, object value)
+ {
+ collection.Insert (index, value);
+ owner.CheckLinks ();
+ owner.CreateLinkPieces ();
+ }
+
+ void IList.Remove (object control)
+ {
+ collection.Remove (control);
+ owner.CreateLinkPieces ();
+ }
+ }
+#if NET_2_0
+
+ public bool UseCompatibleTextRendering {
+ get {
+ return use_compatible_text_rendering;
+ }
+
+ set {
+ use_compatible_text_rendering = value;
+ }
+ }
+#endif
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkLabelLinkClickedEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkLabelLinkClickedEventArgs.cs
new file mode 100644
index 00000000000..0dd50fd8f6c
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkLabelLinkClickedEventArgs.cs
@@ -0,0 +1,49 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+
+// COMPLETE
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms
+{
+
+ [ComVisible(true)]
+ public class LinkLabelLinkClickedEventArgs : EventArgs
+ {
+ private LinkLabel.Link link;
+
+ public LinkLabelLinkClickedEventArgs (LinkLabel.Link link)
+ {
+ this.link = link;
+ }
+
+ public LinkLabel.Link Link{
+ get {return link; }
+ }
+
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkLabelLinkClickedEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkLabelLinkClickedEventHandler.cs
new file mode 100644
index 00000000000..4f09d9d5668
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkLabelLinkClickedEventHandler.cs
@@ -0,0 +1,39 @@
+//
+// System.LinkLabelLinkClickEventHandler.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 Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+// Dennis hayes (dennish@raytek.com)
+//
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms
+{
+ [Serializable]
+ public delegate void LinkLabelLinkClickedEventHandler (object sender, LinkLabelLinkClickedEventArgs e);
+
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkState.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkState.cs
new file mode 100644
index 00000000000..0c7ac502704
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkState.cs
@@ -0,0 +1,41 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+
+
+// COMPLETE
+
+
+namespace System.Windows.Forms
+{
+ public enum LinkState
+ {
+ Normal = 0,
+ Hover = 1,
+ Active = 2,
+ Visited = 4
+ }
+}
+
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBindingConverter.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBindingConverter.cs
new file mode 100644
index 00000000000..03e380fd70c
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBindingConverter.cs
@@ -0,0 +1,60 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// NOT COMPLETE
+
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+ public class ListBindingConverter : TypeConverter {
+ #region Public Constructors
+ public ListBindingConverter() {
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Methods
+ public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) {
+ if (destinationType == typeof(string)) {
+ return true;
+ }
+ return base.CanConvertTo (context, destinationType);
+ }
+
+ [MonoTODO]
+ public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) {
+ return base.ConvertTo (context, culture, value, destinationType);
+ }
+
+ public override object CreateInstance(ITypeDescriptorContext context, System.Collections.IDictionary propertyValues) {
+ return new Binding((string)propertyValues["PropertyName"], (object)propertyValues["DataSource"], (string)propertyValues["DataMember"]);
+ }
+
+ public override bool GetCreateInstanceSupported(ITypeDescriptorContext context) {
+ return true;
+ }
+ #endregion // Public Instance Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs
new file mode 100644
index 00000000000..f5ba6fdd1ef
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs
@@ -0,0 +1,2390 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+
+// COMPLETE
+
+using System;
+using System.Drawing;
+using System.Collections;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.ComponentModel.Design.Serialization;
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms
+{
+ [DefaultProperty("Items")]
+ [DefaultEvent("SelectedIndexChanged")]
+ [Designer ("System.Windows.Forms.Design.ListBoxDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+ public class ListBox : ListControl
+ {
+ public const int DefaultItemHeight = 13;
+ public const int NoMatches = -1;
+
+ internal class ListBoxInfo
+ {
+ internal int item_height; /* Item's height */
+ internal int top_item; /* First item that we show the in the current page */
+ internal int last_item; /* Last visible item */
+ internal int page_size; /* Number of listbox items per page. In MultiColumn listbox indicates items per column */
+ internal Rectangle textdrawing_rect; /* Displayable Client Rectangle minus the scrollbars and with IntegralHeight calculated*/
+ internal bool show_verticalsb; /* Is Vertical scrollbar show it? */
+ internal bool show_horizontalsb; /* Is Horizontal scrollbar show it? */
+ internal Rectangle client_rect; /* Client Rectangle. Usually = ClientRectangle except when IntegralHeight has been applied*/
+ internal int max_itemwidth; /* Maxium item width within the listbox */
+
+ public ListBoxInfo ()
+ {
+ last_item = 0;
+ item_height = 0;
+ top_item = 0;
+ page_size = 0;
+ max_itemwidth = 0;
+ show_verticalsb = false;
+ show_horizontalsb = false;
+ }
+ }
+
+ internal class ListBoxItem
+ {
+ internal int Index;
+ internal bool Selected;
+ internal int ItemHeight; /* Only used for OwnerDrawVariable */
+ internal CheckState State;
+
+ public ListBoxItem (int index)
+ {
+ Index = index;
+ Selected = false;
+ ItemHeight = -1;
+ State = CheckState.Unchecked;
+ }
+
+ public void CopyState (ListBoxItem src)
+ {
+ Selected = src.Selected;
+ ItemHeight = src.ItemHeight;
+ State = src.State;
+ }
+ }
+
+ internal enum ItemNavigation
+ {
+ First,
+ Last,
+ Next,
+ Previous,
+ NextPage,
+ PreviousPage,
+ PreviousColumn,
+ NextColumn
+ }
+
+ internal enum UpdateOperation
+ {
+ AddItems,
+ DeleteItems,
+ AllItems
+ }
+
+ private int column_width;
+ private DrawMode draw_mode;
+ private int horizontal_extent;
+ private bool horizontal_scrollbar;
+ private bool integral_height;
+ private bool multicolumn;
+ private bool scroll_always_visible;
+ private int selected_index;
+ private SelectedIndexCollection selected_indices;
+ private SelectedObjectCollection selected_items;
+ private SelectionMode selection_mode;
+ private bool sorted;
+ private bool use_tabstops;
+ private int column_width_internal;
+ private VScrollBar vscrollbar_ctrl;
+ private HScrollBar hscrollbar_ctrl;
+ private bool suspend_ctrlupdate;
+ private bool ctrl_pressed;
+ private bool shift_pressed;
+ private bool has_focus;
+ private bool use_item_height;
+
+ internal int focused_item;
+ internal ListBoxInfo listbox_info;
+ internal ObjectCollection items;
+
+ public ListBox ()
+ {
+ border_style = BorderStyle.Fixed3D;
+ draw_mode = DrawMode.Normal;
+ horizontal_extent = 0;
+ horizontal_scrollbar = false;
+ integral_height = true;
+ multicolumn = false;
+ scroll_always_visible = false;
+ selected_index = -1;
+ focused_item = -1;
+ selection_mode = SelectionMode.One;
+ sorted = false;
+ use_tabstops = true;
+ BackColor = ThemeEngine.Current.ColorWindow;
+ ColumnWidth = 0;
+ suspend_ctrlupdate = false;
+ ctrl_pressed = false;
+ shift_pressed = false;
+ has_focus = false;
+ use_item_height = false;
+
+ items = new ObjectCollection (this);
+ selected_indices = new SelectedIndexCollection (this);
+ selected_items = new SelectedObjectCollection (this);
+ listbox_info = new ListBoxInfo ();
+ listbox_info.item_height = FontHeight;
+
+ /* Vertical scrollbar */
+ vscrollbar_ctrl = new VScrollBar ();
+ vscrollbar_ctrl.Minimum = 0;
+ vscrollbar_ctrl.SmallChange = 1;
+ vscrollbar_ctrl.LargeChange = 1;
+ vscrollbar_ctrl.Maximum = 0;
+ vscrollbar_ctrl.ValueChanged += new EventHandler (VerticalScrollEvent);
+ vscrollbar_ctrl.Visible = false;
+
+ /* Horizontal scrollbar */
+ hscrollbar_ctrl = new HScrollBar ();
+ hscrollbar_ctrl.Minimum = 0;
+ hscrollbar_ctrl.SmallChange = 1;
+ hscrollbar_ctrl.LargeChange = 1;
+ hscrollbar_ctrl.Maximum = 0;
+ hscrollbar_ctrl.Visible = false;
+ hscrollbar_ctrl.ValueChanged += new EventHandler (HorizontalScrollEvent);
+
+ /* Events */
+ MouseDown += new MouseEventHandler (OnMouseDownLB);
+ KeyDown += new KeyEventHandler (OnKeyDownLB);
+ KeyUp += new KeyEventHandler (OnKeyUpLB);
+ GotFocus += new EventHandler (OnGotFocus);
+ LostFocus += new EventHandler (OnLostFocus);
+
+ SetStyle (ControlStyles.UserPaint, false);
+ }
+
+ #region Events
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler BackgroundImageChanged;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ public new event EventHandler Click;
+
+ public event DrawItemEventHandler DrawItem;
+ public event MeasureItemEventHandler MeasureItem;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event PaintEventHandler Paint;
+
+ public event EventHandler SelectedIndexChanged;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ public new event EventHandler TextChanged;
+ #endregion // Events
+
+ #region Public Properties
+ public override Color BackColor {
+ get { return base.BackColor; }
+ set {
+ if (base.BackColor == value)
+ return;
+
+ base.BackColor = value;
+ base.Refresh (); // Careful. Calling the base method is not the same that calling
+ } // the overriden one that refresh also all the items
+ }
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public override Image BackgroundImage {
+ get { return base.BackgroundImage; }
+ set {
+ if (base.BackgroundImage == value)
+ return;
+
+ base.BackgroundImage = value;
+
+ if (BackgroundImageChanged != null)
+ BackgroundImageChanged (this, EventArgs.Empty);
+
+ base.Refresh ();
+ }
+ }
+
+ [DefaultValue (BorderStyle.Fixed3D)]
+ [DispId(-504)]
+ public BorderStyle BorderStyle {
+ get { return InternalBorderStyle; }
+ set { InternalBorderStyle = value; }
+ }
+
+ [DefaultValue (0)]
+ [Localizable (true)]
+ public int ColumnWidth {
+ get { return column_width; }
+ set {
+ if (value < 0)
+ throw new ArgumentException ("A value less than zero is assigned to the property.");
+
+ column_width = value;
+
+ if (value == 0)
+ ColumnWidthInternal = 120;
+ else
+ ColumnWidthInternal = value;
+
+ base.Refresh ();
+ }
+ }
+
+ protected override CreateParams CreateParams {
+ get { return base.CreateParams;}
+ }
+
+ protected override Size DefaultSize {
+ get { return new Size (120, 96); }
+ }
+
+ [RefreshProperties(RefreshProperties.Repaint)]
+ [DefaultValue (DrawMode.Normal)]
+ public virtual DrawMode DrawMode {
+ get { return draw_mode; }
+
+ set {
+ if (!Enum.IsDefined (typeof (DrawMode), value))
+ throw new InvalidEnumArgumentException (string.Format("Enum argument value '{0}' is not valid for DrawMode", value));
+
+ if (value == DrawMode.OwnerDrawVariable && multicolumn == true)
+ throw new ArgumentException ("Cannot have variable height and multicolumn");
+
+ if (draw_mode == value)
+ return;
+
+ draw_mode = value;
+ base.Refresh ();
+ }
+ }
+
+ public override Color ForeColor {
+ get { return base.ForeColor; }
+ set {
+
+ if (base.ForeColor == value)
+ return;
+
+ base.ForeColor = value;
+ base.Refresh ();
+ }
+ }
+
+ [DefaultValue (0)]
+ [Localizable (true)]
+ public int HorizontalExtent {
+ get { return horizontal_extent; }
+ set {
+ if (horizontal_extent == value)
+ return;
+
+ horizontal_extent = value;
+ base.Refresh ();
+ }
+ }
+
+ [DefaultValue (false)]
+ [Localizable (true)]
+ public bool HorizontalScrollbar {
+ get { return horizontal_scrollbar; }
+ set {
+ if (horizontal_scrollbar == value)
+ return;
+
+ horizontal_scrollbar = value;
+ UpdateShowHorizontalScrollBar ();
+ base.Refresh ();
+ }
+ }
+
+ [DefaultValue (true)]
+ [Localizable (true)]
+ [RefreshProperties(RefreshProperties.Repaint)]
+ public bool IntegralHeight {
+ get { return integral_height; }
+ set {
+ if (integral_height == value)
+ return;
+
+ integral_height = value;
+ CalcClientArea ();
+ }
+ }
+
+ [DefaultValue (13)]
+ [Localizable (true)]
+ [RefreshProperties(RefreshProperties.Repaint)]
+ public virtual int ItemHeight {
+ get {
+ if (draw_mode == DrawMode.Normal)
+ return FontHeight;
+ return listbox_info.item_height;
+ }
+ set {
+ if (value > 255)
+ throw new ArgumentOutOfRangeException ("The ItemHeight property was set beyond 255 pixels");
+
+ if (listbox_info.item_height == value)
+ return;
+
+ listbox_info.item_height = value;
+ use_item_height = true;
+ CalcClientArea ();
+ }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [Localizable (true)]
+ [Editor ("System.Windows.Forms.Design.ListControlStringCollectionEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
+ public ObjectCollection Items {
+ get { return items; }
+ }
+
+ [DefaultValue (false)]
+ public bool MultiColumn {
+ get { return multicolumn; }
+ set {
+ if (multicolumn == value)
+ return;
+
+ if (value == true && DrawMode == DrawMode.OwnerDrawVariable)
+ throw new ArgumentException ("A multicolumn ListBox cannot have a variable-sized height.");
+
+ multicolumn = value;
+
+ if (IsHandleCreated) {
+ RellocateScrollBars ();
+ CalcClientArea ();
+ UpdateItemInfo (UpdateOperation.AllItems, 0, 0);
+ }
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ public int PreferredHeight {
+ get {
+ int itemsHeight = 0;
+ if (draw_mode == DrawMode.Normal)
+ itemsHeight = FontHeight * items.Count;
+ else if (draw_mode == DrawMode.OwnerDrawFixed)
+ itemsHeight = ItemHeight * items.Count;
+ else if (draw_mode == DrawMode.OwnerDrawVariable) {
+ for (int i = 0; i < items.Count; i++)
+ itemsHeight += items.GetListBoxItem (i).ItemHeight;
+ }
+
+ return itemsHeight;
+ }
+ }
+
+ public override RightToLeft RightToLeft {
+ get { return base.RightToLeft; }
+ set {
+ base.RightToLeft = value;
+ base.Refresh ();
+ }
+ }
+
+ // Only affects the Vertical ScrollBar
+ [DefaultValue (false)]
+ [Localizable (true)]
+ public bool ScrollAlwaysVisible {
+ get { return scroll_always_visible; }
+ set {
+ if (scroll_always_visible == value)
+ return;
+
+ scroll_always_visible = value;
+ UpdateShowVerticalScrollBar ();
+ UpdateShowHorizontalScrollBar ();
+ }
+ }
+
+ [Bindable(true)]
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public override int SelectedIndex {
+ get { return selected_index;}
+ set {
+ if (value < -1 || value >= Items.Count)
+ throw new ArgumentOutOfRangeException ("Index of out range");
+
+ if (SelectionMode == SelectionMode.None)
+ throw new ArgumentException ("cannot call this method if SelectionMode is SelectionMode.None");
+
+ if (selected_index == value)
+ return;
+
+ if (SelectionMode == SelectionMode.One)
+ UnSelectItem (selected_index, true);
+
+ SelectItem (value);
+ selected_index = value;
+ focused_item = value;
+ OnSelectedIndexChanged (new EventArgs ());
+ OnSelectedValueChanged (new EventArgs ());
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public SelectedIndexCollection SelectedIndices {
+ get { return selected_indices; }
+ }
+
+ [Bindable(true)]
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public object SelectedItem {
+ get {
+ if (SelectedItems.Count > 0)
+ return SelectedItems[0];
+ else
+ return null;
+ }
+ set {
+
+ int index = Items.IndexOf (value);
+
+ if (index == -1)
+ return;
+
+ if (index != SelectedIndex) {
+ SelectedIndex = index;
+ }
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public SelectedObjectCollection SelectedItems {
+ get {return selected_items;}
+ }
+
+ [DefaultValue (SelectionMode.One)]
+ public virtual SelectionMode SelectionMode {
+ get { return selection_mode; }
+ set {
+ if (!Enum.IsDefined (typeof (SelectionMode), value))
+ throw new InvalidEnumArgumentException (string.Format("Enum argument value '{0}' is not valid for SelectionMode", value));
+
+ if (selection_mode == value)
+ return;
+
+ selection_mode = value;
+
+ if (SelectedItems.Count > 0) {
+ switch (selection_mode) {
+ case SelectionMode.None:
+ ClearSelected ();
+ break;
+ case SelectionMode.One: {
+ if (SelectedItems.Count > 1) { // All except one
+ int cnt = selected_indices.Count - 1;
+ for (int i = 0; i < cnt; i++) {
+ UnSelectItem (i, true);
+ }
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+
+ [DefaultValue (false)]
+ public bool Sorted {
+ get { return sorted; }
+
+ set {
+ if (sorted == value)
+ return;
+
+ sorted = value;
+ Sort ();
+ }
+ }
+
+ [Bindable (false)]
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ public override string Text {
+ get {
+ if (SelectionMode != SelectionMode.None && SelectedIndex != -1)
+ return GetItemText (SelectedItem);
+
+ return base.Text;
+ }
+ set {
+
+ base.Text = value;
+
+ if (SelectionMode == SelectionMode.None)
+ return;
+
+ int index;
+
+ index = FindStringExact (value);
+
+ if (index == -1)
+ return;
+
+ SelectedIndex = index;
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public int TopIndex {
+ get { return LBoxInfo.top_item; }
+ set {
+ if (value == LBoxInfo.top_item)
+ return;
+
+ if (value < 0 || value >= Items.Count)
+ return;
+
+ LBoxInfo.top_item = value;
+ UpdatedTopItem ();
+ base.Refresh ();
+ }
+ }
+
+ [DefaultValue (true)]
+ public bool UseTabStops {
+ get { return use_tabstops; }
+
+ set {
+ if (use_tabstops == value)
+ return;
+
+ use_tabstops = value;
+ base.Refresh ();
+ }
+ }
+
+ #endregion Public Properties
+
+ #region Private Properties
+
+ internal ListBoxInfo LBoxInfo {
+ get { return listbox_info; }
+ }
+
+ private int ColumnWidthInternal {
+ get { return column_width_internal; }
+ set { column_width_internal = value; }
+ }
+
+ #endregion Private Properties
+
+ #region Public Methods
+ protected virtual void AddItemsCore (object[] value)
+ {
+ Items.AddRange (value);
+ }
+
+ public void BeginUpdate ()
+ {
+ suspend_ctrlupdate = true;
+ }
+
+ public void ClearSelected ()
+ {
+ foreach (int i in selected_indices) {
+ UnSelectItem (i, false);
+ }
+
+ selected_indices.ClearIndices ();
+ selected_items.ClearObjects ();
+ }
+
+ protected virtual ObjectCollection CreateItemCollection ()
+ {
+ return new ObjectCollection (this);
+ }
+
+ public void EndUpdate ()
+ {
+ suspend_ctrlupdate = false;
+ UpdateItemInfo (UpdateOperation.AllItems, 0, 0);
+ base.Refresh ();
+ }
+
+ public int FindString (String s)
+ {
+ return FindString (s, -1);
+ }
+
+ public int FindString (string s, int startIndex)
+ {
+ if (Items.Count == 0)
+ return -1; // No exception throwing if empty
+
+ if (startIndex < -1 || startIndex >= Items.Count - 1)
+ throw new ArgumentOutOfRangeException ("Index of out range");
+
+ startIndex++;
+ for (int i = startIndex; i < Items.Count; i++) {
+ if ((GetItemText (Items[i])).StartsWith (s))
+ return i;
+ }
+
+ return NoMatches;
+ }
+
+ public int FindStringExact (string s)
+ {
+ return FindStringExact (s, -1);
+ }
+
+ public int FindStringExact (string s, int startIndex)
+ {
+ if (Items.Count == 0)
+ return -1; // No exception throwing if empty
+
+ if (startIndex < -1 || startIndex >= Items.Count - 1)
+ throw new ArgumentOutOfRangeException ("Index of out range");
+
+ startIndex++;
+ for (int i = startIndex; i < Items.Count; i++) {
+ if ((GetItemText (Items[i])).Equals (s))
+ return i;
+ }
+
+ return NoMatches;
+ }
+
+ public int GetItemHeight (int index)
+ {
+ if (index < 0 || index >= Items.Count)
+ throw new ArgumentOutOfRangeException ("Index of out range");
+
+ if (DrawMode == DrawMode.OwnerDrawVariable && IsHandleCreated == true) {
+
+ if ((Items.GetListBoxItem (index)).ItemHeight != -1) {
+ return (Items.GetListBoxItem (index)).ItemHeight;
+ }
+
+ MeasureItemEventArgs args = new MeasureItemEventArgs (DeviceContext, index, ItemHeight);
+ OnMeasureItem (args);
+ (Items.GetListBoxItem (index)).ItemHeight = args.ItemHeight;
+ return args.ItemHeight;
+ }
+
+ return ItemHeight;
+ }
+
+ public Rectangle GetItemRectangle (int index)
+ {
+ if (index < 0 || index >= Items.Count)
+ throw new ArgumentOutOfRangeException ("GetItemRectangle index out of range.");
+
+ Rectangle rect = new Rectangle ();
+
+ if (MultiColumn == false) {
+
+ rect.X = 0;
+ rect.Height = GetItemHeight (index);
+ rect.Width = listbox_info.textdrawing_rect.Width;
+
+ if (DrawMode == DrawMode.OwnerDrawVariable) {
+ rect.Y = 0;
+ if (index >= listbox_info.top_item) {
+ for (int i = listbox_info.top_item; i < index; i++) {
+ rect.Y += GetItemHeight (i);
+ }
+ } else {
+ for (int i = index; i < listbox_info.top_item; i++) {
+ rect.Y -= GetItemHeight (i);
+ }
+ }
+ } else {
+ rect.Y = ItemHeight * (index - listbox_info.top_item);
+ }
+ }
+ else {
+ int which_page;
+
+ which_page = index / listbox_info.page_size;
+ rect.Y = ((index - listbox_info.top_item) % listbox_info.page_size) * ItemHeight;
+ rect.X = which_page * ColumnWidthInternal;
+ rect.Height = ItemHeight;
+ rect.Width = ColumnWidthInternal;
+ }
+
+ return rect;
+ }
+
+ public bool GetSelected (int index)
+ {
+ if (index < 0 || index >= Items.Count)
+ throw new ArgumentOutOfRangeException ("Index of out range");
+
+ return (Items.GetListBoxItem (index)).Selected;
+ }
+
+ public int IndexFromPoint (Point p)
+ {
+ return IndexFromPoint (p.X, p.Y);
+ }
+
+ // Only returns visible points
+ public int IndexFromPoint (int x, int y)
+ {
+
+ if (Items.Count == 0) {
+ return -1;
+ }
+
+ for (int i = LBoxInfo.top_item; i <= LBoxInfo.last_item; i++) {
+ if (GetItemRectangle (i).Contains (x,y) == true)
+ return i;
+ }
+
+ return -1;
+ }
+
+ protected override void OnChangeUICues (UICuesEventArgs e)
+ {
+ base.OnChangeUICues (e);
+ }
+
+ protected override void OnDataSourceChanged (EventArgs e)
+ {
+ base.OnDataSourceChanged (e);
+ BindDataItems (items);
+
+ if (DataSource == null || DataManager == null) {
+ SelectedIndex = -1;
+ }
+ else {
+ SelectedIndex = DataManager.Position;
+ }
+ }
+
+ protected override void OnDisplayMemberChanged (EventArgs e)
+ {
+ base.OnDisplayMemberChanged (e);
+
+ if (DataManager == null || !IsHandleCreated)
+ return;
+
+ BindDataItems (items);
+ base.Refresh ();
+ }
+
+ protected virtual void OnDrawItem (DrawItemEventArgs e)
+ {
+
+ if (DrawItem != null && (DrawMode == DrawMode.OwnerDrawFixed || DrawMode == DrawMode.OwnerDrawVariable)) {
+ DrawItem (this, e);
+ return;
+ }
+
+ ThemeEngine.Current.DrawListBoxItem (this, e);
+ }
+
+ protected override void OnFontChanged (EventArgs e)
+ {
+ base.OnFontChanged (e);
+ if (!use_item_height) {
+ listbox_info.item_height = FontHeight;
+ RellocateScrollBars ();
+ CalcClientArea ();
+ UpdateItemInfo (UpdateOperation.AllItems, 0, 0);
+ } else {
+ base.Refresh ();
+ }
+ }
+
+ protected override void OnHandleCreated (EventArgs e)
+ {
+ base.OnHandleCreated (e);
+
+ UpdateInternalClientRect (ClientRectangle);
+ SuspendLayout ();
+ Controls.AddImplicit (vscrollbar_ctrl);
+ Controls.AddImplicit (hscrollbar_ctrl);
+ ResumeLayout ();
+ UpdateItemInfo (UpdateOperation.AllItems, 0, 0);
+ }
+
+ protected override void OnHandleDestroyed (EventArgs e)
+ {
+ base.OnHandleDestroyed (e);
+ }
+
+ protected virtual void OnMeasureItem (MeasureItemEventArgs e)
+ {
+ if (draw_mode != DrawMode.OwnerDrawVariable)
+ return;
+
+ if (MeasureItem != null)
+ MeasureItem (this, e);
+ }
+
+ protected override void OnParentChanged (EventArgs e)
+ {
+ base.OnParentChanged (e);
+ }
+
+ protected override void OnResize (EventArgs e)
+ {
+ base.OnResize (e);
+ UpdateInternalClientRect (ClientRectangle);
+ }
+
+ protected override void OnSelectedIndexChanged (EventArgs e)
+ {
+ base.OnSelectedIndexChanged (e);
+
+ if (SelectedIndexChanged != null)
+ SelectedIndexChanged (this, e);
+ }
+
+ protected override void OnSelectedValueChanged (EventArgs e)
+ {
+ base.OnSelectedValueChanged (e);
+ }
+
+ public override void Refresh ()
+ {
+ if (draw_mode == DrawMode.OwnerDrawVariable) {
+ for (int i = 0; i < Items.Count; i++) {
+ (Items.GetListBoxItem (i)).ItemHeight = -1;
+ }
+ }
+
+ base.Refresh ();
+ }
+
+ protected override void RefreshItem (int index)
+ {
+ if (index < 0 || index >= Items.Count)
+ throw new ArgumentOutOfRangeException ("Index of out range");
+
+ if (draw_mode == DrawMode.OwnerDrawVariable) {
+ (Items.GetListBoxItem (index)).ItemHeight = -1;
+ }
+ }
+
+ protected override void SetBoundsCore (int x, int y, int width, int height, BoundsSpecified specified)
+ {
+ base.SetBoundsCore (x, y, width, height, specified);
+ }
+
+ protected override void SetItemCore (int index, object value)
+ {
+ if (index < 0 || index >= Items.Count)
+ return;
+
+ Items[index] = value;
+ }
+
+ protected override void SetItemsCore (IList value)
+ {
+ BeginUpdate ();
+ try {
+ Items.Clear ();
+ Items.AddRange (value);
+ } finally {
+ EndUpdate ();
+ }
+ }
+
+ public void SetSelected (int index, bool value)
+ {
+ if (index < 0 || index >= Items.Count)
+ throw new ArgumentOutOfRangeException ("Index of out range");
+
+ if (SelectionMode == SelectionMode.None)
+ throw new InvalidOperationException ();
+
+ if (value)
+ SelectItem (index);
+ else
+ UnSelectItem (index, true);
+ }
+
+ protected virtual void Sort ()
+ {
+ if (Items.Count == 0)
+ return;
+
+ Items.Sort ();
+ base.Refresh ();
+ }
+
+ public override string ToString ()
+ {
+ return base.ToString () + ", Items Count: " + Items.Count;
+ }
+
+ protected virtual void WmReflectCommand (ref Message m)
+ {
+
+ }
+
+ protected override void WndProc (ref Message m)
+ {
+ switch ((Msg) m.Msg) {
+
+ case Msg.WM_PAINT: {
+ PaintEventArgs paint_event;
+ paint_event = XplatUI.PaintEventStart (Handle, true);
+ OnPaintLB (paint_event);
+ XplatUI.PaintEventEnd (Handle, true);
+ return;
+ }
+
+ case Msg.WM_ERASEBKGND:
+ m.Result = (IntPtr) 1;
+ return;
+
+ default:
+ break;
+ }
+
+ base.WndProc (ref m);
+ }
+
+ #endregion Public Methods
+
+ #region Private Methods
+
+ internal void CalcClientArea ()
+ {
+ listbox_info.textdrawing_rect = listbox_info.client_rect;
+
+ if (listbox_info.show_verticalsb)
+ listbox_info.textdrawing_rect.Width -= vscrollbar_ctrl.Width;
+
+ if (listbox_info.show_horizontalsb)
+ listbox_info.textdrawing_rect.Height -= hscrollbar_ctrl.Height;
+
+ if (DrawMode == DrawMode.OwnerDrawVariable) {
+ int height = 0;
+
+ listbox_info.page_size = 0;
+ for (int i = 0; i < Items.Count; i++) {
+ height += GetItemHeight (i);
+ if (height > listbox_info.textdrawing_rect.Height)
+ break;
+
+ listbox_info.page_size++;
+ }
+
+ } else {
+ listbox_info.page_size = listbox_info.textdrawing_rect.Height / ItemHeight;
+ }
+
+ if (listbox_info.page_size == 0) {
+ listbox_info.page_size = 1;
+ }
+
+ /* Adjust size to visible the maximum number of displayable items */
+ if (IntegralHeight == true) {
+
+ // From MS Docs: The integral height is based on the height of the ListBox, rather than
+ // the client area height. As a result, when the IntegralHeight property is set true,
+ // items can still be partially shown if scroll bars are displayed.
+
+ int remaining = listbox_info.client_rect.Height % listbox_info.item_height;
+
+ if (remaining > 0) {
+ listbox_info.client_rect.Height -= remaining;
+ CalcClientArea ();
+ RellocateScrollBars ();
+ base.Refresh ();
+ }
+ }
+ }
+
+ internal void Draw (Rectangle clip, Graphics dc)
+ {
+ // IntegralHeight has effect, we also have to paint the unused area
+ if (IntegralHeight) {
+ if (ClientRectangle.Height > listbox_info.client_rect.Height) {
+ Region area = new Region (ClientRectangle);
+ area.Exclude (LBoxInfo.textdrawing_rect);
+
+ if (listbox_info.show_horizontalsb) {
+ area.Exclude (new Rectangle (hscrollbar_ctrl.Location.X, hscrollbar_ctrl.Location.Y,
+ hscrollbar_ctrl.Width, hscrollbar_ctrl.Height));
+ }
+
+ dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (BackColor),
+ area.GetBounds (dc));
+
+ area.Dispose ();
+ }
+ }
+
+ dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (BackColor),
+ LBoxInfo.textdrawing_rect);
+
+ if (Items.Count > 0) {
+ Rectangle item_rect;
+ DrawItemState state = DrawItemState.None;
+
+ for (int i = LBoxInfo.top_item; i <= LBoxInfo.last_item; i++) {
+ item_rect = GetItemDisplayRectangle (i, LBoxInfo.top_item);
+
+ if (clip.IntersectsWith (item_rect) == false)
+ continue;
+
+ /* Draw item */
+ state = DrawItemState.None;
+
+ if ((Items.GetListBoxItem (i)).Selected) {
+ state |= DrawItemState.Selected;
+ }
+
+ if (has_focus == true && focused_item == i)
+ state |= DrawItemState.Focus;
+
+ if (MultiColumn == false && hscrollbar_ctrl != null && hscrollbar_ctrl.Visible) {
+ item_rect.X -= hscrollbar_ctrl.Value;
+ item_rect.Width += hscrollbar_ctrl.Value;
+ }
+
+ OnDrawItem (new DrawItemEventArgs (dc, Font, item_rect,
+ i, state, ForeColor, BackColor));
+ }
+ }
+
+ }
+
+ // Converts a GetItemRectangle to a one that we can display
+ internal Rectangle GetItemDisplayRectangle (int index, int first_displayble)
+ {
+ Rectangle item_rect;
+ Rectangle first_item_rect = GetItemRectangle (first_displayble);
+ item_rect = GetItemRectangle (index);
+ item_rect.X -= first_item_rect.X;
+ item_rect.Y -= first_item_rect.Y;
+
+ return item_rect;
+ }
+
+ // Value Changed
+ private void HorizontalScrollEvent (object sender, EventArgs e)
+ {
+ if (!multicolumn) {
+ base.Refresh ();
+ return;
+ }
+
+ int top_item = LBoxInfo.top_item;
+ int last_item = LBoxInfo.last_item;
+
+ LBoxInfo.top_item = listbox_info.page_size * hscrollbar_ctrl.Value;
+ LBoxInfo.last_item = LastVisibleItem ();
+
+ if (top_item != LBoxInfo.top_item || last_item != LBoxInfo.last_item)
+ base.Refresh ();
+ }
+
+ // Only returns visible points. The diference of with IndexFromPoint is that the rectangle
+ // has screen coordinates
+ internal int IndexFromPointDisplayRectangle (int x, int y)
+ {
+ if (Items.Count == 0)
+ return -1;
+
+ for (int i = LBoxInfo.top_item; i <= LBoxInfo.last_item; i++) {
+ if (GetItemDisplayRectangle (i, LBoxInfo.top_item).Contains (x, y) == true)
+ return i;
+ }
+
+ return -1;
+ }
+
+ private int LastVisibleItem ()
+ {
+ Rectangle item_rect;
+ int top_y = LBoxInfo.textdrawing_rect.Y + LBoxInfo.textdrawing_rect.Height;
+ int i = 0;
+
+ if (LBoxInfo.top_item >= Items.Count)
+ return LBoxInfo.top_item;
+
+ for (i = LBoxInfo.top_item; i < Items.Count; i++) {
+
+ item_rect = GetItemDisplayRectangle (i, LBoxInfo.top_item);
+ if (MultiColumn) {
+
+ if (item_rect.X > LBoxInfo.textdrawing_rect.Width)
+ return i - 1;
+ }
+ else {
+ if (item_rect.Y + item_rect.Height > top_y) {
+ return i;
+ }
+ }
+ }
+ return i - 1;
+ }
+
+ private void UpdatedTopItem ()
+ {
+ if (multicolumn) {
+ int col = LBoxInfo.top_item / LBoxInfo.page_size;
+
+ if (col > hscrollbar_ctrl.Maximum)
+ hscrollbar_ctrl.Value = hscrollbar_ctrl.Maximum;
+ else
+ hscrollbar_ctrl.Value = col;
+ }
+ else {
+ if (LBoxInfo.top_item > vscrollbar_ctrl.Maximum)
+ vscrollbar_ctrl.Value = vscrollbar_ctrl.Maximum;
+ else
+ vscrollbar_ctrl.Value = LBoxInfo.top_item;
+ }
+ }
+
+ // Navigates to the indicated item and returns the new item
+ private int NavigateItemVisually (ItemNavigation navigation)
+ {
+ int page_size, columns, selected_index = -1;
+
+ if (multicolumn) {
+ columns = LBoxInfo.textdrawing_rect.Width / ColumnWidthInternal;
+ page_size = columns * LBoxInfo.page_size;
+ if (page_size == 0) {
+ page_size = LBoxInfo.page_size;
+ }
+ } else {
+ page_size = LBoxInfo.page_size;
+ }
+
+ switch (navigation) {
+
+ case ItemNavigation.PreviousColumn: {
+ if (focused_item - LBoxInfo.page_size < 0) {
+ return -1;
+ }
+
+ if (focused_item - LBoxInfo.page_size < LBoxInfo.top_item) {
+ LBoxInfo.top_item = focused_item - LBoxInfo.page_size;
+ UpdatedTopItem ();
+ }
+
+ selected_index = focused_item - LBoxInfo.page_size;
+ break;
+ }
+
+ case ItemNavigation.NextColumn: {
+ if (focused_item + LBoxInfo.page_size >= Items.Count) {
+ break;
+ }
+
+ if (focused_item + LBoxInfo.page_size > LBoxInfo.last_item) {
+ LBoxInfo.top_item = focused_item;
+ UpdatedTopItem ();
+ }
+
+ selected_index = focused_item + LBoxInfo.page_size;
+ break;
+ }
+
+ case ItemNavigation.First: {
+ LBoxInfo.top_item = 0;
+ selected_index = 0;
+ UpdatedTopItem ();
+ break;
+ }
+
+ case ItemNavigation.Last: {
+
+ if (Items.Count < LBoxInfo.page_size) {
+ LBoxInfo.top_item = 0;
+ selected_index = Items.Count - 1;
+ UpdatedTopItem ();
+ } else {
+ LBoxInfo.top_item = Items.Count - LBoxInfo.page_size;
+ selected_index = Items.Count - 1;
+ UpdatedTopItem ();
+ }
+ break;
+ }
+
+ case ItemNavigation.Next: {
+ if (focused_item + 1 < Items.Count) {
+ int actualHeight = 0;
+ if (draw_mode == DrawMode.OwnerDrawVariable) {
+ for (int i = LBoxInfo.top_item; i <= focused_item + 1; i++)
+ actualHeight += GetItemHeight (i);
+ } else {
+ actualHeight = ((focused_item + 1) - LBoxInfo.top_item + 1) * ItemHeight;
+ }
+ if (actualHeight >= LBoxInfo.textdrawing_rect.Height) {
+ int bal = IntegralHeight ? 0 : (listbox_info.textdrawing_rect.Height == actualHeight ? 0 : 1);
+ if (focused_item + bal >= LBoxInfo.last_item) {
+ LBoxInfo.top_item++;
+ UpdatedTopItem ();
+ }
+ }
+ selected_index = focused_item + 1;
+ }
+ break;
+ }
+
+ case ItemNavigation.Previous: {
+ if (focused_item > 0) {
+ if (focused_item - 1 < LBoxInfo.top_item) {
+ LBoxInfo.top_item--;
+ UpdatedTopItem ();
+ }
+ selected_index = focused_item - 1;
+ }
+ break;
+ }
+
+ case ItemNavigation.NextPage: {
+ if (Items.Count < page_size) {
+ NavigateItemVisually (ItemNavigation.Last);
+ break;
+ }
+
+ if (focused_item + page_size - 1 >= Items.Count) {
+ LBoxInfo.top_item = Items.Count - page_size;
+ UpdatedTopItem ();
+ selected_index = Items.Count - 1;
+ }
+ else {
+ if (focused_item + page_size - 1 > LBoxInfo.last_item) {
+ LBoxInfo.top_item = focused_item;
+ UpdatedTopItem ();
+ }
+
+ selected_index = focused_item + page_size - 1;
+ }
+
+ break;
+ }
+
+ case ItemNavigation.PreviousPage: {
+
+ if (focused_item - (LBoxInfo.page_size - 1) <= 0) {
+
+ LBoxInfo.top_item = 0;
+ UpdatedTopItem ();
+ SelectedIndex = 0;
+ }
+ else {
+ if (focused_item - (LBoxInfo.page_size - 1) < LBoxInfo.top_item) {
+ LBoxInfo.top_item = focused_item - (LBoxInfo.page_size - 1);
+ UpdatedTopItem ();
+ }
+
+ selected_index = focused_item - (LBoxInfo.page_size - 1);
+ }
+
+ break;
+ }
+ default:
+ break;
+ }
+
+ return selected_index;
+ }
+
+
+ private void OnGotFocus (object sender, EventArgs e)
+ {
+ has_focus = true;
+
+ if (focused_item != -1) {
+ Rectangle invalidate = GetItemDisplayRectangle (focused_item, LBoxInfo.top_item);
+ Invalidate (invalidate);
+ }
+ }
+
+ private void OnLostFocus (object sender, EventArgs e)
+ {
+ has_focus = false;
+
+ if (focused_item != -1) {
+ Rectangle invalidate = GetItemDisplayRectangle (focused_item, LBoxInfo.top_item);
+ Invalidate (invalidate);
+ }
+ }
+
+ private void OnKeyDownLB (object sender, KeyEventArgs e)
+ {
+ int new_item = -1;
+
+ if (Items.Count == 0)
+ return;
+
+ switch (e.KeyCode) {
+
+ case Keys.ControlKey:
+ ctrl_pressed = true;
+ break;
+
+ case Keys.ShiftKey:
+ shift_pressed = true;
+ break;
+
+ case Keys.Home:
+ new_item = NavigateItemVisually (ItemNavigation.First);
+ break;
+
+ case Keys.End:
+ new_item = NavigateItemVisually (ItemNavigation.Last);
+ break;
+
+ case Keys.Up:
+ new_item = NavigateItemVisually (ItemNavigation.Previous);
+ break;
+
+ case Keys.Down:
+ new_item = NavigateItemVisually (ItemNavigation.Next);
+ break;
+
+ case Keys.PageUp:
+ new_item = NavigateItemVisually (ItemNavigation.PreviousPage);
+ break;
+
+ case Keys.PageDown:
+ new_item = NavigateItemVisually (ItemNavigation.NextPage);
+ break;
+
+ case Keys.Right:
+ if (multicolumn == true) {
+ new_item = NavigateItemVisually (ItemNavigation.NextColumn);
+ }
+ break;
+
+ case Keys.Left:
+ if (multicolumn == true) {
+ new_item = NavigateItemVisually (ItemNavigation.PreviousColumn);
+ }
+ break;
+
+ case Keys.Space:
+ if (selection_mode == SelectionMode.MultiSimple) {
+ SelectedItemFromNavigation (focused_item);
+ }
+ break;
+
+
+ default:
+ break;
+ }
+
+ if (new_item != -1) {
+ SetFocusedItem (new_item);
+ }
+
+ if (new_item != -1) {
+ if (selection_mode != SelectionMode.MultiSimple && selection_mode != SelectionMode.None) {
+ SelectedItemFromNavigation (new_item);
+ }
+ }
+ }
+
+ private void OnKeyUpLB (object sender, KeyEventArgs e)
+ {
+ switch (e.KeyCode) {
+ case Keys.ControlKey:
+ ctrl_pressed = false;
+ break;
+ case Keys.ShiftKey:
+ shift_pressed = false;
+ break;
+ default:
+ break;
+ }
+ }
+
+ internal virtual void OnMouseDownLB (object sender, MouseEventArgs e)
+ {
+ if (Click != null) {
+ if (e.Button == MouseButtons.Left) {
+ Click (this, e);
+ }
+ }
+
+ int index = IndexFromPointDisplayRectangle (e.X, e.Y);
+
+ if (index != -1) {
+ SelectedItemFromNavigation (index);
+ SetFocusedItem (index);
+ }
+ }
+
+ private void OnPaintLB (PaintEventArgs pevent)
+ {
+ if (Paint != null)
+ Paint (this, pevent);
+
+ if (suspend_ctrlupdate == true)
+ return;
+
+ Draw (pevent.ClipRectangle, pevent.Graphics);
+ }
+
+ internal void RellocateScrollBars ()
+ {
+ if (listbox_info.show_verticalsb) {
+ vscrollbar_ctrl.Size = new Size (vscrollbar_ctrl.Width, ClientRectangle.Height);
+ vscrollbar_ctrl.Location = new Point (ClientRectangle.Width - vscrollbar_ctrl.Width, 0);
+ }
+
+ if (listbox_info.show_horizontalsb) {
+ int width = listbox_info.client_rect.Width;
+
+ if (listbox_info.show_verticalsb)
+ width -= vscrollbar_ctrl.Width;
+
+ hscrollbar_ctrl.Size = new Size (width, hscrollbar_ctrl.Height);
+ hscrollbar_ctrl.Location = new Point (0, ClientRectangle.Height - hscrollbar_ctrl.Height);
+ }
+
+ CalcClientArea ();
+ }
+
+ // Add an item in the Selection array and marks it visually as selected
+ private void SelectItem (int index)
+ {
+ if (index == -1)
+ return;
+
+ Rectangle invalidate = GetItemDisplayRectangle (index, LBoxInfo.top_item);
+ (Items.GetListBoxItem (index)).Selected = true;
+ selected_indices.AddIndex (index);
+ selected_items.AddObject (Items[index]);
+
+ if (ClientRectangle.IntersectsWith (invalidate))
+ Invalidate (invalidate);
+
+ }
+
+ // An item navigation operation (mouse or keyboard) has caused to select a new item
+ internal void SelectedItemFromNavigation (int index)
+ {
+ switch (SelectionMode) {
+ case SelectionMode.None: // Do nothing
+ break;
+ case SelectionMode.One: {
+ SelectedIndex = index;
+ break;
+ }
+ case SelectionMode.MultiSimple: {
+ if (selected_index == -1) {
+ SelectedIndex = index;
+ } else {
+
+ if ((Items.GetListBoxItem (index)).Selected) // BUG: index or selected_index?
+ UnSelectItem (index, true);
+ else {
+ SelectItem (index);
+ OnSelectedIndexChanged (new EventArgs ());
+ OnSelectedValueChanged (new EventArgs ());
+ }
+ }
+ break;
+ }
+
+ case SelectionMode.MultiExtended: {
+ if (selected_index == -1) {
+ SelectedIndex = index;
+ } else {
+
+ if (ctrl_pressed == false && shift_pressed == false) {
+ ClearSelected ();
+ }
+
+ if (shift_pressed == true) {
+ ShiftSelection (index);
+ } else { // ctrl_pressed or single item
+ SelectItem (index);
+ }
+
+ OnSelectedIndexChanged (new EventArgs ());
+ OnSelectedValueChanged (new EventArgs ());
+ }
+ break;
+ }
+
+ default:
+ break;
+ }
+ }
+
+ private void ShiftSelection (int index)
+ {
+ int shorter_item = -1, dist = Items.Count + 1, cur_dist;
+
+ foreach (int idx in selected_indices) {
+ if (idx > index) {
+ cur_dist = idx - index;
+ }
+ else {
+ cur_dist = index - idx;
+ }
+
+ if (cur_dist < dist) {
+ dist = cur_dist;
+ shorter_item = idx;
+ }
+ }
+
+ if (shorter_item != -1) {
+ int start, end;
+
+ if (shorter_item > index) {
+ start = index;
+ end = shorter_item;
+ } else {
+ start = shorter_item;
+ end = index;
+ }
+
+ ClearSelected ();
+ for (int idx = start; idx <= end; idx++) {
+ SelectItem (idx);
+ }
+ }
+ }
+
+ internal void SetFocusedItem (int index)
+ {
+ Rectangle invalidate;
+ int prev = focused_item;
+
+ focused_item = index;
+
+ if (has_focus == false)
+ return;
+
+ if (prev != -1) { // Invalidates previous item
+ invalidate = GetItemDisplayRectangle (prev, LBoxInfo.top_item);
+ Invalidate (invalidate);
+ }
+
+ if (index != -1) {
+ invalidate = GetItemDisplayRectangle (index, LBoxInfo.top_item);
+ Invalidate (invalidate);
+ }
+ }
+
+ // Removes an item in the Selection array and marks it visually as unselected
+ private void UnSelectItem (int index, bool remove)
+ {
+ if (index == -1)
+ return;
+
+ Rectangle invalidate = GetItemDisplayRectangle (index, LBoxInfo.top_item);
+ (Items.GetListBoxItem (index)).Selected = false;
+
+ if (remove) {
+ selected_indices.RemoveIndex (index);
+ selected_items.RemoveObject (Items[index]);
+ }
+
+ if (ClientRectangle.IntersectsWith (invalidate))
+ Invalidate (invalidate);
+ }
+
+ internal StringFormat GetFormatString ()
+ {
+ StringFormat string_format = new StringFormat ();
+
+ if (RightToLeft == RightToLeft.Yes)
+ string_format.Alignment = StringAlignment.Far;
+ else
+ string_format.Alignment = StringAlignment.Near;
+
+ if (UseTabStops)
+ string_format.SetTabStops (0, new float [] {(float)(Font.Height * 3.7)});
+
+ return string_format;
+ }
+
+ // Updates the scrollbar's position with the new items and inside area
+ internal virtual void UpdateItemInfo (UpdateOperation operation, int first, int last)
+ {
+ if (!IsHandleCreated || suspend_ctrlupdate == true)
+ return;
+
+ UpdateShowVerticalScrollBar ();
+
+ if (listbox_info.show_verticalsb && Items.Count > listbox_info.page_size)
+ if (vscrollbar_ctrl.Enabled)
+ vscrollbar_ctrl.Maximum = Items.Count - listbox_info.page_size;
+
+ if (listbox_info.show_horizontalsb) {
+ if (MultiColumn) {
+ int fullpage = (listbox_info.page_size * (listbox_info.client_rect.Width / ColumnWidthInternal));
+
+ if (hscrollbar_ctrl.Enabled && listbox_info.page_size > 0)
+ hscrollbar_ctrl.Maximum = Math.Max (0, 1 + ((Items.Count - fullpage) / listbox_info.page_size));
+ }
+ }
+
+ if (MultiColumn == false) {
+ /* Calc the longest items for non multicolumn listboxes */
+ if (operation == UpdateOperation.AllItems || operation == UpdateOperation.DeleteItems) {
+
+ SizeF size;
+ for (int i = 0; i < Items.Count; i++) {
+ size = DeviceContext.MeasureString (GetItemText (Items[i]), Font);
+
+ if ((int) size.Width > listbox_info.max_itemwidth)
+ listbox_info.max_itemwidth = (int) size.Width;
+ }
+ }
+ else {
+ if (operation == UpdateOperation.AddItems) {
+
+ SizeF size;
+ for (int i = first; i < last + 1; i++) {
+ size = DeviceContext.MeasureString (GetItemText (Items[i]), Font);
+
+ if ((int) size.Width > listbox_info.max_itemwidth)
+ listbox_info.max_itemwidth = (int) size.Width;
+ }
+ }
+ }
+ }
+
+ if (sorted)
+ Sort ();
+
+ if (Items.Count == 0) {
+ selected_index = -1;
+ focused_item = -1;
+ }
+
+ SelectedItems.ReCreate ();
+ SelectedIndices.ReCreate ();
+ UpdateShowHorizontalScrollBar ();
+ LBoxInfo.last_item = LastVisibleItem ();
+ base.Refresh ();
+ }
+
+ private void UpdateInternalClientRect (Rectangle client_rectangle)
+ {
+ listbox_info.client_rect = client_rectangle;
+ UpdateShowHorizontalScrollBar ();
+ UpdateShowVerticalScrollBar ();
+ RellocateScrollBars ();
+ UpdateItemInfo (UpdateOperation.AllItems, 0, 0);
+ }
+
+ /* Determines if the horizontal scrollbar has to be displyed */
+ private void UpdateShowHorizontalScrollBar ()
+ {
+ bool show = false;
+ bool enabled = true;
+
+ if (MultiColumn) { /* Horizontal scrollbar is always shown in Multicolum mode */
+
+ /* Is it really need it */
+ int page_size = listbox_info.client_rect.Height / listbox_info.item_height;
+ int fullpage = (page_size * (listbox_info.textdrawing_rect.Height / ColumnWidthInternal));
+
+ if (Items.Count > fullpage) {
+ show = true;
+ }
+ else { /* Acording to MS Documentation ScrollAlwaysVisible only affects Horizontal scrollbars but
+ this is not true for MultiColumn listboxes */
+ if (ScrollAlwaysVisible == true) {
+ enabled = false;
+ show = true;
+ }
+ }
+
+ } else { /* If large item*/
+
+ if (listbox_info.max_itemwidth > listbox_info.client_rect.Width && HorizontalScrollbar) {
+ show = true;
+ hscrollbar_ctrl.Maximum = listbox_info.max_itemwidth;
+ hscrollbar_ctrl.LargeChange = listbox_info.textdrawing_rect.Width;
+ }
+ }
+
+ if (hscrollbar_ctrl.Enabled != enabled)
+ hscrollbar_ctrl.Enabled = enabled;
+
+ if (listbox_info.show_horizontalsb == show)
+ return;
+
+ listbox_info.show_horizontalsb = show;
+ hscrollbar_ctrl.Visible = show;
+
+ if (show == true) {
+ RellocateScrollBars ();
+ }
+
+ CalcClientArea ();
+ }
+
+ /* Determines if the vertical scrollbar has to be displyed */
+ private void UpdateShowVerticalScrollBar ()
+ {
+ bool show = false;
+ bool enabled = true;
+
+ if (!MultiColumn) { /* Vertical scrollbar is never shown in Multicolum mode */
+ if (Items.Count > listbox_info.page_size) {
+ show = true;
+ }
+ else
+ if (ScrollAlwaysVisible) {
+ show = true;
+ enabled = false;
+ }
+ }
+
+ if (vscrollbar_ctrl.Enabled != enabled)
+ vscrollbar_ctrl.Enabled = enabled;
+
+ if (listbox_info.show_verticalsb == show)
+ return;
+
+ listbox_info.show_verticalsb = show;
+ vscrollbar_ctrl.Visible = show;
+
+ if (show == true) {
+ if (vscrollbar_ctrl.Enabled)
+ vscrollbar_ctrl.Maximum = Items.Count - listbox_info.page_size;
+
+ RellocateScrollBars ();
+ } else if (vscrollbar_ctrl.Maximum > 0) {
+ vscrollbar_ctrl.Maximum = 0;
+ }
+
+ CalcClientArea ();
+ }
+
+ // Value Changed
+ private void VerticalScrollEvent (object sender, EventArgs e)
+ {
+ int top_item = LBoxInfo.top_item;
+ int last_item = LBoxInfo.last_item;
+
+ LBoxInfo.top_item = /*listbox_info.page_size + */ vscrollbar_ctrl.Value;
+ LBoxInfo.last_item = LastVisibleItem ();
+
+ if (top_item != LBoxInfo.top_item || last_item != LBoxInfo.last_item)
+ base.Refresh ();
+ }
+
+ #endregion Private Methods
+
+ /*
+ ListBox.ObjectCollection
+ */
+ [ListBindable (false)]
+ public class ObjectCollection : IList, ICollection, IEnumerable
+ {
+ // Compare objects
+ internal class ListObjectComparer : IComparer
+ {
+ private ListBox owner;
+
+ public ListObjectComparer (ListBox owner)
+ {
+ this.owner = owner;
+ }
+
+ public int Compare (object a, object b)
+ {
+ string str1 = a.ToString ();
+ string str2 = b.ToString ();
+ return str1.CompareTo (str2);
+ }
+ }
+
+ // Compare ListItem
+ internal class ListItemComparer : IComparer
+ {
+ private ListBox owner;
+
+ public ListItemComparer (ListBox owner)
+ {
+ this.owner = owner;
+ }
+
+ public int Compare (object a, object b)
+ {
+ int index1 = ((ListBox.ListBoxItem) (a)).Index;
+ int index2 = ((ListBox.ListBoxItem) (b)).Index;
+ string str1 = owner.GetItemText (owner.Items[index1]);
+ string str2 = owner.GetItemText (owner.Items[index2]);
+ return str1.CompareTo (str2);
+ }
+ }
+
+ private ListBox owner;
+ internal ArrayList object_items = new ArrayList ();
+ internal ArrayList listbox_items = new ArrayList ();
+
+ public ObjectCollection (ListBox owner)
+ {
+ this.owner = owner;
+ }
+
+ public ObjectCollection (ListBox owner, object[] obj)
+ {
+ this.owner = owner;
+ AddRange (obj);
+ }
+
+ public ObjectCollection (ListBox owner, ObjectCollection obj)
+ {
+ this.owner = owner;
+ AddRange (obj);
+ }
+
+ #region Public Properties
+ public virtual int Count {
+ get { return object_items.Count; }
+ }
+
+ public virtual bool IsReadOnly {
+ get { return false; }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public virtual object this [int index] {
+ get {
+ if (index < 0 || index >= Count)
+ throw new ArgumentOutOfRangeException ("Index of out range");
+
+ return object_items[index];
+ }
+ set {
+ if (index < 0 || index >= Count)
+ throw new ArgumentOutOfRangeException ("Index of out range");
+
+ object_items[index] = value;
+ }
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return false; }
+ }
+
+ object ICollection.SyncRoot {
+ get { return this; }
+ }
+
+ bool IList.IsFixedSize {
+ get { return false; }
+ }
+
+ #endregion Public Properties
+
+ #region Private Properties
+ internal ArrayList ObjectItems {
+ get { return object_items;}
+ set {
+ object_items = value;
+ }
+ }
+
+ internal ArrayList ListBoxItems {
+ get { return listbox_items;}
+ set {
+ listbox_items = value;
+ }
+ }
+ #endregion Private Properties
+
+ #region Public Methods
+ public int Add (object item)
+ {
+ int idx;
+
+ idx = AddItem (item);
+ owner.UpdateItemInfo (UpdateOperation.AddItems, idx, idx);
+ return idx;
+ }
+
+ public void AddRange (object[] items)
+ {
+ int cnt = Count;
+
+ foreach (object mi in items)
+ AddItem (mi);
+
+ owner.UpdateItemInfo (UpdateOperation.AddItems, cnt, Count - 1);
+ }
+
+ public void AddRange (ObjectCollection col)
+ {
+ int cnt = Count;
+
+ foreach (object mi in col)
+ AddItem (mi);
+
+ owner.UpdateItemInfo (UpdateOperation.AddItems, cnt, Count - 1);
+ }
+
+ internal void AddRange (IList list)
+ {
+ int cnt = Count;
+
+ foreach (object mi in list)
+ AddItem (mi);
+
+ owner.UpdateItemInfo (UpdateOperation.AddItems, cnt, Count - 1);
+ }
+
+ public virtual void Clear ()
+ {
+ owner.selected_index = -1;
+ owner.focused_item = -1;
+ object_items.Clear ();
+ listbox_items.Clear ();
+ owner.UpdateItemInfo (UpdateOperation.AllItems, 0, 0);
+ }
+ public virtual bool Contains (object obj)
+ {
+ return object_items.Contains (obj);
+ }
+
+ public void CopyTo (object[] dest, int arrayIndex)
+ {
+ object_items.CopyTo (dest, arrayIndex);
+ }
+
+ void ICollection.CopyTo (Array dest, int index)
+ {
+ object_items.CopyTo (dest, index);
+ }
+
+ public virtual IEnumerator GetEnumerator ()
+ {
+ return object_items.GetEnumerator ();
+ }
+
+ int IList.Add (object item)
+ {
+ return Add (item);
+ }
+
+ public virtual int IndexOf (object value)
+ {
+ return object_items.IndexOf (value);
+ }
+
+ public virtual void Insert (int index, object item)
+ {
+ if (index < 0 || index > Count)
+ throw new ArgumentOutOfRangeException ("Index of out range");
+
+ int idx;
+ ObjectCollection new_items = new ObjectCollection (owner);
+
+ owner.BeginUpdate ();
+
+ for (int i = 0; i < index; i++) {
+ idx = new_items.AddItem (ObjectItems[i]);
+ (new_items.GetListBoxItem (idx)).CopyState (GetListBoxItem (i));
+ }
+
+ new_items.AddItem (item);
+
+ for (int i = index; i < Count; i++){
+ idx = new_items.AddItem (ObjectItems[i]);
+ (new_items.GetListBoxItem (idx)).CopyState (GetListBoxItem (i));
+ }
+
+ ObjectItems = new_items.ObjectItems;
+ ListBoxItems = new_items.ListBoxItems;
+
+ owner.EndUpdate (); // Calls UpdateItemInfo
+ }
+
+ public virtual void Remove (object value)
+ {
+ RemoveAt (IndexOf (value));
+ }
+
+ public virtual void RemoveAt (int index)
+ {
+ if (index < 0 || index >= Count)
+ throw new ArgumentOutOfRangeException ("Index of out range");
+
+ object_items.RemoveAt (index);
+ listbox_items.RemoveAt (index);
+ owner.UpdateItemInfo (UpdateOperation.DeleteItems, index, index);
+ }
+ #endregion Public Methods
+
+ #region Private Methods
+ internal int AddItem (object item)
+ {
+ int cnt = object_items.Count;
+ object_items.Add (item);
+ listbox_items.Add (new ListBox.ListBoxItem (cnt));
+ return cnt;
+ }
+
+ internal ListBox.ListBoxItem GetListBoxItem (int index)
+ {
+ if (index < 0 || index >= Count)
+ throw new ArgumentOutOfRangeException ("Index of out range");
+
+ return (ListBox.ListBoxItem) listbox_items[index];
+ }
+
+ internal void SetListBoxItem (ListBox.ListBoxItem item, int index)
+ {
+ if (index < 0 || index >= Count)
+ throw new ArgumentOutOfRangeException ("Index of out range");
+
+ listbox_items[index] = item;
+ }
+
+ internal void Sort ()
+ {
+ /* Keep this order */
+ listbox_items.Sort (new ListItemComparer (owner));
+ object_items.Sort (new ListObjectComparer (owner));
+
+ for (int i = 0; i < listbox_items.Count; i++) {
+ ListBox.ListBoxItem item = GetListBoxItem (i);
+ item.Index = i;
+ }
+ }
+
+ #endregion Private Methods
+ }
+
+ /*
+ ListBox.SelectedIndexCollection
+ */
+ public class SelectedIndexCollection : IList, ICollection, IEnumerable
+ {
+ private ListBox owner;
+ private ArrayList indices = new ArrayList ();
+
+ public SelectedIndexCollection (ListBox owner)
+ {
+ this.owner = owner;
+ }
+
+ #region Public Properties
+ [Browsable (false)]
+ public virtual int Count {
+ get { return indices.Count; }
+ }
+
+ public virtual bool IsReadOnly {
+ get { return true; }
+ }
+
+ public int this [int index] {
+ get {
+ if (index < 0 || index >= Count)
+ throw new ArgumentOutOfRangeException ("Index of out range");
+
+ return (int) indices[index];
+ }
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return true; }
+ }
+
+ bool IList.IsFixedSize{
+ get { return true; }
+ }
+
+ object ICollection.SyncRoot {
+ get { return this; }
+ }
+
+ #endregion Public Properties
+
+ #region Public Methods
+ public bool Contains (int selectedIndex)
+ {
+ return indices.Contains (selectedIndex);
+ }
+
+ public virtual void CopyTo (Array dest, int index)
+ {
+ indices.CopyTo (dest, index);
+ }
+
+ public virtual IEnumerator GetEnumerator ()
+ {
+ return indices.GetEnumerator ();
+ }
+
+ int IList.Add (object obj)
+ {
+ throw new NotSupportedException ();
+ }
+
+ void IList.Clear ()
+ {
+ throw new NotSupportedException ();
+ }
+
+ bool IList.Contains (object selectedIndex)
+ {
+ return Contains ((int)selectedIndex);
+ }
+
+ int IList.IndexOf (object selectedIndex)
+ {
+ return IndexOf ((int) selectedIndex);
+ }
+
+ void IList.Insert (int index, object value)
+ {
+ throw new NotSupportedException ();
+ }
+
+ void IList.Remove (object value)
+ {
+ throw new NotSupportedException ();
+ }
+
+ void IList.RemoveAt (int index)
+ {
+ throw new NotSupportedException ();
+ }
+
+ object IList.this[int index]{
+ get {return indices[index]; }
+ set {throw new NotImplementedException (); }
+ }
+
+ public int IndexOf (int selectedIndex)
+ {
+ return indices.IndexOf (selectedIndex);
+ }
+ #endregion Public Methods
+
+ #region Private Methods
+
+ internal void AddIndex (int index)
+ {
+ indices.Add (index);
+ }
+
+ internal void ClearIndices ()
+ {
+ indices.Clear ();
+ }
+
+ internal void RemoveIndex (int index)
+ {
+ indices.Remove (index);
+ }
+
+ internal void ReCreate ()
+ {
+ indices.Clear ();
+
+ for (int i = 0; i < owner.Items.Count; i++) {
+ ListBox.ListBoxItem item = owner.Items.GetListBoxItem (i);
+
+ if (item.Selected)
+ indices.Add (item.Index);
+ }
+ }
+
+ #endregion Private Methods
+ }
+
+ /*
+ SelectedObjectCollection
+ */
+ public class SelectedObjectCollection : IList, ICollection, IEnumerable
+ {
+ private ListBox owner;
+ private ArrayList object_items = new ArrayList ();
+
+ public SelectedObjectCollection (ListBox owner)
+ {
+ this.owner = owner;
+ }
+
+ #region Public Properties
+ public virtual int Count {
+ get { return object_items.Count; }
+ }
+
+ public virtual bool IsReadOnly {
+ get { return true; }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public virtual object this [int index] {
+ get {
+ if (index < 0 || index >= Count)
+ throw new ArgumentOutOfRangeException ("Index of out range");
+
+ return object_items[index];
+ }
+ set {throw new NotSupportedException ();}
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return true; }
+ }
+
+ object ICollection.SyncRoot {
+ get { return this; }
+ }
+
+ bool IList.IsFixedSize {
+ get { return true; }
+ }
+
+ object IList.this[int index] {
+ get { return object_items[index]; }
+ set { throw new NotSupportedException (); }
+ }
+
+ #endregion Public Properties
+
+ #region Public Methods
+ public virtual bool Contains (object selectedObject)
+ {
+ return object_items.Contains (selectedObject);
+ }
+
+ public virtual void CopyTo (Array dest, int index)
+ {
+ object_items.CopyTo (dest, index);
+ }
+
+ int IList.Add (object value)
+ {
+ throw new NotSupportedException ();
+ }
+
+ void IList.Clear ()
+ {
+ throw new NotSupportedException ();
+ }
+
+ bool IList.Contains (object selectedIndex)
+ {
+ throw new NotImplementedException ();
+ }
+
+ void IList.Insert (int index, object value)
+ {
+ throw new NotSupportedException ();
+ }
+
+ void IList.Remove (object value)
+ {
+ throw new NotSupportedException ();
+ }
+
+ void IList.RemoveAt (int index)
+ {
+ throw new NotSupportedException ();
+ }
+
+ public int IndexOf (object item)
+ {
+ return object_items.IndexOf (item);
+ }
+
+ public virtual IEnumerator GetEnumerator ()
+ {
+ return object_items.GetEnumerator ();
+ }
+
+ #endregion Public Methods
+
+ #region Private Methods
+ internal void AddObject (object obj)
+ {
+ object_items.Add (obj);
+ }
+
+ internal void ClearObjects ()
+ {
+ object_items.Clear ();
+ }
+
+ internal void ReCreate ()
+ {
+ object_items.Clear ();
+
+ for (int i = 0; i < owner.Items.Count; i++) {
+ ListBox.ListBoxItem item = owner.Items.GetListBoxItem (i);
+
+ if (item.Selected)
+ object_items.Add (owner.Items[item.Index]);
+ }
+ }
+
+ internal void RemoveObject (object obj)
+ {
+ object_items.Remove (obj);
+ }
+
+ #endregion Private Methods
+
+ }
+
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListControl.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListControl.cs
new file mode 100644
index 00000000000..41b0249798b
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListControl.cs
@@ -0,0 +1,316 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+//
+
+// COMPLETE
+
+using System;
+using System.Drawing;
+using System.Collections;
+using System.ComponentModel;
+using System.Reflection;
+
+namespace System.Windows.Forms
+{
+ public abstract class ListControl : Control
+ {
+ private object data_source;
+ private BindingMemberInfo value_member;
+ private string display_member;
+ private CurrencyManager data_manager;
+
+ protected ListControl ()
+ {
+ data_source = null;
+ value_member = new BindingMemberInfo (string.Empty);
+ display_member = string.Empty;
+ data_manager = null;
+ SetStyle (ControlStyles.StandardClick | ControlStyles.UserPaint, false);
+ }
+
+ #region Events
+ public event EventHandler DataSourceChanged;
+ public event EventHandler DisplayMemberChanged;
+ public event EventHandler SelectedValueChanged;
+ public event EventHandler ValueMemberChanged;
+ #endregion // Events
+
+ #region Public Properties
+
+ [DefaultValue(null)]
+ [RefreshProperties(RefreshProperties.Repaint)]
+ [TypeConverter("System.Windows.Forms.Design.DataSourceConverter, " + Consts.AssemblySystem_Design)]
+ public object DataSource {
+ get { return data_source; }
+ set {
+ if (!(value is IList || value is IListSource)) {
+ throw new Exception ("Complex DataBinding accepts as a data source " +
+ "either an IList or an IListSource");
+ }
+
+ if (data_source == value)
+ return;
+
+ data_source = value;
+ ConnectToDataSource ();
+ OnDataSourceChanged (EventArgs.Empty);
+ }
+ }
+
+ [DefaultValue("")]
+ [Editor("System.Windows.Forms.Design.DataMemberFieldEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
+ [TypeConverter("System.Windows.Forms.Design.DataMemberFieldConverter, " + Consts.AssemblySystem_Design)]
+ public string DisplayMember {
+ get {
+ return display_member;
+ }
+ set {
+ if (display_member == value) {
+ return;
+ }
+
+ display_member = value;
+ ConnectToDataSource ();
+ OnDisplayMemberChanged (EventArgs.Empty);
+ }
+ }
+
+ public abstract int SelectedIndex {
+ get;
+ set;
+ }
+
+ [Bindable(BindableSupport.Yes)]
+ [Browsable(false)]
+ [DefaultValue(null)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public object SelectedValue {
+ get {
+ if (data_manager == null) {
+ return null;
+ }
+
+ object item = data_manager.GetItem (SelectedIndex);
+ object fil = FilterItemOnProperty (item, ValueMember);
+ return fil;
+ }
+ set {
+ if (data_manager != null) {
+
+ PropertyDescriptorCollection col = data_manager.GetItemProperties ();
+ PropertyDescriptor prop = col.Find (ValueMember, true);
+
+ for (int i = 0; i < data_manager.Count; i++) {
+ if (prop.GetValue (data_manager.GetItem (i)) == value) {
+ SelectedIndex = i;
+ return;
+ }
+ }
+
+ }
+ }
+ }
+
+ [DefaultValue("")]
+ [Editor("System.Windows.Forms.Design.DataMemberFieldEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
+ public string ValueMember {
+ get { return value_member.BindingMember; }
+ set {
+ BindingMemberInfo new_value = new BindingMemberInfo (value);
+
+ if (value_member.Equals (new_value)) {
+ return;
+ }
+
+ value_member = new_value;
+
+ if (display_member == string.Empty) {
+ DisplayMember = value_member.BindingMember;
+ }
+
+ ConnectToDataSource ();
+ OnValueMemberChanged (EventArgs.Empty);
+ }
+ }
+
+ #endregion Public Properties
+
+ #region Public Methods
+
+ protected object FilterItemOnProperty (object item)
+ {
+ return FilterItemOnProperty (item, string.Empty);
+ }
+
+ protected object FilterItemOnProperty (object item, string field)
+ {
+ if (item == null)
+ return null;
+
+ if (field == null || field == string.Empty)
+ return item;
+
+ PropertyDescriptor prop = null;
+
+ if (data_manager != null) {
+ PropertyDescriptorCollection col = data_manager.GetItemProperties ();
+ prop = col.Find (field, true);
+ }
+
+ if (prop == null)
+ return item;
+
+ return prop.GetValue (item);
+ }
+
+ public string GetItemText (object item)
+ {
+ if (data_manager != null) {
+ object fil = FilterItemOnProperty (item, DisplayMember);
+ if (fil != null) {
+ return fil.ToString ();
+ }
+ }
+
+ return item.ToString ();
+ }
+
+ protected CurrencyManager DataManager {
+ get { return data_manager; }
+ }
+
+ // Used only by ListBox to avoid to break Listbox's member signature
+ protected override bool IsInputKey (Keys keyData)
+ {
+ switch (keyData) {
+ case Keys.Up:
+ case Keys.Down:
+ case Keys.PageUp:
+ case Keys.PageDown:
+ case Keys.Right:
+ case Keys.Left:
+ case Keys.End:
+ case Keys.Home:
+ case Keys.ControlKey:
+ case Keys.Space:
+ case Keys.ShiftKey:
+ return true;
+
+ default:
+ return false;
+ }
+ }
+
+ protected override void OnBindingContextChanged (EventArgs e)
+ {
+ base.OnBindingContextChanged (e);
+ ConnectToDataSource ();
+
+ if (DataManager != null) {
+ SetItemsCore (DataManager.List);
+ SelectedIndex = DataManager.Position;
+ }
+ }
+
+ protected virtual void OnDataSourceChanged (EventArgs e)
+ {
+ if (DataSourceChanged != null)
+ DataSourceChanged (this,e);
+ }
+
+ protected virtual void OnDisplayMemberChanged (EventArgs e)
+ {
+ if (DisplayMemberChanged != null)
+ DisplayMemberChanged (this, e);
+ }
+
+ protected virtual void OnSelectedIndexChanged (EventArgs e)
+ {
+ if (data_manager == null)
+ return;
+ if (data_manager.Position == SelectedIndex)
+ return;
+ data_manager.Position = SelectedIndex;
+ }
+
+ protected virtual void OnSelectedValueChanged (EventArgs e)
+ {
+ if (SelectedValueChanged != null)
+ SelectedValueChanged (this, e);
+ }
+
+ protected virtual void OnValueMemberChanged (EventArgs e)
+ {
+ if (ValueMemberChanged != null)
+ ValueMemberChanged (this, e);
+ }
+
+ protected abstract void RefreshItem (int index);
+
+ protected virtual void SetItemCore (int index, object value)
+ {
+
+ }
+
+ protected abstract void SetItemsCore (IList items);
+
+ #endregion Public Methods
+
+ #region Private Methods
+
+ internal void BindDataItems (IList items)
+ {
+ items.Clear ();
+
+ if (data_manager != null) {
+ SetItemsCore (data_manager.List);
+ }
+ }
+
+ private void ConnectToDataSource ()
+ {
+ if (data_source == null) {
+ data_manager = null;
+ return;
+ }
+
+ if (BindingContext == null) {
+ return;
+ }
+
+ data_manager = (CurrencyManager) BindingContext [data_source];
+ data_manager.PositionChanged += new EventHandler (OnPositionChanged);
+ }
+
+ private void OnPositionChanged (object sender, EventArgs e)
+ {
+ SelectedIndex = data_manager.Position;
+ }
+
+ #endregion Private Methods
+ }
+
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs
new file mode 100644
index 00000000000..9066811f135
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs
@@ -0,0 +1,2479 @@
+// 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-2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Ravindra Kumar (rkumar@novell.com)
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+// TODO:
+// - Item text editing
+// - Column resizing/reodering
+// - Feedback for item activation, change in cursor types as mouse moves.
+// - HideSelection
+// - LabelEdit
+// - Manual column resizing
+// - Drag and drop
+
+
+// NOT COMPLETE
+
+
+using System.Collections;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Drawing;
+using System.Runtime.InteropServices;
+using System.Globalization;
+
+namespace System.Windows.Forms
+{
+ [DefaultEvent ("SelectedIndexChanged")]
+ [DefaultProperty ("Items")]
+ [Designer ("System.Windows.Forms.Design.ListViewDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+ public class ListView : Control
+ {
+ private ItemActivation activation = ItemActivation.Standard;
+ private ListViewAlignment alignment = ListViewAlignment.Top;
+ private bool allow_column_reorder = false;
+ private bool auto_arrange = true;
+ private bool check_boxes = false;
+ private CheckedIndexCollection checked_indices;
+ private CheckedListViewItemCollection checked_items;
+ private ColumnHeader clicked_column;
+ private ListViewItem clicked_item;
+ private ListViewItem last_clicked_item;
+ private ColumnHeaderCollection columns;
+ private bool ctrl_pressed;
+ private bool shift_pressed;
+ internal ListViewItem focused_item;
+ private bool full_row_select = false;
+ private bool grid_lines = false;
+ private ColumnHeaderStyle header_style = ColumnHeaderStyle.Clickable;
+ private bool hide_selection = true;
+ private bool hover_selection = false;
+ private IComparer item_sorter;
+ private ListViewItemCollection items;
+ private bool label_edit = false;
+ private bool label_wrap = true;
+ private bool multiselect = true;
+ private bool scrollable = true;
+ private SelectedIndexCollection selected_indices;
+ private SelectedListViewItemCollection selected_items;
+ private SortOrder sort_order = SortOrder.None;
+ private ImageList state_image_list;
+ private bool updating = false;
+ private View view = View.LargeIcon;
+ private int layout_wd; // We might draw more than our client area
+ private int layout_ht; // therefore we need to have these two.
+ //private TextBox editor; // Used for editing an item text
+ internal ScrollBar h_scroll; // used for scrolling horizontally
+ internal ScrollBar v_scroll; // used for scrolling vertically
+ internal int h_marker; // Position markers for scrolling
+ internal int v_marker;
+ internal Rectangle client_area; // ClientRectangle - scrollbars
+ private int keysearch_tickcnt;
+ private string keysearch_text;
+ static private readonly int keysearch_keydelay = 1000;
+
+ // internal variables
+ internal ImageList large_image_list;
+ internal ImageList small_image_list;
+ internal Size text_size = Size.Empty;
+
+ #region Events
+ public event LabelEditEventHandler AfterLabelEdit;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler BackgroundImageChanged;
+
+ public event LabelEditEventHandler BeforeLabelEdit;
+ public event ColumnClickEventHandler ColumnClick;
+ public event EventHandler ItemActivate;
+ public event ItemCheckEventHandler ItemCheck;
+ public event ItemDragEventHandler ItemDrag;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event PaintEventHandler Paint;
+
+ public event EventHandler SelectedIndexChanged;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler TextChanged;
+ #endregion // Events
+
+ #region Public Constructors
+ public ListView ()
+ {
+ background_color = ThemeEngine.Current.ColorWindow;
+ checked_indices = new CheckedIndexCollection (this);
+ checked_items = new CheckedListViewItemCollection (this);
+ columns = new ColumnHeaderCollection (this);
+ foreground_color = SystemColors.WindowText;
+ items = new ListViewItemCollection (this);
+ selected_indices = new SelectedIndexCollection (this);
+ selected_items = new SelectedListViewItemCollection (this);
+
+ border_style = BorderStyle.Fixed3D;
+
+ // we are mostly scrollable
+ h_scroll = new HScrollBar ();
+ v_scroll = new VScrollBar ();
+ h_marker = v_marker = 0;
+ keysearch_tickcnt = 0;
+
+ // scroll bars are disabled initially
+ h_scroll.Visible = false;
+ h_scroll.ValueChanged += new EventHandler(HorizontalScroller);
+ v_scroll.Visible = false;
+ v_scroll.ValueChanged += new EventHandler(VerticalScroller);
+
+ // event handlers
+ base.DoubleClick += new EventHandler(ListView_DoubleClick);
+ base.KeyDown += new KeyEventHandler(ListView_KeyDown);
+ base.KeyUp += new KeyEventHandler(ListView_KeyUp);
+ base.MouseDown += new MouseEventHandler(ListView_MouseDown);
+ base.MouseHover += new EventHandler(ListView_MouseHover);
+ base.MouseUp += new MouseEventHandler(ListView_MouseUp);
+ base.MouseMove += new MouseEventHandler(ListView_MouseMove);
+ base.Paint += new PaintEventHandler (ListView_Paint);
+ SizeChanged += new EventHandler (ListView_SizeChanged);
+
+ this.SetStyle (ControlStyles.UserPaint | ControlStyles.StandardClick, false);
+ }
+ #endregion // Public Constructors
+
+ #region Private Internal Properties
+ internal Size CheckBoxSize {
+ get {
+ if (this.check_boxes) {
+ if (this.state_image_list != null)
+ return this.state_image_list.ImageSize;
+ else
+ return ThemeEngine.Current.ListViewCheckBoxSize;
+ }
+ return Size.Empty;
+ }
+ }
+
+ internal bool CanMultiselect {
+ get {
+ if (this.multiselect &&
+ (this.ctrl_pressed || this.shift_pressed))
+ return true;
+ else
+ return false;
+ }
+ }
+ #endregion // Private Internal Properties
+
+ #region Protected Properties
+ protected override CreateParams CreateParams {
+ get { return base.CreateParams; }
+ }
+
+ protected override Size DefaultSize {
+ get { return ThemeEngine.Current.ListViewDefaultSize; }
+ }
+ #endregion // Protected Properties
+
+ #region Public Instance Properties
+ [DefaultValue (ItemActivation.Standard)]
+ public ItemActivation Activation {
+ get { return activation; }
+ set {
+ if (value != ItemActivation.Standard && value != ItemActivation.OneClick &&
+ value != ItemActivation.TwoClick) {
+ throw new InvalidEnumArgumentException (string.Format
+ ("Enum argument value '{0}' is not valid for Activation", value));
+ }
+
+ activation = value;
+ }
+ }
+
+ [DefaultValue (ListViewAlignment.Top)]
+ [Localizable (true)]
+ public ListViewAlignment Alignment {
+ get { return alignment; }
+ set {
+ if (value != ListViewAlignment.Default && value != ListViewAlignment.Left &&
+ value != ListViewAlignment.SnapToGrid && value != ListViewAlignment.Top) {
+ throw new InvalidEnumArgumentException (string.Format
+ ("Enum argument value '{0}' is not valid for Alignment", value));
+ }
+
+ if (this.alignment != value) {
+ alignment = value;
+ // alignment does not matter in Details/List views
+ if (this.view == View.LargeIcon ||
+ this.View == View.SmallIcon)
+ this.Redraw (true);
+ }
+ }
+ }
+
+ [DefaultValue (false)]
+ public bool AllowColumnReorder {
+ get { return allow_column_reorder; }
+ set {
+ if (this.allow_column_reorder != value) {
+ allow_column_reorder = value;
+ // column reorder does not matter in Details view
+ if (this.view != View.Details)
+ this.Redraw (true);
+ }
+ }
+ }
+
+ [DefaultValue (true)]
+ public bool AutoArrange {
+ get { return auto_arrange; }
+ set {
+ if (auto_arrange != value) {
+ auto_arrange = value;
+ // autoarrange does not matter in Details/List views
+ if (this.view == View.LargeIcon || this.View == View.SmallIcon)
+ this.Redraw (true);
+ }
+ }
+ }
+
+ public override Color BackColor {
+ get {
+ if (background_color.IsEmpty)
+ return ThemeEngine.Current.ColorWindow;
+ else
+ return background_color;
+ }
+ set { background_color = value; }
+ }
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public override Image BackgroundImage {
+ get { return background_image; }
+ set {
+ if (value == background_image)
+ return;
+
+ background_image = value;
+ if (BackgroundImageChanged != null)
+ BackgroundImageChanged (this, new EventArgs ());
+ }
+ }
+
+ [DefaultValue (BorderStyle.Fixed3D)]
+ [DispId (-504)]
+ public BorderStyle BorderStyle {
+ get { return InternalBorderStyle; }
+ set { InternalBorderStyle = value; }
+ }
+
+ [DefaultValue (false)]
+ public bool CheckBoxes {
+ get { return check_boxes; }
+ set {
+ if (check_boxes != value) {
+ check_boxes = value;
+ this.Redraw (true);
+ }
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public CheckedIndexCollection CheckedIndices {
+ get { return checked_indices; }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public CheckedListViewItemCollection CheckedItems {
+ get { return checked_items; }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [Localizable (true)]
+ [MergableProperty (false)]
+ public ColumnHeaderCollection Columns {
+ get { return columns; }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public ListViewItem FocusedItem {
+ get { return focused_item; }
+ }
+
+ public override Color ForeColor {
+ get {
+ if (foreground_color.IsEmpty)
+ return ThemeEngine.Current.ColorWindowText;
+ else
+ return foreground_color;
+ }
+ set { foreground_color = value; }
+ }
+
+ [DefaultValue (false)]
+ public bool FullRowSelect {
+ get { return full_row_select; }
+ set { full_row_select = value; }
+ }
+
+ [DefaultValue (false)]
+ public bool GridLines {
+ get { return grid_lines; }
+ set {
+ if (grid_lines != value) {
+ grid_lines = value;
+ this.Redraw (false);
+ }
+ }
+ }
+
+ [DefaultValue (ColumnHeaderStyle.Clickable)]
+ public ColumnHeaderStyle HeaderStyle {
+ get { return header_style; }
+ set {
+ if (value != ColumnHeaderStyle.Clickable && value != ColumnHeaderStyle.Nonclickable &&
+ value != ColumnHeaderStyle.None) {
+ throw new InvalidEnumArgumentException (string.Format
+ ("Enum argument value '{0}' is not valid for ColumnHeaderStyle", value));
+ }
+
+ if (header_style != value) {
+ header_style = value;
+ // header style matters only in Details view
+ if (this.view == View.Details)
+ this.Redraw (false);
+ }
+ }
+ }
+
+ [DefaultValue (true)]
+ public bool HideSelection {
+ get { return hide_selection; }
+ set {
+ if (hide_selection != value) {
+ hide_selection = value;
+ this.Redraw (false);
+ }
+ }
+ }
+
+ [DefaultValue (false)]
+ public bool HoverSelection {
+ get { return hover_selection; }
+ set { hover_selection = value; }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [Localizable (true)]
+ [MergableProperty (false)]
+ public ListViewItemCollection Items {
+ get { return items; }
+ }
+
+ [DefaultValue (false)]
+ public bool LabelEdit {
+ get { return label_edit; }
+ set { label_edit = value; }
+ }
+
+ [DefaultValue (true)]
+ [Localizable (true)]
+ public bool LabelWrap {
+ get { return label_wrap; }
+ set {
+ if (label_wrap != value) {
+ label_wrap = value;
+ this.Redraw (true);
+ }
+ }
+ }
+
+ [DefaultValue (null)]
+ public ImageList LargeImageList {
+ get { return large_image_list; }
+ set {
+ large_image_list = value;
+ this.Redraw (true);
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public IComparer ListViewItemSorter {
+ get { return item_sorter; }
+ set { item_sorter = value; }
+ }
+
+ [DefaultValue (true)]
+ public bool MultiSelect {
+ get { return multiselect; }
+ set { multiselect = value; }
+ }
+
+ [DefaultValue (true)]
+ public bool Scrollable {
+ get { return scrollable; }
+ set {
+ if (scrollable != value) {
+ scrollable = value;
+ this.Redraw (true);
+ }
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public SelectedIndexCollection SelectedIndices {
+ get { return selected_indices; }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public SelectedListViewItemCollection SelectedItems {
+ get { return selected_items; }
+ }
+
+ [DefaultValue (null)]
+ public ImageList SmallImageList {
+ get { return small_image_list; }
+ set {
+ small_image_list = value;
+ this.Redraw (true);
+ }
+ }
+
+ [DefaultValue (SortOrder.None)]
+ public SortOrder Sorting {
+ get { return sort_order; }
+ set {
+ if (value != SortOrder.Ascending && value != SortOrder.Descending &&
+ value != SortOrder.None) {
+ throw new InvalidEnumArgumentException (string.Format
+ ("Enum argument value '{0}' is not valid for Sorting", value));
+ }
+
+ if (sort_order != value) {
+ sort_order = value;
+ this.Redraw (false);
+ }
+ }
+ }
+
+ [DefaultValue (null)]
+ public ImageList StateImageList {
+ get { return state_image_list; }
+ set {
+ state_image_list = value;
+ this.Redraw (true);
+ }
+ }
+
+ [Bindable (false)]
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public override string Text {
+ get { return text; }
+ set {
+ if (value == text)
+ return;
+
+ text = value;
+ this.Redraw (true);
+
+ if (TextChanged != null)
+ TextChanged (this, new EventArgs ());
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public ListViewItem TopItem {
+ get {
+ // there is no item
+ if (this.items.Count == 0)
+ return null;
+ // if contents are not scrolled
+ // it is the first item
+ else if (h_marker == 0 && v_marker == 0)
+ return this.items [0];
+ // do a hit test for the scrolled position
+ else {
+ foreach (ListViewItem item in this.items) {
+ if (item.EntireRect.X >= h_marker && item.EntireRect.Y >= v_marker)
+ return item;
+ }
+ return null;
+ }
+ }
+ }
+
+ [DefaultValue (View.LargeIcon)]
+ public View View {
+ get { return view; }
+ set {
+ if (value != View.Details && value != View.LargeIcon &&
+ value != View.List && value != View.SmallIcon ) {
+ throw new InvalidEnumArgumentException (string.Format
+ ("Enum argument value '{0}' is not valid for View", value));
+ }
+
+ if (view != value) {
+ h_scroll.Value = v_scroll.Value = 0;
+ view = value;
+ Redraw (true);
+ }
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Internal Methods Properties
+
+ internal int FirstVisibleIndex {
+ get {
+ // there is no item
+ if (this.items.Count == 0)
+ return 0;
+
+ if (h_marker == 0 && v_marker == 0)
+ return 0;
+
+ foreach (ListViewItem item in this.items) {
+ if (item.EntireRect.X + item.EntireRect.Width >= h_marker
+ && item.EntireRect.Y + item.EntireRect.Height >= v_marker)
+ return item.Index;
+ }
+ return 0;
+
+ }
+ }
+
+
+ internal int LastItemIndex {
+ get {
+ for (int i = FirstVisibleIndex; i < Items.Count; i++) {
+ if (Items[i].EntireRect.Y > v_marker + ClientRectangle.Bottom)
+ return i -1;
+ }
+
+ return Items.Count - 1;
+ }
+ }
+
+ internal int TotalWidth {
+ get { return Math.Max (this.Width, this.layout_wd); }
+ }
+
+ internal int TotalHeight {
+ get { return Math.Max (this.Height, this.layout_ht); }
+ }
+
+ internal void Redraw (bool recalculate)
+ {
+ // Avoid calculations when control is being updated
+ if (this.updating)
+ return;
+
+ if (recalculate)
+ CalculateListView (this.alignment);
+
+ Refresh ();
+ }
+
+ internal Size GetChildColumnSize (int index)
+ {
+ Size ret_size = Size.Empty;
+ ColumnHeader col = this.columns [index];
+
+ if (col.Width == -2) { // autosize = max(items, columnheader)
+ Size size = Size.Ceiling (this.DeviceContext.MeasureString
+ (col.Text, this.Font));
+ ret_size = BiggestItem (index);
+ if (size.Width > ret_size.Width)
+ ret_size = size;
+ }
+ else { // -1 and all the values < -2 are put under one category
+ ret_size = BiggestItem (index);
+ // fall back to empty columns' width if no subitem is available for a column
+ if (ret_size.IsEmpty) {
+ ret_size.Width = ThemeEngine.Current.ListViewEmptyColumnWidth;
+ if (col.Text.Length > 0)
+ ret_size.Height = Size.Ceiling (this.DeviceContext.MeasureString
+ (col.Text, this.Font)).Height;
+ else
+ ret_size.Height = this.Font.Height;
+ }
+ }
+
+ // adjust the size for icon and checkbox for 0th column
+ if (index == 0) {
+ ret_size.Width += (this.CheckBoxSize.Width + 4);
+ if (this.small_image_list != null)
+ ret_size.Width += this.small_image_list.ImageSize.Width;
+ }
+ return ret_size;
+ }
+
+ // Returns the size of biggest item text in a column.
+ private Size BiggestItem (int col)
+ {
+ Size temp = Size.Empty;
+ Size ret_size = Size.Empty;
+
+ // 0th column holds the item text, we check the size of
+ // the various subitems falling in that column and get
+ // the biggest one's size.
+ foreach (ListViewItem item in items) {
+ if (col >= item.SubItems.Count)
+ continue;
+
+ temp = Size.Ceiling (this.DeviceContext.MeasureString
+ (item.SubItems [col].Text, this.Font));
+ if (temp.Width > ret_size.Width)
+ ret_size = temp;
+ }
+
+ // adjustment for space
+ if (!ret_size.IsEmpty)
+ ret_size.Width += 4;
+
+ return ret_size;
+ }
+
+ // Sets the size of the biggest item text as per the view
+ private void CalcTextSize ()
+ {
+ // clear the old value
+ text_size = Size.Empty;
+
+ if (items.Count == 0)
+ return;
+
+ text_size = BiggestItem (0);
+
+ if (view == View.LargeIcon && this.label_wrap) {
+ Size temp = Size.Empty;
+ if (this.check_boxes)
+ temp.Width += 2 * this.CheckBoxSize.Width;
+ if (large_image_list != null)
+ temp.Width += large_image_list.ImageSize.Width;
+ if (temp.Width == 0)
+ temp.Width = 43;
+ // wrapping is done for two lines only
+ if (text_size.Width > temp.Width) {
+ text_size.Width = temp.Width;
+ text_size.Height *= 2;
+ }
+ }
+ else if (view == View.List) {
+ // in list view max text shown in determined by the
+ // control width, even if scolling is enabled.
+ int max_wd = this.Width - (this.CheckBoxSize.Width - 2);
+ if (this.small_image_list != null)
+ max_wd -= this.small_image_list.ImageSize.Width;
+
+ if (text_size.Width > max_wd)
+ text_size.Width = max_wd;
+ }
+
+ // we do the default settings, if we have got 0's
+ if (text_size.Height <= 0)
+ text_size.Height = this.Font.Height;
+ if (text_size.Width <= 0)
+ text_size.Width = this.Width;
+
+ // little adjustment
+ text_size.Width += 4;
+ text_size.Height += 2;
+ }
+
+ private void CalculateScrollBars ()
+ {
+ client_area = ClientRectangle;
+
+ if (!this.scrollable || this.items.Count <= 0) {
+ h_scroll.Visible = false;
+ v_scroll.Visible = false;
+ return;
+ }
+
+ // making a scroll bar visible might make
+ // other scroll bar visible
+ if (layout_wd > client_area.Right) {
+ h_scroll.Visible = true;
+ if ((layout_ht + h_scroll.Height) > client_area.Bottom) {
+ v_scroll.Visible = true;
+ }
+ else {
+ v_scroll.Visible = false;
+ }
+ } else if (layout_ht > client_area.Bottom) {
+ v_scroll.Visible = true;
+ if ((layout_wd + v_scroll.Width) > client_area.Right) {
+ h_scroll.Visible = true;
+ }
+ else {
+ h_scroll.Visible = false;
+ }
+ } else {
+ h_scroll.Visible = false;
+ v_scroll.Visible = false;
+ }
+
+ if (h_scroll.Visible) {
+ h_scroll.Location = new Point (client_area.X, client_area.Bottom - h_scroll.Height);
+ h_scroll.Minimum = 0;
+
+ // if v_scroll is visible, adjust the maximum of the
+ // h_scroll to account for the width of v_scroll
+ if (v_scroll.Visible) {
+ h_scroll.Maximum = layout_wd + v_scroll.Width;
+ h_scroll.Width = client_area.Width - v_scroll.Width;
+ }
+ else {
+ h_scroll.Maximum = layout_wd;
+ h_scroll.Width = client_area.Width;
+ }
+
+ h_scroll.LargeChange = client_area.Width;
+ h_scroll.SmallChange = Font.Height;
+ client_area.Height -= h_scroll.Height;
+ }
+
+ // vertical scrollbar
+ if (v_scroll.Visible) {
+ v_scroll.Location = new Point (client_area.Right - v_scroll.Width, client_area.Y);
+ v_scroll.Minimum = 0;
+
+ // if h_scroll is visible, adjust the maximum of the
+ // v_scroll to account for the height of h_scroll
+ if (h_scroll.Visible) {
+ v_scroll.Maximum = layout_ht + h_scroll.Height;
+ v_scroll.Height = client_area.Height; // - h_scroll.Height already done
+ } else {
+ v_scroll.Maximum = layout_ht;
+ v_scroll.Height = client_area.Height;
+ }
+
+ v_scroll.LargeChange = client_area.Height;
+ v_scroll.SmallChange = Font.Height;
+ client_area.Width -= v_scroll.Width;
+ }
+ }
+
+
+ // Sets the location of every item on
+ // the ListView as per the view
+ private void CalculateListView (ListViewAlignment align)
+ {
+ int current_pos_x = 0; // our x-position marker
+ int current_pos_y = 0; // our y-position marker
+ int item_ht;
+ int item_wd;
+ int max; // max x_pos or y_pos depending on the alignment
+ int current = 0; // current row or column
+ int vertical_spacing = ThemeEngine.Current.ListViewVerticalSpacing;
+ int horizontal_spacing = ThemeEngine.Current.ListViewHorizontalSpacing;
+
+ CalcTextSize ();
+
+ switch (view) {
+
+ case View.Details:
+ // ColumnHeaders are not drawn if headerstyle is none
+ int ht = (this.header_style == ColumnHeaderStyle.None) ?
+ 0 : this.Font.Height + 3;
+
+ if (columns.Count > 0) {
+ foreach (ColumnHeader col in columns) {
+ col.X = current_pos_x;
+ col.Y = current_pos_y;
+ col.CalcColumnHeader ();
+ current_pos_x += col.Wd;
+ }
+ this.layout_wd = current_pos_x;
+ }
+ // set the position marker for placing items
+ // vertically down
+ current_pos_y = ht;
+
+ if (items.Count > 0) {
+ foreach (ListViewItem item in items) {
+ item.location.X = 0;
+ item.location.Y = current_pos_y;
+ item.CalcListViewItem ();
+ current_pos_y += item.EntireRect.Height;
+ }
+ this.layout_ht = current_pos_y;
+
+ // some space for bottom gridline
+ if (this.grid_lines)
+ this.layout_ht += 2;
+ }
+ break;
+
+ case View.SmallIcon:
+ vertical_spacing = 0;
+ horizontal_spacing = 0;
+ goto case View.LargeIcon;
+
+ case View.LargeIcon:
+ if (items.Count > 0) {
+ items [0].CalcListViewItem ();
+ item_ht = items [0].EntireRect.Height;
+ item_wd = items [0].EntireRect.Width;
+
+ // top (default) and snaptogrid alignments are handled same way
+ if (align == ListViewAlignment.Left) {
+ max = client_area.Height;
+ foreach (ListViewItem item in items) {
+ item.location.X = current_pos_x +
+ horizontal_spacing;
+ item.location.Y = 0;
+ item.CalcListViewItem ();
+ current_pos_y += item_ht;
+
+ current ++; // just to know about the last element
+ // we just did the last item
+ if (current == items.Count) {
+ if (max < current_pos_y)
+ max = current_pos_y;
+ current_pos_x = item.EntireRect.Right;
+ break;
+ }
+ else {
+ // is there enough space for another row ?
+ if ((current_pos_y + vertical_spacing
+ + item_ht) <= client_area.Height)
+ current_pos_y += vertical_spacing;
+ else {
+ // start another column
+ // make current_pos_y as the
+ // max value and reset
+ // current_pos_y value.
+ max = current_pos_y;
+ current_pos_x += item_wd;
+ current_pos_y = 0;
+ }
+ }
+ }
+ // adjust the layout dimensions
+ this.layout_ht = max;
+ this.layout_wd = current_pos_x;
+ }
+ else { // other default/top alignment
+ max = client_area.Width;
+ foreach (ListViewItem item in items) {
+ item.location.X = current_pos_x +
+ horizontal_spacing;
+
+ item.location.Y = current_pos_y;
+ item.CalcListViewItem ();
+ current_pos_x += item_wd;
+
+ current ++; // just to know about the last element
+ // we just did the last item
+ if (current == items.Count) {
+ if (max < current_pos_x)
+ max = current_pos_x;
+ current_pos_y = item.EntireRect.Bottom;
+ break;
+ }
+ else {
+ // is there enough space for another column?
+ if ((current_pos_x + horizontal_spacing
+ + item_wd) <= client_area.Width)
+ continue;
+ else {
+ // start another row
+ // make current_pos_x as the
+ // max value and reset
+ // current_pos_x value.
+ max = current_pos_x;
+ current_pos_y += (item_ht +
+ vertical_spacing);
+ current_pos_x = 0;
+ }
+ }
+ }
+ // adjust the layout dimensions
+ this.layout_wd = max;
+ this.layout_ht = current_pos_y;
+ }
+ }
+ break;
+
+ case View.List:
+ if (items.Count > 0) {
+ items [0].CalcListViewItem ();
+ item_ht = items [0].EntireRect.Height;
+ item_wd = items [0].EntireRect.Width;
+
+ max = client_area.Height / item_ht;
+ if (max == 0)
+ max = 1; // we draw at least one row
+
+ foreach (ListViewItem item in items) {
+ item.location.X = current_pos_x;
+ item.location.Y = current_pos_y;
+ item.CalcListViewItem ();
+ current ++;
+ if (current == max) {
+ current_pos_x += item_wd;
+ current_pos_y = 0;
+ current = 0;
+ }
+ else
+ current_pos_y += item_ht;
+ }
+
+ // adjust the layout dimensions
+ this.layout_ht = max * item_ht;
+ if (current == 0) // we have fully filled layout
+ this.layout_wd = current_pos_x;
+ else
+ this.layout_wd = current_pos_x + item_wd;
+ }
+ break;
+ }
+
+ CalculateScrollBars ();
+
+ }
+
+ private bool KeySearchString (KeyEventArgs ke)
+ {
+ int current_tickcnt = Environment.TickCount;
+ if (keysearch_tickcnt > 0 && current_tickcnt - keysearch_tickcnt > keysearch_keydelay) {
+ keysearch_text = string.Empty;
+ }
+
+ keysearch_text += (char) ke.KeyData;
+ keysearch_tickcnt = current_tickcnt;
+
+ int i = FocusedItem.Index;
+ while (true) {
+ if (CultureInfo.CurrentCulture.CompareInfo.IsPrefix (Items[i].Text, keysearch_text,
+ CompareOptions.IgnoreCase)) {
+ SetFocusedItem (Items [i]);
+ items [i].Selected = true;
+ EnsureVisible (i);
+ break;
+ }
+ i = (i + 1 < Items.Count) ? i+1 : 0;
+
+ if (i == FocusedItem.Index)
+ break;
+ }
+ return true;
+ }
+
+
+ // Event Handlers
+ private void ListView_DoubleClick (object sender, EventArgs e)
+ {
+ if (this.activation == ItemActivation.Standard
+ && this.ItemActivate != null)
+ this.ItemActivate (this, e);
+ }
+
+ private void ListView_KeyDown (object sender, KeyEventArgs ke)
+ {
+ int index = -1;
+ if (ke.Handled || Items.Count == 0)
+ return;
+
+ ke.Handled = true;
+
+ switch (ke.KeyCode) {
+
+ case Keys.ControlKey:
+ ctrl_pressed = true;
+ break;
+
+ case Keys.Down:
+ if (focused_item != null && focused_item.Index + 1 < Items.Count) {
+ index = focused_item.Index + 1;
+ }
+ break;
+
+ case Keys.End:
+ index = Items.Count - 1;
+ break;
+
+ case Keys.Home:
+ index = 0;
+ break;
+
+ case Keys.Left:
+ index = -1;
+ if (focused_item != null)
+ index = focused_item.Index;
+ else
+ break;
+
+ if (index > 0)
+ index -= 1;
+
+ break;
+
+ case Keys.Right:
+ if (focused_item != null)
+ index = focused_item.Index + 1;
+ else
+ index = 1;
+
+ if (index == items.Count)
+ index = -1;
+
+ break;
+
+ case Keys.ShiftKey:
+ shift_pressed = true;
+ break;
+
+ case Keys.Up:
+ if (focused_item != null)
+ index = focused_item.Index;
+ else
+ break;
+
+ if (index > 0)
+ index--;
+
+ if (index < 0) {
+ index = -1;
+ }
+ break;
+
+ default:
+ if (KeySearchString (ke)) {
+ ke.Handled = true;
+ } else {
+ ke.Handled = false;
+ }
+ return;
+ }
+
+ if (index != -1) {
+ items [index].Selected = true;
+ SetFocusedItem (items [index]);
+ EnsureVisible (index);
+ }
+ }
+
+ private void ListView_KeyUp (object sender, KeyEventArgs ke)
+ {
+ if (!ke.Handled) {
+ if (ke.KeyCode == Keys.ControlKey)
+ this.ctrl_pressed = false;
+
+ if (ke.KeyCode == Keys.ShiftKey)
+ this.shift_pressed = false;
+ ke.Handled = true;
+ }
+ }
+
+ private void ListView_MouseDown (object sender, MouseEventArgs me)
+ {
+ if (items.Count == 0)
+ return;
+
+ Point hit = Point.Empty;
+ if (this.HeaderStyle != ColumnHeaderStyle.None) {
+ // take horizontal scrolling into account
+ hit = new Point (me.X + h_marker, me.Y);
+
+ // hit test on columns
+ if (this.view == View.Details && this.columns.Count > 0) {
+ foreach (ColumnHeader col in this.columns) {
+ if (col.Rect.Contains (hit)) {
+ this.clicked_column = col;
+ this.Capture = true;
+ break;
+ }
+ }
+
+ if (this.clicked_column != null) {
+ this.clicked_column.pressed = true;
+ this.Redraw (false);
+ return;
+ }
+ }
+ }
+
+ // hit test on items
+ // we need to take scrolling into account
+ hit = new Point (me.X + h_marker, me.Y + v_marker);
+ foreach (ListViewItem item in this.items) {
+ if (item.CheckRect.Contains (hit)) {
+ CheckState curr_state = item.Checked ?
+ CheckState.Checked : CheckState.Unchecked;
+ if (item.Checked)
+ item.Checked = false;
+ else
+ item.Checked = true;
+
+ CheckState new_state = item.Checked ?
+ CheckState.Checked : CheckState.Unchecked;
+ this.Redraw (false);
+
+ // Raise the ItemCheck event
+ ItemCheckEventArgs ice = new ItemCheckEventArgs (item.Index,
+ curr_state,
+ new_state);
+ this.OnItemCheck (ice);
+ break;
+ }
+
+ if (this.view == View.Details &&
+ this.FullRowSelect == false) {
+ if (item.LabelRect.Contains (hit)) {
+ this.clicked_item = item;
+ break;
+ }
+ }
+ else {
+ if (item.EntireRect.Contains (hit)) {
+ this.clicked_item = item;
+ break;
+ }
+ }
+ }
+
+ // set the FocusedItem to be the current clicked_item
+ SetFocusedItem (clicked_item);
+
+ if (clicked_item != null) {
+ bool changed = !clicked_item.Selected;
+ clicked_item.Selected = true;
+
+ // Only Raise the event if the selected item has changed
+ if (changed)
+ OnSelectedIndexChanged (EventArgs.Empty);
+
+ // Raise double click if the item was clicked. On MS the
+ // double click is only raised if you double click an item
+ if (me.Clicks > 1 && this.clicked_item != null)
+ OnDoubleClick (EventArgs.Empty);
+ else if (me.Clicks == 1 && clicked_item != null)
+ OnClick (EventArgs.Empty);
+
+ this.Redraw (false);
+ } else if (selected_indices.Count > 0) {
+ // NOTE: selected_indices isn't computed properly so
+ // this doesn't actually work
+
+ // Raise the event if there was at least one item
+ // selected and the user click on a dead area (unselecting all)
+ OnSelectedIndexChanged (EventArgs.Empty);
+ Redraw (false);
+ }
+ }
+
+ private void ListView_MouseHover (object sender, EventArgs e)
+ {
+ // handle the hover events only when the mouse
+ // is not captured.
+ if (this.hover_selection == false || this.Capture)
+ return;
+
+ // hit test for the items
+ Point hit = this.PointToClient (Control.MousePosition);
+ ListViewItem item = this.GetItemAt (hit.X, hit.Y);
+
+ if (item != null) {
+ item.Selected = true;
+ // Raise the event
+ this.OnSelectedIndexChanged (new EventArgs ());
+
+ this.Redraw (false);
+ }
+ }
+
+ private void ListView_MouseMove (object sender, MouseEventArgs me)
+ {
+ // Column header is always at the top. It can
+ // scroll only horizontally. So, we have to take
+ // only horizontal scrolling into account
+ Point hit = new Point (me.X + h_marker, me.Y);
+
+ // non-null clicked_col means mouse down has happened
+ // on a column
+ if (this.clicked_column != null) {
+ if (this.clicked_column.pressed == false &&
+ this.clicked_column.Rect.Contains (hit)) {
+ this.clicked_column.pressed = true;
+ this.Redraw (false);
+ }
+ else if (this.clicked_column.pressed &&
+ ! this.clicked_column.Rect.Contains (hit)) {
+ this.clicked_column.pressed = false;
+ this.Redraw (false);
+ }
+ }
+ }
+
+ private void ListView_MouseUp (object sender, MouseEventArgs me)
+ {
+ this.Capture = false;
+ if (items.Count == 0)
+ return;
+
+ Point hit = new Point (me.X, me.Y);
+
+ if (this.clicked_column != null) {
+ if (this.clicked_column.pressed) {
+ this.clicked_column.pressed = false;
+ this.Redraw (false);
+
+ // Raise the ColumnClick event
+ this.OnColumnClick (new ColumnClickEventArgs
+ (this.clicked_column.Index));
+ }
+ }
+
+ // Raise the ItemActivate event
+ Rectangle rect = Rectangle.Empty;
+ if (this.clicked_item != null) {
+ if (this.view == View.Details && !this.full_row_select)
+ rect = this.clicked_item.LabelRect;
+ else
+ rect = this.clicked_item.EntireRect;
+
+ // We handle double click in a separate handler
+ if (this.activation != ItemActivation.Standard &&
+ rect.Contains (hit)) {
+ if (this.activation == ItemActivation.OneClick)
+ this.ItemActivate (this, EventArgs.Empty);
+
+ // ItemActivate is raised on the second click on the same item
+ else if (this.activation == ItemActivation.TwoClick) {
+ if (this.last_clicked_item == this.clicked_item) {
+ this.ItemActivate (this, EventArgs.Empty);
+ this.last_clicked_item = null;
+ }
+ else
+ this.last_clicked_item = this.clicked_item;
+ }
+ }
+ }
+
+ this.clicked_column = null;
+ this.clicked_item = null;
+ }
+
+ private void ListView_Paint (object sender, PaintEventArgs pe)
+ {
+ if (this.Width <= 0 || this.Height <= 0 ||
+ this.Visible == false || this.updating == true)
+ return;
+
+ CalculateScrollBars ();
+
+ ThemeEngine.Current.DrawListView (pe.Graphics,
+ pe.ClipRectangle, this);
+
+ // Raise the Paint event
+ if (Paint != null)
+ Paint (this, pe);
+ }
+
+ private void ListView_SizeChanged (object sender, EventArgs e)
+ {
+ CalculateListView (alignment);
+ }
+
+ private void SetFocusedItem (ListViewItem item)
+ {
+ if (focused_item != null)
+ focused_item.Focused = false;
+
+ if (item != null)
+ item.Focused = true;
+
+ focused_item = item;
+ }
+
+ private void HorizontalScroller (object sender, EventArgs e)
+ {
+ // Avoid unnecessary flickering, when button is
+ // kept pressed at the end
+ if (h_marker != h_scroll.Value) {
+
+ int pixels = h_marker - h_scroll.Value;
+ Rectangle area = client_area;
+
+ if (View == View.Details && Columns.Count > 0) {
+ area.Y += Columns[0].Ht;
+ area.Height -= Columns[0].Ht;
+ }
+
+ h_marker = h_scroll.Value;
+ XplatUI.ScrollWindow (Handle, area, pixels, 0, false);
+ }
+ }
+
+ private void VerticalScroller (object sender, EventArgs e)
+ {
+ // Avoid unnecessary flickering, when button is
+ // kept pressed at the end
+ if (v_marker != v_scroll.Value) {
+ int pixels = v_marker - v_scroll.Value;
+ Rectangle area = client_area;
+
+ if (View == View.Details && header_style != ColumnHeaderStyle.None && Columns.Count > 0) {
+ area.Y += Columns[0].Ht;
+ area.Height -= Columns[0].Ht;
+ }
+
+ v_marker = v_scroll.Value;
+ XplatUI.ScrollWindow (Handle, area, 0, pixels, false);
+ }
+ }
+ #endregion // Internal Methods Properties
+
+ #region Protected Methods
+ protected override void CreateHandle ()
+ {
+ base.CreateHandle ();
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ if (disposing) {
+ h_scroll.Dispose ();
+ v_scroll.Dispose ();
+
+ large_image_list = null;
+ small_image_list = null;
+ state_image_list = null;
+ }
+
+ base.Dispose (disposing);
+ }
+
+ protected override bool IsInputKey (Keys keyData)
+ {
+ switch (keyData) {
+ case Keys.Up:
+ case Keys.Down:
+ case Keys.PageUp:
+ case Keys.PageDown:
+ case Keys.Right:
+ case Keys.Left:
+ case Keys.End:
+ case Keys.Home:
+ return true;
+
+ default:
+ break;
+ }
+
+ return base.IsInputKey (keyData);
+ }
+
+ protected virtual void OnAfterLabelEdit (LabelEditEventArgs e)
+ {
+ if (AfterLabelEdit != null)
+ AfterLabelEdit (this, e);
+ }
+
+ protected virtual void OnBeforeLabelEdit (LabelEditEventArgs e)
+ {
+ if (BeforeLabelEdit != null)
+ BeforeLabelEdit (this, e);
+ }
+
+ protected virtual void OnColumnClick (ColumnClickEventArgs e)
+ {
+ if (ColumnClick != null)
+ ColumnClick (this, e);
+ }
+
+ protected override void OnEnabledChanged (EventArgs e)
+ {
+ base.OnEnabledChanged (e);
+ }
+
+ protected override void OnFontChanged (EventArgs e)
+ {
+ base.OnFontChanged (e);
+ Redraw (true);
+ }
+
+ protected override void OnHandleCreated (EventArgs e)
+ {
+ base.OnHandleCreated (e);
+ SuspendLayout ();
+ Controls.AddImplicit (this.v_scroll);
+ Controls.AddImplicit (this.h_scroll);
+ ResumeLayout ();
+ }
+
+ protected override void OnHandleDestroyed (EventArgs e)
+ {
+ base.OnHandleDestroyed (e);
+ }
+
+ protected virtual void OnItemActivate (EventArgs e)
+ {
+ if (ItemActivate != null)
+ ItemActivate (this, e);
+ }
+
+ protected virtual void OnItemCheck (ItemCheckEventArgs ice)
+ {
+ if (ItemCheck != null)
+ ItemCheck (this, ice);
+ }
+
+ protected virtual void OnItemDrag (ItemDragEventArgs e)
+ {
+ if (ItemDrag != null)
+ ItemDrag (this, e);
+ }
+
+ protected virtual void OnSelectedIndexChanged (EventArgs e)
+ {
+ if (SelectedIndexChanged != null)
+ SelectedIndexChanged (this, e);
+ }
+
+ protected override void OnSystemColorsChanged (EventArgs e)
+ {
+ base.OnSystemColorsChanged (e);
+ }
+
+ protected void RealizeProperties ()
+ {
+ // FIXME: TODO
+ }
+
+ protected void UpdateExtendedStyles ()
+ {
+ // FIXME: TODO
+ }
+
+ protected override void WndProc (ref Message m)
+ {
+ base.WndProc (ref m);
+ }
+ #endregion // Protected Methods
+
+ #region Public Instance Methods
+ public void ArrangeIcons ()
+ {
+ ArrangeIcons (this.alignment);
+ }
+
+ public void ArrangeIcons (ListViewAlignment alignment)
+ {
+ // Icons are arranged only if view is set to LargeIcon or SmallIcon
+ if (view == View.LargeIcon || view == View.SmallIcon) {
+ this.CalculateListView (alignment);
+ // we have done the calculations already
+ this.Redraw (false);
+ }
+ }
+
+ public void BeginUpdate ()
+ {
+ // flag to avoid painting
+ updating = true;
+ }
+
+ public void Clear ()
+ {
+ columns.Clear ();
+ items.Clear (); // Redraw (true) called here
+ }
+
+ public void EndUpdate ()
+ {
+ // flag to avoid painting
+ updating = false;
+
+ // probably, now we need a redraw with recalculations
+ this.Redraw (true);
+ }
+
+ public void EnsureVisible (int index)
+ {
+ if (index < 0 || index >= this.items.Count || this.scrollable == false)
+ return;
+
+ // dimensions of visible area
+ int view_wd = client_area.Width;
+ int view_ht = client_area.Height;
+ // visible area is decided by the h_marker and v_marker
+ Rectangle view_rect = new Rectangle (h_marker, v_marker, view_wd, view_ht);
+
+ // an item's bounding rect
+ Rectangle rect = this.items [index].EntireRect;
+
+ // we don't need to do anything if item is visible.
+ // visible area is represented by (0,0,view_wd,view_ht)
+ if (view_rect.Contains (rect))
+ return;
+
+ // Scroll Left or Up
+ if ((rect.Left < view_rect.Left) || (rect.Top < view_rect.Top)) {
+ if (rect.Left < view_rect.Left)
+ this.h_scroll.Value -= (view_rect.Left - rect.Left);
+ if (rect.Top < view_rect.Top)
+ this.v_scroll.Value -= (view_rect.Top - rect.Top);
+ }
+ // Scroll Right or Down
+ else {
+ if (rect.Right > view_rect.Right)
+ this.h_scroll.Value += (rect.Right - view_rect.Right);
+ if (rect.Bottom > view_rect.Bottom)
+ this.v_scroll.Value += (rect.Bottom - view_rect.Bottom);
+ }
+ }
+
+ public ListViewItem GetItemAt (int x, int y)
+ {
+ foreach (ListViewItem item in items) {
+ if (item.Bounds.Contains (x, y))
+ return item;
+ }
+ return null;
+ }
+
+ public Rectangle GetItemRect (int index)
+ {
+ return GetItemRect (index, ItemBoundsPortion.Entire);
+ }
+
+ public Rectangle GetItemRect (int index, ItemBoundsPortion portion)
+ {
+ if (index < 0 || index >= items.Count)
+ throw new IndexOutOfRangeException ("Invalid Index");
+
+ return items [index].GetBounds (portion);
+ }
+
+ public void Sort ()
+ {
+ if (sort_order != SortOrder.None)
+ items.list.Sort (item_sorter);
+
+ if (sort_order == SortOrder.Descending)
+ items.list.Reverse ();
+
+ this.Redraw (true);
+ }
+
+ public override string ToString ()
+ {
+ int count = this.Items.Count;
+
+ if (count == 0)
+ return string.Format ("System.Windows.Forms.ListView, Items.Count: 0");
+ else
+ return string.Format ("System.Windows.Forms.ListView, Items.Count: {0}, Items[0]: {1}", count, this.Items [0].ToString ());
+ }
+ #endregion // Public Instance Methods
+
+
+ #region Subclasses
+ public class CheckedIndexCollection : IList, ICollection, IEnumerable
+ {
+ internal ArrayList list;
+ private ListView owner;
+
+ #region Public Constructor
+ public CheckedIndexCollection (ListView owner)
+ {
+ list = new ArrayList ();
+ this.owner = owner;
+ }
+ #endregion // Public Constructor
+
+ #region Public Properties
+ [Browsable (false)]
+ public virtual int Count {
+ get { return list.Count; }
+ }
+
+ public virtual bool IsReadOnly {
+ get { return true; }
+ }
+
+ public int this [int index] {
+ get {
+ if (index < 0 || index >= list.Count)
+ throw new ArgumentOutOfRangeException ("Index out of range.");
+ return (int) list [index];
+ }
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return false; }
+ }
+
+ object ICollection.SyncRoot {
+ get { return this; }
+ }
+
+ bool IList.IsFixedSize {
+ get { return true; }
+ }
+
+ object IList.this [int index] {
+ get { return this [index]; }
+ set { throw new NotSupportedException ("SetItem operation is not supported."); }
+ }
+ #endregion // Public Properties
+
+ #region Public Methods
+ public bool Contains (int checkedIndex)
+ {
+ return list.Contains (checkedIndex);
+ }
+
+ public virtual IEnumerator GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+
+ void ICollection.CopyTo (Array dest, int index)
+ {
+ list.CopyTo (dest, index);
+ }
+
+ int IList.Add (object value)
+ {
+ throw new NotSupportedException ("Add operation is not supported.");
+ }
+
+ void IList.Clear ()
+ {
+ throw new NotSupportedException ("Clear operation is not supported.");
+ }
+
+ bool IList.Contains (object checkedIndex)
+ {
+ return list.Contains (checkedIndex);
+ }
+
+ int IList.IndexOf (object checkedIndex)
+ {
+ return list.IndexOf (checkedIndex);
+ }
+
+ void IList.Insert (int index, object value)
+ {
+ throw new NotSupportedException ("Insert operation is not supported.");
+ }
+
+ void IList.Remove (object value)
+ {
+ throw new NotSupportedException ("Remove operation is not supported.");
+ }
+
+ void IList.RemoveAt (int index)
+ {
+ throw new NotSupportedException ("RemoveAt operation is not supported.");
+ }
+
+ public int IndexOf (int checkedIndex)
+ {
+ return list.IndexOf (checkedIndex);
+ }
+ #endregion // Public Methods
+
+ } // CheckedIndexCollection
+
+ public class CheckedListViewItemCollection : IList, ICollection, IEnumerable
+ {
+ internal ArrayList list;
+ private ListView owner;
+
+ #region Public Constructor
+ public CheckedListViewItemCollection (ListView owner)
+ {
+ list = new ArrayList ();
+ this.owner = owner;
+ }
+ #endregion // Public Constructor
+
+ #region Public Properties
+ [Browsable (false)]
+ public virtual int Count {
+ get { return list.Count; }
+ }
+
+ public virtual bool IsReadOnly {
+ get { return true; }
+ }
+
+ public ListViewItem this [int index] {
+ get {
+ if (index < 0 || index >= list.Count)
+ throw new ArgumentOutOfRangeException ("Index out of range.");
+ return (ListViewItem) list [index];
+ }
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return list.IsSynchronized; }
+ }
+
+ object ICollection.SyncRoot {
+ get { return this; }
+ }
+
+ bool IList.IsFixedSize {
+ get { return true; }
+ }
+
+ object IList.this [int index] {
+ get { return this [index]; }
+ set { throw new NotSupportedException ("SetItem operation is not supported."); }
+ }
+ #endregion // Public Properties
+
+ #region Public Methods
+ public bool Contains (ListViewItem item)
+ {
+ return list.Contains (item);
+ }
+
+ public virtual void CopyTo (Array dest, int index)
+ {
+ list.CopyTo (dest, index);
+ }
+
+ public virtual IEnumerator GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+
+ int IList.Add (object value)
+ {
+ throw new NotSupportedException ("Add operation is not supported.");
+ }
+
+ void IList.Clear ()
+ {
+ throw new NotSupportedException ("Clear operation is not supported.");
+ }
+
+ bool IList.Contains (object item)
+ {
+ return list.Contains (item);
+ }
+
+ int IList.IndexOf (object item)
+ {
+ return list.IndexOf (item);
+ }
+
+ void IList.Insert (int index, object value)
+ {
+ throw new NotSupportedException ("Insert operation is not supported.");
+ }
+
+ void IList.Remove (object value)
+ {
+ throw new NotSupportedException ("Remove operation is not supported.");
+ }
+
+ void IList.RemoveAt (int index)
+ {
+ throw new NotSupportedException ("RemoveAt operation is not supported.");
+ }
+
+ public int IndexOf (ListViewItem item)
+ {
+ return list.IndexOf (item);
+ }
+ #endregion // Public Methods
+
+ } // CheckedListViewItemCollection
+
+ public class ColumnHeaderCollection : IList, ICollection, IEnumerable
+ {
+ internal ArrayList list;
+ private ListView owner;
+
+ #region Public Constructor
+ public ColumnHeaderCollection (ListView owner)
+ {
+ list = new ArrayList ();
+ this.owner = owner;
+ }
+ #endregion // Public Constructor
+
+ #region Public Properties
+ [Browsable (false)]
+ public virtual int Count {
+ get { return list.Count; }
+ }
+
+ public virtual bool IsReadOnly {
+ get { return false; }
+ }
+
+ public virtual ColumnHeader this [int index] {
+ get {
+ if (index < 0 || index >= list.Count)
+ throw new ArgumentOutOfRangeException ("Index out of range.");
+ return (ColumnHeader) list [index];
+ }
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return true; }
+ }
+
+ object ICollection.SyncRoot {
+ get { return this; }
+ }
+
+ bool IList.IsFixedSize {
+ get { return list.IsFixedSize; }
+ }
+
+ object IList.this [int index] {
+ get { return this [index]; }
+ set { throw new NotSupportedException ("SetItem operation is not supported."); }
+ }
+ #endregion // Public Properties
+
+ #region Public Methods
+ public virtual int Add (ColumnHeader value)
+ {
+ int idx;
+ value.owner = this.owner;
+ idx = list.Add (value);
+ owner.Redraw (true);
+ return idx;
+ }
+
+ public virtual ColumnHeader Add (string str, int width, HorizontalAlignment textAlign)
+ {
+ ColumnHeader colHeader = new ColumnHeader (this.owner, str, textAlign, width);
+ this.Add (colHeader);
+ return colHeader;
+ }
+
+ public virtual void AddRange (ColumnHeader [] values)
+ {
+ foreach (ColumnHeader colHeader in values) {
+ colHeader.owner = this.owner;
+ Add (colHeader);
+ }
+
+ owner.Redraw (true);
+ }
+
+ public virtual void Clear ()
+ {
+ list.Clear ();
+ owner.Redraw (true);
+ }
+
+ public bool Contains (ColumnHeader value)
+ {
+ return list.Contains (value);
+ }
+
+ public virtual IEnumerator GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+
+ void ICollection.CopyTo (Array dest, int index)
+ {
+ list.CopyTo (dest, index);
+ }
+
+ int IList.Add (object value)
+ {
+ if (! (value is ColumnHeader)) {
+ throw new ArgumentException ("Not of type ColumnHeader", "value");
+ }
+
+ return this.Add ((ColumnHeader) value);
+ }
+
+ bool IList.Contains (object value)
+ {
+ if (! (value is ColumnHeader)) {
+ throw new ArgumentException ("Not of type ColumnHeader", "value");
+ }
+
+ return this.Contains ((ColumnHeader) value);
+ }
+
+ int IList.IndexOf (object value)
+ {
+ if (! (value is ColumnHeader)) {
+ throw new ArgumentException ("Not of type ColumnHeader", "value");
+ }
+
+ return this.IndexOf ((ColumnHeader) value);
+ }
+
+ void IList.Insert (int index, object value)
+ {
+ if (! (value is ColumnHeader)) {
+ throw new ArgumentException ("Not of type ColumnHeader", "value");
+ }
+
+ this.Insert (index, (ColumnHeader) value);
+ }
+
+ void IList.Remove (object value)
+ {
+ if (! (value is ColumnHeader)) {
+ throw new ArgumentException ("Not of type ColumnHeader", "value");
+ }
+
+ this.Remove ((ColumnHeader) value);
+ }
+
+ public int IndexOf (ColumnHeader value)
+ {
+ return list.IndexOf (value);
+ }
+
+ public void Insert (int index, ColumnHeader value)
+ {
+ // LAMESPEC: MSDOCS say greater than or equal to the value of the Count property
+ // but it's really only greater.
+ if (index < 0 || index > list.Count)
+ throw new ArgumentOutOfRangeException ("Index out of range.");
+
+ value.owner = this.owner;
+ list.Insert (index, value);
+ owner.Redraw (true);
+ }
+
+ public void Insert (int index, string str, int width, HorizontalAlignment textAlign)
+ {
+ ColumnHeader colHeader = new ColumnHeader (this.owner, str, textAlign, width);
+ this.Insert (index, colHeader);
+ }
+
+ public virtual void Remove (ColumnHeader column)
+ {
+ // TODO: Update Column internal index ?
+ list.Remove (column);
+ owner.Redraw (true);
+ }
+
+ public virtual void RemoveAt (int index)
+ {
+ if (index < 0 || index >= list.Count)
+ throw new ArgumentOutOfRangeException ("Index out of range.");
+
+ // TODO: Update Column internal index ?
+ list.RemoveAt (index);
+ owner.Redraw (true);
+ }
+ #endregion // Public Methods
+
+
+ } // ColumnHeaderCollection
+
+ public class ListViewItemCollection : IList, ICollection, IEnumerable
+ {
+ internal ArrayList list;
+ private ListView owner;
+
+ #region Public Constructor
+ public ListViewItemCollection (ListView owner)
+ {
+ list = new ArrayList ();
+ this.owner = owner;
+ }
+ #endregion // Public Constructor
+
+ #region Public Properties
+ [Browsable (false)]
+ public virtual int Count {
+ get { return list.Count; }
+ }
+
+ public virtual bool IsReadOnly {
+ get { return false; }
+ }
+
+ public virtual ListViewItem this [int displayIndex] {
+ get {
+ if (displayIndex < 0 || displayIndex >= list.Count)
+ throw new ArgumentOutOfRangeException ("Index out of range.");
+ return (ListViewItem) list [displayIndex];
+ }
+
+ set {
+ if (displayIndex < 0 || displayIndex >= list.Count)
+ throw new ArgumentOutOfRangeException ("Index out of range.");
+
+ if (list.Contains (value))
+ throw new ArgumentException ("An item cannot be added more than once. To add an item again, you need to clone it.", "value");
+
+ value.owner = this.owner;
+ list [displayIndex] = value;
+
+ owner.Redraw (true);
+ }
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return true; }
+ }
+
+ object ICollection.SyncRoot {
+ get { return this; }
+ }
+
+ bool IList.IsFixedSize {
+ get { return list.IsFixedSize; }
+ }
+
+ object IList.this [int index] {
+ get { return this [index]; }
+ set {
+ if (value is ListViewItem)
+ this [index] = (ListViewItem) value;
+ else
+ this [index] = new ListViewItem (value.ToString ());
+ }
+ }
+ #endregion // Public Properties
+
+ #region Public Methods
+ public virtual ListViewItem Add (ListViewItem value)
+ {
+ if (list.Contains (value))
+ throw new ArgumentException ("An item cannot be added more than once. To add an item again, you need to clone it.", "value");
+
+ value.owner = this.owner;
+ list.Add (value);
+
+ if (owner.Sorting != SortOrder.None)
+ owner.Sort ();
+
+ owner.Redraw (true);
+
+ return value;
+ }
+
+ public virtual ListViewItem Add (string text)
+ {
+ ListViewItem item = new ListViewItem (text);
+ return this.Add (item);
+ }
+
+ public virtual ListViewItem Add (string text, int imageIndex)
+ {
+ ListViewItem item = new ListViewItem (text, imageIndex);
+ return this.Add (item);
+ }
+
+ public void AddRange (ListViewItem [] values)
+ {
+ list.Clear ();
+ owner.SelectedItems.list.Clear ();
+ owner.SelectedIndices.list.Clear ();
+ owner.CheckedItems.list.Clear ();
+ owner.CheckedIndices.list.Clear ();
+
+ foreach (ListViewItem item in values) {
+ item.owner = this.owner;
+ list.Add (item);
+ }
+
+ if (owner.Sorting != SortOrder.None)
+ owner.Sort ();
+
+ owner.Redraw (true);
+ }
+
+ public virtual void Clear ()
+ {
+ owner.SetFocusedItem (null);
+ owner.h_scroll.Value = owner.v_scroll.Value = 0;
+ list.Clear ();
+ owner.SelectedItems.list.Clear ();
+ owner.SelectedIndices.list.Clear ();
+ owner.CheckedItems.list.Clear ();
+ owner.CheckedIndices.list.Clear ();
+ owner.Redraw (true);
+ }
+
+ public bool Contains (ListViewItem item)
+ {
+ return list.Contains (item);
+ }
+
+ public virtual void CopyTo (Array dest, int index)
+ {
+ list.CopyTo (dest, index);
+ }
+
+ public virtual IEnumerator GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+
+ int IList.Add (object item)
+ {
+ int result;
+ ListViewItem li;
+
+ if (item is ListViewItem) {
+ li = (ListViewItem) item;
+ if (list.Contains (li))
+ throw new ArgumentException ("An item cannot be added more than once. To add an item again, you need to clone it.", "item");
+ }
+ else
+ li = new ListViewItem (item.ToString ());
+
+ li.owner = this.owner;
+ result = list.Add (li);
+ owner.Redraw (true);
+
+ return result;
+ }
+
+ bool IList.Contains (object item)
+ {
+ return list.Contains (item);
+ }
+
+ int IList.IndexOf (object item)
+ {
+ return list.IndexOf (item);
+ }
+
+ void IList.Insert (int index, object item)
+ {
+ if (item is ListViewItem)
+ this.Insert (index, (ListViewItem) item);
+ else
+ this.Insert (index, item.ToString ());
+ }
+
+ void IList.Remove (object item)
+ {
+ Remove ((ListViewItem) item);
+ }
+
+ public int IndexOf (ListViewItem item)
+ {
+ return list.IndexOf (item);
+ }
+
+ public ListViewItem Insert (int index, ListViewItem item)
+ {
+ // LAMESPEC: MSDOCS say greater than or equal to the value of the Count property
+ // but it's really only greater.
+ if (index < 0 || index > list.Count)
+ throw new ArgumentOutOfRangeException ("Index out of range.");
+
+ if (list.Contains (item))
+ throw new ArgumentException ("An item cannot be added more than once. To add an item again, you need to clone it.", "item");
+
+ item.owner = this.owner;
+ list.Insert (index, item);
+ owner.Redraw (true);
+ return item;
+ }
+
+ public ListViewItem Insert (int index, string text)
+ {
+ return this.Insert (index, new ListViewItem (text));
+ }
+
+ public ListViewItem Insert (int index, string text, int imageIndex)
+ {
+ return this.Insert (index, new ListViewItem (text, imageIndex));
+ }
+
+ public virtual void Remove (ListViewItem item)
+ {
+ if (!list.Contains (item))
+ return;
+
+ owner.SelectedItems.list.Remove (item);
+ owner.SelectedIndices.list.Remove (item.Index);
+ owner.CheckedItems.list.Remove (item);
+ owner.CheckedIndices.list.Remove (item.Index);
+ list.Remove (item);
+ owner.Redraw (true);
+ }
+
+ public virtual void RemoveAt (int index)
+ {
+ if (index < 0 || index >= list.Count)
+ throw new ArgumentOutOfRangeException ("Index out of range.");
+
+ list.RemoveAt (index);
+ owner.SelectedItems.list.RemoveAt (index);
+ owner.SelectedIndices.list.RemoveAt (index);
+ owner.CheckedItems.list.RemoveAt (index);
+ owner.CheckedIndices.list.RemoveAt (index);
+ owner.Redraw (false);
+ }
+ #endregion // Public Methods
+
+ } // ListViewItemCollection
+
+ public class SelectedIndexCollection : IList, ICollection, IEnumerable
+ {
+ internal ArrayList list;
+ private ListView owner;
+
+ #region Public Constructor
+ public SelectedIndexCollection (ListView owner)
+ {
+ list = new ArrayList ();
+ this.owner = owner;
+ }
+ #endregion // Public Constructor
+
+ #region Public Properties
+ [Browsable (false)]
+ public virtual int Count {
+ get { return list.Count; }
+ }
+
+ public virtual bool IsReadOnly {
+ get { return true; }
+ }
+
+ public int this [int index] {
+ get {
+ if (index < 0 || index >= list.Count)
+ throw new ArgumentOutOfRangeException ("Index out of range.");
+ return (int) list [index];
+ }
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return list.IsSynchronized; }
+ }
+
+ object ICollection.SyncRoot {
+ get { return this; }
+ }
+
+ bool IList.IsFixedSize {
+ get { return true; }
+ }
+
+ object IList.this [int index] {
+ get { return this [index]; }
+ set { throw new NotSupportedException ("SetItem operation is not supported."); }
+ }
+ #endregion // Public Properties
+
+ #region Public Methods
+ public bool Contains (int selectedIndex)
+ {
+ return list.Contains (selectedIndex);
+ }
+
+ public virtual void CopyTo (Array dest, int index)
+ {
+ list.CopyTo (dest, index);
+ }
+
+ public virtual IEnumerator GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+
+ int IList.Add (object value)
+ {
+ throw new NotSupportedException ("Add operation is not supported.");
+ }
+
+ void IList.Clear ()
+ {
+ throw new NotSupportedException ("Clear operation is not supported.");
+ }
+
+ bool IList.Contains (object selectedIndex)
+ {
+ return list.Contains (selectedIndex);
+ }
+
+ int IList.IndexOf (object selectedIndex)
+ {
+ return list.IndexOf (selectedIndex);
+ }
+
+ void IList.Insert (int index, object value)
+ {
+ throw new NotSupportedException ("Insert operation is not supported.");
+ }
+
+ void IList.Remove (object value)
+ {
+ throw new NotSupportedException ("Remove operation is not supported.");
+ }
+
+ void IList.RemoveAt (int index)
+ {
+ throw new NotSupportedException ("RemoveAt operation is not supported.");
+ }
+
+ public int IndexOf (int selectedIndex)
+ {
+ return list.IndexOf (selectedIndex);
+ }
+ #endregion // Public Methods
+
+ } // SelectedIndexCollection
+
+ public class SelectedListViewItemCollection : IList, ICollection, IEnumerable
+ {
+ internal ArrayList list;
+ private ListView owner;
+
+ #region Public Constructor
+ public SelectedListViewItemCollection (ListView owner)
+ {
+ list = new ArrayList ();
+ this.owner = owner;
+ }
+ #endregion // Public Constructor
+
+ #region Public Properties
+ [Browsable (false)]
+ public virtual int Count {
+ get { return list.Count; }
+ }
+
+ public virtual bool IsReadOnly {
+ get { return true; }
+ }
+
+ public ListViewItem this [int index] {
+ get {
+ if (index < 0 || index >= list.Count)
+ throw new ArgumentOutOfRangeException ("Index out of range.");
+ return (ListViewItem) list [index];
+ }
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return list.IsSynchronized; }
+ }
+
+ object ICollection.SyncRoot {
+ get { return this; }
+ }
+
+ bool IList.IsFixedSize {
+ get { return true; }
+ }
+
+ object IList.this [int index] {
+ get { return this [index]; }
+ set { throw new NotSupportedException ("SetItem operation is not supported."); }
+ }
+ #endregion // Public Properties
+
+ #region Public Methods
+ public virtual void Clear ()
+ {
+ // mark the items as unselected before clearing the list
+ for (int i = 0; i < list.Count; i++)
+ ((ListViewItem) list [i]).selected = false;
+
+ list.Clear ();
+
+ if (owner != null)
+ owner.Invalidate ();
+ }
+
+ public bool Contains (ListViewItem item)
+ {
+ return list.Contains (item);
+ }
+
+ public virtual void CopyTo (Array dest, int index)
+ {
+ list.CopyTo (dest, index);
+ }
+
+ public virtual IEnumerator GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+
+ int IList.Add (object value)
+ {
+ throw new NotSupportedException ("Add operation is not supported.");
+ }
+
+ bool IList.Contains (object item)
+ {
+ return list.Contains (item);
+ }
+
+ int IList.IndexOf (object item)
+ {
+ return list.IndexOf (item);
+ }
+
+ void IList.Insert (int index, object value)
+ {
+ throw new NotSupportedException ("Insert operation is not supported.");
+ }
+
+ void IList.Remove (object value)
+ {
+ throw new NotSupportedException ("Remove operation is not supported.");
+ }
+
+ void IList.RemoveAt (int index)
+ {
+ throw new NotSupportedException ("RemoveAt operation is not supported.");
+ }
+
+ public int IndexOf (ListViewItem item)
+ {
+ return list.IndexOf (item);
+ }
+ #endregion // Public Methods
+
+ } // SelectedListViewItemCollection
+
+ #endregion // Subclasses
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListViewAlignment.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListViewAlignment.cs
new file mode 100644
index 00000000000..953877b8226
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListViewAlignment.cs
@@ -0,0 +1,37 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Ravindra (rkumar@novell.com)
+//
+
+
+namespace System.Windows.Forms
+{
+ [Serializable]
+ public enum ListViewAlignment
+ {
+ Default = 0,
+ Left = 1,
+ Top = 2,
+ SnapToGrid = 5
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListViewItem.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListViewItem.cs
new file mode 100644
index 00000000000..dc223d13aef
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListViewItem.cs
@@ -0,0 +1,899 @@
+// 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 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Ravindra (rkumar@novell.com)
+//
+// Todo:
+// - Drawing of focus rectangle
+
+
+
+// NOT COMPLETE
+
+
+using System.Collections;
+using System.ComponentModel;
+using System.Drawing;
+using System.Runtime.Serialization;
+
+namespace System.Windows.Forms
+{
+ [DefaultProperty ("Text")]
+ [DesignTimeVisible (false)]
+ [Serializable]
+ [ToolboxItem (false)]
+ [TypeConverter (typeof (ListViewItemConverter))]
+ public class ListViewItem : ICloneable, ISerializable
+ {
+ #region Instance Variables
+ private int image_index = -1;
+ private bool is_checked = false;
+ private bool is_focused = false;
+ private int state_image_index = -1;
+ private ListViewSubItemCollection sub_items;
+ private object tag;
+ private bool use_item_style = true;
+
+ // internal variables
+ internal Rectangle checkbox_rect; // calculated by CalcListViewItem method
+ internal Rectangle entire_rect;
+ internal Rectangle icon_rect;
+ internal Rectangle item_rect;
+ internal Rectangle label_rect;
+ internal Point location = Point.Empty; // set by the ListView control
+ internal ListView owner;
+ internal bool selected;
+
+ #endregion Instance Variables
+
+ #region Public Constructors
+ public ListViewItem ()
+ {
+ this.sub_items = new ListViewSubItemCollection (this);
+ this.sub_items.Add ("");
+ }
+
+ public ListViewItem (string text) : this (text, -1)
+ {
+ }
+
+ public ListViewItem (string [] items) : this (items, -1)
+ {
+ }
+
+ public ListViewItem (ListViewItem.ListViewSubItem [] subItems, int imageIndex)
+ {
+ this.sub_items = new ListViewSubItemCollection (this);
+ this.sub_items.AddRange (subItems);
+ this.image_index = imageIndex;
+ }
+
+ public ListViewItem (string text, int imageIndex)
+ {
+ this.image_index = imageIndex;
+ this.sub_items = new ListViewSubItemCollection (this);
+ this.sub_items.Add (text);
+ }
+
+ public ListViewItem (string [] items, int imageIndex)
+ {
+ this.sub_items = new ListViewSubItemCollection (this);
+ this.sub_items.AddRange (items);
+ this.image_index = imageIndex;
+ }
+
+ public ListViewItem (string [] items, int imageIndex, Color foreColor,
+ Color backColor, Font font)
+ {
+ this.sub_items = new ListViewSubItemCollection (this);
+ this.sub_items.AddRange (items);
+ this.image_index = imageIndex;
+ ForeColor = foreColor;
+ BackColor = backColor;
+ Font = font;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public Color BackColor {
+ get {
+ if (sub_items.Count > 0)
+ return sub_items[0].BackColor;
+
+ if (owner != null)
+ return owner.BackColor;
+
+ return ThemeEngine.Current.ColorWindow;
+ }
+
+ set { sub_items[0].BackColor = value; }
+ }
+
+ [Browsable (false)]
+ public Rectangle Bounds {
+ get {
+ return GetBounds (ItemBoundsPortion.Entire);
+ }
+ }
+
+ [DefaultValue (false)]
+ [RefreshProperties (RefreshProperties.Repaint)]
+ public bool Checked {
+ get { return is_checked; }
+ set {
+ if (is_checked == value)
+ return;
+
+ if (owner != null) {
+ is_checked = value;
+ if (is_checked) {
+ if (owner.CheckedItems.Contains (this) == false) {
+ owner.CheckedItems.list.Add (this);
+ owner.CheckedIndices.list.Add (this.Index);
+ }
+ }
+ else {
+ owner.CheckedItems.list.Remove (this);
+ owner.CheckedIndices.list.Remove (this.Index);
+ }
+
+ owner.Invalidate (Bounds);
+ }
+ }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public bool Focused {
+ get { return is_focused; }
+ set {
+ if (is_focused == value)
+ return;
+
+ is_focused = value;
+
+ if (owner != null)
+ owner.Invalidate (Bounds);
+ }
+ }
+
+ [Localizable (true)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public Font Font {
+ get {
+ if (sub_items.Count > 0)
+ return sub_items[0].Font;
+
+ if (owner != null)
+ return owner.Font;
+
+ return ThemeEngine.Current.DefaultFont;
+ }
+ set {
+ if (sub_items[0].Font == value)
+ return;
+
+ sub_items[0].Font = value;
+
+ if (owner != null)
+ owner.Invalidate (Bounds);
+ }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public Color ForeColor {
+ get {
+ if (sub_items.Count > 0)
+ return sub_items[0].ForeColor;
+
+ if (owner != null)
+ return owner.ForeColor;
+
+ return ThemeEngine.Current.ColorWindowText;
+ }
+ set { sub_items[0].ForeColor = value; }
+ }
+
+ [DefaultValue (-1)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [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 ("Invalid ImageIndex. It must be greater than or equal to -1.");
+
+ image_index = value;
+
+ if (owner != null)
+ owner.Invalidate (Bounds);
+ }
+ }
+
+ [Browsable (false)]
+ public ImageList ImageList {
+ get {
+ if (owner == null)
+ return null;
+ else if (owner.View == View.LargeIcon)
+ return owner.large_image_list;
+ else
+ return owner.small_image_list;
+ }
+ }
+
+ [Browsable (false)]
+ public int Index {
+ get {
+ if (owner == null)
+ return -1;
+ else
+ return owner.Items.IndexOf (this);
+ }
+ }
+
+ [Browsable (false)]
+ public ListView ListView {
+ get { return owner; }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public bool Selected {
+ get { return selected; }
+ set {
+ if (owner != null) {
+ if (owner.CanMultiselect == false &&
+ owner.SelectedItems.Count > 0) {
+ owner.SelectedItems.Clear ();
+ owner.SelectedIndices.list.Clear ();
+ }
+
+ selected = value;
+ if (selected) {
+ if (owner.SelectedItems.Contains (this) == false) {
+ owner.SelectedItems.list.Add (this);
+ owner.SelectedIndices.list.Add (this.Index);
+ }
+ }
+ else {
+ owner.SelectedItems.list.Remove (this);
+ owner.SelectedIndices.list.Remove (this.Index);
+ }
+
+ owner.Invalidate (Bounds);
+ }
+ }
+ }
+
+ [DefaultValue (-1)]
+ [Editor ("System.Windows.Forms.Design.ImageIndexEditor, " + Consts.AssemblySystem_Design,
+ typeof (System.Drawing.Design.UITypeEditor))]
+ [Localizable (true)]
+ [TypeConverter (typeof (ImageIndexConverter))]
+ public int StateImageIndex {
+ get { return state_image_index; }
+ set {
+ if (value < -1 || value > 14)
+ throw new ArgumentOutOfRangeException ("Invalid StateImageIndex. It must be in the range of [-1, 14].");
+
+ state_image_index = value;
+ }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public ListViewSubItemCollection SubItems {
+ get { return sub_items; }
+ }
+
+ [Bindable (true)]
+ [DefaultValue (null)]
+ [Localizable (false)]
+ [TypeConverter (typeof (StringConverter))]
+ public object Tag {
+ get { return tag; }
+ set { tag = value; }
+ }
+
+ [Localizable (true)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public string Text {
+ get {
+ if (this.sub_items.Count > 0)
+ return this.sub_items [0].Text;
+ else
+ return "";
+ }
+ set { this.sub_items [0].Text = value; }
+ }
+
+ [DefaultValue (true)]
+ public bool UseItemStyleForSubItems {
+ get { return use_item_style; }
+ set { use_item_style = value; }
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Instance Methods
+ public void BeginEdit ()
+ {
+ // FIXME: TODO
+ // if (owner != null && owner.LabelEdit
+ // && owner.Activation == ItemActivation.Standard)
+ // allow editing
+ // else
+ // throw new InvalidOperationException ();
+ }
+
+ public virtual object Clone ()
+ {
+ ListViewItem clone = new ListViewItem ();
+ clone.image_index = this.image_index;
+ clone.is_checked = this.is_checked;
+ clone.is_focused = this.is_focused;
+ clone.selected = this.selected;
+ clone.state_image_index = this.state_image_index;
+ clone.sub_items = new ListViewSubItemCollection (this);
+
+ foreach (ListViewSubItem subItem in this.sub_items)
+ clone.sub_items.Add (subItem.Text, subItem.ForeColor,
+ subItem.BackColor, subItem.Font);
+ clone.tag = this.tag;
+ clone.use_item_style = this.use_item_style;
+ clone.owner = null;
+
+ return clone;
+ }
+
+ public virtual void EnsureVisible ()
+ {
+ if (this.owner != null) {
+ owner.EnsureVisible (owner.Items.IndexOf (this));
+ }
+ }
+
+ public Rectangle GetBounds (ItemBoundsPortion portion)
+ {
+ if (owner == null)
+ return Rectangle.Empty;
+
+ /* Original Ravi's design calculated all items in a virtual space
+ We convert them real screen positions
+ */
+ switch (portion) {
+
+ case ItemBoundsPortion.Icon: {
+ Rectangle rect = icon_rect;
+ rect.X -= owner.h_marker;
+ rect.Y -= owner.v_marker;
+ return rect;
+ }
+
+ case ItemBoundsPortion.Label: {
+ Rectangle rect = label_rect;
+ rect.X -= owner.h_marker;
+ rect.Y -= owner.v_marker;
+ return rect;
+ }
+
+ case ItemBoundsPortion.ItemOnly: {
+ Rectangle rect = item_rect;
+ rect.X -= owner.h_marker;
+ rect.Y -= owner.v_marker;
+ return rect;
+ }
+
+ case ItemBoundsPortion.Entire: {
+ Rectangle rect = entire_rect;
+ rect.X -= owner.h_marker;
+ rect.Y -= owner.v_marker;
+ return rect;
+ }
+
+ default:
+ throw new ArgumentException ("Invalid value for portion.");
+ }
+ }
+
+ void ISerializable.GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ // FIXME: TODO
+ }
+
+ public virtual void Remove ()
+ {
+ if (owner != null)
+ owner.Items.Remove (this);
+ owner = null;
+ }
+
+ public override string ToString ()
+ {
+ return string.Format ("ListViewItem: {0}", this.Text);
+ }
+ #endregion // Public Instance Methods
+
+ #region Protected Methods
+ protected virtual void Deserialize (SerializationInfo info, StreamingContext context)
+ {
+ // FIXME: TODO
+ }
+
+ protected virtual void Serialize (SerializationInfo info, StreamingContext context)
+ {
+ // FIXME: TODO
+ }
+ #endregion // Protected Methods
+
+ #region Private Internal Methods
+ internal Rectangle CheckRectReal {
+ get {
+ Rectangle rect = checkbox_rect;
+ rect.X -= owner.h_marker;
+ rect.Y -= owner.v_marker;
+ return rect;
+ }
+ }
+
+ internal Rectangle CheckRect {
+ get { return this.checkbox_rect; }
+ }
+
+ internal Rectangle EntireRect {
+ get { return this.entire_rect; }
+ }
+
+ internal Rectangle IconRect {
+ get { return this.icon_rect; }
+ }
+
+ internal Rectangle LabelRect {
+ get { return this.label_rect; }
+ }
+
+ internal void CalcListViewItem ()
+ {
+ int item_ht;
+ Size text_size = owner.text_size;
+
+ if (owner.CheckBoxes)
+ checkbox_rect.Size = owner.CheckBoxSize;
+ else
+ checkbox_rect = Rectangle.Empty;
+
+ checkbox_rect.Location = this.location;
+
+ switch (owner.View) {
+
+ case View.Details:
+ // LAMESPEC: MSDN says, "In all views except the details
+ // view of the ListView, this value specifies the same
+ // bounding rectangle as the Entire value." Actually, it
+ // returns same bounding rectangles for Item and Entire
+ // values in the case of Details view.
+
+ icon_rect.X = checkbox_rect.X + checkbox_rect.Width + 2;
+ icon_rect.Y = checkbox_rect.Y;
+
+ item_ht = Math.Max (owner.CheckBoxSize.Height + 1,
+ text_size.Height);
+
+ if (owner.SmallImageList != null) {
+ item_ht = Math.Max (item_ht,
+ owner.SmallImageList.ImageSize.Height + 1);
+ icon_rect.Width = owner.SmallImageList.ImageSize.Width;
+ }
+ else
+ icon_rect.Width = 0;
+
+ label_rect.Height = checkbox_rect.Height = icon_rect.Height = item_ht;
+
+ label_rect.X = icon_rect.X + icon_rect.Width;
+ label_rect.Y = icon_rect.Y;
+
+ if (owner.Columns.Count > 0)
+ label_rect.Width = Math.Max (text_size.Width, owner.Columns[0].Wd);
+ else
+ label_rect.Width = text_size.Width;
+
+ item_rect = entire_rect = Rectangle.Union
+ (Rectangle.Union (checkbox_rect, icon_rect), label_rect);
+
+ // Take into account the rest of columns. First column
+ // is already taken into account above.
+ for (int i = 1; i < owner.Columns.Count; i++) {
+ item_rect.Width += owner.Columns [i].Wd;
+ entire_rect.Width += owner.Columns [i].Wd;
+ }
+ break;
+
+ case View.LargeIcon:
+ if (owner.LargeImageList != null) {
+ icon_rect.Width = owner.LargeImageList.ImageSize.Width + 16;
+ icon_rect.Height = owner.LargeImageList.ImageSize.Height + 4;
+ }
+ else {
+ icon_rect.Width = 16;
+ icon_rect.Height = 4;
+ }
+
+ if (text_size.Width <= (checkbox_rect.Width + icon_rect.Width)) {
+ icon_rect.X = checkbox_rect.X + checkbox_rect.Width;
+ icon_rect.Y = checkbox_rect.Y;
+
+ label_rect.X = icon_rect.X + (icon_rect.Width
+ - text_size.Width) / 2;
+ label_rect.Y = Math.Max (checkbox_rect.Bottom,
+ icon_rect.Bottom) + 2;
+ label_rect.Size = text_size;
+ }
+ else {
+ label_rect.X = this.location.X;
+
+ int centerX = label_rect.X + text_size.Width / 2;
+ icon_rect.X = centerX - icon_rect.Width / 2;
+ checkbox_rect.X = (icon_rect.X - checkbox_rect.Width);
+
+ icon_rect.Y = checkbox_rect.Y;
+
+ label_rect.Y = Math.Max (checkbox_rect.Bottom,
+ icon_rect.Bottom) + 2;
+ label_rect.Size = text_size;
+ }
+
+ item_rect = Rectangle.Union (icon_rect, label_rect);
+ entire_rect = Rectangle.Union (item_rect, checkbox_rect);
+ break;
+
+ case View.List:
+ goto case View.SmallIcon;
+
+ case View.SmallIcon:
+ icon_rect.X = checkbox_rect.X + checkbox_rect.Width;
+ icon_rect.Y = checkbox_rect.Y;
+
+ item_ht = Math.Max (owner.CheckBoxSize.Height, text_size.Height);
+
+ if (owner.SmallImageList != null) {
+ item_ht = Math.Max (item_ht,
+ owner.SmallImageList.ImageSize.Height + 1);
+ icon_rect.Width = owner.SmallImageList.ImageSize.Width;
+ }
+ else
+ icon_rect.Width = 0;
+
+ label_rect.Height = checkbox_rect.Height = icon_rect.Height = item_ht;
+
+ label_rect.X = icon_rect.X + icon_rect.Width;
+ label_rect.Y = icon_rect.Y;
+ label_rect.Width = text_size.Width;
+
+ item_rect = Rectangle.Union (icon_rect, label_rect);
+ entire_rect = Rectangle.Union (item_rect, checkbox_rect);
+ break;
+ }
+
+ }
+ #endregion // Private Internal Methods
+
+ #region Subclasses
+
+ [DefaultProperty ("Text")]
+ [DesignTimeVisible (false)]
+ [Serializable]
+ [ToolboxItem (false)]
+ [TypeConverter (typeof(ListViewSubItemConverter))]
+ public class ListViewSubItem
+ {
+ private Color back_color;
+ private Font font;
+ private Color fore_color;
+ internal ListViewItem owner;
+ private string text;
+
+ #region Public Constructors
+ public ListViewSubItem ()
+ {
+ }
+
+ public ListViewSubItem (ListViewItem owner, string text)
+ : this (owner, text, ThemeEngine.Current.ColorWindowText,
+ ThemeEngine.Current.ColorWindow,
+ ThemeEngine.Current.DefaultFont)
+ {
+ }
+
+ public ListViewSubItem (ListViewItem owner, string text, Color foreColor,
+ Color backColor, Font font)
+ {
+ this.owner = owner;
+ this.text = text;
+ this.fore_color = foreColor;
+ this.back_color = backColor;
+ this.font = font;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public Color BackColor {
+ get { return back_color; }
+ set {
+ back_color = value;
+ Invalidate ();
+ }
+ }
+
+ [Localizable (true)]
+ public Font Font {
+ get {
+ if (font != null)
+ return font;
+ else if (owner != null)
+ return owner.Font;
+ return font;
+ }
+ set {
+ font = value;
+ Invalidate ();
+ }
+ }
+
+ public Color ForeColor {
+ get { return fore_color; }
+ set {
+ fore_color = value;
+ Invalidate ();
+ }
+ }
+
+ [Localizable (true)]
+ public string Text {
+ get { return text; }
+ set {
+ text = value;
+ Invalidate ();
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Methods
+ public void ResetStyle ()
+ {
+ font = ThemeEngine.Current.DefaultFont;
+ back_color = ThemeEngine.Current.DefaultControlBackColor;
+ fore_color = ThemeEngine.Current.DefaultControlForeColor;
+ Invalidate ();
+ }
+
+ public override string ToString ()
+ {
+ return string.Format ("ListViewSubItem {{0}}", text);
+ }
+ #endregion // Public Methods
+
+
+ #region Private Methods
+ private void Invalidate ()
+ {
+ if (owner == null || owner.owner == null)
+ return;
+
+ owner.owner.Invalidate ();
+ }
+ #endregion // Private Methods
+ }
+
+ public class ListViewSubItemCollection : IList, ICollection, IEnumerable
+ {
+ private ArrayList list;
+ internal ListViewItem owner;
+
+ #region Public Constructors
+ public ListViewSubItemCollection (ListViewItem owner)
+ {
+ this.owner = owner;
+ this.list = new ArrayList ();
+ }
+ #endregion // Public Constructors
+
+ #region Public Properties
+ [Browsable (false)]
+ public virtual int Count {
+ get { return list.Count; }
+ }
+
+ public virtual bool IsReadOnly {
+ get { return false; }
+ }
+
+ public ListViewSubItem this [int index] {
+ get { return (ListViewSubItem) list [index]; }
+ set {
+ value.owner = this.owner;
+ list [index] = value;
+ }
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return list.IsSynchronized; }
+ }
+
+ object ICollection.SyncRoot {
+ get { return list.SyncRoot; }
+ }
+
+ bool IList.IsFixedSize {
+ get { return list.IsFixedSize; }
+ }
+
+ object IList.this [int index] {
+ get { return this [index]; }
+ set {
+ if (! (value is ListViewSubItem))
+ throw new ArgumentException ("Not of type ListViewSubItem", "value");
+ this [index] = (ListViewSubItem) value;
+ }
+ }
+ #endregion // Public Properties
+
+ #region Public Methods
+ public ListViewSubItem Add (ListViewSubItem item)
+ {
+ item.owner = this.owner;
+ list.Add (item);
+ return item;
+ }
+
+ public ListViewSubItem Add (string text)
+ {
+ ListViewSubItem item = new ListViewSubItem (this.owner, text);
+ list.Add (item);
+ return item;
+ }
+
+ public ListViewSubItem Add (string text, Color foreColor,
+ Color backColor, Font font)
+ {
+ ListViewSubItem item = new ListViewSubItem (this.owner, text,
+ foreColor, backColor, font);
+ list.Add (item);
+ return item;
+ }
+
+ public void AddRange (ListViewSubItem [] items)
+ {
+ this.Clear ();
+ foreach (ListViewSubItem item in items)
+ this.Add (item);
+ }
+
+ public void AddRange (string [] items)
+ {
+ this.Clear ();
+ foreach (string item in items)
+ this.Add (item);
+ }
+
+ public void AddRange (string [] items, Color foreColor,
+ Color backColor, Font font)
+ {
+ this.Clear ();
+ foreach (string item in items)
+ this.Add (item, foreColor, backColor, font);
+ }
+
+ public virtual void Clear ()
+ {
+ list.Clear ();
+ }
+
+ public bool Contains (ListViewSubItem item)
+ {
+ return list.Contains (item);
+ }
+
+ public virtual IEnumerator GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+
+ void ICollection.CopyTo (Array dest, int index)
+ {
+ list.CopyTo (dest, index);
+ }
+
+ int IList.Add (object item)
+ {
+ if (! (item is ListViewSubItem)) {
+ throw new ArgumentException ("Not of type ListViewSubItem", "item");
+ }
+
+ ListViewSubItem sub_item = (ListViewSubItem) item;
+ sub_item.owner = this.owner;
+ return list.Add (sub_item);
+ }
+
+ bool IList.Contains (object subItem)
+ {
+ if (! (subItem is ListViewSubItem)) {
+ throw new ArgumentException ("Not of type ListViewSubItem", "subItem");
+ }
+
+ return this.Contains ((ListViewSubItem) subItem);
+ }
+
+ int IList.IndexOf (object subItem)
+ {
+ if (! (subItem is ListViewSubItem)) {
+ throw new ArgumentException ("Not of type ListViewSubItem", "subItem");
+ }
+
+ return this.IndexOf ((ListViewSubItem) subItem);
+ }
+
+ void IList.Insert (int index, object item)
+ {
+ if (! (item is ListViewSubItem)) {
+ throw new ArgumentException ("Not of type ListViewSubItem", "item");
+ }
+
+ this.Insert (index, (ListViewSubItem) item);
+ }
+
+ void IList.Remove (object item)
+ {
+ if (! (item is ListViewSubItem)) {
+ throw new ArgumentException ("Not of type ListViewSubItem", "item");
+ }
+
+ this.Remove ((ListViewSubItem) item);
+ }
+
+ public int IndexOf (ListViewSubItem subItem)
+ {
+ return list.IndexOf (subItem);
+ }
+
+ public void Insert (int index, ListViewSubItem item)
+ {
+ item.owner = this.owner;
+ list.Insert (index, item);
+ }
+
+ public void Remove (ListViewSubItem item)
+ {
+ list.Remove (item);
+ }
+
+ public virtual void RemoveAt (int index)
+ {
+ list.RemoveAt (index);
+ }
+ #endregion // Public Methods
+ }
+ #endregion // Subclasses
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListViewItemConverter.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListViewItemConverter.cs
new file mode 100644
index 00000000000..53975c93fa0
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListViewItemConverter.cs
@@ -0,0 +1,97 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Ravindra (rkumar@novell.com)
+
+
+// COMPLETE
+
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.ComponentModel.Design.Serialization;
+using System.Drawing;
+using System.Globalization;
+using System.Reflection;
+
+namespace System.Windows.Forms
+{
+ public class ListViewItemConverter : ExpandableObjectConverter
+ {
+ #region Public Constructors
+ public ListViewItemConverter () { }
+ #endregion // Public Constructors
+
+ #region Public Instance Methods
+ public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType) {
+ if (destinationType == typeof (string)) {
+ return true;
+ }
+
+ return base.CanConvertTo (context, destinationType);
+ }
+
+ public override object ConvertTo (ITypeDescriptorContext context,
+ CultureInfo culture, object value,
+ Type destinationType)
+ {
+ if (destinationType == typeof (string)) {
+ return value.ToString ();
+ } else {
+ return base.ConvertTo (context, culture, value, destinationType);
+ }
+ }
+ #endregion // Public Instance Methods
+ }
+
+ internal class ListViewSubItemConverter : ExpandableObjectConverter {
+ #region Public Instance Methods
+ public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType) {
+ if (destinationType == typeof(InstanceDescriptor)) {
+ return true;
+ } else {
+ return base.CanConvertTo(context, destinationType);
+ }
+ }
+
+ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) {
+ if (destinationType == typeof(InstanceDescriptor) && value is ListViewItem.ListViewSubItem) {
+ ConstructorInfo constructor_info;
+ Type[] type;
+ ListViewItem.ListViewSubItem sub_item;
+
+ sub_item = (ListViewItem.ListViewSubItem)value;
+ type = new Type[] { typeof(ListViewItem), typeof(string), typeof(Color), typeof(Color), typeof(Font)};
+
+ constructor_info = typeof(ListViewItem.ListViewSubItem).GetConstructor(type);
+ if (constructor_info != null) {
+ object[] arguments = new object[] {sub_item.Text, sub_item.ForeColor, sub_item.BackColor, sub_item.Font};
+ return new InstanceDescriptor(constructor_info, (ICollection) arguments, true);
+ }
+
+ }
+ return base.ConvertTo(context, culture, value, destinationType);
+ }
+ #endregion // Public Instance Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MWFCategoryAttribute.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MWFCategoryAttribute.cs
new file mode 100644
index 00000000000..56afff3f818
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MWFCategoryAttribute.cs
@@ -0,0 +1,50 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+using System.ComponentModel;
+using System.Windows.Forms;
+
+namespace System {
+ [AttributeUsage (AttributeTargets.All, AllowMultiple=false)]
+ internal sealed class MWFCategoryAttribute : System.ComponentModel.CategoryAttribute {
+ #region Constructors
+ public MWFCategoryAttribute() : base() {
+ }
+
+ public MWFCategoryAttribute(string category) : base(category) {
+ }
+ #endregion // Constructors
+
+ #region Methods
+ protected override string GetLocalizedString(string value) {
+ return Locale.GetText(value);
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MWFDescriptionAttribute.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MWFDescriptionAttribute.cs
new file mode 100644
index 00000000000..c7555332d9f
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MWFDescriptionAttribute.cs
@@ -0,0 +1,51 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+using System.ComponentModel;
+using System.Windows.Forms;
+
+namespace System {
+ [AttributeUsage (AttributeTargets.All, AllowMultiple=false)]
+ internal sealed class MWFDescriptionAttribute : System.ComponentModel.DescriptionAttribute {
+ #region Constructors
+ public MWFDescriptionAttribute() : base() {
+ }
+
+ public MWFDescriptionAttribute(string category) : base(category) {
+ }
+ #endregion // Constructors
+
+ #region Properties
+ public override string Description {
+ get {
+ return Locale.GetText(base.Description);
+ }
+ }
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MainMenu.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MainMenu.cs
new file mode 100644
index 00000000000..52ce918644e
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MainMenu.cs
@@ -0,0 +1,143 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+//
+
+// COMPLETE
+
+using System.ComponentModel;
+using System.Drawing;
+
+namespace System.Windows.Forms
+{
+ [ToolboxItemFilter("System.Windows.Forms.MainMenu", ToolboxItemFilterType.Allow)]
+ public class MainMenu : Menu
+ {
+ private RightToLeft right_to_left = RightToLeft.Inherit;
+ private Form form = null;
+
+ public MainMenu () : base (null)
+ {
+
+ }
+
+ public MainMenu (MenuItem[] items) : base (items)
+ {
+
+ }
+
+ #region Public Properties
+ [Localizable(true)]
+ public virtual RightToLeft RightToLeft {
+ get { return right_to_left;}
+ set { right_to_left = value; }
+ }
+
+ #endregion Public Properties
+
+ #region Public Methods
+
+ public virtual MainMenu CloneMenu ()
+ {
+ MainMenu new_menu = new MainMenu ();
+ new_menu.CloneMenu (this);
+ return new_menu;
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ base.Dispose (disposing);
+ }
+
+ public Form GetForm ()
+ {
+ return form;
+ }
+
+ public override string ToString ()
+ {
+ return base.ToString () + ", GetForm: " + form;
+ }
+
+ #endregion Public Methods
+
+ #region Private Methods
+
+ internal void Draw ()
+ {
+ Draw (Rect);
+ }
+
+ internal void Draw (Rectangle rect)
+ {
+ Graphics g;
+
+ if (Wnd.window.Handle == IntPtr.Zero)
+ return;
+
+ X = rect.X;
+ Y = rect.Y;
+ Height = Rect.Height;
+
+ g = XplatUI.GetMenuDC(Wnd.window.Handle, IntPtr.Zero);
+ ThemeEngine.Current.DrawMenuBar (g, this, rect);
+ XplatUI.ReleaseMenuDC(Wnd.window.Handle, g);
+ }
+
+ internal void SetForm (Form form)
+ {
+ this.form = form;
+ Wnd = form;
+
+ if (tracker == null)
+ tracker = new MenuTracker (this);
+ }
+
+ internal override void OnMenuChanged (EventArgs e)
+ {
+ base.OnMenuChanged (EventArgs.Empty);
+ if (form == null)
+ return;
+
+ Height = 0;
+ Draw ();
+ }
+
+ /* Mouse events from the form */
+ internal void OnMouseDown (object window, MouseEventArgs args)
+ {
+ tracker.OnClick (args);
+ }
+
+ internal void OnMouseMove (object window, MouseEventArgs e)
+ {
+ MouseEventArgs args = new MouseEventArgs (e.Button, e.Clicks, Control.MousePosition.X, Control.MousePosition.Y, e.Delta);
+ tracker.OnMotion (args);
+ }
+
+ #endregion Private Methods
+ }
+}
+
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiChildContext.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiChildContext.cs
new file mode 100644
index 00000000000..39bd6a8e2f5
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiChildContext.cs
@@ -0,0 +1,691 @@
+using System;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+
+namespace System.Windows.Forms {
+
+ internal class MdiChildContext {
+
+ private static readonly int MdiBorderStyle = 0xFFFF;
+ private static Color titlebar_color;
+
+
+ private MainMenu merged_menu;
+ private int BorderWidth = 3;
+// private int TitleBarHeight = 26;
+// private int ToolTitleBarHeight = 19;
+ private Size MinTitleBarSize = new Size (115, 25);
+
+ private Form form;
+ private MdiClient mdi_container;
+
+ private TitleButton close_button;
+ private TitleButton maximize_button;
+ private TitleButton minimize_button;
+
+ private TitleButton [] title_buttons = new TitleButton [3];
+
+ // moving windows
+ private Point start;
+ private State state;
+ private FormPos sizing_edge;
+ private Rectangle virtual_position;
+ private Rectangle prev_virtual_position;
+ private Rectangle prev_bounds;
+ private bool maximized;
+
+ private class TitleButton {
+ public Rectangle Rectangle;
+ public ButtonState State;
+ public CaptionButton Caption;
+ public EventHandler Clicked;
+
+ public TitleButton (CaptionButton caption, EventHandler clicked)
+ {
+ Caption = caption;
+ Clicked = clicked;
+ }
+ }
+
+ private enum State {
+ Idle,
+ Moving,
+ Sizing,
+ }
+
+ [Flags]
+ private enum FormPos {
+ None,
+
+ TitleBar = 1,
+
+ Top = 2,
+ Left = 4,
+ Right = 8,
+ Bottom = 16,
+
+ TopLeft = Top | Left,
+ TopRight = Top | Right,
+
+ BottomLeft = Bottom | Left,
+ BottomRight = Bottom | Right,
+
+ AnyEdge = Top | Left | Right | Bottom,
+ }
+
+ public MdiChildContext (Form form, MdiClient mdi_container)
+ {
+ titlebar_color = Color.FromArgb (255, 0, 0, 255);
+ this.form = form;
+ this.mdi_container = mdi_container;
+
+ /*
+ minimize_button = new Button ();
+ minimize_button.Bounds = new Rectangle (form.Width - 62,
+ -26, 18, 22);
+ minimize_button.Anchor = AnchorStyles.Top | AnchorStyles.Right;
+ minimize_button.Paint += new PaintEventHandler (PaintButtonHandler);
+ minimize_button.Click += new EventHandler (OnMinimizeHandler);
+
+ maximize_button = new Button ();
+ maximize_button.Bounds = new Rectangle (form.Width - 44,
+ BorderWidth + 2, 18, 22);
+ maximize_button.Anchor = AnchorStyles.Top | AnchorStyles.Right;
+ maximize_button.Paint += new PaintEventHandler (PaintButtonHandler);
+ maximize_button.Click += new EventHandler (OnMaximizeHandler);
+
+ close_button = new Button ();
+ close_button.Bounds = new Rectangle (form.Width - 24,
+ BorderWidth + 2, 18, 22);
+ close_button.Anchor = AnchorStyles.Top | AnchorStyles.Right;
+ close_button.Paint += new PaintEventHandler (PaintButtonHandler);
+ close_button.Click += new EventHandler (CloseButtonClicked);
+
+
+ form.Controls.AddImplicit (close_button);
+ form.Controls.AddImplicit (maximize_button);
+ form.Controls.AddImplicit (minimize_button);
+ */
+
+ CreateButtons ();
+ }
+
+ public bool Maximized {
+ get { return maximized; }
+ }
+
+ public MainMenu MergedMenu {
+ get {
+ if (merged_menu == null)
+ merged_menu = CreateMergedMenu ();
+ return merged_menu;
+ }
+ }
+
+ private MainMenu CreateMergedMenu ()
+ {
+ Form parent = (Form) mdi_container.Parent;
+ MainMenu clone = (MainMenu) parent.Menu.CloneMenu ();
+ clone.MergeMenu (form.Menu);
+ clone.MenuChanged += new EventHandler (MenuChangedHandler);
+ clone.SetForm (parent);
+ return clone;
+ }
+
+ private void MenuChangedHandler (object sender, EventArgs e)
+ {
+ CreateMergedMenu ();
+ }
+
+ public bool HandleMessage (ref Message m)
+ {
+ switch ((Msg)m.Msg) {
+
+
+ // The mouse handling messages are actually
+ // not WM_NC* messages except for the first button and NCMOVEs
+ // down because we capture on the form
+
+ case Msg.WM_MOUSEMOVE:
+ return HandleMouseMove (form, ref m);
+
+ case Msg.WM_LBUTTONUP:
+ HandleLButtonUp (ref m);
+ break;
+
+ case Msg.WM_RBUTTONDOWN:
+ case Msg.WM_LBUTTONDOWN:
+ return HandleButtonDown (ref m);
+
+ case Msg.WM_NCMOUSEMOVE:
+ return HandleNCMouseMove (form, ref m);
+
+ case Msg.WM_NCLBUTTONUP:
+ return HandleNCLButtonUp (ref m);
+
+ case Msg.WM_NCLBUTTONDOWN:
+ return HandleNCLButtonDown (ref m);
+
+ case Msg.WM_MOUSE_LEAVE:
+ FormMouseLeave (ref m);
+ break;
+
+ case Msg.WM_NCPAINT:
+// form.UpdateStyles ();
+ PaintWindowDecorations ();
+ // Graphics g = XplatUI.GetMenuDC (form.Handle, IntPtr.Zero);
+ // g.Clear (Color.Red);
+ break;
+ }
+ return false;
+ }
+
+ public void UpdateBorderStyle (FormBorderStyle border_style)
+ {
+ if (border_style != FormBorderStyle.None)
+ XplatUI.SetBorderStyle (form.Handle, (FormBorderStyle) MdiBorderStyle);
+ else
+ XplatUI.SetBorderStyle (form.Handle, FormBorderStyle.None);
+
+ CreateButtons ();
+ }
+
+ private void CreateButtons ()
+ {
+ switch (form.FormBorderStyle) {
+ case FormBorderStyle.None:
+ close_button = null;
+ minimize_button = null;
+ maximize_button = null;
+ break;
+ case FormBorderStyle.FixedSingle:
+ case FormBorderStyle.Fixed3D:
+ case FormBorderStyle.FixedDialog:
+ case FormBorderStyle.Sizable:
+ close_button = new TitleButton (CaptionButton.Close, new EventHandler (CloseClicked));
+ minimize_button = new TitleButton (CaptionButton.Minimize, new EventHandler (MinimizeClicked));
+ maximize_button = new TitleButton (CaptionButton.Maximize, new EventHandler (MaximizeClicked));
+ break;
+ case FormBorderStyle.FixedToolWindow:
+ case FormBorderStyle.SizableToolWindow:
+ close_button = new TitleButton (CaptionButton.Close, new EventHandler (CloseClicked));
+ break;
+ }
+
+ title_buttons [0] = close_button;
+ title_buttons [1] = minimize_button;
+ title_buttons [2] = maximize_button;
+
+ }
+
+ private bool HandleButtonDown (ref Message m)
+ {
+ form.BringToFront ();
+ mdi_container.ActiveMdiChild = form;
+ return false;
+ }
+
+ private bool HandleNCLButtonDown (ref Message m)
+ {
+ form.BringToFront ();
+ mdi_container.ActiveMdiChild = form;
+
+ int x = Control.LowOrder ((int) m.LParam.ToInt32 ());
+ int y = Control.HighOrder ((int) m.LParam.ToInt32 ());
+
+ form.PointToClient (ref x, ref y);
+
+ start = new Point (x, y);
+ virtual_position = form.Bounds;
+
+ // Need to adjust because we are in NC land
+ y += TitleBarHeight;
+ FormPos pos = FormPosForCoords (x, y);
+
+ if (pos == FormPos.TitleBar) {
+ HandleTitleBarDown (x, y);
+ return true;
+ }
+
+ if (IsSizable) {
+ SetCursorForPos (pos);
+
+ if ((pos & FormPos.AnyEdge) == 0)
+ return false;
+
+ state = State.Sizing;
+ sizing_edge = pos;
+ form.Capture = true;
+ return true;
+ }
+
+ return false;
+ }
+
+ private void HandleTitleBarDown (int x, int y)
+ {
+ foreach (TitleButton button in title_buttons) {
+ if (button != null && button.Rectangle.Contains (x, y)) {
+ button.State = ButtonState.Pushed;
+ return;
+ }
+ }
+
+ if (maximized)
+ return;
+
+ state = State.Moving;
+ form.Capture = true;
+ }
+
+ private bool HandleMouseMove (Form form, ref Message m)
+ {
+ switch (state) {
+ case State.Moving:
+ HandleWindowMove (m);
+ return true;
+ case State.Sizing:
+ HandleSizing (m);
+ return true;
+ }
+
+ /*
+ if (IsSizable) {
+ int x = Control.LowOrder ((int) m.LParam.ToInt32 ());
+ int y = Control.HighOrder ((int) m.LParam.ToInt32 ());
+ FormPos pos = FormPosForCoords (x, y);
+ Console.WriteLine ("position: " + pos);
+ SetCursorForPos (pos);
+
+ ClearVirtualPosition ();
+ state = State.Idle;
+ }
+ */
+
+ return false;
+ }
+
+ private bool HandleNCMouseMove (Form form, ref Message m)
+ {
+ if (IsSizable) {
+ int x = Control.LowOrder ((int) m.LParam.ToInt32 ());
+ int y = Control.HighOrder ((int) m.LParam.ToInt32 ());
+ FormPos pos = FormPosForCoords (x, y);
+
+ SetCursorForPos (pos);
+
+ ClearVirtualPosition ();
+ state = State.Idle;
+ }
+
+ return false;
+ }
+
+ private void FormMouseLeave (ref Message m)
+ {
+ form.ResetCursor ();
+ }
+
+ private void SetCursorForPos (FormPos pos)
+ {
+ switch (pos) {
+ case FormPos.TopLeft:
+ case FormPos.BottomRight:
+ form.Cursor = Cursors.SizeNWSE;
+ break;
+ case FormPos.TopRight:
+ case FormPos.BottomLeft:
+ form.Cursor = Cursors.SizeNESW;
+ break;
+ case FormPos.Top:
+ case FormPos.Bottom:
+ form.Cursor = Cursors.SizeNS;
+ break;
+ case FormPos.Left:
+ case FormPos.Right:
+ form.Cursor = Cursors.SizeWE;
+ break;
+ default:
+ form.ResetCursor ();
+ break;
+ }
+ }
+
+ private void HandleWindowMove (Message m)
+ {
+ Point move = MouseMove (m);
+
+ virtual_position.X = form.Left + move.X;
+ virtual_position.Y = form.Top + move.Y;
+ virtual_position.Width = form.Width;
+ virtual_position.Height = form.Height;
+
+ mdi_container.EnsureScrollBars (virtual_position.Right, virtual_position.Bottom);
+
+ DrawVirtualPosition ();
+ }
+
+ private void HandleSizing (Message m)
+ {
+ Point move = MouseMove (m);
+ Rectangle pos = virtual_position;
+ int mw = MinTitleBarSize.Width + (BorderWidth * 2);
+ int mh = MinTitleBarSize.Height + (BorderWidth * 2);
+
+ if ((sizing_edge & FormPos.Top) != 0) {
+ int height = form.Height - move.Y;
+ if (height <= mh) {
+ move.Y += height - mh;
+ height = mh;
+ }
+ pos.Y = form.Top + move.Y;
+ pos.Height = height;
+ } else if ((sizing_edge & FormPos.Bottom) != 0) {
+ int height = form.Height + move.Y;
+ if (height <= mh)
+ move.Y -= height - mh;
+ pos.Height = form.Height + move.Y;
+ }
+
+ if ((sizing_edge & FormPos.Left) != 0) {
+ int width = form.Width - move.X;
+ if (width <= mw) {
+ move.X += width - mw;
+ width = mw;
+ }
+ pos.X = form.Left + move.X;
+ pos.Width = width;
+ } else if ((sizing_edge & FormPos.Right) != 0) {
+ int width = form.Width + move.X;
+ if (width <= mw)
+ move.X -= width - mw;
+ pos.Width = form.Width + move.X;
+ }
+
+ UpdateVP (pos);
+ }
+
+ private bool IsSizable {
+ get {
+ switch (form.FormBorderStyle) {
+ case FormBorderStyle.Sizable:
+ case FormBorderStyle.SizableToolWindow:
+ return true;
+ default:
+ return false;
+ }
+ }
+ }
+
+ private bool HasBorders {
+ get {
+ return form.FormBorderStyle != FormBorderStyle.None;
+ }
+ }
+
+ private bool IsToolWindow {
+ get {
+ if (form.FormBorderStyle == FormBorderStyle.SizableToolWindow ||
+ form.FormBorderStyle == FormBorderStyle.FixedToolWindow)
+ return true;
+ return false;
+ }
+ }
+
+ private int TitleBarHeight {
+ get {
+ if (IsToolWindow)
+ return 19;
+ if (form.FormBorderStyle == FormBorderStyle.None)
+ return 0;
+ return 26;
+ }
+ }
+
+ private void UpdateVP (Rectangle r)
+ {
+ UpdateVP (r.X, r.Y, r.Width, r.Height);
+ }
+
+ private void UpdateVP (Point loc, int w, int h)
+ {
+ UpdateVP (loc.X, loc.Y, w, h);
+ }
+
+ private void UpdateVP (int x, int y, int w, int h)
+ {
+ virtual_position.X = x;
+ virtual_position.Y = y;
+ virtual_position.Width = w;
+ virtual_position.Height = h;
+
+ DrawVirtualPosition ();
+ }
+
+ private void HandleLButtonUp (ref Message m)
+ {
+ if (state == State.Idle)
+ return;
+
+ ClearVirtualPosition ();
+
+ form.Capture = false;
+ form.Bounds = virtual_position;
+ state = State.Idle;
+ }
+
+ private bool HandleNCLButtonUp (ref Message m)
+ {
+ int x = Control.LowOrder ((int) m.LParam.ToInt32 ());
+ int y = Control.HighOrder ((int) m.LParam.ToInt32 ());
+
+ form.PointToClient (ref x, ref y);
+
+ // Need to adjust because we are in NC land
+ y += TitleBarHeight;
+
+ foreach (TitleButton button in title_buttons) {
+ if (button != null && button.Rectangle.Contains (x, y)) {
+ button.Clicked (this, EventArgs.Empty);
+ return true;
+ }
+ }
+
+ return true;
+ }
+
+ private void PaintWindowDecorations ()
+ {
+ Graphics dc = XplatUI.GetMenuDC (form.Handle, IntPtr.Zero);
+
+ if (HasBorders) {
+ Rectangle borders = new Rectangle (0, 0, form.Width, form.Height);
+// dc.FillRectangle (new SolidBrush (Color.Black), borders);
+
+/*
+ dc.DrawRectangle (new Pen (SystemColors.ControlLight, 1), borders);
+ borders.Inflate (-2, -2);
+ dc.DrawRectangle (new Pen (SystemColors.ControlDark, 1), borders);
+ borders.X++;
+ borders.Width -= 2;
+ dc.DrawRectangle (new Pen (SystemColors.ControlLight, 1), borders);
+*/
+
+ ControlPaint.DrawBorder3D (dc, borders, Border3DStyle.Raised);
+
+ if (IsSizable) {
+ borders.Inflate (-1, -1);
+ ControlPaint.DrawFocusRectangle (dc, borders);
+ }
+ }
+
+ Color color = ThemeEngine.Current.ColorControlDark;
+ if (form == mdi_container.ActiveMdiChild && !maximized)
+ color = titlebar_color;
+
+ Rectangle tb = new Rectangle (BorderWidth, BorderWidth,
+ form.Width - (BorderWidth * 2), TitleBarHeight - 1);
+
+ dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (color), tb);
+
+ dc.DrawLine (new Pen (Color.White, 1), BorderWidth,
+ TitleBarHeight + BorderWidth, form.Width - BorderWidth,
+ TitleBarHeight + BorderWidth);
+
+ if (!IsToolWindow) {
+ tb.X += 18; // Room for the icon and the buttons
+ tb.Width = (form.Width - 62) - tb.X;
+ }
+
+ if (form.Text != null) {
+ StringFormat format = new StringFormat ();
+ format.FormatFlags = StringFormatFlags.NoWrap;
+ format.Trimming = StringTrimming.EllipsisCharacter;
+ format.LineAlignment = StringAlignment.Center;
+ dc.DrawString (form.Text, form.Font,
+ ThemeEngine.Current.ResPool.GetSolidBrush (Color.White),
+ tb, format);
+ }
+
+ if (!IsToolWindow && HasBorders) {
+ if (form.Icon != null) {
+ dc.DrawIcon (form.Icon, new Rectangle (BorderWidth + 3,
+ BorderWidth + 3, 16, 16));
+ }
+
+ minimize_button.Rectangle = new Rectangle (form.Width - 62,
+ BorderWidth + 2, 18, 22);
+
+ maximize_button.Rectangle = new Rectangle (form.Width - 44,
+ BorderWidth + 2, 18, 22);
+
+ close_button.Rectangle = new Rectangle (form.Width - 24,
+ BorderWidth + 2, 18, 22);
+
+ DrawTitleButton (dc, minimize_button);
+ DrawTitleButton (dc, maximize_button);
+ DrawTitleButton (dc, close_button);
+ } else {
+ close_button.Rectangle = new Rectangle (form.Width - BorderWidth - 2 - 13,
+ BorderWidth + 2, 13, 13);
+ DrawTitleButton (dc, close_button);
+ }
+ }
+
+ private void DrawTitleButton (Graphics dc, TitleButton button)
+ {
+ dc.FillRectangle (SystemBrushes.Control, button.Rectangle);
+
+ ControlPaint.DrawCaptionButton (dc, button.Rectangle,
+ button.Caption, ButtonState.Normal);
+ }
+
+ private void CloseClicked (object sender, EventArgs e)
+ {
+ form.Close ();
+ // form.Close should set visibility to false somewhere
+ // in it's closing chain but currently does not.
+ form.Visible = false;
+ }
+
+ private void MinimizeClicked (object sender, EventArgs e)
+ {
+ form.SuspendLayout ();
+ form.Width = MinTitleBarSize.Width + (BorderWidth * 2);
+ form.Height = MinTitleBarSize.Height + (BorderWidth * 2);
+ form.ResumeLayout ();
+ }
+
+ private void MaximizeClicked (object sender, EventArgs e)
+ {
+ if (maximized) {
+ form.Bounds = prev_bounds;
+ maximized = false;
+ } else {
+ prev_bounds = form.Bounds;
+ form.Bounds = form.Parent.Bounds;
+ maximized = true;
+ }
+ }
+
+ private Point NewLocation (Message m)
+ {
+ int x = Control.LowOrder ((int) m.LParam.ToInt32 ());
+ int y = Control.HighOrder ((int) m.LParam.ToInt32 ());
+ int x_move = x - start.X;
+ int y_move = y - start.Y;
+
+ return new Point (form.Left + x_move, form.Top + y_move);
+ }
+
+ private Point MouseMove (Message m)
+ {
+ int x = Control.LowOrder ((int) m.LParam.ToInt32 ());
+ int y = Control.HighOrder ((int) m.LParam.ToInt32 ());
+ int x_move = x - start.X;
+ int y_move = y - start.Y;
+
+ return new Point (x_move, y_move);
+ }
+
+ private void DrawVirtualPosition ()
+ {
+ ClearVirtualPosition ();
+
+ XplatUI.DrawReversibleRectangle (mdi_container.Handle, virtual_position, 2);
+ prev_virtual_position = virtual_position;
+ }
+
+ private void ClearVirtualPosition ()
+ {
+ if (prev_virtual_position != Rectangle.Empty)
+ XplatUI.DrawReversibleRectangle (mdi_container.Handle,
+ prev_virtual_position, 2);
+ prev_virtual_position = Rectangle.Empty;
+ }
+
+ private FormPos FormPosForCoords (int x, int y)
+ {
+ if (y < TitleBarHeight + BorderWidth) {
+
+ if (y > BorderWidth && x > BorderWidth &&
+ x < form.Width - BorderWidth)
+ return FormPos.TitleBar;
+
+ if (x < BorderWidth || (x < 20 && y < BorderWidth))
+ return FormPos.TopLeft;
+
+ if (x > form.Width - BorderWidth ||
+ (x > form.Width - 20 && y < BorderWidth))
+ return FormPos.TopRight;
+
+ if (y < BorderWidth)
+ return FormPos.Top;
+
+ } else if (y > form.Height - 20) {
+
+ if (x < BorderWidth ||
+ (x < 20 && y > form.Height - BorderWidth))
+ return FormPos.BottomLeft;
+
+ if (x > form.Width - BorderWidth ||
+ (x > form.Width - 20 &&
+ y > form.Height - BorderWidth))
+ return FormPos.BottomRight;
+
+ if (y > form.Height - BorderWidth)
+ return FormPos.Bottom;
+
+
+ } else if (x < BorderWidth) {
+ return FormPos.Left;
+ } else if (x > form.Width - BorderWidth) {
+ return FormPos.Right;
+ }
+
+ return FormPos.None;
+ }
+ }
+
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs
new file mode 100644
index 00000000000..f52b9540c41
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs
@@ -0,0 +1,328 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+// NOT COMPLETE
+
+using System.Collections;
+using System.ComponentModel;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+ [DesignTimeVisible(false)]
+ [ToolboxItem(false)]
+ public sealed class MdiClient : Control {
+ #region Local Variables
+ private int mdi_created;
+ private Form active;
+ private HScrollBar hbar;
+ private VScrollBar vbar;
+
+ #endregion // Local Variables
+
+ #region Public Classes
+ public new class ControlCollection : Control.ControlCollection {
+ MdiClient owner;
+
+ public ControlCollection(MdiClient owner) : base(owner) {
+ this.owner = owner;
+ controls = new ArrayList ();
+ }
+
+ public override void Add(Control value) {
+ if ((value is Form) == false || !(((Form)value).IsMdiChild)) {
+ throw new ArgumentException("Form must be MdiChild");
+ }
+ base.Add (value);
+ SetChildIndex (value, 0); // always insert at front
+ // newest member is the active one
+ owner.ActiveMdiChild = (Form) value;
+ }
+
+ public override void Remove(Control value) {
+ base.Remove (value);
+ }
+ }
+ #endregion // Public Classes
+
+ #region Public Constructors
+ public MdiClient() {
+ BackColor = SystemColors.AppWorkspace;
+ Dock = DockStyle.Fill;
+ SetStyle (ControlStyles.Selectable, false);
+ }
+ #endregion // Public Constructors
+
+ protected override Control.ControlCollection CreateControlsInstance ()
+ {
+ return new MdiClient.ControlCollection (this);
+ }
+
+ protected override void WndProc(ref Message m) {
+ /*
+ switch ((Msg) m.Msg) {
+ case Msg.WM_PAINT: {
+ Console.WriteLine ("ignoring paint");
+ return;
+ }
+ }
+ */
+ base.WndProc (ref m);
+ }
+
+ protected override void OnResize (EventArgs e)
+ {
+ base.OnResize (e);
+
+ // Should probably make this into one loop
+ SizeScrollBars ();
+ SizeMaximized ();
+ }
+
+ protected override void ScaleCore (float dx, float dy)
+ {
+ base.ScaleCore (dx, dy);
+ }
+
+ protected override void SetBoundsCore (int x, int y, int width, int height, BoundsSpecified specified)
+ {
+ base.SetBoundsCore (x, y, width, height, specified);
+ }
+
+ #region Public Instance Properties
+ [Localizable(true)]
+ public override System.Drawing.Image BackgroundImage {
+ get {
+ return base.BackgroundImage;
+ }
+ set {
+ base.BackgroundImage = value;
+ }
+ }
+
+ public Form[] MdiChildren {
+ get {
+ Form[] children;
+
+ children = new Form[Controls.Count];
+ Controls.CopyTo(children, 0);
+
+ return children;
+ }
+ }
+ #endregion // Public Instance Properties
+
+#region Protected Instance Properties
+ protected override CreateParams CreateParams {
+ get {
+ return base.CreateParams;
+ }
+ }
+ #endregion // Protected Instance Properties
+
+ #region Public Instance Methods
+ public void LayoutMdi(MdiLayout value) {
+ throw new NotImplementedException();
+ }
+ #endregion // Public Instance Methods
+
+ #region Protected Instance Methods
+ #endregion // Protected Instance Methods
+
+ internal void EnsureScrollBars (int right, int bottom)
+ {
+ int width = Width;
+ int height = Height;
+
+ if (vbar != null && vbar.Visible)
+ width -= vbar.Width;
+ if (hbar != null && hbar.Visible)
+ height -= hbar.Height;
+
+ if (right > width) {
+ if (hbar == null) {
+ hbar = new HScrollBar ();
+ Controls.AddImplicit (hbar);
+ }
+ hbar.Visible = true;
+ } else {
+ if (hbar != null) {
+ bool found = false;
+ foreach (Form child in Controls) {
+ if (child == ActiveMdiChild)
+ continue;
+ if (child.Right < width)
+ continue;
+ found = true;
+ break;
+ }
+ hbar.Visible = found;
+ }
+ }
+
+ if (bottom > height) {
+ if (vbar == null) {
+ vbar = new VScrollBar ();
+ Controls.AddImplicit (vbar);
+ }
+ vbar.Visible = true;
+ } else {
+ if (vbar != null) {
+ bool found = false;
+ foreach (Form child in Controls) {
+ if (child == ActiveMdiChild)
+ continue;
+ if (child.Bottom < height)
+ continue;
+ found = true;
+ break;
+ }
+ vbar.Visible = found;
+ }
+ }
+
+ if (hbar != null && hbar.Visible)
+ CalcHBar (right, vbar != null && vbar.Visible);
+ if (vbar != null && vbar.Visible)
+ CalcVBar (bottom, hbar != null && hbar.Visible);
+ }
+
+ private void SizeScrollBars ()
+ {
+ int right = 0;
+ foreach (Form child in Controls) {
+ if (!child.Visible)
+ continue;
+ if (child.Right > right)
+ right = child.Right;
+ }
+
+ int bottom = 0;
+ foreach (Form child in Controls) {
+ if (!child.Visible)
+ continue;
+ if (child.Bottom > bottom)
+ bottom = child.Bottom;
+ }
+
+ int right_edge = Right;
+ int bottom_edge = Bottom;
+ int prev_right_edge;
+ int prev_bottom_edge;
+
+ bool need_hbar = false;
+ bool need_vbar = false;
+
+ do {
+ prev_right_edge = right_edge;
+ prev_bottom_edge = bottom_edge;
+
+ if (right > right_edge) {
+ need_hbar = true;
+ bottom_edge = Bottom - SystemInformation.HorizontalScrollBarHeight;
+ } else {
+ need_hbar = false;
+ bottom_edge = Bottom;
+ }
+
+ if (bottom > bottom_edge) {
+ need_vbar = true;
+ right_edge = Right - SystemInformation.VerticalScrollBarWidth;
+ } else {
+ need_vbar = false;
+ right_edge = Right;
+ }
+
+ } while (right_edge != prev_right_edge || bottom_edge != prev_bottom_edge);
+
+ if (need_hbar) {
+ if (hbar == null) {
+ hbar = new HScrollBar ();
+ Controls.AddImplicit (hbar);
+ }
+ hbar.Visible = true;
+ CalcHBar (right, vbar != null && vbar.Visible);
+ } else if (hbar != null)
+ hbar.Visible = false;
+
+ if (need_vbar) {
+ if (vbar == null) {
+ vbar = new VScrollBar ();
+ Controls.AddImplicit (vbar);
+ }
+ vbar.Visible = true;
+ CalcVBar (bottom, hbar != null && hbar.Visible);
+ } else if (vbar != null)
+ vbar.Visible = false;
+ }
+
+ private void CalcHBar (int right, bool vert_vis)
+ {
+ hbar.Left = 0;
+ hbar.Top = Height - hbar.Height;
+ hbar.Width = Width - (vert_vis ? vbar.Width : 0);
+ hbar.LargeChange = right;
+ hbar.SmallChange = right / 10;
+ hbar.Maximum = right - 1;
+ }
+
+ private void CalcVBar (int bottom, bool horz_vis)
+ {
+ vbar.Left = Width - vbar.Width;
+ vbar.Top = 0;
+ vbar.Height = Height - (horz_vis ? hbar.Height : 0);
+ vbar.LargeChange = bottom;
+ vbar.SmallChange = bottom / 10;
+ vbar.Maximum = bottom - 1;
+ }
+
+ private void SizeMaximized ()
+ {
+ foreach (Form child in Controls) {
+ if (!child.Visible)
+ continue;
+
+ if (child.WindowManager.Maximized)
+ child.Bounds = Bounds;
+ }
+ }
+
+ internal void ActivateChild (Form form)
+ {
+ form.BringToFront ();
+ active = form;
+ }
+
+ internal int ChildrenCreated {
+ get { return mdi_created; }
+ set { mdi_created = value; }
+ }
+
+ internal Form ActiveMdiChild {
+ get { return active; }
+ set { active = value; }
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiLayout.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiLayout.cs
new file mode 100644
index 00000000000..7adca3b97e0
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiLayout.cs
@@ -0,0 +1,36 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public enum MdiLayout {
+ Cascade = 0,
+ TileHorizontal = 1,
+ TileVertical = 2,
+ ArrangeIcons = 3
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiWindowManager.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiWindowManager.cs
new file mode 100644
index 00000000000..5c6464093d3
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiWindowManager.cs
@@ -0,0 +1,124 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+//
+//
+
+
+using System;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+
+namespace System.Windows.Forms {
+
+ internal class MdiWindowManager : InternalWindowManager {
+
+ private static readonly int MdiBorderStyle = 0xFFFF;
+
+ private MainMenu merged_menu;
+ private MdiClient mdi_container;
+ private Rectangle prev_virtual_position;
+
+ public MdiWindowManager (Form form, MdiClient mdi_container) : base (form)
+ {
+ this.mdi_container = mdi_container;
+ }
+
+ public MainMenu MergedMenu {
+ get {
+ if (merged_menu == null)
+ merged_menu = CreateMergedMenu ();
+ return merged_menu;
+ }
+ }
+
+ private MainMenu CreateMergedMenu ()
+ {
+ Form parent = (Form) mdi_container.Parent;
+ MainMenu clone = (MainMenu) parent.Menu.CloneMenu ();
+ clone.MergeMenu (form.Menu);
+ clone.MenuChanged += new EventHandler (MenuChangedHandler);
+ clone.SetForm (parent);
+ return clone;
+ }
+
+ private void MenuChangedHandler (object sender, EventArgs e)
+ {
+ CreateMergedMenu ();
+ }
+
+ public override void PointToClient (ref int x, ref int y)
+ {
+ XplatUI.ScreenToClient (mdi_container.Handle, ref x, ref y);
+ }
+
+ public override void PointToScreen (ref int x, ref int y)
+ {
+ XplatUI.ClientToScreen (mdi_container.Handle, ref x, ref y);
+ }
+
+ public override void UpdateBorderStyle (FormBorderStyle border_style)
+ {
+ base.UpdateBorderStyle (border_style);
+
+ if (border_style != FormBorderStyle.None)
+ XplatUI.SetBorderStyle (form.Handle, (FormBorderStyle) MdiBorderStyle);
+ else
+ XplatUI.SetBorderStyle (form.Handle, FormBorderStyle.None);
+ }
+
+ protected override bool ShouldRemoveWindowManager (FormBorderStyle style)
+ {
+ return false;
+ }
+
+ protected override void HandleWindowMove (Message m)
+ {
+ Point move = MouseMove (m);
+
+ int x = virtual_position.X + move.X;
+ int y = virtual_position.Y + move.Y;
+
+ UpdateVP (x, y, form.Width, form.Height);
+ start = Cursor.Position;
+ }
+
+ protected override void DrawVirtualPosition (Rectangle virtual_position)
+ {
+ ClearVirtualPosition ();
+
+ if (form.Parent != null)
+ XplatUI.DrawReversibleRectangle (form.Parent.Handle, virtual_position, 2);
+ prev_virtual_position = virtual_position;
+ }
+
+ protected override void ClearVirtualPosition ()
+ {
+ if (prev_virtual_position != Rectangle.Empty && form.Parent != null)
+ XplatUI.DrawReversibleRectangle (form.Parent.Handle,
+ prev_virtual_position, 2);
+ prev_virtual_position = Rectangle.Empty;
+ }
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MeasureItemEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MeasureItemEventArgs.cs
new file mode 100644
index 00000000000..65759a002bb
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MeasureItemEventArgs.cs
@@ -0,0 +1,76 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+//
+
+using System.Drawing;
+
+namespace System.Windows.Forms
+{
+ public class MeasureItemEventArgs : EventArgs
+ {
+ private Graphics graphics;
+ private int index;
+ private int itemHeight;
+ private int itemWidth = 0;
+
+ public MeasureItemEventArgs (Graphics graphics, int index)
+ {
+ this.graphics = graphics;
+ this.index = index;
+ this.itemHeight = 0;
+ }
+
+ public MeasureItemEventArgs (Graphics graphics, int index, int itemHeight)
+ {
+ this.graphics = graphics;
+ this.index = index;
+ this.itemHeight = itemHeight;
+ }
+
+ #region Public Properties
+
+ public Graphics Graphics {
+ get { return graphics;}
+ }
+
+ public int Index {
+ get { return index;}
+ }
+
+ public int ItemHeight {
+ get { return itemHeight;}
+ set { itemHeight = value;}
+ }
+
+ public int ItemWidth {
+ get { return itemWidth;}
+ set { itemWidth = value;}
+ }
+
+ #endregion Public Properties
+ }
+
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MeasureItemEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MeasureItemEventHandler.cs
new file mode 100644
index 00000000000..2be15e43ced
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MeasureItemEventHandler.cs
@@ -0,0 +1,31 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+//
+
+namespace System.Windows.Forms
+{
+ [Serializable]
+ public delegate void MeasureItemEventHandler (object sender, MeasureItemEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Menu.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Menu.cs
new file mode 100644
index 00000000000..243ef678978
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Menu.cs
@@ -0,0 +1,501 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+// TODO:
+// - MDI integration
+// - ShortCut navigation
+//
+// NOT COMPLETE
+
+using System.Collections;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms
+{
+ [Designer ("Microsoft.VisualStudio.Windows.Forms.MenuDesigner, " + Consts.AssemblyMicrosoft_VisualStudio, "System.ComponentModel.Design.IDesigner")]
+ [ToolboxItemFilter("System.Windows.Forms", ToolboxItemFilterType.Allow)]
+ [ListBindable(false)]
+ public abstract class Menu : Component
+ {
+ internal MenuItemCollection menu_items;
+ internal IntPtr menu_handle = IntPtr.Zero;
+ internal Menu parent_menu = null;
+ System.Drawing.Rectangle rect;
+ internal Control Wnd;
+ internal MenuTracker tracker;
+
+ public const int FindHandle = 0;
+ public const int FindShortcut = 1;
+
+ protected Menu (MenuItem[] items)
+ {
+ menu_items = new MenuItemCollection (this);
+
+ if (items != null)
+ menu_items.AddRange (items);
+ }
+
+
+ #region Public Properties
+ [BrowsableAttribute(false)]
+ [EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
+ [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]
+ public IntPtr Handle {
+ get { return menu_handle; }
+ }
+
+ internal virtual void OnMenuChanged (EventArgs e)
+ {
+ if (MenuChanged != null)
+ MenuChanged (this, e);
+ }
+
+ [BrowsableAttribute(false)]
+ [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]
+ public virtual bool IsParent {
+ get {
+ if (menu_items != null && menu_items.Count > 0)
+ return true;
+ else
+ return false;
+ }
+ }
+
+ [BrowsableAttribute(false)]
+ [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]
+ public MenuItem MdiListItem {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [BrowsableAttribute(false)]
+ [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content)]
+ [MergableProperty(false)]
+ public MenuItemCollection MenuItems {
+ get { return menu_items; }
+ }
+
+ #endregion Public Properties
+
+ #region Private Properties
+
+ internal System.Drawing.Rectangle Rect {
+ get {
+ return rect;
+ }
+ }
+
+ internal MenuItem SelectedItem {
+ get {
+ foreach (MenuItem item in MenuItems)
+ if ((item.Status & DrawItemState.Selected) == DrawItemState.Selected)
+ return item;
+
+ return null;
+ }
+ }
+
+ internal int Height {
+ get { return rect.Height; }
+ set { rect.Height = value; }
+ }
+
+ internal int Width {
+ get { return rect.Width; }
+ set { rect.Width = value; }
+ }
+
+ internal int X {
+ get { return rect.X; }
+ set { rect.X = value; }
+ }
+
+ internal int Y {
+ get { return rect.Y; }
+ set { rect.Y = value; }
+ }
+
+ internal MenuTracker Tracker {
+ get {
+ Menu top = this;
+ while (top.parent_menu != null)
+ top = top.parent_menu;
+
+ return top.tracker;
+ }
+ }
+ #endregion Private Properties
+
+ #region Public Methods
+
+ protected void CloneMenu (Menu menuSrc)
+ {
+ Dispose (true);
+
+ menu_items = new MenuItemCollection (this);
+
+ for (int i = 0; i < menuSrc.MenuItems.Count ; i++)
+ menu_items.Add (menuSrc.MenuItems [i].CloneMenu ());
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ if (disposing) {
+ if (menu_handle != IntPtr.Zero) {
+ menu_handle = IntPtr.Zero;
+ }
+ }
+ }
+
+ // From Microsoft documentation is impossible to guess that
+ // this method is supossed to do
+ public MenuItem FindMenuItem (int type, IntPtr value)
+ {
+ return null;
+ }
+
+ protected int FindMergePosition (int mergeOrder)
+ {
+ int cnt = MenuItems.Count, cur, pos;
+
+ for (pos = 0; pos < cnt; ) {
+ cur = (pos + cnt) /2;
+ if (MenuItems[cur].MergeOrder > mergeOrder) {
+ cnt = cur;
+ } else {
+ pos = cur +1;
+ }
+ }
+
+ return pos;
+ }
+
+ public ContextMenu GetContextMenu ()
+ {
+ for (Menu item = this; item != null; item = item.parent_menu) {
+ if (item is ContextMenu) {
+ return (ContextMenu) item;
+ }
+ }
+
+ return null;
+ }
+
+ public MainMenu GetMainMenu ()
+ {
+ for (Menu item = this; item != null; item = item.parent_menu) {
+ if (item is MainMenu) {
+ return (MainMenu) item;
+ }
+ }
+
+ return null;
+ }
+
+ public virtual void MergeMenu (Menu menuSrc)
+ {
+ if (menuSrc == this)
+ throw new ArgumentException ("The menu cannot be merged with itself");
+
+ for (int i = 0; i < menuSrc.MenuItems.Count; i++){
+
+ switch (menuSrc.MenuItems[i].MergeType) {
+ case MenuMerge.Remove: // Item not included
+ break;
+
+ case MenuMerge.Add:
+ {
+ int pos = FindMergePosition (menuSrc.MenuItems[i].MergeOrder);
+ MenuItems.Add (pos, menuSrc.MenuItems[i].CloneMenu ());
+ break;
+ }
+
+ case MenuMerge.Replace:
+ case MenuMerge.MergeItems:
+ {
+ int pos = FindMergePosition (menuSrc.MenuItems[i].MergeOrder - 1);
+ MenuItems.Insert (pos, menuSrc.MenuItems[i].CloneMenu ());
+
+ break;
+ }
+
+ default:
+ break;
+ }
+ }
+ }
+
+ internal bool ProcessCmdKey (ref Message msg, Keys keyData)
+ {
+ if (tracker == null)
+ return false;
+ return tracker.ProcessKeys (ref msg, keyData);
+ }
+
+ public override string ToString ()
+ {
+ return base.ToString () + ", Items.Count: " + MenuItems.Count;
+ }
+
+ #endregion Public Methods
+
+ internal event EventHandler MenuChanged;
+
+ [ListBindable(false)]
+ public class MenuItemCollection : IList, ICollection, IEnumerable
+ {
+ private Menu owner;
+ private ArrayList items = new ArrayList ();
+
+ public MenuItemCollection (Menu owner)
+ {
+ this.owner = owner;
+ }
+
+ #region Public Properties
+
+ public virtual int Count {
+ get { return items.Count;}
+ }
+
+ public virtual bool IsReadOnly {
+ get { return false;}
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return false;}
+ }
+
+ object ICollection.SyncRoot {
+ get { return this;}
+ }
+
+ bool IList.IsFixedSize {
+ get { return false;}
+ }
+
+ public virtual MenuItem this [int index] {
+ get {
+ if (index < 0 || index >= Count)
+ throw new ArgumentOutOfRangeException ("Index of out range");
+
+ return (MenuItem) items[index];
+ }
+ }
+
+ object IList.this[int index] {
+ get { return items[index]; }
+ set { throw new NotSupportedException (); }
+ }
+
+ #endregion Public Properties
+
+ #region Public Methods
+
+ public virtual int Add (MenuItem mi)
+ {
+ if (mi.Parent != null)
+ mi.Parent.MenuItems.Remove (mi);
+
+ items.Add (mi);
+ mi.Index = items.Count - 1;
+ UpdateItem (mi);
+
+ owner.OnMenuChanged (EventArgs.Empty);
+ if (owner.parent_menu != null)
+ owner.parent_menu.OnMenuChanged (EventArgs.Empty);
+ return items.Count - 1;
+ }
+
+ public virtual MenuItem Add (string s)
+ {
+ MenuItem item = new MenuItem (s);
+ Add (item);
+ return item;
+ }
+
+ public virtual int Add (int index, MenuItem mi)
+ {
+ if (index < 0 || index > Count)
+ throw new ArgumentOutOfRangeException ("Index of out range");
+
+ ArrayList new_items = new ArrayList (Count + 1);
+
+ for (int i = 0; i < index; i++)
+ new_items.Add (items[i]);
+
+ new_items.Add (mi);
+
+ for (int i = index; i < Count; i++)
+ new_items.Add (items[i]);
+
+ items = new_items;
+ UpdateItemsIndices ();
+ UpdateItem (mi);
+
+ return index;
+ }
+
+ private void UpdateItem (MenuItem mi)
+ {
+ mi.parent_menu = owner;
+ owner.OnMenuChanged (EventArgs.Empty);
+ if (owner.parent_menu != null)
+ owner.parent_menu.OnMenuChanged (EventArgs.Empty);
+ if (owner.Tracker != null)
+ owner.Tracker.AddShortcuts (mi);
+ }
+
+ internal void Insert (int index, MenuItem mi)
+ {
+ if (index < 0 || index > Count)
+ throw new ArgumentOutOfRangeException ("Index of out range");
+ UpdateItemsIndices ();
+ UpdateItem (mi);
+ }
+
+ public virtual MenuItem Add (string s, EventHandler e)
+ {
+ MenuItem item = new MenuItem (s, e);
+ Add (item);
+
+ return item;
+ }
+
+ public virtual MenuItem Add (string s, MenuItem[] items)
+ {
+ MenuItem item = new MenuItem (s, items);
+ Add (item);
+
+ return item;
+ }
+
+ public virtual void AddRange (MenuItem[] items)
+ {
+ if (items == null)
+ throw new ArgumentNullException ("items");
+
+ foreach (MenuItem mi in items)
+ Add (mi);
+ }
+
+ public virtual void Clear ()
+ {
+ MenuTracker tracker = owner.Tracker;
+ foreach (MenuItem item in items) {
+ if (tracker != null)
+ tracker.RemoveShortcuts (item);
+ item.parent_menu = null;
+ }
+ items.Clear ();
+ owner.OnMenuChanged (EventArgs.Empty);
+ }
+
+ public bool Contains (MenuItem value)
+ {
+ return items.Contains (value);
+ }
+
+ public virtual void CopyTo (Array dest, int index)
+ {
+ items.CopyTo (dest, index);
+ }
+
+ public virtual IEnumerator GetEnumerator ()
+ {
+ return items.GetEnumerator ();
+ }
+
+ int IList.Add (object value)
+ {
+ return Add ((MenuItem)value);
+ }
+
+ bool IList.Contains (object value)
+ {
+ return Contains ((MenuItem)value);
+ }
+
+ int IList.IndexOf (object value)
+ {
+ return IndexOf ((MenuItem)value);
+ }
+
+ void IList.Insert (int index, object value)
+ {
+ Insert (index, (MenuItem) value);
+ }
+
+ void IList.Remove (object value)
+ {
+ Remove ((MenuItem) value);
+ }
+
+ public int IndexOf (MenuItem value)
+ {
+ return items.IndexOf (value);
+ }
+
+ public virtual void Remove (MenuItem item)
+ {
+ RemoveAt (item.Index);
+ }
+
+ public virtual void RemoveAt (int index)
+ {
+ if (index < 0 || index >= Count)
+ throw new ArgumentOutOfRangeException ("Index of out range");
+
+ MenuItem item = (MenuItem) items [index];
+ MenuTracker tracker = owner.Tracker;
+ if (tracker != null)
+ tracker.RemoveShortcuts (item);
+ item.parent_menu = null;
+
+ items.RemoveAt (index);
+
+ UpdateItemsIndices ();
+ owner.OnMenuChanged (EventArgs.Empty);
+ }
+
+ #endregion Public Methods
+
+ #region Private Methods
+
+ private void UpdateItemsIndices ()
+ {
+ for (int i = 0; i < Count; i++) // Recalculate indeces
+ ((MenuItem)items[i]).Index = i;
+ }
+
+ #endregion Private Methods
+ }
+ }
+}
+
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuAPI.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuAPI.cs
new file mode 100644
index 00000000000..ff035b48e63
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuAPI.cs
@@ -0,0 +1,746 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+// Mike Kestner <mkestner@novell.com>
+//
+
+// NOT COMPLETE
+
+using System.Collections;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ /*
+ When writing this code the Wine project was of great help to
+ understand the logic behind some Win32 issues. Thanks to them. Jordi,
+ */
+ internal class MenuTracker {
+
+ bool active;
+ public Menu CurrentMenu;
+ public Menu TopMenu;
+ GrabControl grab_control;
+
+ class GrabControl : Control {
+
+ MenuTracker tracker;
+
+ public GrabControl (MenuTracker owner) : base ()
+ {
+ tracker = owner;
+ }
+
+ protected override void OnMouseDown (MouseEventArgs args)
+ {
+ tracker.OnClick (new MouseEventArgs (args.Button, args.Clicks, Control.MousePosition.X, Control.MousePosition.Y, args.Delta));
+ }
+
+ protected override void OnMouseMove (MouseEventArgs args)
+ {
+ tracker.OnMotion (new MouseEventArgs (args.Button, args.Clicks, Control.MousePosition.X, Control.MousePosition.Y, args.Delta));
+ }
+ }
+
+ public MenuTracker (Menu top_menu)
+ {
+ TopMenu = CurrentMenu = top_menu;
+ foreach (MenuItem item in TopMenu.MenuItems)
+ AddShortcuts (item);
+ grab_control = new GrabControl (this);
+ if (top_menu is ContextMenu) {
+ (top_menu as ContextMenu).SourceControl.FindForm ().Controls.AddImplicit (grab_control);
+ active = true;
+ grab_control.Capture = true;
+ } else
+ top_menu.Wnd.FindForm ().Controls.AddImplicit (grab_control);
+ }
+
+ enum KeyNavState {
+ Idle,
+ Startup,
+ NoPopups,
+ Navigating
+ }
+
+ KeyNavState keynav_state = KeyNavState.Idle;
+
+ public bool Navigating {
+ get { return keynav_state != KeyNavState.Idle; }
+ }
+
+ public void Dispose ()
+ {
+ grab_control.Parent.Controls.RemoveImplicit (grab_control);
+ }
+
+ Point ScreenToMenu (Menu menu, Point pnt)
+ {
+ int x = pnt.X;
+ int y = pnt.Y;
+ XplatUI.ScreenToMenu (menu.Wnd.window.Handle, ref x, ref y);
+ return new Point (x, y);
+ }
+
+ void Deactivate ()
+ {
+ active = false;
+ grab_control.Capture = false;
+ keynav_state = KeyNavState.Idle;
+ if (TopMenu is ContextMenu) {
+ PopUpWindow puw = TopMenu.Wnd as PopUpWindow;
+ puw.HideWindow ();
+ } else {
+ DeselectItem (TopMenu.SelectedItem);
+ (TopMenu as MainMenu).Draw ();
+ }
+ CurrentMenu = TopMenu;
+ }
+
+ MenuItem FindItemByCoords (Menu menu, Point pt)
+ {
+ if (menu is MainMenu)
+ pt = ScreenToMenu (menu, pt);
+ else
+ pt = menu.Wnd.PointToClient (pt);
+ foreach (MenuItem item in menu.MenuItems) {
+ Rectangle rect = item.bounds;
+ if (rect.Contains (pt))
+ return item;
+ }
+
+ return null;
+ }
+
+ MenuItem GetItemAtXY (int x, int y)
+ {
+ Point pnt = new Point (x, y);
+ MenuItem item = FindItemByCoords (TopMenu, pnt);
+ if (item == null && TopMenu.SelectedItem != null)
+ item = FindSubItemByCoord (TopMenu.SelectedItem, Control.MousePosition);
+ return item;
+ }
+
+ public void OnClick (MouseEventArgs args)
+ {
+ MenuItem item = GetItemAtXY (args.X, args.Y);
+
+ if (item == null) {
+ Deactivate ();
+ return;
+ }
+
+ SelectItem (item.Parent, item, item.IsPopup);
+ if (item.IsPopup) {
+ active = true;
+ grab_control.Capture = true;
+ } else if (item.Parent is MainMenu)
+ active = false;
+ else
+ Deactivate ();
+ item.PerformClick ();
+ }
+
+ public void OnMotion (MouseEventArgs args)
+ {
+ MenuItem item = GetItemAtXY (args.X, args.Y);
+
+ if (CurrentMenu.SelectedItem == item)
+ return;
+
+ grab_control.Capture = active || item != null;
+
+ Rectangle top_bounds = new Rectangle(0, 0, TopMenu.Rect.Width, TopMenu.Rect.Height);
+ if (item == null && (!active || top_bounds.Contains (ScreenToMenu (TopMenu, new Point (args.X, args.Y)))))
+ DeselectItem (TopMenu.SelectedItem);
+ else
+ MoveSelection (item);
+ }
+
+ void MoveSelection (MenuItem item)
+ {
+ if (item == null) {
+ if (CurrentMenu.SelectedItem.IsPopup)
+ return;
+ MenuItem old_item = CurrentMenu.SelectedItem;
+ if (CurrentMenu != TopMenu)
+ CurrentMenu = CurrentMenu.parent_menu;
+ DeselectItem (old_item);
+ } else {
+ if (item.Parent != CurrentMenu.SelectedItem)
+ DeselectItem (CurrentMenu.SelectedItem);
+ CurrentMenu = item.Parent;
+ SelectItem (CurrentMenu, item, active && item.IsPopup);
+ }
+ }
+
+ static public bool TrackPopupMenu (Menu menu, Point pnt)
+ {
+ if (menu.MenuItems.Count <= 0) // No submenus to track
+ return true;
+
+ menu.Wnd = new PopUpWindow (menu);
+ MenuTracker tracker = new MenuTracker (menu);
+
+ menu.Wnd.Location = menu.Wnd.PointToClient (pnt);
+
+ ((PopUpWindow)menu.Wnd).ShowWindow ();
+
+ bool no_quit = true;
+
+ while ((menu.Wnd != null) && menu.Wnd.Visible && no_quit) {
+ MSG msg = new MSG ();
+ no_quit = XplatUI.GetMessage(ref msg, IntPtr.Zero, 0, 0);
+ XplatUI.TranslateMessage(ref msg);
+ XplatUI.DispatchMessage(ref msg);
+ }
+
+ if (!no_quit)
+ XplatUI.PostQuitMessage(0);
+
+ tracker.Dispose ();
+
+ if (menu.Wnd != null) {
+ menu.Wnd.Dispose ();
+ menu.Wnd = null;
+ }
+
+ return true;
+ }
+
+ void DeselectItem (MenuItem item)
+ {
+ if (item == null)
+ return;
+
+ item.Status = item.Status &~ DrawItemState.Selected;
+
+ if (item.IsPopup)
+ HideSubPopups (item);
+
+ Menu menu = item.Parent;
+ if (menu is MainMenu)
+ (menu as MainMenu).Draw ();
+ else if (menu.Wnd != null)
+ menu.Wnd.Invalidate (item.bounds);
+ }
+
+ void SelectItem (Menu menu, MenuItem item, bool execute)
+ {
+ MenuItem prev_item = menu.SelectedItem;
+
+ if (prev_item != item) {
+ DeselectItem (prev_item);
+ if (CurrentMenu != menu)
+ CurrentMenu = menu;
+ item.Status |= DrawItemState.Selected;
+ if (menu is MainMenu)
+ (menu as MainMenu).Draw ();
+ else
+ menu.Wnd.Invalidate (item.bounds);
+ item.PerformSelect ();
+ }
+
+ if (execute)
+ ExecFocusedItem (menu, item);
+ }
+
+
+ // Used when the user executes the action of an item (press enter, shortcut)
+ // or a sub-popup menu has to be shown
+ void ExecFocusedItem (Menu menu, MenuItem item)
+ {
+ if (!item.Enabled)
+ return;
+
+ if (item.IsPopup) {
+ ShowSubPopup (menu, item);
+ } else {
+ Deactivate ();
+ item.PerformClick ();
+ }
+ }
+
+ // Create a popup window and show it or only show it if it is already created
+ void ShowSubPopup (Menu menu, MenuItem item)
+ {
+ if (item.Enabled == false)
+ return;
+
+ if (item.Wnd != null)
+ item.Wnd.Dispose ();
+
+ PopUpWindow puw = new PopUpWindow (item);
+
+ Point pnt;
+ if (menu is MainMenu)
+ pnt = new Point (item.X, item.Y + 1);
+ else
+ pnt = new Point (item.X + item.Width, item.Y + 1);
+ pnt = menu.Wnd.PointToScreen (pnt);
+ puw.Location = pnt;
+ item.Wnd = puw;
+
+ puw.ShowWindow ();
+ }
+
+ static public void HideSubPopups (Menu menu)
+ {
+ foreach (MenuItem item in menu.MenuItems)
+ if (item.IsPopup)
+ HideSubPopups (item);
+
+ if (menu.Wnd == null)
+ return;
+
+ PopUpWindow puw = menu.Wnd as PopUpWindow;
+ puw.Hide ();
+ }
+
+ MenuItem FindSubItemByCoord (Menu menu, Point pnt)
+ {
+ foreach (MenuItem item in menu.MenuItems) {
+
+ if (item.IsPopup && item.Wnd != null && item.Wnd.Visible && item == menu.SelectedItem) {
+ MenuItem result = FindSubItemByCoord (item, pnt);
+ if (result != null)
+ return result;
+ }
+
+ if (menu.Wnd == null)
+ continue;
+
+ Rectangle rect = item.bounds;
+ Point pnt_client = menu.Wnd.PointToScreen (new Point (item.X, item.Y));
+ rect.X = pnt_client.X;
+ rect.Y = pnt_client.Y;
+
+ if (rect.Contains (pnt) == true)
+ return item;
+ }
+
+ return null;
+ }
+
+ static MenuItem FindItemByKey (Menu menu, IntPtr key)
+ {
+ char key_char = (char ) (key.ToInt32() & 0xff);
+ key_char = Char.ToUpper (key_char);
+
+ foreach (MenuItem item in menu.MenuItems) {
+ if (item.Mnemonic == '\0')
+ continue;
+
+ if (item.Mnemonic == key_char)
+ return item;
+ }
+
+ return null;
+ }
+
+ enum ItemNavigation {
+ First,
+ Last,
+ Next,
+ Previous,
+ }
+
+ static MenuItem GetNextItem (Menu menu, ItemNavigation navigation)
+ {
+ int pos = 0;
+ bool selectable_items = false;
+ MenuItem item;
+
+ // Check if there is at least a selectable item
+ for (int i = 0; i < menu.MenuItems.Count; i++) {
+ item = menu.MenuItems [i];
+ if (item.Separator == false && item.Visible == true) {
+ selectable_items = true;
+ break;
+ }
+ }
+
+ if (selectable_items == false)
+ return null;
+
+ switch (navigation) {
+ case ItemNavigation.First:
+
+ /* First item that is not separator and it is visible*/
+ for (pos = 0; pos < menu.MenuItems.Count; pos++) {
+ item = menu.MenuItems [pos];
+ if (item.Separator == false && item.Visible == true)
+ break;
+ }
+
+ break;
+
+ case ItemNavigation.Last: // Not used
+ break;
+
+ case ItemNavigation.Next:
+
+ if (menu.SelectedItem != null)
+ pos = menu.SelectedItem.Index;
+
+ /* Next item that is not separator and it is visible*/
+ for (pos++; pos < menu.MenuItems.Count; pos++) {
+ item = menu.MenuItems [pos];
+ if (item.Separator == false && item.Visible == true)
+ break;
+ }
+
+ if (pos >= menu.MenuItems.Count) { /* Jump at the start of the menu */
+ pos = 0;
+ /* Next item that is not separator and it is visible*/
+ for (; pos < menu.MenuItems.Count; pos++) {
+ item = menu.MenuItems [pos];
+ if (item.Separator == false && item.Visible == true)
+ break;
+ }
+ }
+ break;
+
+ case ItemNavigation.Previous:
+
+ if (menu.SelectedItem != null)
+ pos = menu.SelectedItem.Index;
+
+ /* Previous item that is not separator and it is visible*/
+ for (pos--; pos >= 0; pos--) {
+ item = menu.MenuItems [pos];
+ if (item.Separator == false && item.Visible == true)
+ break;
+ }
+
+ if (pos < 0 ) { /* Jump at the end of the menu*/
+ pos = menu.MenuItems.Count - 1;
+ /* Previous item that is not separator and it is visible*/
+ for (; pos >= 0; pos--) {
+ item = menu.MenuItems [pos];
+ if (item.Separator == false && item.Visible == true)
+ break;
+ }
+ }
+
+ break;
+
+ default:
+ break;
+ }
+
+ return menu.MenuItems [pos];
+ }
+
+ void ProcessMenuKey (Msg msg_type)
+ {
+ if (TopMenu.MenuItems.Count == 0)
+ return;
+
+ MainMenu main_menu = TopMenu as MainMenu;
+
+ switch (msg_type) {
+ case Msg.WM_SYSKEYDOWN:
+ switch (keynav_state) {
+ case KeyNavState.Idle:
+ keynav_state = KeyNavState.Startup;
+ CurrentMenu = TopMenu;
+ main_menu.Draw ();
+ break;
+ case KeyNavState.Startup:
+ break;
+ default:
+ keynav_state = KeyNavState.Idle;
+ Deactivate ();
+ main_menu.Draw ();
+ break;
+ }
+ break;
+
+ case Msg.WM_SYSKEYUP:
+ switch (keynav_state) {
+ case KeyNavState.Idle:
+ case KeyNavState.Navigating:
+ break;
+ case KeyNavState.Startup:
+ keynav_state = KeyNavState.NoPopups;
+ SelectItem (TopMenu, TopMenu.MenuItems [0], false);
+ break;
+ default:
+ keynav_state = KeyNavState.Idle;
+ Deactivate ();
+ main_menu.Draw ();
+ break;
+ }
+ break;
+
+ default:
+ throw new ArgumentException ("Invalid msg_type " + msg_type);
+ }
+ }
+
+ bool ProcessMnemonic (Message msg, Keys key_data)
+ {
+ keynav_state = KeyNavState.Navigating;
+ MenuItem item = FindItemByKey (CurrentMenu, msg.WParam);
+ if (item == null)
+ return false;
+
+ SelectItem (CurrentMenu, item, true);
+ if (item.IsPopup) {
+ SelectItem (item, item.MenuItems [0], false);
+ CurrentMenu = item;
+ }
+ return true;
+ }
+
+ void ProcessArrowKey (Keys keyData)
+ {
+ MenuItem item;
+ switch (keyData) {
+ case Keys.Up:
+ if (CurrentMenu is MainMenu)
+ return;
+ else if (CurrentMenu.MenuItems.Count == 1 && CurrentMenu.parent_menu == TopMenu) {
+ DeselectItem (CurrentMenu.SelectedItem);
+ CurrentMenu = TopMenu;
+ return;
+ }
+ item = GetNextItem (CurrentMenu, ItemNavigation.Previous);
+ if (item != null)
+ SelectItem (CurrentMenu, item, false);
+ break;
+
+ case Keys.Down:
+ if (CurrentMenu is MainMenu) {
+ if (CurrentMenu.SelectedItem != null && CurrentMenu.SelectedItem.IsPopup) {
+ keynav_state = KeyNavState.Navigating;
+ item = CurrentMenu.SelectedItem;
+ ShowSubPopup (CurrentMenu, item);
+ SelectItem (item, item.MenuItems [0], false);
+ CurrentMenu = item;
+ }
+ return;
+ }
+ item = GetNextItem (CurrentMenu, ItemNavigation.Next);
+ if (item != null)
+ SelectItem (CurrentMenu, item, false);
+ break;
+
+ case Keys.Right:
+ if (CurrentMenu is MainMenu) {
+ item = GetNextItem (CurrentMenu, ItemNavigation.Next);
+ bool popup = item.IsPopup && keynav_state != KeyNavState.NoPopups;
+ SelectItem (CurrentMenu, item, popup);
+ if (popup) {
+ SelectItem (item, item.MenuItems [0], false);
+ CurrentMenu = item;
+ }
+ } else if (CurrentMenu.SelectedItem.IsPopup) {
+ item = CurrentMenu.SelectedItem;
+ ShowSubPopup (CurrentMenu, item);
+ SelectItem (item, item.MenuItems [0], false);
+ CurrentMenu = item;
+ } else if (CurrentMenu.parent_menu is MainMenu) {
+ item = GetNextItem (CurrentMenu.parent_menu, ItemNavigation.Next);
+ SelectItem (CurrentMenu.parent_menu, item, item.IsPopup);
+ if (item.IsPopup) {
+ SelectItem (item, item.MenuItems [0], false);
+ CurrentMenu = item;
+ }
+ }
+ break;
+
+ case Keys.Left:
+ if (CurrentMenu is MainMenu) {
+ item = GetNextItem (CurrentMenu, ItemNavigation.Previous);
+ bool popup = item.IsPopup && keynav_state != KeyNavState.NoPopups;
+ SelectItem (CurrentMenu, item, popup);
+ if (popup) {
+ SelectItem (item, item.MenuItems [0], false);
+ CurrentMenu = item;
+ }
+ } else if (CurrentMenu.parent_menu is MainMenu) {
+ item = GetNextItem (CurrentMenu.parent_menu, ItemNavigation.Previous);
+ SelectItem (CurrentMenu.parent_menu, item, item.IsPopup);
+ if (item.IsPopup) {
+ SelectItem (item, item.MenuItems [0], false);
+ CurrentMenu = item;
+ }
+ } else {
+ HideSubPopups (CurrentMenu);
+ CurrentMenu = CurrentMenu.parent_menu;
+ }
+ break;
+ default:
+ throw new ArgumentException ("Invalid keyData: " + keyData);
+ }
+ }
+
+ Hashtable shortcuts = new Hashtable ();
+
+ public void AddShortcuts (MenuItem item)
+ {
+ foreach (MenuItem child in item.MenuItems) {
+ AddShortcuts (child);
+ if (child.Shortcut != Shortcut.None)
+ shortcuts [(int)child.Shortcut] = child;
+ }
+
+ if (item.Shortcut != Shortcut.None)
+ shortcuts [(int)item.Shortcut] = item;
+ }
+
+ public void RemoveShortcuts (MenuItem item)
+ {
+ foreach (MenuItem child in item.MenuItems) {
+ RemoveShortcuts (child);
+ if (child.Shortcut != Shortcut.None)
+ shortcuts.Remove ((int)child.Shortcut);
+ }
+
+ if (item.Shortcut != Shortcut.None)
+ shortcuts.Remove ((int)item.Shortcut);
+ }
+
+ bool ProcessShortcut (Keys keyData)
+ {
+ MenuItem item = shortcuts [(int)keyData] as MenuItem;
+ if (item == null)
+ return false;
+
+ Deactivate ();
+ item.PerformClick ();
+ return true;
+ }
+
+ public bool ProcessKeys (ref Message msg, Keys keyData)
+ {
+ if ((Msg)msg.Msg != Msg.WM_SYSKEYUP && ProcessShortcut (keyData))
+ return true;
+ else if ((keyData & Keys.KeyCode) == Keys.Menu && TopMenu is MainMenu) {
+ ProcessMenuKey ((Msg) msg.Msg);
+ return true;
+ } else if ((keyData & Keys.Alt) == Keys.Alt)
+ return ProcessMnemonic (msg, keyData);
+ else if ((Msg)msg.Msg == Msg.WM_SYSKEYUP || keynav_state == KeyNavState.Idle)
+ return false;
+
+ switch (keyData) {
+ case Keys.Up:
+ case Keys.Down:
+ case Keys.Right:
+ case Keys.Left:
+ ProcessArrowKey (keyData);
+ break;
+
+ case Keys.Escape:
+ Deactivate ();
+ break;
+
+ case Keys.Return:
+ ExecFocusedItem (CurrentMenu, CurrentMenu.SelectedItem);
+ break;
+
+ default:
+ ProcessMnemonic (msg, keyData);
+ break;
+ }
+
+ return true;
+ }
+ }
+
+ internal class PopUpWindow : Control
+ {
+ private Menu menu;
+
+ public PopUpWindow (Menu menu): base ()
+ {
+ this.menu = menu;
+ Paint += new PaintEventHandler (OnPaintPUW);
+ SetStyle (ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
+ SetStyle (ControlStyles.ResizeRedraw | ControlStyles.Opaque, true);
+ is_visible = false;
+ }
+
+ protected override CreateParams CreateParams
+ {
+ get {
+ CreateParams cp = base.CreateParams;
+ cp.Caption = "Menu PopUp";
+ cp.Style = unchecked ((int)(WindowStyles.WS_POPUP));
+ cp.ExStyle |= (int)(WindowStyles.WS_EX_TOOLWINDOW | WindowStyles.WS_EX_TOPMOST);
+ return cp;
+ }
+ }
+
+ public void ShowWindow ()
+ {
+ Show ();
+ RefreshItems ();
+ Refresh ();
+ }
+
+ private void OnPaintPUW (Object o, PaintEventArgs args)
+ {
+ ThemeEngine.Current.DrawPopupMenu (args.Graphics, menu, args.ClipRectangle, ClientRectangle);
+ }
+
+ public void HideWindow ()
+ {
+ MenuTracker.HideSubPopups (menu);
+ Hide ();
+ }
+
+#if false
+ protected override bool ProcessCmdKey (ref Message msg, Keys keyData)
+ {
+ return MenuTracker.ProcessKeys (menu, ref msg, keyData, tracker);
+ }
+#endif
+
+ protected override void CreateHandle ()
+ {
+ base.CreateHandle ();
+ RefreshItems ();
+ }
+
+ // Called when the number of items has changed
+ internal void RefreshItems ()
+ {
+ ThemeEngine.Current.CalcPopupMenuSize (DeviceContext, menu);
+
+ if ((Location.X + menu.Rect.Width) > SystemInformation.WorkingArea.Width) {
+ Location = new Point (Location.X - menu.Rect.Width, Location.Y);
+ }
+ if ((Location.Y + menu.Rect.Height) > SystemInformation.WorkingArea.Height) {
+ Location = new Point (Location.X, Location.Y - menu.Rect.Height);
+ }
+
+ Width = menu.Rect.Width;
+ Height = menu.Rect.Height;
+ }
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuGlyph.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuGlyph.cs
new file mode 100644
index 00000000000..459337ae4ba
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuGlyph.cs
@@ -0,0 +1,36 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public enum MenuGlyph {
+ Arrow = 0,
+ Min = 0,
+ Checkmark = 1,
+ Bullet = 2,
+ Max = 2
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuItem.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuItem.cs
new file mode 100644
index 00000000000..6e7ec0dfd95
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuItem.cs
@@ -0,0 +1,673 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+//
+
+// NOT COMPLETE
+
+using System.Collections;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Drawing;
+using System.Drawing.Text;
+
+namespace System.Windows.Forms
+{
+ [DefaultProperty("Text")]
+ [DefaultEvent("Click")]
+ [DesignTimeVisible(false)]
+ [ToolboxItem(false)]
+ public class MenuItem : Menu
+ {
+ internal bool separator;
+ internal bool break_;
+ internal bool bar_break;
+ private Shortcut shortcut;
+ private string text;
+ private bool checked_;
+ private bool radiocheck;
+ private bool enabled;
+ private char mnemonic;
+ private bool showshortcut;
+ private int index;
+ private bool mdilist;
+ private Hashtable mdilist_items;
+ private MdiClient mdicontainer;
+ private bool defaut_item;
+ private bool visible;
+ private bool ownerdraw;
+ private int menuid;
+ private int mergeorder;
+ private int xtab;
+ private int menuheight;
+ private bool menubar;
+ private DrawItemState status;
+ private MenuMerge mergetype;
+ internal Rectangle bounds;
+
+ public MenuItem (): base (null)
+ {
+ CommonConstructor (string.Empty);
+ shortcut = Shortcut.None;
+ }
+
+ public MenuItem (string text) : base (null)
+ {
+ CommonConstructor (text);
+ shortcut = Shortcut.None;
+ }
+
+ public MenuItem (string text, EventHandler onClick) : base (null)
+ {
+ CommonConstructor (text);
+ shortcut = Shortcut.None;
+ Click += onClick;
+ }
+
+ public MenuItem (string text, MenuItem[] items) : base (items)
+ {
+ CommonConstructor (text);
+ shortcut = Shortcut.None;
+ }
+
+ public MenuItem (string text, EventHandler onClick, Shortcut shortcut) : base (null)
+ {
+ CommonConstructor (text);
+ Click += onClick;
+ this.shortcut = shortcut;
+ }
+
+ public MenuItem (MenuMerge mergeType, int mergeOrder, Shortcut shortcut, string text,
+ EventHandler onClick, EventHandler onPopup, EventHandler onSelect, MenuItem[] items)
+ : base (items)
+ {
+ CommonConstructor (text);
+ this.shortcut = shortcut;
+ mergeorder = mergeOrder;
+ mergetype = mergeType;
+
+ Click += onClick;
+ Popup += onPopup;
+ Select += onSelect;
+ }
+
+ private void CommonConstructor (string text)
+ {
+ defaut_item = false;
+ separator = false;
+ break_ = false;
+ bar_break = false;
+ checked_ = false;
+ radiocheck = false;
+ enabled = true;
+ showshortcut = true;
+ visible = true;
+ ownerdraw = false;
+ status = DrawItemState.None;
+ menubar = false;
+ menuheight = 0;
+ xtab = 0;
+ index = -1;
+ mnemonic = '\0';
+ menuid = -1;
+ mergeorder = 0;
+ mergetype = MenuMerge.Add;
+ Text = text; // Text can change separator status
+ }
+
+ #region Events
+ public event EventHandler Click;
+ public event DrawItemEventHandler DrawItem;
+ public event MeasureItemEventHandler MeasureItem;
+ public event EventHandler Popup;
+ public event EventHandler Select;
+ #endregion // Events
+
+ #region Public Properties
+
+ [Browsable(false)]
+ [DefaultValue(false)]
+ public bool BarBreak {
+ get { return break_; }
+ set { break_ = value; }
+ }
+
+ [Browsable(false)]
+ [DefaultValue(false)]
+ public bool Break {
+ get { return bar_break; }
+ set { bar_break = value; }
+ }
+
+ [DefaultValue(false)]
+ public bool Checked {
+ get { return checked_; }
+ set { checked_ = value; }
+ }
+
+ [DefaultValue(false)]
+ public bool DefaultItem {
+ get { return defaut_item; }
+ set { defaut_item = value; }
+ }
+
+ [DefaultValue(true)]
+ [Localizable(true)]
+ public bool Enabled {
+ get { return enabled; }
+ set { enabled = value; }
+ }
+
+ [Browsable(false)]
+ public int Index {
+ get { return index; }
+ set {
+ if (Parent != null && Parent.MenuItems != null && (value < 0 || value >= Parent.MenuItems.Count))
+ throw new ArgumentException ("'" + value + "' is not a valid value for 'value'");
+ index = value;
+ }
+ }
+
+ [Browsable(false)]
+ public override bool IsParent {
+ get { return IsPopup; }
+ }
+
+ [DefaultValue(false)]
+ public bool MdiList {
+ get { return mdilist; }
+ set {
+ if (mdilist == value)
+ return;
+ mdilist = value;
+
+ if (mdilist || mdilist_items == null)
+ return;
+
+ foreach (MenuItem item in mdilist_items.Keys)
+ MenuItems.Remove (item);
+ mdilist_items.Clear ();
+ mdilist_items = null;
+
+ }
+ }
+
+ protected int MenuID {
+ get { return menuid; }
+ }
+
+ [DefaultValue(0)]
+ public int MergeOrder {
+ get { return mergeorder; }
+ set { mergeorder = value; }
+ }
+
+ [DefaultValue(MenuMerge.Add)]
+ public MenuMerge MergeType {
+ get { return mergetype; }
+ set {
+ if (!Enum.IsDefined (typeof (MenuMerge), value))
+ throw new InvalidEnumArgumentException (string.Format("Enum argument value '{0}' is not valid for MenuMerge", value));
+
+ mergetype = value;
+ }
+ }
+
+ [Browsable(false)]
+ public char Mnemonic {
+ get { return mnemonic; }
+ }
+
+ [DefaultValue(false)]
+ public bool OwnerDraw {
+ get { return ownerdraw; }
+ set { ownerdraw = value; }
+ }
+
+ [Browsable(false)]
+ public Menu Parent {
+ get { return parent_menu;}
+ }
+
+ [DefaultValue(false)]
+ public bool RadioCheck {
+ get { return radiocheck; }
+ set { radiocheck = value; }
+ }
+
+ [DefaultValue(Shortcut.None)]
+ [Localizable(true)]
+ public Shortcut Shortcut {
+ get { return shortcut;}
+ set {
+ if (!Enum.IsDefined (typeof (Shortcut), value))
+ throw new InvalidEnumArgumentException (string.Format("Enum argument value '{0}' is not valid for Shortcut", value));
+
+ shortcut = value;
+ }
+ }
+
+ [DefaultValue(true)]
+ [Localizable(true)]
+ public bool ShowShortcut {
+ get { return showshortcut;}
+ set { showshortcut = value; }
+ }
+
+ [Localizable(true)]
+ public string Text {
+ get { return text; }
+ set {
+ text = value;
+
+ if (text == "-")
+ separator = true;
+ else
+ separator = false;
+
+ ProcessMnemonic ();
+ }
+ }
+
+ [DefaultValue(true)]
+ [Localizable(true)]
+ public bool Visible {
+ get { return visible;}
+ set {
+ if (value == visible)
+ return;
+
+ visible = value;
+
+ if (menu_items != null) {
+ foreach (MenuItem mi in menu_items)
+ mi.Visible = value;
+ }
+
+ if (parent_menu != null)
+ parent_menu.OnMenuChanged (EventArgs.Empty);
+ }
+ }
+
+ #endregion Public Properties
+
+ #region Private Properties
+
+ internal new int Height {
+ get { return bounds.Height; }
+ set { bounds.Height = value; }
+ }
+
+ internal bool IsPopup {
+ get {
+ if (menu_items.Count > 0)
+ return true;
+ else
+ return false;
+ }
+ }
+
+ internal bool MeasureEventDefined {
+ get {
+ if (ownerdraw == true && MeasureItem != null) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ }
+
+ internal bool MenuBar {
+ get { return menubar; }
+ set { menubar = value; }
+ }
+
+ internal int MenuHeight {
+ get { return menuheight; }
+ set { menuheight = value; }
+ }
+
+ internal bool Separator {
+ get { return separator; }
+ set { separator = value; }
+ }
+
+ internal DrawItemState Status {
+ get { return status; }
+ set { status = value; }
+ }
+
+ internal new int Width {
+ get { return bounds.Width; }
+ set { bounds.Width = value; }
+ }
+
+ internal new int X {
+ get { return bounds.X; }
+ set { bounds.X = value; }
+ }
+
+ internal int XTab {
+ get { return xtab; }
+ set { xtab = value; }
+ }
+
+ internal new int Y {
+ get { return bounds.Y; }
+ set { bounds.Y = value; }
+ }
+
+ #endregion Private Properties
+
+ #region Public Methods
+
+ public virtual MenuItem CloneMenu ()
+ {
+ MenuItem item = new MenuItem ();
+ item.CloneMenu (this);
+ return item;
+ }
+
+ protected void CloneMenu (MenuItem menuitem)
+ {
+ base.CloneMenu (menuitem); // Copy subitems
+
+ // Properties
+ BarBreak = menuitem.BarBreak;
+ Break = menuitem.Break;
+ Checked = menuitem.Checked;
+ DefaultItem = menuitem.DefaultItem;
+ Enabled = menuitem.Enabled;
+ MergeOrder = menuitem.MergeOrder;
+ MergeType = menuitem.MergeType;
+ OwnerDraw = menuitem.OwnerDraw;
+ //Parent = menuitem.Parent;
+ RadioCheck = menuitem.RadioCheck;
+ Shortcut = menuitem.Shortcut;
+ ShowShortcut = menuitem.ShowShortcut;
+ Text = menuitem.Text;
+ Visible = menuitem.Visible;
+
+ // Events
+ Click = menuitem.Click;
+ DrawItem = menuitem.DrawItem;
+ MeasureItem = menuitem.MeasureItem;
+ Popup = menuitem.Popup;
+ Select = menuitem.Select;
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ base.Dispose (disposing);
+ }
+
+ // This really clones the item
+ public virtual MenuItem MergeMenu ()
+ {
+ MenuItem item = new MenuItem ();
+ item.CloneMenu (this);
+ return item;
+ }
+
+ public void MergeMenu (MenuItem menuitem)
+ {
+ base.MergeMenu (menuitem);
+ }
+
+ protected virtual void OnClick (EventArgs e)
+ {
+ if (Click != null)
+ Click (this, e);
+ }
+
+ protected virtual void OnDrawItem (DrawItemEventArgs e)
+ {
+ if (DrawItem != null) {
+ DrawItem (this, e);
+ return;
+ }
+
+ ThemeEngine.Current.DrawMenuItem (this, e);
+ }
+
+
+ protected virtual void OnInitMenuPopup (EventArgs e)
+ {
+ OnPopup (e);
+ }
+
+ protected virtual void OnMeasureItem (MeasureItemEventArgs e)
+ {
+ if (MeasureItem != null)
+ MeasureItem (this, e);
+ }
+
+ protected virtual void OnPopup (EventArgs e)
+ {
+ if (Popup != null)
+ Popup (this, e);
+ }
+
+ protected virtual void OnSelect (EventArgs e)
+ {
+ if (Select != null)
+ Select (this, e);
+ }
+
+ public void PerformClick ()
+ {
+ OnClick (EventArgs.Empty);
+ }
+
+ public virtual void PerformSelect ()
+ {
+ OnSelect (EventArgs.Empty);
+ }
+
+ public override string ToString ()
+ {
+ return base.ToString () + ", Items.Count: " + MenuItems.Count + ", Text: " + text;
+ }
+
+ #endregion Public Methods
+
+ #region Private Methods
+
+ internal void PerformDrawItem (DrawItemEventArgs e)
+ {
+ if (mdilist && mdilist_items == null) {
+ do {
+ // Add the mdilist for the first time
+ mdilist_items = new Hashtable ();
+
+ MainMenu main = GetMainMenu ();
+ if (main == null || main.GetForm () == null)
+ break;
+
+ Form form = main.GetForm ();
+ mdicontainer = form.MdiContainer;
+ if (mdicontainer == null)
+ break;
+
+ foreach (Form mdichild in mdicontainer.Controls) {
+ MenuItem item = new MenuItem (mdichild.Text);
+ item.Click += new EventHandler (MdiWindowClickHandler);
+ MenuItems.Add (item);
+ mdilist_items.Add (item, form);
+ }
+
+ } while (false);
+ }
+
+ OnDrawItem (e);
+ }
+
+ internal void PerformMeasureItem (MeasureItemEventArgs e)
+ {
+ OnMeasureItem (e);
+ }
+
+ private void ProcessMnemonic ()
+ {
+ if (text.Length < 2) {
+ mnemonic = '\0';
+ return;
+ }
+
+ bool bPrevAmp = false;
+ for (int i = 0; i < text.Length -1 ; i++) {
+ if (text[i] == '&') {
+ if (bPrevAmp == false && (text[i+1] != '&')) {
+ mnemonic = Char.ToUpper (text[i+1]);
+ return;
+ }
+
+ bPrevAmp = true;
+ }
+ else
+ bPrevAmp = false;
+ }
+
+ mnemonic = '\0';
+ }
+
+ private string GetShortCutTextCtrl () { return "Ctrl"; }
+ private string GetShortCutTextAlt () { return "Alt"; }
+ private string GetShortCutTextShift () { return "Shift"; }
+
+ internal string GetShortCutText ()
+ {
+ /* Ctrl+A - Ctrl+Z */
+ if (Shortcut >= Shortcut.CtrlA && Shortcut <= Shortcut.CtrlZ)
+ return GetShortCutTextCtrl () + "+" + (char)((int) 'A' + (int)(Shortcut - Shortcut.CtrlA));
+
+ /* Alt+0 - Alt+9 */
+ if (Shortcut >= Shortcut.Alt0 && Shortcut <= Shortcut.Alt9)
+ return GetShortCutTextAlt () + "+" + (char)((int) '0' + (int)(Shortcut - Shortcut.Alt0));
+
+ /* Alt+F1 - Alt+F2 */
+ if (Shortcut >= Shortcut.AltF1 && Shortcut <= Shortcut.AltF9)
+ return GetShortCutTextAlt () + "+F" + (char)((int) '1' + (int)(Shortcut - Shortcut.AltF1));
+
+ /* Ctrl+0 - Ctrl+9 */
+ if (Shortcut >= Shortcut.Ctrl0 && Shortcut <= Shortcut.Ctrl9)
+ return GetShortCutTextCtrl () + "+" + (char)((int) '0' + (int)(Shortcut - Shortcut.Ctrl0));
+
+ /* Ctrl+F0 - Ctrl+F9 */
+ if (Shortcut >= Shortcut.CtrlF1 && Shortcut <= Shortcut.CtrlF9)
+ return GetShortCutTextCtrl () + "+F" + (char)((int) '1' + (int)(Shortcut - Shortcut.CtrlF1));
+
+ /* Ctrl+Shift+0 - Ctrl+Shift+9 */
+ if (Shortcut >= Shortcut.CtrlShift0 && Shortcut <= Shortcut.CtrlShift9)
+ return GetShortCutTextCtrl () + "+" + GetShortCutTextShift () + "+" + (char)((int) '0' + (int)(Shortcut - Shortcut.CtrlShift0));
+
+ /* Ctrl+Shift+A - Ctrl+Shift+Z */
+ if (Shortcut >= Shortcut.CtrlShiftA && Shortcut <= Shortcut.CtrlShiftZ)
+ return GetShortCutTextCtrl () + "+" + GetShortCutTextShift () + "+" + (char)((int) 'A' + (int)(Shortcut - Shortcut.CtrlShiftA));
+
+ /* Ctrl+Shift+F1 - Ctrl+Shift+F9 */
+ if (Shortcut >= Shortcut.CtrlShiftF1 && Shortcut <= Shortcut.CtrlShiftF9)
+ return GetShortCutTextCtrl () + "+" + GetShortCutTextShift () + "+F" + (char)((int) '1' + (int)(Shortcut - Shortcut.CtrlShiftF1));
+
+ /* F1 - F9 */
+ if (Shortcut >= Shortcut.F1 && Shortcut <= Shortcut.F9)
+ return "F" + (char)((int) '1' + (int)(Shortcut - Shortcut.F1));
+
+ /* Shift+F1 - Shift+F9 */
+ if (Shortcut >= Shortcut.ShiftF1 && Shortcut <= Shortcut.ShiftF9)
+ return GetShortCutTextShift () + "+F" + (char)((int) '1' + (int)(Shortcut - Shortcut.ShiftF1));
+
+ /* Special cases */
+ switch (Shortcut) {
+ case Shortcut.AltBksp:
+ return "AltBksp";
+ case Shortcut.AltF10:
+ return GetShortCutTextAlt () + "+F10";
+ case Shortcut.AltF11:
+ return GetShortCutTextAlt () + "+F11";
+ case Shortcut.AltF12:
+ return GetShortCutTextAlt () + "+F12";
+ case Shortcut.CtrlDel:
+ return GetShortCutTextCtrl () + "+Del";
+ case Shortcut.CtrlF10:
+ return GetShortCutTextCtrl () + "+F10";
+ case Shortcut.CtrlF11:
+ return GetShortCutTextCtrl () + "+F11";
+ case Shortcut.CtrlF12:
+ return GetShortCutTextCtrl () + "+F12";
+ case Shortcut.CtrlIns:
+ return GetShortCutTextCtrl () + "+Ins";
+ case Shortcut.CtrlShiftF10:
+ return GetShortCutTextCtrl () + "+" + GetShortCutTextShift () + "+F10";
+ case Shortcut.CtrlShiftF11:
+ return GetShortCutTextCtrl () + "+" + GetShortCutTextShift () + "+F11";
+ case Shortcut.CtrlShiftF12:
+ return GetShortCutTextCtrl () + "+" + GetShortCutTextShift () + "+F12";
+ case Shortcut.Del:
+ return "Del";
+ case Shortcut.F10:
+ return "F10";
+ case Shortcut.F11:
+ return "F11";
+ case Shortcut.F12:
+ return "F12";
+ case Shortcut.Ins:
+ return "Ins";
+ case Shortcut.None:
+ return "None";
+ case Shortcut.ShiftDel:
+ return GetShortCutTextShift () + "+Del";
+ case Shortcut.ShiftF10:
+ return GetShortCutTextShift () + "+F10";
+ case Shortcut.ShiftF11:
+ return GetShortCutTextShift () + "+F11";
+ case Shortcut.ShiftF12:
+ return GetShortCutTextShift () + "+F12";
+ case Shortcut.ShiftIns:
+ return GetShortCutTextShift () + "+Ins";
+ default:
+ break;
+ }
+
+ return "";
+ }
+
+ private void MdiWindowClickHandler (object sender, EventArgs e)
+ {
+ Form mdichild = (Form) mdilist_items [SelectedItem];
+
+ // people could add weird items to the Window menu
+ // so we can't assume its just us
+ if (mdichild == null)
+ return;
+
+ mdicontainer.ActivateChild (mdichild);
+ }
+
+ #endregion Private Methods
+
+ }
+}
+
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuMerge.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuMerge.cs
new file mode 100644
index 00000000000..2df9a7b9be1
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuMerge.cs
@@ -0,0 +1,38 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+//
+
+namespace System.Windows.Forms
+{
+ public enum MenuMerge
+ {
+ Add = 0,
+ Replace = 1,
+ MergeItems = 2,
+ Remove = 3,
+ }
+}
+
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Message.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Message.cs
new file mode 100644
index 00000000000..42649008dee
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Message.cs
@@ -0,0 +1,108 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+
+
+// COMPLETE
+
+using System;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Diagnostics;
+
+namespace System.Windows.Forms {
+ public struct Message {
+ private int msg;
+ private IntPtr hwnd;
+ private IntPtr lParam;
+ private IntPtr wParam;
+ private IntPtr result;
+
+ #region Public Instance Properties
+ public IntPtr HWnd {
+ get { return hwnd; }
+ set { hwnd=value; }
+ }
+
+ public IntPtr LParam {
+ get { return lParam; }
+ set { lParam=value; }
+ }
+
+ public int Msg {
+ get { return msg; }
+ set { msg=value; }
+ }
+
+ public IntPtr Result {
+ get { return result; }
+ set { result=value; }
+ }
+
+ public IntPtr WParam {
+ get { return wParam; }
+ set { wParam=value; }
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Static Methods
+ public static Message Create(IntPtr hWnd, int msg, IntPtr wparam, IntPtr lparam) {
+ Message new_message = new Message();
+
+ new_message.msg=msg;
+ new_message.hwnd=hWnd;
+ new_message.wParam=wparam;
+ new_message.lParam=lparam;
+ return new_message;
+ }
+ #endregion // Public Static Methods
+
+ #region Public Instance Methods
+ public override bool Equals(object o) {
+ if (!(o is Message)) {
+ return false;
+ }
+
+ return ((this.msg == ((Message)o).msg) &&
+ (this.hwnd == ((Message)o).hwnd) &&
+ (this.lParam == ((Message)o).lParam) &&
+ (this.wParam == ((Message)o).wParam) &&
+ (this.result == ((Message)o).result));
+ }
+
+ public override int GetHashCode() {
+ return base.GetHashCode();
+ }
+
+ public object GetLParam(Type cls) {
+ object o = Marshal.PtrToStructure(this.lParam, cls);
+
+ return(o);
+ }
+
+ public override string ToString() {
+ return String.Format("[{0} {1} {2} {3}]", msg.ToString(), lParam.ToString(), wParam.ToString(), hwnd.ToString());
+ }
+ #endregion // Public Instance Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MessageBox.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MessageBox.cs
new file mode 100644
index 00000000000..499e99aee2c
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MessageBox.cs
@@ -0,0 +1,516 @@
+// 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.
+//
+// Authors:
+// Jordi Mas i Hernandez (jordi@ximian.com)
+// Benjamin Dasnois (benjamin.dasnois@gmail.com)
+// Robert Thompson (rmt@corporatism.org)
+// Peter Bartok (pbartok@novell.com)
+//
+// TODO:
+// - Complete the implementation when Form.BorderStyle is available.
+// - Add support for MessageBoxOptions and MessageBoxDefaultButton.
+// - Button size calculations assume fixed height for buttons, that could be bad
+//
+
+
+// NOT COMPLETE
+
+using System;
+using System.Drawing;
+using System.Globalization;
+using System.Resources;
+
+namespace System.Windows.Forms
+{
+ public class MessageBox
+ {
+ #region Private MessageBoxForm class
+ private class MessageBoxForm : Form
+ {
+ #region MessageBoxFrom Local Variables
+ internal static string Yes;
+ internal const int space_border = 10;
+ string msgbox_text;
+ bool size_known = false;
+ const int space_image_text= 10;
+ Image icon_image;
+ Point textleft_up;
+ MessageBoxButtons msgbox_buttons;
+ bool buttons_placed = false;
+ int button_left;
+ #endregion // MessageBoxFrom Local Variables
+
+ #region MessageBoxForm Constructors
+ public MessageBoxForm (IWin32Window owner, string text, string caption,
+ MessageBoxButtons buttons, MessageBoxIcon icon)
+ {
+ switch (icon) {
+ case MessageBoxIcon.None: {
+ icon_image = null;
+ break;
+ }
+
+ case MessageBoxIcon.Error: { // Same as MessageBoxIcon.Hand and MessageBoxIcon.Stop
+ icon_image = ThemeEngine.Current.Images(UIIcon.MessageBoxError);
+ break;
+ }
+
+ case MessageBoxIcon.Question: {
+ icon_image = ThemeEngine.Current.Images(UIIcon.MessageBoxQuestion);
+ break;
+ }
+
+ case MessageBoxIcon.Asterisk: { // Same as MessageBoxIcon.Information
+ icon_image = ThemeEngine.Current.Images(UIIcon.MessageBoxInfo);
+ break;
+ }
+
+ case MessageBoxIcon.Warning: { // Same as MessageBoxIcon.Exclamation:
+ icon_image = ThemeEngine.Current.Images(UIIcon.MessageBoxWarning);
+ break;
+ }
+ }
+
+ msgbox_text = text;
+ msgbox_buttons = buttons;
+ this.Text = caption;
+ this.Paint += new PaintEventHandler (MessageBoxForm_Paint);
+ }
+
+ [MonoTODO]
+ public MessageBoxForm (IWin32Window owner, string text, string caption,
+ MessageBoxButtons buttons, MessageBoxIcon icon,
+ MessageBoxDefaultButton defaultButton, MessageBoxOptions options) : this (owner, text, caption, buttons, icon)
+ {
+ // Still needs to implement defaultButton and options
+
+ }
+ #endregion // MessageBoxForm Constructors
+
+ #region Protected Instance Properties
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams cp;
+
+ ControlBox = true;
+ MinimizeBox = false;
+ MaximizeBox = false;
+
+ cp = base.CreateParams;
+
+ cp.Style = (int)(WindowStyles.WS_DLGFRAME | WindowStyles.WS_POPUP | WindowStyles.WS_CLIPCHILDREN | WindowStyles.WS_CLIPSIBLINGS | WindowStyles.WS_CAPTION);
+ if (!is_enabled) {
+ cp.Style |= (int)(WindowStyles.WS_DISABLED);
+ }
+
+ return cp;
+ }
+ }
+ #endregion // Protected Instance Properties
+
+ #region MessageBoxForm Methods
+ public DialogResult RunDialog ()
+ {
+ this.StartPosition = FormStartPosition.CenterScreen;
+
+ if (size_known == false) {
+ InitFormsSize ();
+ }
+
+ this.ShowDialog ();
+
+ return this.DialogResult;
+
+ }
+
+ private void MessageBoxForm_Paint (object sender, PaintEventArgs e)
+ {
+ e.Graphics.DrawString (msgbox_text, this.Font, ThemeEngine.Current.ResPool.GetSolidBrush (Color.Black), textleft_up);
+ if (icon_image != null) {
+ e.Graphics.DrawImage(icon_image, new Point(space_border, space_border));
+ }
+ }
+
+ private void InitFormsSize ()
+ {
+ int tb_width = 0;
+
+ // First we have to know the size of text + image
+ Drawing.SizeF tsize = DeviceContext.MeasureString (msgbox_text, this.Font);
+
+ if (icon_image != null) {
+ tsize.Width += icon_image.Width + 10;
+ if(icon_image.Height > tsize.Height) {
+ // Place text middle-right
+ textleft_up = new Point (icon_image.Width + space_image_text + space_border, (int)((icon_image.Height/2)-(tsize.Height/2)) + space_border);
+ } else {
+ textleft_up = new Point (icon_image.Width + space_image_text + space_border, 2 + space_border);
+ }
+ tsize.Height = icon_image.Height;
+ } else {
+ tsize.Width += space_border * 2;
+ textleft_up = new Point (space_border + 12, space_border + 12);
+ tsize.Height += space_border * 2;
+ }
+
+ // Now we want to know the width of buttons
+
+ switch (msgbox_buttons) {
+ case MessageBoxButtons.OK: {
+ tb_width = 110 * 1;
+ break;
+ }
+
+ case MessageBoxButtons.OKCancel: {
+ tb_width = 110 * 2;
+ break;
+ }
+
+ case MessageBoxButtons.AbortRetryIgnore: {
+ tb_width = 110 * 3;
+ break;
+ }
+
+ case MessageBoxButtons.YesNoCancel: {
+ tb_width = 110 * 3;
+ break;
+ }
+
+ case MessageBoxButtons.YesNo: {
+ tb_width = 110 * 2;
+ break;
+ }
+
+ case MessageBoxButtons.RetryCancel: {
+ tb_width = 110 * 2;
+ break;
+ }
+ }
+
+ // Now we choose the good size for the form
+ if (tsize.ToSize ().Width > tb_width) {
+ //this.Width = tsize.ToSize().Width + 10;
+ this.ClientSize = new Size(tsize.ToSize().Width + 10 + (space_border * 2), Height = tsize.ToSize ().Height + 40 + (space_border * 2));
+ } else {
+ //this.Width = tb_width + 10;
+ this.ClientSize = new Size(tb_width + 10 + (space_border * 2), Height = tsize.ToSize ().Height + 40 + (space_border * 2));
+ }
+
+ // Now we set the left of the buttons
+ button_left = (this.ClientSize.Width / 2) - (tb_width / 2) + 5;
+ AddButtons ();
+ size_known = true;
+ }
+ #endregion // MessageBoxForm Methods
+
+ #region Functions for Adding buttons
+ private void AddButtons()
+ {
+ if (!buttons_placed) {
+ switch (msgbox_buttons) {
+ case MessageBoxButtons.OK: {
+ AddOkButton (0 + button_left);
+ break;
+ }
+
+ case MessageBoxButtons.OKCancel: {
+ AddOkButton (0 + button_left);
+ AddCancelButton (110 + button_left);
+ break;
+ }
+
+ case MessageBoxButtons.AbortRetryIgnore: {
+ AddAbortButton (0 + button_left);
+ AddRetryButton (110 + button_left);
+ AddIgnoreButton (220 + button_left);
+ break;
+ }
+
+ case MessageBoxButtons.YesNoCancel: {
+ AddYesButton (0 + button_left);
+ AddNoButton (110 + button_left);
+ AddCancelButton (220 + button_left);
+ break;
+ }
+
+ case MessageBoxButtons.YesNo: {
+ AddYesButton (0 + button_left);
+ AddNoButton (110 + button_left);
+ break;
+ }
+
+ case MessageBoxButtons.RetryCancel: {
+ AddRetryButton (0 + button_left);
+ AddCancelButton (110 + button_left);
+ break;
+ }
+ }
+ buttons_placed = true;
+ }
+ }
+
+ private void AddOkButton (int left)
+ {
+ Button bok = new Button ();
+ bok.Text = Locale.GetText("OK");
+ bok.Width = 100;
+ bok.Height = 30;
+ bok.Top = this.ClientSize.Height - 35 - space_border;
+ bok.Left = left;
+ bok.Click += new EventHandler (OkClick);
+ AcceptButton = bok;
+ this.Controls.Add (bok);
+ }
+
+ private void AddCancelButton (int left)
+ {
+ Button bcan = new Button ();
+ bcan.Text = Locale.GetText("Cancel");
+ bcan.Width = 100;
+ bcan.Height = 30;
+ bcan.Top = this.ClientSize.Height - 35 - space_border;
+ bcan.Left = left;
+ bcan.Click += new EventHandler (CancelClick);
+ CancelButton = bcan;
+ this.Controls.Add (bcan);
+ }
+
+ private void AddAbortButton (int left)
+ {
+ Button babort = new Button ();
+ babort.Text = Locale.GetText("Abort");
+ babort.Width = 100;
+ babort.Height = 30;
+ babort.Top = this.ClientSize.Height - 35 - space_border;
+ babort.Left = left;
+ babort.Click += new EventHandler (AbortClick);
+ CancelButton = babort;
+ this.Controls.Add (babort);
+ }
+
+ private void AddRetryButton(int left)
+ {
+ Button bretry = new Button ();
+ bretry.Text = Locale.GetText("Retry");
+ bretry.Width = 100;
+ bretry.Height = 30;
+ bretry.Top = this.ClientSize.Height - 35 - space_border;
+ bretry.Left = left;
+ bretry.Click += new EventHandler (RetryClick);
+ AcceptButton = bretry;
+ this.Controls.Add (bretry);
+ }
+
+ private void AddIgnoreButton (int left)
+ {
+ Button bignore = new Button ();
+ bignore.Text = Locale.GetText("Ignore");
+ bignore.Width = 100;
+ bignore.Height = 30;
+ bignore.Top = this.ClientSize.Height - 35 - space_border;
+ bignore.Left = left;
+ bignore.Click += new EventHandler (IgnoreClick);
+ this.Controls.Add (bignore);
+ }
+
+ private void AddYesButton (int left)
+ {
+ Button byes = new Button ();
+ byes.Text = Locale.GetText("Yes");
+ byes.Width = 100;
+ byes.Height = 30;
+ byes.Top = this.ClientSize.Height - 35 - space_border;
+ byes.Left = left;
+ byes.Click += new EventHandler (YesClick);
+ AcceptButton = byes;
+ this.Controls.Add (byes);
+ }
+
+ private void AddNoButton (int left)
+ {
+ Button bno = new Button ();
+ bno.Text = Locale.GetText("No");
+ bno.Width = 100;
+ bno.Height = 30;
+ bno.Top = this.ClientSize.Height - 35 - space_border;
+ bno.Left = left;
+ bno.Click += new EventHandler (NoClick);
+ CancelButton = bno;
+ this.Controls.Add (bno);
+ }
+ #endregion
+
+ #region Button click handlers
+ private void OkClick (object sender, EventArgs e)
+ {
+ this.DialogResult = DialogResult.OK;
+ this.Close ();
+ }
+
+ private void CancelClick (object sender, EventArgs e)
+ {
+ this.DialogResult = DialogResult.Cancel;
+ this.Close ();
+ }
+
+ private void AbortClick (object sender, EventArgs e)
+ {
+ this.DialogResult = DialogResult.Abort;
+ this.Close ();
+ }
+
+ private void RetryClick (object sender, EventArgs e)
+ {
+ this.DialogResult = DialogResult.Retry;
+ this.Close ();
+ }
+
+ private void IgnoreClick (object sender, EventArgs e)
+ {
+ this.DialogResult = DialogResult.Ignore;
+ this.Close ();
+ }
+
+ private void YesClick (object sender, EventArgs e)
+ {
+ this.DialogResult = DialogResult.Yes;
+ this.Close ();
+ }
+
+ private void NoClick (object sender, EventArgs e)
+ {
+ this.DialogResult = DialogResult.No;
+ this.Close ();
+ }
+ #endregion
+ }
+ #endregion // Private MessageBoxForm class
+
+
+ #region Constructors
+ private MessageBox ()
+ {
+ }
+ #endregion // Constructors
+
+ #region Public Static Methods
+ public static DialogResult Show (string text)
+ {
+ MessageBoxForm form = new MessageBoxForm (null, text, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None);
+
+ return form.RunDialog ();
+
+ }
+
+ public static DialogResult Show (IWin32Window owner, string text)
+ {
+ MessageBoxForm form = new MessageBoxForm (owner, text, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None);
+
+ return form.RunDialog ();
+
+ }
+
+ public static DialogResult Show (string text, string caption)
+ {
+ MessageBoxForm form = new MessageBoxForm (null, text, caption, MessageBoxButtons.OK, MessageBoxIcon.None);
+
+ return form.RunDialog ();
+ }
+
+ public static DialogResult Show (string text, string caption, MessageBoxButtons buttons)
+ {
+ MessageBoxForm form = new MessageBoxForm (null, text, caption, buttons, MessageBoxIcon.None);
+
+ return form.RunDialog ();
+ }
+
+ public static DialogResult Show (IWin32Window owner, string text, string caption,
+ MessageBoxButtons buttons)
+ {
+ MessageBoxForm form = new MessageBoxForm (owner, text, caption, buttons, MessageBoxIcon.None);
+
+ return form.RunDialog ();
+ }
+
+ public static DialogResult Show (IWin32Window owner, string text, string caption,
+ MessageBoxButtons buttons, MessageBoxIcon icon)
+ {
+ MessageBoxForm form = new MessageBoxForm (owner, text, caption, buttons, icon);
+
+ return form.RunDialog ();
+ }
+
+
+ public static DialogResult Show (IWin32Window owner, string text, string caption)
+ {
+ MessageBoxForm form = new MessageBoxForm (owner, text, caption, MessageBoxButtons.OK, MessageBoxIcon.None);
+
+ return form.RunDialog ();
+ }
+
+
+ public static DialogResult Show (string text, string caption, MessageBoxButtons buttons,
+ MessageBoxIcon icon)
+ {
+ MessageBoxForm form = new MessageBoxForm (null, text, caption, buttons, icon);
+
+ return form.RunDialog ();
+ }
+
+ public static DialogResult Show (string text, string caption, MessageBoxButtons buttons,
+ MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
+ {
+
+ MessageBoxForm form = new MessageBoxForm (null, text, caption, buttons, icon, defaultButton, MessageBoxOptions.DefaultDesktopOnly);
+
+ return form.RunDialog ();
+
+ }
+
+ public static DialogResult Show (IWin32Window owner, string text, string caption,
+ MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
+ {
+ MessageBoxForm form = new MessageBoxForm (owner, text, caption, buttons, icon, defaultButton, MessageBoxOptions.DefaultDesktopOnly);
+
+ return form.RunDialog ();
+ }
+
+ public static DialogResult Show (string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon,
+ MessageBoxDefaultButton defaultButton, MessageBoxOptions options)
+ {
+ MessageBoxForm form = new MessageBoxForm (null, text, caption, buttons, icon, defaultButton, options);
+
+ return form.RunDialog ();
+ }
+
+ public static DialogResult Show (IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon,
+ MessageBoxDefaultButton defaultButton, MessageBoxOptions options)
+ {
+ MessageBoxForm form = new MessageBoxForm (owner, text, caption,
+ buttons, icon, defaultButton, options);
+
+ return form.RunDialog ();
+ }
+ #endregion // Public Static Methods
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MessageBoxButtons.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MessageBoxButtons.cs
new file mode 100644
index 00000000000..eea8234d4bc
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MessageBoxButtons.cs
@@ -0,0 +1,43 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+//
+
+
+// COMPLETE
+
+
+namespace System.Windows.Forms
+{
+ public enum MessageBoxButtons
+ {
+ OK = 0,
+ OKCancel = 1,
+ AbortRetryIgnore = 2,
+ YesNoCancel = 3,
+ YesNo = 4,
+ RetryCancel = 5,
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MessageBoxDefaultButton.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MessageBoxDefaultButton.cs
new file mode 100644
index 00000000000..a5a1c4cca37
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MessageBoxDefaultButton.cs
@@ -0,0 +1,40 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+//
+
+
+// COMPLETE
+
+
+namespace System.Windows.Forms
+{
+
+ public enum MessageBoxDefaultButton
+ {
+ Button1 = 0,
+ Button2 = 0x100,
+ Button3 = 0x200,
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MessageBoxIcon.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MessageBoxIcon.cs
new file mode 100644
index 00000000000..a2ec5cd3561
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MessageBoxIcon.cs
@@ -0,0 +1,45 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+//
+
+
+// COMPLETE
+
+
+namespace System.Windows.Forms
+{
+ public enum MessageBoxIcon
+ {
+ None = 0x0000,
+ Error = 0x0010,
+ Hand = 0x0010,
+ Stop = 0x0010,
+ Question = 0x0020,
+ Exclamation = 0x0030,
+ Warning = 0x0030,
+ Asterisk = 0x0040,
+ Information = 0x0040,
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MessageBoxOptions.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MessageBoxOptions.cs
new file mode 100644
index 00000000000..ed505c9a8a9
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MessageBoxOptions.cs
@@ -0,0 +1,41 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms
+{
+ [Flags]
+ public enum MessageBoxOptions
+ {
+ DefaultDesktopOnly = 0x20000,
+ RightAlign = 0x80000,
+ RtlReading = 0x100000,
+ ServiceNotification = 0x200000,
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MethodInvoker.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MethodInvoker.cs
new file mode 100644
index 00000000000..67d3176a360
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MethodInvoker.cs
@@ -0,0 +1,32 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ [Serializable]
+ public delegate void MethodInvoker();
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Mime.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Mime.cs
new file mode 100644
index 00000000000..d7ecc084726
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Mime.cs
@@ -0,0 +1,823 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//
+// Alexander Olk xenomorph2@onlinehome.de
+//
+
+using System;
+using System.IO;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text.RegularExpressions;
+using System.Text;
+
+// Usage:
+// - for files:
+// string mimeType = Mime.GetMimeTypeForFile( string filename );
+// - for byte array:
+// string mimeType = Mime.GetMimeTypeForData( byte[] data );
+// - for string (maybe an email):
+// string mimeType = Mime.GetMimeTypeForString( string input );
+
+// - get alias for mime type:
+// string alias = Mime.GetMimeAlias( string mimeType );
+// - get subclass for mime type:
+// string subtype = Mime.GetMimeSubClass( string mimeType );
+// - get all available mime types:
+// string[] available = Mime.AvailableMimeTypes;
+
+// TODO:
+// - optimize
+// - little/big endian stuff for TypeHostXX
+// - async callback ?!?
+// - freedesktop org file extensions can have regular expressions also, resolve them too
+// - sort match collections by magic priority ( higher = first )
+// - MimeGenerated: use indexes to point to mime type name strings instead of repeating the name string each time (in match, subclass, etc.) !?!
+// - buffer is currently hard coded to size 8192, value should be determined by MimeGenerated
+
+namespace System.Windows.Forms
+{
+ internal class Mime
+ {
+ public static Mime Instance = new Mime();
+
+ private string current_file_name;
+ private string global_result = octet_stream;
+
+ private FileStream file_stream;
+
+ private byte[] buffer = new byte[ 8192 ];
+
+ private const string octet_stream = "application/octet-stream";
+ private const string text_plain = "text/plain";
+ private const string zero_file = "application/x-zerosize";
+
+ private StringDictionary mime_file_cache = new StringDictionary();
+
+ private const int mime_file_cache_max_size = 5000;
+
+ private string search_string;
+
+ private static object lock_object = new Object();
+
+ private int platform = (int) Environment.OSVersion.Platform;
+
+ private bool is_zero_file = false;
+
+ public Mime( )
+ {
+ MimeGenerated.Init( );
+
+// Console.WriteLine( "Mime Instance created..." );
+ }
+
+ public static string GetMimeTypeForFile( string filename )
+ {
+ lock ( lock_object )
+ {
+ Instance.StartByFileName( filename );
+ }
+
+ return Instance.global_result;
+ }
+
+ // not tested
+ public static string GetMimeTypeForData( byte[] data )
+ {
+ lock ( lock_object )
+ {
+ Instance.StartDataLookup( data );
+ }
+
+ return Instance.global_result;
+ }
+
+ public static string GetMimeTypeForString( string input )
+ {
+ lock ( lock_object )
+ {
+ Instance.StartStringLookup( input );
+ }
+
+ return Instance.global_result;
+ }
+
+ public static string GetMimeAlias( string mimetype )
+ {
+ return MimeGenerated.Aliases[ mimetype ];
+ }
+
+ public static string GetMimeSubClass( string mimetype )
+ {
+ return MimeGenerated.SubClasses[ mimetype ];
+ }
+
+ public static string[] AvailableMimeTypes
+ {
+ get {
+ string[] result = new string[ MimeGenerated.MimeTypes.Count ];
+
+ MimeGenerated.MimeTypes.Keys.CopyTo( result, 0 );
+
+ return result;
+ }
+ }
+
+ private void StartByFileName( string filename )
+ {
+ if ( mime_file_cache.ContainsKey( filename ) )
+ {
+ global_result = mime_file_cache[ filename ];
+ return;
+ }
+
+ current_file_name = filename;
+ is_zero_file = false;
+
+// if ( !CheckForInode( ) )
+// {
+ global_result = octet_stream;
+
+ GoByFileName( );
+// }
+
+ if ( !mime_file_cache.ContainsKey( current_file_name ) )
+ mime_file_cache.Add( current_file_name, global_result );
+
+ // not tested
+ if ( mime_file_cache.Count > mime_file_cache_max_size )
+ {
+ IEnumerator enumerator = mime_file_cache.GetEnumerator( );
+
+ for ( int i = 0; i < mime_file_cache_max_size - 1000; i++ )
+ {
+ mime_file_cache.Remove( enumerator.Current.ToString( ) );
+ }
+ }
+ }
+
+ private void StartDataLookup( byte[] data )
+ {
+ global_result = octet_stream;
+
+ System.Array.Clear( buffer, 0, buffer.Length );
+
+ if ( data.Length > buffer.Length )
+ {
+ System.Array.Copy( data, buffer, buffer.Length );
+ }
+ else
+ {
+ System.Array.Copy( data, buffer, data.Length );
+ }
+
+ if ( CheckMatch80Plus( ) )
+ return;
+
+ if ( CheckMatchBelow80( ) )
+ return;
+
+ CheckForBinaryOrText( );
+ }
+
+ private void StartStringLookup( string input )
+ {
+ global_result = text_plain;
+
+ search_string = input;
+
+ if ( CheckForContentTypeString( ) )
+ return;
+ }
+
+// private bool CheckForInode( )
+// {
+// if ( ( platform == 4 ) || ( platform == 128 ) )
+// {
+//#if __MonoCS__
+// try
+// {
+// // *nix platform
+// Mono.Unix.UnixFileInfo ufi = new Mono.Unix.UnixFileInfo( current_file_name );
+//
+// if ( ufi.IsFile )
+// {
+// return false;
+// }
+// else
+// if ( ufi.IsDirectory )
+// {
+// global_result = "inode/directory";
+// return true;
+// }
+// else
+// if ( ufi.IsBlockDevice )
+// {
+// global_result = "inode/blockdevice";
+// return true;
+// }
+// else
+// if ( ufi.IsSocket )
+// {
+// global_result = "inode/socket";
+// return true;
+// }
+// else
+// if ( ufi.IsSymbolicLink )
+// {
+// global_result = "inode/symlink";
+// return true;
+// }
+// else
+// if ( ufi.IsCharacterDevice )
+// {
+// global_result = "inode/chardevice";
+// return true;
+// }
+// else
+// if ( ufi.IsFIFO )
+// {
+// global_result = "inode/fifo";
+// return true;
+// }
+// } catch( Exception e )
+// {
+// return false;
+// }
+//#endif
+// }
+// else
+// {
+// // TODO!!!!
+// // windows platform
+// }
+//
+// return false;
+// }
+
+ private void GoByFileName( )
+ {
+ // check if we can open the file
+ if ( !OpenFile( ) )
+ {
+ // couldn't open the file, check globals only
+
+ CheckGlobalPatterns( );
+
+ return;
+ }
+
+ if ( !is_zero_file )
+ {
+ // check for matches with a priority >= 80
+ if ( CheckMatch80Plus( ) )
+ return;
+ }
+
+ // check global patterns, aka file extensions...
+ // this should be done for zero size files also,
+ // for example zero size file trash.ccc~ should return
+ // application/x-trash instead of application/x-zerosize
+ if ( CheckGlobalPatterns( ) )
+ return;
+
+ // if file size is zero, no other checks are needed
+ if ( is_zero_file )
+ return;
+
+ // ok, still nothing matches then try matches with a priority < 80
+ if ( CheckMatchBelow80( ) )
+ return;
+
+ // wow, still nothing... return application/octet-stream for binary data, or text/plain for textual data
+ CheckForBinaryOrText( );
+ }
+
+ private bool CheckMatch80Plus( )
+ {
+ foreach ( Match match in MimeGenerated.Matches80Plus )
+ {
+ if ( TestMatch( match ) )
+ {
+ global_result = match.MimeType;
+
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private void CheckGlobalResult( )
+ {
+ int comma_index = global_result.IndexOf( "," );
+
+ if ( comma_index != -1 )
+ {
+ global_result = global_result.Substring( 0, comma_index );
+ }
+ }
+
+ private bool CheckGlobalPatterns( )
+ {
+ string filename = Path.GetFileName( current_file_name );
+ string filename_lower = filename.ToLower( );
+
+ // first check for literals
+
+ for ( int i = 0; i < MimeGenerated.GlobalLiterals.Count; i++ )
+ {
+ string key = MimeGenerated.GlobalLiterals.GetKey( i );
+
+ // no regex char
+ if ( key.IndexOf( '[' ) == -1 )
+ {
+ if ( key.Equals( filename ) )
+ {
+ global_result = MimeGenerated.GlobalLiterals[ i ];
+ CheckGlobalResult( );
+ return true;
+ }
+ }
+ else // regex it ;)
+ {
+ if ( Regex.IsMatch( filename, key ) )
+ {
+ global_result = MimeGenerated.GlobalLiterals[ i ];
+ CheckGlobalResult( );
+ return true;
+ }
+ }
+ }
+
+ if ( filename.IndexOf( '.' ) != -1 )
+ {
+ // check for double extension like .tar.gz
+
+ for ( int i = 0; i < MimeGenerated.GlobalPatternsLong.Count; i++ )
+ {
+ string key = MimeGenerated.GlobalPatternsLong.GetKey( i );
+
+ if ( filename.EndsWith( key ) )
+ {
+ global_result = MimeGenerated.GlobalPatternsLong[ i ];
+ CheckGlobalResult( );
+ return true;
+ }
+ else
+ {
+ if ( filename_lower.EndsWith( key ) )
+ {
+ global_result = MimeGenerated.GlobalPatternsLong[ i ];
+ CheckGlobalResult( );
+ return true;
+ }
+ }
+ }
+
+ // check normal extensions...
+
+ string extension = Path.GetExtension( current_file_name );
+
+ if ( extension.Length != 0 )
+ {
+ global_result = MimeGenerated.GlobalPatternsShort[ extension ];
+
+ if ( global_result != null )
+ {
+ CheckGlobalResult( );
+ return true;
+ }
+
+ string extension_lower = extension.ToLower( );
+
+ global_result = MimeGenerated.GlobalPatternsShort[ extension_lower ];
+
+ if ( global_result != null )
+ {
+ CheckGlobalResult( );
+ return true;
+ }
+ }
+ }
+
+ // finally check if a prefix or suffix matches
+
+ for ( int i = 0; i < MimeGenerated.GlobalSufPref.Count; i++ )
+ {
+ string key = MimeGenerated.GlobalSufPref.GetKey( i );
+
+ if ( key.StartsWith( "*" ) )
+ {
+ if ( filename.EndsWith( key.Replace( "*", "" ) ) )
+ {
+ global_result = MimeGenerated.GlobalSufPref[ i ];
+ CheckGlobalResult( );
+ return true;
+ }
+ }
+ else
+ {
+ if ( filename.StartsWith( key.Replace( "*", "" ) ) )
+ {
+ global_result = MimeGenerated.GlobalSufPref[ i ];
+ CheckGlobalResult( );
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ private bool CheckMatchBelow80( )
+ {
+ foreach ( Match match in MimeGenerated.MatchesBelow80 )
+ {
+ if ( TestMatch( match ) )
+ {
+ global_result = match.MimeType;
+
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private void CheckForBinaryOrText( )
+ {
+ // check the first 32 bytes
+
+ for ( int i = 0; i < 32; i++ )
+ {
+ char c = System.Convert.ToChar( buffer[ i ] );
+
+ if ( c != '\t' && c != '\n' && c != '\r' && c != 12 && c < 32 )
+ {
+ global_result = octet_stream;
+ return;
+ }
+ }
+
+ global_result = text_plain;
+ }
+
+ private bool TestMatch( Match match )
+ {
+ bool found = false;
+
+ // using a simple brute force search algorithm
+ // compare each (masked) value from the buffer with the (masked) value from the match
+ // TODO:
+ // - to find some more speed, maybe we should use unsafe code
+ // - check if buffer[0] and buffer[lastmatchbyte] match ByteValue[0] and ByteValue[lastmatchbyte] in a match
+
+ for ( int offset_counter = 0; offset_counter < match.OffsetLength; offset_counter++ )
+ {
+ if ( match.Mask == null )
+ {
+ if ( buffer[ match.Offset + offset_counter ] == match.ByteValue[ 0 ] )
+ {
+ if ( match.ByteValue.Length == 1 )
+ {
+ if ( match.Matches.Count > 0 )
+ {
+ foreach ( Match sub_match in match.Matches )
+ {
+ if ( TestMatch( sub_match ) )
+ return true;
+ }
+ }
+ else
+ return true;
+ }
+
+ for ( int i = 1; i < match.ByteValue.Length; i++ )
+ {
+ if ( buffer[ match.Offset + offset_counter + i ] != match.ByteValue[ i ] )
+ {
+ found = false;
+ break;
+ }
+
+ found = true;
+ }
+
+ if ( found )
+ {
+ found = false;
+
+ if ( match.Matches.Count > 0 )
+ {
+ foreach ( Match sub_match in match.Matches )
+ {
+ if ( TestMatch( sub_match ) )
+ return true;
+ }
+ }
+ else
+ return true;
+ }
+ }
+ }
+ else // with mask ( it's the same as above, only AND the byte with the corresponding mask byte
+ {
+ if ( ( buffer[ match.Offset + offset_counter ] & match.Mask[ 0 ] ) ==
+ ( match.ByteValue[ 0 ] & match.Mask[ 0 ] ) )
+ {
+ if ( match.ByteValue.Length == 1 )
+ {
+ if ( match.Matches.Count > 0 )
+ {
+ foreach ( Match sub_match in match.Matches )
+ {
+ if ( TestMatch( sub_match ) )
+ return true;
+ }
+ }
+ else
+ return true;
+ }
+
+ for ( int i = 1; i < match.ByteValue.Length; i++ )
+ {
+ if ( ( buffer[ match.Offset + offset_counter + i ] & match.Mask[ i ] ) !=
+ ( match.ByteValue[ i ] & match.Mask[ i ] ) )
+ {
+ found = false;
+ break;
+ }
+
+ found = true;
+ }
+
+ if ( found )
+ {
+ found = false;
+
+ if ( match.Matches.Count > 0 )
+ {
+ foreach ( Match sub_match in match.Matches )
+ {
+ if ( TestMatch( sub_match ) )
+ return true;
+ }
+ }
+ else
+ return true;
+ }
+ }
+ }
+ }
+
+ return found;
+ }
+
+ private bool OpenFile( )
+ {
+ try
+ {
+ System.Array.Clear( buffer, 0, buffer.Length );
+
+ file_stream = new FileStream( current_file_name, FileMode.Open, FileAccess.Read ); // FileShare ??? use BinaryReader ???
+
+ if ( file_stream.Length == 0 )
+ {
+ global_result = zero_file;
+ is_zero_file = true;
+ }
+ else
+ {
+ file_stream.Read( buffer, 0, buffer.Length );
+ }
+
+ file_stream.Close( );
+ }
+ catch (Exception e)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ private bool CheckForContentTypeString( )
+ {
+ int index = search_string.IndexOf( "Content-type:" );
+
+ if ( index != -1 )
+ {
+ index += 13; // Length of string "Content-type:"
+
+ global_result = "";
+
+ while ( search_string[ index ] != ';' )
+ {
+ global_result += search_string[ index++ ];
+ }
+
+ global_result.Trim( );
+
+ return true;
+ }
+
+ // convert string to byte array
+ byte[] string_byte = ( new ASCIIEncoding( ) ).GetBytes( search_string );
+
+ System.Array.Clear( buffer, 0, buffer.Length );
+
+ if ( string_byte.Length > buffer.Length )
+ {
+ System.Array.Copy( string_byte, buffer, buffer.Length );
+ }
+ else
+ {
+ System.Array.Copy( string_byte, buffer, string_byte.Length );
+ }
+
+ if ( CheckMatch80Plus( ) )
+ return true;
+
+ if ( CheckMatchBelow80( ) )
+ return true;
+
+ return false;
+ }
+ }
+
+ internal class MimeType
+ {
+ private string comment;
+ private Hashtable commentsLanguage = new Hashtable();
+
+ public string Comment
+ {
+ get {
+ return comment;
+ }
+ set {
+ comment = value;
+ }
+ }
+
+ public Hashtable CommentsLanguage
+ {
+ get {
+ return commentsLanguage;
+ }
+ set {
+ commentsLanguage = value;
+ }
+ }
+ public string GetCommentForLanguage( string language )
+ {
+ return commentsLanguage[ language ] as string;
+ }
+ }
+
+ internal enum MatchTypes
+ {
+ TypeString,
+ TypeHost16,
+ TypeHost32,
+ TypeBig16,
+ TypeBig32,
+ TypeLittle16,
+ TypeLittle32,
+ TypeByte
+ }
+
+ internal class Match
+ {
+ string mimeType;
+ byte[] byteValue;
+ byte[] mask = null;
+ int priority;
+ int offset;
+ int offsetLength;
+ int wordSize = 1;
+ MatchTypes matchType;
+ ArrayList matches = new ArrayList();
+
+ public string MimeType
+ {
+ set {
+ mimeType = value;
+ }
+
+ get {
+ return mimeType;
+ }
+ }
+
+ public byte[] ByteValue
+ {
+ set {
+ byteValue = value;
+ }
+
+ get {
+ return byteValue;
+ }
+ }
+
+ public byte[] Mask
+ {
+ set {
+ mask = value;
+ }
+
+ get {
+ return mask;
+ }
+ }
+
+ public int Priority
+ {
+ set {
+ priority = value;
+ }
+
+ get {
+ return priority;
+ }
+ }
+
+ public ArrayList Matches
+ {
+ set {
+ matches = value;
+ }
+
+ get {
+ return matches;
+ }
+ }
+
+ public int Offset
+ {
+ set {
+ offset = value;
+ }
+
+ get {
+ return offset;
+ }
+ }
+
+ public int OffsetLength
+ {
+ set {
+ offsetLength = value;
+ }
+
+ get {
+ return offsetLength;
+ }
+ }
+
+ public int WordSize
+ {
+ set {
+ wordSize = value;
+ }
+
+ get {
+ return wordSize;
+ }
+ }
+
+ public MatchTypes MatchType
+ {
+ set {
+ matchType = value;
+ }
+
+ get {
+ return matchType;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MimeGenerated.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MimeGenerated.cs
new file mode 100644
index 00000000000..eb1f2d02a47
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MimeGenerated.cs
@@ -0,0 +1,7245 @@
+#region generated code 11.06.2005 12:21:32
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+
+namespace System.Windows.Forms
+{
+ internal struct MimeGenerated
+ {
+ public static NameValueCollection Aliases = new NameValueCollection( new CaseInsensitiveHashCodeProvider(), new Comparer( System.Globalization.CultureInfo.CurrentUICulture ) );
+ public static NameValueCollection SubClasses = new NameValueCollection( new CaseInsensitiveHashCodeProvider(), new Comparer( System.Globalization.CultureInfo.CurrentUICulture ) );
+
+ public static NameValueCollection GlobalPatternsShort = new NameValueCollection( new CaseInsensitiveHashCodeProvider(), new Comparer( System.Globalization.CultureInfo.CurrentUICulture ) );
+ public static NameValueCollection GlobalPatternsLong = new NameValueCollection( new CaseInsensitiveHashCodeProvider(), new Comparer( System.Globalization.CultureInfo.CurrentUICulture ) );
+ public static NameValueCollection GlobalLiterals = new NameValueCollection( new CaseInsensitiveHashCodeProvider(), new Comparer( System.Globalization.CultureInfo.CurrentUICulture ) );
+ public static NameValueCollection GlobalSufPref = new NameValueCollection( new CaseInsensitiveHashCodeProvider(), new Comparer( System.Globalization.CultureInfo.CurrentUICulture ) );
+ public static Hashtable MimeTypes = new Hashtable();
+
+ public static ArrayList Matches80Plus = new ArrayList();
+ public static ArrayList MatchesBelow80 = new ArrayList();
+
+ public static void Init()
+ {
+
+ Aliases.Add( "application/pdf", "application/x-pdf" );
+ Aliases.Add( "application/stuffit", "application/x-stuffit" );
+ Aliases.Add( "application/stuffit", "application/x-sit" );
+ Aliases.Add( "application/vnd.lotus-1-2-3", "application/x-lotus123" );
+ Aliases.Add( "application/vnd.lotus-1-2-3", "application/x-123" );
+ Aliases.Add( "application/vnd.lotus-1-2-3", "application/lotus123" );
+ Aliases.Add( "application/vnd.lotus-1-2-3", "application/wk1" );
+ Aliases.Add( "application/vnd.ms-excel", "application/msexcel" );
+ Aliases.Add( "application/msword", "application/vnd.ms-word" );
+ Aliases.Add( "application/vnd.wordperfect", "application/x-wordperfect" );
+ Aliases.Add( "application/vnd.wordperfect", "application/wordperfect" );
+ Aliases.Add( "application/x-dbf", "application/x-dbase" );
+ Aliases.Add( "application/x-dbf", "application/dbf" );
+ Aliases.Add( "application/x-dbf", "application/dbase" );
+ Aliases.Add( "application/x-desktop", "application/x-gnome-app-info" );
+ Aliases.Add( "text/x-lyx", "application/x-lyx" );
+ Aliases.Add( "application/zip", "application/x-zip-compressed" );
+ Aliases.Add( "audio/midi", "audio/x-midi" );
+ Aliases.Add( "audio/mp4", "audio/x-m4a" );
+ Aliases.Add( "audio/mpeg", "audio/x-mp3" );
+ Aliases.Add( "audio/x-pn-realaudio", "audio/vnd.rn-realaudio" );
+ Aliases.Add( "audio/x-wav", "audio/wav" );
+ Aliases.Add( "audio/x-wav", "audio/vnd.wave" );
+ Aliases.Add( "image/vnd.djvu", "image/x-djvu" );
+ Aliases.Add( "text/calendar", "text/x-vcalendar" );
+ Aliases.Add( "text/directory", "text/x-vcard" );
+
+ SubClasses.Add( "application/rtf", "text/plain" );
+ SubClasses.Add( "application/smil", "text/plain" );
+ SubClasses.Add( "application/vnd.mozilla.xul+xml", "text/xml" );
+ SubClasses.Add( "application/vnd.sun.xml.calc", "application/zip" );
+ SubClasses.Add( "application/x-xbel", "text/plain" );
+ SubClasses.Add( "application/x-7z-compressed", "application/octet-stream" );
+ SubClasses.Add( "application/x-asp", "text/plain" );
+ SubClasses.Add( "application/x-awk", "text/plain" );
+ SubClasses.Add( "application/x-cgi", "text/plain" );
+ SubClasses.Add( "application/x-csh", "application/x-shellscript" );
+ SubClasses.Add( "application/x-csh", "text/plain" );
+ SubClasses.Add( "application/x-desktop", "text/plain" );
+ SubClasses.Add( "application/x-glade", "text/xml" );
+ SubClasses.Add( "application/x-java-jnlp-file", "text/xml" );
+ SubClasses.Add( "application/x-javascript", "text/plain" );
+ SubClasses.Add( "application/x-magicpoint", "text/plain" );
+ SubClasses.Add( "application/x-nautilus-link", "text/plain" );
+ SubClasses.Add( "application/x-netscape-bookmarks", "text/plain" );
+ SubClasses.Add( "application/x-perl", "application/x-executable" );
+ SubClasses.Add( "application/x-perl", "text/plain" );
+ SubClasses.Add( "application/x-php", "text/plain" );
+ SubClasses.Add( "application/x-profile", "text/plain" );
+ SubClasses.Add( "application/x-reject", "text/plain" );
+ SubClasses.Add( "application/x-ruby", "application/x-executable" );
+ SubClasses.Add( "application/x-ruby", "text/plain" );
+ SubClasses.Add( "application/x-shar", "text/plain" );
+ SubClasses.Add( "application/x-shellscript", "text/plain" );
+ SubClasses.Add( "application/x-theme", "text/plain" );
+ SubClasses.Add( "application/x-troff", "text/plain" );
+ SubClasses.Add( "application/x-troff-man", "text/plain" );
+ SubClasses.Add( "application/xhtml+xml", "text/xml" );
+ SubClasses.Add( "image/svg+xml", "text/xml" );
+ SubClasses.Add( "image/x-eps", "application/postscript" );
+ SubClasses.Add( "inode/mount-point", "inode/directory" );
+ SubClasses.Add( "message/delivery-status", "text/plain" );
+ SubClasses.Add( "message/news", "text/plain" );
+ SubClasses.Add( "message/partial", "text/plain" );
+ SubClasses.Add( "message/rfc822", "text/plain" );
+ SubClasses.Add( "text/mathml", "text/xml" );
+ SubClasses.Add( "text/rdf", "text/plain" );
+ SubClasses.Add( "text/richtext", "text/plain" );
+ SubClasses.Add( "text/rss", "text/plain" );
+ SubClasses.Add( "text/tab-separated-values", "text/plain" );
+ SubClasses.Add( "text/x-adasrc", "text/plain" );
+ SubClasses.Add( "text/x-authors", "text/plain" );
+ SubClasses.Add( "text/x-bibtex", "text/plain" );
+ SubClasses.Add( "text/x-c++hdr", "text/plain" );
+ SubClasses.Add( "text/x-c++src", "text/plain" );
+ SubClasses.Add( "text/x-chdr", "text/plain" );
+ SubClasses.Add( "text/x-comma-separated-values", "text/plain" );
+ SubClasses.Add( "text/x-copying", "text/plain" );
+ SubClasses.Add( "text/x-credits", "text/plain" );
+ SubClasses.Add( "text/x-csrc", "text/plain" );
+ SubClasses.Add( "text/x-csharp", "text/plain" );
+ SubClasses.Add( "text/x-dcl", "text/plain" );
+ SubClasses.Add( "text/x-dsrc", "text/plain" );
+ SubClasses.Add( "text/x-dtd", "text/plain" );
+ SubClasses.Add( "text/x-emacs-lisp", "text/plain" );
+ SubClasses.Add( "text/x-fortran", "text/plain" );
+ SubClasses.Add( "text/x-gettext-translation", "text/plain" );
+ SubClasses.Add( "text/x-gettext-translation-template", "text/plain" );
+ SubClasses.Add( "text/x-gtkrc", "text/plain" );
+ SubClasses.Add( "text/x-haskell", "text/plain" );
+ SubClasses.Add( "text/x-idl", "text/plain" );
+ SubClasses.Add( "text/x-install", "text/plain" );
+ SubClasses.Add( "text/x-java", "text/plain" );
+ SubClasses.Add( "text/x-ksysv-log", "text/plain" );
+ SubClasses.Add( "text/x-literate-haskell", "text/plain" );
+ SubClasses.Add( "text/x-log", "text/plain" );
+ SubClasses.Add( "text/x-makefile", "text/plain" );
+ SubClasses.Add( "text/x-moc", "text/plain" );
+ SubClasses.Add( "text/x-objcsrc", "text/plain" );
+ SubClasses.Add( "text/x-pascal", "text/plain" );
+ SubClasses.Add( "text/x-patch", "text/plain" );
+ SubClasses.Add( "text/x-python", "application/x-executable" );
+ SubClasses.Add( "text/x-python", "text/plain" );
+ SubClasses.Add( "text/x-readme", "text/plain" );
+ SubClasses.Add( "text/x-scheme", "text/plain" );
+ SubClasses.Add( "text/x-setext", "text/plain" );
+ SubClasses.Add( "text/x-sql", "text/plain" );
+ SubClasses.Add( "text/x-tcl", "text/plain" );
+ SubClasses.Add( "text/x-tex", "text/plain" );
+ SubClasses.Add( "text/x-texinfo", "text/plain" );
+ SubClasses.Add( "application/xml", "text/plain" );
+ SubClasses.Add( "text/xml", "text/plain" );
+ SubClasses.Add( "application/x-gdesklets-display", "text/xml" );
+
+ GlobalPatternsShort.Add( ".bfproject", "application/bluefish-project" );
+ GlobalPatternsShort.Add( ".ez", "application/andrew-inset" );
+ GlobalPatternsShort.Add( ".ai", "application/illustrator" );
+ GlobalPatternsShort.Add( ".nb", "application/mathematica" );
+ GlobalPatternsShort.Add( ".bin", "application/octet-stream" );
+ GlobalPatternsShort.Add( ".oda", "application/oda" );
+ GlobalPatternsShort.Add( ".pdf", "application/pdf" );
+ GlobalPatternsShort.Add( ".pgp", "application/pgp" );
+ GlobalPatternsShort.Add( ".p7s", "application/pkcs7-signature" );
+ GlobalPatternsShort.Add( ".ps", "application/postscript" );
+ GlobalPatternsShort.Add( ".rtf", "application/rtf" );
+ GlobalPatternsShort.Add( ".smil", "application/smil" );
+ GlobalPatternsShort.Add( ".smi", "application/smil" );
+ GlobalPatternsShort.Add( ".sml", "application/smil" );
+ GlobalPatternsShort.Add( ".kino", "application/smil" );
+ GlobalPatternsShort.Add( ".sit", "application/stuffit" );
+ GlobalPatternsShort.Add( ".ged", "application/x-gedcom" );
+ GlobalPatternsShort.Add( ".gedcom", "application/x-gedcom" );
+ GlobalPatternsShort.Add( ".cdr", "application/vnd.corel-draw" );
+ GlobalPatternsShort.Add( ".hpgl", "application/vnd.hp-hpgl" );
+ GlobalPatternsShort.Add( ".pcl", "application/vnd.hp-pcl" );
+ GlobalPatternsShort.Add( ".123", "application/vnd.lotus-1-2-3" );
+ GlobalPatternsShort.Add( ".wk1", "application/vnd.lotus-1-2-3" );
+ GlobalPatternsShort.Add( ".wk3", "application/vnd.lotus-1-2-3" );
+ GlobalPatternsShort.Add( ".wk4", "application/vnd.lotus-1-2-3" );
+ GlobalPatternsShort.Add( ".wks", "application/vnd.lotus-1-2-3" );
+ GlobalPatternsShort.Add( ".xul", "application/vnd.mozilla.xul+xml" );
+ GlobalPatternsShort.Add( ".mdb", "application/vnd.ms-access" );
+ GlobalPatternsShort.Add( ".xls", "application/vnd.ms-excel" );
+ GlobalPatternsShort.Add( ".xlc", "application/vnd.ms-excel" );
+ GlobalPatternsShort.Add( ".xll", "application/vnd.ms-excel" );
+ GlobalPatternsShort.Add( ".xlm", "application/vnd.ms-excel" );
+ GlobalPatternsShort.Add( ".xlw", "application/vnd.ms-excel" );
+ GlobalPatternsShort.Add( ".xla", "application/vnd.ms-excel" );
+ GlobalPatternsShort.Add( ".xlt", "application/vnd.ms-excel" );
+ GlobalPatternsShort.Add( ".xld", "application/vnd.ms-excel" );
+ GlobalPatternsShort.Add( ".ppz", "application/vnd.ms-powerpoint" );
+ GlobalPatternsShort.Add( ".ppt", "application/vnd.ms-powerpoint" );
+ GlobalPatternsShort.Add( ".pps", "application/vnd.ms-powerpoint" );
+ GlobalPatternsShort.Add( ".pot", "application/vnd.ms-powerpoint" );
+ GlobalPatternsShort.Add( ".doc", "application/msword" );
+ GlobalPatternsShort.Add( ".pdb", "application/vnd.palm" );
+ GlobalPatternsShort.Add( ".sdc", "application/vnd.stardivision.calc" );
+ GlobalPatternsShort.Add( ".sds", "application/vnd.stardivision.chart" );
+ GlobalPatternsShort.Add( ".sda", "application/vnd.stardivision.draw" );
+ GlobalPatternsShort.Add( ".sdd", "application/vnd.stardivision.impress" );
+ GlobalPatternsShort.Add( ".sdp", "application/vnd.stardivision.impress" );
+ GlobalPatternsShort.Add( ".smd", "application/vnd.stardivision.mail" );
+ GlobalPatternsShort.Add( ".smf", "application/vnd.stardivision.math" );
+ GlobalPatternsShort.Add( ".sdw", "application/vnd.stardivision.writer" );
+ GlobalPatternsShort.Add( ".vor", "application/vnd.stardivision.writer" );
+ GlobalPatternsShort.Add( ".sgl", "application/vnd.stardivision.writer" );
+ GlobalPatternsShort.Add( ".sxc", "application/vnd.sun.xml.calc" );
+ GlobalPatternsShort.Add( ".stc", "application/vnd.sun.xml.calc.template" );
+ GlobalPatternsShort.Add( ".sxd", "application/vnd.sun.xml.draw" );
+ GlobalPatternsShort.Add( ".std", "application/vnd.sun.xml.draw.template" );
+ GlobalPatternsShort.Add( ".sxi", "application/vnd.sun.xml.impress" );
+ GlobalPatternsShort.Add( ".sti", "application/vnd.sun.xml.impress.template" );
+ GlobalPatternsShort.Add( ".sxm", "application/vnd.sun.xml.math" );
+ GlobalPatternsShort.Add( ".sxw", "application/vnd.sun.xml.writer" );
+ GlobalPatternsShort.Add( ".sxg", "application/vnd.sun.xml.writer.global" );
+ GlobalPatternsShort.Add( ".stw", "application/vnd.sun.xml.writer.template" );
+ GlobalPatternsShort.Add( ".odt", "application/vnd.oasis.opendocument.text" );
+ GlobalPatternsShort.Add( ".ott", "application/vnd.oasis.opendocument.text-template" );
+ GlobalPatternsShort.Add( ".oth", "application/vnd.oasis.opendocument.text-web" );
+ GlobalPatternsShort.Add( ".odm", "application/vnd.oasis.opendocument.text-master" );
+ GlobalPatternsShort.Add( ".odg", "application/vnd.oasis.opendocument.graphics" );
+ GlobalPatternsShort.Add( ".otg", "application/vnd.oasis.opendocument.graphics-template" );
+ GlobalPatternsShort.Add( ".odp", "application/vnd.oasis.opendocument.presentation" );
+ GlobalPatternsShort.Add( ".otp", "application/vnd.oasis.opendocument.presentation-template" );
+ GlobalPatternsShort.Add( ".ods", "application/vnd.oasis.opendocument.spreadsheet" );
+ GlobalPatternsShort.Add( ".ots", "application/vnd.oasis.opendocument.spreadsheet-template" );
+ GlobalPatternsShort.Add( ".odc", "application/vnd.oasis.opendocument.chart" );
+ GlobalPatternsShort.Add( ".odf", "application/vnd.oasis.opendocument.formula" );
+ GlobalPatternsShort.Add( ".odb", "application/vnd.oasis.opendocument.database" );
+ GlobalPatternsShort.Add( ".odi", "application/vnd.oasis.opendocument.image" );
+ GlobalPatternsShort.Add( ".wpd", "application/vnd.wordperfect" );
+ GlobalPatternsShort.Add( ".xbel", "application/x-xbel" );
+ GlobalPatternsShort.Add( ".7z", "application/x-7z-compressed" );
+ GlobalPatternsShort.Add( ".abw", "application/x-abiword" );
+ GlobalPatternsLong.Add( ".abw.CRASHED", "application/x-abiword" );
+ GlobalPatternsLong.Add( ".abw.gz", "application/x-abiword" );
+ GlobalPatternsShort.Add( ".zabw", "application/x-abiword" );
+ GlobalPatternsShort.Add( ".cue", "application/x-cue" );
+ GlobalPatternsShort.Add( ".sam", "application/x-amipro" );
+ GlobalPatternsShort.Add( ".as", "application/x-applix-spreadsheet" );
+ GlobalPatternsShort.Add( ".aw", "application/x-applix-word" );
+ GlobalPatternsShort.Add( ".a", "application/x-archive" );
+ GlobalPatternsShort.Add( ".arj", "application/x-arj" );
+ GlobalPatternsShort.Add( ".asp", "application/x-asp" );
+ GlobalPatternsShort.Add( ".bcpio", "application/x-bcpio" );
+ GlobalPatternsShort.Add( ".torrent", "application/x-bittorrent" );
+ GlobalPatternsShort.Add( ".blender", "application/x-blender" );
+ GlobalPatternsShort.Add( ".blend", "application/x-blender" );
+ GlobalPatternsShort.Add( ".BLEND", "application/x-blender" );
+ GlobalPatternsShort.Add( ".bz", "application/x-bzip" );
+ GlobalPatternsShort.Add( ".bz2", "application/x-bzip" );
+ GlobalPatternsLong.Add( ".tar.bz", "application/x-bzip-compressed-tar" );
+ GlobalPatternsLong.Add( ".tar.bz2", "application/x-bzip-compressed-tar" );
+ GlobalPatternsShort.Add( ".iso", "application/x-cd-image" );
+ GlobalPatternsShort.Add( ".cgi", "application/x-cgi" );
+ GlobalPatternsShort.Add( ".pgn", "application/x-chess-pgn" );
+ GlobalPatternsShort.Add( ".chm", "application/x-chm" );
+ GlobalPatternsShort.Add( ".Z", "application/x-compress" );
+ GlobalPatternsLong.Add( ".tar.gz", "application/x-compressed-tar" );
+ GlobalPatternsShort.Add( ".tgz", "application/x-compressed-tar" );
+ GlobalLiterals.Add( "core", "application/x-core" );
+ GlobalPatternsShort.Add( ".cpio", "application/x-cpio" );
+ GlobalPatternsLong.Add( ".cpio.gz", "application/x-cpio-compressed" );
+ GlobalPatternsShort.Add( ".csh", "application/x-csh" );
+ GlobalPatternsShort.Add( ".dbf", "application/x-dbf" );
+ GlobalPatternsShort.Add( ".dc", "application/x-dc-rom" );
+ GlobalPatternsShort.Add( ".deb", "application/x-deb" );
+ GlobalPatternsShort.Add( ".ui", "application/x-designer" );
+ GlobalPatternsShort.Add( ".desktop", "application/x-desktop" );
+ GlobalPatternsShort.Add( ".kdelnk", "application/x-desktop" );
+ GlobalPatternsShort.Add( ".dia", "application/x-dia-diagram" );
+ GlobalPatternsShort.Add( ".dvi", "application/x-dvi" );
+ GlobalPatternsShort.Add( ".etheme", "application/x-e-theme" );
+ GlobalPatternsShort.Add( ".egon", "application/x-egon" );
+ GlobalPatternsShort.Add( ".exe", "application/x-executable" );
+ GlobalPatternsShort.Add( ".pfa", "application/x-font-type1" );
+ GlobalPatternsShort.Add( ".pfb", "application/x-font-type1" );
+ GlobalPatternsShort.Add( ".gsf", "application/x-font-type1" );
+ GlobalPatternsLong.Add( ".pcf.Z", "application/x-font-type1" );
+ GlobalPatternsShort.Add( ".afm", "application/x-font-afm" );
+ GlobalPatternsShort.Add( ".bdf", "application/x-font-bdf" );
+ GlobalPatternsShort.Add( ".psf", "application/x-font-linux-psf" );
+ GlobalPatternsShort.Add( ".pcf", "application/x-font-pcf" );
+ GlobalPatternsShort.Add( ".spd", "application/x-font-speedo" );
+ GlobalPatternsShort.Add( ".ttf", "application/x-font-ttf" );
+ GlobalPatternsShort.Add( ".gb", "application/x-gameboy-rom" );
+ GlobalPatternsShort.Add( ".gen", "application/x-genesis-rom" );
+ GlobalPatternsShort.Add( ".md", "application/x-genesis-rom" );
+ GlobalPatternsShort.Add( ".gmo", "application/x-gettext-translation" );
+ GlobalPatternsShort.Add( ".glade", "application/x-glade" );
+ GlobalPatternsShort.Add( ".gnucash", "application/x-gnucash" );
+ GlobalPatternsShort.Add( ".gnc", "application/x-gnucash" );
+ GlobalPatternsShort.Add( ".xac", "application/x-gnucash" );
+ GlobalPatternsShort.Add( ".gnumeric", "application/x-gnumeric" );
+ GlobalPatternsShort.Add( ".gra", "application/x-graphite" );
+ GlobalPatternsShort.Add( ".gtar", "application/x-gtar" );
+ GlobalPatternsShort.Add( ".gz", "application/x-gzip" );
+ GlobalPatternsLong.Add( ".ps.gz", "application/x-gzpostscript" );
+ GlobalPatternsShort.Add( ".hdf", "application/x-hdf" );
+ GlobalPatternsShort.Add( ".jar", "application/x-jar" );
+ GlobalPatternsShort.Add( ".class", "application/x-java" );
+ GlobalPatternsShort.Add( ".jnlp", "application/x-java-jnlp-file" );
+ GlobalPatternsShort.Add( ".js", "application/x-javascript" );
+ GlobalPatternsShort.Add( ".jpr", "application/x-jbuilder-project" );
+ GlobalPatternsShort.Add( ".jpx", "application/x-jbuilder-project" );
+ GlobalPatternsShort.Add( ".karbon", "application/x-karbon" );
+ GlobalPatternsShort.Add( ".chrt", "application/x-kchart" );
+ GlobalPatternsShort.Add( ".kfo", "application/x-kformula" );
+ GlobalPatternsShort.Add( ".kil", "application/x-killustrator" );
+ GlobalPatternsShort.Add( ".flw", "application/x-kivio" );
+ GlobalPatternsShort.Add( ".kon", "application/x-kontour" );
+ GlobalPatternsShort.Add( ".kpm", "application/x-kpovmodeler" );
+ GlobalPatternsShort.Add( ".kpr", "application/x-kpresenter" );
+ GlobalPatternsShort.Add( ".kpt", "application/x-kpresenter" );
+ GlobalPatternsShort.Add( ".kra", "application/x-krita" );
+ GlobalPatternsShort.Add( ".ksp", "application/x-kspread" );
+ GlobalPatternsShort.Add( ".kud", "application/x-kugar" );
+ GlobalPatternsShort.Add( ".kwd", "application/x-kword" );
+ GlobalPatternsShort.Add( ".kwt", "application/x-kword" );
+ GlobalPatternsShort.Add( ".lha", "application/x-lha" );
+ GlobalPatternsShort.Add( ".lzh", "application/x-lha" );
+ GlobalPatternsShort.Add( ".lhz", "application/x-lhz" );
+ GlobalPatternsShort.Add( ".ts", "application/x-linguist" );
+ GlobalPatternsShort.Add( ".lyx", "text/x-lyx" );
+ GlobalPatternsShort.Add( ".lzo", "application/x-lzop" );
+ GlobalPatternsShort.Add( ".mgp", "application/x-magicpoint" );
+ GlobalPatternsShort.Add( ".mkv", "application/x-matroska" );
+ GlobalPatternsShort.Add( ".mif", "application/x-mif" );
+ GlobalPatternsShort.Add( ".exe", "application/x-ms-dos-executable" );
+ GlobalPatternsShort.Add( ".wri", "application/x-mswrite" );
+ GlobalPatternsShort.Add( ".msx", "application/x-msx-rom" );
+ GlobalPatternsShort.Add( ".n64", "application/x-n64-rom" );
+ GlobalPatternsShort.Add( ".nes", "application/x-nes-rom" );
+ GlobalPatternsShort.Add( ".cdf", "application/x-netcdf" );
+ GlobalPatternsShort.Add( ".nc", "application/x-netcdf" );
+ GlobalPatternsShort.Add( ".o", "application/x-object" );
+ GlobalPatternsShort.Add( ".ogg", "application/ogg" );
+ GlobalPatternsShort.Add( ".oleo", "application/x-oleo" );
+ GlobalPatternsShort.Add( ".PAR2", "application/x-par2" );
+ GlobalPatternsShort.Add( ".par2", "application/x-par2" );
+ GlobalPatternsShort.Add( ".pl", "application/x-perl" );
+ GlobalPatternsShort.Add( ".pm", "application/x-perl" );
+ GlobalPatternsShort.Add( ".al", "application/x-perl" );
+ GlobalPatternsShort.Add( ".perl", "application/x-perl" );
+ GlobalPatternsShort.Add( ".php", "application/x-php" );
+ GlobalPatternsShort.Add( ".php3", "application/x-php" );
+ GlobalPatternsShort.Add( ".php4", "application/x-php" );
+ GlobalPatternsShort.Add( ".p12", "application/x-pkcs12" );
+ GlobalPatternsShort.Add( ".pfx", "application/x-pkcs12" );
+ GlobalLiterals.Add( "gmon.out", "application/x-profile" );
+ GlobalPatternsShort.Add( ".pw", "application/x-pw" );
+ GlobalPatternsShort.Add( ".pyc", "application/x-python-bytecode" );
+ GlobalPatternsShort.Add( ".pyo", "application/x-python-bytecode" );
+ GlobalPatternsShort.Add( ".wb1", "application/x-quattropro" );
+ GlobalPatternsShort.Add( ".wb2", "application/x-quattropro" );
+ GlobalPatternsShort.Add( ".wb3", "application/x-quattropro" );
+ GlobalPatternsShort.Add( ".qif", "application/x-qw" );
+ GlobalPatternsShort.Add( ".rar", "application/x-rar" );
+ GlobalPatternsShort.Add( ".rej", "application/x-reject" );
+ GlobalPatternsShort.Add( ".rpm", "application/x-rpm" );
+ GlobalPatternsShort.Add( ".rb", "application/x-ruby" );
+ GlobalPatternsShort.Add( ".shar", "application/x-shar" );
+ GlobalPatternsShort.Add( ".la", "application/x-shared-library-la" );
+ GlobalPatternsShort.Add( ".so", "application/x-sharedlib" );
+ GlobalPatternsShort.Add( ".sh", "application/x-shellscript" );
+ GlobalPatternsShort.Add( ".swf", "application/x-shockwave-flash" );
+ GlobalPatternsShort.Add( ".siag", "application/x-siag" );
+ GlobalPatternsShort.Add( ".sms", "application/x-sms-rom" );
+ GlobalPatternsShort.Add( ".gg", "application/x-sms-rom" );
+ GlobalPatternsShort.Add( ".sv4cpio", "application/x-sv4cpio" );
+ GlobalPatternsShort.Add( ".sv4crc", "application/x-sv4crc" );
+ GlobalPatternsShort.Add( ".tar", "application/x-tar" );
+ GlobalPatternsLong.Add( ".tar.Z", "application/x-tarz" );
+ GlobalPatternsShort.Add( ".gf", "application/x-tex-gf" );
+ GlobalSufPref.Add( "*pk", "application/x-tex-pk" );
+ GlobalPatternsShort.Add( ".obj", "application/x-tgif" );
+ GlobalPatternsShort.Add( ".theme", "application/x-theme" );
+ GlobalSufPref.Add( "*~", "application/x-trash" );
+ GlobalSufPref.Add( "*%", "application/x-trash" );
+ GlobalPatternsShort.Add( ".bak", "application/x-trash" );
+ GlobalPatternsShort.Add( ".old", "application/x-trash" );
+ GlobalPatternsShort.Add( ".sik", "application/x-trash" );
+ GlobalPatternsShort.Add( ".tr", "application/x-troff" );
+ GlobalPatternsShort.Add( ".roff", "application/x-troff" );
+ GlobalPatternsShort.Add( ".t", "application/x-troff" );
+ GlobalPatternsShort.Add( ".man", "application/x-troff-man" );
+ GlobalPatternsLong.Add( ".tar.lzo", "application/x-tzo" );
+ GlobalPatternsShort.Add( ".tzo", "application/x-tzo" );
+ GlobalPatternsShort.Add( ".ustar", "application/x-ustar" );
+ GlobalPatternsShort.Add( ".src", "application/x-wais-source" );
+ GlobalPatternsShort.Add( ".wpg", "application/x-wpg" );
+ GlobalPatternsShort.Add( ".der", "application/x-x509-ca-cert" );
+ GlobalPatternsShort.Add( ".cer", "application/x-x509-ca-cert" );
+ GlobalPatternsShort.Add( ".crt", "application/x-x509-ca-cert" );
+ GlobalPatternsShort.Add( ".cert", "application/x-x509-ca-cert" );
+ GlobalPatternsShort.Add( ".pem", "application/x-x509-ca-cert" );
+ GlobalPatternsShort.Add( ".zoo", "application/x-zoo" );
+ GlobalPatternsShort.Add( ".xhtml", "application/xhtml+xml" );
+ GlobalPatternsShort.Add( ".zip", "application/zip" );
+ GlobalPatternsShort.Add( ".ac3", "audio/ac3" );
+ GlobalPatternsShort.Add( ".au", "audio/basic" );
+ GlobalPatternsShort.Add( ".snd", "audio/basic" );
+ GlobalPatternsShort.Add( ".sid", "audio/prs.sid" );
+ GlobalPatternsShort.Add( ".psid", "audio/prs.sid" );
+ GlobalPatternsShort.Add( ".aiff", "audio/x-aiff" );
+ GlobalPatternsShort.Add( ".aif", "audio/x-aiff" );
+ GlobalPatternsShort.Add( ".aifc", "audio/x-aiff" );
+ GlobalPatternsShort.Add( ".it", "audio/x-it" );
+ GlobalPatternsShort.Add( ".flac", "audio/x-flac" );
+ GlobalPatternsShort.Add( ".mid", "audio/midi" );
+ GlobalPatternsShort.Add( ".midi", "audio/midi" );
+ GlobalPatternsShort.Add( ".m4a", "audio/mp4" );
+ GlobalPatternsShort.Add( ".mp4", "video/mp4" );
+ GlobalPatternsShort.Add( ".mod", "audio/x-mod" );
+ GlobalPatternsShort.Add( ".ult", "audio/x-mod" );
+ GlobalPatternsShort.Add( ".uni", "audio/x-mod" );
+ GlobalPatternsShort.Add( ".XM", "audio/x-mod" );
+ GlobalPatternsShort.Add( ".m15", "audio/x-mod" );
+ GlobalPatternsShort.Add( ".mtm", "audio/x-mod" );
+ GlobalPatternsShort.Add( ".669", "audio/x-mod" );
+ GlobalPatternsShort.Add( ".mp3", "audio/mpeg" );
+ GlobalPatternsShort.Add( ".m3u", "audio/x-mpegurl" );
+ GlobalPatternsShort.Add( ".ra", "audio/x-pn-realaudio" );
+ GlobalPatternsShort.Add( ".ram", "audio/x-pn-realaudio" );
+ GlobalPatternsShort.Add( ".rm", "audio/x-pn-realaudio" );
+ GlobalPatternsShort.Add( ".rmvb", "audio/x-pn-realaudio" );
+ GlobalPatternsShort.Add( ".s3m", "audio/x-s3m" );
+ GlobalPatternsShort.Add( ".pls", "audio/x-scpls" );
+ GlobalPatternsShort.Add( ".stm", "audio/x-stm" );
+ GlobalPatternsShort.Add( ".voc", "audio/x-voc" );
+ GlobalPatternsShort.Add( ".wav", "audio/x-wav" );
+ GlobalPatternsShort.Add( ".xi", "audio/x-xi" );
+ GlobalPatternsShort.Add( ".xm", "audio/x-xm" );
+ GlobalPatternsShort.Add( ".bmp", "image/bmp" );
+ GlobalPatternsShort.Add( ".cgm", "image/cgm" );
+ GlobalPatternsShort.Add( ".g3", "image/fax-g3" );
+ GlobalPatternsShort.Add( ".gif", "image/gif" );
+ GlobalPatternsShort.Add( ".ief", "image/ief" );
+ GlobalPatternsShort.Add( ".jpeg", "image/jpeg" );
+ GlobalPatternsShort.Add( ".jpg", "image/jpeg" );
+ GlobalPatternsShort.Add( ".jpe", "image/jpeg" );
+ GlobalPatternsShort.Add( ".jp2", "image/jpeg2000" );
+ GlobalPatternsShort.Add( ".pict", "image/x-pict" );
+ GlobalPatternsShort.Add( ".pict1", "image/x-pict" );
+ GlobalPatternsShort.Add( ".pict2", "image/x-pict" );
+ GlobalPatternsShort.Add( ".png", "image/png" );
+ GlobalPatternsShort.Add( ".rle", "image/rle" );
+ GlobalPatternsShort.Add( ".svg", "image/svg+xml" );
+ GlobalPatternsShort.Add( ".tif", "image/tiff" );
+ GlobalPatternsShort.Add( ".tiff", "image/tiff" );
+ GlobalPatternsShort.Add( ".dwg", "image/vnd.dwg" );
+ GlobalPatternsShort.Add( ".dxf", "image/vnd.dxf" );
+ GlobalPatternsShort.Add( ".3ds", "image/x-3ds" );
+ GlobalPatternsShort.Add( ".ag", "image/x-applix-graphics" );
+ GlobalPatternsShort.Add( ".ras", "image/x-cmu-raster" );
+ GlobalPatternsLong.Add( ".xcf.gz", "image/x-compressed-xcf" );
+ GlobalPatternsLong.Add( ".xcf.bz2", "image/x-compressed-xcf" );
+ GlobalPatternsShort.Add( ".dcm", "application/dicom" );
+ GlobalPatternsShort.Add( ".djvu", "image/vnd.djvu" );
+ GlobalPatternsShort.Add( ".djv", "image/vnd.djvu" );
+ GlobalPatternsShort.Add( ".eps", "image/x-eps" );
+ GlobalPatternsShort.Add( ".epsi", "image/x-eps" );
+ GlobalPatternsShort.Add( ".epsf", "image/x-eps" );
+ GlobalPatternsShort.Add( ".fits", "image/x-fits" );
+ GlobalPatternsShort.Add( ".icb", "image/x-icb" );
+ GlobalPatternsShort.Add( ".ico", "image/x-ico" );
+ GlobalPatternsShort.Add( ".iff", "image/x-iff" );
+ GlobalPatternsShort.Add( ".ilbm", "image/x-ilbm" );
+ GlobalPatternsShort.Add( ".jng", "image/x-jng" );
+ GlobalPatternsShort.Add( ".lwo", "image/x-lwo" );
+ GlobalPatternsShort.Add( ".lwob", "image/x-lwo" );
+ GlobalPatternsShort.Add( ".lws", "image/x-lws" );
+ GlobalPatternsShort.Add( ".msod", "image/x-msod" );
+ GlobalPatternsShort.Add( ".pcd", "image/x-photo-cd" );
+ GlobalPatternsShort.Add( ".pnm", "image/x-portable-anymap" );
+ GlobalPatternsShort.Add( ".pbm", "image/x-portable-bitmap" );
+ GlobalPatternsShort.Add( ".pgm", "image/x-portable-graymap" );
+ GlobalPatternsShort.Add( ".ppm", "image/x-portable-pixmap" );
+ GlobalPatternsShort.Add( ".psd", "image/x-psd" );
+ GlobalPatternsShort.Add( ".rgb", "image/x-rgb" );
+ GlobalPatternsShort.Add( ".sgi", "image/x-sgi" );
+ GlobalPatternsShort.Add( ".sun", "image/x-sun-raster" );
+ GlobalPatternsShort.Add( ".tga", "image/x-tga" );
+ GlobalPatternsShort.Add( ".cur", "image/x-win-bitmap" );
+ GlobalPatternsShort.Add( ".wmf", "image/x-wmf" );
+ GlobalPatternsShort.Add( ".xbm", "image/x-xbitmap" );
+ GlobalPatternsShort.Add( ".xcf", "image/x-xcf" );
+ GlobalPatternsShort.Add( ".fig", "image/x-xfig" );
+ GlobalPatternsShort.Add( ".xpm", "image/x-xpixmap" );
+ GlobalPatternsShort.Add( ".xwd", "image/x-xwindowdump" );
+ GlobalLiterals.Add( "RMAIL", "message/x-gnu-rmail" );
+ GlobalPatternsShort.Add( ".wrl", "model/vrml" );
+ GlobalPatternsShort.Add( ".vcs", "text/calendar" );
+ GlobalPatternsShort.Add( ".ics", "text/calendar" );
+ GlobalPatternsShort.Add( ".css", "text/css" );
+ GlobalPatternsShort.Add( ".CSSL", "text/css" );
+ GlobalPatternsShort.Add( ".vcf", "text/directory" );
+ GlobalPatternsShort.Add( ".vct", "text/directory" );
+ GlobalPatternsShort.Add( ".gcrd", "text/directory" );
+ GlobalPatternsShort.Add( ".mml", "text/mathml" );
+ GlobalPatternsShort.Add( ".txt", "text/plain" );
+ GlobalPatternsShort.Add( ".asc", "text/plain" );
+ GlobalPatternsShort.Add( ".rdf", "text/rdf" );
+ GlobalPatternsShort.Add( ".rtx", "text/richtext" );
+ GlobalPatternsShort.Add( ".rss", "text/rss" );
+ GlobalPatternsShort.Add( ".sgml", "text/sgml" );
+ GlobalPatternsShort.Add( ".sgm", "text/sgml" );
+ GlobalPatternsShort.Add( ".sylk", "text/spreadsheet" );
+ GlobalPatternsShort.Add( ".slk", "text/spreadsheet" );
+ GlobalPatternsShort.Add( ".tsv", "text/tab-separated-values" );
+ GlobalPatternsShort.Add( ".wml", "text/vnd.wap.wml" );
+ GlobalPatternsShort.Add( ".adb", "text/x-adasrc" );
+ GlobalPatternsShort.Add( ".ads", "text/x-adasrc" );
+ GlobalLiterals.Add( "AUTHORS", "text/x-authors" );
+ GlobalPatternsShort.Add( ".bib", "text/x-bibtex" );
+ GlobalPatternsShort.Add( ".hh", "text/x-c++hdr" );
+ GlobalPatternsShort.Add( ".hpp", "text/x-c++hdr" );
+ GlobalPatternsShort.Add( ".cpp", "text/x-c++src" );
+ GlobalPatternsShort.Add( ".cxx", "text/x-c++src" );
+ GlobalPatternsShort.Add( ".cc", "text/x-c++src" );
+ GlobalPatternsShort.Add( ".C", "text/x-c++src" );
+ GlobalPatternsShort.Add( ".c++", "text/x-c++src" );
+ GlobalPatternsShort.Add( ".h", "text/x-chdr" );
+ GlobalPatternsShort.Add( ".h++", "text/x-chdr" );
+ GlobalPatternsShort.Add( ".hp", "text/x-chdr" );
+ GlobalPatternsShort.Add( ".csv", "text/x-comma-separated-values" );
+ GlobalLiterals.Add( "COPYING", "text/x-copying" );
+ GlobalLiterals.Add( "CREDITS", "text/x-credits" );
+ GlobalPatternsShort.Add( ".c", "text/x-csrc" );
+ GlobalPatternsShort.Add( ".cs", "text/x-csharp" );
+ GlobalPatternsShort.Add( ".dcl", "text/x-dcl" );
+ GlobalPatternsShort.Add( ".dsl", "text/x-dsl" );
+ GlobalPatternsShort.Add( ".d", "text/x-dsrc" );
+ GlobalPatternsShort.Add( ".dtd", "text/x-dtd" );
+ GlobalPatternsShort.Add( ".el", "text/x-emacs-lisp" );
+ GlobalPatternsShort.Add( ".f", "text/x-fortran" );
+ GlobalPatternsShort.Add( ".f9[05]", "text/x-fortran" );
+ GlobalPatternsShort.Add( ".for", "text/x-fortran" );
+ GlobalPatternsShort.Add( ".po", "text/x-gettext-translation" );
+ GlobalPatternsShort.Add( ".pot", "text/x-gettext-translation-template" );
+ GlobalPatternsShort.Add( ".html", "text/html" );
+ GlobalPatternsShort.Add( ".htm", "text/html" );
+ GlobalLiterals.Add( "gtkrc", "text/x-gtkrc" );
+ GlobalLiterals.Add( ".gtkrc", "text/x-gtkrc" );
+ GlobalPatternsShort.Add( ".hs", "text/x-haskell" );
+ GlobalPatternsShort.Add( ".idl", "text/x-idl" );
+ GlobalLiterals.Add( "INSTALL", "text/x-install" );
+ GlobalPatternsShort.Add( ".java", "text/x-java" );
+ GlobalPatternsShort.Add( ".lhs", "text/x-literate-haskell" );
+ GlobalPatternsShort.Add( ".log", "text/x-log" );
+ GlobalSufPref.Add( "makefile*", "text/x-makefile" );
+ GlobalLiterals.Add( "[Mm]akefile", "text/x-makefile" );
+ GlobalPatternsShort.Add( ".moc", "text/x-moc" );
+ GlobalPatternsShort.Add( ".m", "text/x-objcsrc" );
+ GlobalPatternsShort.Add( ".p", "text/x-pascal" );
+ GlobalPatternsShort.Add( ".pas", "text/x-pascal" );
+ GlobalPatternsShort.Add( ".diff", "text/x-patch" );
+ GlobalPatternsShort.Add( ".patch", "text/x-patch" );
+ GlobalPatternsShort.Add( ".py", "text/x-python" );
+ GlobalSufPref.Add( "README*", "text/x-readme" );
+ GlobalPatternsShort.Add( ".scm", "text/x-scheme" );
+ GlobalPatternsShort.Add( ".etx", "text/x-setext" );
+ GlobalPatternsShort.Add( ".sql", "text/x-sql" );
+ GlobalPatternsShort.Add( ".tcl", "text/x-tcl" );
+ GlobalPatternsShort.Add( ".tk", "text/x-tcl" );
+ GlobalPatternsShort.Add( ".tex", "text/x-tex" );
+ GlobalPatternsShort.Add( ".ltx", "text/x-tex" );
+ GlobalPatternsShort.Add( ".sty", "text/x-tex" );
+ GlobalPatternsShort.Add( ".cls", "text/x-tex" );
+ GlobalPatternsShort.Add( ".texi", "text/x-texinfo" );
+ GlobalPatternsShort.Add( ".texinfo", "text/x-texinfo" );
+ GlobalPatternsShort.Add( ".me", "text/x-troff-me" );
+ GlobalPatternsShort.Add( ".mm", "text/x-troff-mm" );
+ GlobalPatternsShort.Add( ".ms", "text/x-troff-ms" );
+ GlobalPatternsShort.Add( ".uil", "text/x-uil" );
+ GlobalPatternsShort.Add( ".uri", "text/x-uri" );
+ GlobalPatternsShort.Add( ".url", "text/x-uri" );
+ GlobalPatternsShort.Add( ".xmi", "text/x-xmi" );
+ GlobalPatternsShort.Add( ".fo", "text/x-xslfo" );
+ GlobalPatternsShort.Add( ".xslfo", "text/x-xslfo" );
+ GlobalPatternsShort.Add( ".xslt", "application/xml" );
+ GlobalPatternsShort.Add( ".xsl", "application/xml" );
+ GlobalPatternsShort.Add( ".xml", "text/xml" );
+ GlobalPatternsShort.Add( ".mpeg", "video/mpeg" );
+ GlobalPatternsShort.Add( ".mpg", "video/mpeg" );
+ GlobalPatternsShort.Add( ".mp2", "video/mpeg" );
+ GlobalPatternsShort.Add( ".mpe", "video/mpeg" );
+ GlobalPatternsShort.Add( ".vob", "video/mpeg" );
+ GlobalPatternsShort.Add( ".dat", "video/mpeg" );
+ GlobalPatternsShort.Add( ".qt", "video/quicktime" );
+ GlobalPatternsShort.Add( ".mov", "video/quicktime" );
+ GlobalPatternsShort.Add( ".moov", "video/quicktime" );
+ GlobalPatternsShort.Add( ".qtvr", "video/quicktime" );
+ GlobalPatternsShort.Add( ".anim[1-9j]", "video/x-anim" );
+ GlobalPatternsShort.Add( ".fli", "video/x-flic" );
+ GlobalPatternsShort.Add( ".flc", "video/x-flic" );
+ GlobalPatternsShort.Add( ".mng", "video/x-mng" );
+ GlobalPatternsShort.Add( ".asf", "video/x-ms-asf" );
+ GlobalPatternsShort.Add( ".asx", "video/x-ms-asf" );
+ GlobalPatternsShort.Add( ".wmv", "video/x-ms-wmv" );
+ GlobalPatternsShort.Add( ".avi", "video/x-msvideo" );
+ GlobalPatternsShort.Add( ".nsv", "video/x-nsv" );
+ GlobalPatternsShort.Add( ".NSV", "video/x-nsv" );
+ GlobalPatternsShort.Add( ".movie", "video/x-sgi-movie" );
+ GlobalPatternsShort.Add( ".crw", "application/x-crw" );
+ GlobalPatternsShort.Add( ".cr2", "application/x-crw" );
+ GlobalPatternsShort.Add( ".pln", "application/x-planperfect" );
+ GlobalPatternsShort.Add( ".mps", "application/x-mps" );
+ GlobalPatternsShort.Add( ".display", "application/x-gdesklets-display" );
+ GlobalPatternsShort.Add( ".il", "text/x-msil" );
+ GlobalPatternsShort.Add( ".n", "text/x-nemerle" );
+ GlobalPatternsShort.Add( ".vb", "text/x-vb" );
+ GlobalPatternsShort.Add( ".js", "text/x-js" );
+ GlobalPatternsShort.Add( ".aspx", "application/x-aspx" );
+ GlobalPatternsShort.Add( ".ashx", "application/x-ashx" );
+ GlobalPatternsShort.Add( ".ascx", "application/x-ascx" );
+ GlobalPatternsShort.Add( ".asix", "application/x-asix" );
+ GlobalPatternsShort.Add( ".axd", "application/x-axd" );
+ GlobalLiterals.Add( "web.config", "application/x-web-config" );
+ GlobalLiterals.Add( "machine.config", "application/x-machine-config" );
+ GlobalPatternsShort.Add( ".config", "application/x-config" );
+ GlobalPatternsShort.Add( ".master", "application/x-master-page" );
+ GlobalPatternsShort.Add( ".resources", "application/x-resources" );
+ GlobalPatternsShort.Add( ".resx", "application/x-resourcesx" );
+ GlobalPatternsShort.Add( ".rem", "application/x-remoting" );
+ GlobalPatternsShort.Add( ".soap", "application/x-soap-remoting" );
+ GlobalPatternsShort.Add( ".asmx", "application/x-asmx" );
+ GlobalPatternsShort.Add( ".prjx", "application/x-prjx" );
+ GlobalPatternsShort.Add( ".cmbx", "application/x-cmbx" );
+ GlobalPatternsShort.Add( ".mdsx", "application/x-mdsx" );
+ GlobalPatternsShort.Add( ".mdp", "application/x-mdp" );
+ GlobalPatternsShort.Add( ".mds", "application/x-mds" );
+ GlobalPatternsShort.Add( ".disco", "application/x-disco" );
+ GlobalPatternsShort.Add( ".asax", "application/x-asax" );
+ GlobalPatternsShort.Add( ".wsdl", "application/x-wsdl" );
+ GlobalPatternsShort.Add( ".planner", "application/x-planner" );
+ GlobalPatternsShort.Add( ".mrproject", "application/x-planner" );
+ GlobalPatternsShort.Add( ".sla", "application/x-scribus" );
+ GlobalPatternsLong.Add( ".sla.gz", "application/x-scribus" );
+ GlobalPatternsShort.Add( ".scd", "application/x-scribus" );
+ GlobalPatternsLong.Add( ".scd.gz", "application/x-scribus" );
+ GlobalPatternsShort.Add( ".vmx", "application/x-vmware-vm" );
+ GlobalPatternsShort.Add( ".vmdk", "application/x-vmware-vmdisk" );
+ GlobalPatternsShort.Add( ".vmtm", "application/x-vmware-team" );
+ GlobalPatternsShort.Add( ".vmsn", "application/x-vmware-snapshot" );
+ GlobalPatternsShort.Add( ".vmxf", "application/x-vmware-vmfoundry" );
+
+ MimeType mt = null;
+
+ mt = new MimeType();
+ mt.Comment = "Bluefish project file";
+ MimeTypes.Add( "application/bluefish-project", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Andrew Toolkit inset";
+ MimeTypes.Add( "application/andrew-inset", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Adobe Illustrator document";
+ MimeTypes.Add( "application/illustrator", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Macintosh BinHex-encoded file";
+ MimeTypes.Add( "application/mac-binhex40", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/mathematica", mt );
+
+ mt = new MimeType();
+ mt.Comment = "unknown";
+ MimeTypes.Add( "application/octet-stream", mt );
+
+ mt = new MimeType();
+ mt.Comment = "ODA document";
+ MimeTypes.Add( "application/oda", mt );
+
+ mt = new MimeType();
+ mt.Comment = "PDF document";
+ MimeTypes.Add( "application/pdf", mt );
+
+ mt = new MimeType();
+ mt.Comment = "PGP message";
+ MimeTypes.Add( "application/pgp", mt );
+
+ mt = new MimeType();
+ mt.Comment = "PGP/MIME-encrypted message header";
+ MimeTypes.Add( "application/pgp-encrypted", mt );
+
+ mt = new MimeType();
+ mt.Comment = "PGP keys";
+ MimeTypes.Add( "application/pgp-keys", mt );
+
+ mt = new MimeType();
+ mt.Comment = "detached OpenPGP signature";
+ MimeTypes.Add( "application/pgp-signature", mt );
+
+ mt = new MimeType();
+ mt.Comment = "S/MIME file";
+ MimeTypes.Add( "application/pkcs7-mime", mt );
+
+ mt = new MimeType();
+ mt.Comment = "detached S/MIME signature";
+ MimeTypes.Add( "application/pkcs7-signature", mt );
+
+ mt = new MimeType();
+ mt.Comment = "PostScript document";
+ MimeTypes.Add( "application/postscript", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Rich Text Format";
+ MimeTypes.Add( "application/rtf", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Synchronized Multimedia Integration Language";
+ MimeTypes.Add( "application/smil", mt );
+
+ mt = new MimeType();
+ mt.Comment = "StuffIt archive";
+ MimeTypes.Add( "application/stuffit", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Family history file";
+ MimeTypes.Add( "application/x-gedcom", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Corel Draw drawing";
+ MimeTypes.Add( "application/vnd.corel-draw", mt );
+
+ mt = new MimeType();
+ mt.Comment = "HP Graphics Language (plotter)";
+ MimeTypes.Add( "application/vnd.hp-hpgl", mt );
+
+ mt = new MimeType();
+ mt.Comment = "HP Printer Control Language file";
+ MimeTypes.Add( "application/vnd.hp-pcl", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Lotus 1-2-3 spreadsheet";
+ MimeTypes.Add( "application/vnd.lotus-1-2-3", mt );
+
+ mt = new MimeType();
+ mt.Comment = "XML User Interface Language document";
+ MimeTypes.Add( "application/vnd.mozilla.xul+xml", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Microsoft Access Jet Database";
+ MimeTypes.Add( "application/vnd.ms-access", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Microsoft Excel spreadsheet";
+ MimeTypes.Add( "application/vnd.ms-excel", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Microsoft PowerPoint presentation";
+ MimeTypes.Add( "application/vnd.ms-powerpoint", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Microsoft Word document";
+ MimeTypes.Add( "application/msword", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Palmpilot database/document";
+ MimeTypes.Add( "application/vnd.palm", mt );
+
+ mt = new MimeType();
+ mt.Comment = "RealAudio/Video document";
+ MimeTypes.Add( "application/vnd.rn-realmedia", mt );
+
+ mt = new MimeType();
+ mt.Comment = "StarCalc spreadsheet";
+ MimeTypes.Add( "application/vnd.stardivision.calc", mt );
+
+ mt = new MimeType();
+ mt.Comment = "StarChart chart";
+ MimeTypes.Add( "application/vnd.stardivision.chart", mt );
+
+ mt = new MimeType();
+ mt.Comment = "StarDraw drawing";
+ MimeTypes.Add( "application/vnd.stardivision.draw", mt );
+
+ mt = new MimeType();
+ mt.Comment = "StarImpress presentation";
+ MimeTypes.Add( "application/vnd.stardivision.impress", mt );
+
+ mt = new MimeType();
+ mt.Comment = "StarMail email";
+ MimeTypes.Add( "application/vnd.stardivision.mail", mt );
+
+ mt = new MimeType();
+ mt.Comment = "StarMath formula";
+ MimeTypes.Add( "application/vnd.stardivision.math", mt );
+
+ mt = new MimeType();
+ mt.Comment = "StarWriter document";
+ MimeTypes.Add( "application/vnd.stardivision.writer", mt );
+
+ mt = new MimeType();
+ mt.Comment = "OpenOffice.org Calc spreadsheet";
+ MimeTypes.Add( "application/vnd.sun.xml.calc", mt );
+
+ mt = new MimeType();
+ mt.Comment = "OpenOffice.org Calc spreadsheet template";
+ MimeTypes.Add( "application/vnd.sun.xml.calc.template", mt );
+
+ mt = new MimeType();
+ mt.Comment = "OpenOffice.org Draw drawing";
+ MimeTypes.Add( "application/vnd.sun.xml.draw", mt );
+
+ mt = new MimeType();
+ mt.Comment = "OpenOffice.org Draw drawing template";
+ MimeTypes.Add( "application/vnd.sun.xml.draw.template", mt );
+
+ mt = new MimeType();
+ mt.Comment = "OpenOffice.org Impress presentation";
+ MimeTypes.Add( "application/vnd.sun.xml.impress", mt );
+
+ mt = new MimeType();
+ mt.Comment = "OpenOffice.org Impress presentation template";
+ MimeTypes.Add( "application/vnd.sun.xml.impress.template", mt );
+
+ mt = new MimeType();
+ mt.Comment = "OpenOffice.org Math formula";
+ MimeTypes.Add( "application/vnd.sun.xml.math", mt );
+
+ mt = new MimeType();
+ mt.Comment = "OpenOffice.org Writer document";
+ MimeTypes.Add( "application/vnd.sun.xml.writer", mt );
+
+ mt = new MimeType();
+ mt.Comment = "OpenOffice.org Writer global document";
+ MimeTypes.Add( "application/vnd.sun.xml.writer.global", mt );
+
+ mt = new MimeType();
+ mt.Comment = "OpenOffice.org Writer document template";
+ MimeTypes.Add( "application/vnd.sun.xml.writer.template", mt );
+
+ mt = new MimeType();
+ mt.Comment = "OpenDocument Text";
+ MimeTypes.Add( "application/vnd.oasis.opendocument.text", mt );
+
+ mt = new MimeType();
+ mt.Comment = "OpenDocument Text Template";
+ MimeTypes.Add( "application/vnd.oasis.opendocument.text-template", mt );
+
+ mt = new MimeType();
+ mt.Comment = "OpenDocument HTML Document Template";
+ MimeTypes.Add( "application/vnd.oasis.opendocument.text-web", mt );
+
+ mt = new MimeType();
+ mt.Comment = "OpenDocument Master Document";
+ MimeTypes.Add( "application/vnd.oasis.opendocument.text-master", mt );
+
+ mt = new MimeType();
+ mt.Comment = "OpenDocument Drawing";
+ MimeTypes.Add( "application/vnd.oasis.opendocument.graphics", mt );
+
+ mt = new MimeType();
+ mt.Comment = "OpenDocument Drawing Template";
+ MimeTypes.Add( "application/vnd.oasis.opendocument.graphics-template", mt );
+
+ mt = new MimeType();
+ mt.Comment = "OpenDocument Presentation";
+ MimeTypes.Add( "application/vnd.oasis.opendocument.presentation", mt );
+
+ mt = new MimeType();
+ mt.Comment = "OpenDocument Presentation Template";
+ MimeTypes.Add( "application/vnd.oasis.opendocument.presentation-template", mt );
+
+ mt = new MimeType();
+ mt.Comment = "OpenDocument Spreadsheet";
+ MimeTypes.Add( "application/vnd.oasis.opendocument.spreadsheet", mt );
+
+ mt = new MimeType();
+ mt.Comment = "OpenDocument Spreadsheet Template";
+ MimeTypes.Add( "application/vnd.oasis.opendocument.spreadsheet-template", mt );
+
+ mt = new MimeType();
+ mt.Comment = "OpenDocument Chart";
+ MimeTypes.Add( "application/vnd.oasis.opendocument.chart", mt );
+
+ mt = new MimeType();
+ mt.Comment = "OpenDocument Formula";
+ MimeTypes.Add( "application/vnd.oasis.opendocument.formula", mt );
+
+ mt = new MimeType();
+ mt.Comment = "OpenDocument Database";
+ MimeTypes.Add( "application/vnd.oasis.opendocument.database", mt );
+
+ mt = new MimeType();
+ mt.Comment = "OpenDocument Image";
+ MimeTypes.Add( "application/vnd.oasis.opendocument.image", mt );
+
+ mt = new MimeType();
+ mt.Comment = "WordPerfect document";
+ MimeTypes.Add( "application/vnd.wordperfect", mt );
+
+ mt = new MimeType();
+ mt.Comment = "XBEL bookmarks";
+ MimeTypes.Add( "application/x-xbel", mt );
+
+ mt = new MimeType();
+ mt.Comment = "7-zip archive";
+ MimeTypes.Add( "application/x-7z-compressed", mt );
+
+ mt = new MimeType();
+ mt.Comment = "AbiWord document";
+ MimeTypes.Add( "application/x-abiword", mt );
+
+ mt = new MimeType();
+ mt.Comment = "CD image cuesheet";
+ MimeTypes.Add( "application/x-cue", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Lotus AmiPro document";
+ MimeTypes.Add( "application/x-amipro", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Applix Spreadsheets spreadsheet";
+ MimeTypes.Add( "application/x-applix-spreadsheet", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Applix Words document";
+ MimeTypes.Add( "application/x-applix-word", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-arc", mt );
+
+ mt = new MimeType();
+ mt.Comment = "AR archive";
+ MimeTypes.Add( "application/x-archive", mt );
+
+ mt = new MimeType();
+ mt.Comment = "ARJ archive";
+ MimeTypes.Add( "application/x-arj", mt );
+
+ mt = new MimeType();
+ mt.Comment = "active server page";
+ MimeTypes.Add( "application/x-asp", mt );
+
+ mt = new MimeType();
+ mt.Comment = "AWK script";
+ MimeTypes.Add( "application/x-awk", mt );
+
+ mt = new MimeType();
+ mt.Comment = "BCPIO document";
+ MimeTypes.Add( "application/x-bcpio", mt );
+
+ mt = new MimeType();
+ mt.Comment = "BitTorrent seed file";
+ MimeTypes.Add( "application/x-bittorrent", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Blender scene";
+ MimeTypes.Add( "application/x-blender", mt );
+
+ mt = new MimeType();
+ mt.Comment = "bzip archive";
+ MimeTypes.Add( "application/x-bzip", mt );
+
+ mt = new MimeType();
+ mt.Comment = "tar archive (bzip-compressed)";
+ MimeTypes.Add( "application/x-bzip-compressed-tar", mt );
+
+ mt = new MimeType();
+ mt.Comment = "raw CD image";
+ MimeTypes.Add( "application/x-cd-image", mt );
+
+ mt = new MimeType();
+ mt.Comment = "CGI script";
+ MimeTypes.Add( "application/x-cgi", mt );
+
+ mt = new MimeType();
+ mt.Comment = "PGN chess game";
+ MimeTypes.Add( "application/x-chess-pgn", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Compiled HTML Help Format";
+ MimeTypes.Add( "application/x-chm", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Java byte code";
+ MimeTypes.Add( "application/x-class-file", mt );
+
+ mt = new MimeType();
+ mt.Comment = "UNIX-compressed file";
+ MimeTypes.Add( "application/x-compress", mt );
+
+ mt = new MimeType();
+ mt.Comment = "tar archive (gzip-compressed)";
+ MimeTypes.Add( "application/x-compressed-tar", mt );
+
+ mt = new MimeType();
+ mt.Comment = "program crash data";
+ MimeTypes.Add( "application/x-core", mt );
+
+ mt = new MimeType();
+ mt.Comment = "CPIO archive";
+ MimeTypes.Add( "application/x-cpio", mt );
+
+ mt = new MimeType();
+ mt.Comment = "CPIO archive (gzip-compressed)";
+ MimeTypes.Add( "application/x-cpio-compressed", mt );
+
+ mt = new MimeType();
+ mt.Comment = "C shell script";
+ MimeTypes.Add( "application/x-csh", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Xbase document";
+ MimeTypes.Add( "application/x-dbf", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-dbm", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Dreamcast ROM";
+ MimeTypes.Add( "application/x-dc-rom", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Debian package";
+ MimeTypes.Add( "application/x-deb", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Qt Designer file";
+ MimeTypes.Add( "application/x-designer", mt );
+
+ mt = new MimeType();
+ mt.Comment = "desktop configuration file";
+ MimeTypes.Add( "application/x-desktop", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Dia diagram";
+ MimeTypes.Add( "application/x-dia-diagram", mt );
+
+ mt = new MimeType();
+ mt.Comment = "TeX DVI document";
+ MimeTypes.Add( "application/x-dvi", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Enlightenment theme";
+ MimeTypes.Add( "application/x-e-theme", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Egon Animator animation";
+ MimeTypes.Add( "application/x-egon", mt );
+
+ mt = new MimeType();
+ mt.Comment = "executable";
+ MimeTypes.Add( "application/x-executable", mt );
+
+ mt = new MimeType();
+ mt.Comment = "font";
+ MimeTypes.Add( "application/x-font-type1", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Adobe font metrics";
+ MimeTypes.Add( "application/x-font-afm", mt );
+
+ mt = new MimeType();
+ mt.Comment = "BDF font";
+ MimeTypes.Add( "application/x-font-bdf", mt );
+
+ mt = new MimeType();
+ mt.Comment = "DOS font";
+ MimeTypes.Add( "application/x-font-dos", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Adobe FrameMaker font";
+ MimeTypes.Add( "application/x-font-framemaker", mt );
+
+ mt = new MimeType();
+ mt.Comment = "LIBGRX font";
+ MimeTypes.Add( "application/x-font-libgrx", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Linux PSF console font";
+ MimeTypes.Add( "application/x-font-linux-psf", mt );
+
+ mt = new MimeType();
+ mt.Comment = "PCF font";
+ MimeTypes.Add( "application/x-font-pcf", mt );
+
+ mt = new MimeType();
+ mt.Comment = "OpenType font";
+ MimeTypes.Add( "application/x-font-otf", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Speedo font";
+ MimeTypes.Add( "application/x-font-speedo", mt );
+
+ mt = new MimeType();
+ mt.Comment = "SunOS News font";
+ MimeTypes.Add( "application/x-font-sunos-news", mt );
+
+ mt = new MimeType();
+ mt.Comment = "TeX font";
+ MimeTypes.Add( "application/x-font-tex", mt );
+
+ mt = new MimeType();
+ mt.Comment = "TeX font metrics";
+ MimeTypes.Add( "application/x-font-tex-tfm", mt );
+
+ mt = new MimeType();
+ mt.Comment = "TrueType font";
+ MimeTypes.Add( "application/x-font-ttf", mt );
+
+ mt = new MimeType();
+ mt.Comment = "V font";
+ MimeTypes.Add( "application/x-font-vfont", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-frame", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Game Boy ROM";
+ MimeTypes.Add( "application/x-gameboy-rom", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-gdbm", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Genesis ROM";
+ MimeTypes.Add( "application/x-genesis-rom", mt );
+
+ mt = new MimeType();
+ mt.Comment = "translated messages (machine-readable)";
+ MimeTypes.Add( "application/x-gettext-translation", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Glade project";
+ MimeTypes.Add( "application/x-glade", mt );
+
+ mt = new MimeType();
+ mt.Comment = "GMC link";
+ MimeTypes.Add( "application/x-gmc-link", mt );
+
+ mt = new MimeType();
+ mt.Comment = "GnuCash spreadsheet";
+ MimeTypes.Add( "application/x-gnucash", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Gnumeric spreadsheet";
+ MimeTypes.Add( "application/x-gnumeric", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Graphite scientific graph";
+ MimeTypes.Add( "application/x-graphite", mt );
+
+ mt = new MimeType();
+ mt.Comment = "gtar archive";
+ MimeTypes.Add( "application/x-gtar", mt );
+
+ mt = new MimeType();
+ mt.Comment = "GTKtalog catalog";
+ MimeTypes.Add( "application/x-gtktalog", mt );
+
+ mt = new MimeType();
+ mt.Comment = "gzip archive";
+ MimeTypes.Add( "application/x-gzip", mt );
+
+ mt = new MimeType();
+ mt.Comment = "PostScript document (gzip-compressed)";
+ MimeTypes.Add( "application/x-gzpostscript", mt );
+
+ mt = new MimeType();
+ mt.Comment = "HDF document";
+ MimeTypes.Add( "application/x-hdf", mt );
+
+ mt = new MimeType();
+ mt.Comment = "iPod firmware";
+ MimeTypes.Add( "application/x-ipod-firmware", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Java archive";
+ MimeTypes.Add( "application/x-jar", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Java class";
+ MimeTypes.Add( "application/x-java", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Java Network Launched Application";
+ MimeTypes.Add( "application/x-java-jnlp-file", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Javascript program";
+ MimeTypes.Add( "application/x-javascript", mt );
+
+ mt = new MimeType();
+ mt.Comment = "JBuilder project";
+ MimeTypes.Add( "application/x-jbuilder-project", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Karbon14 drawing";
+ MimeTypes.Add( "application/x-karbon", mt );
+
+ mt = new MimeType();
+ mt.Comment = "KChart chart";
+ MimeTypes.Add( "application/x-kchart", mt );
+
+ mt = new MimeType();
+ mt.Comment = "KFormula formula";
+ MimeTypes.Add( "application/x-kformula", mt );
+
+ mt = new MimeType();
+ mt.Comment = "KIllustrator drawing";
+ MimeTypes.Add( "application/x-killustrator", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Kivio flowchart";
+ MimeTypes.Add( "application/x-kivio", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Kontour drawing";
+ MimeTypes.Add( "application/x-kontour", mt );
+
+ mt = new MimeType();
+ mt.Comment = "KPovModeler scene";
+ MimeTypes.Add( "application/x-kpovmodeler", mt );
+
+ mt = new MimeType();
+ mt.Comment = "KPresenter presentation";
+ MimeTypes.Add( "application/x-kpresenter", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Krita document";
+ MimeTypes.Add( "application/x-krita", mt );
+
+ mt = new MimeType();
+ mt.Comment = "KSpread spreadsheet";
+ MimeTypes.Add( "application/x-kspread", mt );
+
+ mt = new MimeType();
+ mt.Comment = "KSpread spreadsheet (encrypted)";
+ MimeTypes.Add( "application/x-kspread-crypt", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-ksysv-package", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Kugar document";
+ MimeTypes.Add( "application/x-kugar", mt );
+
+ mt = new MimeType();
+ mt.Comment = "KWord document";
+ MimeTypes.Add( "application/x-kword", mt );
+
+ mt = new MimeType();
+ mt.Comment = "KWord document (encrypted)";
+ MimeTypes.Add( "application/x-kword-crypt", mt );
+
+ mt = new MimeType();
+ mt.Comment = "LHA archive";
+ MimeTypes.Add( "application/x-lha", mt );
+
+ mt = new MimeType();
+ mt.Comment = "LHZ archive";
+ MimeTypes.Add( "application/x-lhz", mt );
+
+ mt = new MimeType();
+ mt.Comment = "message catalog";
+ MimeTypes.Add( "application/x-linguist", mt );
+
+ mt = new MimeType();
+ mt.Comment = "LyX document";
+ MimeTypes.Add( "text/x-lyx", mt );
+
+ mt = new MimeType();
+ mt.Comment = "LZO archive";
+ MimeTypes.Add( "application/x-lzop", mt );
+
+ mt = new MimeType();
+ mt.Comment = "MagicPoint presentation";
+ MimeTypes.Add( "application/x-magicpoint", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Macintosh MacBinary file";
+ MimeTypes.Add( "application/x-macbinary", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Matroska video";
+ MimeTypes.Add( "application/x-matroska", mt );
+
+ mt = new MimeType();
+ mt.Comment = "FrameMaker MIF document";
+ MimeTypes.Add( "application/x-mif", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Mozilla bookmarks";
+ MimeTypes.Add( "application/x-mozilla-bookmarks", mt );
+
+ mt = new MimeType();
+ mt.Comment = "DOS/Windows executable";
+ MimeTypes.Add( "application/x-ms-dos-executable", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-mswinurl", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Microsoft Write document";
+ MimeTypes.Add( "application/x-mswrite", mt );
+
+ mt = new MimeType();
+ mt.Comment = "MSX ROM";
+ MimeTypes.Add( "application/x-msx-rom", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Nintendo64 ROM";
+ MimeTypes.Add( "application/x-n64-rom", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Nautilus link";
+ MimeTypes.Add( "application/x-nautilus-link", mt );
+
+ mt = new MimeType();
+ mt.Comment = "NES ROM";
+ MimeTypes.Add( "application/x-nes-rom", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Unidata NetCDF document";
+ MimeTypes.Add( "application/x-netcdf", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Netscape bookmarks";
+ MimeTypes.Add( "application/x-netscape-bookmarks", mt );
+
+ mt = new MimeType();
+ mt.Comment = "object code";
+ MimeTypes.Add( "application/x-object", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Ogg Vorbis audio";
+ MimeTypes.Add( "application/ogg", mt );
+
+ mt = new MimeType();
+ mt.Comment = "OLE2 compound document storage";
+ MimeTypes.Add( "application/x-ole-storage", mt );
+
+ mt = new MimeType();
+ mt.Comment = "GNU Oleo spreadsheet";
+ MimeTypes.Add( "application/x-oleo", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Palm OS database";
+ MimeTypes.Add( "application/x-palm-database", mt );
+
+ mt = new MimeType();
+ mt.Comment = "PAR2 Parity File";
+ MimeTypes.Add( "application/x-par2", mt );
+
+ mt = new MimeType();
+ mt.Comment = "PEF executable";
+ MimeTypes.Add( "application/x-pef-executable", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Perl script";
+ MimeTypes.Add( "application/x-perl", mt );
+
+ mt = new MimeType();
+ mt.Comment = "PHP script";
+ MimeTypes.Add( "application/x-php", mt );
+
+ mt = new MimeType();
+ mt.Comment = "PKCS#12 certificate bundle";
+ MimeTypes.Add( "application/x-pkcs12", mt );
+
+ mt = new MimeType();
+ mt.Comment = "profiler results";
+ MimeTypes.Add( "application/x-profile", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Pathetic Writer document";
+ MimeTypes.Add( "application/x-pw", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Python bytecode";
+ MimeTypes.Add( "application/x-python-bytecode", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Quattro Pro spreadsheet";
+ MimeTypes.Add( "application/x-quattropro", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Quicken document";
+ MimeTypes.Add( "application/x-qw", mt );
+
+ mt = new MimeType();
+ mt.Comment = "RAR archive";
+ MimeTypes.Add( "application/x-rar", mt );
+
+ mt = new MimeType();
+ mt.Comment = "rejected patch";
+ MimeTypes.Add( "application/x-reject", mt );
+
+ mt = new MimeType();
+ mt.Comment = "RPM package";
+ MimeTypes.Add( "application/x-rpm", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Ruby script";
+ MimeTypes.Add( "application/x-ruby", mt );
+
+ mt = new MimeType();
+ mt.Comment = "SC/xspread file";
+ MimeTypes.Add( "application/x-sc", mt );
+
+ mt = new MimeType();
+ mt.Comment = "shell archive";
+ MimeTypes.Add( "application/x-shar", mt );
+
+ mt = new MimeType();
+ mt.Comment = "shared library (la)";
+ MimeTypes.Add( "application/x-shared-library-la", mt );
+
+ mt = new MimeType();
+ mt.Comment = "shared library";
+ MimeTypes.Add( "application/x-sharedlib", mt );
+
+ mt = new MimeType();
+ mt.Comment = "shell script";
+ MimeTypes.Add( "application/x-shellscript", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Shockwave Flash file";
+ MimeTypes.Add( "application/x-shockwave-flash", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Siag spreadsheet";
+ MimeTypes.Add( "application/x-siag", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Stampede package";
+ MimeTypes.Add( "application/x-slp", mt );
+
+ mt = new MimeType();
+ mt.Comment = "SMS/Game Gear ROM";
+ MimeTypes.Add( "application/x-sms-rom", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Macintosh StuffIt archive";
+ MimeTypes.Add( "application/x-stuffit", mt );
+
+ mt = new MimeType();
+ mt.Comment = "SV4 CPIO archive";
+ MimeTypes.Add( "application/x-sv4cpio", mt );
+
+ mt = new MimeType();
+ mt.Comment = "SV4 CPIP archive (with CRC)";
+ MimeTypes.Add( "application/x-sv4crc", mt );
+
+ mt = new MimeType();
+ mt.Comment = "tar archive";
+ MimeTypes.Add( "application/x-tar", mt );
+
+ mt = new MimeType();
+ mt.Comment = "tar archive (compressed)";
+ MimeTypes.Add( "application/x-tarz", mt );
+
+ mt = new MimeType();
+ mt.Comment = "generic font file";
+ MimeTypes.Add( "application/x-tex-gf", mt );
+
+ mt = new MimeType();
+ mt.Comment = "packed font file";
+ MimeTypes.Add( "application/x-tex-pk", mt );
+
+ mt = new MimeType();
+ mt.Comment = "TGIF document";
+ MimeTypes.Add( "application/x-tgif", mt );
+
+ mt = new MimeType();
+ mt.Comment = "theme";
+ MimeTypes.Add( "application/x-theme", mt );
+
+ mt = new MimeType();
+ mt.Comment = "ToutDoux document";
+ MimeTypes.Add( "application/x-toutdoux", mt );
+
+ mt = new MimeType();
+ mt.Comment = "backup file";
+ MimeTypes.Add( "application/x-trash", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Troff document";
+ MimeTypes.Add( "application/x-troff", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Troff document (with manpage macros)";
+ MimeTypes.Add( "application/x-troff-man", mt );
+
+ mt = new MimeType();
+ mt.Comment = "manual page (compressed)";
+ MimeTypes.Add( "application/x-troff-man-compressed", mt );
+
+ mt = new MimeType();
+ mt.Comment = "tar archive (LZO-compressed)";
+ MimeTypes.Add( "application/x-tzo", mt );
+
+ mt = new MimeType();
+ mt.Comment = "ustar archive";
+ MimeTypes.Add( "application/x-ustar", mt );
+
+ mt = new MimeType();
+ mt.Comment = "WAIS source code";
+ MimeTypes.Add( "application/x-wais-source", mt );
+
+ mt = new MimeType();
+ mt.Comment = "WordPerfect/Drawperfect image";
+ MimeTypes.Add( "application/x-wpg", mt );
+
+ mt = new MimeType();
+ mt.Comment = "DER/PEM/Netscape-encoded X.509 certificate";
+ MimeTypes.Add( "application/x-x509-ca-cert", mt );
+
+ mt = new MimeType();
+ mt.Comment = "empty document";
+ MimeTypes.Add( "application/x-zerosize", mt );
+
+ mt = new MimeType();
+ mt.Comment = "zoo archive";
+ MimeTypes.Add( "application/x-zoo", mt );
+
+ mt = new MimeType();
+ mt.Comment = "XHTML page";
+ MimeTypes.Add( "application/xhtml+xml", mt );
+
+ mt = new MimeType();
+ mt.Comment = "ZIP archive";
+ MimeTypes.Add( "application/zip", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Dolby Digital audio";
+ MimeTypes.Add( "audio/ac3", mt );
+
+ mt = new MimeType();
+ mt.Comment = "ULAW (Sun) audio";
+ MimeTypes.Add( "audio/basic", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Commodore 64 audio";
+ MimeTypes.Add( "audio/prs.sid", mt );
+
+ mt = new MimeType();
+ mt.Comment = "PCM audio";
+ MimeTypes.Add( "audio/x-adpcm", mt );
+
+ mt = new MimeType();
+ mt.Comment = "AIFC audio";
+ MimeTypes.Add( "audio/x-aifc", mt );
+
+ mt = new MimeType();
+ mt.Comment = "AIFF/Amiga/Mac audio";
+ MimeTypes.Add( "audio/x-aiff", mt );
+
+ mt = new MimeType();
+ mt.Comment = "AIFF audio";
+ MimeTypes.Add( "audio/x-aiffc", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Impulse Tracker audio";
+ MimeTypes.Add( "audio/x-it", mt );
+
+ mt = new MimeType();
+ mt.Comment = "FLAC audio";
+ MimeTypes.Add( "audio/x-flac", mt );
+
+ mt = new MimeType();
+ mt.Comment = "MIDI audio";
+ MimeTypes.Add( "audio/midi", mt );
+
+ mt = new MimeType();
+ mt.Comment = "MPEG-4 audio";
+ MimeTypes.Add( "audio/mp4", mt );
+
+ mt = new MimeType();
+ mt.Comment = "MPEG-4 video";
+ MimeTypes.Add( "video/mp4", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Amiga SoundTracker audio";
+ MimeTypes.Add( "audio/x-mod", mt );
+
+ mt = new MimeType();
+ mt.Comment = "MP3 audio";
+ MimeTypes.Add( "audio/mpeg", mt );
+
+ mt = new MimeType();
+ mt.Comment = "MP3 playlist";
+ MimeTypes.Add( "audio/x-mp3-playlist", mt );
+
+ mt = new MimeType();
+ mt.Comment = "MP3 audio";
+ MimeTypes.Add( "audio/x-mpeg", mt );
+
+ mt = new MimeType();
+ mt.Comment = "MP3 audio (streamed)";
+ MimeTypes.Add( "audio/x-mpegurl", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Playlist";
+ MimeTypes.Add( "audio/x-ms-asx", mt );
+
+ mt = new MimeType();
+ mt.Comment = "RealAudio broadcast";
+ MimeTypes.Add( "audio/x-pn-realaudio", mt );
+
+ mt = new MimeType();
+ mt.Comment = "RIFF audio";
+ MimeTypes.Add( "audio/x-riff", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Scream Tracker 3 audio";
+ MimeTypes.Add( "audio/x-s3m", mt );
+
+ mt = new MimeType();
+ mt.Comment = "MP3 ShoutCast playlist";
+ MimeTypes.Add( "audio/x-scpls", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Scream Tracker audio";
+ MimeTypes.Add( "audio/x-stm", mt );
+
+ mt = new MimeType();
+ mt.Comment = "VOC audio";
+ MimeTypes.Add( "audio/x-voc", mt );
+
+ mt = new MimeType();
+ mt.Comment = "WAV audio";
+ MimeTypes.Add( "audio/x-wav", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Scream Tracker instrument";
+ MimeTypes.Add( "audio/x-xi", mt );
+
+ mt = new MimeType();
+ mt.Comment = "FastTracker II audio";
+ MimeTypes.Add( "audio/x-xm", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Windows BMP image";
+ MimeTypes.Add( "image/bmp", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Computer Graphics Metafile";
+ MimeTypes.Add( "image/cgm", mt );
+
+ mt = new MimeType();
+ mt.Comment = "CCITT G3 fax";
+ MimeTypes.Add( "image/fax-g3", mt );
+
+ mt = new MimeType();
+ mt.Comment = "G3 fax image";
+ MimeTypes.Add( "image/g3fax", mt );
+
+ mt = new MimeType();
+ mt.Comment = "GIF image";
+ MimeTypes.Add( "image/gif", mt );
+
+ mt = new MimeType();
+ mt.Comment = "IEF image";
+ MimeTypes.Add( "image/ief", mt );
+
+ mt = new MimeType();
+ mt.Comment = "JPEG image";
+ MimeTypes.Add( "image/jpeg", mt );
+
+ mt = new MimeType();
+ mt.Comment = "JPEG-2000 image";
+ MimeTypes.Add( "image/jpeg2000", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Macintosh Quickdraw/PICT drawing";
+ MimeTypes.Add( "image/x-pict", mt );
+
+ mt = new MimeType();
+ mt.Comment = "PNG image";
+ MimeTypes.Add( "image/png", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Run Length Encoded bitmap";
+ MimeTypes.Add( "image/rle", mt );
+
+ mt = new MimeType();
+ mt.Comment = "scalable SVG image";
+ MimeTypes.Add( "image/svg+xml", mt );
+
+ mt = new MimeType();
+ mt.Comment = "TIFF image";
+ MimeTypes.Add( "image/tiff", mt );
+
+ mt = new MimeType();
+ mt.Comment = "AutoCAD image";
+ MimeTypes.Add( "image/vnd.dwg", mt );
+
+ mt = new MimeType();
+ mt.Comment = "DXF vector image";
+ MimeTypes.Add( "image/vnd.dxf", mt );
+
+ mt = new MimeType();
+ mt.Comment = "3D Studio image";
+ MimeTypes.Add( "image/x-3ds", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Applix Graphics image";
+ MimeTypes.Add( "image/x-applix-graphics", mt );
+
+ mt = new MimeType();
+ mt.Comment = "CMU raster image";
+ MimeTypes.Add( "image/x-cmu-raster", mt );
+
+ mt = new MimeType();
+ mt.Comment = "GIMP image (compressed)";
+ MimeTypes.Add( "image/x-compressed-xcf", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Digital Imaging and Communications in Medicine image";
+ MimeTypes.Add( "application/dicom", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Device Independant Bitmap";
+ MimeTypes.Add( "image/x-dib", mt );
+
+ mt = new MimeType();
+ mt.Comment = "DjVu image";
+ MimeTypes.Add( "image/vnd.djvu", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Digital Moving Picture Exchange image";
+ MimeTypes.Add( "image/dpx", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Encapsulated PostScript image";
+ MimeTypes.Add( "image/x-eps", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Flexible Image Transport System";
+ MimeTypes.Add( "image/x-fits", mt );
+
+ mt = new MimeType();
+ mt.Comment = "FlashPix image";
+ MimeTypes.Add( "image/x-fpx", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Truevision Targa image";
+ MimeTypes.Add( "image/x-icb", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Microsoft Windows icon";
+ MimeTypes.Add( "image/x-ico", mt );
+
+ mt = new MimeType();
+ mt.Comment = "IFF image";
+ MimeTypes.Add( "image/x-iff", mt );
+
+ mt = new MimeType();
+ mt.Comment = "ILBM image";
+ MimeTypes.Add( "image/x-ilbm", mt );
+
+ mt = new MimeType();
+ mt.Comment = "JNG image";
+ MimeTypes.Add( "image/x-jng", mt );
+
+ mt = new MimeType();
+ mt.Comment = "LightWave object";
+ MimeTypes.Add( "image/x-lwo", mt );
+
+ mt = new MimeType();
+ mt.Comment = "LightWave scene";
+ MimeTypes.Add( "image/x-lws", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Microsoft Office drawing";
+ MimeTypes.Add( "image/x-msod", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "image/x-niff", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "image/x-pcx", mt );
+
+ mt = new MimeType();
+ mt.Comment = "PhotoCD image";
+ MimeTypes.Add( "image/x-photo-cd", mt );
+
+ mt = new MimeType();
+ mt.Comment = "PNM image";
+ MimeTypes.Add( "image/x-portable-anymap", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Portable Bitmap File Format";
+ MimeTypes.Add( "image/x-portable-bitmap", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Portable Graymap File Format";
+ MimeTypes.Add( "image/x-portable-graymap", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Portable Pixmap File Format";
+ MimeTypes.Add( "image/x-portable-pixmap", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Photoshop image";
+ MimeTypes.Add( "image/x-psd", mt );
+
+ mt = new MimeType();
+ mt.Comment = "RGB image";
+ MimeTypes.Add( "image/x-rgb", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Silicon Graphics IRIS image";
+ MimeTypes.Add( "image/x-sgi", mt );
+
+ mt = new MimeType();
+ mt.Comment = "SUN Rasterfile image";
+ MimeTypes.Add( "image/x-sun-raster", mt );
+
+ mt = new MimeType();
+ mt.Comment = "TarGA image";
+ MimeTypes.Add( "image/x-tga", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Windows cursor";
+ MimeTypes.Add( "image/x-win-bitmap", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Microsoft WMF file";
+ MimeTypes.Add( "image/x-wmf", mt );
+
+ mt = new MimeType();
+ mt.Comment = "X BitMap image";
+ MimeTypes.Add( "image/x-xbitmap", mt );
+
+ mt = new MimeType();
+ mt.Comment = "GIMP image";
+ MimeTypes.Add( "image/x-xcf", mt );
+
+ mt = new MimeType();
+ mt.Comment = "XFig image";
+ MimeTypes.Add( "image/x-xfig", mt );
+
+ mt = new MimeType();
+ mt.Comment = "X PixMap image";
+ MimeTypes.Add( "image/x-xpixmap", mt );
+
+ mt = new MimeType();
+ mt.Comment = "X window image";
+ MimeTypes.Add( "image/x-xwindowdump", mt );
+
+ mt = new MimeType();
+ mt.Comment = "block device";
+ MimeTypes.Add( "inode/blockdevice", mt );
+
+ mt = new MimeType();
+ mt.Comment = "character device";
+ MimeTypes.Add( "inode/chardevice", mt );
+
+ mt = new MimeType();
+ mt.Comment = "folder";
+ MimeTypes.Add( "inode/directory", mt );
+
+ mt = new MimeType();
+ mt.Comment = "pipe";
+ MimeTypes.Add( "inode/fifo", mt );
+
+ mt = new MimeType();
+ mt.Comment = "mount point";
+ MimeTypes.Add( "inode/mount-point", mt );
+
+ mt = new MimeType();
+ mt.Comment = "socket";
+ MimeTypes.Add( "inode/socket", mt );
+
+ mt = new MimeType();
+ mt.Comment = "symbolic link";
+ MimeTypes.Add( "inode/symlink", mt );
+
+ mt = new MimeType();
+ mt.Comment = "mail delivery report";
+ MimeTypes.Add( "message/delivery-status", mt );
+
+ mt = new MimeType();
+ mt.Comment = "mail disposition report";
+ MimeTypes.Add( "message/disposition-notification", mt );
+
+ mt = new MimeType();
+ mt.Comment = "reference to remote file";
+ MimeTypes.Add( "message/external-body", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Usenet news message";
+ MimeTypes.Add( "message/news", mt );
+
+ mt = new MimeType();
+ mt.Comment = "partial email message";
+ MimeTypes.Add( "message/partial", mt );
+
+ mt = new MimeType();
+ mt.Comment = "email message";
+ MimeTypes.Add( "message/rfc822", mt );
+
+ mt = new MimeType();
+ mt.Comment = "GNU mail message";
+ MimeTypes.Add( "message/x-gnu-rmail", mt );
+
+ mt = new MimeType();
+ mt.Comment = "VRML document";
+ MimeTypes.Add( "model/vrml", mt );
+
+ mt = new MimeType();
+ mt.Comment = "message in several formats";
+ MimeTypes.Add( "multipart/alternative", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Macintosh AppleDouble-encoded file";
+ MimeTypes.Add( "multipart/appledouble", mt );
+
+ mt = new MimeType();
+ mt.Comment = "message digest";
+ MimeTypes.Add( "multipart/digest", mt );
+
+ mt = new MimeType();
+ mt.Comment = "encrypted message";
+ MimeTypes.Add( "multipart/encrypted", mt );
+
+ mt = new MimeType();
+ mt.Comment = "compound documents";
+ MimeTypes.Add( "multipart/mixed", mt );
+
+ mt = new MimeType();
+ mt.Comment = "compound document";
+ MimeTypes.Add( "multipart/related", mt );
+
+ mt = new MimeType();
+ mt.Comment = "mail system report";
+ MimeTypes.Add( "multipart/report", mt );
+
+ mt = new MimeType();
+ mt.Comment = "signed message";
+ MimeTypes.Add( "multipart/signed", mt );
+
+ mt = new MimeType();
+ mt.Comment = "stream of data (server push)";
+ MimeTypes.Add( "multipart/x-mixed-replace", mt );
+
+ mt = new MimeType();
+ mt.Comment = "vCalendar interchange file";
+ MimeTypes.Add( "text/calendar", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Cascading Style Sheet";
+ MimeTypes.Add( "text/css", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Electronic Business Card";
+ MimeTypes.Add( "text/directory", mt );
+
+ mt = new MimeType();
+ mt.Comment = "enriched text document";
+ MimeTypes.Add( "text/enriched", mt );
+
+ mt = new MimeType();
+ mt.Comment = "help page";
+ MimeTypes.Add( "text/htmlh", mt );
+
+ mt = new MimeType();
+ mt.Comment = "MathML document";
+ MimeTypes.Add( "text/mathml", mt );
+
+ mt = new MimeType();
+ mt.Comment = "plain text document";
+ MimeTypes.Add( "text/plain", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Resource Description Framework (RDF) file";
+ MimeTypes.Add( "text/rdf", mt );
+
+ mt = new MimeType();
+ mt.Comment = "email headers";
+ MimeTypes.Add( "text/rfc822-headers", mt );
+
+ mt = new MimeType();
+ mt.Comment = "rich text document";
+ MimeTypes.Add( "text/richtext", mt );
+
+ mt = new MimeType();
+ mt.Comment = "RDF Site Summary";
+ MimeTypes.Add( "text/rss", mt );
+
+ mt = new MimeType();
+ mt.Comment = "SGML document";
+ MimeTypes.Add( "text/sgml", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Spreadsheet interchange document";
+ MimeTypes.Add( "text/spreadsheet", mt );
+
+ mt = new MimeType();
+ mt.Comment = "text document (with tab-separated values)";
+ MimeTypes.Add( "text/tab-separated-values", mt );
+
+ mt = new MimeType();
+ mt.Comment = "WML document";
+ MimeTypes.Add( "text/vnd.wap.wml", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Ada source code";
+ MimeTypes.Add( "text/x-adasrc", mt );
+
+ mt = new MimeType();
+ mt.Comment = "author list";
+ MimeTypes.Add( "text/x-authors", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Bibtex bibliographic data";
+ MimeTypes.Add( "text/x-bibtex", mt );
+
+ mt = new MimeType();
+ mt.Comment = "C++ source code header";
+ MimeTypes.Add( "text/x-c++hdr", mt );
+
+ mt = new MimeType();
+ mt.Comment = "C++ source code";
+ MimeTypes.Add( "text/x-c++src", mt );
+
+ mt = new MimeType();
+ mt.Comment = "C source code header";
+ MimeTypes.Add( "text/x-chdr", mt );
+
+ mt = new MimeType();
+ mt.Comment = "text document (with comma-separated values)";
+ MimeTypes.Add( "text/x-comma-separated-values", mt );
+
+ mt = new MimeType();
+ mt.Comment = "software license terms";
+ MimeTypes.Add( "text/x-copying", mt );
+
+ mt = new MimeType();
+ mt.Comment = "software author credits";
+ MimeTypes.Add( "text/x-credits", mt );
+
+ mt = new MimeType();
+ mt.Comment = "C source code";
+ MimeTypes.Add( "text/x-csrc", mt );
+
+ mt = new MimeType();
+ mt.Comment = "C# source code";
+ MimeTypes.Add( "text/x-csharp", mt );
+
+ mt = new MimeType();
+ mt.Comment = "DCL script";
+ MimeTypes.Add( "text/x-dcl", mt );
+
+ mt = new MimeType();
+ mt.Comment = "DSSSL document";
+ MimeTypes.Add( "text/x-dsl", mt );
+
+ mt = new MimeType();
+ mt.Comment = "D source code";
+ MimeTypes.Add( "text/x-dsrc", mt );
+
+ mt = new MimeType();
+ mt.Comment = "document type definition";
+ MimeTypes.Add( "text/x-dtd", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Emacs Lisp source code";
+ MimeTypes.Add( "text/x-emacs-lisp", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Fortran source code";
+ MimeTypes.Add( "text/x-fortran", mt );
+
+ mt = new MimeType();
+ mt.Comment = "translated messages";
+ MimeTypes.Add( "text/x-gettext-translation", mt );
+
+ mt = new MimeType();
+ mt.Comment = "message translation template";
+ MimeTypes.Add( "text/x-gettext-translation-template", mt );
+
+ mt = new MimeType();
+ mt.Comment = "HTML page";
+ MimeTypes.Add( "text/html", mt );
+
+ mt = new MimeType();
+ mt.Comment = "GTK configuration";
+ MimeTypes.Add( "text/x-gtkrc", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Haskell source code";
+ MimeTypes.Add( "text/x-haskell", mt );
+
+ mt = new MimeType();
+ mt.Comment = "IDL document";
+ MimeTypes.Add( "text/x-idl", mt );
+
+ mt = new MimeType();
+ mt.Comment = "software installation instructions";
+ MimeTypes.Add( "text/x-install", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Java source code";
+ MimeTypes.Add( "text/x-java", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "text/x-ksysv-log", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Literate haskell source code";
+ MimeTypes.Add( "text/x-literate-haskell", mt );
+
+ mt = new MimeType();
+ mt.Comment = "application log";
+ MimeTypes.Add( "text/x-log", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Makefile";
+ MimeTypes.Add( "text/x-makefile", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Qt Meta Object file";
+ MimeTypes.Add( "text/x-moc", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Objective-C source code";
+ MimeTypes.Add( "text/x-objcsrc", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Pascal source code";
+ MimeTypes.Add( "text/x-pascal", mt );
+
+ mt = new MimeType();
+ mt.Comment = "differences between files";
+ MimeTypes.Add( "text/x-patch", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Python script";
+ MimeTypes.Add( "text/x-python", mt );
+
+ mt = new MimeType();
+ mt.Comment = "README document";
+ MimeTypes.Add( "text/x-readme", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Scheme source code";
+ MimeTypes.Add( "text/x-scheme", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Setext document";
+ MimeTypes.Add( "text/x-setext", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Speech document";
+ MimeTypes.Add( "text/x-speech", mt );
+
+ mt = new MimeType();
+ mt.Comment = "SQL code";
+ MimeTypes.Add( "text/x-sql", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Tcl script";
+ MimeTypes.Add( "text/x-tcl", mt );
+
+ mt = new MimeType();
+ mt.Comment = "TeX document";
+ MimeTypes.Add( "text/x-tex", mt );
+
+ mt = new MimeType();
+ mt.Comment = "TeXInfo document";
+ MimeTypes.Add( "text/x-texinfo", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Troff ME input document";
+ MimeTypes.Add( "text/x-troff-me", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Troff MM input document";
+ MimeTypes.Add( "text/x-troff-mm", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Troff MS input document";
+ MimeTypes.Add( "text/x-troff-ms", mt );
+
+ mt = new MimeType();
+ mt.Comment = "X-Motif UIL table";
+ MimeTypes.Add( "text/x-uil", mt );
+
+ mt = new MimeType();
+ mt.Comment = "resource location";
+ MimeTypes.Add( "text/x-uri", mt );
+
+ mt = new MimeType();
+ mt.Comment = "XML Metadata Interchange file";
+ MimeTypes.Add( "text/x-xmi", mt );
+
+ mt = new MimeType();
+ mt.Comment = "XSL Formating Object file";
+ MimeTypes.Add( "text/x-xslfo", mt );
+
+ mt = new MimeType();
+ mt.Comment = "XSLT stylesheet";
+ MimeTypes.Add( "application/xml", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "text/xmcd", mt );
+
+ mt = new MimeType();
+ mt.Comment = "eXtensible Markup Language document";
+ MimeTypes.Add( "text/xml", mt );
+
+ mt = new MimeType();
+ mt.Comment = "ISI video";
+ MimeTypes.Add( "video/isivideo", mt );
+
+ mt = new MimeType();
+ mt.Comment = "MPEG video";
+ MimeTypes.Add( "video/mpeg", mt );
+
+ mt = new MimeType();
+ mt.Comment = "QuickTime video";
+ MimeTypes.Add( "video/quicktime", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Vivo video";
+ MimeTypes.Add( "video/vivo", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Wavelet video";
+ MimeTypes.Add( "video/wavelet", mt );
+
+ mt = new MimeType();
+ mt.Comment = "ANIM animation";
+ MimeTypes.Add( "video/x-anim", mt );
+
+ mt = new MimeType();
+ mt.Comment = "AVI video";
+ MimeTypes.Add( "video/x-avi", mt );
+
+ mt = new MimeType();
+ mt.Comment = "AutoDesk FLIC animation";
+ MimeTypes.Add( "video/x-flic", mt );
+
+ mt = new MimeType();
+ mt.Comment = "MNG animation";
+ MimeTypes.Add( "video/x-mng", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Microsoft ASF video";
+ MimeTypes.Add( "video/x-ms-asf", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Microsoft WMV video";
+ MimeTypes.Add( "video/x-ms-wmv", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Microsoft AVI video";
+ MimeTypes.Add( "video/x-msvideo", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Nullsoft video";
+ MimeTypes.Add( "video/x-nsv", mt );
+
+ mt = new MimeType();
+ mt.Comment = "RealVideo video";
+ MimeTypes.Add( "video/x-real-video", mt );
+
+ mt = new MimeType();
+ mt.Comment = "SGI video";
+ MimeTypes.Add( "video/x-sgi-movie", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Canon RAW File";
+ MimeTypes.Add( "application/x-crw", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Plan Perfect document";
+ MimeTypes.Add( "application/x-planperfect", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Linear and integer program expression format";
+ MimeTypes.Add( "application/x-mps", mt );
+
+ mt = new MimeType();
+ mt.Comment = "gDesklets display";
+ MimeTypes.Add( "application/x-gdesklets-display", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "text/x-msil", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "text/x-nemerle", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "text/x-vb", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "text/x-js", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-aspx", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-ashx", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-ascx", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-asix", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-axd", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-web-config", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-machine-config", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-config", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-master-page", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-resources", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-resourcesx", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-remoting", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-soap-remoting", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-asmx", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-prjx", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-cmbx", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-mdsx", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-mdp", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-mds", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-disco", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-asax", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-wsdl", mt );
+
+ mt = new MimeType();
+ mt.Comment = "Planner project plan";
+ MimeTypes.Add( "application/x-planner", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-scribus", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-vmware-vm", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-vmware-vmdisk", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-vmware-team", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-vmware-snapshot", mt );
+
+ mt = new MimeType();
+ mt.Comment = "";
+ MimeTypes.Add( "application/x-vmware-vmfoundry", mt );
+
+ Match match0 = null;
+
+ match0 = new Match();
+ match0.MimeType = "application/mac-binhex40";
+ match0.Priority = 50;
+ match0.Offset = 11;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 29 ] {
+ 109, 117, 115, 116, 32, 98, 101, 32,
+ 99, 111, 110, 118, 101, 114, 116, 101,
+ 100, 32, 119, 105, 116, 104, 32, 66,
+ 105, 110, 72, 101, 120 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/mathematica";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 53 ] {
+ 40, 42, 42, 42, 42, 42, 42, 42,
+ 42, 42, 42, 42, 42, 42, 42, 32,
+ 67, 111, 110, 116, 101, 110, 116, 45,
+ 116, 121, 112, 101, 58, 32, 97, 112,
+ 112, 108, 105, 99, 97, 116, 105, 111,
+ 110, 47, 109, 97, 116, 104, 101, 109,
+ 97, 116, 105, 99, 97 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/mathematica";
+ match0.Priority = 50;
+ match0.Offset = 100;
+ match0.OffsetLength = 156;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 65 ] {
+ 84, 104, 105, 115, 32, 110, 111, 116,
+ 101, 98, 111, 111, 107, 32, 99, 97,
+ 110, 32, 98, 101, 32, 117, 115, 101,
+ 100, 32, 111, 110, 32, 97, 110, 121,
+ 32, 99, 111, 109, 112, 117, 116, 101,
+ 114, 32, 115, 121, 115, 116, 101, 109,
+ 32, 119, 105, 116, 104, 32, 77, 97,
+ 116, 104, 101, 109, 97, 116, 105, 99,
+ 97 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/mathematica";
+ match0.Priority = 50;
+ match0.Offset = 10;
+ match0.OffsetLength = 246;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 60 ] {
+ 84, 104, 105, 115, 32, 105, 115, 32,
+ 97, 32, 77, 97, 116, 104, 101, 109,
+ 97, 116, 105, 99, 97, 32, 78, 111,
+ 116, 101, 98, 111, 111, 107, 32, 102,
+ 105, 108, 101, 46, 32, 32, 73, 116,
+ 32, 99, 111, 110, 116, 97, 105, 110,
+ 115, 32, 65, 83, 67, 73, 73, 32,
+ 116, 101, 120, 116 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/octet-stream";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 2 ] {
+ 31, 30 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/octet-stream";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeHost16;
+ match0.WordSize = 2;
+ match0.ByteValue = new byte[ 2 ] {
+ 31, 31 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/octet-stream";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeHost16;
+ match0.WordSize = 2;
+ match0.ByteValue = new byte[ 2 ] {
+ 31, 255 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/octet-stream";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 2 ] {
+ 255, 31 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/octet-stream";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeHost16;
+ match0.WordSize = 2;
+ match0.ByteValue = new byte[ 2 ] {
+ 5, 203 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/pdf";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 37, 80, 68, 70, 45 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/postscript";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 3 ] {
+ 4, 37, 33 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/postscript";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 2 ] {
+ 37, 33 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/rtf";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 123, 92, 114, 116, 102 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/smil";
+ match0.Priority = 80;
+ match0.Offset = 0;
+ match0.OffsetLength = 256;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 6 ] {
+ 60, 115, 109, 105, 108, 32 };
+ Matches80Plus.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/stuffit";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 7 ] {
+ 83, 116, 117, 102, 102, 73, 116 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-gedcom";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 6 ] {
+ 48, 32, 72, 69, 65, 68 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/vnd.corel-draw";
+ match0.Priority = 80;
+ match0.Offset = 8;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 8 ] {
+ 67, 68, 82, 88, 118, 114, 115, 110 };
+ match0.Mask = new byte[ 8 ] {
+ 255, 255, 255, 0, 255, 255, 255, 255 };
+ Matches80Plus.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/vnd.lotus-1-2-3";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 14 ] {
+ 0, 0, 2, 0, 6, 4, 6, 0,
+ 8, 0, 0, 0, 0, 0 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/vnd.ms-access";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 19 ] {
+ 0, 1, 0, 0, 83, 116, 97, 110,
+ 100, 97, 114, 100, 32, 74, 101, 116,
+ 32, 68, 66 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/vnd.ms-excel";
+ match0.Priority = 50;
+ match0.Offset = 2080;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 29 ] {
+ 77, 105, 99, 114, 111, 115, 111, 102,
+ 116, 32, 69, 120, 99, 101, 108, 32,
+ 53, 46, 48, 32, 87, 111, 114, 107,
+ 115, 104, 101, 101, 116 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/vnd.ms-powerpoint";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeLittle32;
+ match0.ByteValue = new byte[ 4 ] {
+ 207, 208, 224, 17 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/msword";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 49, 190, 0, 0 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/msword";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 80, 79, 94, 81, 96 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/msword";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 254, 55, 0, 35 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/msword";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 6 ] {
+ 219, 165, 45, 0, 0, 0 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/msword";
+ match0.Priority = 50;
+ match0.Offset = 2080;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 27 ] {
+ 77, 105, 99, 114, 111, 115, 111, 102,
+ 116, 32, 87, 111, 114, 100, 32, 54,
+ 46, 48, 32, 68, 111, 99, 117, 109,
+ 101, 110, 116 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/msword";
+ match0.Priority = 50;
+ match0.Offset = 2112;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 28 ] {
+ 77, 105, 99, 114, 111, 115, 111, 102,
+ 116, 32, 87, 111, 114, 100, 32, 100,
+ 111, 99, 117, 109, 101, 110, 116, 32,
+ 100, 97, 116, 97 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/vnd.sun.xml.calc";
+ match0.Priority = 50;
+ match0.Offset = 30;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 36 ] {
+ 109, 105, 109, 101, 116, 121, 112, 101,
+ 97, 112, 112, 108, 105, 99, 97, 116,
+ 105, 111, 110, 47, 118, 110, 100, 46,
+ 115, 117, 110, 46, 120, 109, 108, 46,
+ 99, 97, 108, 99 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/vnd.wordperfect";
+ match0.Priority = 50;
+ match0.Offset = 1;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 3 ] {
+ 87, 80, 67 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-xbel";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 64;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 14 ] {
+ 60, 33, 68, 79, 67, 84, 89, 80,
+ 69, 32, 120, 98, 101, 108 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-abiword";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 64;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 8 ] {
+ 60, 97, 98, 105, 119, 111, 114, 100 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-abiword";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 64;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 17 ] {
+ 60, 33, 68, 79, 67, 84, 89, 80,
+ 69, 32, 97, 98, 105, 119, 111, 114,
+ 100 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-applix-spreadsheet";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 19 ] {
+ 42, 66, 69, 71, 73, 78, 32, 83,
+ 80, 82, 69, 65, 68, 83, 72, 69,
+ 69, 84, 83 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-applix-spreadsheet";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 6 ] {
+ 42, 66, 69, 71, 73, 78 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 7;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeString;
+ match1.ByteValue = new byte[ 12 ] {
+ 83, 80, 82, 69, 65, 68, 83, 72,
+ 69, 69, 84, 83 };
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-applix-word";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 6 ] {
+ 42, 66, 69, 71, 73, 78 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 7;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeString;
+ match1.ByteValue = new byte[ 5 ] {
+ 87, 79, 82, 68, 83 };
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-arc";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeLittle32;
+ match0.ByteValue = new byte[ 4 ] {
+ 0, 0, 8, 26 };
+ match0.Mask = new byte[ 4 ] {
+ 128, 128, 255, 255 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-arc";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeLittle32;
+ match0.ByteValue = new byte[ 4 ] {
+ 0, 0, 9, 26 };
+ match0.Mask = new byte[ 4 ] {
+ 128, 128, 255, 255 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-arc";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeLittle32;
+ match0.ByteValue = new byte[ 4 ] {
+ 0, 0, 2, 26 };
+ match0.Mask = new byte[ 4 ] {
+ 128, 128, 255, 255 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-arc";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeLittle32;
+ match0.ByteValue = new byte[ 4 ] {
+ 0, 0, 3, 26 };
+ match0.Mask = new byte[ 4 ] {
+ 128, 128, 255, 255 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-arc";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeLittle32;
+ match0.ByteValue = new byte[ 4 ] {
+ 0, 0, 4, 26 };
+ match0.Mask = new byte[ 4 ] {
+ 128, 128, 255, 255 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-arc";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeLittle32;
+ match0.ByteValue = new byte[ 4 ] {
+ 0, 0, 6, 26 };
+ match0.Mask = new byte[ 4 ] {
+ 128, 128, 255, 255 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-archive";
+ match0.Priority = 45;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 60, 97, 114, 62 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-archive";
+ match0.Priority = 45;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 7 ] {
+ 33, 60, 97, 114, 99, 104, 62 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-arj";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeLittle16;
+ match0.ByteValue = new byte[ 2 ] {
+ 234, 96 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-awk";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 11 ] {
+ 35, 33, 47, 98, 105, 110, 47, 103,
+ 97, 119, 107 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-awk";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 12 ] {
+ 35, 33, 32, 47, 98, 105, 110, 47,
+ 103, 97, 119, 107 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-awk";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 15 ] {
+ 35, 33, 47, 117, 115, 114, 47, 98,
+ 105, 110, 47, 103, 97, 119, 107 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-awk";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 16 ] {
+ 35, 33, 32, 47, 117, 115, 114, 47,
+ 98, 105, 110, 47, 103, 97, 119, 107 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-awk";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 21 ] {
+ 35, 33, 47, 117, 115, 114, 47, 108,
+ 111, 99, 97, 108, 47, 98, 105, 110,
+ 47, 103, 97, 119, 107 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-awk";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 22 ] {
+ 35, 33, 32, 47, 117, 115, 114, 47,
+ 108, 111, 99, 97, 108, 47, 98, 105,
+ 110, 47, 103, 97, 119, 107 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-awk";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 10 ] {
+ 35, 33, 47, 98, 105, 110, 47, 97,
+ 119, 107 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-awk";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 11 ] {
+ 35, 33, 32, 47, 98, 105, 110, 47,
+ 97, 119, 107 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-awk";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 14 ] {
+ 35, 33, 47, 117, 115, 114, 47, 98,
+ 105, 110, 47, 97, 119, 107 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-awk";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 15 ] {
+ 35, 33, 32, 47, 117, 115, 114, 47,
+ 98, 105, 110, 47, 97, 119, 107 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-bittorrent";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 11 ] {
+ 100, 56, 58, 97, 110, 110, 111, 117,
+ 110, 99, 101 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-blender";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 7 ] {
+ 66, 76, 69, 78, 68, 69, 82 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-bzip";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 3 ] {
+ 66, 90, 104 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-compress";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 2 ] {
+ 31, 157 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-core";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 17 ] {
+ 127, 69, 76, 70, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32,
+ 4 };
+ match0.Mask = new byte[ 17 ] {
+ 255, 255, 255, 255, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 255 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-core";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 127, 69, 76, 70 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 5;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeByte;
+ match1.ByteValue = new byte[ 1 ] {
+ 1 };
+
+ if ( match1.Matches.Count > 0 )
+ {
+ Match match2 = null;
+ match2 = new Match();
+ match2.Offset = 16;
+ match2.OffsetLength = 1;
+ match2.MatchType = MatchTypes.TypeLittle16;
+ match2.ByteValue = new byte[ 2 ] {
+ 4, 0 };
+ match1.Matches.Add( match2 );
+
+ }
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-core";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 127, 69, 76, 70 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 5;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeByte;
+ match1.ByteValue = new byte[ 1 ] {
+ 2 };
+
+ if ( match1.Matches.Count > 0 )
+ {
+ Match match2 = null;
+ match2 = new Match();
+ match2.Offset = 16;
+ match2.OffsetLength = 1;
+ match2.MatchType = MatchTypes.TypeBig16;
+ match2.ByteValue = new byte[ 2 ] {
+ 0, 4 };
+ match1.Matches.Add( match2 );
+
+ }
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-core";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 67, 111, 114, 101, 1 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-core";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 67, 111, 114, 101, 2 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-cpio";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeHost16;
+ match0.WordSize = 2;
+ match0.ByteValue = new byte[ 2 ] {
+ 199, 113 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-cpio";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 6 ] {
+ 48, 55, 48, 55, 48, 49 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-cpio";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 6 ] {
+ 48, 55, 48, 55, 48, 50 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-cpio";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeHost16;
+ match0.WordSize = 2;
+ match0.ByteValue = new byte[ 2 ] {
+ 113, 199 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-csh";
+ match0.Priority = 50;
+ match0.Offset = 1;
+ match0.OffsetLength = 15;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 9 ] {
+ 47, 98, 105, 110, 47, 116, 99, 115,
+ 104 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-csh";
+ match0.Priority = 50;
+ match0.Offset = 1;
+ match0.OffsetLength = 15;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 8 ] {
+ 47, 98, 105, 110, 47, 99, 115, 104 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-csh";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 18 ] {
+ 35, 33, 47, 117, 115, 114, 47, 98,
+ 105, 110, 47, 101, 110, 118, 32, 99,
+ 115, 104 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-csh";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 19 ] {
+ 35, 33, 47, 117, 115, 114, 47, 98,
+ 105, 110, 47, 101, 110, 118, 32, 116,
+ 99, 115, 104 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-dbm";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeBig32;
+ match0.ByteValue = new byte[ 3 ] {
+ 6, 21, 97 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-deb";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 7 ] {
+ 33, 60, 97, 114, 99, 104, 62 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 8;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeString;
+ match1.ByteValue = new byte[ 6 ] {
+ 100, 101, 98, 105, 97, 110 };
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-desktop";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 32;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 15 ] {
+ 91, 68, 101, 115, 107, 116, 111, 112,
+ 32, 69, 110, 116, 114, 121, 93 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-desktop";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 15 ] {
+ 91, 68, 101, 115, 107, 116, 111, 112,
+ 32, 65, 99, 116, 105, 111, 110 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-desktop";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 19 ] {
+ 91, 75, 68, 69, 32, 68, 101, 115,
+ 107, 116, 111, 112, 32, 69, 110, 116,
+ 114, 121, 93 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-desktop";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 13 ] {
+ 35, 32, 67, 111, 110, 102, 105, 103,
+ 32, 70, 105, 108, 101 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-desktop";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 17 ] {
+ 35, 32, 75, 68, 69, 32, 67, 111,
+ 110, 102, 105, 103, 32, 70, 105, 108,
+ 101 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-dia-diagram";
+ match0.Priority = 50;
+ match0.Offset = 5;
+ match0.OffsetLength = 95;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 60, 100, 105, 97, 58 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-dvi";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeLittle16;
+ match0.ByteValue = new byte[ 2 ] {
+ 2, 247 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-executable";
+ match0.Priority = 40;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 127, 69, 76, 70 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 5;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeByte;
+ match1.ByteValue = new byte[ 1 ] {
+ 1 };
+
+ if ( match1.Matches.Count > 0 )
+ {
+ Match match2 = null;
+ match2 = new Match();
+ match2.Offset = 16;
+ match2.OffsetLength = 1;
+ match2.MatchType = MatchTypes.TypeLittle16;
+ match2.ByteValue = new byte[ 2 ] {
+ 2, 0 };
+ match1.Matches.Add( match2 );
+
+ }
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-executable";
+ match0.Priority = 40;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 127, 69, 76, 70 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 5;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeByte;
+ match1.ByteValue = new byte[ 1 ] {
+ 2 };
+
+ if ( match1.Matches.Count > 0 )
+ {
+ Match match2 = null;
+ match2 = new Match();
+ match2.Offset = 16;
+ match2.OffsetLength = 1;
+ match2.MatchType = MatchTypes.TypeBig16;
+ match2.ByteValue = new byte[ 2 ] {
+ 0, 2 };
+ match1.Matches.Add( match2 );
+
+ }
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-executable";
+ match0.Priority = 40;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 2 ] {
+ 77, 90 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-executable";
+ match0.Priority = 40;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeLittle16;
+ match0.ByteValue = new byte[ 2 ] {
+ 82, 28 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-executable";
+ match0.Priority = 40;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeHost16;
+ match0.WordSize = 2;
+ match0.ByteValue = new byte[ 2 ] {
+ 16, 1 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-executable";
+ match0.Priority = 40;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeHost16;
+ match0.WordSize = 2;
+ match0.ByteValue = new byte[ 2 ] {
+ 17, 1 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-executable";
+ match0.Priority = 40;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeLittle16;
+ match0.ByteValue = new byte[ 2 ] {
+ 131, 1 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-font-type1";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 76, 87, 70, 78 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-font-type1";
+ match0.Priority = 50;
+ match0.Offset = 65;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 76, 87, 70, 78 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-font-type1";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 17 ] {
+ 37, 33, 80, 83, 45, 65, 100, 111,
+ 98, 101, 70, 111, 110, 116, 45, 49,
+ 46 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-font-type1";
+ match0.Priority = 50;
+ match0.Offset = 6;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 17 ] {
+ 37, 33, 80, 83, 45, 65, 100, 111,
+ 98, 101, 70, 111, 110, 116, 45, 49,
+ 46 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-font-type1";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 14 ] {
+ 37, 33, 70, 111, 110, 116, 84, 121,
+ 112, 101, 49, 45, 49, 46 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-font-type1";
+ match0.Priority = 50;
+ match0.Offset = 6;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 14 ] {
+ 37, 33, 70, 111, 110, 116, 84, 121,
+ 112, 101, 49, 45, 49, 46 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-font-bdf";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 10 ] {
+ 83, 84, 65, 82, 84, 70, 79, 78,
+ 84, 32 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-font-dos";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 255, 70, 79, 78 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-font-dos";
+ match0.Priority = 50;
+ match0.Offset = 7;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 0, 69, 71, 65 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-font-dos";
+ match0.Priority = 50;
+ match0.Offset = 7;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 0, 86, 73, 68 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-font-framemaker";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 16 ] {
+ 60, 77, 97, 107, 101, 114, 83, 99,
+ 114, 101, 101, 110, 70, 111, 110, 116 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-font-libgrx";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 20, 2, 89, 25 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-font-linux-psf";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 2 ] {
+ 54, 4 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-font-pcf";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 1, 102, 99, 112 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-font-otf";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 79, 84, 84, 79 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-font-speedo";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 68, 49, 46, 48, 13 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-font-sunos-news";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 9 ] {
+ 83, 116, 97, 114, 116, 70, 111, 110,
+ 116 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-font-sunos-news";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 3 ] {
+ 19, 122, 41 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-font-sunos-news";
+ match0.Priority = 50;
+ match0.Offset = 8;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 3 ] {
+ 19, 122, 43 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-font-tex";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 2 ] {
+ 247, 131 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-font-tex";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 2 ] {
+ 247, 89 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-font-tex";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 2 ] {
+ 247, 202 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-font-tex-tfm";
+ match0.Priority = 50;
+ match0.Offset = 2;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 2 ] {
+ 0, 17 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-font-tex-tfm";
+ match0.Priority = 50;
+ match0.Offset = 2;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 2 ] {
+ 0, 18 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-font-ttf";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 70, 70, 73, 76 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-font-ttf";
+ match0.Priority = 50;
+ match0.Offset = 65;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 70, 70, 73, 76 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-font-ttf";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 0, 1, 0, 0, 0 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-font-vfont";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 70, 79, 78, 84 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-frame";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 10 ] {
+ 60, 77, 97, 107, 101, 114, 70, 105,
+ 108, 101 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-frame";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 8 ] {
+ 60, 77, 73, 70, 70, 105, 108, 101 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-frame";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 16 ] {
+ 60, 77, 97, 107, 101, 114, 68, 105,
+ 99, 116, 105, 111, 110, 97, 114, 121 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-frame";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 15 ] {
+ 60, 77, 97, 107, 101, 114, 83, 99,
+ 114, 101, 101, 110, 70, 111, 110 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-frame";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 60, 77, 77, 76 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-frame";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 60, 66, 111, 111, 107 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-frame";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 6 ] {
+ 60, 77, 97, 107, 101, 114 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-gdbm";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeBig32;
+ match0.ByteValue = new byte[ 4 ] {
+ 19, 87, 154, 206 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-gdbm";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeLittle32;
+ match0.ByteValue = new byte[ 4 ] {
+ 19, 87, 154, 206 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-gdbm";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 71, 68, 66, 77 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-gmc-link";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 32;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 85, 82, 76, 58 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-gnumeric";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 64;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 12 ] {
+ 103, 109, 114, 58, 87, 111, 114, 107,
+ 98, 111, 111, 107 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-gtktalog";
+ match0.Priority = 50;
+ match0.Offset = 4;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 9 ] {
+ 103, 116, 107, 116, 97, 108, 111, 103,
+ 32 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-gzip";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 2 ] {
+ 31, 139 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-ipod-firmware";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 7 ] {
+ 83, 32, 84, 32, 79, 32, 80 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-java";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeHost16;
+ match0.WordSize = 2;
+ match0.ByteValue = new byte[ 2 ] {
+ 202, 254 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 2;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeHost16;
+ match1.WordSize = 2;
+ match1.ByteValue = new byte[ 2 ] {
+ 186, 190 };
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-java-jnlp-file";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 64;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 60, 106, 110, 108, 112 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-karbon";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 2 ] {
+ 31, 139 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 10;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeString;
+ match1.ByteValue = new byte[ 7 ] {
+ 75, 79, 102, 102, 105, 99, 101 };
+
+ if ( match1.Matches.Count > 0 )
+ {
+ Match match2 = null;
+ match2 = new Match();
+ match2.Offset = 18;
+ match2.OffsetLength = 1;
+ match2.MatchType = MatchTypes.TypeString;
+ match2.ByteValue = new byte[ 22 ] {
+ 97, 112, 112, 108, 105, 99, 97, 116,
+ 105, 111, 110, 47, 120, 45, 107, 97,
+ 114, 98, 111, 110, 4, 6 };
+ match1.Matches.Add( match2 );
+
+ }
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-karbon";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 80, 75, 3, 4 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 30;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeString;
+ match1.ByteValue = new byte[ 8 ] {
+ 109, 105, 109, 101, 116, 121, 112, 101 };
+
+ if ( match1.Matches.Count > 0 )
+ {
+ Match match2 = null;
+ match2 = new Match();
+ match2.Offset = 38;
+ match2.OffsetLength = 1;
+ match2.MatchType = MatchTypes.TypeString;
+ match2.ByteValue = new byte[ 20 ] {
+ 97, 112, 112, 108, 105, 99, 97, 116,
+ 105, 111, 110, 47, 120, 45, 107, 97,
+ 114, 98, 111, 110 };
+ match1.Matches.Add( match2 );
+
+ }
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-kchart";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 2 ] {
+ 31, 139 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 10;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeString;
+ match1.ByteValue = new byte[ 7 ] {
+ 75, 79, 102, 102, 105, 99, 101 };
+
+ if ( match1.Matches.Count > 0 )
+ {
+ Match match2 = null;
+ match2 = new Match();
+ match2.Offset = 18;
+ match2.OffsetLength = 1;
+ match2.MatchType = MatchTypes.TypeString;
+ match2.ByteValue = new byte[ 22 ] {
+ 97, 112, 112, 108, 105, 99, 97, 116,
+ 105, 111, 110, 47, 120, 45, 107, 99,
+ 104, 97, 114, 116, 4, 6 };
+ match1.Matches.Add( match2 );
+
+ }
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-kchart";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 80, 75, 3, 4 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 30;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeString;
+ match1.ByteValue = new byte[ 8 ] {
+ 109, 105, 109, 101, 116, 121, 112, 101 };
+
+ if ( match1.Matches.Count > 0 )
+ {
+ Match match2 = null;
+ match2 = new Match();
+ match2.Offset = 38;
+ match2.OffsetLength = 1;
+ match2.MatchType = MatchTypes.TypeString;
+ match2.ByteValue = new byte[ 20 ] {
+ 97, 112, 112, 108, 105, 99, 97, 116,
+ 105, 111, 110, 47, 120, 45, 107, 99,
+ 104, 97, 114, 116 };
+ match1.Matches.Add( match2 );
+
+ }
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-kformula";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 2 ] {
+ 31, 139 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 10;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeString;
+ match1.ByteValue = new byte[ 7 ] {
+ 75, 79, 102, 102, 105, 99, 101 };
+
+ if ( match1.Matches.Count > 0 )
+ {
+ Match match2 = null;
+ match2 = new Match();
+ match2.Offset = 18;
+ match2.OffsetLength = 1;
+ match2.MatchType = MatchTypes.TypeString;
+ match2.ByteValue = new byte[ 24 ] {
+ 97, 112, 112, 108, 105, 99, 97, 116,
+ 105, 111, 110, 47, 120, 45, 107, 102,
+ 111, 114, 109, 117, 108, 97, 4, 6 };
+ match1.Matches.Add( match2 );
+
+ }
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-kformula";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 80, 75, 3, 4 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 30;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeString;
+ match1.ByteValue = new byte[ 8 ] {
+ 109, 105, 109, 101, 116, 121, 112, 101 };
+
+ if ( match1.Matches.Count > 0 )
+ {
+ Match match2 = null;
+ match2 = new Match();
+ match2.Offset = 38;
+ match2.OffsetLength = 1;
+ match2.MatchType = MatchTypes.TypeString;
+ match2.ByteValue = new byte[ 22 ] {
+ 97, 112, 112, 108, 105, 99, 97, 116,
+ 105, 111, 110, 47, 120, 45, 107, 102,
+ 111, 114, 109, 117, 108, 97 };
+ match1.Matches.Add( match2 );
+
+ }
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-killustrator";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 2 ] {
+ 31, 139 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 10;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeString;
+ match1.ByteValue = new byte[ 7 ] {
+ 75, 79, 102, 102, 105, 99, 101 };
+
+ if ( match1.Matches.Count > 0 )
+ {
+ Match match2 = null;
+ match2 = new Match();
+ match2.Offset = 18;
+ match2.OffsetLength = 1;
+ match2.MatchType = MatchTypes.TypeString;
+ match2.ByteValue = new byte[ 28 ] {
+ 97, 112, 112, 108, 105, 99, 97, 116,
+ 105, 111, 110, 47, 120, 45, 107, 105,
+ 108, 108, 117, 115, 116, 114, 97, 116,
+ 111, 114, 4, 6 };
+ match1.Matches.Add( match2 );
+
+ }
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-kivio";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 2 ] {
+ 31, 139 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 10;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeString;
+ match1.ByteValue = new byte[ 7 ] {
+ 75, 79, 102, 102, 105, 99, 101 };
+
+ if ( match1.Matches.Count > 0 )
+ {
+ Match match2 = null;
+ match2 = new Match();
+ match2.Offset = 18;
+ match2.OffsetLength = 1;
+ match2.MatchType = MatchTypes.TypeString;
+ match2.ByteValue = new byte[ 21 ] {
+ 97, 112, 112, 108, 105, 99, 97, 116,
+ 105, 111, 110, 47, 120, 45, 107, 105,
+ 118, 105, 111, 4, 6 };
+ match1.Matches.Add( match2 );
+
+ }
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-kivio";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 80, 75, 3, 4 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 30;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeString;
+ match1.ByteValue = new byte[ 8 ] {
+ 109, 105, 109, 101, 116, 121, 112, 101 };
+
+ if ( match1.Matches.Count > 0 )
+ {
+ Match match2 = null;
+ match2 = new Match();
+ match2.Offset = 38;
+ match2.OffsetLength = 1;
+ match2.MatchType = MatchTypes.TypeString;
+ match2.ByteValue = new byte[ 19 ] {
+ 97, 112, 112, 108, 105, 99, 97, 116,
+ 105, 111, 110, 47, 120, 45, 107, 105,
+ 118, 105, 111 };
+ match1.Matches.Add( match2 );
+
+ }
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-kontour";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 2 ] {
+ 31, 139 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 10;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeString;
+ match1.ByteValue = new byte[ 7 ] {
+ 75, 79, 102, 102, 105, 99, 101 };
+
+ if ( match1.Matches.Count > 0 )
+ {
+ Match match2 = null;
+ match2 = new Match();
+ match2.Offset = 18;
+ match2.OffsetLength = 1;
+ match2.MatchType = MatchTypes.TypeString;
+ match2.ByteValue = new byte[ 23 ] {
+ 97, 112, 112, 108, 105, 99, 97, 116,
+ 105, 111, 110, 47, 120, 45, 107, 111,
+ 110, 116, 111, 117, 114, 4, 6 };
+ match1.Matches.Add( match2 );
+
+ }
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-kontour";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 80, 75, 3, 4 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 30;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeString;
+ match1.ByteValue = new byte[ 8 ] {
+ 109, 105, 109, 101, 116, 121, 112, 101 };
+
+ if ( match1.Matches.Count > 0 )
+ {
+ Match match2 = null;
+ match2 = new Match();
+ match2.Offset = 38;
+ match2.OffsetLength = 1;
+ match2.MatchType = MatchTypes.TypeString;
+ match2.ByteValue = new byte[ 21 ] {
+ 97, 112, 112, 108, 105, 99, 97, 116,
+ 105, 111, 110, 47, 120, 45, 107, 111,
+ 110, 116, 111, 117, 114 };
+ match1.Matches.Add( match2 );
+
+ }
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-kpresenter";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 2 ] {
+ 31, 139 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 10;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeString;
+ match1.ByteValue = new byte[ 7 ] {
+ 75, 79, 102, 102, 105, 99, 101 };
+
+ if ( match1.Matches.Count > 0 )
+ {
+ Match match2 = null;
+ match2 = new Match();
+ match2.Offset = 18;
+ match2.OffsetLength = 1;
+ match2.MatchType = MatchTypes.TypeString;
+ match2.ByteValue = new byte[ 26 ] {
+ 97, 112, 112, 108, 105, 99, 97, 116,
+ 105, 111, 110, 47, 120, 45, 107, 112,
+ 114, 101, 115, 101, 110, 116, 101, 114,
+ 4, 6 };
+ match1.Matches.Add( match2 );
+
+ }
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-kpresenter";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 80, 75, 3, 4 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 30;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeString;
+ match1.ByteValue = new byte[ 8 ] {
+ 109, 105, 109, 101, 116, 121, 112, 101 };
+
+ if ( match1.Matches.Count > 0 )
+ {
+ Match match2 = null;
+ match2 = new Match();
+ match2.Offset = 38;
+ match2.OffsetLength = 1;
+ match2.MatchType = MatchTypes.TypeString;
+ match2.ByteValue = new byte[ 24 ] {
+ 97, 112, 112, 108, 105, 99, 97, 116,
+ 105, 111, 110, 47, 120, 45, 107, 112,
+ 114, 101, 115, 101, 110, 116, 101, 114 };
+ match1.Matches.Add( match2 );
+
+ }
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-krita";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 2 ] {
+ 31, 139 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 10;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeString;
+ match1.ByteValue = new byte[ 7 ] {
+ 75, 79, 102, 102, 105, 99, 101 };
+
+ if ( match1.Matches.Count > 0 )
+ {
+ Match match2 = null;
+ match2 = new Match();
+ match2.Offset = 18;
+ match2.OffsetLength = 1;
+ match2.MatchType = MatchTypes.TypeString;
+ match2.ByteValue = new byte[ 21 ] {
+ 97, 112, 112, 108, 105, 99, 97, 116,
+ 105, 111, 110, 47, 120, 45, 107, 114,
+ 105, 116, 97, 4, 6 };
+ match1.Matches.Add( match2 );
+
+ }
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-krita";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 80, 75, 3, 4 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 30;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeString;
+ match1.ByteValue = new byte[ 8 ] {
+ 109, 105, 109, 101, 116, 121, 112, 101 };
+
+ if ( match1.Matches.Count > 0 )
+ {
+ Match match2 = null;
+ match2 = new Match();
+ match2.Offset = 38;
+ match2.OffsetLength = 1;
+ match2.MatchType = MatchTypes.TypeString;
+ match2.ByteValue = new byte[ 19 ] {
+ 97, 112, 112, 108, 105, 99, 97, 116,
+ 105, 111, 110, 47, 120, 45, 107, 114,
+ 105, 116, 97 };
+ match1.Matches.Add( match2 );
+
+ }
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-kspread";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 2 ] {
+ 31, 139 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 10;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeString;
+ match1.ByteValue = new byte[ 7 ] {
+ 75, 79, 102, 102, 105, 99, 101 };
+
+ if ( match1.Matches.Count > 0 )
+ {
+ Match match2 = null;
+ match2 = new Match();
+ match2.Offset = 18;
+ match2.OffsetLength = 1;
+ match2.MatchType = MatchTypes.TypeString;
+ match2.ByteValue = new byte[ 23 ] {
+ 97, 112, 112, 108, 105, 99, 97, 116,
+ 105, 111, 110, 47, 120, 45, 107, 115,
+ 112, 114, 101, 97, 100, 4, 6 };
+ match1.Matches.Add( match2 );
+
+ }
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-kspread";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 80, 75, 3, 4 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 30;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeString;
+ match1.ByteValue = new byte[ 8 ] {
+ 109, 105, 109, 101, 116, 121, 112, 101 };
+
+ if ( match1.Matches.Count > 0 )
+ {
+ Match match2 = null;
+ match2 = new Match();
+ match2.Offset = 38;
+ match2.OffsetLength = 1;
+ match2.MatchType = MatchTypes.TypeString;
+ match2.ByteValue = new byte[ 21 ] {
+ 97, 112, 112, 108, 105, 99, 97, 116,
+ 105, 111, 110, 47, 120, 45, 107, 115,
+ 112, 114, 101, 97, 100 };
+ match1.Matches.Add( match2 );
+
+ }
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-kspread-crypt";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeBig32;
+ match0.ByteValue = new byte[ 4 ] {
+ 13, 26, 39, 2 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-ksysv-package";
+ match0.Priority = 50;
+ match0.Offset = 4;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 75, 83, 121, 115, 86 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-kword";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 2 ] {
+ 31, 139 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 10;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeString;
+ match1.ByteValue = new byte[ 7 ] {
+ 75, 79, 102, 102, 105, 99, 101 };
+
+ if ( match1.Matches.Count > 0 )
+ {
+ Match match2 = null;
+ match2 = new Match();
+ match2.Offset = 18;
+ match2.OffsetLength = 1;
+ match2.MatchType = MatchTypes.TypeString;
+ match2.ByteValue = new byte[ 21 ] {
+ 97, 112, 112, 108, 105, 99, 97, 116,
+ 105, 111, 110, 47, 120, 45, 107, 119,
+ 111, 114, 100, 4, 6 };
+ match1.Matches.Add( match2 );
+
+ }
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-kword";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 80, 75, 3, 4 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 30;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeString;
+ match1.ByteValue = new byte[ 8 ] {
+ 109, 105, 109, 101, 116, 121, 112, 101 };
+
+ if ( match1.Matches.Count > 0 )
+ {
+ Match match2 = null;
+ match2 = new Match();
+ match2.Offset = 38;
+ match2.OffsetLength = 1;
+ match2.MatchType = MatchTypes.TypeString;
+ match2.ByteValue = new byte[ 19 ] {
+ 97, 112, 112, 108, 105, 99, 97, 116,
+ 105, 111, 110, 47, 120, 45, 107, 119,
+ 111, 114, 100 };
+ match1.Matches.Add( match2 );
+
+ }
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-kword-crypt";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeBig32;
+ match0.ByteValue = new byte[ 4 ] {
+ 13, 26, 39, 1 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-lha";
+ match0.Priority = 50;
+ match0.Offset = 2;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 45, 108, 104, 32, 45 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-lha";
+ match0.Priority = 50;
+ match0.Offset = 2;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 45, 108, 104, 48, 45 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-lha";
+ match0.Priority = 50;
+ match0.Offset = 2;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 45, 108, 104, 49, 45 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-lha";
+ match0.Priority = 50;
+ match0.Offset = 2;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 45, 108, 104, 50, 45 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-lha";
+ match0.Priority = 50;
+ match0.Offset = 2;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 45, 108, 104, 51, 45 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-lha";
+ match0.Priority = 50;
+ match0.Offset = 2;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 45, 108, 104, 52, 45 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-lha";
+ match0.Priority = 50;
+ match0.Offset = 2;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 45, 108, 104, 53, 45 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-lha";
+ match0.Priority = 50;
+ match0.Offset = 2;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 6 ] {
+ 45, 108, 104, 52, 48, 45 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-lha";
+ match0.Priority = 50;
+ match0.Offset = 2;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 45, 108, 104, 100, 45 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-lha";
+ match0.Priority = 50;
+ match0.Offset = 2;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 45, 108, 122, 52, 45 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-lha";
+ match0.Priority = 50;
+ match0.Offset = 2;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 45, 108, 122, 53, 45 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-lha";
+ match0.Priority = 50;
+ match0.Offset = 2;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 45, 108, 122, 115, 45 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/x-lyx";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 35, 76, 121, 88 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-macbinary";
+ match0.Priority = 50;
+ match0.Offset = 102;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 109, 66, 73, 78 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-matroska";
+ match0.Priority = 50;
+ match0.Offset = 8;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 8 ] {
+ 109, 97, 116, 114, 111, 115, 107, 97 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-mozilla-bookmarks";
+ match0.Priority = 80;
+ match0.Offset = 0;
+ match0.OffsetLength = 64;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 35 ] {
+ 60, 33, 68, 79, 67, 84, 89, 80,
+ 69, 32, 78, 69, 84, 83, 67, 65,
+ 80, 69, 45, 66, 111, 111, 107, 109,
+ 97, 114, 107, 45, 102, 105, 108, 101,
+ 45, 49, 62 };
+ Matches80Plus.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-ms-dos-executable";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 2 ] {
+ 77, 90 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-mswinurl";
+ match0.Priority = 50;
+ match0.Offset = 1;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 16 ] {
+ 73, 110, 116, 101, 114, 110, 101, 116,
+ 83, 104, 111, 114, 116, 99, 117, 116 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-nautilus-link";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 32;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 30 ] {
+ 60, 110, 97, 117, 116, 105, 108, 117,
+ 115, 95, 111, 98, 106, 101, 99, 116,
+ 32, 110, 97, 117, 116, 105, 108, 117,
+ 115, 95, 108, 105, 110, 107 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-netscape-bookmarks";
+ match0.Priority = 80;
+ match0.Offset = 0;
+ match0.OffsetLength = 64;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 35 ] {
+ 60, 33, 68, 79, 67, 84, 89, 80,
+ 69, 32, 78, 69, 84, 83, 67, 65,
+ 80, 69, 45, 66, 111, 111, 107, 109,
+ 97, 114, 107, 45, 102, 105, 108, 101,
+ 45, 49, 62 };
+ Matches80Plus.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-object";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 127, 69, 76, 70 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 5;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeByte;
+ match1.ByteValue = new byte[ 1 ] {
+ 1 };
+
+ if ( match1.Matches.Count > 0 )
+ {
+ Match match2 = null;
+ match2 = new Match();
+ match2.Offset = 16;
+ match2.OffsetLength = 1;
+ match2.MatchType = MatchTypes.TypeLittle16;
+ match2.ByteValue = new byte[ 2 ] {
+ 1, 0 };
+ match1.Matches.Add( match2 );
+
+ }
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-object";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 127, 69, 76, 70 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 5;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeByte;
+ match1.ByteValue = new byte[ 1 ] {
+ 2 };
+
+ if ( match1.Matches.Count > 0 )
+ {
+ Match match2 = null;
+ match2 = new Match();
+ match2.Offset = 16;
+ match2.OffsetLength = 1;
+ match2.MatchType = MatchTypes.TypeBig16;
+ match2.ByteValue = new byte[ 2 ] {
+ 0, 1 };
+ match1.Matches.Add( match2 );
+
+ }
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/ogg";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 79, 103, 103, 83 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-ole-storage";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 8 ] {
+ 208, 207, 17, 224, 161, 177, 26, 225 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-oleo";
+ match0.Priority = 50;
+ match0.Offset = 31;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 79, 108, 101, 111 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-par2";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 80, 65, 82, 50 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-pef-executable";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 74, 111, 121, 33 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-perl";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 30 ] {
+ 101, 118, 97, 108, 32, 34, 101, 120,
+ 101, 99, 32, 47, 117, 115, 114, 47,
+ 108, 111, 99, 97, 108, 47, 98, 105,
+ 110, 47, 112, 101, 114, 108 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-perl";
+ match0.Priority = 50;
+ match0.Offset = 1;
+ match0.OffsetLength = 15;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 9 ] {
+ 47, 98, 105, 110, 47, 112, 101, 114,
+ 108 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-perl";
+ match0.Priority = 50;
+ match0.Offset = 1;
+ match0.OffsetLength = 15;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 13 ] {
+ 47, 98, 105, 110, 47, 101, 110, 118,
+ 32, 112, 101, 114, 108 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-php";
+ match0.Priority = 80;
+ match0.Offset = 0;
+ match0.OffsetLength = 64;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 60, 63, 112, 104, 112 };
+ Matches80Plus.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-python-bytecode";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeBig32;
+ match0.ByteValue = new byte[ 4 ] {
+ 153, 78, 13, 10 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-rar";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 82, 97, 114, 33 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-rpm";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 237, 171, 238, 219 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-ruby";
+ match0.Priority = 50;
+ match0.Offset = 1;
+ match0.OffsetLength = 15;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 13 ] {
+ 47, 98, 105, 110, 47, 101, 110, 118,
+ 32, 114, 117, 98, 121 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-ruby";
+ match0.Priority = 50;
+ match0.Offset = 1;
+ match0.OffsetLength = 15;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 9 ] {
+ 47, 98, 105, 110, 47, 114, 117, 98,
+ 121 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-sc";
+ match0.Priority = 50;
+ match0.Offset = 38;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 11 ] {
+ 83, 112, 114, 101, 97, 100, 115, 104,
+ 101, 101, 116 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-sharedlib";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 127, 69, 76, 70 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 5;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeByte;
+ match1.ByteValue = new byte[ 1 ] {
+ 1 };
+
+ if ( match1.Matches.Count > 0 )
+ {
+ Match match2 = null;
+ match2 = new Match();
+ match2.Offset = 16;
+ match2.OffsetLength = 1;
+ match2.MatchType = MatchTypes.TypeLittle16;
+ match2.ByteValue = new byte[ 2 ] {
+ 3, 0 };
+ match1.Matches.Add( match2 );
+
+ }
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-sharedlib";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 127, 69, 76, 70 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 5;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeByte;
+ match1.ByteValue = new byte[ 1 ] {
+ 2 };
+
+ if ( match1.Matches.Count > 0 )
+ {
+ Match match2 = null;
+ match2 = new Match();
+ match2.Offset = 16;
+ match2.OffsetLength = 1;
+ match2.MatchType = MatchTypes.TypeBig16;
+ match2.ByteValue = new byte[ 2 ] {
+ 0, 3 };
+ match1.Matches.Add( match2 );
+
+ }
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-sharedlib";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeLittle16;
+ match0.ByteValue = new byte[ 2 ] {
+ 131, 1 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 22;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeLittle16;
+ match1.ByteValue = new byte[ 2 ] {
+ 0, 32 };
+ match1.Mask = new byte[ 3 ] {
+ 3, 0, 0 };
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-sharedlib";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 17 ] {
+ 127, 69, 76, 70, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32,
+ 3 };
+ match0.Mask = new byte[ 17 ] {
+ 255, 255, 255, 255, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 255 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-shellscript";
+ match0.Priority = 50;
+ match0.Offset = 10;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 25 ] {
+ 35, 32, 84, 104, 105, 115, 32, 105,
+ 115, 32, 97, 32, 115, 104, 101, 108,
+ 108, 32, 97, 114, 99, 104, 105, 118,
+ 101 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-shellscript";
+ match0.Priority = 50;
+ match0.Offset = 1;
+ match0.OffsetLength = 15;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 9 ] {
+ 47, 98, 105, 110, 47, 98, 97, 115,
+ 104 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-shellscript";
+ match0.Priority = 50;
+ match0.Offset = 1;
+ match0.OffsetLength = 15;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 9 ] {
+ 47, 98, 105, 110, 47, 110, 97, 119,
+ 107 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-shellscript";
+ match0.Priority = 50;
+ match0.Offset = 1;
+ match0.OffsetLength = 15;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 8 ] {
+ 47, 98, 105, 110, 47, 122, 115, 104 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-shellscript";
+ match0.Priority = 50;
+ match0.Offset = 1;
+ match0.OffsetLength = 15;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 7 ] {
+ 47, 98, 105, 110, 47, 115, 104 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-shellscript";
+ match0.Priority = 50;
+ match0.Offset = 1;
+ match0.OffsetLength = 15;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 8 ] {
+ 47, 98, 105, 110, 47, 107, 115, 104 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-shellscript";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 17 ] {
+ 35, 33, 47, 117, 115, 114, 47, 98,
+ 105, 110, 47, 101, 110, 118, 32, 115,
+ 104 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-shellscript";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 19 ] {
+ 35, 33, 47, 117, 115, 114, 47, 98,
+ 105, 110, 47, 101, 110, 118, 32, 98,
+ 97, 115, 104 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-shellscript";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 18 ] {
+ 35, 33, 47, 117, 115, 114, 47, 98,
+ 105, 110, 47, 101, 110, 118, 32, 122,
+ 115, 104 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-shellscript";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 18 ] {
+ 35, 33, 47, 117, 115, 114, 47, 98,
+ 105, 110, 47, 101, 110, 118, 32, 107,
+ 115, 104 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-shockwave-flash";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 3 ] {
+ 70, 87, 83 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-stuffit";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 8 ] {
+ 83, 116, 117, 102, 102, 73, 116, 32 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-stuffit";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 83, 73, 84, 33 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-tar";
+ match0.Priority = 50;
+ match0.Offset = 257;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 6 ] {
+ 117, 115, 116, 97, 114, 0 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-tar";
+ match0.Priority = 50;
+ match0.Offset = 257;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 8 ] {
+ 117, 115, 116, 97, 114, 32, 32, 0 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-tgif";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 37, 84, 71, 73, 70 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-troff";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 3 ] {
+ 46, 92, 34 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-troff";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 3 ] {
+ 39, 92, 34 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-troff";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 39, 46, 92, 34 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-troff";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 2 ] {
+ 92, 34 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-zoo";
+ match0.Priority = 50;
+ match0.Offset = 20;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeLittle32;
+ match0.ByteValue = new byte[ 4 ] {
+ 253, 196, 167, 220 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/zip";
+ match0.Priority = 40;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 80, 75, 3, 4 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "audio/basic";
+ match0.Priority = 40;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 46, 115, 110, 100 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "audio/prs.sid";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 80, 83, 73, 68 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "audio/x-adpcm";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 46, 115, 110, 100 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 12;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeBig32;
+ match1.ByteValue = new byte[ 4 ] {
+ 0, 0, 0, 19 };
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "audio/x-adpcm";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeLittle32;
+ match0.ByteValue = new byte[ 4 ] {
+ 0, 100, 115, 46 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 12;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeLittle32;
+ match1.ByteValue = new byte[ 4 ] {
+ 1, 0, 0, 0 };
+ match0.Matches.Add( match1 );
+
+ match1 = new Match();
+ match1.Offset = 12;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeLittle32;
+ match1.ByteValue = new byte[ 4 ] {
+ 2, 0, 0, 0 };
+ match0.Matches.Add( match1 );
+
+ match1 = new Match();
+ match1.Offset = 12;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeLittle32;
+ match1.ByteValue = new byte[ 4 ] {
+ 3, 0, 0, 0 };
+ match0.Matches.Add( match1 );
+
+ match1 = new Match();
+ match1.Offset = 12;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeLittle32;
+ match1.ByteValue = new byte[ 4 ] {
+ 4, 0, 0, 0 };
+ match0.Matches.Add( match1 );
+
+ match1 = new Match();
+ match1.Offset = 12;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeLittle32;
+ match1.ByteValue = new byte[ 4 ] {
+ 5, 0, 0, 0 };
+ match0.Matches.Add( match1 );
+
+ match1 = new Match();
+ match1.Offset = 12;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeLittle32;
+ match1.ByteValue = new byte[ 4 ] {
+ 6, 0, 0, 0 };
+ match0.Matches.Add( match1 );
+
+ match1 = new Match();
+ match1.Offset = 12;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeLittle32;
+ match1.ByteValue = new byte[ 4 ] {
+ 7, 0, 0, 0 };
+ match0.Matches.Add( match1 );
+
+ match1 = new Match();
+ match1.Offset = 12;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeLittle32;
+ match1.ByteValue = new byte[ 4 ] {
+ 19, 0, 0, 0 };
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "audio/x-aifc";
+ match0.Priority = 50;
+ match0.Offset = 8;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 65, 73, 70, 67 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "audio/x-aiff";
+ match0.Priority = 50;
+ match0.Offset = 8;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 65, 73, 70, 70 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "audio/x-aiff";
+ match0.Priority = 50;
+ match0.Offset = 8;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 65, 73, 70, 67 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "audio/x-aiff";
+ match0.Priority = 50;
+ match0.Offset = 8;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 56, 83, 86, 88 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "audio/x-it";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 73, 77, 80, 77 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "audio/midi";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 77, 84, 104, 100 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "audio/mp4";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 7 ] {
+ 102, 116, 121, 112, 77, 52, 65 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "video/mp4";
+ match0.Priority = 50;
+ match0.Offset = 4;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 8 ] {
+ 102, 116, 121, 112, 105, 115, 111, 109 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "video/mp4";
+ match0.Priority = 50;
+ match0.Offset = 4;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 8 ] {
+ 102, 116, 121, 112, 109, 112, 52, 50 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "audio/mpeg";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeBig32;
+ match0.ByteValue = new byte[ 2 ] {
+ 255, 251 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "audio/mpeg";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 3 ] {
+ 73, 68, 51 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "audio/x-mpegurl";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 7 ] {
+ 35, 69, 88, 84, 77, 51, 85 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "audio/x-ms-asx";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 65, 83, 70, 32 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "audio/x-ms-asx";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 60, 65, 83, 88 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "audio/x-ms-asx";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 60, 97, 115, 120 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "audio/x-pn-realaudio";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 46, 114, 97, 253 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "audio/x-pn-realaudio";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 46, 82, 77, 70 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "audio/x-riff";
+ match0.Priority = 45;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 82, 73, 70, 70 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "audio/x-scpls";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 10 ] {
+ 91, 112, 108, 97, 121, 108, 105, 115,
+ 116, 93 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "audio/x-scpls";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 10 ] {
+ 91, 80, 108, 97, 121, 108, 105, 115,
+ 116, 93 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "audio/x-scpls";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 10 ] {
+ 91, 80, 76, 65, 89, 76, 73, 83,
+ 84, 93 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "audio/x-wav";
+ match0.Priority = 50;
+ match0.Offset = 8;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 87, 65, 86, 69 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "audio/x-wav";
+ match0.Priority = 50;
+ match0.Offset = 8;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 87, 65, 86, 32 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "image/bmp";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 8 ] {
+ 66, 77, 120, 120, 120, 120, 0, 0 };
+ match0.Mask = new byte[ 8 ] {
+ 255, 255, 0, 0, 0, 0, 255, 255 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "image/bmp";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 2 ] {
+ 66, 77 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 14;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeByte;
+ match1.ByteValue = new byte[ 1 ] {
+ 12 };
+ match0.Matches.Add( match1 );
+
+ match1 = new Match();
+ match1.Offset = 14;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeByte;
+ match1.ByteValue = new byte[ 1 ] {
+ 64 };
+ match0.Matches.Add( match1 );
+
+ match1 = new Match();
+ match1.Offset = 14;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeByte;
+ match1.ByteValue = new byte[ 1 ] {
+ 40 };
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "image/gif";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 3 ] {
+ 71, 73, 70 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "image/jpeg";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 3 ] {
+ 255, 216, 255 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "image/jpeg";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeBig16;
+ match0.ByteValue = new byte[ 2 ] {
+ 255, 216 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "image/png";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 137, 80, 78, 71 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "image/svg+xml";
+ match0.Priority = 80;
+ match0.Offset = 0;
+ match0.OffsetLength = 256;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 13 ] {
+ 60, 33, 68, 79, 67, 84, 89, 80,
+ 69, 32, 115, 118, 103 };
+ Matches80Plus.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "image/svg+xml";
+ match0.Priority = 80;
+ match0.Offset = 0;
+ match0.OffsetLength = 64;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 60, 115, 118, 103 };
+ Matches80Plus.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "image/tiff";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 77, 77, 0, 42 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "image/tiff";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 73, 73, 42, 0 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "image/x-applix-graphics";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 6 ] {
+ 42, 66, 69, 71, 73, 78 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 7;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeString;
+ match1.ByteValue = new byte[ 8 ] {
+ 71, 82, 65, 80, 72, 73, 67, 83 };
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/dicom";
+ match0.Priority = 50;
+ match0.Offset = 128;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 68, 73, 67, 77 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "image/x-dib";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 40, 0, 0, 0 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "image/vnd.djvu";
+ match0.Priority = 50;
+ match0.Offset = 4;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 70, 79, 82, 77 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 12;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeString;
+ match1.ByteValue = new byte[ 4 ] {
+ 68, 74, 86, 85 };
+ match0.Matches.Add( match1 );
+
+ match1 = new Match();
+ match1.Offset = 12;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeString;
+ match1.ByteValue = new byte[ 4 ] {
+ 68, 74, 86, 77 };
+ match0.Matches.Add( match1 );
+
+ match1 = new Match();
+ match1.Offset = 12;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeString;
+ match1.ByteValue = new byte[ 4 ] {
+ 66, 77, 52, 52 };
+ match0.Matches.Add( match1 );
+
+ match1 = new Match();
+ match1.Offset = 12;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeString;
+ match1.ByteValue = new byte[ 4 ] {
+ 80, 77, 52, 52 };
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "image/dpx";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeBig32;
+ match0.ByteValue = new byte[ 4 ] {
+ 83, 68, 80, 88 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "image/x-eps";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 2 ] {
+ 37, 33 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 15;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeString;
+ match1.ByteValue = new byte[ 3 ] {
+ 69, 80, 83 };
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "image/x-eps";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 3 ] {
+ 4, 37, 33 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 16;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeString;
+ match1.ByteValue = new byte[ 3 ] {
+ 69, 80, 83 };
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "image/x-fits";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 9 ] {
+ 83, 73, 77, 80, 76, 69, 32, 32,
+ 61 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "image/x-fpx";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeBig32;
+ match0.ByteValue = new byte[ 4 ] {
+ 70, 80, 105, 120 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "image/x-icb";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeBig32;
+ match0.ByteValue = new byte[ 4 ] {
+ 0, 0, 2, 0 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "image/x-niff";
+ match0.Priority = 80;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 73, 73, 78, 49 };
+ Matches80Plus.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "image/x-pcx";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeByte;
+ match0.ByteValue = new byte[ 1 ] {
+ 10 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 1;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeByte;
+ match1.ByteValue = new byte[ 1 ] {
+ 0 };
+ match0.Matches.Add( match1 );
+
+ match1 = new Match();
+ match1.Offset = 1;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeByte;
+ match1.ByteValue = new byte[ 1 ] {
+ 2 };
+ match0.Matches.Add( match1 );
+
+ match1 = new Match();
+ match1.Offset = 1;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeByte;
+ match1.ByteValue = new byte[ 1 ] {
+ 3 };
+ match0.Matches.Add( match1 );
+
+ match1 = new Match();
+ match1.Offset = 1;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeByte;
+ match1.ByteValue = new byte[ 1 ] {
+ 5 };
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "image/x-portable-bitmap";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 2 ] {
+ 80, 49 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "image/x-portable-bitmap";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 2 ] {
+ 80, 52 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "image/x-portable-graymap";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 2 ] {
+ 80, 50 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "image/x-portable-graymap";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 2 ] {
+ 80, 53 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "image/x-portable-pixmap";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 2 ] {
+ 80, 51 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "image/x-portable-pixmap";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 2 ] {
+ 80, 54 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "image/x-psd";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 10 ] {
+ 56, 66, 80, 83, 32, 32, 0, 0,
+ 0, 0 };
+ match0.Mask = new byte[ 10 ] {
+ 255, 255, 255, 255, 0, 0, 255, 255,
+ 255, 255 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "image/x-sun-raster";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeBig32;
+ match0.ByteValue = new byte[ 4 ] {
+ 89, 166, 106, 149 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "image/x-xfig";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 35, 70, 73, 71 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "image/x-xpixmap";
+ match0.Priority = 80;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 6 ] {
+ 47, 42, 32, 88, 80, 77 };
+ Matches80Plus.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "message/news";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 7 ] {
+ 65, 114, 116, 105, 99, 108, 101 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "message/news";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 80, 97, 116, 104, 58 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "message/news";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 88, 114, 101, 102, 58 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "message/rfc822";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 8 ] {
+ 35, 33, 32, 114, 110, 101, 119, 115 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "message/rfc822";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 10 ] {
+ 70, 111, 114, 119, 97, 114, 100, 32,
+ 116, 111 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "message/rfc822";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 70, 114, 111, 109, 58 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "message/rfc822";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 9 ] {
+ 78, 35, 33, 32, 114, 110, 101, 119,
+ 115 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "message/rfc822";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 7 ] {
+ 80, 105, 112, 101, 32, 116, 111 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "message/rfc822";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 9 ] {
+ 82, 101, 99, 101, 105, 118, 101, 100,
+ 58 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "message/rfc822";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 14 ] {
+ 82, 101, 108, 97, 121, 45, 86, 101,
+ 114, 115, 105, 111, 110, 58 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "message/rfc822";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 12 ] {
+ 82, 101, 116, 117, 114, 110, 45, 80,
+ 97, 116, 104, 58 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/calendar";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 15 ] {
+ 66, 69, 71, 73, 78, 58, 86, 67,
+ 65, 76, 69, 78, 68, 65, 82 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/calendar";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 15 ] {
+ 98, 101, 103, 105, 110, 58, 118, 99,
+ 97, 108, 101, 110, 100, 97, 114 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/directory";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 11 ] {
+ 66, 69, 71, 73, 78, 58, 86, 67,
+ 65, 82, 68 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/directory";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 11 ] {
+ 98, 101, 103, 105, 110, 58, 118, 99,
+ 97, 114, 100 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/plain";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 12 ] {
+ 84, 104, 105, 115, 32, 105, 115, 32,
+ 84, 101, 88, 44 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/plain";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 17 ] {
+ 84, 104, 105, 115, 32, 105, 115, 32,
+ 77, 69, 84, 65, 70, 79, 78, 84,
+ 44 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/spreadsheet";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 3 ] {
+ 73, 68, 59 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/x-emacs-lisp";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 2 ] {
+ 10, 40 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/x-emacs-lisp";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 8 ] {
+ 59, 69, 76, 67, 19, 0, 0, 0 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/html";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 64;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 14 ] {
+ 60, 33, 68, 79, 67, 84, 89, 80,
+ 69, 32, 72, 84, 77, 76 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/html";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 64;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 14 ] {
+ 60, 33, 100, 111, 99, 116, 121, 112,
+ 101, 32, 104, 116, 109, 108 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/html";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 64;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 60, 72, 69, 65, 68 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/html";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 64;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 60, 104, 101, 97, 100 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/html";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 64;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 6 ] {
+ 60, 84, 73, 84, 76, 69 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/html";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 64;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 6 ] {
+ 60, 116, 105, 116, 108, 101 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/html";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 64;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 60, 104, 116, 109, 108 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/html";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 64;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 60, 72, 84, 77, 76 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/html";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 60, 66, 79, 68, 89 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/html";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 60, 98, 111, 100, 121 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/html";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 6 ] {
+ 60, 84, 73, 84, 76, 69 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/html";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 6 ] {
+ 60, 116, 105, 116, 108, 101 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/html";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 60, 33, 45, 45 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/html";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 3 ] {
+ 60, 104, 49 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/html";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 3 ] {
+ 60, 72, 49 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/html";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 14 ] {
+ 60, 33, 100, 111, 99, 116, 121, 112,
+ 101, 32, 72, 84, 77, 76 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/html";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 14 ] {
+ 60, 33, 68, 79, 67, 84, 89, 80,
+ 69, 32, 104, 116, 109, 108 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/x-ksysv-log";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 24 ] {
+ 75, 68, 69, 32, 83, 121, 115, 116,
+ 101, 109, 32, 86, 32, 73, 110, 105,
+ 116, 32, 69, 100, 105, 116, 111, 114 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/x-patch";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 100, 105, 102, 102, 9 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/x-patch";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 100, 105, 102, 102, 32 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/x-patch";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 42, 42, 42, 9 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/x-patch";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 42, 42, 42, 32 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/x-patch";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 8 ] {
+ 79, 110, 108, 121, 32, 105, 110, 9 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/x-patch";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 8 ] {
+ 79, 110, 108, 121, 32, 105, 110, 32 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/x-patch";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 23 ] {
+ 67, 111, 109, 109, 111, 110, 32, 115,
+ 117, 98, 100, 105, 114, 101, 99, 116,
+ 111, 114, 105, 101, 115, 58, 32 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/x-patch";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 6 ] {
+ 73, 110, 100, 101, 120, 58 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/x-python";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 13 ] {
+ 35, 33, 47, 98, 105, 110, 47, 112,
+ 121, 116, 104, 111, 110 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/x-python";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 14 ] {
+ 35, 33, 32, 47, 98, 105, 110, 47,
+ 112, 121, 116, 104, 111, 110 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/x-python";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 22 ] {
+ 101, 118, 97, 108, 32, 34, 101, 120,
+ 101, 99, 32, 47, 98, 105, 110, 47,
+ 112, 121, 116, 104, 111, 110 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/x-python";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 17 ] {
+ 35, 33, 47, 117, 115, 114, 47, 98,
+ 105, 110, 47, 112, 121, 116, 104, 111,
+ 110 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/x-python";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 18 ] {
+ 35, 33, 32, 47, 117, 115, 114, 47,
+ 98, 105, 110, 47, 112, 121, 116, 104,
+ 111, 110 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/x-python";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 26 ] {
+ 101, 118, 97, 108, 32, 34, 101, 120,
+ 101, 99, 32, 47, 117, 115, 114, 47,
+ 98, 105, 110, 47, 112, 121, 116, 104,
+ 111, 110 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/x-python";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 23 ] {
+ 35, 33, 47, 117, 115, 114, 47, 108,
+ 111, 99, 97, 108, 47, 98, 105, 110,
+ 47, 112, 121, 116, 104, 111, 110 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/x-python";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 24 ] {
+ 35, 33, 32, 47, 117, 115, 114, 47,
+ 108, 111, 99, 97, 108, 47, 98, 105,
+ 110, 47, 112, 121, 116, 104, 111, 110 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/x-python";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 32 ] {
+ 101, 118, 97, 108, 32, 34, 101, 120,
+ 101, 99, 32, 47, 117, 115, 114, 47,
+ 108, 111, 99, 97, 108, 47, 98, 105,
+ 110, 47, 112, 121, 116, 104, 111, 110 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/x-python";
+ match0.Priority = 50;
+ match0.Offset = 1;
+ match0.OffsetLength = 15;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 15 ] {
+ 47, 98, 105, 110, 47, 101, 110, 118,
+ 32, 112, 121, 116, 104, 111, 110 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/xmcd";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 6 ] {
+ 35, 32, 120, 109, 99, 100 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "text/xml";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 5 ] {
+ 60, 63, 120, 109, 108 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "video/mpeg";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 71, 63, 255, 16 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "video/mpeg";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeBig32;
+ match0.ByteValue = new byte[ 4 ] {
+ 0, 0, 1, 179 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "video/mpeg";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeBig32;
+ match0.ByteValue = new byte[ 4 ] {
+ 0, 0, 1, 186 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "video/quicktime";
+ match0.Priority = 50;
+ match0.Offset = 12;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 109, 100, 97, 116 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "video/quicktime";
+ match0.Priority = 50;
+ match0.Offset = 4;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 109, 100, 97, 116 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "video/quicktime";
+ match0.Priority = 50;
+ match0.Offset = 4;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 109, 111, 111, 118 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "video/x-flic";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeLittle16;
+ match0.ByteValue = new byte[ 2 ] {
+ 175, 17 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "video/x-flic";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeLittle16;
+ match0.ByteValue = new byte[ 2 ] {
+ 175, 18 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "video/x-ms-asf";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeBig32;
+ match0.ByteValue = new byte[ 4 ] {
+ 48, 38, 178, 117 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "video/x-msvideo";
+ match0.Priority = 50;
+ match0.Offset = 8;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 65, 86, 73, 32 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "video/x-msvideo";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 82, 73, 70, 70 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "video/x-nsv";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 78, 83, 86, 102 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "video/x-sgi-movie";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 77, 79, 86, 73 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-gdesklets-display";
+ match0.Priority = 60;
+ match0.Offset = 0;
+ match0.OffsetLength = 128;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 8 ] {
+ 60, 100, 105, 115, 112, 108, 97, 121 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-planner";
+ match0.Priority = 50;
+ match0.Offset = 20;
+ match0.OffsetLength = 120;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 17 ] {
+ 109, 114, 112, 114, 111, 106, 101, 99,
+ 116, 45, 118, 101, 114, 115, 105, 111,
+ 110 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-vmware-vm";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 4096;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 18 ] {
+ 99, 111, 110, 102, 105, 103, 46, 118,
+ 101, 114, 115, 105, 111, 110, 32, 61,
+ 32, 34 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-vmware-vmdisk";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 21 ] {
+ 35, 32, 68, 105, 115, 107, 32, 68,
+ 101, 115, 99, 114, 105, 112, 116, 111,
+ 114, 70, 105, 108, 101 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-vmware-vmdisk";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 4 ] {
+ 75, 68, 77, 86 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-vmware-team";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 21 ] {
+ 60, 70, 111, 117, 110, 100, 114, 121,
+ 32, 118, 101, 114, 115, 105, 111, 110,
+ 61, 34, 49, 34, 62 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 23;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeString;
+ match1.ByteValue = new byte[ 8 ] {
+ 60, 86, 77, 84, 101, 97, 109, 62 };
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-vmware-snapshot";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 16 ] {
+ 0, 120, 68, 48, 0, 120, 66, 69,
+ 0, 120, 68, 48, 0, 120, 66, 69 };
+ MatchesBelow80.Add( match0 );
+
+ match0 = new Match();
+ match0.MimeType = "application/x-vmware-vmfoundry";
+ match0.Priority = 50;
+ match0.Offset = 0;
+ match0.OffsetLength = 1;
+ match0.MatchType = MatchTypes.TypeString;
+ match0.ByteValue = new byte[ 21 ] {
+ 60, 70, 111, 117, 110, 100, 114, 121,
+ 32, 118, 101, 114, 115, 105, 111, 110,
+ 61, 34, 49, 34, 62 };
+
+ if ( match0.Matches.Count > 0 )
+ {
+ Match match1 = null;
+ match1 = new Match();
+ match1.Offset = 23;
+ match1.OffsetLength = 1;
+ match1.MatchType = MatchTypes.TypeString;
+ match1.ByteValue = new byte[ 4 ] {
+ 60, 86, 77, 62 };
+ match0.Matches.Add( match1 );
+
+ }
+ MatchesBelow80.Add( match0 );
+
+ }
+ }
+}
+
+#endregion
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MimeIcon.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MimeIcon.cs
new file mode 100644
index 00000000000..3c228a3b067
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MimeIcon.cs
@@ -0,0 +1,1021 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//
+// Alexander Olk xenomorph2@onlinehome.de
+//
+
+// short "how to" if you want to add an other platform handler, etc:
+// - first add mime type names and icon names (best is without extension) to MimeIconEngine, for example:
+// MimeIconEngine.AddMimeTypeAndIconName( "inode/directory", "gnome-fs-directory" );
+// - next add the icon name (the same as used in AddMimeTypeAndIconName) and the full filename, for example:
+// MimeIconEngine.AddIcon( "gnome-fs-directory", "/opt/gnome/share/icons/gnome/48x48/filesystems/gnome-fs-directory.png" );
+// AddIcon adds the icon to the image lists SmallIconList and LargeIconList
+// - provide always a "unknown/unknown" 'mime type' with a default icon for unkown mime types,
+// "desktop/desktop" 'mime type' for the desktop icon, "directory/home" 'mime type for the home dir of the user and so on
+// (look at the default platform handler)
+//
+// use
+// public static int GetIconIndexForFile( string full_filename )
+// public static int GetIconIndexForMimeType( string mime_type )
+// to get the image index in MimeIconEngine.SmallIcons and MimeIconEngine.LargeIcons
+// use
+// public static Image GetIconForMimeTypeAndSize( string mime_type, Size size )
+// to get the image itself for a mime type with a specific size
+
+using System;
+using System.Drawing;
+using System.Collections;
+using System.Collections.Specialized;
+using System.IO;
+using System.Text;
+using System.Runtime.InteropServices;
+using System.Xml;
+
+namespace System.Windows.Forms
+{
+ internal enum MimeExtensionHandlerStatus
+ {
+ OK,
+ NO_KDEGLOBALS,
+ NO_GNOMECONFIG,
+ NO_ICONS,
+ NO_MIMELNK
+ }
+
+ internal enum EPlatformHandler
+ {
+ Default,
+ KDE,
+ GNOME
+ // Win, Mac OSX...
+ }
+
+ internal class MimeIconEngine
+ {
+ public static ImageList SmallIcons = new ImageList();
+ public static ImageList LargeIcons = new ImageList();
+
+ private static EPlatformHandler platform = EPlatformHandler.Default;
+
+ private static Hashtable MimeTypeIconIndexHash = new Hashtable();
+
+ private static NameValueCollection IconNameMimeTypeNameValueCollection = new NameValueCollection();
+
+ private static StringCollection added_icons = new StringCollection();
+
+ private static object lock_object = new Object();
+
+ static MimeIconEngine( )
+ {
+ // add some more aliases, kde for example uses other mime type names for some mime types...
+ MimeGenerated.Aliases.Add( "application/x-compressed-tar", "application/x-tgz" );
+ MimeGenerated.Aliases.Add( "application/x-bzip-compressed-tar", "application/x-tbz" );
+ MimeGenerated.Aliases.Add( "application/zip", "application/x-zip" );
+ MimeGenerated.Aliases.Add( "text/x-patch", "text/x-diff" );
+
+ SmallIcons.ColorDepth = ColorDepth.Depth32Bit;
+ SmallIcons.TransparentColor = Color.Transparent;
+ LargeIcons.ColorDepth = ColorDepth.Depth32Bit;
+ LargeIcons.TransparentColor = Color.Transparent;
+
+ string session = Environment.GetEnvironmentVariable( "DESKTOP_SESSION" );
+
+ if ( session != null )
+ {
+ session = session.ToUpper( );
+
+ if ( session == "DEFAULT" )
+ {
+ string helper = Environment.GetEnvironmentVariable( "KDE_FULL_SESSION" );
+
+ if ( helper != null )
+ session = "KDE";
+ else
+ {
+ helper = Environment.GetEnvironmentVariable( "GNOME_DESKTOP_SESSION_ID" );
+
+ if ( helper != null )
+ session = "GNOME";
+ }
+ }
+ }
+ else
+ session = "";
+
+ //Console.WriteLine( "Desktop session is: " + session );
+
+ PlatformMimeIconHandler platformMimeHandler = null;
+
+ if ( session == "KDE" )
+ {
+ SmallIcons.ImageSize = new Size( 24, 24 );
+ LargeIcons.ImageSize = new Size( 48, 48 );
+
+ platformMimeHandler = new KdeHandler( );
+ if ( platformMimeHandler.Start( ) == MimeExtensionHandlerStatus.OK )
+ {
+ Console.WriteLine( "Kde icons ready..." );
+ platform = EPlatformHandler.KDE;
+ }
+ else // fallback to default
+ {
+ MimeIconEngine.LargeIcons.Images.Clear( );
+ MimeIconEngine.SmallIcons.Images.Clear( );
+ platformMimeHandler = new PlatformDefaultHandler( );
+ platformMimeHandler.Start( );
+ }
+ }
+ else
+ if ( session == "GNOME" )
+ {
+ SmallIcons.ImageSize = new Size( 24, 24 );
+ LargeIcons.ImageSize = new Size( 48, 48 );
+
+ platformMimeHandler = new GnomeHandler( );
+ if ( platformMimeHandler.Start( ) == MimeExtensionHandlerStatus.OK )
+ {
+ Console.WriteLine( "Gnome icons ready..." );
+ platform = EPlatformHandler.GNOME;
+ }
+ else // fallback to default
+ {
+ MimeIconEngine.LargeIcons.Images.Clear( );
+ MimeIconEngine.SmallIcons.Images.Clear( );
+ platformMimeHandler = new PlatformDefaultHandler( );
+ platformMimeHandler.Start( );
+ }
+ }
+ else
+ {
+ SmallIcons.ImageSize = new Size( 16, 16 );
+ LargeIcons.ImageSize = new Size( 48, 48 );
+
+ platformMimeHandler = new PlatformDefaultHandler( );
+ platformMimeHandler.Start( );
+ }
+
+ IconNameMimeTypeNameValueCollection = null;
+ added_icons = null;
+ }
+
+ public static int GetIconIndexForFile( string full_filename )
+ {
+ lock ( lock_object )
+ {
+ string mime_type = Mime.GetMimeTypeForFile( full_filename );
+
+ if ( platform == EPlatformHandler.Default )
+ {
+ if ( mime_type == "inode/directory" )
+ {
+ return (int)MimeTypeIconIndexHash[ "inode/directory" ];
+ }
+ else
+ {
+ return (int)MimeTypeIconIndexHash[ "unknown/unknown" ];
+ }
+ }
+
+ object oindex = GetIconIndex( mime_type );
+
+ if ( oindex == null )
+ oindex = MimeTypeIconIndexHash[ "unknown/unknown" ];
+
+ return (int)oindex;
+ }
+ }
+
+ public static int GetIconIndexForMimeType( string mime_type )
+ {
+ lock ( lock_object )
+ {
+ if ( platform == EPlatformHandler.Default )
+ {
+ if ( mime_type == "inode/directory" )
+ {
+ return (int)MimeTypeIconIndexHash[ "inode/directory" ];
+ }
+ else
+ {
+ return (int)MimeTypeIconIndexHash[ "unknown/unknown" ];
+ }
+ }
+
+ object oindex = GetIconIndex( mime_type );
+
+ if ( oindex == null )
+ oindex = MimeTypeIconIndexHash[ "unknown/unknown" ];
+
+ return (int)oindex;
+ }
+ }
+
+ public static Image GetIconForMimeTypeAndSize( string mime_type, Size size )
+ {
+ lock ( lock_object )
+ {
+ object oindex = GetIconIndex( mime_type );
+
+ if ( oindex == null )
+ oindex = MimeTypeIconIndexHash[ "unknown/unknown" ];
+
+ Bitmap bmp = new Bitmap( LargeIcons.Images[ (int)oindex ], size );
+
+ return bmp;
+ }
+ }
+
+ internal static void AddIcon( string name, string fullname )
+ {
+ if ( !CheckIfIconIsNeeded( name ) )
+ return;
+
+ if ( added_icons.Contains( name ) )
+ return;
+
+ added_icons.Add( name );
+
+ Bitmap bmp = new Bitmap( fullname );
+
+ int index = SmallIcons.Images.Add( bmp, Color.Transparent );
+ LargeIcons.Images.Add( bmp, Color.Transparent );
+
+ AddMimeTypeIconIndexHash( name, index );
+ }
+
+ internal static void AddSVGIcon( string name, string fullname )
+ {
+ if ( !CheckIfIconIsNeeded( name ) )
+ return;
+
+ if ( added_icons.Contains( name ) )
+ return;
+
+ added_icons.Add( name );
+
+ Image image = SVGUtil.GetSVGasImage (fullname, 48, 48);
+
+ int index = SmallIcons.Images.Add( image, Color.Transparent );
+ LargeIcons.Images.Add( image, Color.Transparent );
+
+ AddMimeTypeIconIndexHash( name, index );
+ }
+
+ private static bool CheckIfIconIsNeeded( string name )
+ {
+ string mime_types = IconNameMimeTypeNameValueCollection[ name ];
+
+ if ( mime_types != null )
+ return true;
+
+ return false;
+ }
+
+ internal static void AddMimeTypeIconIndexHash( string name, int index )
+ {
+ string mime_type = IconNameMimeTypeNameValueCollection[ name ];
+
+ if ( mime_type == null )
+ return;
+
+ string[] split = mime_type.Split( new char[] { ',' } );
+
+ foreach ( string s in split )
+ {
+ if ( MimeTypeIconIndexHash.ContainsKey( s ) )
+ continue;
+
+ MimeTypeIconIndexHash.Add( s, index );
+ }
+ }
+
+ internal static void AddIconByImage( string name, Image image )
+ {
+ int index = SmallIcons.Images.Add( image, Color.Transparent );
+ LargeIcons.Images.Add( image, Color.Transparent );
+
+ AddMimeTypeIconIndexHash( name, index );
+ }
+
+ internal static void AddMimeTypeAndIconName( string mimetype, string iconname )
+ {
+ if ( iconname.Equals( String.Empty ) )
+ return;
+
+ IconNameMimeTypeNameValueCollection.Add( iconname, mimetype );
+ }
+
+ private static object GetIconIndex( string mime_type )
+ {
+ object oindex = null;
+
+ if ( mime_type != null )
+ {
+ // first check if mime_type is available in the mimetype/icon hashtable
+ oindex = MimeTypeIconIndexHash[ mime_type ];
+
+ if ( oindex == null )
+ {
+ // it is not available, check if an alias exist for mime_type
+ string alias = Mime.GetMimeAlias( mime_type );
+
+ if ( alias != null )
+ {
+ string[] split = alias.Split( new char[] { ',' } );
+
+ foreach ( string s in split )
+ {
+ oindex = MimeTypeIconIndexHash[ s ];
+
+ if ( oindex != null )
+ return oindex;
+ }
+ }
+
+ // if oindex is still null check if mime_type is a sub class of an other mime type
+ string sub_class = MimeGenerated.SubClasses[ mime_type ];
+
+ if ( sub_class != null )
+ return MimeTypeIconIndexHash[ sub_class ];
+
+ // last check, see if we find an entry for the main mime type class
+ string mime_class_main = mime_type.Substring( 0, mime_type.IndexOf( '/' ) );
+ return MimeTypeIconIndexHash[ mime_class_main ];
+ }
+ }
+
+ return oindex;
+ }
+ }
+
+ internal abstract class PlatformMimeIconHandler
+ {
+ protected StringCollection mime_paths = new StringCollection();
+
+ protected StringCollection icon_paths = new StringCollection();
+
+ protected string icon_theme = "";
+
+ protected MimeExtensionHandlerStatus mimeExtensionHandlerStatus = MimeExtensionHandlerStatus.OK;
+
+ public MimeExtensionHandlerStatus MimeExtensionHandlerStatus
+ {
+ get {
+ return mimeExtensionHandlerStatus;
+ }
+ }
+
+ public abstract MimeExtensionHandlerStatus Start( );
+
+ // check, if icon, mime, etc., directories exist
+ protected virtual bool CheckPlatformDirectories( )
+ {
+ return true;
+ }
+ }
+
+ internal class PlatformDefaultHandler : PlatformMimeIconHandler
+ {
+ public override MimeExtensionHandlerStatus Start( )
+ {
+ MimeIconEngine.AddMimeTypeAndIconName( "unknown/unknown", "paper" );
+ MimeIconEngine.AddMimeTypeAndIconName( "inode/directory", "folder" );
+ MimeIconEngine.AddMimeTypeAndIconName( "desktop/desktop", "desktop" );
+ MimeIconEngine.AddMimeTypeAndIconName( "directory/home", "folder_with_paper" );
+ MimeIconEngine.AddMimeTypeAndIconName( "network/network", "monitor-planet" );
+ MimeIconEngine.AddMimeTypeAndIconName( "recently/recently", "last_open" );
+ MimeIconEngine.AddMimeTypeAndIconName( "workplace/workplace", "monitor-computer" );
+
+ MimeIconEngine.AddIconByImage( "folder", (Image)Locale.GetResource( "folder" ) );
+ MimeIconEngine.AddIconByImage( "paper", (Image)Locale.GetResource( "paper" ) );
+ MimeIconEngine.AddIconByImage( "desktop", (Image)Locale.GetResource( "desktop" ) );
+ MimeIconEngine.AddIconByImage( "folder_with_paper", (Image)Locale.GetResource( "folder_with_paper" ) );
+ MimeIconEngine.AddIconByImage( "monitor-planet", (Image)Locale.GetResource( "monitor-planet" ) );
+ MimeIconEngine.AddIconByImage( "last_open", (Image)Locale.GetResource( "last_open" ) );
+ MimeIconEngine.AddIconByImage( "monitor-computer", (Image)Locale.GetResource( "monitor-computer" ) );
+
+ return MimeExtensionHandlerStatus.OK; // return always ok
+ }
+ }
+
+ internal class KdeHandler : PlatformMimeIconHandler
+ {
+ string full_kdegloabals_filename = Environment.GetFolderPath( Environment.SpecialFolder.Personal )
+ + "/"
+ + ".kde/share/config/kdeglobals";
+
+ public override MimeExtensionHandlerStatus Start( )
+ {
+ if ( !ReadKdeglobals( ) )
+ return mimeExtensionHandlerStatus;
+
+ if ( !CheckPlatformDirectories( ) )
+ return mimeExtensionHandlerStatus;
+
+ // check if the theme is svg only
+ // if true, use theme "default.kde"
+ // don't know if that is available in every linux distribution
+ if ( SVGOnly( ) )
+ icon_theme = "default.kde";
+ else
+ // check if there is a /48x48 directory
+ if( No48x48( ) )
+ icon_theme = "default.kde";
+
+ ReadMimetypes( );
+
+ ReadIcons( );
+
+ return mimeExtensionHandlerStatus;
+ }
+
+ private bool SVGOnly( )
+ {
+ // check only the first path in icon_paths
+ if ( icon_paths.Count > 0 )
+ {
+ string icon_path = icon_paths[ 0 ] + icon_theme;
+ string[] dirs = Directory.GetDirectories( icon_path );
+
+ if ( dirs.Length == 1 && dirs[ 0 ] == "scalable" )
+ return true;
+ }
+
+ return false;
+ }
+
+ private bool No48x48( )
+ {
+ // check only the first path in icon_paths
+ if ( icon_paths.Count > 0 )
+ {
+ string icon_path = icon_paths[ 0 ] + icon_theme;
+ string[] dirs = Directory.GetDirectories( icon_path );
+
+ foreach( string path in dirs )
+ {
+ if ( path.EndsWith( "48x48" ) )
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ protected override bool CheckPlatformDirectories( )
+ {
+ bool icons_found = false;
+
+ // default icon dirs
+ if ( Directory.Exists( "/opt/kde3/share/icons/default.kde" ) )
+ {
+ icon_paths.Add( "/opt/kde3/share/icons" + "/" );
+ icons_found = true;
+ }
+ else
+ if ( Directory.Exists( "/usr/share/icons/default.kde" ) )
+ {
+ icon_paths.Add( "/usr/share/icons" + "/" );
+ icons_found = true;
+ }
+ else
+ if ( Directory.Exists( "/usr/local/share/icons/default.kde" ) )
+ {
+ icon_paths.Add( "/usr/local/share/icons" + "/" );
+ icons_found = true;
+ }
+ else
+ if ( !icons_found )
+ {
+ mimeExtensionHandlerStatus = MimeExtensionHandlerStatus.NO_ICONS;
+ return false;
+ }
+
+ bool mimelnk_found = false;
+
+ if ( Directory.Exists( "/usr/share/mimelnk" ) )
+ {
+ mime_paths.Add( "/usr/share/mimelnk" + "/" );
+ mimelnk_found = true;
+ }
+
+ if ( Directory.Exists( "/usr/local/share/mimelnk" ) )
+ {
+ mime_paths.Add( "/usr/local/share/mimelnk" + "/" );
+ mimelnk_found = true;
+ }
+
+ if ( Directory.Exists( "/opt/kde3/share/mimelnk" ) )
+ {
+ mime_paths.Add( "/opt/kde3/share/mimelnk" + "/" );
+ mimelnk_found = true;
+ }
+
+ if ( !mimelnk_found )
+ {
+ mimeExtensionHandlerStatus = MimeExtensionHandlerStatus.NO_MIMELNK;
+ return false;
+ }
+
+ return true;
+ }
+
+ private void ReadIcons( )
+ {
+ foreach ( string icon_path_in in icon_paths )
+ {
+ string icon_path = icon_path_in + icon_theme + "/48x48";
+
+ string[] directories = Directory.GetDirectories( icon_path );
+
+ foreach ( string d in directories )
+ {
+ DirectoryInfo di = new DirectoryInfo( d );
+
+ FileInfo[] fileinfo = di.GetFiles( );
+
+ foreach ( FileInfo fi in fileinfo )
+ {
+ string name = Path.GetFileNameWithoutExtension( fi.Name );
+
+ MimeIconEngine.AddIcon( name, fi.FullName );
+ }
+ }
+ }
+ }
+
+ private void ReadMimetypes( )
+ {
+ MimeIconEngine.AddMimeTypeAndIconName( "unknown/unknown", "unknown" );
+ MimeIconEngine.AddMimeTypeAndIconName( "desktop/desktop", "desktop" );
+ MimeIconEngine.AddMimeTypeAndIconName( "directory/home", "folder_home" );
+ MimeIconEngine.AddMimeTypeAndIconName( "network/network", "network" );
+ MimeIconEngine.AddMimeTypeAndIconName( "recently/recently", "folder_man" );
+ MimeIconEngine.AddMimeTypeAndIconName( "workplace/workplace", "system" );
+
+ foreach ( string mime_path in mime_paths )
+ {
+ string[] directories = Directory.GetDirectories( mime_path );
+
+ foreach ( string d in directories )
+ {
+ string[] files = Directory.GetFiles( d );
+
+ foreach ( string f in files )
+ {
+ try {
+ ReadDotDesktop( f );
+ } catch {
+ // Ignore errors if the file can not be read.
+ }
+ }
+ }
+ }
+ }
+
+ private void ReadDotDesktop( string filename )
+ {
+ StreamReader sr = new StreamReader( filename );
+
+ string line = sr.ReadLine( );
+
+ string icon_name = "";
+
+ string mime_type = "";
+
+ bool have_icon = false;
+ bool have_mimetype = false;
+
+ while ( line != null )
+ {
+ line = line.Trim( );
+
+ if ( line.StartsWith( "Icon" ) )
+ {
+ icon_name = line.Substring( line.IndexOf( '=' ) + 1 );
+ icon_name = icon_name.Trim( );
+ if ( have_mimetype )
+ break;
+ have_icon = true;
+ }
+ else
+ if ( line.StartsWith( "MimeType" ) )
+ {
+ mime_type = line.Substring( line.IndexOf( '=' ) + 1 );
+ mime_type = mime_type.Trim( );
+ if ( have_icon )
+ break;
+ have_mimetype = true;
+ }
+
+ line = sr.ReadLine( );
+ }
+
+ sr.Close( );
+
+ MimeIconEngine.AddMimeTypeAndIconName( mime_type, icon_name );
+ }
+
+ private bool ReadKdeglobals( )
+ {
+ if ( !File.Exists( full_kdegloabals_filename ) )
+ {
+ mimeExtensionHandlerStatus = MimeExtensionHandlerStatus.NO_KDEGLOBALS;
+
+ return false;
+ }
+
+ StreamReader sr = new StreamReader( full_kdegloabals_filename );
+
+ string line = sr.ReadLine( );
+
+ while ( line != null )
+ {
+ if ( line.IndexOf( "[Icons]" ) != -1 )
+ {
+ line = sr.ReadLine( );
+
+ if ( line != null && line.IndexOf( "Theme" ) != -1 )
+ {
+ line = line.Trim( );
+
+ icon_theme = line.Substring( line.IndexOf( '=' ) + 1 );
+
+ icon_theme = icon_theme.Trim( );
+
+ break;
+ }
+ }
+
+ line = sr.ReadLine( );
+ }
+
+ sr.Close( );
+
+ return true;
+ }
+ }
+
+ internal class GnomeHandler : PlatformMimeIconHandler
+ {
+ string full_gnome_gconf_tree = Environment.GetFolderPath( Environment.SpecialFolder.Personal )
+ + "/"
+ + ".gconf/%gconf-tree.xml";
+
+ bool is_svg_icon_theme = false;
+
+ string main_icon_theme_path;
+
+ StringCollection inherits_path_collection = new StringCollection ();
+
+ public override MimeExtensionHandlerStatus Start( )
+ {
+ icon_theme = String.Empty;
+
+ if (!File.Exists (full_gnome_gconf_tree))
+ full_gnome_gconf_tree = Environment.GetFolderPath( Environment.SpecialFolder.Personal )
+ + "/"
+ + ".gconf/desktop/gnome/interface/%gconf.xml";
+
+ GetIconThemeFromGConf ();
+
+ if (!GetIconPaths ())
+ return MimeExtensionHandlerStatus.NO_ICONS;
+
+ if (!GetMainIconThemePath ())
+ return MimeExtensionHandlerStatus.NO_ICONS;
+
+ GetIconThemeInherits ();
+
+ CreateUIIcons ();
+
+ CreateMimeTypeIcons( );
+
+ inherits_path_collection = null;
+ icon_paths = null;
+
+ return MimeExtensionHandlerStatus.OK;
+ }
+
+ private bool GetIconThemeFromGConf ()
+ {
+ if (!File.Exists (full_gnome_gconf_tree))
+ return false;
+
+ try {
+ bool found_icon_theme_in_xml = false;
+
+ XmlTextReader xtr = new XmlTextReader (full_gnome_gconf_tree);
+
+ while (xtr.Read ()) {
+ if (xtr.NodeType == XmlNodeType.Element && xtr.Name.ToUpper () == "ENTRY" && xtr.GetAttribute ("name") == "icon_theme") {
+ found_icon_theme_in_xml = true;
+ } else
+ if (xtr.NodeType == XmlNodeType.Element && xtr.Name.ToUpper () == "STRINGVALUE" && found_icon_theme_in_xml) {
+ xtr.Read ();
+ icon_theme = xtr.Value;
+ break;
+ }
+ }
+ xtr.Close ();
+
+ if (icon_theme != String.Empty)
+ return true;
+ else {
+ icon_theme = "gnome";
+ return false;
+ }
+ } catch ( Exception e ) {
+ return false;
+ }
+ }
+
+ private bool GetIconPaths ()
+ {
+ string global_icon_path = "";
+
+ if (Directory.Exists ("/opt/gnome/share/icons"))
+ global_icon_path = "/opt/gnome/share/icons";
+ else
+ if (Directory.Exists ("/usr/share/icons"))
+ global_icon_path = "/usr/share/icons";
+ else
+ if (Directory.Exists ("/usr/local/share/icons"))
+ global_icon_path = "/usr/local/share/icons";
+
+ if (global_icon_path.Length > 0)
+ icon_paths.Add (global_icon_path);
+
+ if (Directory.Exists (Environment.GetFolderPath (Environment.SpecialFolder.Personal) + "/.icons"))
+ icon_paths.Add (Environment.GetFolderPath (Environment.SpecialFolder.Personal) + "/.icons");
+
+ if (icon_paths.Count == 0)
+ return false;
+
+ return true;
+ }
+
+ private bool GetMainIconThemePath ()
+ {
+ foreach (string path in icon_paths) {
+ if (Directory.Exists (path + "/" + icon_theme)) {
+ main_icon_theme_path = path + "/" + icon_theme;
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private void GetIconThemeInherits ()
+ {
+ inherits_path_collection.Add (main_icon_theme_path);
+ GetIndexThemeInherits (main_icon_theme_path + "/" + "index.theme");
+ }
+
+ private void GetIndexThemeInherits (string filename)
+ {
+ StringCollection tmp_inherits = new StringCollection ();
+
+ try {
+ StreamReader sr = new StreamReader (filename);
+
+ string line = sr.ReadLine ();
+
+ while (line != null) {
+ if (line.IndexOf ("Inherits=") != -1) {
+ line = line.Trim ();
+ line = line.Replace ("Inherits=", "");
+
+ line = line.Trim ();
+
+ string[] split = line.Split (new char [] { ',' });
+
+ tmp_inherits.AddRange (split);
+ break;
+ }
+ line = sr.ReadLine ();
+ }
+
+ sr.Close ();
+ } catch (Exception e) {
+
+ }
+
+ if (tmp_inherits.Count > 0) {
+ foreach (string icon_theme in tmp_inherits) {
+ foreach (string path in icon_paths) {
+ if (Directory.Exists (path + "/" + icon_theme)) {
+ if (!inherits_path_collection.Contains (path + "/" + icon_theme))
+ inherits_path_collection.Add (path + "/" + icon_theme);
+ if (File.Exists (path + "/" + icon_theme + "/" + "index.theme"))
+ GetIndexThemeInherits (path + "/" + icon_theme + "/" + "index.theme");
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ private void CreateUIIcons ()
+ {
+ string resolv_path = ResolvePath (main_icon_theme_path);
+
+ string[] dirs = Directory.GetDirectories (resolv_path);
+
+ Hashtable name_mime_hash = new Hashtable ();
+
+ name_mime_hash ["gnome-fs-directory"] = "inode/directory";
+ name_mime_hash ["gnome-fs-regular"] = "unknown/unknown";
+ name_mime_hash ["gnome-fs-desktop"] = "desktop/desktop";
+ name_mime_hash ["gnome-fs-home"] = "directory/home";
+ name_mime_hash ["gnome-fs-network"] = "network/network";
+ name_mime_hash ["gnome-fs-directory-accept"] = "recently/recently";
+ name_mime_hash ["gnome-fs-client"] = "workplace/workplace";
+
+ if (!CheckAndAddUIIcons (dirs, name_mime_hash)) {
+ //could be a kde icon theme, so we check kde icon names also
+ name_mime_hash.Clear ();
+ name_mime_hash ["folder"] = "inode/directory";
+ name_mime_hash ["unknown"] = "unknown/unknown";
+ name_mime_hash ["desktop"] = "desktop/desktop";
+ name_mime_hash ["folder_home"] = "directory/home";
+ name_mime_hash ["network"] = "network/network";
+ name_mime_hash ["folder_man"] = "recently/recently";
+ name_mime_hash ["system"] = "workplace/workplace";
+
+ CheckAndAddUIIcons (dirs, name_mime_hash);
+ }
+ }
+
+ private bool CheckAndAddUIIcons (string[] dirs, Hashtable name_mime_hash)
+ {
+ string extension = is_svg_icon_theme ? "svg" : "png";
+ int counter = 0;
+
+ foreach (string place in dirs) {
+ foreach (DictionaryEntry entry in name_mime_hash) {
+ string key = (string)entry.Key;
+ if (File.Exists (place + "/" + key + "." + extension)) {
+ string value = (string)entry.Value;
+ MimeIconEngine.AddMimeTypeAndIconName (value, key);
+ if (!is_svg_icon_theme)
+ MimeIconEngine.AddIcon (key, place + "/" + key + "." + extension);
+ else
+ MimeIconEngine.AddSVGIcon (key, place + "/" + key + "." + extension);
+ counter++;
+ if (counter == name_mime_hash.Count)
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ private void CreateMimeTypeIcons ()
+ {
+ foreach (string ip in inherits_path_collection) {
+ string path_to_use = ResolvePath (ip);
+
+ if (path_to_use == String.Empty)
+ continue;
+
+ if (!Directory.Exists (path_to_use + "mimetypes"))
+ continue;
+
+ string[] files = Directory.GetFiles (path_to_use + "mimetypes");
+
+ foreach (string file in files) {
+ string extension = Path.GetExtension (file);
+
+ if (!is_svg_icon_theme) {
+ if (extension != ".png")
+ continue;
+ } else
+ if (extension != ".svg")
+ continue;
+
+ string file_name = Path.GetFileNameWithoutExtension (file);
+
+ if (!file_name.StartsWith ("gnome-mime-"))
+ continue;
+
+ StringBuilder mime_type = new StringBuilder (file_name.Replace ("gnome-mime-", ""));
+
+ for (int i = 0; i < mime_type.Length; i++)
+ if (mime_type [i] == '-') {
+ mime_type [i] = '/';
+ break;
+ }
+
+ MimeIconEngine.AddMimeTypeAndIconName (mime_type.ToString (), file_name);
+
+ if (!is_svg_icon_theme)
+ MimeIconEngine.AddIcon (file_name, file);
+ else
+ MimeIconEngine.AddSVGIcon (file_name, file);
+ }
+ }
+ }
+
+ private string ResolvePath (string path)
+ {
+ if (Directory.Exists (path + "/48x48")) {
+ is_svg_icon_theme = false;
+ return path + "/48x48/";
+ }
+
+ if (Directory.Exists (path + "/scalable")) {
+ is_svg_icon_theme = true;
+ return path + "/scalable/";
+ }
+
+ return String.Empty;
+ }
+ }
+
+ internal class SVGUtil {
+ [DllImport("librsvg-2.so")]
+ static extern IntPtr rsvg_pixbuf_from_file_at_size (string file_name, int width, int height, out IntPtr error);
+
+ [DllImport("libgdk-x11-2.0.so")]
+ static extern bool gdk_pixbuf_save_to_buffer (IntPtr pixbuf, out IntPtr buffer, out UIntPtr buffer_size, string type, out IntPtr error, IntPtr option_dummy);
+
+ [DllImport("libglib-2.0.so")]
+ static extern void g_free (IntPtr mem);
+
+ [DllImport("libgdk-x11-2.0.so")]
+ static extern bool gdk_init_check(out int argc, string argv);
+
+ [DllImport("libgobject-2.0.so")]
+ static extern void g_object_unref (IntPtr nativeObject);
+
+ static bool inited = false;
+
+ static void Init () {
+ int argc = 0;
+ string argv = "";
+
+ gdk_init_check (out argc, argv);
+
+ inited = true;
+ }
+
+ public static Image GetSVGasImage (string filename, int width, int height) {
+ if (!inited)
+ Init ();
+
+ if (!File.Exists (filename))
+ return null;
+ IntPtr error = IntPtr.Zero;
+ IntPtr pixbuf = rsvg_pixbuf_from_file_at_size (filename, width, height, out error);
+
+ if (error != IntPtr.Zero)
+ return null;
+
+ error = IntPtr.Zero;
+ IntPtr buffer;
+ UIntPtr buffer_size_as_ptr;
+ string type = "png";
+
+ bool saved = gdk_pixbuf_save_to_buffer (pixbuf, out buffer, out buffer_size_as_ptr, type, out error, IntPtr.Zero);
+
+ if (!saved)
+ return null;
+
+ int buffer_size = (int) (uint) buffer_size_as_ptr;
+ byte[] result = new byte [buffer_size];
+ Marshal.Copy (buffer, result, 0, (int) buffer_size);
+ g_free (buffer);
+ g_object_unref (pixbuf);
+
+ Image image = null;
+ using (MemoryStream s = new MemoryStream (result))
+ image = Image.FromStream (s);
+
+ return image;
+ }
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MonthCalendar.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MonthCalendar.cs
new file mode 100644
index 00000000000..d8d4ba94e70
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MonthCalendar.cs
@@ -0,0 +1,2019 @@
+// 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.
+//
+// Authors:
+// John BouAntoun jba-mono@optusnet.com.au
+//
+// REMAINING TODO:
+// - get the date_cell_size and title_size to be pixel perfect match of SWF
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace System.Windows.Forms {
+ [DefaultProperty("SelectionRange")]
+ [DefaultEvent("DateChanged")]
+ [Designer ("System.Windows.Forms.Design.MonthCalendarDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+ public class MonthCalendar : Control {
+ #region Local variables
+ DateTime [] annually_bolded_dates;
+ Color back_color;
+ DateTime [] bolded_dates;
+ Size calendar_dimensions;
+ Day first_day_of_week;
+ Color fore_color;
+ DateTime max_date;
+ int max_selection_count;
+ DateTime min_date;
+ DateTime [] monthly_bolded_dates;
+ int scroll_change;
+ SelectionRange selection_range;
+ bool show_today;
+ bool show_today_circle;
+ bool show_week_numbers;
+ Color title_back_color;
+ Color title_fore_color;
+ DateTime today_date;
+ bool today_date_set;
+ Color trailing_fore_color;
+ ContextMenu menu;
+ NumericUpDown year_updown;
+ Timer timer;
+
+ // internal variables used
+ internal DateTime current_month; // the month that is being displayed in top left corner of the grid
+ internal DateTimePicker owner; // used if this control is popped up
+ internal int button_x_offset;
+ internal Size button_size;
+ internal Size title_size;
+ internal Size date_cell_size;
+ internal Size calendar_spacing;
+ internal int divider_line_offset;
+ internal DateTime clicked_date;
+ internal bool is_date_clicked;
+ internal bool is_previous_clicked;
+ internal bool is_next_clicked;
+ internal bool is_shift_pressed;
+ internal DateTime first_select_start_date;
+ internal int last_clicked_calendar_index;
+ internal Rectangle last_clicked_calendar_rect;
+ private Point month_title_click_location;
+ // this is used to see which item was actually clicked on in the beginning
+ // so that we know which item to fire on timer
+ // 0: date clicked
+ // 1: previous clicked
+ // 2: next clicked
+ private bool[] click_state;
+
+ // arraylists used to store new dates
+ ArrayList added_bolded_dates;
+ ArrayList removed_bolded_dates;
+ ArrayList added_annually_bolded_dates;
+ ArrayList removed_annually_bolded_dates;
+ ArrayList added_monthly_bolded_dates;
+ ArrayList removed_monthly_bolded_dates;
+
+
+ #endregion // Local variables
+
+ #region Public Constructors
+
+ public MonthCalendar () {
+ // set up the control painting
+ SetStyle (ControlStyles.UserPaint | ControlStyles.StandardClick, false);
+
+ // mouse down timer
+ timer = new Timer ();
+ timer.Interval = 500;
+ timer.Enabled = false;
+
+ // initialise default values
+ DateTime now = DateTime.Now.Date;
+ selection_range = new SelectionRange (now, now);
+ today_date = now;
+ current_month = new DateTime (now.Year , now.Month, 1);
+
+ // iniatialise local members
+ annually_bolded_dates = null;
+ back_color = ThemeEngine.Current.ColorWindow;
+ bolded_dates = null;
+ calendar_dimensions = new Size (1,1);
+ first_day_of_week = Day.Default;
+ fore_color = SystemColors.ControlText;
+ max_date = new DateTime (9998, 12, 31);
+ max_selection_count = 7;
+ min_date = new DateTime (1953, 1, 1);
+ monthly_bolded_dates = null;
+ scroll_change = 0;
+ show_today = true;
+ show_today_circle = true;
+ show_week_numbers = false;
+ title_back_color = ThemeEngine.Current.ColorActiveCaption;
+ title_fore_color = ThemeEngine.Current.ColorActiveCaptionText;
+ today_date_set = false;
+ trailing_fore_color = Color.Gray;
+
+ // initialise the arraylest for bolded dates
+ added_bolded_dates = new ArrayList ();
+ removed_bolded_dates = new ArrayList ();
+ added_annually_bolded_dates = new ArrayList ();
+ removed_annually_bolded_dates = new ArrayList ();
+ added_monthly_bolded_dates = new ArrayList ();
+ removed_monthly_bolded_dates = new ArrayList ();
+
+ // intiailise internal variables used
+ button_x_offset = 5;
+ button_size = new Size (22, 17);
+ // default settings based on 8.25 pt San Serif Font
+ // Not sure of algorithm used to establish this
+ date_cell_size = new Size (24, 16); // default size at san-serif 8.25
+ divider_line_offset = 4;
+ calendar_spacing = new Size (4, 5); // horiz and vert spacing between months in a calendar grid
+
+ // set some state info
+ clicked_date = now;
+ is_date_clicked = false;
+ is_previous_clicked = false;
+ is_next_clicked = false;
+ is_shift_pressed = false;
+ click_state = new bool [] {false, false, false};
+ first_select_start_date = now;
+ month_title_click_location = Point.Empty;
+
+ // set up context menu
+ SetUpContextMenu ();
+
+
+ // event handlers
+// LostFocus += new EventHandler (LostFocusHandler);
+ timer.Tick += new EventHandler (TimerHandler);
+ MouseMove += new MouseEventHandler (MouseMoveHandler);
+ MouseDown += new MouseEventHandler (MouseDownHandler);
+ KeyDown += new KeyEventHandler (KeyDownHandler);
+ MouseUp += new MouseEventHandler (MouseUpHandler);
+ KeyUp += new KeyEventHandler (KeyUpHandler);
+
+ // this replaces paint so call the control version
+ base.Paint += new PaintEventHandler (PaintHandler);
+ }
+
+ // called when this control is added to date time picker
+ internal MonthCalendar (DateTimePicker owner) : this () {
+ this.owner = owner;
+ this.is_visible = false;
+ this.Size = this.DefaultSize;
+ }
+
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+
+ // dates to make bold on calendar annually (recurring)
+ [Localizable (true)]
+ public DateTime[] AnnuallyBoldedDates {
+ set {
+ if (annually_bolded_dates == null || annually_bolded_dates != value) {
+ annually_bolded_dates = value;
+ this.UpdateBoldedDates ();
+ this.Invalidate ();
+ }
+ }
+ get {
+ return annually_bolded_dates;
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override Image BackgroundImage {
+ get {
+ return base.BackgroundImage;
+ }
+ set {
+ base.BackgroundImage = value;
+ }
+ }
+
+
+ // the back color for the main part of the calendar
+ public override Color BackColor {
+ set {
+ if (back_color != value) {
+ back_color = value;
+ this.OnBackColorChanged (EventArgs.Empty);
+ this.Invalidate ();
+ }
+ }
+ get {
+ return back_color;
+ }
+ }
+
+ // specific dates to make bold on calendar (non-recurring)
+ [Localizable (true)]
+ public DateTime[] BoldedDates {
+ set {
+ if (bolded_dates == null || bolded_dates != value) {
+ bolded_dates = value;
+ this.UpdateBoldedDates ();
+ this.Invalidate ();
+ }
+ }
+ get {
+ return bolded_dates;
+ }
+ }
+
+ // the configuration of the monthly grid display - only allowed to display at most,
+ // 1 calendar year at a time, will be trimmed to fit it properly
+ [Localizable (true)]
+ public Size CalendarDimensions {
+ set {
+ if (value.Width < 0 || value.Height < 0) {
+ throw new ArgumentException ();
+ }
+ if (calendar_dimensions != value) {
+ // squeeze the grid into 1 calendar year
+ if (value.Width * value.Height > 12) {
+ // iteratively reduce the largest dimension till our
+ // product is less than 12
+ if (value.Width > 12 && value.Height > 12) {
+ calendar_dimensions = new Size (4, 3);
+ } else if (value.Width > 12) {
+ for (int i = 12; i > 0; i--) {
+ if (i * value.Height <= 12) {
+ calendar_dimensions = new Size (i, value.Height);
+ break;
+ }
+ }
+ } else if (value.Height > 12) {
+ for (int i = 12; i > 0; i--) {
+ if (i * value.Width <= 12) {
+ calendar_dimensions = new Size (value.Width, i);
+ break;
+ }
+ }
+ }
+ } else {
+ calendar_dimensions = value;
+ }
+ this.Invalidate ();
+ }
+ }
+ get {
+ return calendar_dimensions;
+ }
+ }
+
+ // the first day of the week to display
+ [Localizable (true)]
+ [DefaultValue (Day.Default)]
+ public Day FirstDayOfWeek {
+ set {
+ if (first_day_of_week != value) {
+ first_day_of_week = value;
+ this.Invalidate ();
+ }
+ }
+ get {
+ return first_day_of_week;
+ }
+ }
+
+ // the fore color for the main part of the calendar
+ public override Color ForeColor {
+ set {
+ if (fore_color != value) {
+ fore_color = value;
+ this.OnForeColorChanged (EventArgs.Empty);
+ this.Invalidate ();
+ }
+ }
+ get {
+ return fore_color;
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ImeMode ImeMode {
+ get {
+ return ime_mode;
+ }
+
+ set {
+ if (ime_mode != value) {
+ ime_mode = value;
+
+ if (ImeModeChanged != null) {
+ ImeModeChanged(this, EventArgs.Empty);
+ }
+ }
+ }
+ }
+
+ // the maximum date allowed to be selected on this month calendar
+ public DateTime MaxDate {
+ set {
+ if (value < MinDate) {
+ throw new ArgumentException();
+ }
+
+ if (max_date != value) {
+ max_date = value;
+ }
+ }
+ get {
+ return max_date;
+ }
+ }
+
+ // the maximum number of selectable days
+ [DefaultValue (7)]
+ public int MaxSelectionCount {
+ set {
+ if (value < 0) {
+ throw new ArgumentException();
+ }
+
+ // can't set selectioncount less than already selected dates
+ if ((SelectionEnd - SelectionStart).Days > value) {
+ throw new ArgumentException();
+ }
+
+ if (max_selection_count != value) {
+ max_selection_count = value;
+ }
+ }
+ get {
+ return max_selection_count;
+ }
+ }
+
+ // the minimum date allowed to be selected on this month calendar
+ public DateTime MinDate {
+ set {
+ if (value < new DateTime (1953, 1, 1)) {
+ throw new ArgumentException();
+ }
+
+ if (value > MaxDate) {
+ throw new ArgumentException();
+ }
+
+ if (max_date != value) {
+ min_date = value;
+ }
+ }
+ get {
+ return min_date;
+ }
+ }
+
+ // dates to make bold on calendar monthly (recurring)
+ [Localizable (true)]
+ public DateTime[] MonthlyBoldedDates {
+ set {
+ if (monthly_bolded_dates == null || monthly_bolded_dates != value) {
+ monthly_bolded_dates = value;
+ this.UpdateBoldedDates ();
+ this.Invalidate ();
+ }
+ }
+ get {
+ return monthly_bolded_dates;
+ }
+ }
+
+ // the ammount by which to scroll this calendar by
+ [DefaultValue (0)]
+ public int ScrollChange {
+ set {
+ if (value < 0 || value > 20000) {
+ throw new ArgumentException();
+ }
+
+ if (scroll_change != value) {
+ scroll_change = value;
+ }
+ }
+ get {
+ // if zero it to the default -> the total number of months currently visible
+ if (scroll_change == 0) {
+ return CalendarDimensions.Width * CalendarDimensions.Height;
+ }
+ return scroll_change;
+ }
+ }
+
+
+ // the last selected date
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public DateTime SelectionEnd {
+ set {
+ if (value < MinDate || value > MaxDate) {
+ throw new ArgumentException();
+ }
+
+ if (SelectionRange.End != value) {
+ DateTime old_end = SelectionRange.End;
+ // make sure the end obeys the max selection range count
+ if (value < SelectionRange.Start) {
+ SelectionRange.Start = value;
+ }
+ if (value.AddDays((MaxSelectionCount-1)*-1) > SelectionRange.Start) {
+ SelectionRange.Start = value.AddDays((MaxSelectionCount-1)*-1);
+ }
+ SelectionRange.End = value;
+ this.InvalidateDateRange (new SelectionRange (old_end, SelectionRange.End));
+ this.OnDateChanged (new DateRangeEventArgs (SelectionStart, SelectionEnd));
+ }
+ }
+ get {
+ return SelectionRange.End;
+ }
+ }
+
+ // the range of selected dates
+ public SelectionRange SelectionRange {
+ set {
+ if (selection_range != value) {
+ SelectionRange old_range = selection_range;
+
+ // make sure the end obeys the max selection range count
+ if (value.End.AddDays((MaxSelectionCount-1)*-1) > value.Start) {
+ selection_range = new SelectionRange (value.End.AddDays((MaxSelectionCount-1)*-1), value.End);
+ } else {
+ selection_range = value;
+ }
+ SelectionRange visible_range = this.GetDisplayRange(true);
+ if(visible_range.Start > selection_range.End) {
+ this.current_month = new DateTime (selection_range.Start.Year, selection_range.Start.Month, 1);
+ this.Invalidate ();
+ } else if (visible_range.End < selection_range.Start) {
+ int year_diff = selection_range.End.Year - visible_range.End.Year;
+ int month_diff = selection_range.End.Month - visible_range.End.Month;
+ this.current_month = current_month.AddMonths(year_diff * 12 + month_diff);
+ this.Invalidate ();
+ }
+ // invalidate the selected range changes
+ DateTime diff_start = old_range.Start;
+ DateTime diff_end = old_range.End;
+ // now decide which region is greated
+ if (old_range.Start > SelectionRange.Start) {
+ diff_start = SelectionRange.Start;
+ } else if (old_range.Start == SelectionRange.Start) {
+ if (old_range.End < SelectionRange.End) {
+ diff_start = old_range.End;
+ } else {
+ diff_start = SelectionRange.End;
+ }
+ }
+ if (old_range.End < SelectionRange.End) {
+ diff_end = SelectionRange.End;
+ } else if (old_range.End == SelectionRange.End) {
+ if (old_range.Start < SelectionRange.Start) {
+ diff_end = SelectionRange.Start;
+ } else {
+ diff_end = old_range.Start;
+ }
+ }
+
+ // invalidate the region required
+ this.InvalidateDateRange (new SelectionRange (diff_start, diff_end));
+ // raise date changed event
+ this.OnDateChanged (new DateRangeEventArgs (SelectionStart, SelectionEnd));
+ }
+ }
+ get {
+ return selection_range;
+ }
+ }
+
+ // the first selected date
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public DateTime SelectionStart {
+ set {
+ if (value < MinDate || value > MaxDate) {
+ throw new ArgumentException();
+ }
+
+ if (SelectionRange.Start != value) {
+ DateTime old_start = SelectionRange.Start;
+ // make sure the end obeys the max selection range count
+ if (value > SelectionRange.End) {
+ SelectionRange.End = value;
+ } else if (value.AddDays(MaxSelectionCount-1) < SelectionRange.End) {
+ SelectionRange.End = value.AddDays(MaxSelectionCount-1);
+ }
+ SelectionRange.Start = value;
+ DateTime new_month = new DateTime(value.Year, value.Month, 1);
+ if (current_month != new_month) {
+ current_month = new_month;
+ this.Invalidate ();
+ } else {
+ this.InvalidateDateRange (new SelectionRange (old_start, SelectionRange.Start));
+ }
+ this.OnDateChanged (new DateRangeEventArgs (SelectionStart, SelectionEnd));
+ }
+ }
+ get {
+ return selection_range.Start;
+ }
+ }
+
+ // whether or not to show todays date
+ [DefaultValue (true)]
+ public bool ShowToday {
+ set {
+ if (show_today != value) {
+ show_today = value;
+ this.Invalidate ();
+ }
+ }
+ get {
+ return show_today;
+ }
+ }
+
+ // whether or not to show a circle around todays date
+ [DefaultValue (true)]
+ public bool ShowTodayCircle {
+ set {
+ if (show_today_circle != value) {
+ show_today_circle = value;
+ this.Invalidate ();
+ }
+ }
+ get {
+ return show_today_circle;
+ }
+ }
+
+ // whether or not to show numbers beside each row of weeks
+ [Localizable (true)]
+ [DefaultValue (false)]
+ public bool ShowWeekNumbers {
+ set {
+ if (show_week_numbers != value) {
+ show_week_numbers = value;
+ this.Invalidate ();
+ }
+ }
+ get {
+ return show_week_numbers;
+ }
+ }
+
+ // the rectangle size required to render one month based on current font
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public Size SingleMonthSize {
+ get {
+ if (this.Font == null) {
+ throw new InvalidOperationException();
+ }
+
+ // multiplier is sucked out from the font size
+ int multiplier = this.Font.Height;
+
+ // establis how many columns and rows we have
+ int column_count = (ShowWeekNumbers) ? 8 : 7;
+ int row_count = 7; // not including the today date
+
+ // set the date_cell_size and the title_size
+ date_cell_size = new Size ((int) Math.Ceiling (2.5 * multiplier), (int) Math.Ceiling (1.5 * multiplier));
+ title_size = new Size ((date_cell_size.Width * column_count), 3 * multiplier);
+
+ return new Size (column_count * date_cell_size.Width, row_count * date_cell_size.Height + title_size.Height);
+ }
+ }
+
+ [Bindable(false)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override string Text {
+ get {
+ return base.Text;
+ }
+ set {
+ base.Text = value;
+ }
+ }
+
+ // the back color for the title of the calendar and the
+ // forecolor for the day of the week text
+ public Color TitleBackColor {
+ set {
+ if (title_back_color != value) {
+ title_back_color = value;
+ this.Invalidate ();
+ }
+ }
+ get {
+ return title_back_color;
+ }
+ }
+
+ // the fore color for the title of the calendar
+ public Color TitleForeColor {
+ set {
+ if (title_fore_color != value) {
+ title_fore_color = value;
+ this.Invalidate ();
+ }
+ }
+ get {
+ return title_fore_color;
+ }
+ }
+
+ // the date this calendar is using to refer to today's date
+ public DateTime TodayDate {
+ set {
+ today_date_set = true;
+ if (today_date != value) {
+ today_date = value;
+ this.Invalidate ();
+ }
+ }
+ get {
+ return today_date;
+ }
+ }
+
+ // tells if user specifically set today_date for this control
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public bool TodayDateSet {
+ get {
+ return today_date_set;
+ }
+ }
+
+ // the color used for trailing dates in the calendar
+ public Color TrailingForeColor {
+ set {
+ if (trailing_fore_color != value) {
+ trailing_fore_color = value;
+ SelectionRange bounds = this.GetDisplayRange (false);
+ SelectionRange visible_bounds = this.GetDisplayRange (true);
+ this.InvalidateDateRange (new SelectionRange (bounds.Start, visible_bounds.Start));
+ this.InvalidateDateRange (new SelectionRange (bounds.End, visible_bounds.End));
+ }
+ }
+ get {
+ return trailing_fore_color;
+ }
+ }
+
+ #endregion // Public Instance Properties
+
+ #region Protected Instance Properties
+
+ // overloaded to allow controll to be windowed for drop down
+ protected override CreateParams CreateParams {
+ get {
+ if (this.owner == null) {
+ return base.CreateParams;
+ } else {
+ CreateParams cp = base.CreateParams;
+ cp.Style = unchecked ((int)(WindowStyles.WS_POPUP | WindowStyles.WS_VISIBLE | WindowStyles.WS_CLIPSIBLINGS | WindowStyles.WS_CLIPCHILDREN));
+ cp.ExStyle |= (int)(WindowStyles.WS_EX_TOOLWINDOW | WindowStyles.WS_EX_TOPMOST);
+
+ if (!is_enabled) {
+ cp.Style |= (int)(WindowStyles.WS_DISABLED);
+ }
+ return cp;
+ }
+ }
+ }
+
+ // not sure what to put in here - just doing a base() call - jba
+ protected override ImeMode DefaultImeMode {
+ get {
+ return base.DefaultImeMode;
+ }
+ }
+
+ protected override Size DefaultSize {
+ get {
+ Size single_month = SingleMonthSize;
+ // get the width
+ int width = calendar_dimensions.Width * single_month.Width;
+ if (calendar_dimensions.Width > 1) {
+ width += (calendar_dimensions.Width - 1) * calendar_spacing.Width;
+ }
+
+ // get the height
+ int height = calendar_dimensions.Height * single_month.Height;
+ if (this.ShowToday) {
+ height += date_cell_size.Height + 2; // add the height of the "Today: " ...
+ }
+ if (calendar_dimensions.Height > 1) {
+ height += (calendar_dimensions.Height - 1) * calendar_spacing.Height;
+ }
+
+ // add the 1 pixel boundary
+ if (width > 0) {
+ width += 2;
+ }
+ if (height > 0) {
+ height +=2;
+ }
+
+ return new Size (width, height);
+ }
+ }
+
+ #endregion // Protected Instance Properties
+
+ #region Public Instance Methods
+
+ // add a date to the anually bolded date arraylist
+ public void AddAnnuallyBoldedDate (DateTime date) {
+ added_annually_bolded_dates.Add (date.Date);
+ }
+
+ // add a date to the normal bolded date arraylist
+ public void AddBoldedDate (DateTime date) {
+ added_bolded_dates.Add (date.Date);
+ }
+
+ // add a date to the anually monthly date arraylist
+ public void AddMonthlyBoldedDate (DateTime date) {
+ added_monthly_bolded_dates.Add (date.Date);
+ }
+
+ // if visible = true, return only the dates of full months, else return all dates visible
+ public SelectionRange GetDisplayRange (bool visible) {
+ DateTime start;
+ DateTime end;
+ start = new DateTime (current_month.Year, current_month.Month, 1);
+ end = start.AddMonths (calendar_dimensions.Width * calendar_dimensions.Height);
+ end = end.AddDays(-1);
+
+ // process all visible dates if needed (including the grayed out dates
+ if (!visible) {
+ start = GetFirstDateInMonthGrid (start);
+ end = GetLastDateInMonthGrid (end);
+ }
+
+ return new SelectionRange (start, end);
+ }
+
+ // HitTest overload that recieve's x and y co-ordinates as separate ints
+ public HitTestInfo HitTest (int x, int y) {
+ return HitTest (new Point (x, y));
+ }
+
+ // returns a HitTestInfo for MonthCalendar element's under the specified point
+ public HitTestInfo HitTest (Point point) {
+ return HitTest (point, out last_clicked_calendar_index, out last_clicked_calendar_rect);
+ }
+
+ // clears all the annually bolded dates
+ public void RemoveAllAnnuallyBoldedDates () {
+ annually_bolded_dates = null;
+ added_annually_bolded_dates.Clear ();
+ removed_annually_bolded_dates.Clear ();
+ }
+
+ // clears all the normal bolded dates
+ public void RemoveAllBoldedDates () {
+ bolded_dates = null;
+ added_bolded_dates.Clear ();
+ removed_bolded_dates.Clear ();
+ }
+
+ // clears all the monthly bolded dates
+ public void RemoveAllMonthlyBoldedDates () {
+ monthly_bolded_dates = null;
+ added_monthly_bolded_dates.Clear ();
+ removed_monthly_bolded_dates.Clear ();
+ }
+
+ // clears the specified annually bolded date (only compares day and month)
+ // only removes the first instance of the match
+ public void RemoveAnnuallyBoldedDate (DateTime date) {
+ if (!removed_annually_bolded_dates.Contains (date.Date)) {
+ removed_annually_bolded_dates.Add (date.Date);
+ }
+ }
+
+ // clears all the normal bolded date
+ // only removes the first instance of the match
+ public void RemoveBoldedDate (DateTime date) {
+ if (!removed_bolded_dates.Contains (date.Date)) {
+ removed_bolded_dates.Add (date.Date);
+ }
+ }
+
+ // clears the specified monthly bolded date (only compares day and month)
+ // only removes the first instance of the match
+ public void RemoveMonthlyBoldedDate (DateTime date) {
+ if (!removed_monthly_bolded_dates.Contains (date.Date)) {
+ removed_monthly_bolded_dates.Add (date.Date);
+ }
+ }
+
+ // sets the calendar_dimensions. If product is > 12, the larger dimension is reduced to make product < 12
+ public void SetCalendarDimensions(int x, int y) {
+ this.CalendarDimensions = new Size(x, y);
+ }
+
+ // sets the currently selected date as date
+ public void SetDate (DateTime date) {
+ this.SetSelectionRange (date.Date, date.Date);
+ }
+
+ // utility method set the SelectionRange property using individual dates
+ public void SetSelectionRange (DateTime date1, DateTime date2) {
+ this.SelectionRange = new SelectionRange(date1, date2);
+ }
+
+ public override string ToString () {
+ return this.GetType().Name + ", " + this.SelectionRange.ToString ();
+ }
+
+ // usually called after an AddBoldedDate method is called
+ // formats monthly and daily bolded dates according to the current calendar year
+ public void UpdateBoldedDates () {
+ UpdateDateArray (ref bolded_dates, added_bolded_dates, removed_bolded_dates);
+ UpdateDateArray (ref monthly_bolded_dates, added_monthly_bolded_dates, removed_monthly_bolded_dates);
+ UpdateDateArray (ref annually_bolded_dates, added_annually_bolded_dates, removed_annually_bolded_dates);
+ }
+
+ #endregion // Public Instance Methods
+
+ #region Protected Instance Methods
+
+ // not sure why this needs to be overriden
+ protected override void CreateHandle () {
+ base.CreateHandle ();
+ }
+
+ private void CreateYearUpDown ()
+ {
+ year_updown = new NumericUpDown ();
+ year_updown.Font = this.Font;
+ year_updown.Minimum = MinDate.Year;
+ year_updown.Maximum = MaxDate.Year;
+ year_updown.ReadOnly = true;
+ year_updown.Visible = false;
+ this.Controls.AddImplicit (year_updown);
+ year_updown.ValueChanged += new EventHandler(UpDownYearChangedHandler);
+ }
+
+ // not sure why this needs to be overriden
+ protected override void Dispose (bool disposing) {
+ base.Dispose (disposing);
+ }
+
+ // not sure why this needs to be overriden
+ protected override bool IsInputKey (Keys keyData) {
+ return base.IsInputKey (keyData);
+ }
+
+ // not sure why this needs to be overriden
+ protected override void OnBackColorChanged (EventArgs e) {
+ base.OnBackColorChanged (e);
+ this.Invalidate ();
+ }
+
+ // raises the date changed event
+ protected virtual void OnDateChanged (DateRangeEventArgs drevent) {
+ if (this.DateChanged != null) {
+ this.DateChanged (this, drevent);
+ }
+ }
+
+ // raises the DateSelected event
+ protected virtual void OnDateSelected (DateRangeEventArgs drevent) {
+ if (this.DateSelected != null) {
+ this.DateSelected (this, drevent);
+ }
+ }
+
+ protected override void OnFontChanged (EventArgs e) {
+ base.OnFontChanged (e);
+ }
+
+ protected override void OnForeColorChanged (EventArgs e) {
+ base.OnForeColorChanged (e);
+ }
+
+ protected override void OnHandleCreated (EventArgs e) {
+ base.OnHandleCreated (e);
+ CreateYearUpDown ();
+ }
+
+ // i think this is overriden to not allow the control to be changed to an arbitrary size
+ protected override void SetBoundsCore (int x, int y, int width, int height, BoundsSpecified specified) {
+ if ((specified & BoundsSpecified.Height) == BoundsSpecified.Height ||
+ (specified & BoundsSpecified.Width) == BoundsSpecified.Width ||
+ (specified & BoundsSpecified.Size) == BoundsSpecified.Size) {
+ // only allow sizes = default size to be set
+ Size min_size = DefaultSize;
+ Size max_size = new Size (
+ DefaultSize.Width + SingleMonthSize.Width + calendar_spacing.Width,
+ DefaultSize.Height + SingleMonthSize.Height + calendar_spacing.Height);
+ int x_mid_point = (max_size.Width + min_size.Width)/2;
+ int y_mid_point = (max_size.Height + min_size.Height)/2;
+ if (width < x_mid_point) {
+ width = min_size.Width;
+ } else {
+ width = max_size.Width;
+ }
+ if (height < y_mid_point) {
+ height = min_size.Height;
+ } else {
+ height = max_size.Height;
+ }
+ base.SetBoundsCore (x, y, width, height, specified);
+ } else {
+ base.SetBoundsCore (x, y, width, height, specified);
+ }
+ }
+
+ protected override void WndProc (ref Message m) {
+ base.WndProc (ref m);
+ }
+
+ #endregion // Protected Instance Methods
+
+ #region public events
+
+ // fired when the date is changed (either explicitely or implicitely)
+ // when navigating the month selector
+ public event DateRangeEventHandler DateChanged;
+
+ // fired when the user explicitely clicks on date to select it
+ public event DateRangeEventHandler DateSelected;
+
+ [Browsable(false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public event EventHandler BackgroundImageChanged;
+
+ // this event is overridden to supress it from being fired
+ [Browsable(false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public event EventHandler Click;
+
+ // this event is overridden to supress it from being fired
+ [Browsable(false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public event EventHandler DoubleClick;
+
+ [Browsable(false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public event EventHandler ImeModeChanged;
+
+ [Browsable(false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event PaintEventHandler Paint;
+
+ [Browsable(false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public event EventHandler TextChanged;
+ #endregion // public events
+
+ #region internal properties
+
+ internal DateTime CurrentMonth {
+ set {
+ // only interested in if the month (not actual date) has changed
+ if (value.Month != current_month.Month ||
+ value.Year != current_month.Year) {
+ this.SelectionRange = new SelectionRange(
+ this.SelectionStart.Add(value.Subtract(current_month)),
+ this.SelectionEnd.Add(value.Subtract(current_month)));
+ current_month = value;
+ UpdateBoldedDates();
+ this.Invalidate();
+ }
+ }
+ get {
+ return current_month;
+ }
+ }
+
+ #endregion // internal properties
+
+ #region internal/private methods
+ internal HitTestInfo HitTest (
+ Point point,
+ out int calendar_index,
+ out Rectangle calendar_rect) {
+ // start by initialising the ref parameters
+ calendar_index = -1;
+ calendar_rect = Rectangle.Empty;
+
+ // before doing all the hard work, see if the today's date wasn't clicked
+ Rectangle today_rect = new Rectangle (
+ ClientRectangle.X,
+ ClientRectangle.Bottom - date_cell_size.Height,
+ 7 * date_cell_size.Width,
+ date_cell_size.Height);
+ if (today_rect.Contains (point) && this.ShowToday) {
+ return new HitTestInfo(HitArea.TodayLink, point, DateTime.Now);
+ }
+
+ Size month_size = SingleMonthSize;
+ // define calendar rect's that this thing can land in
+ Rectangle[] calendars = new Rectangle [CalendarDimensions.Width * CalendarDimensions.Height];
+ for (int i=0; i < CalendarDimensions.Width * CalendarDimensions.Height; i ++) {
+ if (i == 0) {
+ calendars[i] = new Rectangle (
+ new Point (ClientRectangle.X + 1, ClientRectangle.Y + 1),
+ month_size);
+ } else {
+ // calendar on the next row
+ if (i % CalendarDimensions.Width == 0) {
+ calendars[i] = new Rectangle (
+ new Point (calendars[i-CalendarDimensions.Width].X, calendars[i-CalendarDimensions.Width].Bottom + calendar_spacing.Height),
+ month_size);
+ } else {
+ // calendar on the next column
+ calendars[i] = new Rectangle (
+ new Point (calendars[i-1].Right + calendar_spacing.Width, calendars[i-1].Y),
+ month_size);
+ }
+ }
+ }
+
+ // through each trying to find a match
+ for (int i = 0; i < calendars.Length ; i++) {
+ if (calendars[i].Contains (point)) {
+ // check the title section
+ Rectangle title_rect = new Rectangle (
+ calendars[i].Location,
+ title_size);
+ if (title_rect.Contains (point) ) {
+ // make sure it's not a previous button
+ if (i == 0) {
+ Rectangle button_rect = new Rectangle(
+ new Point (calendars[i].X + button_x_offset, (title_size.Height - button_size.Height)/2),
+ button_size);
+ if (button_rect.Contains (point)) {
+ return new HitTestInfo(HitArea.PrevMonthButton, point, DateTime.Now);
+ }
+ }
+ // make sure it's not the next button
+ if (i % CalendarDimensions.Height == 0 && i % CalendarDimensions.Width == calendar_dimensions.Width - 1) {
+ Rectangle button_rect = new Rectangle(
+ new Point (calendars[i].Right - button_x_offset - button_size.Width, (title_size.Height - button_size.Height)/2),
+ button_size);
+ if (button_rect.Contains (point)) {
+ return new HitTestInfo(HitArea.NextMonthButton, point, DateTime.Now);
+ }
+ }
+
+ // indicate which calendar and month it was
+ calendar_index = i;
+ calendar_rect = calendars[i];
+
+ // make sure it's not the month or the year of the calendar
+ if (GetMonthNameRectangle (title_rect, i).Contains (point)) {
+ return new HitTestInfo(HitArea.TitleMonth, point, DateTime.Now);
+ }
+ if (GetYearNameRectangle (title_rect, i).Contains (point)) {
+ return new HitTestInfo(HitArea.TitleYear, point, DateTime.Now);
+ }
+
+ // return the hit test in the title background
+ return new HitTestInfo(HitArea.TitleBackground, point, DateTime.Now);
+ }
+
+ Point date_grid_location = new Point (calendars[i].X, title_rect.Bottom);
+
+ // see if it's in the Week numbers
+ if (ShowWeekNumbers) {
+ Rectangle weeks_rect = new Rectangle (
+ date_grid_location,
+ new Size (date_cell_size.Width,Math.Max (calendars[i].Height - title_rect.Height, 0)));
+ if (weeks_rect.Contains (point)) {
+ return new HitTestInfo(HitArea.WeekNumbers, point, DateTime.Now);
+ }
+
+ // move the location of the grid over
+ date_grid_location.X += date_cell_size.Width;
+ }
+
+ // see if it's in the week names
+ Rectangle day_rect = new Rectangle (
+ date_grid_location,
+ new Size (Math.Max (calendars[i].Right - date_grid_location.X, 0), date_cell_size.Height));
+ if (day_rect.Contains (point)) {
+ return new HitTestInfo(HitArea.DayOfWeek, point, DateTime.Now);
+ }
+
+ // finally see if it was a date that was clicked
+ Rectangle date_grid = new Rectangle (
+ new Point (day_rect.X, day_rect.Bottom),
+ new Size (day_rect.Width, Math.Max(calendars[i].Bottom - day_rect.Bottom, 0)));
+ if (date_grid.Contains (point)) {
+ // okay so it's inside the grid, get the offset
+ Point offset = new Point (point.X - date_grid.X, point.Y - date_grid.Y);
+ int row = offset.Y / date_cell_size.Height;
+ int col = offset.X / date_cell_size.Width;
+ // establish our first day of the month
+ DateTime calendar_month = this.CurrentMonth.AddMonths(i);
+ DateTime first_day = GetFirstDateInMonthGrid (calendar_month);
+ DateTime time = first_day.AddDays ((row * 7) + col);
+ // establish which date was clicked
+ if (time.Year != calendar_month.Year || time.Month != calendar_month.Month) {
+ if (time < calendar_month && i == 0) {
+ return new HitTestInfo(HitArea.PrevMonthDate, point, time);
+ } else if (time > calendar_month && i == CalendarDimensions.Width*CalendarDimensions.Height - 1) {
+ return new HitTestInfo(HitArea.NextMonthDate, point, time);
+ }
+ return new HitTestInfo(HitArea.Nowhere, point, time);
+ }
+ return new HitTestInfo(HitArea.Date, point, time);
+ }
+ }
+ }
+
+ return new HitTestInfo ();
+ }
+
+ // returns the date of the first cell of the specified month grid
+ internal DateTime GetFirstDateInMonthGrid (DateTime month) {
+ // convert the first_day_of_week into a DayOfWeekEnum
+ DayOfWeek first_day = GetDayOfWeek (first_day_of_week);
+ // find the first day of the month
+ DateTime first_date_of_month = new DateTime (month.Year, month.Month, 1);
+ DayOfWeek first_day_of_month = first_date_of_month.DayOfWeek;
+ // adjust for the starting day of the week
+ int offset = first_day_of_month - first_day;
+ if (offset < 0) {
+ offset += 7;
+ }
+ return first_date_of_month.AddDays (-1*offset);
+ }
+
+ // returns the date of the last cell of the specified month grid
+ internal DateTime GetLastDateInMonthGrid (DateTime month)
+ {
+ DateTime start = GetFirstDateInMonthGrid(month);
+ return start.AddDays ((7 * 6)-1);
+ }
+
+ internal bool IsBoldedDate (DateTime date) {
+ // check bolded dates
+ if (bolded_dates != null && bolded_dates.Length > 0) {
+ foreach (DateTime bolded_date in bolded_dates) {
+ if (bolded_date.Date == date.Date) {
+ return true;
+ }
+ }
+ }
+ // check monthly dates
+ if (monthly_bolded_dates != null && monthly_bolded_dates.Length > 0) {
+ foreach (DateTime bolded_date in monthly_bolded_dates) {
+ if (bolded_date.Day == date.Day) {
+ return true;
+ }
+ }
+ }
+ // check yearly dates
+ if (annually_bolded_dates != null && annually_bolded_dates.Length > 0) {
+ foreach (DateTime bolded_date in annually_bolded_dates) {
+ if (bolded_date.Month == date.Month && bolded_date.Day == date.Day) {
+ return true;
+ }
+ }
+ }
+
+ return false; // no match
+ }
+
+ // updates the specified bolded dates array with ones to add and ones to remove
+ private void UpdateDateArray (ref DateTime [] dates, ArrayList to_add, ArrayList to_remove) {
+ ArrayList list = new ArrayList ();
+
+ // update normal bolded dates
+ if (dates != null) {
+ foreach (DateTime date in dates) {
+ list.Add (date.Date);
+ }
+ }
+
+ // add new ones
+ foreach (DateTime date in to_add) {
+ if (!list.Contains (date.Date)) {
+ list.Add (date.Date);
+ }
+ }
+ to_add.Clear ();
+
+ // remove ones to remove
+ foreach (DateTime date in to_remove) {
+ if (list.Contains (date.Date)) {
+ list.Remove (date.Date);
+ }
+ }
+ to_remove.Clear ();
+ // set up the array now
+ if (list.Count > 0) {
+ dates = (DateTime []) list.ToArray (typeof (DateTime));
+ Array.Sort (dates);
+ list.Clear ();
+ } else {
+ dates = null;
+ }
+ }
+
+ // initialise the context menu
+ private void SetUpContextMenu () {
+ menu = new ContextMenu ();
+ for (int i=0; i < 12; i++) {
+ MenuItem menu_item = new MenuItem ( new DateTime (2000, i+1, 1).ToString ("MMMM"));
+ menu_item.Click += new EventHandler (MenuItemClickHandler);
+ menu.MenuItems.Add (menu_item);
+ }
+ }
+
+ // initialises text value and show's year up down in correct position
+ private void PrepareYearUpDown (Point p) {
+ Rectangle old_location = year_updown.Bounds;
+
+ // set position
+ Rectangle title_rect = new Rectangle(
+ last_clicked_calendar_rect.Location,
+ title_size);
+
+ year_updown.Bounds = GetYearNameRectangle(
+ title_rect,
+ last_clicked_calendar_index);
+ year_updown.Top -= 4;
+ year_updown.Width += (int) (this.Font.Size * 4);
+ // set year - only do this if this isn't being called because of a year up down click
+ if(year_updown.Bounds != old_location) {
+ year_updown.Value = current_month.AddMonths(last_clicked_calendar_index).Year;
+ }
+
+ if(!year_updown.Visible) {
+ year_updown.Visible = true;
+ }
+ }
+
+ // returns the first date of the month
+ private DateTime GetFirstDateInMonth (DateTime date) {
+ return new DateTime (date.Year, date.Month, 1);
+ }
+
+ // returns the last date of the month
+ private DateTime GetLastDateInMonth (DateTime date) {
+ return new DateTime (date.Year, date.Month, 1).AddMonths(1).AddDays(-1);
+ }
+
+ // called in response to users seletion with shift key
+ private void AddTimeToSelection (int delta, bool isDays)
+ {
+ DateTime cursor_point;
+ DateTime end_point;
+ // okay we add the period to the date that is not the same as the
+ // start date when shift was first clicked.
+ if (SelectionStart != first_select_start_date) {
+ cursor_point = SelectionStart;
+ } else {
+ cursor_point = SelectionEnd;
+ }
+ // add the days
+ if (isDays) {
+ end_point = cursor_point.AddDays (delta);
+ } else {
+ // delta must be months
+ end_point = cursor_point.AddMonths (delta);
+ }
+ // set the new selection range
+ SelectionRange range = new SelectionRange (first_select_start_date, end_point);
+ if (range.Start.AddDays (MaxSelectionCount-1) < range.End) {
+ // okay the date is beyond what is allowed, lets set the maximum we can
+ if (range.Start != first_select_start_date) {
+ range.Start = range.End.AddDays ((MaxSelectionCount-1)*-1);
+ } else {
+ range.End = range.Start.AddDays (MaxSelectionCount-1);
+ }
+ }
+ this.SelectionRange = range;
+ }
+
+ // attempts to add the date to the selection without throwing exception
+ private void SelectDate (DateTime date) {
+ // try and add the new date to the selction range
+ if (is_shift_pressed || (click_state [0])) {
+ SelectionRange range = new SelectionRange (first_select_start_date, date);
+ if (range.Start.AddDays (MaxSelectionCount-1) < range.End) {
+ // okay the date is beyond what is allowed, lets set the maximum we can
+ if (range.Start != first_select_start_date) {
+ range.Start = range.End.AddDays ((MaxSelectionCount-1)*-1);
+ } else {
+ range.End = range.Start.AddDays (MaxSelectionCount-1);
+ }
+ }
+ SelectionRange = range;
+ } else {
+ SelectionRange = new SelectionRange (date, date);
+ first_select_start_date = date;
+ }
+ }
+
+ // gets the week of the year
+ internal int GetWeekOfYear (DateTime date) {
+ // convert the first_day_of_week into a DayOfWeekEnum
+ DayOfWeek first_day = GetDayOfWeek (first_day_of_week);
+ // find the first day of the year
+ DayOfWeek first_day_of_year = new DateTime (date.Year, 1, 1).DayOfWeek;
+ // adjust for the starting day of the week
+ int offset = first_day_of_year - first_day;
+ int week = ((date.DayOfYear + offset) / 7) + 1;
+ return week;
+ }
+
+ // convert a Day enum into a DayOfWeek enum
+ internal DayOfWeek GetDayOfWeek (Day day) {
+ if (day == Day.Default) {
+ return DayOfWeek.Sunday;
+ } else {
+ return (DayOfWeek) DayOfWeek.Parse (typeof (DayOfWeek), day.ToString ());
+ }
+ }
+
+ // returns the rectangle for themonth name
+ internal Rectangle GetMonthNameRectangle (Rectangle title_rect, int calendar_index) {
+ Graphics g = this.DeviceContext;
+ DateTime this_month = this.current_month.AddMonths (calendar_index);
+ Size title_text_size = g.MeasureString (this_month.ToString ("MMMM yyyy"), this.Font).ToSize ();
+ Size month_size = g.MeasureString (this_month.ToString ("MMMM"), this.Font).ToSize ();
+ // return only the month name part of that
+ return new Rectangle (
+ new Point (
+ title_rect.X + ((title_rect.Width - title_text_size.Width)/2),
+ title_rect.Y + ((title_rect.Height - title_text_size.Height)/2)),
+ month_size);
+ }
+
+ // returns the rectangle for the year in the title
+ internal Rectangle GetYearNameRectangle (Rectangle title_rect, int calendar_index) {
+ Graphics g = this.DeviceContext;
+ DateTime this_month = this.current_month.AddMonths (calendar_index);
+ Size title_text_size = g.MeasureString (this_month.ToString ("MMMM yyyy"), this.Font).ToSize ();
+ Size year_size = g.MeasureString (this_month.ToString ("yyyy"), this.Font).ToSize ();
+ // find out how much space the title took
+ Rectangle text_rect = new Rectangle (
+ new Point (
+ title_rect.X + ((title_rect.Width - title_text_size.Width)/2),
+ title_rect.Y + ((title_rect.Height - title_text_size.Height)/2)),
+ title_text_size);
+ // return only the rect of the year
+ return new Rectangle (
+ new Point (
+ text_rect.Right - year_size.Width,
+ text_rect.Y),
+ year_size);
+ }
+
+ // determine if date is allowed to be drawn in month
+ internal bool IsValidWeekToDraw (DateTime month, DateTime date, int row, int col) {
+ DateTime tocheck = month.AddMonths (-1);
+ if ((month.Year == date.Year && month.Month == date.Month) ||
+ (tocheck.Year == date.Year && tocheck.Month == date.Month)) {
+ return true;
+ }
+
+ // check the railing dates (days in the month after the last month in grid)
+ if (row == CalendarDimensions.Height - 1 && col == CalendarDimensions.Width - 1) {
+ tocheck = month.AddMonths (1);
+ return (tocheck.Year == date.Year && tocheck.Month == date.Month) ;
+ }
+
+ return false;
+ }
+
+ // set one item clicked and all others off
+ private void SetItemClick(HitTestInfo hti)
+ {
+ switch(hti.HitArea) {
+ case HitArea.NextMonthButton:
+ this.is_previous_clicked = false;
+ this.is_next_clicked = true;
+ this.is_date_clicked = false;
+ break;
+ case HitArea.PrevMonthButton:
+ this.is_previous_clicked = true;
+ this.is_next_clicked = false;
+ this.is_date_clicked = false;
+ break;
+ case HitArea.PrevMonthDate:
+ case HitArea.NextMonthDate:
+ case HitArea.Date:
+ this.clicked_date = hti.Time;
+ this.is_previous_clicked = false;
+ this.is_next_clicked = false;
+ this.is_date_clicked = true;
+ break;
+ default :
+ this.is_previous_clicked = false;
+ this.is_next_clicked = false;
+ this.is_date_clicked = false;
+ break;
+ }
+ }
+
+ // called when the year is changed
+ private void UpDownYearChangedHandler (object sender, EventArgs e) {
+ int initial_year_value = this.CurrentMonth.AddMonths(last_clicked_calendar_index).Year;
+ int diff = (int) year_updown.Value - initial_year_value;
+ this.CurrentMonth = this.CurrentMonth.AddYears(diff);
+ }
+
+ // called when context menu is clicked
+ private void MenuItemClickHandler (object sender, EventArgs e) {
+ MenuItem item = sender as MenuItem;
+ if (item != null && month_title_click_location != Point.Empty) {
+ // establish which month we want to move to
+ if (item.Parent == null) {
+ return;
+ }
+ int new_month = item.Parent.MenuItems.IndexOf (item) + 1;
+ if (new_month == 0) {
+ return;
+ }
+ // okay let's establish which calendar was hit
+ Size month_size = this.SingleMonthSize;
+ for (int i=0; i < CalendarDimensions.Height; i++) {
+ for (int j=0; j < CalendarDimensions.Width; j++) {
+ int month_index = (i * CalendarDimensions.Width) + j;
+ Rectangle month_rect = new Rectangle ( new Point (0, 0), month_size);
+ if (j == 0) {
+ month_rect.X = this.ClientRectangle.X + 1;
+ } else {
+ month_rect.X = this.ClientRectangle.X + 1 + ((j)*(month_size.Width+calendar_spacing.Width));
+ }
+ if (i == 0) {
+ month_rect.Y = this.ClientRectangle.Y + 1;
+ } else {
+ month_rect.Y = this.ClientRectangle.Y + 1 + ((i)*(month_size.Height+calendar_spacing.Height));
+ }
+ // see if the point is inside
+ if (month_rect.Contains (month_title_click_location)) {
+ DateTime clicked_month = CurrentMonth.AddMonths (month_index);
+ // get the month that we want to move to
+ int month_offset = new_month - clicked_month.Month;
+
+ // move forward however more months we need to
+ this.CurrentMonth = this.CurrentMonth.AddMonths (month_offset);
+ break;
+ }
+ }
+ }
+
+ // clear the point
+ month_title_click_location = Point.Empty;
+ }
+ }
+
+ // raised on the timer, for mouse hold clicks
+ private void TimerHandler (object sender, EventArgs e) {
+ // now find out which area was click
+ if (this.Capture) {
+ HitTestInfo hti = this.HitTest (this.PointToClient (MousePosition));
+ // see if it was clicked on the prev or next mouse
+ if (click_state [1] || click_state [2]) {
+ // invalidate the area where the mouse was last held
+ DoMouseUp ();
+ // register the click
+ if (hti.HitArea == HitArea.PrevMonthButton ||
+ hti.HitArea == HitArea.NextMonthButton) {
+ DoButtonMouseDown (hti);
+ click_state [1] = (hti.HitArea == HitArea.PrevMonthButton);
+ click_state [2] = !click_state [1];
+ }
+ if (timer.Interval != 300) {
+ timer.Interval = 300;
+ }
+ }
+ } else {
+ timer.Enabled = false;
+ }
+ }
+
+ // selects one of the buttons
+ private void DoButtonMouseDown (HitTestInfo hti) {
+ // show the click then move on
+ SetItemClick(hti);
+ if (hti.HitArea == HitArea.PrevMonthButton) {
+ // invalidate the prev monthbutton
+ this.Invalidate(
+ new Rectangle (
+ this.ClientRectangle.X + 1 + button_x_offset,
+ this.ClientRectangle.Y + 1 + (title_size.Height - button_size.Height)/2,
+ button_size.Width,
+ button_size.Height));
+ this.CurrentMonth = this.CurrentMonth.AddMonths (ScrollChange*-1);
+ } else {
+ // invalidate the next monthbutton
+ this.Invalidate(
+ new Rectangle (
+ this.ClientRectangle.Right - 1 - button_x_offset - button_size.Width,
+ this.ClientRectangle.Y + 1 + (title_size.Height - button_size.Height)/2,
+ button_size.Width,
+ button_size.Height));
+ this.CurrentMonth = this.CurrentMonth.AddMonths (ScrollChange);
+ }
+ }
+
+ // selects the clicked date
+ private void DoDateMouseDown (HitTestInfo hti) {
+ SetItemClick(hti);
+ this.SelectDate (clicked_date);
+ this.OnDateSelected (new DateRangeEventArgs (SelectionStart, SelectionEnd));
+ }
+
+ // event run on the mouse up event
+ private void DoMouseUp () {
+ // invalidate the next monthbutton
+ if (this.is_next_clicked) {
+ this.Invalidate(
+ new Rectangle (
+ this.ClientRectangle.Right - 1 - button_x_offset - button_size.Width,
+ this.ClientRectangle.Y + 1 + (title_size.Height - button_size.Height)/2,
+ button_size.Width,
+ button_size.Height));
+ }
+ // invalidate the prev monthbutton
+ if (this.is_previous_clicked) {
+ this.Invalidate(
+ new Rectangle (
+ this.ClientRectangle.X + 1 + button_x_offset,
+ this.ClientRectangle.Y + 1 + (title_size.Height - button_size.Height)/2,
+ button_size.Width,
+ button_size.Height));
+ }
+ if (this.is_date_clicked) {
+ // invalidate the area under the cursor, to remove focus rect
+ this.InvalidateDateRange (new SelectionRange (clicked_date, clicked_date));
+ }
+ this.is_previous_clicked = false;
+ this.is_next_clicked = false;
+ this.is_date_clicked = false;
+ }
+
+// // need when in windowed mode
+// private void LostFocusHandler (object sender, EventArgs e)
+// {
+// if (this.owner != null) {
+// if (this.Visible) {
+// this.owner.HideMonthCalendar ();
+// }
+// }
+// }
+
+ // occurs when mouse moves around control, used for selection
+ private void MouseMoveHandler (object sender, MouseEventArgs e) {
+ HitTestInfo hti = this.HitTest (e.X, e.Y);
+ // clear the last clicked item
+ if (click_state [0]) {
+ // register the click
+ if (hti.HitArea == HitArea.PrevMonthDate ||
+ hti.HitArea == HitArea.NextMonthDate ||
+ hti.HitArea == HitArea.Date)
+ {
+ DoDateMouseDown (hti);
+ if (owner == null) {
+ click_state [0] = true;
+ } else {
+ click_state [0] = false;
+ click_state [1] = false;
+ click_state [2] = false;
+ }
+ }
+
+ }
+ }
+
+ // to check if the mouse has come down on this control
+ private void MouseDownHandler (object sender, MouseEventArgs e)
+ {
+ // clear the click_state variables
+ click_state [0] = false;
+ click_state [1] = false;
+ click_state [2] = false;
+
+ // disable the timer if it was enabled
+ if (timer.Enabled) {
+ timer.Stop ();
+ timer.Enabled = false;
+ }
+
+ Point point = new Point (e.X, e.Y);
+ // figure out if we are in drop down mode and a click happened outside us
+ if (this.owner != null) {
+ if (!this.ClientRectangle.Contains (point)) {
+ this.owner.HideMonthCalendar ();
+ return;
+ }
+ }
+
+ //establish where was hit
+ HitTestInfo hti = this.HitTest(point);
+ // hide the year numeric up down if it was clicked
+ if (year_updown != null && year_updown.Visible && hti.HitArea != HitArea.TitleYear)
+ {
+ year_updown.Visible = false;
+ }
+ switch (hti.HitArea) {
+ case HitArea.PrevMonthButton:
+ case HitArea.NextMonthButton:
+ DoButtonMouseDown (hti);
+ click_state [1] = (hti.HitArea == HitArea.PrevMonthDate);
+ click_state [2] = !click_state [1];
+ timer.Interval = 750;
+ timer.Start ();
+ break;
+ case HitArea.Date:
+ case HitArea.PrevMonthDate:
+ case HitArea.NextMonthDate:
+ DoDateMouseDown (hti);
+ // leave clicked state blank if drop down window
+ if (owner == null) {
+ click_state [0] = true;
+ } else {
+ click_state [0] = false;
+ click_state [1] = false;
+ click_state [2] = false;
+ }
+ break;
+ case HitArea.TitleMonth:
+ month_title_click_location = hti.Point;
+ menu.Show (this, hti.Point);
+ break;
+ case HitArea.TitleYear:
+ // place the numeric up down
+ PrepareYearUpDown(hti.Point);
+ break;
+ case HitArea.TodayLink:
+ this.SetSelectionRange (DateTime.Now.Date, DateTime.Now.Date);
+ this.OnDateSelected (new DateRangeEventArgs (SelectionStart, SelectionEnd));
+ break;
+ default:
+ this.is_previous_clicked = false;
+ this.is_next_clicked = false;
+ this.is_date_clicked = false;
+ break;
+ }
+ }
+
+ // raised by any key down events
+ private void KeyDownHandler (object sender, KeyEventArgs e) {
+ // send keys to the year_updown control, let it handle it
+ if(year_updown.Visible) {
+ switch (e.KeyCode) {
+ case Keys.Enter:
+ year_updown.Visible = false;
+ break;
+ case Keys.Up:
+ year_updown.Value = year_updown.Value + 1;
+ break;
+ case Keys.Down:
+ year_updown.Value = year_updown.Value - 1;
+ break;
+ }
+ } else {
+ if (!is_shift_pressed && e.Shift) {
+ first_select_start_date = SelectionStart;
+ is_shift_pressed = e.Shift;
+ }
+ switch (e.KeyCode) {
+ case Keys.Home:
+ // set the date to the start of the month
+ if (is_shift_pressed) {
+ DateTime date = GetFirstDateInMonth (first_select_start_date);
+ if (date < first_select_start_date.AddDays ((MaxSelectionCount-1)*-1)) {
+ date = first_select_start_date.AddDays ((MaxSelectionCount-1)*-1);
+ }
+ this.SetSelectionRange (date, first_select_start_date);
+ } else {
+ DateTime date = GetFirstDateInMonth (this.SelectionStart);
+ this.SetSelectionRange (date, date);
+ }
+ this.OnDateSelected (new DateRangeEventArgs (SelectionStart, SelectionEnd));
+ break;
+ case Keys.End:
+ // set the date to the last of the month
+ if (is_shift_pressed) {
+ DateTime date = GetLastDateInMonth (first_select_start_date);
+ if (date > first_select_start_date.AddDays (MaxSelectionCount-1)) {
+ date = first_select_start_date.AddDays (MaxSelectionCount-1);
+ }
+ this.SetSelectionRange (date, first_select_start_date);
+ } else {
+ DateTime date = GetLastDateInMonth (this.SelectionStart);
+ this.SetSelectionRange (date, date);
+ }
+ this.OnDateSelected (new DateRangeEventArgs (SelectionStart, SelectionEnd));
+ break;
+ case Keys.PageUp:
+ // set the date to the last of the month
+ if (is_shift_pressed) {
+ this.AddTimeToSelection (-1, false);
+ } else {
+ DateTime date = this.SelectionStart.AddMonths (-1);
+ this.SetSelectionRange (date, date);
+ }
+ this.OnDateSelected (new DateRangeEventArgs (SelectionStart, SelectionEnd));
+ break;
+ case Keys.PageDown:
+ // set the date to the last of the month
+ if (is_shift_pressed) {
+ this.AddTimeToSelection (1, false);
+ } else {
+ DateTime date = this.SelectionStart.AddMonths (1);
+ this.SetSelectionRange (date, date);
+ }
+ this.OnDateSelected (new DateRangeEventArgs (SelectionStart, SelectionEnd));
+ break;
+ case Keys.Up:
+ // set the back 1 week
+ if (is_shift_pressed) {
+ this.AddTimeToSelection (-7, true);
+ } else {
+ DateTime date = this.SelectionStart.AddDays (-7);
+ this.SetSelectionRange (date, date);
+ }
+ this.OnDateSelected (new DateRangeEventArgs (SelectionStart, SelectionEnd));
+ break;
+ case Keys.Down:
+ // set the date forward 1 week
+ if (is_shift_pressed) {
+ this.AddTimeToSelection (7, true);
+ } else {
+ DateTime date = this.SelectionStart.AddDays (7);
+ this.SetSelectionRange (date, date);
+ }
+ this.OnDateSelected (new DateRangeEventArgs (SelectionStart, SelectionEnd));
+ break;
+ case Keys.Left:
+ // move one left
+ if (is_shift_pressed) {
+ this.AddTimeToSelection (-1, true);
+ } else {
+ DateTime date = this.SelectionStart.AddDays (-1);
+ this.SetSelectionRange (date, date);
+ }
+ this.OnDateSelected (new DateRangeEventArgs (SelectionStart, SelectionEnd));
+ break;
+ case Keys.Right:
+ // move one left
+ if (is_shift_pressed) {
+ this.AddTimeToSelection (1, true);
+ } else {
+ DateTime date = this.SelectionStart.AddDays (1);
+ this.SetSelectionRange (date, date);
+ }
+ this.OnDateSelected (new DateRangeEventArgs (SelectionStart, SelectionEnd));
+ break;
+ default:
+ break;
+ }
+ e.Handled = true;
+ }
+ }
+
+ // to check if the mouse has come up on this control
+ private void MouseUpHandler (object sender, MouseEventArgs e)
+ {
+ if (timer.Enabled) {
+ timer.Stop ();
+ }
+ // clear the click state array
+ click_state [0] = false;
+ click_state [1] = false;
+ click_state [2] = false;
+ // do the regulare mouseup stuff
+ this.DoMouseUp ();
+ }
+
+ // raised by any key up events
+ private void KeyUpHandler (object sender, KeyEventArgs e) {
+ is_shift_pressed = e.Shift ;
+ e.Handled = true;
+ }
+
+ // paint this control now
+ private void PaintHandler (object sender, PaintEventArgs pe) {
+ if (Width <= 0 || Height <= 0 || Visible == false)
+ return;
+
+ Draw (pe.ClipRectangle, pe.Graphics);
+
+ // fire the new paint handler
+ if (this.Paint != null)
+ {
+ this.Paint (sender, pe);
+ }
+ }
+
+ // returns the region of the control that needs to be redrawn
+ private void InvalidateDateRange (SelectionRange range) {
+ SelectionRange bounds = this.GetDisplayRange (false);
+ if (range.End < bounds.Start || range.Start > bounds.End) {
+ // don't invalidate anything, as the modified date range
+ // is outside the visible bounds of this control
+ return;
+ }
+ // adjust the start and end to be inside the visible range
+ if (range.Start < bounds.Start) {
+ range = new SelectionRange (bounds.Start, range.End);
+ }
+ if (range.End > bounds.End) {
+ range = new SelectionRange (range.Start, bounds.End);
+ }
+ // now invalidate the date rectangles as series of rows
+ DateTime last_month = this.current_month.AddMonths ((CalendarDimensions.Width * CalendarDimensions.Height)).AddDays (-1);
+ DateTime current = range.Start;
+ while (current <= range.End) {
+ DateTime month_end = new DateTime (current.Year, current.Month, 1).AddMonths (1).AddDays (-1);;
+ Rectangle start_rect;
+ Rectangle end_rect;
+ // see if entire selection is in this current month
+ if (range.End <= month_end && current < last_month) {
+ // the end is the last date
+ if (current < this.current_month) {
+ start_rect = GetDateRowRect (current_month, current_month);
+ } else {
+ start_rect = GetDateRowRect (current, current);
+ }
+ end_rect = GetDateRowRect (current, range.End);
+ } else if (current < last_month) {
+ // otherwise it simply means we have a selection spaning
+ // multiple months simply set rectangle inside the current month
+ start_rect = GetDateRowRect (current, current);
+ end_rect = GetDateRowRect (month_end, month_end);
+ } else {
+ // it's outside the visible range
+ start_rect = GetDateRowRect (last_month, last_month.AddDays (1));
+ end_rect = GetDateRowRect (last_month, range.End);
+ }
+ // push to the next month
+ current = month_end.AddDays (1);
+ // invalidate from the start row to the end row for this month
+ this.Invalidate (
+ new Rectangle (
+ start_rect.X,
+ start_rect.Y,
+ start_rect.Width,
+ Math.Max (end_rect.Bottom - start_rect.Y, 0)));
+ }
+ }
+
+ // gets the rect of the row where the specified date appears on the specified month
+ private Rectangle GetDateRowRect (DateTime month, DateTime date) {
+ // first get the general rect of the supplied month
+ Size month_size = SingleMonthSize;
+ Rectangle month_rect = Rectangle.Empty;
+ for (int i=0; i < CalendarDimensions.Width*CalendarDimensions.Height; i++) {
+ DateTime this_month = this.current_month.AddMonths (i);
+ if (month.Year == this_month.Year && month.Month == this_month.Month) {
+ month_rect = new Rectangle (
+ this.ClientRectangle.X + 1 + (month_size.Width * (i%CalendarDimensions.Width)) + (this.calendar_spacing.Width * (i%CalendarDimensions.Width)),
+ this.ClientRectangle.Y + 1 + (month_size.Height * (i/CalendarDimensions.Width)) + (this.calendar_spacing.Height * (i/CalendarDimensions.Width)),
+ month_size.Width,
+ month_size.Height);
+ break;
+ }
+ }
+ // now find out where in the month the supplied date is
+ if (month_rect == Rectangle.Empty) {
+ return Rectangle.Empty;
+ }
+ // find out which row this date is in
+ int row = -1;
+ DateTime first_date = GetFirstDateInMonthGrid (month);
+ DateTime end_date = first_date.AddDays (7);
+ for (int i=0; i < 6; i++) {
+ if (date >= first_date && date < end_date) {
+ row = i;
+ break;
+ }
+ first_date = end_date;
+ end_date = end_date.AddDays (7);
+ }
+ // ensure it's a valid row
+ if (row < 0) {
+ return Rectangle.Empty;
+ }
+ int x_offset = (this.ShowWeekNumbers) ? date_cell_size.Width : 0;
+ int y_offset = title_size.Height + (date_cell_size.Height * (row + 1));
+ return new Rectangle (
+ month_rect.X + x_offset,
+ month_rect.Y + y_offset,
+ date_cell_size.Width * 7,
+ date_cell_size.Height);
+ }
+
+ internal void Draw (Rectangle clip_rect, Graphics dc)
+ {
+ ThemeEngine.Current.DrawMonthCalendar (dc, clip_rect, this);
+ }
+
+ #endregion //internal methods
+
+ #region internal drawing methods
+
+
+ #endregion // internal drawing methods
+
+ #region inner classes and enumerations
+
+ // enumeration about what type of area on the calendar was hit
+ public enum HitArea {
+ Nowhere,
+ TitleBackground,
+ TitleMonth,
+ TitleYear,
+ NextMonthButton,
+ PrevMonthButton,
+ CalendarBackground,
+ Date,
+ NextMonthDate,
+ PrevMonthDate,
+ DayOfWeek,
+ WeekNumbers,
+ TodayLink
+ }
+
+ // info regarding to a hit test on this calendar
+ public sealed class HitTestInfo {
+
+ private HitArea hit_area;
+ private Point point;
+ private DateTime time;
+
+ // default constructor
+ internal HitTestInfo () {
+ hit_area = HitArea.Nowhere;
+ point = new Point (0, 0);
+ time = DateTime.Now;
+ }
+
+ // overload receives all properties
+ internal HitTestInfo (HitArea hit_area, Point point, DateTime time) {
+ this.hit_area = hit_area;
+ this.point = point;
+ this.time = time;
+ }
+
+ // the type of area that was hit
+ public HitArea HitArea {
+ get {
+ return hit_area;
+ }
+ }
+
+ // the point that is being test
+ public Point Point {
+ get {
+ return point;
+ }
+ }
+
+ // the date under the hit test point, only valid if HitArea is Date
+ public DateTime Time {
+ get {
+ return time;
+ }
+ }
+ }
+
+ #endregion // inner classes
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MouseButtons.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MouseButtons.cs
new file mode 100644
index 00000000000..7c73ec3a3d8
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MouseButtons.cs
@@ -0,0 +1,42 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+// COMPLETE
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [Flags]
+ [ComVisible(true)]
+ public enum MouseButtons {
+ None = 0x00000000,
+ Left = 0x00100000,
+ Right = 0x00200000,
+ Middle = 0x00400000,
+ XButton1 = 0x00800000,
+ XButton2 = 0x01000000
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MouseEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MouseEventArgs.cs
new file mode 100644
index 00000000000..138d64d988e
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MouseEventArgs.cs
@@ -0,0 +1,82 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [ComVisible(true)]
+ public class MouseEventArgs : EventArgs {
+ private MouseButtons buttons;
+ private int clicks;
+ private int delta;
+ private int x;
+ private int y;
+
+ #region Public Constructors
+ public MouseEventArgs(MouseButtons buttons, int clicks, int x, int y, int delta) {
+ this.buttons=buttons;
+ this.clicks=clicks;
+ this.delta=delta;
+ this.x=x;
+ this.y=y;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public MouseButtons Button {
+ get {
+ return this.buttons;
+ }
+ }
+
+ public int Clicks {
+ get {
+ return this.clicks;
+ }
+ }
+
+ public int Delta {
+ get {
+ return this.delta;
+ }
+ }
+
+ public int X {
+ get {
+ return this.x;
+ }
+ }
+
+ public int Y {
+ get {
+ return this.y;
+ }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MouseEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MouseEventHandler.cs
new file mode 100644
index 00000000000..9ba33c20f44
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MouseEventHandler.cs
@@ -0,0 +1,32 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public delegate void MouseEventHandler (object sender, MouseEventArgs e);
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NativeWindow.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NativeWindow.cs
new file mode 100644
index 00000000000..6811b434778
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NativeWindow.cs
@@ -0,0 +1,167 @@
+// 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.
+//
+// Authors:
+// Peter Dennis Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+#define ExternalExceptionHandler
+
+using System.Runtime.Remoting;
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+using System.Collections;
+using System.Diagnostics;
+
+namespace System.Windows.Forms
+{
+ public class NativeWindow : MarshalByRefObject {
+ internal IntPtr window_handle;
+ static internal Hashtable window_collection = new Hashtable();
+
+ #region Public Constructors
+ public NativeWindow() {
+ window_handle=IntPtr.Zero;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public IntPtr Handle {
+ get {
+ return window_handle;
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Static Methods
+ public static NativeWindow FromHandle(IntPtr handle) {
+ NativeWindow window=new NativeWindow();
+
+ window.AssignHandle(handle);
+ return window;
+ }
+ #endregion // Public Static Methods
+
+ #region Private and Internal Methods
+ internal static NativeWindow FindWindow(IntPtr handle) {
+ return (NativeWindow)window_collection[handle];
+ }
+
+ internal void InvalidateHandle() {
+ window_collection.Remove(window_handle);
+ window_handle = IntPtr.Zero;
+ }
+ #endregion
+
+ #region Public Instance Methods
+ public void AssignHandle(IntPtr handle) {
+ if (window_handle != IntPtr.Zero) {
+ window_collection.Remove(window_handle);
+ }
+ window_handle=handle;
+ window_collection.Add(window_handle, this);
+ OnHandleChange();
+ }
+
+ public virtual void CreateHandle(CreateParams create_params) {
+ if (create_params != null) {
+ window_handle=XplatUI.CreateWindow(create_params);
+
+ if (window_handle != IntPtr.Zero) {
+ window_collection.Add(window_handle, this);
+ }
+ }
+ }
+
+ public void DefWndProc(ref Message m) {
+ m.Result=XplatUI.DefWndProc(ref m);
+ }
+
+ public virtual void DestroyHandle() {
+ if (window_handle != IntPtr.Zero) {
+ XplatUI.DestroyWindow(window_handle);
+ }
+ }
+
+ public virtual void ReleaseHandle() {
+ window_collection.Remove(window_handle);
+ window_handle=IntPtr.Zero;
+ OnHandleChange();
+ }
+
+ #endregion // Public Instance Methods
+
+ #region Protected Instance Methods
+ ~NativeWindow() {
+ }
+
+ protected virtual void OnHandleChange() {
+ }
+
+ protected virtual void OnThreadException(Exception e) {
+ Application.OnThreadException(e);
+ }
+
+ protected virtual void WndProc(ref Message m) {
+ DefWndProc(ref m);
+ }
+
+ internal static IntPtr WndProc(IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) {
+ Message m = new Message();
+ NativeWindow window = null;
+
+ #if !ExternalExceptionHandler
+ try {
+ #endif
+ window = (NativeWindow)window_collection[hWnd];
+ m.HWnd=hWnd;
+ m.Msg=(int)msg;
+ m.WParam=wParam;
+ m.LParam=lParam;
+ m.Result=IntPtr.Zero;
+
+ if (window != null) {
+ window.WndProc(ref m);
+ } else {
+ m.Result=XplatUI.DefWndProc(ref m);
+ }
+ #if !ExternalExceptionHandler
+ }
+
+ catch(System.Exception ex) {
+ if (window != null) {
+ window.OnThreadException(ex);
+ }
+ }
+ #endif
+
+ #if debug
+ Console.WriteLine("NativeWindow.cs: Message {0}, result {1}", msg, m.Result);
+ #endif
+
+ return m.Result;
+ }
+ #endregion // Protected Instance Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NavigateEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NavigateEventArgs.cs
new file mode 100644
index 00000000000..77985888c8e
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NavigateEventArgs.cs
@@ -0,0 +1,52 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [ComVisible(true)]
+ public class NavigateEventArgs : EventArgs {
+ #region Local Variables
+ private bool forward;
+ #endregion // Local Variables
+
+ #region Public Constructors
+ public NavigateEventArgs(bool isForward) {
+ forward = isForward;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public bool Forward {
+ get {
+ return forward;
+ }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NavigateEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NavigateEventHandler.cs
new file mode 100644
index 00000000000..b68bf5f6d2c
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NavigateEventHandler.cs
@@ -0,0 +1,32 @@
+// 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) 2005 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public delegate void NavigateEventHandler (object sender, NavigateEventArgs ne);
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NodeLabelEditEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NodeLabelEditEventArgs.cs
new file mode 100644
index 00000000000..9f2461598d3
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NodeLabelEditEventArgs.cs
@@ -0,0 +1,61 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+
+using System;
+
+namespace System.Windows.Forms {
+
+ public class NodeLabelEditEventArgs : EventArgs {
+
+ private TreeNode node;
+ private string label;
+ private bool cancel;
+
+ public NodeLabelEditEventArgs (TreeNode node)
+ {
+ this.node = node;
+ }
+
+ public NodeLabelEditEventArgs (TreeNode node, string label) : this (node)
+ {
+ this.label = label;
+ }
+
+ public bool CancelEdit {
+ get { return cancel; }
+ set { cancel = value; }
+ }
+
+ public TreeNode Node {
+ get { return node; }
+ }
+
+ public string Label {
+ get { return label; }
+ }
+ }
+
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NodeLabelEditEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NodeLabelEditEventHandler.cs
new file mode 100644
index 00000000000..be4f65b4669
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NodeLabelEditEventHandler.cs
@@ -0,0 +1,33 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+
+using System;
+
+namespace System.Windows.Forms {
+
+ public delegate void NodeLabelEditEventHandler (object sender, NodeLabelEditEventArgs e);
+
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NotifyIcon.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NotifyIcon.cs
new file mode 100644
index 00000000000..decd1fb1756
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NotifyIcon.cs
@@ -0,0 +1,379 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+// NOT COMPLETE
+
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+ [DefaultProperty("Text")]
+ [DefaultEvent("MouseDown")]
+ [Designer ("System.Windows.Forms.Design.NotifyIconDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+ [ToolboxItemFilter("System.Windows.Forms", ToolboxItemFilterType.Allow)]
+ public sealed class NotifyIcon : System.ComponentModel.Component {
+ #region Local Variables
+ private ContextMenu context_menu;
+ private Icon icon;
+ private Bitmap icon_bitmap;
+ private string text;
+ private bool visible;
+ private NotifyIconWindow window;
+ private bool systray_active;
+ private ToolTip tooltip;
+ #endregion // Local Variables
+
+ #region NotifyIconWindow Class
+ internal class NotifyIconWindow : Control {
+ NotifyIcon owner;
+ Rectangle rect;
+
+ public NotifyIconWindow(NotifyIcon owner) {
+ this.owner = owner;
+ is_visible = false;
+ rect = new Rectangle(0, 0, 1, 1);
+
+ CreateControl();
+
+ Paint += new PaintEventHandler(HandlePaint);
+ SizeChanged += new EventHandler(HandleSizeChanged);
+
+ // Events that need to be sent to our parent
+ Click += new EventHandler(HandleClick);
+ DoubleClick += new EventHandler(HandleDoubleClick);
+ MouseDown +=new MouseEventHandler(HandleMouseDown);
+ MouseUp +=new MouseEventHandler(HandleMouseUp);
+ MouseMove +=new MouseEventHandler(HandleMouseMove);
+ ContextMenu = owner.context_menu;
+ }
+
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams cp;
+
+ cp = base.CreateParams;
+
+ cp.Parent = IntPtr.Zero;
+ cp.Style = (int)WindowStyles.WS_POPUP;
+ cp.Style |= (int)WindowStyles.WS_CLIPSIBLINGS;
+
+ cp.ExStyle = (int)(WindowStyles.WS_EX_TOOLWINDOW);
+
+ return cp;
+ }
+ }
+
+ protected override void WndProc(ref Message m) {
+ switch((Msg)m.Msg) {
+ case Msg.WM_NCPAINT: {
+ PaintEventArgs paint_event;
+
+ paint_event = XplatUI.PaintEventStart(Handle, false);
+ OnPaint(paint_event);
+ XplatUI.PaintEventEnd(Handle, false);
+ break;
+ }
+
+ case Msg.WM_USER: {
+ switch ((Msg)m.LParam.ToInt32()) {
+ case Msg.WM_LBUTTONDOWN: {
+ HandleMouseDown(this, new MouseEventArgs(MouseButtons.Left, 1, Control.MousePosition.X, Control.MousePosition.Y, 0));
+ return;
+ }
+
+ case Msg.WM_LBUTTONUP: {
+ HandleMouseUp(this, new MouseEventArgs(MouseButtons.Left, 1, Control.MousePosition.X, Control.MousePosition.Y, 0));
+ HandleClick(this, EventArgs.Empty);
+ return;
+ }
+
+ case Msg.WM_LBUTTONDBLCLK: {
+ HandleDoubleClick(this, EventArgs.Empty);
+ return;
+ }
+
+ case Msg.WM_MOUSEMOVE: {
+ HandleMouseMove(this, new MouseEventArgs(MouseButtons.None, 1, Control.MousePosition.X, Control.MousePosition.Y, 0));
+ return;
+ }
+
+ case Msg.WM_RBUTTONDOWN: {
+ HandleMouseDown(this, new MouseEventArgs(MouseButtons.Right, 1, Control.MousePosition.X, Control.MousePosition.Y, 0));
+ return;
+ }
+
+ case Msg.WM_RBUTTONUP: {
+ HandleMouseUp(this, new MouseEventArgs(MouseButtons.Right, 1, Control.MousePosition.X, Control.MousePosition.Y, 0));
+ HandleClick(this, EventArgs.Empty);
+ return;
+ }
+
+ case Msg.WM_RBUTTONDBLCLK: {
+ HandleDoubleClick(this, EventArgs.Empty);
+ return;
+ }
+ }
+ return;
+ }
+ }
+ base.WndProc (ref m);
+ }
+
+ internal void CalculateIconRect() {
+ if (owner != null && owner.icon != null) {
+ int x;
+ int y;
+ int size;
+
+ // Icons are always square. Try to center them in the window
+ if (ClientRectangle.Width < ClientRectangle.Height) {
+ size = ClientRectangle.Width;
+ } else {
+ size = ClientRectangle.Height;
+ }
+ x = this.ClientRectangle.Width / 2 - size / 2;
+ y = this.ClientRectangle.Height / 2 - size / 2;
+ rect = new Rectangle(x, y, size, size);
+
+ // Force our window to be square
+ if (Width != size) {
+ this.Width = size;
+ }
+
+ if (Height != size) {
+ this.Height = size;
+ }
+ }
+ }
+
+ private void HandlePaint(object sender, PaintEventArgs e) {
+ if (owner.icon != null) {
+ e.Graphics.FillRectangle(ThemeEngine.Current.ResPool.GetSolidBrush(SystemColors.Window), rect);
+ e.Graphics.DrawImage(owner.icon_bitmap, rect);
+
+ }
+ }
+
+ private void HandleSizeChanged(object sender, EventArgs e) {
+ CalculateIconRect();
+ }
+
+ private void HandleClick(object sender, EventArgs e) {
+ if (owner.Click != null) {
+ owner.Click(owner, e);
+ }
+ }
+
+ private void HandleDoubleClick(object sender, EventArgs e) {
+ if (owner.DoubleClick != null) {
+ owner.DoubleClick(owner, e);
+ }
+ }
+
+ private void HandleMouseDown(object sender, MouseEventArgs e) {
+ if (owner.MouseDown != null) {
+ owner.MouseDown(owner, e);
+ }
+ }
+
+ private void HandleMouseUp(object sender, MouseEventArgs e) {
+ if (owner.context_menu != null) {
+ owner.context_menu.Show(this, new Point(e.X, e.Y));
+ }
+
+ if (owner.MouseUp != null) {
+ owner.MouseUp(owner, e);
+ }
+ }
+
+ private void HandleMouseMove(object sender, MouseEventArgs e) {
+ if (owner.MouseMove != null) {
+ owner.MouseMove(owner, e);
+ }
+ }
+ }
+ #endregion // NotifyIconWindow Class
+
+ #region Public Constructors
+ public NotifyIcon() {
+ window = new NotifyIconWindow(this);
+ systray_active = false;
+ }
+
+ public NotifyIcon(System.ComponentModel.IContainer container) : this() {
+ }
+ #endregion // Public Constructors
+
+ #region Private Methods
+ private void ShowSystray(bool property_changed) {
+ if (property_changed) {
+ window.CalculateIconRect();
+ }
+
+ if (systray_active) {
+ if (property_changed) {
+ UpdateSystray();
+ }
+ return;
+ }
+
+ if (icon == null) {
+ return;
+ }
+
+ icon_bitmap = icon.ToBitmap();
+
+ systray_active = true;
+ XplatUI.SystrayAdd(window.Handle, text, icon, out tooltip);
+ }
+
+ private void HideSystray() {
+ if (!systray_active) {
+ return;
+ }
+
+ systray_active = false;
+ XplatUI.SystrayRemove(window.Handle, ref tooltip);
+ }
+
+ private void UpdateSystray() {
+ if (icon_bitmap != null) {
+ icon_bitmap.Dispose();
+ }
+
+ if (icon != null) {
+ icon_bitmap = icon.ToBitmap();
+ }
+
+ XplatUI.SystrayChange(window.Handle, text, icon, ref tooltip);
+ window.Invalidate();
+ }
+ #endregion // Private Methods
+
+ #region Public Instance Properties
+ [DefaultValue(null)]
+ public ContextMenu ContextMenu {
+ get {
+ return context_menu;
+ }
+
+ set {
+ if (context_menu != value) {
+ context_menu = value;
+ window.ContextMenu = value;
+ }
+ }
+ }
+
+ [Localizable(true)]
+ [DefaultValue(null)]
+ public Icon Icon {
+ get {
+ return icon;
+ }
+
+ set {
+ if (icon != value) {
+ icon = value;
+ ShowSystray(true);
+ }
+ }
+ }
+
+ [Localizable(true)]
+ public string Text {
+ get {
+ return text;
+ }
+
+ set {
+ if (text != value) {
+ if (value.Length >= 64) {
+ throw new ArgumentException("ToolTip length must be less than 64 characters long", "Text");
+ }
+ text = value;
+ if (text == string.Empty && icon == null) {
+ HideSystray();
+ } else {
+ ShowSystray(true);
+ }
+ }
+ }
+ }
+
+ [Localizable(true)]
+ [DefaultValue(false)]
+ public bool Visible {
+ get {
+ return visible;
+ }
+
+ set {
+ if (visible != value) {
+ visible = value;
+
+ // Let our control know, too
+ window.is_visible = value;
+
+ if (visible) {
+ ShowSystray(false);
+ } else {
+ HideSystray();
+ }
+ }
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Protected Instance Methods
+ protected override void Dispose(bool disposing) {
+ if (icon_bitmap != null) {
+ icon_bitmap.Dispose();
+ }
+
+ if (disposing)
+ icon = null;
+
+ base.Dispose (disposing);
+ }
+
+ #endregion // Protected Instance Methods
+
+ #region Events
+ [Category("Action")]
+ public event EventHandler Click;
+
+ [Category("Action")]
+ public event EventHandler DoubleClick;
+
+ public event MouseEventHandler MouseDown;
+ public event MouseEventHandler MouseMove;
+ public event MouseEventHandler MouseUp;
+ #endregion // Events
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NumericUpDown.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NumericUpDown.cs
new file mode 100644
index 00000000000..6af7dfda164
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NumericUpDown.cs
@@ -0,0 +1,463 @@
+// 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) 2005 Novell, Inc.
+//
+// Authors:
+// Jonathan Gilbert <logic@deltaq.org>
+//
+// Integration into MWF:
+// Peter Bartok <pbartok@novell.com>
+//
+
+// COMPLETE
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Drawing;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Windows.Forms;
+
+namespace System.Windows.Forms {
+ [DefaultEvent("ValueChanged")]
+ [DefaultProperty("Value")]
+ public class NumericUpDown : UpDownBase, ISupportInitialize {
+ #region Local Variables
+ private int suppress_validation;
+ private int decimal_places;
+ private bool hexadecimal;
+ private decimal increment;
+ private decimal maximum;
+ private decimal minimum;
+ private bool thousands_separator;
+ private decimal value;
+ #endregion // Local Variables
+
+ #region Public Constructors
+ public NumericUpDown() {
+ suppress_validation = 0;
+ decimal_places = 0;
+ hexadecimal = false;
+ increment = 1M;
+ maximum = 100.0M;
+ minimum = 0.0M;
+ thousands_separator = false;
+ }
+ #endregion // Public Constructors
+
+ #region Private Methods
+ void wide_number_multiply_by_10(int[] number) {
+ long carry = 0;
+
+ for (int i=0; i < number.Length; i++) {
+ long multiplication = unchecked(carry + 10 * (long)(uint)number[i]);
+
+ carry = multiplication >> 32;
+
+ number[i] = unchecked((int)multiplication);
+ }
+ }
+
+ void wide_number_multiply_by_16(int[] number) {
+ int carry = 0;
+
+ for (int i=0; i < number.Length; i++) {
+ int multiplication = unchecked(carry | (number[i] << 4));
+
+ carry = (number[i] >> 28) & 0x0F;
+
+ number[i] = multiplication;
+ }
+ }
+
+ void wide_number_divide_by_16(int[] number) {
+ int carry = 0;
+
+ for (int i=number.Length - 1; i >= 0; i--) {
+ int division = unchecked(carry | ((number[i] >> 4) & 0x0FFFFFFF));
+
+ carry = (number[i] << 28);
+
+ number[i] = division;
+ }
+ }
+
+ bool wide_number_less_than(int[] left, int[] right) {
+ unchecked {
+ for (int i=left.Length - 1; i >= 0; i--) {
+ uint leftvalue = (uint)left[i];
+ uint rightvalue = (uint)right[i];
+
+ if (leftvalue > rightvalue)
+ return false;
+ if (leftvalue < rightvalue)
+ return true;
+ }
+ }
+
+ // equal
+ return false;
+ }
+
+ void wide_number_subtract(int[] subtrahend, int[] minuend) {
+ long carry = 0;
+
+ unchecked {
+ for (int i=0; i < subtrahend.Length; i++) {
+ long subtrahendvalue = (uint)subtrahend[i];
+ long minuendvalue = (uint)minuend[i];
+
+ long result = subtrahendvalue - minuendvalue + carry;
+
+ if (result < 0) {
+ carry = -1;
+ result -= int.MinValue;
+ result -= int.MinValue;
+ }
+ else
+ carry = 0;
+
+ subtrahend[i] = unchecked((int)result);
+ }
+ }
+ }
+ #endregion // Private Methods
+
+ #region Public Instance Properties
+ [DefaultValue(0)]
+ public int DecimalPlaces {
+ get {
+ return decimal_places;
+ }
+
+ set {
+ decimal_places = value;
+ if (!UserEdit) {
+ UpdateEditText();
+ }
+ }
+ }
+
+ [DefaultValue(false)]
+ public bool Hexadecimal {
+ get {
+ return hexadecimal;
+ }
+
+ set {
+ hexadecimal = value;
+ if (!UserEdit) {
+ UpdateEditText();
+ }
+ }
+ }
+
+ public decimal Increment {
+ get {
+ return increment;
+ }
+
+ set {
+ if (value < 0) {
+ throw new ArgumentOutOfRangeException("value", value, "NumericUpDown increment cannot be negative");
+ }
+
+ increment = value;
+ }
+ }
+
+ [RefreshProperties(RefreshProperties.All)]
+ public decimal Maximum {
+ get {
+ return maximum;
+ }
+
+ set {
+ maximum = value;
+
+ if (minimum > maximum)
+ minimum = maximum;
+
+ if (value > maximum)
+ value = maximum;
+ }
+ }
+
+ [RefreshProperties(RefreshProperties.All)]
+ public decimal Minimum {
+ get {
+ return minimum;
+ }
+
+ set {
+ minimum = value;
+
+ if (maximum < minimum)
+ maximum = minimum;
+
+ if (value < minimum)
+ value = minimum;
+ }
+ }
+
+ [Bindable(false)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override string Text {
+ get {
+ return base.txtView.Text;
+ }
+
+ set {
+ base.txtView.Text = value;
+ }
+ }
+
+ [DefaultValue(false)]
+ [Localizable(true)]
+ public bool ThousandsSeparator {
+ get {
+ return thousands_separator;
+ }
+
+ set {
+ thousands_separator = value;
+
+ if (!UserEdit) {
+ UpdateEditText();
+ }
+ }
+ }
+
+ [Bindable(true)]
+ public decimal Value {
+ get {
+ return value;
+ }
+
+ set {
+ if (suppress_validation <= 0) {
+ if ((value < minimum) || (value > maximum)) {
+ throw new ArgumentException("NumericUpDown.Value must be within the specified Minimum and Maximum values", "value");
+ }
+ }
+
+ this.value = value;
+ OnValueChanged(EventArgs.Empty);
+ UpdateEditText();
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Instance Methods
+ public void BeginInit() {
+ suppress_validation++;
+ }
+
+ public override void DownButton() {
+ if (UserEdit) {
+ ParseEditText();
+ }
+
+ Value = Math.Max(minimum, unchecked(value - increment));
+ }
+
+ public void EndInit() {
+ suppress_validation--;
+ if (suppress_validation == 0)
+ UpdateEditText ();
+ }
+
+ public override string ToString() {
+ return string.Format("{0}: value {1} in range [{2}, {3}]", base.ToString(), value, minimum, maximum);
+ }
+
+ public override void UpButton() {
+ if (UserEdit)
+ ParseEditText();
+
+ Value = Math.Min(maximum, unchecked(value + increment));
+ }
+ #endregion // Public Instance Methods
+
+ #region Protected Instance Methods
+ protected override AccessibleObject CreateAccessibilityInstance() {
+ AccessibleObject acc;
+
+ acc = new AccessibleObject(this);
+ acc.role = AccessibleRole.SpinButton;
+
+ return acc;
+ }
+
+ protected override void OnTextBoxKeyPress(object source, KeyPressEventArgs e) {
+ if ((ModifierKeys & ~Keys.Shift) != Keys.None) {
+ return;
+ }
+
+ string acceptable = hexadecimal ? "\b-.,0123456789ABCDEF" : "\b-.,0123456789";
+
+ if (acceptable.IndexOf(e.KeyChar) < 0) {
+ // prevent the key from reaching the text box
+ e.Handled = true;
+ }
+
+ base.OnTextBoxKeyPress(source, e);
+ }
+
+ protected virtual void OnValueChanged(EventArgs e) {
+ if (ValueChanged != null) {
+ ValueChanged(this, e);
+ }
+ }
+
+ protected void ParseEditText() {
+ UserEdit = false;
+
+ try {
+ string user_edit_text = Text.Replace(",", "").Trim();
+
+ if (!hexadecimal) {
+ value = decimal.Parse(user_edit_text);
+ } else {
+ value = 0M;
+
+ for (int i=0; i < user_edit_text.Length; i++) {
+ int hex_digit = Convert.ToInt32(user_edit_text.Substring(i, 1), 16);
+
+ value = unchecked(value * 16M + (decimal)hex_digit);
+ }
+ }
+
+ if (value < minimum) {
+ value = minimum;
+ }
+
+ if (value > maximum) {
+ value = maximum;
+ }
+
+ OnValueChanged(EventArgs.Empty);
+ }
+ catch {}
+ }
+
+ protected override void UpdateEditText() {
+ if (suppress_validation > 0)
+ return;
+
+ if (UserEdit)
+ ParseEditText(); // validate user input
+
+ if (!hexadecimal) {
+ // "N" and "F" differ only in that "N" includes commas
+ // every 3 digits to the left of the decimal and "F"
+ // does not.
+
+ string format_string;
+
+ if (thousands_separator) {
+ format_string = "N";
+ } else {
+ format_string = "F";
+ }
+
+ format_string += decimal_places;
+
+ ChangingText = true;
+ Text = value.ToString(format_string);
+ }
+ else {
+ // Decimal.ToString doesn't know the "X" formatter, and
+ // converting it to an int is narrowing, so do it
+ // manually...
+
+ int[] bits = decimal.GetBits(value);
+
+ bool negative = (bits[3] < 0);
+
+ int scale = (bits[3] >> 16) & 0x1F;
+
+ bits[3] = 0;
+
+ int[] radix = new int[4];
+
+ radix[0] = 1;
+
+ for (int i=0; i < scale; i++)
+ wide_number_multiply_by_10(radix);
+
+ int num_chars = 0;
+
+ while (!wide_number_less_than(bits, radix)) {
+ num_chars++;
+ wide_number_multiply_by_16(radix);
+ }
+
+ if (num_chars == 0) {
+ ChangingText = true;
+ Text = "0";
+ return;
+ }
+
+ StringBuilder chars = new StringBuilder();
+
+ if (negative)
+ chars.Append('-');
+
+ for (int i=0; i < num_chars; i++) {
+ int digit = 0;
+
+ wide_number_divide_by_16(radix);
+
+ while (!wide_number_less_than(bits, radix)) { // greater than or equals
+ digit++;
+ wide_number_subtract(bits, radix);
+ }
+
+ if (digit < 10) {
+ chars.Append((char)('0' + digit));
+ } else {
+ chars.Append((char)('A' + digit - 10));
+ }
+ }
+
+ ChangingText = true;
+ Text = chars.ToString();
+ }
+ }
+
+ protected override void ValidateEditText() {
+ ParseEditText();
+ UpdateEditText();
+ }
+ #endregion // Protected Instance Methods
+
+ #region Events
+ public event EventHandler ValueChanged;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler TextChanged;
+ #endregion // Events
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/OSFeature.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/OSFeature.cs
new file mode 100644
index 00000000000..3de949aa8a1
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/OSFeature.cs
@@ -0,0 +1,63 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public class OSFeature : FeatureSupport {
+ #region Local Variables
+ private static OSFeature feature = new OSFeature();
+ #endregion // Local Variables
+
+ #region Protected Constructors
+ protected OSFeature() {
+
+ }
+ #endregion // Protected Constructors
+
+ #region Public Static Fields
+ public static readonly object LayeredWindows;
+ public static readonly object Themes;
+ #endregion // Public Static Fields
+
+ #region Public Static Properties
+ public static OSFeature Feature {
+ get {
+ return feature;
+ }
+ }
+ #endregion // Public Static Properties
+
+ #region Public Instance Methods
+ public override Version GetVersionPresent(object feature) {
+ if (feature == Themes) {
+ return ThemeEngine.Current.Version;
+ }
+ return null;
+ }
+ #endregion // Public Instance Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/OSXStructs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/OSXStructs.cs
new file mode 100644
index 00000000000..c26542a5efd
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/OSXStructs.cs
@@ -0,0 +1,514 @@
+// 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) 2005 Novell, Inc.
+//
+// Authors:
+// Geoff Norton <gnorton@customerdna.com>
+//
+
+
+// NOT COMPLETE
+
+using System;
+using System.ComponentModel;
+using System.Collections;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+
+/// Mac OSX Version
+namespace System.Windows.Forms {
+
+ internal class OSXConstants {
+
+ #region EventClass constants
+ internal const uint kEventClassMouse = 1836021107;
+ internal const uint kEventClassKeyboard = 1801812322;
+ internal const uint kEventClassTextInput = 1952807028;
+ internal const uint kEventClassApplication = 1634758764;
+ internal const uint kEventClassAppleEvent = 1701867619;
+ internal const uint kEventClassMenu = 1835363957;
+ internal const uint kEventClassWindow = 2003398244;
+ internal const uint kEventClassControl = 1668183148;
+ internal const uint kEventClassCommand = 1668113523;
+ internal const uint kEventClassTablet = 1952607348;
+ internal const uint kEventClassVolume = 1987013664;
+ internal const uint kEventClassAppearance = 1634758765;
+ internal const uint kEventClassService = 1936028278;
+ internal const uint kEventClassToolbar = 1952604530;
+ internal const uint kEventClassToolbarItem = 1952606580;
+ internal const uint kEventClassAccessibility = 1633903461;
+ #endregion
+
+ #region kEventClassMouse constants
+ internal const uint kEventMouseDown = 1;
+ internal const uint kEventMouseUp = 2;
+ internal const uint kEventMouseMoved = 5;
+ internal const uint kEventMouseDragged = 6;
+ internal const uint kEventMouseEntered = 8;
+ internal const uint kEventMouseExited = 9;
+ internal const uint kEventMouseWheelMoved = 10;
+ #endregion
+
+ #region kEventClassKeyboard constants
+ internal const uint kEventRawKeyDown = 1;
+ internal const uint kEventRawKeyRepeat = 2;
+ internal const uint kEventRawKeyUp = 3;
+ internal const uint kEventRawKeyModifiersChanged = 4;
+ internal const uint kEventHotKeyPressed = 5;
+ internal const uint kEventHotKeyReleased = 6;
+ #endregion
+
+ #region kEventClassTextInput constants
+ // TODO: We dont use these yet; fill if needed
+ #endregion
+
+ #region kEventClassApplication constants
+ // TODO: We dont use these yet; fill if needed
+ #endregion
+
+ #region kEventClassAppleEvent constants
+ // TODO: We dont use these yet; fill if needed
+ #endregion
+
+ #region kEventClassMenu constants
+ // TODO: We dont use these yet; fill if needed
+ #endregion
+
+ #region kEventClassWindow constants
+ internal const uint kEventWindowUpdate = 1;
+ internal const uint kEventWindowDrawContent = 2;
+ internal const uint kEventWindowActivated = 5;
+ internal const uint kEventWindowDeactivated = 6;
+ internal const uint kEventWindowGetClickActivation = 7;
+ internal const uint kEventWindowShowing = 22;
+ internal const uint kEventWindowHiding = 23;
+ internal const uint kEventWindowShown = 24;
+ internal const uint kEventWindowHidden = 25;
+ internal const uint kEventWindowCollapsing = 86;
+ internal const uint kEventWindowExpanding = 87;
+ internal const uint kEventWindowZoomed = 76;
+ internal const uint kEventWindowBoundsChanging = 26;
+ internal const uint kEventWindowBoundsChanged = 27;
+ internal const uint kEventWindowResizeStarted = 28;
+ internal const uint kEventWindowResizeCompleted = 29;
+ internal const uint kEventWindowDragStarted = 30;
+ internal const uint kEventWindowDragCompleted = 31;
+ internal const uint kEventWindowTransitionStarted = 88;
+ internal const uint kEventWindowTransitionCompleted = 89;
+ internal const uint kEventWindowClickDragRgn = 32;
+ internal const uint kEventWindowClickResizeRgn = 33;
+ internal const uint kEventWindowClickCollapseRgn = 34;
+ internal const uint kEventWindowClickCloseRgn = 35;
+ internal const uint kEventWindowClickZoomRgn = 36;
+ internal const uint kEventWindowClickContentRgn = 37;
+ internal const uint kEventWindowClickProxyIconRgn = 38;
+ internal const uint kEventWindowClickToolbarButtonRgn = 41;
+ internal const uint kEventWindowClickStructureRgn = 42;
+ internal const uint kEventWindowCursorChange = 40;
+ internal const uint kEventWindowCollapse = 66;
+ internal const uint kEventWindowCollapsed = 67;
+ internal const uint kEventWindowCollapseAll = 68;
+ internal const uint kEventWindowExpand = 69;
+ internal const uint kEventWindowExpanded = 70;
+ internal const uint kEventWindowExpandAll = 71;
+ internal const uint kEventWindowClose = 72;
+ internal const uint kEventWindowClosed = 73;
+ internal const uint kEventWindowCloseAll = 74;
+ internal const uint kEventWindowZoom = 75;
+ internal const uint kEventWindowZoomAll = 77;
+ internal const uint kEventWindowContextualMenuSelect = 78;
+ internal const uint kEventWindowPathSelect = 79;
+ internal const uint kEventWindowGetIdealSize = 80;
+ internal const uint kEventWindowGetMinimumSize = 81;
+ internal const uint kEventWindowGetMaximumSize = 82;
+ internal const uint kEventWindowConstrain = 83;
+ internal const uint kEventWindowHandleContentClick = 85;
+ internal const uint kEventWindowGetDockTileMenu = 90;
+ internal const uint kEventWindowHandleActivate = 91;
+ internal const uint kEventWindowHandleDeactivate = 92;
+ internal const uint kEventWindowProxyBeginDrag = 128;
+ internal const uint kEventWindowProxyEndDrag = 129;
+ internal const uint kEventWindowToolbarSwitchMode = 150;
+ internal const uint kEventWindowFocusAcquired = 200;
+ internal const uint kEventWindowFocusRelinquish = 201;
+ internal const uint kEventWindowFocusContent = 202;
+ internal const uint kEventWindowFocusToolbar = 203;
+ internal const uint kEventWindowDrawerOpening = 220;
+ internal const uint kEventWindowDrawerOpened = 221;
+ internal const uint kEventWindowDrawerClosing = 222;
+ internal const uint kEventWindowDrawerClosed = 223;
+ internal const uint kEventWindowDrawFrame = 1000;
+ internal const uint kEventWindowDrawPart = 1001;
+ internal const uint kEventWindowGetRegion = 1002;
+ internal const uint kEventWindowHitTest = 1003;
+ internal const uint kEventWindowInit = 1004;
+ internal const uint kEventWindowDispose = 1005;
+ internal const uint kEventWindowDragHilite = 1006;
+ internal const uint kEventWindowModified = 1007;
+ internal const uint kEventWindowSetupProxyDragImage = 1008;
+ internal const uint kEventWindowStateChanged = 1009;
+ internal const uint kEventWindowMeasureTitle = 1010;
+ internal const uint kEventWindowDrawGrowBox = 1011;
+ internal const uint kEventWindowGetGrowImageRegion = 1012;
+ internal const uint kEventWindowPaint = 1013;
+ #endregion
+
+ #region kEventClassControl constants
+ internal const uint kEventControlInitialize = 1000;
+ internal const uint kEventControlDispose = 1001;
+ internal const uint kEventControlGetOptimalBounds = 1003;
+ internal const uint kEventControlDefInitialize = kEventControlInitialize;
+ internal const uint kEventControlDefDispose = kEventControlDispose;
+ internal const uint kEventControlHit = 1;
+ internal const uint kEventControlSimulateHit = 2;
+ internal const uint kEventControlHitTest = 3;
+ internal const uint kEventControlDraw = 4;
+ internal const uint kEventControlApplyBackground = 5;
+ internal const uint kEventControlApplyTextColor = 6;
+ internal const uint kEventControlSetFocusPart = 7;
+ internal const uint kEventControlGetFocusPart = 8;
+ internal const uint kEventControlActivate = 9;
+ internal const uint kEventControlDeactivate = 10;
+ internal const uint kEventControlSetCursor = 11;
+ internal const uint kEventControlContextualMenuClick = 12;
+ internal const uint kEventControlClick = 13;
+ internal const uint kEventControlGetNextFocusCandidate = 14;
+ internal const uint kEventControlGetAutoToggleValue = 15;
+ internal const uint kEventControlInterceptSubviewClick = 16;
+ internal const uint kEventControlGetClickActivation = 17;
+ internal const uint kEventControlDragEnter = 18;
+ internal const uint kEventControlDragWithin = 19;
+ internal const uint kEventControlDragLeave = 20;
+ internal const uint kEventControlDragReceive = 21;
+ internal const uint kEventControlInvalidateForSizeChange = 22;
+ internal const uint kEventControlTrackingAreaEntered = 23;
+ internal const uint kEventControlTrackingAreaExited = 24;
+ internal const uint kEventControlTrack = 51;
+ internal const uint kEventControlGetScrollToHereStartPoint = 52;
+ internal const uint kEventControlGetIndicatorDragConstraint = 53;
+ internal const uint kEventControlIndicatorMoved = 54;
+ internal const uint kEventControlGhostingFinished = 55;
+ internal const uint kEventControlGetActionProcPart = 56;
+ internal const uint kEventControlGetPartRegion = 101;
+ internal const uint kEventControlGetPartBounds = 102;
+ internal const uint kEventControlSetData = 103;
+ internal const uint kEventControlGetData = 104;
+ internal const uint kEventControlGetSizeConstraints= 105;
+ internal const uint kEventControlGetFrameMetrics = 106;
+ internal const uint kEventControlValueFieldChanged = 151;
+ internal const uint kEventControlAddedSubControl = 152;
+ internal const uint kEventControlRemovingSubControl = 153;
+ internal const uint kEventControlBoundsChanged = 154;
+ internal const uint kEventControlVisibilityChanged = 157;
+ internal const uint kEventControlTitleChanged = 158;
+ internal const uint kEventControlOwningWindowChanged = 159;
+ internal const uint kEventControlHiliteChanged = 160;
+ internal const uint kEventControlEnabledStateChanged = 161;
+ internal const uint kEventControlLayoutInfoChanged = 162;
+ internal const uint kEventControlArbitraryMessage = 201;
+ #endregion
+
+ #region kEventClassCommand constants
+ // TODO: We dont use these yet; fill if needed
+ #endregion
+
+ #region kEventClassTablet constants
+ // TODO: We dont use these yet; fill if needed
+ #endregion
+
+ #region kEventClassVolume constants
+ // TODO: We dont use these yet; fill if needed
+ #endregion
+
+ #region kEventClassAppearance constants
+ // TODO: We dont use these yet; fill if needed
+ #endregion
+
+ #region kEventClassService constants
+ // TODO: We dont use these yet; fill if needed
+ #endregion
+
+ #region kEventClassToolbar constants
+ // TODO: We dont use these yet; fill if needed
+ #endregion
+
+ #region kEventClassToolbarItem constants
+ // TODO: We dont use these yet; fill if needed
+ #endregion
+
+ #region kEventClassAccessibility constants
+ // TODO: We dont use these yet; fill if needed
+ #endregion
+
+ #region kEventParam constants
+
+ internal enum EventParamName : uint {
+ // source: /System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/Headers/CarbonEvents.h
+
+ /* Keyboard event parameter and types*/
+ kEventParamKeyMacCharCodes = 1801676914, // 'kchr'
+
+ /* Mouse event parameters and types*/
+ kEventParamMouseLocation = 1835822947, // 'mloc', /* typeHIPoint*/
+ kEventParamMouseButton = 1835168878, // 'mbtn' /* type MouseButton*/
+
+ /* Generic toolbox parameters and types */
+ kEventParamCGContextRef = 1668183160, // 'cntx' /* typeCGContextRef*/
+ kEventParamRgnHandle = 1919381096, // 'rgnh'
+
+ /* Control event parameters and types */
+ kEventParamControlPart = 1668313716, // 'cprt' /* typeControlPartCode*/
+
+ // source: /System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/Headers/CarbonEventsCore.h
+ /* Core Event Types */
+ kEventParamDirectObject = 757935405, // '----' /* type varies depending on event*/
+ }
+
+ internal enum EventParamType : uint {
+
+ typeControlPartCode = 1668313716, // 'cprt' /* ControlPartCode*/
+
+ typeQDPoint = 1363439732, // 'QDpt'
+
+ typeControlRef = 1668575852, // 'ctrl'
+
+ typeCGContextRef = 1668183160, // 'cntx' /* CGContextRef*/
+
+ typeMouseButton = 1835168878, // 'mbtn' /* EventMouseButton*/
+
+ typeQDRgnHandle = 1919381096, // 'rgnh'
+
+ typeChar = 1413830740, // 'TEXT'
+ }
+
+ #endregion
+ }
+
+ internal enum WindowClass : uint {
+ kAlertWindowClass = 1,
+ kMovableAlertWindowClass = 2,
+ kModalWindowClass = 3,
+ kMovableModalWindowClass = 4,
+ kFloatingWindowClass = 5,
+ kDocumentWindowClass = 6,
+ kUtilityWindowClass = 8,
+ kHelpWindowClass = 10,
+ kSheetWindowClass = 11,
+ kToolbarWindowClass = 12,
+ kPlainWindowClass = 13,
+ kOverlayWindowClass = 14,
+ kSheetAlertWindowClass = 15,
+ kAltPlainWindowClass = 16,
+ kDrawerWindowClass = 20,
+ kAllWindowClasses = 0xFFFFFFFF
+ }
+
+ internal enum WindowAttributes : uint {
+ kWindowNoAttributes = 0,
+ kWindowCloseBoxAttribute = (1u << 0),
+ kWindowHorizontalZoomAttribute = (1u << 1),
+ kWindowVerticalZoomAttribute = (1u << 2),
+ kWindowFullZoomAttribute = (kWindowVerticalZoomAttribute | kWindowHorizontalZoomAttribute),
+ kWindowCollapseBoxAttribute = (1u << 3),
+ kWindowResizableAttribute = (1u << 4),
+ kWindowSideTitlebarAttribute = (1u << 5),
+ kWindowToolbarButtonAttribute = (1u << 6),
+ kWindowMetalAttribute = (1u << 8),
+ kWindowNoUpdatesAttribute = (1u << 16),
+ kWindowNoActivatesAttribute = (1u << 17),
+ kWindowOpaqueForEventsAttribute = (1u << 18),
+ kWindowCompositingAttribute = (1u << 19),
+ kWindowNoShadowAttribute = (1u << 21),
+ kWindowHideOnSuspendAttribute = (1u << 24),
+ kWindowStandardHandlerAttribute = (1u << 25),
+ kWindowHideOnFullScreenAttribute = (1u << 26),
+ kWindowInWindowMenuAttribute = (1u << 27),
+ kWindowuiveResizeAttribute = (1u << 28),
+ kWindowIgnoreClicksAttribute = (1u << 29),
+ kWindowNoConstrainAttribute = (1u << 31),
+ kWindowStandardDocumentAttributes = (kWindowCloseBoxAttribute | kWindowFullZoomAttribute | kWindowCollapseBoxAttribute | kWindowResizableAttribute),
+ kWindowStandardFloatingAttributes = (kWindowCloseBoxAttribute | kWindowCollapseBoxAttribute)
+ }
+ internal enum ThemeCursor : uint {
+ kThemeArrowCursor = 0,
+ kThemeCopyArrowCursor = 1,
+ kThemeAliasArrowCursor = 2,
+ kThemeContextualMenuArrowCursor = 3,
+ kThemeIBeamCursor = 4,
+ kThemeCrossCursor = 5,
+ kThemePlusCursor = 6,
+ kThemeWatchCursor = 7,
+ kThemeClosedHandCursor = 8,
+ kThemeOpenHandCursor = 9,
+ kThemePointingHandCursor = 10,
+ kThemeCountingUpHandCursor = 11,
+ kThemeCountingDownHandCursor = 12,
+ kThemeCountingUpAndDownHandCursor = 13,
+ kThemeSpinningCursor = 14,
+ kThemeResizeLeftCursor = 15,
+ kThemeResizeRightCursor = 16,
+ kThemeResizeLeftRightCursor = 17,
+ kThemeNotAllowedCursor = 18
+ }
+
+ internal struct CGSize {
+ public float width;
+ public float height;
+
+ public CGSize (int w, int h) {
+ this.width = (float)w;
+ this.height = (float)h;
+ }
+ }
+
+ internal struct QDPoint {
+ public short y;
+ public short x;
+
+ public QDPoint (short x, short y) {
+ this.x = x;
+ this.y = y;
+ }
+ }
+ internal struct CGPoint {
+ public float x;
+ public float y;
+
+ public CGPoint (int x, int y) {
+ this.x = (float)x;
+ this.y = (float)y;
+ }
+ }
+
+ internal struct HIRect {
+ public CGPoint origin;
+ public CGSize size;
+
+ public HIRect (int x, int y, int w, int h) {
+ this.origin = new CGPoint (x, y);
+ this.size = new CGSize (w, h);
+ }
+ }
+
+ internal struct HIViewID {
+ public uint type;
+ public uint id;
+
+ public HIViewID (uint type, uint id) {
+ this.type = type;
+ this.id = id;
+ }
+ }
+
+ internal struct EventTypeSpec
+ {
+ public UInt32 eventClass;
+ public UInt32 eventKind;
+
+ public EventTypeSpec (UInt32 eventClass, UInt32 eventKind)
+ {
+ this.eventClass = eventClass;
+ this.eventKind = eventKind;
+ }
+ }
+
+ internal struct CarbonEvent
+ {
+ public IntPtr hWnd;
+ public IntPtr evt;
+
+ public CarbonEvent (IntPtr hWnd, IntPtr evt)
+ {
+ this.hWnd = hWnd;
+ this.evt = evt;
+ }
+ }
+
+ internal struct RGBColor
+ {
+ public short red;
+ public short green;
+ public short blue;
+ }
+
+ internal struct Rect
+ {
+ public short top;
+ public short left;
+ public short bottom;
+ public short right;
+ }
+
+ internal struct OSXCaret
+ {
+ internal Timer Timer;
+ internal IntPtr Hwnd;
+ internal int X;
+ internal int Y;
+ internal int Width;
+ internal int Height;
+ internal int Visible;
+ internal bool On;
+ internal bool Paused;
+ }
+
+ internal struct OSXHover {
+ internal Timer Timer;
+ internal IntPtr Hwnd;
+ internal int X;
+ internal int Y;
+ internal int Interval;
+ }
+
+ internal struct CGAffineTransform
+ {
+ internal float a;
+ internal float b;
+ internal float c;
+ internal float d;
+ internal float tx;
+ internal float ty;
+ }
+
+ internal enum MouseTrackingResult : ushort
+ {
+ kMouseTrackingMouseDown = 1,
+ kMouseTrackingMouseUp = 2,
+ kMouseTrackingMouseExited = 3,
+ kMouseTrackingMouseEntered = 4,
+ kMouseTrackingMouseDragged = 5,
+ kMouseTrackingKeyModifiersChanged = 6,
+ kMouseTrackingUserCancelled = 7,
+ kMouseTrackingTimedOut = 8,
+ kMouseTrackingMouseMoved = 9
+ }
+
+ internal struct MouseTrackingRegionID
+ {
+ uint signature;
+ uint id;
+
+ public MouseTrackingRegionID (uint signature, uint id) {
+ this.signature = signature;
+ this.id = id;
+ }
+ }
+
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/OpacityConverter.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/OpacityConverter.cs
new file mode 100644
index 00000000000..b4acde1289c
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/OpacityConverter.cs
@@ -0,0 +1,74 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Globalization;
+using System.Text;
+
+namespace System.Windows.Forms {
+ public class OpacityConverter : TypeConverter {
+ #region Public Constructors
+ public OpacityConverter() {
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Methods
+ public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) {
+ if (sourceType == typeof(string)) {
+ return true;
+ }
+ return false;
+ }
+
+ public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) {
+ if (value is string) {
+ string s;
+
+ s = (string)value;
+ if (s.EndsWith("%")) {
+ s = ((string)value).Substring(0, ((string)value).Length - 1);
+ }
+ return Double.Parse(s, NumberStyles.Any, culture) / 100;
+ }
+ return base.ConvertFrom (context, culture, value);
+ }
+
+ public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) {
+ if (destinationType == typeof(string)) {
+ double v;
+
+ v = ((double)value) * 100;
+ return v.ToString() + "%";
+ }
+ return base.ConvertTo (context, culture, value, destinationType);
+ }
+ #endregion // Public Instance Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/OpenFileDialog.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/OpenFileDialog.cs
new file mode 100644
index 00000000000..b4c02410755
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/OpenFileDialog.cs
@@ -0,0 +1,140 @@
+// 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-2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//
+// Alexander Olk xenomorph2@onlinehome.de
+//
+
+// NOT COMPLETE - work in progress
+
+using System;
+using System.ComponentModel;
+using System.Drawing;
+using System.IO;
+
+namespace System.Windows.Forms
+{
+ [Designer("System.Windows.Forms.Design.OpenFileDialogDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+ public sealed class OpenFileDialog : FileDialog
+ {
+ #region Public Constructors
+ public OpenFileDialog( )
+ {
+ form.Text = "Open";
+
+ form.Size = new Size( 554, 405 ); // 384
+
+ OpenSaveButtonText = "Open";
+
+ SearchSaveLabelText = "Search in:";
+
+ checkFileExists = true;
+
+ fileDialogType = FileDialogType.OpenFileDialog;
+
+ fileDialogPanel = new FileDialogPanel( this );
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ [DefaultValue(true)]
+ public override bool CheckFileExists
+ {
+ get
+ {
+ return checkFileExists;
+ }
+
+ set
+ {
+ checkFileExists = value;
+ }
+ }
+
+ [DefaultValue(false)]
+ public new bool Multiselect
+ {
+ get
+ {
+ return multiSelect;
+ }
+
+ set
+ {
+ base.Multiselect = value;
+ }
+ }
+
+ [DefaultValue(false)]
+ public new bool ReadOnlyChecked
+ {
+ get
+ {
+ return readOnlyChecked;
+ }
+
+ set
+ {
+ base.ReadOnlyChecked = value;
+ }
+ }
+
+ [DefaultValue(false)]
+ public new bool ShowReadOnly
+ {
+ get
+ {
+ return showReadOnly;
+ }
+
+ set
+ {
+ base.ShowReadOnly = value;
+ }
+ }
+
+ #endregion // Public Instance Properties
+
+ #region Public Instance Methods
+ public Stream OpenFile( )
+ {
+ if ( FileName == null )
+ throw new ArgumentNullException( "OpenFile", "FileName is null" );
+
+ return new FileStream( FileName, FileMode.Open, FileAccess.Read );
+ }
+ #endregion // Public Instance Methods
+
+ public override void Reset( )
+ {
+ base.Reset( );
+ multiSelect = false;
+ checkFileExists = true;
+ readOnlyChecked = false;
+ ReadOnlyChecked = readOnlyChecked;
+ showReadOnly = false;
+ ShowReadOnly = showReadOnly;
+ }
+ }
+}
+
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/OpenTreeNodeEnumerator.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/OpenTreeNodeEnumerator.cs
new file mode 100644
index 00000000000..32a79e93027
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/OpenTreeNodeEnumerator.cs
@@ -0,0 +1,113 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+
+using System;
+using System.Collections;
+
+namespace System.Windows.Forms {
+
+ internal class OpenTreeNodeEnumerator : IEnumerator {
+
+ private TreeNode start;
+ private TreeNode current;
+ private bool started;
+
+ public OpenTreeNodeEnumerator (TreeNode start)
+ {
+ this.start = start;
+ }
+
+ public object Current {
+ get { return current; }
+ }
+
+ public TreeNode CurrentNode {
+ get { return current; }
+ }
+
+ public bool MoveNext ()
+ {
+ if (!started) {
+ started = true;
+ current = start;
+ return (current != null);
+ }
+
+ if (current.IsExpanded && current.Nodes.Count > 0) {
+ current = current.Nodes [0];
+ return true;
+ }
+
+ TreeNode prev = current;
+ TreeNode next = current.NextNode;
+ while (next == null) {
+ // The next node is null so we need to move back up the tree until we hit the top
+ if (prev.parent == null)
+ return false;
+ prev = prev.parent;
+ if (prev.parent != null)
+ next = prev.NextNode;
+ }
+ current = next;
+ return true;
+ }
+
+ public bool MovePrevious ()
+ {
+ if (!started) {
+ started = true;
+ current = start;
+ return (current != null);
+ }
+
+ if (current.PrevNode != null) {
+ // Drill down as far as possible
+ TreeNode prev = current.PrevNode;
+ TreeNode walk = prev;
+ while (walk != null) {
+ prev = walk;
+ if (!walk.IsExpanded)
+ break;
+ walk = walk.LastNode;
+ }
+ current = prev;
+ return true;
+ }
+
+ if (current.parent == null ||
+ current.parent == current.TreeView.root_node)
+ return false;
+
+ current = current.parent;
+ return true;
+ }
+
+ public void Reset ()
+ {
+ started = false;
+ }
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Orientation.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Orientation.cs
new file mode 100644
index 00000000000..8213f05264e
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Orientation.cs
@@ -0,0 +1,39 @@
+//
+// System.Windows.Forms.Orientation.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.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+// Copyright (C) Novell Inc., 2004
+//
+//
+
+
+namespace System.Windows.Forms
+{
+
+ public enum Orientation
+ {
+ Horizontal = 0,
+ Vertical = 1,
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/OwnerDrawPropertyBag.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/OwnerDrawPropertyBag.cs
new file mode 100644
index 00000000000..8e17c902728
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/OwnerDrawPropertyBag.cs
@@ -0,0 +1,84 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+using System;
+using System.Drawing;
+using System.Runtime.Serialization;
+
+namespace System.Windows.Forms {
+
+ [Serializable]
+ public class OwnerDrawPropertyBag : MarshalByRefObject, ISerializable {
+
+ private Color fore_color;
+ private Color back_color;
+ private Font font;
+
+ internal OwnerDrawPropertyBag ()
+ {
+ fore_color = back_color = Color.Empty;
+ }
+
+ private OwnerDrawPropertyBag (Color fore_color, Color back_color, Font font)
+ {
+ this.fore_color = fore_color;
+ this.back_color = back_color;
+ this.font = font;
+ }
+
+ public Color ForeColor {
+ get { return fore_color; }
+ set { fore_color = value; }
+ }
+
+ public Color BackColor {
+ get { return back_color; }
+ set { back_color = value; }
+ }
+
+ public Font Font {
+ get { return font; }
+ set { font = value; }
+ }
+
+ public virtual bool IsEmpty ()
+ {
+ return (font == null && fore_color.IsEmpty && back_color.IsEmpty);
+ }
+
+ void ISerializable.GetObjectData (SerializationInfo si, StreamingContext context)
+ {
+ si.AddValue ("BackColor", BackColor);
+ si.AddValue ("ForeColor", ForeColor);
+ si.AddValue ("Font", Font);
+ }
+
+ public static OwnerDrawPropertyBag Copy (OwnerDrawPropertyBag value)
+ {
+ return new OwnerDrawPropertyBag (value.ForeColor, value.BackColor, value.Font);
+ }
+ }
+}
+
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Padding.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Padding.cs
new file mode 100644
index 00000000000..489edc44f98
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Padding.cs
@@ -0,0 +1,144 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ [SerializableAttribute()]
+ public struct Padding {
+
+ private int bottom;
+ private int left;
+ private int right;
+ private int top;
+
+ public Padding (int all) {
+ bottom = left = right = top = all;
+ }
+
+ public Padding (int left, int top, int right, int bottom) {
+ this.left = left;
+ this.top = top;
+ this.right = right;
+ this.bottom = bottom;
+ }
+
+ public static readonly Padding Empty = new Padding(0);
+
+ public int All {
+ get {
+ if (left == top && left == right && left == bottom) {
+ return left;
+ }
+ return -1;
+ }
+ set { left = top = right = bottom = value; }
+ }
+
+ public int Bottom {
+ get { return bottom; }
+ set { bottom = value; }
+ }
+
+ public int Horizontal {
+ get { return left + right; }
+ }
+
+ public int Left {
+ get { return left; }
+ set { left = value; }
+ }
+
+ public int Right {
+ get { return right; }
+ set { right = value; }
+ }
+
+ public Size Size {
+ get { return new Size(left + right, top + bottom); }
+ }
+
+ public int Top {
+ get { return top; }
+ set { top = value; }
+ }
+
+ public int Vertical {
+ get { return top + bottom; }
+ }
+
+ public static Padding Add (Padding p1, Padding p2) {
+ return op_Addition(p1, p2);
+ }
+
+ public override bool Equals (object other) {
+ if (other is Padding) {
+ Padding other_aux = (Padding) other;
+ return this.left == other_aux.left &&
+ this.top == other_aux.top &&
+ this.right == other_aux.right &&
+ this.bottom == other_aux.bottom;
+ }
+ return false;
+ }
+
+ public override int GetHashCode () {
+ ////////////////////////////// COMPROBAR EN Windows /////////////////////////
+ return top ^ bottom ^ left ^ right;
+ }
+
+ public static Padding op_Addition (Padding p1, Padding p2) {
+ return new Padding(p1.Left + p2.Left, p1.Top + p2.Top, p1.Right + p2.Right, p1.Bottom + p2.Bottom);
+ }
+
+ public static bool op_Equality (Padding p1, Padding p2) {
+ return p1.Equals(p2);
+ }
+
+ public static bool op_Inequality (Padding p1, Padding p2) {
+ return !(p1.Equals(p2));
+ }
+
+ public static Padding op_Subtraction (Padding p1, Padding p2) {
+ return new Padding(p1.Left - p2.Left, p1.Top - p2.Top, p1.Right - p2.Right, p1.Bottom - p2.Bottom);
+ }
+
+ public static Padding Subtract (Padding p1, Padding p2) {
+ return op_Subtraction(p1, p2);
+ }
+
+ public override string ToString () {
+ return ""; ////////////////////////// Windows //////////////////////////////////
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PageSetupDialog.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PageSetupDialog.cs
new file mode 100755
index 00000000000..cf67ca593aa
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PageSetupDialog.cs
@@ -0,0 +1,377 @@
+// 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) 2006 Novell, Inc.
+//
+// Authors:
+// Jonathan Chambers (jonathan.chambers@ansys.com)
+//
+
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.ComponentModel.Design.Serialization;
+using System.Collections;
+using System.Diagnostics;
+using System.Drawing;
+using System.Drawing.Printing;
+using System.Reflection;
+
+namespace System.Windows.Forms {
+
+ public sealed class PageSetupDialog : CommonDialog {
+ #region Local variables
+ private PrintDocument document;
+ private PageSettings page_settings;
+ private PrinterSettings printer_settings;
+ private Margins min_margins;
+ private bool allow_margins;
+ private bool allow_orientation;
+ private bool allow_paper;
+ private bool allow_printer;
+ private bool show_help;
+ private bool show_network;
+
+ private GroupBox groupbox_paper;
+ private Label label_source;
+ private Label label_size;
+ private GroupBox groupbox_orientation;
+ private RadioButton radio_landscape;
+ private RadioButton radio_portrait;
+ private GroupBox groupbox_margin;
+ private Label label_left;
+ private Button button_ok;
+ private Button button_cancel;
+ private Button button_printer;
+ private Label label_top;
+ private Label label_right;
+ private Label label_bottom;
+ private TextBox textbox_left;
+ private TextBox textbox_top;
+ private TextBox textbox_right;
+ private TextBox textbox_bottom;
+ private ComboBox combobox_source;
+ private ComboBox combobox_size;
+ #endregion // Local variables
+
+ #region Public Constructors
+ public PageSetupDialog () {
+ InitializeComponent();
+ }
+ #endregion // Public Constructors
+
+
+ #region Public Instance Methods
+ public override void Reset () {
+ }
+ #endregion // Public Instance Methods
+
+ #region Public Instance Properties
+ public bool AllowMargins {
+ get { return allow_margins; }
+ set { allow_margins = value; }
+ }
+
+ public bool AllowOrientation {
+ get { return allow_orientation; }
+ set { allow_orientation = value; }
+ }
+
+ public bool AllowPaper {
+ get { return allow_paper; }
+ set { allow_paper = value; }
+ }
+
+ public bool AllowPrinter {
+ get { return allow_printer; }
+ set { allow_printer = value; }
+ }
+
+ public PrintDocument Document {
+ get { return document; }
+ set { document = value; }
+ }
+
+ public Margins MinMargins {
+ get { return min_margins; }
+ set { min_margins = value; }
+ }
+
+ public PageSettings PageSettings {
+ get { return page_settings; }
+ set { page_settings = value; }
+ }
+
+ public PrinterSettings PrinterSettings {
+ get { return printer_settings; }
+ set { printer_settings = value; }
+ }
+
+ public bool ShowHelp {
+ get { return show_help; }
+ set { show_help = value; }
+ }
+
+ public bool ShowNetwork {
+ get { return show_network; }
+ set { show_network = value; }
+ }
+
+ #endregion // Public Instance Properties
+
+ #region Protected Instance Methods
+ protected override bool RunDialog (IntPtr hwnd) {
+ return true;
+ }
+ #endregion // Protected Instance Methods
+
+ #region Private Helper
+ private void InitializeComponent() {
+ this.groupbox_paper = new System.Windows.Forms.GroupBox();
+ this.combobox_source = new System.Windows.Forms.ComboBox();
+ this.combobox_size = new System.Windows.Forms.ComboBox();
+ this.label_source = new System.Windows.Forms.Label();
+ this.label_size = new System.Windows.Forms.Label();
+ this.groupbox_orientation = new System.Windows.Forms.GroupBox();
+ this.radio_landscape = new System.Windows.Forms.RadioButton();
+ this.radio_portrait = new System.Windows.Forms.RadioButton();
+ this.groupbox_margin = new System.Windows.Forms.GroupBox();
+ this.label_left = new System.Windows.Forms.Label();
+ this.button_ok = new System.Windows.Forms.Button();
+ this.button_cancel = new System.Windows.Forms.Button();
+ this.button_printer = new System.Windows.Forms.Button();
+ this.label_top = new System.Windows.Forms.Label();
+ this.label_right = new System.Windows.Forms.Label();
+ this.label_bottom = new System.Windows.Forms.Label();
+ this.textbox_left = new System.Windows.Forms.TextBox();
+ this.textbox_top = new System.Windows.Forms.TextBox();
+ this.textbox_right = new System.Windows.Forms.TextBox();
+ this.textbox_bottom = new System.Windows.Forms.TextBox();
+ this.groupbox_paper.SuspendLayout();
+ this.groupbox_orientation.SuspendLayout();
+ this.groupbox_margin.SuspendLayout();
+ form.SuspendLayout();
+ //
+ // groupbox_paper
+ //
+ this.groupbox_paper.Controls.Add(this.combobox_source);
+ this.groupbox_paper.Controls.Add(this.combobox_size);
+ this.groupbox_paper.Controls.Add(this.label_source);
+ this.groupbox_paper.Controls.Add(this.label_size);
+ this.groupbox_paper.Location = new System.Drawing.Point(12, 157);
+ this.groupbox_paper.Name = "groupbox_paper";
+ this.groupbox_paper.Size = new System.Drawing.Size(336, 90);
+ this.groupbox_paper.TabIndex = 0;
+ this.groupbox_paper.TabStop = false;
+ this.groupbox_paper.Text = "Paper";
+ //
+ // combobox_source
+ //
+ this.combobox_source.Location = new System.Drawing.Point(84, 54);
+ this.combobox_source.Name = "combobox_source";
+ this.combobox_source.Size = new System.Drawing.Size(240, 21);
+ this.combobox_source.TabIndex = 3;
+ this.combobox_source.Text = "Default";
+ //
+ // combobox_size
+ //
+ this.combobox_size.ItemHeight = 13;
+ this.combobox_size.Location = new System.Drawing.Point(84, 22);
+ this.combobox_size.Name = "combobox_size";
+ this.combobox_size.Size = new System.Drawing.Size(240, 21);
+ this.combobox_size.TabIndex = 2;
+ this.combobox_size.Text = "A4";
+ //
+ // label_source
+ //
+ this.label_source.Location = new System.Drawing.Point(10, 58);
+ this.label_source.Name = "label_source";
+ this.label_source.Size = new System.Drawing.Size(48, 16);
+ this.label_source.TabIndex = 1;
+ this.label_source.Text = "&Source:";
+ //
+ // label_size
+ //
+ this.label_size.Location = new System.Drawing.Point(10, 25);
+ this.label_size.Name = "label_size";
+ this.label_size.Size = new System.Drawing.Size(52, 16);
+ this.label_size.TabIndex = 0;
+ this.label_size.Text = "Si&ze:";
+ //
+ // groupbox_orientation
+ //
+ this.groupbox_orientation.Controls.Add(this.radio_landscape);
+ this.groupbox_orientation.Controls.Add(this.radio_portrait);
+ this.groupbox_orientation.Location = new System.Drawing.Point(12, 255);
+ this.groupbox_orientation.Name = "groupbox_orientation";
+ this.groupbox_orientation.Size = new System.Drawing.Size(96, 90);
+ this.groupbox_orientation.TabIndex = 1;
+ this.groupbox_orientation.TabStop = false;
+ this.groupbox_orientation.Text = "Orientation";
+ //
+ // radio_landscape
+ //
+ this.radio_landscape.Location = new System.Drawing.Point(13, 52);
+ this.radio_landscape.Name = "radio_landscape";
+ this.radio_landscape.Size = new System.Drawing.Size(80, 24);
+ this.radio_landscape.TabIndex = 7;
+ this.radio_landscape.Text = "L&andscape";
+ //
+ // radio_portrait
+ //
+ this.radio_portrait.Location = new System.Drawing.Point(13, 19);
+ this.radio_portrait.Name = "radio_portrait";
+ this.radio_portrait.Size = new System.Drawing.Size(72, 24);
+ this.radio_portrait.TabIndex = 6;
+ this.radio_portrait.Text = "P&ortrait";
+ //
+ // groupbox_margin
+ //
+ this.groupbox_margin.Controls.Add(this.textbox_bottom);
+ this.groupbox_margin.Controls.Add(this.textbox_right);
+ this.groupbox_margin.Controls.Add(this.textbox_top);
+ this.groupbox_margin.Controls.Add(this.textbox_left);
+ this.groupbox_margin.Controls.Add(this.label_bottom);
+ this.groupbox_margin.Controls.Add(this.label_right);
+ this.groupbox_margin.Controls.Add(this.label_top);
+ this.groupbox_margin.Controls.Add(this.label_left);
+ this.groupbox_margin.Location = new System.Drawing.Point(120, 255);
+ this.groupbox_margin.Name = "groupbox_margin";
+ this.groupbox_margin.Size = new System.Drawing.Size(228, 90);
+ this.groupbox_margin.TabIndex = 2;
+ this.groupbox_margin.TabStop = false;
+ this.groupbox_margin.Text = "Margins (inches)";
+ //
+ // label_left
+ //
+ this.label_left.Location = new System.Drawing.Point(10, 25);
+ this.label_left.Name = "label_left";
+ this.label_left.Size = new System.Drawing.Size(40, 23);
+ this.label_left.TabIndex = 0;
+ this.label_left.Text = "&Left:";
+ //
+ // button_ok
+ //
+ this.button_ok.Location = new System.Drawing.Point(120, 358);
+ this.button_ok.Name = "button_ok";
+ this.button_ok.Size = new System.Drawing.Size(72, 23);
+ this.button_ok.TabIndex = 3;
+ this.button_ok.Text = "OK";
+ //
+ // button_cancel
+ //
+ this.button_cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.button_cancel.Location = new System.Drawing.Point(198, 358);
+ this.button_cancel.Name = "button_cancel";
+ this.button_cancel.Size = new System.Drawing.Size(72, 23);
+ this.button_cancel.TabIndex = 4;
+ this.button_cancel.Text = "Cancel";
+ //
+ // button_printer
+ //
+ this.button_printer.Location = new System.Drawing.Point(276, 358);
+ this.button_printer.Name = "button_printer";
+ this.button_printer.Size = new System.Drawing.Size(72, 23);
+ this.button_printer.TabIndex = 5;
+ this.button_printer.Text = "&Printer...";
+ //
+ // label_top
+ //
+ this.label_top.Location = new System.Drawing.Point(10, 57);
+ this.label_top.Name = "label_top";
+ this.label_top.Size = new System.Drawing.Size(40, 23);
+ this.label_top.TabIndex = 1;
+ this.label_top.Text = "&Top:";
+ //
+ // label_right
+ //
+ this.label_right.Location = new System.Drawing.Point(124, 25);
+ this.label_right.Name = "label_right";
+ this.label_right.Size = new System.Drawing.Size(40, 23);
+ this.label_right.TabIndex = 2;
+ this.label_right.Text = "&Right:";
+ //
+ // label_bottom
+ //
+ this.label_bottom.Location = new System.Drawing.Point(124, 57);
+ this.label_bottom.Name = "label_bottom";
+ this.label_bottom.Size = new System.Drawing.Size(40, 23);
+ this.label_bottom.TabIndex = 3;
+ this.label_bottom.Text = "&Bottom:";
+ //
+ // textbox_left
+ //
+ this.textbox_left.Location = new System.Drawing.Point(57, 21);
+ this.textbox_left.Name = "textbox_left";
+ this.textbox_left.Size = new System.Drawing.Size(48, 20);
+ this.textbox_left.TabIndex = 4;
+ this.textbox_left.Text = "1";
+ //
+ // textbox_top
+ //
+ this.textbox_top.Location = new System.Drawing.Point(57, 54);
+ this.textbox_top.Name = "textbox_top";
+ this.textbox_top.Size = new System.Drawing.Size(48, 20);
+ this.textbox_top.TabIndex = 5;
+ this.textbox_top.Text = "1";
+ //
+ // textbox_right
+ //
+ this.textbox_right.Location = new System.Drawing.Point(171, 21);
+ this.textbox_right.Name = "textbox_right";
+ this.textbox_right.Size = new System.Drawing.Size(48, 20);
+ this.textbox_right.TabIndex = 6;
+ this.textbox_right.Text = "1";
+ //
+ // textbox_bottom
+ //
+ this.textbox_bottom.Location = new System.Drawing.Point(171, 54);
+ this.textbox_bottom.Name = "textbox_bottom";
+ this.textbox_bottom.Size = new System.Drawing.Size(48, 20);
+ this.textbox_bottom.TabIndex = 7;
+ this.textbox_bottom.Text = "1";
+ //
+ // Form3
+ //
+ form.AcceptButton = this.button_ok;
+ form.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
+ form.CancelButton = this.button_cancel;
+ form.ClientSize = new System.Drawing.Size(360, 390);
+ form.Controls.Add(this.button_printer);
+ form.Controls.Add(this.button_cancel);
+ form.Controls.Add(this.button_ok);
+ form.Controls.Add(this.groupbox_margin);
+ form.Controls.Add(this.groupbox_orientation);
+ form.Controls.Add(this.groupbox_paper);
+ form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
+ form.HelpButton = true;
+ form.MaximizeBox = false;
+ form.MinimizeBox = false;
+ form.Name = "Form3";
+ form.ShowInTaskbar = false;
+ form.Text = "Page Setup";
+ this.groupbox_paper.ResumeLayout(false);
+ this.groupbox_orientation.ResumeLayout(false);
+ this.groupbox_margin.ResumeLayout(false);
+ form.ResumeLayout(false);
+
+ }
+ #endregion // Private Helper
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PaintEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PaintEventArgs.cs
new file mode 100644
index 00000000000..2089a0fc046
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PaintEventArgs.cs
@@ -0,0 +1,86 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+using System.Drawing;
+
+namespace System.Windows.Forms {
+ public class PaintEventArgs : EventArgs, IDisposable {
+ private Graphics graphics;
+ private Rectangle clip_rectangle;
+
+ #region Public Constructors
+ public PaintEventArgs(System.Drawing.Graphics graphics, System.Drawing.Rectangle clipRect) {
+ this.graphics=graphics;
+ this.clip_rectangle=clipRect;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public Rectangle ClipRectangle {
+ get {
+ return this.clip_rectangle;
+ }
+ }
+
+ public Graphics Graphics {
+ get {
+ return this.graphics;
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Instance Methods
+ public void Dispose() {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+ #endregion // Public Instance Methods
+
+ // Returns the previous graphics
+ internal Graphics SetGraphics (Graphics g)
+ {
+ Graphics res = graphics;
+ graphics = g;
+
+ return res;
+ }
+
+ #region Protected Instance Methods
+ ~PaintEventArgs() {
+ Dispose(false);
+ }
+
+ protected virtual void Dispose(bool disposing) {
+ if (this.graphics!=null) {
+ graphics.Dispose();
+ this.graphics=null;
+ }
+ }
+ #endregion // Protected Instance Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PaintEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PaintEventHandler.cs
new file mode 100644
index 00000000000..bba9a5dc5be
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PaintEventHandler.cs
@@ -0,0 +1,34 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms
+{
+ [Serializable]
+ public delegate void PaintEventHandler (object sender, PaintEventArgs e);
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Panel.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Panel.cs
new file mode 100644
index 00000000000..092470403ac
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Panel.cs
@@ -0,0 +1,125 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+//
+
+// COMPLETE
+
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Drawing;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [DefaultProperty("BorderStyle")]
+ [DefaultEvent("Paint")]
+ [Designer ("System.Windows.Forms.Design.PanelDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+ public class Panel : ScrollableControl {
+ #region Constructors & Destructors
+ public Panel () {
+ base.TabStop = false;
+ SetStyle(ControlStyles.Selectable, false);
+ SetStyle (ControlStyles.SupportsTransparentBackColor, true);
+ }
+ #endregion // Constructors & Destructors
+
+ #region Public Instance Properties
+ [DefaultValue(BorderStyle.None)]
+ [DispId(-504)]
+ public BorderStyle BorderStyle {
+ get { return InternalBorderStyle; }
+ set { InternalBorderStyle = value; }
+ }
+
+ [DefaultValue(false)]
+ public new bool TabStop {
+ get { return base.TabStop; }
+ set {
+ if (value == TabStop)
+ return;
+ base.TabStop = value;
+ }
+ }
+
+ [Bindable(false)]
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override string Text {
+ get { return base.Text; }
+ set {
+ if (value == Text)
+ return;
+ base.Text = value;
+ Refresh ();
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Protected Instance Properties
+ protected override CreateParams CreateParams {
+ get {
+ return base.CreateParams;
+ }
+ }
+
+ protected override Size DefaultSize {
+ get { return ThemeEngine.Current.PanelDefaultSize; }
+ }
+ #endregion // Proteced Instance Properties
+
+ #region Public Instance Methods
+ public override string ToString ()
+ {
+ return base.ToString () + ", BorderStyle: " + BorderStyle;
+ }
+ #endregion // Public Instance Methods
+
+ #region Protected Instance Methods
+ protected override void OnResize(EventArgs e) {
+ base.OnResize (e);
+ Invalidate(true);
+ }
+
+ #endregion // Protected Instance Methods
+
+ #region Events
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event KeyEventHandler KeyDown;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event KeyPressEventHandler KeyPress;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event KeyEventHandler KeyUp;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler TextChanged;
+ #endregion
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PictureBox.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PictureBox.cs
new file mode 100644
index 00000000000..cef4a72c15a
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PictureBox.cs
@@ -0,0 +1,382 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+//
+
+// COMPLETE
+
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [DefaultProperty("Image")]
+ [Designer("System.Windows.Forms.Design.PictureBoxDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+ public class PictureBox : Control {
+
+ private Image image;
+ private PictureBoxSizeMode size_mode;
+ private bool redraw;
+ private bool recalc;
+ private bool allow_drop;
+
+ private EventHandler frame_handler;
+
+ public PictureBox ()
+ {
+ redraw = true;
+ recalc = true;
+ allow_drop = false;
+ SetStyle (ControlStyles.Selectable, false);
+ SetStyle (ControlStyles.SupportsTransparentBackColor, true);
+ }
+
+ [DefaultValue(PictureBoxSizeMode.Normal)]
+ [Localizable(true)]
+ [RefreshProperties(RefreshProperties.Repaint)]
+ public PictureBoxSizeMode SizeMode {
+ get { return size_mode; }
+ set {
+ if (size_mode == value)
+ return;
+ size_mode = value;
+ UpdateSize ();
+ Redraw (true);
+ Invalidate ();
+
+ OnSizeModeChanged (EventArgs.Empty);
+ }
+ }
+
+ [DefaultValue(null)]
+ [Localizable(true)]
+ public Image Image {
+ get { return image; }
+ set {
+ StopAnimation ();
+
+ image = value;
+ UpdateSize ();
+ if (image != null && ImageAnimator.CanAnimate (image)) {
+ frame_handler = new EventHandler (OnAnimateImage);
+ ImageAnimator.Animate (image, frame_handler);
+ }
+ Redraw (true);
+ Invalidate ();
+ }
+ }
+
+ [DefaultValue(BorderStyle.None)]
+ [DispId(-504)]
+ public BorderStyle BorderStyle {
+ get { return InternalBorderStyle; }
+ set { InternalBorderStyle = value; }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new bool CausesValidation {
+ get { return base.CausesValidation; }
+ set { base.CausesValidation = value; }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new ImeMode ImeMode {
+ get { return base.ImeMode; }
+ set { base.ImeMode = value; }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override RightToLeft RightToLeft {
+ get { return base.RightToLeft; }
+ set { base.RightToLeft = value; }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new int TabIndex {
+ get { return base.TabIndex; }
+ set { base.TabIndex = value; }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new bool TabStop {
+ get { return base.TabStop; }
+ set { base.TabStop = value; }
+ }
+
+ [Bindable(false)]
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override string Text {
+ get { return base.Text; }
+ set { base.Text = value; }
+ }
+
+ protected override CreateParams CreateParams {
+ get {
+ return base.CreateParams;
+ }
+ }
+
+ protected override ImeMode DefaultImeMode {
+ get { return base.DefaultImeMode; }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override Font Font {
+ get { return base.Font; }
+ set { base.Font = value; }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override Color ForeColor {
+ get { return base.ForeColor; }
+ set { base.ForeColor = value; }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool AllowDrop {
+ get {
+ return allow_drop;
+ }
+ set {
+ if (allow_drop != value) {
+ allow_drop = value;
+ }
+ }
+ }
+
+ #region Protected Instance Methods
+ protected override Size DefaultSize {
+ get { return ThemeEngine.Current.PictureBoxDefaultSize; }
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ if (image != null) {
+ StopAnimation ();
+ image = null;
+ }
+ base.Dispose (disposing);
+ }
+
+ protected override void OnPaint (PaintEventArgs pe)
+ {
+ ThemeEngine.Current.DrawPictureBox (pe.Graphics, pe.ClipRectangle, this);
+ base.OnPaint (pe);
+ }
+
+ protected override void OnVisibleChanged (EventArgs e)
+ {
+ base.OnVisibleChanged (e);
+ Redraw (true);
+ }
+
+ protected virtual void OnSizeModeChanged (EventArgs e)
+ {
+ if (SizeModeChanged != null)
+ SizeModeChanged (this, e);
+ }
+
+ protected override void OnEnabledChanged (EventArgs e)
+ {
+ base.OnEnabledChanged (e);
+ }
+
+ protected override void OnParentChanged (EventArgs e)
+ {
+ base.OnParentChanged (e);
+ }
+
+ protected override void OnResize (EventArgs e)
+ {
+ base.OnResize (e);
+ redraw = true;
+
+ if (size_mode == PictureBoxSizeMode.CenterImage || size_mode == PictureBoxSizeMode.StretchImage)
+ Refresh ();
+ }
+
+ protected override void SetBoundsCore (int x, int y, int width, int height, BoundsSpecified specified)
+ {
+ if (size_mode == PictureBoxSizeMode.AutoSize && image != null) {
+ width = image.Width;
+ height = image.Height;
+ }
+ base.SetBoundsCore (x, y, width, height, specified);
+ }
+ #endregion // Protected Instance Methods
+
+ #region Private Methods
+ private void StopAnimation ()
+ {
+ if (frame_handler == null)
+ return;
+ ImageAnimator.StopAnimate (image, frame_handler);
+ frame_handler = null;
+ }
+
+ private void UpdateSize ()
+ {
+ if (image == null)
+ return;
+ if (size_mode == PictureBoxSizeMode.AutoSize)
+ ClientSize = image.Size;
+ }
+
+ private void Redraw (bool recalc)
+ {
+ redraw = true;
+ this.recalc = recalc;
+ }
+
+ private void OnAnimateImage (object sender, EventArgs e)
+ {
+ // This is called from a worker thread,BeginInvoke is used
+ // so the control is updated from the correct thread
+ BeginInvoke (new EventHandler (UpdateAnimatedImage), new object [] { this, e });
+ }
+
+ private void UpdateAnimatedImage (object sender, EventArgs e)
+ {
+ ImageAnimator.UpdateFrames (image);
+ Redraw (false);
+ Refresh ();
+ }
+
+ #endregion // Private Methods
+
+ #region Public Instance Methods
+ public override string ToString() {
+ return base.ToString ();
+ }
+ #endregion
+
+ #region Events
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler CausesValidationChanged {
+ add { base.CausesValidationChanged += value; }
+ remove { base.CausesValidationChanged -= value; }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler Enter {
+ add { base.Enter += value; }
+ remove { base.Enter -= value; }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler FontChanged {
+ add { base.FontChanged += value; }
+ remove { base.FontChanged -= value; }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler ForeColorChanged {
+ add { base.ForeColorChanged += value; }
+ remove { base.ForeColorChanged -= value; }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler ImeModeChanged {
+ add { base.ImeModeChanged += value; }
+ remove { base.ImeModeChanged -= value; }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event KeyEventHandler KeyDown {
+ add { base.KeyDown += value; }
+ remove { base.KeyDown -= value; }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event KeyPressEventHandler KeyPress {
+ add { base.KeyPress += value; }
+ remove { base.KeyPress -= value; }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event KeyEventHandler KeyUp {
+ add { base.KeyUp += value; }
+ remove { base.KeyUp -= value; }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler Leave {
+ add { base.Leave += value; }
+ remove { base.Leave -= value; }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler RightToLeftChanged {
+ add { base.RightToLeftChanged += value; }
+ remove { base.RightToLeftChanged -= value; }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler TabIndexChanged {
+ add { base.TabIndexChanged += value; }
+ remove { base.TabIndexChanged -= value; }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler TabStopChanged {
+ add { base.TabStopChanged += value; }
+ remove { base.TabStopChanged -= value; }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler TextChanged {
+ add { base.TextChanged += value; }
+ remove { base.TextChanged -= value; }
+ }
+
+ public event EventHandler SizeModeChanged;
+ #endregion // Events
+
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PictureBoxSizeMode.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PictureBoxSizeMode.cs
new file mode 100644
index 00000000000..d864f06a9f6
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PictureBoxSizeMode.cs
@@ -0,0 +1,37 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+//
+
+
+namespace System.Windows.Forms {
+
+ public enum PictureBoxSizeMode {
+ Normal,
+ StretchImage,
+ AutoSize,
+ CenterImage
+ }
+}
+
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PrintControllerWithStatusDialog.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PrintControllerWithStatusDialog.cs
new file mode 100755
index 00000000000..d67bc5f358d
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PrintControllerWithStatusDialog.cs
@@ -0,0 +1,129 @@
+// 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) 2006 Novell, Inc.
+//
+// Authors:
+// Jonathan Chambers (jonathan.chambers@ansys.com)
+//
+
+using System;
+using System.Drawing;
+using System.Drawing.Printing;
+
+namespace System.Windows.Forms
+{
+
+ public class PrintControllerWithStatusDialog : PrintController {
+ #region Local variables
+ PrintController underlyingController;
+ string dialogTitle;
+ PrintingDialog dialog;
+ int currentPage;
+ #endregion // Local variables
+
+ #region Public Constructors
+
+ [MonoTODO("Localize Dialog Title")]
+ public PrintControllerWithStatusDialog(PrintController underlyingController) {
+ this.underlyingController = underlyingController;
+ dialog = new PrintingDialog();
+ dialog.Text = "Printing";
+ }
+
+ public PrintControllerWithStatusDialog(PrintController underlyingController, string dialogTitle) : this(underlyingController) {
+ dialog.Text = dialogTitle;
+ }
+ #endregion // Public Constructors
+
+ #region Protected Instance Methods
+ public override void OnEndPage(PrintDocument document, PrintPageEventArgs e) {
+ if (dialog.DialogResult == DialogResult.Cancel) {
+ e.Cancel = true;
+ dialog.Close();
+ }
+ base.OnEndPage (document, e);
+ }
+
+ public override void OnEndPrint(PrintDocument document, PrintEventArgs e) {
+ if (dialog.Visible)
+ dialog.Close();
+ base.OnEndPrint (document, e);
+ }
+
+ public override Graphics OnStartPage(PrintDocument document, PrintPageEventArgs e) {
+ if (dialog.DialogResult == DialogResult.Cancel) {
+ e.Cancel = true;
+ dialog.Close();
+ }
+ dialog.LabelText = string.Format("Page {0} of document", ++currentPage);
+ return base.OnStartPage (document, e);
+ }
+
+ public override void OnStartPrint(PrintDocument document, PrintEventArgs e) {
+ currentPage = 0;
+ dialog.Show();
+ base.OnStartPrint (document, e);
+ }
+
+ #endregion // Protected Instance Methods
+
+ #region Internal Class
+ public class PrintingDialog : Form {
+ private Button buttonCancel;
+ private Label label;
+
+ public PrintingDialog() {
+ buttonCancel = new System.Windows.Forms.Button();
+ label = new System.Windows.Forms.Label();
+ SuspendLayout();
+
+ buttonCancel.Location = new System.Drawing.Point(88, 88);
+ buttonCancel.Name = "buttonCancel";
+ buttonCancel.TabIndex = 0;
+ buttonCancel.Text = "Cancel";
+
+ label.Location = new System.Drawing.Point(0, 40);
+ label.Name = "label";
+ label.Size = new System.Drawing.Size(257, 23);
+ label.TabIndex = 1;
+ label.Text = "Page 1 of document";
+ label.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+
+ AutoScaleBaseSize = new System.Drawing.Size(5, 13);
+ CancelButton = buttonCancel;
+ ClientSize = new System.Drawing.Size(258, 124);
+ ControlBox = false;
+ Controls.Add(label);
+ Controls.Add(buttonCancel);
+ FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
+ Name = "PrintingDialog";
+ ShowInTaskbar = false;
+ Text = "Printing";
+ ResumeLayout(false);
+ }
+
+ public string LabelText {
+ get { return label.Text; }
+ set { label.Text = value; }
+ }
+ }
+ #endregion Internal Class
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PrintDialog.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PrintDialog.cs
new file mode 100644
index 00000000000..6b0c62269f5
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PrintDialog.cs
@@ -0,0 +1,168 @@
+// 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) 2005 Novell, Inc.
+//
+// Authors:
+// Someone
+// Jonathan Chambers (jonathan.chambers@ansys.com)
+//
+
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.ComponentModel.Design.Serialization;
+using System.Collections;
+using System.Diagnostics;
+using System.Drawing;
+using System.Drawing.Printing;
+using System.Reflection;
+
+namespace System.Windows.Forms
+{
+ [DefaultProperty("Document")]
+ public sealed class PrintDialog : CommonDialog {
+ PrintDocument document;
+ PrinterSettings printer_settings;
+ bool allow_current_page;
+ bool allow_print_to_file;
+ bool allow_selection;
+ bool allow_some_pages;
+ bool show_help;
+ bool show_network;
+ bool print_to_file;
+
+ public PrintDialog ()
+ {
+ allow_print_to_file = true;
+ show_network = true;
+ }
+
+ public override void Reset ()
+ {
+ }
+
+#if NET_2_0
+ public bool AllowCurrentPage {
+ get {
+ return allow_current_page;
+ }
+
+ set {
+ allow_current_page = value;
+ }
+ }
+#endif
+
+ [DefaultValue(true)]
+ public bool AllowPrintToFile {
+ get {
+ return allow_print_to_file;
+ }
+
+ set {
+ allow_print_to_file = value;
+ }
+ }
+
+ [DefaultValue(false)]
+ public bool AllowSelection {
+ get {
+ return allow_selection;
+ }
+
+ set {
+ allow_selection = value;
+ }
+ }
+
+ [DefaultValue(false)]
+ public bool AllowSomePages {
+ get {
+ return allow_some_pages;
+ }
+
+ set {
+ allow_some_pages = value;
+ }
+ }
+
+ [DefaultValue(null)]
+ public PrintDocument Document {
+ get {
+ return document;
+ }
+
+ set {
+ document = value;
+ }
+ }
+
+ [Browsable(false)]
+ [DefaultValue(null)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public PrinterSettings PrinterSettings {
+ get {
+ return printer_settings;
+ }
+
+ set {
+ printer_settings = value;
+ }
+ }
+
+ [DefaultValue(false)]
+ public bool PrintToFile {
+ get {
+ return print_to_file;
+ }
+
+ set {
+ print_to_file = value;
+ }
+ }
+
+ [DefaultValue(true)]
+ public bool ShowNetwork {
+ get {
+ return show_network;
+ }
+
+ set {
+ show_network = value;
+ }
+ }
+
+ [DefaultValue(false)]
+ public bool ShowHelp {
+ get {
+ return show_help;
+ }
+
+ set {
+ show_help = value;
+ }
+ }
+
+ protected override bool RunDialog (IntPtr hwnd)
+ {
+ return true;
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PrintPreviewControl.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PrintPreviewControl.cs
new file mode 100755
index 00000000000..b598daa7b13
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PrintPreviewControl.cs
@@ -0,0 +1,159 @@
+// 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) 2006 Novell, Inc.
+//
+// Authors:
+// Jonathan Chambers (jonathan.chambers@ansys.com)
+//
+
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.ComponentModel.Design.Serialization;
+using System.Collections;
+using System.Diagnostics;
+using System.Drawing;
+using System.Drawing.Printing;
+using System.Reflection;
+
+namespace System.Windows.Forms {
+ [DefaultPropertyAttribute("Document")]
+ public class PrintPreviewControl : Control {
+ #region Local variables
+ private bool autozoom;
+ private int columns;
+ private PrintDocument document;
+ private int rows;
+ private int startPage;
+ private bool useAntiAlias;
+ private double zoom;
+ #endregion // Local variables
+
+ #region Public Constructors
+ public PrintPreviewControl() {
+ autozoom = true;
+ columns = 1;
+ rows = 0;
+ startPage = 0;
+
+ this.BackColor = SystemColors.AppWorkspace;
+ }
+ #endregion // Public Constructors
+
+
+ #region Public Instance Properties
+ [DefaultValue(true)]
+ public bool AutoZoom {
+ get { return autozoom; }
+ set { autozoom = value; }
+ }
+ [DefaultValue(1)]
+ public int Columns {
+ get { return columns; }
+ set { columns = value; }
+ }
+ [DefaultValue(null)]
+ public PrintDocument Document {
+ get { return document; }
+ set { document = value; }
+ }
+ [DefaultValue(0)]
+ public int Rows {
+ get { return rows; }
+ set { rows = value; }
+ }
+ [DefaultValue(0)]
+ public int StartPage {
+ get { return startPage; }
+ set { startPage = value; }
+ }
+
+ public override string Text {
+ get {
+ return base.Text;
+ }
+ set {
+ base.Text = value;
+ }
+ }
+
+ [DefaultValue(false)]
+ public bool UseAntiAlias {
+ get { return useAntiAlias; }
+ set { useAntiAlias = value; }
+ }
+ [DefaultValue(1.0)]
+ public double Zoom {
+ get { return zoom; }
+ set { zoom = value; }
+ }
+ #endregion // Public Instance Properties
+
+
+ #region Public Instance Methods
+ public void InvalidatePreview() {
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override void ResetBackColor() {
+ base.ResetBackColor();
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override void ResetForeColor() {
+ base.ResetForeColor ();
+ }
+ #endregion // Public Instance Methods
+
+ #region Protected Instance Properties
+ protected override CreateParams CreateParams {
+ get {
+ return base.CreateParams;
+ }
+ }
+
+ #endregion // Protected Instance Methods
+
+ #region Protected Instance Properties
+
+ protected override void OnPaint(PaintEventArgs e) {
+ base.OnPaint (e);
+ }
+
+ protected override void OnResize(EventArgs e) {
+ base.OnResize (e);
+ }
+
+ protected virtual void OnStartPageChanged(EventArgs e) {
+ if (StartPageChanged != null)
+ StartPageChanged(this, e);
+ }
+
+ protected override void WndProc(ref Message m) {
+ base.WndProc (ref m);
+ }
+
+ #endregion // Protected Instance Methods
+
+ public event EventHandler StartPageChanged;
+
+ public new event EventHandler TextChanged;
+ }
+} \ No newline at end of file
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PrintPreviewDialog.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PrintPreviewDialog.cs
new file mode 100755
index 00000000000..36830a92cd3
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PrintPreviewDialog.cs
@@ -0,0 +1,77 @@
+// 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) 2006 Novell, Inc.
+//
+// Authors:
+// Jonathan Chambers (jonathan.chambers@ansys.com)
+//
+
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.ComponentModel.Design.Serialization;
+using System.Collections;
+using System.Diagnostics;
+using System.Drawing;
+using System.Drawing.Printing;
+using System.Reflection;
+
+namespace System.Windows.Forms {
+
+ public class PrintPreviewDialog : Form {
+ #region Local variables
+ PrintPreviewControl print_preview;
+ #endregion // Local variables
+
+ #region Public Constructors
+ public PrintPreviewDialog() {
+ print_preview = new PrintPreviewControl();
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public PrintDocument Document {
+ get { return print_preview.Document; }
+ set { print_preview.Document = value; }
+ }
+ public override ISite Site {
+ get {
+ return base.Site;
+ }
+ set {
+ base.Site = value;
+ }
+ }
+ public bool UseAntiAlias {
+ get { return print_preview.UseAntiAlias; }
+ set { print_preview.UseAntiAlias = value; }
+ }
+
+ #endregion // Public Instance Properties
+
+ #region Protected Instance Properties
+ protected override void CreateHandle() {
+ base.CreateHandle ();
+ }
+
+
+ #endregion // Protected Instance Methods
+ }
+} \ No newline at end of file
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ProgressBar.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ProgressBar.cs
new file mode 100644
index 00000000000..0fa380b92eb
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ProgressBar.cs
@@ -0,0 +1,414 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez jordi@ximian.com
+//
+//
+
+
+using System.Drawing;
+using System.ComponentModel;
+using System.Drawing.Imaging;
+using System.Drawing.Drawing2D;
+
+namespace System.Windows.Forms
+{
+ [DefaultProperty ("Value")]
+ public sealed class ProgressBar : Control
+ {
+ #region Local Variables
+ private int maximum;
+ private int minimum;
+ internal int step;
+ internal int val;
+ internal Rectangle client_area = new Rectangle ();
+ #endregion // Local Variables
+
+ #region events
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler BackColorChanged;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler BackgroundImageChanged;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler CausesValidationChanged;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler DoubleClick;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler Enter;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler FontChanged;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler ForeColorChanged;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler ImeModeChanged;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event KeyEventHandler KeyDown;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event KeyPressEventHandler KeyPress;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event KeyEventHandler KeyUp;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler Leave;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event PaintEventHandler Paint;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler RightToLeftChanged;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler TabStopChanged;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler TextChanged;
+ #endregion Events
+
+ #region Public Constructors
+ public ProgressBar()
+ {
+ maximum = 100;
+ minimum = 0;
+ step = 10;
+ val = 0;
+
+ base.Paint += new PaintEventHandler (OnPaintPB);
+ base.Resize += new EventHandler (OnResizeTB);
+
+ SetStyle (ControlStyles.UserPaint |
+ ControlStyles.Selectable |
+ ControlStyles.ResizeRedraw |
+ ControlStyles.Opaque, false);
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public override bool AllowDrop
+ {
+ get { return base.AllowDrop; }
+ set {
+ base.AllowDrop = value;
+ }
+ }
+
+ // Setting this property in MS .Net 1.1 does not have any visual effect and it
+ // does not fire a BackColorChanged event
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public override Color BackColor
+ {
+ get { return base.BackColor; }
+ set { base.BackColor = value; }
+ }
+
+ // Setting this property in MS .Net 1.1 does not have any visual effect and it
+ // does not fire a BackgroundImageChanged event
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public override Image BackgroundImage
+ {
+ get { return base.BackgroundImage; }
+ set { base.BackgroundImage = value; }
+ }
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new bool CausesValidation
+ {
+ get { return base.CausesValidation; }
+ set {
+ if (base.CausesValidation == value)
+ return;
+
+ base.CausesValidation = value;
+ if (CausesValidationChanged != null)
+ CausesValidationChanged (this, new EventArgs ());
+ }
+ }
+
+ protected override CreateParams CreateParams
+ {
+ get { return base.CreateParams; }
+ }
+
+ protected override ImeMode DefaultImeMode
+ {
+ get { return base.DefaultImeMode; }
+ }
+
+ protected override Size DefaultSize
+ {
+ get { return ThemeEngine.Current.ProgressBarDefaultSize; }
+ }
+
+ // Setting this property in MS .Net 1.1 does not have any visual effect and it
+ // does not fire a FontChanged event
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public override Font Font
+ {
+ get { return base.Font; }
+ set { base.Font = value; }
+ }
+
+ // Setting this property in MS .Net 1.1 does not have any visual effect and it
+ // does not fire a FontChanged event
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public override Color ForeColor
+ {
+ get { return base.ForeColor; }
+ set { base.ForeColor = value; }
+ }
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new ImeMode ImeMode
+ {
+ get { return base.ImeMode; }
+ set
+ {
+ if (value == base.ImeMode)
+ return;
+
+ base.ImeMode = value;
+ if (ImeModeChanged != null)
+ ImeModeChanged (this, EventArgs.Empty);
+ }
+ }
+
+ [RefreshProperties(RefreshProperties.Repaint)]
+ [DefaultValue (100)]
+ public int Maximum
+ {
+ get {
+ return maximum;
+ }
+ set {
+ if (value < 0)
+ throw new ArgumentException(
+ string.Format("Value '{0}' must be greater than or equal to 0.", value ));
+
+ maximum = value;
+ Refresh ();
+ }
+ }
+
+ [RefreshProperties(RefreshProperties.Repaint)]
+ [DefaultValue (0)]
+ public int Minimum {
+ get {
+ return minimum;
+ }
+ set {
+ if (value < 0)
+ throw new ArgumentException(
+ string.Format("Value '{0}' must be greater than or equal to 0.", value ));
+
+ minimum = value;
+ Refresh ();
+ }
+ }
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public override RightToLeft RightToLeft
+ {
+ get { return base.RightToLeft; }
+ set {
+ if (base.RightToLeft == value)
+ return;
+
+ base.RightToLeft = value;
+
+ if (RightToLeftChanged != null)
+ RightToLeftChanged (this, EventArgs.Empty);
+
+ }
+ }
+
+ [DefaultValue (10)]
+ public int Step
+ {
+ get { return step; }
+ set {
+ step = value;
+ Refresh ();
+ }
+ }
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new bool TabStop
+ {
+ get { return base.TabStop; }
+ set {
+ if (base.TabStop == value)
+ return;
+
+ base.TabStop = value;
+
+ if (TabStopChanged != null)
+ TabStopChanged (this, EventArgs.Empty);
+
+ }
+ }
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ [Bindable(false)]
+ public override string Text
+ {
+ get { return base.Text; }
+ set
+ {
+ if (value == base.Text)
+ return;
+
+ if (TextChanged != null)
+ TextChanged (this, EventArgs.Empty);
+
+ Refresh ();
+ }
+ }
+
+ [Bindable(true)]
+ [DefaultValue (0)]
+ public int Value
+ {
+ get {
+ return val;
+ }
+ set {
+ if (value < Minimum || value > Maximum)
+ throw new ArgumentException(
+ string.Format("'{0}' is not a valid value for 'Value'. 'Value' should be between 'Minimum' and 'Maximum'", value));
+
+ val = value;
+ Refresh ();
+ }
+ }
+
+
+ #endregion // Protected Instance Properties
+
+ #region Public Instance Methods
+
+ protected override void CreateHandle ()
+ {
+ base.CreateHandle ();
+ }
+
+ public void Increment (int value)
+ {
+ int newValue = Value + value;
+
+ if (newValue < Minimum)
+ newValue = Minimum;
+
+ if (newValue > Maximum)
+ newValue = Maximum;
+
+ Value = newValue;
+ Refresh ();
+ }
+
+ protected override void OnHandleCreated (EventArgs e)
+ {
+ base.OnHandleCreated (e);
+
+ UpdateAreas ();
+ }
+
+ public void PerformStep ()
+ {
+ if (Value >= Maximum)
+ return;
+
+ Value = Value + Step;
+ Refresh ();
+ }
+
+ public override string ToString()
+ {
+ return string.Format ("{0}, Minimum: {1}, Maximum: {2}, Value: {3}",
+ GetType().FullName.ToString (),
+ Maximum.ToString (),
+ Minimum.ToString (),
+ Value.ToString () );
+ }
+
+ #endregion // Public Instance Methods
+
+ #region Private Instance Methods
+ private void UpdateAreas ()
+ {
+ client_area.X = client_area.Y = 2;
+ client_area.Width = Width - 4;
+ client_area.Height = Height - 4;
+ }
+
+ private void OnResizeTB (Object o, EventArgs e)
+ {
+ if (Width <= 0 || Height <= 0)
+ return;
+
+ UpdateAreas ();
+ }
+
+ private void OnPaintPB (Object o, PaintEventArgs pevent)
+ {
+ ThemeEngine.Current.DrawProgressBar (pevent.Graphics, pevent.ClipRectangle, this);
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertiesTab.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertiesTab.cs
new file mode 100755
index 00000000000..fe1c4505ae1
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertiesTab.cs
@@ -0,0 +1,77 @@
+// 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) 2005 Novell, Inc.
+//
+// Authors:
+// Jonathan Chambers jonathan.chambers@ansys.com
+//
+
+
+// NOT COMPLETE
+
+using System;
+
+namespace System.Windows.Forms.PropertyGridInternal
+{
+ /// <summary>
+ /// Summary description for PropertiesTab.
+ /// </summary>
+ public class PropertiesTab : System.Windows.Forms.Design.PropertyTab
+ {
+ public PropertiesTab()
+ {
+ }
+
+ public override System.ComponentModel.PropertyDescriptorCollection GetProperties(object component, Attribute[] attributes)
+ {
+ return base.GetProperties(null, component, attributes);
+ }
+
+ public override System.ComponentModel.PropertyDescriptorCollection GetProperties(System.ComponentModel.ITypeDescriptorContext context, object component, Attribute[] attributes)
+ {
+ return base.GetProperties (context, component, attributes);
+ }
+
+ public override System.ComponentModel.PropertyDescriptor GetDefaultProperty (object component)
+ {
+ return base.GetDefaultProperty(component);
+ }
+
+ public override string HelpKeyword
+ {
+ get
+ {
+ return base.HelpKeyword;
+ }
+ }
+
+
+ public override string TabName
+ {
+ get
+ {
+ return string.Empty;
+ }
+ }
+
+
+
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGrid.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGrid.cs
new file mode 100644
index 00000000000..0bc88346ab8
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGrid.cs
@@ -0,0 +1,1068 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Jonathan Chambers (jonathan.chambers@ansys.com)
+//
+
+// NOT COMPLETE
+
+using System;
+using System.Drawing;
+using System.Drawing.Design;
+using System.ComponentModel;
+using System.Collections;
+using System.ComponentModel.Design;
+using System.Reflection;
+using System.Windows.Forms.Design;
+using System.Windows.Forms.PropertyGridInternal;
+
+namespace System.Windows.Forms
+{
+ [Designer("System.Windows.Forms.Design.PropertyGridDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+ public class PropertyGrid : System.Windows.Forms.ContainerControl, ComponentModel.Com2Interop.IComPropertyBrowser
+ {
+ #region Private Members
+
+
+ private const int GRID_ITEM_HEIGHT = 16;
+ private const int GRID_LEFT_COLUMN_WIDTH = 16;
+ private const int DIVIDER_PADDING = 2;
+
+ private AttributeCollection browsable_attributes = null;
+ private bool can_show_commands = false;
+ private Color commands_back_color;
+ private Color commands_fore_color;
+ private bool commands_visible;
+ private bool commands_visible_if_available;
+ private Point context_menu_default_location;
+ private bool large_buttons;
+ private Color line_color;
+ private PropertySort property_sort;
+ private PropertyTabCollection property_tabs;
+ private GridItem selected_grid_item;
+ internal GridItemCollection grid_items;
+ private object[] selected_objects;
+ private PropertyTab selected_tab;
+
+ private ImageList toolbar_imagelist;
+ private ToolBarButton categorized_toolbarbutton;
+ private ToolBarButton alphabetic_toolbarbutton;
+ private ToolBarButton separator_toolbarbutton;
+ private ToolBarButton propertypages_toolbarbutton;
+
+ internal ToolBar toolbar;
+ internal PropertyGridView property_grid_view;
+ internal Splitter splitter;
+ internal Panel help_panel;
+ internal Label help_title_label;
+ internal Label help_description_label;
+ private ContextMenu context_menu;
+ private MenuItem reset_menuitem;
+ private MenuItem description_menuitem;
+ private object current_property_value;
+
+ #endregion // Private Members
+
+ #region Contructors
+ public PropertyGrid() {
+ selected_objects = new object[1];
+ grid_items = new GridItemCollection();
+ property_tabs = new PropertyTabCollection();
+
+ line_color = SystemColors.ScrollBar;
+ line_color = SystemColors.ScrollBar;
+ browsable_attributes = new AttributeCollection(new Attribute[] {});
+ commands_visible_if_available = false;
+ property_sort = PropertySort.Categorized;
+
+ property_grid_view = new PropertyGridView(this);
+ property_grid_view.Dock = DockStyle.Fill;
+
+ splitter = new Splitter();
+ splitter.Dock = DockStyle.Bottom;
+
+ help_panel = new Panel();
+ help_panel.Dock = DockStyle.Bottom;
+ //help_panel.DockPadding.All = 3;
+ help_panel.Height = 50;
+ help_panel.BackColor = SystemColors.Control;
+
+
+ help_title_label = new Label();
+ help_title_label.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
+ help_title_label.Name = "help_title_label";
+ help_title_label.Font = new Font(this.Font,FontStyle.Bold);
+ help_title_label.Text = "Title";
+ help_title_label.Location = new Point(2,2);
+ help_title_label.Height = 17;
+ help_title_label.Width = help_panel.Width - 4;
+
+
+ help_description_label = new Label();
+ help_description_label.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
+ help_description_label.Name = "help_description_label";
+ help_description_label.Font = this.Font;
+ help_description_label.Text = "The long important Description";
+ help_description_label.Location = new Point(2,help_title_label.Top+help_title_label.Height);
+ help_description_label.Width = help_panel.Width - 4;
+ help_description_label.Height = 17;
+
+ help_panel.Controls.Add(help_description_label);
+ help_panel.Controls.Add(help_title_label);
+ help_panel.Paint+=new PaintEventHandler(help_panel_Paint);
+
+ toolbar = new ToolBar();
+ toolbar.Dock = DockStyle.Top;
+ categorized_toolbarbutton = new ToolBarButton();
+ alphabetic_toolbarbutton = new ToolBarButton();
+ separator_toolbarbutton = new ToolBarButton();
+ propertypages_toolbarbutton = new ToolBarButton();
+ context_menu = new ContextMenu();
+
+ toolbar_imagelist = new ImageList();
+ toolbar_imagelist.ColorDepth = ColorDepth.Depth32Bit;
+ toolbar_imagelist.ImageSize = new System.Drawing.Size(16, 16);
+ toolbar_imagelist.TransparentColor = System.Drawing.Color.Transparent;
+ toolbar_imagelist.Images.Add( (Image)Locale.GetResource( "propertygrid_sort_category") );
+ toolbar_imagelist.Images.Add( (Image)Locale.GetResource( "propertygrid_sort_alphabetical") );
+ toolbar_imagelist.Images.Add( (Image)Locale.GetResource( "propertygrid_tab_properties") );
+
+ toolbar.Appearance = ToolBarAppearance.Flat;
+ toolbar.AutoSize = false;
+ toolbar.Buttons.AddRange(new ToolBarButton[] {
+ categorized_toolbarbutton,
+ alphabetic_toolbarbutton,
+ separator_toolbarbutton,
+ propertypages_toolbarbutton});
+
+ toolbar.ButtonSize = new System.Drawing.Size(20, 20);
+ toolbar.ImageList = toolbar_imagelist;
+ toolbar.Location = new System.Drawing.Point(0, 0);
+ toolbar.Name = "toolbar";
+ toolbar.ShowToolTips = true;
+ toolbar.Size = new System.Drawing.Size(256, 27);
+ toolbar.TabIndex = 0;
+ toolbar.ButtonClick += new ToolBarButtonClickEventHandler(toolbar_ButtonClick);
+
+ categorized_toolbarbutton.ImageIndex = 0;
+ categorized_toolbarbutton.Style = ToolBarButtonStyle.ToggleButton;
+ categorized_toolbarbutton.ToolTipText = (string)Locale.GetResource( "Categorized");
+
+ alphabetic_toolbarbutton.ImageIndex = 1;
+ alphabetic_toolbarbutton.Style = ToolBarButtonStyle.ToggleButton;
+ alphabetic_toolbarbutton.ToolTipText = (string)Locale.GetResource( "Alphabetic");
+
+ separator_toolbarbutton.Style = ToolBarButtonStyle.Separator;
+
+ propertypages_toolbarbutton.Enabled = false;
+ propertypages_toolbarbutton.ImageIndex = 2;
+ propertypages_toolbarbutton.Style = ToolBarButtonStyle.ToggleButton;
+ propertypages_toolbarbutton.ToolTipText = "Property Pages";
+
+
+ reset_menuitem = context_menu.MenuItems.Add("Reset");
+ reset_menuitem.Click +=new EventHandler(OnResetPropertyClick);
+ context_menu.MenuItems.Add("-");
+ description_menuitem = context_menu.MenuItems.Add("Description");
+ description_menuitem.Click += new EventHandler(OnDescriptionClick);
+ description_menuitem.Checked = this.HelpVisible;
+ this.ContextMenu = context_menu;
+ toolbar.ContextMenu = context_menu;
+
+ this.Controls.Add(property_grid_view);
+ this.Controls.Add(toolbar);
+ this.Controls.Add(splitter);
+ this.Controls.Add(help_panel);
+ this.Name = "PropertyGrid";
+ this.Size = new System.Drawing.Size(256, 400);
+
+ has_focus = false;
+
+ //TextChanged+=new System.EventHandler(RedrawEvent);
+ //ForeColorChanged+=new EventHandler(RedrawEvent);
+ //BackColorChanged+=new System.EventHandler(RedrawEvent);
+ //FontChanged+=new EventHandler(RedrawEvent);
+ //SizeChanged+=new EventHandler(RedrawEvent);
+
+ UpdateToolBarButtons();
+ }
+ #endregion // Constructors
+
+ #region Public Instance Properties
+
+ [BrowsableAttribute(false)]
+ [EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
+ [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]
+ public AttributeCollection BrowsableAttributes {
+ get {
+ return browsable_attributes;
+ }
+
+ set {
+ if (browsable_attributes == value) {
+ return;
+ }
+
+ browsable_attributes = value;
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool AutoScroll {
+ get {
+ return base.AutoScroll;
+ }
+ set {
+ base.AutoScroll = value;
+ }
+ }
+
+ public override Color BackColor {
+ get {
+ return base.BackColor;
+ }
+
+ set {
+ if (base.BackColor == value) {
+ return;
+ }
+ base.BackColor = value;
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override Image BackgroundImage {
+ get {
+ return base.BackgroundImage;
+ }
+ set {
+ base.BackgroundImage = value;
+ }
+ }
+
+
+ [BrowsableAttribute(false)]
+ [EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
+ public virtual bool CanShowCommands {
+ get {
+ return can_show_commands;
+ }
+ }
+
+ public Color CommandsBackColor {
+ get {
+ return commands_back_color;
+ }
+
+ set {
+ if (commands_back_color == value) {
+ return;
+ }
+ commands_back_color = value;
+ }
+ }
+
+ public Color CommandsForeColor {
+ get {
+ return commands_fore_color;
+ }
+
+ set {
+ if (commands_fore_color == value) {
+ return;
+ }
+ commands_fore_color = value;
+ }
+ }
+
+ [BrowsableAttribute(false)]
+ [EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
+ public virtual bool CommandsVisible {
+ get {
+ return commands_visible;
+ }
+ }
+
+ [DefaultValue(false)]
+ public virtual bool CommandsVisibleIfAvailable {
+ get {
+ return commands_visible_if_available;
+ }
+
+ set {
+ if (commands_visible_if_available == value) {
+ return;
+ }
+ commands_visible_if_available = value;
+ }
+ }
+
+ [BrowsableAttribute(false)]
+ [EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
+ [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]
+ public Point ContextMenuDefaultLocation {
+ get {
+ return context_menu_default_location;
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public new Control.ControlCollection Controls {
+ get {
+ return base.Controls;
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override Color ForeColor
+ {
+ get {
+ return base.ForeColor;
+ }
+ set {
+ base.ForeColor = value;
+ }
+ }
+
+ public Color HelpBackColor {
+ get
+ {
+ return help_panel.BackColor;
+ }
+ set
+ {
+ if (help_panel.BackColor == value) {
+ return;
+ }
+
+ help_panel.BackColor = value;
+ }
+ }
+
+ public Color HelpForeColor {
+ get {
+ return help_panel.ForeColor;
+ }
+
+ set {
+ if (help_panel.ForeColor == value) {
+ return;
+ }
+
+ help_panel.ForeColor = value;
+ }
+ }
+
+ [DefaultValue(true)]
+ [Localizable(true)]
+ public virtual bool HelpVisible {
+ get {
+ return help_panel.Visible;
+ }
+
+ set {
+ if (help_panel.Visible == value) {
+ return;
+ }
+
+ help_panel.Visible = value;
+ }
+ }
+
+ public bool LargeButtons {
+ get {
+ return large_buttons;
+ }
+
+ set {
+ if (large_buttons == value) {
+ return;
+ }
+
+ large_buttons = value;
+ }
+ }
+
+ public Color LineColor {
+ get {
+ return line_color;
+ }
+
+ set {
+ if (line_color == value) {
+ return;
+ }
+
+ line_color = value;
+ }
+ }
+
+ [DefaultValue(PropertySort.CategorizedAlphabetical)]
+ public PropertySort PropertySort {
+ get {
+ return property_sort;
+ }
+
+ set {
+ if (!Enum.IsDefined (typeof (PropertySort), value)) {
+ throw new InvalidEnumArgumentException (string.Format("Enum argument value '{0}' is not valid for PropertySort", value));
+ }
+
+ if (property_sort == value) {
+ return;
+ }
+
+ property_sort = value;
+
+ ReflectObjects();
+ Console.WriteLine("PropertySort");
+ property_grid_view.Refresh();
+
+ if (PropertySortChanged != null) {
+ PropertySortChanged(this, EventArgs.Empty);
+ }
+ }
+ }
+
+ [BrowsableAttribute(false)]
+ [EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
+ [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]
+ public PropertyTabCollection PropertyTabs {
+ get {
+ return property_tabs;
+ }
+ }
+
+ [BrowsableAttribute(false)]
+ [EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
+ [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]
+ public GridItem SelectedGridItem {
+ get {
+ return selected_grid_item;
+ }
+
+ set {
+ if (selected_grid_item == value) {
+ return;
+ }
+
+ GridItem oldItem = selected_grid_item;
+ selected_grid_item = value;
+ this.help_title_label.Text = selected_grid_item.Label;
+ if (selected_grid_item.PropertyDescriptor != null)
+ this.help_description_label.Text = selected_grid_item.PropertyDescriptor.Description;
+
+ Console.WriteLine("SelectedGridItem");
+ current_property_value = value.Value;
+ if (oldItem != null && oldItem.PropertyDescriptor != null)
+ oldItem.PropertyDescriptor.RemoveValueChanged(SelectedObject, new EventHandler(HandlePropertyValueChanged));
+ if (selected_grid_item.PropertyDescriptor != null)
+ selected_grid_item.PropertyDescriptor.AddValueChanged(SelectedObject, new EventHandler(HandlePropertyValueChanged));
+ OnSelectedGridItemChanged(new SelectedGridItemChangedEventArgs( oldItem, selected_grid_item));
+
+ }
+ }
+
+ private void HandlePropertyValueChanged(object sender, EventArgs e)
+ {
+ OnPropertyValueChanged(new PropertyValueChangedEventArgs( selected_grid_item, current_property_value));
+ }
+
+ [DefaultValue(null)]
+ [TypeConverter("System.Windows.Forms.PropertyGrid+SelectedObjectConverter, " + Consts.AssemblySystem_Windows_Forms)]
+ public object SelectedObject {
+ get {
+ return selected_objects[0];
+ }
+
+ set {
+ selected_objects = new object[] {value};
+ if (this.SelectedObject == null)
+ return;
+ PropertyTabAttribute[] propTabs = (PropertyTabAttribute[])this.SelectedObject.GetType().GetCustomAttributes(typeof(PropertyTabAttribute),true);
+ if (propTabs.Length > 0)
+ {
+ foreach (Type tabType in propTabs[0].TabClasses)
+ {
+ this.PropertyTabs.AddTabType(tabType);
+ }
+ }
+ RefreshTabs(PropertyTabScope.Component);
+ Console.WriteLine("SelectedObject");
+ ReflectObjects();
+ property_grid_view.Refresh();
+ }
+ }
+
+ [BrowsableAttribute(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public object[] SelectedObjects {
+ get {
+ return selected_objects;
+ }
+
+ set {
+ selected_objects = value;
+ ReflectObjects();
+ }
+ }
+
+ [BrowsableAttribute(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public PropertyTab SelectedTab {
+ get {
+ return selected_tab;
+ }
+ }
+
+ public override ISite Site {
+ get {
+ return base.Site;
+ }
+
+ set {
+ base.Site = value;
+ }
+ }
+
+
+ [DefaultValue(true)]
+ public virtual bool ToolbarVisible {
+ get {
+ return toolbar.Visible;
+ }
+
+ set {
+ if (toolbar.Visible == value) {
+ return;
+ }
+
+ toolbar.Visible = value;
+ }
+ }
+
+ public Color ViewBackColor {
+ get {
+ return property_grid_view.BackColor;
+ }
+
+ set {
+ if (property_grid_view.BackColor == value) {
+ return;
+ }
+
+ property_grid_view.BackColor = value;
+ }
+ }
+
+ public Color ViewForeColor {
+ get {
+ return property_grid_view.ForeColor;
+ }
+
+ set {
+ if (property_grid_view.ForeColor == value) {
+ return;
+ }
+
+ property_grid_view.ForeColor = value;
+ }
+ }
+
+ #endregion // Public Instance Properties
+
+ #region Protected Instance Properties
+
+ protected override Size DefaultSize {
+ get {
+ return base.DefaultSize;
+ }
+ }
+
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]
+ protected virtual Type DefaultTabType {
+ get {
+ return typeof(PropertiesTab);
+ }
+ }
+
+ protected bool DrawFlatToolbar {
+ get {
+ return (toolbar.Appearance == ToolBarAppearance.Flat);
+ }
+ set {
+ if (value)
+ toolbar.Appearance = ToolBarAppearance.Flat;
+ else
+ toolbar.Appearance = ToolBarAppearance.Normal;
+ }
+ }
+
+ protected override bool ShowFocusCues {
+ get {
+ return base.ShowFocusCues;
+ }
+ }
+
+ #endregion // Protected Instance Properties
+
+ #region Public Instance Methods
+
+ protected override void Dispose(bool val)
+ {
+ base.Dispose(val);
+ }
+
+ public void CollapseAllGridItems ()
+ {
+ foreach (GridItem item in this.grid_items)
+ {
+ item.Expanded = false;
+ }
+ }
+
+ public void ExpandAllGridItems ()
+ {
+ foreach (GridItem item in this.grid_items)
+ {
+ item.Expanded = true;
+ }
+ }
+
+ public override void Refresh ()
+ {
+ base.Refresh ();
+ }
+
+ public void RefreshTabs (PropertyTabScope tabScope)
+ {
+
+ /*button = new ToolBarButton("C");
+ button.ImageIndex = 0;
+ this.toolbar.Buttons.Add(button);
+ button = new ToolBarButton();
+ button.ImageIndex = 0;
+ button.Style = ToolBarButtonStyle.Separator;
+ this.toolbar.Buttons.Add(button);
+ foreach (PropertyTab tab in this.PropertyTabs)
+ {
+
+ int index = toolbar.ImageList.Images.Count;
+ this.toolbar.ImageList.Images.Add(tab.Bitmap);
+ button = new ToolBarButton();
+ button.ImageIndex = index;
+ this.toolbar.Buttons.Add(button);
+ }*/
+
+ }
+
+ public void ResetSelectedProperty()
+ {
+ if (selected_grid_item == null || selected_grid_item.PropertyDescriptor == null)
+ return;
+
+ selected_grid_item.PropertyDescriptor.ResetValue(SelectedObject);
+ }
+ #endregion // Public Instance Methods
+
+ #region Protected Instance Methods
+
+ protected virtual PropertyTab CreatePropertyTab(Type tabType)
+ {
+ return (PropertyTab)Activator.CreateInstance(tabType);
+ }
+
+ [MonoTODO]
+ protected void OnComComponentNameChanged(ComponentRenameEventArgs e)
+ {
+ throw new NotImplementedException();
+ }
+
+ protected override void OnFontChanged(EventArgs e)
+ {
+ base.OnFontChanged (e);
+ }
+
+ protected override void OnGotFocus(EventArgs e)
+ {
+ has_focus=true;
+ base.OnGotFocus(e);
+ }
+
+ protected override void OnHandleCreated (EventArgs e)
+ {
+ base.OnHandleCreated (e);
+ }
+
+ protected override void OnHandleDestroyed (EventArgs e)
+ {
+ base.OnHandleDestroyed (e);
+ }
+
+ protected override void OnMouseDown (MouseEventArgs e)
+ {
+ base.OnMouseDown (e);
+ }
+
+ protected override void OnMouseMove (MouseEventArgs e)
+ {
+ base.OnMouseMove (e);
+ }
+
+ protected override void OnMouseUp (MouseEventArgs e)
+ {
+ base.OnMouseUp (e);
+ }
+
+ [MonoTODO]
+ protected void OnNotifyPropertyValueUIItemsChanged(object sender, EventArgs e)
+ {
+ }
+
+ protected override void OnPaint (PaintEventArgs pevent)
+ {
+ base.OnPaint (pevent);
+ }
+
+ [MonoTODO]
+ protected virtual void OnPropertyTabChanged (PropertyTabChangedEventArgs e)
+ {
+ throw new NotImplementedException();
+ }
+
+ protected virtual void OnPropertyValueChanged (PropertyValueChangedEventArgs e)
+ {
+ if (PropertyValueChanged != null)
+ {
+ PropertyValueChanged(this, e);
+ current_property_value = selected_grid_item.Value;
+ }
+ }
+
+ protected override void OnResize (EventArgs e)
+ {
+ base.OnResize (e);
+ }
+
+ protected virtual void OnSelectedGridItemChanged (SelectedGridItemChangedEventArgs e)
+ {
+ if (SelectedGridItemChanged != null)
+ {
+ SelectedGridItemChanged(this, e);
+ }
+ }
+
+ protected virtual void OnSelectedObjectsChanged (EventArgs e)
+ {
+ if (SelectedObjectsChanged != null)
+ {
+ SelectedObjectsChanged(this, e);
+ }
+ }
+
+ protected override void OnSystemColorsChanged (EventArgs e)
+ {
+ base.OnSystemColorsChanged (e);
+ }
+
+ protected override void OnVisibleChanged (EventArgs e)
+ {
+ base.OnVisibleChanged (e);
+ }
+
+ protected override bool ProcessDialogKey (Keys keyData)
+ {
+ return base.ProcessDialogKey (keyData);
+ }
+
+ protected override void ScaleCore (float dx, float dy)
+ {
+ base.ScaleCore (dx, dy);
+ }
+
+ [MonoTODO]
+ protected void ShowEventsButton(bool value)
+ {
+ throw new NotImplementedException();
+ }
+
+ protected override void WndProc (ref Message m)
+ {
+ base.WndProc (ref m);
+ }
+ #endregion
+
+ #region Events
+ public event EventHandler PropertySortChanged;
+ public event PropertyTabChangedEventHandler PropertyTabChanged;
+ public event PropertyValueChangedEventHandler PropertyValueChanged;
+ public event SelectedGridItemChangedEventHandler SelectedGridItemChanged;
+ public event EventHandler SelectedObjectsChanged;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler BackgroundImageChanged;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler ForeColorChanged;
+ #endregion
+
+ #region Com2Interop.IComPropertyBrowser Interface
+ [MonoTODO]
+ bool ComponentModel.Com2Interop.IComPropertyBrowser.InPropertySet {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ [MonoTODO]
+ void ComponentModel.Com2Interop.IComPropertyBrowser.DropDownDone() {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ bool ComponentModel.Com2Interop.IComPropertyBrowser.EnsurePendingChangesCommitted() {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ void ComponentModel.Com2Interop.IComPropertyBrowser.HandleF4() {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ void ComponentModel.Com2Interop.IComPropertyBrowser.LoadState(Microsoft.Win32.RegistryKey key) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ void ComponentModel.Com2Interop.IComPropertyBrowser.SaveState(Microsoft.Win32.RegistryKey key) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ private event ComponentRenameEventHandler com_component_name_changed;
+ event ComponentRenameEventHandler ComponentModel.Com2Interop.IComPropertyBrowser.ComComponentNameChanged {
+ add { com_component_name_changed += value; }
+ remove { com_component_name_changed -= value; }
+ }
+ #endregion // Com2Interop.IComPropertyBrowser Interface
+
+ #region PropertyTabCollection Class
+ public class PropertyTabCollection : ICollection, IEnumerable
+ {
+ System.Collections.ArrayList list;
+ #region Private Constructors
+ internal PropertyTabCollection() {
+ list = new ArrayList();
+ }
+
+ #endregion // Private Constructors
+
+ public PropertyTab this[int index] {
+ get {
+ return (PropertyTab)list[index];
+ }
+ }
+
+ #region ICollection Members
+ bool ICollection.IsSynchronized
+ {
+ get {
+ return list.IsSynchronized;
+ }
+ }
+
+ void ICollection.CopyTo(Array array, int index)
+ {
+ list.CopyTo(array, index);
+ }
+
+ object ICollection.SyncRoot
+ {
+ get {
+ return list.SyncRoot;
+ }
+ }
+
+ #endregion
+
+ #region IEnumerable Members
+ public IEnumerator GetEnumerator() {
+ return list.GetEnumerator();
+ }
+
+ #endregion
+
+ #region ICollection Members
+ public int Count {
+ get {
+ return list.Count;
+ }
+ }
+
+ #endregion
+
+ #region Public Instance Methods
+ public void AddTabType(System.Type propertyTabType)
+ {
+ list.Add(Activator.CreateInstance(propertyTabType));
+ }
+ [MonoTODO]
+ public void AddTabType(System.Type propertyTabType,
+ System.ComponentModel.PropertyTabScope tabScope)
+ {
+ AddTabType(propertyTabType);
+ }
+ [MonoTODO]
+ public void Clear(System.ComponentModel.PropertyTabScope tabScope)
+ {
+ throw new NotImplementedException();
+ }
+ [MonoTODO]
+ public void RemoveTabType(System.Type propertyTabType)
+ {
+ throw new NotImplementedException();
+ }
+ #endregion
+ }
+ #endregion // PropertyTabCollection Class
+
+ #region Private Helper Methods
+
+ private void toolbar_ButtonClick (object sender, ToolBarButtonClickEventArgs e)
+ {
+ if (e.Button == alphabetic_toolbarbutton) {
+ this.PropertySort = PropertySort.Alphabetical;
+ }
+ else if (e.Button == categorized_toolbarbutton) {
+ this.PropertySort = PropertySort.Categorized;
+ }
+ UpdateToolBarButtons();
+ ReflectObjects();
+ Console.WriteLine("toolbar_ButtonClick");
+ property_grid_view.Refresh();
+ }
+
+ internal void UpdateToolBarButtons ()
+ {
+ if (PropertySort == PropertySort.Alphabetical) {
+ categorized_toolbarbutton.Pushed = false;
+ alphabetic_toolbarbutton.Pushed = true;
+ }
+ else if (PropertySort == PropertySort.Categorized) {
+ categorized_toolbarbutton.Pushed = true;
+ alphabetic_toolbarbutton.Pushed = false;
+ }
+ else {
+ categorized_toolbarbutton.Pushed = false;
+ alphabetic_toolbarbutton.Pushed = false;
+ }
+ }
+
+ private void OnResetPropertyClick (object sender, EventArgs e)
+ {
+ ResetSelectedProperty();
+ }
+
+ private void OnDescriptionClick (object sender, EventArgs e)
+ {
+ this.HelpVisible = !this.HelpVisible;
+ description_menuitem.Checked = this.HelpVisible;
+
+ }
+
+ private void ReflectObjects ()
+ {
+ grid_items = new GridItemCollection();
+ foreach (object obj in selected_objects) {
+ if (obj != null) {
+ PopulateGridItemCollection(obj,grid_items, true);
+ }
+ }
+ }
+
+ private void PopulateGridItemCollection (object obj, GridItemCollection grid_item_coll, bool recurse)
+ {
+ //TypeConverter converter = TypeDescriptor.GetConverter(obj);
+ PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(obj);
+ foreach (PropertyDescriptor property in properties) {
+ if (property.IsBrowsable) {
+ GridEntry grid_entry = new GridEntry(obj, property);
+ if (property_sort == PropertySort.Alphabetical || !recurse)
+ {
+ if (grid_item_coll[property.Name] == null)
+ grid_item_coll.Add(property.Name,grid_entry);
+ }
+ else if (property_sort == PropertySort.Categorized || property_sort == PropertySort.CategorizedAlphabetical)
+ {
+
+ string category = property.Category;
+ GridItem cat_item = grid_item_coll[category];
+ if (cat_item == null)
+ {
+ cat_item = new CategoryGridEntry(category);
+ grid_item_coll.Add(category,cat_item);
+ }
+ cat_item.GridItems.Add(property.Name,grid_entry);
+ }
+ if (recurse)
+ {
+ object propObj = property.GetValue(obj);
+ if (propObj != null)
+ PopulateGridItemCollection(propObj,grid_entry.GridItems, false);
+ }
+ }
+ }
+ }
+
+ #endregion // Private Helper Methods
+
+ private void help_panel_Paint(object sender, PaintEventArgs e)
+ {
+ e.Graphics.FillRectangle(ThemeEngine.Current.ResPool.GetSolidBrush(help_panel.BackColor), help_panel.ClientRectangle );
+ e.Graphics.DrawRectangle(SystemPens.ControlDark, 0,0,help_panel.Width-1,help_panel.Height-1 );
+ }
+#if NET_2_0
+
+ public bool UseCompatibleTextRendering {
+ get {
+ return use_compatible_text_rendering;
+ }
+
+ set {
+ use_compatible_text_rendering = value;
+ }
+ }
+#endif
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridCommands.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridCommands.cs
new file mode 100755
index 00000000000..b92886962ec
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridCommands.cs
@@ -0,0 +1,47 @@
+// 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) 2005 Novell, Inc.
+//
+// Authors:
+// Jonathan Chambers jonathan.chambers@ansys.com
+//
+
+
+// COMPLETE
+
+using System;
+using System.ComponentModel.Design;
+
+namespace System.Windows.Forms.PropertyGridInternal
+{
+ public class PropertyGridCommands
+ {
+ public PropertyGridCommands()
+ {
+ }
+
+ public static readonly CommandID Commands;
+ public static readonly CommandID Description;
+ public static readonly CommandID Hide;
+ public static readonly CommandID Reset;
+ protected static readonly Guid wfcMenuCommand;
+ protected static readonly Guid wfcMenuGroup;
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridEntry.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridEntry.cs
new file mode 100644
index 00000000000..1e71c636626
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridEntry.cs
@@ -0,0 +1,18 @@
+using System;
+using System.ComponentModel;
+
+namespace System.Windows.Forms.PropertyGridInternal {
+ /// <summary>
+ /// Summary description for PropertyGridEntry.
+ /// </summary>
+ internal class PropertyGridEntry : GridEntry {
+ public PropertyGridEntry() {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+
+ public PropertyGridEntry(object obj, PropertyDescriptor prop_desc) : base(obj, prop_desc) {
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridTextBox.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridTextBox.cs
new file mode 100644
index 00000000000..be8110e959e
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridTextBox.cs
@@ -0,0 +1,146 @@
+using System;
+
+namespace System.Windows.Forms.PropertyGridInternal {
+ internal class PropertyGridTextBox : System.Windows.Forms.UserControl {
+ private TextBox textbox;
+ private Button dialog_button;
+ private Button dropdown_button;
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.Container components = null;
+
+ public PropertyGridTextBox() {
+ // This call is required by the Windows.Forms Form Designer.
+ InitializeComponent();
+ dropdown_button.Paint+=new PaintEventHandler(dropdown_button_Paint);
+
+ // TODO: Add any initialization after the InitializeComponent call
+
+ }
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ protected override void Dispose( bool disposing ) {
+ if( disposing ) {
+ if(components != null) {
+ components.Dispose();
+ }
+ }
+ base.Dispose( disposing );
+ }
+
+ #region Component Designer generated code
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent() {
+ this.dialog_button = new System.Windows.Forms.Button();
+ this.dropdown_button = new System.Windows.Forms.Button();
+ this.textbox = new System.Windows.Forms.TextBox();
+ this.SuspendLayout();
+ //
+ // dialog_button
+ //
+ this.dialog_button.Dock = System.Windows.Forms.DockStyle.Right;
+ this.dialog_button.Location = new System.Drawing.Point(256, 0);
+ this.dialog_button.Name = "dialog_button";
+ this.dialog_button.Size = new System.Drawing.Size(16, 16);
+ this.dialog_button.TabIndex = 1;
+ this.dialog_button.Text = "D";
+ this.dialog_button.Visible = false;
+ this.dialog_button.Click += new System.EventHandler(this.dialog_button_Click);
+ //
+ // dropdown_button
+ //
+ this.dropdown_button.Dock = System.Windows.Forms.DockStyle.Right;
+ this.dropdown_button.Location = new System.Drawing.Point(240, 0);
+ this.dropdown_button.Name = "dropdown_button";
+ this.dropdown_button.Size = new System.Drawing.Size(16, 16);
+ this.dropdown_button.TabIndex = 2;
+ this.dropdown_button.Visible = false;
+ this.dropdown_button.Click += new System.EventHandler(this.dropdown_button_Click);
+ //
+ // textbox
+ //
+ this.textbox.AutoSize = false;
+ this.textbox.BackColor = System.Drawing.SystemColors.Window;
+ this.textbox.BorderStyle = System.Windows.Forms.BorderStyle.None;
+ this.textbox.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.textbox.Location = new System.Drawing.Point(0, 0);
+ this.textbox.Name = "textbox";
+ this.textbox.Size = new System.Drawing.Size(240, 16);
+ this.textbox.TabIndex = 3;
+ this.textbox.Text = "textbox";
+ //
+ // PropertyGridTextBox
+ //
+ this.Controls.Add(this.textbox);
+ this.Controls.Add(this.dropdown_button);
+ this.Controls.Add(this.dialog_button);
+ this.Name = "PropertyGridTextBox";
+ this.Size = new System.Drawing.Size(272, 16);
+ this.ResumeLayout(false);
+
+ }
+ #endregion
+
+ private void dropdown_button_Click(object sender, System.EventArgs e) {
+ if (DropDownButtonClicked != null)
+ DropDownButtonClicked(this, EventArgs.Empty);
+ }
+
+ private void dialog_button_Click(object sender, System.EventArgs e) {
+ if (DialogButtonClicked != null)
+ DialogButtonClicked(this, EventArgs.Empty);
+ }
+
+
+ public event EventHandler DropDownButtonClicked;
+ public event EventHandler DialogButtonClicked;
+
+ public bool DialogButtonVisible {
+ get{
+ return dialog_button.Visible;
+ }
+ set {
+ dialog_button.Visible = value;
+ dropdown_button.Redraw();
+ }
+ }
+ public bool DropDownButtonVisible {
+ get{
+ return dropdown_button.Visible;
+ }
+ set {
+ dropdown_button.Visible = value;
+ dropdown_button.Redraw();
+ }
+ }
+
+ public bool ReadOnly {
+ get {
+ return textbox.ReadOnly;
+ }
+ set {
+ textbox.ReadOnly = value;
+ }
+ }
+
+ public new string Text {
+ get {
+ return textbox.Text;
+ }
+ set {
+ textbox.Text = value;
+ }
+ }
+
+ private void dropdown_button_Paint(object sender, PaintEventArgs e)
+ {
+ ThemeEngine.Current.CPDrawComboButton(e.Graphics, dropdown_button.ClientRectangle, dropdown_button.ButtonState);
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs
new file mode 100644
index 00000000000..638fdb9bc77
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs
@@ -0,0 +1,758 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Jonathan Chambers (jonathan.chambers@ansys.com)
+//
+//
+
+// NOT COMPLETE
+
+using System;
+using System.Collections;
+using System.Drawing;
+using System.Drawing.Design;
+using System.ComponentModel;
+using System.Windows.Forms.Design;
+
+namespace System.Windows.Forms.PropertyGridInternal
+{
+ internal class PropertyGridView : System.Windows.Forms.ScrollableControl, IWindowsFormsEditorService
+ {
+
+ #region Private Members
+ private const int V_INDENT = 16;
+ private const int ROW_HEIGHT = 16;
+ private const int RESIZE_WIDTH = 3;
+ private const int BUTTON_WIDTH = 25;
+ private PropertyGridTextBox grid_textbox;
+ private PropertyGrid property_grid;
+ private bool resizing_grid;
+ private int splitter_location;
+ private int open_grid_item_count = -1;
+ private int skipped_grid_items;
+ private PropertyGridDropDown dropdown_form;
+ private bool dropdown_form_showing;
+ private Form dialog_form;
+ private VScrollBar vbar;
+ private StringFormat stringFormat;
+ #endregion
+
+ #region Contructors
+ public PropertyGridView (PropertyGrid propertyGrid)
+ {
+ property_grid = propertyGrid;
+
+ property_grid.SelectedGridItemChanged+=new SelectedGridItemChangedEventHandler(HandleSelectedGridItemChanged);
+ property_grid.PropertyValueChanged+=new PropertyValueChangedEventHandler(HandlePropertyValueChanged);
+
+ stringFormat = new StringFormat();
+ stringFormat.FormatFlags = StringFormatFlags.NoWrap;
+ stringFormat.Trimming = StringTrimming.None;
+
+ this.BackColor = Color.Beige;
+ grid_textbox = new PropertyGridTextBox();
+ grid_textbox.DropDownButtonClicked +=new EventHandler(DropDownButtonClicked);
+ grid_textbox.DialogButtonClicked +=new EventHandler(DialogButtonClicked);
+
+
+ dropdown_form = new PropertyGridDropDown();
+ dropdown_form.FormBorderStyle = FormBorderStyle.None;
+ dropdown_form.ShowInTaskbar = false;
+
+ dialog_form = new Form();
+ //dialog_form.FormBorderStyle = FormBorderStyle.None;
+
+
+
+ grid_textbox.Visible = false;
+ grid_textbox.Font = this.Font;//new Font(this.Font,FontStyle.Bold);
+ grid_textbox.BackColor = this.BackColor;
+ // Not working at all, used to??
+ grid_textbox.Validating += new CancelEventHandler(TextBoxValidating);
+ this.Controls.Add(grid_textbox);
+
+ vbar = new VScrollBar();
+ vbar.Visible = false;
+ vbar.Scroll+=new ScrollEventHandler(HandleScroll);
+ vbar.Dock = DockStyle.Right;
+ this.Controls.Add(vbar);
+
+ splitter_location = 65;
+ resizing_grid = false;
+
+ ForeColorChanged+=new EventHandler(RedrawEvent);
+ BackColorChanged+=new System.EventHandler(RedrawEvent);
+ FontChanged+=new EventHandler(RedrawEvent);
+ SizeChanged+=new EventHandler(RedrawEvent);
+
+ SetStyle(ControlStyles.DoubleBuffer, true);
+ SetStyle(ControlStyles.UserPaint, true);
+ SetStyle(ControlStyles.AllPaintingInWmPaint, true);
+ SetStyle(ControlStyles.ResizeRedraw, false);
+ SetStyle(ControlStyles.StandardClick | ControlStyles.StandardDoubleClick, false);
+ }
+
+ #endregion
+
+ #region Protected Instance Methods
+
+ protected override void OnPaint(PaintEventArgs e)
+ {
+ if (property_grid.SelectedGridItem != null && property_grid.SelectedGridItem.GridItemType == GridItemType.Property)
+ {
+ grid_textbox.Visible = true;
+ if (!grid_textbox.Focused)
+ grid_textbox.Focus();
+ }
+ else
+ {
+ grid_textbox.Visible = false;
+ }
+
+ // Decide if we need a scrollbar
+ open_grid_item_count = 0;
+
+ // draw grid outline
+ //DrawBackground(e);
+
+ e.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (BackColor), ClientRectangle);
+
+ // draw grid items
+ // can we use the transform
+ //pevent.Graphics.TranslateTransform(0, -vbar.Value*ROW_HEIGHT);
+ int yLoc = -vbar.Value*ROW_HEIGHT;
+ DrawGridItems(property_grid.grid_items, e, 1, ref yLoc);
+
+ DrawGrid(e, yLoc);
+ e.Graphics.DrawRectangle(SystemPens.ControlDark, 0,0,Width-1,Height-1 );
+
+
+
+
+ UpdateScrollBar();
+
+ base.OnPaint(e);
+ }
+
+ protected override void OnMouseMove (MouseEventArgs e)
+ {
+
+ if (resizing_grid)
+ {
+ splitter_location = Math.Max(e.X,2*V_INDENT);
+ Refresh();
+ }
+ if (e.X > splitter_location - RESIZE_WIDTH && e.X < splitter_location + RESIZE_WIDTH)
+ this.Cursor = Cursors.SizeWE;
+ else
+ this.Cursor = Cursors.Default;
+ base.OnMouseMove (e);
+ }
+
+ private GridItem GetSelectedGridItem (GridItemCollection grid_items, int y, ref int current)
+ {
+ foreach (GridItem child_grid_item in grid_items)
+ {
+ if (y > current && y < current + ROW_HEIGHT)
+ {
+ return child_grid_item;
+ }
+ current += ROW_HEIGHT;
+ if (child_grid_item.Expanded)
+ {
+ GridItem foundItem = GetSelectedGridItem(child_grid_item.GridItems, y, ref current);
+ if (foundItem != null)
+ return foundItem;
+ }
+ }
+ return null;
+ }
+
+ protected override void OnMouseDown (MouseEventArgs e)
+ {
+ if (e.X > splitter_location - RESIZE_WIDTH && e.X < splitter_location + RESIZE_WIDTH)
+ {
+ resizing_grid = true;
+ }
+ else
+ {
+ int offset = -vbar.Value*ROW_HEIGHT;
+ GridItem foundItem = GetSelectedGridItem(property_grid.grid_items, e.Y, ref offset);
+
+ if (foundItem != null)
+ {
+ if (foundItem.Expandable)
+ {
+ if (e.X >=3 && e.X <= 11 && (e.Y % ROW_HEIGHT >= 3 && e.Y % ROW_HEIGHT <= 11))
+ {
+ foundItem.Expanded = !foundItem.Expanded;
+ Invalidate();
+ }
+ }
+ this.property_grid.SelectedGridItem = foundItem;
+ }
+
+ base.OnMouseDown (e);
+ }
+ }
+
+ protected override void OnMouseUp (MouseEventArgs e)
+ {
+ resizing_grid = false;
+ base.OnMouseUp (e);
+ }
+
+ protected override void OnKeyDown (KeyEventArgs e)
+ {
+ base.OnKeyDown (e);
+ }
+
+ #endregion
+
+ #region Private Helper Methods
+
+ private void UpdateScrollBar()
+ {
+ int visible_rows = this.ClientRectangle.Height/ROW_HEIGHT;
+ if (open_grid_item_count > visible_rows)
+ {
+ vbar.Visible = true;
+ vbar.SmallChange = 1;
+ vbar.Minimum = 0;
+ vbar.Maximum = open_grid_item_count-1;
+ vbar.LargeChange = visible_rows;
+ }
+ else
+ {
+ vbar.Visible = false;
+ }
+
+ }
+
+ private GridItem GetGridItemAt (int y)
+ {
+ return null;
+ }
+
+ #region Drawing Code
+
+ private void DrawGrid(PaintEventArgs pevent, int yLoc)
+ {
+ Pen pen = ThemeEngine.Current.ResPool.GetPen(property_grid.LineColor);
+ // vertical divider line
+ pevent.Graphics.DrawLine(pen, splitter_location, 0, splitter_location, yLoc);
+
+ while (yLoc >= 0)
+ {
+ // horizontal lines
+ pevent.Graphics.DrawLine(pen, 0, yLoc, ClientRectangle.Width, yLoc);
+ yLoc -= ROW_HEIGHT;
+ }
+ }
+
+ private void DrawGridItems(GridItemCollection grid_items, PaintEventArgs pevent, int depth, ref int yLoc)
+ {
+ foreach (GridItem grid_item in grid_items)
+ {
+ DrawGridItem (grid_item, pevent, depth, ref yLoc);
+ if (grid_item.Expanded)
+ DrawGridItems(grid_item.GridItems, pevent, (grid_item.GridItemType == GridItemType.Category) ? depth : depth+1, ref yLoc);
+ }
+ }
+
+ private void DrawGridItemLabel(GridItem grid_item, PaintEventArgs pevent, Rectangle rect)
+ {
+ int x = rect.X+1;
+ if (grid_item.Parent != null && grid_item.Parent.GridItemType != GridItemType.Category)
+ x += V_INDENT;
+
+ Font font = this.Font;
+ Brush brush = SystemBrushes.WindowText;
+ if (grid_item.GridItemType == GridItemType.Category)
+ {
+ font = new Font(font, FontStyle.Bold);
+ brush = SystemBrushes.ControlDark;
+ }
+
+ if (grid_item == property_grid.SelectedGridItem && grid_item.GridItemType != GridItemType.Category)
+ {
+ pevent.Graphics.FillRectangle (SystemBrushes.Highlight, rect);
+ // Label
+ brush = SystemBrushes.HighlightText;
+ }
+
+
+ pevent.Graphics.DrawString(grid_item.Label,font,brush,new Rectangle(x, rect.Y + 2,x-rect.X+rect.Width-2,rect.Height-2),stringFormat);
+ }
+
+ private void DrawGridItemValue(GridItem grid_item, PaintEventArgs pevent, Rectangle rect)
+ {
+ // Value
+ if (grid_item.PropertyDescriptor != null)
+ {
+
+ bool paintsValue = false;
+ UITypeEditor editor = null;
+ object temp = grid_item.PropertyDescriptor.GetEditor(typeof(UITypeEditor));
+ editor = (UITypeEditor)temp;//grid_item.PropertyDescriptor.GetEditor(typeof(UITypeEditor));
+ if (editor != null)
+ {
+ paintsValue = editor.GetPaintValueSupported();
+ }
+
+ if (grid_item == property_grid.SelectedGridItem)
+ {
+ grid_textbox.ReadOnly = false;
+ grid_textbox.DropDownButtonVisible = false;
+ grid_textbox.DialogButtonVisible = false;
+ if (editor != null)
+ {
+ UITypeEditorEditStyle style = editor.GetEditStyle();
+
+ switch (style)
+ {
+ case UITypeEditorEditStyle.DropDown:
+ grid_textbox.DropDownButtonVisible = true;
+ break;
+ case UITypeEditorEditStyle.Modal:
+ grid_textbox.DialogButtonVisible = true;
+ break;
+ }
+ }
+ else
+ {
+ try
+ {
+ if (grid_item.PropertyDescriptor.Converter != null)
+ {
+ if (grid_item.PropertyDescriptor.Converter.GetStandardValuesSupported())
+ {
+
+ grid_textbox.DropDownButtonVisible = true;
+ grid_textbox.ReadOnly = true;
+ }
+ }
+ else
+ {
+ System.Console.WriteLine("Converter not available for type {0}",grid_item.PropertyDescriptor.PropertyType);
+ }
+
+ }
+ catch (Exception ex)
+ {
+ }
+ }
+ }
+
+
+
+ int xLoc = splitter_location+1;
+ if (paintsValue)
+ {
+ pevent.Graphics.DrawRectangle(ThemeEngine.Current.ResPool.GetPen(Color.Black), splitter_location+2,rect.Y+2, 20, ROW_HEIGHT-4);
+ try
+ {
+ editor.PaintValue(grid_item.Value, pevent.Graphics, new Rectangle(splitter_location+3,rect.Y+3, 19, ROW_HEIGHT-5));
+ }
+ catch (Exception ex)
+ {
+ System.Console.WriteLine(ex.Message);
+ System.Console.WriteLine("Paint Value failed for type {0}",grid_item.PropertyDescriptor.PropertyType);
+ // design time stuff is not playing nice
+ }
+ xLoc += 27;
+ }
+
+ Font font = this.Font;
+ try
+ {
+ if (grid_item.PropertyDescriptor.Converter != null)
+ {
+ string value = grid_item.PropertyDescriptor.Converter.ConvertToString(grid_item.Value);
+ if (grid_item.PropertyDescriptor.CanResetValue(property_grid.SelectedObject))
+ font = new Font(font, FontStyle.Bold);
+
+ pevent.Graphics.DrawString(value,font,SystemBrushes.WindowText,new RectangleF(xLoc,rect.Y+2, ClientRectangle.Width-(xLoc), ROW_HEIGHT),stringFormat);
+ }
+ else
+ {
+ System.Console.WriteLine("No converter for type {0}",grid_item.PropertyDescriptor.PropertyType);
+ }
+
+ }
+ catch (Exception e)
+ {
+ }
+ if (grid_item == property_grid.SelectedGridItem && grid_item.GridItemType != GridItemType.Category)
+ {
+ grid_textbox.SetBounds(xLoc, rect.Top, ClientRectangle.Width-xLoc - (vbar.Visible ? vbar.Width: 0),ROW_HEIGHT);
+ }
+ }
+ }
+
+ private void DrawGridItem (GridItem grid_item, PaintEventArgs pevent, int depth, ref int yLoc)
+ {
+ if (yLoc > -ROW_HEIGHT && yLoc < ClientRectangle.Height)
+ {
+
+ // left column
+ pevent.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (property_grid.LineColor), 0,yLoc,V_INDENT, ROW_HEIGHT);
+
+ if (grid_item.Expandable)
+ {
+ grid_item.PlusMinusBounds = DrawPlusMinus(pevent, 3, yLoc+3, grid_item.Expanded, grid_item.GridItemType == GridItemType.Category);
+ }
+
+ if (grid_item.GridItemType == GridItemType.Category)
+ {
+ pevent.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (property_grid.LineColor), depth*V_INDENT,yLoc,ClientRectangle.Width-(depth*V_INDENT), ROW_HEIGHT);
+ }
+
+ DrawGridItemLabel(grid_item, pevent, new Rectangle(depth*V_INDENT,yLoc, splitter_location-depth*V_INDENT, ROW_HEIGHT));
+ DrawGridItemValue(grid_item, pevent, new Rectangle(splitter_location+2,yLoc, ClientRectangle.Width-splitter_location-2, ROW_HEIGHT));
+
+
+
+ }
+ grid_item.Top = yLoc;
+ yLoc += ROW_HEIGHT;
+ open_grid_item_count++;
+ }
+
+ private Rectangle DrawPlusMinus (PaintEventArgs pevent, int x, int y, bool expanded, bool category)
+ {
+ Rectangle bounds = new Rectangle(x, y, 8, 8);
+ if (!category) pevent.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush(Color.White), bounds);
+ pevent.Graphics.DrawRectangle (SystemPens.ControlDark, bounds);
+ pevent.Graphics.DrawLine (SystemPens.ControlDark, x+2, y+4, x + 6, y+4);
+ if (!expanded)
+ pevent.Graphics.DrawLine (SystemPens.ControlDark, x+4, y+2, x+4, y+6);
+
+ return bounds;
+ }
+
+ #endregion
+
+ #region Event Handling
+ private void RedrawEvent (object sender, System.EventArgs e)
+ {
+ Refresh();
+ }
+
+ private void TextBoxValidating (object sender, CancelEventArgs e)
+ {
+ if (this.property_grid.SelectedGridItem != null)
+ {
+ PropertyDescriptor desc = property_grid.SelectedGridItem.PropertyDescriptor;
+ if (desc != null)
+ {
+ try
+ {
+ if (desc.Converter != null)
+ {
+ SetPropertyValue(desc.Converter.ConvertFromString(grid_textbox.Text));
+ }
+ else
+ {
+ System.Console.WriteLine("No converter for type {0}",desc.PropertyType);
+ }
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("Error converting string");
+ }
+ }
+ }
+ }
+
+ #endregion
+
+
+ #endregion
+
+ private void dropdown_form_Deactivate (object sender, EventArgs e)
+ {
+ dropdown_form_showing = false;
+ dropdown_form.Hide();
+ //dropdown_form = new Form();
+ }
+
+ private void listBox_SelectedIndexChanged (object sender, EventArgs e)
+ {
+ if (this.property_grid.SelectedGridItem != null)
+ {
+ PropertyDescriptor desc = property_grid.SelectedGridItem.PropertyDescriptor;
+ if (desc != null)
+ {
+ SetPropertyValue(((ListBox)sender).SelectedItem);
+ }
+ }
+ dropdown_form.Hide();
+ //dropdown_form = new Form();
+ Refresh();
+ }
+
+ private void SetPropertyValue(object newVal)
+ {
+ if (this.property_grid.SelectedGridItem != null)
+ {
+ PropertyDescriptor desc = property_grid.SelectedGridItem.PropertyDescriptor;
+ if (desc != null)
+ {
+ desc.SetValue(property_grid.SelectedObject, newVal);
+ }
+ }
+ }
+
+ private void DropDownButtonClicked (object sender, EventArgs e)
+ {
+ if (property_grid.SelectedGridItem.PropertyDescriptor.GetEditor(typeof(UITypeEditor)) == null)
+ {
+ //dropdown_form.FormBorderStyle = FormBorderStyle.None;
+ dropdown_form.Deactivate +=new EventHandler(dropdown_form_Deactivate);
+ ListBox listBox = new ListBox();
+ listBox.Dock = DockStyle.Fill;
+ listBox.SelectedIndexChanged +=new EventHandler(listBox_SelectedIndexChanged);
+ foreach (object obj in property_grid.SelectedGridItem.PropertyDescriptor.Converter.GetStandardValues())
+ listBox.Items.Add(obj);
+ dropdown_form.Controls.Clear();
+ dropdown_form.Controls.Add(listBox);
+ dropdown_form.Location = PointToScreen(new Point(grid_textbox.Location.X,grid_textbox.Location.Y+ROW_HEIGHT));
+ dropdown_form.Width = grid_textbox.Width;
+ dropdown_form.Show();
+ }
+ else // use editor
+ {
+ UITypeEditor editor = (UITypeEditor)property_grid.SelectedGridItem.PropertyDescriptor.GetEditor(typeof(UITypeEditor));
+ System.ComponentModel.Design.ServiceContainer service_container = new System.ComponentModel.Design.ServiceContainer();
+ service_container.AddService(typeof(System.Windows.Forms.Design.IWindowsFormsEditorService), this);
+ SetPropertyValue(editor.EditValue(new ITypeDescriptorContextImpl(this.property_grid), service_container,property_grid.SelectedGridItem.Value));
+ }
+ }
+
+ private void DialogButtonClicked(object sender, EventArgs e)
+ {
+ //dialog_form.Location = PointToScreen(new Point(grid_textbox.Location.X,grid_textbox.Location.Y+ROW_HEIGHT));
+ //dropdown_form.Width = grid_textbox.Width;
+ dialog_form.Show();
+ }
+
+ private void HandleScroll(object sender, ScrollEventArgs e)
+ {
+ if (e.NewValue <= 0)
+ {
+ e.NewValue = 0;
+ if (e.NewValue == vbar.Value)return;
+ }
+ if (e.NewValue > vbar.Maximum-ClientRectangle.Height/ROW_HEIGHT)
+ {
+ e.NewValue = vbar.Maximum-ClientRectangle.Height/ROW_HEIGHT+1;
+ if (e.NewValue == vbar.Value)return;
+ }
+
+ switch (e.Type)
+ {
+ case ScrollEventType.SmallDecrement:
+ XplatUI.ScrollWindow(Handle, 0, ROW_HEIGHT, false);
+ grid_textbox.Top += ROW_HEIGHT;
+ Invalidate(ClientRectangle);
+ //Invalidate(new Rectangle(0,0,ClientRectangle.Width,ROW_HEIGHT));
+ break;
+ case ScrollEventType.SmallIncrement:
+ XplatUI.ScrollWindow(Handle, 0, -ROW_HEIGHT, false);
+ grid_textbox.Top -= ROW_HEIGHT;
+ Invalidate(ClientRectangle);
+ //Invalidate(new Rectangle(0,ClientRectangle.Bottom-ROW_HEIGHT,ClientRectangle.Width,ROW_HEIGHT));
+ break;
+ case ScrollEventType.LargeDecrement:
+ XplatUI.ScrollWindow(Handle, 0, ROW_HEIGHT, false);
+ Invalidate(ClientRectangle);
+ break;
+ case ScrollEventType.LargeIncrement:
+ XplatUI.ScrollWindow(Handle, 0, -ROW_HEIGHT, false);
+ Invalidate(ClientRectangle);
+ break;
+ case ScrollEventType.ThumbTrack:
+ XplatUI.ScrollWindow(Handle, 0, -(vbar.Value-e.NewValue), false);
+ Invalidate(ClientRectangle);
+ break;
+ case ScrollEventType.ThumbPosition:
+ Invalidate(ClientRectangle);
+ break;
+ }
+ }
+
+
+ private void HandleSelectedGridItemChanged(object sender, SelectedGridItemChangedEventArgs e)
+ {
+ // Region not working correctly
+ //Region clip = new Region();
+ //if (property_grid.SelectedGridItem != null)
+ // clip.Union(new Rectangle(0,property_grid.SelectedGridItem.Top, ClientRectangle.Width, ROW_HEIGHT));
+ // clip.Union(new Rectangle(0,property_grid.SelectedGridItem.Top, ClientRectangle.Width, ROW_HEIGHT));
+
+ if (e.NewSelection.PropertyDescriptor != null)
+ {
+ grid_textbox.Text = e.NewSelection.PropertyDescriptor.Converter.ConvertToString(e.NewSelection.Value);
+ if (e.NewSelection.PropertyDescriptor.CanResetValue(property_grid.SelectedObject))
+ grid_textbox.Font = new Font(this.Font, FontStyle.Bold);
+ else
+ grid_textbox.Font = this.Font;
+ }
+
+ Invalidate(/*clip*/this.ClientRectangle);
+ Update();
+ }
+
+ private void HandlePropertyValueChanged(object s, PropertyValueChangedEventArgs e)
+ {
+ if (e.ChangedItem.PropertyDescriptor != null)
+ {
+ grid_textbox.Text = e.ChangedItem.PropertyDescriptor.Converter.ConvertToString(e.ChangedItem.Value);
+ if (e.ChangedItem.PropertyDescriptor.CanResetValue(property_grid.SelectedObject))
+ grid_textbox.Font = new Font(this.Font, FontStyle.Bold);
+ else
+ grid_textbox.Font = this.Font;
+ }
+ }
+
+ #region IWindowsFormsEditorService Members
+
+ public void CloseDropDown()
+ {
+ dropdown_form_showing = false;
+ dropdown_form.Hide();
+ }
+
+ public void DropDownControl(Control control)
+ {
+ //dropdown_form.FormBorderStyle = FormBorderStyle.None;
+ dropdown_form.Deactivate +=new EventHandler(dropdown_form_Deactivate);
+ dropdown_form.Size = control.Size;
+ control.Dock = DockStyle.Fill;
+ dropdown_form.Controls.Clear();
+ dropdown_form.Controls.Add(control);
+ dropdown_form.Location = PointToScreen(new Point(grid_textbox.Location.X,grid_textbox.Location.Y+ROW_HEIGHT));
+ dropdown_form.Width = grid_textbox.Width;
+
+ dropdown_form_showing = true;
+ dropdown_form.Show();
+ System.Windows.Forms.MSG msg = new MSG();
+ while (XplatUI.GetMessage(ref msg, IntPtr.Zero, 0, 0) && dropdown_form_showing)
+ {
+ XplatUI.TranslateMessage(ref msg);
+ XplatUI.DispatchMessage(ref msg);
+ }
+ }
+
+ public System.Windows.Forms.DialogResult ShowDialog(Form dialog)
+ {
+ return dialog.ShowDialog(this);
+ }
+
+ #endregion
+
+ #region DropDownForm Class
+ #endregion DropDownForm Class
+
+ #region Internal Classes
+ internal class ITypeDescriptorContextImpl : System.ComponentModel.ITypeDescriptorContext
+ {
+ private PropertyGrid property_grid;
+ public ITypeDescriptorContextImpl(PropertyGrid propertyGrid)
+ {
+ property_grid = propertyGrid;
+ }
+ #region ITypeDescriptorContext Members
+
+ public void OnComponentChanged()
+ {
+ // TODO: Add SystemComp.OnComponentChanged implementation
+ }
+
+ public IContainer Container
+ {
+ get
+ {
+ return property_grid as IContainer;
+ }
+ }
+
+ public bool OnComponentChanging()
+ {
+ // TODO: Add SystemComp.OnComponentChanging implementation
+ return false;
+ }
+
+ public object Instance
+ {
+ get
+ {
+ return property_grid.SelectedGridItem.Value;
+ }
+ }
+
+ public PropertyDescriptor PropertyDescriptor
+ {
+ get
+ {
+ return property_grid.SelectedGridItem.PropertyDescriptor;
+ }
+ }
+
+ #endregion
+
+ #region IServiceProvider Members
+
+ public object GetService(Type serviceType)
+ {
+ // TODO: Add SystemComp.GetService implementation
+ return null;
+ }
+
+ #endregion
+
+ }
+
+
+
+ /*
+ class ComboListBox
+ */
+ internal class PropertyGridDropDown : Form
+ {
+ protected override CreateParams CreateParams
+ {
+ get
+ {
+ CreateParams cp = base.CreateParams;
+ cp.Style = unchecked ((int)(WindowStyles.WS_POPUP | WindowStyles.WS_VISIBLE | WindowStyles.WS_CLIPSIBLINGS | WindowStyles.WS_CLIPCHILDREN));
+ cp.ExStyle |= (int)(WindowStyles.WS_EX_TOOLWINDOW | WindowStyles.WS_EX_TOPMOST);
+ return cp;
+ }
+ }
+
+ }
+ #endregion
+
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyManager.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyManager.cs
new file mode 100644
index 00000000000..ea27ef69a07
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyManager.cs
@@ -0,0 +1,141 @@
+// 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) 2005 Novell, Inc.
+//
+// Authors:
+// Jackson Harper jackson@ximian.com
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+ public class PropertyManager : BindingManagerBase {
+
+ private object data_source;
+ private string property_name;
+ private PropertyDescriptor prop_desc;
+ private bool binding_suspended;
+
+ public PropertyManager() {
+ }
+
+ internal PropertyManager (object data_source, string property_name)
+ {
+ this.data_source = data_source;
+ this.property_name = property_name;
+
+ prop_desc = TypeDescriptor.GetProperties (data_source).Find (property_name, true);
+
+ if (prop_desc == null)
+ return;
+
+ prop_desc.AddValueChanged (data_source, new EventHandler (PropertyChangedHandler));
+ }
+
+ public override object Current {
+ get { return data_source; }
+ }
+
+ public override int Position {
+ get { return 0; }
+ set { /* Doesn't do anything on MS" */ }
+ }
+
+ public override int Count {
+ get { return 1; }
+ }
+
+ public override void AddNew ()
+ {
+ throw new NotSupportedException ("AddNew is not supported for property to property binding");
+ }
+
+ public override void CancelCurrentEdit ()
+ {
+ IEditableObject editable = data_source as IEditableObject;
+ if (editable == null)
+ return;
+ editable.CancelEdit ();
+
+ PushData ();
+ }
+
+ public override void EndCurrentEdit ()
+ {
+ PullData ();
+
+ IEditableObject editable = data_source as IEditableObject;
+ if (editable == null)
+ return;
+ editable.EndEdit ();
+ }
+
+ public override PropertyDescriptorCollection GetItemProperties ()
+ {
+ return TypeDescriptor.GetProperties (data_source);
+ }
+
+ public override void RemoveAt (int idx)
+ {
+ throw new NotSupportedException ("RemoveAt is not supported for property to property binding");
+ }
+
+ public override void ResumeBinding ()
+ {
+ binding_suspended = false;
+ }
+
+ public override void SuspendBinding ()
+ {
+ binding_suspended = true;
+ }
+
+ internal override bool IsSuspended {
+ get { return binding_suspended; }
+ }
+
+ protected internal override string GetListName (ArrayList list)
+ {
+ return String.Empty;
+ }
+
+ [MonoTODO]
+ protected override void UpdateIsBinding ()
+ {
+ }
+
+ protected internal override void OnCurrentChanged (EventArgs e)
+ {
+ PullData ();
+
+ if (onCurrentChangedHandler != null) {
+ onCurrentChangedHandler (this, e);
+ }
+ }
+
+ private void PropertyChangedHandler (object sender, EventArgs e)
+ {
+ OnCurrentChanged (EventArgs.Empty);
+ }
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertySort.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertySort.cs
new file mode 100644
index 00000000000..701fdab4f96
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertySort.cs
@@ -0,0 +1,41 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jonathan Chambers (jonathan.chambers@ansys.com)
+//
+
+// COMPLETE
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms
+{
+ [Serializable]
+ [ComVisible(true)]
+ public enum PropertySort
+ {
+ NoSort = 0,
+ Alphabetical = 1,
+ Categorized = 2,
+ CategorizedAlphabetical = 3
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyTabChangedEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyTabChangedEventArgs.cs
new file mode 100644
index 00000000000..90392b514ee
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyTabChangedEventArgs.cs
@@ -0,0 +1,66 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jonathan Chambers (jonathan.chambers@ansys.com)
+//
+
+// COMPLETE
+
+using System;
+using System.Runtime.InteropServices;
+using System.Windows.Forms.Design;
+
+namespace System.Windows.Forms
+{
+ [ComVisible(true)]
+ public class PropertyTabChangedEventArgs : EventArgs
+ {
+ #region Local Variables
+ private PropertyTab old_tab;
+ private PropertyTab new_tab;
+ #endregion // Local Variables
+
+ #region Constructor
+ public PropertyTabChangedEventArgs ( PropertyTab oldTab , PropertyTab newTab )
+ {
+ old_tab = oldTab;
+ new_tab = newTab;
+ }
+ #endregion // Constructor
+
+ #region Public Instance Properties
+ public PropertyTab NewTab
+ {
+ get {
+ return new_tab;
+ }
+ }
+
+ public PropertyTab OldTab
+ {
+ get {
+ return old_tab;
+ }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyTabChangedEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyTabChangedEventHandler.cs
new file mode 100644
index 00000000000..aa8e7645bcc
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyTabChangedEventHandler.cs
@@ -0,0 +1,34 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jonathan Chambers (jonathan.chambers@ansys.com)
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms
+{
+ [Serializable]
+ public delegate void PropertyTabChangedEventHandler(object s, PropertyTabChangedEventArgs e);
+}
+
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyValueChangedEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyValueChangedEventArgs.cs
new file mode 100644
index 00000000000..a38c5b367b0
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyValueChangedEventArgs.cs
@@ -0,0 +1,66 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jonathan Chambers (jonathan.chambers@ansys.com)
+//
+
+// COMPLETE
+
+using System;
+using System.Runtime.InteropServices;
+using System.Windows.Forms.Design;
+
+namespace System.Windows.Forms
+{
+ [ComVisible(true)]
+ public class PropertyValueChangedEventArgs : EventArgs
+ {
+ #region Local Variables
+ private GridItem changed_item;
+ private object old_value;
+ #endregion // Local Variables
+
+ #region Constructors
+ public PropertyValueChangedEventArgs ( GridItem changedItem , object oldValue )
+ {
+ changed_item = changedItem;
+ old_value = oldValue;
+ }
+ #endregion
+
+ #region Public Instance Properties
+ public GridItem ChangedItem
+ {
+ get {
+ return changed_item;
+ }
+ }
+
+ public object OldValue
+ {
+ get {
+ return old_value;
+ }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyValueChangedEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyValueChangedEventHandler.cs
new file mode 100644
index 00000000000..b09ee2dfe1b
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyValueChangedEventHandler.cs
@@ -0,0 +1,32 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jonathan Chambers (jonathan.chambers@ansys.com)
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms
+{
+ [Serializable]
+ public delegate void PropertyValueChangedEventHandler(object s, PropertyValueChangedEventArgs e);
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/QueryAccessibilityHelpEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/QueryAccessibilityHelpEventArgs.cs
new file mode 100644
index 00000000000..4d0e9c4fbb1
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/QueryAccessibilityHelpEventArgs.cs
@@ -0,0 +1,84 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [ComVisible(true)]
+ public class QueryAccessibilityHelpEventArgs : EventArgs {
+ private string help_namespace;
+ private string help_string;
+ private string help_keyword;
+
+ #region Public Constructors
+ public QueryAccessibilityHelpEventArgs() {
+ this.help_namespace = null;
+ this.help_string = null;
+ this.help_keyword = null;
+ }
+
+ public QueryAccessibilityHelpEventArgs(string helpNamespace, string helpString, string helpKeyword) {
+ this.help_namespace=helpNamespace;
+ this.help_string=helpString;
+ this.help_keyword=helpKeyword;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public string HelpKeyword {
+ get {
+ return this.help_keyword;
+ }
+
+ set {
+ this.help_keyword = value;
+ }
+ }
+
+ public string HelpNamespace {
+ get {
+ return this.help_namespace;
+ }
+
+ set {
+ this.help_namespace = value;
+ }
+ }
+
+ public string HelpString {
+ get {
+ return this.help_string;
+ }
+
+ set {
+ this.help_string = value;
+ }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/QueryAccessibilityHelpEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/QueryAccessibilityHelpEventHandler.cs
new file mode 100644
index 00000000000..e6085de5ca0
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/QueryAccessibilityHelpEventHandler.cs
@@ -0,0 +1,31 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public delegate void QueryAccessibilityHelpEventHandler (object sender, QueryAccessibilityHelpEventArgs e);
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/QueryContinueDragEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/QueryContinueDragEventArgs.cs
new file mode 100644
index 00000000000..85e151668b2
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/QueryContinueDragEventArgs.cs
@@ -0,0 +1,71 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+
+// COMPLETE
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [ComVisible(true)]
+ public class QueryContinueDragEventArgs : EventArgs {
+ internal int key_state;
+ internal bool escape_pressed;
+ internal DragAction drag_action;
+
+ #region Public Constructors
+ public QueryContinueDragEventArgs(int keyState, bool escapePressed, DragAction action) {
+ this.key_state = keyState;
+ this.escape_pressed = escapePressed;
+ this.drag_action = action;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public DragAction Action {
+ get {
+ return this.drag_action;
+ }
+
+ set {
+ this.drag_action=value;
+ }
+ }
+
+ public bool EscapePressed {
+ get {
+ return this.escape_pressed;
+ }
+ }
+
+ public int KeyState {
+ get {
+ return this.key_state;
+ }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/QueryContinueDragEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/QueryContinueDragEventHandler.cs
new file mode 100644
index 00000000000..d250a237ab4
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/QueryContinueDragEventHandler.cs
@@ -0,0 +1,31 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public delegate void QueryContinueDragEventHandler (object sender, QueryContinueDragEventArgs e);
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/QuestionEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/QuestionEventArgs.cs
new file mode 100644
index 00000000000..afe72db3b0f
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/QuestionEventArgs.cs
@@ -0,0 +1,52 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public class QuestionEventArgs : EventArgs {
+
+ private bool response;
+
+ public QuestionEventArgs () {
+ response = false;
+ }
+
+ public QuestionEventArgs (bool response) {
+ this.response = response;
+ }
+
+ public bool Response {
+ get { return response; }
+ set { response = value; }
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/QuestionEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/QuestionEventHandler.cs
new file mode 100644
index 00000000000..261306c0e18
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/QuestionEventHandler.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ public delegate void QuestionEventHandler (object sender, QuestionEventArgs e);
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RadioButton.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RadioButton.cs
new file mode 100644
index 00000000000..ace406fa54e
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RadioButton.cs
@@ -0,0 +1,333 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+// COMPLETE
+
+using System.ComponentModel;
+using System.Drawing;
+using System.Drawing.Text;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [DefaultProperty("Checked")]
+ [DefaultEvent("CheckedChanged")]
+ public class RadioButton : ButtonBase {
+ #region Local Variables
+ internal Appearance appearance;
+ internal bool auto_check;
+ internal ContentAlignment radiobutton_alignment;
+ internal CheckState check_state;
+ #endregion // Local Variables
+
+ #region RadioButtonAccessibleObject Subclass
+ [ComVisible(true)]
+ public class RadioButtonAccessibleObject : ControlAccessibleObject {
+ #region RadioButtonAccessibleObject Local Variables
+ private RadioButton owner;
+ #endregion // RadioButtonAccessibleObject Local Variables
+
+ #region RadioButtonAccessibleObject Constructors
+ public RadioButtonAccessibleObject(RadioButton owner) : base(owner) {
+ this.owner = owner;
+ }
+ #endregion // RadioButtonAccessibleObject Constructors
+
+ #region RadioButtonAccessibleObject Properties
+ public override string DefaultAction {
+ get {
+ return "Select";
+ }
+ }
+
+ public override AccessibleRole Role {
+ get {
+ return AccessibleRole.RadioButton;
+ }
+ }
+
+ public override AccessibleStates State {
+ get {
+ AccessibleStates retval;
+
+ retval = AccessibleStates.Default;
+
+ if (owner.check_state == CheckState.Checked) {
+ retval |= AccessibleStates.Checked;
+ }
+
+ if (owner.Focused) {
+ retval |= AccessibleStates.Focused;
+ }
+
+ if (owner.CanFocus) {
+ retval |= AccessibleStates.Focusable;
+ }
+
+ return retval;
+ }
+ }
+ #endregion // RadioButtonAccessibleObject Properties
+
+ #region RadioButtonAccessibleObject Methods
+ public override void DoDefaultAction() {
+ owner.PerformClick();
+ }
+ #endregion // RadioButtonAccessibleObject Methods
+ }
+ #endregion // RadioButtonAccessibleObject Sub-class
+
+ #region Public Constructors
+ public RadioButton() {
+ appearance = Appearance.Normal;
+ auto_check = true;
+ radiobutton_alignment = ContentAlignment.MiddleLeft;
+ text_alignment = ContentAlignment.MiddleLeft;
+ tab_stop = false;
+ GotFocus +=new EventHandler(ReceivedFocus);
+ }
+ #endregion // Public Constructors
+
+ #region Private Methods
+ private void UpdateSiblings() {
+ Control c;
+
+ if (auto_check == false) {
+ return;
+ }
+
+ // Remove tabstop property from and uncheck our radio-button siblings
+ c = this.parent;
+ if (c != null) {
+ for (int i = 0; i < c.child_controls.Count; i++) {
+ if ((this != c.child_controls[i]) && (c.child_controls[i] is RadioButton)) {
+ if (((RadioButton)(c.child_controls[i])).auto_check) {
+ c.child_controls[i].TabStop = false;
+ ((RadioButton)(c.child_controls[i])).Checked = false;
+ }
+ }
+ }
+ }
+
+ this.TabStop = true;
+ }
+
+ internal override void HaveDoubleClick() {
+ if (DoubleClick != null) DoubleClick(this, EventArgs.Empty);
+ }
+
+ internal override void Draw (PaintEventArgs pe) {
+ ThemeEngine.Current.DrawRadioButton (pe.Graphics, this.ClientRectangle, this);
+ }
+
+ private void ReceivedFocus(object sender, EventArgs e) {
+ OnClick(e);
+ }
+ #endregion // Private Methods
+
+ #region Public Instance Properties
+ [DefaultValue(Appearance.Normal)]
+ [Localizable(true)]
+ public Appearance Appearance {
+ get {
+ return appearance;
+ }
+
+ set {
+ if (value != appearance) {
+ appearance = value;
+ if (AppearanceChanged != null) {
+ AppearanceChanged(this, EventArgs.Empty);
+ }
+ Redraw();
+ }
+ }
+ }
+
+ [DefaultValue(true)]
+ public bool AutoCheck {
+ get {
+ return auto_check;
+ }
+
+ set {
+ auto_check = value;
+ }
+ }
+
+ [Bindable(true)]
+ [Localizable(true)]
+ [DefaultValue(ContentAlignment.MiddleLeft)]
+ public ContentAlignment CheckAlign {
+ get {
+ return radiobutton_alignment;
+ }
+
+ set {
+ if (value != radiobutton_alignment) {
+ radiobutton_alignment = value;
+
+ Redraw();
+ }
+ }
+ }
+
+ [DefaultValue(false)]
+ public bool Checked {
+ get {
+ if (check_state != CheckState.Unchecked) {
+ return true;
+ }
+ return false;
+ }
+
+ set {
+ if (value && (check_state != CheckState.Checked)) {
+ UpdateSiblings();
+ check_state = CheckState.Checked;
+ Redraw();
+ OnCheckedChanged(EventArgs.Empty);
+ } else if (!value && (check_state != CheckState.Unchecked)) {
+ check_state = CheckState.Unchecked;
+ Redraw();
+ OnCheckedChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ [DefaultValue(false)]
+ public new bool TabStop {
+ get {
+ return tab_stop;
+ }
+
+ set {
+ tab_stop = value;
+ }
+ }
+
+ [DefaultValue(ContentAlignment.MiddleLeft)]
+ [Localizable(true)]
+ public override ContentAlignment TextAlign {
+ get {
+ return text_alignment;
+ }
+
+ set {
+ if (value != text_alignment) {
+ text_alignment = value;
+ Redraw();
+ }
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Protected Instance Properties
+ protected override CreateParams CreateParams {
+ get {
+ SetStyle(ControlStyles.AllPaintingInWmPaint, true);
+ SetStyle(ControlStyles.UserPaint, true);
+
+ return base.CreateParams;
+ }
+ }
+
+ protected override Size DefaultSize {
+ get {
+ return ThemeEngine.Current.RadioButtonDefaultSize;
+ }
+ }
+ #endregion // Protected Instance Properties
+
+ #region Public Instance Methods
+ public void PerformClick() {
+ OnClick(EventArgs.Empty);
+ }
+
+ public override string ToString() {
+ return base.ToString() + ", Checked: " + this.Checked;
+ }
+ #endregion // Public Instance Methods
+
+ #region Protected Instance Methods
+ protected override AccessibleObject CreateAccessibilityInstance() {
+ AccessibleObject ao;
+
+ ao = base.CreateAccessibilityInstance ();
+ ao.role = AccessibleRole.RadioButton;
+
+ return ao;
+ }
+
+ protected virtual void OnCheckedChanged(EventArgs e) {
+ if (CheckedChanged != null) {
+ CheckedChanged(this, e);
+ }
+ }
+
+ protected override void OnClick(EventArgs e) {
+ if (auto_check) {
+ if (!Checked) {
+ Checked = true;
+ }
+ } else {
+ Checked = !Checked;
+ }
+
+ base.OnClick (e);
+ }
+
+ protected override void OnEnter(EventArgs e) {
+ base.OnEnter(e);
+ }
+
+ protected override void OnHandleCreated(EventArgs e) {
+ base.OnHandleCreated(e);
+ }
+
+ protected override void OnMouseUp(MouseEventArgs mevent) {
+ base.OnMouseUp(mevent);
+ }
+
+ protected override bool ProcessMnemonic(char charCode) {
+ if (IsMnemonic(charCode, Text) == true) {
+ Select();
+ PerformClick();
+ return true;
+ }
+
+ return base.ProcessMnemonic(charCode);
+ }
+ #endregion // Protected Instance Methods
+
+ #region Events
+ public event EventHandler AppearanceChanged;
+ public event EventHandler CheckedChanged;
+
+ [Browsable(false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public event EventHandler DoubleClick;
+ #endregion // Events
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBox.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBox.cs
new file mode 100644
index 00000000000..4259fb6b797
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBox.cs
@@ -0,0 +1,1612 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok <pbartok@novell.com>
+//
+//
+
+// NOT COMPLETE
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Drawing;
+using System.IO;
+using System.Text;
+using RTF=System.Windows.Forms.RTF;
+
+namespace System.Windows.Forms {
+ public class RichTextBox : TextBoxBase {
+ #region Local Variables
+ internal bool auto_word_select;
+ internal int bullet_indent;
+ internal bool can_redo;
+ internal bool detect_urls;
+ internal string redo_action_name;
+ internal int margin_right;
+ internal string undo_action_name;
+ internal float zoom;
+
+ private RTF.TextMap rtf_text_map;
+ private int rtf_skip_width;
+ private int rtf_skip_count;
+ private StringBuilder rtf_line;
+ private SolidBrush rtf_color;
+ private RTF.Font rtf_rtffont;
+ private int rtf_rtffont_size;
+ private FontStyle rtf_rtfstyle;
+ private HorizontalAlignment rtf_rtfalign;
+ private int rtf_cursor_x;
+ private int rtf_cursor_y;
+ #endregion // Local Variables
+
+ #region Public Constructors
+ public RichTextBox() {
+ accepts_return = true;
+ auto_word_select = false;
+ bullet_indent = 0;
+ can_redo = false;
+ detect_urls = true;
+ max_length = Int32.MaxValue;
+ redo_action_name = string.Empty;
+ margin_right = 0;
+ undo_action_name = string.Empty;
+ zoom = 1;
+ base.Multiline = true;
+ document.CRLFSize = 1;
+
+ scrollbars = RichTextBoxScrollBars.Both;
+ alignment = HorizontalAlignment.Left;
+ LostFocus += new EventHandler(RichTextBox_LostFocus);
+ GotFocus += new EventHandler(RichTextBox_GotFocus);
+ BackColor = ThemeEngine.Current.ColorWindow;
+ ForeColor = ThemeEngine.Current.ColorWindowText;
+ base.HScrolled += new EventHandler(RichTextBox_HScrolled);
+ base.VScrolled += new EventHandler(RichTextBox_VScrolled);
+ }
+ #endregion // Public Constructors
+
+ #region Private & Internal Methods
+ private void RichTextBox_LostFocus(object sender, EventArgs e) {
+ has_focus = false;
+ Invalidate();
+ }
+
+ private void RichTextBox_GotFocus(object sender, EventArgs e) {
+ has_focus = true;
+ Invalidate();
+ }
+ #endregion // Private & Internal Methods
+
+ #region Public Instance Properties
+ public override bool AllowDrop {
+ get {
+ return base.AllowDrop;
+ }
+
+ set {
+ base.AllowDrop = value;
+ }
+ }
+
+ [DefaultValue(false)]
+ [Localizable(true)]
+ public override bool AutoSize {
+ get {
+ return auto_size;
+ }
+
+ set {
+ base.AutoSize = value;
+ }
+ }
+
+ [DefaultValue(false)]
+ public bool AutoWordSelection {
+ get {
+ return auto_word_select;
+ }
+
+ set {
+ auto_word_select = true;
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override System.Drawing.Image BackgroundImage {
+ get {
+ return background_image;
+ }
+
+ set {
+ base.BackgroundImage = value;
+ }
+ }
+
+ [DefaultValue(0)]
+ [Localizable(true)]
+ public int BulletIndent {
+ get {
+ return bullet_indent;
+ }
+
+ set {
+ bullet_indent = value;
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool CanRedo {
+ get {
+ return can_redo;
+ }
+ }
+
+ [DefaultValue(true)]
+ public bool DetectUrls {
+ get {
+ return detect_urls;
+ }
+
+ set {
+ detect_urls = true;
+ }
+ }
+
+ public override Font Font {
+ get {
+ return base.Font;
+ }
+
+ set {
+ if (font != value) {
+ Line start;
+ Line end;
+
+ if (auto_size) {
+ if (PreferredHeight != Height) {
+ Height = PreferredHeight;
+ }
+ }
+
+ base.Font = value;
+
+ // Font changes always set the whole doc to that font
+ start = document.GetLine(1);
+ end = document.GetLine(document.Lines);
+ document.FormatText(start, 1, end, end.text.Length + 1, base.Font, new SolidBrush(this.ForeColor));
+ }
+ }
+ }
+
+ public override Color ForeColor {
+ get {
+ return base.ForeColor;
+ }
+
+ set {
+ base.ForeColor = value;
+ }
+ }
+
+ [DefaultValue(Int32.MaxValue)]
+ public override int MaxLength {
+ get {
+ return base.max_length;
+ }
+
+ set {
+ base.max_length = value;
+ }
+ }
+
+ [DefaultValue(true)]
+ public override bool Multiline {
+ get {
+ return multiline;
+ }
+
+ set {
+ base.Multiline = value;
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ [MonoTODO]
+ public string RedoActionName {
+ get {
+ return redo_action_name;
+ }
+ }
+
+ [DefaultValue(0)]
+ [Localizable(true)]
+ [MonoTODO("Teach TextControl.RecalculateLine to consider the right margin as well")]
+ public int RightMargin {
+ get {
+ return margin_right;
+ }
+
+ set {
+ margin_right = value;
+ }
+ }
+
+ [Browsable(false)]
+ [DefaultValue("")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string Rtf {
+ get {
+ Line start_line;
+ Line end_line;
+ int current;
+ int total;
+
+ start_line = document.GetLine(1);
+ end_line = document.GetLine(document.Lines);
+ return GenerateRTF(start_line, 0, end_line, end_line.text.Length).ToString();
+ }
+
+ set {
+ MemoryStream data;
+
+ document.Empty();
+ data = new MemoryStream(Encoding.ASCII.GetBytes(value), false);
+
+ InsertRTFFromStream(data, 0, 1);
+
+ data.Close();
+ }
+ }
+
+ [DefaultValue(RichTextBoxScrollBars.Both)]
+ [Localizable(true)]
+ public RichTextBoxScrollBars ScrollBars {
+ get {
+ return scrollbars;
+ }
+
+ set {
+ scrollbars = value;
+ }
+ }
+
+ [Browsable(false)]
+ [DefaultValue("")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string SelectedRtf {
+ get {
+ return GenerateRTF(document.selection_start.line, document.selection_start.pos, document.selection_end.line, document.selection_end.pos).ToString();
+ }
+
+ set {
+ MemoryStream data;
+ int x;
+ int y;
+ Line line;
+
+ if (document.selection_visible) {
+ document.ReplaceSelection("");
+ }
+
+ data = new MemoryStream(Encoding.ASCII.GetBytes(value), false);
+ InsertRTFFromStream(data, document.selection_start.pos, document.selection_start.line.line_no, out x, out y);
+ data.Close();
+
+ line = document.GetLine(y);
+ document.SetSelection(document.GetLine(y), x);
+ document.PositionCaret(line, x);
+ document.DisplayCaret();
+
+ OnTextChanged(EventArgs.Empty);
+ }
+ }
+
+ [Browsable(false)]
+ [DefaultValue("")]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public override string SelectedText {
+ get {
+ return base.SelectedText;
+ }
+
+ set {
+ base.SelectedText = value;
+ }
+ }
+
+ [Browsable(false)]
+ [DefaultValue(HorizontalAlignment.Left)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public HorizontalAlignment SelectionAlignment {
+ get {
+ HorizontalAlignment align;
+ Line start;
+ Line end;
+ Line line;
+
+ start = document.ParagraphStart(document.selection_start.line);
+ align = start.alignment;
+
+ end = document.ParagraphEnd(document.selection_end.line);
+
+ line = start;
+
+ while (true) {
+ if (line.alignment != align) {
+ return HorizontalAlignment.Left;
+ }
+
+ if (line == end) {
+ break;
+ }
+ line = document.GetLine(line.line_no + 1);
+ }
+
+ return align;
+ }
+
+ set {
+ Line start;
+ Line end;
+ Line line;
+
+ start = document.ParagraphStart(document.selection_start.line);
+
+ end = document.ParagraphEnd(document.selection_end.line);
+
+ line = start;
+
+ while (true) {
+ line.alignment = value;
+
+ if (line == end) {
+ break;
+ }
+ line = document.GetLine(line.line_no + 1);
+ }
+ this.CalculateDocument();
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public Color SelectionColor {
+ get {
+ Color color;
+ LineTag start;
+ LineTag end;
+ LineTag tag;
+
+ start = document.selection_start.tag;
+ end = document.selection_end.tag;
+ color = ((SolidBrush)document.selection_start.tag.color).Color;
+
+ tag = start;
+ while (true) {
+ if (!color.Equals(((SolidBrush)tag.color).Color)) {
+ return Color.Empty;
+ }
+
+ if (tag == end) {
+ break;
+ }
+
+ tag = document.NextTag(tag);
+
+ if (tag == null) {
+ break;
+ }
+ }
+
+ return color;
+ }
+
+ set {
+ int sel_start;
+ int sel_end;
+
+ sel_start = document.LineTagToCharIndex(document.selection_start.line, document.selection_start.pos);
+ sel_end = document.LineTagToCharIndex(document.selection_end.line, document.selection_end.pos);
+Console.WriteLine("FIXME - SelectionColor should not alter font");
+ document.FormatText(document.selection_start.line, document.selection_start.pos + 1, document.selection_end.line, document.selection_end.pos + 1, document.selection_start.tag.font, new SolidBrush(value));
+
+ document.CharIndexToLineTag(sel_start, out document.selection_start.line, out document.selection_start.tag, out document.selection_start.pos);
+ document.CharIndexToLineTag(sel_end, out document.selection_end.line, out document.selection_end.tag, out document.selection_end.pos);
+
+ document.UpdateView(document.selection_start.line, 0);
+ document.AlignCaret();
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public Font SelectionFont {
+ get {
+ Font font;
+ LineTag start;
+ LineTag end;
+ LineTag tag;
+
+ start = document.selection_start.tag;
+ end = document.selection_end.tag;
+ font = document.selection_start.tag.font;
+
+ tag = start;
+ while (true) {
+ if (!font.Equals(tag.font)) {
+ return null;
+ }
+
+ if (tag == end) {
+ break;
+ }
+
+ tag = document.NextTag(tag);
+
+ if (tag == null) {
+ break;
+ }
+ }
+
+ return font;
+ }
+
+ set {
+ int sel_start;
+ int sel_end;
+
+ sel_start = document.LineTagToCharIndex(document.selection_start.line, document.selection_start.pos);
+ sel_end = document.LineTagToCharIndex(document.selection_end.line, document.selection_end.pos);
+
+ document.FormatText(document.selection_start.line, document.selection_start.pos + 1, document.selection_end.line, document.selection_end.pos + 1, value, document.selection_start.tag.color);
+
+ document.CharIndexToLineTag(sel_start, out document.selection_start.line, out document.selection_start.tag, out document.selection_start.pos);
+ document.CharIndexToLineTag(sel_end, out document.selection_end.line, out document.selection_end.tag, out document.selection_end.pos);
+
+ document.UpdateView(document.selection_start.line, 0);
+ document.AlignCaret();
+
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public override int SelectionLength {
+ get {
+ return base.SelectionLength;
+ }
+
+ set {
+ base.SelectionLength = value;
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public RichTextBoxSelectionTypes SelectionType {
+ get {
+ if (document.selection_start == document.selection_end) {
+ return RichTextBoxSelectionTypes.Empty;
+ }
+
+ // Lazy, but works
+ if (SelectedText.Length > 1) {
+ return RichTextBoxSelectionTypes.MultiChar | RichTextBoxSelectionTypes.Text;
+ }
+
+ return RichTextBoxSelectionTypes.Text;
+ }
+ }
+
+ [Localizable(true)]
+ public override string Text {
+ get {
+ return base.Text;
+ }
+
+ set {
+ base.Text = value;
+ }
+ }
+
+ [Browsable(false)]
+ public override int TextLength {
+ get {
+ return base.TextLength;
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public string UndoActionName {
+ get {
+ return document.undo.UndoName;
+ }
+ }
+
+ [Localizable(true)]
+ [DefaultValue(1)]
+ public float ZoomFactor {
+ get {
+ return zoom;
+ }
+
+ set {
+ zoom = value;
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Protected Instance Properties
+ protected override CreateParams CreateParams {
+ get {
+ return base.CreateParams;
+ }
+ }
+
+ protected override Size DefaultSize {
+ get {
+ return new Size(100, 96);
+ }
+ }
+ #endregion // Protected Instance Properties
+
+ #region Public Instance Methods
+ public bool CanPaste(DataFormats.Format clipFormat) {
+ if ((clipFormat.Name == DataFormats.Rtf) ||
+ (clipFormat.Name == DataFormats.Text) ||
+ (clipFormat.Name == DataFormats.UnicodeText)) {
+ return true;
+ }
+ return false;
+ }
+
+ public int Find(char[] characterSet) {
+ return Find(characterSet, -1, -1);
+ }
+
+ public int Find(char[] characterSet, int start) {
+ return Find(characterSet, start, -1);
+ }
+
+ public int Find(char[] characterSet, int start, int end) {
+ Document.Marker start_mark;
+ Document.Marker end_mark;
+ Document.Marker result;
+
+ if (start == -1) {
+ document.GetMarker(out start_mark, true);
+ } else {
+ Line line;
+ LineTag tag;
+ int pos;
+
+ start_mark = new Document.Marker();
+
+ document.CharIndexToLineTag(start, out line, out tag, out pos);
+ start_mark.line = line;
+ start_mark.tag = tag;
+ start_mark.pos = pos;
+ }
+
+ if (end == -1) {
+ document.GetMarker(out end_mark, false);
+ } else {
+ Line line;
+ LineTag tag;
+ int pos;
+
+ end_mark = new Document.Marker();
+
+ document.CharIndexToLineTag(end, out line, out tag, out pos);
+ end_mark.line = line;
+ end_mark.tag = tag;
+ end_mark.pos = pos;
+ }
+
+ if (document.FindChars(characterSet, start_mark, end_mark, out result)) {
+ return document.LineTagToCharIndex(result.line, result.pos);
+ }
+
+ return -1;
+ }
+
+ public int Find(string str) {
+ return Find(str, -1, -1, RichTextBoxFinds.None);
+ }
+
+ public int Find(string str, int start, int end, RichTextBoxFinds options) {
+ Document.Marker start_mark;
+ Document.Marker end_mark;
+ Document.Marker result;
+
+ if (start == -1) {
+ document.GetMarker(out start_mark, true);
+ } else {
+ Line line;
+ LineTag tag;
+ int pos;
+
+ start_mark = new Document.Marker();
+
+ document.CharIndexToLineTag(start, out line, out tag, out pos);
+
+ start_mark.line = line;
+ start_mark.tag = tag;
+ start_mark.pos = pos;
+ }
+
+ if (end == -1) {
+ document.GetMarker(out end_mark, false);
+ } else {
+ Line line;
+ LineTag tag;
+ int pos;
+
+ end_mark = new Document.Marker();
+
+ document.CharIndexToLineTag(end, out line, out tag, out pos);
+
+ end_mark.line = line;
+ end_mark.tag = tag;
+ end_mark.pos = pos;
+ }
+
+ if (document.Find(str, start_mark, end_mark, out result, options)) {
+ return document.LineTagToCharIndex(result.line, result.pos);
+ }
+
+ return -1;
+ }
+
+ public int Find(string str, int start, RichTextBoxFinds options) {
+ return Find(str, start, -1, options);
+ }
+
+ public int Find(string str, RichTextBoxFinds options) {
+ return Find(str, -1, -1, options);
+ }
+
+ public char GetCharFromPosition(Point pt) {
+ LineTag tag;
+ int pos;
+
+ PointToTagPos(pt, out tag, out pos);
+
+ if (pos >= tag.line.text.Length) {
+ return '\n';
+ }
+
+ return tag.line.text[pos];
+
+ }
+
+ public int GetCharIndexFromPosition(Point pt) {
+ LineTag tag;
+ int pos;
+
+ PointToTagPos(pt, out tag, out pos);
+
+ return document.LineTagToCharIndex(tag.line, pos);
+ }
+
+ public int GetLineFromCharIndex(int index) {
+ Line line;
+ LineTag tag;
+ int pos;
+
+ document.CharIndexToLineTag(index, out line, out tag, out pos);
+
+ return line.LineNo - 1;
+ }
+
+ public Point GetPositionFromCharIndex(int index) {
+ Line line;
+ LineTag tag;
+ int pos;
+
+ document.CharIndexToLineTag(index, out line, out tag, out pos);
+
+ return new Point((int)line.widths[pos] + 1, line.Y + 1);
+ }
+
+ public void LoadFile(System.IO.Stream data, RichTextBoxStreamType fileType) {
+ RTF.RTF rtf; // Not 'using SWF.RTF' to avoid ambiguities with font and color
+
+ document.Empty();
+
+ // FIXME - ignoring unicode
+ if (fileType == RichTextBoxStreamType.PlainText) {
+ StringBuilder sb;
+ int count;
+ byte[] buffer;
+
+ try {
+ sb = new StringBuilder((int)data.Length);
+ buffer = new byte[1024];
+ }
+
+ catch {
+ throw new IOException("Not enough memory to load document");
+ }
+
+ count = 0;
+ while (count < data.Length) {
+ count += data.Read(buffer, count, 1024);
+ sb.Append(buffer);
+ }
+ base.Text = sb.ToString();
+ return;
+ }
+
+ InsertRTFFromStream(data, 0, 1);
+ }
+
+ [MonoTODO("Make smarter RTF detection?")]
+ public void LoadFile(string path) {
+ if (path.EndsWith(".rtf")) {
+ LoadFile(path, RichTextBoxStreamType.RichText);
+ } else {
+ LoadFile(path, RichTextBoxStreamType.PlainText);
+ }
+ }
+
+ public void LoadFile(string path, RichTextBoxStreamType fileType) {
+ FileStream data;
+
+ data = null;
+
+ try {
+ data = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, 1024);
+ LoadFile(data, fileType);
+ }
+
+ catch {
+ throw new IOException("Could not open file " + path);
+ }
+
+ finally {
+ if (data != null) {
+ data.Close();
+ }
+ }
+ }
+
+ public void Paste(DataFormats.Format clipFormat) {
+ base.Paste(clipFormat, false);
+ }
+
+ [MonoTODO()]
+ public void Redo() {
+ }
+
+ public void SaveFile(Stream data, RichTextBoxStreamType fileType) {
+ Encoding encoding;
+ int i;
+ Byte[] bytes;
+
+
+ if (fileType == RichTextBoxStreamType.UnicodePlainText) {
+ encoding = Encoding.Unicode;
+ } else {
+ encoding = Encoding.ASCII;
+ }
+
+ switch(fileType) {
+ case RichTextBoxStreamType.PlainText:
+ case RichTextBoxStreamType.TextTextOleObjs:
+ case RichTextBoxStreamType.UnicodePlainText: {
+ if (!multiline) {
+ bytes = encoding.GetBytes(document.Root.text.ToString());
+ data.Write(bytes, 0, bytes.Length);
+ return;
+ }
+
+ for (i = 1; i < document.Lines; i++) {
+ bytes = encoding.GetBytes(document.GetLine(i).text.ToString() + Environment.NewLine);
+ data.Write(bytes, 0, bytes.Length);
+ }
+ bytes = encoding.GetBytes(document.GetLine(document.Lines).text.ToString());
+ data.Write(bytes, 0, bytes.Length);
+ return;
+ }
+ }
+
+ // If we're here we're saving RTF
+ Line start_line;
+ Line end_line;
+ StringBuilder rtf;
+ int current;
+ int total;
+
+ start_line = document.GetLine(1);
+ end_line = document.GetLine(document.Lines);
+ rtf = GenerateRTF(start_line, 0, end_line, end_line.text.Length);
+ total = rtf.Length;
+ bytes = new Byte[4096];
+
+ // Let's chunk it so we don't use up all memory...
+ for (i = 0; i < total; i += 1024) {
+ if ((i + 1024) < total) {
+ current = encoding.GetBytes(rtf.ToString(i, 1024), 0, 1024, bytes, 0);
+ } else {
+ current = total - i;
+ current = encoding.GetBytes(rtf.ToString(i, current), 0, current, bytes, 0);
+ }
+ data.Write(bytes, 0, current);
+ }
+ }
+
+ public void SaveFile(string path) {
+ if (path.EndsWith(".rtf")) {
+ SaveFile(path, RichTextBoxStreamType.RichText);
+ } else {
+ SaveFile(path, RichTextBoxStreamType.PlainText);
+ }
+ }
+
+ public void SaveFile(string path, RichTextBoxStreamType fileType) {
+ FileStream data;
+
+ data = null;
+
+// try {
+ data = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None, 1024, false);
+ SaveFile(data, fileType);
+// }
+
+// catch {
+// throw new IOException("Could not write document to file " + path);
+// }
+
+// finally {
+ if (data != null) {
+ data.Close();
+ }
+// }
+ }
+
+ #endregion // Public Instance Methods
+
+ #region Protected Instance Methods
+ protected virtual object CreateRichEditOleCallback() {
+ throw new NotImplementedException();
+ }
+
+ protected override void OnBackColorChanged(EventArgs e) {
+ base.OnBackColorChanged (e);
+ }
+
+ protected virtual void OnContentsResized(ContentsResizedEventArgs e) {
+ if (ContentsResized != null) {
+ ContentsResized(this, e);
+ }
+ }
+
+ protected override void OnContextMenuChanged(EventArgs e) {
+ base.OnContextMenuChanged (e);
+ }
+
+ protected override void OnHandleCreated(EventArgs e) {
+ base.OnHandleCreated (e);
+ }
+
+ protected override void OnHandleDestroyed(EventArgs e) {
+ base.OnHandleDestroyed (e);
+ }
+
+ protected virtual void OnHScroll(EventArgs e) {
+ if (HScroll != null) {
+ HScroll(this, e);
+ }
+ }
+
+ [MonoTODO("Determine when to call this")]
+ protected virtual void OnImeChange(EventArgs e) {
+ if (ImeChange != null) {
+ ImeChange(this, e);
+ }
+ }
+
+ protected virtual void OnLinkClicked(LinkClickedEventArgs e) {
+ if (LinkClicked != null) {
+ LinkClicked(this, e);
+ }
+ }
+
+ protected virtual void OnProtected(EventArgs e) {
+ if (Protected != null) {
+ Protected(this, e);
+ }
+ }
+
+ protected override void OnRightToLeftChanged(EventArgs e) {
+ base.OnRightToLeftChanged (e);
+ }
+
+ protected virtual void OnSelectionChanged(EventArgs e) {
+ if (SelectionChanged != null) {
+ SelectionChanged(this, e);
+ }
+ }
+
+ protected override void OnSystemColorsChanged(EventArgs e) {
+ base.OnSystemColorsChanged (e);
+ }
+
+ protected override void OnTextChanged(EventArgs e) {
+ base.OnTextChanged (e);
+ }
+
+ protected virtual void OnVScroll(EventArgs e) {
+ if (VScroll != null) {
+ VScroll(this, e);
+ }
+ }
+
+ protected override void WndProc(ref Message m) {
+ base.WndProc (ref m);
+ }
+ #endregion // Protected Instance Methods
+
+ #region Events
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler BackgroundImageChanged;
+
+ public event ContentsResizedEventHandler ContentsResized;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler DoubleClick;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event DragEventHandler DragDrop {
+ add {
+ base.DragDrop += value;
+ }
+
+ remove {
+ base.DragDrop -= value;
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event DragEventHandler DragEnter {
+ add {
+ base.DragEnter += value;
+ }
+
+ remove {
+ base.DragEnter -= value;
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler DragLeave {
+ add {
+ base.DragLeave += value;
+ }
+
+ remove {
+ base.DragLeave -= value;
+ }
+ }
+
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event DragEventHandler DragOver {
+ add {
+ base.DragOver += value;
+ }
+
+ remove {
+ base.DragOver -= value;
+ }
+ }
+
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event GiveFeedbackEventHandler GiveFeedback;
+
+ public event EventHandler HScroll;
+ public event EventHandler ImeChange;
+ public event LinkClickedEventHandler LinkClicked;
+ public event EventHandler Protected;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event QueryContinueDragEventHandler QueryContinueDrag;
+ public event EventHandler SelectionChanged;
+ public event EventHandler VScroll;
+ #endregion // Events
+
+ #region Private Methods
+ private void HandleControl(RTF.RTF rtf) {
+ switch(rtf.Major) {
+ case RTF.Major.Unicode: {
+ switch(rtf.Minor) {
+ case Minor.UnicodeCharBytes: {
+ rtf_skip_width = rtf.Param;
+ break;
+ }
+
+ case Minor.UnicodeChar: {
+ rtf_skip_count += rtf_skip_width;
+ rtf_line.Append((char)rtf.Param);
+ break;
+ }
+ }
+ break;
+ }
+
+ case RTF.Major.Destination: {
+ Console.Write("[Got Destination control {0}]", rtf.Minor);
+ rtf.SkipGroup();
+ break;
+ }
+
+ case RTF.Major.CharAttr: {
+ switch(rtf.Minor) {
+ case Minor.ForeColor: {
+ System.Windows.Forms.RTF.Color color;
+
+ color = System.Windows.Forms.RTF.Color.GetColor(rtf, rtf.Param);
+ if (color != null) {
+ FlushText(rtf, false);
+ if (color.Red == -1 && color.Green == -1 && color.Blue == -1) {
+ this.rtf_color = new SolidBrush(ForeColor);
+ } else {
+ this.rtf_color = new SolidBrush(Color.FromArgb(color.Red, color.Green, color.Blue));
+ }
+ }
+ break;
+ }
+
+ case Minor.FontSize: {
+ FlushText(rtf, false);
+ this.rtf_rtffont_size = rtf.Param / 2;
+ break;
+ }
+
+ case Minor.FontNum: {
+ System.Windows.Forms.RTF.Font font;
+
+ font = System.Windows.Forms.RTF.Font.GetFont(rtf, rtf.Param);
+ if (font != null) {
+ FlushText(rtf, false);
+ this.rtf_rtffont = font;
+ }
+ break;
+ }
+
+ case Minor.Plain: {
+ FlushText(rtf, false);
+ rtf_rtfstyle = FontStyle.Regular;
+ break;
+ }
+
+ case Minor.Bold: {
+ FlushText(rtf, false);
+ if (rtf.Param == RTF.RTF.NoParam) {
+ rtf_rtfstyle |= FontStyle.Bold;
+ } else {
+ rtf_rtfstyle &= ~FontStyle.Bold;
+ }
+ break;
+ }
+
+ case Minor.Italic: {
+ FlushText(rtf, false);
+ if (rtf.Param == RTF.RTF.NoParam) {
+ rtf_rtfstyle |= FontStyle.Italic;
+ } else {
+ rtf_rtfstyle &= ~FontStyle.Italic;
+ }
+ break;
+ }
+
+ case Minor.StrikeThru: {
+ FlushText(rtf, false);
+ if (rtf.Param == RTF.RTF.NoParam) {
+ rtf_rtfstyle |= FontStyle.Strikeout;
+ } else {
+ rtf_rtfstyle &= ~FontStyle.Strikeout;
+ }
+ break;
+ }
+
+ case Minor.Underline: {
+ FlushText(rtf, false);
+ if (rtf.Param == RTF.RTF.NoParam) {
+ rtf_rtfstyle |= FontStyle.Underline;
+ } else {
+ rtf_rtfstyle = rtf_rtfstyle & ~FontStyle.Underline;
+ }
+ break;
+ }
+
+ case Minor.NoUnderline: {
+ FlushText(rtf, false);
+ rtf_rtfstyle &= ~FontStyle.Underline;
+ break;
+ }
+ }
+ break;
+ }
+
+ case RTF.Major.SpecialChar: {
+ Console.Write("[Got SpecialChar control {0}]", rtf.Minor);
+ SpecialChar(rtf);
+ break;
+ }
+ }
+ }
+
+ private void SpecialChar(RTF.RTF rtf) {
+ switch(rtf.Minor) {
+ case Minor.Page:
+ case Minor.Sect:
+ case Minor.Row:
+ case Minor.Line:
+ case Minor.Par: {
+ FlushText(rtf, true);
+ break;
+ }
+
+ case Minor.Cell: {
+ Console.Write(" ");
+ break;
+ }
+
+ case Minor.NoBrkSpace: {
+ Console.Write(" ");
+ break;
+ }
+
+ case Minor.Tab: {
+ Console.Write("\t");
+ break;
+ }
+
+ case Minor.NoBrkHyphen: {
+ Console.Write("-");
+ break;
+ }
+
+ case Minor.Bullet: {
+ Console.Write("*");
+ break;
+ }
+
+ case Minor.EmDash: {
+ Console.Write("—");
+ break;
+ }
+
+ case Minor.EnDash: {
+ Console.Write("–");
+ break;
+ }
+
+ case Minor.LQuote: {
+ Console.Write("‘");
+ break;
+ }
+
+ case Minor.RQuote: {
+ Console.Write("’");
+ break;
+ }
+
+ case Minor.LDblQuote: {
+ Console.Write("“");
+ break;
+ }
+
+ case Minor.RDblQuote: {
+ Console.Write("”");
+ break;
+ }
+
+ default: {
+ rtf.SkipGroup();
+ break;
+ }
+ }
+ }
+
+ private void HandleText(RTF.RTF rtf) {
+ if (rtf_skip_count > 0) {
+ rtf_skip_count--;
+ return;
+ }
+
+ if ((RTF.StandardCharCode)rtf.Minor != RTF.StandardCharCode.nothing) {
+ rtf_line.Append(rtf_text_map[(RTF.StandardCharCode)rtf.Minor]);
+ } else {
+ if ((int)rtf.Major > 31 && (int)rtf.Major < 128) {
+ rtf_line.Append((char)rtf.Major);
+ } else {
+ //rtf_line.Append((char)rtf.Major);
+ Console.Write("[Literal:0x{0:X2}]", (int)rtf.Major);
+ }
+ }
+ }
+
+ private void FlushText(RTF.RTF rtf, bool newline) {
+ int length;
+ Font font;
+
+ length = rtf_line.Length;
+ if (length == 0) {
+ return;
+ }
+
+ if (rtf_rtffont == null) {
+ // First font in table is default
+ rtf_rtffont = System.Windows.Forms.RTF.Font.GetFont(rtf, 0);
+ }
+
+ font = new Font(rtf_rtffont.Name, rtf_rtffont_size, rtf_rtfstyle);
+
+ if (rtf_color == null) {
+ System.Windows.Forms.RTF.Color color;
+
+ // First color in table is default
+ color = System.Windows.Forms.RTF.Color.GetColor(rtf, 0);
+
+ if ((color == null) || (color.Red == -1 && color.Green == -1 && color.Blue == -1)) {
+ rtf_color = new SolidBrush(ForeColor);
+ } else {
+ rtf_color = new SolidBrush(Color.FromArgb(color.Red, color.Green, color.Blue));
+ }
+ }
+
+ if (rtf_cursor_x == 0) {
+ document.Add(rtf_cursor_y, rtf_line.ToString(), rtf_rtfalign, font, rtf_color);
+ } else {
+ Line line;
+
+ line = document.GetLine(rtf_cursor_y);
+ document.InsertString(line, rtf_cursor_x, rtf_line.ToString());
+ document.FormatText(line, rtf_cursor_x + 1, line, rtf_cursor_x + 1 + length, font, rtf_color); // FormatText is 1-based
+ }
+
+ if (newline) {
+ rtf_cursor_x = 0;
+ rtf_cursor_y++;
+ } else {
+ rtf_cursor_x += length;
+ }
+ rtf_line.Length = 0; // Empty line
+ }
+
+ private void InsertRTFFromStream(Stream data, int cursor_x, int cursor_y) {
+ int x;
+ int y;
+
+ InsertRTFFromStream(data, cursor_x, cursor_y, out x, out y);
+ }
+
+ private void InsertRTFFromStream(Stream data, int cursor_x, int cursor_y, out int to_x, out int to_y) {
+ RTF.RTF rtf;
+
+ rtf = new RTF.RTF(data);
+
+ // Prepare
+ rtf.ClassCallback[RTF.TokenClass.Text] = new RTF.ClassDelegate(HandleText);
+ rtf.ClassCallback[RTF.TokenClass.Control] = new RTF.ClassDelegate(HandleControl);
+
+ rtf_skip_width = 0;
+ rtf_skip_count = 0;
+ rtf_line = new StringBuilder();
+ rtf_color = null;
+ rtf_rtffont_size = (int)this.Font.Size;
+ rtf_rtfalign = HorizontalAlignment.Left;
+ rtf_rtfstyle = FontStyle.Regular;
+ rtf_rtffont = null;
+ rtf_cursor_x = cursor_x;
+ rtf_cursor_y = cursor_y;
+ rtf.DefaultFont(this.Font.Name);
+
+ rtf_text_map = new RTF.TextMap();
+ RTF.TextMap.SetupStandardTable(rtf_text_map.Table);
+
+ try {
+ rtf.Read(); // That's it
+ FlushText(rtf, false);
+ }
+
+ catch (RTF.RTFException) {
+ // Seems to be plain text...
+
+ }
+
+ to_x = rtf_cursor_x;
+ to_y = rtf_cursor_y;
+
+ document.RecalculateDocument(CreateGraphics(), cursor_y, document.Lines, false);
+ document.Invalidate(document.GetLine(cursor_y), 0, document.GetLine(document.Lines), -1);
+ }
+
+ private void RichTextBox_HScrolled(object sender, EventArgs e) {
+ OnHScroll(e);
+ }
+
+ private void RichTextBox_VScrolled(object sender, EventArgs e) {
+ OnVScroll(e);
+ }
+
+ private void PointToTagPos(Point pt, out LineTag tag, out int pos) {
+ Point p;
+
+ p = pt;
+
+ if (p.X >= document.ViewPortWidth) {
+ p.X = document.ViewPortWidth - 1;
+ } else if (p.X < 0) {
+ p.X = 0;
+ }
+
+ if (p.Y >= document.ViewPortHeight) {
+ p.Y = document.ViewPortHeight - 1;
+ } else if (p.Y < 0) {
+ p.Y = 0;
+ }
+
+ tag = document.FindCursor(p.X + document.ViewPortX, p.Y + document.ViewPortY, out pos);
+ }
+
+ private void EmitRTFFontProperties(StringBuilder rtf, int prev_index, int font_index, Font prev_font, Font font) {
+ if (prev_index != font_index) {
+ rtf.Append(String.Format("\\f{0}", font_index)); // Font table entry
+ }
+
+ if ((prev_font == null) || (prev_font.Size != font.Size)) {
+ rtf.Append(String.Format("\\fs{0}", (int)(font.Size * 2))); // Font size
+ }
+
+ if ((prev_font == null) || (font.Bold != prev_font.Bold)) {
+ if (font.Bold) {
+ rtf.Append("\\b");
+ } else {
+ if (prev_font != null) {
+ rtf.Append("\\b0");
+ }
+ }
+ }
+
+ if ((prev_font == null) || (font.Italic != prev_font.Italic)) {
+ if (font.Italic) {
+ rtf.Append("\\i");
+ } else {
+ if (prev_font != null) {
+ rtf.Append("\\i0");
+ }
+ }
+ }
+
+ if ((prev_font == null) || (font.Strikeout != prev_font.Strikeout)) {
+ if (font.Strikeout) {
+ rtf.Append("\\strike");
+ } else {
+ if (prev_font != null) {
+ rtf.Append("\\strike0");
+ }
+ }
+ }
+
+ if ((prev_font == null) || (font.Underline != prev_font.Underline)) {
+ if (font.Underline) {
+ rtf.Append("\\ul");
+ } else {
+ if (prev_font != null) {
+ rtf.Append("\\ul0");
+ }
+ }
+ }
+ }
+
+ [MonoTODO("Emit unicode and other special characters properly")]
+ private void EmitRTFText(StringBuilder rtf, string text) {
+ rtf.Append(text);
+ }
+
+ // start_pos and end_pos are 0-based
+ private StringBuilder GenerateRTF(Line start_line, int start_pos, Line end_line, int end_pos) {
+ StringBuilder sb;
+ ArrayList fonts;
+ ArrayList colors;
+ Color color;
+ Font font;
+ Line line;
+ LineTag tag;
+ int pos;
+ int line_no;
+ int line_len;
+ int i;
+ int length;
+
+ sb = new StringBuilder();
+ fonts = new ArrayList(10);
+ colors = new ArrayList(10);
+
+ // Two runs, first we parse to determine tables;
+ // and unlike most of our processing here we work on tags
+
+ line = start_line;
+ line_no = start_line.line_no;
+ pos = start_pos;
+
+ // Add default font and color; to optimize document content we don't
+ // use this.Font and this.ForeColor but the font/color from the first tag
+ tag = LineTag.FindTag(start_line, pos);
+ font = tag.font;
+ color = ((SolidBrush)tag.color).Color;
+ fonts.Add(font.Name);
+ colors.Add(color);
+
+ while (line_no <= end_line.line_no) {
+ line = document.GetLine(line_no);
+ tag = LineTag.FindTag(line, pos);
+
+ if (line_no != end_line.line_no) {
+ line_len = line.text.Length;
+ } else {
+ line_len = end_pos;
+ }
+
+ while (pos < line_len) {
+ if (tag.font.Name != font.Name) {
+ font = tag.font;
+ if (!fonts.Contains(font.Name)) {
+ fonts.Add(font.Name);
+ }
+ }
+
+ if (((SolidBrush)tag.color).Color != color) {
+ color = ((SolidBrush)tag.color).Color;
+ if (!colors.Contains(color)) {
+ colors.Add(color);
+ }
+ }
+
+ pos = tag.start + tag.length - 1;
+ tag = tag.next;
+ }
+ pos = 0;
+ line_no++;
+ }
+
+ // We have the tables, emit the header
+ sb.Append("{\\rtf1\\ansi");
+ sb.Append("\\ansicpg1252"); // FIXME - is this correct?
+
+ // Default Font
+ sb.Append(String.Format("\\deff{0}", fonts.IndexOf(this.Font.Name)));
+
+ // Default Language
+ sb.Append("\\deflang1033\n"); // FIXME - always 1033?
+
+ // Emit the font table
+ sb.Append("{\\fonttbl");
+ for (i = 0; i < fonts.Count; i++) {
+ sb.Append(String.Format("{{\\f{0}", i)); // {Font
+ sb.Append("\\fnil"); // Family
+ sb.Append("\\fcharset0 "); // Charset ANSI<space>
+ sb.Append((string)fonts[i]); // Font name
+ sb.Append(";}"); // }
+ }
+ sb.Append("}\n");
+
+ // Emit the color table (if needed)
+ if ((colors.Count > 1) || ((((Color)colors[0]).R != this.ForeColor.R) || (((Color)colors[0]).G != this.ForeColor.G) || (((Color)colors[0]).B != this.ForeColor.B))) {
+ sb.Append("{\\colortbl "); // Header and NO! default color
+ for (i = 0; i < colors.Count; i++) {
+ sb.Append(String.Format("\\red{0}", ((Color)colors[i]).R));
+ sb.Append(String.Format("\\green{0}", ((Color)colors[i]).G));
+ sb.Append(String.Format("\\blue{0}", ((Color)colors[i]).B));
+ sb.Append(";");
+ }
+ sb.Append("}\n");
+ }
+
+ sb.Append("{\\*\\generator Mono RichTextBox;}");
+ // Emit initial paragraph settings
+ tag = LineTag.FindTag(start_line, start_pos);
+ sb.Append("\\pard"); // Reset to default paragraph properties
+ EmitRTFFontProperties(sb, -1, fonts.IndexOf(tag.font.Name), null, tag.font); // Font properties
+ sb.Append(" "); // Space separator
+
+ font = tag.font;
+ color = (Color)colors[0];
+ line = start_line;
+ line_no = start_line.line_no;
+ pos = start_pos;
+
+ while (line_no <= end_line.line_no) {
+ line = document.GetLine(line_no);
+ tag = LineTag.FindTag(line, pos);
+
+ if (line_no != end_line.line_no) {
+ line_len = line.text.Length;
+ } else {
+ line_len = end_pos;
+ }
+
+ while (pos < line_len) {
+ length = sb.Length;
+
+ if (tag.font != font) {
+ EmitRTFFontProperties(sb, fonts.IndexOf(font.Name), fonts.IndexOf(tag.font.Name), font, tag.font);
+ font = tag.font;
+ }
+
+ if (((SolidBrush)tag.color).Color != color) {
+ color = ((SolidBrush)tag.color).Color;
+ sb.Append(String.Format("\\cf{0}", colors.IndexOf(color)));
+ }
+ if (length != sb.Length) {
+ sb.Append(" "); // Emit space to separate keywords from text
+ }
+
+ // Emit the string itself
+ if (line_no != end_line.line_no) {
+ EmitRTFText(sb, tag.line.text.ToString(pos, tag.start + tag.length - pos - 1));
+ } else {
+ if (end_pos < (tag.start + tag.length - 1)) {
+ // Emit partial tag only, end_pos is inside this tag
+ EmitRTFText(sb, tag.line.text.ToString(pos, end_pos - pos));
+ } else {
+ EmitRTFText(sb, tag.line.text.ToString(pos, tag.start + tag.length - pos - 1));
+ }
+ }
+
+ pos = tag.start + tag.length - 1;
+ tag = tag.next;
+ }
+ if (pos >= line.text.Length) {
+ if (!line.soft_break) {
+ sb.Append("\\par\n");
+ }
+ }
+ pos = 0;
+ line_no++;
+ }
+
+ sb.Append("}\n");
+
+ return sb;
+ }
+ #endregion // Private Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBoxFinds.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBoxFinds.cs
new file mode 100644
index 00000000000..a6a93d0b56a
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBoxFinds.cs
@@ -0,0 +1,38 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok <pbartok@novell.com>
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ [Flags]
+ public enum RichTextBoxFinds {
+ None = 0x00000000,
+ WholeWord = 0x00000002,
+ MatchCase = 0x00000004,
+ NoHighlight = 0x00000008,
+ Reverse = 0x00000010,
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBoxScrollBars.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBoxScrollBars.cs
new file mode 100644
index 00000000000..a26e2346540
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBoxScrollBars.cs
@@ -0,0 +1,39 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok <pbartok@novell.com>
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public enum RichTextBoxScrollBars {
+ None = 0,
+ Horizontal = 1,
+ Vertical = 2,
+ Both = 3,
+ ForcedHorizontal= 17,
+ ForcedVertical = 18,
+ ForcedBoth = 19
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBoxSelectionAttribute.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBoxSelectionAttribute.cs
new file mode 100644
index 00000000000..80d78eeadf0
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBoxSelectionAttribute.cs
@@ -0,0 +1,35 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok <pbartok@novell.com>
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public enum RichTextBoxSelectionAttribute {
+ None = 0,
+ All = 1,
+ Mixed = -1,
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBoxSelectionTypes.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBoxSelectionTypes.cs
new file mode 100644
index 00000000000..34d80eb32e4
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBoxSelectionTypes.cs
@@ -0,0 +1,38 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok <pbartok@novell.com>
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ [Flags]
+ public enum RichTextBoxSelectionTypes {
+ Empty = 0x00000000,
+ Text = 0x00000001,
+ Object = 0x00000002,
+ MultiChar = 0x00000004,
+ MultiObject = 0x00000008
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBoxStreamType.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBoxStreamType.cs
new file mode 100644
index 00000000000..2b9a7198bad
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBoxStreamType.cs
@@ -0,0 +1,37 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok <pbartok@novell.com>
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public enum RichTextBoxStreamType {
+ RichText = 0,
+ PlainText = 1,
+ RichNoOleObjs = 2,
+ TextTextOleObjs = 3,
+ UnicodePlainText= 4
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBoxWordPunctuations.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBoxWordPunctuations.cs
new file mode 100644
index 00000000000..a6a97dadb8d
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBoxWordPunctuations.cs
@@ -0,0 +1,36 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok <pbartok@novell.com>
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public enum RichTextBoxWordPunctuations {
+ Level1 = 128,
+ Level2 = 256,
+ Custom = 512,
+ All = 896
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RightToLeft.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RightToLeft.cs
new file mode 100644
index 00000000000..05afe1bcdee
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RightToLeft.cs
@@ -0,0 +1,36 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public enum RightToLeft {
+ No = 0,
+ Yes = 1,
+ Inherit = 2
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SWF.csproj.user b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SWF.csproj.user
new file mode 100644
index 00000000000..412fc047288
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SWF.csproj.user
@@ -0,0 +1,48 @@
+<VisualStudioProject>
+ <CSHARP LastOpenVersion = "7.10.3077" >
+ <Build>
+ <Settings ReferencePath = "" >
+ <Config
+ Name = "Debug"
+ EnableASPDebugging = "false"
+ EnableASPXDebugging = "false"
+ EnableUnmanagedDebugging = "false"
+ EnableSQLServerDebugging = "false"
+ RemoteDebugEnabled = "false"
+ RemoteDebugMachine = ""
+ StartAction = "Project"
+ StartArguments = ""
+ StartPage = ""
+ StartProgram = ""
+ StartURL = ""
+ StartWorkingDirectory = ""
+ StartWithIE = "true"
+ />
+ <Config
+ Name = "Release"
+ EnableASPDebugging = "false"
+ EnableASPXDebugging = "false"
+ EnableUnmanagedDebugging = "false"
+ EnableSQLServerDebugging = "false"
+ RemoteDebugEnabled = "false"
+ RemoteDebugMachine = ""
+ StartAction = "Project"
+ StartArguments = ""
+ StartPage = ""
+ StartProgram = ""
+ StartURL = ""
+ StartWorkingDirectory = ""
+ StartWithIE = "false"
+ />
+ </Settings>
+ </Build>
+ <OtherProjectSettings
+ CopyProjectDestinationFolder = ""
+ CopyProjectUncPath = ""
+ CopyProjectOption = "0"
+ ProjectView = "ProjectFiles"
+ ProjectTrust = "0"
+ />
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SaveFileDialog.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SaveFileDialog.cs
new file mode 100644
index 00000000000..65f939afd31
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SaveFileDialog.cs
@@ -0,0 +1,117 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//
+// Alexander Olk xenomorph2@onlinehome.de
+//
+
+// NOT COMPLETE - work in progress
+
+using System;
+using System.ComponentModel;
+using System.Drawing;
+using System.IO;
+
+namespace System.Windows.Forms
+{
+ [Designer("System.Windows.Forms.Design.SaveFileDialogDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+ public sealed class SaveFileDialog : FileDialog
+ {
+ #region Public Constructors
+ public SaveFileDialog( )
+ {
+ form.Text = "Save";
+
+ form.Size = new Size( 554, 405 ); // 384
+
+ OpenSaveButtonText = "Save";
+
+ SearchSaveLabelText = "Save in:";
+
+ fileDialogType = FileDialogType.SaveFileDialog;
+
+ fileDialogPanel = new FileDialogPanel( this );
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ [DefaultValue(false)]
+ public new bool CreatePrompt
+ {
+ set
+ {
+ base.CreatePrompt = value;
+ }
+
+ get
+ {
+ return createPrompt;
+ }
+ }
+
+ [DefaultValue(true)]
+ public new bool OverwritePrompt
+ {
+ set
+ {
+ base.OverwritePrompt = value;
+ }
+
+ get
+ {
+ return overwritePrompt;
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Instance Methods
+ public Stream OpenFile( )
+ {
+ if ( FileName == null )
+ throw new ArgumentNullException( "OpenFile", "FileName is null" );
+
+ Stream retValue;
+
+ try
+ {
+ retValue = new FileStream( FileName, FileMode.Create, FileAccess.ReadWrite );
+ }
+ catch (Exception ex)
+ {
+ retValue = null;
+ }
+
+ return retValue;
+ }
+ #endregion // Public Instance Methods
+
+ public override void Reset( )
+ {
+ base.Reset( );
+ overwritePrompt = true;
+ createPrompt = false;
+ OverwritePrompt = overwritePrompt;
+ CreatePrompt = createPrompt;
+ }
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Screen.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Screen.cs
new file mode 100644
index 00000000000..9e2ccb97f53
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Screen.cs
@@ -0,0 +1,181 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+// NOTE: We made a concious decision to have only a single 'screen'
+// due to the differences in platforms. On Win32 we could gather
+// all information, but not for X11 (and possibly Mac). So for now
+// we'll stick with a single screen, but the functions are still
+// written to support multiple screens, simply beef up the all_screens
+// assignment to get multiples
+// To support multiples, we need to use GetMonitorInfo API on Win32
+
+using System;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+ public class Screen {
+ #region Local Variables
+ private static Screen[] all_screens = { new Screen(true, "Mono MWF Primary Display", SystemInformation.VirtualScreen, SystemInformation.WorkingArea) };
+ private bool primary;
+ private Rectangle bounds;
+ private Rectangle workarea;
+ private string name;
+
+ #endregion // Local Variables
+
+ #region Constructors
+ private Screen() {
+ this.primary = true;
+ this.bounds = SystemInformation.WorkingArea;
+ }
+
+ private Screen(bool primary, string name, Rectangle bounds, Rectangle workarea) {
+ this.primary = primary;
+ this.name = name;
+ this.bounds = bounds;
+ this.workarea = workarea;
+ }
+ #endregion // Constructors
+
+ #region Public Static Properties
+ public static Screen[] AllScreens {
+ get {
+ return all_screens;
+ }
+ }
+
+ public static Screen PrimaryScreen {
+ get {
+ return all_screens[0];
+ }
+ }
+ #endregion // Public Static Properties
+
+ #region Public Instance Properties
+ public Rectangle Bounds {
+ get {
+ return this.bounds;
+ }
+ }
+
+ public string DeviceName {
+ get {
+ return this.name;
+ }
+ }
+
+ public bool Primary {
+ get {
+ return this.primary;
+ }
+ }
+
+ public Rectangle WorkingArea {
+ get {
+ return this.workarea;
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Static Methods
+ public static Screen FromControl(Control control) {
+ return Screen.FromPoint(control.Location);
+ }
+
+ public static Screen FromHandle(IntPtr hwnd) {
+ Control control;
+
+ control = Control.FromHandle(hwnd);
+ if (control != null) {
+ return Screen.FromPoint(control.Location);
+ }
+ return Screen.PrimaryScreen;
+ }
+
+ public static Screen FromPoint(Point point) {
+ for (int i = 0; i < all_screens.Length; i++) {
+ if (all_screens[i].Bounds.Contains(point)) {
+ return all_screens[i];
+ }
+ }
+ return Screen.PrimaryScreen;
+ }
+
+ public static Screen FromRectangle(Rectangle rect) {
+ return Screen.FromPoint(new Point(rect.Left, rect.Top));
+ }
+
+ public static Rectangle GetBounds(Control ctl) {
+ return Screen.FromControl(ctl).Bounds;
+ }
+
+ public static Rectangle GetBounds(Point pt) {
+ return Screen.FromPoint(pt).Bounds;
+ }
+
+ public static Rectangle GetBounds(Rectangle rect) {
+ return Screen.FromRectangle(rect).Bounds;
+ }
+
+ public static Rectangle GetWorkingArea(Control ctl) {
+ return Screen.FromControl(ctl).WorkingArea;
+ }
+
+ public static Rectangle GetWorkingArea(Point pt) {
+ return Screen.FromPoint(pt).WorkingArea;
+ }
+
+ public static Rectangle GetWorkingArea(Rectangle rect) {
+ return Screen.FromRectangle(rect).WorkingArea;
+ }
+ #endregion // Public Static Methods
+
+ #region Public Instance Methods
+ public override bool Equals(object obj) {
+ if (obj is Screen) {
+ Screen s = (Screen)obj;
+
+ if (name.Equals(s.name) && (primary == s.primary) && (bounds.Equals(s.Bounds)) && (workarea.Equals(s.workarea))) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public override int GetHashCode() {
+ return base.GetHashCode ();
+ }
+
+ public override string ToString() {
+ return "Screen[Bounds={" + this.Bounds + "} WorkingArea={" + this.WorkingArea + "} Primary={" + this.Primary + "} DeviceName=" + this.DeviceName;
+ }
+
+
+ #endregion // Public Instance Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollBar.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollBar.cs
new file mode 100644
index 00000000000..8dab1dfe0da
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollBar.cs
@@ -0,0 +1,1235 @@
+//
+// System.Windows.Forms.ScrollBar.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-2005, Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez jordi@ximian.com
+//
+//
+
+// COMPLETE
+
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.Drawing.Drawing2D;
+using System.ComponentModel;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms
+{
+ [DefaultEvent ("Scroll")]
+ [DefaultProperty ("Value")]
+ public abstract class ScrollBar : Control
+ {
+ #region Local Variables
+ private int position;
+ private int minimum;
+ private int maximum;
+ private int large_change;
+ private int small_change;
+ internal int scrollbutton_height;
+ internal int scrollbutton_width;
+ private ScrollBars type;
+ private Rectangle first_arrow_area = new Rectangle (); // up or left
+ private Rectangle second_arrow_area = new Rectangle (); // down or right
+ private Rectangle thumb_pos = new Rectangle ();
+ private Rectangle thumb_area = new Rectangle ();
+ internal ButtonState firstbutton_state = ButtonState.Normal;
+ internal ButtonState secondbutton_state = ButtonState.Normal;
+ private bool firstbutton_pressed = false;
+ private bool secondbutton_pressed = false;
+ private bool thumb_pressed = false;
+ private float pixel_per_pos = 0;
+ private Timer timer = new Timer ();
+ private TimerType timer_type;
+ private int thumb_pixel_click_move;
+ private int thumb_pixel_click_move_prev;
+ private int thumb_size = 40;
+ private const int thumb_min_size = 8;
+ private const int thumb_notshown_size = 40;
+ internal bool vert;
+ private int lastclick_pos; // Position of the last button-down event
+ private int lastclick_pos_thumb; // Position of the last button-down event relative to the thumb
+ private bool outside_thumbarea_right = false;
+ private bool outside_thumbarea_left = false;
+
+ private Rectangle dirty;
+
+ internal ThumbMoving thumb_moving = ThumbMoving.None;
+ #endregion // Local Variables
+
+ private enum TimerType
+ {
+ HoldButton,
+ RepeatButton,
+ HoldThumbArea,
+ RepeatThumbArea
+ }
+
+ internal enum ThumbMoving
+ {
+ None,
+ Forward,
+ Backwards,
+ }
+
+ #region events
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler BackColorChanged;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler BackgroundImageChanged;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler Click;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler DoubleClick;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler FontChanged;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler ForeColorChanged;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler ImeModeChanged;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event MouseEventHandler MouseDown;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event MouseEventHandler MouseMove;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event MouseEventHandler MouseUp;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event PaintEventHandler Paint;
+
+ public event ScrollEventHandler Scroll;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler TextChanged;
+
+ public event EventHandler ValueChanged;
+ #endregion Events
+
+ public ScrollBar ()
+ {
+ position = 0;
+ minimum = 0;
+ maximum = 100;
+ large_change = 10;
+ small_change = 1;
+
+ timer.Tick += new EventHandler (OnTimer);
+ base.KeyDown += new KeyEventHandler (OnKeyDownSB);
+ base.MouseDown += new MouseEventHandler (OnMouseDownSB);
+ base.MouseUp += new MouseEventHandler (OnMouseUpSB);
+ base.MouseMove += new MouseEventHandler (OnMouseMoveSB);
+ base.Resize += new EventHandler (OnResizeSB);
+ base.TabStop = false;
+
+ SetStyle (ControlStyles.UserPaint | ControlStyles.StandardClick, false);
+ }
+
+ #region Internal & Private Properties
+ internal Rectangle FirstArrowArea {
+ get {
+ return this.first_arrow_area;
+ }
+
+ set {
+ this.first_arrow_area = value;
+ }
+ }
+
+ internal Rectangle SecondArrowArea {
+ get {
+ return this.second_arrow_area;
+ }
+
+ set {
+ this.second_arrow_area = value;
+ }
+ }
+
+ internal Rectangle ThumbPos {
+ get {
+ return thumb_pos;
+ }
+
+ set {
+ thumb_pos = value;
+ }
+ }
+ #endregion // Internal & Private Properties
+
+ #region Public Properties
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ [Browsable (false)]
+ public override Color BackColor
+ {
+ get { return base.BackColor; }
+ set {
+ if (base.BackColor == value)
+ return;
+
+ if (BackColorChanged != null)
+ BackColorChanged (this, EventArgs.Empty);
+
+ base.BackColor = value;
+ Refresh ();
+ }
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ [Browsable (false)]
+ public override Image BackgroundImage
+ {
+ get { return base.BackgroundImage; }
+ set {
+ if (base.BackgroundImage == value)
+ return;
+
+ if (BackgroundImageChanged != null)
+ BackgroundImageChanged (this, EventArgs.Empty);
+
+ base.BackgroundImage = value;
+ }
+ }
+
+ protected override CreateParams CreateParams
+ {
+ get { return base.CreateParams; }
+ }
+
+ protected override ImeMode DefaultImeMode
+ {
+ get { return ImeMode.Disable; }
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ [Browsable (false)]
+ public override Font Font
+ {
+ get { return base.Font; }
+ set {
+ if (base.Font.Equals (value))
+ return;
+
+ if (FontChanged != null)
+ FontChanged (this, EventArgs.Empty);
+
+ base.Font = value;
+ }
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ [Browsable (false)]
+ public override Color ForeColor
+ {
+ get { return base.ForeColor; }
+ set {
+ if (base.ForeColor == value)
+ return;
+
+ if (ForeColorChanged != null)
+ ForeColorChanged (this, EventArgs.Empty);
+
+ base.ForeColor = value;
+ Refresh ();
+ }
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ [Browsable (false)]
+ public new ImeMode ImeMode
+ {
+ get { return base.ImeMode; }
+ set {
+ if (base.ImeMode == value)
+ return;
+
+ if (ImeModeChanged != null)
+ ImeModeChanged (this, EventArgs.Empty);
+
+ base.ImeMode = value;
+ }
+ }
+
+ [DefaultValue (10)]
+ [RefreshProperties(RefreshProperties.Repaint)]
+ [MWFDescription("Scroll amount when clicking in the scroll area"), MWFCategory("Behaviour")]
+ public int LargeChange {
+ get {
+ if (large_change > maximum)
+ return (maximum + 1);
+ else
+ return large_change;
+ }
+ set {
+ if (value < 0)
+ throw new Exception( string.Format("Value '{0}' must be greater than or equal to 0.", value));
+
+ if (large_change != value) {
+ large_change = value;
+
+ // thumb area depends on large change value,
+ // so we need to recalculate it.
+ CalcThumbArea ();
+ UpdatePos (Value, true);
+ Refresh ();
+ }
+ }
+ }
+
+ [DefaultValue (100)]
+ [RefreshProperties(RefreshProperties.Repaint)]
+ [MWFDescription("Highest value for scrollbar"), MWFCategory("Behaviour")]
+ public int Maximum {
+ get { return maximum; }
+ set {
+ if (maximum == value)
+ return;
+
+ maximum = value;
+
+ if (maximum < minimum)
+ minimum = maximum;
+
+ // thumb area depends on maximum value,
+ // so we need to recalculate it.
+ CalcThumbArea ();
+ UpdatePos (Value, true);
+ Refresh ();
+ }
+ }
+
+ [DefaultValue (0)]
+ [RefreshProperties(RefreshProperties.Repaint)]
+ [MWFDescription("Smallest value for scrollbar"), MWFCategory("Behaviour")]
+ public int Minimum {
+ get { return minimum; }
+ set {
+ if (minimum == value)
+ return;
+
+ minimum = value;
+
+ if (minimum > maximum)
+ maximum = minimum;
+
+ // thumb area depends on minimum value,
+ // so we need to recalculate it.
+ CalcThumbArea ();
+ UpdatePos (Value, true);
+ Refresh ();
+ }
+ }
+
+ [DefaultValue (1)]
+ [MWFDescription("Scroll amount when clicking scroll arrows"), MWFCategory("Behaviour")]
+ public int SmallChange {
+ get { return small_change; }
+ set {
+ if ( value < 0 )
+ throw new Exception( string.Format("Value '{0}' must be greater than or equal to 0.", value));
+
+ if (small_change != value) {
+ small_change = value;
+ UpdatePos (Value, true);
+ Refresh ();
+ }
+ }
+ }
+
+ [DefaultValue (false)]
+ public new bool TabStop {
+ get { return base.TabStop; }
+ set { base.TabStop = value; }
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ [Bindable (false)]
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public override string Text {
+ get { return base.Text; }
+ set { base.Text = value; }
+ }
+
+ [Bindable(true)]
+ [DefaultValue (0)]
+ [MWFDescription("Current value for scrollbar"), MWFCategory("Behaviour")]
+ public int Value {
+ get { return position; }
+ set {
+ if ( value < minimum || value > maximum )
+ throw new ArgumentException(
+ string.Format("'{0}' is not a valid value for 'Value'. 'Value' should be between 'Minimum' and 'Maximum'", value));
+
+ if (position != value){
+ position = value;
+
+ OnValueChanged (EventArgs.Empty);
+
+ ClearDirty ();
+
+ if (IsHandleCreated) {
+ UpdateThumbPos (thumb_area.Y + (int)(((float)(position - minimum)) * pixel_per_pos), false);
+ }
+
+ InvalidateDirty ();
+ }
+ }
+ }
+
+ #endregion //Public Properties
+
+ #region Public Methods
+
+ protected override void OnEnabledChanged (EventArgs e)
+ {
+ base.OnEnabledChanged (e);
+
+ if (Enabled)
+ firstbutton_state = secondbutton_state = ButtonState.Normal;
+ else
+ firstbutton_state = secondbutton_state = ButtonState.Inactive;
+
+ Refresh ();
+ }
+
+ protected override void OnHandleCreated (System.EventArgs e)
+ {
+ base.OnHandleCreated (e);
+
+ CalcButtonSizes ();
+ CalcThumbArea ();
+ UpdateThumbPos (thumb_area.Y + (int)(((float)(position - minimum)) * pixel_per_pos), false);
+ }
+
+ protected virtual void OnScroll (ScrollEventArgs event_args)
+ {
+ if (Scroll == null)
+ return;
+
+ if (event_args.NewValue < Minimum) {
+ event_args.NewValue = Minimum;
+ }
+
+ if (event_args.NewValue > Maximum) {
+ event_args.NewValue = Maximum;
+ }
+
+ Scroll (this, event_args);
+ }
+
+ protected virtual void OnValueChanged (EventArgs e)
+ {
+ if (ValueChanged != null)
+ ValueChanged (this, e);
+ }
+
+ public override string ToString()
+ {
+ return string.Format("{0}, Minimum: {1}, Maximum: {2}, Value: {3}",
+ GetType( ).FullName.ToString( ), minimum, maximum, position);
+ }
+
+ protected void UpdateScrollInfo ()
+ {
+ Refresh ();
+ }
+
+ protected override void WndProc (ref Message m)
+ {
+ switch ((Msg) m.Msg)
+ {
+ case Msg.WM_PAINT:
+ {
+ PaintEventArgs paint_event;
+
+ paint_event = XplatUI.PaintEventStart (Handle, true);
+ OnPaintSB (paint_event);
+ XplatUI.PaintEventEnd (Handle, true);
+ return;
+ }
+
+ case Msg.WM_ERASEBKGND:
+ m.Result = (IntPtr) 1; /// Disable background painting to avoid flickering
+ return;
+
+ default:
+ break;
+ }
+
+ base.WndProc (ref m);
+ }
+
+ #endregion //Public Methods
+
+ #region Private Methods
+
+ private void CalcButtonSizes ()
+ {
+ if (vert) {
+ if (Height < ThemeEngine.Current.ScrollBarButtonSize * 2)
+ scrollbutton_height = Height /2;
+ else
+ scrollbutton_height = ThemeEngine.Current.ScrollBarButtonSize;
+
+ } else {
+ if (Width < ThemeEngine.Current.ScrollBarButtonSize * 2)
+ scrollbutton_width = Width /2;
+ else
+ scrollbutton_width = ThemeEngine.Current.ScrollBarButtonSize;
+ }
+ }
+
+ private void CalcThumbArea ()
+ {
+ // Thumb area
+ if (vert) {
+
+ thumb_area.Height = Height - scrollbutton_height - scrollbutton_height;
+ thumb_area.X = 0;
+ thumb_area.Y = scrollbutton_height;
+ thumb_area.Width = Width;
+
+ if (Height < thumb_notshown_size)
+ thumb_size = 0;
+ else {
+ double per = ((double) this.LargeChange / (double)((1 + maximum - minimum)));
+ thumb_size = 1 + (int) (thumb_area.Height * per);
+
+ if (thumb_size < thumb_min_size)
+ thumb_size = thumb_min_size;
+ }
+
+ pixel_per_pos = ((float)(thumb_area.Height - thumb_size) / (float) ((maximum - minimum - this.LargeChange) + 1));
+
+ } else {
+
+ thumb_area.Y = 0;
+ thumb_area.X = scrollbutton_width;
+ thumb_area.Height = Height;
+ thumb_area.Width = Width - scrollbutton_width - scrollbutton_width;
+
+ if (Width < thumb_notshown_size)
+ thumb_size = 0;
+ else {
+ double per = ((double) this.LargeChange / (double)((1 + maximum - minimum)));
+ thumb_size = 1 + (int) (thumb_area.Width * per);
+
+ if (thumb_size < thumb_min_size)
+ thumb_size = thumb_min_size;
+ }
+
+ pixel_per_pos = ((float)(thumb_area.Width - thumb_size) / (float) ((maximum - minimum - this.LargeChange) + 1));
+ }
+ }
+
+ private void LargeIncrement ()
+ {
+ ScrollEventArgs event_args;
+ int pos = position + large_change;
+
+ event_args = new ScrollEventArgs (ScrollEventType.LargeIncrement, pos);
+ OnScroll (event_args);
+ pos = event_args.NewValue;
+
+ event_args = new ScrollEventArgs (ScrollEventType.EndScroll, pos);
+ OnScroll (event_args);
+ pos = event_args.NewValue;
+
+ UpdatePos (pos, true);
+ }
+
+ private void LargeDecrement ()
+ {
+ ScrollEventArgs event_args;
+ int pos = position - large_change;
+
+ event_args = new ScrollEventArgs (ScrollEventType.LargeDecrement, pos);
+ OnScroll (event_args);
+ pos = event_args.NewValue;
+
+ event_args = new ScrollEventArgs (ScrollEventType.EndScroll, pos);
+ OnScroll (event_args);
+ pos = event_args.NewValue;
+
+
+ UpdatePos (pos, true);
+ }
+
+ private void OnResizeSB (Object o, EventArgs e)
+ {
+ if (Width <= 0 || Height <= 0)
+ return;
+
+ CalcButtonSizes ();
+ CalcThumbArea ();
+ UpdatePos (position, true);
+ }
+
+ private void OnPaintSB (PaintEventArgs pevent)
+ {
+ if (Paint != null) {
+ Paint (this, pevent);
+ }
+ ThemeEngine.Current.DrawScrollBar (pevent.Graphics, pevent.ClipRectangle, this);
+ }
+
+ private void OnTimer (Object source, EventArgs e)
+ {
+ ClearDirty ();
+
+ switch (timer_type) {
+
+ case TimerType.HoldButton:
+ SetRepeatButtonTimer ();
+ break;
+
+ case TimerType.RepeatButton:
+ {
+ if ((firstbutton_state & ButtonState.Pushed) == ButtonState.Pushed &&
+ position != Minimum)
+ SmallDecrement();
+
+ if ((secondbutton_state & ButtonState.Pushed) == ButtonState.Pushed &&
+ position != Maximum)
+ SmallIncrement();
+
+ break;
+ }
+
+ case TimerType.HoldThumbArea:
+ SetRepeatThumbAreaTimer ();
+ break;
+
+ case TimerType.RepeatThumbArea:
+ {
+ Point pnt, pnt_screen;
+ Rectangle thumb_area_screen = thumb_area;
+
+ pnt_screen = PointToScreen (new Point (thumb_area.X, thumb_area.Y));
+ thumb_area_screen.X = pnt_screen.X;
+ thumb_area_screen.Y = pnt_screen.Y;
+
+ if (thumb_area_screen.Contains (MousePosition) == false) {
+ timer.Enabled = false;
+ thumb_moving = ThumbMoving.None;
+ DirtyThumbArea ();
+ InvalidateDirty ();
+ }
+
+ pnt = PointToClient (MousePosition);
+
+ if (vert)
+ lastclick_pos = pnt.Y;
+ else
+ lastclick_pos = pnt.X;
+
+ if (thumb_moving == ThumbMoving.Forward) {
+ if ((vert && (thumb_pos.Y + thumb_size > lastclick_pos)) ||
+ (!vert && (thumb_pos.X + thumb_size > lastclick_pos)) ||
+ (thumb_area.Contains (pnt) == false)){
+ timer.Enabled = false;
+ thumb_moving = ThumbMoving.None;
+ Refresh ();
+ return;
+ } else {
+ LargeIncrement ();
+ }
+ }
+ else
+ if ((vert && (thumb_pos.Y < lastclick_pos)) ||
+ (!vert && (thumb_pos.X < lastclick_pos))){
+ timer.Enabled = false;
+ thumb_moving = ThumbMoving.None;
+ Refresh ();
+ } else {
+ LargeDecrement ();
+ }
+
+ break;
+ }
+ default:
+ break;
+ }
+
+ InvalidateDirty ();
+ }
+
+ private void OnMouseMoveSB (object sender, MouseEventArgs e)
+ {
+ if (MouseMove != null) {
+ MouseMove (this, e);
+ }
+
+ if (Enabled == false || thumb_size == 0)
+ return;
+
+ if (firstbutton_pressed) {
+ if (!first_arrow_area.Contains (e.X, e.Y) && ((firstbutton_state & ButtonState.Pushed) == ButtonState.Pushed)) {
+ firstbutton_state = ButtonState.Normal;
+ Invalidate (first_arrow_area);
+ return;
+ } else if (first_arrow_area.Contains (e.X, e.Y) && ((firstbutton_state & ButtonState.Normal) == ButtonState.Normal)) {
+ firstbutton_state = ButtonState.Pushed;
+ Invalidate (first_arrow_area);
+ return;
+ }
+ } else if (secondbutton_pressed) {
+ if (!second_arrow_area.Contains (e.X, e.Y) && ((secondbutton_state & ButtonState.Pushed) == ButtonState.Pushed)) {
+ secondbutton_state = ButtonState.Normal;
+ Invalidate (second_arrow_area);
+ return;
+ } else if (second_arrow_area.Contains (e.X, e.Y) && ((secondbutton_state & ButtonState.Normal) == ButtonState.Normal)) {
+ secondbutton_state = ButtonState.Pushed;
+ Invalidate (second_arrow_area);
+ return;
+ }
+ } else if (thumb_pressed == true) {
+ int pixel_pos;
+
+ if (vert) {
+
+ int mouse_click = e.Y;
+ int outside_curpos = thumb_area.Y + thumb_area.Height - thumb_size + lastclick_pos_thumb;
+
+
+ if (mouse_click > thumb_area.Y + thumb_area.Height) {
+ outside_thumbarea_right = true;
+ mouse_click = thumb_area.Y + thumb_area.Height;
+ }
+
+ if (mouse_click < thumb_area.Y) {
+ outside_thumbarea_left = true;
+ mouse_click = thumb_area.Y;
+ }
+
+ if (outside_thumbarea_right && mouse_click < outside_curpos) {
+ outside_thumbarea_right = false;
+ thumb_pixel_click_move_prev =
+ thumb_pixel_click_move = outside_curpos;
+ }
+
+ if (outside_thumbarea_left && mouse_click > thumb_area.Y + lastclick_pos_thumb) {
+ outside_thumbarea_left = false;
+ thumb_pixel_click_move_prev =
+ thumb_pixel_click_move = thumb_area.Y + lastclick_pos_thumb;
+ }
+
+ if (outside_thumbarea_right == false && outside_thumbarea_left == false) {
+ pixel_pos = thumb_pos.Y + (thumb_pixel_click_move - thumb_pixel_click_move_prev);
+ thumb_pixel_click_move_prev = thumb_pixel_click_move;
+ thumb_pixel_click_move = mouse_click;
+
+ UpdateThumbPos (pixel_pos, true);
+ OnScroll (new ScrollEventArgs (ScrollEventType.ThumbTrack, position));
+ }
+
+ }
+ else {
+ int mouse_click = e.X;
+ int outside_curpos = thumb_area.X + thumb_area.Width - thumb_size + lastclick_pos_thumb;
+
+ if (mouse_click > thumb_area.X + thumb_area.Width) {
+ outside_thumbarea_right = true;
+ mouse_click = thumb_area.X + thumb_area.Width;
+ }
+
+ if (mouse_click < thumb_area.X) {
+ outside_thumbarea_left = true;
+ mouse_click = thumb_area.X;
+ }
+
+ if (outside_thumbarea_right && mouse_click < outside_curpos) {
+ outside_thumbarea_right = false;
+ thumb_pixel_click_move_prev =
+ thumb_pixel_click_move = outside_curpos;
+ }
+
+ if (outside_thumbarea_left && mouse_click > thumb_area.X + lastclick_pos_thumb) {
+ outside_thumbarea_left = false;
+ thumb_pixel_click_move_prev =
+ thumb_pixel_click_move = thumb_area.X + lastclick_pos_thumb;
+ }
+
+ if (outside_thumbarea_right == false && outside_thumbarea_left == false) {
+ pixel_pos = thumb_pos.X + (thumb_pixel_click_move - thumb_pixel_click_move_prev);
+ thumb_pixel_click_move_prev = thumb_pixel_click_move;
+ thumb_pixel_click_move = mouse_click;
+ UpdateThumbPos (pixel_pos, true);
+ OnScroll (new ScrollEventArgs (ScrollEventType.ThumbTrack, position));
+ }
+
+ }
+
+ Refresh ();
+ }
+
+ }
+
+ private void OnMouseDownSB (object sender, MouseEventArgs e)
+ {
+ ClearDirty ();
+
+ if (e.Button == MouseButtons.Right) {
+ if (MouseDown != null) {
+ MouseDown (this, e);
+ }
+ }
+
+ if (Enabled == false)
+ return;
+
+ if (firstbutton_state != ButtonState.Inactive && first_arrow_area.Contains (e.X, e.Y)) {
+ this.Capture = true;
+ firstbutton_state = ButtonState.Pushed;
+ firstbutton_pressed = true;
+ Invalidate (first_arrow_area);
+ if (!timer.Enabled) {
+ SetHoldButtonClickTimer ();
+ timer.Enabled = true;
+ }
+ }
+
+ if (secondbutton_state != ButtonState.Inactive && second_arrow_area.Contains (e.X, e.Y)) {
+ this.Capture = true;
+ secondbutton_state = ButtonState.Pushed;
+ secondbutton_pressed = true;
+ Invalidate (second_arrow_area);
+ if (!timer.Enabled) {
+ SetHoldButtonClickTimer ();
+ timer.Enabled = true;
+ }
+ }
+
+ if (thumb_size > 0 && thumb_pos.Contains (e.X, e.Y)) {
+ thumb_pressed = true;
+ this.Capture = true;
+ if (vert) {
+ lastclick_pos_thumb = e.Y - thumb_pos.Y;
+ lastclick_pos = e.Y;
+ thumb_pixel_click_move_prev = thumb_pixel_click_move = e.Y;
+ }
+ else {
+ lastclick_pos_thumb = e.X - thumb_pos.X;
+ lastclick_pos = e.X;
+ thumb_pixel_click_move_prev = thumb_pixel_click_move = e.X;
+ }
+ } else {
+ if (thumb_size > 0 && thumb_area.Contains (e.X, e.Y)) {
+
+ if (vert) {
+ lastclick_pos_thumb = e.Y - thumb_pos.Y;
+ lastclick_pos = e.Y;
+
+ if (e.Y > thumb_pos.Y + thumb_pos.Height) {
+ LargeIncrement ();
+ thumb_moving = ThumbMoving.Forward;
+ Dirty (new Rectangle (0, thumb_pos.Y + thumb_pos.Height,
+ ClientRectangle.Width,
+ ClientRectangle.Height - (thumb_pos.Y + thumb_pos.Height) -
+ scrollbutton_height));
+ } else {
+ LargeDecrement ();
+ thumb_moving = ThumbMoving.Backwards;
+ Dirty (new Rectangle (0, scrollbutton_height,
+ ClientRectangle.Width,
+ thumb_pos.Y - scrollbutton_height));
+ }
+ } else {
+
+ lastclick_pos_thumb = e.X - thumb_pos.X;
+ lastclick_pos = e.X;
+
+ if (e.X > thumb_pos.X + thumb_pos.Width) {
+ thumb_moving = ThumbMoving.Forward;
+ LargeIncrement ();
+ Dirty (new Rectangle (thumb_pos.X + thumb_pos.Width, 0,
+ ClientRectangle.Width - (thumb_pos.X + thumb_pos.Width) -
+ scrollbutton_width,
+ ClientRectangle.Height));
+ } else {
+ thumb_moving = ThumbMoving.Backwards;
+ LargeDecrement ();
+ Dirty (new Rectangle (scrollbutton_width, 0,
+ thumb_pos.X - scrollbutton_width,
+ ClientRectangle.Height));
+ }
+ }
+
+ SetHoldThumbAreaTimer ();
+ timer.Enabled = true;
+ InvalidateDirty ();
+ }
+ }
+ }
+
+ private void OnMouseUpSB (object sender, MouseEventArgs e)
+ {
+ ClearDirty ();
+
+ if (e.Button == MouseButtons.Right) {
+ if (MouseUp != null) {
+ MouseUp (this, e);
+ }
+ }
+
+ if (Enabled == false)
+ return;
+
+ timer.Enabled = false;
+ if (thumb_moving != ThumbMoving.None) {
+ DirtyThumbArea ();
+ thumb_moving = ThumbMoving.None;
+ }
+ this.Capture = false;
+
+ if (firstbutton_pressed) {
+ firstbutton_state = ButtonState.Normal;
+ if (first_arrow_area.Contains (e.X, e.Y)) {
+ SmallDecrement ();
+ }
+ firstbutton_pressed = false;
+ Dirty (first_arrow_area);
+ } else if (secondbutton_pressed) {
+ secondbutton_state = ButtonState.Normal;
+ if (second_arrow_area.Contains (e.X, e.Y)) {
+ SmallIncrement ();
+ }
+ Dirty (second_arrow_area);
+ secondbutton_pressed = false;
+ } else if (thumb_pressed == true) {
+ OnScroll (new ScrollEventArgs (ScrollEventType.ThumbPosition, position));
+ OnScroll (new ScrollEventArgs (ScrollEventType.EndScroll, position));
+ thumb_pressed = false;
+ Refresh ();
+ return;
+ }
+
+ InvalidateDirty ();
+ }
+
+ private void OnKeyDownSB (Object o, KeyEventArgs key)
+ {
+ if (Enabled == false)
+ return;
+
+ ClearDirty ();
+
+ switch (key.KeyCode){
+ case Keys.Up:
+ {
+ SmallDecrement ();
+ break;
+ }
+ case Keys.Down:
+ {
+ SmallIncrement ();
+ break;
+ }
+ case Keys.PageUp:
+ {
+ LargeDecrement ();
+ break;
+ }
+ case Keys.PageDown:
+ {
+ LargeIncrement ();
+ break;
+ }
+ case Keys.Home:
+ {
+ SetHomePosition ();
+ break;
+ }
+ case Keys.End:
+ {
+ SetEndPosition ();
+ break;
+ }
+ default:
+ break;
+ }
+
+ InvalidateDirty ();
+ }
+
+ private void SetEndPosition ()
+ {
+ ScrollEventArgs event_args;
+ int pos = Maximum;
+
+ event_args = new ScrollEventArgs (ScrollEventType.Last, pos);
+ OnScroll (event_args);
+ pos = event_args.NewValue;
+
+ event_args = new ScrollEventArgs (ScrollEventType.EndScroll, pos);
+ OnScroll (event_args);
+ pos = event_args.NewValue;
+
+ SetValue (pos);
+ }
+
+ private void SetHomePosition ()
+ {
+ ScrollEventArgs event_args;
+ int pos = Minimum;
+
+ event_args = new ScrollEventArgs (ScrollEventType.First, pos);
+ OnScroll (event_args);
+ pos = event_args.NewValue;
+
+ event_args = new ScrollEventArgs (ScrollEventType.EndScroll, pos);
+ OnScroll (event_args);
+ pos = event_args.NewValue;
+
+ SetValue (pos);
+ }
+
+ private void SmallIncrement ()
+ {
+ ScrollEventArgs event_args;
+ int pos = position + small_change;
+
+ event_args = new ScrollEventArgs (ScrollEventType.SmallIncrement, pos);
+ OnScroll (event_args);
+ pos = event_args.NewValue;
+
+ event_args = new ScrollEventArgs (ScrollEventType.EndScroll, pos);
+ OnScroll (event_args);
+ pos = event_args.NewValue;
+
+ UpdatePos (pos, true);
+ }
+
+ private void SmallDecrement ()
+ {
+ ScrollEventArgs event_args;
+ int pos = position - small_change;
+
+ event_args = new ScrollEventArgs (ScrollEventType.SmallDecrement, pos);
+ OnScroll (event_args);
+ pos = event_args.NewValue;
+
+ event_args = new ScrollEventArgs (ScrollEventType.EndScroll, pos);
+ OnScroll (event_args);
+ pos = event_args.NewValue;
+
+ UpdatePos (pos, true);
+ }
+
+ private void SetHoldButtonClickTimer ()
+ {
+ timer.Enabled = false;
+ timer.Interval = 200;
+ timer_type = TimerType.HoldButton;
+ timer.Enabled = true;
+ }
+
+ private void SetRepeatButtonTimer ()
+ {
+ timer.Enabled = false;
+ timer.Interval = 50;
+ timer_type = TimerType.RepeatButton;
+ timer.Enabled = true;
+ }
+
+ private void SetHoldThumbAreaTimer ()
+ {
+ timer.Enabled = false;
+ timer.Interval = 200;
+ timer_type = TimerType.HoldThumbArea;
+ timer.Enabled = true;
+ }
+
+ private void SetRepeatThumbAreaTimer ()
+ {
+ timer.Enabled = false;
+ timer.Interval = 50;
+ timer_type = TimerType.RepeatThumbArea;
+ timer.Enabled = true;
+ }
+
+ private void UpdatePos (int newPos, bool update_thumbpos)
+ {
+ int pos;
+
+ if (newPos < minimum)
+ pos = minimum;
+ else
+ if (newPos > maximum + 1 - large_change)
+ pos = maximum + 1 - large_change;
+ else
+ pos = newPos;
+
+ // pos can't be less than minimum
+ if (pos < minimum)
+ pos = minimum;
+
+ if (update_thumbpos) {
+ if (vert)
+ UpdateThumbPos (thumb_area.Y + (int)(((float)(pos - minimum)) * pixel_per_pos), false);
+ else
+ UpdateThumbPos (thumb_area.X + (int)(((float)(pos - minimum)) * pixel_per_pos), false);
+ SetValue (pos);
+ }
+ else {
+ position = pos; // Updates directly the value to avoid thumb pos update
+
+ if (ValueChanged != null)
+ ValueChanged (this, EventArgs.Empty);
+ }
+ }
+
+ private void UpdateThumbPos (int pixel, bool update_value)
+ {
+ float new_pos = 0;
+
+ if (vert) {
+ Dirty (thumb_pos);
+ if (pixel < thumb_area.Y)
+ thumb_pos.Y = thumb_area.Y;
+ else
+ if (pixel > thumb_area.Y + thumb_area.Height - thumb_size)
+ thumb_pos.Y = thumb_area.Y + thumb_area.Height - thumb_size;
+ else
+ thumb_pos.Y = pixel;
+
+ thumb_pos.X = 0;
+ thumb_pos.Width = ThemeEngine.Current.ScrollBarButtonSize;
+ thumb_pos.Height = thumb_size;
+ new_pos = (float) (thumb_pos.Y - thumb_area.Y);
+ new_pos = new_pos / pixel_per_pos;
+
+ Dirty (thumb_pos);
+ } else {
+ Dirty (thumb_pos);
+ if (pixel < thumb_area.X)
+ thumb_pos.X = thumb_area.X;
+ else
+ if (pixel > thumb_area.X + thumb_area.Width - thumb_size)
+ thumb_pos.X = thumb_area.X + thumb_area.Width - thumb_size;
+ else
+ thumb_pos.X = pixel;
+
+ thumb_pos.Y = 0;
+ thumb_pos.Width = thumb_size;
+ thumb_pos.Height = ThemeEngine.Current.ScrollBarButtonSize;
+ new_pos = (float) (thumb_pos.X - thumb_area.X);
+ new_pos = new_pos / pixel_per_pos;
+
+ Dirty (thumb_pos);
+ }
+
+ if (update_value)
+ UpdatePos ((int) new_pos + minimum, false);
+ }
+
+ private void SetValue (int value)
+ {
+ if ( value < minimum || value > maximum )
+ throw new ArgumentException(
+ String.Format("'{0}' is not a valid value for 'Value'. 'Value' should be between 'Minimum' and 'Maximum'", value));
+
+ if (position != value){
+ position = value;
+
+ OnValueChanged (EventArgs.Empty);
+ UpdatePos (value, true);
+ }
+ }
+
+ private void ClearDirty ()
+ {
+ dirty = Rectangle.Empty;
+ }
+
+ private void Dirty (Rectangle r)
+ {
+ if (dirty == Rectangle.Empty) {
+ dirty = r;
+ return;
+ }
+ dirty = Rectangle.Union (dirty, r);
+ }
+
+ private void DirtyThumbArea ()
+ {
+ if (thumb_moving == ThumbMoving.Forward) {
+ if (vert) {
+ Dirty (new Rectangle (0, thumb_pos.Y + thumb_pos.Height,
+ ClientRectangle.Width,
+ ClientRectangle.Height - (thumb_pos.Y + thumb_pos.Height) -
+ scrollbutton_height));
+ } else {
+ Dirty (new Rectangle (thumb_pos.X + thumb_pos.Width, 0,
+ ClientRectangle.Width - (thumb_pos.X + thumb_pos.Width) -
+ scrollbutton_width,
+ ClientRectangle.Height));
+ }
+ } else if (thumb_moving == ThumbMoving.Backwards) {
+ if (vert) {
+ Dirty(new Rectangle (0, scrollbutton_height,
+ ClientRectangle.Width,
+ thumb_pos.Y - scrollbutton_height));
+ } else {
+ Dirty (new Rectangle (scrollbutton_width, 0,
+ thumb_pos.X - scrollbutton_width,
+ ClientRectangle.Height));
+ }
+ }
+ }
+
+ private void InvalidateDirty ()
+ {
+ Invalidate (dirty);
+ dirty = Rectangle.Empty;
+ }
+
+ #endregion //Private Methods
+ }
+}
+
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollBars.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollBars.cs
new file mode 100644
index 00000000000..0488122b44b
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollBars.cs
@@ -0,0 +1,36 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public enum ScrollBars {
+ None = 0,
+ Horizontal = 1,
+ Vertical = 2,
+ Both = 3
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollButton.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollButton.cs
new file mode 100644
index 00000000000..f58dc9f8e49
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollButton.cs
@@ -0,0 +1,39 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public enum ScrollButton {
+ Min = 0,
+ Up = 0,
+ Down = 1,
+ Left = 2,
+ Right = 3,
+ Max = 3
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollEventArgs.cs
new file mode 100644
index 00000000000..12ecbafdf78
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollEventArgs.cs
@@ -0,0 +1,64 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [ComVisible(true)]
+ public class ScrollEventArgs : EventArgs {
+ #region Local Variables
+ private ScrollEventType type;
+ private int new_value;
+ #endregion
+
+ #region Public Constructors
+ public ScrollEventArgs(ScrollEventType type, int newValue) {
+ this.type = type;
+ this.new_value = newValue;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public int NewValue {
+ get {
+ return new_value;
+ }
+
+ set {
+ new_value = value;
+ }
+ }
+
+ public ScrollEventType Type {
+ get {
+ return type;
+ }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollEventHandler.cs
new file mode 100644
index 00000000000..7d9483d512d
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollEventHandler.cs
@@ -0,0 +1,31 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public delegate void ScrollEventHandler(object sender, ScrollEventArgs e);
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollEventType.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollEventType.cs
new file mode 100644
index 00000000000..b3f8c4a222c
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollEventType.cs
@@ -0,0 +1,44 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [ComVisible(true)]
+ public enum ScrollEventType {
+ SmallDecrement = 0,
+ SmallIncrement = 1,
+ LargeDecrement = 2,
+ LargeIncrement = 3,
+ ThumbPosition = 4,
+ ThumbTrack = 5,
+ First = 6,
+ Last = 7,
+ EndScroll = 8
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollableControl.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollableControl.cs
new file mode 100644
index 00000000000..a99be9c9d4a
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollableControl.cs
@@ -0,0 +1,659 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// NOT COMPLETE
+
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+ [Designer ("System.Windows.Forms.Design.ScrollableControlDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+ public class ScrollableControl : Control {
+ #region Local Variables
+ private bool auto_vscroll;
+ private bool auto_hscroll;
+ private bool hscroll_visible;
+ private bool vscroll_visible;
+ private bool force_hscroll_visible;
+ private bool force_vscroll_visible;
+ private bool auto_scroll;
+ private Size auto_scroll_margin;
+ private Size auto_scroll_min_size;
+ private Point scroll_position;
+ private DockPaddingEdges dock_padding;
+ private SizeGrip sizegrip;
+ private HScrollBar hscrollbar;
+ private VScrollBar vscrollbar;
+ #endregion // Local Variables
+
+ [MonoTODO("Need to use the edge values when performing the layout")]
+ [TypeConverter(typeof(ScrollableControl.DockPaddingEdgesConverter))]
+ #region Subclass DockPaddingEdges
+ public class DockPaddingEdges : ICloneable {
+ #region DockPaddingEdges Local Variables
+ private int all;
+ private int left;
+ private int right;
+ private int top;
+ private int bottom;
+ private Control owner;
+ #endregion // DockPaddingEdges Local Variables
+
+ #region DockPaddingEdges Constructor
+ internal DockPaddingEdges(Control owner) {
+ all = 0;
+ left = 0;
+ right = 0;
+ top = 0;
+ bottom = 0;
+ this.owner = owner;
+ }
+ #endregion // DockPaddingEdges Constructor
+
+ #region DockPaddingEdges Public Instance Properties
+ [RefreshProperties(RefreshProperties.All)]
+ public int All {
+ get {
+ return all;
+ }
+
+ set {
+ all = value;
+ left = value;
+ right = value;
+ top = value;
+ bottom = value;
+
+ owner.PerformLayout();
+ }
+ }
+
+ [RefreshProperties(RefreshProperties.All)]
+ public int Bottom {
+ get {
+ return bottom;
+ }
+
+ set {
+ bottom = value;
+ all = 0;
+
+ owner.PerformLayout();
+ }
+ }
+
+ [RefreshProperties(RefreshProperties.All)]
+ public int Left {
+ get {
+ return left;
+ }
+
+ set {
+ left=value;
+ all = 0;
+
+ owner.PerformLayout();
+ }
+ }
+
+ [RefreshProperties(RefreshProperties.All)]
+ public int Right {
+ get {
+ return right;
+ }
+
+ set {
+ right=value;
+ all = 0;
+
+ owner.PerformLayout();
+ }
+ }
+
+ [RefreshProperties(RefreshProperties.All)]
+ public int Top {
+ get {
+ return top;
+ }
+
+ set {
+ top=value;
+ all = 0;
+
+ owner.PerformLayout();
+ }
+ }
+
+ #endregion // DockPaddingEdges Public Instance Properties
+
+ // Public Instance Methods
+ public override bool Equals(object other) {
+ if (! (other is DockPaddingEdges)) {
+ return false;
+ }
+
+ if ( (this.all == ((DockPaddingEdges)other).all) && (this.left == ((DockPaddingEdges)other).left) &&
+ (this.right == ((DockPaddingEdges)other).right) && (this.top == ((DockPaddingEdges)other).top) &&
+ (this.bottom == ((DockPaddingEdges)other).bottom)) {
+ return true;
+ }
+
+ return false;
+ }
+
+ public override int GetHashCode() {
+ return all*top*bottom*right*left;
+ }
+
+ public override string ToString() {
+ return "All = "+all.ToString()+" Top = "+top.ToString()+" Left = "+left.ToString()+" Bottom = "+bottom.ToString()+" Right = "+right.ToString();
+ }
+
+ object ICloneable.Clone() {
+ DockPaddingEdges padding_edge;
+
+ padding_edge=new DockPaddingEdges(owner);
+
+ padding_edge.all=all;
+ padding_edge.left=left;
+ padding_edge.right=right;
+ padding_edge.top=top;
+ padding_edge.bottom=bottom;
+
+ return padding_edge;
+ }
+ }
+ #endregion // Subclass DockPaddingEdges
+
+ #region Subclass DockPaddingEdgesConverter
+ public class DockPaddingEdgesConverter : System.ComponentModel.TypeConverter {
+ // Public Constructors
+ public DockPaddingEdgesConverter() {
+ }
+
+ // Public Instance Methods
+ public override PropertyDescriptorCollection GetProperties(System.ComponentModel.ITypeDescriptorContext context, object value, Attribute[] attributes) {
+ return TypeDescriptor.GetProperties(typeof(DockPaddingEdges), attributes);
+ }
+
+ public override bool GetPropertiesSupported(System.ComponentModel.ITypeDescriptorContext context) {
+ return true;
+ }
+ }
+ #endregion // Subclass DockPaddingEdgesConverter
+
+ #region Public Constructors
+ public ScrollableControl() {
+ SetStyle(ControlStyles.ContainerControl, true);
+ SetStyle(ControlStyles.AllPaintingInWmPaint, false);
+ auto_scroll = false;
+ auto_hscroll = false;
+ auto_vscroll = false;
+ hscroll_visible = false;
+ vscroll_visible = false;
+ force_hscroll_visible = false;
+ force_vscroll_visible = false;
+ auto_scroll_margin = new Size(0, 0);
+ auto_scroll_min_size = new Size(0, 0);
+ scroll_position = new Point(0, 0);
+ dock_padding = new DockPaddingEdges(this);
+ SizeChanged +=new EventHandler(Recalculate);
+ VisibleChanged += new EventHandler(Recalculate);
+ }
+ #endregion // Public Constructors
+
+ #region Protected Static Fields
+ protected const int ScrollStateAutoScrolling = 1;
+ protected const int ScrollStateFullDrag = 16;
+ protected const int ScrollStateHScrollVisible = 2;
+ protected const int ScrollStateUserHasScrolled = 8;
+ protected const int ScrollStateVScrollVisible = 4;
+ #endregion // Protected Static Fields
+
+ #region Public Instance Properties
+ [DefaultValue(false)]
+ [Localizable(true)]
+ public virtual bool AutoScroll {
+ get {
+ return auto_scroll;
+ }
+
+ set {
+ if (auto_scroll == value) {
+ return;
+ }
+
+ auto_scroll = value;
+ if (!auto_scroll) {
+ SuspendLayout ();
+
+ Controls.RemoveImplicit (hscrollbar);
+ hscrollbar.Dispose();
+ hscrollbar = null;
+ hscroll_visible = false;
+
+ Controls.RemoveImplicit (vscrollbar);
+ vscrollbar.Dispose();
+ vscrollbar = null;
+ vscroll_visible = false;
+
+ Controls.RemoveImplicit (sizegrip);
+ sizegrip.Dispose();
+ sizegrip = null;
+
+ ResumeLayout ();
+ } else {
+ SuspendLayout ();
+
+ hscrollbar = new HScrollBar();
+ hscrollbar.Visible = false;
+ hscrollbar.ValueChanged += new EventHandler(HandleScrollBar);
+ hscrollbar.Height = SystemInformation.HorizontalScrollBarHeight;
+ this.Controls.AddImplicit (hscrollbar);
+
+ vscrollbar = new VScrollBar();
+ vscrollbar.Visible = false;
+ vscrollbar.ValueChanged += new EventHandler(HandleScrollBar);
+ vscrollbar.Width = SystemInformation.VerticalScrollBarWidth;
+ this.Controls.AddImplicit (vscrollbar);
+
+ sizegrip = new SizeGrip();
+ sizegrip.Visible = false;
+ this.Controls.AddImplicit (sizegrip);
+
+ ResumeLayout ();
+ }
+ }
+ }
+
+ [Localizable(true)]
+ public Size AutoScrollMargin {
+ get {
+ return auto_scroll_margin;
+ }
+
+ set {
+ if (value.Width < 0) {
+ throw new ArgumentException("Width is assigned less than 0", "value.Width");
+ }
+
+ if (value.Height < 0) {
+ throw new ArgumentException("Height is assigned less than 0", "value.Height");
+ }
+
+ auto_scroll_margin = value;
+ }
+ }
+
+ [Localizable(true)]
+ public Size AutoScrollMinSize {
+ get {
+ return auto_scroll_min_size;
+ }
+
+ set {
+ auto_scroll_min_size = value;
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public Point AutoScrollPosition {
+ get {
+ return new Point(-scroll_position.X, -scroll_position.Y);
+ }
+
+ set {
+ if ((value.X != scroll_position.X) || (value.Y != scroll_position.Y)) {
+ int shift_x;
+ int shift_y;
+
+ shift_x = 0;
+ shift_y = 0;
+ if (hscroll_visible) {
+ shift_x = value.X - scroll_position.X;
+ }
+
+ if (vscroll_visible) {
+ shift_y = value.Y - scroll_position.Y;
+ }
+
+ ScrollWindow(shift_x, shift_y);
+
+ if (hscroll_visible) {
+ hscrollbar.Value = scroll_position.X;
+ }
+
+ if (vscroll_visible) {
+ vscrollbar.Value = scroll_position.Y;
+ }
+
+ }
+ }
+ }
+
+ public override Rectangle DisplayRectangle {
+ get {
+ Rectangle rect;
+
+ rect = base.DisplayRectangle;
+ if (vscroll_visible) {
+ rect.Width -= vscrollbar.Width;
+ if (rect.Width < 0) {
+ rect.Width = 0;
+ }
+ }
+
+ if (hscroll_visible) {
+ rect.Height -= hscrollbar.Height;
+ if (rect.Height < 0) {
+ rect.Height = 0;
+ }
+ }
+
+ rect.X += dock_padding.Left;
+ rect.Y += dock_padding.Top;
+
+ rect.Width -= dock_padding.Right + dock_padding.Left;
+ rect.Height -= dock_padding.Bottom + dock_padding.Top;
+
+ return rect;
+ //return new Rectangle(-scroll_position.X, -scroll_position.Y, auto_scroll_min_size.Width, auto_scroll_min_size.Height);
+ }
+ }
+
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
+ [Localizable(true)]
+ public DockPaddingEdges DockPadding {
+ get {
+ return dock_padding;
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Protected Instance Methods
+ protected override CreateParams CreateParams {
+ get {
+ return base.CreateParams;
+ }
+ }
+
+ protected bool HScroll {
+ get {
+ return hscroll_visible;
+ }
+
+ set {
+ if (hscroll_visible != value) {
+ force_hscroll_visible = value;
+ Recalculate(this, EventArgs.Empty);
+ }
+ }
+ }
+
+ protected bool VScroll {
+ get {
+ return vscroll_visible;
+ }
+
+ set {
+ if (vscroll_visible != value) {
+ force_vscroll_visible = value;
+ Recalculate(this, EventArgs.Empty);
+ }
+ }
+ }
+ #endregion // Protected Instance Methods
+
+ #region Public Instance Methods
+ public void ScrollControlIntoView(Control activeControl) {
+ }
+
+ public void SetAutoScrollMargin(int x, int y) {
+ if (x < 0) {
+ x = 0;
+ }
+
+ if (y < 0) {
+ y = 0;
+ }
+
+ auto_scroll_margin = new Size(x, y);
+ Recalculate(this, EventArgs.Empty);
+ }
+ #endregion // Public Instance Methods
+
+ #region Protected Instance Methods
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void AdjustFormScrollbars(bool displayScrollbars) {
+ // Internal MS
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected bool GetScrollState(int bit) {
+ return false;
+ // Internal MS
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected override void OnLayout(LayoutEventArgs levent) {
+ base.OnLayout(levent);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected override void OnMouseWheel(MouseEventArgs e) {
+ if (vscroll_visible) {
+ if (e.Delta > 0) {
+ if (vscrollbar.Minimum < (vscrollbar.Value - vscrollbar.LargeChange)) {
+ vscrollbar.Value -= vscrollbar.LargeChange;
+ } else {
+ vscrollbar.Value = vscrollbar.Minimum;
+ }
+ } else {
+ if (vscrollbar.Maximum > (vscrollbar.Value + vscrollbar.LargeChange)) {
+ vscrollbar.Value += vscrollbar.LargeChange;
+ } else {
+ vscrollbar.Value = vscrollbar.Maximum;
+ }
+ }
+ }
+ base.OnMouseWheel(e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected override void OnVisibleChanged(EventArgs e) {
+ base.OnVisibleChanged(e);
+ }
+
+ protected override void ScaleCore(float dx, float dy) {
+ base.ScaleCore(dx, dy);
+ }
+
+ protected void SetDisplayRectLocation(int x, int y) {
+ throw new NotImplementedException();
+ }
+
+ protected void SetScrollState(int bit, bool value) {
+ throw new NotImplementedException();
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected override void WndProc(ref Message m) {
+ base.WndProc(ref m);
+ }
+ #endregion // Protected Instance Methods
+
+ #region Internal & Private Methods
+ private Size Canvas {
+ get {
+ int num_of_children;
+ int width;
+ int height;
+
+ num_of_children = child_controls.Count;
+ width = 0;
+ height = 0;
+
+ for (int i = 0; i < num_of_children; i++) {
+ if ((child_controls[i].Visible == false) || (child_controls[i] == hscrollbar) || (child_controls[i] == vscrollbar) || (child_controls[i] == sizegrip)) {
+ continue;
+ }
+ if (child_controls[i].Right > width) {
+ width = child_controls[i].Right;
+ }
+
+ if (child_controls[i].Bottom > height) {
+ height = child_controls[i].Bottom;
+ }
+ }
+
+ return new Size(width, height);
+ }
+ }
+
+ private void Recalculate(object sender, EventArgs e) {
+ Size canvas;
+ Size client;
+
+ // FIXME - this whole function begs for optimizations, all the math
+ // shouldn't have to be done over and over
+
+ // Check if we need scrollbars
+ if (!this.auto_scroll && !force_hscroll_visible && !force_vscroll_visible) {
+ return;
+ }
+
+ canvas = Canvas;
+ client = ClientRectangle.Size;
+
+ canvas.Width += auto_scroll_margin.Width;
+ canvas.Height += auto_scroll_margin.Height;
+
+ // || (scroll_position.X == 0 && scroll_position.Y == 0)
+
+ if ((canvas.Width > client.Width) || // Regular decision
+ ((canvas.Height > client.Height) && ((canvas.Width + SystemInformation.HorizontalScrollBarHeight) > client.Width)) ||
+ (auto_scroll_min_size.Width > client.Width) ||
+ force_hscroll_visible) {
+ // Need horz
+
+ hscrollbar.Left = 0;
+ hscrollbar.Top = client.Height - SystemInformation.HorizontalScrollBarHeight;
+ hscrollbar.LargeChange = DisplayRectangle.Width;
+ hscrollbar.SmallChange = DisplayRectangle.Width / 10;
+ hscrollbar.Maximum = canvas.Width - 1;
+
+ hscroll_visible = true;
+ } else {
+ hscroll_visible = false;
+ scroll_position.X = 0;
+ }
+
+ if ((canvas.Height > client.Height) ||
+ ((canvas.Width > client.Width) && ((canvas.Height + SystemInformation.VerticalScrollBarWidth) > client.Height)) ||
+ (auto_scroll_min_size.Height > client.Height) ||
+ force_vscroll_visible) {
+ // Need vert
+ vscrollbar.Left = client.Width - SystemInformation.VerticalScrollBarWidth;
+ vscrollbar.Top = 0;
+
+ // FIXME - Working around some scrollbar bugs here; shouldn't have to add the height again (see canvas+= above)
+ vscrollbar.LargeChange = DisplayRectangle.Height;
+ vscrollbar.SmallChange = DisplayRectangle.Height / 10;
+ vscrollbar.Maximum = canvas.Height - 1;
+ vscroll_visible = true;
+ } else {
+ vscroll_visible = false;
+ scroll_position.Y = 0;
+ }
+
+ if (hscroll_visible && vscroll_visible) {
+ hscrollbar.Width = ClientRectangle.Width - SystemInformation.VerticalScrollBarWidth;
+ vscrollbar.Height = ClientRectangle.Height - SystemInformation.HorizontalScrollBarHeight;
+
+ sizegrip.Left = hscrollbar.Right;
+ sizegrip.Top = vscrollbar.Bottom;
+ sizegrip.Width = SystemInformation.VerticalScrollBarWidth;
+ sizegrip.Height = SystemInformation.HorizontalScrollBarHeight;
+
+ hscrollbar.Visible = true;
+ vscrollbar.Visible = true;
+ sizegrip.Visible = true;
+ } else {
+ sizegrip.Visible = false;
+ if (hscroll_visible) {
+ hscrollbar.Width = ClientRectangle.Width;
+ hscrollbar.Visible = true;
+ } else {
+ hscrollbar.Visible = false;
+ }
+
+ if (vscroll_visible) {
+ vscrollbar.Height = ClientRectangle.Height;
+ vscrollbar.Visible = true;
+ } else {
+ vscrollbar.Visible = false;
+ }
+ }
+ }
+
+ private void HandleScrollBar(object sender, EventArgs e) {
+ if (sender == vscrollbar) {
+ ScrollWindow(0, vscrollbar.Value- scroll_position.Y);
+ } else {
+ ScrollWindow(hscrollbar.Value - scroll_position.X, 0);
+ }
+ }
+
+ private void ScrollWindow(int XOffset, int YOffset) {
+ int num_of_children;
+
+ SuspendLayout();
+
+ num_of_children = child_controls.Count;
+
+ for (int i = 0; i < num_of_children; i++) {
+ if (child_controls[i] == hscrollbar || child_controls[i] == vscrollbar || child_controls[i] == sizegrip) {
+ continue;
+ }
+ child_controls[i].Left -= XOffset;
+ child_controls[i].Top -= YOffset;
+ // Is this faster? child_controls[i].Location -= new Size(XOffset, YOffset);
+ }
+
+ scroll_position.X += XOffset;
+ scroll_position.Y += YOffset;
+
+ // Should we call XplatUI.ScrollWindow???
+ Invalidate();
+ ResumeLayout();
+ }
+ #endregion // Internal & Private Methods
+
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SecurityIDType.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SecurityIDType.cs
new file mode 100644
index 00000000000..ba8ade5edba
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SecurityIDType.cs
@@ -0,0 +1,41 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public enum SecurityIDType {
+ User = 1,
+ Group = 2,
+ Domain = 3,
+ Alias = 4,
+ WellKnownGroup = 5,
+ DeletedAccount = 6,
+ Invalid = 7,
+ Unknown = 8,
+ Computer = 9
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SelectedGridItemChangedEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SelectedGridItemChangedEventArgs.cs
new file mode 100644
index 00000000000..95f632cb55e
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SelectedGridItemChangedEventArgs.cs
@@ -0,0 +1,65 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jonathan Chambers (jonathan.chambers@ansys.com)
+//
+
+// COMPLETE
+
+using System;
+using System.Windows.Forms.Design;
+
+namespace System.Windows.Forms
+{
+ public class SelectedGridItemChangedEventArgs : EventArgs
+ {
+ #region Local Variables
+ private GridItem new_selection;
+ private GridItem old_selection;
+ #endregion
+
+ #region Constructors
+ public SelectedGridItemChangedEventArgs ( GridItem oldSel , GridItem newSel )
+ {
+ old_selection = oldSel;
+ new_selection = newSel;
+ }
+ #endregion // Constructors
+
+ #region Public Instance Properties
+ public GridItem NewSelection
+ {
+ get {
+ return new_selection;
+ }
+ }
+
+ public GridItem OldSelection
+ {
+ get {
+ return old_selection;
+ }
+ }
+ #endregion // Public Instance Properties
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SelectedGridItemChangedEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SelectedGridItemChangedEventHandler.cs
new file mode 100644
index 00000000000..1a1a7db7191
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SelectedGridItemChangedEventHandler.cs
@@ -0,0 +1,32 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jonathan Chambers (jonathan.chambers@ansys.com)
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms
+{
+ [Serializable]
+ public delegate void SelectedGridItemChangedEventHandler(object sender, SelectedGridItemChangedEventArgs e);
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SelectionMode.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SelectionMode.cs
new file mode 100644
index 00000000000..2dad4a22c19
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SelectionMode.cs
@@ -0,0 +1,43 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+
+//COMPLETE
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms
+{
+ [Serializable]
+ [ComVisible(true)]
+ public enum SelectionMode
+ {
+ None = 0,
+ One = 1,
+ MultiSimple = 2,
+ MultiExtended = 3,
+
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SelectionRange.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SelectionRange.cs
new file mode 100644
index 00000000000..92c152f20de
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SelectionRange.cs
@@ -0,0 +1,100 @@
+//
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// John BouAntoun jba-mono@optusnet.com.au
+//
+
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+ [TypeConverter(typeof(SelectionRangeConverter))]
+ public sealed class SelectionRange {
+ #region local members
+
+ DateTime end;
+ DateTime start;
+
+ #endregion // local members
+
+ #region public constructors
+
+ // default parameterless construcor, use default values
+ public SelectionRange () {
+ }
+
+ // constructor that receives another range, copies it's Start and End values
+ public SelectionRange (SelectionRange selectionRange) {
+ end = selectionRange.End;
+ start = selectionRange.Start;
+ }
+
+ // constructor that receives two dates, uses the lower of the two as start
+ public SelectionRange (DateTime lower, DateTime upper) {
+ if (lower <= upper) {
+ end = upper;
+ start = lower;
+ } else {
+ end = lower;
+ start = upper;
+ }
+ }
+
+ #endregion // public constructors
+
+ #region public properties
+
+ // end date of this range
+ public DateTime End {
+ set {
+ if (end != value) {
+ end = value;
+ }
+ }
+ get {
+ return end;
+ }
+ }
+
+ // start date of this range
+ public DateTime Start {
+ set {
+ if (start != value) {
+ start = value;
+ }
+ }
+ get {
+ return start;
+ }
+ }
+
+ #endregion // public properties
+
+ #region public methods
+
+ public override string ToString() {
+ return "SelectionRange: Start: " + Start.ToString() + ", End: " + End.ToString();
+ }
+
+ #endregion // public methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SelectionRangeConverter.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SelectionRangeConverter.cs
new file mode 100644
index 00000000000..eb293b88ddc
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SelectionRangeConverter.cs
@@ -0,0 +1,109 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+using System.ComponentModel;
+using System.Globalization;
+
+namespace System.Windows.Forms {
+ public class SelectionRangeConverter : TypeConverter {
+ #region Public Constructors
+ public SelectionRangeConverter() {
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Methods
+ public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) {
+ if (sourceType == typeof(string)) {
+ return true;
+ }
+ return false;
+ }
+
+ public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) {
+ if (destinationType == typeof(string)) {
+ return true;
+ }
+ return false;
+ }
+
+ public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) {
+ string[] parts;
+ DateTime start;
+ DateTime end;
+
+ if ((value == null) || !(value is String)) {
+ return base.ConvertFrom (context, culture, value);
+ }
+
+ if (culture == null) {
+ culture = CultureInfo.CurrentCulture;
+ }
+
+ parts = ((string)value).Split(culture.TextInfo.ListSeparator.ToCharArray());
+
+ start = (DateTime)TypeDescriptor.GetConverter(typeof(DateTime)).ConvertFromString(context, culture, parts[0]);
+ end = (DateTime)TypeDescriptor.GetConverter(typeof(DateTime)).ConvertFromString(context, culture, parts[1]);
+
+ return new SelectionRange(start, end);
+ }
+
+ public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) {
+ SelectionRange s;
+
+ if ((value == null) || !(value is SelectionRange) || (destinationType != typeof(string))) {
+ return base.ConvertTo (context, culture, value, destinationType);
+ }
+
+ if (culture == null) {
+ culture = CultureInfo.CurrentCulture;
+ }
+
+ s = (SelectionRange)value;
+
+
+ return s.Start.ToShortDateString() + culture.TextInfo.ListSeparator + s.End.ToShortDateString();
+ }
+
+ public override object CreateInstance(ITypeDescriptorContext context, System.Collections.IDictionary propertyValues) {
+ return new SelectionRange((DateTime)propertyValues["Start"], (DateTime)propertyValues["End"]);
+ }
+
+ public override bool GetCreateInstanceSupported(ITypeDescriptorContext context) {
+ return true;
+ }
+
+ public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes) {
+ return TypeDescriptor.GetProperties(typeof(SelectionRange), attributes);
+ }
+
+ public override bool GetPropertiesSupported(ITypeDescriptorContext context) {
+ return true;
+ }
+ #endregion // Public Instance Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SendKeys.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SendKeys.cs
new file mode 100644
index 00000000000..1b8837b32f9
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SendKeys.cs
@@ -0,0 +1,199 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// NOT COMPLETE
+
+using System.Collections;
+
+namespace System.Windows.Forms {
+ public class SendKeys {
+ #region Local variables
+ private static Queue keys = new Queue();
+ #endregion
+
+ #region Private methods
+ private SendKeys() {
+ }
+
+ private static IntPtr CharToVKey(char key) {
+ // FIXME - build a table to translate between vkeys and chars
+ throw new NotImplementedException();
+ }
+
+ private static IntPtr SymbolToVKey(string symbol) {
+ // FIXME - build a table to translate between vkeys and symbols
+ throw new NotImplementedException();
+ }
+
+ private static void SendSymbol(IntPtr hwnd, string symbol, int repeat_count, bool down) {
+ MSG msg;
+
+ if (down) {
+ for (int i = 0; i < repeat_count; i++ ) {
+ msg = new MSG();
+ msg.hwnd = hwnd;
+ msg.message = Msg.WM_KEYDOWN;
+ msg.wParam = SymbolToVKey(symbol);
+ msg.lParam = IntPtr.Zero;
+
+ keys.Enqueue(msg);
+ }
+ } else {
+ msg = new MSG();
+ msg.hwnd = hwnd;
+ msg.message = Msg.WM_KEYUP;
+ msg.wParam = SymbolToVKey(symbol);
+ msg.lParam = IntPtr.Zero;
+
+ keys.Enqueue(msg);
+ }
+ }
+
+ private static void SendKey(IntPtr hwnd, char key, int repeat_count) {
+ MSG msg;
+
+ for (int i = 0; i < repeat_count; i++ ) {
+ msg = new MSG();
+ msg.hwnd = hwnd;
+ msg.message = Msg.WM_KEYDOWN;
+ msg.wParam = CharToVKey(key);
+ msg.lParam = IntPtr.Zero;
+
+ keys.Enqueue(msg);
+ }
+
+ msg = new MSG();
+ msg.hwnd = hwnd;
+ msg.message = Msg.WM_KEYUP;
+ msg.wParam = CharToVKey(key);
+ msg.lParam = IntPtr.Zero;
+
+ keys.Enqueue(msg);
+ }
+
+ #endregion // Private Methods
+
+ #region Public Static Methods
+ public static void Flush() {
+ MSG msg;
+
+ // FIXME - we only send to our own app, instead of the active app
+ while (keys.Count > 0) {
+ msg = (MSG)keys.Dequeue();
+ XplatUI.TranslateMessage (ref msg);
+ XplatUI.DispatchMessage (ref msg);
+ }
+ }
+
+ [MonoTODO("Finish")]
+ public static void Send(string key_string) {
+ IntPtr hwnd;
+ int shift_reset;
+ int control_reset;
+ int alt_reset;
+
+ hwnd = XplatUI.GetActive();
+
+ shift_reset = 0;
+ control_reset = 0;
+ alt_reset = 0;
+
+ for (int i = 0; i < key_string.Length; i++) {
+ switch(key_string[i]) {
+ case '+': {
+ SendSymbol(hwnd, "SHIFT", 1, true);
+ shift_reset = 2;
+ break;
+ }
+
+ case '^': {
+ SendSymbol(hwnd, "CONTROL", 1, true);
+ control_reset = 2;
+ break;
+ }
+
+ case '%': {
+ SendSymbol(hwnd, "ALT", 1, true);
+ alt_reset = 2;
+ break;
+ }
+
+ case '~': {
+ SendSymbol(hwnd, "ENTER", 1, true);
+ SendSymbol(hwnd, "ENTER", 1, false);
+ break;
+ }
+
+ case '(':
+ case ')': {
+ // FIXME - implement group parser
+ break;
+ }
+
+ case '{':
+ case '}': {
+ // FIXME - implement symbol parser
+ break;
+ }
+
+ default: {
+ SendKey(hwnd, key_string[i], 1);
+ break;
+ }
+ }
+
+
+
+ if (shift_reset > 0) {
+ shift_reset--;
+ if (shift_reset == 0) {
+ SendSymbol(hwnd, "SHIFT", 1, false);
+ }
+ }
+
+ if (control_reset > 0) {
+ control_reset--;
+ if (control_reset == 0) {
+ SendSymbol(hwnd, "CONTROL", 1, false);
+ }
+ }
+
+ if (alt_reset > 0) {
+ alt_reset--;
+ if (alt_reset == 0) {
+ SendSymbol(hwnd, "ALT", 1, false);
+ }
+ }
+ }
+ }
+
+ public static void SendWait(string keys) {
+ Send(keys);
+ Flush();
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Shortcut.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Shortcut.cs
new file mode 100644
index 00000000000..ca6b72ed8b0
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Shortcut.cs
@@ -0,0 +1,187 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms
+{
+ [ComVisible (true)]
+ public enum Shortcut
+ {
+ Alt0 = 0x040030,
+ Alt1 = 0x040031,
+ Alt2 = 0x040032,
+ Alt3 = 0x040033,
+ Alt4 = 0x040034,
+ Alt5 = 0x040035,
+ Alt6 = 0x040036,
+ Alt7 = 0x040037,
+ Alt8 = 0x040038,
+ Alt9 = 0x040039,
+ AltBksp = 0x040008,
+ AltF1 = 0x040070,
+ AltF10 = 0x040079,
+ AltF11 = 0x04007A,
+ AltF12 = 0x04007B,
+ AltF2 = 0x040071,
+ AltF3 = 0x040072,
+ AltF4 = 0x040073,
+ AltF5 = 0x040074,
+ AltF6 = 0x040075,
+ AltF7 = 0x040076,
+ AltF8 = 0x040077,
+ AltF9 = 0x040078,
+ Ctrl0 = 0x020030,
+ Ctrl1 = 0x020031,
+ Ctrl2 = 0x020032,
+ Ctrl3 = 0x020033,
+ Ctrl4 = 0x020034,
+ Ctrl5 = 0x020035,
+ Ctrl6 = 0x020036,
+ Ctrl7 = 0x020037,
+ Ctrl8 = 0x020038,
+ Ctrl9 = 0x020039,
+ CtrlA = 0x020041,
+ CtrlB = 0x020042,
+ CtrlC = 0x020043,
+ CtrlD = 0x020044,
+ CtrlDel = 0x02002E,
+ CtrlE = 0x020045,
+ CtrlF = 0x020046,
+ CtrlF1 = 0x020070,
+ CtrlF10 = 0x020079,
+ CtrlF11 = 0x02007A,
+ CtrlF12 = 0x02007B,
+ CtrlF2 = 0x020071,
+ CtrlF3 = 0x020072,
+ CtrlF4 = 0x020073,
+ CtrlF5 = 0x020074,
+ CtrlF6 = 0x020075,
+ CtrlF7 = 0x020076,
+ CtrlF8 = 0x020077,
+ CtrlF9 = 0x020078,
+ CtrlG = 0x020047,
+ CtrlH = 0x020048,
+ CtrlI = 0x020049,
+ CtrlIns = 0x02002D,
+ CtrlJ = 0x02004A,
+ CtrlK = 0x02004B,
+ CtrlL = 0x02004C,
+ CtrlM = 0x02004D,
+ CtrlN = 0x02004E,
+ CtrlO = 0x02004F,
+ CtrlP = 0x020050,
+ CtrlQ = 0x020051,
+ CtrlR = 0x020052,
+ CtrlS = 0x020053,
+ CtrlShift0 = 0x030030,
+ CtrlShift1 = 0x030031,
+ CtrlShift2 = 0x030032,
+ CtrlShift3 = 0x030033,
+ CtrlShift4 = 0x030034,
+ CtrlShift5 = 0x030035,
+ CtrlShift6 = 0x030036,
+ CtrlShift7 = 0x030037,
+ CtrlShift8 = 0x030038,
+ CtrlShift9 = 0x030039,
+ CtrlShiftA = 0x030041,
+ CtrlShiftB = 0x030042,
+ CtrlShiftC = 0x030043,
+ CtrlShiftD = 0x030044,
+ CtrlShiftE = 0x030045,
+ CtrlShiftF = 0x030046,
+ CtrlShiftF1 = 0x030070,
+ CtrlShiftF10 = 0x030079,
+ CtrlShiftF11 = 0x03007A,
+ CtrlShiftF12 = 0x03007B,
+ CtrlShiftF2 = 0x030071,
+ CtrlShiftF3 = 0x030072,
+ CtrlShiftF4 = 0x030073,
+ CtrlShiftF5 = 0x030074,
+ CtrlShiftF6 = 0x030075,
+ CtrlShiftF7 = 0x030076,
+ CtrlShiftF8 = 0x030077,
+ CtrlShiftF9 = 0x030078,
+ CtrlShiftG = 0x030047,
+ CtrlShiftH = 0x030048,
+ CtrlShiftI = 0x030049,
+ CtrlShiftJ = 0x03004A,
+ CtrlShiftK = 0x03004B,
+ CtrlShiftL = 0x03004C,
+ CtrlShiftM = 0x03004D,
+ CtrlShiftN = 0x03004E,
+ CtrlShiftO = 0x03004F,
+ CtrlShiftP = 0x030050,
+ CtrlShiftQ = 0x030051,
+ CtrlShiftR = 0x030052,
+ CtrlShiftS = 0x030053,
+ CtrlShiftT = 0x030054,
+ CtrlShiftU = 0x030055,
+ CtrlShiftV = 0x030056,
+ CtrlShiftW = 0x030057,
+ CtrlShiftX = 0x030058,
+ CtrlShiftY = 0x030059,
+ CtrlShiftZ = 0x03005A,
+ CtrlT = 0x020054,
+ CtrlU = 0x020055,
+ CtrlV = 0x020056,
+ CtrlW = 0x020057,
+ CtrlX = 0x020058,
+ CtrlY = 0x020059,
+ CtrlZ = 0x02005A,
+ Del = 0x00002E,
+ F1 = 0x000070,
+ F10 = 0x000079,
+ F11 = 0x00007A,
+ F12 = 0x00007B,
+ F2 = 0x000071,
+ F3 = 0x000072,
+ F4 = 0x000073,
+ F5 = 0x000074,
+ F6 = 0x000075,
+ F7 = 0x000076,
+ F8 = 0x000077,
+ F9 = 0x000078,
+ Ins = 0x00002D,
+ None = 0x000000,
+ ShiftDel = 65582,
+ ShiftF1 = 65648,
+ ShiftF10 = 65657,
+ ShiftF11 = 65658,
+ ShiftF12 = 65659,
+ ShiftF2 = 65649,
+ ShiftF3 = 65650,
+ ShiftF4 = 65651,
+ ShiftF5 = 65652,
+ ShiftF6 = 65653,
+ ShiftF7 = 65654,
+ ShiftF8 = 65655,
+ ShiftF9 = 65656,
+ ShiftIns = 65581,
+ }
+}
+
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SizeGrip.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SizeGrip.cs
new file mode 100644
index 00000000000..3acff5c509a
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SizeGrip.cs
@@ -0,0 +1,135 @@
+// 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) 2005 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+// TODO: Eventually we need to handle the cursor and resizing the parent
+
+using System;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ internal class SizeGrip : Control {
+ #region Local Variables
+ private bool redraw;
+ private Point capture_point;
+ private int window_w;
+ private int window_h;
+ private bool show_grip;
+ private bool hide_pending;
+ #endregion // Local Variables
+
+ #region Constructors
+ public SizeGrip ()
+ {
+ this.Cursor = Cursors.SizeNWSE;
+ show_grip = true;
+ redraw = true;
+ hide_pending = false;
+ }
+ #endregion // Constructors
+
+ #region Properties
+ public bool ShowGrip {
+ get {
+ return show_grip;
+ }
+
+ set {
+ show_grip = value;
+ redraw = true;
+ }
+ }
+ #endregion // Properties
+
+ #region Methods
+ protected override void OnPaint (PaintEventArgs pe) {
+ if (redraw && show_grip) {
+ ControlPaint.DrawSizeGrip (pe.Graphics, BackColor, ClientRectangle);
+ }
+ base.OnPaint (pe);
+ }
+
+ protected override void OnSizeChanged (EventArgs e) {
+ base.OnSizeChanged (e);
+ redraw = true;
+ }
+
+ protected override void OnVisibleChanged (EventArgs e) {
+ base.OnVisibleChanged (e);
+ redraw = true;
+ }
+
+ protected override void OnMouseDown(MouseEventArgs e) {
+ Capture = true;
+
+ capture_point = Control.MousePosition;
+
+ window_w = parent.Width;
+ window_h = parent.Height;
+ }
+
+ protected override void OnMouseMove(MouseEventArgs e) {
+ if (this.is_captured) {
+ int delta_x;
+ int delta_y;
+ Point current_point;
+
+ current_point = Control.MousePosition;
+
+ delta_x = current_point.X - capture_point.X;
+ delta_y = current_point.Y - capture_point.Y;
+
+ this.parent.Size = new Size(window_w + delta_x, window_h + delta_y);
+ XplatUI.DoEvents();
+ }
+ }
+
+ protected override void OnMouseUp(MouseEventArgs e) {
+ if (Capture) {
+ Capture = false;
+ if (hide_pending) {
+ Hide();
+ hide_pending = false;
+ }
+ }
+ }
+
+
+ protected override void SetVisibleCore(bool value) {
+ if (Capture) {
+ if (value == false) {
+ hide_pending = true;
+ } else {
+ hide_pending = false;
+ }
+ return;
+ }
+ base.SetVisibleCore (value);
+ }
+
+ #endregion // Methods
+ }
+}
+
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SizeGripStyle.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SizeGripStyle.cs
new file mode 100644
index 00000000000..e2c32be9118
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SizeGripStyle.cs
@@ -0,0 +1,38 @@
+// 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 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Ravindra (rkumar@novell.com)
+//
+
+// COMPLETE
+
+
+namespace System.Windows.Forms
+{
+ [Serializable]
+ public enum SizeGripStyle
+ {
+ Auto = 0,
+ Show = 1,
+ Hide = 2
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SortOrder.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SortOrder.cs
new file mode 100644
index 00000000000..804a78dd6da
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SortOrder.cs
@@ -0,0 +1,38 @@
+// 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 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Ravindra (rkumar@novell.com)
+//
+
+// COMPLETE
+
+
+namespace System.Windows.Forms
+{
+ [Serializable]
+ public enum SortOrder
+ {
+ None = 0,
+ Ascending = 1,
+ Descending = 2
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Splitter.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Splitter.cs
new file mode 100644
index 00000000000..09f69a15570
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Splitter.cs
@@ -0,0 +1,735 @@
+// 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) 2005-2006 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Dennis Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+#undef Debug
+
+using System;
+using System.ComponentModel;
+using System.Drawing;
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [DefaultEvent("SplitterMoved")]
+ [Designer("System.Windows.Forms.Design.SplitterDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+ [DefaultProperty("Dock")]
+ public class Splitter : Control, IMessageFilter {
+ #region Enums
+ private enum DrawType {
+ Initial,
+ Redraw,
+ Finish
+ }
+ #endregion // Enums
+
+ #region Local Variables
+ static private Cursor splitter_ns;
+ static private Cursor splitter_we;
+ private BorderStyle border_style;
+ private int min_extra;
+ private int min_size;
+ private int split_position; // Current splitter position
+ private int prev_split_position; // Previous splitter position, only valid during drag
+ private int click_offset; // Click offset from border of splitter control
+ private int splitter_size; // Size (width or height) of our splitter control
+ private bool horizontal; // true if we've got a horizontal splitter
+ private Control affected; // The control that the splitter resizes
+ private Control filler; // The control that MinExtra prevents from being shrunk to 0 size
+ private SplitterEventArgs sevent; // We cache the object, prevents fragmentation
+ private int limit_min; // The max we're allowed to move the splitter left/up
+ private int limit_max; // The max we're allowed to move the splitter right/down
+ #endregion // Local Variables
+
+ #region Constructors
+ static Splitter() {
+ try {
+ splitter_ns = new Cursor(typeof(Splitter), "SplitterNS.cur");
+ }
+
+ catch (System.IO.FileNotFoundException) {
+ splitter_ns = Cursors.SizeNS;
+ }
+
+ try {
+ splitter_we = new Cursor(typeof(Splitter), "SplitterWE.cur");
+ }
+
+ catch (System.IO.FileNotFoundException) {
+ splitter_we = Cursors.SizeWE;
+ }
+ }
+
+ public Splitter() {
+
+ min_extra = 25;
+ min_size = 25;
+ split_position = -1;
+ splitter_size = 3;
+ horizontal = false;
+ sevent = new SplitterEventArgs(0, 0, 0, 0);
+
+ SetStyle(ControlStyles.Selectable, false);
+ Anchor = AnchorStyles.None;
+ Dock = DockStyle.Left;
+
+ Paint += new PaintEventHandler(PaintSplitter);
+ Layout += new LayoutEventHandler(LayoutSplitter);
+ Cursor = splitter_we;
+ }
+ #endregion // Constructors
+
+ #region Public Instance Properties
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool AllowDrop {
+ get {
+ return base.AllowDrop;
+ }
+
+ set {
+ base.AllowDrop = value;
+ }
+ }
+
+ [Browsable(false)]
+ [DefaultValue(AnchorStyles.None)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override AnchorStyles Anchor {
+ get {
+ return AnchorStyles.None;
+ }
+
+ set {
+ ; // MS doesn't set it
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override Image BackgroundImage {
+ get {
+ return base.BackgroundImage;
+ }
+
+ set {
+ base.BackgroundImage = value;
+ }
+ }
+
+ [DispId(-504)]
+ [DefaultValue (BorderStyle.None)]
+ [MWFDescription("Sets the border style for the splitter")]
+ [MWFCategory("Appearance")]
+ public BorderStyle BorderStyle {
+ get {
+ return border_style;
+ }
+
+ set {
+ border_style = value;
+
+ switch(value) {
+ case BorderStyle.FixedSingle: {
+ splitter_size = 4; // We don't get motion events for 1px wide windows on X11. sigh.
+ break;
+ }
+
+ case BorderStyle.Fixed3D: {
+ value = BorderStyle.None;
+ splitter_size = 3;
+ break;
+ }
+
+ case BorderStyle.None: {
+ splitter_size = 3;
+ break;
+ }
+
+ default: {
+ throw new InvalidEnumArgumentException (string.Format("Enum argument value '{0}' is not valid for BorderStyle", value));
+ }
+ }
+
+ base.InternalBorderStyle = value;
+ }
+ }
+
+ [DefaultValue(DockStyle.Left)]
+ [Localizable(true)]
+ public override DockStyle Dock {
+ get {
+ return base.Dock;
+ }
+
+ set {
+ if (!Enum.IsDefined (typeof (DockStyle), value) || (value == DockStyle.None) || (value == DockStyle.Fill)) {
+ throw new ArgumentException("Splitter must be docked left, top, bottom or right");
+ }
+
+ if ((value == DockStyle.Top) || (value == DockStyle.Bottom)) {
+ horizontal = true;
+ Cursor = splitter_ns;
+ } else {
+ horizontal = false;
+ Cursor = splitter_we;
+ }
+ base.Dock = value;
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override Font Font {
+ get {
+ return base.Font;
+ }
+
+ set {
+ base.Font = value;
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override Color ForeColor {
+ get {
+ return base.ForeColor;
+ }
+
+ set {
+ base.ForeColor = value;
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new ImeMode ImeMode {
+ get {
+ return base.ImeMode;
+ }
+
+ set {
+ base.ImeMode = value;
+ }
+ }
+
+ [DefaultValue(25)]
+ [Localizable(true)]
+ [MWFDescription("Sets minimum size of undocked window")]
+ [MWFCategory("Behaviour")]
+ public int MinExtra {
+ get {
+ return min_extra;
+ }
+
+ set {
+ min_extra = value;
+ }
+ }
+
+ [DefaultValue(25)]
+ [Localizable(true)]
+ [MWFDescription("Sets minimum size of the resized control")]
+ [MWFCategory("Behaviour")]
+ public int MinSize {
+ get {
+ return min_size;
+ }
+
+ set {
+ min_size = value;
+ }
+ }
+
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ [MWFDescription("Current splitter position")]
+ [MWFCategory("Layout")]
+ public int SplitPosition {
+ get {
+ if (affected == null) {
+ return -1;
+ }
+
+ if (Capture) {
+ return CalculateSplitPosition();
+ }
+
+ if (horizontal) {
+ return affected.Height;
+ } else {
+ return affected.Width;
+ }
+ }
+
+ set {
+ if (Capture || (affected == null)) {
+ return;
+ }
+
+ if (horizontal) {
+ affected.Height = value;
+ } else {
+ affected.Width = value;
+ }
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool TabStop {
+ get {
+ return base.TabStop;
+ }
+
+ set {
+ base.TabStop = value;
+ }
+ }
+
+ [Bindable(false)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override string Text {
+ get {
+ return base.Text;
+ }
+
+ set {
+ base.Text = value;
+ }
+ }
+
+ #endregion // Public Instance Properties
+
+ #region Protected Instance Properties
+ protected override CreateParams CreateParams {
+ get {
+ return base.CreateParams;
+ }
+ }
+
+ protected override ImeMode DefaultImeMode {
+ get {
+ return ImeMode.Disable;
+ }
+ }
+
+ protected override Size DefaultSize {
+ get {
+ return new Size (3, 3);
+ }
+ }
+ #endregion // Protected Instance Properties
+
+ #region Public Instance Methods
+ public bool PreFilterMessage(ref Message m) {
+ return false;
+ }
+
+ public override string ToString() {
+ return base.ToString () + String.Format(", MinExtra: {0}, MinSize: {1}", min_extra, min_size);
+ }
+ #endregion // Public Instance Methods
+
+ #region Protected Instance Methods
+ protected override void OnKeyDown(KeyEventArgs e) {
+ base.OnKeyDown (e);
+ if (Capture && (e.KeyCode == Keys.Escape)) {
+ Capture = false;
+ DrawDragHandle(DrawType.Finish);
+ }
+ }
+
+ protected override void OnMouseDown(MouseEventArgs e) {
+ Point pt;
+
+ base.OnMouseDown (e);
+
+ // Only allow if we are set up properly
+ if (affected == null || e.Button != MouseButtons.Left) {
+ return;
+ }
+
+ // Prepare the job
+ Capture = true;
+
+ // Calculate limits
+ if (filler != null) {
+ if (horizontal) {
+ if (dock_style == DockStyle.Top) {
+ limit_min = affected.Bounds.Top + min_size;
+ limit_max = filler.Bounds.Bottom - min_extra + this.bounds.Top - filler.Bounds.Top;
+ } else {
+ limit_min = filler.Bounds.Top + min_extra + this.bounds.Top - filler.Bounds.Bottom;
+ limit_max = affected.Bounds.Bottom - min_size - this.Height;
+ }
+ } else {
+ if (dock_style == DockStyle.Left) {
+ limit_min = affected.Bounds.Left + min_size;
+ limit_max = filler.Bounds.Right - min_extra + this.bounds.Left - filler.Bounds.Left;
+ } else {
+ limit_min = filler.Bounds.Left + min_extra + this.bounds.Left - filler.Bounds.Right;
+ limit_max = affected.Bounds.Right - min_size - this.Width;
+ }
+ }
+ } else {
+ limit_min = 0;
+ if (horizontal) {
+ limit_max = affected.Parent.Height;
+ } else {
+ limit_max = affected.Parent.Width;
+ }
+ }
+
+ #if Debug
+ Console.WriteLine("Sizing limits: Min:{0}, Max:{1}", limit_min, limit_max);
+ #endif
+
+ pt = PointToScreen(parent.PointToClient(new Point(e.X, e.Y)));
+
+ if (horizontal) {
+ split_position = pt.Y;
+ if (dock_style == DockStyle.Top) {
+ click_offset = e.Y;
+ } else {
+ click_offset = -e.Y;
+ }
+ } else {
+ split_position = pt.X;
+ if (dock_style == DockStyle.Left) {
+ click_offset = e.X;
+ } else {
+ click_offset = -e.X;
+ }
+ }
+
+ // We need to set this, in case we never get a mouse move
+ prev_split_position = split_position;
+
+ #if Debug
+ Console.WriteLine("Click-offset: {0} MouseDown split position: {1}", click_offset, split_position);
+ #endif
+
+ // Draw our initial handle
+ DrawDragHandle(DrawType.Initial);
+ }
+
+ protected override void OnMouseMove(MouseEventArgs e) {
+ Point pt;
+
+ base.OnMouseMove (e);
+
+ if (!Capture || e.Button != MouseButtons.Left) {
+ return;
+ }
+
+ // We need our mouse coordinates relative to our parent
+ pt = PointToScreen(parent.PointToClient(new Point(e.X, e.Y)));
+
+ // Grab our new coordinates
+ prev_split_position = split_position;
+ if (horizontal) {
+ split_position = pt.Y;
+ } else {
+ split_position = pt.X;
+ }
+ // Enforce limits
+ if (split_position < limit_min) {
+ #if Debug
+ Console.WriteLine("SplitPosition {0} less than minimum {1}, setting to minimum", split_position, limit_min);
+ #endif
+ split_position = limit_min;
+ } else if (split_position > limit_max) {
+ #if Debug
+ Console.WriteLine("SplitPosition {0} more than maximum {1}, setting to maximum", split_position, limit_max);
+ #endif
+ split_position = limit_max;
+ }
+
+ // Don't waste cycles
+ if (prev_split_position != split_position) {
+ // Update our handle location
+ DrawDragHandle(DrawType.Redraw);
+ }
+
+ // Prepare the event
+ if (horizontal) {
+ sevent.split_x = 0;
+ sevent.split_y = split_position;
+ } else {
+ sevent.split_x = split_position;
+ sevent.split_y = 0;
+ }
+
+ sevent.x = pt.X;
+ sevent.y = pt.Y;
+
+ // Fire the event
+ OnSplitterMoving(sevent);
+ }
+
+ protected override void OnMouseUp(MouseEventArgs e) {
+ if (!Capture || e.Button != MouseButtons.Left) {
+ base.OnMouseUp (e);
+ return;
+ }
+
+ Capture = false;
+ DrawDragHandle(DrawType.Finish);
+
+ // Resize the affected window
+ if (horizontal) {
+ affected.Height = CalculateSplitPosition() - click_offset;
+ #if Debug
+ Console.WriteLine("Setting height of affected control to {0}", CalculateSplitPosition() - click_offset);
+ #endif
+ } else {
+ affected.Width = CalculateSplitPosition() - click_offset;
+ #if Debug
+ Console.WriteLine("Setting width of affected control to {0}", CalculateSplitPosition() - click_offset);
+ #endif
+ }
+
+ base.OnMouseUp (e);
+
+ // It seems that MS is sending some data that doesn't quite make sense
+ // In this event. It tried to match their stuff.., not sure about split_x...
+
+ // Prepare the event
+ if (horizontal) {
+ sevent.x = 0;
+ sevent.y = split_position;
+ sevent.split_x = 200;
+ sevent.split_y = split_position;
+ } else {
+ sevent.x = split_position;
+ sevent.y = 0;
+ sevent.split_x = split_position;
+ sevent.split_y = 200;
+ }
+
+
+ // Fire the event
+ OnSplitterMoved(sevent);
+ }
+
+ protected virtual void OnSplitterMoved(SplitterEventArgs sevent) {
+ if (SplitterMoved != null) {
+ SplitterMoved(this, sevent);
+ }
+ }
+
+ protected virtual void OnSplitterMoving(SplitterEventArgs sevent) {
+ if (SplitterMoving != null) {
+ SplitterMoving(this, sevent);
+ }
+ }
+
+ protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified) {
+ // enforce our width / height
+ if (horizontal) {
+ base.SetBoundsCore (x, y, width, splitter_size, specified);
+ } else {
+ base.SetBoundsCore (x, y, splitter_size, height, specified);
+ }
+ }
+ #endregion // Protected Instance Methods
+
+ #region Private Properties and Methods
+ private Control AffectedControl {
+ get {
+ if (parent == null) {
+ return null;
+ }
+
+ // Doc says the first control preceeding us in the zorder
+ for (int i = parent.Controls.GetChildIndex(this) + 1; i < parent.Controls.Count; i++) {
+ switch(this.Dock) {
+ case DockStyle.Top: {
+ if (Top == parent.Controls[i].Bottom) {
+ return parent.Controls[i];
+ }
+ break;
+ }
+
+ case DockStyle.Bottom: {
+ if (Bottom == parent.Controls[i].Top) {
+ return parent.Controls[i];
+ }
+ break;
+ }
+
+ case DockStyle.Left: {
+ if (Left == parent.Controls[i].Right) {
+ return parent.Controls[i];
+ }
+ break;
+ }
+
+ case DockStyle.Right: {
+ if (Right == parent.Controls[i].Left) {
+ return parent.Controls[i];
+ }
+ break;
+ }
+ }
+ }
+ return null;
+ }
+ }
+
+ private Control FillerControl {
+ get {
+ if (parent == null) {
+ return null;
+ }
+
+ // Doc says the first control preceeding us in the zorder
+ for (int i = parent.Controls.GetChildIndex(this) - 1; i >= 0; i--) {
+ if (parent.Controls[i].Dock == DockStyle.Fill) {
+ return parent.Controls[i];
+ }
+ }
+ return null;
+ }
+ }
+
+ private int CalculateSplitPosition() {
+ if (horizontal) {
+ if (dock_style == DockStyle.Top) {
+ return split_position;
+ } else {
+ return affected.Bottom - split_position - splitter_size;
+ }
+ } else {
+ if (dock_style == DockStyle.Left) {
+ return split_position;
+ } else {
+ return affected.Right - split_position - splitter_size;
+ }
+ }
+ }
+
+ private void PaintSplitter(object sender, PaintEventArgs e) {
+ e.Graphics.FillRectangle(ThemeEngine.Current.ResPool.GetSolidBrush(this.BackColor), e.ClipRectangle);
+ }
+
+ private void LayoutSplitter(object sender, LayoutEventArgs e) {
+ affected = AffectedControl;
+ filler = FillerControl;
+ }
+
+ private void DrawDragHandle(DrawType type) {
+ Rectangle prev;
+ Rectangle current;
+
+ if (horizontal) {
+ prev = new Rectangle(0, prev_split_position - click_offset + 1, Width, 0);
+ current = new Rectangle(0, split_position - click_offset + 1, Width, 0);
+ } else {
+ prev = new Rectangle(prev_split_position - click_offset + 1, 0, 0, Height);
+ current = new Rectangle(split_position - click_offset + 1, 0, 0, Height);
+ }
+
+ switch(type) {
+ case DrawType.Initial: {
+ XplatUI.DrawReversibleRectangle(Parent.window.Handle, current, 3);
+ return;
+ }
+
+ case DrawType.Redraw: {
+ if (prev.X == current.X && prev.Y == current.Y) {
+ return;
+ }
+
+ XplatUI.DrawReversibleRectangle(Parent.window.Handle, prev, 3);
+ XplatUI.DrawReversibleRectangle(Parent.window.Handle, current, 3);
+ return;
+ }
+
+ case DrawType.Finish: {
+ XplatUI.DrawReversibleRectangle(Parent.window.Handle, prev, 3);
+ return;
+ }
+ }
+ }
+ #endregion // Private Properties and Methods
+
+ #region Events
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler BackgroundImageChanged;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler Enter;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler FontChanged;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler ForeColorChanged;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler ImeModeChanged;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event KeyEventHandler KeyDown;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event KeyPressEventHandler KeyPress;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event KeyEventHandler KeyUp;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler Leave;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler TabStopChanged;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler TextChanged;
+
+ public event SplitterEventHandler SplitterMoved;
+ public event SplitterEventHandler SplitterMoving;
+ #endregion // Events
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SplitterEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SplitterEventArgs.cs
new file mode 100644
index 00000000000..3570f84df50
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SplitterEventArgs.cs
@@ -0,0 +1,79 @@
+// 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-2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Aleksandar Dezelin adezelin@beotel.net
+// Peter Dennis Bartok pbartok@novell.com
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [ComVisible(true)]
+ public class SplitterEventArgs : EventArgs
+ {
+ #region Private fields
+
+ internal int split_x;
+ internal int split_y;
+ internal int x;
+ internal int y;
+
+ #endregion
+
+ #region Constructors
+
+ public SplitterEventArgs(int x, int y, int splitX, int splitY)
+ {
+ this.x = x;
+ this.y = y;
+ SplitX = splitX;
+ SplitY = splitY;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public int SplitX {
+ get { return split_x; }
+ set { split_x = value; }
+ }
+
+ public int SplitY {
+ get { return split_y; }
+ set { split_y = value; }
+ }
+
+ public int X {
+ get { return x; }
+ }
+
+ public int Y {
+ get { return y; }
+ }
+
+ #endregion
+ }
+}
+
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SplitterEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SplitterEventHandler.cs
new file mode 100644
index 00000000000..c1c6131a7b5
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SplitterEventHandler.cs
@@ -0,0 +1,32 @@
+// 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 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Aleksandar Dezelin adezelin@beotel.net
+//
+
+using System;
+
+namespace System.Windows.Forms
+{
+ public delegate void SplitterEventHandler(object sender, SplitterEventArgs e);
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBar.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBar.cs
new file mode 100644
index 00000000000..3b87051dfe1
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBar.cs
@@ -0,0 +1,616 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+//
+// TODO:
+// - Change cursor when mouse is over grip
+//
+
+using System.Collections;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Drawing;
+using System.Drawing.Text;
+using System.Drawing.Imaging;
+
+namespace System.Windows.Forms {
+ [DefaultEvent("PanelClick")]
+ [Designer("System.Windows.Forms.Design.StatusBarDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+ [DefaultProperty("Text")]
+ public class StatusBar : Control {
+ #region Fields
+ private StatusBarPanelCollection panels;
+
+ private Color back_color;
+ private Color fore_color;
+
+ private bool show_panels = false;
+ private bool sizing_grip = true;
+
+ #endregion // Fields
+
+ #region Public Constructors
+ [MonoTODO("Change cursor when mouse is over grip")]
+ public StatusBar ()
+ {
+ base.Dock = DockStyle.Bottom;
+ back_color = SystemColors.Control;
+ fore_color = SystemColors.ControlText;
+ Anchor = AnchorStyles.Top | AnchorStyles.Left;
+ this.TabStop = false;
+ this.SetStyle(ControlStyles.UserPaint | ControlStyles.Selectable, false);
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override Color BackColor {
+ get { return back_color; }
+ set {
+ if (value == BackColor)
+ return;
+ back_color = value;
+ if (BackColorChanged != null)
+ BackColorChanged (this, EventArgs.Empty);
+ Update ();
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override Image BackgroundImage {
+ get { return base.BackgroundImage; }
+ set {
+ if (value == BackgroundImage)
+ return;
+ base.BackgroundImage = value;
+ if (BackgroundImageChanged != null)
+ BackgroundImageChanged (this, EventArgs.Empty);
+ }
+ }
+
+ [Localizable(true)]
+ [DefaultValue(DockStyle.Bottom)]
+ public override DockStyle Dock {
+ get { return base.Dock; }
+ set {
+ if (value == Dock)
+ return;
+ base.Dock = value;
+ Update ();
+ }
+ }
+
+ [Localizable(true)]
+ public override Font Font {
+ get { return base.Font; }
+ set {
+ if (value == Font)
+ return;
+ base.Font = value;
+ Update ();
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override Color ForeColor {
+ get { return fore_color; }
+ set {
+ if (value == ForeColor)
+ return;
+ fore_color = value;
+ if (ForeColorChanged != null)
+ ForeColorChanged (this, EventArgs.Empty);
+ Update ();
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new ImeMode ImeMode {
+ get { return base.ImeMode; }
+ set {
+ if (value == ImeMode)
+ return;
+ base.ImeMode = value;
+ if (ImeModeChanged != null)
+ ImeModeChanged (this, EventArgs.Empty);
+ }
+ }
+
+ [MergableProperty(false)]
+ [Localizable(true)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
+ public StatusBarPanelCollection Panels {
+ get {
+ if (panels == null)
+ panels = new StatusBarPanelCollection (this);
+ return panels;
+ }
+ }
+
+ [DefaultValue(false)]
+ public bool ShowPanels {
+ get { return show_panels; }
+ set {
+ if (show_panels == value)
+ return;
+ show_panels = value;
+ Update ();
+ }
+ }
+
+ [DefaultValue(true)]
+ public bool SizingGrip {
+ get { return sizing_grip; }
+ set {
+ if (sizing_grip == value)
+ return;
+ sizing_grip = value;
+ Update ();
+ }
+ }
+
+ [DefaultValue(false)]
+ public new bool TabStop {
+ get { return base.TabStop; }
+ set { base.TabStop = value; }
+ }
+
+ [Localizable(true)]
+ public override string Text {
+ get { return base.Text; }
+ set {
+ if (value == Text)
+ return;
+ base.Text = value;
+ Update ();
+ }
+
+ }
+
+ #endregion Public Instance Properties
+
+ #region Protected Instance Properties
+ protected override CreateParams CreateParams {
+ get {
+ return base.CreateParams;
+ }
+ }
+
+ protected override ImeMode DefaultImeMode {
+ get { return ImeMode.Disable; }
+ }
+
+ protected override Size DefaultSize {
+ get { return ThemeEngine.Current.StatusBarDefaultSize; }
+ }
+
+ #endregion // Protected Instance Properties
+
+ #region Public Instance Methods
+ public override string ToString () {
+ return base.ToString () + ", Panels.Count: " + Panels.Count +
+ (Panels.Count > 0 ? ", Panels[0]: " + Panels [0] : String.Empty);
+ }
+
+ #endregion // Public Instance Methods
+
+ #region Protected Instance Methods
+ protected override void CreateHandle ()
+ {
+ base.CreateHandle ();
+ }
+
+ protected override void Dispose (bool disposing) {
+ base.Dispose (disposing);
+ }
+
+ protected virtual void OnDrawItem (StatusBarDrawItemEventArgs e) {
+ if (DrawItem != null)
+ DrawItem (this, e);
+ }
+
+ protected override void OnHandleCreated (EventArgs e) {
+ base.OnHandleCreated (e);
+ CalcPanelSizes ();
+ }
+
+ protected override void OnHandleDestroyed (EventArgs e) {
+ base.OnHandleDestroyed (e);
+ }
+
+ protected override void OnLayout (LayoutEventArgs e) {
+ base.OnLayout (e);
+ }
+
+ protected override void OnMouseDown (MouseEventArgs e) {
+ if (panels == null)
+ return;
+
+ float prev_x = 0;
+ float gap = ThemeEngine.Current.StatusBarHorzGapWidth;
+ for (int i = 0; i < panels.Count; i++) {
+ float x = panels [i].Width + prev_x + (i == panels.Count - 1 ? gap : gap / 2);
+ if (e.X >= prev_x && e.X <= x) {
+ OnPanelClick (new StatusBarPanelClickEventArgs (panels [i],
+ e.Button, e.Clicks, e.X, e.Y));
+ break;
+ }
+ prev_x = x;
+ }
+
+ base.OnMouseDown (e);
+ }
+
+ protected virtual void OnPanelClick (StatusBarPanelClickEventArgs e) {
+ if (PanelClick != null)
+ PanelClick (this, e);
+ }
+
+ protected override void OnResize (EventArgs e)
+ {
+ base.OnResize (e);
+
+ if (Width <= 0 || Height <= 0)
+ return;
+
+ Update ();
+ }
+
+ protected override void WndProc(ref Message m) {
+ switch ((Msg) m.Msg) {
+ case Msg.WM_PAINT: {
+ PaintEventArgs paint_event;
+
+ paint_event = XplatUI.PaintEventStart (Handle, true);
+ DoPaint (paint_event);
+ XplatUI.PaintEventEnd (Handle, true);
+ return;
+ }
+ }
+ base.WndProc (ref m);
+ }
+
+ #endregion // Methods
+
+
+ #region Internal Methods
+ internal void OnDrawItemInternal (StatusBarDrawItemEventArgs e)
+ {
+ OnDrawItem (e);
+ }
+
+ internal void UpdatePanel (StatusBarPanel panel)
+ {
+ if (panel.AutoSize == StatusBarPanelAutoSize.Contents) {
+ Update ();
+ return;
+ }
+
+ Update ();
+ }
+
+ internal void UpdatePanelContents (StatusBarPanel panel)
+ {
+ if (panel.AutoSize == StatusBarPanelAutoSize.Contents) {
+ Update ();
+ return;
+ }
+
+ Update ();
+ }
+
+ internal void Update ()
+ {
+ CalcPanelSizes ();
+ Refresh ();
+ }
+
+ private void DoPaint (PaintEventArgs pevent)
+ {
+ if (Width <= 0 || Height <= 0 || Visible == false)
+ return;
+
+ Draw (pevent.Graphics, pevent.ClipRectangle);
+ }
+
+ private void CalcPanelSizes ()
+ {
+ if (panels == null || !show_panels)
+ return;
+
+ if (Width == 0 || Height == 0)
+ return;
+
+ int border = 2;
+ int gap = ThemeEngine.Current.StatusBarHorzGapWidth;
+ int taken = 0;
+ ArrayList springs = null;
+
+ taken = border;
+ for (int i = 0; i < panels.Count; i++) {
+ StatusBarPanel p = panels [i];
+
+ if (p.AutoSize == StatusBarPanelAutoSize.None) {
+ taken += p.Width;
+ taken += gap;
+ continue;
+ }
+ if (p.AutoSize == StatusBarPanelAutoSize.Contents) {
+ int len = (int) (DeviceContext.MeasureString (p.Text, Font).Width + 0.5F);
+ p.SetWidth (len + 8);
+ taken += p.Width;
+ taken += gap;
+ continue;
+ }
+ if (p.AutoSize == StatusBarPanelAutoSize.Spring) {
+ if (springs == null)
+ springs = new ArrayList ();
+ springs.Add (p);
+ taken += gap;
+ continue;
+ }
+ }
+
+ if (springs == null)
+ return;
+
+ int spring_total = springs.Count;
+ int total_width = Width - taken - (SizingGrip ? ThemeEngine.Current.StatusBarSizeGripWidth : 0);
+ for (int i = 0; i < spring_total; i++) {
+ StatusBarPanel p = (StatusBarPanel) springs [i];
+ int width = total_width / spring_total;
+ p.SetWidth (width >= p.MinWidth ? width : p.MinWidth);
+ }
+
+ taken = border;
+ for (int i = 0; i < panels.Count; i++) {
+ StatusBarPanel p = panels [i];
+ p.X = taken;
+ taken += p.Width + gap;
+ }
+ }
+
+ private void Draw (Graphics dc, Rectangle clip)
+ {
+ ThemeEngine.Current.DrawStatusBar (dc, this.ClientRectangle, this);
+ }
+ #endregion // Internal Methods
+
+
+ #region Events
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler BackColorChanged;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler BackgroundImageChanged;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler ForeColorChanged;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler ImeModeChanged;
+
+ public event StatusBarDrawItemEventHandler DrawItem;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event PaintEventHandler Paint;
+ public event StatusBarPanelClickEventHandler PanelClick;
+ #endregion // Events
+
+
+ #region Subclass StatusBarPanelCollection
+ public class StatusBarPanelCollection : IList, ICollection, IEnumerable {
+ #region Fields
+ private StatusBar owner;
+ private ArrayList panels;
+ #endregion // Fields
+
+ #region Public Constructors
+ public StatusBarPanelCollection (StatusBar owner)
+ {
+ this.owner = owner;
+ }
+
+ #endregion // Public Constructors
+
+ #region Private & Internal Methods
+ private int AddInternal (StatusBarPanel p, bool refresh) {
+ if (p == null)
+ throw new ArgumentNullException ("value");
+ if (panels == null)
+ panels = new ArrayList ();
+
+ int res = panels.Add (p);
+ p.SetParent (owner);
+
+ if (refresh) {
+ owner.CalcPanelSizes ();
+ owner.Refresh ();
+ }
+
+ return res;
+ }
+
+ #endregion // Private & Internal Methods
+
+ #region Public Instance Properties
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual int Count {
+ get {
+ if (panels == null)
+ return 0;
+ return panels.Count;
+ }
+ }
+
+ public virtual bool IsReadOnly {
+ get { return false; }
+ }
+
+ public virtual StatusBarPanel this [int index] {
+ get {
+ if (index < 0 || index >= Count)
+ throw new ArgumentOutOfRangeException ("index");
+ return (StatusBarPanel) panels [index];
+ }
+ set {
+ if (value == null)
+ throw new ArgumentNullException ("index");
+ if (index < 0 || index >= Count)
+ throw new ArgumentOutOfRangeException ("index");
+ panels [index] = value;
+ }
+ }
+
+ #endregion // Public Instance Properties
+
+ #region Public Instance Methods
+ public virtual int Add (StatusBarPanel p) {
+ return AddInternal (p, true);
+ }
+
+ public virtual StatusBarPanel Add (string text) {
+ StatusBarPanel res = new StatusBarPanel ();
+ res.Text = text;
+ Add (res);
+ return res;
+ }
+
+ public virtual void AddRange (StatusBarPanel [] range) {
+ if (range == null)
+ throw new ArgumentNullException ("panels");
+ if (range.Length == 0)
+ return;
+ if (panels == null)
+ panels = new ArrayList (range.Length);
+
+ for (int i = 0; i < range.Length; i++)
+ AddInternal (range [i], false);
+ owner.Refresh ();
+ }
+
+ public virtual void Clear () {
+ panels.Clear ();
+
+ owner.Refresh ();
+ }
+
+ public bool Contains (StatusBarPanel panel) {
+ return panels.Contains (panel);
+ }
+
+ public virtual IEnumerator GetEnumerator () {
+ return panels.GetEnumerator ();
+ }
+
+ public int IndexOf (StatusBarPanel panel) {
+ return panels.IndexOf (panel);
+ }
+
+ public virtual void Insert (int index, StatusBarPanel value) {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ if (index > Count)
+ throw new ArgumentOutOfRangeException ("index");
+ // TODO: InvalidArgumentException for bad AutoSize values
+ // although it seems impossible to set it to a bad value
+ value.SetParent (owner);
+ panels [index] = value;
+
+ owner.Refresh ();
+ }
+
+ public virtual void Remove (StatusBarPanel panel) {
+ panels.Remove (panel);
+ }
+
+ public virtual void RemoveAt (int index) {
+ panels.RemoveAt (index);
+ }
+
+ #endregion // Public Instance Methods
+
+ #region IList & ICollection Interfaces
+ bool ICollection.IsSynchronized {
+ get { return panels.IsSynchronized; }
+ }
+
+ object ICollection.SyncRoot {
+ get { return panels.SyncRoot; }
+ }
+
+ void ICollection.CopyTo (Array dest, int index)
+ {
+ panels.CopyTo (dest, index);
+ }
+
+
+ object IList.this [int index] {
+ get { return panels [index]; }
+ set { panels [index] = value; }
+ }
+
+ int IList.Add (object value) {
+ return panels.Add (value);
+ }
+
+ bool IList.Contains (object panel) {
+ return panels.Contains (panel);
+ }
+
+ int IList.IndexOf (object panel)
+ {
+ return panels.IndexOf (panel);
+ }
+
+ void IList.Insert (int index, object value)
+ {
+ panels.Insert (index, value);
+ }
+
+ bool IList.IsFixedSize {
+ get { return false; }
+ }
+
+ void IList.Remove (object value)
+ {
+ panels.Remove (value);
+ }
+ #endregion // IList & ICollection Interfaces
+ }
+ #endregion // Subclass StatusBarPanelCollection
+ }
+
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBarDrawItemEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBarDrawItemEventArgs.cs
new file mode 100644
index 00000000000..a07ab170fea
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBarDrawItemEventArgs.cs
@@ -0,0 +1,57 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+
+using System;
+using System.Drawing;
+
+
+namespace System.Windows.Forms {
+
+ public class StatusBarDrawItemEventArgs : DrawItemEventArgs {
+
+ private StatusBarPanel panel;
+
+ public StatusBarDrawItemEventArgs (Graphics g, Font font, Rectangle rect,
+ int item, DrawItemState state, StatusBarPanel panel) :
+ this (g, font, rect, item, state, panel, Control.DefaultForeColor,
+ Control.DefaultBackColor)
+
+ {
+ }
+
+ public StatusBarDrawItemEventArgs (Graphics g, Font font, Rectangle rect,
+ int item, DrawItemState state, StatusBarPanel panel,
+ Color foreColor, Color backColor) : base (g, font, rect,
+ item, state)
+ {
+ this.panel = panel;
+ }
+
+ public StatusBarPanel Panel {
+ get { return panel; }
+ }
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBarDrawItemEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBarDrawItemEventHandler.cs
new file mode 100644
index 00000000000..db550ee27b3
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBarDrawItemEventHandler.cs
@@ -0,0 +1,36 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+
+using System;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ public delegate void StatusBarDrawItemEventHandler (object sender,
+ StatusBarDrawItemEventArgs sbdevent);
+
+}
+
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBarPanel.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBarPanel.cs
new file mode 100644
index 00000000000..5419b971f02
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBarPanel.cs
@@ -0,0 +1,215 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+// COMPLETE
+
+using System;
+using System.Drawing;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [DefaultProperty("Text")]
+ [DesignTimeVisible(false)]
+ public class StatusBarPanel : Component, ISupportInitialize {
+ #region Local Variables
+ private StatusBar parent;
+
+ private bool initializing;
+ private string text = String.Empty;
+ private string tool_tip_text = String.Empty;
+
+ private Icon icon;
+ private HorizontalAlignment alignment = HorizontalAlignment.Left;
+ private StatusBarPanelAutoSize auto_size = StatusBarPanelAutoSize.None;
+ private StatusBarPanelBorderStyle border_style = StatusBarPanelBorderStyle.Sunken;
+ private StatusBarPanelStyle style;
+ private int width = 100;
+ private int twidth = -1;
+ private int min_width = 10;
+ internal int X;
+ #endregion // Local Variables
+
+ #region Constructors
+ public StatusBarPanel ()
+ {
+ }
+ #endregion // Constructors
+
+ [DefaultValue(HorizontalAlignment.Left)]
+ [Localizable(true)]
+ public HorizontalAlignment Alignment {
+ get { return alignment; }
+ set {
+ alignment = value;
+ InvalidateContents ();
+ }
+ }
+
+ [DefaultValue(StatusBarPanelAutoSize.None)]
+ public StatusBarPanelAutoSize AutoSize {
+ get { return auto_size; }
+ set {
+ auto_size = value;
+ Invalidate ();
+ }
+ }
+
+ [DefaultValue(StatusBarPanelBorderStyle.Sunken)]
+ [DispId(-504)]
+ public StatusBarPanelBorderStyle BorderStyle {
+ get { return border_style; }
+ set {
+ border_style = value;
+ Invalidate ();
+ }
+ }
+
+ [DefaultValue(null)]
+ [Localizable(true)]
+ public Icon Icon {
+ get { return icon; }
+ set {
+ icon = value;
+ InvalidateContents ();
+ }
+ }
+
+ [DefaultValue(10)]
+ [Localizable(true)]
+ [RefreshProperties(RefreshProperties.All)]
+ public int MinWidth {
+ get {
+ if (AutoSize == StatusBarPanelAutoSize.None)
+ return Width;
+ return min_width;
+ }
+ set {
+ if (value < 0)
+ throw new ArgumentException ("value");
+ min_width = value;
+ Invalidate ();
+ }
+ }
+
+ [DefaultValue(100)]
+ [Localizable(true)]
+ public int Width {
+ get { return width; }
+ set {
+ if (value < 0)
+ throw new ArgumentException ("value");
+
+ if (initializing)
+ twidth = value;
+ else
+ width = value;
+
+ Invalidate ();
+ }
+ }
+
+ [DefaultValue(StatusBarPanelStyle.Text)]
+ public StatusBarPanelStyle Style {
+ get { return style; }
+ set {
+ style = value;
+ Invalidate ();
+ }
+ }
+
+ [DefaultValue("")]
+ [Localizable(true)]
+ public string Text {
+ get { return text; }
+ set {
+ text = value;
+ InvalidateContents ();
+ }
+ }
+
+ [DefaultValue("")]
+ [Localizable(true)]
+ public string ToolTipText {
+ get { return tool_tip_text; }
+ set { tool_tip_text = value; }
+ }
+
+ [Browsable(false)]
+ public StatusBar Parent {
+ get { return parent; }
+ }
+
+ private void Invalidate ()
+ {
+ if (parent == null)
+ return;
+ parent.UpdatePanel (this);
+ }
+
+ private void InvalidateContents ()
+ {
+ if (parent == null)
+ return;
+ parent.UpdatePanelContents (this);
+ }
+
+ internal void SetParent (StatusBar parent)
+ {
+ this.parent = parent;
+ }
+
+ internal void SetWidth (int width)
+ {
+ this.width = width;
+ }
+
+ public override string ToString ()
+ {
+ return "StatusBarPanel: {" + Text +"}";
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ }
+
+ public virtual void BeginInit ()
+ {
+ initializing = true;
+ }
+
+ public virtual void EndInit ()
+ {
+ if (!initializing || twidth == -1)
+ return;
+
+ width = twidth;
+ twidth = -1;
+ initializing = false;
+ }
+ }
+}
+
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBarPanelAutoSize.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBarPanelAutoSize.cs
new file mode 100644
index 00000000000..e4cfc3b4956
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBarPanelAutoSize.cs
@@ -0,0 +1,33 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+namespace System.Windows.Forms {
+
+ public enum StatusBarPanelAutoSize {
+ None = 1,
+ Spring,
+ Contents
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBarPanelBorderStyle.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBarPanelBorderStyle.cs
new file mode 100644
index 00000000000..d86dfef8bd8
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBarPanelBorderStyle.cs
@@ -0,0 +1,33 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+
+namespace System.Windows.Forms {
+
+ public enum StatusBarPanelBorderStyle {
+ None = 1,
+ Raised,
+ Sunken
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBarPanelClickEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBarPanelClickEventArgs.cs
new file mode 100644
index 00000000000..880b6194841
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBarPanelClickEventArgs.cs
@@ -0,0 +1,46 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+
+using System;
+
+namespace System.Windows.Forms {
+
+ public class StatusBarPanelClickEventArgs : MouseEventArgs {
+
+ private StatusBarPanel panel;
+
+ public StatusBarPanelClickEventArgs (StatusBarPanel panel,
+ MouseButtons buttons, int clicks, int x, int y) :
+ base (buttons, clicks, x, y, 0)
+ {
+ this.panel = panel;
+ }
+
+ public StatusBarPanel StatusBarPanel {
+ get { return panel; }
+ }
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBarPanelClickEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBarPanelClickEventHandler.cs
new file mode 100644
index 00000000000..cef19cd2c23
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBarPanelClickEventHandler.cs
@@ -0,0 +1,32 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+
+namespace System.Windows.Forms {
+
+ public delegate void StatusBarPanelClickEventHandler (object sender,
+ StatusBarPanelClickEventArgs e);
+
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBarPanelStyle.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBarPanelStyle.cs
new file mode 100644
index 00000000000..086aa4c7e52
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusBarPanelStyle.cs
@@ -0,0 +1,33 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+
+namespace System.Windows.Forms {
+
+ public enum StatusBarPanelStyle {
+ Text = 1,
+ OwnerDraw
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StructFormat.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StructFormat.cs
new file mode 100644
index 00000000000..74bc4f8a455
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StructFormat.cs
@@ -0,0 +1,37 @@
+// 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 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Ravindra (rkumar@novell.com)
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms
+{
+ [Serializable]
+ public enum StructFormat
+ {
+ Ansi = 1,
+ Unicode = 2,
+ Auto = 3
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SystemInformation.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SystemInformation.cs
new file mode 100644
index 00000000000..a5bef543a38
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SystemInformation.cs
@@ -0,0 +1,415 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Miguel de Icaza (miguel@novell.com).
+// Peter Bartok (pbartok@novell.com)
+//
+
+// NOT COMPLETE
+
+using System;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+ public class SystemInformation {
+ #region Constructor
+ internal SystemInformation() {
+ }
+ #endregion
+
+ #region Public Static Properties
+ public static ArrangeDirection ArrangeDirection {
+ get {
+ return ThemeEngine.Current.ArrangeDirection;
+ }
+ }
+
+ public static ArrangeStartingPosition ArrangeStartingPosition {
+ get {
+ return ThemeEngine.Current.ArrangeStartingPosition;
+ }
+ }
+
+ public static BootMode BootMode {
+ get {
+ return BootMode.Normal;
+ }
+ }
+
+ public static Size Border3DSize {
+ get {
+ return ThemeEngine.Current.Border3DSize;
+ }
+ }
+
+ public static Size BorderSize {
+ get {
+ return ThemeEngine.Current.Border3DSize;
+ }
+ }
+
+ public static Size CaptionButtonSize {
+ get {
+ return ThemeEngine.Current.CaptionButtonSize;
+ }
+ }
+
+ public static int CaptionHeight {
+ get {
+ return ThemeEngine.Current.CaptionHeight;
+ }
+ }
+
+ public static string ComputerName {
+ get {
+ return Environment.MachineName;
+ }
+ }
+
+ public static Size CursorSize {
+ get {
+ return XplatUI.CursorSize;
+ }
+ }
+
+ public static bool DbcsEnabled {
+ get {
+ return false;
+ }
+ }
+
+ public static bool DebugOS {
+ get {
+ return false;
+ }
+ }
+
+ public static Size DoubleClickSize {
+ get {
+ return ThemeEngine.Current.DoubleClickSize;
+ }
+ }
+
+ public static int DoubleClickTime {
+ get {
+ return ThemeEngine.Current.DoubleClickTime;
+ }
+ }
+
+ public static bool DragFullWindows {
+ get {
+ return XplatUI.DragFullWindows;
+ }
+ }
+
+ public static Size DragSize {
+ get {
+ return XplatUI.DragSize;
+ }
+ }
+
+ public static Size FixedFrameBorderSize {
+ get {
+ return ThemeEngine.Current.FixedFrameBorderSize;
+ }
+ }
+
+ public static Size FrameBorderSize {
+ get {
+ return ThemeEngine.Current.FrameBorderSize;
+ }
+ }
+
+ public static bool HighContrast {
+ get {
+ return false;
+ }
+ }
+
+ public static int HorizontalScrollBarArrowWidth {
+ get {
+ return ThemeEngine.Current.HorizontalScrollBarArrowWidth;
+ }
+ }
+
+ public static int HorizontalScrollBarHeight {
+ get {
+ return ThemeEngine.Current.HorizontalScrollBarHeight;
+ }
+ }
+
+ public static int HorizontalScrollBarThumbWidth {
+ get {
+ return ThemeEngine.Current.HorizontalScrollBarThumbWidth;
+ }
+ }
+
+ public static Size IconSize {
+ get {
+ return XplatUI.IconSize;
+ }
+ }
+
+ public static Size IconSpacingSize {
+ get {
+ return ThemeEngine.Current.IconSpacingSize;
+ }
+ }
+
+ public static int KanjiWindowHeight {
+ get {
+ return 0;
+ }
+ }
+
+ public static Size MaxWindowTrackSize {
+ get {
+ return XplatUI.MaxWindowTrackSize;
+ }
+ }
+
+ public static Size MenuButtonSize {
+ get {
+ return ThemeEngine.Current.MenuButtonSize;
+ }
+ }
+
+ public static Size MenuCheckSize {
+ get {
+ return ThemeEngine.Current.MenuCheckSize;
+ }
+ }
+
+ public static Font MenuFont {
+ get {
+ return ThemeEngine.Current.MenuFont;
+ }
+ }
+
+ public static int MenuHeight {
+ get {
+ return ThemeEngine.Current.MenuHeight;
+ }
+ }
+
+ public static bool MidEastEnabled {
+ get {
+ return false; // ??? how do we decide?
+ }
+ }
+
+ public static Size MinimizedWindowSize {
+ get {
+ return XplatUI.MinimizedWindowSize;
+ }
+ }
+
+ public static Size MinimizedWindowSpacingSize {
+ get {
+ return XplatUI.MinimizedWindowSpacingSize;
+ }
+ }
+
+ public static Size MinimumWindowSize {
+ get {
+ return XplatUI.MinimumWindowSize;
+ }
+ }
+
+ public static Size MinWindowTrackSize {
+ get {
+ return XplatUI.MinWindowTrackSize;
+ }
+ }
+
+ public static int MonitorCount {
+ get {
+ return 1; // Why bother...
+ }
+ }
+
+ public static bool MonitorsSameDisplayFormat {
+ get {
+ return true;
+ }
+ }
+
+ public static int MouseButtons {
+ get {
+ return XplatUI.MouseButtonCount;
+ }
+ }
+
+ public static bool MouseButtonsSwapped {
+ get {
+ return XplatUI.MouseButtonsSwapped;
+ }
+ }
+
+ public static bool MousePresent {
+ get {
+ return true;
+ }
+ }
+
+ public static bool MouseWheelPresent {
+ get {
+ return XplatUI.MouseWheelPresent;
+ }
+ }
+
+ public static int MouseWheelScrollLines {
+ get {
+ return ThemeEngine.Current.MouseWheelScrollLines;
+ }
+ }
+
+ public static bool NativeMouseWheelSupport {
+ get {
+ return MouseWheelPresent;
+ }
+ }
+
+ public static bool Network {
+ get {
+ return true;
+ }
+ }
+
+ public static bool PenWindows {
+ get {
+ return false;
+ }
+ }
+
+ public static Size PrimaryMonitorMaximizedWindowSize {
+ get {
+ return new Size(WorkingArea.Width, WorkingArea.Height);
+ }
+ }
+
+ public static Size PrimaryMonitorSize {
+ get {
+ return new Size(WorkingArea.Width, WorkingArea.Height);
+ }
+ }
+
+ public static bool RightAlignedMenus {
+ get {
+ return ThemeEngine.Current.RightAlignedMenus;
+ }
+ }
+
+ public static bool Secure {
+ get {
+ return true; // FIXME - figure out if we're running 98/Me and return false
+ }
+ }
+
+ public static bool ShowSounds {
+ get {
+ return false;
+ }
+ }
+
+ public static Size SmallIconSize {
+ get {
+ return XplatUI.SmallIconSize;
+ }
+ }
+
+ public static Size ToolWindowCaptionButtonSize {
+ get {
+ return ThemeEngine.Current.ToolWindowCaptionButtonSize;
+ }
+ }
+
+ public static int ToolWindowCaptionHeight {
+ get {
+ return ThemeEngine.Current.ToolWindowCaptionHeight;
+ }
+ }
+
+ public static string UserDomainName {
+ get {
+ return Environment.UserDomainName;
+ }
+ }
+
+ public static bool UserInteractive {
+ get {
+ return Environment.UserInteractive;
+ }
+ }
+
+ public static string UserName {
+ get {
+ return Environment.UserName;
+ }
+ }
+
+ public static int VerticalScrollBarArrowHeight {
+ get {
+ return ThemeEngine.Current.VerticalScrollBarArrowHeight;
+ }
+ }
+
+ public static int VerticalScrollBarThumbHeight {
+ get {
+ return ThemeEngine.Current.VerticalScrollBarThumbHeight;
+ }
+ }
+
+ public static int VerticalScrollBarWidth {
+ get {
+ return ThemeEngine.Current.VerticalScrollBarWidth;
+ }
+ }
+
+ public static Rectangle VirtualScreen {
+ get {
+ return XplatUI.VirtualScreen;
+ }
+ }
+
+ public static Rectangle WorkingArea {
+ get {
+ return XplatUI.WorkingArea;
+ }
+ }
+ #endregion // Public Static Properties
+
+ #region Internal Static Properties
+ internal static int KeyboardSpeed {
+ get {
+ return XplatUI.KeyboardSpeed;
+ }
+ }
+
+ internal static int KeyboardDelay {
+ get {
+ return XplatUI.KeyboardDelay;
+ }
+ }
+ #endregion // Internal Static Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabAlignment.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabAlignment.cs
new file mode 100644
index 00000000000..5e5c2ef3346
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabAlignment.cs
@@ -0,0 +1,35 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+
+namespace System.Windows.Forms {
+
+ public enum TabAlignment {
+ Top,
+ Bottom,
+ Left,
+ Right
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabAppearance.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabAppearance.cs
new file mode 100644
index 00000000000..59a7bd83d73
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabAppearance.cs
@@ -0,0 +1,34 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+
+namespace System.Windows.Forms {
+
+ public enum TabAppearance {
+ Normal,
+ Buttons,
+ FlatButtons
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabControl.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabControl.cs
new file mode 100644
index 00000000000..4124c3ed259
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabControl.cs
@@ -0,0 +1,1226 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Drawing;
+
+
+namespace System.Windows.Forms {
+ [DefaultEvent("SelectedIndexChanged")]
+ [DefaultProperty("TabPages")]
+ [Designer("System.Windows.Forms.Design.TabControlDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+ public class TabControl : Control {
+ #region Fields
+ private int selected_index = -1;
+ private TabAlignment alignment;
+ private TabAppearance appearance;
+ private TabDrawMode draw_mode;
+ private bool multiline;
+ private ImageList image_list;
+ private Size item_size = Size.Empty;
+ private Point padding;
+ private int row_count = 1;
+ private bool hottrack;
+ private TabPageCollection tab_pages;
+ private bool show_tool_tips;
+ private TabSizeMode size_mode;
+ private Rectangle display_rect;
+ private bool show_slider = false;
+ private ButtonState right_slider_state;
+ private ButtonState left_slider_state;
+ private int slider_pos = 0;
+ #endregion // Fields
+
+ #region Public Constructors
+ public TabControl ()
+ {
+ tab_pages = new TabPageCollection (this);
+ SetStyle (ControlStyles.UserPaint, false);
+ padding = ThemeEngine.Current.TabControlDefaultPadding;
+ item_size = ThemeEngine.Current.TabControlDefaultItemSize;
+
+ MouseDown += new MouseEventHandler (MouseDownHandler);
+ MouseUp += new MouseEventHandler (MouseUpHandler);
+ SizeChanged += new EventHandler (SizeChangedHandler);
+ }
+
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ [DefaultValue(TabAlignment.Top)]
+ [Localizable(true)]
+ [RefreshProperties(RefreshProperties.All)]
+ public TabAlignment Alignment {
+ get { return alignment; }
+ set {
+ if (alignment == value)
+ return;
+ alignment = value;
+ if (alignment == TabAlignment.Left || alignment == TabAlignment.Right)
+ multiline = true;
+ Redraw ();
+ }
+ }
+
+ [DefaultValue(TabAppearance.Normal)]
+ [Localizable(true)]
+ public TabAppearance Appearance {
+ get { return appearance; }
+ set {
+ if (appearance == value)
+ return;
+ appearance = value;
+ Redraw ();
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override Color BackColor {
+ get { return base.BackColor; }
+ set { /* nothing happens on set on MS */ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override Image BackgroundImage {
+ get { return base.BackgroundImage; }
+ set { base.BackgroundImage = value; }
+ }
+
+ public override Rectangle DisplayRectangle {
+ get {
+ return ThemeEngine.Current.GetTabControlDisplayRectangle (this);
+ }
+ }
+
+ [DefaultValue(TabDrawMode.Normal)]
+ public TabDrawMode DrawMode {
+ get { return draw_mode; }
+ set {
+ if (draw_mode == value)
+ return;
+ draw_mode = value;
+ Redraw ();
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override Color ForeColor {
+ get { return base.ForeColor; }
+ set { base.ForeColor = value; }
+ }
+
+ [DefaultValue(false)]
+ public bool HotTrack {
+ get { return hottrack; }
+ set {
+ if (hottrack == value)
+ return;
+ hottrack = value;
+ Redraw ();
+ }
+ }
+
+ [DefaultValue(null)]
+ public ImageList ImageList {
+ get { return image_list; }
+ set { image_list = value; }
+ }
+
+ [Localizable(true)]
+ public Size ItemSize {
+ get {
+ return item_size;
+ }
+ set {
+ if (value.Height < 0 || value.Width < 0)
+ throw new ArgumentException ("'" + value + "' is not a valid value for 'ItemSize'.");
+ item_size = value;
+ Redraw ();
+ }
+ }
+
+ [DefaultValue(false)]
+ public bool Multiline {
+ get { return multiline; }
+ set {
+ if (multiline == value)
+ return;
+ multiline = value;
+ if (!multiline && alignment == TabAlignment.Left || alignment == TabAlignment.Right)
+ alignment = TabAlignment.Top;
+ Redraw ();
+ }
+ }
+
+ [Localizable(true)]
+ public Point Padding {
+ get { return padding; }
+ set {
+ if (value.X < 0 || value.Y < 0)
+ throw new ArgumentException ("'" + value + "' is not a valid value for 'Padding'.");
+ if (padding == value)
+ return;
+ padding = value;
+ Redraw ();
+ }
+
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int RowCount {
+ get { return row_count; }
+ }
+
+ [DefaultValue(-1)]
+ [Browsable(false)]
+ public int SelectedIndex {
+ get { return selected_index; }
+ set {
+ if (selected_index == value)
+ return;
+ if (selected_index < -1) {
+ throw new ArgumentException ("'" + value + "' is not a valid value for 'value'. " +
+ "'value' must be greater than or equal to -1.");
+ }
+
+ SuspendLayout ();
+
+ Rectangle invalid = Rectangle.Empty;
+ bool refresh = false;
+
+ if (-1 != value && show_slider && value < slider_pos) {
+ slider_pos = value;
+ refresh = true;
+ }
+
+ int le = TabPages [value].TabBounds.Right;
+ int re = ThemeEngine.Current.GetTabControlLeftScrollRect (this).Left;
+
+ if (-1 != value && show_slider && le > re) {
+ int diff = le - re;
+ int ind = value - 1;
+ while (ind > 0 && diff > 0) {
+ diff -= TabPages [ind++].Width;
+ }
+ slider_pos = ind - 1;
+ refresh = true;
+ }
+
+ if (selected_index != -1) {
+ if (!refresh)
+ invalid = GetTabRect (selected_index);
+ Controls [selected_index].Visible = false;
+ }
+ selected_index = value;
+
+ OnSelectedIndexChanged (EventArgs.Empty);
+
+ TabPage selected = (TabPage) Controls [selected_index];
+
+ if (selected_index != -1) {
+ invalid = Rectangle.Union (invalid, GetTabRect (selected_index));
+ selected.Visible = true;
+ selected.Focus ();
+ }
+
+ ResumeLayout ();
+
+ if (refresh) {
+ SizeTabs ();
+ Refresh ();
+ } else if (selected_index != -1 && selected.Row != BottomRow) {
+ DropRow (TabPages [selected_index].Row);
+ // calculating what to invalidate here seems to be slower then just
+ // refreshing the whole thing
+ SizeTabs ();
+ Refresh ();
+ } else {
+ SizeTabs ();
+ // The lines are drawn on the edges of the tabs so the invalid area should
+ // needs to include the extra pixels of line width.
+ if (appearance == TabAppearance.Normal)
+ invalid.Inflate (6, 4);
+ Invalidate (invalid);
+ }
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public TabPage SelectedTab {
+ get {
+ if (selected_index == -1)
+ return null;
+ return tab_pages [selected_index];
+ }
+ set {
+ int index = IndexForTabPage (value);
+ if (index == selected_index)
+ return;
+ SelectedIndex = index;
+ }
+ }
+
+ [DefaultValue(false)]
+ [Localizable(true)]
+ public bool ShowToolTips {
+ get { return show_tool_tips; }
+ set {
+ if (show_tool_tips == value)
+ return;
+ show_tool_tips = value;
+ Redraw ();
+ }
+ }
+
+ [DefaultValue(TabSizeMode.Normal)]
+ [RefreshProperties(RefreshProperties.Repaint)]
+ public TabSizeMode SizeMode {
+ get { return size_mode; }
+ set {
+ if (size_mode == value)
+ return;
+ size_mode = value;
+ Redraw ();
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int TabCount {
+ get {
+ return tab_pages.Count;
+ }
+ }
+
+ [DefaultValue(null)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ [MergableProperty(false)]
+ public TabPageCollection TabPages {
+ get { return tab_pages; }
+ }
+
+ [Browsable(false)]
+ [Bindable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override string Text {
+ get { return base.Text; }
+ set { base.Text = value; }
+ }
+
+ #endregion // Public Instance Properties
+
+ #region Internal Properties
+ internal bool ShowSlider {
+ get { return show_slider; }
+ set { show_slider = value; }
+ }
+
+ internal int SliderPos {
+ get { return slider_pos; }
+ }
+
+ internal ButtonState RightSliderState {
+ get { return right_slider_state; }
+ }
+
+ internal ButtonState LeftSliderState {
+ get { return left_slider_state; }
+ }
+
+ private Size DefaultItemSize {
+ get {
+ return ThemeEngine.Current.TabControlDefaultItemSize;
+ }
+ }
+
+ #endregion // Internal Properties
+
+ #region Protected Instance Properties
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams c = base.CreateParams;
+ return c;
+ }
+ }
+
+ protected override Size DefaultSize {
+ get { return new Size (200, 100); }
+ }
+
+ #endregion // Protected Instance Properties
+
+ #region Public Instance Methods
+ public Rectangle GetTabRect (int index)
+ {
+ TabPage page = GetTab (index);
+ return page.TabBounds;
+ }
+
+ public Control GetControl (int index)
+ {
+ return GetTab (index);
+ }
+
+ public override string ToString ()
+ {
+ string res = String.Concat (base.ToString (),
+ ", TabPages.Count: ",
+ TabCount);
+ if (TabCount > 0)
+ res = String.Concat (res, ", TabPages[0]: ",
+ TabPages [0]);
+ return res;
+ }
+
+ #endregion // Public Instance Methods
+
+ #region Protected Instance Methods
+ protected override Control.ControlCollection CreateControlsInstance ()
+ {
+ return new TabControl.ControlCollection (this);
+ }
+
+ protected void UpdateTabSelection (bool uiselected)
+ {
+ ResizeTabPages ();
+ }
+
+ protected override void CreateHandle ()
+ {
+ base.CreateHandle ();
+ ResizeTabPages ();
+ }
+
+ protected override void OnHandleCreated (EventArgs e)
+ {
+ base.OnHandleCreated (e);
+ }
+
+ protected override void OnHandleDestroyed (EventArgs e)
+ {
+ base.OnHandleDestroyed (e);
+ }
+
+ protected virtual void OnDrawItem (DrawItemEventArgs e)
+ {
+ if (DrawItem != null && DrawMode == TabDrawMode.OwnerDrawFixed)
+ DrawItem (this, e);
+ }
+
+ internal void OnDrawItemInternal (DrawItemEventArgs e)
+ {
+ OnDrawItem (e);
+ }
+
+ protected override void OnFontChanged (EventArgs e)
+ {
+ base.OnFontChanged (e);
+ ResizeTabPages ();
+ }
+
+ protected override void OnResize (EventArgs e)
+ {
+ base.OnResize (e);
+ }
+
+ protected override void OnStyleChanged (EventArgs e)
+ {
+ base.OnStyleChanged (e);
+ }
+
+ protected override bool ProcessKeyPreview (ref Message m)
+ {
+ if (ProcessKeyEventArgs (ref m))
+ return true;
+ return base.ProcessKeyPreview (ref m);
+ }
+
+ protected override void OnKeyDown (KeyEventArgs e)
+ {
+ if (e.KeyCode == Keys.Tab && (e.KeyData & Keys.Control) != 0) {
+ if ((e.KeyData & Keys.Shift) == 0)
+ SelectedIndex = (SelectedIndex + 1) % TabCount;
+ else
+ SelectedIndex = (SelectedIndex - 1) % TabCount;
+ e.Handled = true;
+ } else if (e.KeyCode == Keys.Home) {
+ SelectedIndex = 0;
+ e.Handled = true;
+ } else if (e.KeyCode == Keys.End) {
+ SelectedIndex = TabCount - 1;
+ e.Handled = true;
+ } else if (e.KeyCode == Keys.Left && SelectedIndex > 0) {
+ SelectedIndex--;
+ e.Handled = true;
+ } else if (e.KeyCode == Keys.Right && SelectedIndex < TabCount - 1) {
+ SelectedIndex++;
+ e.Handled = true;
+ }
+
+ base.OnKeyDown (e);
+ }
+
+ protected override bool IsInputKey (Keys key)
+ {
+ switch (key & Keys.KeyCode) {
+ case Keys.Home:
+ case Keys.End:
+ case Keys.Left:
+ case Keys.Right:
+ case Keys.Tab:
+ return true;
+ }
+ return base.IsInputKey (key);
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ base.Dispose (disposing);
+ }
+
+ protected void RemoveAll ()
+ {
+ Controls.Clear ();
+ }
+
+ protected virtual object [] GetItems ()
+ {
+ TabPage [] pages = new TabPage [Controls.Count];
+ Controls.CopyTo (pages, 0);
+ return pages;
+ }
+
+ protected virtual object [] GetItems (Type type)
+ {
+ object [] pages = (object []) Array.CreateInstance (type, Controls.Count);
+ Controls.CopyTo (pages, 0);
+ return pages;
+ }
+
+ protected string GetToolTipText (object item)
+ {
+ TabPage page = (TabPage) item;
+ return page.ToolTipText;
+ }
+
+ protected override void WndProc (ref Message m)
+ {
+ switch ((Msg) m.Msg) {
+ case Msg.WM_PAINT:
+ PaintEventArgs paint_event;
+ paint_event = XplatUI.PaintEventStart (Handle, true);
+ PaintInternal (paint_event);
+ XplatUI.PaintEventEnd (Handle, true);
+ break;
+ default:
+ base.WndProc (ref m);
+ break;
+ }
+ }
+
+ protected virtual void OnSelectedIndexChanged (EventArgs e)
+ {
+ if (SelectedIndexChanged != null)
+ SelectedIndexChanged (this, e);
+ }
+
+ #endregion // Protected Instance Methods
+
+ #region Internal & Private Methods
+ private bool CanScrollRight {
+ get {
+ return (slider_pos < TabCount - 1);
+ }
+ }
+
+ private bool CanScrollLeft {
+ get { return slider_pos > 0; }
+ }
+
+ private void MouseDownHandler (object sender, MouseEventArgs e)
+ {
+ if (ShowSlider) {
+ Rectangle right = ThemeEngine.Current.GetTabControlRightScrollRect (this);
+ Rectangle left = ThemeEngine.Current.GetTabControlLeftScrollRect (this);
+ if (right.Contains (e.X, e.Y)) {
+ right_slider_state = ButtonState.Pushed;
+ if (CanScrollRight) {
+ slider_pos++;
+ SizeTabs ();
+
+ Invalidate (new Rectangle (0, 0, Width, DisplayRectangle.Top));
+ } else {
+ Invalidate (right);
+ }
+ return;
+ } else if (left.Contains (e.X, e.Y)) {
+ left_slider_state = ButtonState.Pushed;
+ if (CanScrollLeft) {
+ slider_pos--;
+ SizeTabs ();
+
+ Invalidate (new Rectangle (0, 0, Width, DisplayRectangle.Top));
+ } else {
+ Invalidate (left);
+ }
+ return;
+ }
+ }
+
+ int count = Controls.Count;
+ for (int i = SliderPos; i < count; i++) {
+ if (!GetTabRect (i).Contains (e.X, e.Y))
+ continue;
+ SelectedIndex = i;
+ break;
+ }
+ }
+
+ private void MouseUpHandler (object sender, MouseEventArgs e)
+ {
+ if (ShowSlider && (left_slider_state == ButtonState.Pushed || right_slider_state == ButtonState.Pushed)) {
+ Rectangle invalid;
+ if (left_slider_state == ButtonState.Pushed)
+ invalid = ThemeEngine.Current.GetTabControlLeftScrollRect (this);
+ else
+ invalid = ThemeEngine.Current.GetTabControlRightScrollRect (this);
+ left_slider_state = ButtonState.Normal;
+ right_slider_state = ButtonState.Normal;
+
+ Invalidate (invalid);
+ }
+ }
+
+ private void SizeChangedHandler (object sender, EventArgs e)
+ {
+ ResizeTabPages ();
+ }
+
+ internal void UpdateTabpage (TabPage page)
+ {
+
+ }
+
+ internal int IndexForTabPage (TabPage page)
+ {
+ for (int i = 0; i < tab_pages.Count; i++) {
+ if (page == tab_pages [i])
+ return i;
+ }
+ return -1;
+ }
+
+ private void ResizeTabPages ()
+ {
+ CalcTabRows ();
+ SizeTabs ();
+ Rectangle r = DisplayRectangle;
+ foreach (TabPage page in Controls) {
+ page.Bounds = r;
+ }
+ }
+
+ private int MinimumTabWidth {
+ get {
+ return ThemeEngine.Current.TabControlMinimumTabWidth;
+ }
+ }
+
+ private Size TabSpacing {
+ get {
+ return ThemeEngine.Current.TabControlGetSpacing (this);
+ }
+ }
+
+ private void CalcTabRows ()
+ {
+ switch (Alignment) {
+ case TabAlignment.Right:
+ case TabAlignment.Left:
+ CalcTabRows (Height);
+ break;
+ default:
+ CalcTabRows (Width);
+ break;
+ }
+ }
+
+ private void CalcTabRows (int row_width)
+ {
+ int xpos = 4;
+ Size spacing = TabSpacing;
+
+ row_count = 1;
+ show_slider = false;
+
+ for (int i = 0; i < TabPages.Count; i++) {
+ TabPage page = TabPages [i];
+ int width;
+
+ page.Row = 1;
+
+ if (SizeMode == TabSizeMode.Fixed) {
+ width = item_size.Width;
+ } else {
+ width = (int) DeviceContext.MeasureString (page.Text, Font).Width + (Padding.X * 2);
+ }
+
+ if (i == SelectedIndex)
+ width += 8;
+ if (width < MinimumTabWidth)
+ width = MinimumTabWidth;
+
+ if (xpos + width > row_width && multiline) {
+ xpos = 4;
+ for (int j = 0; j < i; j++) {
+ TabPages [j].Row++;
+ }
+ row_count++;
+ } else if (xpos + width > row_width) {
+ show_slider = true;
+ }
+
+ xpos += width + 1 + spacing.Width;
+ }
+
+ if (SelectedIndex != -1 && TabPages [SelectedIndex].Row != BottomRow)
+ DropRow (TabPages [SelectedIndex].Row);
+ }
+
+ private int BottomRow {
+ get {
+ switch (Alignment) {
+ case TabAlignment.Right:
+ case TabAlignment.Bottom:
+ return row_count;
+ default:
+ return 1;
+ }
+ }
+ }
+
+ private int Direction
+ {
+ get {
+ switch (Alignment) {
+ case TabAlignment.Right:
+ case TabAlignment.Bottom:
+ return -1;
+ default:
+ return 1;
+ }
+ }
+ }
+
+ private void DropRow (int row)
+ {
+ int bottom = BottomRow;
+ int direction = Direction;
+
+ foreach (TabPage page in TabPages) {
+ if (page.Row == row) {
+ page.Row = bottom;
+ } else if (direction == 1 && page.Row < row) {
+ page.Row += direction;
+ } else if (direction == -1 && page.Row > row) {
+ page.Row += direction;
+ }
+ }
+ }
+
+ private int CalcYPos ()
+ {
+ if (Alignment == TabAlignment.Bottom) {
+ Rectangle r = ThemeEngine.Current.GetTabControlDisplayRectangle (this);
+ return r.Bottom + 3;
+ }
+ return 1;
+ }
+
+ private int CalcXPos ()
+ {
+ if (Alignment == TabAlignment.Right) {
+ Rectangle r = ThemeEngine.Current.GetTabControlDisplayRectangle (this);
+ return r.Right + 4;
+ }
+ return 4;
+
+ }
+
+ private void SizeTabs ()
+ {
+ switch (Alignment) {
+ case TabAlignment.Right:
+ case TabAlignment.Left:
+ SizeTabsV (Height);
+ break;
+ default:
+ SizeTabs (Width);
+ break;
+ }
+ }
+
+ private void SizeTabsV (int row_width)
+ {
+ int ypos = 1;
+ int prev_row = 1;
+ Size spacing = TabSpacing;
+ int xpos = CalcXPos ();
+ int begin_prev = 0;
+
+ if (TabPages.Count == 0)
+ return;
+
+ prev_row = TabPages [0].Row;
+
+ for (int i = 0; i < TabPages.Count; i++) {
+ TabPage page = TabPages [i];
+ int width;
+
+ if (SizeMode == TabSizeMode.Fixed) {
+ width = item_size.Width;
+ } else {
+ width = (int) DeviceContext.MeasureString (page.Text, Font).Width + (Padding.X * 2);
+ }
+
+ if (width < MinimumTabWidth)
+ width = MinimumTabWidth;
+ if (page.Row != prev_row)
+ ypos = 1;
+
+ page.TabBounds = new Rectangle (xpos + (row_count - page.Row) * ((item_size.Height - 2) + spacing.Width),
+ ypos, item_size.Height - 2, width);
+
+ if (page.Row != prev_row) {
+ if (SizeMode == TabSizeMode.FillToRight && !ShowSlider) {
+ FillRowV (begin_prev, i - 1, ((row_width - TabPages [i - 1].TabBounds.Bottom) / (i - begin_prev)), spacing);
+ }
+ begin_prev = i;
+ }
+
+ ypos += width + spacing.Width;
+ prev_row = page.Row;
+ }
+
+ if (SizeMode == TabSizeMode.FillToRight && !ShowSlider) {
+ FillRowV (begin_prev, TabPages.Count - 1,
+ ((row_width - TabPages [TabPages.Count - 1].TabBounds.Bottom) / (TabPages.Count - begin_prev)), spacing);
+ }
+
+ if (SelectedIndex != -1) {
+ ExpandSelected (TabPages [SelectedIndex], 2, row_width - 1);
+ }
+ }
+
+ private void SizeTabs (int row_width)
+ {
+ int ypos = CalcYPos ();
+ int prev_row = 1;
+ Size spacing = TabSpacing;
+ int xpos = 4;
+ int begin_prev = 0;
+
+ if (TabPages.Count == 0)
+ return;
+
+ prev_row = TabPages [0].Row;
+
+ // Reset the slider position if the slider isn't needed
+ // anymore (ie window size was increased so all tabs are visible)
+ if (!show_slider)
+ slider_pos = 0;
+
+ for (int i = slider_pos; i < TabPages.Count; i++) {
+ TabPage page = TabPages [i];
+ int width;
+
+ if (SizeMode == TabSizeMode.Fixed) {
+ width = item_size.Width;
+ } else {
+ width = (int) DeviceContext.MeasureString (page.Text, Font).Width + (Padding.X * 2);
+ }
+
+ if (width < MinimumTabWidth)
+ width = MinimumTabWidth;
+ if (page.Row != prev_row)
+ xpos = 4;
+
+ page.TabBounds = new Rectangle (xpos,
+ ypos + (row_count - page.Row) * (item_size.Height + spacing.Height),
+ width, item_size.Height);
+
+ if (page.Row != prev_row) {
+ if (SizeMode == TabSizeMode.FillToRight && !ShowSlider) {
+ FillRow (begin_prev, i - 1, ((row_width - TabPages [i - 1].TabBounds.Right) / (i - begin_prev)), spacing);
+ }
+ begin_prev = i;
+ }
+
+ xpos += width + 1 + spacing.Width;
+ prev_row = page.Row;
+ }
+
+ if (SizeMode == TabSizeMode.FillToRight && !ShowSlider) {
+ FillRow (begin_prev, TabPages.Count - 1,
+ ((row_width - TabPages [TabPages.Count - 1].TabBounds.Right) / (TabPages.Count - begin_prev)), spacing);
+ }
+
+ if (SelectedIndex != -1) {
+ ExpandSelected (TabPages [SelectedIndex], 2, row_width - 1);
+ }
+ }
+
+ private void FillRow (int start, int end, int amount, Size spacing)
+ {
+ int xpos = TabPages [start].TabBounds.Left;
+ for (int i = start; i <= end; i++) {
+ TabPage page = TabPages [i];
+ int left = xpos;
+ int width = (i == end ? Width - left - 3 : page.TabBounds.Width + amount);
+
+ page.TabBounds = new Rectangle (left, page.TabBounds.Top,
+ width, page.TabBounds.Height);
+ xpos = page.TabBounds.Right + 1 + spacing.Width;
+ }
+ }
+
+ private void FillRowV (int start, int end, int amount, Size spacing)
+ {
+ int ypos = TabPages [start].TabBounds.Top;
+ for (int i = start; i <= end; i++) {
+ TabPage page = TabPages [i];
+ int top = ypos;
+ int height = (i == end ? Height - top - 5 : page.TabBounds.Height + amount);
+
+ page.TabBounds = new Rectangle (page.TabBounds.Left, top,
+ page.TabBounds.Width, height);
+ ypos = page.TabBounds.Bottom + 1;
+ }
+ }
+
+ private void ExpandSelected (TabPage page, int left_edge, int right_edge)
+ {
+ if (Appearance != TabAppearance.Normal)
+ return;
+
+ if (Alignment == TabAlignment.Top || Alignment == TabAlignment.Bottom) {
+ int l = page.TabBounds.Left - 4;
+ int r = page.TabBounds.Right + 4;
+ int y = page.TabBounds.Y;
+ int h = page.TabBounds.Height + 3;
+
+ if (l < left_edge)
+ l = left_edge;
+ if (r > right_edge && SizeMode != TabSizeMode.Normal)
+ r = right_edge;
+ if (Alignment == TabAlignment.Top)
+ y -= 1;
+ if (Alignment == TabAlignment.Bottom)
+ y -= 2;
+
+ page.TabBounds = new Rectangle (l, y, r - l, h);
+ } else {
+ int l = page.TabBounds.Left - 3;
+ int r = page.TabBounds.Right + 3;
+ int t = page.TabBounds.Top - 3;
+ int b = page.TabBounds.Bottom + 3;
+
+ if (t < left_edge)
+ t = left_edge;
+ if (b > right_edge)
+ b = right_edge;
+
+ page.TabBounds = new Rectangle (l, t, r - l, b - t);
+ }
+ }
+
+ private void PaintInternal (PaintEventArgs pe)
+ {
+ Draw (pe.Graphics, pe.ClipRectangle);
+ // On MS the Paint event never seems to be raised
+ }
+
+ private void Draw (Graphics dc, Rectangle clip)
+ {
+ ThemeEngine.Current.DrawTabControl (dc, clip, this);
+ }
+
+ private TabPage GetTab (int index)
+ {
+ return Controls [index] as TabPage;
+ }
+
+ private void SetTab (int index, TabPage value)
+ {
+ ((IList) Controls).Insert (index, value);
+ Redraw ();
+ }
+
+ internal void Redraw ()
+ {
+ ResizeTabPages ();
+ Refresh ();
+ }
+
+ #endregion // Internal & Private Methods
+
+ #region Events
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler BackColorChanged {
+ add { base.BackColorChanged += value; }
+ remove { base.BackColorChanged -= value; }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler BackgroundImageChanged {
+ add { base.BackgroundImageChanged += value; }
+ remove { base.BackgroundImageChanged -= value; }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler ForeColorChanged {
+ add { base.ForeColorChanged += value; }
+ remove { base.ForeColorChanged -= value; }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event PaintEventHandler Paint {
+ add { base.Paint += value; }
+ remove { base.Paint -= value; }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler TextChanged {
+ add { base.TextChanged += value; }
+ remove { base.TextChanged -= value; }
+ }
+
+ public event DrawItemEventHandler DrawItem;
+ public event EventHandler SelectedIndexChanged;
+ #endregion // Events
+
+
+ #region Class TaControl.ControlCollection
+ public class ControlCollection : System.Windows.Forms.Control.ControlCollection {
+
+ private TabControl owner;
+ private ArrayList list = new ArrayList ();
+
+ public ControlCollection (TabControl owner) : base (owner)
+ {
+ this.owner = owner;
+ }
+
+ public override void Add (Control value)
+ {
+ if (!(value is TabPage))
+ throw new ArgumentException ("Cannot add " +
+ value.GetType ().Name + " to TabControl. " +
+ "Only TabPages can be directly added to TabControls.");
+
+ value.Visible = false;
+ base.Add (value);
+ if (Count == 1) {
+ owner.SelectedIndex = 0;
+ } else {
+ // Setting the selected index will calc the tab rows so
+ // we don't need to do it again
+ owner.ResizeTabPages ();
+ }
+ }
+
+ public override void Remove (Control value)
+ {
+ TabPage page = value as TabPage;
+ if (page != null) {
+ int index = owner.IndexForTabPage (page);
+ if (index == owner.SelectedIndex)
+ owner.SelectedIndex = (index + 1) % owner.TabCount;
+ }
+ base.Remove (value);
+ }
+ }
+ #endregion // Class TabControl.ControlCollection
+
+ #region Class TabPage.TabPageCollection
+ public class TabPageCollection : IList, ICollection, IEnumerable {
+
+ private TabControl owner;
+ private IList controls;
+
+ public TabPageCollection (TabControl owner)
+ {
+ if (owner == null)
+ throw new ArgumentNullException ("Value cannot be null.");
+ this.owner = owner;
+ controls = owner.Controls;
+ }
+
+ [Browsable(false)]
+ public virtual int Count {
+ get { return owner.Controls.Count; }
+ }
+
+ public virtual bool IsReadOnly {
+ get { return false; }
+ }
+
+ public virtual TabPage this [int index] {
+ get {
+ return owner.GetTab (index);
+ }
+ set {
+ owner.SetTab (index, value);
+ }
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return false; }
+ }
+
+ object ICollection.SyncRoot {
+ get { return this; }
+ }
+
+ bool IList.IsFixedSize {
+ get { return false; }
+ }
+
+ object IList.this [int index] {
+ get {
+ return owner.GetTab (index);
+ }
+ set {
+ owner.SetTab (index, (TabPage) value);
+ }
+ }
+
+ public void Add (TabPage page)
+ {
+ if (page == null)
+ throw new ArgumentNullException ("Value cannot be null.");
+ owner.Controls.Add (page);
+ }
+
+ public void AddRange (TabPage [] pages)
+ {
+ if (pages == null)
+ throw new ArgumentNullException ("Value cannot be null.");
+ owner.Controls.AddRange (pages);
+ }
+
+ public virtual void Clear ()
+ {
+ owner.Controls.Clear ();
+ }
+
+ public bool Contains (TabPage page)
+ {
+ if (page == null)
+ throw new ArgumentNullException ("Value cannot be null.");
+ return owner.Controls.Contains (page);
+ }
+
+ public virtual IEnumerator GetEnumerator ()
+ {
+ return owner.Controls.GetEnumerator ();
+ }
+
+ public int IndexOf (TabPage page)
+ {
+ return owner.Controls.IndexOf (page);
+ }
+
+ public void Remove (TabPage page)
+ {
+ owner.Controls.Remove (page);
+ }
+
+ public virtual void RemoveAt (int index)
+ {
+ owner.Controls.RemoveAt (index);
+ }
+
+ void ICollection.CopyTo (Array dest, int index)
+ {
+ owner.Controls.CopyTo (dest, index);
+ }
+
+ int IList.Add (object value)
+ {
+ TabPage page = value as TabPage;
+ if (value == null)
+ throw new ArgumentException ("value");
+ owner.Controls.Add (page);
+ return owner.Controls.IndexOf (page);
+ }
+
+ bool IList.Contains (object value)
+ {
+ TabPage page = value as TabPage;
+ if (page == null)
+ return false;
+ return Contains (page);
+ }
+
+ int IList.IndexOf (object value)
+ {
+ TabPage page = value as TabPage;
+ if (page == null)
+ return -1;
+ return IndexOf ((TabPage) page);
+ }
+
+ void IList.Insert (int index, object value)
+ {
+ throw new NotSupportedException ();
+ }
+
+ void IList.Remove (object value)
+ {
+ TabPage page = value as TabPage;
+ if (page == null)
+ return;
+ Remove ((TabPage) value);
+ }
+ }
+ #endregion // Class TabPage.TabPageCollection
+ }
+}
+
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabDrawMode.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabDrawMode.cs
new file mode 100644
index 00000000000..8de82769517
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabDrawMode.cs
@@ -0,0 +1,33 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+
+namespace System.Windows.Forms {
+
+ public enum TabDrawMode {
+ Normal,
+ OwnerDrawFixed
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabPage.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabPage.cs
new file mode 100644
index 00000000000..ded9913a101
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabPage.cs
@@ -0,0 +1,269 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+ [DefaultEvent("Click")]
+ [DesignTimeVisible(false)]
+ [DefaultProperty("Text")]
+ [Designer("System.Windows.Forms.Design.TabPageDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+ [ToolboxItem(false)]
+ public class TabPage : Panel {
+ #region Fields
+ private int image_index = -1;
+ private string tooltip_text = String.Empty;
+ private Rectangle tab_bounds;
+ private int row;
+ #endregion // Fields
+
+ #region Public Constructors
+ public TabPage ()
+ {
+ Visible = true;
+
+ SetStyle (ControlStyles.CacheText, true);
+ }
+
+ public TabPage (string text) : base ()
+ {
+ base.Text = text;
+ }
+
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override AnchorStyles Anchor {
+ get { return base.Anchor; }
+ set { base.Anchor = value; }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override DockStyle Dock {
+ get { return base.Dock; }
+ set { base.Dock = value; }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new bool Enabled {
+ get { return base.Enabled; }
+ set { base.Enabled = value; }
+ }
+
+ [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 (image_index == value)
+ return;
+ image_index = value;
+ UpdateOwner ();
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new int TabIndex {
+ get { return base.TabIndex; }
+ set { base.TabIndex = value; }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new bool TabStop {
+ get { return base.TabStop; }
+ set { base.TabStop = value; }
+ }
+
+ [Browsable(true)]
+ [Localizable(true)]
+ public override string Text {
+ get { return base.Text; }
+ set {
+ if (value == base.Text)
+ return;
+ base.Text = value;
+ UpdateOwner ();
+ }
+ }
+
+ [Localizable(true)]
+ [DefaultValue("")]
+ public string ToolTipText {
+ get { return tooltip_text; }
+ set {
+ if (value == null)
+ value = String.Empty;
+ tooltip_text = value;
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new bool Visible {
+ get { return base.Visible; }
+ set { base.Visible = value; }
+ }
+
+ #endregion // Public Instance Properties
+
+ #region Public Static Methods
+ public static TabPage GetTabPageOfComponent (object comp)
+ {
+ Control control = comp as Control;
+ if (control == null)
+ return null;
+ control = control.Parent;
+ while (control != null) {
+ if (control is TabPage)
+ break;
+ control = control.Parent;
+ }
+ return control as TabPage;
+ }
+
+ #endregion // Public Static Methods
+
+ #region Public Instance Methods
+ public override string ToString ()
+ {
+ return "TabPage: {" + Text + "}";
+ }
+
+ #endregion // Public Instance Methods
+
+ #region Internal & Private Methods and Properties
+ internal Rectangle TabBounds {
+ get { return tab_bounds; }
+ set { tab_bounds = value; }
+ }
+
+ internal int Row {
+ get { return row; }
+ set { row = value; }
+ }
+
+ private void UpdateOwner ()
+ {
+ if (Owner != null) {
+ Owner.Redraw ();
+ }
+ }
+
+ private TabControl Owner {
+ get { return base.Parent as TabControl; }
+ }
+
+ #endregion // Internal & Private Methods and Properties
+
+ #region Protected Instance Methods
+ protected override ControlCollection CreateControlsInstance ()
+ {
+ return new TabPageControlCollection (this);
+ }
+
+ protected override void SetBoundsCore (int x, int y, int width, int height, BoundsSpecified specified)
+ {
+ if (Owner != null && Owner.IsHandleCreated) {
+ Rectangle display = Owner.DisplayRectangle;
+
+ base.SetBoundsCore (display.X, display.Y,
+ display.Width, display.Height,
+ BoundsSpecified.All);
+ } else {
+ base.SetBoundsCore (x, y, width, height, specified);
+ }
+ }
+
+ #endregion // Protected Instance Methods
+
+ #region Events
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler DockChanged {
+ add { base.DockChanged += value; }
+ remove { base.DockChanged -= value; }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler EnabledChanged {
+ add { base.EnabledChanged += value; }
+ remove { base.EnabledChanged -= value; }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler TabIndexChanged {
+ add { base.TabIndexChanged += value; }
+ remove { base.TabIndexChanged -= value; }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler TabStopChanged {
+ add { base.TabStopChanged += value; }
+ remove { base.TabStopChanged -= value; }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler VisibleChanged {
+ add { base.VisibleChanged += value; }
+ remove { base.VisibleChanged -= value; }
+ }
+
+ #endregion // Events
+
+ #region Class TabPageControlCollection
+ public class TabPageControlCollection : ControlCollection {
+
+ private TabPage owner;
+
+ public TabPageControlCollection (TabPage owner) : base (owner)
+ {
+ this.owner = owner;
+ }
+
+ public override void Add (Control value)
+ {
+ base.Add (value);
+ }
+ }
+ #endregion // Class TabPageControlCollection
+ }
+
+
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabSizeMode.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabSizeMode.cs
new file mode 100644
index 00000000000..45cf1508950
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabSizeMode.cs
@@ -0,0 +1,34 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+
+namespace System.Windows.Forms {
+
+ public enum TabSizeMode {
+ Normal,
+ FillToRight,
+ Fixed
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBox.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBox.cs
new file mode 100644
index 00000000000..9c4857f011f
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBox.cs
@@ -0,0 +1,218 @@
+// 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-2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+// NOT COMPLETE
+
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+ public class TextBox : TextBoxBase {
+ #region Public Constructors
+ public TextBox() {
+ scrollbars = RichTextBoxScrollBars.None;
+ alignment = HorizontalAlignment.Left;
+ this.LostFocus +=new EventHandler(TextBox_LostFocus);
+ this.BackColor = ThemeEngine.Current.ColorWindow;
+ this.ForeColor = ThemeEngine.Current.ColorWindowText;
+
+ SetStyle (ControlStyles.StandardClick | ControlStyles.StandardDoubleClick, false);
+ SetStyle (ControlStyles.FixedHeight, true);
+ }
+ #endregion // Public Constructors
+
+
+ #region Private & Internal Methods
+ private void TextBox_LostFocus(object sender, EventArgs e) {
+ has_focus = false;
+ Invalidate();
+ }
+ #endregion // Private & Internal Methods
+
+ #region Public Instance Properties
+ [DefaultValue(false)]
+ public bool AcceptsReturn {
+ get {
+ return accepts_return;
+ }
+
+ set {
+ if (value != accepts_return) {
+ accepts_return = value;
+ }
+ }
+ }
+
+ [DefaultValue(CharacterCasing.Normal)]
+ public CharacterCasing CharacterCasing {
+ get {
+ return character_casing;
+ }
+
+ set {
+ if (value != character_casing) {
+ character_casing = value;
+ }
+ }
+ }
+
+ [Localizable(true)]
+ [DefaultValue('\0')]
+ public char PasswordChar {
+ get {
+ return password_char;
+ }
+
+ set {
+ if (value != password_char) {
+ password_char = value;
+ if (!multiline) {
+ document.PasswordChar = value.ToString();
+ } else {
+ document.PasswordChar = "";
+ }
+ }
+ }
+ }
+
+ [DefaultValue(ScrollBars.None)]
+ [Localizable(true)]
+ public ScrollBars ScrollBars {
+ get {
+ return (ScrollBars)scrollbars;
+ }
+
+ set {
+ if (value != (ScrollBars)scrollbars) {
+ scrollbars = (RichTextBoxScrollBars)value;
+ base.CalculateScrollBars();
+ }
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public override int SelectionLength {
+ get {
+ return base.SelectionLength;
+ }
+ set {
+ base.SelectionLength = value;
+ }
+ }
+
+
+ public override string Text {
+ get {
+ return base.Text;
+ }
+
+ set {
+ base.Text = value;
+ }
+ }
+
+ [DefaultValue(HorizontalAlignment.Left)]
+ [Localizable(true)]
+ public HorizontalAlignment TextAlign {
+ get {
+ return alignment;
+ }
+
+ set {
+ if (value != alignment) {
+ alignment = value;
+
+ // MS word-wraps if alignment isn't left
+ if (multiline) {
+ if (alignment != HorizontalAlignment.Left) {
+ document.Wrap = true;
+ } else {
+ document.Wrap = word_wrap;
+ }
+ }
+
+ for (int i = 1; i <= document.Lines; i++) {
+ document.GetLine(i).Alignment = value;
+ }
+ document.RecalculateDocument(CreateGraphics());
+ OnTextAlignChanged(EventArgs.Empty);
+ }
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Protected Instance Methods
+ protected override CreateParams CreateParams {
+ get {
+ return base.CreateParams;
+ }
+ }
+
+ protected override ImeMode DefaultImeMode {
+ get {
+ return base.DefaultImeMode;
+ }
+ }
+ #endregion // Protected Instance Methods
+
+ #region Protected Instance Methods
+ protected override bool IsInputKey(Keys keyData) {
+ return base.IsInputKey (keyData);
+ }
+
+ protected override void OnGotFocus(EventArgs e) {
+ has_focus=true;
+ Invalidate();
+ base.OnGotFocus (e);
+ }
+
+ protected override void OnHandleCreated(EventArgs e) {
+ base.OnHandleCreated (e);
+ }
+
+ protected override void OnMouseUp(MouseEventArgs e) {
+ base.OnMouseUp (e);
+ }
+
+ protected virtual void OnTextAlignChanged(EventArgs e) {
+ if (TextAlignChanged != null) {
+ TextAlignChanged(this, e);
+ }
+ }
+
+ protected override void WndProc(ref Message m) {
+ base.WndProc(ref m);
+ }
+ #endregion // Protected Instance Methods
+
+ #region Events
+ public event EventHandler TextAlignChanged;
+ #endregion // Events
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs
new file mode 100644
index 00000000000..f03de748c48
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs
@@ -0,0 +1,1641 @@
+// 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-2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+// NOT COMPLETE
+#undef Debug
+#undef DebugClick
+
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Drawing;
+using System.Drawing.Text;
+using System.Text;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [DefaultEvent("TextChanged")]
+ [Designer("System.Windows.Forms.Design.TextBoxBaseDesigner, " + Consts.AssemblySystem_Design)]
+ public abstract class TextBoxBase : Control {
+ #region Local Variables
+ internal HorizontalAlignment alignment;
+ internal bool accepts_tab;
+ internal bool accepts_return;
+ internal bool auto_size;
+ internal CharacterCasing character_casing;
+ internal bool undo;
+ internal bool hide_selection;
+ internal int max_length;
+ internal bool modified;
+ internal bool multiline;
+ internal char password_char;
+ internal bool read_only;
+ internal bool word_wrap;
+ internal Document document;
+ internal LineTag caret_tag; // tag our cursor is in
+ internal int caret_pos; // position on the line our cursor is in (can be 0 = beginning of line)
+ internal ImplicitHScrollBar hscroll;
+ internal ImplicitVScrollBar vscroll;
+ internal RichTextBoxScrollBars scrollbars;
+ internal bool richtext;
+ internal int requested_height;
+ internal int canvas_width;
+ internal int canvas_height;
+ internal int track_width = 20;
+ internal DateTime click_last;
+ internal CaretSelection click_mode;
+ #if Debug
+ internal static bool draw_lines = false;
+ #endif
+
+ #endregion // Local Variables
+
+ #region Internal Constructor
+ // Constructor will go when complete, only for testing - pdb
+ internal TextBoxBase() {
+ alignment = HorizontalAlignment.Left;
+ accepts_return = false;
+ accepts_tab = false;
+ auto_size = true;
+ border_style = BorderStyle.Fixed3D;
+ character_casing = CharacterCasing.Normal;
+ undo = false;
+ hide_selection = true;
+ max_length = 32767;
+ modified = false;
+ multiline = false;
+ password_char = '\0';
+ read_only = false;
+ word_wrap = true;
+ richtext = false;
+ document = new Document(this);
+ document.WidthChanged += new EventHandler(document_WidthChanged);
+ document.HeightChanged += new EventHandler(document_HeightChanged);
+ //document.CaretMoved += new EventHandler(CaretMoved);
+ document.Wrap = false;
+ requested_height = -1;
+ click_last = DateTime.Now;
+ click_mode = CaretSelection.Position;
+
+ MouseDown += new MouseEventHandler(TextBoxBase_MouseDown);
+ MouseUp += new MouseEventHandler(TextBoxBase_MouseUp);
+ MouseMove += new MouseEventHandler(TextBoxBase_MouseMove);
+ SizeChanged += new EventHandler(TextBoxBase_SizeChanged);
+ FontChanged += new EventHandler(TextBoxBase_FontOrColorChanged);
+ ForeColorChanged += new EventHandler(TextBoxBase_FontOrColorChanged);
+ MouseWheel += new MouseEventHandler(TextBoxBase_MouseWheel);
+
+ scrollbars = RichTextBoxScrollBars.None;
+
+ hscroll = new ImplicitHScrollBar();
+ hscroll.ValueChanged += new EventHandler(hscroll_ValueChanged);
+ hscroll.control_style &= ~ControlStyles.Selectable;
+ hscroll.Enabled = false;
+ hscroll.Visible = false;
+
+ vscroll = new ImplicitVScrollBar();
+ vscroll.ValueChanged += new EventHandler(vscroll_ValueChanged);
+ vscroll.control_style &= ~ControlStyles.Selectable;
+ vscroll.Enabled = false;
+ vscroll.Visible = false;
+
+ SuspendLayout ();
+ this.Controls.AddImplicit (hscroll);
+ this.Controls.AddImplicit (vscroll);
+ ResumeLayout ();
+
+ //SetStyle(ControlStyles.ResizeRedraw, true);
+ SetStyle(ControlStyles.UserPaint | ControlStyles.StandardClick, false);
+
+ canvas_width = ClientSize.Width;
+ canvas_height = ClientSize.Height;
+
+ CalculateScrollBars();
+ }
+ #endregion // Internal Constructor
+
+ #region Private and Internal Methods
+ internal string CaseAdjust(string s) {
+ if (character_casing == CharacterCasing.Normal) {
+ return s;
+ }
+ if (character_casing == CharacterCasing.Lower) {
+ return s.ToLower();
+ } else {
+ return s.ToUpper();
+ }
+ }
+ #endregion // Private and Internal Methods
+
+ #region Public Instance Properties
+ [DefaultValue(false)]
+ public bool AcceptsTab {
+ get {
+ return accepts_tab;
+ }
+
+ set {
+ if (value != accepts_tab) {
+ accepts_tab = value;
+ OnAcceptsTabChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ [DefaultValue(true)]
+ [Localizable(true)]
+ [RefreshProperties(RefreshProperties.Repaint)]
+ public virtual bool AutoSize {
+ get {
+ return auto_size;
+ }
+
+ set {
+ if (value != auto_size) {
+ auto_size = value;
+ if (auto_size) {
+ if (PreferredHeight != ClientSize.Height) {
+ ClientSize = new Size(ClientSize.Width, PreferredHeight);
+ }
+ }
+ OnAutoSizeChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ [DispId(-501)]
+ public override System.Drawing.Color BackColor {
+ get {
+ return base.BackColor;
+ }
+ set {
+ base.BackColor = value;
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override System.Drawing.Image BackgroundImage {
+ get {
+ return base.BackgroundImage;
+ }
+ set {
+ base.BackgroundImage = value;
+ }
+ }
+
+ [DefaultValue(BorderStyle.Fixed3D)]
+ [DispId(-504)]
+ public BorderStyle BorderStyle {
+ get { return InternalBorderStyle; }
+ set {
+ InternalBorderStyle = value;
+ OnBorderStyleChanged(EventArgs.Empty);
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool CanUndo {
+ get {
+ return undo;
+ }
+ }
+
+ [DispId(-513)]
+ public override System.Drawing.Color ForeColor {
+ get {
+ return base.ForeColor;
+ }
+ set {
+ base.ForeColor = value;
+ }
+ }
+
+ [DefaultValue(true)]
+ public bool HideSelection {
+ get {
+ return hide_selection;
+ }
+
+ set {
+ if (value != hide_selection) {
+ hide_selection = value;
+ OnHideSelectionChanged(EventArgs.Empty);
+ }
+ if (hide_selection) {
+ document.selection_visible = false;
+ } else {
+ document.selection_visible = true;
+ }
+ document.InvalidateSelectionArea();
+
+ }
+ }
+
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ [Editor("System.Windows.Forms.Design.StringArrayEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
+ [Localizable(true)]
+ public string[] Lines {
+ get {
+ string[] lines;
+ int i;
+ int l;
+
+ l = document.Lines;
+ lines = new string[l];
+
+ for (i = 1; i <= l; i++) {
+ lines[i - 1] = document.GetLine(i).text.ToString();
+ }
+
+ return lines;
+ }
+
+ set {
+ int i;
+ int l;
+ Brush brush;
+
+ document.Empty();
+
+ l = value.Length;
+ brush = ThemeEngine.Current.ResPool.GetSolidBrush(this.ForeColor);
+
+ for (i = 0; i < l; i++) {
+ document.Add(i+1, CaseAdjust(value[i]), alignment, Font, brush);
+ }
+ CalculateDocument();
+ OnTextChanged(EventArgs.Empty);
+ }
+ }
+
+ [DefaultValue(32767)]
+ [Localizable(true)]
+ public virtual int MaxLength {
+ get {
+ if (max_length == 2147483646) { // We don't distinguish between single and multi-line limits
+ return 0;
+ }
+ return max_length;
+ }
+
+ set {
+ if (value != max_length) {
+ max_length = value;
+ }
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool Modified {
+ get {
+ return modified;
+ }
+
+ set {
+ if (value != modified) {
+ modified = value;
+ OnModifiedChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ [DefaultValue(false)]
+ [Localizable(true)]
+ [RefreshProperties(RefreshProperties.All)]
+ public virtual bool Multiline {
+ get {
+ return multiline;
+ }
+
+ set {
+ if (value != multiline) {
+ multiline = value;
+ // Make sure we update our size; the user may have already set the size before going to multiline
+ if (multiline && requested_height != -1) {
+ Height = requested_height;
+ requested_height = -1;
+ }
+
+ OnMultilineChanged(EventArgs.Empty);
+ }
+
+ document.multiline = multiline;
+
+ if (multiline) {
+ document.Wrap = word_wrap;
+ document.PasswordChar = "";
+
+ } else {
+ document.Wrap = false;
+ if (this.password_char != '\0') {
+ document.PasswordChar = password_char.ToString();
+ } else {
+ document.PasswordChar = "";
+ }
+ }
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public int PreferredHeight {
+ get {
+ return this.Font.Height + 7; // FIXME - consider border style as well
+ }
+ }
+
+ [DefaultValue(false)]
+ public bool ReadOnly {
+ get {
+ return read_only;
+ }
+
+ set {
+ if (value != read_only) {
+ read_only = value;
+ OnReadOnlyChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public virtual string SelectedText {
+ get {
+ return document.GetSelection();
+ }
+
+ set {
+ if (!read_only) {
+ document.ReplaceSelection(CaseAdjust(value));
+ OnTextChanged(EventArgs.Empty);
+ }
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public virtual int SelectionLength {
+ get {
+ return document.SelectionLength();
+ }
+
+ set {
+ if (value != 0) {
+ int start;
+ Line line;
+ LineTag tag;
+ int pos;
+
+ start = document.LineTagToCharIndex(document.selection_start.line, document.selection_start.pos);
+
+ document.CharIndexToLineTag(start + value, out line, out tag, out pos);
+ document.SetSelectionEnd(line, pos);
+ document.PositionCaret(line, pos);
+ } else {
+ document.SetSelectionEnd(document.selection_start.line, document.selection_start.pos);
+ document.PositionCaret(document.selection_start.line, document.selection_start.pos);
+ }
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int SelectionStart {
+ get {
+ int index;
+
+ index = document.LineTagToCharIndex(document.selection_start.line, document.selection_start.pos);
+
+ return index;
+ }
+
+ set {
+ Line line;
+ LineTag tag;
+ int pos;
+
+ document.CharIndexToLineTag(value, out line, out tag, out pos);
+ document.SetSelectionStart(line, pos);
+ }
+ }
+
+ [Localizable(true)]
+ public override string Text {
+ get {
+ if (document == null || document.Root == null || document.Root.text == null) {
+ return string.Empty;
+ }
+
+ if (!multiline) {
+ return document.Root.text.ToString();
+ } else {
+ StringBuilder sb;
+ int i;
+
+ sb = new StringBuilder();
+
+ for (i = 1; i < document.Lines; i++) {
+ sb.Append(document.GetLine(i).text.ToString() + Environment.NewLine);
+ }
+ sb.Append(document.GetLine(document.Lines).text.ToString());
+ return sb.ToString();
+ }
+ }
+
+ set {
+ if (value == base.Text) {
+ return;
+ }
+
+ if (value != null) {
+ Line line;
+
+ if (multiline) {
+ string[] lines;
+
+ lines = value.Split(new char[] {'\n'});
+
+ for (int i = 0; i < lines.Length; i++) {
+ if (lines[i].EndsWith("\r")) {
+ lines[i] = lines[i].Substring(0, lines[i].Length - 1);
+ }
+ }
+ this.Lines = lines;
+
+ line = document.GetLine(1);
+ document.SetSelectionStart(line, 0);
+
+ line = document.GetLine(document.Lines);
+ document.SetSelectionEnd(line, line.text.Length);
+ document.PositionCaret(line, line.text.Length);
+ } else {
+ document.Clear();
+ document.Add(1, CaseAdjust(value), alignment, Font, ThemeEngine.Current.ResPool.GetSolidBrush(ForeColor));
+ CalculateDocument();
+ line = document.GetLine(1);
+ document.SetSelectionStart(line, 0);
+ document.SetSelectionEnd(line, value.Length);
+ document.PositionCaret(line, value.Length);
+ }
+ }
+ base.Text = value;
+ // Not needed, base.Text already fires it
+ // OnTextChanged(EventArgs.Empty);
+ }
+ }
+
+ [Browsable(false)]
+ public virtual int TextLength {
+ get {
+ if (document == null || document.Root == null || document.Root.text == null) {
+ return 0;
+ }
+
+ if (!multiline) {
+ return document.Root.text.Length;
+ } else {
+ int total;
+ int i;
+
+ total = 0;
+ for (i = 1; i < document.Lines; i++) {
+ total += document.GetLine(i).text.Length + Environment.NewLine.Length;
+ }
+ total += document.GetLine(i).text.Length;
+
+ return total;
+ }
+ }
+ }
+
+ [DefaultValue(true)]
+ [Localizable(true)]
+ public bool WordWrap {
+ get {
+ return word_wrap;
+ }
+
+ set {
+ if (value != word_wrap) {
+ if (multiline) {
+ word_wrap = value;
+ document.Wrap = value;
+ }
+ }
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Protected Instance Properties
+ protected override CreateParams CreateParams {
+ get {
+ return base.CreateParams;
+ }
+ }
+
+ protected override System.Drawing.Size DefaultSize {
+ get {
+ return base.DefaultSize;
+ }
+ }
+ #endregion // Protected Instance Properties
+
+ #region Public Instance Methods
+ public void AppendText(string text) {
+ if (multiline) {
+ // Grab the formatting for the last element
+ document.MoveCaret(CaretDirection.CtrlEnd);
+ document.Insert(document.CaretLine, document.CaretPosition, text);
+
+ CalculateDocument();
+ document.MoveCaret(CaretDirection.CtrlEnd);
+ } else {
+ document.MoveCaret(CaretDirection.CtrlEnd);
+ document.InsertStringAtCaret(text, true);
+ Invalidate();
+ }
+ OnTextChanged(EventArgs.Empty);
+ }
+
+ public void Clear() {
+ Text = null;
+ }
+
+ public void ClearUndo() {
+ document.undo.Clear();
+ }
+
+ public void Copy() {
+ DataObject o;
+
+ o = new DataObject(DataFormats.Text, SelectedText);
+ if (this is RichTextBox) {
+ o.SetData(DataFormats.Rtf, ((RichTextBox)this).SelectedRtf);
+ }
+ Clipboard.SetDataObject(o);
+ }
+
+ public void Cut() {
+ DataObject o;
+
+ o = new DataObject(DataFormats.Text, SelectedText);
+ if (this is RichTextBox) {
+ o.SetData(DataFormats.Rtf, ((RichTextBox)this).SelectedRtf);
+ }
+ Clipboard.SetDataObject(o);
+ document.ReplaceSelection("");
+ }
+
+ public void Paste() {
+ Paste(null, false);
+ }
+
+ public void ScrollToCaret() {
+ this.CaretMoved(this, EventArgs.Empty);
+ }
+
+ public void Select(int start, int length) {
+ SelectionStart = start;
+ SelectionLength = length;
+ }
+
+
+ public void SelectAll() {
+ Line last;
+
+ last = document.GetLine(document.Lines);
+ document.SetSelectionStart(document.GetLine(1), 0);
+ document.SetSelectionEnd(last, last.text.Length);
+ }
+
+ public override string ToString() {
+ return Text;
+ }
+
+ public void Undo() {
+ document.undo.Undo();
+ }
+ #endregion // Public Instance Methods
+
+ #region Protected Instance Methods
+ protected override void CreateHandle() {
+ base.CreateHandle ();
+ }
+
+ protected override bool IsInputKey(Keys keyData) {
+ if ((keyData & Keys.Alt) != 0) {
+ return base.IsInputKey(keyData);
+ }
+
+ switch (keyData & Keys.KeyCode) {
+ case Keys.Enter: {
+ if (multiline && accepts_return) {
+ return true;
+ }
+ return false;
+ }
+
+ case Keys.Tab: {
+ if (accepts_tab && multiline) {
+ if ((keyData & Keys.Control) == 0) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ case Keys.Left:
+ case Keys.Right:
+ case Keys.Up:
+ case Keys.Down:
+ case Keys.PageUp:
+ case Keys.PageDown:
+ case Keys.Home:
+ case Keys.End: {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ protected virtual void OnAcceptsTabChanged(EventArgs e) {
+ if (AcceptsTabChanged != null) {
+ AcceptsTabChanged(this, e);
+ }
+ }
+
+ protected virtual void OnAutoSizeChanged(EventArgs e) {
+ if (AutoSizeChanged != null) {
+ AutoSizeChanged(this, e);
+ }
+ }
+
+ protected virtual void OnBorderStyleChanged(EventArgs e) {
+ if (BorderStyleChanged != null) {
+ BorderStyleChanged(this, e);
+ }
+ }
+
+ protected override void OnFontChanged(EventArgs e) {
+ base.OnFontChanged (e);
+
+ if (auto_size) {
+ if (PreferredHeight != ClientSize.Height) {
+ Height = PreferredHeight;
+ }
+ }
+ }
+
+ protected override void OnHandleCreated(EventArgs e) {
+ base.OnHandleCreated (e);
+ }
+
+ protected override void OnHandleDestroyed(EventArgs e) {
+ base.OnHandleDestroyed (e);
+ }
+
+ protected virtual void OnHideSelectionChanged(EventArgs e) {
+ if (HideSelectionChanged != null) {
+ HideSelectionChanged(this, e);
+ }
+ }
+
+ protected virtual void OnModifiedChanged(EventArgs e) {
+ if (ModifiedChanged != null) {
+ ModifiedChanged(this, e);
+ }
+ }
+
+ protected virtual void OnMultilineChanged(EventArgs e) {
+ if (MultilineChanged != null) {
+ MultilineChanged(this, e);
+ }
+ }
+
+ protected virtual void OnReadOnlyChanged(EventArgs e) {
+ if (ReadOnlyChanged != null) {
+ ReadOnlyChanged(this, e);
+ }
+ }
+
+ protected override bool ProcessDialogKey(Keys keyData) {
+ return base.ProcessDialogKey(keyData);
+ }
+
+ private bool ProcessKey(Keys keyData) {
+ bool control;
+ bool shift;
+
+ control = (Control.ModifierKeys & Keys.Control) != 0;
+ shift = (Control.ModifierKeys & Keys.Shift) != 0;
+
+ switch (keyData & Keys.KeyCode) {
+ case Keys.X: { // Cut (Ctrl-X)
+ if (control) {
+ Cut();
+ return true;
+ }
+ return false;
+ }
+
+ case Keys.C: { // Copy (Ctrl-C)
+ if (control) {
+ Copy();
+ return true;
+ }
+ return false;
+ }
+
+ case Keys.V: { // Paste (Ctrl-V)
+ if (control) {
+ return Paste(null, true);
+ }
+ return false;
+ }
+
+ case Keys.Z: { // Undo (Ctrl-Z)
+ if (control) {
+ Undo();
+ return true;
+ }
+ return false;
+ }
+
+ case Keys.Left: {
+ if (control) {
+ document.MoveCaret(CaretDirection.WordBack);
+ } else {
+ if (!document.selection_visible || shift) {
+ document.MoveCaret(CaretDirection.CharBack);
+ } else {
+ document.MoveCaret(CaretDirection.SelectionStart);
+ }
+ }
+
+ if (!shift) {
+ document.SetSelectionToCaret(true);
+ } else {
+ document.SetSelectionToCaret(false);
+ }
+
+ CaretMoved(this, null);
+ return true;
+ }
+
+ case Keys.Right: {
+ if (control) {
+ document.MoveCaret(CaretDirection.WordForward);
+ } else {
+ if (!document.selection_visible || shift) {
+ document.MoveCaret(CaretDirection.CharForward);
+ } else {
+ document.MoveCaret(CaretDirection.SelectionEnd);
+ }
+ }
+ if (!shift) {
+ document.SetSelectionToCaret(true);
+ } else {
+ document.SetSelectionToCaret(false);
+ }
+
+ CaretMoved(this, null);
+ return true;
+ }
+
+ case Keys.Up: {
+ if (control) {
+ if (document.CaretPosition == 0) {
+ document.MoveCaret(CaretDirection.LineUp);
+ } else {
+ document.MoveCaret(CaretDirection.Home);
+ }
+ } else {
+ document.MoveCaret(CaretDirection.LineUp);
+ }
+
+ if ((Control.ModifierKeys & Keys.Shift) == 0) {
+ document.SetSelectionToCaret(true);
+ } else {
+ document.SetSelectionToCaret(false);
+ }
+
+ CaretMoved(this, null);
+ return true;
+ }
+
+ case Keys.Down: {
+ if (control) {
+ if (document.CaretPosition == document.CaretLine.Text.Length) {
+ document.MoveCaret(CaretDirection.LineDown);
+ } else {
+ document.MoveCaret(CaretDirection.End);
+ }
+ } else {
+ document.MoveCaret(CaretDirection.LineDown);
+ }
+
+ if ((Control.ModifierKeys & Keys.Shift) == 0) {
+ document.SetSelectionToCaret(true);
+ } else {
+ document.SetSelectionToCaret(false);
+ }
+
+ CaretMoved(this, null);
+ return true;
+ }
+
+ case Keys.Home: {
+ if ((Control.ModifierKeys & Keys.Control) != 0) {
+ document.MoveCaret(CaretDirection.CtrlHome);
+ } else {
+ document.MoveCaret(CaretDirection.Home);
+ }
+
+ if ((Control.ModifierKeys & Keys.Shift) == 0) {
+ document.SetSelectionToCaret(true);
+ } else {
+ document.SetSelectionToCaret(false);
+ }
+
+ CaretMoved(this, null);
+ return true;
+ }
+
+ case Keys.End: {
+ if ((Control.ModifierKeys & Keys.Control) != 0) {
+ document.MoveCaret(CaretDirection.CtrlEnd);
+ } else {
+ document.MoveCaret(CaretDirection.End);
+ }
+
+ if ((Control.ModifierKeys & Keys.Shift) == 0) {
+ document.SetSelectionToCaret(true);
+ } else {
+ document.SetSelectionToCaret(false);
+ }
+
+ CaretMoved(this, null);
+ return true;
+ }
+
+ case Keys.Enter: {
+ // ignoring accepts_return, fixes bug #76355
+ if (!read_only && multiline && (accepts_return || (FindForm().AcceptButton == null) || ((Control.ModifierKeys & Keys.Control) != 0))) {
+ Line line;
+
+ if (document.selection_visible) {
+ document.ReplaceSelection("");
+ }
+ document.SetSelectionToCaret(true);
+
+ line = document.CaretLine;
+
+ document.Split(document.CaretLine, document.CaretTag, document.CaretPosition, false);
+ OnTextChanged(EventArgs.Empty);
+ document.UpdateView(line, 2, 0);
+ document.MoveCaret(CaretDirection.CharForward);
+ CaretMoved(this, null);
+ return true;
+ }
+ break;
+ }
+
+ case Keys.Tab: {
+ if (!read_only && accepts_tab && multiline) {
+ document.InsertChar(document.CaretLine, document.CaretPosition, '\t');
+ if (document.selection_visible) {
+ document.ReplaceSelection("");
+ }
+ document.SetSelectionToCaret(true);
+
+ OnTextChanged(EventArgs.Empty);
+ CaretMoved(this, null);
+ return true;
+ }
+ break;
+ }
+
+
+ case Keys.Back: {
+ if (read_only) {
+ break;
+ }
+
+ // delete only deletes on the line, doesn't do the combine
+ if (document.selection_visible) {
+ document.ReplaceSelection("");
+ }
+ document.SetSelectionToCaret(true);
+
+ if (document.CaretPosition == 0) {
+ if (document.CaretLine.LineNo > 1) {
+ Line line;
+ int new_caret_pos;
+
+ line = document.GetLine(document.CaretLine.LineNo - 1);
+ new_caret_pos = line.text.Length;
+
+ document.Combine(line, document.CaretLine);
+ document.UpdateView(line, 1, 0);
+ document.PositionCaret(line, new_caret_pos);
+ //document.MoveCaret(CaretDirection.CharForward);
+ document.UpdateCaret();
+ OnTextChanged(EventArgs.Empty);
+ }
+ } else {
+ if (!control || document.CaretPosition == 0) {
+ document.DeleteChar(document.CaretTag, document.CaretPosition, false);
+ document.MoveCaret(CaretDirection.CharBack);
+ } else {
+ int start_pos;
+
+ start_pos = document.CaretPosition - 1;
+
+ while ((start_pos > 0) && !Document.IsWordSeparator(document.CaretLine.Text[start_pos - 1])) {
+ start_pos--;
+ }
+ document.DeleteChars(document.CaretTag, start_pos, document.CaretPosition - start_pos);
+ document.PositionCaret(document.CaretLine, start_pos);
+ }
+ document.UpdateCaret();
+ OnTextChanged(EventArgs.Empty);
+ }
+ CaretMoved(this, null);
+ return true;
+ }
+
+ case Keys.Insert: {
+ if (shift) {
+ Paste(null, true);
+ return true;
+ }
+
+ if (control) {
+ Copy();
+ return true;
+ }
+
+ // FIXME - need overwrite/insert toggle?
+ return false;
+ }
+
+ case Keys.Delete: {
+ if (shift) {
+ Cut();
+ return true;
+ }
+
+ if (read_only) {
+ break;
+ }
+
+ if (document.selection_visible) {
+ document.ReplaceSelection("");
+ } else {
+ // DeleteChar only deletes on the line, doesn't do the combine
+ if (document.CaretPosition == document.CaretLine.Text.Length) {
+ if (document.CaretLine.LineNo < document.Lines) {
+ Line line;
+
+ line = document.GetLine(document.CaretLine.LineNo + 1);
+ document.Combine(document.CaretLine, line);
+ document.UpdateView(document.CaretLine, 2, 0);
+
+ #if not_Debug
+ Line check_first;
+ Line check_second;
+
+ check_first = document.GetLine(document.CaretLine.LineNo);
+ check_second = document.GetLine(check_first.line_no + 1);
+
+ Console.WriteLine("Post-UpdateView: Y of first line: {0}, second line: {1}", check_first.Y, check_second.Y);
+ #endif
+
+ // Caret doesn't move
+ }
+ } else {
+ if (!control) {
+ document.DeleteChar(document.CaretTag, document.CaretPosition, true);
+ } else {
+ int end_pos;
+
+ end_pos = document.CaretPosition;
+
+ while ((end_pos < document.CaretLine.Text.Length) && !Document.IsWordSeparator(document.CaretLine.Text[end_pos])) {
+ end_pos++;
+ }
+
+ if (end_pos < document.CaretLine.Text.Length) {
+ end_pos++;
+ }
+ document.DeleteChars(document.CaretTag, document.CaretPosition, end_pos - document.CaretPosition);
+ }
+ }
+ }
+
+ OnTextChanged(EventArgs.Empty);
+ document.AlignCaret();
+ document.UpdateCaret();
+ CaretMoved(this, null);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified) {
+ // Make sure we don't get sized bigger than we want to be
+ if (!richtext) {
+ if (!multiline) {
+ if (height > PreferredHeight) {
+ requested_height = height;
+ height = PreferredHeight;
+ specified |= BoundsSpecified.Height;
+ }
+ }
+ }
+
+ document.ViewPortWidth = width;
+ document.ViewPortHeight = height;
+
+ CalculateDocument();
+
+ base.SetBoundsCore (x, y, width, height, specified);
+ }
+
+ protected override void WndProc(ref Message m) {
+ switch ((Msg)m.Msg) {
+ case Msg.WM_PAINT: {
+ PaintEventArgs paint_event;
+
+ paint_event = XplatUI.PaintEventStart(Handle, true);
+
+ PaintControl(paint_event);
+ XplatUI.PaintEventEnd(Handle, true);
+ DefWndProc(ref m);
+ return;
+ }
+
+ case Msg.WM_SETFOCUS: {
+ // Set caret
+ document.CaretHasFocus();
+ base.WndProc(ref m);
+ return;
+ }
+
+ case Msg.WM_KILLFOCUS: {
+ // Kill caret
+ document.CaretLostFocus();
+ base.WndProc(ref m);
+ return;
+ }
+
+ case Msg.WM_KEYDOWN: {
+ base.WndProc(ref m);
+ ProcessKey((Keys)m.WParam.ToInt32() | XplatUI.State.ModifierKeys);
+ return;
+ }
+
+ case Msg.WM_CHAR: {
+ // Ctrl-Backspace generates a real char, whack it
+ if (m.WParam.ToInt32() == 127) {
+ base.WndProc(ref m);
+ return;
+ }
+
+ base.WndProc(ref m);
+
+ if (!read_only && (m.WParam.ToInt32() >= 32)) { // FIXME, tabs should probably go through
+ if (document.selection_visible) {
+ document.ReplaceSelection("");
+ }
+
+ switch (character_casing) {
+ case CharacterCasing.Normal: {
+ if (document.Length < max_length) {
+ document.InsertCharAtCaret((char)m.WParam, true);
+ OnTextChanged(EventArgs.Empty);
+ CaretMoved(this, null);
+ } else {
+ XplatUI.AudibleAlert();
+ }
+ return;
+ }
+
+ case CharacterCasing.Lower: {
+ if (document.Length < max_length) {
+ document.InsertCharAtCaret(Char.ToLower((char)m.WParam), true);
+ OnTextChanged(EventArgs.Empty);
+ CaretMoved(this, null);
+ } else {
+ XplatUI.AudibleAlert();
+ }
+ return;
+ }
+
+ case CharacterCasing.Upper: {
+ if (document.Length < max_length) {
+ document.InsertCharAtCaret(Char.ToUpper((char)m.WParam), true);
+ OnTextChanged(EventArgs.Empty);
+ CaretMoved(this, null);
+ } else {
+ XplatUI.AudibleAlert();
+ }
+ return;
+ }
+ }
+ }
+ return;
+ }
+
+ default: {
+ base.WndProc(ref m);
+ return;
+ }
+ }
+ }
+
+ #endregion // Protected Instance Methods
+
+ #region Events
+ public event EventHandler AcceptsTabChanged;
+ public event EventHandler AutoSizeChanged;
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler BackgroundImageChanged {
+ add { base.BackgroundImageChanged += value; }
+ remove { base.BackgroundImageChanged -= value; }
+ }
+ public event EventHandler BorderStyleChanged;
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public event EventHandler Click;
+ public event EventHandler HideSelectionChanged;
+ public event EventHandler ModifiedChanged;
+ public event EventHandler MultilineChanged;
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event PaintEventHandler Paint;
+ public event EventHandler ReadOnlyChanged;
+
+ internal event EventHandler HScrolled;
+ internal event EventHandler VScrolled;
+ #endregion // Events
+
+ #region Private Methods
+ internal Document Document {
+ get {
+ return document;
+ }
+
+ set {
+ document = value;
+ }
+ }
+
+ #if Debug
+ static int current;
+ #endif
+
+ private void PaintControl(PaintEventArgs pevent) {
+ // Fill background
+ pevent.Graphics.FillRectangle(ThemeEngine.Current.ResPool.GetSolidBrush(BackColor), pevent.ClipRectangle);
+ pevent.Graphics.TextRenderingHint=TextRenderingHint.AntiAlias;
+
+ // Draw the viewable document
+ document.Draw(pevent.Graphics, pevent.ClipRectangle);
+
+ Rectangle rect = ClientRectangle;
+ rect.Width--;
+ rect.Height--;
+ //pevent.Graphics.DrawRectangle(ThemeEngine.Current.ResPool.GetPen(ThemeEngine.Current.ColorControlDark), rect);
+
+ #if Debug
+ int start;
+ int end;
+ Line line;
+ int line_no;
+ Pen p;
+
+ p = new Pen(Color.Red, 1);
+
+ // First, figure out from what line to what line we need to draw
+ start = document.GetLineByPixel(pevent.ClipRectangle.Top - document.ViewPortY, false).line_no;
+ end = document.GetLineByPixel(pevent.ClipRectangle.Bottom - document.ViewPortY, false).line_no;
+
+ //Console.WriteLine("Starting drawing on line '{0}'", document.GetLine(start));
+ //Console.WriteLine("Ending drawing on line '{0}'", document.GetLine(end));
+
+ line_no = start;
+ while (line_no <= end) {
+ line = document.GetLine(line_no);
+
+ if (draw_lines) {
+ for (int i = 0; i < line.text.Length; i++) {
+ pevent.Graphics.DrawLine(p, (int)line.widths[i] - document.ViewPortX, line.Y - document.ViewPortY, (int)line.widths[i] - document.ViewPortX, line.Y + line.height - document.ViewPortY);
+ }
+ }
+
+ line_no++;
+ }
+ #endif
+ }
+
+ private void TextBoxBase_MouseDown(object sender, MouseEventArgs e) {
+ if (e.Button == MouseButtons.Left) {
+ TimeSpan interval;
+
+ interval = DateTime.Now - click_last;
+ document.PositionCaret(e.X + document.ViewPortX, e.Y + document.ViewPortY);
+ this.Capture = true;
+
+ // Handle place caret/select word/select line behaviour
+ if (e.Clicks == 1) {
+ if (SystemInformation.DoubleClickTime < interval.TotalMilliseconds) {
+ #if DebugClick
+ Console.WriteLine("Single Click Invalidating from char {0} to char {1} ({2})", document.selection_start.pos, document.selection_end.pos, document.selection_start.line.text.ToString(document.selection_start.pos, document.selection_end.pos - document.selection_start.pos));
+ #endif
+ document.SetSelectionToCaret(true);
+ click_mode = CaretSelection.Position;
+ } else {
+ #if DebugClick
+ Console.WriteLine("Tripple Click Selecting line");
+ #endif
+ document.ExpandSelection(CaretSelection.Line, false);
+ click_mode = CaretSelection.Line;
+ }
+ } else {
+ // We select the line if the word is already selected, and vice versa
+ if (click_mode != CaretSelection.Word) {
+ if (click_mode == CaretSelection.Line) {
+ document.Invalidate(document.selection_start.line, 0, document.selection_start.line, document.selection_start.line.text.Length);
+ }
+ click_mode = CaretSelection.Word;
+ document.ExpandSelection(CaretSelection.Word, false); // Setting initial selection
+ } else {
+ click_mode = CaretSelection.Line;
+ document.ExpandSelection(CaretSelection.Line, false); // Setting initial selection
+ }
+ }
+
+ // Reset
+ click_last = DateTime.Now;
+ return;
+ }
+
+ #if Debug
+ LineTag tag;
+ Line line;
+ int pos;
+
+ if (e.Button == MouseButtons.Right) {
+ draw_lines = !draw_lines;
+ this.Invalidate();
+ Console.WriteLine("SelectedText: {0}, length {1}", this.SelectedText, this.SelectionLength);
+ Console.WriteLine("Selection start: {0}", this.SelectionStart);
+
+ this.SelectionStart = 10;
+ this.SelectionLength = 5;
+
+ return;
+ }
+
+ tag = document.FindTag(e.X + document.ViewPortX, e.Y + document.ViewPortY, out pos, false);
+
+ Console.WriteLine("Click found tag {0}, character {1}", tag, pos);
+ line = tag.line;
+ switch(current) {
+ case 4: LineTag.FormatText(tag.line, pos, (pos+10)<line.Text.Length ? 10 : line.Text.Length - pos+1, new Font("impact", 20, FontStyle.Bold, GraphicsUnit.Pixel), ThemeEngine.Current.ResPool.GetSolidBrush(Color.Red)); break;
+ case 1: LineTag.FormatText(tag.line, pos, (pos+10)<line.Text.Length ? 10 : line.Text.Length - pos+1, new Font("arial unicode ms", 24, FontStyle.Italic, GraphicsUnit.Pixel), ThemeEngine.Current.ResPool.GetSolidBrush(Color.DarkGoldenrod)); break;
+ case 2: LineTag.FormatText(tag.line, pos, (pos+10)<line.Text.Length ? 10 : line.Text.Length - pos+1, new Font("arial", 10, FontStyle.Regular, GraphicsUnit.Pixel), ThemeEngine.Current.ResPool.GetSolidBrush(Color.Aquamarine)); break;
+ case 3: LineTag.FormatText(tag.line, pos, (pos+10)<line.Text.Length ? 10 : line.Text.Length - pos+1, new Font("times roman", 16, FontStyle.Underline, GraphicsUnit.Pixel), ThemeEngine.Current.ResPool.GetSolidBrush(Color.Turquoise)); break;
+ case 0: LineTag.FormatText(tag.line, pos, (pos+10)<line.Text.Length ? 10 : line.Text.Length - pos+1, new Font("times roman", 64, FontStyle.Italic | FontStyle.Bold, GraphicsUnit.Pixel), ThemeEngine.Current.ResPool.GetSolidBrush(Color.LightSeaGreen)); break;
+ case 5: LineTag.FormatText(tag.line, pos, (pos+10)<line.Text.Length ? 10 : line.Text.Length - pos+1, ((TextBoxBase)sender).Font, ThemeEngine.Current.ResPool.GetSolidBrush(ForeColor)); break;
+ }
+ current++;
+ if (current==6) {
+ current=0;
+ }
+
+ // Update/Recalculate what we see
+ document.UpdateView(line, 0);
+
+ // Make sure our caret is properly positioned and sized
+ document.AlignCaret();
+ #endif
+ }
+
+ private void TextBoxBase_MouseUp(object sender, MouseEventArgs e) {
+ this.Capture = false;
+ if (e.Button == MouseButtons.Left) {
+ document.PositionCaret(e.X + document.ViewPortX, e.Y + document.ViewPortY);
+ if (click_mode == CaretSelection.Position) {
+ document.SetSelectionToCaret(false);
+ document.DisplayCaret();
+ } else {
+ document.ExpandSelection(click_mode, true);
+ }
+ return;
+ }
+ }
+
+ private void TextBoxBase_SizeChanged(object sender, EventArgs e) {
+ canvas_width = ClientSize.Width;
+ canvas_height = ClientSize.Height;
+
+ // We always move them, they just might not be displayed
+ hscroll.Bounds = new Rectangle (ClientRectangle.Left, ClientRectangle.Bottom - hscroll.Height, ClientSize.Width - (vscroll.Visible ? SystemInformation.VerticalScrollBarWidth : 0), hscroll.Height);
+ vscroll.Bounds = new Rectangle (ClientRectangle.Right - vscroll.Width, ClientRectangle.Top, vscroll.Width, ClientSize.Height - (hscroll.Visible ? SystemInformation.HorizontalScrollBarHeight : 0));
+
+ }
+
+ private void TextBoxBase_MouseWheel(object sender, MouseEventArgs e) {
+ Line line;
+ int line_no;
+ int target;
+
+ if (!vscroll.Enabled) {
+ return;
+ }
+
+ if (e.Delta < 0) {
+ line_no = document.GetLineByPixel(document.ViewPortY, false).line_no + SystemInformation.MouseWheelScrollLines;
+ if (line_no > document.Lines) {
+ line_no = document.Lines;
+ }
+ } else {
+ line_no = document.GetLineByPixel(document.ViewPortY, false).line_no - SystemInformation.MouseWheelScrollLines;
+ if (line_no < 1) {
+ line_no = 1;
+ }
+ }
+
+ line = document.GetLine(line_no);
+ if (line.Y < vscroll.Maximum) {
+ vscroll.Value = line.Y;
+ } else {
+ vscroll.Value = vscroll.Maximum;
+ }
+ }
+
+ internal void CalculateDocument() {
+ if (!IsHandleCreated) {
+ return;
+ }
+ document.RecalculateDocument(CreateGraphics());
+ CalculateScrollBars();
+//blah Console.WriteLine("TextBox.cs(1175) Invalidate called in CalculateDocument");
+ Invalidate(); // FIXME - do we need this?
+ }
+
+ internal void CalculateScrollBars() {
+ // FIXME - need separate calculations for center and right alignment
+ // No scrollbars for a single line
+ if (document.Width >= ClientSize.Width) {
+ hscroll.Enabled = true;
+ hscroll.Minimum = 0;
+ hscroll.Maximum = document.Width - ClientSize.Width;
+ } else {
+ hscroll.Maximum = document.ViewPortWidth;
+ hscroll.Enabled = false;
+ }
+
+ if (document.Height >= ClientSize.Height) {
+ vscroll.Enabled = true;
+ vscroll.Minimum = 0;
+ vscroll.Maximum = document.Height - ClientSize.Height;
+ } else {
+ vscroll.Maximum = document.ViewPortHeight;
+ vscroll.Enabled = false;
+ }
+
+
+ if (!multiline) {
+ return;
+ }
+
+ if (!WordWrap) {
+ if ((scrollbars & RichTextBoxScrollBars.Horizontal) != 0) {
+ if (((scrollbars & RichTextBoxScrollBars.ForcedHorizontal) != 0) || hscroll.Enabled) {
+ hscroll.Visible = true;
+ }
+ }
+ }
+
+ if ((scrollbars & RichTextBoxScrollBars.Vertical) != 0) {
+ if (((scrollbars & RichTextBoxScrollBars.ForcedVertical) != 0) || vscroll.Enabled) {
+ vscroll.Visible = true;
+ }
+ }
+
+ if (hscroll.Visible) {
+ vscroll.Maximum += hscroll.Height;
+ canvas_height = ClientSize.Height - hscroll.Height;
+ }
+
+ if (vscroll.Visible) {
+ hscroll.Maximum += vscroll.Width * 2;
+ canvas_width = ClientSize.Width - vscroll.Width * 2;
+ }
+
+ TextBoxBase_SizeChanged(this, EventArgs.Empty);
+ }
+
+ private void document_WidthChanged(object sender, EventArgs e) {
+ CalculateScrollBars();
+ }
+
+ private void document_HeightChanged(object sender, EventArgs e) {
+ CalculateScrollBars();
+ }
+
+ private void hscroll_ValueChanged(object sender, EventArgs e) {
+ XplatUI.ScrollWindow(this.Handle, document.ViewPortX-this.hscroll.Value, 0, false);
+ document.ViewPortX = this.hscroll.Value;
+ document.UpdateCaret();
+
+ if (HScrolled != null) {
+ HScrolled(this, EventArgs.Empty);
+ }
+ }
+
+ private void vscroll_ValueChanged(object sender, EventArgs e) {
+ XplatUI.ScrollWindow(this.Handle, 0, document.ViewPortY-this.vscroll.Value, false);
+ document.ViewPortY = this.vscroll.Value;
+ document.UpdateCaret();
+
+ if (VScrolled != null) {
+ VScrolled(this, EventArgs.Empty);
+ }
+ }
+
+ private void TextBoxBase_MouseMove(object sender, MouseEventArgs e) {
+ // FIXME - handle auto-scrolling if mouse is to the right/left of the window
+ if (Capture) {
+ document.PositionCaret(e.X + document.ViewPortX, e.Y + document.ViewPortY);
+ if (click_mode == CaretSelection.Position) {
+ document.SetSelectionToCaret(false);
+ document.DisplayCaret();
+ } else {
+ document.ExpandSelection(click_mode, true);
+ }
+ }
+ }
+
+ private void TextBoxBase_FontOrColorChanged(object sender, EventArgs e) {
+ if (!richtext) {
+ Line line;
+
+ // Font changes apply to the whole document
+ for (int i = 1; i <= document.Lines; i++) {
+ line = document.GetLine(i);
+ LineTag.FormatText(line, 1, line.text.Length, Font, ThemeEngine.Current.ResPool.GetSolidBrush(ForeColor));
+ document.UpdateView(line, 0);
+ }
+ // Make sure the caret height is matching the new font height
+ document.AlignCaret();
+ }
+ }
+
+ /// <summary>Ensure the caret is always visible</summary>
+ internal void CaretMoved(object sender, EventArgs e) {
+ Point pos;
+ int height;
+
+ pos = document.Caret;
+ //Console.WriteLine("Caret now at {0} (Thumb: {1}x{2}, Canvas: {3}x{4}, Document {5}x{6})", pos, hscroll.Value, vscroll.Value, canvas_width, canvas_height, document.Width, document.Height);
+
+ // Handle horizontal scrolling
+ if (document.CaretLine.alignment == HorizontalAlignment.Left) {
+ if (pos.X < (document.ViewPortX + track_width)) {
+ do {
+ if ((hscroll.Value - track_width) >= hscroll.Minimum) {
+ hscroll.Value -= track_width;
+ } else {
+ hscroll.Value = hscroll.Minimum;
+ }
+ } while (hscroll.Value > pos.X);
+ }
+
+ if ((pos.X > (this.canvas_width + document.ViewPortX - track_width)) && (hscroll.Value != hscroll.Maximum)) {
+ do {
+ if ((hscroll.Value + track_width) <= hscroll.Maximum) {
+ hscroll.Value += track_width;
+ } else {
+ hscroll.Value = hscroll.Maximum;
+ }
+ } while (pos.X > (hscroll.Value + this.canvas_width));
+ }
+ } else if (document.CaretLine.alignment == HorizontalAlignment.Right) {
+ if (pos.X < document.ViewPortX) {
+ if (pos.X > hscroll.Minimum) {
+ hscroll.Value = pos.X;
+ } else {
+ hscroll.Value = hscroll.Minimum;
+ }
+ }
+
+ if ((pos.X > (this.canvas_width + document.ViewPortX)) && (hscroll.Value != hscroll.Maximum)) {
+ hscroll.Value = hscroll.Maximum;
+ }
+ } else {
+ }
+
+ if (!multiline) {
+ return;
+ }
+
+ // Handle vertical scrolling
+ height = document.CaretLine.Height;
+
+ if (pos.Y < document.ViewPortY) {
+ vscroll.Value = pos.Y;
+ }
+
+ if ((pos.Y + height) > (document.ViewPortY + canvas_height)) {
+ vscroll.Value = pos.Y - canvas_height + height;
+ }
+ }
+
+ internal bool Paste(DataFormats.Format format, bool obey_length) {
+ IDataObject clip;
+ string s;
+
+ clip = Clipboard.GetDataObject();
+ if (clip == null)
+ return false;
+
+ if (format == null) {
+ if ((this is RichTextBox) && clip.GetDataPresent(DataFormats.Rtf)) {
+ format = DataFormats.GetFormat(DataFormats.Rtf);
+ } else if (clip.GetDataPresent(DataFormats.UnicodeText)) {
+ format = DataFormats.GetFormat(DataFormats.UnicodeText);
+ } else if (clip.GetDataPresent(DataFormats.Text)) {
+ format = DataFormats.GetFormat(DataFormats.Text);
+ } else {
+ return false;
+ }
+ } else {
+ if ((format.Name == DataFormats.Rtf) && !(this is RichTextBox)) {
+ return false;
+ }
+
+ if (!clip.GetDataPresent(format.Name)) {
+ return false;
+ }
+ }
+
+ if (format.Name == DataFormats.Rtf) {
+ ((RichTextBox)this).SelectedRtf = (string)clip.GetData(DataFormats.Rtf);
+ return true;
+ } else if (format.Name == DataFormats.UnicodeText) {
+ s = (string)clip.GetData(DataFormats.UnicodeText);
+ } else if (format.Name == DataFormats.Text) {
+ s = (string)clip.GetData(DataFormats.Text);
+ } else {
+ return false;
+ }
+
+ if (!obey_length) {
+ this.SelectedText = s;
+ } else {
+ if ((s.Length + document.Length) < max_length) {
+ this.SelectedText = s;
+ } else if (document.Length < max_length) {
+ this.SelectedText = s.Substring(0, max_length - document.Length);
+ }
+ }
+
+ return true;
+ }
+ #endregion // Private Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextControl.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextControl.cs
new file mode 100644
index 00000000000..0f46ca5af39
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextControl.cs
@@ -0,0 +1,4386 @@
+// 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-2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+// NOT COMPLETE
+
+// There's still plenty of things missing, I've got most of it planned, just hadn't had
+// the time to write it all yet.
+// Stuff missing (in no particular order):
+// - Align text after RecalculateLine
+// - Implement tag types for hotlinks, images, etc.
+// - Implement CaretPgUp/PgDown
+
+// NOTE:
+// selection_start.pos and selection_end.pos are 0-based
+// selection_start.pos = first selected char
+// selection_end.pos = first NOT-selected char
+//
+// FormatText methods are 1-based (as are all tags, LineTag.Start is 1 for
+// the first character on a line; the reason is that 0 is the position
+// *before* the first character on a line
+
+
+#undef Debug
+
+using System;
+using System.Collections;
+using System.Drawing;
+using System.Drawing.Text;
+using System.Text;
+
+namespace System.Windows.Forms {
+ internal enum LineColor {
+ Red = 0,
+ Black = 1
+ }
+
+ internal enum CaretSelection {
+ Position, // Selection=Caret
+ Word, // Selection=Word under caret
+ Line // Selection=Line under caret
+ }
+
+ internal enum CaretDirection {
+ CharForward, // Move a char to the right
+ CharBack, // Move a char to the left
+ LineUp, // Move a line up
+ LineDown, // Move a line down
+ Home, // Move to the beginning of the line
+ End, // Move to the end of the line
+ PgUp, // Move one page up
+ PgDn, // Move one page down
+ CtrlHome, // Move to the beginning of the document
+ CtrlEnd, // Move to the end of the document
+ WordBack, // Move to the beginning of the previous word (or beginning of line)
+ WordForward, // Move to the beginning of the next word (or end of line)
+ SelectionStart, // Move to the beginning of the current selection
+ SelectionEnd // Move to the end of the current selection
+ }
+
+ // Being cloneable should allow for nice line and document copies...
+ internal class Line : ICloneable, IComparable {
+ #region Local Variables
+ // Stuff that matters for our line
+ internal StringBuilder text; // Characters for the line
+ internal float[] widths; // Width of each character; always one larger than text.Length
+ internal int space; // Number of elements in text and widths
+ internal int line_no; // Line number
+ internal LineTag tags; // Tags describing the text
+ internal int Y; // Baseline
+ internal int height; // Height of the line (height of tallest tag)
+ internal int ascent; // Ascent of the line (ascent of the tallest tag)
+ internal HorizontalAlignment alignment; // Alignment of the line
+ internal int align_shift; // Pixel shift caused by the alignment
+ internal bool soft_break; // Tag is 'broken soft' and continuation from previous line
+ internal int indent; // Left indent for the first line
+ internal int hanging_indent; // Hanging indent (left indent for all but the first line)
+ internal int right_indent; // Right indent for all lines
+
+
+ // Stuff that's important for the tree
+ internal Line parent; // Our parent line
+ internal Line left; // Line with smaller line number
+ internal Line right; // Line with higher line number
+ internal LineColor color; // We're doing a black/red tree. this is the node color
+ internal int DEFAULT_TEXT_LEN; //
+ internal static StringFormat string_format; // For calculating widths/heights
+ internal bool recalc; // Line changed
+ #endregion // Local Variables
+
+ #region Constructors
+ internal Line() {
+ color = LineColor.Red;
+ left = null;
+ right = null;
+ parent = null;
+ text = null;
+ recalc = true;
+ soft_break = false;
+ alignment = HorizontalAlignment.Left;
+
+ if (string_format == null) {
+ string_format = new StringFormat(StringFormat.GenericTypographic);
+ string_format.Trimming = StringTrimming.None;
+ string_format.FormatFlags = StringFormatFlags.MeasureTrailingSpaces;
+ }
+ }
+
+ internal Line(int LineNo, string Text, Font font, Brush color) : this() {
+ space = Text.Length > DEFAULT_TEXT_LEN ? Text.Length+1 : DEFAULT_TEXT_LEN;
+
+ text = new StringBuilder(Text, space);
+ line_no = LineNo;
+
+ widths = new float[space + 1];
+ tags = new LineTag(this, 1, text.Length);
+ tags.font = font;
+ tags.color = color;
+ }
+
+ internal Line(int LineNo, string Text, HorizontalAlignment align, Font font, Brush color) : this() {
+ space = Text.Length > DEFAULT_TEXT_LEN ? Text.Length+1 : DEFAULT_TEXT_LEN;
+
+ text = new StringBuilder(Text, space);
+ line_no = LineNo;
+ alignment = align;
+
+ widths = new float[space + 1];
+ tags = new LineTag(this, 1, text.Length);
+ tags.font = font;
+ tags.color = color;
+ }
+
+ internal Line(int LineNo, string Text, LineTag tag) : this() {
+ space = Text.Length > DEFAULT_TEXT_LEN ? Text.Length+1 : DEFAULT_TEXT_LEN;
+
+ text = new StringBuilder(Text, space);
+ line_no = LineNo;
+
+ widths = new float[space + 1];
+ tags = tag;
+ }
+
+ #endregion // Constructors
+
+ #region Internal Properties
+ internal int Indent {
+ get {
+ return indent;
+ }
+
+ set {
+ indent = value;
+ recalc = true;
+ }
+ }
+
+ internal int HangingIndent {
+ get {
+ return hanging_indent;
+ }
+
+ set {
+ hanging_indent = value;
+ recalc = true;
+ }
+ }
+
+ internal int RightIndent {
+ get {
+ return right_indent;
+ }
+
+ set {
+ right_indent = value;
+ recalc = true;
+ }
+ }
+
+
+ internal int Height {
+ get {
+ return height;
+ }
+
+ set {
+ height = value;
+ }
+ }
+
+ internal int LineNo {
+ get {
+ return line_no;
+ }
+
+ set {
+ line_no = value;
+ }
+ }
+
+ internal string Text {
+ get {
+ return text.ToString();
+ }
+
+ set {
+ text = new StringBuilder(value, value.Length > DEFAULT_TEXT_LEN ? value.Length : DEFAULT_TEXT_LEN);
+ }
+ }
+
+ internal HorizontalAlignment Alignment {
+ get {
+ return alignment;
+ }
+
+ set {
+ if (alignment != value) {
+ alignment = value;
+ recalc = true;
+ }
+ }
+ }
+#if no
+ internal StringBuilder Text {
+ get {
+ return text;
+ }
+
+ set {
+ text = value;
+ }
+ }
+#endif
+ #endregion // Internal Properties
+
+ #region Internal Methods
+ // Make sure we always have enoughs space in text and widths
+ internal void Grow(int minimum) {
+ int length;
+ float[] new_widths;
+
+ length = text.Length;
+
+ if ((length + minimum) > space) {
+ // We need to grow; double the size
+
+ if ((length + minimum) > (space * 2)) {
+ new_widths = new float[length + minimum * 2 + 1];
+ space = length + minimum * 2;
+ } else {
+ new_widths = new float[space * 2 + 1];
+ space *= 2;
+ }
+ widths.CopyTo(new_widths, 0);
+
+ widths = new_widths;
+ }
+ }
+
+ internal void Streamline() {
+ LineTag current;
+ LineTag next;
+
+ current = this.tags;
+ next = current.next;
+
+ // Catch what the loop below wont; eliminate 0 length
+ // tags, but only if there are other tags after us
+ while ((current.length == 0) && (next != null)) {
+ tags = next;
+ tags.previous = null;
+ current = next;
+ next = current.next;
+ }
+
+ if (next == null) {
+ return;
+ }
+
+ while (next != null) {
+ // Take out 0 length tags
+ if (next.length == 0) {
+ current.next = next.next;
+ if (current.next != null) {
+ current.next.previous = current;
+ }
+ next = current.next;
+ continue;
+ }
+
+ if (current.Combine(next)) {
+ next = current.next;
+ continue;
+ }
+
+ current = current.next;
+ next = current.next;
+ }
+ }
+
+ /// <summary> Find the tag on a line based on the character position, pos is 0-based</summary>
+ internal LineTag FindTag(int pos) {
+ LineTag tag;
+
+ if (pos == 0) {
+ return tags;
+ }
+
+ tag = this.tags;
+
+ if (pos >= text.Length) {
+ pos = text.Length - 1;
+ }
+
+ while (tag != null) {
+ if (((tag.start - 1) <= pos) && (pos < (tag.start + tag.length - 1))) {
+ return tag;
+ }
+ tag = tag.next;
+ }
+ return null;
+ }
+
+ /// <summary>
+ /// Recalculate a single line using the same char for every character in the line
+ /// </summary>
+
+ internal bool RecalculatePasswordLine(Graphics g, Document doc) {
+ LineTag tag;
+ int pos;
+ int len;
+ float w;
+ bool ret;
+ int descent;
+
+ pos = 0;
+ len = this.text.Length;
+ tag = this.tags;
+ ascent = 0;
+ tag.shift = 0;
+ tag.width = 0;
+
+ this.recalc = false;
+ widths[0] = indent;
+ tag.X = indent;
+
+ w = g.MeasureString(doc.password_char, tags.font, 10000, string_format).Width;
+
+ if (this.height != (int)tag.font.Height) {
+ ret = true;
+ } else {
+ ret = false;
+ }
+
+ this.height = (int)tag.font.Height;
+ tag.height = this.height;
+
+ XplatUI.GetFontMetrics(g, tag.font, out tag.ascent, out descent);
+ this.ascent = tag.ascent;
+
+ while (pos < len) {
+ tag.width += w;
+ pos++;
+ widths[pos] = widths[pos-1] + w;
+ }
+
+ return ret;
+ }
+
+ /// <summary>
+ /// Go through all tags on a line and recalculate all size-related values;
+ /// returns true if lineheight changed
+ /// </summary>
+ internal bool RecalculateLine(Graphics g, Document doc) {
+ LineTag tag;
+ int pos;
+ int len;
+ SizeF size;
+ float w;
+ int prev_height;
+ bool retval;
+ bool wrapped;
+ Line line;
+ int wrap_pos;
+ float wrap_width;
+
+ pos = 0;
+ len = this.text.Length;
+ tag = this.tags;
+ prev_height = this.height; // For drawing optimization calculations
+ this.height = 0; // Reset line height
+ this.ascent = 0; // Reset the ascent for the line
+ tag.shift = 0;
+ tag.width = 0;
+
+ if (this.soft_break) {
+ widths[0] = hanging_indent;
+ } else {
+ widths[0] = indent;
+ }
+
+ this.recalc = false;
+ retval = false;
+ wrapped = false;
+
+ wrap_pos = 0;
+ wrap_width = 0;
+
+ while (pos < len) {
+ size = g.MeasureString(this.text.ToString(pos, 1), tag.font, 10000, string_format);
+
+ while (tag.length == 0) { // We should always have tags after a tag.length==0 unless len==0
+ tag.width = 0;
+ tag.ascent = 0;
+ if (tag.previous != null) {
+ tag.X = tag.previous.X;
+ } else {
+ tag.X = (int)widths[pos];
+ }
+ tag = tag.next;
+ tag.width = 0;
+ tag.shift = 0;
+ }
+
+ w = size.Width;
+
+ if (Char.IsWhiteSpace(text[pos])) {
+ wrap_pos = pos + 1;
+ wrap_width = tag.width + w;
+ }
+
+ if (doc.wrap) {
+ if ((wrap_pos > 0) && (wrap_pos != len) && (widths[pos] + w) + 27 > (doc.viewport_width - this.right_indent)) {
+ pos = wrap_pos;
+ tag.width = wrap_width;
+ doc.Split(this, tag, pos, true);
+ len = this.text.Length;
+ retval = true;
+ wrapped = true;
+ }
+ }
+
+ // Contract all soft lines that follow back into our line
+ if (!wrapped) {
+ tag.width += w;
+
+ pos++;
+
+ widths[pos] = widths[pos-1] + w;
+
+ if (pos == len) {
+ line = doc.GetLine(this.line_no + 1);
+ if ((line != null) && (line.soft_break)) {
+ // Pull the previous line back into this one
+ doc.Combine(this.line_no, this.line_no + 1);
+ len = this.text.Length;
+ retval = true;
+ }
+ }
+ }
+
+ if (pos == (tag.start-1 + tag.length)) {
+ // We just found the end of our current tag
+ tag.height = (int)tag.font.Height;
+
+ // Check if we're the tallest on the line (so far)
+ if (tag.height > this.height) {
+ this.height = tag.height; // Yep; make sure the line knows
+ }
+
+ if (tag.ascent == 0) {
+ int descent;
+
+ XplatUI.GetFontMetrics(g, tag.font, out tag.ascent, out descent);
+ }
+
+ if (tag.ascent > this.ascent) {
+ LineTag t;
+
+ // We have a tag that has a taller ascent than the line;
+
+ t = tags;
+ while (t != tag) {
+ t.shift = tag.ascent - t.ascent;
+ t = t.next;
+ }
+
+ // Save on our line
+ this.ascent = tag.ascent;
+ } else {
+ tag.shift = this.ascent - tag.ascent;
+ }
+
+ // Update our horizontal starting pixel position
+ if (tag.previous == null) {
+ tag.X = (int)widths[0];
+ } else {
+ tag.X = tag.previous.X + (int)tag.previous.width;
+ }
+
+ tag = tag.next;
+ if (tag != null) {
+ tag.width = 0;
+ tag.shift = 0;
+ wrap_pos = pos;
+ wrap_width = tag.width;
+ }
+ }
+ }
+
+ if (this.height == 0) {
+ this.height = tags.font.Height;
+ tag.height = this.height;
+ }
+
+ if (prev_height != this.height) {
+ retval = true;
+ }
+ return retval;
+ }
+ #endregion // Internal Methods
+
+ #region Administrative
+ public int CompareTo(object obj) {
+ if (obj == null) {
+ return 1;
+ }
+
+ if (! (obj is Line)) {
+ throw new ArgumentException("Object is not of type Line", "obj");
+ }
+
+ if (line_no < ((Line)obj).line_no) {
+ return -1;
+ } else if (line_no > ((Line)obj).line_no) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+
+ public object Clone() {
+ Line clone;
+
+ clone = new Line();
+
+ clone.text = text;
+
+ if (left != null) {
+ clone.left = (Line)left.Clone();
+ }
+
+ if (left != null) {
+ clone.left = (Line)left.Clone();
+ }
+
+ return clone;
+ }
+
+ internal object CloneLine() {
+ Line clone;
+
+ clone = new Line();
+
+ clone.text = text;
+
+ return clone;
+ }
+
+ public override bool Equals(object obj) {
+ if (obj == null) {
+ return false;
+ }
+
+ if (!(obj is Line)) {
+ return false;
+ }
+
+ if (obj == this) {
+ return true;
+ }
+
+ if (line_no == ((Line)obj).line_no) {
+ return true;
+ }
+
+ return false;
+ }
+
+ public override int GetHashCode() {
+ return base.GetHashCode ();
+ }
+
+ public override string ToString() {
+ return "Line " + line_no;
+ }
+
+ #endregion // Administrative
+ }
+
+ internal class Document : ICloneable, IEnumerable {
+ #region Structures
+ // FIXME - go through code and check for places where
+ // we do explicit comparisons instead of using the compare overloads
+ internal struct Marker {
+ internal Line line;
+ internal LineTag tag;
+ internal int pos;
+ internal int height;
+
+ public static bool operator<(Marker lhs, Marker rhs) {
+ if (lhs.line.line_no < rhs.line.line_no) {
+ return true;
+ }
+
+ if (lhs.line.line_no == rhs.line.line_no) {
+ if (lhs.pos < rhs.pos) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static bool operator>(Marker lhs, Marker rhs) {
+ if (lhs.line.line_no > rhs.line.line_no) {
+ return true;
+ }
+
+ if (lhs.line.line_no == rhs.line.line_no) {
+ if (lhs.pos > rhs.pos) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static bool operator==(Marker lhs, Marker rhs) {
+ if ((lhs.line.line_no == rhs.line.line_no) && (lhs.pos == rhs.pos)) {
+ return true;
+ }
+ return false;
+ }
+
+ public static bool operator!=(Marker lhs, Marker rhs) {
+ if ((lhs.line.line_no != rhs.line.line_no) || (lhs.pos != rhs.pos)) {
+ return true;
+ }
+ return false;
+ }
+
+ public override bool Equals(object obj) {
+ return this==(Marker)obj;
+ }
+
+ public override int GetHashCode() {
+ return base.GetHashCode ();
+ }
+
+ public override string ToString() {
+ return "Marker Line " + line + ", Position " + pos;
+ }
+
+ }
+ #endregion Structures
+
+ #region Local Variables
+ private Line document;
+ private int lines;
+ private Line sentinel;
+ private Line last_found;
+ private int document_id;
+ private Random random = new Random();
+ internal string password_char;
+ private StringBuilder password_cache;
+ private bool calc_pass;
+ private int char_count;
+
+ internal bool multiline;
+ internal bool wrap;
+
+ internal UndoClass undo;
+
+ internal Marker caret;
+ internal Marker selection_start;
+ internal Marker selection_end;
+ internal bool selection_visible;
+ internal Marker selection_anchor;
+ internal Marker selection_prev;
+ internal bool selection_end_anchor;
+
+ internal int viewport_x;
+ internal int viewport_y; // The visible area of the document
+ internal int viewport_width;
+ internal int viewport_height;
+
+ internal int document_x; // Width of the document
+ internal int document_y; // Height of the document
+
+ internal Rectangle invalid;
+
+ internal int crlf_size; // 1 or 2, depending on whether we use \r\n or just \n
+
+ internal Control owner; // Who's owning us?
+ #endregion // Local Variables
+
+ #region Constructors
+ internal Document(Control owner) {
+ lines = 0;
+
+ this.owner = owner;
+
+ multiline = true;
+ password_char = "";
+ calc_pass = false;
+
+ // Tree related stuff
+ sentinel = new Line();
+ sentinel.color = LineColor.Black;
+
+ document = sentinel;
+ last_found = sentinel;
+
+ // We always have a blank line
+ owner.HandleCreated += new EventHandler(owner_HandleCreated);
+ Add(1, "", owner.Font, ThemeEngine.Current.ResPool.GetSolidBrush(owner.ForeColor));
+ lines=1;
+
+ undo = new UndoClass(this);
+
+ selection_visible = false;
+ selection_start.line = this.document;
+ selection_start.pos = 0;
+ selection_start.tag = selection_start.line.tags;
+ selection_end.line = this.document;
+ selection_end.pos = 0;
+ selection_end.tag = selection_end.line.tags;
+
+ viewport_x = 0;
+ viewport_y = 0;
+
+ crlf_size = 2;
+
+ // Default selection is empty
+
+ document_id = random.Next();
+ }
+ #endregion
+
+ #region Internal Properties
+ internal Line Root {
+ get {
+ return document;
+ }
+
+ set {
+ document = value;
+ }
+ }
+
+ internal int Lines {
+ get {
+ return lines;
+ }
+ }
+
+ internal Line CaretLine {
+ get {
+ return caret.line;
+ }
+ }
+
+ internal int CaretPosition {
+ get {
+ return caret.pos;
+ }
+ }
+
+ internal Point Caret {
+ get {
+ return new Point((int)caret.tag.line.widths[caret.pos] + caret.line.align_shift, caret.line.Y);
+ }
+ }
+
+ internal LineTag CaretTag {
+ get {
+ return caret.tag;
+ }
+ }
+
+ internal int CRLFSize {
+ get {
+ return crlf_size;
+ }
+
+ set {
+ crlf_size = value;
+ }
+ }
+
+ internal string PasswordChar {
+ get {
+ return password_char;
+ }
+
+ set {
+ password_char = value;
+ if ((password_char.Length != 0) && (password_char[0] != '\0')) {
+ char ch;
+
+ calc_pass = true;
+ ch = value[0];
+ password_cache = new StringBuilder(1024);
+ for (int i = 0; i < 1024; i++) {
+ password_cache.Append(ch);
+ }
+ } else {
+ calc_pass = false;
+ password_cache = null;
+ }
+ }
+ }
+
+ internal int ViewPortX {
+ get {
+ return viewport_x;
+ }
+
+ set {
+ viewport_x = value;
+ }
+ }
+
+ internal int Length {
+ get {
+ return char_count + lines - 1; // Add \n for each line but the last
+ }
+ }
+
+ private int CharCount {
+ get {
+ return char_count;
+ }
+
+ set {
+ char_count = value;
+
+ if (LengthChanged != null) {
+ LengthChanged(this, EventArgs.Empty);
+ }
+ }
+ }
+
+ internal int ViewPortY {
+ get {
+ return viewport_y;
+ }
+
+ set {
+ viewport_y = value;
+ }
+ }
+
+ internal int ViewPortWidth {
+ get {
+ return viewport_width;
+ }
+
+ set {
+ viewport_width = value - 4;
+ }
+ }
+
+ internal int ViewPortHeight {
+ get {
+ return viewport_height;
+ }
+
+ set {
+ viewport_height = value;
+ }
+ }
+
+
+ internal int Width {
+ get {
+ return this.document_x;
+ }
+ }
+
+ internal int Height {
+ get {
+ return this.document_y;
+ }
+ }
+
+ internal bool SelectionVisible {
+ get {
+ return selection_visible;
+ }
+ }
+
+ internal bool Wrap {
+ get {
+ return wrap;
+ }
+
+ set {
+ wrap = value;
+ }
+ }
+
+ #endregion // Internal Properties
+
+ #region Private Methods
+ // For debugging
+ internal int DumpTree(Line line, bool with_tags) {
+ int total;
+
+ total = 1;
+
+ Console.Write("Line {0}, Y: {1} Text {2}", line.line_no, line.Y, line.text != null ? line.text.ToString() : "undefined");
+
+ if (line.left == sentinel) {
+ Console.Write(", left = sentinel");
+ } else if (line.left == null) {
+ Console.Write(", left = NULL");
+ }
+
+ if (line.right == sentinel) {
+ Console.Write(", right = sentinel");
+ } else if (line.right == null) {
+ Console.Write(", right = NULL");
+ }
+
+ Console.WriteLine("");
+
+ if (with_tags) {
+ LineTag tag;
+ int count;
+ int length;
+
+ tag = line.tags;
+ count = 1;
+ length = 0;
+ Console.Write(" Tags: ");
+ while (tag != null) {
+ Console.Write("{0} <{1}>-<{2}> ", count++, tag.start, tag.length);
+ length += tag.length;
+
+ if (tag.line != line) {
+ Console.Write("BAD line link");
+ throw new Exception("Bad line link in tree");
+ }
+ tag = tag.next;
+ if (tag != null) {
+ Console.Write(", ");
+ }
+ }
+ if (length > line.text.Length) {
+ throw new Exception(String.Format("Length of tags more than length of text on line (expected {0} calculated {1})", line.text.Length, length));
+ } else if (length < line.text.Length) {
+ throw new Exception(String.Format("Length of tags less than length of text on line (expected {0} calculated {1})", line.text.Length, length));
+ }
+ Console.WriteLine("");
+ }
+ if (line.left != null) {
+ if (line.left != sentinel) {
+ total += DumpTree(line.left, with_tags);
+ }
+ } else {
+ if (line != sentinel) {
+ throw new Exception("Left should not be NULL");
+ }
+ }
+
+ if (line.right != null) {
+ if (line.right != sentinel) {
+ total += DumpTree(line.right, with_tags);
+ }
+ } else {
+ if (line != sentinel) {
+ throw new Exception("Right should not be NULL");
+ }
+ }
+
+ for (int i = 1; i <= this.lines; i++) {
+ if (GetLine(i) == null) {
+ throw new Exception(String.Format("Hole in line order, missing {0}", i));
+ }
+ }
+
+ if (line == this.Root) {
+ if (total < this.lines) {
+ throw new Exception(String.Format("Not enough nodes in tree, found {0}, expected {1}", total, this.lines));
+ } else if (total > this.lines) {
+ throw new Exception(String.Format("Too many nodes in tree, found {0}, expected {1}", total, this.lines));
+ }
+ }
+
+ return total;
+ }
+
+ private void DecrementLines(int line_no) {
+ int current;
+
+ current = line_no;
+ while (current <= lines) {
+ GetLine(current).line_no--;
+ current++;
+ }
+ return;
+ }
+
+ private void IncrementLines(int line_no) {
+ int current;
+
+ current = this.lines;
+ while (current >= line_no) {
+ GetLine(current).line_no++;
+ current--;
+ }
+ return;
+ }
+
+ private void RebalanceAfterAdd(Line line1) {
+ Line line2;
+
+ while ((line1 != document) && (line1.parent.color == LineColor.Red)) {
+ if (line1.parent == line1.parent.parent.left) {
+ line2 = line1.parent.parent.right;
+
+ if ((line2 != null) && (line2.color == LineColor.Red)) {
+ line1.parent.color = LineColor.Black;
+ line2.color = LineColor.Black;
+ line1.parent.parent.color = LineColor.Red;
+ line1 = line1.parent.parent;
+ } else {
+ if (line1 == line1.parent.right) {
+ line1 = line1.parent;
+ RotateLeft(line1);
+ }
+
+ line1.parent.color = LineColor.Black;
+ line1.parent.parent.color = LineColor.Red;
+
+ RotateRight(line1.parent.parent);
+ }
+ } else {
+ line2 = line1.parent.parent.left;
+
+ if ((line2 != null) && (line2.color == LineColor.Red)) {
+ line1.parent.color = LineColor.Black;
+ line2.color = LineColor.Black;
+ line1.parent.parent.color = LineColor.Red;
+ line1 = line1.parent.parent;
+ } else {
+ if (line1 == line1.parent.left) {
+ line1 = line1.parent;
+ RotateRight(line1);
+ }
+
+ line1.parent.color = LineColor.Black;
+ line1.parent.parent.color = LineColor.Red;
+ RotateLeft(line1.parent.parent);
+ }
+ }
+ }
+ document.color = LineColor.Black;
+ }
+
+ private void RebalanceAfterDelete(Line line1) {
+ Line line2;
+
+ while ((line1 != document) && (line1.color == LineColor.Black)) {
+ if (line1 == line1.parent.left) {
+ line2 = line1.parent.right;
+ if (line2.color == LineColor.Red) {
+ line2.color = LineColor.Black;
+ line1.parent.color = LineColor.Red;
+ RotateLeft(line1.parent);
+ line2 = line1.parent.right;
+ }
+ if ((line2.left.color == LineColor.Black) && (line2.right.color == LineColor.Black)) {
+ line2.color = LineColor.Red;
+ line1 = line1.parent;
+ } else {
+ if (line2.right.color == LineColor.Black) {
+ line2.left.color = LineColor.Black;
+ line2.color = LineColor.Red;
+ RotateRight(line2);
+ line2 = line1.parent.right;
+ }
+ line2.color = line1.parent.color;
+ line1.parent.color = LineColor.Black;
+ line2.right.color = LineColor.Black;
+ RotateLeft(line1.parent);
+ line1 = document;
+ }
+ } else {
+ line2 = line1.parent.left;
+ if (line2.color == LineColor.Red) {
+ line2.color = LineColor.Black;
+ line1.parent.color = LineColor.Red;
+ RotateRight(line1.parent);
+ line2 = line1.parent.left;
+ }
+ if ((line2.right.color == LineColor.Black) && (line2.left.color == LineColor.Black)) {
+ line2.color = LineColor.Red;
+ line1 = line1.parent;
+ } else {
+ if (line2.left.color == LineColor.Black) {
+ line2.right.color = LineColor.Black;
+ line2.color = LineColor.Red;
+ RotateLeft(line2);
+ line2 = line1.parent.left;
+ }
+ line2.color = line1.parent.color;
+ line1.parent.color = LineColor.Black;
+ line2.left.color = LineColor.Black;
+ RotateRight(line1.parent);
+ line1 = document;
+ }
+ }
+ }
+ line1.color = LineColor.Black;
+ }
+
+ private void RotateLeft(Line line1) {
+ Line line2 = line1.right;
+
+ line1.right = line2.left;
+
+ if (line2.left != sentinel) {
+ line2.left.parent = line1;
+ }
+
+ if (line2 != sentinel) {
+ line2.parent = line1.parent;
+ }
+
+ if (line1.parent != null) {
+ if (line1 == line1.parent.left) {
+ line1.parent.left = line2;
+ } else {
+ line1.parent.right = line2;
+ }
+ } else {
+ document = line2;
+ }
+
+ line2.left = line1;
+ if (line1 != sentinel) {
+ line1.parent = line2;
+ }
+ }
+
+ private void RotateRight(Line line1) {
+ Line line2 = line1.left;
+
+ line1.left = line2.right;
+
+ if (line2.right != sentinel) {
+ line2.right.parent = line1;
+ }
+
+ if (line2 != sentinel) {
+ line2.parent = line1.parent;
+ }
+
+ if (line1.parent != null) {
+ if (line1 == line1.parent.right) {
+ line1.parent.right = line2;
+ } else {
+ line1.parent.left = line2;
+ }
+ } else {
+ document = line2;
+ }
+
+ line2.right = line1;
+ if (line1 != sentinel) {
+ line1.parent = line2;
+ }
+ }
+
+
+ internal void UpdateView(Line line, int pos) {
+ if (!owner.IsHandleCreated) {
+ return;
+ }
+
+ if (RecalculateDocument(owner.CreateGraphics(), line.line_no, line.line_no, true)) {
+ // Lineheight changed, invalidate the rest of the document
+ if ((line.Y - viewport_y) >=0 ) {
+ // We formatted something that's in view, only draw parts of the screen
+ owner.Invalidate(new Rectangle(0, line.Y - viewport_y, viewport_width, owner.Height - line.Y - viewport_y));
+ } else {
+ // The tag was above the visible area, draw everything
+ owner.Invalidate();
+ }
+ } else {
+ owner.Invalidate(new Rectangle((int)line.widths[pos] - viewport_x - 1, line.Y - viewport_y, viewport_width, line.height));
+ }
+ }
+
+
+ // Update display from line, down line_count lines; pos is unused, but required for the signature
+ internal void UpdateView(Line line, int line_count, int pos) {
+ if (RecalculateDocument(owner.CreateGraphics(), line.line_no, line.line_no + line_count - 1, true)) {
+ // Lineheight changed, invalidate the rest of the document
+ if ((line.Y - viewport_y) >=0 ) {
+ // We formatted something that's in view, only draw parts of the screen
+//blah Console.WriteLine("TextControl.cs(981) Invalidate called in UpdateView(line, line_count, pos)");
+ owner.Invalidate(new Rectangle(0, line.Y - viewport_y, viewport_width, owner.Height - line.Y - viewport_y));
+ } else {
+ // The tag was above the visible area, draw everything
+//blah Console.WriteLine("TextControl.cs(985) Invalidate called in UpdateView(line, line_count, pos)");
+ owner.Invalidate();
+ }
+ } else {
+ Line end_line;
+
+ end_line = GetLine(line.line_no + line_count -1);
+ if (end_line == null) {
+ end_line = line;
+ }
+
+//blah Console.WriteLine("TextControl.cs(996) Invalidate called in UpdateView(line, line_count, pos)");
+ owner.Invalidate(new Rectangle(0 - viewport_x, line.Y - viewport_y, (int)line.widths[line.text.Length], end_line.Y + end_line.height));
+ }
+ }
+ #endregion // Private Methods
+
+ #region Internal Methods
+ // Clear the document and reset state
+ internal void Empty() {
+
+ document = sentinel;
+ last_found = sentinel;
+ lines = 0;
+
+ // We always have a blank line
+ Add(1, "", owner.Font, ThemeEngine.Current.ResPool.GetSolidBrush(owner.ForeColor));
+ this.RecalculateDocument(owner.CreateGraphics());
+ PositionCaret(0, 0);
+
+ selection_visible = false;
+ selection_start.line = this.document;
+ selection_start.pos = 0;
+ selection_start.tag = selection_start.line.tags;
+ selection_end.line = this.document;
+ selection_end.pos = 0;
+ selection_end.tag = selection_end.line.tags;
+
+ viewport_x = 0;
+ viewport_y = 0;
+
+ document_x = 0;
+ document_y = 0;
+ }
+
+ internal void PositionCaret(Line line, int pos) {
+ undo.RecordCursor();
+
+ caret.tag = line.FindTag(pos);
+ caret.line = line;
+ caret.pos = pos;
+ caret.height = caret.tag.height;
+
+ XplatUI.DestroyCaret(owner.Handle);
+ XplatUI.CreateCaret(owner.Handle, 2, caret.height);
+ XplatUI.SetCaretPos(owner.Handle, (int)caret.tag.line.widths[caret.pos] + caret.line.align_shift - viewport_x, caret.line.Y + caret.tag.shift - viewport_y);
+
+ if (CaretMoved != null) CaretMoved(this, EventArgs.Empty);
+ }
+
+ internal void PositionCaret(int x, int y) {
+ undo.RecordCursor();
+
+ caret.tag = FindCursor(x, y, out caret.pos);
+ caret.line = caret.tag.line;
+ caret.height = caret.tag.height;
+
+ XplatUI.DestroyCaret(owner.Handle);
+ XplatUI.CreateCaret(owner.Handle, 2, caret.height);
+ XplatUI.SetCaretPos(owner.Handle, (int)caret.tag.line.widths[caret.pos] + caret.line.align_shift - viewport_x, caret.line.Y + caret.tag.shift - viewport_y);
+
+ if (CaretMoved != null) CaretMoved(this, EventArgs.Empty);
+ }
+
+ internal void CaretHasFocus() {
+ if ((caret.tag != null) && (!selection_visible)) {
+ XplatUI.CreateCaret(owner.Handle, 2, caret.height);
+ XplatUI.SetCaretPos(owner.Handle, (int)caret.tag.line.widths[caret.pos] + caret.line.align_shift - viewport_x, caret.line.Y + caret.tag.shift - viewport_y);
+ XplatUI.CaretVisible(owner.Handle, true);
+ }
+ }
+
+ internal void CaretLostFocus() {
+ XplatUI.DestroyCaret(owner.Handle);
+ }
+
+ internal void AlignCaret() {
+ if (!owner.IsHandleCreated) {
+ return;
+ }
+
+ undo.RecordCursor();
+
+ caret.tag = LineTag.FindTag(caret.line, caret.pos);
+ caret.height = caret.tag.height;
+
+ XplatUI.CreateCaret(owner.Handle, 2, caret.height);
+ XplatUI.SetCaretPos(owner.Handle, (int)caret.tag.line.widths[caret.pos] + caret.line.align_shift - viewport_x, caret.line.Y + caret.tag.shift - viewport_y);
+ XplatUI.CaretVisible(owner.Handle, true);
+
+ if (CaretMoved != null) CaretMoved(this, EventArgs.Empty);
+ }
+
+ internal void UpdateCaret() {
+ undo.RecordCursor();
+
+ if (caret.tag.height != caret.height) {
+ caret.height = caret.tag.height;
+ XplatUI.CreateCaret(owner.Handle, 2, caret.height);
+ }
+ XplatUI.SetCaretPos(owner.Handle, (int)caret.tag.line.widths[caret.pos] + caret.line.align_shift - viewport_x, caret.line.Y + caret.tag.shift - viewport_y);
+ XplatUI.CaretVisible(owner.Handle, true);
+
+ if (CaretMoved != null) CaretMoved(this, EventArgs.Empty);
+ }
+
+ internal void DisplayCaret() {
+ XplatUI.CaretVisible(owner.Handle, true);
+ }
+
+ internal void HideCaret() {
+ XplatUI.CaretVisible(owner.Handle, false);
+ }
+
+ internal void MoveCaret(CaretDirection direction) {
+ // FIXME should we use IsWordSeparator to detect whitespace, instead
+ // of looking for actual spaces in the Word move cases?
+ switch(direction) {
+ case CaretDirection.CharForward: {
+ caret.pos++;
+ if (caret.pos > caret.line.text.Length) {
+ if (multiline) {
+ // Go into next line
+ if (caret.line.line_no < this.lines) {
+ caret.line = GetLine(caret.line.line_no+1);
+ caret.pos = 0;
+ caret.tag = caret.line.tags;
+ } else {
+ caret.pos--;
+ }
+ } else {
+ // Single line; we stay where we are
+ caret.pos--;
+ }
+ } else {
+ if ((caret.tag.start - 1 + caret.tag.length) < caret.pos) {
+ caret.tag = caret.tag.next;
+ }
+ }
+ UpdateCaret();
+ return;
+ }
+
+ case CaretDirection.CharBack: {
+ if (caret.pos > 0) {
+ // caret.pos--; // folded into the if below
+ if (--caret.pos > 0) {
+ if (caret.tag.start > caret.pos) {
+ caret.tag = caret.tag.previous;
+ }
+ }
+ } else {
+ if (caret.line.line_no > 1) {
+ caret.line = GetLine(caret.line.line_no - 1);
+ caret.pos = caret.line.text.Length;
+ caret.tag = LineTag.FindTag(caret.line, caret.pos);
+ }
+ }
+ UpdateCaret();
+ return;
+ }
+
+ case CaretDirection.WordForward: {
+ int len;
+
+ len = caret.line.text.Length;
+ if (caret.pos < len) {
+ while ((caret.pos < len) && (caret.line.text[caret.pos] != ' ')) {
+ caret.pos++;
+ }
+ if (caret.pos < len) {
+ // Skip any whitespace
+ while ((caret.pos < len) && (caret.line.text[caret.pos] == ' ')) {
+ caret.pos++;
+ }
+ }
+ caret.tag = LineTag.FindTag(caret.line, caret.pos);
+ } else {
+ if (caret.line.line_no < this.lines) {
+ caret.line = GetLine(caret.line.line_no + 1);
+ caret.pos = 0;
+ caret.tag = caret.line.tags;
+ }
+ }
+ UpdateCaret();
+ return;
+ }
+
+ case CaretDirection.WordBack: {
+ if (caret.pos > 0) {
+ caret.pos--;
+
+ while ((caret.pos > 0) && (caret.line.text[caret.pos] == ' ')) {
+ caret.pos--;
+ }
+
+ while ((caret.pos > 0) && (caret.line.text[caret.pos] != ' ')) {
+ caret.pos--;
+ }
+
+ if (caret.line.text.ToString(caret.pos, 1) == " ") {
+ if (caret.pos != 0) {
+ caret.pos++;
+ } else {
+ caret.line = GetLine(caret.line.line_no - 1);
+ caret.pos = caret.line.text.Length;
+ }
+ }
+ caret.tag = LineTag.FindTag(caret.line, caret.pos);
+ } else {
+ if (caret.line.line_no > 1) {
+ caret.line = GetLine(caret.line.line_no - 1);
+ caret.pos = caret.line.text.Length;
+ caret.tag = LineTag.FindTag(caret.line, caret.pos);
+ }
+ }
+ UpdateCaret();
+ return;
+ }
+
+ case CaretDirection.LineUp: {
+ if (caret.line.line_no > 1) {
+ int pixel;
+
+ pixel = (int)caret.line.widths[caret.pos];
+ PositionCaret(pixel, GetLine(caret.line.line_no - 1).Y);
+ XplatUI.CaretVisible(owner.Handle, true);
+ }
+ return;
+ }
+
+ case CaretDirection.LineDown: {
+ if (caret.line.line_no < lines) {
+ int pixel;
+
+ pixel = (int)caret.line.widths[caret.pos];
+ PositionCaret(pixel, GetLine(caret.line.line_no + 1).Y);
+ XplatUI.CaretVisible(owner.Handle, true);
+ }
+ return;
+ }
+
+ case CaretDirection.Home: {
+ if (caret.pos > 0) {
+ caret.pos = 0;
+ caret.tag = caret.line.tags;
+ UpdateCaret();
+ }
+ return;
+ }
+
+ case CaretDirection.End: {
+ if (caret.pos < caret.line.text.Length) {
+ caret.pos = caret.line.text.Length;
+ caret.tag = LineTag.FindTag(caret.line, caret.pos);
+ UpdateCaret();
+ }
+ return;
+ }
+
+ case CaretDirection.PgUp: {
+ return;
+ }
+
+ case CaretDirection.PgDn: {
+ return;
+ }
+
+ case CaretDirection.CtrlHome: {
+ caret.line = GetLine(1);
+ caret.pos = 0;
+ caret.tag = caret.line.tags;
+
+ UpdateCaret();
+ return;
+ }
+
+ case CaretDirection.CtrlEnd: {
+ caret.line = GetLine(lines);
+ caret.pos = 0;
+ caret.tag = caret.line.tags;
+
+ UpdateCaret();
+ return;
+ }
+
+ case CaretDirection.SelectionStart: {
+ caret.line = selection_start.line;
+ caret.pos = selection_start.pos;
+ caret.tag = selection_start.tag;
+
+ UpdateCaret();
+ return;
+ }
+
+ case CaretDirection.SelectionEnd: {
+ caret.line = selection_end.line;
+ caret.pos = selection_end.pos;
+ caret.tag = selection_end.tag;
+
+ UpdateCaret();
+ return;
+ }
+ }
+ }
+
+ // Draw the document
+ internal void Draw(Graphics g, Rectangle clip) {
+ Line line; // Current line being drawn
+ LineTag tag; // Current tag being drawn
+ int start; // First line to draw
+ int end; // Last line to draw
+ StringBuilder text; // String representing the current line
+ int line_no; //
+ Brush disabled;
+ Brush hilight;
+ Brush hilight_text;
+
+ // First, figure out from what line to what line we need to draw
+ start = GetLineByPixel(clip.Top + viewport_y, false).line_no;
+ end = GetLineByPixel(clip.Bottom + viewport_y, false).line_no;
+//Console.WriteLine("Starting drawing at line {0}, ending at line {1} (clip-bottom:{2})", start, end, clip.Bottom);
+
+ // Now draw our elements; try to only draw those that are visible
+ line_no = start;
+
+ #if Debug
+ DateTime n = DateTime.Now;
+ Console.WriteLine("Started drawing: {0}s {1}ms", n.Second, n.Millisecond);
+ #endif
+
+ disabled = ThemeEngine.Current.ResPool.GetSolidBrush(ThemeEngine.Current.ColorGrayText);
+ hilight = ThemeEngine.Current.ResPool.GetSolidBrush(ThemeEngine.Current.ColorHighlight);
+ hilight_text = ThemeEngine.Current.ResPool.GetSolidBrush(ThemeEngine.Current.ColorHighlightText);
+
+ while (line_no <= end) {
+ line = GetLine(line_no);
+ tag = line.tags;
+ if (!calc_pass) {
+ text = line.text;
+ } else {
+ // This fails if there's a password > 1024 chars...
+ text = this.password_cache;
+ }
+ while (tag != null) {
+ if (tag.length == 0) {
+ tag = tag.next;
+ continue;
+ }
+
+ if (((tag.X + tag.width) > (clip.Left - viewport_x)) || (tag.X < (clip.Right - viewport_x))) {
+ // Check for selection
+ if ((!selection_visible) || (!owner.has_focus) || (line_no < selection_start.line.line_no) || (line_no > selection_end.line.line_no)) {
+ // regular drawing, no selection to deal with
+ //g.DrawString(s.Substring(tag.start-1, tag.length), tag.font, tag.color, tag.X + line.align_shift - viewport_x, line.Y + tag.shift - viewport_y, StringFormat.GenericTypographic);
+ if (owner.is_enabled) {
+ g.DrawString(text.ToString(tag.start-1, tag.length), tag.font, tag.color, tag.X + line.align_shift - viewport_x, line.Y + tag.shift - viewport_y, StringFormat.GenericTypographic);
+ } else {
+ Color a;
+ Color b;
+
+ a = ((SolidBrush)tag.color).Color;
+ b = ThemeEngine.Current.ColorWindowText;
+
+ if ((a.R == b.R) && (a.G == b.G) && (a.B == b.B)) {
+ g.DrawString(text.ToString(tag.start-1, tag.length), tag.font, disabled, tag.X + line.align_shift - viewport_x, line.Y + tag.shift - viewport_y, StringFormat.GenericTypographic);
+ } else {
+ g.DrawString(text.ToString(tag.start-1, tag.length), tag.font, tag.color, tag.X + line.align_shift - viewport_x, line.Y + tag.shift - viewport_y, StringFormat.GenericTypographic);
+ }
+ }
+ } else {
+ // we might have to draw our selection
+ if ((line_no != selection_start.line.line_no) && (line_no != selection_end.line.line_no)) {
+ // Special case, whole line is selected, draw this tag selected
+ g.FillRectangle(
+ hilight, // Brush
+ tag.X + line.align_shift - viewport_x, // X
+ line.Y + tag.shift - viewport_y, // Y
+ line.widths[tag.start + tag.length - 1], // width
+ tag.height // Height
+ );
+
+ g.DrawString(
+ //s.Substring(tag.start-1, tag.length), // String
+ text.ToString(tag.start-1, tag.length), // String
+ tag.font, // Font
+ hilight_text, // Brush
+ tag.X + line.align_shift - viewport_x, // X
+ line.Y + tag.shift - viewport_y, // Y
+ StringFormat.GenericTypographic);
+ } else {
+ bool highlight;
+ bool partial;
+
+ highlight = false;
+ partial = false;
+
+ // One or more, but not all tags on the line are selected
+ if ((selection_start.tag == tag) && (selection_end.tag == tag)) {
+ // Single tag selected, draw "normalSELECTEDnormal"
+ partial = true;
+ // First, the regular part
+ g.DrawString(
+ //s.Substring(tag.start - 1, selection_start.pos - tag.start + 1), // String
+ text.ToString(tag.start - 1, selection_start.pos - tag.start + 1), // String
+ tag.font, // Font
+ tag.color, // Brush
+ tag.X + line.align_shift - viewport_x, // X
+ line.Y + tag.shift - viewport_y, // Y
+ StringFormat.GenericTypographic);
+
+ // Now the highlight
+ g.FillRectangle(
+ hilight, // Brush
+ line.widths[selection_start.pos] + line.align_shift, // X
+ line.Y + tag.shift - viewport_y, // Y
+ line.widths[selection_end.pos] - line.widths[selection_start.pos], // Width
+ tag.height); // Height
+
+ g.DrawString(
+ //s.Substring(selection_start.pos, selection_end.pos - selection_start.pos), // String
+ text.ToString(selection_start.pos, selection_end.pos - selection_start.pos), // String
+ tag.font, // Font
+ hilight_text, // Brush
+ line.widths[selection_start.pos] + line.align_shift - viewport_x, // X
+ line.Y + tag.shift - viewport_y, // Y
+ StringFormat.GenericTypographic);
+
+ // And back to the regular
+ g.DrawString(
+ //s.Substring(selection_end.pos, tag.start + tag.length - selection_end.pos - 1), // String
+ text.ToString(selection_end.pos, tag.start + tag.length - selection_end.pos - 1), // String
+ tag.font, // Font
+ tag.color, // Brush
+ line.widths[selection_end.pos] + line.align_shift - viewport_x, // X
+ line.Y + tag.shift - viewport_y, // Y
+ StringFormat.GenericTypographic);
+
+ } else if (selection_start.tag == tag) {
+ partial = true;
+
+ // The highlighted part
+ g.FillRectangle(
+ hilight,
+ line.widths[selection_start.pos] + line.align_shift,
+ line.Y + tag.shift - viewport_y,
+ line.widths[tag.start + tag.length - 1] - line.widths[selection_start.pos],
+ tag.height);
+
+ g.DrawString(
+ //s.Substring(selection_start.pos, tag.start + tag.length - selection_start.pos - 1), // String
+ text.ToString(selection_start.pos, tag.start + tag.length - selection_start.pos - 1), // String
+ tag.font, // Font
+ hilight_text, // Brush
+ line.widths[selection_start.pos] + line.align_shift - viewport_x, // X
+ line.Y + tag.shift - viewport_y, // Y
+ StringFormat.GenericTypographic);
+
+ // The regular part
+ g.DrawString(
+ //s.Substring(tag.start - 1, selection_start.pos - tag.start + 1), // String
+ text.ToString(tag.start - 1, selection_start.pos - tag.start + 1), // String
+ tag.font, // Font
+ tag.color, // Brush
+ tag.X + line.align_shift - viewport_x, // X
+ line.Y + tag.shift - viewport_y, // Y
+ StringFormat.GenericTypographic);
+ } else if (selection_end.tag == tag) {
+ partial = true;
+
+ // The highlighted part
+ g.FillRectangle(
+ hilight,
+ tag.X + line.align_shift - viewport_x,
+ line.Y + tag.shift - viewport_y,
+ line.widths[selection_end.pos] - line.widths[tag.start - 1],
+ tag.height);
+
+ g.DrawString(
+ //s.Substring(tag.start - 1, selection_end.pos - tag.start + 1), // String
+ text.ToString(tag.start - 1, selection_end.pos - tag.start + 1), // String
+ tag.font, // Font
+ hilight_text, // Brush
+ tag.X + line.align_shift - viewport_x, // X
+ line.Y + tag.shift - viewport_y, // Y
+ StringFormat.GenericTypographic);
+
+ // The regular part
+ g.DrawString(
+ //s.Substring(selection_end.pos, tag.start + tag.length - selection_end.pos - 1), // String
+ text.ToString(selection_end.pos, tag.start + tag.length - selection_end.pos - 1), // String
+ tag.font, // Font
+ tag.color, // Brush
+ line.widths[selection_end.pos] + line.align_shift - viewport_x, // X
+ line.Y + tag.shift - viewport_y, // Y
+ StringFormat.GenericTypographic);
+ } else {
+ // no partially selected tags here, simple checks...
+ if (selection_start.line == line) {
+ int begin;
+ int stop;
+
+ begin = tag.start - 1;
+ stop = tag.start + tag.length - 1;
+ if (selection_end.line == line) {
+ if ((begin >= selection_start.pos) && (stop < selection_end.pos)) {
+ highlight = true;
+ }
+ } else {
+ if (stop > selection_start.pos) {
+ highlight = true;
+ }
+ }
+ } else if (selection_end.line == line) {
+ if ((tag.start - 1) < selection_end.pos) {
+ highlight = true;
+ }
+ }
+ }
+
+ if (!partial) {
+ if (highlight) {
+ g.FillRectangle(
+ hilight,
+ tag.X + line.align_shift - viewport_x,
+ line.Y + tag.shift - viewport_y,
+ line.widths[tag.start + tag.length - 1] - line.widths[tag.start - 1],
+ tag.height);
+
+ g.DrawString(
+ //s.Substring(tag.start-1, tag.length), // String
+ text.ToString(tag.start-1, tag.length), // String
+ tag.font, // Font
+ hilight_text, // Brush
+ tag.X + line.align_shift - viewport_x, // X
+ line.Y + tag.shift - viewport_y, // Y
+ StringFormat.GenericTypographic);
+ } else {
+ g.DrawString(
+ //s.Substring(tag.start-1, tag.length), // String
+ text.ToString(tag.start-1, tag.length), // String
+ tag.font, // Font
+ tag.color, // Brush
+ tag.X + line.align_shift - viewport_x, // X
+ line.Y + tag.shift - viewport_y, // Y
+ StringFormat.GenericTypographic);
+ }
+ }
+ }
+
+ }
+ }
+
+ tag = tag.next;
+ }
+
+ line_no++;
+ }
+ #if Debug
+ n = DateTime.Now;
+ Console.WriteLine("Finished drawing: {0}s {1}ms", n.Second, n.Millisecond);
+ #endif
+
+ }
+
+ internal void Insert(Line line, int pos, string s) {
+ Insert(line, pos, false, s);
+ }
+
+ // Insert multi-line text at the given position; use formatting at insertion point for inserted text
+ internal void Insert(Line line, int pos, bool update_caret, string s) {
+ int i;
+ int base_line;
+ string[] ins;
+ int insert_lines;
+ LineTag tag;
+
+
+ // The formatting at the insertion point is used for the inserted text
+ tag = LineTag.FindTag(line, pos);
+
+ base_line = line.line_no;
+
+ ins = s.Split(new char[] {'\n'});
+
+ for (int j = 0; j < ins.Length; j++) {
+ if (ins[j].EndsWith("\r")) {
+ ins[j] = ins[j].Substring(0, ins[j].Length - 1);
+ }
+ }
+
+ insert_lines = ins.Length;
+
+ // Bump the text at insertion point a line down if we're inserting more than one line
+ if (insert_lines > 1) {
+ Split(line, pos);
+ // Remainder of start line is now in base_line + 1
+ }
+
+ // Insert the first line
+ InsertString(line, pos, ins[0]);
+
+ if (insert_lines > 1) {
+ for (i = 1; i < insert_lines; i++) {
+ Add(base_line + i, ins[i], line.alignment, tag.font, tag.color);
+ }
+ if (!s.EndsWith("\n")) {
+ this.Combine(base_line + insert_lines - 1, base_line + insert_lines);
+ }
+ }
+
+ UpdateView(line, insert_lines + 1, pos);
+
+ if (update_caret) {
+ // Move caret to the end of the inserted text
+ if (insert_lines > 1) {
+ PositionCaret(GetLine(line.line_no + insert_lines - 1), ins[ins.Length - 1].Length);
+ } else {
+ PositionCaret(line, pos + ins[0].Length);
+ }
+ XplatUI.CaretVisible(owner.Handle, true);
+ }
+ }
+
+ // Inserts a character at the given position
+ internal void InsertString(Line line, int pos, string s) {
+ InsertString(line.FindTag(pos), pos, s);
+ }
+
+ // Inserts a string at the given position
+ internal void InsertString(LineTag tag, int pos, string s) {
+ Line line;
+ int len;
+
+ len = s.Length;
+
+ CharCount += len;
+
+ line = tag.line;
+ line.text.Insert(pos, s);
+ tag.length += len;
+
+ tag = tag.next;
+ while (tag != null) {
+ tag.start += len;
+ tag = tag.next;
+ }
+ line.Grow(len);
+ line.recalc = true;
+
+ UpdateView(line, pos);
+ }
+
+ // Inserts a string at the caret position
+ internal void InsertStringAtCaret(string s, bool move_caret) {
+ LineTag tag;
+ int len;
+
+ len = s.Length;
+
+ CharCount += len;
+
+ caret.line.text.Insert(caret.pos, s);
+ caret.tag.length += len;
+
+ if (caret.tag.next != null) {
+ tag = caret.tag.next;
+ while (tag != null) {
+ tag.start += len;
+ tag = tag.next;
+ }
+ }
+ caret.line.Grow(len);
+ caret.line.recalc = true;
+
+ UpdateView(caret.line, caret.pos);
+ if (move_caret) {
+ caret.pos += len;
+ UpdateCaret();
+ }
+ }
+
+
+
+ // Inserts a character at the given position
+ internal void InsertChar(Line line, int pos, char ch) {
+ InsertChar(line.FindTag(pos), pos, ch);
+ }
+
+ // Inserts a character at the given position
+ internal void InsertChar(LineTag tag, int pos, char ch) {
+ Line line;
+
+ CharCount++;
+
+ line = tag.line;
+ line.text.Insert(pos, ch);
+ tag.length++;
+
+ tag = tag.next;
+ while (tag != null) {
+ tag.start++;
+ tag = tag.next;
+ }
+ line.Grow(1);
+ line.recalc = true;
+
+ UpdateView(line, pos);
+ }
+
+ // Inserts a character at the current caret position
+ internal void InsertCharAtCaret(char ch, bool move_caret) {
+ LineTag tag;
+
+ CharCount++;
+
+ caret.line.text.Insert(caret.pos, ch);
+ caret.tag.length++;
+
+ if (caret.tag.next != null) {
+ tag = caret.tag.next;
+ while (tag != null) {
+ tag.start++;
+ tag = tag.next;
+ }
+ }
+ caret.line.Grow(1);
+ caret.line.recalc = true;
+
+ UpdateView(caret.line, caret.pos);
+ if (move_caret) {
+ caret.pos++;
+ UpdateCaret();
+ }
+ }
+
+ // Deletes n characters at the given position; it will not delete past line limits
+ // pos is 0-based
+ internal void DeleteChars(LineTag tag, int pos, int count) {
+ Line line;
+ bool streamline;
+
+ streamline = false;
+ line = tag.line;
+
+ CharCount -= count;
+
+ if (pos == line.text.Length) {
+ return;
+ }
+
+ line.text.Remove(pos, count);
+
+ // Make sure the tag points to the right spot
+ while ((tag != null) && (tag.start + tag.length - 1) <= pos) {
+ tag = tag.next;
+ }
+
+ if (tag == null) {
+ return;
+ }
+
+ // Check if we're crossing tag boundaries
+ if ((pos + count) > (tag.start + tag.length - 1)) {
+ int left;
+
+ // We have to delete cross tag boundaries
+ streamline = true;
+ left = count;
+
+ left -= tag.start + tag.length - pos - 1;
+ tag.length -= tag.start + tag.length - pos - 1;
+
+ tag = tag.next;
+ while ((tag != null) && (left > 0)) {
+ tag.start -= count - left;
+ if (tag.length > left) {
+ tag.length -= left;
+ left = 0;
+ } else {
+ left -= tag.length;
+ tag.length = 0;
+
+ tag = tag.next;
+ }
+ }
+ } else {
+ // We got off easy, same tag
+
+ tag.length -= count;
+
+ if (tag.length == 0) {
+ streamline = true;
+ }
+ }
+
+ // Adjust the start point of any tags following
+ if (tag != null) {
+ tag = tag.next;
+ while (tag != null) {
+ tag.start -= count;
+ tag = tag.next;
+ }
+ }
+
+ line.recalc = true;
+ if (streamline) {
+ line.Streamline();
+ }
+
+ UpdateView(line, pos);
+ }
+
+ // Deletes a character at or after the given position (depending on forward); it will not delete past line limits
+ internal void DeleteChar(LineTag tag, int pos, bool forward) {
+ Line line;
+ bool streamline;
+
+ CharCount--;
+
+ streamline = false;
+ line = tag.line;
+
+ if ((pos == 0 && forward == false) || (pos == line.text.Length && forward == true)) {
+ return;
+ }
+
+
+ if (forward) {
+ line.text.Remove(pos, 1);
+
+ while ((tag != null) && (tag.start + tag.length - 1) <= pos) {
+ tag = tag.next;
+ }
+
+ if (tag == null) {
+ return;
+ }
+
+ tag.length--;
+
+ if (tag.length == 0) {
+ streamline = true;
+ }
+ } else {
+ pos--;
+ line.text.Remove(pos, 1);
+ if (pos >= (tag.start - 1)) {
+ tag.length--;
+ if (tag.length == 0) {
+ streamline = true;
+ }
+ } else if (tag.previous != null) {
+ tag.previous.length--;
+ if (tag.previous.length == 0) {
+ streamline = true;
+ }
+ }
+ }
+
+ tag = tag.next;
+ while (tag != null) {
+ tag.start--;
+ tag = tag.next;
+ }
+ line.recalc = true;
+ if (streamline) {
+ line.Streamline();
+ }
+
+ UpdateView(line, pos);
+ }
+
+ // Combine two lines
+ internal void Combine(int FirstLine, int SecondLine) {
+ Combine(GetLine(FirstLine), GetLine(SecondLine));
+ }
+
+ internal void Combine(Line first, Line second) {
+ LineTag last;
+ int shift;
+
+ // Combine the two tag chains into one
+ last = first.tags;
+
+ while (last.next != null) {
+ last = last.next;
+ }
+
+ last.next = second.tags;
+ last.next.previous = last;
+
+ shift = last.start + last.length - 1;
+
+ // Fix up references within the chain
+ last = last.next;
+ while (last != null) {
+ last.line = first;
+ last.start += shift;
+ last = last.next;
+ }
+
+ // Combine both lines' strings
+ first.text.Insert(first.text.Length, second.text.ToString());
+ first.Grow(first.text.Length);
+
+ // Remove the reference to our (now combined) tags from the doomed line
+ second.tags = null;
+
+ // Renumber lines
+ DecrementLines(first.line_no + 2); // first.line_no + 1 will be deleted, so we need to start renumbering one later
+
+ // Mop up
+ first.recalc = true;
+ first.height = 0; // This forces RecalcDocument/UpdateView to redraw from this line on
+ first.Streamline();
+
+ #if Debug
+ Line check_first;
+ Line check_second;
+
+ check_first = GetLine(first.line_no);
+ check_second = GetLine(check_first.line_no + 1);
+
+ Console.WriteLine("Pre-delete: Y of first line: {0}, second line: {1}", check_first.Y, check_second.Y);
+ #endif
+
+ this.Delete(second);
+
+ #if Debug
+ check_first = GetLine(first.line_no);
+ check_second = GetLine(check_first.line_no + 1);
+
+ Console.WriteLine("Post-delete Y of first line: {0}, second line: {1}", check_first.Y, check_second.Y);
+ #endif
+
+ }
+
+ // Split the line at the position into two
+ internal void Split(int LineNo, int pos) {
+ Line line;
+ LineTag tag;
+
+ line = GetLine(LineNo);
+ tag = LineTag.FindTag(line, pos);
+ Split(line, tag, pos, false);
+ }
+
+ internal void Split(Line line, int pos) {
+ LineTag tag;
+
+ tag = LineTag.FindTag(line, pos);
+ Split(line, tag, pos, false);
+ }
+
+ internal void Split(Line line, LineTag tag, int pos, bool soft) {
+ LineTag new_tag;
+ Line new_line;
+ bool move_caret;
+ bool move_sel_start;
+ bool move_sel_end;
+
+ move_caret = false;
+ move_sel_start = false;
+ move_sel_end = false;
+
+ // Adjust selection and cursors
+ if (soft && (caret.line == line) && (caret.pos > pos)) {
+ move_caret = true;
+ }
+ if (selection_start.line == line && selection_start.pos > pos) {
+ move_sel_start = true;
+ }
+
+ if (selection_end.line == line && selection_end.pos > pos) {
+ move_sel_end = true;
+ }
+
+ // cover the easy case first
+ if (pos == line.text.Length) {
+ Add(line.line_no + 1, "", line.alignment, tag.font, tag.color);
+
+ new_line = GetLine(line.line_no + 1);
+
+ if (soft) {
+ if (move_caret) {
+ caret.line = new_line;
+ caret.line.soft_break = true;
+ caret.tag = new_line.tags;
+ caret.pos = 0;
+ } else {
+ new_line.soft_break = true;
+ }
+ }
+
+ if (move_sel_start) {
+ selection_start.line = new_line;
+ selection_start.pos = 0;
+ selection_start.tag = new_line.tags;
+ }
+
+ if (move_sel_end) {
+ selection_end.line = new_line;
+ selection_end.pos = 0;
+ selection_end.tag = new_line.tags;
+ }
+ return;
+ }
+
+ // We need to move the rest of the text into the new line
+ Add(line.line_no + 1, line.text.ToString(pos, line.text.Length - pos), line.alignment, tag.font, tag.color);
+
+ // Now transfer our tags from this line to the next
+ new_line = GetLine(line.line_no + 1);
+ line.recalc = true;
+ new_line.recalc = true;
+
+ if ((tag.start - 1) == pos) {
+ int shift;
+
+ // We can simply break the chain and move the tag into the next line
+ if (tag == line.tags) {
+ new_tag = new LineTag(line, 1, 0);
+ new_tag.font = tag.font;
+ new_tag.color = tag.color;
+ line.tags = new_tag;
+ }
+
+ if (tag.previous != null) {
+ tag.previous.next = null;
+ }
+ new_line.tags = tag;
+ tag.previous = null;
+ tag.line = new_line;
+
+ // Walk the list and correct the start location of the tags we just bumped into the next line
+ shift = tag.start - 1;
+
+ new_tag = tag;
+ while (new_tag != null) {
+ new_tag.start -= shift;
+ new_tag.line = new_line;
+ new_tag = new_tag.next;
+ }
+ } else {
+ int shift;
+
+ new_tag = new LineTag(new_line, 1, tag.start - 1 + tag.length - pos);
+ new_tag.next = tag.next;
+ new_tag.font = tag.font;
+ new_tag.color = tag.color;
+ new_line.tags = new_tag;
+ if (new_tag.next != null) {
+ new_tag.next.previous = new_tag;
+ }
+ tag.next = null;
+ tag.length = pos - tag.start + 1;
+
+ shift = pos;
+ new_tag = new_tag.next;
+ while (new_tag != null) {
+ new_tag.start -= shift;
+ new_tag.line = new_line;
+ new_tag = new_tag.next;
+
+ }
+ }
+
+ if (soft) {
+ if (move_caret) {
+ caret.line = new_line;
+ caret.pos = caret.pos - pos;
+ caret.tag = caret.line.FindTag(caret.pos);
+ }
+ new_line.soft_break = true;
+ }
+
+ if (move_sel_start) {
+ selection_start.line = new_line;
+ selection_start.pos = selection_start.pos - pos;
+ selection_start.tag = new_line.FindTag(selection_start.pos);
+ }
+
+ if (move_sel_end) {
+ selection_end.line = new_line;
+ selection_end.pos = selection_end.pos - pos;
+ selection_end.tag = new_line.FindTag(selection_end.pos);
+ }
+
+ CharCount -= line.text.Length - pos;
+ line.text.Remove(pos, line.text.Length - pos);
+ }
+
+ // Adds a line of text, with given font.
+ // Bumps any line at that line number that already exists down
+ internal void Add(int LineNo, string Text, Font font, Brush color) {
+ Add(LineNo, Text, HorizontalAlignment.Left, font, color);
+ }
+
+ internal void Add(int LineNo, string Text, HorizontalAlignment align, Font font, Brush color) {
+ Line add;
+ Line line;
+ int line_no;
+
+ CharCount += Text.Length;
+
+ if (LineNo<1 || Text == null) {
+ if (LineNo<1) {
+ throw new ArgumentNullException("LineNo", "Line numbers must be positive");
+ } else {
+ throw new ArgumentNullException("Text", "Cannot insert NULL line");
+ }
+ }
+
+ add = new Line(LineNo, Text, align, font, color);
+
+ line = document;
+ while (line != sentinel) {
+ add.parent = line;
+ line_no = line.line_no;
+
+ if (LineNo > line_no) {
+ line = line.right;
+ } else if (LineNo < line_no) {
+ line = line.left;
+ } else {
+ // Bump existing line numbers; walk all nodes to the right of this one and increment line_no
+ IncrementLines(line.line_no);
+ line = line.left;
+ }
+ }
+
+ add.left = sentinel;
+ add.right = sentinel;
+
+ if (add.parent != null) {
+ if (LineNo > add.parent.line_no) {
+ add.parent.right = add;
+ } else {
+ add.parent.left = add;
+ }
+ } else {
+ // Root node
+ document = add;
+ }
+
+ RebalanceAfterAdd(add);
+
+ lines++;
+ }
+
+ internal virtual void Clear() {
+ lines = 0;
+ document = sentinel;
+ }
+
+ public virtual object Clone() {
+ Document clone;
+
+ clone = new Document(null);
+
+ clone.lines = this.lines;
+ clone.document = (Line)document.Clone();
+
+ return clone;
+ }
+
+ internal void Delete(int LineNo) {
+ Line line;
+
+ if (LineNo>lines) {
+ return;
+ }
+
+ line = GetLine(LineNo);
+
+ CharCount -= line.text.Length;
+
+ DecrementLines(LineNo + 1);
+ Delete(line);
+ }
+
+ internal void Delete(Line line1) {
+ Line line2;// = new Line();
+ Line line3;
+
+ if ((line1.left == sentinel) || (line1.right == sentinel)) {
+ line3 = line1;
+ } else {
+ line3 = line1.right;
+ while (line3.left != sentinel) {
+ line3 = line3.left;
+ }
+ }
+
+ if (line3.left != sentinel) {
+ line2 = line3.left;
+ } else {
+ line2 = line3.right;
+ }
+
+ line2.parent = line3.parent;
+ if (line3.parent != null) {
+ if(line3 == line3.parent.left) {
+ line3.parent.left = line2;
+ } else {
+ line3.parent.right = line2;
+ }
+ } else {
+ document = line2;
+ }
+
+ if (line3 != line1) {
+ LineTag tag;
+
+ line1.ascent = line3.ascent;
+ line1.height = line3.height;
+ line1.line_no = line3.line_no;
+ line1.recalc = line3.recalc;
+ line1.space = line3.space;
+ line1.tags = line3.tags;
+ line1.text = line3.text;
+ line1.widths = line3.widths;
+ line1.Y = line3.Y;
+ line1.soft_break = line3.soft_break;
+
+ tag = line1.tags;
+ while (tag != null) {
+ tag.line = line1;
+ tag = tag.next;
+ }
+ }
+
+ if (line3.color == LineColor.Black)
+ RebalanceAfterDelete(line2);
+
+ this.lines--;
+
+ last_found = sentinel;
+ }
+
+ // Invalidate a section of the document to trigger redraw
+ internal void Invalidate(Line start, int start_pos, Line end, int end_pos) {
+ Line l1;
+ Line l2;
+ int p1;
+ int p2;
+
+ if ((start == end) && (start_pos == end_pos)) {
+ return;
+ }
+
+ if (end_pos == -1) {
+ end_pos = end.text.Length;
+ }
+
+ // figure out what's before what so the logic below is straightforward
+ if (start.line_no < end.line_no) {
+ l1 = start;
+ p1 = start_pos;
+
+ l2 = end;
+ p2 = end_pos;
+ } else if (start.line_no > end.line_no) {
+ l1 = end;
+ p1 = end_pos;
+
+ l2 = start;
+ p2 = start_pos;
+ } else {
+ if (start_pos < end_pos) {
+ l1 = start;
+ p1 = start_pos;
+
+ l2 = end;
+ p2 = end_pos;
+ } else {
+ l1 = end;
+ p1 = end_pos;
+
+ l2 = start;
+ p2 = start_pos;
+ }
+
+ #if Debug
+ Console.WriteLine("Invaliding from {0}:{1} to {2}:{3}", l1.line_no, p1, l2.line_no, p2);
+ #endif
+
+ owner.Invalidate(
+ new Rectangle(
+ (int)l1.widths[p1] + l1.align_shift - viewport_x,
+ l1.Y - viewport_y,
+ (int)l2.widths[p2] - (int)l1.widths[p1] + 1,
+ l1.height
+ )
+ );
+ return;
+ }
+
+ #if Debug
+ Console.WriteLine("Invaliding from {0}:{1} to {2}:{3} Start => x={4}, y={5}, {6}x{7}", l1.line_no, p1, l2.line_no, p2, (int)l1.widths[p1] + l1.align_shift - viewport_x, l1.Y - viewport_y, viewport_width, l1.height);
+ #endif
+
+ // Three invalidates:
+ // First line from start
+ owner.Invalidate(new Rectangle((int)l1.widths[p1] + l1.align_shift - viewport_x, l1.Y - viewport_y, viewport_width, l1.height));
+
+ // lines inbetween
+ if ((l1.line_no + 1) < l2.line_no) {
+ int y;
+
+ y = GetLine(l1.line_no + 1).Y;
+ owner.Invalidate(new Rectangle(0, y - viewport_y, viewport_width, GetLine(l2.line_no).Y - y - viewport_y));
+
+ #if Debug
+ Console.WriteLine("Invaliding from {0}:{1} to {2}:{3} Middle => x={4}, y={5}, {6}x{7}", l1.line_no, p1, l2.line_no, p2, 0, y - viewport_y, viewport_width, GetLine(l2.line_no).Y - y - viewport_y);
+ #endif
+ }
+
+ // Last line to end
+ owner.Invalidate(new Rectangle((int)l2.widths[0] + l2.align_shift - viewport_x, l2.Y - viewport_y, (int)l2.widths[p2] + 1, l2.height));
+ #if Debug
+ Console.WriteLine("Invaliding from {0}:{1} to {2}:{3} End => x={4}, y={5}, {6}x{7}", l1.line_no, p1, l2.line_no, p2, (int)l2.widths[0] + l2.align_shift - viewport_x, l2.Y - viewport_y, (int)l2.widths[p2] + 1, l2.height);
+ #endif
+ }
+
+ /// <summary>Select text around caret</summary>
+ internal void ExpandSelection(CaretSelection mode, bool to_caret) {
+ if (to_caret) {
+ // We're expanding the selection to the caret position
+ switch(mode) {
+ case CaretSelection.Line: {
+ // Invalidate the selection delta
+ if (caret > selection_prev) {
+ Invalidate(selection_prev.line, 0, caret.line, caret.line.text.Length);
+ } else {
+ Invalidate(selection_prev.line, selection_prev.line.text.Length, caret.line, 0);
+ }
+
+ if (caret.line.line_no <= selection_anchor.line.line_no) {
+ selection_start.line = caret.line;
+ selection_start.tag = caret.line.tags;
+ selection_start.pos = 0;
+
+ selection_end.line = selection_anchor.line;
+ selection_end.tag = selection_anchor.tag;
+ selection_end.pos = selection_anchor.pos;
+
+ selection_end_anchor = true;
+ } else {
+ selection_start.line = selection_anchor.line;
+ selection_start.pos = selection_anchor.height;
+ selection_start.tag = selection_anchor.line.FindTag(selection_anchor.height);
+
+ selection_end.line = caret.line;
+ selection_end.tag = caret.line.tags;
+ selection_end.pos = caret.line.text.Length;
+
+ selection_end_anchor = false;
+ }
+ selection_prev.line = caret.line;
+ selection_prev.tag = caret.tag;
+ selection_prev.pos = caret.pos;
+
+ break;
+ }
+
+ case CaretSelection.Word: {
+ int start_pos;
+ int end_pos;
+
+ start_pos = FindWordSeparator(caret.line, caret.pos, false);
+ end_pos = FindWordSeparator(caret.line, caret.pos, true);
+
+
+ // Invalidate the selection delta
+ if (caret > selection_prev) {
+ Invalidate(selection_prev.line, selection_prev.pos, caret.line, end_pos);
+ } else {
+ Invalidate(selection_prev.line, selection_prev.pos, caret.line, start_pos);
+ }
+ if (caret < selection_anchor) {
+ selection_start.line = caret.line;
+ selection_start.tag = caret.line.FindTag(start_pos);
+ selection_start.pos = start_pos;
+
+ selection_end.line = selection_anchor.line;
+ selection_end.tag = selection_anchor.tag;
+ selection_end.pos = selection_anchor.pos;
+
+ selection_prev.line = caret.line;
+ selection_prev.tag = caret.tag;
+ selection_prev.pos = start_pos;
+
+ selection_end_anchor = true;
+ } else {
+ selection_start.line = selection_anchor.line;
+ selection_start.pos = selection_anchor.height;
+ selection_start.tag = selection_anchor.line.FindTag(selection_anchor.height);
+
+ selection_end.line = caret.line;
+ selection_end.tag = caret.line.FindTag(end_pos);
+ selection_end.pos = end_pos;
+
+ selection_prev.line = caret.line;
+ selection_prev.tag = caret.tag;
+ selection_prev.pos = end_pos;
+
+ selection_end_anchor = false;
+ }
+ break;
+ }
+
+ case CaretSelection.Position: {
+ SetSelectionToCaret(false);
+ return;
+ }
+ }
+ } else {
+ // We're setting the selection 'around' the caret position
+ switch(mode) {
+ case CaretSelection.Line: {
+ this.Invalidate(caret.line, 0, caret.line, caret.line.text.Length);
+
+ selection_start.line = caret.line;
+ selection_start.tag = caret.line.tags;
+ selection_start.pos = 0;
+
+ selection_end.line = caret.line;
+ selection_end.pos = caret.line.text.Length;
+ selection_end.tag = caret.line.FindTag(selection_end.pos);
+
+ selection_anchor.line = selection_end.line;
+ selection_anchor.tag = selection_end.tag;
+ selection_anchor.pos = selection_end.pos;
+ selection_anchor.height = 0;
+
+ selection_prev.line = caret.line;
+ selection_prev.tag = caret.tag;
+ selection_prev.pos = caret.pos;
+
+ this.selection_end_anchor = true;
+
+ break;
+ }
+
+ case CaretSelection.Word: {
+ int start_pos;
+ int end_pos;
+
+ start_pos = FindWordSeparator(caret.line, caret.pos, false);
+ end_pos = FindWordSeparator(caret.line, caret.pos, true);
+
+ this.Invalidate(selection_start.line, start_pos, caret.line, end_pos);
+
+ selection_start.line = caret.line;
+ selection_start.tag = caret.line.FindTag(start_pos);
+ selection_start.pos = start_pos;
+
+ selection_end.line = caret.line;
+ selection_end.tag = caret.line.FindTag(end_pos);
+ selection_end.pos = end_pos;
+
+ selection_anchor.line = selection_end.line;
+ selection_anchor.tag = selection_end.tag;
+ selection_anchor.pos = selection_end.pos;
+ selection_anchor.height = start_pos;
+
+ selection_prev.line = caret.line;
+ selection_prev.tag = caret.tag;
+ selection_prev.pos = caret.pos;
+
+ this.selection_end_anchor = true;
+
+ break;
+ }
+ }
+ }
+
+ if (selection_start == selection_end) {
+ selection_visible = false;
+ } else {
+ selection_visible = true;
+ }
+ }
+
+ internal void SetSelectionToCaret(bool start) {
+ if (start) {
+ // Invalidate old selection; selection is being reset to empty
+ this.Invalidate(selection_start.line, selection_start.pos, selection_end.line, selection_end.pos);
+
+ selection_start.line = caret.line;
+ selection_start.tag = caret.tag;
+ selection_start.pos = caret.pos;
+
+ // start always also selects end
+ selection_end.line = caret.line;
+ selection_end.tag = caret.tag;
+ selection_end.pos = caret.pos;
+
+ selection_anchor.line = caret.line;
+ selection_anchor.tag = caret.tag;
+ selection_anchor.pos = caret.pos;
+ } else {
+ // Invalidate from previous end to caret (aka new end)
+ if (selection_end_anchor) {
+ if (selection_start != caret) {
+ this.Invalidate(selection_start.line, selection_start.pos, caret.line, caret.pos);
+ }
+ } else {
+ if (selection_end != caret) {
+ this.Invalidate(selection_end.line, selection_end.pos, caret.line, caret.pos);
+ }
+ }
+
+ if (caret < selection_anchor) {
+ selection_start.line = caret.line;
+ selection_start.tag = caret.tag;
+ selection_start.pos = caret.pos;
+
+ selection_end.line = selection_anchor.line;
+ selection_end.tag = selection_anchor.tag;
+ selection_end.pos = selection_anchor.pos;
+
+ selection_end_anchor = true;
+ } else {
+ selection_start.line = selection_anchor.line;
+ selection_start.tag = selection_anchor.tag;
+ selection_start.pos = selection_anchor.pos;
+
+ selection_end.line = caret.line;
+ selection_end.tag = caret.tag;
+ selection_end.pos = caret.pos;
+
+ selection_end_anchor = false;
+ }
+ }
+
+ if (selection_start == selection_end) {
+ selection_visible = false;
+ } else {
+ selection_visible = true;
+ }
+ }
+
+ internal void SetSelection(Line start, int start_pos, Line end, int end_pos) {
+ if (selection_visible) {
+ Invalidate(selection_start.line, selection_start.pos, selection_end.line, selection_end.pos);
+ }
+
+ if ((end.line_no < start.line_no) || ((end == start) && (end_pos <= start_pos))) {
+ selection_start.line = end;
+ selection_start.tag = LineTag.FindTag(end, end_pos);
+ selection_start.pos = end_pos;
+
+ selection_end.line = start;
+ selection_end.tag = LineTag.FindTag(start, start_pos);
+ selection_end.pos = start_pos;
+
+ selection_end_anchor = true;
+ } else {
+ selection_start.line = start;
+ selection_start.tag = LineTag.FindTag(start, start_pos);
+ selection_start.pos = start_pos;
+
+ selection_end.line = end;
+ selection_end.tag = LineTag.FindTag(end, end_pos);
+ selection_end.pos = end_pos;
+
+ selection_end_anchor = false;
+ }
+
+ selection_anchor.line = start;
+ selection_anchor.tag = selection_start.tag;
+ selection_anchor.pos = start_pos;
+
+ if (((start == end) && (start_pos == end_pos)) || start == null || end == null) {
+ selection_visible = false;
+ } else {
+ selection_visible = true;
+
+ }
+ }
+
+ internal void SetSelectionStart(Line start, int start_pos) {
+ // Invalidate from the previous to the new start pos
+ Invalidate(selection_start.line, selection_start.pos, start, start_pos);
+
+ selection_start.line = start;
+ selection_start.pos = start_pos;
+ selection_start.tag = LineTag.FindTag(start, start_pos);
+
+ selection_anchor.line = start;
+ selection_anchor.pos = start_pos;
+ selection_anchor.tag = selection_start.tag;
+
+ selection_end_anchor = false;
+
+ if ((selection_end.line != selection_start.line) || (selection_end.pos != selection_start.pos)) {
+ selection_visible = true;
+
+ // This could be calculated better
+ Invalidate(selection_start.line, selection_start.pos, selection_end.line, selection_end.pos);
+ }
+
+ }
+
+ internal void SetSelectionEnd(Line end, int end_pos) {
+ if ((end.line_no < selection_anchor.line.line_no) || ((end == selection_anchor.line) && (end_pos <= selection_anchor.pos))) {
+ selection_start.line = end;
+ selection_start.tag = LineTag.FindTag(end, end_pos);
+ selection_start.pos = end_pos;
+
+ selection_end.line = selection_anchor.line;
+ selection_end.tag = selection_anchor.tag;
+ selection_end.pos = selection_anchor.pos;
+
+ selection_end_anchor = true;
+ } else {
+ selection_start.line = selection_anchor.line;
+ selection_start.tag = selection_anchor.tag;
+ selection_start.pos = selection_anchor.pos;
+
+ selection_end.line = end;
+ selection_end.tag = LineTag.FindTag(end, end_pos);
+ selection_end.pos = end_pos;
+
+ selection_end_anchor = false;
+ }
+
+ if ((selection_end.line != selection_start.line) || (selection_end.pos != selection_start.pos)) {
+ selection_visible = true;
+ Invalidate(selection_start.line, selection_start.pos, selection_end.line, selection_end.pos);
+ }
+ }
+
+ internal void SetSelection(Line start, int start_pos) {
+ if (selection_visible) {
+ Invalidate(selection_start.line, selection_start.pos, selection_end.line, selection_end.pos);
+ }
+
+ selection_start.line = start;
+ selection_start.pos = start_pos;
+ selection_start.tag = LineTag.FindTag(start, start_pos);
+
+ selection_end.line = start;
+ selection_end.tag = selection_start.tag;
+ selection_end.pos = start_pos;
+
+ selection_anchor.line = start;
+ selection_anchor.tag = selection_start.tag;
+ selection_anchor.pos = start_pos;
+
+ selection_end_anchor = false;
+ selection_visible = false;
+ }
+
+ internal void InvalidateSelectionArea() {
+ // FIXME - the only place that calls this right now should really calculate the redraw itself; if done this function can go
+ // Invalidate(selection_start.line, selection_start.pos, selection_end.line, selection_end.pos);
+ }
+
+ // Return the current selection, as string
+ internal string GetSelection() {
+ // We return String.Empty if there is no selection
+ if ((selection_start.pos == selection_end.pos) && (selection_start.line == selection_end.line)) {
+ return string.Empty;
+ }
+
+ if (!multiline || (selection_start.line == selection_end.line)) {
+ return selection_start.line.text.ToString(selection_start.pos, selection_end.pos - selection_start.pos);
+ } else {
+ StringBuilder sb;
+ int i;
+ int start;
+ int end;
+
+ sb = new StringBuilder();
+ start = selection_start.line.line_no;
+ end = selection_end.line.line_no;
+
+ sb.Append(selection_start.line.text.ToString(selection_start.pos, selection_start.line.text.Length - selection_start.pos) + Environment.NewLine);
+
+ if ((start + 1) < end) {
+ for (i = start + 1; i < end; i++) {
+ sb.Append(GetLine(i).text.ToString() + Environment.NewLine);
+ }
+ }
+
+ sb.Append(selection_end.line.text.ToString(0, selection_end.pos));
+
+ return sb.ToString();
+ }
+ }
+
+ internal void ReplaceSelection(string s) {
+ int i;
+ int base_line;
+ string[] ins;
+ int insert_lines;
+
+ base_line = selection_start.line.line_no;
+
+ // First, delete any selected text
+ if ((selection_start.pos != selection_end.pos) || (selection_start.line != selection_end.line)) {
+ if (!multiline || (selection_start.line == selection_end.line)) {
+ undo.RecordDeleteChars(selection_start.line, selection_start.pos + 1, selection_end.pos - selection_start.pos);
+
+ DeleteChars(selection_start.tag, selection_start.pos, selection_end.pos - selection_start.pos);
+
+ // The tag might have been removed, we need to recalc it
+ selection_start.tag = selection_start.line.FindTag(selection_start.pos);
+ } else {
+ int start;
+ int end;
+
+ start = selection_start.line.line_no;
+ end = selection_end.line.line_no;
+
+ undo.RecordDelete(selection_start.line, selection_start.pos + 1, selection_end.line, selection_end.pos);
+
+ // Delete first line
+ DeleteChars(selection_start.tag, selection_start.pos, selection_start.line.text.Length - selection_start.pos);
+
+ // Delete last line
+ DeleteChars(selection_end.line.tags, 0, selection_end.pos);
+
+ start++;
+ if (start < end) {
+ for (i = end - 1; i >= start; i--) {
+ Delete(i);
+ }
+ }
+
+ // BIG FAT WARNING - selection_end.line might be stale due
+ // to the above Delete() call. DONT USE IT before hitting the end of this method!
+
+ // Join start and end
+ Combine(selection_start.line.line_no, start);
+ }
+ }
+
+ Insert(selection_start.line, selection_start.pos, true, s);
+
+ selection_end.line = selection_start.line;
+ selection_end.pos = selection_start.pos;
+ selection_end.tag = selection_start.tag;
+
+ selection_visible = false;
+ }
+
+ internal void CharIndexToLineTag(int index, out Line line_out, out LineTag tag_out, out int pos) {
+ Line line;
+ LineTag tag;
+ int i;
+ int chars;
+ int start;
+
+ chars = 0;
+
+ for (i = 1; i < lines; i++) {
+ line = GetLine(i);
+
+ start = chars;
+ chars += line.text.Length + crlf_size;
+
+ if (index <= chars) {
+ // we found the line
+ tag = line.tags;
+
+ while (tag != null) {
+ if (index < (start + tag.start + tag.length)) {
+ line_out = line;
+ tag_out = tag;
+ pos = index - start;
+ return;
+ }
+ if (tag.next == null) {
+ Line next_line;
+
+ next_line = GetLine(line.line_no + 1);
+
+ if (next_line != null) {
+ line_out = next_line;
+ tag_out = next_line.tags;
+ pos = 0;
+ return;
+ } else {
+ line_out = line;
+ tag_out = tag;
+ pos = line_out.text.Length;
+ return;
+ }
+ }
+ tag = tag.next;
+ }
+ }
+ }
+
+ line_out = GetLine(lines);
+ tag = line_out.tags;
+ while (tag.next != null) {
+ tag = tag.next;
+ }
+ tag_out = tag;
+ pos = line_out.text.Length;
+ }
+
+ internal int LineTagToCharIndex(Line line, int pos) {
+ int i;
+ int length;
+
+ // Count first and last line
+ length = 0;
+
+ // Count the lines in the middle
+
+ for (i = 1; i < line.line_no; i++) {
+ length += GetLine(i).text.Length + crlf_size;
+ }
+
+ length += pos;
+
+ return length;
+ }
+
+ internal int SelectionLength() {
+ if ((selection_start.pos == selection_end.pos) && (selection_start.line == selection_end.line)) {
+ return 0;
+ }
+
+ if (!multiline || (selection_start.line == selection_end.line)) {
+ return selection_end.pos - selection_start.pos;
+ } else {
+ int i;
+ int start;
+ int end;
+ int length;
+
+ // Count first and last line
+ length = selection_start.line.text.Length - selection_start.pos + selection_end.pos + crlf_size;
+
+ // Count the lines in the middle
+ start = selection_start.line.line_no + 1;
+ end = selection_end.line.line_no;
+
+ if (start < end) {
+ for (i = start; i < end; i++) {
+ length += GetLine(i).text.Length + crlf_size;
+ }
+ }
+
+ return length;
+ }
+
+
+ }
+
+
+ /// <summary>Give it a Line number and it returns the Line object at with that line number</summary>
+ internal Line GetLine(int LineNo) {
+ Line line = document;
+
+ while (line != sentinel) {
+ if (LineNo == line.line_no) {
+ return line;
+ } else if (LineNo < line.line_no) {
+ line = line.left;
+ } else {
+ line = line.right;
+ }
+ }
+
+ return null;
+ }
+
+ /// <summary>Retrieve the previous tag; walks line boundaries</summary>
+ internal LineTag PreviousTag(LineTag tag) {
+ Line l;
+
+ if (tag.previous != null) {
+ return tag.previous;
+ }
+
+ // Next line
+ if (tag.line.line_no == 1) {
+ return null;
+ }
+
+ l = GetLine(tag.line.line_no - 1);
+ if (l != null) {
+ LineTag t;
+
+ t = l.tags;
+ while (t.next != null) {
+ t = t.next;
+ }
+ return t;
+ }
+
+ return null;
+ }
+
+ /// <summary>Retrieve the next tag; walks line boundaries</summary>
+ internal LineTag NextTag(LineTag tag) {
+ Line l;
+
+ if (tag.next != null) {
+ return tag.next;
+ }
+
+ // Next line
+ l = GetLine(tag.line.line_no + 1);
+ if (l != null) {
+ return l.tags;
+ }
+
+ return null;
+ }
+
+ internal Line ParagraphStart(Line line) {
+ while (line.soft_break) {
+ line = GetLine(line.line_no - 1);
+ }
+ return line;
+ }
+
+ internal Line ParagraphEnd(Line line) {
+ Line l;
+
+ while (line.soft_break) {
+ l = GetLine(line.line_no + 1);
+ if ((l == null) || (!l.soft_break)) {
+ break;
+ }
+ line = l;
+ }
+ return line;
+ }
+
+ /// <summary>Give it a Y pixel coordinate and it returns the Line covering that Y coordinate</summary>
+ internal Line GetLineByPixel(int y, bool exact) {
+ Line line = document;
+ Line last = null;
+
+ while (line != sentinel) {
+ last = line;
+ if ((y >= line.Y) && (y < (line.Y+line.height))) {
+ return line;
+ } else if (y < line.Y) {
+ line = line.left;
+ } else {
+ line = line.right;
+ }
+ }
+
+ if (exact) {
+ return null;
+ }
+ return last;
+ }
+
+ // Give it x/y pixel coordinates and it returns the Tag at that position; optionally the char position is returned in index
+ internal LineTag FindTag(int x, int y, out int index, bool exact) {
+ Line line;
+ LineTag tag;
+
+ line = GetLineByPixel(y, exact);
+ if (line == null) {
+ index = 0;
+ return null;
+ }
+ tag = line.tags;
+
+ // Alignment adjustment
+ x += line.align_shift;
+
+ while (true) {
+ if (x >= tag.X && x < (tag.X+tag.width)) {
+ int end;
+
+ end = tag.start + tag.length - 1;
+
+ for (int pos = tag.start; pos < end; pos++) {
+ if (x < line.widths[pos]) {
+ index = pos;
+ return tag;
+ }
+ }
+ index=end;
+ return tag;
+ }
+ if (tag.next != null) {
+ tag = tag.next;
+ } else {
+ if (exact) {
+ index = 0;
+ return null;
+ }
+
+ index = line.text.Length;
+ return tag;
+ }
+ }
+ }
+
+ // Give it x/y pixel coordinates and it returns the Tag at that position; optionally the char position is returned in index
+ internal LineTag FindCursor(int x, int y, out int index) {
+ Line line;
+ LineTag tag;
+
+ line = GetLineByPixel(y, false);
+ tag = line.tags;
+
+ // Adjust for alignment
+ x += line.align_shift;
+
+ while (true) {
+ if (x >= tag.X && x < (tag.X+tag.width)) {
+ int end;
+
+ end = tag.start + tag.length - 1;
+
+ for (int pos = tag.start-1; pos < end; pos++) {
+ // When clicking on a character, we position the cursor to whatever edge
+ // of the character the click was closer
+ if (x < (line.widths[pos] + ((line.widths[pos+1]-line.widths[pos])/2))) {
+ index = pos;
+ return tag;
+ }
+ }
+ index=end;
+ return tag;
+ }
+ if (tag.next != null) {
+ tag = tag.next;
+ } else {
+ index = line.text.Length;
+ return tag;
+ }
+ }
+ }
+
+ /// <summary>Format area of document in specified font and color</summary>
+ /// <param name="start_pos">1-based start position on start_line</param>
+ /// <param name="end_pos">1-based end position on end_line </param>
+ internal void FormatText(Line start_line, int start_pos, Line end_line, int end_pos, Font font, Brush color) {
+ Line l;
+
+ // First, format the first line
+ if (start_line != end_line) {
+ // First line
+ LineTag.FormatText(start_line, start_pos, start_line.text.Length - start_pos + 1, font, color);
+
+ // Format last line
+ LineTag.FormatText(end_line, 1, end_pos, font, color);
+
+ // Now all the lines inbetween
+ for (int i = start_line.line_no + 1; i < end_line.line_no; i++) {
+ l = GetLine(i);
+ LineTag.FormatText(l, 1, l.text.Length, font, color);
+ }
+ } else {
+ // Special case, single line
+ LineTag.FormatText(start_line, start_pos, end_pos - start_pos, font, color);
+ }
+ }
+
+ internal void RecalculateAlignments() {
+ Line line;
+ int line_no;
+
+ line_no = 1;
+
+ while (line_no <= lines) {
+ line = GetLine(line_no);
+
+ if (line != null && line.alignment != HorizontalAlignment.Left) {
+ if (line.alignment == HorizontalAlignment.Center) {
+ line.align_shift = (viewport_width - (int)line.widths[line.text.Length]) / 2;
+ } else {
+ line.align_shift = viewport_width - (int)line.widths[line.text.Length];
+ }
+ }
+
+ line_no++;
+ }
+ return;
+ }
+
+ /// <summary>Calculate formatting for the whole document</summary>
+ internal bool RecalculateDocument(Graphics g) {
+ return RecalculateDocument(g, 1, this.lines, false);
+ }
+
+ /// <summary>Calculate formatting starting at a certain line</summary>
+ internal bool RecalculateDocument(Graphics g, int start) {
+ return RecalculateDocument(g, start, this.lines, false);
+ }
+
+ /// <summary>Calculate formatting within two given line numbers</summary>
+ internal bool RecalculateDocument(Graphics g, int start, int end) {
+ return RecalculateDocument(g, start, end, false);
+ }
+
+ /// <summary>With optimize on, returns true if line heights changed</summary>
+ internal bool RecalculateDocument(Graphics g, int start, int end, bool optimize) {
+ Line line;
+ int line_no;
+ int Y;
+ int new_width;
+ bool changed;
+ int shift;
+
+ Y = GetLine(start).Y;
+ line_no = start;
+ new_width = 0;
+ shift = this.lines;
+ if (!optimize) {
+ changed = true; // We always return true if we run non-optimized
+ } else {
+ changed = false;
+ }
+
+ while (line_no <= (end + this.lines - shift)) {
+ line = GetLine(line_no++);
+ line.Y = Y;
+
+ if (!calc_pass) {
+ if (!optimize) {
+ line.RecalculateLine(g, this);
+ } else {
+ if (line.recalc && line.RecalculateLine(g, this)) {
+ changed = true;
+ // If the height changed, all subsequent lines change
+ end = this.lines;
+ shift = this.lines;
+ }
+ }
+ } else {
+ if (!optimize) {
+ line.RecalculatePasswordLine(g, this);
+ } else {
+ if (line.recalc && line.RecalculatePasswordLine(g, this)) {
+ changed = true;
+ // If the height changed, all subsequent lines change
+ end = this.lines;
+ shift = this.lines;
+ }
+ }
+ }
+
+ if (line.widths[line.text.Length] > new_width) {
+ new_width = (int)line.widths[line.text.Length];
+ }
+
+ // Calculate alignment
+ if (line.alignment != HorizontalAlignment.Left) {
+ if (line.alignment == HorizontalAlignment.Center) {
+ line.align_shift = (viewport_width - (int)line.widths[line.text.Length]) / 2;
+ } else {
+ line.align_shift = viewport_width - (int)line.widths[line.text.Length];
+ }
+ }
+
+ Y += line.height;
+
+ if (line_no > lines) {
+ break;
+ }
+ }
+
+ if (document_x != new_width) {
+ document_x = new_width;
+ if (WidthChanged != null) {
+ WidthChanged(this, null);
+ }
+ }
+
+ RecalculateAlignments();
+
+ line = GetLine(lines);
+
+ if (document_y != line.Y + line.height) {
+ document_y = line.Y + line.height;
+ if (HeightChanged != null) {
+ HeightChanged(this, null);
+ }
+ }
+
+ return changed;
+ }
+
+ internal int Size() {
+ return lines;
+ }
+
+ private void owner_HandleCreated(object sender, EventArgs e) {
+ this.RecalculateDocument(owner.CreateGraphics());
+ PositionCaret(0, 0);
+ }
+
+ internal static bool IsWordSeparator(char ch) {
+ switch(ch) {
+ case ' ':
+ case '\t':
+ case '(':
+ case ')': {
+ return true;
+ }
+
+ default: {
+ return false;
+ }
+ }
+ }
+ internal int FindWordSeparator(Line line, int pos, bool forward) {
+ int len;
+
+ len = line.text.Length;
+
+ if (forward) {
+ for (int i = pos + 1; i < len; i++) {
+ if (IsWordSeparator(line.Text[i])) {
+ return i + 1;
+ }
+ }
+ return len;
+ } else {
+ for (int i = pos - 1; i > 0; i--) {
+ if (IsWordSeparator(line.Text[i - 1])) {
+ return i;
+ }
+ }
+ return 0;
+ }
+ }
+
+ /* Search document for text */
+ internal bool FindChars(char[] chars, Marker start, Marker end, out Marker result) {
+ Line line;
+ int line_no;
+ int pos;
+ int line_len;
+
+ // Search for occurence of any char in the chars array
+ result = new Marker();
+
+ line = start.line;
+ line_no = start.line.line_no;
+ pos = start.pos;
+ while (line_no <= end.line.line_no) {
+ line_len = line.text.Length;
+ while (pos < line_len) {
+ for (int i = 0; i < chars.Length; i++) {
+ if (line.text[pos] == chars[i]) {
+ // Special case
+ if ((line.line_no == end.line.line_no) && (pos >= end.pos)) {
+ return false;
+ }
+
+ result.line = line;
+ result.pos = pos;
+ return true;
+ }
+ }
+ pos++;
+ }
+
+ pos = 0;
+ line_no++;
+ line = GetLine(line_no);
+ }
+
+ return false;
+ }
+
+ // This version does not build one big string for searching, instead it handles
+ // line-boundaries, which is faster and less memory intensive
+ // FIXME - Depending on culture stuff we might have to create a big string and use culturespecific
+ // search stuff and change it to accept and return positions instead of Markers (which would match
+ // RichTextBox behaviour better but would be inconsistent with the rest of TextControl)
+ internal bool Find(string search, Marker start, Marker end, out Marker result, RichTextBoxFinds options) {
+ Marker last;
+ string search_string;
+ Line line;
+ int line_no;
+ int pos;
+ int line_len;
+ int current;
+ bool word;
+ bool word_option;
+ bool ignore_case;
+ bool reverse;
+ char c;
+
+ result = new Marker();
+ word_option = ((options & RichTextBoxFinds.WholeWord) != 0);
+ ignore_case = ((options & RichTextBoxFinds.MatchCase) == 0);
+ reverse = ((options & RichTextBoxFinds.Reverse) != 0);
+
+ line = start.line;
+ line_no = start.line.line_no;
+ pos = start.pos;
+ current = 0;
+
+ // Prep our search string, lowercasing it if we do case-independent matching
+ if (ignore_case) {
+ StringBuilder sb;
+ sb = new StringBuilder(search);
+ for (int i = 0; i < sb.Length; i++) {
+ sb[i] = Char.ToLower(sb[i]);
+ }
+ search_string = sb.ToString();
+ } else {
+ search_string = search;
+ }
+
+ // We need to check if the character before our start position is a wordbreak
+ if (word_option) {
+ if (line_no == 1) {
+ if ((pos == 0) || (IsWordSeparator(line.text[pos - 1]))) {
+ word = true;
+ } else {
+ word = false;
+ }
+ } else {
+ if (pos > 0) {
+ if (IsWordSeparator(line.text[pos - 1])) {
+ word = true;
+ } else {
+ word = false;
+ }
+ } else {
+ // Need to check the end of the previous line
+ Line prev_line;
+
+ prev_line = GetLine(line_no - 1);
+ if (prev_line.soft_break) {
+ if (IsWordSeparator(prev_line.text[prev_line.text.Length - 1])) {
+ word = true;
+ } else {
+ word = false;
+ }
+ } else {
+ word = true;
+ }
+ }
+ }
+ } else {
+ word = false;
+ }
+
+ // To avoid duplication of this loop with reverse logic, we search
+ // through the document, remembering the last match and when returning
+ // report that last remembered match
+
+ last = new Marker();
+ last.height = -1; // Abused - we use it to track change
+
+ while (line_no <= end.line.line_no) {
+ if (line_no != end.line.line_no) {
+ line_len = line.text.Length;
+ } else {
+ line_len = end.pos;
+ }
+
+ while (pos < line_len) {
+ if (word_option && (current == search_string.Length)) {
+ if (IsWordSeparator(line.text[pos])) {
+ if (!reverse) {
+ goto FindFound;
+ } else {
+ last = result;
+ current = 0;
+ }
+ } else {
+ current = 0;
+ }
+ }
+
+ if (ignore_case) {
+ c = Char.ToLower(line.text[pos]);
+ } else {
+ c = line.text[pos];
+ }
+
+ if (c == search_string[current]) {
+ if (current == 0) {
+ result.line = line;
+ result.pos = pos;
+ }
+ if (!word_option || (word_option && (word || (current > 0)))) {
+ current++;
+ }
+
+ if (!word_option && (current == search_string.Length)) {
+ if (!reverse) {
+ goto FindFound;
+ } else {
+ last = result;
+ current = 0;
+ }
+ }
+ } else {
+ current = 0;
+ }
+ pos++;
+
+ if (!word_option) {
+ continue;
+ }
+
+ if (IsWordSeparator(c)) {
+ word = true;
+ } else {
+ word = false;
+ }
+ }
+
+ if (word_option) {
+ // Mark that we just saw a word boundary
+ if (!line.soft_break) {
+ word = true;
+ }
+
+ if (current == search_string.Length) {
+ if (word) {
+ if (!reverse) {
+ goto FindFound;
+ } else {
+ last = result;
+ current = 0;
+ }
+ } else {
+ current = 0;
+ }
+ }
+ }
+
+ pos = 0;
+ line_no++;
+ line = GetLine(line_no);
+ }
+
+ if (reverse) {
+ if (last.height != -1) {
+ result = last;
+ return true;
+ }
+ }
+
+ return false;
+
+ FindFound:
+ if (!reverse) {
+// if ((line.line_no == end.line.line_no) && (pos >= end.pos)) {
+// return false;
+// }
+ return true;
+ }
+
+ result = last;
+ return true;
+
+ }
+
+ /* Marker stuff */
+ internal void GetMarker(out Marker mark, bool start) {
+ mark = new Marker();
+
+ if (start) {
+ mark.line = GetLine(1);
+ mark.tag = mark.line.tags;
+ mark.pos = 0;
+ } else {
+ mark.line = GetLine(lines);
+ mark.tag = mark.line.tags;
+ while (mark.tag.next != null) {
+ mark.tag = mark.tag.next;
+ }
+ mark.pos = mark.line.text.Length;
+ }
+ }
+ #endregion // Internal Methods
+
+ #region Events
+ internal event EventHandler CaretMoved;
+ internal event EventHandler WidthChanged;
+ internal event EventHandler HeightChanged;
+ internal event EventHandler LengthChanged;
+ #endregion // Events
+
+ #region Administrative
+ public IEnumerator GetEnumerator() {
+ // FIXME
+ return null;
+ }
+
+ public override bool Equals(object obj) {
+ if (obj == null) {
+ return false;
+ }
+
+ if (!(obj is Document)) {
+ return false;
+ }
+
+ if (obj == this) {
+ return true;
+ }
+
+ if (ToString().Equals(((Document)obj).ToString())) {
+ return true;
+ }
+
+ return false;
+ }
+
+ public override int GetHashCode() {
+ return document_id;
+ }
+
+ public override string ToString() {
+ return "document " + this.document_id;
+ }
+ #endregion // Administrative
+ }
+
+ internal class LineTag {
+ #region Local Variables;
+ // Payload; formatting
+ internal Font font; // System.Drawing.Font object for this tag
+ internal Brush color; // System.Drawing.Brush object
+
+ // Payload; text
+ internal int start; // start, in chars; index into Line.text
+ internal int length; // length, in chars
+ internal bool r_to_l; // Which way is the font
+
+ // Drawing support
+ internal int height; // Height in pixels of the text this tag describes
+ internal int X; // X location of the text this tag describes
+ internal float width; // Width in pixels of the text this tag describes
+ internal int ascent; // Ascent of the font for this tag
+ internal int shift; // Shift down for this tag, to stay on baseline
+
+ // Administrative
+ internal Line line; // The line we're on
+ internal LineTag next; // Next tag on the same line
+ internal LineTag previous; // Previous tag on the same line
+ #endregion;
+
+ #region Constructors
+ internal LineTag(Line line, int start, int length) {
+ this.line = line;
+ this.start = start;
+ this.length = length;
+ this.X = 0;
+ this.width = 0;
+ }
+ #endregion // Constructors
+
+ #region Internal Methods
+ /// <summary>Applies 'font' to characters starting at 'start' for 'length' chars;
+ /// Removes any previous tags overlapping the same area;
+ /// returns true if lineheight has changed</summary>
+ /// <param name="start">1-based character position on line</param>
+ internal static bool FormatText(Line line, int start, int length, Font font, Brush color) {
+ LineTag tag;
+ LineTag start_tag;
+ int end;
+ bool retval = false; // Assume line-height doesn't change
+
+ // Too simple?
+ if (font.Height != line.height) {
+ retval = true;
+ }
+ line.recalc = true; // This forces recalculation of the line in RecalculateDocument
+
+ // A little sanity, not sure if it's needed, might be able to remove for speed
+ if (length > line.text.Length) {
+ length = line.text.Length;
+ }
+
+ tag = line.tags;
+ end = start + length;
+
+ // Common special case
+ if ((start == 1) && (length == tag.length)) {
+ tag.ascent = 0;
+ tag.font = font;
+ tag.color = color;
+ return retval;
+ }
+
+//Console.WriteLine("Finding tag for {0} {1}", line, start);
+ start_tag = FindTag(line, start);
+
+ tag = new LineTag(line, start, length);
+ tag.font = font;
+ tag.color = color;
+
+ if (start == 1) {
+ line.tags = tag;
+ }
+//Console.WriteLine("Start tag: '{0}'", start_tag!=null ? start_tag.ToString() : "NULL");
+ if (start_tag.start == start) {
+ tag.next = start_tag;
+ tag.previous = start_tag.previous;
+ if (start_tag.previous != null) {
+ start_tag.previous.next = tag;
+ }
+ start_tag.previous = tag;
+ } else {
+ // Insert ourselves 'in the middle'
+ if ((start_tag.next != null) && (start_tag.next.start < end)) {
+ tag.next = start_tag.next;
+ } else {
+ tag.next = new LineTag(line, start_tag.start, start_tag.length);
+ tag.next.font = start_tag.font;
+ tag.next.color = start_tag.color;
+
+ if (start_tag.next != null) {
+ tag.next.next = start_tag.next;
+ tag.next.next.previous = tag.next;
+ }
+ }
+ tag.next.previous = tag;
+
+ start_tag.length = start - start_tag.start;
+
+ tag.previous = start_tag;
+ start_tag.next = tag;
+#if nope
+ if (tag.next.start > (tag.start + tag.length)) {
+ tag.next.length += tag.next.start - (tag.start + tag.length);
+ tag.next.start = tag.start + tag.length;
+ }
+#endif
+ }
+
+ // Elimination loop
+ tag = tag.next;
+ while ((tag != null) && (tag.start < end)) {
+ if ((tag.start + tag.length) <= end) {
+ // remove the tag
+ tag.previous.next = tag.next;
+ if (tag.next != null) {
+ tag.next.previous = tag.previous;
+ }
+ tag = tag.previous;
+ } else {
+ // Adjust the length of the tag
+ tag.length = (tag.start + tag.length) - end;
+ tag.start = end;
+ }
+ tag = tag.next;
+ }
+
+ return retval;
+ }
+
+
+ /// <summary>Finds the tag that describes the character at position 'pos' on 'line'</summary>
+ internal static LineTag FindTag(Line line, int pos) {
+ LineTag tag = line.tags;
+
+ // Beginning of line is a bit special
+ if (pos == 0) {
+ return tag;
+ }
+
+ while (tag != null) {
+ if ((tag.start <= pos) && (pos < (tag.start+tag.length))) {
+ return tag;
+ }
+
+ tag = tag.next;
+ }
+
+ return null;
+ }
+
+ /// <summary>Combines 'this' tag with 'other' tag</summary>
+ internal bool Combine(LineTag other) {
+ if (!this.Equals(other)) {
+ return false;
+ }
+
+ this.width += other.width;
+ this.length += other.length;
+ this.next = other.next;
+ if (this.next != null) {
+ this.next.previous = this;
+ }
+
+ return true;
+ }
+
+
+ /// <summary>Remove 'this' tag ; to be called when formatting is to be removed</summary>
+ internal bool Remove() {
+ if ((this.start == 1) && (this.next == null)) {
+ // We cannot remove the only tag
+ return false;
+ }
+ if (this.start != 1) {
+ this.previous.length += this.length;
+ this.previous.width = -1;
+ this.previous.next = this.next;
+ this.next.previous = this.previous;
+ } else {
+ this.next.start = 1;
+ this.next.length += this.length;
+ this.next.width = -1;
+ this.line.tags = this.next;
+ this.next.previous = null;
+ }
+ return true;
+ }
+
+
+ /// <summary>Checks if 'this' tag describes the same formatting options as 'obj'</summary>
+ public override bool Equals(object obj) {
+ LineTag other;
+
+ if (obj == null) {
+ return false;
+ }
+
+ if (!(obj is LineTag)) {
+ return false;
+ }
+
+ if (obj == this) {
+ return true;
+ }
+
+ other = (LineTag)obj;
+
+ if (this.font.Equals(other.font) && this.color.Equals(other.color)) { // FIXME add checking for things like link or type later
+ return true;
+ }
+
+ return false;
+ }
+
+ public override int GetHashCode() {
+ return base.GetHashCode ();
+ }
+
+ public override string ToString() {
+ return "Tag starts at index " + this.start + "length " + this.length + " text: " + this.line.Text.Substring(this.start-1, this.length) + "Font " + this.font.ToString();
+ }
+
+ #endregion // Internal Methods
+ }
+
+ internal class UndoClass {
+ internal enum ActionType {
+ InsertChar,
+ InsertString,
+ DeleteChar,
+ DeleteChars,
+ CursorMove,
+ Mark,
+ }
+
+ internal class Action {
+ internal ActionType type;
+ internal int line_no;
+ internal int pos;
+ internal object data;
+ }
+
+ #region Local Variables
+ private Document document;
+ private Stack undo_actions;
+ private Stack redo_actions;
+ private int caret_line;
+ private int caret_pos;
+ #endregion // Local Variables
+
+ #region Constructors
+ internal UndoClass(Document doc) {
+ document = doc;
+ undo_actions = new Stack(50);
+ redo_actions = new Stack(50);
+ }
+ #endregion // Constructors
+
+ #region Properties
+ [MonoTODO("Change this to be configurable")]
+ internal int UndoLevels {
+ get {
+ return undo_actions.Count;
+ }
+ }
+
+ [MonoTODO("Change this to be configurable")]
+ internal int RedoLevels {
+ get {
+ return redo_actions.Count;
+ }
+ }
+
+ [MonoTODO("Come up with good naming and localization")]
+ internal string UndoName {
+ get {
+ Action action;
+
+ action = (Action)undo_actions.Peek();
+ switch(action.type) {
+ case ActionType.InsertChar: {
+ Locale.GetText("Insert character");
+ break;
+ }
+
+ case ActionType.DeleteChar: {
+ Locale.GetText("Delete character");
+ break;
+ }
+
+ case ActionType.InsertString: {
+ Locale.GetText("Insert string");
+ break;
+ }
+
+ case ActionType.DeleteChars: {
+ Locale.GetText("Delete string");
+ break;
+ }
+
+ case ActionType.CursorMove: {
+ Locale.GetText("Cursor move");
+ break;
+ }
+ }
+ return null;
+ }
+ }
+
+ internal string RedoName() {
+ return null;
+ }
+ #endregion // Properties
+
+ #region Internal Methods
+ internal void Clear() {
+ undo_actions.Clear();
+ redo_actions.Clear();
+ }
+
+ internal void Undo() {
+ Action action;
+
+ if (undo_actions.Count == 0) {
+ return;
+ }
+
+ action = (Action)undo_actions.Pop();
+
+ // Put onto redo stack
+ redo_actions.Push(action);
+
+ // Do the thing
+ switch(action.type) {
+ case ActionType.InsertChar: {
+ break;
+ }
+
+ case ActionType.DeleteChars: {
+ this.Insert(document.GetLine(action.line_no), action.pos, (Line)action.data);
+ break;
+ }
+
+ case ActionType.CursorMove: {
+ document.caret.line = document.GetLine(action.line_no);
+ document.caret.tag = document.caret.line.FindTag(action.pos);
+ document.caret.pos = action.pos;
+ document.caret.height = document.caret.tag.height;
+
+ XplatUI.DestroyCaret(document.owner.Handle);
+ XplatUI.CreateCaret(document.owner.Handle, 2, document.caret.height);
+ XplatUI.SetCaretPos(document.owner.Handle, (int)document.caret.tag.line.widths[document.caret.pos] + document.caret.line.align_shift - document.viewport_x, document.caret.line.Y + document.caret.tag.shift - document.viewport_y);
+ XplatUI.CaretVisible(document.owner.Handle, true);
+
+ // FIXME - enable call
+ //if (document.CaretMoved != null) document.CaretMoved(this, EventArgs.Empty);
+ break;
+ }
+ }
+ }
+
+ internal void Redo() {
+ if (redo_actions.Count == 0) {
+ return;
+ }
+ }
+ #endregion // Internal Methods
+
+ #region Private Methods
+ // pos = 1-based
+ public void RecordDeleteChars(Line line, int pos, int length) {
+ RecordDelete(line, pos, line, pos + length - 1);
+ }
+
+ // start_pos, end_pos = 1 based
+ public void RecordDelete(Line start_line, int start_pos, Line end_line, int end_pos) {
+ Line l;
+ Action a;
+
+ l = Duplicate(start_line, start_pos, end_line, end_pos);
+
+ a = new Action();
+ a.type = ActionType.DeleteChars;
+ a.data = l;
+ a.line_no = start_line.line_no;
+ a.pos = start_pos - 1;
+
+ undo_actions.Push(a);
+ }
+
+ public void RecordCursor() {
+ if (document.caret.line == null) {
+ return;
+ }
+
+ RecordCursor(document.caret.line, document.caret.pos);
+ }
+
+ public void RecordCursor(Line line, int pos) {
+ Action a;
+
+ if ((line.line_no == caret_line) && (pos == caret_pos)) {
+ return;
+ }
+
+ caret_line = line.line_no;
+ caret_pos = pos;
+
+ a = new Action();
+ a.type = ActionType.CursorMove;
+ a.line_no = line.line_no;
+ a.pos = pos;
+
+ undo_actions.Push(a);
+ }
+
+ // start_pos = 1-based
+ // end_pos = 1-based
+ public Line Duplicate(Line start_line, int start_pos, Line end_line, int end_pos) {
+ Line ret;
+ Line line;
+ Line current;
+ LineTag tag;
+ LineTag current_tag;
+ int start;
+ int end;
+ int tag_start;
+ int tag_length;
+
+ line = new Line();
+ ret = line;
+
+ for (int i = start_line.line_no; i <= end_line.line_no; i++) {
+ current = document.GetLine(i);
+
+ if (start_line.line_no == i) {
+ start = start_pos;
+ } else {
+ start = 1;
+ }
+
+ if (end_line.line_no == i) {
+ end = end_pos;
+ } else {
+ end = current.text.Length;
+ }
+
+ // Text for the tag
+ line.text = new StringBuilder(current.text.ToString(start - 1, end - start + 1));
+
+ // Copy tags from start to start+length onto new line
+ current_tag = current.FindTag(start - 1);
+ while ((current_tag != null) && (current_tag.start < end)) {
+ if ((current_tag.start <= start) && (start < (current_tag.start + current_tag.length))) {
+ // start tag is within this tag
+ tag_start = start;
+ } else {
+ tag_start = current_tag.start;
+ }
+
+ if (end < (current_tag.start + current_tag.length)) {
+ tag_length = end - tag_start + 1;
+ } else {
+ tag_length = current_tag.start + current_tag.length - tag_start;
+ }
+ tag = new LineTag(line, tag_start - start + 1, tag_length);
+ tag.color = current_tag.color;
+ tag.font = current_tag.font;
+
+ current_tag = current_tag.next;
+
+ // Add the new tag to the line
+ if (line.tags == null) {
+ line.tags = tag;
+ } else {
+ LineTag tail;
+ tail = line.tags;
+
+ while (tail.next != null) {
+ tail = tail.next;
+ }
+ tail.next = tag;
+ tag.previous = tail;
+ }
+ }
+
+ if ((i + 1) <= end_line.line_no) {
+ line.soft_break = current.soft_break;
+
+ // Chain them (we use right/left as next/previous)
+ line.right = new Line();
+ line.right.left = line;
+ line = line.right;
+ }
+ }
+
+ return ret;
+ }
+
+ // Insert multi-line text at the given position; use formatting at insertion point for inserted text
+ internal void Insert(Line line, int pos, Line insert) {
+ Line current;
+ LineTag tag;
+ int offset;
+ int lines;
+ Line first;
+
+ // Handle special case first
+ if (insert.right == null) {
+
+ // Single line insert
+ document.Split(line, pos);
+
+ if (insert.tags == null) {
+ return; // Blank line
+ }
+
+ //Insert our tags at the end
+ tag = line.tags;
+
+ while (tag.next != null) {
+ tag = tag.next;
+ }
+
+ offset = tag.start + tag.length - 1;
+
+ tag.next = insert.tags;
+ line.text.Insert(offset, insert.text.ToString());
+
+ // Adjust start locations
+ tag = tag.next;
+ while (tag != null) {
+ tag.start += offset;
+ tag.line = line;
+ tag = tag.next;
+ }
+ // Put it back together
+ document.Combine(line.line_no, line.line_no + 1);
+ document.UpdateView(line, pos);
+ return;
+ }
+
+ first = line;
+ lines = 1;
+ current = insert;
+ while (current != null) {
+ if (current == insert) {
+ // Inserting the first line we split the line (and make space)
+ document.Split(line, pos);
+ //Insert our tags at the end of the line
+ tag = line.tags;
+
+ if (tag != null) {
+ while (tag.next != null) {
+ tag = tag.next;
+ }
+ offset = tag.start + tag.length - 1;
+ tag.next = current.tags;
+ tag.next.previous = tag;
+
+ tag = tag.next;
+
+ } else {
+ offset = 0;
+ line.tags = current.tags;
+ line.tags.previous = null;
+ tag = line.tags;
+ }
+ } else {
+ document.Split(line.line_no, 0);
+ offset = 0;
+ line.tags = current.tags;
+ line.tags.previous = null;
+ tag = line.tags;
+ }
+ // Adjust start locations and line pointers
+ while (tag != null) {
+ tag.start += offset;
+ tag.line = line;
+ tag = tag.next;
+ }
+
+ line.text.Insert(offset, current.text.ToString());
+ line.Grow(line.text.Length);
+
+ line.recalc = true;
+ line = document.GetLine(line.line_no + 1);
+
+ // FIXME? Test undo of line-boundaries
+ if ((current.right == null) && (current.tags.length != 0)) {
+ document.Combine(line.line_no - 1, line.line_no);
+ }
+ current = current.right;
+ lines++;
+
+ }
+
+ // Recalculate our document
+ document.UpdateView(first, lines, pos);
+ return;
+ }
+ #endregion // Private Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextFormatFlags.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextFormatFlags.cs
new file mode 100644
index 00000000000..35487bc368f
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextFormatFlags.cs
@@ -0,0 +1,66 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+namespace System.Windows.Forms {
+
+ [FlagsAttribute()]
+ public enum TextFormatFlags {
+ Left = 0,
+ Top = 0,
+ Default = 0,
+ GlyphOverhangPadding = 0,
+ HorizontalCenter = 1,
+ Right = 2,
+ VerticalCenter = 4,
+ Bottom = 8,
+ WordBreak = 16,
+ SingleLine = 32,
+ ExpandTabs = 64,
+ TabStop = 128,
+ NoClipping = 256,
+ ExternalLeading = 512,
+ NoPrefix = 2048,
+ Internal = 4096,
+ TextBoxControl = 8192,
+ PathEllipsis = 16384,
+ EndEllipsis = 32768,
+ ModifyString = 65536,
+ RightToLeft = 131072,
+ WordEllipsis = 262144,
+ NoFullWidthCharacterBreak = 524288,
+ HidePrefix = 1048576,
+ PrefixOnly = 2097152,
+ PreserveGraphicsClipping = 16777216,
+ PreserveGraphicsTranslateTransform = 33554432,
+ NoPadding = 268435456,
+ LeftAndRightPadding = 536870912
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Theme.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Theme.cs
new file mode 100644
index 00000000000..da34301d543
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Theme.cs
@@ -0,0 +1,849 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+// Peter Dennis Bartok, pbartok@novell.com
+//
+
+
+using System.Collections;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Drawing.Imaging;
+using System.Reflection;
+
+namespace System.Windows.Forms
+{
+ internal enum UIIcon {
+ PlacesRecentDocuments,
+ PlacesDesktop,
+ PlacesPersonal,
+ PlacesMyComputer,
+ PlacesMyNetwork,
+ MessageBoxError,
+ MessageBoxQuestion,
+ MessageBoxWarning,
+ MessageBoxInfo,
+
+ NormalFolder
+ }
+
+ // Implements a pool of system resources
+ internal class SystemResPool
+ {
+ private Hashtable pens = new Hashtable ();
+ private Hashtable solidbrushes = new Hashtable ();
+ private Hashtable hatchbrushes = new Hashtable ();
+ private Hashtable uiImages = new Hashtable();
+
+ public SystemResPool () {}
+
+ public Pen GetPen (Color color)
+ {
+ int hash = color.ToArgb ();
+
+ Pen res = pens [hash] as Pen;
+ if (res != null)
+ return res;
+
+ Pen pen = new Pen (color);
+ pens.Add (hash, pen);
+ return pen;
+ }
+
+ public SolidBrush GetSolidBrush (Color color)
+ {
+ int hash = color.ToArgb ();
+
+ SolidBrush res = solidbrushes [hash] as SolidBrush;
+ if (res != null)
+ return res;
+
+ SolidBrush brush = new SolidBrush (color);
+ solidbrushes.Add (hash, brush);
+ return brush;
+ }
+
+ public HatchBrush GetHatchBrush (HatchStyle hatchStyle, Color foreColor, Color backColor)
+ {
+ string hash = hatchStyle.ToString () + foreColor.ToString () + backColor.ToString ();
+
+ if (hatchbrushes.Contains (hash))
+ return (HatchBrush) hatchbrushes[hash];
+
+ HatchBrush brush = new HatchBrush (hatchStyle, foreColor, backColor);
+ hatchbrushes.Add (hash, brush);
+ return brush;
+ }
+
+ public void AddUIImage (Image image, string name, int size)
+ {
+ string hash = name + size.ToString();
+
+ if (uiImages.Contains (hash))
+ return;
+ uiImages.Add (hash, image);
+ }
+
+ public Image GetUIImage(string name, int size)
+ {
+ string hash = name + size.ToString();
+
+ Image image = uiImages [hash] as Image;
+
+ return image;
+ }
+ }
+
+ internal abstract class Theme
+ {
+ protected Array syscolors;
+ protected Font default_font;
+ protected Color defaultWindowBackColor;
+ protected Color defaultWindowForeColor;
+ protected bool always_draw_hotkeys = true;
+ internal SystemResPool ResPool = new SystemResPool ();
+ private Type system_colors = Type.GetType("System.Drawing.SystemColors, System.Drawing");
+
+ private void SetSystemColors(string name, Color value) {
+ if (system_colors != null) {
+ MethodInfo update;
+
+ system_colors.GetField(name, System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).SetValue(null, value);
+ update = system_colors.GetMethod("UpdateColors", BindingFlags.Static | BindingFlags.NonPublic);
+ if (update != null) {
+ update.Invoke(null, null);
+ }
+ }
+ }
+
+
+ /* OS Feature support */
+ public abstract Version Version {
+ get;
+ }
+
+ /* Default properties */
+ public virtual Color ColorScrollBar {
+ get { return SystemColors.ScrollBar;}
+ set { SetSystemColors("scroll_bar", value); }
+ }
+
+ public virtual Color ColorDesktop {
+ get { return SystemColors.Desktop;}
+ set { SetSystemColors("desktop", value); }
+ }
+
+ public virtual Color ColorActiveCaption {
+ get { return SystemColors.ActiveCaption;}
+ set { SetSystemColors("active_caption", value); }
+ }
+
+ public virtual Color ColorInactiveCaption {
+ get { return SystemColors.InactiveCaption;}
+ set { SetSystemColors("inactive_caption", value); }
+ }
+
+ public virtual Color ColorMenu {
+ get { return SystemColors.Menu;}
+ set { SetSystemColors("menu", value); }
+ }
+
+ public virtual Color ColorWindow {
+ get { return SystemColors.Window;}
+ set { SetSystemColors("window", value); }
+ }
+
+ public virtual Color ColorWindowFrame {
+ get { return SystemColors.WindowFrame;}
+ set { SetSystemColors("window_frame", value); }
+ }
+
+ public virtual Color ColorMenuText {
+ get { return SystemColors.MenuText;}
+ set { SetSystemColors("menu_text", value); }
+ }
+
+ public virtual Color ColorWindowText {
+ get { return SystemColors.WindowText;}
+ set { SetSystemColors("window_text", value); }
+ }
+
+ public virtual Color ColorActiveCaptionText {
+ get { return SystemColors.ActiveCaptionText;}
+ set { SetSystemColors("active_caption_text", value); }
+ }
+
+ public virtual Color ColorActiveBorder {
+ get { return SystemColors.ActiveBorder;}
+ set { SetSystemColors("active_border", value); }
+ }
+
+ public virtual Color ColorInactiveBorder{
+ get { return SystemColors.InactiveBorder;}
+ set { SetSystemColors("inactive_border", value); }
+ }
+
+ public virtual Color ColorAppWorkspace {
+ get { return SystemColors.AppWorkspace;}
+ set { SetSystemColors("app_workspace", value); }
+ }
+
+ public virtual Color ColorHighlight {
+ get { return SystemColors.Highlight;}
+ set { SetSystemColors("highlight", value); }
+ }
+
+ public virtual Color ColorHighlightText {
+ get { return SystemColors.HighlightText;}
+ set { SetSystemColors("highlight_text", value); }
+ }
+
+ public virtual Color ColorControl {
+ get { return SystemColors.Control;}
+ set { SetSystemColors("control", value); }
+ }
+
+ public virtual Color ColorControlDark {
+ get { return SystemColors.ControlDark;}
+ set { SetSystemColors("control_dark", value); }
+ }
+
+ public virtual Color ColorGrayText {
+ get { return SystemColors.GrayText;}
+ set { SetSystemColors("gray_text", value); }
+ }
+
+ public virtual Color ColorControlText {
+ get { return SystemColors.ControlText;}
+ set { SetSystemColors("control_text", value); }
+ }
+
+ public virtual Color ColorInactiveCaptionText {
+ get { return SystemColors.InactiveCaptionText;}
+ set { SetSystemColors("inactive_caption_text", value); }
+ }
+
+ public virtual Color ColorControlLight {
+ get { return SystemColors.ControlLight;}
+ set { SetSystemColors("control_light", value); }
+ }
+
+ public virtual Color ColorControlDarkDark {
+ get { return SystemColors.ControlDarkDark;}
+ set { SetSystemColors("control_dark_dark", value); }
+ }
+
+ public virtual Color ColorControlLightLight {
+ get { return SystemColors.ControlLightLight;}
+ set { SetSystemColors("control_light_light", value); }
+ }
+
+ public virtual Color ColorInfoText {
+ get { return SystemColors.InfoText;}
+ set { SetSystemColors("info_text", value); }
+ }
+
+ public virtual Color ColorInfo {
+ get { return SystemColors.Info;}
+ set { SetSystemColors("info", value); }
+ }
+
+ public virtual Color ColorHotTrack {
+ get { return SystemColors.HotTrack;}
+ set { SetSystemColors("hot_track", value);}
+ }
+
+ public virtual Color DefaultControlBackColor {
+ get { return ColorControl; }
+ set { ColorControl = value; }
+ }
+
+ public virtual Color DefaultControlForeColor {
+ get { return ColorControlText; }
+ set { ColorControlText = value; }
+ }
+
+ public virtual Font DefaultFont {
+ get { return default_font; }
+ }
+
+ public virtual Color DefaultWindowBackColor {
+ get { return defaultWindowBackColor; }
+ }
+
+ public virtual Color DefaultWindowForeColor {
+ get { return defaultWindowForeColor; }
+ }
+
+ public virtual Color GetColor (XplatUIWin32.GetSysColorIndex idx)
+ {
+ return (Color) syscolors.GetValue ((int)idx);
+ }
+
+ public virtual void SetColor (XplatUIWin32.GetSysColorIndex idx, Color color)
+ {
+ syscolors.SetValue (color, (int) idx);
+ }
+
+ // Theme/UI specific defaults
+ public virtual ArrangeDirection ArrangeDirection {
+ get {
+ return ArrangeDirection.Down;
+ }
+ }
+
+ public virtual ArrangeStartingPosition ArrangeStartingPosition {
+ get {
+ return ArrangeStartingPosition.BottomLeft;
+ }
+ }
+
+ public virtual Size Border3DSize {
+ get {
+ return new Size(2, 2);
+ }
+ }
+
+ public virtual Size BorderSize {
+ get {
+ return new Size(1, 1);
+ }
+ }
+
+ public virtual Size CaptionButtonSize {
+ get {
+ return new Size(18, 18);
+ }
+ }
+
+ public virtual int CaptionHeight {
+ get {
+ return XplatUI.CaptionHeight;
+ }
+ }
+
+ public virtual Size DoubleClickSize {
+ get {
+ return new Size(4, 4);
+ }
+ }
+
+ public virtual int DoubleClickTime {
+ get {
+ return 500;
+ }
+ }
+
+ public virtual Size FixedFrameBorderSize {
+ get {
+ return new Size(3, 3);
+ }
+ }
+
+ public virtual Size FrameBorderSize {
+ get {
+ return XplatUI.FrameBorderSize;
+ }
+ }
+
+ public virtual int HorizontalScrollBarArrowWidth {
+ get {
+ return 16;
+ }
+ }
+
+ public virtual int HorizontalScrollBarHeight {
+ get {
+ return 16;
+ }
+ }
+
+ public virtual int HorizontalScrollBarThumbWidth {
+ get {
+ return 16;
+ }
+ }
+
+ public virtual Size IconSpacingSize {
+ get {
+ return new Size(75, 75);
+ }
+ }
+
+ public virtual Size MenuButtonSize {
+ get {
+ return new Size(18, 18);
+ }
+ }
+
+ public virtual Size MenuCheckSize {
+ get {
+ return new Size(13, 13);
+ }
+ }
+
+ public virtual Font MenuFont {
+ get {
+ return default_font;
+ }
+ }
+
+ public virtual int MenuHeight {
+ get {
+ return 19;
+ }
+ }
+
+ public virtual int MouseWheelScrollLines {
+ get {
+ return 3;
+ }
+ }
+
+ public virtual bool RightAlignedMenus {
+ get {
+ return false;
+ }
+ }
+
+ public virtual Size ToolWindowCaptionButtonSize {
+ get {
+ return new Size(15, 15);
+ }
+ }
+
+ public virtual int ToolWindowCaptionHeight {
+ get {
+ return 16;
+ }
+ }
+
+ public virtual int VerticalScrollBarArrowHeight {
+ get {
+ return 16;
+ }
+ }
+
+ public virtual int VerticalScrollBarThumbHeight {
+ get {
+ return 16;
+ }
+ }
+
+ public virtual int VerticalScrollBarWidth {
+ get {
+ return 16;
+ }
+ }
+
+ [MonoTODO("Figure out where to point for My Network Places")]
+ public virtual string Places(UIIcon index) {
+ switch (index) {
+ case UIIcon.PlacesRecentDocuments: {
+ // Default = "Recent Documents"
+ return Environment.GetFolderPath(Environment.SpecialFolder.Recent);
+ }
+
+ case UIIcon.PlacesDesktop: {
+ // Default = "Desktop"
+ return Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
+ }
+
+ case UIIcon.PlacesPersonal: {
+ // Default = "My Documents"
+ return Environment.GetFolderPath(Environment.SpecialFolder.Personal);
+ }
+
+ case UIIcon.PlacesMyComputer: {
+ // Default = "My Computer"
+ return Environment.GetFolderPath(Environment.SpecialFolder.MyComputer);
+ }
+
+ case UIIcon.PlacesMyNetwork: {
+ // Default = "My Network Places"
+ return "/tmp";
+ }
+
+ default: {
+ throw new ArgumentOutOfRangeException("index", index, "Unsupported place");
+ }
+ }
+ }
+
+ private Image GetSizedResourceImage(string name, int size) {
+
+ Image image = ResPool.GetUIImage (name, size);
+ if (image != null)
+ return image;
+
+ string fullname;
+
+ if (size > 0) {
+ // Try name name_sizexsize
+ fullname = String.Format("{0}_{1}x{1}", name, size);
+ image = ResPool.GetUIImage (fullname, size);
+ if (image != null)
+ return image;
+ else {
+ image = (Image)Locale.GetResource(fullname);
+ if (image != null) {
+ ResPool.AddUIImage (image, fullname, size);
+ return image;
+ }
+ }
+
+ // Try name_size
+ fullname = String.Format("{0}_{1}", name, size);
+ image = ResPool.GetUIImage (fullname, size);
+ if (image != null)
+ return image;
+ else {
+ image = (Image)Locale.GetResource(fullname);
+ if (image != null) {
+ ResPool.AddUIImage (image, fullname, size);
+ return image;
+ }
+ }
+
+ image = (Image)Locale.GetResource(name);
+ if (image != null) {
+ image = new Bitmap (image, new Size (size, size));
+ ResPool.AddUIImage (image, name, size);
+ return image;
+ }
+ }
+
+ // Just try name
+ image = (Image)Locale.GetResource(name);
+ ResPool.AddUIImage (image, name, size);
+ return image;
+ }
+
+ public virtual Image Images(UIIcon index) {
+ return Images(index, 0);
+ }
+
+ public virtual Image Images(UIIcon index, int size) {
+ switch (index) {
+ case UIIcon.PlacesRecentDocuments: return GetSizedResourceImage ("last_open", size);
+ case UIIcon.PlacesDesktop: return GetSizedResourceImage ("desktop", size);
+ case UIIcon.PlacesPersonal: return GetSizedResourceImage ("folder_with_paper", size);
+ case UIIcon.PlacesMyComputer: return GetSizedResourceImage ("monitor-computer", size);
+ case UIIcon.PlacesMyNetwork: return GetSizedResourceImage ("monitor-planet", size);
+
+ // Icons for message boxes
+ case UIIcon.MessageBoxError: return GetSizedResourceImage ("mbox_error.png", size);
+ case UIIcon.MessageBoxInfo: return GetSizedResourceImage ("mbox_info.png", size);
+ case UIIcon.MessageBoxQuestion: return GetSizedResourceImage ("mbox_question.png", size);
+ case UIIcon.MessageBoxWarning: return GetSizedResourceImage ("mbox_warn.png", size);
+
+ // misc Icons
+ case UIIcon.NormalFolder: return GetSizedResourceImage ("folder", size);
+
+ default: {
+ throw new ArgumentException("Invalid Icon type requested", "index");
+ }
+ }
+ return null;
+ }
+
+ public virtual Image Images(string mimetype, string extension, int size) {
+ return null;
+ }
+
+ #region Principal Theme Methods
+ // To let the theme now that a change of defaults (colors, etc) was detected and force a re-read (and possible recreation of cached resources)
+ public abstract void ResetDefaults();
+
+ // If the theme writes directly to a window instead of a device context
+ public abstract bool DoubleBufferingSupported {get;}
+ #endregion // Principal Theme Methods
+
+ #region OwnerDraw Support
+ public abstract void DrawOwnerDrawBackground (DrawItemEventArgs e);
+ public abstract void DrawOwnerDrawFocusRectangle (DrawItemEventArgs e);
+ #endregion // OwnerDraw Support
+
+ #region Button
+ #endregion // Button
+
+ #region ButtonBase
+ // Drawing
+ public abstract void DrawButtonBase(Graphics dc, Rectangle clip_area, ButtonBase button);
+
+ // Sizing
+ public abstract Size ButtonBaseDefaultSize{get;}
+ #endregion // ButtonBase
+
+ #region CheckBox
+ public abstract void DrawCheckBox(Graphics dc, Rectangle clip_area, CheckBox checkbox);
+ #endregion // CheckBox
+
+ #region CheckedListBox
+ // Drawing
+ public abstract void DrawCheckedListBoxItem (CheckedListBox ctrl, DrawItemEventArgs e);
+ public abstract Rectangle CheckedListBoxCheckRectangle ();
+ #endregion // CheckedListBox
+
+ #region ComboBox
+ // Drawing
+ public abstract void DrawComboBoxEditDecorations (Graphics dc, ComboBox ctrl, Rectangle rect);
+ public abstract void DrawComboListBoxDecorations (Graphics dc, ComboBox ctrl, Rectangle rect);
+ public abstract void DrawComboBoxItem (ComboBox ctrl, DrawItemEventArgs e);
+
+ // Sizing
+ public abstract int DrawComboBoxEditDecorationTop ();
+ public abstract int DrawComboBoxEditDecorationBottom ();
+ public abstract int DrawComboBoxEditDecorationRight ();
+ public abstract int DrawComboBoxEditDecorationLeft ();
+ public abstract int DrawComboListBoxDecorationTop (ComboBoxStyle style);
+ public abstract int DrawComboListBoxDecorationBottom (ComboBoxStyle style);
+ public abstract int DrawComboListBoxDecorationRight (ComboBoxStyle style);
+ public abstract int DrawComboListBoxDecorationLeft (ComboBoxStyle style);
+ #endregion // ComboBox
+
+ #region Control
+ #endregion // Control
+
+ #region Datagrid
+ public abstract int DataGridPreferredColumnWidth { get; }
+ public abstract int DataGridMinimumColumnCheckBoxHeight { get; }
+ public abstract int DataGridMinimumColumnCheckBoxWidth { get; }
+
+ // Default colours
+ public abstract Color DataGridAlternatingBackColor { get; }
+ public abstract Color DataGridBackColor { get; }
+ public abstract Color DataGridBackgroundColor { get; }
+ public abstract Color DataGridCaptionBackColor { get; }
+ public abstract Color DataGridCaptionForeColor { get; }
+ public abstract Color DataGridGridLineColor { get; }
+ public abstract Color DataGridHeaderBackColor { get; }
+ public abstract Color DataGridHeaderForeColor { get; }
+ public abstract Color DataGridLinkColor { get; }
+ public abstract Color DataGridLinkHoverColor { get; }
+ public abstract Color DataGridParentRowsBackColor { get; }
+ public abstract Color DataGridParentRowsForeColor { get; }
+ public abstract Color DataGridSelectionBackColor { get; }
+ public abstract Color DataGridSelectionForeColor { get; }
+ // Paint
+ public abstract void DataGridPaint (PaintEventArgs pe, DataGrid grid);
+ public abstract void DataGridPaintCaption (Graphics g, Rectangle clip, DataGrid grid);
+ public abstract void DataGridPaintColumnsHdrs (Graphics g, Rectangle clip, DataGrid grid);
+ public abstract void DataGridPaintRowsHeaders (Graphics g, Rectangle clip, DataGrid grid);
+ public abstract void DataGridPaintRowHeader (Graphics g, Rectangle bounds, int row, DataGrid grid);
+ public abstract void DataGridPaintRowHeaderArrow (Graphics g, Rectangle bounds, DataGrid grid);
+ public abstract void DataGridPaintRows (Graphics g, Rectangle cells, Rectangle clip, DataGrid grid);
+ public abstract void DataGridPaintRow (Graphics g, int row, Rectangle row_rect, bool is_newrow, DataGrid grid);
+
+
+ #endregion // Datagrid
+
+ #region DateTimePicker
+
+ public abstract void DrawDateTimePicker(Graphics dc, Rectangle clip_rectangle, DateTimePicker dtp);
+
+ #endregion // DateTimePicker
+
+ #region GroupBox
+ // Drawing
+ public abstract void DrawGroupBox (Graphics dc, Rectangle clip_area, GroupBox box);
+
+ // Sizing
+ public abstract Size GroupBoxDefaultSize{get;}
+ #endregion // GroupBox
+
+ #region HScrollBar
+ public abstract Size HScrollBarDefaultSize{get;} // Default size of the scrollbar
+ #endregion // HScrollBar
+
+ #region Label
+ // Drawing
+ public abstract void DrawLabel (Graphics dc, Rectangle clip_rectangle, Label label);
+
+ // Sizing
+ public abstract Size LabelDefaultSize{get;}
+ #endregion // Label
+
+ #region LinkLabel
+ public abstract void DrawLinkLabel (Graphics dc, Rectangle clip_rectangle, LinkLabel label);
+ #endregion // LinkLabel
+
+ #region ListBox
+ // Drawing
+ public abstract void DrawListBoxItem (ListBox ctrl, DrawItemEventArgs e);
+ #endregion // ListBox
+
+ #region ListView
+ // Drawing
+ public abstract void DrawListView (Graphics dc, Rectangle clip_rectangle, ListView control);
+
+ // Sizing
+ public abstract Size ListViewCheckBoxSize { get; }
+ public abstract int ListViewColumnHeaderHeight { get; }
+ public abstract int ListViewDefaultColumnWidth { get; }
+ public abstract int ListViewVerticalSpacing { get; }
+ public abstract int ListViewEmptyColumnWidth { get; }
+ public abstract int ListViewHorizontalSpacing { get; }
+ public abstract Size ListViewDefaultSize { get; }
+ #endregion // ListView
+
+ #region Menus
+ public abstract void CalcItemSize (Graphics dc, MenuItem item, int y, int x, bool menuBar);
+ public abstract void CalcPopupMenuSize (Graphics dc, Menu menu);
+ public abstract int CalcMenuBarSize (Graphics dc, Menu menu, int width);
+ public abstract void DrawMenuBar (Graphics dc, Menu menu, Rectangle rect);
+ public abstract void DrawMenuItem (MenuItem item, DrawItemEventArgs e);
+ public abstract void DrawPopupMenu (Graphics dc, Menu menu, Rectangle cliparea, Rectangle rect);
+ #endregion // Menus
+
+ #region MonthCalendar
+ public abstract void DrawMonthCalendar(Graphics dc, Rectangle clip_rectangle, MonthCalendar month_calendar);
+ #endregion // MonthCalendar
+
+ #region Panel
+ // Sizing
+ public abstract Size PanelDefaultSize{get;}
+ #endregion // Panel
+
+ #region PictureBox
+ // Drawing
+ public abstract void DrawPictureBox (Graphics dc, Rectangle clip, PictureBox pb);
+
+ // Sizing
+ public abstract Size PictureBoxDefaultSize{get;}
+ #endregion // PictureBox
+
+ #region ProgressBar
+ // Drawing
+ public abstract void DrawProgressBar (Graphics dc, Rectangle clip_rectangle, ProgressBar progress_bar);
+
+ // Sizing
+ public abstract Size ProgressBarDefaultSize{get;}
+ #endregion // ProgressBar
+
+ #region RadioButton
+ // Drawing
+ public abstract void DrawRadioButton (Graphics dc, Rectangle clip_rectangle, RadioButton radio_button);
+
+ // Sizing
+ public abstract Size RadioButtonDefaultSize{get;}
+ #endregion // RadioButton
+
+ #region ScrollBar
+ // Drawing
+ //public abstract void DrawScrollBar (Graphics dc, Rectangle area, ScrollBar bar, ref Rectangle thumb_pos, ref Rectangle first_arrow_area, ref Rectangle second_arrow_area, ButtonState first_arrow, ButtonState second_arrow, ref int scrollbutton_width, ref int scrollbutton_height, bool vert);
+ public abstract void DrawScrollBar (Graphics dc, Rectangle clip_rectangle, ScrollBar bar);
+
+ // Sizing
+ public abstract int ScrollBarButtonSize {get;} // Size of the scroll button
+ #endregion // ScrollBar
+
+ #region StatusBar
+ // Drawing
+ public abstract void DrawStatusBar (Graphics dc, Rectangle clip_rectangle, StatusBar sb);
+
+ // Sizing
+ public abstract int StatusBarSizeGripWidth {get;} // Size of Resize area
+ public abstract int StatusBarHorzGapWidth {get;} // Gap between panels
+ public abstract Size StatusBarDefaultSize{get;}
+ #endregion // StatusBar
+
+ #region TabControl
+ public abstract Size TabControlDefaultItemSize { get; }
+ public abstract Point TabControlDefaultPadding { get; }
+ public abstract int TabControlMinimumTabWidth { get; }
+
+ public abstract Rectangle GetTabControlLeftScrollRect (TabControl tab);
+ public abstract Rectangle GetTabControlRightScrollRect (TabControl tab);
+ public abstract Rectangle GetTabControlDisplayRectangle (TabControl tab);
+ public abstract Size TabControlGetSpacing (TabControl tab);
+ public abstract void DrawTabControl (Graphics dc, Rectangle area, TabControl tab);
+ #endregion
+
+ #region ToolBar
+ // Drawing
+ public abstract void DrawToolBar (Graphics dc, Rectangle clip_rectangle, ToolBar control);
+
+ // Sizing
+ public abstract int ToolBarGripWidth {get;} // Grip width for the ToolBar
+ public abstract int ToolBarImageGripWidth {get;} // Grip width for the Image on the ToolBarButton
+ public abstract int ToolBarSeparatorWidth {get;} // width of the separator
+ public abstract int ToolBarDropDownWidth { get; } // width of the dropdown arrow rect
+ public abstract int ToolBarDropDownArrowWidth { get; } // width for the dropdown arrow on the ToolBarButton
+ public abstract int ToolBarDropDownArrowHeight { get; } // height for the dropdown arrow on the ToolBarButton
+ public abstract Size ToolBarDefaultSize{get;}
+ #endregion // ToolBar
+
+ #region ToolTip
+ public abstract void DrawToolTip(Graphics dc, Rectangle clip_rectangle, ToolTip.ToolTipWindow control);
+ public abstract Size ToolTipSize(ToolTip.ToolTipWindow tt, string text);
+ #endregion // ToolTip
+
+
+ #region TrackBar
+ // Drawing
+ public abstract void DrawTrackBar (Graphics dc, Rectangle clip_rectangle, TrackBar tb);
+
+ // Sizing
+ public abstract Size TrackBarDefaultSize{get; } // Default size for the TrackBar control
+ #endregion // TrackBar
+
+ #region VScrollBar
+ public abstract Size VScrollBarDefaultSize{get;} // Default size of the scrollbar
+ #endregion // VScrollBar
+
+ #region TreeView
+ public abstract Size TreeViewDefaultSize { get; }
+ #endregion
+
+ #region ControlPaint Methods
+ public abstract void CPDrawBorder (Graphics graphics, Rectangle bounds, Color leftColor, int leftWidth,
+ ButtonBorderStyle leftStyle, Color topColor, int topWidth, ButtonBorderStyle topStyle,
+ Color rightColor, int rightWidth, ButtonBorderStyle rightStyle, Color bottomColor,
+ int bottomWidth, ButtonBorderStyle bottomStyle);
+
+ public abstract void CPDrawBorder3D (Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides);
+ public abstract void CPDrawButton (Graphics graphics, Rectangle rectangle, ButtonState state);
+ public abstract void CPDrawCaptionButton (Graphics graphics, Rectangle rectangle, CaptionButton button, ButtonState state);
+ public abstract void CPDrawCheckBox (Graphics graphics, Rectangle rectangle, ButtonState state);
+ public abstract void CPDrawComboButton (Graphics graphics, Rectangle rectangle, ButtonState state);
+ public abstract void CPDrawContainerGrabHandle (Graphics graphics, Rectangle bounds);
+ public abstract void CPDrawFocusRectangle (Graphics graphics, Rectangle rectangle, Color foreColor, Color backColor);
+ public abstract void CPDrawGrabHandle (Graphics graphics, Rectangle rectangle, bool primary, bool enabled);
+ public abstract void CPDrawGrid (Graphics graphics, Rectangle area, Size pixelsBetweenDots, Color backColor);
+ public abstract void CPDrawImageDisabled (Graphics graphics, Image image, int x, int y, Color background);
+ public abstract void CPDrawLockedFrame (Graphics graphics, Rectangle rectangle, bool primary);
+ public abstract void CPDrawMenuGlyph (Graphics graphics, Rectangle rectangle, MenuGlyph glyph);
+ public abstract void CPDrawRadioButton (Graphics graphics, Rectangle rectangle, ButtonState state);
+ public abstract void CPDrawReversibleFrame (Rectangle rectangle, Color backColor, FrameStyle style);
+ public abstract void CPDrawReversibleLine (Point start, Point end, Color backColor);
+ public abstract void CPDrawScrollButton (Graphics graphics, Rectangle rectangle, ScrollButton button, ButtonState state);
+ public abstract void CPDrawSelectionFrame (Graphics graphics, bool active, Rectangle outsideRect, Rectangle insideRect,
+ Color backColor);
+ public abstract void CPDrawSizeGrip (Graphics graphics, Color backColor, Rectangle bounds);
+ public abstract void CPDrawStringDisabled (Graphics graphics, string s, Font font, Color color, RectangleF layoutRectangle,
+ StringFormat format);
+ public abstract void CPDrawBorderStyle (Graphics dc, Rectangle area, BorderStyle border_style);
+ #endregion // ControlPaint Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeClearlooks.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeClearlooks.cs
new file mode 100644
index 00000000000..317d0570cc9
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeClearlooks.cs
@@ -0,0 +1,3402 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Alexander Olk, alex.olk@googlemail.com
+//
+// based on ThemeWin32Classic
+//
+// - You can activate this Theme with export MONO_THEME=clearlooks
+//
+// This theme tries to match clearlooks theme
+//
+// TODO:
+// - if an other control draws over a ScrollBar button you can see artefacts on the rounded edges
+// (maybe use theme backcolor, but that looks ugly on a white background, need to find a way to get the backcolor of the parent control)
+// - more correct drawing of disabled controls
+
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Drawing.Imaging;
+using System.Drawing.Text;
+
+namespace System.Windows.Forms {
+ internal class ThemeClearlooks : ThemeWin32Classic {
+ public override Version Version {
+ get {
+ return new Version( 0, 0, 0, 2 );
+ }
+ }
+
+ static readonly Color theme_back_color = Color.FromArgb( 239, 235, 231 );
+
+ static readonly Color gradient_first_color = Color.FromArgb( 250, 248, 247 );
+ static readonly Color gradient_second_color = Color.FromArgb( 226, 219, 212 );
+ static readonly Color gradient_second_color_nr2 = Color.FromArgb( 234, 229, 224 );
+ static readonly Color pressed_gradient_first_color = Color.FromArgb( 217, 207, 202 );
+ static readonly Color pressed_gradient_second_color = Color.FromArgb( 199, 193, 187 );
+ static readonly Color border_normal_dark_color = Color.FromArgb( 129, 117, 106 );
+ static readonly Color border_normal_light_color = Color.FromArgb( 158, 145, 131 );
+ static readonly Color border_pressed_dark_color = Color.FromArgb( 109, 103, 98 );
+ static readonly Color border_pressed_light_color = Color.FromArgb( 120, 114, 107 );
+ static readonly Color button_outer_border_dark_color = Color.FromArgb( 232, 226, 220 );
+ static readonly Color button_outer_border_light_color = Color.FromArgb( 250, 248, 247 );
+ static readonly Color inner_border_dark_color = Color.FromArgb( 226, 219, 212 );
+ static readonly Color pressed_inner_border_dark_color = Color.FromArgb( 192, 181, 169 );
+ static readonly Color edge_top_inner_color = Color.FromArgb( 206, 200, 194 );
+ static readonly Color edge_bottom_inner_color = Color.FromArgb( 215, 209, 202 );
+ static readonly Color button_edge_top_outer_color = Color.FromArgb( 237, 233, 228 );
+ static readonly Color button_edge_bottom_outer_color = Color.FromArgb( 243, 239, 236 );
+ static readonly Color button_focus_color = Color.FromArgb( 101, 94, 86 );
+ static readonly Color button_mouse_entered_second_gradient_color = Color.FromArgb( 230, 226, 219 );
+
+ static readonly Color scrollbar_background_color = Color.FromArgb( 209, 200, 191 );
+ static readonly Color scrollbar_border_color = Color.FromArgb( 170, 156, 143 );
+ static readonly Color scrollbar_gradient_first_color = Color.FromArgb( 248, 247, 245 );
+ static readonly Color scrollbar_gradient_second_color = Color.FromArgb( 234, 229, 224 );
+
+ static readonly Color arrow_color = Color.FromArgb( 16, 16, 16 );
+
+ static readonly Color tab_border_color = Color.FromArgb( 166, 151, 138 );
+ static readonly Color tab_not_selected_gradient_first_color = Color.FromArgb( 227, 223, 220 );
+ static readonly Color tab_not_selected_gradient_second_color = Color.FromArgb( 214, 209, 204 );
+ static readonly Color tab_selected_gradient_first_color = Color.FromArgb( 243, 239, 236 );
+ static readonly Color tab_selected_gradient_second_color = Color.FromArgb( 234, 228, 223 );
+ static readonly Color tab_edge_color = Color.FromArgb( 200, 196, 191 );
+ static readonly Color tab_inner_border_color = Color.FromArgb( 221, 212, 205 );
+ static readonly Color tab_top_border_focus_color = Color.FromArgb( 70, 91, 110 );
+ static readonly Color tab_focus_color = Color.FromArgb( 105, 147, 185 );
+
+ static readonly Color menuitem_gradient_first_color = Color.FromArgb( 98, 140, 178 );
+ static readonly Color menuitem_gradient_second_color = Color.FromArgb( 81, 113, 142 );
+ static readonly Color menuitem_border_color = Color.FromArgb( 80, 112, 141 );
+ static readonly Color menu_separator_color = Color.FromArgb( 219, 211, 203 );
+ static readonly Color menu_background_color = Color.FromArgb( 248, 245, 242 );
+ static readonly Color menu_border_color = Color.FromArgb( 141, 122, 104 );
+ static readonly Color menu_inner_border_color = Color.FromArgb( 236, 228, 221 );
+
+ static readonly Color combobox_border_color = Color.FromArgb( 159, 146, 132 );
+ static readonly Color combobox_focus_border_color = Color.FromArgb( 70, 91, 110 );
+ static readonly Color combobox_focus_inner_border_color = Color.FromArgb( 167, 198, 225 );
+ static readonly Color combobox_button_second_gradient_color = Color.FromArgb( 226, 220, 213 );
+
+ static readonly Color progressbar_edge_dot_color = Color.FromArgb( 219, 212, 205 );
+ static readonly Color progressbar_inner_border_color = Color.FromArgb( 139, 176, 209 );
+ static readonly Color progressbar_first_gradient_color = Color.FromArgb( 104, 146, 184 );
+ static readonly Color progressbar_second_gradient_color = Color.FromArgb( 91, 133, 172 );
+
+ static readonly Color checkbox_inner_boder_color = Color.FromArgb( 237, 234, 231 );
+ static readonly Color checkbox_pressed_inner_boder_color = Color.FromArgb( 203, 196, 189 );
+ static readonly Color checkbox_pressed_backcolor = Color.FromArgb( 212, 207, 202 );
+
+ static readonly Color trackbar_second_gradient_color = Color.FromArgb( 114, 154, 190 );
+ static readonly Color trackbar_third_gradient_color = Color.FromArgb( 130, 168, 202 );
+ static readonly Color trackbar_inner_first_gradient_color = Color.FromArgb( 238, 233, 229 );
+ static readonly Color trackbar_inner_second_gradient_color = Color.FromArgb( 223, 215, 208 );
+ static readonly Color trackbar_inner_pressed_second_gradient_color = Color.FromArgb( 224, 217, 210 );
+
+ static readonly Color disabled_color_foreground = Color.FromArgb( 182, 180, 173 );
+
+ static readonly Color active_caption = Color.FromArgb( 85, 152, 215 );
+
+ static readonly Color radio_button_border_circle_color = Color.FromArgb( 126, 118, 105 );
+ static readonly Color radio_button_dot_color = Color.FromArgb( 94, 160, 221 );
+
+ const int SEPARATOR_HEIGHT = 7;
+ const int MENU_TAB_SPACE = 8; // Pixels added to the width of an item because of a tab
+ const int MENU_BAR_ITEMS_SPACE = 8; // Space between menu bar items
+
+ int platform = (int) Environment.OSVersion.Platform;
+
+ static Color control_parent_backcolor;
+
+ #region Principal Theme Methods
+ public ThemeClearlooks( ) {
+ ColorControl = theme_back_color;
+ always_draw_hotkeys = true;
+ }
+
+ public override Color DefaultControlBackColor {
+ get { return theme_back_color; }
+ }
+
+ public override Color DefaultWindowBackColor {
+ get { return theme_back_color; }
+ }
+
+ public override Color ColorControl {
+ get { return theme_back_color;}
+ }
+
+ public override Color ColorHighlight {
+ get { return menuitem_gradient_first_color; }
+ }
+
+ public override Color ColorActiveCaption {
+ get { return active_caption; }
+ }
+
+ public override Size Border3DSize {
+ get {
+ return new Size( 3, 3 );
+ }
+ }
+
+ public override Image Images(UIIcon index, int size) {
+ switch (index) {
+ case UIIcon.PlacesRecentDocuments:
+ if ((platform == 4) || (platform == 128))
+ return MimeIconEngine.GetIconForMimeTypeAndSize( "recently/recently", new Size(size, size) );
+ else
+ return base.Images (UIIcon.PlacesRecentDocuments, size);
+ case UIIcon.PlacesDesktop:
+ if ((platform == 4) || (platform == 128))
+ return MimeIconEngine.GetIconForMimeTypeAndSize( "desktop/desktop", new Size(size, size) );
+ else
+ return base.Images (UIIcon.PlacesDesktop, size);
+ case UIIcon.PlacesPersonal:
+ if ((platform == 4) || (platform == 128))
+ return MimeIconEngine.GetIconForMimeTypeAndSize( "directory/home", new Size(size, size) );
+ else
+ return base.Images (UIIcon.PlacesPersonal, size);
+ case UIIcon.PlacesMyComputer:
+ if ((platform == 4) || (platform == 128))
+ return MimeIconEngine.GetIconForMimeTypeAndSize( "workplace/workplace", new Size(size, size) );
+ else
+ return base.Images (UIIcon.PlacesMyComputer, size);
+ case UIIcon.PlacesMyNetwork:
+ if ((platform == 4) || (platform == 128))
+ return MimeIconEngine.GetIconForMimeTypeAndSize( "network/network", new Size(size, size) );
+ else
+ return base.Images (UIIcon.PlacesMyNetwork, size);
+
+ // Icons for message boxes
+ case UIIcon.MessageBoxError: return base.Images (UIIcon.MessageBoxError, size);
+ case UIIcon.MessageBoxInfo: return base.Images (UIIcon.MessageBoxInfo, size);
+ case UIIcon.MessageBoxQuestion: return base.Images (UIIcon.MessageBoxQuestion, size);
+ case UIIcon.MessageBoxWarning: return base.Images (UIIcon.MessageBoxWarning, size);
+
+ // misc Icons
+ case UIIcon.NormalFolder:
+ if ((platform == 4) || (platform == 128))
+ return MimeIconEngine.GetIconForMimeTypeAndSize( "inode/directory", new Size(size, size) );
+ else
+ return base.Images (UIIcon.NormalFolder, size);
+
+ default: {
+ throw new ArgumentException("Invalid Icon type requested", "index");
+ }
+ }
+ }
+ #endregion // Internal Methods
+
+ #region ButtonBase
+ protected override void ButtonBase_DrawButton( ButtonBase button, Graphics dc ) {
+ dc.FillRectangle( ResPool.GetSolidBrush( button.BackColor ), button.ClientRectangle );
+
+ Color first_gradient_color = gradient_first_color;
+ Color second_gradient_color = gradient_second_color;
+
+ if (((button is CheckBox) && (((CheckBox)button).check_state == CheckState.Checked)) ||
+ ((button is RadioButton) && (((RadioButton)button).check_state == CheckState.Checked))) {
+ first_gradient_color = button.is_entered ? gradient_second_color : pressed_gradient_first_color;
+ second_gradient_color = button.is_entered ? gradient_second_color : pressed_gradient_second_color;
+ } else
+ if (!button.is_enabled) {
+ button.is_entered = false;
+ } else
+ if (button.is_entered) {
+ if (!button.is_pressed) {
+ first_gradient_color = Color.White;
+ second_gradient_color = button_mouse_entered_second_gradient_color;
+ } else {
+ first_gradient_color = pressed_gradient_first_color;
+ second_gradient_color = pressed_gradient_second_color;
+ }
+ }
+
+ bool paint_acceptbutton_black_border = false;
+ Form form = button.TopLevelControl as Form;
+
+ if (form != null && (form.AcceptButton == button as IButtonControl))
+ paint_acceptbutton_black_border = true;
+
+ CL_Draw_Button(dc, button.ClientRectangle, button.flat_style,
+ button.is_entered, button.is_enabled, button.is_pressed,
+ first_gradient_color, second_gradient_color,
+ paint_acceptbutton_black_border);
+ }
+
+ private void CL_Draw_Button(Graphics dc, Rectangle buttonRectangle, FlatStyle flat_style,
+ bool is_entered, bool is_enabled, bool is_pressed,
+ Color first_gradient_color, Color second_gradient_color,
+ bool paint_acceptbutton_black_border)
+ {
+ Rectangle lgbRectangle = new Rectangle (buttonRectangle.X + 3, buttonRectangle.Y + 3,
+ is_pressed ? buttonRectangle.Width - 5 : buttonRectangle.Width - 6,
+ buttonRectangle.Height - 6);
+
+ if (flat_style != FlatStyle.Popup || ((flat_style == FlatStyle.Popup) && is_entered)) {
+ LinearGradientBrush lgbr;
+ if (flat_style == FlatStyle.Flat)
+ lgbr = new LinearGradientBrush (new Point (buttonRectangle.X, buttonRectangle.Y + 3),
+ new Point (buttonRectangle.X, buttonRectangle.Bottom - 3),
+ second_gradient_color, first_gradient_color);
+ else
+ lgbr = new LinearGradientBrush (new Point (buttonRectangle.X, buttonRectangle.Y + 3),
+ new Point (buttonRectangle.X, buttonRectangle.Bottom - 3),
+ first_gradient_color, second_gradient_color);
+ dc.FillRectangle (lgbr, lgbRectangle);
+ lgbr.Dispose ();
+
+ Point[] points_top = {
+ new Point (buttonRectangle.X + 2, buttonRectangle.Y + 2),
+ new Point (buttonRectangle.X + 3, buttonRectangle.Y + 1),
+ new Point (buttonRectangle.Right - 4, buttonRectangle.Y + 1),
+ new Point (buttonRectangle.Right - 3 , buttonRectangle.Y + 2)
+ };
+
+ Point[] points_bottom = {
+ new Point (buttonRectangle.X + 2, buttonRectangle.Bottom - 3),
+ new Point (buttonRectangle.X + 3, buttonRectangle.Bottom - 2),
+ new Point (buttonRectangle.Right - 4, buttonRectangle.Bottom - 2),
+ new Point (buttonRectangle.Right - 3, buttonRectangle.Bottom - 3)
+ };
+
+ Point[] points_top_outer = {
+ new Point (buttonRectangle.X + 1, buttonRectangle.Y + 1),
+ new Point (buttonRectangle.X + 2, buttonRectangle.Y),
+ new Point (buttonRectangle.Right - 3, buttonRectangle.Y),
+ new Point (buttonRectangle.Right - 2 , buttonRectangle.Y + 1)
+ };
+
+ Point[] points_bottom_outer = {
+ new Point (buttonRectangle.X + 1, buttonRectangle.Bottom - 2),
+ new Point (buttonRectangle.X + 2, buttonRectangle.Bottom - 1),
+ new Point (buttonRectangle.Right - 3, buttonRectangle.Bottom - 1),
+ new Point (buttonRectangle.Right - 2, buttonRectangle.Bottom - 2)
+ };
+
+ Pen pen = null;
+
+ // normal border
+ if (is_enabled) {
+ Color top_color = Color.Black;
+ Color bottom_color = Color.Black;
+
+ if (!paint_acceptbutton_black_border) {
+ top_color = is_pressed ? border_pressed_dark_color : border_normal_dark_color;
+ bottom_color = is_pressed ? border_pressed_light_color : border_normal_light_color;
+ }
+
+ pen = ResPool.GetPen (top_color);
+ dc.DrawLines (pen, points_top);
+ pen = ResPool.GetPen (bottom_color);
+ dc.DrawLines (pen, points_bottom);
+
+ using (LinearGradientBrush lgbr2 = new LinearGradientBrush (new Point (buttonRectangle.X, buttonRectangle.Y + 3),
+ new Point (buttonRectangle.X, buttonRectangle.Bottom - 3),
+ top_color, bottom_color)) {
+ dc.FillRectangle (lgbr2, buttonRectangle.X + 1, buttonRectangle.Y + 3, 1, buttonRectangle.Height - 6);
+ dc.FillRectangle (lgbr2, buttonRectangle.Right - 2, buttonRectangle.Y + 3, 1, buttonRectangle.Height - 6);
+ }
+ } else {
+ Point[] points_button_complete = {
+ new Point (buttonRectangle.X + 1, buttonRectangle.Y + 3),
+ new Point (buttonRectangle.X + 3, buttonRectangle.Y + 1),
+ new Point (buttonRectangle.Right - 4, buttonRectangle.Y + 1),
+ new Point (buttonRectangle.Right - 2, buttonRectangle.Y + 3),
+ new Point (buttonRectangle.Right - 2, buttonRectangle.Bottom - 4),
+ new Point (buttonRectangle.Right - 4, buttonRectangle.Bottom - 2),
+ new Point (buttonRectangle.X + 3, buttonRectangle.Bottom - 2),
+ new Point (buttonRectangle.X + 1, buttonRectangle.Bottom - 4),
+ new Point (buttonRectangle.X + 1, buttonRectangle.Y + 3)
+ };
+
+ pen = ResPool.GetPen (pressed_inner_border_dark_color);
+ dc.DrawLines (pen, points_button_complete);
+ }
+
+ // outer border
+ pen = ResPool.GetPen (button_outer_border_dark_color);
+ dc.DrawLines (pen, points_top_outer);
+ pen = ResPool.GetPen (button_outer_border_light_color);
+ dc.DrawLines (pen, points_bottom_outer);
+
+ using (LinearGradientBrush lgbr2 = new LinearGradientBrush (new Point (buttonRectangle.X, buttonRectangle.Y + 2),
+ new Point (buttonRectangle.X, buttonRectangle.Bottom - 1),
+ button_outer_border_dark_color, button_outer_border_light_color)) {
+ dc.FillRectangle (lgbr2, buttonRectangle.X, buttonRectangle.Y + 2, 1, buttonRectangle.Height - 4);
+ dc.FillRectangle (lgbr2, buttonRectangle.Right - 1, buttonRectangle.Y + 2, 1, buttonRectangle.Height - 4);
+ }
+
+ // inner border
+ pen = ResPool.GetPen (is_pressed ? pressed_inner_border_dark_color : inner_border_dark_color);
+ if (!is_pressed) {
+ dc.DrawLine (pen, buttonRectangle.Right - 3, buttonRectangle.Y + 3, buttonRectangle.Right - 3, buttonRectangle.Bottom - 4);
+ }
+ dc.DrawLine (pen, buttonRectangle.X + 3, buttonRectangle.Bottom - 3, buttonRectangle.Right - 4, buttonRectangle.Bottom - 3);
+ pen = ResPool.GetPen (is_pressed ? pressed_inner_border_dark_color : Color.White);
+ dc.DrawLine (pen, buttonRectangle.X + 2, buttonRectangle.Y + 3, buttonRectangle.X + 2, buttonRectangle.Bottom - 4);
+ dc.DrawLine (pen, buttonRectangle.X + 3 , buttonRectangle.Y + 2, buttonRectangle.Right - 4, buttonRectangle.Y + 2);
+
+ // edges
+ pen = ResPool.GetPen (edge_top_inner_color);
+ dc.DrawLine (pen, buttonRectangle.X + 1, buttonRectangle.Y + 2, buttonRectangle.X + 2, buttonRectangle.Y + 1);
+ dc.DrawLine (pen, buttonRectangle.Right - 3, buttonRectangle.Y + 1, buttonRectangle.Right - 2, buttonRectangle.Y + 2);
+
+ pen = ResPool.GetPen (button_edge_top_outer_color);
+ dc.DrawLine (pen, buttonRectangle.X, buttonRectangle.Y + 1, buttonRectangle.X + 1, buttonRectangle.Y);
+ dc.DrawLine (pen, buttonRectangle.Right - 2, buttonRectangle.Y, buttonRectangle.Right - 1, buttonRectangle.Y + 1);
+
+ pen = ResPool.GetPen (edge_bottom_inner_color);
+ dc.DrawLine (pen, buttonRectangle.X + 1, buttonRectangle.Bottom - 3, buttonRectangle.X + 2, buttonRectangle.Bottom - 2);
+ dc.DrawLine (pen, buttonRectangle.Right - 2, buttonRectangle.Bottom - 3, buttonRectangle.Right - 3, buttonRectangle.Bottom - 2);
+
+ pen = ResPool.GetPen (button_edge_bottom_outer_color);
+ dc.DrawLine (pen, buttonRectangle.X, buttonRectangle.Bottom - 2, buttonRectangle.X + 1, buttonRectangle.Bottom - 1);
+ dc.DrawLine (pen, buttonRectangle.Right - 1, buttonRectangle.Bottom - 2, buttonRectangle.Right - 2, buttonRectangle.Bottom - 1);
+ }
+ }
+
+ protected override void ButtonBase_DrawFocus( ButtonBase button, Graphics dc ) {
+
+ if ( !button.is_enabled || button.flat_style == FlatStyle.Popup )
+ return;
+
+ Pen pen = ResPool.GetPen( button_focus_color );
+ DashStyle old_dash_style = pen.DashStyle;
+ pen.DashStyle = DashStyle.Dot;
+
+ Rectangle focus_rect = new Rectangle( button.ClientRectangle.X + 4, button.ClientRectangle.Y + 4, button.ClientRectangle.Width - 9, button.ClientRectangle.Height - 9 );
+
+ dc.DrawRectangle( pen, focus_rect );
+
+ pen.DashStyle = old_dash_style;
+ }
+
+ // FIXME: remove if libgdiplus DrawOrMeasureString is fixed
+ protected override void ButtonBase_DrawText( ButtonBase button, Graphics dc ) {
+ if ( !( button is CheckBox ) && !( button is RadioButton ) ) {
+ Rectangle buttonRectangle = button.ClientRectangle;
+ Rectangle text_rect = Rectangle.Inflate( buttonRectangle, -4, -4 );
+
+ string text = button.Text;
+
+ if ( text.Length > 1 ) {
+ SizeF sizef = dc.MeasureString( text, button.Font, text_rect.Width, button.text_format );
+
+ if ( (int)sizef.Width > text_rect.Width - 3 ) {
+ for ( int i = 1; i < text.Length + 1; i++ ) {
+ sizef = dc.MeasureString( text.Substring( 0, i ), button.Font, text_rect.Width, button.text_format );
+
+ if ( (int)sizef.Width > text_rect.Width - 3 ) {
+ text = text.Substring( 0, i - 1 );
+ break;
+ }
+ }
+ }
+ }
+
+ if ( button.is_pressed ) {
+ text_rect.X++;
+ text_rect.Y++;
+ }
+
+ if ( button.is_enabled ) {
+ dc.DrawString( text, button.Font, ResPool.GetSolidBrush( button.ForeColor ), text_rect, button.text_format );
+ } else {
+ if ( button.FlatStyle == FlatStyle.Flat || button.FlatStyle == FlatStyle.Popup ) {
+ dc.DrawString( text, button.Font, ResPool.GetSolidBrush( ControlPaint.DarkDark( this.ColorControl ) ), text_rect, button.text_format );
+ } else {
+ CPDrawStringDisabled( dc, text, button.Font, ColorControlText, text_rect, button.text_format );
+ }
+ }
+ }
+ }
+ #endregion // ButtonBase
+
+ #region CheckBox
+ protected override void CheckBox_DrawCheckBox( Graphics dc, CheckBox checkbox, ButtonState state, Rectangle checkbox_rectangle ) {
+ dc.FillRectangle( ResPool.GetSolidBrush( checkbox.BackColor ), checkbox.ClientRectangle );
+ // render as per normal button
+ if ( checkbox.appearance == Appearance.Button ) {
+ DrawButtonBase( dc, checkbox.ClientRectangle, checkbox );
+ } else {
+ // establish if we are rendering a flat style of some sort
+ if ( checkbox.FlatStyle == FlatStyle.Flat || checkbox.FlatStyle == FlatStyle.Popup ) {
+ DrawFlatStyleCheckBox( dc, checkbox_rectangle, checkbox );
+ } else {
+ ControlPaint.DrawCheckBox( dc, checkbox_rectangle, state );
+ }
+ }
+ }
+ #endregion // CheckBox
+
+ #region ComboBox
+
+ // Drawing
+ public override void DrawComboBoxEditDecorations( Graphics dc, ComboBox ctrl, Rectangle cl ) {
+
+ Color inner_border = (ctrl.Focused && !ctrl.DroppedDown) ? combobox_focus_inner_border_color : Color.White; // Color.White should be the backcolor of the textctrl
+ Color border_color = (ctrl.Focused && !ctrl.DroppedDown) ? combobox_focus_border_color : combobox_border_color;
+
+ Point[] border_points = null;
+
+ Pen tmp_pen = ResPool.GetPen( inner_border );
+
+ dc.DrawLine( tmp_pen, cl.X + 1, cl.Y + 1, cl.X + 1, cl.Bottom - 2 );
+
+ if (!ctrl.Focused || (ctrl.Focused && ctrl.DropDownStyle == ComboBoxStyle.Simple))
+ {
+ dc.DrawLine( tmp_pen, cl.X + 2, cl.Y + 1, cl.Right - 2, cl.Y + 1 );
+ dc.DrawLine( tmp_pen, cl.X + 2, cl.Bottom - 2, cl.Right - 2, cl.Bottom - 2 );
+ dc.DrawLine( tmp_pen, cl.Right - 2, cl.Y + 1, cl.Right - 2, cl.Bottom - 2 );
+ } else {
+ dc.DrawLine( tmp_pen, cl.X + 2, cl.Y + 1, cl.Right - ctrl.combobox_info.button_rect.Width - 3, cl.Y + 1 );
+ dc.DrawLine( tmp_pen, cl.X + 2, cl.Bottom - 2, cl.Right - ctrl.combobox_info.button_rect.Width - 3, cl.Bottom - 2 );
+ }
+ if (ctrl.combobox_info.show_button) {
+ border_points = new Point[6] {
+ new Point( cl.Right - ctrl.combobox_info.button_rect.Width - 3, cl.Y ),
+ new Point( cl.X + 2, cl.Y ),
+ new Point( cl.X, cl.Y + 2 ),
+ new Point( cl.X, cl.Bottom - 3 ),
+ new Point( cl.X + 2, cl.Bottom - 1 ),
+ new Point( cl.Right - ctrl.combobox_info.button_rect.Width - 3, cl.Bottom - 1 )
+ };
+ } else {
+ border_points = new Point[9] {
+ new Point( cl.X + 2, cl.Y ),
+ new Point( cl.Right - 3, cl.Y ),
+ new Point( cl.Right - 1, cl.Y + 2 ),
+ new Point( cl.Right - 1, cl.Bottom - 3 ),
+ new Point( cl.Right - 3, cl.Bottom - 1 ),
+ new Point( cl.X + 2, cl.Bottom - 1 ),
+ new Point( cl.X, cl.Bottom - 3 ),
+ new Point( cl.X, cl.Y + 2 ),
+ new Point( cl.X + 2, cl.Y )
+ };
+ }
+
+ tmp_pen = ResPool.GetPen( ctrl.Parent.BackColor );
+ dc.DrawLine( tmp_pen, cl.X, cl.Y, cl.X, cl.Y + 1 );
+ dc.DrawLine( tmp_pen, cl.X, cl.Bottom - 1, cl.X, cl.Bottom - 2 );
+ dc.DrawLine( tmp_pen, cl.Right - 1, cl.Y, cl.Right - 1, cl.Y + 1 );
+ dc.DrawLine( tmp_pen, cl.Right - 1, cl.Bottom - 1, cl.Right - 1, cl.Bottom - 2 );
+
+ dc.DrawLines( ResPool.GetPen( border_color ), border_points );
+
+ tmp_pen = ResPool.GetPen( edge_bottom_inner_color );
+ dc.DrawLine( tmp_pen, cl.X, cl.Y + 1, cl.X + 1, cl.Y );
+ dc.DrawLine( tmp_pen, cl.X, cl.Bottom - 2, cl.X + 1, cl.Bottom - 1 );
+ dc.DrawLine( tmp_pen, cl.Right - 2, cl.Y, cl.Right - 1, cl.Y + 1 );
+ dc.DrawLine( tmp_pen, cl.Right - 2, cl.Bottom - 1, cl.Right - 1, cl.Bottom - 2 );
+
+ // FIXME:
+ // here we need to draw the combobox button again,
+ // as DrawComboBoxEditDecorations paints over a fullsize combox button.
+ // ComboBox code calls CPDrawComboButton first then DrawComboBoxEditDecorations
+ // It would be better to move that code out of ComboBox
+
+ if ( ctrl.combobox_info.show_button )
+ {
+ control_parent_backcolor = ctrl.Parent.BackColor;
+
+ ButtonState bs = ctrl.Enabled ? ctrl.combobox_info.button_status : ButtonState.Inactive;
+
+ Rectangle crect = new Rectangle( ctrl.combobox_info.button_rect.X, ctrl.combobox_info.button_rect.Y - 2,
+ ctrl.combobox_info.button_rect.Width + 2, ctrl.combobox_info.button_rect.Height + 4 );
+ CPDrawComboButton( dc, crect, bs );
+ }
+ }
+
+ public override void DrawComboListBoxDecorations( Graphics dc, ComboBox ctrl, Rectangle cl ) {
+ if ( ctrl.DropDownStyle == ComboBoxStyle.Simple ) {
+ DrawComboBoxEditDecorations( dc, ctrl, cl );
+ } else {
+ dc.DrawRectangle( ResPool.GetPen( combobox_border_color ), cl.X, cl.Y, cl.Width - 1, cl.Height - 1 );
+ }
+ }
+ #endregion ComboBox
+
+ #region Menus
+ public override void DrawMenuItem( MenuItem item, DrawItemEventArgs e ) {
+ StringFormat string_format;
+ Rectangle rect_text = e.Bounds;
+
+ if ( item.Visible == false )
+ return;
+
+ if ( item.MenuBar ) {
+ string_format = string_format_menu_menubar_text;
+ } else {
+ string_format = string_format_menu_text;
+ }
+
+ if ( item.Separator ) {
+ e.Graphics.DrawLine( ThemeEngine.Current.ResPool.GetPen( menu_separator_color ),
+ e.Bounds.X, e.Bounds.Y + 1, e.Bounds.X + e.Bounds.Right - 4, e.Bounds.Y + 1 );
+
+ e.Graphics.DrawLine( ThemeEngine.Current.ResPool.GetPen( Color.White ),
+ e.Bounds.X, e.Bounds.Y + 2, e.Bounds.X + e.Bounds.Right - 4, e.Bounds.Y + 2 );
+
+ return;
+ }
+
+ if ( !item.MenuBar )
+ rect_text.X += ThemeEngine.Current.MenuCheckSize.Width;
+
+ if ( item.BarBreak ) { /* Draw vertical break bar*/
+ Rectangle rect = e.Bounds;
+ rect.Y++;
+ rect.Width = 3;
+ rect.Height = item.MenuHeight - 6;
+
+ e.Graphics.DrawLine( ThemeEngine.Current.ResPool.GetPen( menu_separator_color ),
+ rect.X, rect.Y , rect.X, rect.Y + rect.Height );
+
+ e.Graphics.DrawLine( ThemeEngine.Current.ResPool.GetPen( ThemeEngine.Current.ColorControlLight ),
+ rect.X + 1, rect.Y , rect.X + 1, rect.Y + rect.Height );
+ }
+
+ Color color_text = ThemeEngine.Current.ColorMenuText;
+ Color color_back;
+
+ /* Draw background */
+ Rectangle rect_back = e.Bounds;
+ rect_back.X++;
+ rect_back.Width -= 2;
+
+ if ( ( e.State & DrawItemState.Selected ) == DrawItemState.Selected ) {
+ color_text = ThemeEngine.Current.ColorHighlightText;
+ color_back = item.MenuBar ? theme_back_color : menu_background_color;
+
+ using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( rect_back.X, rect_back.Y + 1 ), new Point( rect_back.X, rect_back.Bottom - 1 ), menuitem_gradient_first_color, menuitem_gradient_second_color ) ) {
+ e.Graphics.FillRectangle( lgbr, rect_back.X + 1, rect_back.Y + 1, rect_back.Width - 1, rect_back.Height - 1 );
+ }
+
+ rect_back.Height--;
+ Pen tmp_pen = ResPool.GetPen( menuitem_border_color );
+ e.Graphics.DrawLine( tmp_pen, rect_back.X + 1, rect_back.Y, rect_back.Right - 1, rect_back.Y );
+ e.Graphics.DrawLine( tmp_pen, rect_back.Right, rect_back.Y + 1, rect_back.Right, rect_back.Bottom - 1 );
+ e.Graphics.DrawLine( tmp_pen, rect_back.Right - 1, rect_back.Bottom, rect_back.X + 1, rect_back.Bottom );
+ e.Graphics.DrawLine( tmp_pen, rect_back.X, rect_back.Bottom - 1, rect_back.X, rect_back.Y + 1 );
+ } else {
+ color_text = ThemeEngine.Current.ColorMenuText;
+ color_back = item.MenuBar ? theme_back_color : menu_background_color;
+
+ e.Graphics.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush( color_back ), rect_back );
+ }
+
+ if ( item.Enabled ) {
+ e.Graphics.DrawString( item.Text, e.Font,
+ ThemeEngine.Current.ResPool.GetSolidBrush( color_text ),
+ rect_text, string_format );
+
+ if ( !item.MenuBar && item.Shortcut != Shortcut.None && item.ShowShortcut ) {
+ string str = item.GetShortCutText( );
+ Rectangle rect = rect_text;
+ rect.X = item.XTab;
+ rect.Width -= item.XTab;
+
+ e.Graphics.DrawString( str, e.Font, ThemeEngine.Current.ResPool.GetSolidBrush( color_text ),
+ rect, string_format_menu_shortcut );
+ }
+ } else {
+ ControlPaint.DrawStringDisabled( e.Graphics, item.Text, e.Font,
+ Color.Black, rect_text, string_format );
+ }
+
+ /* Draw arrow */
+ if ( item.MenuBar == false && item.IsPopup ) {
+ int cx = ThemeEngine.Current.MenuCheckSize.Width;
+ int cy = ThemeEngine.Current.MenuCheckSize.Height;
+ using ( Bitmap bmp = new Bitmap( cx, cy ) ) {
+ using ( Graphics dc = Graphics.FromImage( bmp ) ) {
+ SmoothingMode old_smoothing_mode = dc.SmoothingMode;
+ dc.SmoothingMode = SmoothingMode.AntiAlias;
+
+ Rectangle rect_arrow = new Rectangle( 0, 0, cx, cy );
+ ControlPaint.DrawMenuGlyph( dc, rect_arrow, MenuGlyph.Arrow );
+ bmp.MakeTransparent( );
+
+ if ( item.Enabled ) {
+ e.Graphics.DrawImage( bmp, e.Bounds.X + e.Bounds.Width - cx,
+ e.Bounds.Y + ( ( e.Bounds.Height - cy ) / 2 ) );
+ } else {
+ ControlPaint.DrawImageDisabled( e.Graphics, bmp, e.Bounds.X + e.Bounds.Width - cx,
+ e.Bounds.Y + ( ( e.Bounds.Height - cy ) / 2 ), color_back );
+ }
+
+ dc.SmoothingMode = old_smoothing_mode;
+ }
+ }
+ }
+
+ /* Draw checked or radio */
+ if ( item.MenuBar == false && item.Checked ) {
+
+ Rectangle area = e.Bounds;
+ int cx = ThemeEngine.Current.MenuCheckSize.Width;
+ int cy = ThemeEngine.Current.MenuCheckSize.Height;
+ using ( Bitmap bmp = new Bitmap( cx, cy ) ) {
+ using ( Graphics gr = Graphics.FromImage( bmp ) ) {
+ Rectangle rect_arrow = new Rectangle( 0, 0, cx, cy );
+
+ if ( item.RadioCheck )
+ ControlPaint.DrawMenuGlyph( gr, rect_arrow, MenuGlyph.Bullet );
+ else
+ ControlPaint.DrawMenuGlyph( gr, rect_arrow, MenuGlyph.Checkmark );
+
+ bmp.MakeTransparent( );
+ e.Graphics.DrawImage( bmp, area.X, e.Bounds.Y + ( ( e.Bounds.Height - cy ) / 2 ) );
+ }
+ }
+ }
+ }
+
+ public override void DrawPopupMenu( Graphics dc, Menu menu, Rectangle cliparea, Rectangle rect ) {
+
+ dc.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush
+ ( menu_background_color ), cliparea );
+
+ /* Draw menu borders */
+ dc.DrawRectangle( ResPool.GetPen( menu_border_color ), rect.X, rect.Y, rect.Width - 1, rect.Height - 1 );
+
+ // inner border
+ Pen tmp_pen = ResPool.GetPen( Color.White );
+ dc.DrawLine( tmp_pen, rect.X + 1, rect.Y + 1, rect.Right - 2, rect.Y + 1 );
+ dc.DrawLine( tmp_pen, rect.X + 1, rect.Y + 2, rect.X + 1, rect.Bottom - 2 );
+
+ tmp_pen = ResPool.GetPen( menu_inner_border_color );
+ dc.DrawLine( tmp_pen, rect.Right - 2, rect.Y + 2, rect.Right - 2, rect.Bottom - 2 );
+ dc.DrawLine( tmp_pen, rect.Right - 3, rect.Bottom - 2, rect.X + 2, rect.Bottom - 2 );
+
+ for ( int i = 0; i < menu.MenuItems.Count; i++ )
+ if ( cliparea.IntersectsWith( menu.MenuItems[ i ].bounds ) ) {
+ MenuItem item = menu.MenuItems[ i ];
+ item.MenuHeight = menu.Height;
+ item.PerformDrawItem( new DrawItemEventArgs( dc, ThemeEngine.Current.MenuFont,
+ item.bounds, i, item.Status ) );
+ }
+ }
+ #endregion // Menus
+
+ #region ProgressBar
+ public override void DrawProgressBar( Graphics dc, Rectangle clip_rect, ProgressBar ctrl ) {
+ Rectangle client_area = ctrl.client_area;
+ int barpos_pixels;
+ Rectangle bar = ctrl.client_area;
+
+ barpos_pixels = ( ( ctrl.Value - ctrl.Minimum ) * client_area.Width ) / ( ctrl.Maximum - ctrl.Minimum );
+
+ bar.Width = barpos_pixels + 1;
+
+ // Draw bar background
+ dc.FillRectangle( ResPool.GetSolidBrush( menu_separator_color ), ctrl.ClientRectangle.X + 1, ctrl.ClientRectangle.Y + 1, ctrl.ClientRectangle.Width - 2, ctrl.ClientRectangle.Height - 2 );
+
+ /* Draw border */
+ Pen tmp_pen = ResPool.GetPen( progressbar_edge_dot_color );
+ dc.DrawLine( tmp_pen, ctrl.ClientRectangle.X, ctrl.ClientRectangle.Y, ctrl.ClientRectangle.X, ctrl.ClientRectangle.Y + 1 );
+ dc.DrawLine( tmp_pen, ctrl.ClientRectangle.X, ctrl.ClientRectangle.Bottom - 1, ctrl.ClientRectangle.X, ctrl.ClientRectangle.Bottom - 2 );
+ dc.DrawLine( tmp_pen, ctrl.ClientRectangle.Right - 1, ctrl.ClientRectangle.Y, ctrl.ClientRectangle.Right - 1, ctrl.ClientRectangle.Y + 1 );
+ dc.DrawLine( tmp_pen, ctrl.ClientRectangle.Right - 1, ctrl.ClientRectangle.Bottom - 1, ctrl.ClientRectangle.Right - 1, ctrl.ClientRectangle.Bottom - 2 );
+
+ tmp_pen = ResPool.GetPen( scrollbar_border_color );
+ dc.DrawLine( tmp_pen, ctrl.ClientRectangle.X + 1, ctrl.ClientRectangle.Y, ctrl.ClientRectangle.Right - 2, ctrl.ClientRectangle.Y );
+ dc.DrawLine( tmp_pen, ctrl.ClientRectangle.Right - 1, ctrl.ClientRectangle.Y + 1, ctrl.ClientRectangle.Right - 1, ctrl.ClientRectangle.Bottom - 2 );
+ dc.DrawLine( tmp_pen, ctrl.ClientRectangle.X + 1, ctrl.ClientRectangle.Bottom - 1, ctrl.ClientRectangle.Right - 2, ctrl.ClientRectangle.Bottom - 1 );
+ dc.DrawLine( tmp_pen, ctrl.ClientRectangle.X, ctrl.ClientRectangle.Y + 1, ctrl.ClientRectangle.X, ctrl.ClientRectangle.Bottom - 2 );
+
+ if ( barpos_pixels == 0 )
+ return;
+
+ // Draw bar
+ dc.DrawRectangle( ResPool.GetPen( combobox_focus_border_color ), bar.X - 1, bar.Y - 1, bar.Width, bar.Height + 1 );
+ tmp_pen = ResPool.GetPen( progressbar_inner_border_color );
+ dc.DrawLine( tmp_pen, bar.X, bar.Y, bar.Right - 2, bar.Y );
+ dc.DrawLine( tmp_pen, bar.X, bar.Y, bar.X, bar.Bottom - 1 );
+
+ using ( Bitmap bmp = new Bitmap( bar.Width - 2, bar.Height - 1 ) ) {
+ using ( Graphics gr = Graphics.FromImage( bmp ) ) {
+ gr.FillRectangle( ResPool.GetSolidBrush( tab_focus_color ), 0, 0, bmp.Width, bmp.Height );
+
+ LinearGradientBrush lgbr = new LinearGradientBrush( new Rectangle( 0, 0, bmp.Height, bmp.Height ), progressbar_first_gradient_color, progressbar_second_gradient_color, 0.0f, true );
+
+ lgbr.RotateTransform( 45.0f, MatrixOrder.Append );
+
+ float pen_width = bmp.Height / 2;
+
+ Pen pen = new Pen( lgbr, pen_width );
+
+ int add = bmp.Height + (int)pen.Width / 2;
+
+ int x_top = 0;
+ int x_bottom = - bmp.Height;
+
+ while ( x_bottom < bmp.Width ) {
+ gr.DrawLine( pen, x_top, 0, x_bottom, bmp.Height );
+ x_top += add;
+ x_bottom += add;
+ }
+ pen.Dispose( );
+ lgbr.Dispose( );
+ }
+
+ dc.DrawImage( bmp, bar.X + 1, bar.Y + 1 );
+ }
+ }
+ #endregion // ProgressBar
+
+ #region RadioButton
+ protected override void RadioButton_DrawButton( RadioButton radio_button, Graphics dc, ButtonState state, Rectangle radiobutton_rectangle ) {
+ SolidBrush sb = new SolidBrush( radio_button.BackColor );
+ dc.FillRectangle( sb, radio_button.ClientRectangle );
+ sb.Dispose( );
+
+ if ( radio_button.appearance == Appearance.Button ) {
+ if ( radio_button.FlatStyle == FlatStyle.Flat || radio_button.FlatStyle == FlatStyle.Popup ) {
+ DrawFlatStyleButton( dc, radio_button.ClientRectangle, radio_button );
+ } else {
+ DrawButtonBase( dc, radio_button.ClientRectangle, radio_button );
+ }
+ } else {
+ // establish if we are rendering a flat style of some sort
+ if ( radio_button.FlatStyle == FlatStyle.Flat || radio_button.FlatStyle == FlatStyle.Popup ) {
+ DrawFlatStyleRadioButton( dc, radiobutton_rectangle, radio_button );
+ } else {
+ ControlPaint.DrawRadioButton( dc, radiobutton_rectangle, state );
+ }
+ }
+ }
+
+ protected override void RadioButton_DrawFocus( RadioButton radio_button, Graphics dc, Rectangle text_rectangle ) {
+ if ( radio_button.Focused && radio_button.appearance != Appearance.Button ) {
+ if ( radio_button.FlatStyle != FlatStyle.Flat && radio_button.FlatStyle != FlatStyle.Popup ) {
+ DrawInnerFocusRectangle( dc, text_rectangle, radio_button.BackColor );
+ }
+ }
+ }
+
+ // renders a radio button with the Flat and Popup FlatStyle
+ protected void DrawFlatStyleRadioButton (Graphics dc, Rectangle rectangle, RadioButton radio_button)
+ {
+ if (radio_button.Enabled) {
+ // draw the outer flatstyle arcs
+ if (radio_button.FlatStyle == FlatStyle.Flat) {
+ dc.DrawArc (ResPool.GetPen (radio_button.ForeColor), rectangle, 0, 359);
+
+ // fill in the area depending on whether or not the mouse is hovering
+ if (radio_button.is_entered && radio_button.Capture) {
+ dc.FillPie (ResPool.GetSolidBrush (ControlPaint.Light (radio_button.BackColor)), rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 0, 359);
+ } else {
+ dc.FillPie (ResPool.GetSolidBrush (ControlPaint.LightLight (radio_button.BackColor)), rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 0, 359);
+ }
+ } else {
+ // must be a popup radio button
+ // fill the control
+ dc.FillPie (ResPool.GetSolidBrush (ControlPaint.LightLight (radio_button.BackColor)), rectangle, 0, 359);
+
+ if (radio_button.is_entered || radio_button.Capture) {
+ // draw the popup 3d button knob
+ dc.DrawArc (ResPool.GetPen (ControlPaint.Light (radio_button.BackColor)), rectangle.X+1, rectangle.Y+1, rectangle.Width-2, rectangle.Height-2, 0, 359);
+
+ dc.DrawArc (ResPool.GetPen (ControlPaint.Dark (radio_button.BackColor)), rectangle, 135, 180);
+ dc.DrawArc (ResPool.GetPen (ControlPaint.LightLight (radio_button.BackColor)), rectangle, 315, 180);
+
+ } else {
+ // just draw lighter flatstyle outer circle
+ dc.DrawArc (ResPool.GetPen (ControlPaint.Dark (this.ColorControl)), rectangle, 0, 359);
+ }
+ }
+ } else {
+ // disabled
+ // fill control background color regardless of actual backcolor
+ dc.FillPie (ResPool.GetSolidBrush (this.ColorControl), rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 0, 359);
+ // draw the ark as control dark
+ dc.DrawArc (ResPool.GetPen (ControlPaint.Dark(this.ColorControl)), rectangle, 0, 359);
+ }
+
+ // draw the check
+ if (radio_button.Checked) {
+ SmoothingMode old_smoothing_mode = dc.SmoothingMode;
+ dc.SmoothingMode = SmoothingMode.AntiAlias;
+
+ CL_Draw_RadioButton_Dot (dc, rectangle, true, false);
+
+ dc.SmoothingMode = old_smoothing_mode;
+ }
+ }
+ #endregion // RadioButton
+
+ #region ScrollBar
+ public override void DrawScrollBar( Graphics dc, Rectangle clip, ScrollBar bar ) {
+ int scrollbutton_width = bar.scrollbutton_width;
+ int scrollbutton_height = bar.scrollbutton_height;
+ Rectangle first_arrow_area;
+ Rectangle second_arrow_area;
+ Rectangle thumb_pos;
+
+ thumb_pos = bar.ThumbPos;
+
+ if ( bar.vert ) {
+ first_arrow_area = new Rectangle( 0, 0, bar.Width, scrollbutton_height + 1 );
+ bar.FirstArrowArea = first_arrow_area;
+
+ second_arrow_area = new Rectangle( 0, bar.ClientRectangle.Height - scrollbutton_height - 1, bar.Width, scrollbutton_height + 1 );
+ bar.SecondArrowArea = second_arrow_area;
+
+ thumb_pos.Width = bar.Width;
+ bar.ThumbPos = thumb_pos;
+
+ /* Background */
+ switch ( bar.thumb_moving ) {
+ case ScrollBar.ThumbMoving.None: {
+ ScrollBar_Vertical_Draw_ThumbMoving_None( scrollbutton_height, bar, clip, dc );
+ break;
+ }
+ case ScrollBar.ThumbMoving.Forward: {
+ ScrollBar_Vertical_Draw_ThumbMoving_Forward( scrollbutton_height, bar, thumb_pos, clip, dc );
+ break;
+ }
+
+ case ScrollBar.ThumbMoving.Backwards: {
+ ScrollBar_Vertical_Draw_ThumbMoving_Backwards( scrollbutton_height, bar, thumb_pos, clip, dc );
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ /* Buttons */
+ if ( clip.IntersectsWith( first_arrow_area ) )
+ CPDrawScrollButton( dc, first_arrow_area, ScrollButton.Up, bar.firstbutton_state );
+ if ( clip.IntersectsWith( second_arrow_area ) )
+ CPDrawScrollButton( dc, second_arrow_area, ScrollButton.Down, bar.secondbutton_state );
+ } else {
+ first_arrow_area = new Rectangle( 0, 0, scrollbutton_width + 1, bar.Height );
+ bar.FirstArrowArea = first_arrow_area;
+
+ second_arrow_area = new Rectangle( bar.ClientRectangle.Width - scrollbutton_width - 1, 0, scrollbutton_width + 1, bar.Height );
+ bar.SecondArrowArea = second_arrow_area;
+
+ thumb_pos.Height = bar.Height;
+ bar.ThumbPos = thumb_pos;
+
+ /* Background */
+ switch ( bar.thumb_moving ) {
+ case ScrollBar.ThumbMoving.None: {
+ ScrollBar_Horizontal_Draw_ThumbMoving_None( scrollbutton_width, bar, clip, dc );
+ break;
+ }
+
+ case ScrollBar.ThumbMoving.Forward: {
+ ScrollBar_Horizontal_Draw_ThumbMoving_Forward( scrollbutton_width, thumb_pos, bar, clip, dc );
+ break;
+ }
+
+ case ScrollBar.ThumbMoving.Backwards: {
+ ScrollBar_Horizontal_Draw_ThumbMoving_Backwards( scrollbutton_width, thumb_pos, bar, clip, dc );
+ break;
+ }
+ }
+
+ /* Buttons */
+ if ( clip.IntersectsWith( first_arrow_area ) )
+ CPDrawScrollButton( dc, first_arrow_area, ScrollButton.Left, bar.firstbutton_state );
+ if ( clip.IntersectsWith( second_arrow_area ) )
+ CPDrawScrollButton( dc, second_arrow_area, ScrollButton.Right, bar.secondbutton_state );
+ }
+
+ /* Thumb */
+ ScrollBar_DrawThumb( bar, thumb_pos, clip, dc );
+ }
+
+ protected override void ScrollBar_DrawThumb( ScrollBar bar, Rectangle thumb_pos, Rectangle clip, Graphics dc ) {
+ if ( bar.Enabled && thumb_pos.Width > 0 && thumb_pos.Height > 0 && clip.IntersectsWith( thumb_pos ) )
+ DrawScrollBarThumb( dc, thumb_pos, bar );
+ }
+
+ protected override void ScrollBar_Vertical_Draw_ThumbMoving_None( int scrollbutton_height, ScrollBar bar, Rectangle clip, Graphics dc ) {
+ Rectangle r = new Rectangle( 0,
+ scrollbutton_height, bar.ClientRectangle.Width, bar.ClientRectangle.Height - ( scrollbutton_height * 2 ) );
+ Rectangle intersect = Rectangle.Intersect( clip, r );
+
+ if ( intersect != Rectangle.Empty ) {
+ dc.FillRectangle( ResPool.GetSolidBrush( scrollbar_background_color ), intersect );
+ Pen pen = ResPool.GetPen( scrollbar_border_color );
+ dc.DrawLine( pen, intersect.X, intersect.Y, intersect.X, intersect.Bottom - 1 );
+ dc.DrawLine( pen, intersect.Right - 1, intersect.Y, intersect.Right - 1, intersect.Bottom - 1 );
+ }
+ }
+
+ protected override void ScrollBar_Vertical_Draw_ThumbMoving_Forward( int scrollbutton_height, ScrollBar bar, Rectangle thumb_pos, Rectangle clip, Graphics dc ) {
+ Rectangle r = new Rectangle( 0, scrollbutton_height,
+ bar.ClientRectangle.Width, thumb_pos.Y - scrollbutton_height );
+ Rectangle intersect = Rectangle.Intersect( clip, r );
+
+ if ( intersect != Rectangle.Empty ) {
+ dc.FillRectangle( ResPool.GetSolidBrush( scrollbar_background_color ), intersect );
+ Pen pen = ResPool.GetPen( scrollbar_border_color );
+ dc.DrawLine( pen, intersect.X, intersect.Y, intersect.X, intersect.Bottom - 1 );
+ dc.DrawLine( pen, intersect.Right - 1, intersect.Y, intersect.Right - 1, intersect.Bottom - 1 );
+ }
+
+ r.X = 0;
+ r.Y = thumb_pos.Y + thumb_pos.Height;
+ r.Width = bar.ClientRectangle.Width;
+ r.Height = bar.ClientRectangle.Height - ( thumb_pos.Y + thumb_pos.Height ) - scrollbutton_height;
+
+ intersect = Rectangle.Intersect( clip, r );
+ if ( intersect != Rectangle.Empty ) {
+ dc.FillRectangle( ResPool.GetSolidBrush( scrollbar_background_color ), intersect );
+ Pen pen = ResPool.GetPen( scrollbar_border_color );
+ dc.DrawLine( pen, intersect.X, intersect.Y, intersect.X, intersect.Bottom - 1 );
+ dc.DrawLine( pen, intersect.Right - 1, intersect.Y, intersect.Right - 1, intersect.Bottom - 1 );
+ }
+ }
+
+ protected override void ScrollBar_Vertical_Draw_ThumbMoving_Backwards( int scrollbutton_height, ScrollBar bar, Rectangle thumb_pos, Rectangle clip, Graphics dc ) {
+ Rectangle r = new Rectangle( 0, scrollbutton_height,
+ bar.ClientRectangle.Width, thumb_pos.Y - scrollbutton_height );
+ Rectangle intersect = Rectangle.Intersect( clip, r );
+
+ if ( intersect != Rectangle.Empty ) {
+ dc.FillRectangle( ResPool.GetSolidBrush( scrollbar_background_color ), intersect );
+ Pen pen = ResPool.GetPen( scrollbar_border_color );
+ dc.DrawLine( pen, intersect.X, intersect.Y, intersect.X, intersect.Bottom - 1 );
+ dc.DrawLine( pen, intersect.Right - 1, intersect.Y, intersect.Right - 1, intersect.Bottom - 1 );
+ }
+
+ r.X = 0;
+ r.Y = thumb_pos.Y + thumb_pos.Height;
+ r.Width = bar.ClientRectangle.Width;
+ r.Height = bar.ClientRectangle.Height - ( thumb_pos.Y + thumb_pos.Height ) - scrollbutton_height;
+
+ intersect = Rectangle.Intersect( clip, r );
+ if ( intersect != Rectangle.Empty ) {
+ dc.FillRectangle( ResPool.GetSolidBrush( scrollbar_background_color ), intersect );
+ Pen pen = ResPool.GetPen( scrollbar_border_color );
+ dc.DrawLine( pen, intersect.X, intersect.Y, intersect.X, intersect.Bottom - 1 );
+ dc.DrawLine( pen, intersect.Right - 1, intersect.Y, intersect.Right - 1, intersect.Bottom - 1 );
+ }
+ }
+
+ protected override void ScrollBar_Horizontal_Draw_ThumbMoving_None( int scrollbutton_width, ScrollBar bar, Rectangle clip, Graphics dc ) {
+ Rectangle r = new Rectangle( scrollbutton_width,
+ 0, bar.ClientRectangle.Width - ( scrollbutton_width * 2 ), bar.ClientRectangle.Height );
+ Rectangle intersect = Rectangle.Intersect( clip, r );
+
+ if ( intersect != Rectangle.Empty ) {
+ dc.FillRectangle( ResPool.GetSolidBrush( scrollbar_background_color ), intersect );
+ Pen pen = ResPool.GetPen( scrollbar_border_color );
+ dc.DrawLine( pen, intersect.X, intersect.Y, intersect.Right - 1, intersect.Y );
+ dc.DrawLine( pen, intersect.X, intersect.Bottom - 1, intersect.Right - 1, intersect.Bottom - 1 );
+ }
+ }
+
+ protected override void ScrollBar_Horizontal_Draw_ThumbMoving_Forward( int scrollbutton_width, Rectangle thumb_pos, ScrollBar bar, Rectangle clip, Graphics dc ) {
+ Rectangle r = new Rectangle( scrollbutton_width, 0,
+ thumb_pos.X - scrollbutton_width, bar.ClientRectangle.Height );
+ Rectangle intersect = Rectangle.Intersect( clip, r );
+
+ if ( intersect != Rectangle.Empty ) {
+ dc.FillRectangle( ResPool.GetSolidBrush( scrollbar_background_color ), intersect );
+ Pen pen = ResPool.GetPen( scrollbar_border_color );
+ dc.DrawLine( pen, intersect.X, intersect.Y, intersect.Right - 1, intersect.Y );
+ dc.DrawLine( pen, intersect.X, intersect.Bottom - 1, intersect.Right - 1, intersect.Bottom - 1 );
+ }
+
+ r.X = thumb_pos.X + thumb_pos.Width;
+ r.Y = 0;
+ r.Width = bar.ClientRectangle.Width - ( thumb_pos.X + thumb_pos.Width ) - scrollbutton_width;
+ r.Height = bar.ClientRectangle.Height;
+
+ intersect = Rectangle.Intersect( clip, r );
+ if ( intersect != Rectangle.Empty ) {
+ dc.FillRectangle( ResPool.GetSolidBrush( scrollbar_background_color ), intersect );
+ Pen pen = ResPool.GetPen( scrollbar_border_color );
+ dc.DrawLine( pen, intersect.X, intersect.Y, intersect.Right - 1, intersect.Y );
+ dc.DrawLine( pen, intersect.X, intersect.Bottom - 1, intersect.Right - 1, intersect.Bottom - 1 );
+ }
+ }
+
+ protected override void ScrollBar_Horizontal_Draw_ThumbMoving_Backwards( int scrollbutton_width, Rectangle thumb_pos, ScrollBar bar, Rectangle clip, Graphics dc ) {
+ Rectangle r = new Rectangle( scrollbutton_width, 0,
+ thumb_pos.X - scrollbutton_width, bar.ClientRectangle.Height );
+ Rectangle intersect = Rectangle.Intersect( clip, r );
+
+ if ( intersect != Rectangle.Empty ) {
+ dc.FillRectangle( ResPool.GetSolidBrush( scrollbar_background_color ), intersect );
+ Pen pen = ResPool.GetPen( scrollbar_border_color );
+ dc.DrawLine( pen, intersect.X, intersect.Y, intersect.Right - 1, intersect.Y );
+ dc.DrawLine( pen, intersect.X, intersect.Bottom - 1, intersect.Right - 1, intersect.Bottom - 1 );
+ }
+
+ r.X = thumb_pos.X + thumb_pos.Width;
+ r.Y = 0;
+ r.Width = bar.ClientRectangle.Width - ( thumb_pos.X + thumb_pos.Width ) - scrollbutton_width;
+ r.Height = bar.ClientRectangle.Height;
+
+ intersect = Rectangle.Intersect( clip, r );
+ if ( intersect != Rectangle.Empty ) {
+ dc.FillRectangle( ResPool.GetSolidBrush( scrollbar_background_color ), intersect );
+ Pen pen = ResPool.GetPen( scrollbar_border_color );
+ dc.DrawLine( pen, intersect.X, intersect.Y, intersect.Right - 1, intersect.Y );
+ dc.DrawLine( pen, intersect.X, intersect.Bottom - 1, intersect.Right - 1, intersect.Bottom - 1 );
+ }
+ }
+ #endregion // ScrollBar
+
+ #region StatusBar
+ protected override void DrawStatusBarPanel( Graphics dc, Rectangle area, int index,
+ SolidBrush br_forecolor, StatusBarPanel panel ) {
+ int border_size = 3; // this is actually const, even if the border style is none
+
+ area.Height -= border_size;
+ if ( panel.BorderStyle != StatusBarPanelBorderStyle.None ) {
+ dc.DrawRectangle( ResPool.GetPen( pressed_inner_border_dark_color ), area );
+ }
+
+ if ( panel.Style == StatusBarPanelStyle.OwnerDraw ) {
+ StatusBarDrawItemEventArgs e = new StatusBarDrawItemEventArgs(
+ dc, panel.Parent.Font, area, index, DrawItemState.Default,
+ panel, panel.Parent.ForeColor, panel.Parent.BackColor );
+ panel.Parent.OnDrawItemInternal( e );
+ return;
+ }
+
+ int left = area.Left;
+ if ( panel.Icon != null ) {
+ left += 2;
+ dc.DrawIcon( panel.Icon, left, area.Top );
+ left += panel.Icon.Width;
+ }
+
+ if ( panel.Text == String.Empty )
+ return;
+
+ string text = panel.Text;
+ StringFormat string_format = new StringFormat( );
+ string_format.Trimming = StringTrimming.Character;
+ string_format.FormatFlags = StringFormatFlags.NoWrap;
+
+ if ( text[ 0 ] == '\t' ) {
+ string_format.Alignment = StringAlignment.Center;
+ text = text.Substring( 1 );
+ if ( text[ 0 ] == '\t' ) {
+ string_format.Alignment = StringAlignment.Far;
+ text = text.Substring( 1 );
+ }
+ }
+
+ int x = left + border_size;
+ int y = border_size + 2;
+ Rectangle r = new Rectangle( x, y,
+ area.Right - x - border_size,
+ area.Bottom - y - border_size );
+
+ dc.DrawString( text, panel.Parent.Font, br_forecolor, r, string_format );
+ }
+ #endregion // StatusBar
+
+ // FIXME: regions near the borders don't get filled with the correct backcolor
+ // TODO: TabAlignment.Left and TabAlignment.Bottom
+ public override void DrawTabControl( Graphics dc, Rectangle area, TabControl tab ) {
+ if (tab.Parent != null)
+ dc.FillRectangle( ResPool.GetSolidBrush( tab.Parent.BackColor ), area );
+ else
+ dc.FillRectangle( ResPool.GetSolidBrush( tab.BackColor ), area );
+ Rectangle panel_rect = GetTabPanelRectExt( tab );
+
+ if ( tab.Appearance == TabAppearance.Normal ) {
+
+ switch ( tab.Alignment ) {
+ case TabAlignment.Top:
+ // inner border...
+ Pen pen = ResPool.GetPen( Color.White );
+
+ dc.DrawLine( pen, panel_rect.Left + 1, panel_rect.Top, panel_rect.Left + 1, panel_rect.Bottom - 1 );
+ dc.DrawLine( pen, panel_rect.Left + 2, panel_rect.Top , panel_rect.Right - 2, panel_rect.Top );
+
+ pen = ResPool.GetPen( tab_inner_border_color );
+ dc.DrawLine( pen, panel_rect.Right - 2, panel_rect.Top + 1, panel_rect.Right - 2, panel_rect.Bottom - 2 );
+ dc.DrawLine( pen, panel_rect.Right - 2, panel_rect.Bottom - 1, panel_rect.Left + 2, panel_rect.Bottom - 1 );
+
+ // border
+ pen = ResPool.GetPen( tab_border_color );
+
+ dc.DrawLine( pen, panel_rect.Left, panel_rect.Top - 1, panel_rect.Right - 1, panel_rect.Top - 1 );
+ dc.DrawLine( pen, panel_rect.Right - 1, panel_rect.Top - 1, panel_rect.Right - 1, panel_rect.Bottom - 2 );
+ dc.DrawLine( pen, panel_rect.Right - 1, panel_rect.Bottom - 2, panel_rect.Right - 3, panel_rect.Bottom );
+ dc.DrawLine( pen, panel_rect.Right - 3, panel_rect.Bottom, panel_rect.Left + 2, panel_rect.Bottom );
+ dc.DrawLine( pen, panel_rect.Left + 2, panel_rect.Bottom, panel_rect.Left, panel_rect.Bottom - 2 );
+ dc.DrawLine( pen, panel_rect.Left, panel_rect.Bottom - 2, panel_rect.Left, panel_rect.Top - 1 );
+ break;
+
+ // FIXME: the size of the tab page is to big to draw the upper inner white border
+ case TabAlignment.Right:
+ // inner border...
+ pen = ResPool.GetPen( Color.White );
+
+ dc.DrawLine( pen, panel_rect.Left + 1, panel_rect.Top + 1, panel_rect.Left + 1, panel_rect.Bottom - 1 );
+ dc.DrawLine( pen, panel_rect.Left + 2, panel_rect.Top + 1 , panel_rect.Right - 2, panel_rect.Top + 1 );
+
+ pen = ResPool.GetPen( tab_inner_border_color );
+ dc.DrawLine( pen, panel_rect.Right - 2, panel_rect.Top + 1, panel_rect.Right - 2, panel_rect.Bottom - 2 );
+ dc.DrawLine( pen, panel_rect.Right - 2, panel_rect.Bottom - 1, panel_rect.Left + 2, panel_rect.Bottom - 1 );
+
+ // border
+ pen = ResPool.GetPen( tab_border_color );
+
+ dc.DrawLine( pen, panel_rect.Left + 2, panel_rect.Top, panel_rect.Right - 1, panel_rect.Top );
+ dc.DrawLine( pen, panel_rect.Right - 1, panel_rect.Top, panel_rect.Right - 1, panel_rect.Bottom );
+ dc.DrawLine( pen, panel_rect.Right - 1, panel_rect.Bottom, panel_rect.Left + 2, panel_rect.Bottom );
+ dc.DrawLine( pen, panel_rect.Left + 2, panel_rect.Bottom, panel_rect.Left, panel_rect.Bottom - 2 );
+ dc.DrawLine( pen, panel_rect.Left, panel_rect.Bottom - 2, panel_rect.Left, panel_rect.Top + 2 );
+ dc.DrawLine( pen, panel_rect.Left, panel_rect.Top + 2, panel_rect.Left + 2, panel_rect.Top );
+ break;
+ }
+ }
+
+ if (tab.Alignment == TabAlignment.Top) {
+ for (int r = tab.TabPages.Count; r > 0; r--) {
+ for (int i = tab.SliderPos; i < tab.TabPages.Count; i++) {
+ if (i == tab.SelectedIndex)
+ continue;
+ if (r != tab.TabPages [i].Row)
+ continue;
+ Rectangle rect = tab.GetTabRect (i);
+ if (!rect.IntersectsWith (area))
+ continue;
+ DrawTab (dc, tab.TabPages [i], tab, rect, false);
+ }
+ }
+ } else {
+ for (int r = 0; r < tab.TabPages.Count; r++) {
+ for (int i = tab.SliderPos; i < tab.TabPages.Count; i++) {
+ if (i == tab.SelectedIndex)
+ continue;
+ if (r != tab.TabPages [i].Row)
+ continue;
+ Rectangle rect = tab.GetTabRect (i);
+ if (!rect.IntersectsWith (area))
+ continue;
+ DrawTab (dc, tab.TabPages [i], tab, rect, false);
+ }
+ }
+ }
+
+ if (tab.SelectedIndex != -1 && tab.SelectedIndex >= tab.SliderPos) {
+ Rectangle rect = tab.GetTabRect (tab.SelectedIndex);
+ if (rect.IntersectsWith (area))
+ DrawTab (dc, tab.TabPages [tab.SelectedIndex], tab, rect, true);
+ }
+
+ if (tab.ShowSlider) {
+ Rectangle right = GetTabControlRightScrollRect (tab);
+ Rectangle left = GetTabControlLeftScrollRect (tab);
+ CPDrawScrollButton (dc, right, ScrollButton.Right, tab.RightSliderState);
+ CPDrawScrollButton (dc, left, ScrollButton.Left, tab.LeftSliderState);
+ }
+ }
+
+ protected override int DrawTab (Graphics dc, TabPage page, TabControl tab, Rectangle bounds, bool is_selected)
+ {
+ int FlatButtonSpacing = 8;
+ Rectangle interior;
+ int res = bounds.Width;
+
+ if (page.BackColor != tab_selected_gradient_second_color)
+ page.BackColor = tab_selected_gradient_second_color;
+
+ // we can't fill the background right away because the bounds might be adjusted if the tab is selected
+
+ StringFormat string_format = new StringFormat ();
+
+ if (tab.Appearance == TabAppearance.Buttons || tab.Appearance == TabAppearance.FlatButtons) {
+ dc.FillRectangle (ResPool.GetSolidBrush (tab_selected_gradient_second_color), bounds);
+
+ // Separators
+ if (tab.Appearance == TabAppearance.FlatButtons) {
+ int width = bounds.Width;
+ bounds.Width += (FlatButtonSpacing - 2);
+ res = bounds.Width;
+ CPDrawBorder3D (dc, bounds, Border3DStyle.Etched, Border3DSide.Right);
+ bounds.Width = width;
+ }
+
+ if (is_selected) {
+ CPDrawBorder3D (dc, bounds, Border3DStyle.Sunken, Border3DSide.All);
+ } else if (tab.Appearance != TabAppearance.FlatButtons) {
+ CPDrawBorder3D (dc, bounds, Border3DStyle.Raised, Border3DSide.All);
+ }
+
+ interior = new Rectangle (bounds.Left + 2, bounds.Top + 2, bounds.Width - 4, bounds.Height - 4);
+
+ string_format.Alignment = StringAlignment.Center;
+ string_format.LineAlignment = StringAlignment.Center;
+ string_format.FormatFlags = StringFormatFlags.NoWrap;
+ } else {
+ Color tab_first_color = is_selected ? tab_selected_gradient_first_color : tab_not_selected_gradient_first_color;
+ Color tab_second_color = is_selected ? tab_selected_gradient_second_color : tab_not_selected_gradient_second_color;
+
+ switch (tab.Alignment) {
+ case TabAlignment.Top:
+
+ Rectangle tab_interior = new Rectangle (bounds.Left + 2, bounds.Top + 2, bounds.Width - 2, bounds.Height - 3);
+
+ using (LinearGradientBrush lgbr = new LinearGradientBrush (new Point (bounds.Left + 2, bounds.Top + 2), new Point (bounds.Left + 2, bounds.Bottom), tab_first_color, tab_second_color)) {
+ dc.FillRectangle (lgbr, tab_interior);
+ }
+
+ // edges
+ Pen tmp_pen = ResPool.GetPen (tab_edge_color);
+ dc.DrawLine (tmp_pen, bounds.Left, bounds.Top + 1, bounds.Left + 1, bounds.Top);
+ dc.DrawLine (tmp_pen, bounds.Right - 1, bounds.Top, bounds.Right, bounds.Top + 1);
+
+ // inner border
+ tmp_pen = ResPool.GetPen (Color.White);
+ dc.DrawLine (tmp_pen, bounds.Left + 1, bounds.Bottom - 2, bounds.Left + 1, bounds.Top + 1);
+ dc.DrawLine (tmp_pen, bounds.Left + 2, bounds.Top + 1, bounds.Right - 1, bounds.Top + 1);
+
+ // border
+ tmp_pen = ResPool.GetPen (border_pressed_dark_color);
+ dc.DrawLine (tmp_pen, bounds.Left, bounds.Top + 2, bounds.Left + 2, bounds.Top);
+ dc.DrawLine (tmp_pen, bounds.Left + 2, bounds.Top, bounds.Right - 2, bounds.Top);
+ dc.DrawLine (tmp_pen, bounds.Right - 2, bounds.Top, bounds.Right, bounds.Top + 2);
+
+ using (LinearGradientBrush lgbr = new LinearGradientBrush (new Point (bounds.Left, bounds.Top + 2), new Point (bounds.Left, bounds.Bottom - 1), border_pressed_dark_color, border_pressed_light_color)) {
+ int diff = is_selected ? 4 : 3;
+ dc.FillRectangle (lgbr, bounds.Left, bounds.Top + 2, 1, bounds.Height - diff);
+ dc.FillRectangle (lgbr, bounds.Right, bounds.Top + 2, 1, bounds.Height - diff);
+ }
+
+ if (page.Focused) {
+ tmp_pen = ResPool.GetPen (tab_focus_color);
+ dc.DrawLine (tmp_pen, bounds.Left + 1, bounds.Top + 2, bounds.Right - 1, bounds.Top + 2);
+ dc.DrawLine (tmp_pen, bounds.Left + 2, bounds.Top + 1, bounds.Right - 2, bounds.Top + 1);
+
+ tmp_pen = ResPool.GetPen (tab_top_border_focus_color);
+ dc.DrawLine (tmp_pen, bounds.Left, bounds.Top + 2, bounds.Left + 2, bounds.Top);
+ dc.DrawLine (tmp_pen, bounds.Left + 2, bounds.Top, bounds.Right - 2, bounds.Top);
+ dc.DrawLine (tmp_pen, bounds.Right - 2, bounds.Top, bounds.Right, bounds.Top + 2);
+ }
+
+ interior = new Rectangle (bounds.Left + 4, bounds.Top + 4, bounds.Width - 8, bounds.Height - 8);
+
+ string_format.Alignment = StringAlignment.Center;
+ string_format.LineAlignment = StringAlignment.Center;
+ string_format.FormatFlags = StringFormatFlags.NoWrap;
+
+ break;
+
+ case TabAlignment.Bottom:
+
+ tab_interior = new Rectangle (bounds.Left + 2, bounds.Top + 2, bounds.Width - 2, bounds.Height - 3);
+
+ using (LinearGradientBrush lgbr = new LinearGradientBrush (new Point (bounds.Left + 2, bounds.Top + 2), new Point (bounds.Left + 2, bounds.Bottom - 1), tab_first_color, tab_second_color)) {
+ dc.FillRectangle (lgbr, tab_interior);
+ }
+
+ // edges
+ tmp_pen = ResPool.GetPen (tab_edge_color);
+ dc.DrawLine (tmp_pen, bounds.Left, bounds.Bottom - 1, bounds.Left + 1, bounds.Bottom);
+ dc.DrawLine (tmp_pen, bounds.Right - 1, bounds.Bottom, bounds.Right, bounds.Bottom - 1);
+
+ // inner border
+ tmp_pen = ResPool.GetPen (Color.White);
+ dc.DrawLine (tmp_pen, bounds.Left + 1, bounds.Bottom - 2, bounds.Left + 1, bounds.Top + 2);
+ dc.DrawLine (tmp_pen, bounds.Left + 2, bounds.Bottom - 1, bounds.Right - 1, bounds.Bottom - 1);
+
+ // border
+ tmp_pen = ResPool.GetPen (border_pressed_dark_color);
+ dc.DrawLine (tmp_pen, bounds.Left, bounds.Bottom - 2, bounds.Left + 2, bounds.Bottom);
+ dc.DrawLine (tmp_pen, bounds.Left + 2, bounds.Bottom, bounds.Right - 2, bounds.Bottom);
+ dc.DrawLine (tmp_pen, bounds.Right - 2, bounds.Bottom, bounds.Right, bounds.Bottom - 2);
+
+ using (LinearGradientBrush lgbr = new LinearGradientBrush (new Point (bounds.Left, bounds.Top + 2), new Point (bounds.Left, bounds.Bottom - 1), border_pressed_light_color, border_pressed_dark_color)) {
+ int diff = is_selected ? 4 : 3;
+ dc.FillRectangle (lgbr, bounds.Left, bounds.Top + 2, 1, bounds.Height - diff);
+ dc.FillRectangle (lgbr, bounds.Right, bounds.Top + 2, 1, bounds.Height - diff);
+ }
+
+ if (page.Focused) {
+ tmp_pen = ResPool.GetPen (tab_focus_color);
+ dc.DrawLine (tmp_pen, bounds.Left + 1, bounds.Bottom - 2, bounds.Right - 1, bounds.Bottom - 2);
+ dc.DrawLine (tmp_pen, bounds.Left + 2, bounds.Bottom - 1, bounds.Right - 2, bounds.Bottom - 1);
+
+ tmp_pen = ResPool.GetPen (tab_top_border_focus_color);
+ dc.DrawLine (tmp_pen, bounds.Left, bounds.Bottom - 2, bounds.Left + 2, bounds.Bottom);
+ dc.DrawLine (tmp_pen, bounds.Left + 2, bounds.Bottom, bounds.Right - 2, bounds.Bottom);
+ dc.DrawLine (tmp_pen, bounds.Right - 2, bounds.Bottom, bounds.Right, bounds.Bottom - 2);
+ }
+
+ interior = new Rectangle (bounds.Left + 4, bounds.Top + 4, bounds.Width - 8, bounds.Height - 8);
+
+ string_format.Alignment = StringAlignment.Center;
+ string_format.LineAlignment = StringAlignment.Center;
+ string_format.FormatFlags = StringFormatFlags.NoWrap;
+
+ break;
+
+ case TabAlignment.Left:
+
+ int w_diff = is_selected ? 2 : 0;
+
+ tab_interior = new Rectangle (bounds.Left + 2, bounds.Top + 2, bounds.Width - 2 - w_diff, bounds.Height - 2);
+
+ using (LinearGradientBrush lgbr = new LinearGradientBrush (new Point (bounds.Left + 2, bounds.Top + 2), new Point (bounds.Right - w_diff, bounds.Top + 2), tab_first_color, tab_second_color)) {
+ dc.FillRectangle (lgbr, tab_interior);
+ }
+
+ // edges
+ tmp_pen = ResPool.GetPen (tab_edge_color);
+ dc.DrawLine (tmp_pen, bounds.Left + 1, bounds.Top, bounds.Left, bounds.Top + 1);
+ dc.DrawLine (tmp_pen, bounds.Left, bounds.Bottom - 1, bounds.Left + 1, bounds.Bottom);
+
+ // inner border
+ tmp_pen = ResPool.GetPen (Color.White);
+ dc.DrawLine (tmp_pen, bounds.Left + 2, bounds.Top + 1, bounds.Right - 3, bounds.Top + 1);
+ dc.DrawLine (tmp_pen, bounds.Left + 1, bounds.Top + 2, bounds.Left + 1, bounds.Bottom - 2);
+
+ // border
+ tmp_pen = ResPool.GetPen (border_pressed_dark_color);
+ dc.DrawLine (tmp_pen, bounds.Left + 2, bounds.Top, bounds.Left, bounds.Top + 2);
+ dc.DrawLine (tmp_pen, bounds.Left, bounds.Top + 2, bounds.Left, bounds.Bottom - 2);
+ dc.DrawLine (tmp_pen, bounds.Left, bounds.Bottom - 2, bounds.Left + 2, bounds.Bottom);
+
+ using (LinearGradientBrush lgbr = new LinearGradientBrush (new Point (bounds.Left, bounds.Top + 2), new Point (bounds.Right - 2, bounds.Top + 2), border_pressed_dark_color, border_pressed_light_color)) {
+ int diff = is_selected ? 4 : 2;
+
+ dc.FillRectangle (lgbr, bounds.Left + 2, bounds.Top, bounds.Width - diff, 1);
+ dc.FillRectangle (lgbr, bounds.Left + 2, bounds.Bottom, bounds.Width - diff, 1);
+ }
+
+ if (page.Focused) {
+ tmp_pen = ResPool.GetPen (tab_focus_color);
+ dc.DrawLine (tmp_pen, bounds.Left + 3, bounds.Top + 1, bounds.Left + 3, bounds.Bottom - 1);
+ dc.DrawLine (tmp_pen, bounds.Left + 2, bounds.Top + 2, bounds.Left + 2, bounds.Bottom - 2);
+
+ tmp_pen = ResPool.GetPen (tab_top_border_focus_color);
+ dc.DrawLine (tmp_pen, bounds.Left + 3, bounds.Top, bounds.Left + 1, bounds.Top + 2);
+ dc.DrawLine (tmp_pen, bounds.Left + 1, bounds.Top + 2, bounds.Left + 1, bounds.Bottom - 2);
+ dc.DrawLine (tmp_pen, bounds.Left + 1, bounds.Bottom - 2, bounds.Left + 3, bounds.Bottom);
+ }
+
+ interior = new Rectangle (bounds.Left + 2, bounds.Top + 4, bounds.Width - 8, bounds.Height - 8);
+
+ string_format.Alignment = StringAlignment.Center;
+ string_format.LineAlignment = StringAlignment.Center;
+ string_format.FormatFlags = StringFormatFlags.NoWrap;
+ string_format.FormatFlags = StringFormatFlags.DirectionVertical;
+
+ break;
+
+ default:
+ // TabAlignment.Right
+
+ tab_interior = new Rectangle (bounds.Left, bounds.Top + 2, bounds.Width - 2, bounds.Height - 2);
+
+ using (LinearGradientBrush lgbr = new LinearGradientBrush (new Point (bounds.Left, bounds.Top + 2), new Point (bounds.Right, bounds.Top + 2), tab_second_color, tab_first_color)) {
+ dc.FillRectangle (lgbr, tab_interior);
+ }
+
+ int l_diff = is_selected ? 2 : 0;
+
+ // edges
+ tmp_pen = ResPool.GetPen (tab_edge_color);
+ dc.DrawLine (tmp_pen, bounds.Right - 2, bounds.Top, bounds.Right - 1, bounds.Top + 1);
+ dc.DrawLine (tmp_pen, bounds.Right - 1, bounds.Bottom - 1, bounds.Right - 2, bounds.Bottom);
+
+ // inner border
+ tmp_pen = ResPool.GetPen (Color.White);
+ dc.DrawLine (tmp_pen, bounds.Left + l_diff, bounds.Top + 1, bounds.Right - 2, bounds.Top + 1);
+ dc.DrawLine (tmp_pen, bounds.Right - 2, bounds.Top + 2, bounds.Right - 2, bounds.Bottom - 2);
+
+ // border
+ tmp_pen = ResPool.GetPen (border_pressed_dark_color);
+ dc.DrawLine (tmp_pen, bounds.Right - 3, bounds.Top, bounds.Right - 1, bounds.Top + 2);
+ dc.DrawLine (tmp_pen, bounds.Right - 1, bounds.Top + 2, bounds.Right - 1, bounds.Bottom - 2);
+ dc.DrawLine (tmp_pen, bounds.Right - 1, bounds.Bottom - 2, bounds.Right - 3, bounds.Bottom);
+
+ using (LinearGradientBrush lgbr = new LinearGradientBrush (new Point (bounds.Left, bounds.Top + 2), new Point (bounds.Right - 2, bounds.Top + 2), border_pressed_light_color, border_pressed_dark_color)) {
+ int diff = is_selected ? 4 : 2;
+
+ dc.FillRectangle (lgbr, bounds.Left + l_diff, bounds.Top, bounds.Width - diff, 1);
+ dc.FillRectangle (lgbr, bounds.Left + l_diff, bounds.Bottom, bounds.Width - diff, 1);
+ }
+
+ if (page.Focused) {
+ tmp_pen = ResPool.GetPen (tab_focus_color);
+ dc.DrawLine (tmp_pen, bounds.Right - 3, bounds.Top + 1, bounds.Right - 3, bounds.Bottom - 1);
+ dc.DrawLine (tmp_pen, bounds.Right - 2, bounds.Top + 2, bounds.Right - 2, bounds.Bottom - 2);
+
+ tmp_pen = ResPool.GetPen (tab_top_border_focus_color);
+ dc.DrawLine (tmp_pen, bounds.Right - 3, bounds.Top, bounds.Right - 1, bounds.Top + 2);
+ dc.DrawLine (tmp_pen, bounds.Right - 1, bounds.Top + 2, bounds.Right - 1, bounds.Bottom - 2);
+ dc.DrawLine (tmp_pen, bounds.Right - 1, bounds.Bottom - 2, bounds.Right - 3, bounds.Bottom);
+ }
+
+ interior = new Rectangle (bounds.Left + 4, bounds.Top + 4, bounds.Width - 8, bounds.Height - 8);
+
+ string_format.Alignment = StringAlignment.Center;
+ string_format.LineAlignment = StringAlignment.Center;
+ string_format.FormatFlags = StringFormatFlags.NoWrap;
+ string_format.FormatFlags = StringFormatFlags.DirectionVertical;
+
+ break;
+ }
+ }
+
+ if (tab.DrawMode == TabDrawMode.Normal && page.Text != null) {
+ if (tab.Alignment == TabAlignment.Left) {
+ int wo = interior.Width / 2;
+ int ho = interior.Height / 2;
+ dc.TranslateTransform (interior.X + wo, interior.Y + ho);
+ dc.RotateTransform (180);
+ dc.DrawString (page.Text, page.Font, ThemeEngine.Current.ResPool.GetSolidBrush (SystemColors.ControlText), 0, 0, string_format);
+ dc.ResetTransform ();
+ } else {
+ dc.DrawString (page.Text, page.Font,
+ ThemeEngine.Current.ResPool.GetSolidBrush (SystemColors.ControlText),
+ interior, string_format);
+ }
+ } else if (page.Text != null) {
+ DrawItemState state = DrawItemState.None;
+ if (page == tab.SelectedTab)
+ state |= DrawItemState.Selected;
+ DrawItemEventArgs e = new DrawItemEventArgs (dc,
+ tab.Font, bounds, tab.IndexForTabPage (page),
+ state, page.ForeColor, page.BackColor);
+ tab.OnDrawItemInternal (e);
+ return res;
+ }
+
+ return res;
+ }
+
+ public override void CPDrawComboButton( Graphics dc, Rectangle rectangle, ButtonState state ) {
+ Point[] arrow = new Point[ 3 ];
+ Point P1;
+ Point P2;
+ Point P3;
+ int centerX;
+ int centerY;
+ int shiftX;
+ int shiftY;
+ Rectangle rect;
+
+ bool pushed = false;
+
+ Color first_color = Color.White;
+ Color second_color = combobox_button_second_gradient_color;
+
+ dc.FillRectangle( ResPool.GetSolidBrush( Color.White ), rectangle );
+
+ if ( state == ButtonState.Pushed ) {
+ first_color = pressed_gradient_first_color;
+ second_color = pressed_gradient_second_color;
+ pushed = true;
+ }
+
+ using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( rectangle.X, rectangle.Y + 2 ), new Point( rectangle.X, rectangle.Bottom - 2 ), first_color, second_color ) ) {
+ dc.FillRectangle( lgbr, rectangle.X + 2, rectangle.Y + 2, rectangle.Width - 4, rectangle.Height - 4 );
+ }
+
+ // inner borders
+ Pen tmp_pen = ResPool.GetPen( !pushed ? Color.White : pressed_inner_border_dark_color );
+ dc.DrawLine( tmp_pen, rectangle.X + 1, rectangle.Y + 1, rectangle.Right - 2, rectangle.Y + 1 );
+ dc.DrawLine( tmp_pen, rectangle.X + 1, rectangle.Y + 1, rectangle.X + 1, rectangle.Bottom - 2 );
+
+ tmp_pen = ResPool.GetPen( !pushed ? inner_border_dark_color : pressed_inner_border_dark_color );
+ dc.DrawLine( tmp_pen, rectangle.Right - 2, rectangle.Y + 2, rectangle.Right - 2, rectangle.Bottom - 2 );
+ dc.DrawLine( tmp_pen, rectangle.X + 2, rectangle.Bottom - 2, rectangle.Right - 2, rectangle.Bottom - 2 );
+
+ // border
+ Point[] points = new Point[] {
+ new Point( rectangle.X, rectangle.Y ),
+ new Point( rectangle.Right - 3, rectangle.Y ),
+ new Point( rectangle.Right - 1, rectangle.Y + 2 ),
+ new Point( rectangle.Right - 1, rectangle.Bottom - 3 ),
+ new Point( rectangle.Right - 3, rectangle.Bottom - 1 ),
+ new Point( rectangle.X, rectangle.Bottom - 1 ),
+ new Point( rectangle.X, rectangle.Y )
+ };
+
+ dc.DrawPolygon( ResPool.GetPen( pushed ? border_pressed_dark_color : border_normal_dark_color ), points );
+
+ // edges on right side
+ tmp_pen = ResPool.GetPen( control_parent_backcolor );
+ dc.DrawLine( tmp_pen, rectangle.Right - 1, rectangle.Y, rectangle.Right - 1, rectangle.Y + 1 );
+ dc.DrawLine( tmp_pen, rectangle.Right - 1, rectangle.Bottom - 1, rectangle.Right - 1, rectangle.Bottom - 2 );
+
+ tmp_pen = ResPool.GetPen( edge_bottom_inner_color );
+ dc.DrawLine( tmp_pen, rectangle.Right - 2, rectangle.Y, rectangle.Right - 1, rectangle.Y + 1 );
+ dc.DrawLine( tmp_pen, rectangle.Right - 2, rectangle.Bottom - 1, rectangle.Right - 1, rectangle.Bottom - 2 );
+
+ rect = new Rectangle( rectangle.X + 1 + rectangle.Width / 4, rectangle.Y + rectangle.Height / 4, rectangle.Width / 2 - 1, rectangle.Height / 2 );
+ centerX = rect.Left + rect.Width / 2;
+ centerY = rect.Top + rect.Height / 2;
+ shiftX = Math.Max( 1, rect.Width / 8 );
+ shiftY = Math.Max( 1, rect.Height / 8 );
+
+ if ( ( state & ButtonState.Pushed ) != 0 ) {
+ shiftX--;
+ shiftY--;
+ }
+
+ rect.Y -= shiftY;
+ centerY -= shiftY;
+
+ P1 = new Point( rect.Left, centerY );
+ P2 = new Point( centerX, rect.Bottom );
+ P3 = new Point( rect.Right, centerY );
+
+ arrow[ 0 ] = P1;
+ arrow[ 1 ] = P2;
+ arrow[ 2 ] = P3;
+
+ SmoothingMode old_smoothing_mode = dc.SmoothingMode;
+ dc.SmoothingMode = SmoothingMode.AntiAlias;
+
+ /* Draw the arrow */
+ if ( state == ButtonState.Inactive ) {
+ /* Move away from the shadow */
+ P1.X += 1; P1.Y += 1;
+ P2.X += 1; P2.Y += 1;
+ P3.X += 1; P3.Y += 1;
+
+ arrow[ 0 ] = P1;
+ arrow[ 1 ] = P2;
+ arrow[ 2 ] = P3;
+
+ using ( Pen pen = new Pen( SystemColors.ControlLightLight, 2 ) ) {
+ dc.DrawLines( pen, arrow );
+ }
+
+ P1 = new Point( rect.Left, centerY );
+ P2 = new Point( centerX, rect.Bottom );
+ P3 = new Point( rect.Right, centerY );
+
+ arrow[ 0 ] = P1;
+ arrow[ 1 ] = P2;
+ arrow[ 2 ] = P3;
+
+ using ( Pen pen = new Pen( SystemColors.ControlDark, 2 ) ) {
+ dc.DrawLines( pen, arrow );
+ }
+ } else {
+ using ( Pen pen = new Pen( SystemColors.ControlText, 2 ) ) {
+ dc.DrawLines( pen, arrow );
+ }
+ }
+
+ dc.SmoothingMode = old_smoothing_mode;
+ }
+
+ /* Scroll button: regular button + direction arrow */
+ public override void CPDrawScrollButton( Graphics dc, Rectangle area, ScrollButton scroll_button_type, ButtonState state ) {
+ bool enabled = ( state == ButtonState.Inactive ) ? false: true;
+
+ DrawScrollButtonPrimitive( dc, area, state, scroll_button_type );
+
+ if ( area.Width < 12 || area.Height < 12 ) /* Cannot see a thing at smaller sizes */
+ return;
+
+ Color color_arrow;
+
+ if ( enabled )
+ color_arrow = arrow_color;
+ else
+ color_arrow = ColorGrayText;
+
+ /* Paint arrows */
+
+ int centerX = area.Left + area.Width / 2;
+ int centerY = area.Top + area.Height / 2;
+
+ int shift = 0;
+
+ if ( ( state & ButtonState.Pushed ) != 0 )
+ shift = 1;
+
+ Point[] arrow = new Point[ 4 ];
+
+ switch ( scroll_button_type ) {
+ case ScrollButton.Down:
+ centerY += shift + 1;
+ arrow[ 0 ] = new Point( centerX - 4, centerY - 2 );
+ arrow[ 1 ] = new Point( centerX, centerY + 2 );
+ arrow[ 2 ] = new Point( centerX + 4, centerY - 2 );
+ arrow[ 3 ] = new Point( centerX - 4, centerY - 2 );
+ break;
+ case ScrollButton.Up:
+ centerY -= shift;
+ arrow[ 0 ] = new Point( centerX - 4, centerY + 2 );
+ arrow[ 1 ] = new Point( centerX, centerY - 2 );
+ arrow[ 2 ] = new Point( centerX + 4, centerY + 2 );
+ arrow[ 3 ] = new Point( centerX - 4, centerY + 2 );
+ break;
+ case ScrollButton.Left:
+ centerX -= shift;
+ arrow[ 0 ] = new Point( centerX + 2, centerY - 4 );
+ arrow[ 1 ] = new Point( centerX + 2, centerY + 4 );
+ arrow[ 2 ] = new Point( centerX - 2, centerY );
+ arrow[ 3 ] = new Point( centerX + 2, centerY - 4 );
+ break;
+ case ScrollButton.Right:
+ centerX += shift + 1;
+ arrow[ 0 ] = new Point( centerX - 2, centerY - 4 );
+ arrow[ 1 ] = new Point( centerX + 2, centerY );
+ arrow[ 2 ] = new Point( centerX - 2, centerY + 4 );
+ arrow[ 3 ] = new Point( centerX - 2, centerY - 4 );
+ break;
+ default:
+ break;
+ }
+
+ SmoothingMode old_smoothing_mode = dc.SmoothingMode;
+ dc.SmoothingMode = SmoothingMode.AntiAlias;
+ dc.FillPolygon( ResPool.GetSolidBrush( color_arrow ), arrow );
+ dc.SmoothingMode = old_smoothing_mode;
+ }
+
+ public override void CPDrawSizeGrip( Graphics dc, Color backColor, Rectangle bounds ) {
+ Point pt1 = new Point( bounds.Right - 3, bounds.Bottom );
+ Point pt2 = new Point( bounds.Right, bounds.Bottom - 3 );
+
+ // diagonals
+ Pen tmp_pen = ResPool.GetPen( Color.White );
+ for ( int i = 0; i < 4; i++ ) {
+ dc.DrawLine( tmp_pen, pt1.X - i * 4, pt1.Y, pt2.X, pt2.Y - i * 4 );
+ }
+
+ pt1.X += 1;
+ pt2.Y += 1;
+
+ tmp_pen = ResPool.GetPen( pressed_inner_border_dark_color );
+ for ( int i = 0; i < 4; i++ ) {
+ dc.DrawLine( tmp_pen, pt1.X - i * 4, pt1.Y, pt2.X, pt2.Y - i * 4 );
+ }
+ }
+
+ private void DrawScrollBarThumb( Graphics dc, Rectangle area, ScrollBar bar ) {
+ LinearGradientBrush lgbr = null;
+
+ if ( bar.vert )
+ lgbr = new LinearGradientBrush( new Point( area.X + 2, area.Y + 2 ), new Point( area.Right - 2, area.Y + 2 ), scrollbar_gradient_first_color, scrollbar_gradient_second_color );
+ else
+ lgbr = new LinearGradientBrush( new Point( area.X + 2, area.Y + 2 ), new Point( area.X + 2, area.Bottom - 2 ), scrollbar_gradient_first_color, scrollbar_gradient_second_color );
+
+ dc.FillRectangle( lgbr, area.X + 2, area.Y + 2, area.Width - 4, area.Height - 4 );
+
+ lgbr.Dispose( );
+
+ // outer border
+ Pen pen = ResPool.GetPen( border_normal_dark_color );
+
+ dc.DrawRectangle( pen, area.X, area.Y, area.Width - 1, area.Height - 1 );
+
+ // inner border
+ pen = ResPool.GetPen( Color.White );
+ dc.DrawLine( pen, area.X + 1, area.Bottom - 2, area.X + 1, area.Y + 1 );
+ dc.DrawLine( pen, area.X + 2, area.Y + 1, area.Right - 2, area.Y + 1 );
+
+ pen = ResPool.GetPen( inner_border_dark_color );
+ dc.DrawLine( pen, area.Right - 2, area.Y + 2, area.Right - 2, area.Bottom - 2 );
+ dc.DrawLine( pen, area.X + 2, area.Bottom - 2, area.Right - 3, area.Bottom - 2 );
+
+ if ( bar.vert ) {
+ if ( area.Height > 12 ) {
+ int mid_y = area.Y + ( area.Height / 2 );
+ int mid_x = area.X + ( area.Width / 2 );
+
+ pen = ResPool.GetPen( pressed_inner_border_dark_color );
+ dc.DrawLine( pen, mid_x - 3, mid_y, mid_x + 3, mid_y );
+ dc.DrawLine( pen, mid_x - 3, mid_y - 3, mid_x + 3, mid_y - 3 );
+ dc.DrawLine( pen, mid_x - 3, mid_y + 3, mid_x + 3, mid_y + 3 );
+
+ Pen spen = ResPool.GetPen( Color.White );
+ dc.DrawLine( spen, mid_x - 3, mid_y + 1, mid_x + 3, mid_y + 1 );
+ dc.DrawLine( spen, mid_x - 3, mid_y - 2, mid_x + 3, mid_y - 2 );
+ dc.DrawLine( spen, mid_x - 3, mid_y + 4, mid_x + 3, mid_y + 4 );
+ }
+ } else {
+ // draw grip lines only if there is enough space
+ if ( area.Width > 12 ) {
+ int mid_x = area.X + ( area.Width / 2 );
+ int mid_y = area.Y + ( area.Height / 2 );
+
+ pen = ResPool.GetPen( pressed_inner_border_dark_color );
+ dc.DrawLine( pen, mid_x, mid_y - 3, mid_x, mid_y + 3 );
+ dc.DrawLine( pen, mid_x - 3, mid_y - 3, mid_x - 3, mid_y + 3 );
+ dc.DrawLine( pen, mid_x + 3, mid_y - 3, mid_x + 3, mid_y + 3 );
+
+ Pen spen = ResPool.GetPen( Color.White );
+ dc.DrawLine( spen, mid_x + 1, mid_y - 3, mid_x + 1, mid_y + 3 );
+ dc.DrawLine( spen, mid_x - 2, mid_y - 3, mid_x - 2, mid_y + 3 );
+ dc.DrawLine( spen, mid_x + 4, mid_y - 3, mid_x + 4, mid_y + 3 );
+ }
+ }
+ }
+
+ public void DrawScrollButtonPrimitive( Graphics dc, Rectangle area, ButtonState state, ScrollButton scroll_button_type ) {
+ Pen pen = ResPool.GetPen( border_normal_dark_color );
+
+ Color first_gradient_color = gradient_first_color;
+ Color second_gradient_color = gradient_second_color_nr2;
+
+ bool pushed = false;
+
+ if ( ( state & ButtonState.Pushed ) == ButtonState.Pushed ) {
+ first_gradient_color = pressed_gradient_first_color;
+ second_gradient_color = pressed_gradient_second_color;
+ pushed = true;
+ }
+
+ Point[] points = null;
+
+ LinearGradientBrush lgbr = null;
+
+ switch ( scroll_button_type ) {
+ case ScrollButton.Left:
+ // FIXME: temporary fix for artefacts, it should use the backcolor of the parent control
+ dc.DrawLine( ResPool.GetPen( ColorControl ), area.X, area.Y, area.X, area.Bottom - 1 );
+
+ lgbr = new LinearGradientBrush( new Point( area.X + 2, area.Y + 2 ), new Point( area.X + 2, area.Bottom - 2 ), first_gradient_color, second_gradient_color );
+ dc.FillRectangle( lgbr, area.X + 2, area.Y + 2, area.Width - 4, area.Height - 2 );
+
+ Pen tmp_pen = ResPool.GetPen( pushed ? pressed_inner_border_dark_color : Color.White );
+ dc.DrawLine( tmp_pen, area.X + 1, area.Y + 2, area.X + 1, area.Bottom - 2 );
+ dc.DrawLine( tmp_pen, area.X + 2, area.Y + 1, area.Right - 2, area.Y + 1 );
+
+ tmp_pen = ResPool.GetPen( pushed ? pressed_inner_border_dark_color : inner_border_dark_color );
+ dc.DrawLine( tmp_pen, area.Right - 2, area.Y + 2, area.Right - 2, area.Bottom - 2 );
+ dc.DrawLine( tmp_pen, area.X + 2, area.Bottom - 2, area.Right - 3, area.Bottom - 2 );
+
+ tmp_pen = ResPool.GetPen( edge_top_inner_color );
+ dc.DrawLine( tmp_pen, area.X, area.Y + 1, area.X + 1, area.Y );
+ dc.DrawLine( tmp_pen, area.X, area.Bottom - 2, area.X + 1, area.Bottom - 1 );
+
+ points = new Point[] {
+ new Point( area.X + 2, area.Y ),
+ new Point( area.Right - 1, area.Y ),
+ new Point( area.Right - 1, area.Bottom - 1 ),
+ new Point( area.X + 2, area.Bottom - 1 ),
+ new Point( area.X, area.Bottom - 3 ),
+ new Point( area.X, area.Y + 2 ),
+ new Point( area.X + 2, area.Y )
+ };
+ dc.DrawPolygon( pen, points );
+ break;
+ case ScrollButton.Right:
+ // FIXME: temporary fix for artefacts, it should use the backcolor of the parent control
+ dc.DrawLine( ResPool.GetPen( ColorControl ), area.Right - 1, area.Y, area.Right - 1, area.Bottom - 1 );
+
+ lgbr = new LinearGradientBrush( new Point( area.X + 2, area.Y + 2 ), new Point( area.X + 2, area.Bottom - 2 ), first_gradient_color, second_gradient_color );
+ dc.FillRectangle( lgbr, area.X + 2, area.Y + 2, area.Width - 4, area.Height - 2 );
+
+ tmp_pen = ResPool.GetPen( pushed ? pressed_inner_border_dark_color : Color.White );
+ dc.DrawLine( tmp_pen, area.X + 1, area.Y + 1, area.X + 1, area.Bottom - 2 );
+ dc.DrawLine( tmp_pen, area.X + 2, area.Y + 1, area.Right - 2, area.Y + 1 );
+
+ tmp_pen = ResPool.GetPen( pushed ? pressed_inner_border_dark_color : inner_border_dark_color );
+ dc.DrawLine( tmp_pen, area.Right - 2, area.Y + 2, area.Right - 2, area.Bottom - 2 );
+ dc.DrawLine( tmp_pen, area.X + 2, area.Bottom - 2, area.Right - 3, area.Bottom - 2 );
+
+ tmp_pen = ResPool.GetPen( edge_top_inner_color );
+ dc.DrawLine( tmp_pen, area.Right - 2, area.Y, area.Right - 1, area.Y + 1 );
+ dc.DrawLine( tmp_pen, area.Right - 1, area.Bottom - 2, area.Right - 2, area.Bottom - 1 );
+
+ points = new Point[] {
+ new Point( area.X, area.Y ),
+ new Point( area.Right - 3, area.Y ),
+ new Point( area.Right - 1, area.Y + 2 ),
+ new Point( area.Right - 1, area.Bottom - 3 ),
+ new Point( area.Right - 3, area.Bottom - 1 ),
+ new Point( area.X, area.Bottom - 1 ),
+ new Point( area.X, area.Y ),
+ };
+ dc.DrawPolygon( pen, points );
+ break;
+ case ScrollButton.Up:
+ // FIXME: temporary fix for artefacts, it should use the backcolor of the parent control
+ dc.DrawLine( ResPool.GetPen( ColorControl ), area.X, area.Y, area.Right - 1, area.Y );
+
+ lgbr = new LinearGradientBrush( new Point( area.X + 2, area.Y ), new Point( area.Right - 2, area.Y ), first_gradient_color, second_gradient_color );
+ dc.FillRectangle( lgbr, area.X + 2, area.Y + 2, area.Width - 4, area.Height - 4 );
+
+ tmp_pen = ResPool.GetPen( pushed ? pressed_inner_border_dark_color : Color.White );
+ dc.DrawLine( tmp_pen, area.X + 1, area.Y + 1, area.X + 1, area.Bottom - 2 );
+ dc.DrawLine( tmp_pen, area.X + 2, area.Y + 1, area.Right - 2, area.Y + 1 );
+
+ tmp_pen = ResPool.GetPen( pushed ? pressed_inner_border_dark_color : inner_border_dark_color );
+ dc.DrawLine( tmp_pen, area.Right - 2, area.Y + 2, area.Right - 2, area.Bottom - 2 );
+ dc.DrawLine( tmp_pen, area.X + 2, area.Bottom - 2, area.Right - 3, area.Bottom - 2 );
+
+ tmp_pen = ResPool.GetPen( edge_top_inner_color );
+ dc.DrawLine( tmp_pen, area.X, area.Y + 1, area.X + 1, area.Y );
+ dc.DrawLine( tmp_pen, area.Right - 2, area.Y, area.Right - 1, area.Y + 1 );
+
+ points = new Point[] {
+ new Point( area.X + 2, area.Y ),
+ new Point( area.Right - 3, area.Y ),
+ new Point( area.Right - 1, area.Y + 2 ),
+ new Point( area.Right - 1, area.Bottom - 1 ),
+ new Point( area.X, area.Bottom - 1 ),
+ new Point( area.X, area.Y + 2 ),
+ new Point( area.X + 2, area.Y )
+ };
+ dc.DrawPolygon( pen, points );
+ break;
+ case ScrollButton.Down:
+ // FIXME: temporary fix for artefacts, it should use the backcolor of the parent control
+ dc.DrawLine( ResPool.GetPen( ColorControl ), area.X, area.Bottom - 1, area.Right - 1, area.Bottom - 1 );
+
+ lgbr = new LinearGradientBrush( new Point( area.X + 2, area.Y ), new Point( area.Right - 2, area.Y ), first_gradient_color, second_gradient_color );
+ dc.FillRectangle( lgbr, area.X + 2, area.Y + 2, area.Width - 4, area.Height - 4 );
+
+ tmp_pen = ResPool.GetPen( pushed ? pressed_inner_border_dark_color : Color.White );
+ dc.DrawLine( tmp_pen, area.X + 1, area.Y + 1, area.X + 1, area.Bottom - 2 );
+ dc.DrawLine( tmp_pen, area.X + 2, area.Y + 1, area.Right - 2, area.Y + 1 );
+
+ tmp_pen = ResPool.GetPen( pushed ? pressed_inner_border_dark_color : inner_border_dark_color );
+ dc.DrawLine( tmp_pen, area.Right - 2, area.Y + 2, area.Right - 2, area.Bottom - 2 );
+ dc.DrawLine( tmp_pen, area.X + 2, area.Bottom - 2, area.Right - 3, area.Bottom - 2 );
+
+ tmp_pen = ResPool.GetPen( edge_top_inner_color );
+ dc.DrawLine( tmp_pen, area.X, area.Bottom - 2, area.X + 1, area.Bottom - 1 );
+ dc.DrawLine( tmp_pen, area.Right - 2, area.Bottom - 1, area.Right - 1, area.Bottom - 2 );
+
+ points = new Point[] {
+ new Point( area.X, area.Y ),
+ new Point( area.Right - 1, area.Y ),
+ new Point( area.Right - 1, area.Bottom - 3 ),
+ new Point( area.Right - 3, area.Bottom - 1 ),
+ new Point( area.X + 2, area.Bottom - 1 ),
+ new Point( area.X, area.Bottom - 3 ),
+ new Point( area.X, area.Y )
+ };
+ dc.DrawPolygon( pen, points );
+ break;
+ }
+
+ lgbr.Dispose( );
+ }
+
+ #region GroupBox
+ public override void DrawGroupBox( Graphics dc, Rectangle area, GroupBox box ) {
+ StringFormat text_format;
+ SizeF size;
+ int width;
+ int y;
+ Rectangle rect;
+
+ rect = box.ClientRectangle;
+
+ dc.FillRectangle( ResPool.GetSolidBrush( box.BackColor ), rect );
+
+ text_format = new StringFormat( );
+ text_format.HotkeyPrefix = HotkeyPrefix.Show;
+
+ size = dc.MeasureString( box.Text, box.Font );
+ width = (int) size.Width;
+
+ if ( width > box.Width - 16 )
+ width = box.Width - 16;
+
+ y = box.Font.Height / 2;
+
+ Pen pen = ResPool.GetPen( pressed_inner_border_dark_color );
+
+ /* Draw group box*/
+ Point[] points = {
+ new Point( 8 + width, y ),
+ new Point( box.Width - 3, y ),
+ new Point( box.Width - 1, y + 2 ),
+ new Point( box.Width - 1, box.Height - 3 ),
+ new Point( box.Width - 3, box.Height - 1 ),
+ new Point( 2, box.Height - 1 ),
+ new Point( 0, box.Height - 3 ),
+ new Point( 0, y + 2 ),
+ new Point( 2, y ),
+ new Point( 8, y )
+ };
+ dc.DrawLines( pen, points );
+
+ /* Text */
+ if ( box.Enabled ) {
+ dc.DrawString( box.Text, box.Font, ResPool.GetSolidBrush( box.ForeColor ), 10, 0, text_format );
+ } else {
+ CPDrawStringDisabled( dc, box.Text, box.Font, box.ForeColor,
+ new RectangleF( 10, 0, width, box.Font.Height ), text_format );
+ }
+ text_format.Dispose( );
+ }
+ #endregion
+
+ #region TrackBar
+ private void DrawTrackBar_Vertical( Graphics dc, Rectangle clip_rectangle, TrackBar tb,
+ ref Rectangle thumb_pos, ref Rectangle thumb_area,
+ float ticks, int value_pos, bool mouse_value ) {
+
+ Point toptick_startpoint = new Point( );
+ Point bottomtick_startpoint = new Point( );
+ Point channel_startpoint = new Point( );
+ float pixel_len;
+ float pixels_betweenticks;
+ const int space_from_right = 8;
+ const int space_from_left = 8;
+ Rectangle area = tb.ClientRectangle;
+
+ switch ( tb.TickStyle ) {
+ case TickStyle.BottomRight:
+ case TickStyle.None:
+ channel_startpoint.Y = 8;
+ channel_startpoint.X = 9;
+ bottomtick_startpoint.Y = 13;
+ bottomtick_startpoint.X = 24;
+ break;
+ case TickStyle.TopLeft:
+ channel_startpoint.Y = 8;
+ channel_startpoint.X = 19;
+ toptick_startpoint.Y = 13;
+ toptick_startpoint.X = 8;
+ break;
+ case TickStyle.Both:
+ channel_startpoint.Y = 8;
+ channel_startpoint.X = 18;
+ bottomtick_startpoint.Y = 13;
+ bottomtick_startpoint.X = 32;
+ toptick_startpoint.Y = 13;
+ toptick_startpoint.X = 8;
+ break;
+ default:
+ break;
+ }
+
+ thumb_area.X = area.X + channel_startpoint.X;
+ thumb_area.Y = area.Y + channel_startpoint.Y;
+ thumb_area.Height = area.Height - space_from_right - space_from_left;
+ thumb_area.Width = 4;
+
+ pixel_len = thumb_area.Height - 11;
+ pixels_betweenticks = pixel_len / ( tb.Maximum - tb.Minimum );
+
+ /* Convert thumb position from mouse position to value*/
+ if ( mouse_value ) {
+
+ if ( value_pos >= channel_startpoint.Y )
+ value_pos = (int)( ( (float) ( value_pos - channel_startpoint.Y ) ) / pixels_betweenticks );
+ else
+ value_pos = 0;
+
+ if ( value_pos + tb.Minimum > tb.Maximum )
+ value_pos = tb.Maximum - tb.Minimum;
+
+ tb.Value = value_pos + tb.Minimum;
+ }
+
+ thumb_pos.Width = 13;
+ thumb_pos.Height = 29;
+
+ thumb_pos.Y = channel_startpoint.Y + (int) ( pixels_betweenticks * (float) value_pos ) - ( thumb_pos.Height / 3 );
+
+ if ( thumb_pos.Y < channel_startpoint.Y )
+ thumb_pos.Y = channel_startpoint.Y;
+
+ if ( thumb_pos.Y > thumb_area.Bottom - 29 )
+ thumb_pos.Y = thumb_area.Bottom - 29;
+
+ /* Draw channel */
+ // bottom
+ Pen pen = ResPool.GetPen( tab_top_border_focus_color );
+ dc.DrawLine( pen, channel_startpoint.X, thumb_pos.Y + 29, channel_startpoint.X, thumb_area.Bottom );
+ dc.DrawLine( pen, channel_startpoint.X, thumb_area.Bottom, channel_startpoint.X + 4, thumb_area.Bottom );
+ dc.DrawLine( pen, channel_startpoint.X + 4, thumb_pos.Y + 29, channel_startpoint.X + 4, thumb_area.Bottom );
+
+ pen = ResPool.GetPen( menuitem_gradient_first_color );
+ dc.DrawLine( pen, channel_startpoint.X + 1, thumb_pos.Y + 28, channel_startpoint.X + 1, thumb_area.Bottom - 1 );
+ pen = ResPool.GetPen( trackbar_second_gradient_color );
+ dc.DrawLine( pen, channel_startpoint.X + 2, thumb_pos.Y + 28, channel_startpoint.X + 2, thumb_area.Bottom - 1 );
+ pen = ResPool.GetPen( trackbar_third_gradient_color );
+ dc.DrawLine( pen, channel_startpoint.X + 3, thumb_pos.Y + 28, channel_startpoint.X + 3, thumb_area.Bottom - 1 );
+
+ // top
+ pen = ResPool.GetPen( pressed_inner_border_dark_color );
+ dc.DrawLine( pen, channel_startpoint.X + 1, channel_startpoint.Y + 1, channel_startpoint.X + 1, thumb_pos.Y );
+ dc.DrawRectangle( ResPool.GetPen( scrollbar_background_color ), channel_startpoint.X + 2, channel_startpoint.Y + 1, 1, thumb_pos.Y );
+
+ pen = ResPool.GetPen( scrollbar_border_color );
+ dc.DrawLine( pen, channel_startpoint.X, channel_startpoint.Y, channel_startpoint.X, thumb_pos.Y );
+ dc.DrawLine( pen, channel_startpoint.X, channel_startpoint.Y, channel_startpoint.X + 4, channel_startpoint.Y );
+ dc.DrawLine( pen, channel_startpoint.X + 4, channel_startpoint.Y, channel_startpoint.X + 4, thumb_pos.Y );
+
+ /* Draw thumb */
+ thumb_pos.X = channel_startpoint.X - 4;
+
+ // inner border
+ pen = ResPool.GetPen( Color.White );
+ dc.DrawLine( pen, thumb_pos.X + 1, thumb_pos.Y + 1, thumb_pos.X + 1, thumb_pos.Bottom - 2 );
+ dc.DrawLine( pen, thumb_pos.X + 2, thumb_pos.Y + 1, thumb_pos.Right - 2, thumb_pos.Y + 1 );
+
+ pen = ResPool.GetPen( menu_separator_color );
+ dc.DrawLine( pen, thumb_pos.X + 2, thumb_pos.Bottom - 2, thumb_pos.Right - 2, thumb_pos.Bottom - 2 );
+ dc.DrawLine( pen, thumb_pos.Right - 2, thumb_pos.Y + 2, thumb_pos.Right - 2, thumb_pos.Bottom - 2 );
+
+ // outer border
+ Point[] points = {
+ new Point( thumb_pos.X + 2, thumb_pos.Y ),
+ new Point( thumb_pos.Right - 3 , thumb_pos.Y ),
+ new Point( thumb_pos.Right - 1, thumb_pos.Y + 2 ),
+ new Point( thumb_pos.Right - 1, thumb_pos.Bottom - 3 ),
+ new Point( thumb_pos.Right - 3, thumb_pos.Bottom - 1 ),
+ new Point( thumb_pos.X + 2, thumb_pos.Bottom - 1 ),
+ new Point( thumb_pos.X, thumb_pos.Bottom - 3 ),
+ new Point( thumb_pos.X, thumb_pos.Y + 2 ),
+ new Point( thumb_pos.X + 2, thumb_pos.Y )
+ };
+
+ dc.DrawLines( ResPool.GetPen( border_normal_dark_color ), points );
+
+ Color first_gradient_color = mouse_value ? button_edge_bottom_outer_color : trackbar_inner_first_gradient_color;
+ Color second_gradient_color = mouse_value ? trackbar_inner_pressed_second_gradient_color : trackbar_inner_second_gradient_color;
+
+ using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( thumb_pos.X, thumb_pos.Y + 2 ), new Point( thumb_pos.X, thumb_pos.Bottom - 2 ), first_gradient_color, second_gradient_color ) ) {
+ dc.FillRectangle( lgbr, thumb_pos.X + 2, thumb_pos.Y + 2, thumb_pos.Width - 4, thumb_pos.Height - 4 );
+ }
+
+ // outer egdes
+ pen = ResPool.GetPen( edge_top_inner_color );
+ dc.DrawLine( pen, thumb_pos.X, thumb_pos.Y + 1, thumb_pos.X + 1, thumb_pos.Y );
+ dc.DrawLine( pen, thumb_pos.Right - 2, thumb_pos.Y, thumb_pos.Right - 1, thumb_pos.Y + 1 );
+
+ pen = ResPool.GetPen( edge_bottom_inner_color );
+ dc.DrawLine( pen, thumb_pos.X, thumb_pos.Bottom - 2, thumb_pos.X + 1, thumb_pos.Bottom - 1 );
+ dc.DrawLine( pen, thumb_pos.Right - 1, thumb_pos.Bottom - 2, thumb_pos.Right - 2, thumb_pos.Bottom - 1 );
+
+ // draw grip lines
+ pen = ResPool.GetPen( pressed_inner_border_dark_color );
+ dc.DrawLine( pen, thumb_pos.X + 4, thumb_pos.Y + 11, thumb_pos.X + 8, thumb_pos.Y + 11 );
+ dc.DrawLine( pen, thumb_pos.X + 4, thumb_pos.Y + 14, thumb_pos.X + 8, thumb_pos.Y + 14 );
+ dc.DrawLine( pen, thumb_pos.X + 4, thumb_pos.Y + 17, thumb_pos.X + 8, thumb_pos.Y + 17 );
+
+ pen = ResPool.GetPen( Color.White );
+ dc.DrawLine( pen, thumb_pos.X + 4, thumb_pos.Y + 12, thumb_pos.X + 8, thumb_pos.Y + 12 );
+ dc.DrawLine( pen, thumb_pos.X + 4, thumb_pos.Y + 15, thumb_pos.X + 8, thumb_pos.Y + 15 );
+ dc.DrawLine( pen, thumb_pos.X + 4, thumb_pos.Y + 18, thumb_pos.X + 8, thumb_pos.Y + 18 );
+
+ pixel_len = thumb_area.Height - 11;
+ pixels_betweenticks = pixel_len / ticks;
+
+ /* Draw ticks*/
+ thumb_area.X = thumb_pos.X;
+ thumb_area.Y = channel_startpoint.Y;
+ thumb_area.Width = thumb_pos.Width;
+
+ Region outside = new Region( area );
+ outside.Exclude( thumb_area );
+
+ if ( outside.IsVisible( clip_rectangle ) ) {
+ if ( pixels_betweenticks > 0 && ( ( tb.TickStyle & TickStyle.BottomRight ) == TickStyle.BottomRight ||
+ ( ( tb.TickStyle & TickStyle.Both ) == TickStyle.Both ) ) ) {
+
+ for ( float inc = 0; inc < ( pixel_len + 1 ); inc += pixels_betweenticks ) {
+ if ( inc == 0 || ( inc + pixels_betweenticks ) >= pixel_len + 1 )
+ dc.DrawLine( ResPool.GetPen( pen_ticks_color ), area.X + bottomtick_startpoint.X , area.Y + bottomtick_startpoint.Y + inc,
+ area.X + bottomtick_startpoint.X + 3, area.Y + bottomtick_startpoint.Y + inc );
+ else
+ dc.DrawLine( ResPool.GetPen( pen_ticks_color ), area.X + bottomtick_startpoint.X, area.Y + bottomtick_startpoint.Y + inc,
+ area.X + bottomtick_startpoint.X + 2, area.Y + bottomtick_startpoint.Y + inc );
+ }
+ }
+
+ if ( pixels_betweenticks > 0 && ( ( tb.TickStyle & TickStyle.TopLeft ) == TickStyle.TopLeft ||
+ ( ( tb.TickStyle & TickStyle.Both ) == TickStyle.Both ) ) ) {
+
+ pixel_len = thumb_area.Height - 11;
+ pixels_betweenticks = pixel_len / ticks;
+
+ for ( float inc = 0; inc < ( pixel_len + 1 ); inc += pixels_betweenticks ) {
+ if ( inc == 0 || ( inc + pixels_betweenticks ) >= pixel_len + 1 )
+ dc.DrawLine( ResPool.GetPen( pen_ticks_color ), area.X + toptick_startpoint.X - 3 , area.Y + toptick_startpoint.Y + inc,
+ area.X + toptick_startpoint.X, area.Y + toptick_startpoint.Y + inc );
+ else
+ dc.DrawLine( ResPool.GetPen( pen_ticks_color ), area.X + toptick_startpoint.X - 2, area.Y + toptick_startpoint.Y + inc,
+ area.X + toptick_startpoint.X, area.Y + toptick_startpoint.Y + inc );
+ }
+ }
+ }
+
+ outside.Dispose( );
+
+ }
+
+ private void DrawTrackBar_Horizontal( Graphics dc, Rectangle clip_rectangle, TrackBar tb,
+ ref Rectangle thumb_pos, ref Rectangle thumb_area,
+ float ticks, int value_pos, bool mouse_value ) {
+ Point toptick_startpoint = new Point( );
+ Point bottomtick_startpoint = new Point( );
+ Point channel_startpoint = new Point( );
+ float pixel_len;
+ float pixels_betweenticks;
+ const int space_from_right = 8;
+ const int space_from_left = 8;
+ Rectangle area = tb.ClientRectangle;
+
+ switch ( tb.TickStyle ) {
+ case TickStyle.BottomRight:
+ case TickStyle.None:
+ channel_startpoint.X = 8;
+ channel_startpoint.Y = 9;
+ bottomtick_startpoint.X = 13;
+ bottomtick_startpoint.Y = 24;
+ break;
+ case TickStyle.TopLeft:
+ channel_startpoint.X = 8;
+ channel_startpoint.Y = 19;
+ toptick_startpoint.X = 13;
+ toptick_startpoint.Y = 8;
+ break;
+ case TickStyle.Both:
+ channel_startpoint.X = 8;
+ channel_startpoint.Y = 18;
+ bottomtick_startpoint.X = 13;
+ bottomtick_startpoint.Y = 32;
+ toptick_startpoint.X = 13;
+ toptick_startpoint.Y = 8;
+ break;
+ default:
+ break;
+ }
+
+ thumb_area.X = area.X + channel_startpoint.X;
+ thumb_area.Y = area.Y + channel_startpoint.Y;
+ thumb_area.Width = area.Width - space_from_right - space_from_left;
+ thumb_area.Height = 4;
+
+ pixel_len = thumb_area.Width - 11;
+ pixels_betweenticks = pixel_len / ( tb.Maximum - tb.Minimum );
+
+ /* Convert thumb position from mouse position to value*/
+ if ( mouse_value ) {
+ if ( value_pos >= channel_startpoint.X )
+ value_pos = (int)( ( (float) ( value_pos - channel_startpoint.X ) ) / pixels_betweenticks );
+ else
+ value_pos = 0;
+
+ if ( value_pos + tb.Minimum > tb.Maximum )
+ value_pos = tb.Maximum - tb.Minimum;
+
+ tb.Value = value_pos + tb.Minimum;
+ }
+
+ thumb_pos.Width = 29;
+ thumb_pos.Height = 13;
+
+ thumb_pos.X = channel_startpoint.X + (int) ( pixels_betweenticks * (float) value_pos ) - ( thumb_pos.Width / 3 );
+
+ if ( thumb_pos.X < channel_startpoint.X )
+ thumb_pos.X = channel_startpoint.X;
+
+ if ( thumb_pos.X > thumb_area.Right - 29 )
+ thumb_pos.X = thumb_area.Right - 29;
+
+ /* Draw channel */
+ // left side
+ Pen pen = ResPool.GetPen( tab_top_border_focus_color );
+ dc.DrawLine( pen, channel_startpoint.X, channel_startpoint.Y, thumb_pos.X, channel_startpoint.Y );
+ dc.DrawLine( pen, channel_startpoint.X, channel_startpoint.Y, channel_startpoint.X, channel_startpoint.Y + 4 );
+ dc.DrawLine( pen, channel_startpoint.X, channel_startpoint.Y + 4, thumb_pos.X, channel_startpoint.Y + 4 );
+
+ pen = ResPool.GetPen( menuitem_gradient_first_color );
+ dc.DrawLine( pen, channel_startpoint.X + 1, channel_startpoint.Y + 1, thumb_pos.X, channel_startpoint.Y + 1 );
+ pen = ResPool.GetPen( trackbar_second_gradient_color );
+ dc.DrawLine( pen, channel_startpoint.X + 1, channel_startpoint.Y + 2, thumb_pos.X, channel_startpoint.Y + 2 );
+ pen = ResPool.GetPen( trackbar_third_gradient_color );
+ dc.DrawLine( pen, channel_startpoint.X + 1, channel_startpoint.Y + 3, thumb_pos.X, channel_startpoint.Y + 3 );
+
+ // right side
+ pen = ResPool.GetPen( pressed_inner_border_dark_color );
+ dc.DrawLine( pen, thumb_pos.X + 29, channel_startpoint.Y + 1, thumb_area.Right - 1, channel_startpoint.Y + 1 );
+ dc.DrawRectangle( ResPool.GetPen( scrollbar_background_color ), thumb_pos.X + 29, channel_startpoint.Y + 2, thumb_area.Right - thumb_pos.X - 30, 1 );
+
+ pen = ResPool.GetPen( scrollbar_border_color );
+ dc.DrawLine( pen, thumb_pos.X + 29, channel_startpoint.Y, thumb_area.Right, channel_startpoint.Y );
+ dc.DrawLine( pen, thumb_area.Right, channel_startpoint.Y, thumb_area.Right, channel_startpoint.Y + 4 );
+ dc.DrawLine( pen, thumb_pos.X + 29, channel_startpoint.Y + 4, thumb_area.Right, channel_startpoint.Y + 4 );
+
+ /* Draw thumb */
+
+ thumb_pos.Y = channel_startpoint.Y - 4;
+
+ // inner border
+ pen = ResPool.GetPen( Color.White );
+ dc.DrawLine( pen, thumb_pos.X + 1, thumb_pos.Y + 1, thumb_pos.X + 1, thumb_pos.Bottom - 2 );
+ dc.DrawLine( pen, thumb_pos.X + 2, thumb_pos.Y + 1, thumb_pos.Right - 2, thumb_pos.Y + 1 );
+
+ pen = ResPool.GetPen( menu_separator_color );
+ dc.DrawLine( pen, thumb_pos.X + 2, thumb_pos.Bottom - 2, thumb_pos.Right - 2, thumb_pos.Bottom - 2 );
+ dc.DrawLine( pen, thumb_pos.Right - 2, thumb_pos.Y + 2, thumb_pos.Right - 2, thumb_pos.Bottom - 2 );
+
+ // outer border
+ Point[] points = {
+ new Point( thumb_pos.X + 2, thumb_pos.Y ),
+ new Point( thumb_pos.Right - 3 , thumb_pos.Y ),
+ new Point( thumb_pos.Right - 1, thumb_pos.Y + 2 ),
+ new Point( thumb_pos.Right - 1, thumb_pos.Bottom - 3 ),
+ new Point( thumb_pos.Right - 3, thumb_pos.Bottom - 1 ),
+ new Point( thumb_pos.X + 2, thumb_pos.Bottom - 1 ),
+ new Point( thumb_pos.X, thumb_pos.Bottom - 3 ),
+ new Point( thumb_pos.X, thumb_pos.Y + 2 ),
+ new Point( thumb_pos.X + 2, thumb_pos.Y )
+ };
+
+ dc.DrawLines( ResPool.GetPen( border_normal_dark_color ), points );
+
+ Color first_gradient_color = mouse_value ? button_edge_bottom_outer_color : trackbar_inner_first_gradient_color;
+ Color second_gradient_color = mouse_value ? trackbar_inner_pressed_second_gradient_color : trackbar_inner_second_gradient_color;
+
+ using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( thumb_pos.X, thumb_pos.Y + 2 ), new Point( thumb_pos.X, thumb_pos.Bottom - 2 ), first_gradient_color, second_gradient_color ) ) {
+ dc.FillRectangle( lgbr, thumb_pos.X + 2, thumb_pos.Y + 2, thumb_pos.Width - 4, thumb_pos.Height - 4 );
+ }
+
+ // outer egdes
+ pen = ResPool.GetPen( edge_top_inner_color );
+ dc.DrawLine( pen, thumb_pos.X, thumb_pos.Y + 1, thumb_pos.X + 1, thumb_pos.Y );
+ dc.DrawLine( pen, thumb_pos.Right - 2, thumb_pos.Y, thumb_pos.Right - 1, thumb_pos.Y + 1 );
+
+ pen = ResPool.GetPen( edge_bottom_inner_color );
+ dc.DrawLine( pen, thumb_pos.X, thumb_pos.Bottom - 2, thumb_pos.X + 1, thumb_pos.Bottom - 1 );
+ dc.DrawLine( pen, thumb_pos.Right - 1, thumb_pos.Bottom - 2, thumb_pos.Right - 2, thumb_pos.Bottom - 1 );
+
+ // draw grip lines
+ pen = ResPool.GetPen( pressed_inner_border_dark_color );
+ dc.DrawLine( pen, thumb_pos.X + 11, thumb_pos.Y + 4, thumb_pos.X + 11, thumb_pos.Y + 8 );
+ dc.DrawLine( pen, thumb_pos.X + 14, thumb_pos.Y + 4, thumb_pos.X + 14, thumb_pos.Y + 8 );
+ dc.DrawLine( pen, thumb_pos.X + 17, thumb_pos.Y + 4, thumb_pos.X + 17, thumb_pos.Y + 8 );
+
+ pen = ResPool.GetPen( Color.White );
+ dc.DrawLine( pen, thumb_pos.X + 12, thumb_pos.Y + 4, thumb_pos.X + 12, thumb_pos.Y + 8 );
+ dc.DrawLine( pen, thumb_pos.X + 15, thumb_pos.Y + 4, thumb_pos.X + 15, thumb_pos.Y + 8 );
+ dc.DrawLine( pen, thumb_pos.X + 18, thumb_pos.Y + 4, thumb_pos.X + 18, thumb_pos.Y + 8 );
+
+ pixel_len = thumb_area.Width - 11;
+ pixels_betweenticks = pixel_len / ticks;
+
+ /* Draw ticks*/
+ thumb_area.Y = thumb_pos.Y;
+ thumb_area.X = channel_startpoint.X;
+ thumb_area.Height = thumb_pos.Height;
+ Region outside = new Region( area );
+ outside.Exclude( thumb_area );
+
+ if ( outside.IsVisible( clip_rectangle ) ) {
+ if ( pixels_betweenticks > 0 && ( ( tb.TickStyle & TickStyle.BottomRight ) == TickStyle.BottomRight ||
+ ( ( tb.TickStyle & TickStyle.Both ) == TickStyle.Both ) ) ) {
+
+ for ( float inc = 0; inc < ( pixel_len + 1 ); inc += pixels_betweenticks ) {
+ if ( inc == 0 || ( inc + pixels_betweenticks ) >= pixel_len + 1 )
+ dc.DrawLine( ResPool.GetPen( pen_ticks_color ), area.X + bottomtick_startpoint.X + inc , area.Y + bottomtick_startpoint.Y,
+ area.X + bottomtick_startpoint.X + inc , area.Y + bottomtick_startpoint.Y + 3 );
+ else
+ dc.DrawLine( ResPool.GetPen( pen_ticks_color ), area.X + bottomtick_startpoint.X + inc, area.Y + bottomtick_startpoint.Y,
+ area.X + bottomtick_startpoint.X + inc, area.Y + bottomtick_startpoint.Y + 2 );
+ }
+ }
+
+ if ( pixels_betweenticks > 0 && ( ( tb.TickStyle & TickStyle.TopLeft ) == TickStyle.TopLeft ||
+ ( ( tb.TickStyle & TickStyle.Both ) == TickStyle.Both ) ) ) {
+
+ for ( float inc = 0; inc < ( pixel_len + 1 ); inc += pixels_betweenticks ) {
+ if ( inc == 0 || ( inc + pixels_betweenticks ) >= pixel_len + 1 )
+ dc.DrawLine( ResPool.GetPen( pen_ticks_color ), area.X + toptick_startpoint.X + inc , area.Y + toptick_startpoint.Y - 3,
+ area.X + toptick_startpoint.X + inc , area.Y + toptick_startpoint.Y );
+ else
+ dc.DrawLine( ResPool.GetPen( pen_ticks_color ), area.X + toptick_startpoint.X + inc, area.Y + toptick_startpoint.Y - 2,
+ area.X + toptick_startpoint.X + inc, area.Y + toptick_startpoint.Y );
+ }
+ }
+ }
+
+ outside.Dispose( );
+ }
+
+ public override void DrawTrackBar( Graphics dc, Rectangle clip_rectangle, TrackBar tb ) {
+ int value_pos;
+ bool mouse_value;
+ float ticks = ( tb.Maximum - tb.Minimum ) / tb.tickFrequency; /* N of ticks draw*/
+ Rectangle area;
+ Rectangle thumb_pos = tb.ThumbPos;
+ Rectangle thumb_area = tb.ThumbArea;
+
+ if ( tb.thumb_pressed ) {
+ value_pos = tb.thumb_mouseclick;
+ mouse_value = true;
+ } else {
+ value_pos = tb.Value - tb.Minimum;
+ mouse_value = false;
+ }
+
+ area = tb.ClientRectangle;
+
+ /* Control Background */
+ if ( tb.BackColor == DefaultControlBackColor ) {
+ dc.FillRectangle( ResPool.GetSolidBrush( ColorControl ), clip_rectangle );
+ } else {
+ dc.FillRectangle( ResPool.GetSolidBrush( tb.BackColor ), clip_rectangle );
+ }
+
+ if ( tb.Orientation == Orientation.Vertical ) {
+ DrawTrackBar_Vertical( dc, clip_rectangle, tb, ref thumb_pos, ref thumb_area,
+ ticks, value_pos, mouse_value );
+
+ } else {
+ DrawTrackBar_Horizontal( dc, clip_rectangle, tb, ref thumb_pos, ref thumb_area,
+ ticks, value_pos, mouse_value );
+ }
+
+ // TODO: draw better focus rectangle
+ if ( tb.Focused ) {
+ dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, ColorControl, Color.Black ), area.X, area.Y, area.Width - 1, 1 );
+ dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, ColorControl, Color.Black ), area.X, area.Y + area.Height - 1, area.Width - 1, 1 );
+ dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, ColorControl, Color.Black ), area.X, area.Y, 1, area.Height - 1 );
+ dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, ColorControl, Color.Black ), area.X + area.Width - 1, area.Y, 1, area.Height - 1 );
+ }
+
+ tb.ThumbPos = thumb_pos;
+ tb.ThumbArea = thumb_area;
+ }
+ #endregion // TrackBar
+
+ #region ListView
+ // draws the ListViewItem of the given index
+ protected override void DrawListViewItem( Graphics dc, ListView control, ListViewItem item ) {
+ Rectangle rect_checkrect = item.CheckRectReal;
+ Rectangle rect_iconrect = item.GetBounds( ItemBoundsPortion.Icon );
+ Rectangle full_rect = item.GetBounds( ItemBoundsPortion.Entire );
+ Rectangle text_rect = item.GetBounds( ItemBoundsPortion.Label );
+
+ if ( control.CheckBoxes ) {
+ if ( control.StateImageList == null ) {
+ // Make sure we've got at least a line width of 1
+ int check_wd = Math.Max( 3, rect_checkrect.Width / 6 );
+ int scale = Math.Max( 1, rect_checkrect.Width / 12 );
+
+ // set the checkbox background
+ dc.FillRectangle( this.ResPool.GetSolidBrush( this.ColorWindow ),
+ rect_checkrect );
+ // define a rectangle inside the border area
+ Rectangle rect = new Rectangle( rect_checkrect.X + 2,
+ rect_checkrect.Y + 2,
+ rect_checkrect.Width - 4,
+ rect_checkrect.Height - 4 );
+ Pen pen = new Pen( this.ColorWindowText, 2 );
+ dc.DrawRectangle( pen, rect );
+
+ // Need to draw a check-mark
+ if ( item.Checked ) {
+ pen.Width = 1;
+ // adjustments to get the check-mark at the right place
+ rect.X ++; rect.Y ++;
+ // following logic is taken from DrawFrameControl method
+ for ( int i = 0; i < check_wd; i++ ) {
+ dc.DrawLine( pen, rect.Left + check_wd / 2,
+ rect.Top + check_wd + i,
+ rect.Left + check_wd / 2 + 2 * scale,
+ rect.Top + check_wd + 2 * scale + i );
+ dc.DrawLine( pen,
+ rect.Left + check_wd / 2 + 2 * scale,
+ rect.Top + check_wd + 2 * scale + i,
+ rect.Left + check_wd / 2 + 6 * scale,
+ rect.Top + check_wd - 2 * scale + i );
+ }
+ }
+ } else {
+ if ( item.Checked && control.StateImageList.Images.Count > 1 )
+ control.StateImageList.Draw( dc,
+ rect_checkrect.Location, 1 );
+ else if ( ! item.Checked && control.StateImageList.Images.Count > 0 )
+ control.StateImageList.Draw( dc,
+ rect_checkrect.Location, 0 );
+ }
+ }
+
+ // Item is drawn as a special case, as it is not just text
+ if ( control.View == View.LargeIcon ) {
+ if ( item.ImageIndex > -1 &&
+ control.LargeImageList != null &&
+ item.ImageIndex < control.LargeImageList.Images.Count ) {
+ // center image
+ Point image_location = rect_iconrect.Location;
+ Image image = control.LargeImageList.Images[ item.ImageIndex ];
+ if ( image.Width < rect_iconrect.Width ) {
+ int icon_rect_middle = rect_iconrect.Width / 2;
+ int image_middle = image.Width / 2;
+ image_location.X = image_location.X + icon_rect_middle - image_middle;
+ }
+ control.LargeImageList.Draw( dc, image_location,
+ item.ImageIndex );
+ }
+ } else {
+ if ( item.ImageIndex > -1 &&
+ control.SmallImageList != null &&
+ item.ImageIndex < control.SmallImageList.Images.Count )
+ control.SmallImageList.Draw( dc, rect_iconrect.Location,
+ item.ImageIndex );
+ }
+
+ // draw the item text
+ // format for the item text
+ StringFormat format = new StringFormat( );
+ format.LineAlignment = StringAlignment.Center;
+ if ( control.View == View.LargeIcon )
+ format.Alignment = StringAlignment.Center;
+ else
+ format.Alignment = StringAlignment.Near;
+
+ if ( !control.LabelWrap )
+ format.FormatFlags = StringFormatFlags.NoWrap;
+
+ if ( item.Selected ) {
+ if ( control.View == View.Details ) {
+ if ( control.FullRowSelect ) {
+ // fill the entire rect excluding the checkbox
+ full_rect.Location = item.LabelRect.Location;
+ dc.FillRectangle( this.ResPool.GetSolidBrush
+ ( this.ColorHighlight ), full_rect );
+ } else {
+ Size text_size = Size.Ceiling( dc.MeasureString( item.Text,
+ item.Font ) );
+ text_rect.Width = text_size.Width;
+ dc.FillRectangle( this.ResPool.GetSolidBrush
+ ( this.ColorHighlight ), text_rect );
+ }
+ } else {
+ /*Size text_size = Size.Ceiling (dc.MeasureString (item.Text,
+ item.Font));
+ Point loc = text_rect.Location;
+ loc.X += (text_rect.Width - text_size.Width) / 2;
+ text_rect.Width = text_size.Width;*/
+ dc.FillRectangle( this.ResPool.GetSolidBrush( this.ColorHighlight ),
+ text_rect );
+ }
+ } else
+ dc.FillRectangle( ResPool.GetSolidBrush( item.BackColor ), text_rect );
+
+ if ( item.Text != null && item.Text.Length > 0 ) {
+
+ if ( control.View != View.LargeIcon ) {
+ if ( item.Selected )
+ dc.DrawString( item.Text, item.Font, this.ResPool.GetSolidBrush
+ ( this.ColorHighlightText ), text_rect, format );
+ else
+ dc.DrawString( item.Text, item.Font, this.ResPool.GetSolidBrush
+ ( item.ForeColor ), text_rect, format );
+ } else {
+ // ListView CalcTextSize says wrapping is done for two lines only !?!
+ // text is centered for the complete text_rect but it should be centered per available row/line
+
+ // calculate how much lines we get out of text_rect and current item.Font
+ int nr_lines = text_rect.Height / item.Font.Height;
+ int rest = text_rect.Height % item.Font.Height;
+ int line_height = item.Font.Height + ( rest > 1 ? 2 : 0 );
+
+ Rectangle[] text_rects = new Rectangle[ nr_lines ];
+
+ for ( int i = 0; i < nr_lines; i++ ) {
+ text_rects[ i ].X = text_rect.X;
+ text_rects[ i ].Y = text_rect.Y + i * line_height;
+ text_rects[ i ].Width = text_rect.Width;
+ text_rects[ i ].Height = line_height;
+ }
+
+ string[] lines = new string[ nr_lines ];
+
+ string text = item.Text;
+
+ int line_nr = 0;
+ int current_pos = 0;
+ for ( int k = 1; k <= text.Length; k++ ) {
+ lines[ line_nr ] = text.Substring( current_pos, k - current_pos );
+
+ // FIXME: Graphics.MeasureString returns wrong results if there is a
+ // space char in the string
+ SizeF sizef = dc.MeasureString( lines[ line_nr ], item.Font, text_rect.Width, format );
+
+ if ( (int)sizef.Width > text_rect.Width - 3 ) {
+ lines[ line_nr ] = lines[ line_nr ].Remove( lines[ line_nr ].Length - 1, 1 );
+ k--;
+ current_pos = k;
+ line_nr++;
+ if ( line_nr == nr_lines )
+ break;
+ }
+ }
+
+ int j = 0;
+ foreach ( Rectangle t_rect in text_rects ) {
+ if ( item.Selected )
+ dc.DrawString( lines[ j ], item.Font, this.ResPool.GetSolidBrush
+ ( this.ColorHighlightText ), t_rect, format );
+ else
+ dc.DrawString( lines[ j ], item.Font, this.ResPool.GetSolidBrush
+ ( item.ForeColor ), t_rect, format );
+ j++;
+ }
+ }
+ }
+
+ if ( control.View == View.Details && control.Columns.Count > 0 ) {
+ // draw subitems for details view
+ ListViewItem.ListViewSubItemCollection subItems = item.SubItems;
+ int count = ( control.Columns.Count < subItems.Count ?
+ control.Columns.Count : subItems.Count );
+
+ if ( count > 0 ) {
+ ColumnHeader col;
+ ListViewItem.ListViewSubItem subItem;
+ Rectangle sub_item_rect = text_rect;
+
+ // set the format for subitems
+ format.FormatFlags = StringFormatFlags.NoWrap;
+ format.Alignment = StringAlignment.Near;
+
+ // 0th subitem is the item already drawn
+ for ( int index = 1; index < count; index++ ) {
+ subItem = subItems[ index ];
+ col = control.Columns[ index ];
+ sub_item_rect.X = col.Rect.Left;
+ sub_item_rect.Width = col.Wd;
+ sub_item_rect.X -= control.h_marker;
+
+ SolidBrush sub_item_back_br = null;
+ SolidBrush sub_item_fore_br = null;
+ Font sub_item_font = null;
+
+ if ( item.UseItemStyleForSubItems ) {
+ sub_item_back_br = this.ResPool.GetSolidBrush
+ ( item.BackColor );
+ sub_item_fore_br = this.ResPool.GetSolidBrush
+ ( item.ForeColor );
+ sub_item_font = item.Font;
+ } else {
+ sub_item_back_br = this.ResPool.GetSolidBrush
+ ( subItem.BackColor );
+ sub_item_fore_br = this.ResPool.GetSolidBrush
+ ( subItem.ForeColor );
+ sub_item_font = subItem.Font;
+ }
+
+ // In case of fullrowselect, background is filled
+ // for the entire rect above
+ if ( item.Selected && control.FullRowSelect ) {
+ if ( subItem.Text != null && subItem.Text.Length > 0 )
+ dc.DrawString( subItem.Text, sub_item_font,
+ this.ResPool.GetSolidBrush
+ ( this.ColorHighlightText ),
+ sub_item_rect, format );
+ } else {
+ dc.FillRectangle( sub_item_back_br, sub_item_rect );
+ if ( subItem.Text != null && subItem.Text.Length > 0 )
+ dc.DrawString( subItem.Text, sub_item_font,
+ sub_item_fore_br,
+ sub_item_rect, format );
+ }
+ sub_item_rect.X += col.Wd;
+ }
+ }
+ }
+
+ if ( item.Focused ) {
+ if ( item.Selected )
+ CPDrawFocusRectangle( dc, text_rect, ColorHighlightText, ColorHighlight );
+ else
+ CPDrawFocusRectangle( dc, text_rect, control.ForeColor, control.BackColor );
+ }
+
+ format.Dispose( );
+ }
+ #endregion ListView
+
+ #region DateTimePicker
+ public override void DrawDateTimePicker (Graphics dc, Rectangle clip_rectangle, DateTimePicker dtp) {
+ // if not showing the numeric updown control then render border
+ if (!dtp.ShowUpDown && clip_rectangle.IntersectsWith (dtp.ClientRectangle)) {
+ // draw the outer border
+ Rectangle button_bounds = dtp.ClientRectangle;
+ CPDrawBorder3D (dc, button_bounds, Border3DStyle.Sunken, Border3DSide.All, dtp.BackColor);
+
+ // deflate by the border width
+ if (clip_rectangle.IntersectsWith (dtp.drop_down_arrow_rect)) {
+ button_bounds.Inflate (-2,-2);
+ ButtonState state = dtp.is_drop_down_visible ? ButtonState.Pushed : ButtonState.Normal;
+ Rectangle button_rect = new Rectangle(dtp.drop_down_arrow_rect.X, dtp.drop_down_arrow_rect.Y + 1,
+ dtp.drop_down_arrow_rect.Width - 1, dtp.drop_down_arrow_rect.Height - 2);
+ this.CPDrawComboButton (
+ dc,
+ button_rect,
+ state);
+ }
+ }
+
+ // render the date part
+ if (clip_rectangle.IntersectsWith (dtp.date_area_rect)) {
+ // fill the background
+ Rectangle date_area_rect = new Rectangle( dtp.date_area_rect.X + 1, dtp.date_area_rect.Y + 1,
+ dtp.date_area_rect.Width - 2, dtp.date_area_rect.Height - 2);
+ dc.FillRectangle (ResPool.GetSolidBrush (ThemeEngine.Current.ColorWindow), date_area_rect);
+
+ // fill the currently highlighted area
+ if (dtp.hilight_date_area != Rectangle.Empty) {
+ dc.FillRectangle (ResPool.GetSolidBrush (ThemeEngine.Current.ColorHighlight), dtp.hilight_date_area);
+ }
+
+ // draw the text part
+ // TODO: if date format is CUstom then we need to draw the dates as separate parts
+ StringFormat text_format = new StringFormat();
+ text_format.LineAlignment = StringAlignment.Center;
+ text_format.Alignment = StringAlignment.Near;
+ dc.DrawString (dtp.Text, dtp.Font, ResPool.GetSolidBrush (dtp.ForeColor), Rectangle.Inflate(dtp.date_area_rect, -1, -1), text_format);
+ text_format.Dispose ();
+ }
+ }
+ #endregion // DateTimePicker
+
+ #region MonthCalendar
+ // draw the month calendar
+ public override void DrawMonthCalendar(Graphics dc, Rectangle clip_rectangle, MonthCalendar mc)
+ {
+ Rectangle client_rectangle = mc.ClientRectangle;
+ Size month_size = mc.SingleMonthSize;
+ // cache local copies of Marshal-by-ref internal members (gets around error CS0197)
+ Size calendar_spacing = (Size)((object)mc.calendar_spacing);
+ Size date_cell_size = (Size)((object)mc.date_cell_size);
+
+ // draw the singlecalendars
+ int x_offset = 1;
+ int y_offset = 1;
+ // adjust for the position of the specific month
+ for (int i=0; i < mc.CalendarDimensions.Height; i++)
+ {
+ if (i > 0)
+ {
+ y_offset += month_size.Height + calendar_spacing.Height;
+ }
+ // now adjust for x position
+ for (int j=0; j < mc.CalendarDimensions.Width; j++)
+ {
+ if (j > 0)
+ {
+ x_offset += month_size.Width + calendar_spacing.Width;
+ }
+ else
+ {
+ x_offset = 1;
+ }
+
+ Rectangle month_rect = new Rectangle (x_offset, y_offset, month_size.Width, month_size.Height);
+ if (month_rect.IntersectsWith (clip_rectangle)) {
+ DrawSingleMonth (
+ dc,
+ clip_rectangle,
+ month_rect,
+ mc,
+ i,
+ j);
+ }
+ }
+ }
+
+ Rectangle bottom_rect = new Rectangle (
+ client_rectangle.X,
+ Math.Max(client_rectangle.Bottom - date_cell_size.Height - 3, 0),
+ client_rectangle.Width,
+ date_cell_size.Height + 2);
+ // draw the today date if it's set
+ if (mc.ShowToday && bottom_rect.IntersectsWith (clip_rectangle))
+ {
+ dc.FillRectangle (ResPool.GetSolidBrush (mc.BackColor), bottom_rect);
+ if (mc.ShowToday) {
+ int today_offset = 5;
+ if (mc.ShowTodayCircle)
+ {
+ Rectangle today_circle_rect = new Rectangle (
+ client_rectangle.X + 5,
+ Math.Max(client_rectangle.Bottom - date_cell_size.Height - 2, 0),
+ date_cell_size.Width,
+ date_cell_size.Height);
+ DrawTodayCircle (dc, today_circle_rect);
+ today_offset += date_cell_size.Width + 5;
+ }
+ // draw today's date
+ StringFormat text_format = new StringFormat();
+ text_format.LineAlignment = StringAlignment.Center;
+ text_format.Alignment = StringAlignment.Near;
+ Font bold_font = new Font (mc.Font.FontFamily, mc.Font.Size, mc.Font.Style | FontStyle.Bold);
+ Rectangle today_rect = new Rectangle (
+ today_offset + client_rectangle.X,
+ Math.Max(client_rectangle.Bottom - date_cell_size.Height, 0),
+ Math.Max(client_rectangle.Width - today_offset, 0),
+ date_cell_size.Height);
+ dc.DrawString ("Today: " + DateTime.Now.ToShortDateString(), bold_font, ResPool.GetSolidBrush (mc.ForeColor), today_rect, text_format);
+ text_format.Dispose ();
+ bold_font.Dispose ();
+ }
+ }
+
+ // finally paint the borders of the calendars as required
+ for (int i = 0; i <= mc.CalendarDimensions.Width; i++) {
+ if (i == 0 && clip_rectangle.X == client_rectangle.X) {
+ dc.FillRectangle (ResPool.GetSolidBrush (mc.BackColor), new Rectangle (client_rectangle.X, client_rectangle.Y, 1, client_rectangle.Height));
+ } else if (i == mc.CalendarDimensions.Width && clip_rectangle.Right == client_rectangle.Right) {
+ dc.FillRectangle (ResPool.GetSolidBrush (mc.BackColor), new Rectangle (client_rectangle.Right-1, client_rectangle.Y, 1, client_rectangle.Height));
+ } else {
+ Rectangle rect = new Rectangle (
+ client_rectangle.X + (month_size.Width*i) + (calendar_spacing.Width * (i-1)) + 1,
+ client_rectangle.Y,
+ calendar_spacing.Width,
+ client_rectangle.Height);
+ if (i < mc.CalendarDimensions.Width && i > 0 && clip_rectangle.IntersectsWith (rect)) {
+ dc.FillRectangle (ResPool.GetSolidBrush (mc.BackColor), rect);
+ }
+ }
+ }
+ for (int i = 0; i <= mc.CalendarDimensions.Height; i++) {
+ if (i == 0 && clip_rectangle.Y == client_rectangle.Y) {
+ dc.FillRectangle (ResPool.GetSolidBrush (mc.BackColor), new Rectangle (client_rectangle.X, client_rectangle.Y, client_rectangle.Width, 1));
+ } else if (i == mc.CalendarDimensions.Height && clip_rectangle.Bottom == client_rectangle.Bottom) {
+ dc.FillRectangle (ResPool.GetSolidBrush (mc.BackColor), new Rectangle (client_rectangle.X, client_rectangle.Bottom-1, client_rectangle.Width, 1));
+ } else {
+ Rectangle rect = new Rectangle (
+ client_rectangle.X,
+ client_rectangle.Y + (month_size.Height*i) + (calendar_spacing.Height*(i-1)) + 1,
+ client_rectangle.Width,
+ calendar_spacing.Height);
+ if (i < mc.CalendarDimensions.Height && i > 0 && clip_rectangle.IntersectsWith (rect)) {
+ dc.FillRectangle (ResPool.GetSolidBrush (mc.BackColor), rect);
+ }
+ }
+ }
+
+ // draw the drop down border if need
+ if (mc.owner != null) {
+ Rectangle bounds = mc.ClientRectangle;
+ if (clip_rectangle.Contains (mc.Location)) {
+ // find out if top or left line to draw
+ if(clip_rectangle.Contains (new Point (bounds.Left, bounds.Bottom))) {
+
+ dc.DrawLine (SystemPens.ControlText, bounds.X, bounds.Y, bounds.X, bounds.Bottom-1);
+ }
+ if(clip_rectangle.Contains (new Point (bounds.Right, bounds.Y))) {
+ dc.DrawLine (SystemPens.ControlText, bounds.X, bounds.Y, bounds.Right-1, bounds.Y);
+ }
+ }
+ if (clip_rectangle.Contains (new Point(bounds.Right, bounds.Bottom))) {
+ // find out if bottom or right line to draw
+ if(clip_rectangle.Contains (new Point (bounds.Left, bounds.Bottom))) {
+ dc.DrawLine (SystemPens.ControlText, bounds.X, bounds.Bottom-1, bounds.Right-1, bounds.Bottom-1);
+ }
+ if(clip_rectangle.Contains (new Point (bounds.Right, bounds.Y))) {
+ dc.DrawLine (SystemPens.ControlText, bounds.Right-1, bounds.Y, bounds.Right-1, bounds.Bottom-1);
+ }
+ }
+ }
+ }
+
+ // darws a single part of the month calendar (with one month)
+ private void DrawSingleMonth(Graphics dc, Rectangle clip_rectangle, Rectangle rectangle, MonthCalendar mc, int row, int col)
+ {
+ // cache local copies of Marshal-by-ref internal members (gets around error CS0197)
+ Size title_size = (Size)((object)mc.title_size);
+ Size date_cell_size = (Size)((object)mc.date_cell_size);
+ DateTime current_month = (DateTime)((object)mc.current_month);
+
+ // set up some standard string formating variables
+ StringFormat text_format = new StringFormat();
+ text_format.LineAlignment = StringAlignment.Center;
+ text_format.Alignment = StringAlignment.Center;
+
+
+ // draw the title back ground
+ DateTime this_month = current_month.AddMonths (row*mc.CalendarDimensions.Width+col);
+ Rectangle title_rect = new Rectangle(rectangle.X, rectangle.Y, title_size.Width, title_size.Height);
+ if (title_rect.IntersectsWith (clip_rectangle)) {
+ dc.FillRectangle (ResPool.GetSolidBrush (mc.TitleBackColor), title_rect);
+ // draw the title
+ string title_text = this_month.ToString ("MMMM yyyy");
+ dc.DrawString (title_text, mc.Font, ResPool.GetSolidBrush (mc.TitleForeColor), title_rect, text_format);
+
+ // draw previous and next buttons if it's time
+ if (row == 0 && col == 0)
+ {
+ // draw previous button
+ DrawMonthCalendarButton (
+ dc,
+ rectangle,
+ mc,
+ title_size,
+ mc.button_x_offset,
+ (System.Drawing.Size)((object)mc.button_size),
+ true);
+ }
+ if (row == 0 && col == mc.CalendarDimensions.Width-1)
+ {
+ // draw next button
+ DrawMonthCalendarButton (
+ dc,
+ rectangle,
+ mc,
+ title_size,
+ mc.button_x_offset,
+ (System.Drawing.Size)((object)mc.button_size),
+ false);
+ }
+ }
+
+ // set the week offset and draw week nums if needed
+ int col_offset = (mc.ShowWeekNumbers) ? 1 : 0;
+ Rectangle day_name_rect = new Rectangle(
+ rectangle.X,
+ rectangle.Y + title_size.Height,
+ (7 + col_offset) * date_cell_size.Width,
+ date_cell_size.Height);
+ if (day_name_rect.IntersectsWith (clip_rectangle)) {
+ dc.FillRectangle (ResPool.GetSolidBrush (mc.BackColor), day_name_rect);
+ // draw the day names
+ DayOfWeek first_day_of_week = mc.GetDayOfWeek(mc.FirstDayOfWeek);
+ for (int i=0; i < 7; i++)
+ {
+ int position = i - (int) first_day_of_week;
+ if (position < 0)
+ {
+ position = 7 + position;
+ }
+ // draw it
+ Rectangle day_rect = new Rectangle(
+ day_name_rect.X + ((i + col_offset)* date_cell_size.Width),
+ day_name_rect.Y,
+ date_cell_size.Width,
+ date_cell_size.Height);
+ dc.DrawString (((DayOfWeek)i).ToString().Substring(0, 3), mc.Font, ResPool.GetSolidBrush (mc.TitleBackColor), day_rect, text_format);
+ }
+
+ // draw the vertical divider
+ int vert_divider_y = Math.Max(title_size.Height+ date_cell_size.Height-1, 0);
+ dc.DrawLine (
+ ResPool.GetPen (mc.ForeColor),
+ rectangle.X + (col_offset * date_cell_size.Width) + mc.divider_line_offset,
+ rectangle.Y + vert_divider_y,
+ rectangle.Right - mc.divider_line_offset,
+ rectangle.Y + vert_divider_y);
+ }
+
+
+ // draw the actual date items in the grid (including the week numbers)
+ Rectangle date_rect = new Rectangle (
+ rectangle.X,
+ rectangle.Y + title_size.Height + date_cell_size.Height,
+ date_cell_size.Width,
+ date_cell_size.Height);
+ int month_row_count = 0;
+ bool draw_week_num_divider = false;
+ DateTime current_date = mc.GetFirstDateInMonthGrid ( new DateTime (this_month.Year, this_month.Month, 1));
+ for (int i=0; i < 6; i++)
+ {
+ // establish if this row is in our clip_area
+ Rectangle row_rect = new Rectangle (
+ rectangle.X,
+ rectangle.Y + title_size.Height + (date_cell_size.Height * (i+1)),
+ date_cell_size.Width * 7,
+ date_cell_size.Height);
+ if (mc.ShowWeekNumbers) {
+ row_rect.Width += date_cell_size.Width;
+ }
+
+ bool draw_row = row_rect.IntersectsWith (clip_rectangle);
+ if (draw_row) {
+ dc.FillRectangle (ResPool.GetSolidBrush (mc.BackColor), row_rect);
+ }
+ // establish if this is a valid week to draw
+ if (mc.IsValidWeekToDraw (this_month, current_date, row, col)) {
+ month_row_count = i;
+ }
+
+ // draw the week number if required
+ if (mc.ShowWeekNumbers && month_row_count == i) {
+ if (!draw_week_num_divider) {
+ draw_week_num_divider = draw_row;
+ }
+ // get the week for this row
+ int week = mc.GetWeekOfYear (current_date);
+
+ if (draw_row) {
+ dc.DrawString (
+ week.ToString(),
+ mc.Font,
+ ResPool.GetSolidBrush (mc.TitleBackColor),
+ date_rect,
+ text_format);
+ }
+ date_rect.Offset(date_cell_size.Width, 0);
+ }
+
+ // only draw the days if we have to
+ if(month_row_count == i) {
+ for (int j=0; j < 7; j++)
+ {
+ if (draw_row) {
+ DrawMonthCalendarDate (
+ dc,
+ date_rect,
+ mc,
+ current_date,
+ this_month,
+ row,
+ col);
+ }
+
+ // move the day on
+ current_date = current_date.AddDays(1);
+ date_rect.Offset(date_cell_size.Width, 0);
+ }
+
+ // shift the rectangle down one row
+ int offset = (mc.ShowWeekNumbers) ? -8 : -7;
+ date_rect.Offset(offset*date_cell_size.Width, date_cell_size.Height);
+ }
+ }
+
+ // month_row_count is zero based, so add one
+ month_row_count++;
+
+ // draw week numbers if required
+ if (draw_week_num_divider) {
+ col_offset = 1;
+ dc.DrawLine (
+ ResPool.GetPen (mc.ForeColor),
+ rectangle.X + date_cell_size.Width - 1,
+ rectangle.Y + title_size.Height + date_cell_size.Height + mc.divider_line_offset,
+ rectangle.X + date_cell_size.Width - 1,
+ rectangle.Y + title_size.Height + date_cell_size.Height + (month_row_count * date_cell_size.Height) - mc.divider_line_offset);
+ }
+ text_format.Dispose ();
+ }
+
+ // draws the pervious or next button
+ private void DrawMonthCalendarButton (Graphics dc, Rectangle rectangle, MonthCalendar mc, Size title_size, int x_offset, Size button_size, bool is_previous)
+ {
+ bool is_clicked = false;
+ Rectangle button_rect;
+ Rectangle arrow_rect = new Rectangle (rectangle.X, rectangle.Y, 4, 7);
+ Point[] arrow_path = new Point[3];
+ // prepare the button
+ if (is_previous)
+ {
+ is_clicked = mc.is_previous_clicked;
+ button_rect = new Rectangle (
+ rectangle.X + 1 + x_offset,
+ rectangle.Y + 1 + ((title_size.Height - button_size.Height)/2),
+ Math.Max(button_size.Width - 1, 0),
+ Math.Max(button_size.Height - 1, 0));
+ arrow_rect.X = button_rect.X + ((button_rect.Width - arrow_rect.Width)/2);
+ arrow_rect.Y = button_rect.Y + ((button_rect.Height - arrow_rect.Height)/2);
+ if (is_clicked) {
+ arrow_rect.Offset(1,1);
+ }
+ arrow_path[0] = new Point (arrow_rect.Right, arrow_rect.Y);
+ arrow_path[1] = new Point (arrow_rect.X, arrow_rect.Y + arrow_rect.Height/2);
+ arrow_path[2] = new Point (arrow_rect.Right, arrow_rect.Bottom);
+ }
+ else
+ {
+ is_clicked = mc.is_next_clicked;
+ button_rect = new Rectangle (
+ rectangle.Right - 1 - x_offset - button_size.Width,
+ rectangle.Y + 1 + ((title_size.Height - button_size.Height)/2),
+ Math.Max(button_size.Width - 1, 0),
+ Math.Max(button_size.Height - 1, 0));
+ arrow_rect.X = button_rect.X + ((button_rect.Width - arrow_rect.Width)/2);
+ arrow_rect.Y = button_rect.Y + ((button_rect.Height - arrow_rect.Height)/2);
+ if (is_clicked) {
+ arrow_rect.Offset(1,1);
+ }
+ arrow_path[0] = new Point (arrow_rect.X, arrow_rect.Y);
+ arrow_path[1] = new Point (arrow_rect.Right, arrow_rect.Y + arrow_rect.Height/2);
+ arrow_path[2] = new Point (arrow_rect.X, arrow_rect.Bottom);
+ }
+
+ // fill the background
+ dc.FillRectangle (ResPool.GetSolidBrush(mc.TitleBackColor), button_rect);
+
+ // draw the button
+ Color first_gradient_color = is_clicked ? pressed_gradient_first_color : gradient_first_color;
+ Color second_gradient_color = is_clicked ? pressed_gradient_second_color : gradient_second_color;
+
+ CL_Draw_Button (dc, button_rect, FlatStyle.Standard,
+ false, true, is_clicked,
+ first_gradient_color, second_gradient_color,
+ false);
+
+ // draw the arrow
+ SmoothingMode old_smooting_mode = dc.SmoothingMode;
+ dc.SmoothingMode = SmoothingMode.AntiAlias;
+ dc.FillPolygon (SystemBrushes.ControlText, arrow_path);
+ dc.SmoothingMode = old_smooting_mode;
+ }
+
+
+ // draws one day in the calendar grid
+ private void DrawMonthCalendarDate (Graphics dc, Rectangle rectangle, MonthCalendar mc, DateTime date, DateTime month, int row, int col) {
+ Color date_color = mc.ForeColor;
+ Rectangle interior = new Rectangle (rectangle.X, rectangle.Y, Math.Max(rectangle.Width - 1, 0), Math.Max(rectangle.Height - 1, 0));
+
+ // find out if we are the lead of the first calendar or the trail of the last calendar
+ if (date.Year != month.Year || date.Month != month.Month) {
+ DateTime check_date = month.AddMonths (-1);
+ // check if it's the month before
+ if (check_date.Year == date.Year && check_date.Month == date.Month && row == 0 && col == 0) {
+ date_color = mc.TrailingForeColor;
+ } else {
+ // check if it's the month after
+ check_date = month.AddMonths (1);
+ if (check_date.Year == date.Year && check_date.Month == date.Month && row == mc.CalendarDimensions.Height-1 && col == mc.CalendarDimensions.Width-1) {
+ date_color = mc.TrailingForeColor;
+ } else {
+ return;
+ }
+ }
+ } else {
+ date_color = mc.ForeColor;
+ }
+
+
+ if (date == mc.SelectionStart && date == mc.SelectionEnd) {
+ // see if the date is in the start of selection
+ date_color = mc.BackColor;
+ // draw the left hand of the back ground
+ Rectangle selection_rect = Rectangle.Inflate(rectangle, -3, -3);
+ dc.FillPie (ResPool.GetSolidBrush (mc.TitleBackColor), selection_rect, 0, 359);
+ } else if (date == mc.SelectionStart) {
+ // see if the date is in the start of selection
+ date_color = mc.BackColor;
+ // draw the left hand of the back ground
+ Rectangle selection_rect = Rectangle.Inflate(rectangle, -3, -3);
+ dc.FillPie (ResPool.GetSolidBrush (mc.TitleBackColor), selection_rect, 90, 180);
+ // fill the other side as a straight rect
+ if (date < mc.SelectionEnd)
+ {
+ // use rectangle instead of rectangle to go all the way to edge of rect
+ selection_rect.X = (int) Math.Floor((double)(rectangle.X + rectangle.Width / 2));
+ selection_rect.Width = Math.Max(rectangle.Right - selection_rect.X, 0);
+ dc.FillRectangle (ResPool.GetSolidBrush (mc.TitleBackColor), selection_rect);
+ }
+ } else if (date == mc.SelectionEnd) {
+ // see if it is the end of selection
+ date_color = mc.BackColor;
+ // draw the left hand of the back ground
+ Rectangle selection_rect = Rectangle.Inflate(rectangle, -3, -3);
+ dc.FillPie (ResPool.GetSolidBrush (mc.TitleBackColor), selection_rect, 270, 180);
+ // fill the other side as a straight rect
+ if (date > mc.SelectionStart) {
+ selection_rect.X = rectangle.X;
+ selection_rect.Width = rectangle.Width - (rectangle.Width / 2);
+ dc.FillRectangle (ResPool.GetSolidBrush (mc.TitleBackColor), selection_rect);
+ }
+ } else if (date > mc.SelectionStart && date < mc.SelectionEnd) {
+ // now see if it's in the middle
+ date_color = mc.BackColor;
+ // draw the left hand of the back ground
+ Rectangle selection_rect = Rectangle.Inflate(rectangle, 0, -3);
+ dc.FillRectangle (ResPool.GetSolidBrush (mc.TitleBackColor), selection_rect);
+ }
+
+ // set up some standard string formating variables
+ StringFormat text_format = new StringFormat();
+ text_format.LineAlignment = StringAlignment.Center;
+ text_format.Alignment = StringAlignment.Center;
+
+
+ // establish if it's a bolded font
+ Font font;
+ if (mc.IsBoldedDate (date)) {
+ font = new Font (mc.Font.FontFamily, mc.Font.Size, mc.Font.Style | FontStyle.Bold);
+ } else {
+ font = mc.Font;
+ }
+
+ // just draw the date now
+ dc.DrawString (date.Day.ToString(), font, ResPool.GetSolidBrush (date_color), rectangle, text_format);
+
+ // today circle if needed
+ if (mc.ShowTodayCircle && date == DateTime.Now.Date) {
+ DrawTodayCircle (dc, interior);
+ }
+
+ // draw the selection grid
+ if (mc.is_date_clicked && mc.clicked_date == date) {
+ using (Pen pen = new Pen (Color.Black, 1) ) {
+ pen.DashStyle = DashStyle.Dot;
+ dc.DrawRectangle (pen, interior);
+ }
+ }
+ text_format.Dispose ();
+ }
+
+ private void DrawTodayCircle (Graphics dc, Rectangle rectangle) {
+ Color circle_color = Color.FromArgb (248, 0, 0);
+ // draw the left hand of the circle
+ Rectangle lhs_circle_rect = new Rectangle (rectangle.X + 1, rectangle.Y + 4, Math.Max(rectangle.Width - 2, 0), Math.Max(rectangle.Height - 5, 0));
+ Rectangle rhs_circle_rect = new Rectangle (rectangle.X + 1, rectangle.Y + 1, Math.Max(rectangle.Width - 2, 0), Math.Max(rectangle.Height - 2, 0));
+ Point [] curve_points = new Point [3];
+ curve_points [0] = new Point (lhs_circle_rect.X, rhs_circle_rect.Y + rhs_circle_rect.Height/12);
+ curve_points [1] = new Point (lhs_circle_rect.X + lhs_circle_rect.Width/9, rhs_circle_rect.Y);
+ curve_points [2] = new Point (lhs_circle_rect.X + lhs_circle_rect.Width/2 + 1, rhs_circle_rect.Y);
+
+ SmoothingMode old_smoothing_mode = dc.SmoothingMode;
+ dc.SmoothingMode = SmoothingMode.AntiAlias;
+
+ using (Pen pen = new Pen (circle_color, 2)) {
+ dc.DrawArc (pen, lhs_circle_rect, 90, 180);
+ dc.DrawArc (pen, rhs_circle_rect, 270, 180);
+ dc.DrawCurve (pen, curve_points);
+ dc.DrawLine (ResPool.GetPen (circle_color), curve_points [2], new Point (curve_points [2].X, lhs_circle_rect.Y));
+ }
+
+ dc.SmoothingMode = old_smoothing_mode;
+ }
+ #endregion // MonthCalendar
+
+ public override void CPDrawBorder3D( Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides ) {
+ CPDrawBorder3D( graphics, rectangle, style, sides, ColorControl );
+ }
+
+ private void CPDrawBorder3D( Graphics dc, Rectangle rectangle, Border3DStyle style, Border3DSide sides, Color control_color ) {
+ // currently we don't take care of Border3DStyle or Border3DSide
+
+ // FIXME: temporary fix for artefacts, it should use the backcolor of the parent control
+ dc.DrawLine( ResPool.GetPen( ColorControl ), rectangle.X, rectangle.Y, rectangle.X, rectangle.Bottom - 1 );
+ dc.DrawLine( ResPool.GetPen( ColorControl ), rectangle.Right - 1, rectangle.Y, rectangle.Right - 1, rectangle.Bottom - 1 );
+
+ Pen tmp_pen = ResPool.GetPen( edge_bottom_inner_color );
+ dc.DrawLine( tmp_pen, rectangle.X + 1, rectangle.Y + 2, rectangle.X + 2, rectangle.Y + 1 );
+ dc.DrawLine( tmp_pen, rectangle.Right - 3, rectangle.Y + 1, rectangle.Right - 2, rectangle.Y + 2 );
+ dc.DrawLine( tmp_pen, rectangle.Right - 3, rectangle.Bottom - 2, rectangle.Right - 2, rectangle.Bottom - 3 );
+ dc.DrawLine( tmp_pen, rectangle.X + 1, rectangle.Bottom - 3, rectangle.X + 2, rectangle.Bottom - 2 );
+
+ tmp_pen = ResPool.GetPen( theme_back_color );
+ dc.DrawLine( tmp_pen, rectangle.X + 2, rectangle.Y + 2, rectangle.Right - 3, rectangle.Y + 2 );
+ dc.DrawLine( tmp_pen, rectangle.X + 2, rectangle.Y + 3, rectangle.X + 2, rectangle.Bottom - 3 );
+
+ tmp_pen = ResPool.GetPen( Color.White );
+ dc.DrawLine( tmp_pen, rectangle.X + 3, rectangle.Bottom - 3, rectangle.Right - 3, rectangle.Bottom - 3 );
+ dc.DrawLine( tmp_pen, rectangle.Right - 3, rectangle.Y + 3, rectangle.Right - 3, rectangle.Bottom - 3 );
+
+ Point[] points = {
+ new Point( rectangle.X + 3, rectangle.Y + 1 ),
+ new Point( rectangle.Right - 4, rectangle.Y + 1 ),
+ new Point( rectangle.Right - 2, rectangle.Y + 3 ),
+ new Point( rectangle.Right - 2, rectangle.Bottom - 4 ),
+ new Point( rectangle.Right - 4, rectangle.Bottom - 2 ),
+ new Point( rectangle.X + 3, rectangle.Bottom - 2 ),
+ new Point( rectangle.X + 1, rectangle.Bottom - 4 ),
+ new Point( rectangle.X + 1, rectangle.Y + 3 ),
+ new Point( rectangle.X + 3, rectangle.Y + 1 )
+ };
+
+ dc.DrawLines( ResPool.GetPen( combobox_border_color ), points );
+
+ Point[] points_top_outer = {
+ new Point( rectangle.X + 1, rectangle.Y + 1 ),
+ new Point( rectangle.X + 2, rectangle.Y ),
+ new Point( rectangle.Right - 3, rectangle.Y ),
+ new Point( rectangle.Right - 2 , rectangle.Y + 1 )
+ };
+
+ Point[] points_bottom_outer = {
+ new Point( rectangle.X + 1, rectangle.Bottom - 2 ),
+ new Point( rectangle.X + 2, rectangle.Bottom - 1 ),
+ new Point( rectangle.Right - 3, rectangle.Bottom - 1 ),
+ new Point( rectangle.Right - 2, rectangle.Bottom - 2 )
+ };
+
+ // outer border
+ tmp_pen = ResPool.GetPen( button_outer_border_dark_color );
+ dc.DrawLines( tmp_pen, points_top_outer );
+ tmp_pen = ResPool.GetPen( button_outer_border_light_color );
+ dc.DrawLines( tmp_pen, points_bottom_outer );
+
+ using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( 0, 2 ), new Point( 0, rectangle.Height - 1 ), button_outer_border_dark_color, button_outer_border_light_color ) ) {
+ dc.FillRectangle( lgbr, rectangle.X, rectangle.Y + 2, 1, rectangle.Height - 4 );
+ dc.FillRectangle( lgbr, rectangle.Right - 1, rectangle.Y + 2, 1, rectangle.Height - 4 );
+ }
+
+ tmp_pen = ResPool.GetPen( button_edge_top_outer_color );
+ dc.DrawLine( tmp_pen, rectangle.X, rectangle.Y + 1, rectangle.X + 1, rectangle.Y );
+ dc.DrawLine( tmp_pen, rectangle.Right - 2, rectangle.Y, rectangle.Right - 1, rectangle.Y + 1 );
+
+ tmp_pen = ResPool.GetPen( button_edge_bottom_outer_color );
+ dc.DrawLine( tmp_pen, rectangle.X, rectangle.Bottom - 2, rectangle.X + 1, rectangle.Bottom - 1 );
+ dc.DrawLine( tmp_pen, rectangle.Right - 1, rectangle.Bottom - 2, rectangle.Right - 2, rectangle.Bottom - 1 );
+ }
+
+ public override void CPDrawBorder( Graphics dc, Rectangle bounds, Color leftColor, int leftWidth,
+ ButtonBorderStyle leftStyle, Color topColor, int topWidth, ButtonBorderStyle topStyle,
+ Color rightColor, int rightWidth, ButtonBorderStyle rightStyle, Color bottomColor,
+ int bottomWidth, ButtonBorderStyle bottomStyle ) {
+ dc.DrawRectangle( ResPool.GetPen( combobox_border_color ), bounds.X, bounds.Y, bounds.Width - 1, bounds.Height - 1 );
+ }
+
+ // TODO: inactive...
+ public override void CPDrawCheckBox( Graphics dc, Rectangle rectangle, ButtonState state ) {
+
+ bool pushed = ( state & ButtonState.Pushed ) != 0;
+
+ int lineWidth;
+ Rectangle rect;
+ int scale;
+
+ // background
+ dc.FillRectangle( ResPool.GetSolidBrush( pushed ? checkbox_pressed_backcolor : Color.White ), rectangle );
+
+ // border
+ dc.DrawRectangle( ResPool.GetPen( scrollbar_border_color ), rectangle );
+
+ Color inner_border_color = pushed ? checkbox_pressed_inner_boder_color : checkbox_inner_boder_color;
+
+ Pen tmp_pen = ResPool.GetPen( inner_border_color );
+ dc.DrawLine( tmp_pen, rectangle.X + 1, rectangle.Y + 1, rectangle.Right - 1, rectangle.Y + 1 );
+ dc.DrawLine( tmp_pen, rectangle.X + 1, rectangle.Y + 2, rectangle.X + 1, rectangle.Bottom - 1 );
+
+ /* Make sure we've got at least a line width of 1 */
+ lineWidth = Math.Max( 3, rectangle.Width / 6 );
+ scale = Math.Max( 1, rectangle.Width / 12 );
+
+ // define a rectangle inside the border area
+ rect = new Rectangle( rectangle.X + 2, rectangle.Y + 2, rectangle.Width - 4, rectangle.Height - 4 );
+ if ( ( state & ButtonState.Inactive ) != 0 ) {
+ tmp_pen = SystemPens.ControlDark;
+ } else {
+ tmp_pen = SystemPens.ControlText;
+ }
+
+ if ( ( state & ButtonState.Checked ) != 0 ) {
+ /* Need to draw a check-mark */
+ for ( int i=0; i < lineWidth; i++ ) {
+ dc.DrawLine( tmp_pen, rect.Left + lineWidth / 2, rect.Top + lineWidth + i, rect.Left + lineWidth / 2 + 2 * scale, rect.Top + lineWidth + 2 * scale + i );
+ dc.DrawLine( tmp_pen, rect.Left + lineWidth / 2 + 2 * scale, rect.Top + lineWidth + 2 * scale + i, rect.Left + lineWidth / 2 + 6 * scale, rect.Top + lineWidth - 2 * scale + i );
+ }
+ }
+ }
+
+ public override void CPDrawStringDisabled( Graphics graphics, string s, Font font, Color color, RectangleF layoutRectangle,
+ StringFormat format ) {
+
+ graphics.DrawString( s, font, ResPool.GetSolidBrush( ThemeEngine.Current.ColorGrayText), layoutRectangle, format );
+
+ }
+
+ public override void CPDrawButton (Graphics dc, Rectangle buttonRectangle, ButtonState state)
+ {
+ bool is_enabled = true;
+ FlatStyle flat_style = FlatStyle.Standard;
+ bool is_pressed = false;
+
+ if ((state & ButtonState.Pushed) != 0) {
+ is_pressed = true;
+ }
+
+// if ((state & ButtonState.Checked)!=0) {
+// dfcs |= DrawFrameControlStates.Checked;
+// }
+
+ if ((state & ButtonState.Flat) != 0) {
+ flat_style = FlatStyle.Flat;
+ }
+
+ if ((state & ButtonState.Inactive) != 0) {
+ is_enabled = false;
+ }
+
+ Color first_gradient_color = gradient_first_color;
+ Color second_gradient_color = gradient_second_color;
+
+ if (is_pressed) {
+ first_gradient_color = pressed_gradient_first_color;
+ second_gradient_color = pressed_gradient_second_color;
+ }
+
+ CL_Draw_Button (dc, buttonRectangle, flat_style,
+ false, is_enabled, is_pressed,
+ first_gradient_color, second_gradient_color,
+ false);
+ }
+
+ public override void CPDrawRadioButton (Graphics dc, Rectangle rectangle, ButtonState state)
+ {
+ bool is_checked = false;
+ bool is_inactive = false;
+
+ if ((state & ButtonState.Checked) != 0) {
+ is_checked = true;
+ }
+
+ if ((state & ButtonState.Inactive) != 0) {
+ is_inactive = true;
+ }
+
+ SmoothingMode old_smooting_mode = dc.SmoothingMode;
+ dc.SmoothingMode = SmoothingMode.AntiAlias;
+
+ dc.FillPie (ResPool.GetSolidBrush (this.ColorWindow), rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 0, 359);
+
+ dc.DrawArc (ResPool.GetPen (radio_button_border_circle_color), rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 0, 359);
+
+ CL_Draw_RadioButton_Dot (dc, rectangle, is_checked, is_inactive);
+
+ dc.SmoothingMode = old_smooting_mode;
+ }
+
+ private void CL_Draw_RadioButton_Dot (Graphics dc, Rectangle rectangle, bool is_checked, bool is_inactive)
+ {
+ if (is_checked) {
+ int lineWidth = Math.Max (1, Math.Min (rectangle.Width, rectangle.Height) / 4);
+
+ SolidBrush buttonBrush;
+
+ if (is_inactive) {
+ buttonBrush = SystemBrushes.ControlDark as SolidBrush;
+ } else {
+ buttonBrush = ResPool.GetSolidBrush (radio_button_dot_color);
+ }
+ dc.FillPie (buttonBrush, rectangle.X + lineWidth, rectangle.Y + lineWidth, rectangle.Width - lineWidth * 2, rectangle.Height - lineWidth * 2, 0, 359);
+
+ // the white shiny dott
+ buttonBrush = ResPool.GetSolidBrush (ColorWindow);
+ dc.FillPie (buttonBrush, rectangle.X + lineWidth + lineWidth / 2, rectangle.Y + lineWidth + lineWidth / 2, (rectangle.Width - lineWidth * 2) / 3, (rectangle.Height - lineWidth * 2) / 3, 0, 359);
+ }
+ }
+ } //class
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeEngine.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeEngine.cs
new file mode 100644
index 00000000000..ad1b4108ebf
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeEngine.cs
@@ -0,0 +1,65 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+//
+
+
+using System;
+
+namespace System.Windows.Forms
+{
+ internal class ThemeEngine
+ {
+ static private Theme theme = null;
+
+ static ThemeEngine ()
+ {
+ string theme_var;
+
+ theme_var = Environment.GetEnvironmentVariable("MONO_THEME");
+
+ if (theme_var == null)
+ theme_var = "win32";
+
+ theme_var.ToLower ();
+
+ if (theme_var == "gtk")
+ theme = new ThemeGtk ();
+ else
+ if ( theme_var == "nice" )
+ theme = new ThemeNice ();
+ else
+ if ( theme_var == "clearlooks" )
+ theme = new ThemeClearlooks ();
+ else
+ theme = new ThemeWin32Classic ();
+ }
+
+
+ public static Theme Current {
+ get { return theme; }
+ }
+
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeGtk.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeGtk.cs
new file mode 100644
index 00000000000..c735b20ebca
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeGtk.cs
@@ -0,0 +1,887 @@
+// 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.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+// Alexander Olk, alex.olk@googlemail.com
+//
+// This is an experimental GTK theme.
+//
+// Comments:
+// - For now we would keep all the themes in the same assembly to have
+// handy the internals methods.
+// - We are using Pinovoke for now to access GTK/GDK to avoid adding
+// gtk-sharp as a SWF dependency
+// - The ThemeGtk comes from ThemeWin32Classic, we use it as the default
+// implementation for the methods that we are not taking care of.
+// - When GDK is initialised it opens its own display. There is not way of changing it,
+// then we use that display as SWF display
+// - You can activate this Theme in Linux doing export MONO_THEME=gtk
+// - GTK paints controls into a window not a device context. We should inverstigate if we
+// we can encapsulate a dc in a gtkwindow.
+
+
+// NOT COMPLETE
+
+// TODO: fix position of button focus rectangle
+//
+
+using System;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Drawing.Imaging;
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms
+{
+ internal class ThemeGtk : ThemeWin32Classic
+ {
+ /* GTK enums */
+ internal enum StateType
+ {
+ Normal,
+ Active,
+ Prelight,
+ Selected,
+ Insensitive,
+ }
+
+ internal enum ShadowType
+ {
+ None,
+ In,
+ Out,
+ EtchedIn,
+ EtchedOut,
+ }
+
+ internal enum ArrowType
+ {
+ Up,
+ Down,
+ Left,
+ Right,
+ }
+
+ /* Structs */
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct GdkColorStruct
+ {
+ internal int pixel;
+ internal short red;
+ internal short green;
+ internal short blue;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct GtkStyleStruct
+ {
+ [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst=12)]
+ internal byte[] obj; /* GObject is 12 bytes*/
+ [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst=5)]
+ internal GdkColorStruct[] fg;
+ [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst=5)]
+ internal GdkColorStruct[] bg;
+ [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst=5)]
+ internal GdkColorStruct[] light;
+ [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst=5)]
+ internal GdkColorStruct[] dark;
+ [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst=5)]
+ internal GdkColorStruct[] mid;
+ [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst=5)]
+ internal GdkColorStruct[] text;
+ [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst=5)]
+ internal GdkColorStruct[] baseclr;
+ [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst=5)]
+ internal GdkColorStruct[] text_aa; /* Halfway between text/base */
+
+ internal GdkColorStruct black;
+ internal GdkColorStruct white;
+
+ /* TODO: There is more stuff that we will add when we need it*/
+ }
+
+ /* GDK imports */
+ [DllImport("libgdk-x11-2.0.so")]
+ internal static extern IntPtr gdk_display_manager_get ();
+
+ [DllImport("libgdk-x11-2.0.so")]
+ internal static extern IntPtr gdk_display_manager_get_default_display (IntPtr display_manager);
+
+ [DllImport("libgdk-x11-2.0.so")]
+ internal static extern void gdk_display_manager_set_default_display (IntPtr display_manager, IntPtr display);
+
+ [DllImport("libgdk-x11-2.0.so")]
+ internal static extern IntPtr gdk_x11_display_get_xdisplay (IntPtr display);
+
+ [DllImport("libgdk-x11-2.0.so")]
+ static extern IntPtr gdk_window_foreign_new_for_display (IntPtr display, uint anid);
+
+ [DllImport("libgdk-x11-2.0.so")]
+ static extern bool gdk_init_check(out int argc, string argv);
+
+ /* GTK imports */
+ [DllImport("libgtk-x11-2.0.so")]
+ static extern bool gtk_init_check (out int argc, string argv);
+
+ [DllImport("libgtk-x11-2.0.so")]
+ static extern IntPtr gtk_adjustment_new (double value, double lower, double upper, double step_increment, double page_increment, double page_size);
+
+ [DllImport("libgtk-x11-2.0.so")]
+ static extern IntPtr gtk_rc_get_style (IntPtr widget);
+
+ [DllImport("libgtk-x11-2.0.so")]
+ static extern IntPtr gtk_vscrollbar_new(IntPtr adjustment);
+
+ [DllImport("libgtk-x11-2.0.so")]
+ static extern IntPtr gtk_hscrollbar_new(IntPtr adjustment);
+
+ [DllImport("libgtk-x11-2.0.so")]
+ static extern IntPtr gtk_style_attach (IntPtr raw, IntPtr window);
+
+ [DllImport("libgtk-x11-2.0.so")]
+ static extern IntPtr gtk_rc_style_new ();
+
+ [DllImport("libgtk-x11-2.0.so")]
+ static extern IntPtr gtk_invisible_new ();
+
+ [DllImport("libgtk-x11-2.0.so")]
+ static extern void gtk_widget_ensure_style (IntPtr raw);
+
+ [DllImport("libgtk-x11-2.0.so")]
+ static extern IntPtr gtk_widget_get_style (IntPtr raw);
+
+ [DllImport("libgtk-x11-2.0.so")]
+ static extern void gtk_style_detach (IntPtr raw);
+
+ [DllImport("libgtk-x11-2.0.so")]
+ static extern IntPtr gtk_button_new ();
+
+ [DllImport("libgtk-x11-2.0.so")]
+ static extern IntPtr gtk_progress_bar_new ();
+
+ [DllImport("libgtk-x11-2.0.so")]
+ static extern IntPtr gtk_radio_button_new (IntPtr group);
+
+ [DllImport("libgtk-x11-2.0.so")]
+ static extern IntPtr gtk_check_button_new ();
+
+ /* GTK Drawing */
+ [DllImport("libgtk-x11-2.0.so")]
+ static extern void gtk_paint_handle (IntPtr style, IntPtr window, int state_type, int shadow_type, IntPtr area, IntPtr widget, string detail, int x, int y, int width, int height, int orientation);
+
+ [DllImport("libgtk-x11-2.0.so")]
+ static extern void gtk_paint_arrow (IntPtr style, IntPtr window, int state_type, int shadow_type,
+ IntPtr area, IntPtr widget, string detail, int arrow_type, bool fill, int x, int y, int width, int height);
+
+ [DllImport("libgtk-x11-2.0.so")]
+ static extern void gtk_paint_slider (IntPtr style, IntPtr window, int state_type, int shadow_type,
+ IntPtr area, IntPtr widget, string detail, int x, int y, int width, int height, int orientation);
+
+ [DllImport("libgtk-x11-2.0.so")]
+ static extern void gtk_paint_box (IntPtr style, IntPtr window, int state_type, int shadow_type,
+ IntPtr area, IntPtr widget, string detail, int x, int y, int width, int height);
+
+ [DllImport("libgtk-x11-2.0.so")]
+ static extern void gtk_paint_flat_box (IntPtr style, IntPtr window, int state_type, int shadow_type,
+ IntPtr area, IntPtr widget, string detail, int x, int y, int width, int height);
+
+ [DllImport("libgtk-x11-2.0.so")]
+ static extern void gtk_paint_hline(IntPtr style, IntPtr window, int state_type, IntPtr area, IntPtr widget, string detail, int x1, int x2, int y);
+
+ [DllImport("libgtk-x11-2.0.so")]
+ static extern void gtk_paint_vline(IntPtr style, IntPtr window, int state_type, IntPtr area, IntPtr widget, string detail, int y1, int y2, int x);
+
+ [DllImport("libgtk-x11-2.0.so")]
+ static extern void gtk_paint_check(IntPtr style, IntPtr window, int state_type, int shadow_type, IntPtr area, IntPtr widget, string detail, int x, int y, int width, int height);
+
+ [DllImport("libgtk-x11-2.0.so")]
+ static extern void gtk_paint_focus(IntPtr style, IntPtr window, int state_type, IntPtr area, IntPtr widget, string detail, int x, int y, int width, int height);
+
+ [DllImport("libgtk-x11-2.0.so")]
+ static extern void gtk_widget_size_allocate (IntPtr widget, ref Rectangle allocation);
+
+ [DllImport("libgtk-x11-2.0.so")]
+ static extern void gtk_paint_option (IntPtr style, IntPtr window, int state_type, int shadow_type, IntPtr area, IntPtr widget, string detail, int x, int y, int width, int height);
+
+ /* Data */
+ static protected IntPtr dispmgr;
+ static protected IntPtr gdkdisplay;
+ static protected IntPtr widget;
+ static protected IntPtr style;
+
+ IntPtr global_gtk_button = IntPtr.Zero;
+ IntPtr global_gtk_button_style = IntPtr.Zero;
+
+ IntPtr global_gtk_vscrollbar = IntPtr.Zero;
+ IntPtr global_gtk_vscrollbar_style = IntPtr.Zero;
+
+ IntPtr global_gtk_hscrollbar = IntPtr.Zero;
+ IntPtr global_gtk_hscrollbar_style = IntPtr.Zero;
+
+ IntPtr global_gtk_progress_bar = IntPtr.Zero;
+ IntPtr global_gtk_progress_bar_style = IntPtr.Zero;
+
+ IntPtr global_gtk_radio_button = IntPtr.Zero;
+ IntPtr global_gtk_radio_button_style = IntPtr.Zero;
+
+ IntPtr global_gtk_check_button = IntPtr.Zero;
+ IntPtr global_gtk_check_button_style = IntPtr.Zero;
+
+ IntPtr current_gdk_window = IntPtr.Zero;
+ IntPtr current_style = IntPtr.Zero;
+
+ public static void InitGtk ()
+ {
+ Console.WriteLine ("ThemeGtk Init");
+ int argc = 0;
+ string argv = "";
+
+ gdk_init_check (out argc, argv);
+
+ dispmgr = gdk_display_manager_get ();
+ gdkdisplay = gdk_display_manager_get_default_display (dispmgr);
+ gtk_init_check (out argc, argv);
+
+ widget = gtk_invisible_new ();
+ gtk_widget_ensure_style (widget);
+ style = gtk_widget_get_style (widget);
+
+ XplatUIX11.GetInstance().SetDisplay (gdk_x11_display_get_xdisplay (gdkdisplay));
+ }
+
+ public void LoadSysDefaultColors ()
+ {
+ GtkStyleStruct style_struct;
+
+ style_struct = (GtkStyleStruct) Marshal.PtrToStructure (style, typeof (GtkStyleStruct));
+ defaultWindowBackColor = ColorFromGdkColor (style_struct.bg[0]);
+ defaultWindowForeColor = ColorFromGdkColor (style_struct.fg[0]);
+ }
+
+ public ThemeGtk () : base ()
+ {
+ Console.WriteLine ("ThemeGtk constructor");
+ InitGtk ();
+ default_font = new Font (FontFamily.GenericSansSerif, 8.25f);
+
+ LoadSysDefaultColors ();
+
+ always_draw_hotkeys = true;
+
+ global_gtk_button = gtk_button_new();
+ gtk_widget_ensure_style (global_gtk_button);
+ global_gtk_button_style = gtk_rc_get_style (global_gtk_button);
+
+ IntPtr adj = gtk_adjustment_new (0, 0, 0, 0, 0, 0);
+ global_gtk_vscrollbar = gtk_vscrollbar_new (adj);
+ gtk_widget_ensure_style (global_gtk_vscrollbar);
+ global_gtk_vscrollbar_style = gtk_rc_get_style (global_gtk_vscrollbar);
+
+ global_gtk_hscrollbar = gtk_hscrollbar_new (adj);
+ gtk_widget_ensure_style (global_gtk_hscrollbar);
+ global_gtk_hscrollbar_style = gtk_rc_get_style (global_gtk_hscrollbar);
+
+ global_gtk_progress_bar = gtk_progress_bar_new ();
+ gtk_widget_ensure_style (global_gtk_progress_bar);
+ global_gtk_progress_bar_style = gtk_rc_get_style (global_gtk_progress_bar);
+
+ global_gtk_radio_button = gtk_radio_button_new (IntPtr.Zero);
+ gtk_widget_ensure_style (global_gtk_radio_button);
+ global_gtk_radio_button_style = gtk_rc_get_style (global_gtk_radio_button);
+
+ global_gtk_check_button = gtk_check_button_new ();
+ gtk_widget_ensure_style (global_gtk_check_button);
+ global_gtk_check_button_style = gtk_rc_get_style (global_gtk_check_button);
+ }
+
+ public override bool DoubleBufferingSupported {
+ get {return false; }
+ }
+
+ protected override void ButtonBase_DrawButton(ButtonBase button, Graphics dc)
+ {
+ Rectangle buttonRectangle = button.ClientRectangle;
+
+ IntPtr gdkwindow = gdk_window_foreign_new_for_display (gdkdisplay, (uint) button.Handle);
+
+ IntPtr button_style = gtk_style_attach (global_gtk_button_style, gdkwindow); // need it
+
+ StateType state_type = StateType.Normal;
+ ShadowType shadow_type = button.flat_style == FlatStyle.Flat ? ShadowType.In : ShadowType.Out;
+ string detail = "buttondefault";
+
+ if (((button is CheckBox) && (((CheckBox)button).check_state == CheckState.Checked)) ||
+ ((button is RadioButton) && (((RadioButton)button).check_state == CheckState.Checked))) {
+ state_type = StateType.Active;
+ shadow_type = ShadowType.In;
+ detail = "button";
+ } else
+ if (!button.is_enabled) {
+ state_type = StateType.Insensitive;
+ } else
+ if (button.is_pressed) {
+ state_type = StateType.Active;
+ shadow_type = ShadowType.In;
+ detail = "button";
+ } else
+ if (button.is_entered) {
+ state_type = StateType.Prelight;
+ }
+
+ if (button.flat_style == FlatStyle.Flat)
+ gtk_paint_flat_box (button_style, gdkwindow,
+ (int) state_type,
+ (int) shadow_type,
+ IntPtr.Zero,
+ IntPtr.Zero,
+ detail,
+ buttonRectangle.X, buttonRectangle.Y,
+ buttonRectangle.Width, buttonRectangle.Height);
+ else
+ if (button.flat_style != FlatStyle.Popup || (button.flat_style == FlatStyle.Popup && button.is_entered))
+ gtk_paint_box (button_style, gdkwindow,
+ (int) state_type,
+ (int) shadow_type,
+ IntPtr.Zero,
+ IntPtr.Zero,
+ detail,
+ buttonRectangle.X, buttonRectangle.Y,
+ buttonRectangle.Width, buttonRectangle.Height);
+ }
+
+ protected override void ButtonBase_DrawFocus( ButtonBase button, Graphics dc ) {
+
+ if ( !button.is_enabled)
+ return;
+
+ Rectangle focus_rect = new Rectangle( button.ClientRectangle.X + 4, button.ClientRectangle.Y + 4, button.ClientRectangle.Width - 9, button.ClientRectangle.Height - 9 );
+
+ IntPtr gdkwindow = gdk_window_foreign_new_for_display (gdkdisplay, (uint) button.Handle);
+
+ IntPtr button_style = gtk_style_attach (global_gtk_button_style, gdkwindow); // need it
+
+ gtk_paint_focus (button_style,
+ gdkwindow,
+ (int) StateType.Active,
+ IntPtr.Zero,
+ IntPtr.Zero,
+ "button",
+ focus_rect.X,
+ focus_rect.Y,
+ focus_rect.Width,
+ focus_rect.Height);
+ }
+
+ #region ScrollBar
+ public override void DrawScrollBar( Graphics dc, Rectangle clip, ScrollBar bar ) {
+ int scrollbutton_width = bar.scrollbutton_width;
+ int scrollbutton_height = bar.scrollbutton_height;
+ Rectangle first_arrow_area;
+ Rectangle second_arrow_area;
+ Rectangle thumb_pos;
+
+ IntPtr gdkwindow = gdk_window_foreign_new_for_display (gdkdisplay, (uint) bar.Handle);
+
+ IntPtr scrollbar_style;
+
+ Rectangle allocation = new Rectangle (bar.ClientRectangle.X, bar.ClientRectangle.Y, bar.ClientRectangle.Width, bar.ClientRectangle.Height);
+
+ // fix for artefacts
+ Color fix_color = bar.Parent != null ? bar.Parent.BackColor : ColorControl;
+
+ if (bar.vert) {
+ scrollbar_style = global_gtk_vscrollbar_style;
+
+ gtk_widget_size_allocate (global_gtk_vscrollbar, ref allocation);
+
+ // fix for artefacts
+ dc.FillRectangle (ResPool.GetSolidBrush (fix_color),
+ bar.ClientRectangle.X, bar.ClientRectangle.Y, bar.ClientRectangle.Width, 3);
+ dc.FillRectangle (ResPool.GetSolidBrush (fix_color),
+ bar.ClientRectangle.X, bar.ClientRectangle.Bottom - 4, bar.ClientRectangle.Width, 3);
+ } else {
+ scrollbar_style = global_gtk_hscrollbar_style;
+
+ gtk_widget_size_allocate (global_gtk_hscrollbar, ref allocation);
+
+ // fix for artefacts
+ dc.FillRectangle (ResPool.GetSolidBrush (fix_color),
+ bar.ClientRectangle.X, bar.ClientRectangle.Y, 3, bar.ClientRectangle.Height);
+ dc.FillRectangle (ResPool.GetSolidBrush (fix_color),
+ bar.ClientRectangle.Right - 4, bar.ClientRectangle.Y, 3, bar.ClientRectangle.Height);
+ }
+
+ scrollbar_style = gtk_style_attach (scrollbar_style, gdkwindow); // need it
+
+ current_gdk_window = gdkwindow;
+ current_style = scrollbar_style;
+
+ thumb_pos = bar.ThumbPos;
+
+ if ( bar.vert ) {
+ first_arrow_area = new Rectangle( 0, 0, bar.Width, scrollbutton_height + 1 );
+ bar.FirstArrowArea = first_arrow_area;
+
+ second_arrow_area = new Rectangle( 0, bar.ClientRectangle.Height - scrollbutton_height - 1, bar.Width, scrollbutton_height + 1 );
+ bar.SecondArrowArea = second_arrow_area;
+
+ thumb_pos.Width = bar.Width;
+ bar.ThumbPos = thumb_pos;
+
+ ScrollBar_Vertical_Draw_ThumbMoving_None (scrollbutton_height, bar, clip, dc);
+
+ /* Buttons */
+ if ( clip.IntersectsWith( first_arrow_area ) )
+ CPDrawScrollButton( dc, first_arrow_area, ScrollButton.Up, bar.firstbutton_state );
+ if ( clip.IntersectsWith( second_arrow_area ) )
+ CPDrawScrollButton( dc, second_arrow_area, ScrollButton.Down, bar.secondbutton_state );
+ } else {
+ first_arrow_area = new Rectangle( 0, 0, scrollbutton_width + 1, bar.Height );
+ bar.FirstArrowArea = first_arrow_area;
+
+ second_arrow_area = new Rectangle( bar.ClientRectangle.Width - scrollbutton_width - 1, 0, scrollbutton_width + 1, bar.Height );
+ bar.SecondArrowArea = second_arrow_area;
+
+ thumb_pos.Height = bar.Height;
+ bar.ThumbPos = thumb_pos;
+
+ /* Background */
+ ScrollBar_Horizontal_Draw_ThumbMoving_None (scrollbutton_width, bar, clip, dc);
+
+ /* Buttons */
+ if ( clip.IntersectsWith( first_arrow_area ) )
+ CPDrawScrollButton( dc, first_arrow_area, ScrollButton.Left, bar.firstbutton_state );
+ if ( clip.IntersectsWith( second_arrow_area ) )
+ CPDrawScrollButton( dc, second_arrow_area, ScrollButton.Right, bar.secondbutton_state );
+ }
+
+ /* Thumb */
+ ScrollBar_DrawThumb( bar, thumb_pos, clip, dc );
+ }
+
+ protected override void ScrollBar_DrawThumb( ScrollBar bar, Rectangle thumb_pos, Rectangle clip, Graphics dc ) {
+ if ( bar.Enabled)
+ DrawScrollBarThumb( dc, thumb_pos, bar );
+ }
+
+ protected override void ScrollBar_Vertical_Draw_ThumbMoving_None (int scrollbutton_height, ScrollBar bar, Rectangle clip, Graphics dc)
+ {
+ Rectangle r = new Rectangle (0,
+ scrollbutton_height, bar.ClientRectangle.Width, bar.ClientRectangle.Height - (scrollbutton_height * 2));
+ gtk_paint_box (current_style,
+ current_gdk_window,
+ (int) StateType.Active,
+ (int) ShadowType.In,
+ IntPtr.Zero,
+ global_gtk_vscrollbar,
+ "vscrollbar",
+ r.X, r.Y,
+ r.Width, r.Height);
+ }
+
+ protected override void ScrollBar_Horizontal_Draw_ThumbMoving_None (int scrollbutton_width, ScrollBar bar, Rectangle clip, Graphics dc)
+ {
+ Rectangle r = new Rectangle (scrollbutton_width,
+ 0, bar.ClientRectangle.Width - (scrollbutton_width * 2), bar.ClientRectangle.Height);
+
+ gtk_paint_box (current_style,
+ current_gdk_window,
+ (int) StateType.Active,
+ (int) ShadowType.In,
+ IntPtr.Zero,
+ global_gtk_hscrollbar,
+ "hscrollbar",
+ r.X, r.Y,
+ r.Width, r.Height);
+ }
+
+ private void DrawScrollBarThumb( Graphics dc, Rectangle area, ScrollBar bar ) {
+ IntPtr gtk_scrollbar = bar.vert ? global_gtk_vscrollbar : global_gtk_hscrollbar;
+
+ gtk_paint_box (current_style,
+ current_gdk_window,
+ (int) StateType.Active,
+ (int) ShadowType.Out,
+ IntPtr.Zero,
+ gtk_scrollbar,
+ "slider",
+ area.X, area.Y,
+ area.Width, area.Height);
+ }
+ #endregion // ScrollBar
+
+ #region ProgressBar
+ public override void DrawProgressBar (Graphics dc, Rectangle clip_rect, ProgressBar ctrl)
+ {
+ Rectangle client_area = ctrl.client_area;
+ int barpos_pixels;
+
+ IntPtr gdkwindow = gdk_window_foreign_new_for_display (gdkdisplay, (uint) ctrl.Handle);
+
+ IntPtr progressbar_style = gtk_style_attach (global_gtk_progress_bar_style, gdkwindow); // need it
+
+ // draw background
+ gtk_paint_box (progressbar_style,
+ gdkwindow,
+ (int) StateType.Normal,
+ (int) ShadowType.In,
+ IntPtr.Zero,
+ global_gtk_progress_bar,
+ "trough",
+ ctrl.ClientRectangle.X,
+ ctrl.ClientRectangle.Y,
+ ctrl.ClientRectangle.Width,
+ ctrl.ClientRectangle.Height);
+
+ // don't draw the bar if Value is = 0
+ if (ctrl.Value == 0)
+ return;
+
+ if (ctrl.Value == ctrl.Maximum)
+ barpos_pixels = client_area.Width + 2;
+ else
+ barpos_pixels = (((ctrl.Value - ctrl.Minimum) * client_area.Width) / (ctrl.Maximum - ctrl.Minimum)) + 1;
+
+ gtk_paint_box (progressbar_style,
+ gdkwindow,
+ (int) StateType.Prelight,
+ (int) ShadowType.Out,
+ IntPtr.Zero,
+ global_gtk_vscrollbar,
+ "bar",
+ client_area.X - 1, client_area.Y - 1,
+ barpos_pixels, client_area.Height + 2);
+ }
+ #endregion // ProgressBar
+
+ #region RadioButton
+ protected override void RadioButton_DrawButton (RadioButton radio_button, Graphics dc, ButtonState state, Rectangle radiobutton_rectangle)
+ {
+ // we currently don't care for flat or popup radio buttons
+ if (radio_button.appearance == Appearance.Button) {
+ DrawButtonBase (dc, radio_button.ClientRectangle, radio_button);
+ } else {
+ DrawRadioButton (dc, radio_button, state, radiobutton_rectangle);
+ }
+ }
+
+ private void DrawRadioButton (Graphics dc, RadioButton radio_button, ButtonState state, Rectangle radiobutton_rectangle)
+ {
+ IntPtr gdkwindow = gdk_window_foreign_new_for_display (gdkdisplay, (uint) radio_button.Handle);
+
+ IntPtr radiobutton_style = gtk_style_attach (global_gtk_radio_button_style, gdkwindow);
+
+ current_gdk_window = gdkwindow;
+ current_style = radiobutton_style;
+
+ ShadowType shadow_type;
+
+ if (!radio_button.Enabled)
+ shadow_type = ShadowType.Out;
+ else
+ shadow_type = radio_button.Checked ? ShadowType.In : ShadowType.EtchedIn;
+
+ StateType state_type = StateType.Normal;
+
+ if (!radio_button.Enabled)
+ state_type = StateType.Insensitive;
+ else
+ if (radio_button.is_pressed)
+ state_type = StateType.Active;
+ else
+ if (radio_button.is_entered)
+ state_type = StateType.Prelight;
+
+ gtk_paint_option (radiobutton_style,
+ gdkwindow,
+ (int) state_type,
+ (int) shadow_type,
+ IntPtr.Zero,
+ global_gtk_radio_button,
+ "radiobutton",
+ radiobutton_rectangle.X,
+ radiobutton_rectangle.Y,
+ radiobutton_rectangle.Width,
+ radiobutton_rectangle.Height);
+ }
+
+ protected override void RadioButton_DrawText (RadioButton radio_button, Rectangle text_rectangle, Graphics dc, StringFormat text_format)
+ {
+ if (radio_button.Appearance != Appearance.Button)
+ base.RadioButton_DrawText (radio_button, text_rectangle, dc, text_format);
+ }
+
+ protected override void RadioButton_DrawFocus (RadioButton radio_button, Graphics dc, Rectangle text_rectangle)
+ {
+ if (radio_button.Focused && radio_button.appearance != Appearance.Button) {
+ gtk_paint_focus (current_style,
+ current_gdk_window,
+ (int) StateType.Active,
+ IntPtr.Zero,
+ IntPtr.Zero,
+ "radiobutton",
+ text_rectangle.X,
+ text_rectangle.Y,
+ text_rectangle.Width,
+ text_rectangle.Height);
+ }
+ }
+ #endregion // RadioButton
+
+ #region CheckBox
+ protected override void CheckBox_DrawCheckBox (Graphics dc, CheckBox checkbox, ButtonState state, Rectangle checkbox_rectangle)
+ {
+ // render as per normal button
+ if (checkbox.appearance == Appearance.Button) {
+ DrawButtonBase (dc, checkbox.ClientRectangle, checkbox);
+ } else {
+ InternalDrawCheckBox (dc, checkbox, state, checkbox_rectangle);
+ }
+ }
+
+ private void InternalDrawCheckBox (Graphics dc, CheckBox checkbox, ButtonState state, Rectangle checkbox_rectangle)
+ {
+ IntPtr gdkwindow = gdk_window_foreign_new_for_display (gdkdisplay, (uint) checkbox.Handle);
+
+ IntPtr checkbox_style = gtk_style_attach (global_gtk_check_button_style, gdkwindow);
+
+ current_gdk_window = gdkwindow;
+ current_style = checkbox_style;
+
+ ShadowType shadow_type;
+
+ if (!checkbox.Enabled)
+ shadow_type = ShadowType.Out;
+ else
+ shadow_type = checkbox.Checked ? ShadowType.In : ShadowType.EtchedIn;
+
+ StateType state_type = StateType.Normal;
+
+ if (!checkbox.Enabled)
+ state_type = StateType.Insensitive;
+ else
+ if (checkbox.is_pressed)
+ state_type = StateType.Active;
+ else
+ if (checkbox.is_entered)
+ state_type = StateType.Prelight;
+
+ gtk_paint_check (checkbox_style,
+ gdkwindow,
+ (int) state_type,
+ (int) shadow_type,
+ IntPtr.Zero,
+ global_gtk_radio_button,
+ "checkbutton",
+ checkbox_rectangle.X,
+ checkbox_rectangle.Y,
+ checkbox_rectangle.Width,
+ checkbox_rectangle.Height);
+ }
+
+ protected override void CheckBox_DrawText (CheckBox checkbox, Rectangle text_rectangle, Graphics dc, StringFormat text_format)
+ {
+ if (checkbox.Appearance != Appearance.Button)
+ base.CheckBox_DrawText (checkbox, text_rectangle, dc, text_format);
+ }
+
+ protected override void CheckBox_DrawFocus( CheckBox checkbox, Graphics dc, Rectangle text_rectangle )
+ {
+ if (checkbox.Focused && checkbox.appearance != Appearance.Button) {
+ gtk_paint_focus (current_style,
+ current_gdk_window,
+ (int) StateType.Active,
+ IntPtr.Zero,
+ IntPtr.Zero,
+ "checkbutton",
+ text_rectangle.X,
+ text_rectangle.Y,
+ text_rectangle.Width,
+ text_rectangle.Height);
+ }
+ }
+ #endregion // CheckBox
+
+ public override void CPDrawButton (Graphics graphics, Rectangle rectangle, ButtonState state)
+ {
+ bool is_pushed = false;
+// bool is_checked = false;
+// bool is_flat = false;
+ bool is_inactive = false;
+
+ if ((state & ButtonState.Pushed) != 0) {
+ is_pushed = true;
+ }
+
+// if ((state & ButtonState.Checked) != 0) {
+// is_checked = true;
+// }
+//
+// if ((state & ButtonState.Flat) != 0) {
+// is_flat = true;
+// }
+
+ if ((state & ButtonState.Inactive) != 0) {
+ is_inactive = true;
+ }
+
+ IntPtr drawbutton_style = gtk_style_attach (global_gtk_button_style, current_gdk_window); // need it
+
+ StateType state_type = StateType.Normal;
+ ShadowType shadow_type = ShadowType.Out;
+ string detail = "buttondefault";
+
+ if (is_inactive) {
+ state_type = StateType.Insensitive;
+ } else
+ if (is_pushed) {
+ state_type = StateType.Active;
+ shadow_type = ShadowType.In;
+ detail = "button";
+ }
+
+ gtk_paint_box (drawbutton_style, current_gdk_window,
+ (int) state_type,
+ (int) shadow_type,
+ IntPtr.Zero,
+ IntPtr.Zero,
+ detail,
+ rectangle.X, rectangle.Y,
+ rectangle.Width, rectangle.Height);
+ }
+
+ /* Scroll button: regular button + direction arrow */
+ public override void CPDrawScrollButton (Graphics dc, Rectangle area, ScrollButton scroll_button_type, ButtonState state)
+ {
+ bool enabled = (state == ButtonState.Inactive) ? false: true;
+
+ StateType state_type = enabled ? StateType.Normal : StateType.Insensitive;
+
+ DrawScrollButtonPrimitive (dc, area, state, scroll_button_type);
+
+ if (area.Width < 12 || area.Height < 12) /* Cannot see a thing at smaller sizes */
+ return;
+
+ ArrowType arrow_type = 0;
+
+ switch (scroll_button_type) {
+ case ScrollButton.Up:
+ arrow_type = ArrowType.Up;
+ break;
+ case ScrollButton.Down:
+ arrow_type = ArrowType.Down;
+ break;
+ case ScrollButton.Right:
+ arrow_type = ArrowType.Right;
+ break;
+ case ScrollButton.Left:
+ arrow_type = ArrowType.Left;
+ break;
+ default:
+ break;
+ }
+
+ int centerX = area.Left + area.Width / 2;
+ int centerY = area.Top + area.Height / 2;
+ int arrow_x = 0, arrow_y = 0, arrow_height = 0, arrow_width = 0;
+
+ switch (scroll_button_type) {
+ case ScrollButton.Down:
+ case ScrollButton.Up:
+ arrow_x = centerX - 4;
+ arrow_y = centerY - 2;
+ arrow_width = 8;
+ arrow_height = 4;
+ break;
+ case ScrollButton.Left:
+ case ScrollButton.Right:
+ arrow_x = centerX - 2;
+ arrow_y = centerY - 4;
+ arrow_width = 4;
+ arrow_height = 8;
+ break;
+ default:
+ break;
+ }
+
+ gtk_paint_arrow (current_style,
+ current_gdk_window,
+ (int) state_type,
+ (int) ShadowType.Out,
+ IntPtr.Zero,
+ IntPtr.Zero,
+ "",
+ (int) arrow_type, true,
+ arrow_x,
+ arrow_y,
+ arrow_width, arrow_height);
+ }
+
+ public void DrawScrollButtonPrimitive (Graphics dc, Rectangle area, ButtonState state, ScrollButton scroll_button_type)
+ {
+ StateType state_type = StateType.Normal;
+ ShadowType shadow_type = ShadowType.Out;
+
+ if ((state & ButtonState.Pushed) == ButtonState.Pushed) {
+ state_type = StateType.Active;
+ shadow_type = ShadowType.In;
+ }
+
+ switch (scroll_button_type) {
+ case ScrollButton.Left:
+ case ScrollButton.Right:
+ gtk_paint_box (current_style,
+ current_gdk_window,
+ (int) state_type,
+ (int) shadow_type,
+ IntPtr.Zero,
+ global_gtk_hscrollbar,
+ "stepper",
+ area.X, area.Y,
+ area.Width, area.Height);
+ break;
+ case ScrollButton.Up:
+ case ScrollButton.Down:
+ gtk_paint_box (current_style,
+ current_gdk_window,
+ (int) state_type,
+ (int) shadow_type,
+ IntPtr.Zero,
+ global_gtk_vscrollbar,
+ "stepper",
+ area.X, area.Y,
+ area.Width, area.Height);
+ break;
+ }
+ }
+
+ private static Color ColorFromGdkColor (GdkColorStruct gtkcolor)
+ {
+ return Color.FromArgb (255,
+ (gtkcolor.red >> 8) & 0xff,
+ (gtkcolor.green >> 8) & 0xff,
+ (gtkcolor.blue >> 8) & 0xff );
+ }
+
+ } //class
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeNice.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeNice.cs
new file mode 100644
index 00000000000..b949eff8579
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeNice.cs
@@ -0,0 +1,1423 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Alexander Olk, xenomorph2@onlinehome.de
+//
+// based on ThemeWin32Classic
+//
+// - You can activate this Theme with export MONO_THEME=nice
+
+
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Drawing.Imaging;
+using System.Drawing.Text;
+
+namespace System.Windows.Forms
+{
+ internal class ThemeNice : ThemeWin32Classic
+ {
+ public override Version Version
+ {
+ get {
+ return new Version( 0, 0, 0, 2 );
+ }
+ }
+
+ static readonly Color NormalColor = Color.LightGray;
+ static readonly Color MouseOverColor = Color.DarkGray;
+ static readonly Color PressedColor = Color.Gray;
+ static readonly Color FocusColor = Color.FromArgb( System.Convert.ToInt32( "0xff00c0ff", 16 ) );
+ static readonly Color LightColor = Color.LightGray;
+ static readonly Color BorderColor = MouseOverColor;
+ static readonly Color NiceBackColor = Color.FromArgb( System.Convert.ToInt32( "0xffefebe7", 16 ) );
+
+ static Bitmap size_grip_bmp = CreateSizegripDot();
+
+ #region Principal Theme Methods
+ public ThemeNice( )
+ {
+ ColorControl = NiceBackColor;
+ always_draw_hotkeys = true;
+ }
+
+ public override Color DefaultControlBackColor
+ {
+ get { return NiceBackColor; }
+ }
+
+ public override Color DefaultWindowBackColor
+ {
+ get { return NiceBackColor; }
+ }
+
+ public override Color ColorControl {
+ get { return NiceBackColor;}
+ }
+
+ static Bitmap CreateSizegripDot()
+ {
+ Bitmap bmp = new Bitmap( 4, 4 );
+ using ( Graphics dc = Graphics.FromImage( bmp ) )
+ {
+ SmoothingMode old_smoothing_mode = dc.SmoothingMode;
+ dc.SmoothingMode = SmoothingMode.AntiAlias;
+
+ using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( 0, 0 ), new Point( 4, 4 ), PressedColor, Color.White ) )
+ dc.FillEllipse( lgbr, new Rectangle( 0, 0, 4, 4 ) );
+
+ dc.SmoothingMode = old_smoothing_mode;
+ }
+
+ return bmp;
+ }
+ #endregion // Internal Methods
+
+ #region ButtonBase
+ protected override void ButtonBase_DrawButton( ButtonBase button, Graphics dc )
+ {
+ Rectangle buttonRectangle;
+
+ int width = button.ClientSize.Width;
+ int height = button.ClientSize.Height;
+
+ dc.FillRectangle( ResPool.GetSolidBrush( button.BackColor ), button.ClientRectangle );
+
+ // set up the button rectangle
+ buttonRectangle = button.ClientRectangle;
+
+ Color use_color;
+ Color first_color = button.has_focus ? Color.LightYellow : Color.White;
+
+ if ( ( ( button is CheckBox ) && ( ( (CheckBox)button ).check_state == CheckState.Checked ) ) ||
+ ( ( button is RadioButton ) && ( ( (RadioButton)button ).check_state == CheckState.Checked ) ) )
+ {
+ use_color = PressedColor;
+ }
+ else
+ if ( !button.is_enabled )
+ {
+ use_color = NormalColor;
+ button.is_entered = false;
+ }
+ else
+ if ( !button.is_entered )
+ {
+ use_color = NormalColor;
+ }
+ else
+ {
+ if ( !button.is_pressed )
+ use_color = MouseOverColor;
+ else
+ use_color = PressedColor;
+ }
+
+ // Fill button with a nice linear gradient brush
+ Rectangle lgbRectangle = Rectangle.Inflate( buttonRectangle, -1, -1 );
+
+ if ( button.flat_style != FlatStyle.Popup || ( ( button.flat_style == FlatStyle.Popup ) && button.is_entered ) )
+ {
+ LinearGradientBrush lgbr;
+ if ( button.flat_style == FlatStyle.Flat )
+ lgbr = new LinearGradientBrush( new Point( 0, 0 ), new Point( 0, height - 1 ), use_color, first_color );
+ else
+ lgbr = new LinearGradientBrush( new Point( 0, 0 ), new Point( 0, height - 1 ), first_color, use_color );
+ dc.FillRectangle( lgbr, lgbRectangle );
+ lgbr.Dispose( );
+
+ if ( button.has_focus )
+ return;
+
+ Point[] points = new Point[] {
+ new Point( 2, 0 ),
+ new Point( width - 3, 0 ),
+ new Point( width - 1, 2 ),
+ new Point( width - 1, height - 3 ),
+ new Point( width - 3, height - 1 ),
+ new Point( 2, height - 1 ),
+ new Point( 0, height - 3 ),
+ new Point( 0, 2 ),
+ new Point( 2, 0 )
+ };
+
+ Pen pen = ResPool.GetPen( BorderColor );
+ dc.DrawLines( pen, points );
+ }
+ }
+
+ protected override void ButtonBase_DrawFocus( ButtonBase button, Graphics dc )
+ {
+ int width = button.ClientSize.Width;
+ int height = button.ClientSize.Height;
+
+ Point[] points = new Point[] {
+ new Point( 2, 0 ),
+ new Point( width - 3, 0 ),
+ new Point( width - 1, 2 ),
+ new Point( width - 1, height - 3 ),
+ new Point( width - 3, height - 1 ),
+ new Point( 2, height - 1 ),
+ new Point( 0, height - 3 ),
+ new Point( 0, 2 ),
+ new Point( 2, 0 )
+ };
+
+ Pen pen = ResPool.GetPen( FocusColor );
+ dc.DrawLines( pen, points );
+ }
+
+ protected override void ButtonBase_DrawText( ButtonBase button, Graphics dc )
+ {
+ if ( !( button is CheckBox ) && !(button is RadioButton ) )
+ {
+ base.ButtonBase_DrawText( button, dc );
+ }
+ }
+ #endregion // ButtonBase
+
+ #region CheckBox
+ protected override void CheckBox_DrawCheckBox( Graphics dc, CheckBox checkbox, ButtonState state, Rectangle checkbox_rectangle )
+ {
+ dc.FillRectangle( ResPool.GetSolidBrush( checkbox.BackColor ), checkbox.ClientRectangle );
+ // render as per normal button
+ if ( checkbox.appearance == Appearance.Button )
+ {
+ DrawButtonBase( dc, checkbox.ClientRectangle, checkbox );
+ }
+ else
+ {
+ // establish if we are rendering a flat style of some sort
+ if ( checkbox.FlatStyle == FlatStyle.Flat || checkbox.FlatStyle == FlatStyle.Popup )
+ {
+ DrawFlatStyleCheckBox( dc, checkbox_rectangle, checkbox );
+ }
+ else
+ {
+ ControlPaint.DrawCheckBox( dc, checkbox_rectangle, state );
+ }
+ }
+ }
+ #endregion // CheckBox
+
+ #region ComboBox
+
+ // Drawing
+
+ public override void DrawComboBoxEditDecorations( Graphics dc, ComboBox ctrl, Rectangle cl )
+ {
+ if ( !ctrl.Focused )
+ {
+ dc.DrawLine (ResPool.GetPen (BorderColor), cl.X, cl.Y, cl.X + cl.Width, cl.Y); //top
+ dc.DrawLine (ResPool.GetPen (ColorControl), cl.X + 1, cl.Y + 1, cl.X + cl.Width - 2, cl.Y + 1);
+ dc.DrawLine (ResPool.GetPen (BorderColor), cl.X, cl.Y, cl.X, cl.Y + cl.Height); //left
+ dc.DrawLine (ResPool.GetPen (ColorControl), cl.X + 1, cl.Y + 1, cl.X + 1, cl.Y + cl.Height - 2);
+ dc.DrawLine (ResPool.GetPen (BorderColor), cl.X + cl.Width - 1, cl.Y, cl.X + cl.Width - 1, cl.Y + cl.Height); //right
+ dc.DrawLine (ResPool.GetPen (ColorControl), cl.X + cl.Width - 2, cl.Y + 1 , cl.X + cl.Width - 2, cl.Y + cl.Height - 1);
+ dc.DrawLine (ResPool.GetPen (BorderColor), cl.X, cl.Y + cl.Height - 2, cl.X + cl.Width, cl.Y + cl.Height - 2); //down
+ dc.DrawLine (ResPool.GetPen (ColorControl), cl.X, cl.Y + cl.Height - 1, cl.X + cl.Width, cl.Y + cl.Height - 1);
+ }
+ else
+ {
+ dc.DrawLine (ResPool.GetPen (FocusColor), cl.X, cl.Y, cl.X + cl.Width, cl.Y); //top
+ dc.DrawLine (ResPool.GetPen (ColorControl), cl.X + 1, cl.Y + 1, cl.X + cl.Width - 2, cl.Y + 1);
+ dc.DrawLine (ResPool.GetPen (FocusColor), cl.X, cl.Y, cl.X, cl.Y + cl.Height); //left
+ dc.DrawLine (ResPool.GetPen (ColorControl), cl.X + 1, cl.Y + 1, cl.X + 1, cl.Y + cl.Height - 2);
+ dc.DrawLine (ResPool.GetPen (FocusColor), cl.X + cl.Width - 1, cl.Y, cl.X + cl.Width - 1, cl.Y + cl.Height); //right
+ dc.DrawLine (ResPool.GetPen (ColorControl), cl.X + cl.Width - 2, cl.Y + 1 , cl.X + cl.Width - 2, cl.Y + cl.Height - 1);
+ dc.DrawLine (ResPool.GetPen (FocusColor), cl.X, cl.Y + cl.Height - 2, cl.X + cl.Width, cl.Y + cl.Height - 2); //down
+ dc.DrawLine (ResPool.GetPen (FocusColor), cl.X, cl.Y + cl.Height - 1, cl.X + cl.Width, cl.Y + cl.Height - 1);
+ }
+ }
+
+ public override void DrawComboListBoxDecorations( Graphics dc, ComboBox ctrl, Rectangle cl )
+ {
+ if ( ctrl.DropDownStyle == ComboBoxStyle.Simple )
+ {
+ DrawComboBoxEditDecorations( dc, ctrl, cl );
+ }
+ else
+ {
+ dc.DrawRectangle( ResPool.GetPen( ThemeEngine.Current.ColorWindowFrame ), cl.X, cl.Y, cl.Width - 1, cl.Height - 1 );
+ }
+ }
+ #endregion ComboBox
+
+ #region Menus
+ public override void DrawMenuItem( MenuItem item, DrawItemEventArgs e )
+ {
+ StringFormat string_format;
+ Rectangle rect_text = e.Bounds;
+
+ if ( item.Visible == false )
+ return;
+
+ if ( item.MenuBar )
+ {
+ string_format = string_format_menu_menubar_text;
+ }
+ else
+ {
+ string_format = string_format_menu_text;
+ }
+
+ if ( item.Separator )
+ {
+ e.Graphics.DrawLine( ThemeEngine.Current.ResPool.GetPen( BorderColor ),
+ e.Bounds.X, e.Bounds.Y, e.Bounds.X + e.Bounds.Width, e.Bounds.Y );
+
+ e.Graphics.DrawLine( ThemeEngine.Current.ResPool.GetPen( Color.White ),
+ e.Bounds.X + 1, e.Bounds.Y + 1, e.Bounds.X + e.Bounds.Width, e.Bounds.Y + 1 );
+
+ return;
+ }
+
+ if ( !item.MenuBar )
+ rect_text.X += ThemeEngine.Current.MenuCheckSize.Width;
+
+ if ( item.BarBreak )
+ { /* Draw vertical break bar*/
+ Rectangle rect = e.Bounds;
+ rect.Y++;
+ rect.Width = 3;
+ rect.Height = item.MenuHeight - 6;
+
+ e.Graphics.DrawLine( ThemeEngine.Current.ResPool.GetPen( LightColor ),
+ rect.X, rect.Y , rect.X, rect.Y + rect.Height );
+
+ e.Graphics.DrawLine( ThemeEngine.Current.ResPool.GetPen( ThemeEngine.Current.ColorControlLight ),
+ rect.X + 1, rect.Y , rect.X + 1, rect.Y + rect.Height );
+ }
+
+ Color color_text = ThemeEngine.Current.ColorMenuText;
+ Color color_back;
+
+ /* Draw background */
+ Rectangle rect_back = e.Bounds;
+ rect_back.X++;
+ rect_back.Width -= 2;
+
+ if ( ( e.State & DrawItemState.Selected ) == DrawItemState.Selected )
+ {
+ color_text = ThemeEngine.Current.ColorMenuText;
+ color_back = NormalColor;
+
+ using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( rect_back.X, rect_back.Y ), new Point( rect_back.Right, rect_back.Y ), Color.White, NormalColor ) )//NormalColor, Color.White ) )
+ {
+ e.Graphics.FillRectangle( lgbr, rect_back );
+ }
+
+ rect_back.Height--;
+ e.Graphics.DrawRectangle( ResPool.GetPen( BorderColor ), rect_back );
+ }
+ else
+ {
+ color_text = ThemeEngine.Current.ColorMenuText;
+ color_back = NiceBackColor;
+
+ e.Graphics.FillRectangle( ThemeEngine.Current.ResPool.GetSolidBrush( NiceBackColor ), rect_back );
+ }
+
+ if ( item.Enabled )
+ {
+ e.Graphics.DrawString( item.Text, e.Font,
+ ThemeEngine.Current.ResPool.GetSolidBrush( color_text ),
+ rect_text, string_format );
+
+ if ( !item.MenuBar && item.Shortcut != Shortcut.None && item.ShowShortcut )
+ {
+ string str = item.GetShortCutText( );
+ Rectangle rect = rect_text;
+ rect.X = item.XTab;
+ rect.Width -= item.XTab;
+
+ e.Graphics.DrawString( str, e.Font, ThemeEngine.Current.ResPool.GetSolidBrush( color_text ),
+ rect, string_format_menu_shortcut );
+ }
+ }
+ else
+ {
+ ControlPaint.DrawStringDisabled( e.Graphics, item.Text, e.Font,
+ Color.Black, rect_text, string_format );
+ }
+
+ /* Draw arrow */
+ if ( item.MenuBar == false && item.IsPopup )
+ {
+ int cx = ThemeEngine.Current.MenuCheckSize.Width;
+ int cy = ThemeEngine.Current.MenuCheckSize.Height;
+ using ( Bitmap bmp = new Bitmap( cx, cy ) )
+ {
+ using ( Graphics dc = Graphics.FromImage( bmp ) )
+ {
+ SmoothingMode old_smoothing_mode = dc.SmoothingMode;
+ dc.SmoothingMode = SmoothingMode.AntiAlias;
+
+ Rectangle rect_arrow = new Rectangle( 0, 0, cx, cy );
+ ControlPaint.DrawMenuGlyph( dc, rect_arrow, MenuGlyph.Arrow );
+ bmp.MakeTransparent( );
+
+ if ( item.Enabled )
+ {
+ e.Graphics.DrawImage( bmp, e.Bounds.X + e.Bounds.Width - cx,
+ e.Bounds.Y + ( ( e.Bounds.Height - cy ) / 2 ) );
+ }
+ else
+ {
+ ControlPaint.DrawImageDisabled( e.Graphics, bmp, e.Bounds.X + e.Bounds.Width - cx,
+ e.Bounds.Y + ( ( e.Bounds.Height - cy ) / 2 ), color_back );
+ }
+
+ dc.SmoothingMode = old_smoothing_mode;
+ }
+ }
+ }
+
+ /* Draw checked or radio */
+ if ( item.MenuBar == false && item.Checked )
+ {
+
+ Rectangle area = e.Bounds;
+ int cx = ThemeEngine.Current.MenuCheckSize.Width;
+ int cy = ThemeEngine.Current.MenuCheckSize.Height;
+ using ( Bitmap bmp = new Bitmap( cx, cy ) )
+ {
+ using ( Graphics gr = Graphics.FromImage( bmp ) )
+ {
+ Rectangle rect_arrow = new Rectangle( 0, 0, cx, cy );
+
+ if ( item.RadioCheck )
+ ControlPaint.DrawMenuGlyph( gr, rect_arrow, MenuGlyph.Bullet );
+ else
+ ControlPaint.DrawMenuGlyph( gr, rect_arrow, MenuGlyph.Checkmark );
+
+ bmp.MakeTransparent( );
+ e.Graphics.DrawImage( bmp, area.X, e.Bounds.Y + ( ( e.Bounds.Height - cy ) / 2 ) );
+ }
+ }
+ }
+ }
+
+ public override void DrawPopupMenu (Graphics dc, Menu menu, Rectangle cliparea, Rectangle rect)
+ {
+
+ dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush
+ (NiceBackColor), cliparea);
+
+ /* Draw menu borders */
+ dc.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorHighlightText),
+ rect.X, rect.Y, rect.X + rect.Width, rect.Y);
+
+ dc.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorHighlightText),
+ rect.X, rect.Y, rect.X, rect.Y + rect.Height);
+
+ dc.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorControlDark),
+ rect.X + rect.Width - 1 , rect.Y , rect.X + rect.Width - 1, rect.Y + rect.Height);
+
+ dc.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorControlDarkDark),
+ rect.X + rect.Width, rect.Y , rect.X + rect.Width, rect.Y + rect.Height);
+
+ dc.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorControlDark),
+ rect.X , rect.Y + rect.Height - 1 , rect.X + rect.Width - 1, rect.Y + rect.Height -1);
+
+ dc.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorControlDarkDark),
+ rect.X , rect.Y + rect.Height, rect.X + rect.Width - 1, rect.Y + rect.Height);
+
+ for (int i = 0; i < menu.MenuItems.Count; i++)
+ if (cliparea.IntersectsWith (menu.MenuItems [i].bounds)) {
+ MenuItem item = menu.MenuItems [i];
+ item.MenuHeight = menu.Height;
+ item.PerformDrawItem (new DrawItemEventArgs (dc, ThemeEngine.Current.MenuFont,
+ item.bounds, i, item.Status));
+ }
+ }
+ #endregion // Menus
+
+ #region ProgressBar
+ public override void DrawProgressBar( Graphics dc, Rectangle clip_rect, ProgressBar ctrl )
+ {
+ Rectangle client_area = ctrl.client_area;
+ int barpos_pixels;
+ Rectangle bar = ctrl.client_area;
+
+ barpos_pixels = ( ( ctrl.Value - ctrl.Minimum ) * client_area.Width ) / ( ctrl.Maximum - ctrl.Minimum );
+
+ bar.Width = barpos_pixels;
+// bar.Height += 1;
+
+ // Draw bar background
+ using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( client_area.Left, client_area.Top ), new Point( client_area.Left, client_area.Bottom ), LightColor, Color.White ) )
+ {
+ dc.FillRectangle( lgbr, client_area );
+ }
+
+ // Draw bar
+ using ( LinearGradientBrush lgbr = new LinearGradientBrush( bar.Location, new Point( bar.X, bar.Bottom ), Color.White, FocusColor ) )
+ {
+ dc.FillRectangle( lgbr, bar );
+ }
+
+ /* Draw border */
+ dc.DrawRectangle( ResPool.GetPen( BorderColor ), ctrl.ClientRectangle.X, ctrl.ClientRectangle.Y, ctrl.ClientRectangle.Width - 1, ctrl.ClientRectangle.Height - 1 );
+ dc.DrawRectangle( ResPool.GetPen( LightColor ), ctrl.ClientRectangle.X + 1, ctrl.ClientRectangle.Y + 1, ctrl.ClientRectangle.Width - 2, ctrl.ClientRectangle.Height - 2 );
+ }
+ #endregion // ProgressBar
+
+ #region RadioButton
+ protected override void RadioButton_DrawButton( RadioButton radio_button, Graphics dc, ButtonState state, Rectangle radiobutton_rectangle )
+ {
+ SolidBrush sb = new SolidBrush( radio_button.BackColor );
+ dc.FillRectangle( sb, radio_button.ClientRectangle );
+ sb.Dispose( );
+
+ if (radio_button.appearance==Appearance.Button) {
+ if (radio_button.FlatStyle == FlatStyle.Flat || radio_button.FlatStyle == FlatStyle.Popup) {
+ DrawFlatStyleButton(dc, radio_button.ClientRectangle, radio_button);
+ } else {
+ DrawButtonBase( dc, radio_button.ClientRectangle, radio_button );
+ }
+ } else {
+ // establish if we are rendering a flat style of some sort
+ if ( radio_button.FlatStyle == FlatStyle.Flat || radio_button.FlatStyle == FlatStyle.Popup ) {
+ DrawFlatStyleRadioButton (dc, radiobutton_rectangle, radio_button);
+ } else {
+ ControlPaint.DrawRadioButton( dc, radiobutton_rectangle, state );
+ }
+ }
+ }
+
+ protected override void RadioButton_DrawFocus(RadioButton radio_button, Graphics dc, Rectangle text_rectangle)
+ {
+ if (radio_button.Focused && radio_button.appearance != Appearance.Button)
+ {
+ if (radio_button.FlatStyle != FlatStyle.Flat && radio_button.FlatStyle != FlatStyle.Popup)
+ {
+ DrawInnerFocusRectangle (dc, text_rectangle, radio_button.BackColor);
+ }
+ }
+ }
+ #endregion // RadioButton
+
+ #region ScrollBar
+ protected override void ScrollBar_DrawThumb( ScrollBar bar, Rectangle thumb_pos, Rectangle clip, Graphics dc )
+ {
+ if ( bar.Enabled && thumb_pos.Width > 0 && thumb_pos.Height > 0 && clip.IntersectsWith( thumb_pos ) )
+ DrawScrollBarThumb( dc, thumb_pos, bar );
+ }
+
+ protected override void ScrollBar_Vertical_Draw_ThumbMoving_None( int scrollbutton_height, ScrollBar bar, Rectangle clip, Graphics dc )
+ {
+ Rectangle r = new Rectangle( 0,
+ scrollbutton_height, bar.ClientRectangle.Width, bar.ClientRectangle.Height - ( scrollbutton_height * 2 ) );
+ Rectangle intersect = Rectangle.Intersect( clip, r );
+
+ if ( intersect != Rectangle.Empty )
+ {
+ using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( 0, 0 ), new Point( r. Width - 1, 0 ), LightColor, Color.White ) )
+ {
+ dc.FillRectangle( lgbr, intersect );
+ }
+ }
+ }
+
+ protected override void ScrollBar_Vertical_Draw_ThumbMoving_Forward( int scrollbutton_height, ScrollBar bar, Rectangle thumb_pos, Rectangle clip, Graphics dc )
+ {
+ Rectangle r = new Rectangle( 0, scrollbutton_height,
+ bar.ClientRectangle.Width, thumb_pos.Y - scrollbutton_height );
+ Rectangle intersect = Rectangle.Intersect( clip, r );
+
+ using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( 0, 0 ), new Point( r. Width - 1, 0 ), LightColor, Color.White ) )
+ {
+ if ( intersect != Rectangle.Empty )
+ dc.FillRectangle( lgbr, intersect );
+
+ r.X = 0;
+ r.Y = thumb_pos.Y + thumb_pos.Height;
+ r.Width = bar.ClientRectangle.Width;
+ r.Height = bar.ClientRectangle.Height - ( thumb_pos.Y + thumb_pos.Height ) - scrollbutton_height;
+
+ intersect = Rectangle.Intersect( clip, r );
+ if ( intersect != Rectangle.Empty )
+ dc.FillRectangle( lgbr, intersect );
+ }
+ }
+
+ protected override void ScrollBar_Vertical_Draw_ThumbMoving_Backwards( int scrollbutton_height, ScrollBar bar, Rectangle thumb_pos, Rectangle clip, Graphics dc )
+ {
+ Rectangle r = new Rectangle( 0, scrollbutton_height,
+ bar.ClientRectangle.Width, thumb_pos.Y - scrollbutton_height );
+ Rectangle intersect = Rectangle.Intersect( clip, r );
+
+ using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( 0, 0 ), new Point( r. Width - 1, 0 ), LightColor, Color.White ) )
+ {
+ if ( intersect != Rectangle.Empty )
+ dc.FillRectangle( lgbr, intersect );
+
+ r.X = 0;
+ r.Y = thumb_pos.Y + thumb_pos.Height;
+ r.Width = bar.ClientRectangle.Width;
+ r.Height = bar.ClientRectangle.Height - ( thumb_pos.Y + thumb_pos.Height ) - scrollbutton_height;
+
+ intersect = Rectangle.Intersect( clip, r );
+ if ( intersect != Rectangle.Empty )
+ dc.FillRectangle( lgbr, intersect );
+ }
+ }
+
+ protected override void ScrollBar_Horizontal_Draw_ThumbMoving_None( int scrollbutton_width, ScrollBar bar, Rectangle clip, Graphics dc )
+ {
+ Rectangle r = new Rectangle( scrollbutton_width,
+ 0, bar.ClientRectangle.Width - ( scrollbutton_width * 2 ), bar.ClientRectangle.Height );
+ Rectangle intersect = Rectangle.Intersect( clip, r );
+
+ if ( intersect != Rectangle.Empty )
+ {
+ using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( 0, 0 ), new Point( 0, r.Height - 1 ), LightColor, Color.White ) )
+ {
+ dc.FillRectangle( lgbr, intersect );
+ }
+ }
+ }
+
+ protected override void ScrollBar_Horizontal_Draw_ThumbMoving_Forward( int scrollbutton_width, Rectangle thumb_pos, ScrollBar bar, Rectangle clip, Graphics dc )
+ {
+ Rectangle r = new Rectangle( scrollbutton_width, 0,
+ thumb_pos.X - scrollbutton_width, bar.ClientRectangle.Height );
+ Rectangle intersect = Rectangle.Intersect( clip, r );
+
+ using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( 0, 0 ), new Point( 0, r.Height - 1 ), LightColor, Color.White ) )
+ {
+ if ( intersect != Rectangle.Empty )
+ dc.FillRectangle( lgbr, intersect );
+
+ r.X = thumb_pos.X + thumb_pos.Width;
+ r.Y = 0;
+ r.Width = bar.ClientRectangle.Width - ( thumb_pos.X + thumb_pos.Width ) - scrollbutton_width;
+ r.Height = bar.ClientRectangle.Height;
+
+ intersect = Rectangle.Intersect( clip, r );
+ if ( intersect != Rectangle.Empty )
+ dc.FillRectangle( lgbr, intersect );
+ }
+ }
+
+ protected override void ScrollBar_Horizontal_Draw_ThumbMoving_Backwards( int scrollbutton_width, Rectangle thumb_pos, ScrollBar bar, Rectangle clip, Graphics dc )
+ {
+ Rectangle r = new Rectangle( scrollbutton_width, 0,
+ thumb_pos.X - scrollbutton_width, bar.ClientRectangle.Height );
+ Rectangle intersect = Rectangle.Intersect( clip, r );
+
+ using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( 0, 0 ), new Point( 0, r.Height - 1 ), LightColor, Color.White ) )
+ {
+ if ( intersect != Rectangle.Empty )
+ dc.FillRectangle( lgbr, intersect );
+
+ r.X = thumb_pos.X + thumb_pos.Width;
+ r.Y = 0;
+ r.Width = bar.ClientRectangle.Width - ( thumb_pos.X + thumb_pos.Width ) - scrollbutton_width;
+ r.Height = bar.ClientRectangle.Height;
+
+ intersect = Rectangle.Intersect( clip, r );
+ if ( intersect != Rectangle.Empty )
+ dc.FillRectangle( lgbr, intersect );
+ }
+ }
+ #endregion // ScrollBar
+
+ #region StatusBar
+ protected override void DrawStatusBarPanel( Graphics dc, Rectangle area, int index,
+ SolidBrush br_forecolor, StatusBarPanel panel )
+ {
+ int border_size = 3; // this is actually const, even if the border style is none
+
+ area.Height -= border_size;
+ if ( panel.BorderStyle != StatusBarPanelBorderStyle.None )
+ {
+ DrawNiceRoundedBorder( dc, area, BorderColor );
+ }
+
+ if ( panel.Style == StatusBarPanelStyle.OwnerDraw )
+ {
+ StatusBarDrawItemEventArgs e = new StatusBarDrawItemEventArgs(
+ dc, panel.Parent.Font, area, index, DrawItemState.Default,
+ panel, panel.Parent.ForeColor, panel.Parent.BackColor );
+ panel.Parent.OnDrawItemInternal( e );
+ return;
+ }
+
+ int left = area.Left;
+ if ( panel.Icon != null )
+ {
+ left += 2;
+ dc.DrawIcon( panel.Icon, left, area.Top );
+ left += panel.Icon.Width;
+ }
+
+ if ( panel.Text == String.Empty )
+ return;
+
+ string text = panel.Text;
+ StringFormat string_format = new StringFormat( );
+ string_format.Trimming = StringTrimming.Character;
+ string_format.FormatFlags = StringFormatFlags.NoWrap;
+
+ if ( text[ 0 ] == '\t' )
+ {
+ string_format.Alignment = StringAlignment.Center;
+ text = text.Substring( 1 );
+ if ( text[ 0 ] == '\t' )
+ {
+ string_format.Alignment = StringAlignment.Far;
+ text = text.Substring( 1 );
+ }
+ }
+
+ int x = left + border_size;
+ int y = border_size + 2;
+ Rectangle r = new Rectangle( x, y,
+ area.Right - x - border_size,
+ area.Bottom - y - border_size );
+
+ dc.DrawString( text, panel.Parent.Font, br_forecolor, r, string_format );
+ }
+
+ private void DrawNiceRoundedBorder( Graphics dc, Rectangle area, Color color )
+ {
+ Pen pen = ResPool.GetPen( color );
+
+ Point[] points = new Point[] {
+ new Point( area.Left + 2, area.Top ),
+ new Point( area.Right - 2, area.Top ),
+ new Point( area.Right, area.Top + 2 ),
+ new Point( area.Right, area.Bottom - 2 ),
+ new Point( area.Right - 2, area.Bottom ),
+ new Point( area.Left + 2, area.Bottom ),
+ new Point( area.Left, area.Bottom - 2 ),
+ new Point( area.Left, area.Top + 2 ),
+ new Point( area.Left + 2, area.Top )
+ };
+
+ dc.DrawLines( pen, points );
+ }
+ #endregion // StatusBar
+
+ public override void DrawTabControl( Graphics dc, Rectangle area, TabControl tab )
+ {
+ // Do we need to fill the back color? It can't be changed...
+ dc.FillRectangle( ResPool.GetSolidBrush( NiceBackColor ), area );
+ Rectangle panel_rect = GetTabPanelRectExt( tab );
+
+ if ( tab.Appearance == TabAppearance.Normal )
+ {
+ CPDrawBorder( dc, panel_rect, BorderColor, 1, ButtonBorderStyle.Solid, BorderColor, 1, ButtonBorderStyle.Solid,
+ BorderColor, 1, ButtonBorderStyle.Solid, BorderColor, 1, ButtonBorderStyle.Solid );
+ }
+
+ if ( tab.Alignment == TabAlignment.Top )
+ {
+ for ( int r = tab.TabPages.Count; r > 0; r-- )
+ {
+ for ( int i = tab.SliderPos; i < tab.TabPages.Count; i++ )
+ {
+ if ( i == tab.SelectedIndex )
+ continue;
+ if ( r != tab.TabPages[ i ].Row )
+ continue;
+ Rectangle rect = tab.GetTabRect( i );
+ if ( !rect.IntersectsWith( area ) )
+ continue;
+ DrawTab( dc, tab.TabPages[ i ], tab, rect, false );
+ }
+ }
+ }
+ else
+ {
+ for ( int r = 0; r < tab.TabPages.Count; r++ )
+ {
+ for ( int i = tab.SliderPos; i < tab.TabPages.Count; i++ )
+ {
+ if ( i == tab.SelectedIndex )
+ continue;
+ if ( r != tab.TabPages[ i ].Row )
+ continue;
+ Rectangle rect = tab.GetTabRect( i );
+ if ( !rect.IntersectsWith( area ) )
+ continue;
+ DrawTab( dc, tab.TabPages[ i ], tab, rect, false );
+ }
+ }
+ }
+
+ if ( tab.SelectedIndex != -1 && tab.SelectedIndex >= tab.SliderPos )
+ {
+ Rectangle rect = tab.GetTabRect( tab.SelectedIndex );
+ if ( rect.IntersectsWith( area ) )
+ DrawTab( dc, tab.TabPages[ tab.SelectedIndex ], tab, rect, true );
+ }
+
+ if ( tab.ShowSlider )
+ {
+ Rectangle right = GetTabControlRightScrollRect( tab );
+ Rectangle left = GetTabControlLeftScrollRect( tab );
+ CPDrawScrollButton( dc, right, ScrollButton.Right, tab.RightSliderState );
+ CPDrawScrollButton( dc, left, ScrollButton.Left, tab.LeftSliderState );
+ }
+ }
+
+ protected override int DrawTab( Graphics dc, TabPage page, TabControl tab, Rectangle bounds, bool is_selected )
+ {
+ int FlatButtonSpacing = 8;
+ Rectangle interior;
+ int res = bounds.Width;
+
+ // we can't fill the background right away because the bounds might be adjusted if the tab is selected
+
+ if ( tab.Appearance == TabAppearance.Buttons || tab.Appearance == TabAppearance.FlatButtons )
+ {
+ dc.FillRectangle( ResPool.GetSolidBrush( NiceBackColor ), bounds );
+
+ // Separators
+ if ( tab.Appearance == TabAppearance.FlatButtons )
+ {
+ int width = bounds.Width;
+ bounds.Width += ( FlatButtonSpacing - 2 );
+ res = bounds.Width;
+ CPDrawBorder3D( dc, bounds, Border3DStyle.Etched, Border3DSide.Right );
+ bounds.Width = width;
+ }
+
+ if ( is_selected )
+ {
+ CPDrawBorder3D( dc, bounds, Border3DStyle.Sunken, Border3DSide.All );
+ }
+ else if ( tab.Appearance != TabAppearance.FlatButtons )
+ {
+ CPDrawBorder3D( dc, bounds, Border3DStyle.Raised, Border3DSide.All );
+ }
+
+ interior = new Rectangle( bounds.Left + 2, bounds.Top + 2, bounds.Width - 4, bounds.Height - 4 );
+
+
+ StringFormat string_format = new StringFormat( );
+ string_format.Alignment = StringAlignment.Center;
+ string_format.LineAlignment = StringAlignment.Center;
+ string_format.FormatFlags = StringFormatFlags.NoWrap;
+
+ interior.Y++;
+ dc.DrawString( page.Text, page.Font, ThemeEngine.Current.ResPool.GetSolidBrush( SystemColors.ControlText ), interior, string_format );
+ interior.Y--;
+ }
+ else
+ {
+ Pen border_pen = ResPool.GetPen( BorderColor );
+
+ dc.FillRectangle( ResPool.GetSolidBrush( NiceBackColor ), bounds );
+
+ switch ( tab.Alignment )
+ {
+ case TabAlignment.Top:
+
+ if ( !is_selected )
+ {
+ interior = new Rectangle( bounds.Left + 2, bounds.Top + 2, bounds.Width - 2, bounds.Height - 2 );
+
+ using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( bounds.Left + 2, bounds.Top + 2 ), new Point( bounds.Left + 2, bounds.Bottom ), Color.White, LightColor ) )
+ {
+ dc.FillRectangle( lgbr, interior );
+ }
+ }
+
+ dc.DrawLine( border_pen, bounds.Left, bounds.Bottom, bounds.Left, bounds.Top + 3 );
+ dc.DrawLine( border_pen, bounds.Left, bounds.Top + 3, bounds.Left + 3, bounds.Top );
+ dc.DrawLine( border_pen, bounds.Left + 3, bounds.Top, bounds.Right - 3, bounds.Top );
+ dc.DrawLine( border_pen, bounds.Right - 3, bounds.Top, bounds.Right, bounds.Top + 3 );
+ dc.DrawLine( border_pen, bounds.Right, bounds.Top + 3, bounds.Right, bounds.Bottom );
+
+ if ( page.Focused )
+ {
+ dc.DrawLine( ResPool.GetPen( Color.DarkOrange ), bounds.Left - 1 , bounds.Top, bounds.Right - 1, bounds.Top );
+ dc.DrawLine( ResPool.GetPen( Color.Orange ), bounds.Left , bounds.Top + 1, bounds.Right , bounds.Top + 1 );
+ dc.DrawLine( ResPool.GetPen( Color.Orange ), bounds.Left , bounds.Top + 2, bounds.Right , bounds.Top + 2 );
+ }
+
+ interior = new Rectangle( bounds.Left + 4, bounds.Top + 4, bounds.Width - 8, bounds.Height - 8 );
+
+ if ( page.Text != String.Empty )
+ {
+ StringFormat string_format = new StringFormat( );
+ string_format.Alignment = StringAlignment.Center;
+ string_format.LineAlignment = StringAlignment.Center;
+ string_format.FormatFlags = StringFormatFlags.NoWrap;
+ interior.Y++;
+ dc.DrawString( page.Text, page.Font, ThemeEngine.Current.ResPool.GetSolidBrush( SystemColors.ControlText ), interior, string_format );
+ interior.Y--;
+ }
+
+ break;
+
+ case TabAlignment.Bottom:
+
+ if ( !is_selected )
+ {
+ interior = new Rectangle( bounds.Left + 3, bounds.Top, bounds.Width - 3, bounds.Height );
+
+ using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( bounds.Left + 3, bounds.Top ), new Point( bounds.Left + 3, bounds.Bottom ), Color.White, LightColor ) )
+ {
+ dc.FillRectangle( lgbr, interior );
+ }
+ }
+
+ dc.DrawLine( border_pen, bounds.Left, bounds.Top, bounds.Left, bounds.Bottom - 3 );
+ dc.DrawLine( border_pen, bounds.Left, bounds.Bottom - 3, bounds.Left + 3, bounds.Bottom );
+ dc.DrawLine( border_pen, bounds.Left + 3, bounds.Bottom, bounds.Right - 3, bounds.Bottom );
+ dc.DrawLine( border_pen, bounds.Right - 3, bounds.Bottom, bounds.Right, bounds.Bottom - 3 );
+ dc.DrawLine( border_pen, bounds.Right, bounds.Bottom - 3, bounds.Right, bounds.Top );
+
+ if ( page.Focused )
+ {
+ dc.DrawLine( ResPool.GetPen( Color.DarkOrange ), bounds.Left - 1 , bounds.Bottom, bounds.Right - 1, bounds.Bottom );
+ dc.DrawLine( ResPool.GetPen( Color.Orange ), bounds.Left , bounds.Bottom - 1, bounds.Right , bounds.Bottom - 1 );
+ dc.DrawLine( ResPool.GetPen( Color.Orange ), bounds.Left , bounds.Bottom - 2, bounds.Right , bounds.Bottom - 2 );
+ }
+
+ interior = new Rectangle( bounds.Left + 4, bounds.Top + 4, bounds.Width - 8, bounds.Height - 8 );
+
+ if ( page.Text != String.Empty )
+ {
+ StringFormat string_format = new StringFormat( );
+ string_format.Alignment = StringAlignment.Center;
+ string_format.LineAlignment = StringAlignment.Center;
+ string_format.FormatFlags = StringFormatFlags.NoWrap;
+ interior.Y++;
+ dc.DrawString( page.Text, page.Font, ThemeEngine.Current.ResPool.GetSolidBrush( SystemColors.ControlText ), interior, string_format );
+ interior.Y--;
+ }
+
+ break;
+
+ case TabAlignment.Left:
+
+ if ( !is_selected )
+ {
+ interior = new Rectangle( bounds.Left + 2, bounds.Top + 2, bounds.Width - 2, bounds.Height - 2 );
+
+ using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( bounds.Left + 2, bounds.Top + 2 ), new Point( bounds.Right, bounds.Top + 2 ), LightColor, Color.White ) )
+ {
+ dc.FillRectangle( lgbr, interior );
+ }
+ }
+
+ dc.DrawLine( border_pen, bounds.Right, bounds.Top, bounds.Left + 3, bounds.Top );
+ dc.DrawLine( border_pen, bounds.Left + 3, bounds.Top, bounds.Left, bounds.Top + 3 );
+ dc.DrawLine( border_pen, bounds.Left, bounds.Top + 3, bounds.Left, bounds.Bottom - 3 );
+ dc.DrawLine( border_pen, bounds.Left, bounds.Bottom - 3, bounds.Left + 3, bounds.Bottom );
+ dc.DrawLine( border_pen, bounds.Left + 3, bounds.Bottom, bounds.Right, bounds.Bottom );
+
+ if ( page.Focused )
+ {
+ dc.DrawLine( ResPool.GetPen( Color.DarkOrange ), bounds.Left , bounds.Top + 1, bounds.Left , bounds.Bottom - 1 );
+ dc.DrawLine( ResPool.GetPen( Color.Orange ), bounds.Left + 1 , bounds.Top, bounds.Left + 1 , bounds.Bottom );
+ dc.DrawLine( ResPool.GetPen( Color.Orange ), bounds.Left + 2 , bounds.Top, bounds.Left + 2 , bounds.Bottom );
+ }
+
+ interior = new Rectangle( bounds.Left + 4, bounds.Top + 4, bounds.Width - 8, bounds.Height - 8 );
+
+ if ( page.Text != String.Empty )
+ {
+ StringFormat string_format = new StringFormat( );
+ // Flip the text around
+ string_format.Alignment = StringAlignment.Center;
+ string_format.LineAlignment = StringAlignment.Center;
+ string_format.FormatFlags = StringFormatFlags.NoWrap;
+ string_format.FormatFlags = StringFormatFlags.DirectionVertical;
+ int wo = interior.Width / 2;
+ int ho = interior.Height / 2;
+ dc.TranslateTransform( interior.X + wo, interior.Y + ho );
+ dc.RotateTransform( 180 );
+ dc.DrawString( page.Text, page.Font, ThemeEngine.Current.ResPool.GetSolidBrush( SystemColors.ControlText ), 0, 0, string_format );
+ dc.ResetTransform( );
+ }
+
+ break;
+
+ default:
+ // TabAlignment.Right
+
+ if ( !is_selected )
+ {
+ interior = new Rectangle( bounds.Left + 2, bounds.Top + 2, bounds.Width - 2, bounds.Height - 2 );
+
+ using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( bounds.Left + 2, bounds.Top + 2 ), new Point( bounds.Right, bounds.Top + 2 ), Color.White, LightColor ) )
+ {
+ dc.FillRectangle( lgbr, interior );
+ }
+ }
+
+ dc.DrawLine( border_pen, bounds.Left, bounds.Top, bounds.Right - 3, bounds.Top );
+ dc.DrawLine( border_pen, bounds.Right - 3, bounds.Top, bounds.Right, bounds.Top + 3 );
+ dc.DrawLine( border_pen, bounds.Right, bounds.Top + 3, bounds.Right, bounds.Bottom - 3 );
+ dc.DrawLine( border_pen, bounds.Right, bounds.Bottom - 3, bounds.Right - 3, bounds.Bottom );
+ dc.DrawLine( border_pen, bounds.Right - 3, bounds.Bottom, bounds.Left, bounds.Bottom );
+
+ if ( page.Focused )
+ {
+ dc.DrawLine( ResPool.GetPen( Color.DarkOrange ), bounds.Right , bounds.Top + 1, bounds.Right , bounds.Bottom - 1 );
+ dc.DrawLine( ResPool.GetPen( Color.Orange ), bounds.Right - 1 , bounds.Top, bounds.Right - 1 , bounds.Bottom );
+ dc.DrawLine( ResPool.GetPen( Color.Orange ), bounds.Right - 2 , bounds.Top, bounds.Right - 2 , bounds.Bottom );
+ }
+
+ interior = new Rectangle( bounds.Left + 4, bounds.Top + 4, bounds.Width - 8, bounds.Height - 8 );
+
+ if ( page.Text != String.Empty )
+ {
+ StringFormat string_format = new StringFormat( );
+ string_format.Alignment = StringAlignment.Center;
+ string_format.LineAlignment = StringAlignment.Center;
+ string_format.FormatFlags = StringFormatFlags.NoWrap;
+ string_format.FormatFlags = StringFormatFlags.DirectionVertical;
+ interior.X++;
+ dc.DrawString( page.Text, page.Font, ThemeEngine.Current.ResPool.GetSolidBrush( SystemColors.ControlText ), interior, string_format );
+ interior.X--;
+ }
+
+ break;
+ }
+ }
+
+ return res;
+ }
+
+ public override void CPDrawComboButton( Graphics dc, Rectangle rectangle, ButtonState state )
+ {
+ Point[] arrow = new Point[ 3 ];
+ Point P1;
+ Point P2;
+ Point P3;
+ int centerX;
+ int centerY;
+ int shiftX;
+ int shiftY;
+ Rectangle rect;
+
+ Color first_color = Color.White;
+ Color second_color = NormalColor;
+
+// rectangle.Width += 1;
+
+ if ( ( state & ButtonState.Checked ) != 0 )
+ {
+ dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, ColorControlLightLight, ColorControlLight ), rectangle );
+ }
+ else
+ dc.FillRectangle( ResPool.GetSolidBrush( Color.White ), rectangle );
+
+ if ( ( state & ButtonState.Flat ) != 0 )
+ {
+ first_color = NormalColor;
+ second_color = Color.White;
+ }
+ else
+ {
+ if ( ( state & ( ButtonState.Pushed | ButtonState.Checked ) ) != 0 )
+ {
+ first_color = Color.White;
+ second_color = PressedColor;
+ }
+// else
+// {
+// CPDrawBorder3D( graphics, rectangle, Border3DStyle.Raised, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorControl );
+// }
+ }
+
+ using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( rectangle.X + 1, rectangle.Y + 1 ), new Point( rectangle.X + 1, rectangle.Bottom - 2 ), first_color, second_color ) )
+ {
+ dc.FillRectangle( lgbr, rectangle.X + 2, rectangle.Y + 1, rectangle.Width - 4, rectangle.Height - 3 );
+ }
+
+ Point[] points = new Point[] {
+ new Point( rectangle.X + 3, rectangle.Y + 1 ),
+ new Point( rectangle.Right - 4, rectangle.Y + 1 ),
+ new Point( rectangle.Right - 2, rectangle.Y + 3 ),
+ new Point( rectangle.Right - 2, rectangle.Bottom - 4 ),
+ new Point( rectangle.Right - 4, rectangle.Bottom - 2 ),
+ new Point( rectangle.X + 3, rectangle.Bottom - 2 ),
+ new Point( rectangle.X + 1, rectangle.Bottom - 4 ),
+ new Point( rectangle.X + 1, rectangle.Y + 3 ),
+ new Point( rectangle.X + 3, rectangle.Y + 1 )
+ };
+
+ dc.DrawPolygon( ResPool.GetPen( BorderColor ), points );
+
+ rect = new Rectangle( rectangle.X + rectangle.Width / 4, rectangle.Y + rectangle.Height / 4, rectangle.Width / 2, rectangle.Height / 2 );
+ centerX = rect.Left + rect.Width / 2;
+ centerY = rect.Top + rect.Height / 2;
+ shiftX = Math.Max( 1, rect.Width / 8 );
+ shiftY = Math.Max( 1, rect.Height / 8 );
+
+ if ( ( state & ButtonState.Pushed ) != 0 )
+ {
+ shiftX--;
+ shiftY--;
+ }
+
+ rect.Y -= shiftY;
+ centerY -= shiftY;
+
+ P1 = new Point( rect.Left, centerY );
+ P2 = new Point( centerX, rect.Bottom );
+ P3 = new Point( rect.Right, centerY );
+
+ arrow[ 0 ] = P1;
+ arrow[ 1 ] = P2;
+ arrow[ 2 ] = P3;
+
+ SmoothingMode old_smoothing_mode = dc.SmoothingMode;
+ dc.SmoothingMode = SmoothingMode.AntiAlias;
+
+ /* Draw the arrow */
+ if ( ( state & ButtonState.Inactive ) != 0 )
+ {
+ using ( Pen pen = new Pen( SystemColors.ControlLightLight, 2 ) )
+ {
+ dc.DrawLines( pen, arrow );
+ }
+
+ /* Move away from the shadow */
+ P1.X -= 1; P1.Y -= 1;
+ P2.X -= 1; P2.Y -= 1;
+ P3.X -= 1; P3.Y -= 1;
+
+ arrow[ 0 ] = P1;
+ arrow[ 1 ] = P2;
+ arrow[ 2 ] = P3;
+
+ using ( Pen pen = new Pen( SystemColors.ControlDark, 2 ) )
+ {
+ dc.DrawLines( pen, arrow );
+ }
+ }
+ else
+ {
+ using ( Pen pen = new Pen( SystemColors.ControlText, 2 ) )
+ {
+ dc.DrawLines( pen, arrow );
+ }
+ }
+
+ dc.SmoothingMode = old_smoothing_mode;
+ }
+
+ /* Scroll button: regular button + direction arrow */
+ public override void CPDrawScrollButton( Graphics dc, Rectangle area, ScrollButton scroll_button_type, ButtonState state )
+ {
+ bool enabled = ( state == ButtonState.Inactive ) ? false: true;
+
+ DrawScrollButtonPrimitive( dc, area, state, scroll_button_type );
+
+ if ( area.Width < 12 || area.Height < 12 ) /* Cannot see a thing at smaller sizes */
+ return;
+
+ Pen pen = null;
+
+ if ( enabled )
+ pen = new Pen( arrow_color, 2 );
+ else
+ pen = new Pen( ColorGrayText, 2 );
+
+ /* Paint arrows */
+
+ int centerX = area.Left + area.Width / 2;
+ int centerY = area.Top + area.Height / 2;
+
+ int shift = 0;
+
+ if ( ( state & ButtonState.Pushed ) != 0 )
+ shift = 1;
+
+ Point[] arrow = new Point[ 3 ];
+
+ switch ( scroll_button_type )
+ {
+ case ScrollButton.Down:
+ centerY += shift;
+ arrow[ 0 ] = new Point( centerX - 3, centerY - 2 );
+ arrow[ 1 ] = new Point( centerX, centerY + 2 );
+ arrow[ 2 ] = new Point( centerX + 3, centerY - 2 );
+ break;
+ case ScrollButton.Up:
+ centerY -= shift;
+ arrow[ 0 ] = new Point( centerX - 3, centerY + 2 );
+ arrow[ 1 ] = new Point( centerX, centerY - 2 );
+ arrow[ 2 ] = new Point( centerX + 3, centerY + 2 );
+ break;
+ case ScrollButton.Left:
+ centerX -= shift;
+ arrow[ 0 ] = new Point( centerX + 2, centerY - 3 );
+ arrow[ 1 ] = new Point( centerX - 2, centerY );
+ arrow[ 2 ] = new Point( centerX + 2, centerY + 3 );
+ break;
+ case ScrollButton.Right:
+ centerX += shift;
+ arrow[ 0 ] = new Point( centerX - 2, centerY - 3 );
+ arrow[ 1 ] = new Point( centerX + 2, centerY );
+ arrow[ 2 ] = new Point( centerX - 2, centerY + 3 );
+ break;
+ default:
+ break;
+ }
+
+ SmoothingMode old_smoothing_mode = dc.SmoothingMode;
+ dc.SmoothingMode = SmoothingMode.AntiAlias;
+
+ dc.DrawLines( pen, arrow );
+
+ dc.SmoothingMode = old_smoothing_mode;
+
+ pen.Dispose( );
+ }
+
+ public override void CPDrawSizeGrip( Graphics dc, Color backColor, Rectangle bounds )
+ {
+ Point pt = new Point( bounds.Right - 4, bounds.Bottom - 4 );
+
+ dc.DrawImage( size_grip_bmp, pt );
+ dc.DrawImage( size_grip_bmp, pt.X, pt.Y - 5 );
+ dc.DrawImage( size_grip_bmp, pt.X, pt.Y - 10 );
+ dc.DrawImage( size_grip_bmp, pt.X - 5, pt.Y );
+ dc.DrawImage( size_grip_bmp, pt.X - 10, pt.Y );
+ dc.DrawImage( size_grip_bmp, pt.X - 5, pt.Y - 5 );
+ }
+
+ private void DrawScrollBarThumb( Graphics dc, Rectangle area, ScrollBar bar )
+ {
+ LinearGradientBrush lgbr = null;
+
+ if ( bar.vert )
+ lgbr = new LinearGradientBrush( new Point( area.X, area.Y ), new Point( area.Right, area.Y ), Color.White, NormalColor );
+ else
+ lgbr = new LinearGradientBrush( new Point( area.X, area.Y ), new Point( area.X, area.Bottom ), Color.White, NormalColor );
+
+ Pen pen = ResPool.GetPen( BorderColor );
+
+ Point[] points = new Point[] {
+ new Point( area.X + 2, area.Y ),
+ new Point( area.Right - 3, area.Y ),
+ new Point( area.Right - 1, area.Y + 2 ),
+ new Point( area.Right - 1, area.Bottom - 3 ),
+ new Point( area.Right - 3, area.Bottom - 1 ),
+ new Point( area.X + 2, area.Bottom - 1 ),
+ new Point( area.X, area.Bottom - 3 ),
+ new Point( area.X, area.Y + 2 ),
+ new Point( area.X + 2, area.Y )
+ };
+
+ if ( bar.vert )
+ {
+ dc.FillRectangle( lgbr, area.X + 1, area.Y + 1, area.Width - 2, area.Height - 2 );
+ dc.DrawPolygon( pen, points );
+
+ // draw grip lines only if stere is enough space
+ if ( area.Height > 20 )
+ {
+ int mid_y = area.Y + ( area.Height / 2 );
+ int mid_x = area.X + ( area.Width / 2 );
+
+ using ( Pen lpen = new Pen( MouseOverColor, 2 ) )
+ {
+ dc.DrawLine( lpen, mid_x - 3, mid_y, mid_x + 3, mid_y );
+ dc.DrawLine( lpen, mid_x - 3, mid_y - 4, mid_x + 3, mid_y - 4 );
+ dc.DrawLine( lpen, mid_x - 3, mid_y + 4, mid_x + 3, mid_y + 4 );
+ }
+
+ Pen spen = ResPool.GetPen( Color.White );
+ dc.DrawLine( spen, mid_x - 3, mid_y - 1, mid_x + 3, mid_y - 1 );
+ dc.DrawLine( spen, mid_x - 3, mid_y - 5, mid_x + 3, mid_y - 5 );
+ dc.DrawLine( spen, mid_x - 3, mid_y + 3, mid_x + 3, mid_y + 3 );
+ }
+ }
+ else
+ {
+ dc.FillRectangle( lgbr, area.X + 1, area.Y + 1, area.Width - 2, area.Height - 2 );
+ dc.DrawPolygon( pen, points );
+
+ // draw grip lines only if stere is enough space
+ if ( area.Width > 20 )
+ {
+ int mid_x = area.X + ( area.Width / 2 );
+ int mid_y = area.Y + ( area.Height / 2 );
+
+ using ( Pen lpen = new Pen( MouseOverColor, 2 ) )
+ {
+ dc.DrawLine( lpen, mid_x, mid_y - 3, mid_x, mid_y + 3 );
+ dc.DrawLine( lpen, mid_x - 4, mid_y - 3, mid_x - 4, mid_y + 3 );
+ dc.DrawLine( lpen, mid_x + 4, mid_y - 3, mid_x + 4, mid_y + 3 );
+ }
+
+ Pen spen = ResPool.GetPen( Color.White );
+ dc.DrawLine( spen, mid_x - 1, mid_y - 3, mid_x - 1, mid_y + 3 );
+ dc.DrawLine( spen, mid_x - 5, mid_y - 3, mid_x - 5, mid_y + 3 );
+ dc.DrawLine( spen, mid_x + 3, mid_y - 3, mid_x + 3, mid_y + 3 );
+ }
+ }
+
+ lgbr.Dispose( );
+ }
+
+ /* Nice scroll button */
+ public void DrawScrollButtonPrimitive( Graphics dc, Rectangle area, ButtonState state, ScrollButton scroll_button_type )
+ {
+ Pen pen = ResPool.GetPen( BorderColor );
+
+ dc.FillRectangle( ResPool.GetSolidBrush( NiceBackColor ), area );
+
+ Color use_color;
+
+ if ( ( state & ButtonState.Pushed ) == ButtonState.Pushed )
+ use_color = PressedColor;
+ else
+ use_color = NormalColor;
+
+ Point[] points = null;
+
+ LinearGradientBrush lgbr = null;
+
+ switch ( scroll_button_type )
+ {
+ case ScrollButton.Left:
+ lgbr = new LinearGradientBrush( new Point( area.X, area.Y ), new Point( area.Right - 2, area.Y ), use_color, Color.White );
+ dc.FillRectangle( lgbr, area.X + 1, area.Y + 1, area.Width - 4, area.Height - 2 );
+
+ points = new Point[] {
+ new Point( area.X + 2, area.Y ),
+ new Point( area.Right - 1, area.Y ),
+ new Point( area.Right - 1, area.Bottom - 1 ),
+ new Point( area.X + 2, area.Bottom - 1 ),
+ new Point( area.X, area.Bottom - 3 ),
+ new Point( area.X, area.Y + 2 ),
+ new Point( area.X + 2, area.Y )
+ };
+ dc.DrawPolygon( pen, points );
+ break;
+ case ScrollButton.Right:
+ lgbr = new LinearGradientBrush( new Point( area.X, area.Y ), new Point( area.Right - 1, area.Y ), Color.White, use_color );
+ dc.FillRectangle( lgbr, area.X, area.Y + 1, area.Width - 1, area.Height - 2 );
+
+ points = new Point[] {
+ new Point( area.X, area.Y ),
+ new Point( area.Right - 3, area.Y ),
+ new Point( area.Right - 1, area.Y + 2 ),
+ new Point( area.Right - 1, area.Bottom - 3 ),
+ new Point( area.Right - 3, area.Bottom - 1 ),
+ new Point( area.X, area.Bottom - 1 ),
+ new Point( area.X, area.Y ),
+ };
+ dc.DrawPolygon( pen, points );
+ break;
+ case ScrollButton.Up:
+ lgbr = new LinearGradientBrush( new Point( area.X, area.Y ), new Point( area.X, area.Bottom - 1 ), use_color, Color.White );
+ dc.FillRectangle( lgbr, area.X + 1, area.Y + 1, area.Width - 2, area.Height - 2 );
+
+ points = new Point[] {
+ new Point( area.X + 2, area.Y ),
+ new Point( area.Right - 3, area.Y ),
+ new Point( area.Right - 1, area.Y + 2 ),
+ new Point( area.Right - 1, area.Bottom - 1 ),
+ new Point( area.X, area.Bottom - 1 ),
+ new Point( area.X, area.Y + 2 ),
+ new Point( area.X + 2, area.Y )
+ };
+ dc.DrawPolygon( pen, points );
+ break;
+ case ScrollButton.Down:
+ lgbr = new LinearGradientBrush( new Point( area.X, area.Y ), new Point( area.X, area.Bottom - 1 ), Color.White, use_color );
+ dc.FillRectangle( lgbr, area.X + 1, area.Y + 1, area.Width - 2, area.Height - 2 );
+
+ points = new Point[] {
+ new Point( area.X, area.Y ),
+ new Point( area.Right - 1, area.Y ),
+ new Point( area.Right - 1, area.Bottom - 3 ),
+ new Point( area.Right - 3, area.Bottom - 1 ),
+ new Point( area.X + 2, area.Bottom - 1 ),
+ new Point( area.X, area.Bottom - 3 ),
+ new Point( area.X, area.Y )
+ };
+ dc.DrawPolygon( pen, points );
+ break;
+ }
+
+ lgbr.Dispose( );
+ }
+
+ #region GroupBox
+ public override void DrawGroupBox (Graphics dc, Rectangle area, GroupBox box)
+ {
+ StringFormat text_format;
+ SizeF size;
+ int width;
+ int y;
+ Rectangle rect;
+
+ rect = box.ClientRectangle;
+
+ dc.FillRectangle (ResPool.GetSolidBrush (box.BackColor), rect);
+
+ text_format = new StringFormat();
+ text_format.HotkeyPrefix = HotkeyPrefix.Show;
+
+ size = dc.MeasureString (box.Text, box.Font);
+ width = (int) size.Width;
+
+ if (width > box.Width - 16)
+ width = box.Width - 16;
+
+ y = box.Font.Height / 2;
+
+ Pen pen = ResPool.GetPen( BorderColor );
+
+ /* Draw group box*/
+ Point[] points = new Point[] {
+ new Point( 8 + width, y ),
+ new Point( box.Width - 3, y ),
+ new Point( box.Width - 1, y + 2 ),
+ new Point( box.Width - 1, box.Height - 3 ),
+ new Point( box.Width - 3, box.Height - 1 ),
+ new Point( 2, box.Height - 1 ),
+ new Point( 0, box.Height - 3 ),
+ new Point( 0, y + 2 ),
+ new Point( 2, y ),
+ new Point( 8, y )
+ };
+ dc.DrawLines( pen, points );
+
+ /* Text */
+ if (box.Enabled) {
+ dc.DrawString (box.Text, box.Font, ResPool.GetSolidBrush (box.ForeColor), 10, 0, text_format);
+ } else {
+ CPDrawStringDisabled (dc, box.Text, box.Font, box.ForeColor,
+ new RectangleF (10, 0, width, box.Font.Height), text_format);
+ }
+ text_format.Dispose ();
+ }
+ #endregion
+ } //class
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeWin32Classic.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeWin32Classic.cs
new file mode 100644
index 00000000000..0e5b7c3e9f0
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeWin32Classic.cs
@@ -0,0 +1,5572 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+// Peter Bartok, pbartok@novell.com
+// John BouAntoun, jba-mono@optusnet.com.au
+// Marek Safar, marek.safar@seznam.cz
+//
+
+
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Drawing.Imaging;
+using System.Drawing.Text;
+
+namespace System.Windows.Forms
+{
+
+ internal class ThemeWin32Classic : Theme
+ {
+ public override Version Version {
+ get {
+ return new Version(0, 1, 0, 0);
+ }
+ }
+
+ /* Hardcoded colour values not exposed in the API constants in all configurations */
+ protected static readonly Color arrow_color = Color.Black;
+ protected static readonly Color pen_ticks_color = Color.Black;
+ protected static readonly Color progressbarblock_color = Color.FromArgb (255, 0, 0, 128);
+ protected static StringFormat string_format_menu_text;
+ protected static StringFormat string_format_menu_shortcut;
+ protected static StringFormat string_format_menu_menubar_text;
+ static readonly Rectangle checkbox_rect = new Rectangle (2, 2, 11,11); // Position of the checkbox relative to the item
+ static ImageAttributes imagedisabled_attributes = null;
+ const int SEPARATOR_HEIGHT = 5;
+ const int SM_CXBORDER = 1;
+ const int SM_CYBORDER = 1;
+ const int MENU_TAB_SPACE = 8; // Pixels added to the width of an item because of a tab
+ const int MENU_BAR_ITEMS_SPACE = 8; // Space between menu bar items
+
+ #region Principal Theme Methods
+ public ThemeWin32Classic ()
+ {
+ defaultWindowBackColor = this.ColorWindow;
+ defaultWindowForeColor = this.ColorControlText;
+ default_font = new Font (FontFamily.GenericSansSerif, 8.25f);
+
+ /* Menu string formats */
+ string_format_menu_text = new StringFormat ();
+ string_format_menu_text.LineAlignment = StringAlignment.Center;
+ string_format_menu_text.Alignment = StringAlignment.Near;
+ string_format_menu_text.HotkeyPrefix = HotkeyPrefix.Show;
+
+ string_format_menu_shortcut = new StringFormat ();
+ string_format_menu_shortcut.LineAlignment = StringAlignment.Center;
+ string_format_menu_shortcut.Alignment = StringAlignment.Far;
+
+ string_format_menu_menubar_text = new StringFormat ();
+ string_format_menu_menubar_text.LineAlignment = StringAlignment.Center;
+ string_format_menu_menubar_text.Alignment = StringAlignment.Center;
+ string_format_menu_menubar_text.HotkeyPrefix = HotkeyPrefix.Show;
+ always_draw_hotkeys = false;
+ }
+
+ public override void ResetDefaults() {
+ throw new NotImplementedException("Need to implement ResetDefaults() for Win32 theme");
+ }
+
+ public override bool DoubleBufferingSupported {
+ get {return true; }
+ }
+ #endregion // Principal Theme Methods
+
+ #region Internal Methods
+ protected SolidBrush GetControlBackBrush (Color c) {
+ if (c == DefaultControlBackColor)
+ return ResPool.GetSolidBrush (ColorControl);
+ return ResPool.GetSolidBrush (c);
+ }
+
+ protected SolidBrush GetControlForeBrush (Color c) {
+ if (c == DefaultControlForeColor)
+ return ResPool.GetSolidBrush (ColorControlText);
+ return ResPool.GetSolidBrush (c);
+ }
+ #endregion // Internal Methods
+
+ #region OwnerDraw Support
+ public override void DrawOwnerDrawBackground (DrawItemEventArgs e)
+ {
+ if (e.State == DrawItemState.Selected) {
+ e.Graphics.FillRectangle (SystemBrushes.Highlight, e.Bounds);
+ return;
+ }
+
+ e.Graphics.FillRectangle (GetControlBackBrush (e.BackColor), e.Bounds);
+ }
+
+ public override void DrawOwnerDrawFocusRectangle (DrawItemEventArgs e)
+ {
+ if (e.State == DrawItemState.Focus)
+ CPDrawFocusRectangle (e.Graphics, e.Bounds, e.ForeColor, e.BackColor);
+ }
+ #endregion // OwnerDraw Support
+
+ #region ButtonBase
+ public override void DrawButtonBase(Graphics dc, Rectangle clip_area, ButtonBase button) {
+ // Draw the button: fill rectangle, draw border, etc.
+ ButtonBase_DrawButton(button, dc);
+
+ // First, draw the image
+ if ((button.image != null) || (button.image_list != null))
+ ButtonBase_DrawImage(button, dc);
+
+ // Draw the focus rectangle
+ if (button.has_focus)
+ ButtonBase_DrawFocus(button, dc);
+
+ // Now the text
+ if (button.text != null && button.text != String.Empty)
+ ButtonBase_DrawText(button, dc);
+ }
+
+ protected virtual void ButtonBase_DrawButton(ButtonBase button, Graphics dc)
+ {
+ Rectangle buttonRectangle;
+ Rectangle borderRectangle;
+
+ dc.FillRectangle(ResPool.GetSolidBrush (button.BackColor), button.ClientRectangle);
+
+ // set up the button rectangle
+ buttonRectangle = button.ClientRectangle;
+ if (button.has_focus) {
+ // shrink the rectangle for the normal button drawing inside the focus rectangle
+ borderRectangle = Rectangle.Inflate(buttonRectangle, -1, -1);
+ } else {
+ borderRectangle = buttonRectangle;
+ }
+
+ if (button.FlatStyle == FlatStyle.Flat || button.FlatStyle == FlatStyle.Popup) {
+ DrawFlatStyleButton (dc, borderRectangle, button);
+ } else {
+ CPDrawButton(dc, borderRectangle, button.ButtonState);
+ if (button.has_focus) {
+ dc.DrawRectangle(ResPool.GetPen(button.ForeColor), borderRectangle);
+ }
+ }
+ }
+
+ protected virtual void ButtonBase_DrawImage(ButtonBase button, Graphics dc)
+ {
+ // Need to draw a picture
+ Image i;
+ int image_x;
+ int image_y;
+ int image_width;
+ int image_height;
+
+ int width = button.ClientSize.Width;
+ int height = button.ClientSize.Height;
+
+ if (button.ImageIndex != -1) { // We use ImageIndex instead of image_index since it will return -1 if image_list is null
+ i = button.image_list.Images[button.image_index];
+ } else {
+ i = button.image;
+ }
+
+ image_width = button.image.Width;
+ image_height = button.image.Height;
+
+ switch (button.image_alignment) {
+ case ContentAlignment.TopLeft: {
+ image_x=0;
+ image_y=0;
+ break;
+ }
+
+ case ContentAlignment.TopCenter: {
+ image_x=(width-image_width)/2;
+ image_y=0;
+ break;
+ }
+
+ case ContentAlignment.TopRight: {
+ image_x=width-image_width;
+ image_y=0;
+ break;
+ }
+
+ case ContentAlignment.MiddleLeft: {
+ image_x=0;
+ image_y=(height-image_height)/2;
+ break;
+ }
+
+ case ContentAlignment.MiddleCenter: {
+ image_x=(width-image_width)/2;
+ image_y=(height-image_height)/2;
+ break;
+ }
+
+ case ContentAlignment.MiddleRight: {
+ image_x=width-image_width;
+ image_y=(height-image_height)/2;
+ break;
+ }
+
+ case ContentAlignment.BottomLeft: {
+ image_x=0;
+ image_y=height-image_height;
+ break;
+ }
+
+ case ContentAlignment.BottomCenter: {
+ image_x=(width-image_width)/2;
+ image_y=height-image_height;
+ break;
+ }
+
+ case ContentAlignment.BottomRight: {
+ image_x=width-image_width;
+ image_y=height-image_height;
+ break;
+ }
+
+ default: {
+ image_x=0;
+ image_y=0;
+ break;
+ }
+ }
+
+ if (button.is_pressed) {
+ image_x+=1;
+ image_y+=1;
+ }
+
+ if (button.is_enabled) {
+ dc.DrawImage(i, image_x, image_y);
+ }
+ else {
+ CPDrawImageDisabled(dc, i, image_x, image_y, ColorControl);
+ }
+ }
+
+ protected virtual void ButtonBase_DrawFocus(ButtonBase button, Graphics dc)
+ {
+ if (button.FlatStyle == FlatStyle.Flat || button.FlatStyle == FlatStyle.Popup) {
+ DrawFlatStyleFocusRectangle (dc, button.ClientRectangle, button, button.ForeColor, button.BackColor);
+ } else {
+ Rectangle rect = button.ClientRectangle;
+ rect.Inflate (-4, -4);
+ CPDrawFocusRectangle(dc, rect, button.ForeColor, button.BackColor);
+ }
+ }
+
+ protected virtual void ButtonBase_DrawText(ButtonBase button, Graphics dc)
+ {
+ Rectangle buttonRectangle = button.ClientRectangle;
+ Rectangle text_rect = Rectangle.Inflate(buttonRectangle, -4, -4);
+
+ if (button.is_pressed) {
+ text_rect.X++;
+ text_rect.Y++;
+ }
+
+ if (button.is_enabled) {
+ dc.DrawString(button.text, button.Font, ResPool.GetSolidBrush (button.ForeColor), text_rect, button.text_format);
+ } else {
+ if (button.FlatStyle == FlatStyle.Flat || button.FlatStyle == FlatStyle.Popup) {
+ dc.DrawString(button.text, button.Font, ResPool.GetSolidBrush (ControlPaint.DarkDark (this.ColorControl)), text_rect, button.text_format);
+ } else {
+ CPDrawStringDisabled(dc, button.text, button.Font, ColorControlText, text_rect, button.text_format);
+ }
+ }
+ }
+
+ // draw the flat style part of the rectangle
+ public void DrawFlatStyleButton (Graphics graphics, Rectangle rectangle, ButtonBase button) {
+ Color rect_back_color = button.BackColor;
+ Color rect_fore_color = button.ForeColor;
+ Rectangle trace_rectangle = new Rectangle(rectangle.X, rectangle.Y, Math.Max (rectangle.Width-1, 0), Math.Max (rectangle.Height-1, 0));
+
+ if (button.Enabled) {
+ if (button.Capture || button.is_entered) {
+ if (button.FlatStyle == FlatStyle.Flat) {
+ // fill the rectangle
+ graphics.FillRectangle (ResPool.GetSolidBrush (rect_back_color), rectangle);
+
+ // now draw the outer border
+ if (button.Capture && button.is_entered) {
+ rect_back_color = ControlPaint.LightLight (rect_back_color);
+ } else {
+ rect_back_color = ControlPaint.Light (rect_back_color);
+ }
+
+ // draw rectangle and fill it
+ graphics.FillRectangle (ResPool.GetSolidBrush (rect_back_color), rectangle);
+ graphics.DrawRectangle(ResPool.GetPen (rect_fore_color), trace_rectangle);
+ } else {
+ // else it must be a popup button
+
+ if (button.Capture && button.is_entered) {
+ graphics.DrawRectangle(ResPool.GetPen (this.ColorControlText), trace_rectangle);
+ } else {
+ // draw a 3d border
+ CPDrawBorder3D (graphics, rectangle, Border3DStyle.RaisedInner, Border3DSide.Left | Border3DSide.Top, button.BackColor);
+ graphics.DrawLine ( ResPool.GetPen (this.ColorControlText), trace_rectangle.X, trace_rectangle.Bottom, trace_rectangle.Right, trace_rectangle.Bottom);
+ graphics.DrawLine ( ResPool.GetPen (this.ColorControlText), trace_rectangle.Right, trace_rectangle.Y, trace_rectangle.Right, trace_rectangle.Bottom);
+ }
+ }
+
+ // TODO: draw inner focus rectangle
+
+ } else {
+ // popup has a ButtonColorText forecolor, not a button.ForeCOlor
+ if (button.FlatStyle == FlatStyle.Popup) {
+ rect_fore_color = this.ColorControlText;
+ }
+
+ // fill then draw outer rect
+ graphics.FillRectangle (ResPool.GetSolidBrush (rect_back_color), rectangle);
+ graphics.DrawRectangle(ResPool.GetPen (rect_fore_color), trace_rectangle);
+ }
+
+ // finally some small tweaks to render radiobutton and checkbox
+ CheckBox checkbox = button as CheckBox;
+ RadioButton radiobutton = button as RadioButton;
+ if ((checkbox != null && checkbox.Checked) ||
+ (radiobutton != null && radiobutton.Checked)) {
+ if (button.FlatStyle == FlatStyle.Flat && button.is_entered && !button.Capture) {
+ // render the hover for flat flatstyle and cheked
+ graphics.DrawRectangle(ResPool.GetPen (this.ColorControlText), trace_rectangle);
+ } else if (!button.is_entered && !button.Capture) {
+ // render the checked state for popup when unhovered
+ CPDrawBorder3D (graphics, rectangle, Border3DStyle.SunkenInner, Border3DSide.Right | Border3DSide.Bottom, button.BackColor);
+ }
+ }
+ } else {
+ // rendering checkbox or radio button style buttons
+ CheckBox checkbox = button as CheckBox;
+ RadioButton radiobutton = button as RadioButton;
+ bool draw_popup_checked = false;
+
+ if (button.FlatStyle == FlatStyle.Popup) {
+ rect_fore_color = this.ColorControlText;
+
+ // see if we should draw a disabled checked popup button
+ draw_popup_checked = ((checkbox != null && checkbox.Checked) ||
+ (radiobutton != null && radiobutton.Checked));
+ }
+
+ graphics.FillRectangle (ResPool.GetSolidBrush (rect_back_color), rectangle);
+ graphics.DrawRectangle(ResPool.GetPen (rect_fore_color), trace_rectangle);
+
+ // finally draw the flatstyle checked effect if need
+ if (draw_popup_checked) {
+ // render the checked state for popup when unhovered
+ CPDrawBorder3D (graphics, rectangle, Border3DStyle.SunkenInner, Border3DSide.Right | Border3DSide.Bottom, button.BackColor);
+ }
+ }
+ }
+
+ public override Size ButtonBaseDefaultSize {
+ get {
+ return new Size (75, 23);
+ }
+ }
+ #endregion // ButtonBase
+
+ #region CheckBox
+ public override void DrawCheckBox(Graphics dc, Rectangle clip_area, CheckBox checkbox) {
+ StringFormat text_format;
+ Rectangle client_rectangle;
+ Rectangle text_rectangle;
+ Rectangle checkbox_rectangle;
+ int checkmark_size=13;
+ int checkmark_space = 4;
+
+ client_rectangle = checkbox.ClientRectangle;
+ text_rectangle = client_rectangle;
+ checkbox_rectangle = new Rectangle(text_rectangle.X, text_rectangle.Y, checkmark_size, checkmark_size);
+
+ text_format = new StringFormat();
+ text_format.Alignment=StringAlignment.Near;
+ text_format.LineAlignment=StringAlignment.Center;
+ text_format.HotkeyPrefix = HotkeyPrefix.Show;
+
+ /* Calculate the position of text and checkbox rectangle */
+ if (checkbox.appearance!=Appearance.Button) {
+ switch(checkbox.check_alignment) {
+ case ContentAlignment.BottomCenter: {
+ checkbox_rectangle.X=(client_rectangle.Right-client_rectangle.Left)/2-checkmark_size/2;
+ checkbox_rectangle.Y=client_rectangle.Bottom-checkmark_size;
+ text_rectangle.X=client_rectangle.X;
+ text_rectangle.Width=client_rectangle.Width;
+ text_rectangle.Height=client_rectangle.Height-checkbox_rectangle.Y-checkmark_space;
+ break;
+ }
+
+ case ContentAlignment.BottomLeft: {
+ checkbox_rectangle.X=client_rectangle.Left;
+ checkbox_rectangle.Y=client_rectangle.Bottom-checkmark_size;
+ text_rectangle.X=client_rectangle.X+checkmark_size+checkmark_space;
+ text_rectangle.Width=client_rectangle.Width-checkmark_size-checkmark_space;
+ break;
+ }
+
+ case ContentAlignment.BottomRight: {
+ checkbox_rectangle.X=client_rectangle.Right-checkmark_size;
+ checkbox_rectangle.Y=client_rectangle.Bottom-checkmark_size;
+ text_rectangle.X=client_rectangle.X;
+ text_rectangle.Width=client_rectangle.Width-checkmark_size-checkmark_space;
+ break;
+ }
+
+ case ContentAlignment.MiddleCenter: {
+ checkbox_rectangle.X=(client_rectangle.Right-client_rectangle.Left)/2-checkmark_size/2;
+ checkbox_rectangle.Y=(client_rectangle.Bottom-client_rectangle.Top)/2-checkmark_size/2;
+ text_rectangle.X=client_rectangle.X;
+ text_rectangle.Width=client_rectangle.Width;
+ break;
+ }
+
+ default:
+ case ContentAlignment.MiddleLeft: {
+ checkbox_rectangle.X=client_rectangle.Left;
+ checkbox_rectangle.Y=(client_rectangle.Bottom-client_rectangle.Top)/2-checkmark_size/2;
+ text_rectangle.X=client_rectangle.X+checkmark_size+checkmark_space;
+ text_rectangle.Width=client_rectangle.Width-checkmark_size-checkmark_space;
+ break;
+ }
+
+ case ContentAlignment.MiddleRight: {
+ checkbox_rectangle.X=client_rectangle.Right-checkmark_size;
+ checkbox_rectangle.Y=(client_rectangle.Bottom-client_rectangle.Top)/2-checkmark_size/2;
+ text_rectangle.X=client_rectangle.X;
+ text_rectangle.Width=client_rectangle.Width-checkmark_size-checkmark_space;
+ break;
+ }
+
+ case ContentAlignment.TopCenter: {
+ checkbox_rectangle.X=(client_rectangle.Right-client_rectangle.Left)/2-checkmark_size/2;
+ checkbox_rectangle.Y=client_rectangle.Top;
+ text_rectangle.X=client_rectangle.X;
+ text_rectangle.Width=client_rectangle.Width;
+ text_rectangle.Y=checkmark_size+checkmark_space;
+ text_rectangle.Height=client_rectangle.Height-checkmark_size-checkmark_space;
+ break;
+ }
+
+ case ContentAlignment.TopLeft: {
+ checkbox_rectangle.X=client_rectangle.Left;
+ text_rectangle.X=client_rectangle.X+checkmark_size+checkmark_space;
+ text_rectangle.Width=client_rectangle.Width-checkmark_size-checkmark_space;
+ break;
+ }
+
+ case ContentAlignment.TopRight: {
+ checkbox_rectangle.X=client_rectangle.Right-checkmark_size;
+ text_rectangle.X=client_rectangle.X;
+ text_rectangle.Width=client_rectangle.Width-checkmark_size-checkmark_space;
+ break;
+ }
+ }
+ } else {
+ text_rectangle.X=client_rectangle.X;
+ text_rectangle.Width=client_rectangle.Width;
+ }
+
+ /* Set the horizontal alignment of our text */
+ switch(checkbox.text_alignment) {
+ case ContentAlignment.BottomLeft:
+ case ContentAlignment.MiddleLeft:
+ case ContentAlignment.TopLeft: {
+ text_format.Alignment=StringAlignment.Near;
+ break;
+ }
+
+ case ContentAlignment.BottomCenter:
+ case ContentAlignment.MiddleCenter:
+ case ContentAlignment.TopCenter: {
+ text_format.Alignment=StringAlignment.Center;
+ break;
+ }
+
+ case ContentAlignment.BottomRight:
+ case ContentAlignment.MiddleRight:
+ case ContentAlignment.TopRight: {
+ text_format.Alignment=StringAlignment.Far;
+ break;
+ }
+ }
+
+ /* Set the vertical alignment of our text */
+ switch(checkbox.text_alignment) {
+ case ContentAlignment.TopLeft:
+ case ContentAlignment.TopCenter:
+ case ContentAlignment.TopRight: {
+ text_format.LineAlignment=StringAlignment.Near;
+ break;
+ }
+
+ case ContentAlignment.BottomLeft:
+ case ContentAlignment.BottomCenter:
+ case ContentAlignment.BottomRight: {
+ text_format.LineAlignment=StringAlignment.Far;
+ break;
+ }
+
+ case ContentAlignment.MiddleLeft:
+ case ContentAlignment.MiddleCenter:
+ case ContentAlignment.MiddleRight: {
+ text_format.LineAlignment=StringAlignment.Center;
+ break;
+ }
+ }
+
+ ButtonState state = ButtonState.Normal;
+ if (checkbox.FlatStyle == FlatStyle.Flat) {
+ state |= ButtonState.Flat;
+ }
+
+ if (checkbox.Checked) {
+ state |= ButtonState.Checked;
+ }
+
+ if (checkbox.ThreeState && (checkbox.CheckState == CheckState.Indeterminate)) {
+ state |= ButtonState.Checked;
+ state |= ButtonState.Pushed;
+ }
+
+ // finally make sure the pushed and inavtive states are rendered
+ if (!checkbox.Enabled) {
+ state |= ButtonState.Inactive;
+ }
+ else if (checkbox.is_pressed) {
+ state |= ButtonState.Pushed;
+ }
+
+
+ // Start drawing
+
+ CheckBox_DrawCheckBox(dc, checkbox, state, checkbox_rectangle);
+
+ CheckBox_DrawText(checkbox, text_rectangle, dc, text_format);
+
+ CheckBox_DrawFocus(checkbox, dc, text_rectangle);
+
+ text_format.Dispose ();
+ }
+
+ protected virtual void CheckBox_DrawCheckBox( Graphics dc, CheckBox checkbox, ButtonState state, Rectangle checkbox_rectangle )
+ {
+ dc.FillRectangle (ResPool.GetSolidBrush (checkbox.BackColor), checkbox.ClientRectangle);
+ // render as per normal button
+ if (checkbox.appearance==Appearance.Button) {
+ if (checkbox.FlatStyle == FlatStyle.Flat || checkbox.FlatStyle == FlatStyle.Popup) {
+ DrawFlatStyleButton(dc, checkbox.ClientRectangle, checkbox);
+ } else {
+ CPDrawButton(dc, checkbox.ClientRectangle, state);
+ }
+ } else {
+ // establish if we are rendering a flat style of some sort
+ if (checkbox.FlatStyle == FlatStyle.Flat || checkbox.FlatStyle == FlatStyle.Popup) {
+ DrawFlatStyleCheckBox (dc, checkbox_rectangle, checkbox);
+ } else {
+ ControlPaint.DrawCheckBox(dc, checkbox_rectangle, state);
+ }
+ }
+ }
+
+ protected virtual void CheckBox_DrawText( CheckBox checkbox, Rectangle text_rectangle, Graphics dc, StringFormat text_format )
+ {
+ SolidBrush sb;
+
+ // offset the text if it's pressed and a button
+ if (checkbox.Appearance == Appearance.Button) {
+ if (checkbox.Checked || (checkbox.Capture && checkbox.FlatStyle != FlatStyle.Flat)) {
+ text_rectangle.X ++;
+ text_rectangle.Y ++;
+ }
+
+ text_rectangle.Inflate(-4, -4);
+ }
+
+ /* Place the text; to be compatible with Windows place it after the checkbox has been drawn */
+ if (checkbox.Enabled) {
+ sb = ResPool.GetSolidBrush(checkbox.ForeColor);
+ dc.DrawString(checkbox.Text, checkbox.Font, sb, text_rectangle, text_format);
+ } else if (checkbox.FlatStyle == FlatStyle.Flat || checkbox.FlatStyle == FlatStyle.Popup) {
+ dc.DrawString(checkbox.Text, checkbox.Font, ResPool.GetSolidBrush (ControlPaint.DarkDark (this.ColorControl)), text_rectangle, text_format);
+ } else {
+ CPDrawStringDisabled(dc, checkbox.Text, checkbox.Font, ColorControlText, text_rectangle, text_format);
+ }
+ }
+
+ protected virtual void CheckBox_DrawFocus( CheckBox checkbox, Graphics dc, Rectangle text_rectangle )
+ {
+ if (checkbox.Focused) {
+ if (checkbox.FlatStyle != FlatStyle.Flat) {
+ DrawInnerFocusRectangle (dc, Rectangle.Inflate (text_rectangle, -1, -1), checkbox.BackColor);
+ } else {
+ dc.DrawRectangle (ResPool.GetPen (checkbox.ForeColor), Rectangle.Inflate (text_rectangle, -1, -1));
+ }
+ }
+ }
+
+ // renders a checkBox with the Flat and Popup FlatStyle
+ protected virtual void DrawFlatStyleCheckBox (Graphics graphics, Rectangle rectangle, CheckBox checkbox)
+ {
+ Pen pen;
+ Rectangle rect;
+ Rectangle checkbox_rectangle;
+ Rectangle fill_rectangle;
+ int lineWidth;
+ int Scale;
+
+ // set up our rectangles first
+ if (checkbox.FlatStyle == FlatStyle.Popup && checkbox.is_entered) {
+ // clip one pixel from bottom right for non popup rendered checkboxes
+ checkbox_rectangle = new Rectangle(rectangle.X, rectangle.Y, Math.Max(rectangle.Width-1, 0), Math.Max(rectangle.Height-1,0));
+ fill_rectangle = new Rectangle(checkbox_rectangle.X+1, checkbox_rectangle.Y+1, Math.Max(checkbox_rectangle.Width-3, 0), Math.Max(checkbox_rectangle.Height-3,0));
+ } else {
+ // clip two pixels from bottom right for non popup rendered checkboxes
+ checkbox_rectangle = new Rectangle(rectangle.X, rectangle.Y, Math.Max(rectangle.Width-2, 0), Math.Max(rectangle.Height-2,0));
+ fill_rectangle = new Rectangle(checkbox_rectangle.X+1, checkbox_rectangle.Y+1, Math.Max(checkbox_rectangle.Width-2, 0), Math.Max(checkbox_rectangle.Height-2,0));
+ }
+
+ // if disabled render in disabled state
+ if (checkbox.Enabled) {
+ // process the state of the checkbox
+ if (checkbox.is_entered || checkbox.Capture) {
+ // decide on which background color to use
+ if (checkbox.FlatStyle == FlatStyle.Popup && checkbox.is_entered && checkbox.Capture) {
+ graphics.FillRectangle(ResPool.GetSolidBrush (checkbox.BackColor), fill_rectangle);
+ } else if (checkbox.FlatStyle == FlatStyle.Flat && !(checkbox.is_entered && checkbox.Capture)) {
+ graphics.FillRectangle(ResPool.GetSolidBrush (ControlPaint.Light(checkbox.BackColor)), fill_rectangle);
+ } else {
+ // use regular window background color
+ graphics.FillRectangle(ResPool.GetSolidBrush (ControlPaint.LightLight (checkbox.BackColor)), fill_rectangle);
+ }
+
+ // render the outer border
+ if (checkbox.FlatStyle == FlatStyle.Flat) {
+ ControlPaint.DrawBorder(graphics, checkbox_rectangle, checkbox.ForeColor, ButtonBorderStyle.Solid);
+ } else {
+ // draw sunken effect
+ CPDrawBorder3D (graphics, checkbox_rectangle, Border3DStyle.SunkenInner, Border3DSide.All, checkbox.BackColor);
+ }
+ } else {
+ graphics.FillRectangle(ResPool.GetSolidBrush (ControlPaint.LightLight (checkbox.BackColor)), fill_rectangle);
+
+ if (checkbox.FlatStyle == FlatStyle.Flat) {
+ ControlPaint.DrawBorder(graphics, checkbox_rectangle, checkbox.ForeColor, ButtonBorderStyle.Solid);
+ } else {
+ // draw the outer border
+ ControlPaint.DrawBorder(graphics, checkbox_rectangle, ControlPaint.DarkDark (checkbox.BackColor), ButtonBorderStyle.Solid);
+ }
+ }
+ } else {
+ if (checkbox.FlatStyle == FlatStyle.Popup) {
+ graphics.FillRectangle(SystemBrushes.Control, fill_rectangle);
+ }
+
+ // draw disabled state,
+ ControlPaint.DrawBorder(graphics, checkbox_rectangle, ColorControlDark, ButtonBorderStyle.Solid);
+ }
+
+ /* Make sure we've got at least a line width of 1 */
+ lineWidth = Math.Max(3, fill_rectangle.Width/3);
+ Scale=Math.Max(1, fill_rectangle.Width/9);
+
+ // flat style check box is rendered inside a rectangle shifted down by one
+ rect=new Rectangle(fill_rectangle.X, fill_rectangle.Y+1, fill_rectangle.Width, fill_rectangle.Height);
+ if (checkbox.Enabled) {
+ pen=ResPool.GetPen(checkbox.ForeColor);
+ } else {
+ pen=SystemPens.ControlDark;
+ }
+
+ if (checkbox.Checked) {
+ /* Need to draw a check-mark */
+ for (int i=0; i<lineWidth; i++) {
+ graphics.DrawLine(pen, rect.Left+lineWidth/2, rect.Top+lineWidth+i, rect.Left+lineWidth/2+2*Scale, rect.Top+lineWidth+2*Scale+i);
+ graphics.DrawLine(pen, rect.Left+lineWidth/2+2*Scale, rect.Top+lineWidth+2*Scale+i, rect.Left+lineWidth/2+6*Scale, rect.Top+lineWidth-2*Scale+i);
+ }
+ }
+ }
+
+
+ #endregion // CheckBox
+
+ #region CheckedListBox
+
+ public override Rectangle CheckedListBoxCheckRectangle ()
+ {
+ return checkbox_rect;
+ }
+
+ public override void DrawCheckedListBoxItem (CheckedListBox ctrl, DrawItemEventArgs e)
+ {
+ Color back_color, fore_color;
+ Rectangle item_rect = e.Bounds;
+ ButtonState state;
+ StringFormat string_format = ctrl.GetFormatString ();
+
+ /* Draw checkbox */
+
+ if ((ctrl.Items.GetListBoxItem (e.Index)).State == CheckState.Checked)
+ state = ButtonState.Checked;
+ else
+ state = ButtonState.Normal;
+
+ if (ctrl.ThreeDCheckBoxes == false)
+ state |= ButtonState.Flat;
+
+ ControlPaint.DrawCheckBox (e.Graphics,
+ item_rect.X + checkbox_rect.X, item_rect.Y + checkbox_rect.Y,
+ checkbox_rect.Width, checkbox_rect.Height,
+ state);
+
+ item_rect.X += checkbox_rect.Width + checkbox_rect.X * 2;
+ item_rect.Width -= checkbox_rect.Width + checkbox_rect.X * 2;
+
+ /* Draw text*/
+ if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) {
+ back_color = ThemeEngine.Current.ColorHighlight;
+ fore_color = ThemeEngine.Current.ColorHighlightText;
+ }
+ else {
+ back_color = e.BackColor;
+ fore_color = e.ForeColor;
+ }
+
+ e.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush
+ (back_color), item_rect);
+
+ e.Graphics.DrawString (ctrl.GetItemText (ctrl.Items[e.Index]), e.Font,
+ ThemeEngine.Current.ResPool.GetSolidBrush (fore_color),
+ item_rect, string_format);
+
+ if ((e.State & DrawItemState.Focus) == DrawItemState.Focus) {
+ ThemeEngine.Current.CPDrawFocusRectangle (e.Graphics, item_rect,
+ fore_color, back_color);
+ }
+ }
+
+ #endregion // CheckedListBox
+
+ #region ComboBox
+
+ // Drawing
+
+ public override void DrawComboBoxEditDecorations (Graphics dc, ComboBox ctrl, Rectangle cl)
+ {
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), cl.X, cl.Y, cl.X + cl.Width, cl.Y); //top
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), cl.X + 1, cl.Y + 1, cl.X + cl.Width - 2, cl.Y + 1);
+ dc.DrawLine (ResPool.GetPen (ColorControl), cl.X, cl.Y + cl.Height - 2, cl.X + cl.Width, cl.Y + cl.Height - 2); //down
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), cl.X, cl.Y + cl.Height - 1, cl.X + cl.Width, cl.Y + cl.Height - 1);
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), cl.X, cl.Y, cl.X, cl.Y + cl.Height); //left
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), cl.X + 1, cl.Y + 1, cl.X + 1, cl.Y + cl.Height - 2);
+ dc.DrawLine (ResPool.GetPen (ColorControl), cl.X + cl.Width - 2, cl.Y, cl.X + cl.Width - 2, cl.Y + cl.Height); //right
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), cl.X + cl.Width - 1, cl.Y + 1 , cl.X + cl.Width - 1, cl.Y + cl.Height - 1);
+ }
+
+ // Sizing
+ public override int DrawComboBoxEditDecorationTop () { return 2;}
+ public override int DrawComboBoxEditDecorationBottom () { return 2;}
+ public override int DrawComboBoxEditDecorationRight () { return 2;}
+ public override int DrawComboBoxEditDecorationLeft () { return 2;}
+
+ private int DrawComboListBoxDecoration (ComboBoxStyle style)
+ {
+ if (style == ComboBoxStyle.Simple)
+ return 2;
+ else
+ return 1;
+ }
+
+ public override int DrawComboListBoxDecorationTop (ComboBoxStyle style)
+ {
+ return DrawComboListBoxDecoration (style);
+ }
+
+ public override int DrawComboListBoxDecorationBottom (ComboBoxStyle style)
+ {
+ return DrawComboListBoxDecoration (style);
+ }
+
+ public override int DrawComboListBoxDecorationRight (ComboBoxStyle style)
+ {
+ return DrawComboListBoxDecoration (style);
+ }
+
+ public override int DrawComboListBoxDecorationLeft (ComboBoxStyle style)
+ {
+ return DrawComboListBoxDecoration (style);
+ }
+
+ public override void DrawComboListBoxDecorations (Graphics dc, ComboBox ctrl, Rectangle cl)
+ {
+ if (ctrl.DropDownStyle == ComboBoxStyle.Simple) {
+ DrawComboBoxEditDecorations (dc, ctrl, cl);
+ }
+ else {
+ dc.DrawRectangle (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorWindowFrame),
+ cl.X, cl.Y, cl.Width - 1, cl.Height - 1);
+ }
+ }
+
+ public override void DrawComboBoxItem (ComboBox ctrl, DrawItemEventArgs e)
+ {
+ Color back_color, fore_color;
+ Rectangle text_draw = e.Bounds;
+ StringFormat string_format = new StringFormat ();
+ string_format.FormatFlags = StringFormatFlags.LineLimit;
+
+ if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) {
+ back_color = ThemeEngine.Current.ColorHighlight;
+ fore_color = ThemeEngine.Current.ColorHighlightText;
+ }
+ else {
+ back_color = e.BackColor;
+ fore_color = e.ForeColor;
+ }
+
+ e.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (back_color), e.Bounds);
+
+ if (e.Index != -1) {
+ e.Graphics.DrawString (ctrl.GetItemText (ctrl.Items[e.Index]), e.Font,
+ ThemeEngine.Current.ResPool.GetSolidBrush (fore_color),
+ text_draw, string_format);
+ }
+
+ if ((e.State & DrawItemState.Focus) == DrawItemState.Focus) {
+ ThemeEngine.Current.CPDrawFocusRectangle (e.Graphics, e.Bounds, fore_color, back_color);
+ }
+
+ string_format.Dispose ();
+ }
+
+ #endregion ComboBox
+
+ #region Datagrid
+ public override int DataGridPreferredColumnWidth { get { return 75;} }
+ public override int DataGridMinimumColumnCheckBoxHeight { get { return 16;} }
+ public override int DataGridMinimumColumnCheckBoxWidth { get { return 16;} }
+ public override Color DataGridAlternatingBackColor { get { return ColorWindow;} }
+ public override Color DataGridBackColor { get { return ColorWindow;} }
+ public override Color DataGridBackgroundColor { get { return ColorAppWorkspace;} }
+ public override Color DataGridCaptionBackColor { get { return ColorActiveCaption;} }
+ public override Color DataGridCaptionForeColor { get { return ColorActiveCaptionText;} }
+ public override Color DataGridGridLineColor { get { return ColorControl;} }
+ public override Color DataGridHeaderBackColor { get { return ColorControl;} }
+ public override Color DataGridHeaderForeColor { get { return ColorControlText;} }
+ public override Color DataGridLinkColor { get { return ColorHotTrack;} }
+ public override Color DataGridLinkHoverColor { get { return ColorHotTrack;} }
+ public override Color DataGridParentRowsBackColor { get { return ColorControl;} }
+ public override Color DataGridParentRowsForeColor { get { return ColorWindowText;} }
+ public override Color DataGridSelectionBackColor { get { return ColorActiveCaption;} }
+ public override Color DataGridSelectionForeColor { get { return ColorActiveCaptionText;} }
+
+ public override void DataGridPaint (PaintEventArgs pe, DataGrid grid)
+ {
+ // Draw parent rows
+ if (pe.ClipRectangle.IntersectsWith (grid.grid_drawing.parent_rows)) {
+ pe.Graphics.FillRectangle (ResPool.GetSolidBrush (grid.ParentRowsBackColor), grid.grid_drawing.parent_rows);
+ }
+
+ DataGridPaintCaption (pe.Graphics, pe.ClipRectangle, grid);
+ DataGridPaintColumnsHdrs (pe.Graphics, pe.ClipRectangle, grid);
+ DataGridPaintRowsHeaders (pe.Graphics, pe.ClipRectangle, grid);
+ DataGridPaintRows (pe.Graphics, grid.grid_drawing.cells_area, pe.ClipRectangle, grid);
+
+ // Paint scrollBar corner
+ if (grid.vert_scrollbar.Visible && grid.horiz_scrollbar.Visible) {
+
+ Rectangle corner = new Rectangle (grid.ClientRectangle.X + grid.ClientRectangle.Width - grid.horiz_scrollbar.Height,
+ grid.ClientRectangle.Y + grid.ClientRectangle.Height - grid.horiz_scrollbar.Height,
+ grid.horiz_scrollbar.Height, grid.horiz_scrollbar.Height);
+
+ if (pe.ClipRectangle.IntersectsWith (corner)) {
+ pe.Graphics.FillRectangle (ResPool.GetSolidBrush (grid.ParentRowsBackColor),
+ corner);
+ }
+ }
+ }
+
+ public override void DataGridPaintCaption (Graphics g, Rectangle clip, DataGrid grid)
+ {
+ Rectangle modified_area = clip;
+ modified_area.Intersect (grid.grid_drawing.caption_area);
+
+ g.FillRectangle (ResPool.GetSolidBrush (grid.CaptionBackColor),
+ modified_area);
+
+ g.DrawString (grid.CaptionText, grid.CaptionFont,
+ ThemeEngine.Current.ResPool.GetSolidBrush (grid.CaptionForeColor),
+ grid.grid_drawing.caption_area);
+ }
+
+ public override void DataGridPaintColumnsHdrs (Graphics g, Rectangle clip, DataGrid grid)
+ {
+ Rectangle columns_area = grid.grid_drawing.columnshdrs_area;
+
+ if (grid.CurrentTableStyle.CurrentRowHeadersVisible) { // Paint corner shared between row and column header
+ Rectangle rect_bloc = grid.grid_drawing.columnshdrs_area;
+ rect_bloc.Width = grid.RowHeaderWidth;
+ rect_bloc.Height = grid.grid_drawing.columnshdrs_area.Height;
+ if (clip.IntersectsWith (rect_bloc)) {
+ if (grid.visiblecolumn_count > 0) {
+ g.FillRectangle (ResPool.GetSolidBrush (grid.CurrentTableStyle.CurrentHeaderBackColor), rect_bloc);
+ }else {
+ g.FillRectangle (ResPool.GetSolidBrush (grid.BackgroundColor), rect_bloc);
+ }
+ }
+
+ columns_area.X += grid.RowHeaderWidth;
+ columns_area.Width -= grid.RowHeaderWidth;
+ }
+
+ // Set unused area
+ Rectangle columnshdrs_area_complete = columns_area;
+ columnshdrs_area_complete.Width = grid.grid_drawing.columnshdrs_maxwidth;
+
+ if (grid.CurrentTableStyle.CurrentRowHeadersVisible) {
+ columnshdrs_area_complete.Width -= grid.RowHeaderWidth;
+ }
+
+ // Set column painting
+ Rectangle rect_columnhdr = new Rectangle ();
+ int col_pixel;
+ Region current_clip;
+ rect_columnhdr.Y = columns_area.Y;
+ rect_columnhdr.Height = columns_area.Height;
+
+ current_clip = new Region (columns_area);
+ g.Clip = current_clip;
+ int column_cnt = grid.first_visiblecolumn + grid.visiblecolumn_count;
+ for (int column = grid.first_visiblecolumn; column < column_cnt; column++) {
+
+ col_pixel = grid.grid_drawing.GetColumnStartingPixel (column);
+ rect_columnhdr.X = columns_area.X + col_pixel - grid.horz_pixeloffset;
+ rect_columnhdr.Width = grid.CurrentTableStyle.GridColumnStyles[column].Width;
+
+ if (clip.IntersectsWith (rect_columnhdr) == false)
+ continue;
+
+ grid.CurrentTableStyle.GridColumnStyles[column].PaintHeader (g, rect_columnhdr, column);
+
+
+ }
+
+ current_clip.Dispose ();
+ g.ResetClip ();
+
+ // This fills with background colour the unused part in the row headers
+ if (rect_columnhdr.X + rect_columnhdr.Height < grid.ClientRectangle.X + grid.ClientRectangle.Width) {
+
+ Rectangle not_usedarea = columnshdrs_area_complete;
+ not_usedarea.X = rect_columnhdr.X + rect_columnhdr.Width;
+ not_usedarea.Width = grid.ClientRectangle.X + grid.ClientRectangle.Width - rect_columnhdr.X - rect_columnhdr.Height;
+
+ g.FillRectangle (ResPool.GetSolidBrush (grid.BackgroundColor),
+ not_usedarea);
+ }
+ }
+
+ public override void DataGridPaintRowsHeaders (Graphics g, Rectangle clip, DataGrid grid)
+ {
+ Rectangle rowshdrs_area_complete = grid.grid_drawing.rowshdrs_area;
+ rowshdrs_area_complete.Height = grid.grid_drawing.rowshdrs_maxheight;
+ Rectangle rect_row = new Rectangle ();
+ rect_row.X = grid.grid_drawing.rowshdrs_area.X;
+ int last_y = 0;
+ int rowcnt = grid.FirstVisibleRow + grid.VisibleRowCount;
+
+ if (rowcnt < grid.RowsCount) { // Paint one row more for partial rows
+ rowcnt++;
+ }
+
+ g.SetClip (grid.grid_drawing.rowshdrs_area);
+ for (int row = grid.FirstVisibleRow; row < rowcnt; row++) {
+
+ rect_row.Width = grid.grid_drawing.rowshdrs_area.Width;
+ rect_row.Height = grid.RowHeight;
+ rect_row.Y = grid.grid_drawing.rowshdrs_area.Y + ((row - grid.FirstVisibleRow) * grid.RowHeight);
+
+ if (clip.IntersectsWith (rect_row)) {
+ DataGridPaintRowHeader (g, rect_row, row, grid);
+ last_y = rect_row.Y;
+ }
+ }
+
+ g.ResetClip ();
+
+ // This fills with background colour the unused part in the row headers
+ if (last_y > 0 && rect_row.Y + rect_row.Height < grid.grid_drawing.cells_area.Y + grid.grid_drawing.cells_area.Height) {
+ Rectangle not_usedarea = clip;
+ not_usedarea.Intersect (rowshdrs_area_complete);
+
+ not_usedarea.Y = rect_row.Y + rect_row.Height;
+ not_usedarea.Height = rowshdrs_area_complete.Y + rowshdrs_area_complete.Height - rect_row.Height - rect_row.Y;
+ g.FillRectangle (ResPool.GetSolidBrush (grid.BackgroundColor),
+ not_usedarea);
+ }
+
+
+ }
+
+ public override void DataGridPaintRowHeaderArrow (Graphics g, Rectangle bounds, DataGrid grid)
+ {
+ Point[] arrow = new Point[3];
+ Point P1, P2, P3;
+ int centerX, centerY, shiftX;
+ Rectangle rect;
+
+ rect = new Rectangle (bounds.X + bounds.Width /4,
+ bounds.Y + bounds.Height/4, bounds.Width / 2, bounds.Height / 2);
+
+ centerX = rect.Left + rect.Width / 2;
+ centerY = rect.Top + rect.Height / 2;
+ shiftX = Math.Max (1, rect.Width / 8);
+ rect.X -= shiftX;
+ centerX -= shiftX;
+ P1 = new Point (centerX, rect.Top - 1);
+ P2 = new Point (centerX, rect.Bottom);
+ P3 = new Point (rect.Right, centerY);
+ arrow[0] = P1;
+ arrow[1] = P2;
+ arrow[2] = P3;
+
+ g.FillPolygon (ThemeEngine.Current.ResPool.GetSolidBrush
+ (grid.CurrentTableStyle.CurrentHeaderForeColor), arrow, FillMode.Winding);
+ }
+
+ public override void DataGridPaintRowHeader (Graphics g, Rectangle bounds, int row, DataGrid grid)
+ {
+ // Background
+ g.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (grid.CurrentTableStyle.CurrentHeaderBackColor),
+ bounds);
+
+ if (grid.FlatMode == false) {
+
+ // Paint Borders
+ g.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorControlLight),
+ bounds.X, bounds.Y, bounds.X + bounds.Width, bounds.Y);
+
+ g.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorControlLight),
+ bounds.X, bounds.Y + 1, bounds.X, bounds.Y + bounds.Height - 1);
+
+ g.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorControlDark),
+ bounds.X + bounds.Width - 1, bounds.Y + 1 , bounds.X + bounds.Width - 1, bounds.Y + bounds.Height - 1);
+
+ g.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorControlDark),
+ bounds.X, bounds.Y + bounds.Height -1, bounds.X + bounds.Width, bounds.Y + bounds.Height -1);
+ }
+
+ if (grid.ShowEditRow && row == grid.RowsCount && !(row == grid.CurrentCell.RowNumber && grid.is_changing == true)) {
+
+ g.DrawString ("*", grid.grid_drawing.font_newrow, ResPool.GetSolidBrush (grid.CurrentTableStyle.CurrentHeaderForeColor),
+ bounds);
+
+ } else {
+ // Draw arrow
+ if (row == grid.CurrentCell.RowNumber) {
+
+ if (grid.is_changing == true) {
+ g.DrawString ("...", grid.Font,
+ ThemeEngine.Current.ResPool.GetSolidBrush (grid.CurrentTableStyle.CurrentHeaderForeColor),
+ bounds);
+
+ } else {
+
+ Rectangle rect = new Rectangle (bounds.X - 2, bounds.Y, 18, 18);
+ DataGridPaintRowHeaderArrow (g, rect, grid);
+ }
+ }
+ }
+ }
+
+ public override void DataGridPaintRows (Graphics g, Rectangle cells, Rectangle clip, DataGrid grid)
+ {
+ Rectangle rect_row = new Rectangle ();
+ Rectangle not_usedarea = new Rectangle ();
+ rect_row.X = cells.X;
+
+ int rowcnt = grid.FirstVisibleRow + grid.VisibleRowCount;
+
+ if (grid.ShowEditRow) {
+ rowcnt--;
+ }
+
+ if (rowcnt < grid.RowsCount) { // Paint one row more for partial rows
+ rowcnt++;
+ }
+
+ rect_row.Height = grid.RowHeight;
+ rect_row.Width = cells.Width;
+ for (int row = grid.FirstVisibleRow; row < rowcnt; row++) {
+ rect_row.Y = cells.Y + ((row - grid.FirstVisibleRow) * grid.RowHeight);
+ if (clip.IntersectsWith (rect_row)) {
+ DataGridPaintRow (g, row, rect_row, false, grid);
+ }
+ }
+
+ if (grid.ShowEditRow && grid.FirstVisibleRow + grid.VisibleRowCount == grid.RowsCount + 1) {
+ rect_row.Y = cells.Y + ((rowcnt - grid.FirstVisibleRow) * grid.RowHeight);
+ if (clip.IntersectsWith (rect_row)) {
+ DataGridPaintRow (g, rowcnt, rect_row, true, grid);
+ }
+ }
+
+ not_usedarea.Height = cells.Y + cells.Height - rect_row.Y - rect_row.Height;
+ not_usedarea.Y = rect_row.Y + rect_row.Height;
+ not_usedarea.Width = rect_row.Width = cells.Width;
+ not_usedarea.X = cells.X;
+
+ g.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (grid.BackgroundColor),
+ not_usedarea);
+ }
+
+ public override void DataGridPaintRow (Graphics g, int row, Rectangle row_rect, bool is_newrow, DataGrid grid)
+ {
+ Rectangle rect_cell = new Rectangle ();
+ int col_pixel;
+ Color backcolor, forecolor;
+ Region prev_clip = g.Clip;
+ Region current_clip;
+ Rectangle not_usedarea = new Rectangle ();
+
+ rect_cell.Y = row_rect.Y;
+ rect_cell.Height = row_rect.Height;
+
+ // PaintCells at row, column
+ int column_cnt = grid.first_visiblecolumn + grid.visiblecolumn_count;
+ for (int column = grid.first_visiblecolumn; column < column_cnt; column++) {
+
+ col_pixel = grid.grid_drawing.GetColumnStartingPixel (column);
+
+ rect_cell.X = row_rect.X + col_pixel - grid.horz_pixeloffset;
+ rect_cell.Width = grid.CurrentTableStyle.GridColumnStyles[column].Width;
+
+ current_clip = new Region (row_rect);
+ g.Clip = current_clip;
+
+ if (grid.IsSelected (row)) {
+ backcolor = grid.SelectionBackColor;
+ forecolor = grid.SelectionForeColor;
+ } else {
+ if (row % 2 == 0) {
+ backcolor = grid.BackColor;
+ } else {
+ backcolor = grid.AlternatingBackColor;
+ }
+
+ forecolor = grid.ForeColor;
+ }
+
+ if (is_newrow) {
+ grid.CurrentTableStyle.GridColumnStyles[column].PaintNewRow (g, rect_cell,
+ ThemeEngine.Current.ResPool.GetSolidBrush (backcolor),
+ ThemeEngine.Current.ResPool.GetSolidBrush (forecolor));
+
+ } else {
+ grid.CurrentTableStyle.GridColumnStyles[column].Paint (g, rect_cell, grid.ListManager, row,
+ ThemeEngine.Current.ResPool.GetSolidBrush (backcolor),
+ ThemeEngine.Current.ResPool.GetSolidBrush (forecolor),
+ grid.RightToLeft == RightToLeft.Yes);
+ }
+
+ g.Clip = prev_clip;
+ current_clip.Dispose ();
+ }
+
+ if (row_rect.X + row_rect.Width > rect_cell.X + rect_cell.Width) {
+
+ not_usedarea.X = rect_cell.X + rect_cell.Width;
+ not_usedarea.Width = row_rect.X + row_rect.Width - rect_cell.X - rect_cell.Width;
+ not_usedarea.Y = row_rect.Y;
+ not_usedarea.Height = row_rect.Height;
+ g.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (grid.BackgroundColor),
+ not_usedarea);
+ }
+ }
+
+ #endregion // Datagrid
+
+ #region DateTimePicker
+
+ public override void DrawDateTimePicker (Graphics dc, Rectangle clip_rectangle, DateTimePicker dtp) {
+ // if not showing the numeric updown control then render border
+ if (!dtp.ShowUpDown && clip_rectangle.IntersectsWith (dtp.ClientRectangle)) {
+ // draw the outer border
+ Rectangle button_bounds = dtp.ClientRectangle;
+ this.CPDrawBorder3D (dc, button_bounds, Border3DStyle.Sunken, Border3DSide.All, dtp.BackColor);
+
+ // deflate by the border width
+ if (clip_rectangle.IntersectsWith (dtp.drop_down_arrow_rect)) {
+ button_bounds.Inflate (-2,-2);
+ ButtonState state = dtp.is_drop_down_visible ? ButtonState.Pushed : ButtonState.Normal;
+ this.CPDrawComboButton (
+ dc,
+ dtp.drop_down_arrow_rect,
+ state);
+ }
+ }
+
+ // render the date part
+ if (clip_rectangle.IntersectsWith (dtp.date_area_rect)) {
+ // fill the background
+ dc.FillRectangle (ResPool.GetSolidBrush (ThemeEngine.Current.ColorWindow), dtp.date_area_rect);
+
+ // fill the currently highlighted area
+ if (dtp.hilight_date_area != Rectangle.Empty) {
+ dc.FillRectangle (ResPool.GetSolidBrush (ThemeEngine.Current.ColorHighlight), dtp.hilight_date_area);
+ }
+
+ // draw the text part
+ // TODO: if date format is CUstom then we need to draw the dates as separate parts
+ StringFormat text_format = new StringFormat();
+ text_format.LineAlignment = StringAlignment.Center;
+ text_format.Alignment = StringAlignment.Near;
+ dc.DrawString (dtp.Text, dtp.Font, ResPool.GetSolidBrush (dtp.ForeColor), Rectangle.Inflate(dtp.date_area_rect, -1, -1), text_format);
+ text_format.Dispose ();
+ }
+ }
+
+ #endregion // DateTimePicker
+
+ #region GroupBox
+ public override void DrawGroupBox (Graphics dc, Rectangle area, GroupBox box) {
+ StringFormat text_format;
+ SizeF size;
+ int width;
+ int y;
+ Rectangle rect;
+
+ rect = box.ClientRectangle;
+
+ // Needed once the Dark/Light code below is enabled again
+ //Color disabled = ColorGrayText;
+
+ Pen pen_light = ResPool.GetPen (Color.FromArgb (255,255,255,255));
+ Pen pen_dark = ResPool.GetPen (Color.FromArgb (255, 128, 128,128));
+
+ // TODO: When the Light and Dark methods work this code should be activate it
+ //Pen pen_light = new Pen (ControlPaint.Light (disabled, 1));
+ //Pen pen_dark = new Pen (ControlPaint.Dark (disabled, 0));
+
+ dc.FillRectangle (ResPool.GetSolidBrush (box.BackColor), rect);
+
+ text_format = new StringFormat();
+ text_format.HotkeyPrefix = HotkeyPrefix.Show;
+
+ size = dc.MeasureString (box.Text, box.Font);
+ width = (int) size.Width;
+
+ if (width > box.Width - 16)
+ width = box.Width - 16;
+
+ y = box.Font.Height / 2;
+
+ /* Draw group box*/
+ dc.DrawLine (pen_dark, 0, y, 8, y); // top
+ dc.DrawLine (pen_light, 0, y + 1, 8, y + 1);
+ dc.DrawLine (pen_dark, 8 + width, y, box.Width, y);
+ dc.DrawLine (pen_light, 8 + width, y + 1, box.Width, y + 1);
+
+ dc.DrawLine (pen_dark, 0, y + 1, 0, box.Height); // left
+ dc.DrawLine (pen_light, 1, y + 1, 1, box.Height);
+
+ dc.DrawLine (pen_dark, 0, box.Height - 2, box.Width, box.Height - 2); // bottom
+ dc.DrawLine (pen_light, 0, box.Height - 1, box.Width, box.Height - 1);
+
+ dc.DrawLine (pen_dark, box.Width - 2, y, box.Width - 2, box.Height - 2); // right
+ dc.DrawLine (pen_light, box.Width - 1, y, box.Width - 1, box.Height - 2);
+
+
+ /* Text */
+ if (box.Enabled) {
+ dc.DrawString (box.Text, box.Font, ResPool.GetSolidBrush (box.ForeColor), 10, 0, text_format);
+ } else {
+ CPDrawStringDisabled (dc, box.Text, box.Font, box.ForeColor,
+ new RectangleF (10, 0, width, box.Font.Height), text_format);
+ }
+ text_format.Dispose ();
+ }
+
+ public override Size GroupBoxDefaultSize {
+ get {
+ return new Size (200,100);
+ }
+ }
+ #endregion
+
+ #region HScrollBar
+ public override Size HScrollBarDefaultSize {
+ get {
+ return new Size (80, this.ScrollBarButtonSize);
+ }
+ }
+
+ #endregion // HScrollBar
+
+ #region Label
+ public override void DrawLabel (Graphics dc, Rectangle clip_rectangle, Label label)
+ {
+ dc.FillRectangle (ResPool.GetSolidBrush (label.BackColor), clip_rectangle);
+
+ if (label.Enabled) {
+ dc.DrawString (label.Text, label.Font, ResPool.GetSolidBrush (label.ForeColor), clip_rectangle, label.string_format);
+ } else {
+ ControlPaint.DrawStringDisabled (dc, label.Text, label.Font, label.ForeColor, clip_rectangle, label.string_format);
+ }
+
+ }
+
+ public override Size LabelDefaultSize {
+ get {
+ return new Size (100, 23);
+ }
+ }
+ #endregion // Label
+
+ #region LinkLabel
+ public override void DrawLinkLabel (Graphics dc, Rectangle clip_rectangle, LinkLabel label)
+ {
+ Color color;
+
+ dc.FillRectangle (ResPool.GetSolidBrush (label.BackColor), clip_rectangle);
+
+ for (int i = 0; i < label.num_pieces; i++) {
+
+ if (clip_rectangle.IntersectsWith (label.pieces[i].rect) == false) {
+ continue;
+ }
+
+ color = label.GetLinkColor (label.pieces[i], i);
+
+ if (label.pieces[i].link == null)
+ dc.DrawString (label.pieces[i].text, label.GetPieceFont (label.pieces[i]), ResPool.GetSolidBrush (Color.Black),
+ label.pieces[i].rect.X, label.pieces[i].rect.Y);
+ else
+ dc.DrawString (label.pieces[i].text, label.GetPieceFont (label.pieces[i]), ResPool.GetSolidBrush (color),
+ label.pieces[i].rect.X, label.pieces[i].rect.Y);
+
+ if (label.pieces[i].focused) {
+ CPDrawFocusRectangle (dc, label.pieces[i].rect, label.ForeColor, label.BackColor);
+ }
+ }
+
+ }
+ #endregion // LinkLabel
+ #region ListBox
+
+ // Drawing
+
+ private int DrawListBoxDecorationSize (BorderStyle border_style)
+ {
+ switch (border_style) {
+ case BorderStyle.Fixed3D:
+ return 2;
+ case BorderStyle.FixedSingle:
+ return 1;
+ case BorderStyle.None:
+ default:
+ break;
+ }
+
+ return 0;
+ }
+
+ // Sizing
+ public override void DrawListBoxItem (ListBox ctrl, DrawItemEventArgs e)
+ {
+ Color back_color, fore_color;
+ StringFormat string_format = ctrl.GetFormatString ();
+
+ if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) {
+ back_color = ThemeEngine.Current.ColorHighlight;
+ fore_color = ThemeEngine.Current.ColorHighlightText;
+ }
+ else {
+ back_color = e.BackColor;
+ fore_color = e.ForeColor;
+ }
+
+ e.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush
+ (back_color), e.Bounds);
+
+ e.Graphics.DrawString (ctrl.GetItemText (ctrl.Items[e.Index]), e.Font,
+ ThemeEngine.Current.ResPool.GetSolidBrush (fore_color),
+ e.Bounds.X, e.Bounds.Y, string_format);
+
+ if ((e.State & DrawItemState.Focus) == DrawItemState.Focus) {
+ ThemeEngine.Current.CPDrawFocusRectangle (e.Graphics, e.Bounds,
+ fore_color, back_color);
+ }
+ }
+
+ #endregion ListBox
+
+ #region ListView
+ // Drawing
+ public override void DrawListView (Graphics dc, Rectangle clip, ListView control)
+ {
+ bool details = (control.View == View.Details);
+ Rectangle client_area_nohdrs;
+ DrawListViewHeader (dc, clip, control);
+
+ if (details && control.HeaderStyle != ColumnHeaderStyle.None && control.Columns.Count > 0) {
+ client_area_nohdrs = control.client_area;
+ client_area_nohdrs.Y += control.Columns[0].Ht;
+ client_area_nohdrs.Height -= control.Columns[0].Ht;
+ dc.SetClip (client_area_nohdrs);
+ } else
+ dc.SetClip (control.client_area);
+
+ dc.FillRectangle (ResPool.GetSolidBrush (control.BackColor), clip);
+
+ // In case of details view draw the items only if
+ // columns are non-zero
+ if (!details || control.Columns.Count > 0) {
+ int first = control.FirstVisibleIndex;
+
+ for (int i = first; i <= control.LastItemIndex; i ++) {
+ if (clip.IntersectsWith (control.Items[i].GetBounds (ItemBoundsPortion.Entire)))
+ DrawListViewItem (dc, control, control.Items[i]);
+ }
+ }
+
+ // draw the gridlines
+ if (details && control.GridLines) {
+ int top = (control.HeaderStyle == ColumnHeaderStyle.None) ?
+ 2 : control.Font.Height + 2;
+
+ // draw vertical gridlines
+ foreach (ColumnHeader col in control.Columns)
+ dc.DrawLine (this.ResPool.GetPen (this.ColorControl),
+ col.Rect.Right, top,
+ col.Rect.Right, control.TotalHeight);
+ // draw horizontal gridlines
+ ListViewItem last_item = null;
+ foreach (ListViewItem item in control.Items) {
+ dc.DrawLine (this.ResPool.GetPen (this.ColorControl),
+ item.GetBounds (ItemBoundsPortion.Entire).Left, item.GetBounds (ItemBoundsPortion.Entire).Top,
+ control.TotalWidth, item.GetBounds (ItemBoundsPortion.Entire).Top);
+ last_item = item;
+ }
+
+ // draw a line after at the bottom of the last item
+ if (last_item != null) {
+ dc.DrawLine (this.ResPool.GetPen (this.ColorControl),
+ last_item.GetBounds (ItemBoundsPortion.Entire).Left,
+ last_item.GetBounds (ItemBoundsPortion.Entire).Bottom,
+ control.TotalWidth,
+ last_item.GetBounds (ItemBoundsPortion.Entire).Bottom);
+ }
+ }
+
+ dc.ResetClip ();
+
+ // Draw corner between the two scrollbars
+ if (control.h_scroll.Visible == true && control.h_scroll.Visible == true) {
+ Rectangle rect = new Rectangle ();
+ rect.X = control.h_scroll.Location.X + control.h_scroll.Width;
+ rect.Width = control.v_scroll.Width;
+ rect.Y = control.v_scroll.Location.Y + control.v_scroll.Height;
+ rect.Height = control.h_scroll.Height;
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControl), rect);
+ }
+
+ }
+
+ private void DrawListViewHeader (Graphics dc, Rectangle clip, ListView control)
+ {
+ bool details = (control.View == View.Details);
+
+ // border is drawn directly in the Paint method
+ if (details && control.HeaderStyle != ColumnHeaderStyle.None) {
+ dc.FillRectangle (ResPool.GetSolidBrush (control.BackColor),
+ 0, 0, control.TotalWidth, control.Font.Height + 5);
+ if (control.Columns.Count > 0) {
+ if (control.HeaderStyle == ColumnHeaderStyle.Clickable) {
+ foreach (ColumnHeader col in control.Columns) {
+ Rectangle rect = col.Rect;
+ rect.X -= control.h_marker;
+ this.CPDrawButton (dc, rect,
+ (col.Pressed ?
+ ButtonState.Pushed :
+ ButtonState.Normal));
+ dc.DrawString (col.Text, ThemeEngine.Current.DefaultFont,
+ ResPool.GetSolidBrush
+ (this.ColorControlText),
+ rect.X + 3,
+ rect.Y + rect.Height/2 + 1,
+ col.Format);
+ }
+ }
+ // Non-clickable columns
+ else {
+ foreach (ColumnHeader col in control.Columns) {
+ Rectangle rect = col.Rect;
+ rect.X -= control.h_marker;
+ this.CPDrawButton (dc, rect, ButtonState.Flat);
+ dc.DrawString (col.Text, ThemeEngine.Current.DefaultFont,
+ ResPool.GetSolidBrush
+ (this.ColorControlText),
+ rect.X + 3,
+ rect.Y + rect.Height/2 + 1,
+ col.Format);
+ }
+ }
+ }
+ }
+ }
+
+ // draws the ListViewItem of the given index
+ protected virtual void DrawListViewItem (Graphics dc, ListView control, ListViewItem item)
+ {
+ Rectangle rect_checkrect = item.CheckRectReal;
+ Rectangle rect_iconrect = item.GetBounds (ItemBoundsPortion.Icon);
+ Rectangle full_rect = item.GetBounds (ItemBoundsPortion.Entire);
+ Rectangle text_rect = item.GetBounds (ItemBoundsPortion.Label);
+
+ if (control.CheckBoxes) {
+ if (control.StateImageList == null) {
+ // Make sure we've got at least a line width of 1
+ int check_wd = Math.Max (3, rect_checkrect.Width / 6);
+ int scale = Math.Max (1, rect_checkrect.Width / 12);
+
+ // set the checkbox background
+ dc.FillRectangle (this.ResPool.GetSolidBrush (this.ColorWindow),
+ rect_checkrect);
+ // define a rectangle inside the border area
+ Rectangle rect = new Rectangle (rect_checkrect.X + 2,
+ rect_checkrect.Y + 2,
+ rect_checkrect.Width - 4,
+ rect_checkrect.Height - 4);
+ Pen pen = new Pen (this.ColorWindowText, 2);
+ dc.DrawRectangle (pen, rect);
+
+ // Need to draw a check-mark
+ if (item.Checked) {
+ pen.Width = 1;
+ // adjustments to get the check-mark at the right place
+ rect.X ++; rect.Y ++;
+ // following logic is taken from DrawFrameControl method
+ for (int i = 0; i < check_wd; i++) {
+ dc.DrawLine (pen, rect.Left + check_wd / 2,
+ rect.Top + check_wd + i,
+ rect.Left + check_wd / 2 + 2 * scale,
+ rect.Top + check_wd + 2 * scale + i);
+ dc.DrawLine (pen,
+ rect.Left + check_wd / 2 + 2 * scale,
+ rect.Top + check_wd + 2 * scale + i,
+ rect.Left + check_wd / 2 + 6 * scale,
+ rect.Top + check_wd - 2 * scale + i);
+ }
+ }
+ }
+ else {
+ if (item.Checked && control.StateImageList.Images.Count > 1)
+ control.StateImageList.Draw (dc,
+ rect_checkrect.Location, 1);
+ else if (! item.Checked && control.StateImageList.Images.Count > 0)
+ control.StateImageList.Draw (dc,
+ rect_checkrect.Location, 0);
+ }
+ }
+
+ // Item is drawn as a special case, as it is not just text
+ if (control.View == View.LargeIcon) {
+ if (item.ImageIndex > -1 &&
+ control.LargeImageList != null &&
+ item.ImageIndex < control.LargeImageList.Images.Count)
+ control.LargeImageList.Draw (dc, rect_iconrect.Location,
+ item.ImageIndex);
+ }
+ else {
+ if (item.ImageIndex > -1 &&
+ control.SmallImageList != null &&
+ item.ImageIndex < control.SmallImageList.Images.Count)
+ control.SmallImageList.Draw (dc, rect_iconrect.Location,
+ item.ImageIndex);
+ }
+
+ // draw the item text
+ // format for the item text
+ StringFormat format = new StringFormat ();
+ format.LineAlignment = StringAlignment.Center;
+ if (control.View == View.LargeIcon)
+ format.Alignment = StringAlignment.Center;
+ else
+ format.Alignment = StringAlignment.Near;
+
+ if (!control.LabelWrap)
+ format.FormatFlags = StringFormatFlags.NoWrap;
+
+ if (item.Selected) {
+ if (control.View == View.Details) {
+ if (control.FullRowSelect) {
+ // fill the entire rect excluding the checkbox
+ full_rect.Location = item.LabelRect.Location;
+ dc.FillRectangle (this.ResPool.GetSolidBrush
+ (this.ColorHighlight), full_rect);
+ }
+ else {
+ Size text_size = Size.Ceiling (dc.MeasureString (item.Text,
+ item.Font));
+ text_rect.Width = text_size.Width;
+ dc.FillRectangle (this.ResPool.GetSolidBrush
+ (this.ColorHighlight), text_rect);
+ }
+ }
+ else {
+ /*Size text_size = Size.Ceiling (dc.MeasureString (item.Text,
+ item.Font));
+ Point loc = text_rect.Location;
+ loc.X += (text_rect.Width - text_size.Width) / 2;
+ text_rect.Width = text_size.Width;*/
+ dc.FillRectangle (this.ResPool.GetSolidBrush (this.ColorHighlight),
+ text_rect);
+ }
+ }
+ else
+ dc.FillRectangle (ResPool.GetSolidBrush (item.BackColor), text_rect);
+
+ if (item.Text != null && item.Text.Length > 0) {
+ if (item.Selected)
+ dc.DrawString (item.Text, item.Font, this.ResPool.GetSolidBrush
+ (this.ColorHighlightText), text_rect, format);
+ else
+ dc.DrawString (item.Text, item.Font, this.ResPool.GetSolidBrush
+ (item.ForeColor), text_rect, format);
+ }
+
+ if (control.View == View.Details && control.Columns.Count > 0) {
+ // draw subitems for details view
+ ListViewItem.ListViewSubItemCollection subItems = item.SubItems;
+ int count = (control.Columns.Count < subItems.Count ?
+ control.Columns.Count : subItems.Count);
+
+ if (count > 0) {
+ ColumnHeader col;
+ ListViewItem.ListViewSubItem subItem;
+ Rectangle sub_item_rect = text_rect;
+
+ // set the format for subitems
+ format.FormatFlags = StringFormatFlags.NoWrap;
+ format.Alignment = StringAlignment.Near;
+
+ // 0th subitem is the item already drawn
+ for (int index = 1; index < count; index++) {
+ subItem = subItems [index];
+ col = control.Columns [index];
+ sub_item_rect.X = col.Rect.Left;
+ sub_item_rect.Width = col.Wd;
+ sub_item_rect.X -= control.h_marker;
+
+ SolidBrush sub_item_back_br = null;
+ SolidBrush sub_item_fore_br = null;
+ Font sub_item_font = null;
+
+ if (item.UseItemStyleForSubItems) {
+ sub_item_back_br = this.ResPool.GetSolidBrush
+ (item.BackColor);
+ sub_item_fore_br = this.ResPool.GetSolidBrush
+ (item.ForeColor);
+ sub_item_font = item.Font;
+ }
+ else {
+ sub_item_back_br = this.ResPool.GetSolidBrush
+ (subItem.BackColor);
+ sub_item_fore_br = this.ResPool.GetSolidBrush
+ (subItem.ForeColor);
+ sub_item_font = subItem.Font;
+ }
+
+ // In case of fullrowselect, background is filled
+ // for the entire rect above
+ if (item.Selected && control.FullRowSelect) {
+ if (subItem.Text != null && subItem.Text.Length > 0)
+ dc.DrawString (subItem.Text, sub_item_font,
+ this.ResPool.GetSolidBrush
+ (this.ColorHighlightText),
+ sub_item_rect, format);
+ }
+ else {
+ dc.FillRectangle (sub_item_back_br, sub_item_rect);
+ if (subItem.Text != null && subItem.Text.Length > 0)
+ dc.DrawString (subItem.Text, sub_item_font,
+ sub_item_fore_br,
+ sub_item_rect, format);
+ }
+ sub_item_rect.X += col.Wd;
+ }
+ }
+ }
+
+ if (item.Focused) {
+ if (item.Selected)
+ CPDrawFocusRectangle (dc, text_rect, ColorHighlightText, ColorHighlight);
+ else
+ CPDrawFocusRectangle (dc, text_rect, control.ForeColor, control.BackColor);
+ }
+
+ format.Dispose ();
+ }
+
+ // Sizing
+ public override Size ListViewCheckBoxSize {
+ get { return new Size (16, 16); }
+ }
+
+ public override int ListViewColumnHeaderHeight {
+ get { return 16; }
+ }
+
+ public override int ListViewDefaultColumnWidth {
+ get { return 60; }
+ }
+
+ public override int ListViewVerticalSpacing {
+ get { return 22; }
+ }
+
+ public override int ListViewEmptyColumnWidth {
+ get { return 10; }
+ }
+
+ public override int ListViewHorizontalSpacing {
+ get { return 10; }
+ }
+
+ public override Size ListViewDefaultSize {
+ get { return new Size (121, 97); }
+ }
+ #endregion // ListView
+
+ #region Menus
+ public override void CalcItemSize (Graphics dc, MenuItem item, int y, int x, bool menuBar)
+ {
+ item.X = x;
+ item.Y = y;
+
+ if (item.Visible == false) {
+ item.Width = 0;
+ item.Height = 0;
+ return;
+ }
+
+ if (item.Separator == true) {
+ item.Height = SEPARATOR_HEIGHT / 2;
+ item.Width = -1;
+ return;
+ }
+
+ if (item.MeasureEventDefined) {
+ MeasureItemEventArgs mi = new MeasureItemEventArgs (dc, item.Index);
+ item.PerformMeasureItem (mi);
+ item.Height = mi.ItemHeight;
+ item.Width = mi.ItemWidth;
+ return;
+ } else {
+ SizeF size;
+ size = dc.MeasureString (item.Text, ThemeEngine.Current.MenuFont);
+ item.Width = (int) size.Width;
+ item.Height = (int) size.Height;
+
+ if (!menuBar) {
+ if (item.Shortcut != Shortcut.None && item.ShowShortcut) {
+ item.XTab = ThemeEngine.Current.MenuCheckSize.Width + MENU_TAB_SPACE + (int) size.Width;
+ size = dc.MeasureString (" " + item.GetShortCutText (), ThemeEngine.Current.MenuFont);
+ item.Width += MENU_TAB_SPACE + (int) size.Width;
+ }
+
+ item.Width += 4 + (ThemeEngine.Current.MenuCheckSize.Width * 2);
+ } else {
+ item.Width += MENU_BAR_ITEMS_SPACE;
+ x += item.Width;
+ }
+
+ if (item.Height < ThemeEngine.Current.MenuHeight)
+ item.Height = ThemeEngine.Current.MenuHeight;
+ }
+ }
+
+ // Updates the menu rect and returns the height
+ public override int CalcMenuBarSize (Graphics dc, Menu menu, int width)
+ {
+ int x = 0;
+ int y = 0;
+ menu.Height = 0;
+
+ foreach (MenuItem item in menu.MenuItems) {
+
+ CalcItemSize (dc, item, y, x, true);
+
+ if (x + item.Width > width) {
+ item.X = 0;
+ y += item.Height;
+ item.Y = y;
+ x = 0;
+ }
+
+ x += item.Width;
+ item.MenuBar = true;
+
+ if (y + item.Height > menu.Height)
+ menu.Height = item.Height + y;
+ }
+
+ menu.Width = width;
+ return menu.Height;
+ }
+
+ public override void CalcPopupMenuSize (Graphics dc, Menu menu)
+ {
+ int x = 3;
+ int start = 0;
+ int i, n, y, max;
+
+ menu.Height = 0;
+
+ while (start < menu.MenuItems.Count) {
+ y = 2;
+ max = 0;
+ for (i = start; i < menu.MenuItems.Count; i++) {
+ MenuItem item = menu.MenuItems [i];
+
+ if ((i != start) && (item.Break || item.BarBreak))
+ break;
+
+ CalcItemSize (dc, item, y, x, false);
+ y += item.Height;
+
+ if (item.Width > max)
+ max = item.Width;
+ }
+
+ // Replace the -1 by the menu width (separators)
+ for (n = start; n < i; n++, start++)
+ menu.MenuItems [n].Width = max;
+
+ if (y > menu.Height)
+ menu.Height = y;
+
+ x+= max;
+ }
+
+ menu.Width = x;
+
+ //space for border
+ menu.Width += 2;
+ menu.Height += 2;
+
+ menu.Width += SM_CXBORDER;
+ menu.Height += SM_CYBORDER;
+ }
+
+ // Draws a menu bar in a window
+ public override void DrawMenuBar (Graphics dc, Menu menu, Rectangle rect)
+ {
+ if (menu.Height == 0)
+ ThemeEngine.Current.CalcMenuBarSize (dc, menu, rect.Width);
+
+ bool keynav = (menu as MainMenu).tracker.Navigating;
+ HotkeyPrefix hp = always_draw_hotkeys || keynav ? HotkeyPrefix.Show : HotkeyPrefix.Hide;
+ string_format_menu_menubar_text.HotkeyPrefix = hp;
+ string_format_menu_text.HotkeyPrefix = hp;
+
+ rect.Height = menu.Height;
+ dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (menu.Wnd.BackColor), rect);
+
+ for (int i = 0; i < menu.MenuItems.Count; i++) {
+ MenuItem item = menu.MenuItems [i];
+ Rectangle item_rect = item.bounds;
+ item_rect.X += rect.X;
+ item_rect.Y += rect.Y;
+ item.MenuHeight = menu.Height;
+ item.PerformDrawItem (new DrawItemEventArgs (dc, ThemeEngine.Current.MenuFont, item_rect, i, item.Status));
+ }
+ }
+
+ public override void DrawMenuItem (MenuItem item, DrawItemEventArgs e)
+ {
+ StringFormat string_format;
+ Rectangle rect_text = e.Bounds;
+
+ if (item.Visible == false)
+ return;
+
+ if (item.MenuBar)
+ string_format = string_format_menu_menubar_text;
+ else
+ string_format = string_format_menu_text;
+
+ if (item.Separator == true) {
+ e.Graphics.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorControlDark),
+ e.Bounds.X, e.Bounds.Y, e.Bounds.X + e.Bounds.Width, e.Bounds.Y);
+
+ e.Graphics.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorControlLight),
+ e.Bounds.X, e.Bounds.Y + 1, e.Bounds.X + e.Bounds.Width, e.Bounds.Y + 1);
+
+ return;
+ }
+
+ if (!item.MenuBar)
+ rect_text.X += ThemeEngine.Current.MenuCheckSize.Width;
+
+ if (item.BarBreak) { /* Draw vertical break bar*/
+ Rectangle rect = e.Bounds;
+ rect.Y++;
+ rect.Width = 3;
+ rect.Height = item.MenuHeight - 6;
+
+ e.Graphics.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorControlDark),
+ rect.X, rect.Y , rect.X, rect.Y + rect.Height);
+
+ e.Graphics.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorControlLight),
+ rect.X + 1, rect.Y , rect.X +1, rect.Y + rect.Height);
+ }
+
+ Color color_text;
+ Color color_back;
+
+ if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) {
+ color_text = ThemeEngine.Current.ColorHighlightText;
+ color_back = ThemeEngine.Current.ColorHighlight;
+ } else {
+ color_text = ThemeEngine.Current.ColorMenuText;
+ color_back = ThemeEngine.Current.ColorMenu;
+ }
+
+ /* Draw background */
+ Rectangle rect_back = e.Bounds;
+ rect_back.X++;
+ rect_back.Width -=2;
+ e.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (color_back), rect_back);
+
+ if (item.Enabled) {
+ e.Graphics.DrawString (item.Text, e.Font,
+ ThemeEngine.Current.ResPool.GetSolidBrush (color_text),
+ rect_text, string_format);
+
+ if (!item.MenuBar && item.Shortcut != Shortcut.None && item.ShowShortcut) {
+ string str = item.GetShortCutText ();
+ Rectangle rect = rect_text;
+ rect.X = item.XTab;
+ rect.Width -= item.XTab;
+
+ e.Graphics.DrawString (str, e.Font, ThemeEngine.Current.ResPool.GetSolidBrush (color_text),
+ rect, string_format_menu_shortcut);
+ }
+ } else {
+ ControlPaint.DrawStringDisabled (e.Graphics, item.Text, e.Font,
+ Color.Black, rect_text, string_format);
+ }
+
+ /* Draw arrow */
+ if (item.MenuBar == false && item.IsPopup || item.MdiList) {
+
+ int cx = ThemeEngine.Current.MenuCheckSize.Width;
+ int cy = ThemeEngine.Current.MenuCheckSize.Height;
+ Bitmap bmp = new Bitmap (cx, cy);
+ Graphics gr = Graphics.FromImage (bmp);
+ Rectangle rect_arrow = new Rectangle (0, 0, cx, cy);
+ ControlPaint.DrawMenuGlyph (gr, rect_arrow, MenuGlyph.Arrow);
+ bmp.MakeTransparent ();
+
+ if (item.Enabled) {
+ e.Graphics.DrawImage (bmp, e.Bounds.X + e.Bounds.Width - cx,
+ e.Bounds.Y + ((e.Bounds.Height - cy) /2));
+ } else {
+ ControlPaint.DrawImageDisabled (e.Graphics, bmp, e.Bounds.X + e.Bounds.Width - cx,
+ e.Bounds.Y + ((e.Bounds.Height - cy) /2), color_back);
+ }
+
+ gr.Dispose ();
+ bmp.Dispose ();
+ }
+
+ /* Draw checked or radio */
+ if (item.MenuBar == false && item.Checked) {
+
+ Rectangle area = e.Bounds;
+ int cx = ThemeEngine.Current.MenuCheckSize.Width;
+ int cy = ThemeEngine.Current.MenuCheckSize.Height;
+ Bitmap bmp = new Bitmap (cx, cy);
+ Graphics gr = Graphics.FromImage (bmp);
+ Rectangle rect_arrow = new Rectangle (0, 0, cx, cy);
+
+ if (item.RadioCheck)
+ ControlPaint.DrawMenuGlyph (gr, rect_arrow, MenuGlyph.Bullet);
+ else
+ ControlPaint.DrawMenuGlyph (gr, rect_arrow, MenuGlyph.Checkmark);
+
+ bmp.MakeTransparent ();
+ e.Graphics.DrawImage (bmp, area.X, e.Bounds.Y + ((e.Bounds.Height - cy) / 2));
+
+ gr.Dispose ();
+ bmp.Dispose ();
+ }
+ }
+
+ public override void DrawPopupMenu (Graphics dc, Menu menu, Rectangle cliparea, Rectangle rect)
+ {
+
+ dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush
+ (ThemeEngine.Current.ColorMenu), cliparea);
+
+ /* Draw menu borders */
+ dc.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorHighlightText),
+ rect.X, rect.Y, rect.X + rect.Width, rect.Y);
+
+ dc.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorHighlightText),
+ rect.X, rect.Y, rect.X, rect.Y + rect.Height);
+
+ dc.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorControlDark),
+ rect.X + rect.Width - 1 , rect.Y , rect.X + rect.Width - 1, rect.Y + rect.Height);
+
+ dc.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorControlDarkDark),
+ rect.X + rect.Width, rect.Y , rect.X + rect.Width, rect.Y + rect.Height);
+
+ dc.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorControlDark),
+ rect.X , rect.Y + rect.Height - 1 , rect.X + rect.Width - 1, rect.Y + rect.Height -1);
+
+ dc.DrawLine (ThemeEngine.Current.ResPool.GetPen (ThemeEngine.Current.ColorControlDarkDark),
+ rect.X , rect.Y + rect.Height, rect.X + rect.Width - 1, rect.Y + rect.Height);
+
+ for (int i = 0; i < menu.MenuItems.Count; i++)
+ if (cliparea.IntersectsWith (menu.MenuItems [i].bounds)) {
+ MenuItem item = menu.MenuItems [i];
+ item.MenuHeight = menu.Height;
+ item.PerformDrawItem (new DrawItemEventArgs (dc, ThemeEngine.Current.MenuFont,
+ item.bounds, i, item.Status));
+ }
+ }
+
+ #endregion // Menus
+
+ #region MonthCalendar
+
+ // draw the month calendar
+ public override void DrawMonthCalendar(Graphics dc, Rectangle clip_rectangle, MonthCalendar mc)
+ {
+ Rectangle client_rectangle = mc.ClientRectangle;
+ Size month_size = mc.SingleMonthSize;
+ // cache local copies of Marshal-by-ref internal members (gets around error CS0197)
+ Size calendar_spacing = (Size)((object)mc.calendar_spacing);
+ Size date_cell_size = (Size)((object)mc.date_cell_size);
+
+ // draw the singlecalendars
+ int x_offset = 1;
+ int y_offset = 1;
+ // adjust for the position of the specific month
+ for (int i=0; i < mc.CalendarDimensions.Height; i++)
+ {
+ if (i > 0)
+ {
+ y_offset += month_size.Height + calendar_spacing.Height;
+ }
+ // now adjust for x position
+ for (int j=0; j < mc.CalendarDimensions.Width; j++)
+ {
+ if (j > 0)
+ {
+ x_offset += month_size.Width + calendar_spacing.Width;
+ }
+ else
+ {
+ x_offset = 1;
+ }
+
+ Rectangle month_rect = new Rectangle (x_offset, y_offset, month_size.Width, month_size.Height);
+ if (month_rect.IntersectsWith (clip_rectangle)) {
+ DrawSingleMonth (
+ dc,
+ clip_rectangle,
+ month_rect,
+ mc,
+ i,
+ j);
+ }
+ }
+ }
+
+ Rectangle bottom_rect = new Rectangle (
+ client_rectangle.X,
+ Math.Max(client_rectangle.Bottom - date_cell_size.Height - 3, 0),
+ client_rectangle.Width,
+ date_cell_size.Height + 2);
+ // draw the today date if it's set
+ if (mc.ShowToday && bottom_rect.IntersectsWith (clip_rectangle))
+ {
+ dc.FillRectangle (ResPool.GetSolidBrush (mc.BackColor), bottom_rect);
+ if (mc.ShowToday) {
+ int today_offset = 5;
+ if (mc.ShowTodayCircle)
+ {
+ Rectangle today_circle_rect = new Rectangle (
+ client_rectangle.X + 5,
+ Math.Max(client_rectangle.Bottom - date_cell_size.Height - 2, 0),
+ date_cell_size.Width,
+ date_cell_size.Height);
+ DrawTodayCircle (dc, today_circle_rect);
+ today_offset += date_cell_size.Width + 5;
+ }
+ // draw today's date
+ StringFormat text_format = new StringFormat();
+ text_format.LineAlignment = StringAlignment.Center;
+ text_format.Alignment = StringAlignment.Near;
+ Font bold_font = new Font (mc.Font.FontFamily, mc.Font.Size, mc.Font.Style | FontStyle.Bold);
+ Rectangle today_rect = new Rectangle (
+ today_offset + client_rectangle.X,
+ Math.Max(client_rectangle.Bottom - date_cell_size.Height, 0),
+ Math.Max(client_rectangle.Width - today_offset, 0),
+ date_cell_size.Height);
+ dc.DrawString ("Today: " + DateTime.Now.ToShortDateString(), bold_font, ResPool.GetSolidBrush (mc.ForeColor), today_rect, text_format);
+ text_format.Dispose ();
+ bold_font.Dispose ();
+ }
+ }
+
+ // finally paint the borders of the calendars as required
+ for (int i = 0; i <= mc.CalendarDimensions.Width; i++) {
+ if (i == 0 && clip_rectangle.X == client_rectangle.X) {
+ dc.FillRectangle (ResPool.GetSolidBrush (mc.BackColor), new Rectangle (client_rectangle.X, client_rectangle.Y, 1, client_rectangle.Height));
+ } else if (i == mc.CalendarDimensions.Width && clip_rectangle.Right == client_rectangle.Right) {
+ dc.FillRectangle (ResPool.GetSolidBrush (mc.BackColor), new Rectangle (client_rectangle.Right-1, client_rectangle.Y, 1, client_rectangle.Height));
+ } else {
+ Rectangle rect = new Rectangle (
+ client_rectangle.X + (month_size.Width*i) + (calendar_spacing.Width * (i-1)) + 1,
+ client_rectangle.Y,
+ calendar_spacing.Width,
+ client_rectangle.Height);
+ if (i < mc.CalendarDimensions.Width && i > 0 && clip_rectangle.IntersectsWith (rect)) {
+ dc.FillRectangle (ResPool.GetSolidBrush (mc.BackColor), rect);
+ }
+ }
+ }
+ for (int i = 0; i <= mc.CalendarDimensions.Height; i++) {
+ if (i == 0 && clip_rectangle.Y == client_rectangle.Y) {
+ dc.FillRectangle (ResPool.GetSolidBrush (mc.BackColor), new Rectangle (client_rectangle.X, client_rectangle.Y, client_rectangle.Width, 1));
+ } else if (i == mc.CalendarDimensions.Height && clip_rectangle.Bottom == client_rectangle.Bottom) {
+ dc.FillRectangle (ResPool.GetSolidBrush (mc.BackColor), new Rectangle (client_rectangle.X, client_rectangle.Bottom-1, client_rectangle.Width, 1));
+ } else {
+ Rectangle rect = new Rectangle (
+ client_rectangle.X,
+ client_rectangle.Y + (month_size.Height*i) + (calendar_spacing.Height*(i-1)) + 1,
+ client_rectangle.Width,
+ calendar_spacing.Height);
+ if (i < mc.CalendarDimensions.Height && i > 0 && clip_rectangle.IntersectsWith (rect)) {
+ dc.FillRectangle (ResPool.GetSolidBrush (mc.BackColor), rect);
+ }
+ }
+ }
+
+ // draw the drop down border if need
+ if (mc.owner != null) {
+ Rectangle bounds = mc.ClientRectangle;
+ if (clip_rectangle.Contains (mc.Location)) {
+ // find out if top or left line to draw
+ if(clip_rectangle.Contains (new Point (bounds.Left, bounds.Bottom))) {
+
+ dc.DrawLine (SystemPens.ControlText, bounds.X, bounds.Y, bounds.X, bounds.Bottom-1);
+ }
+ if(clip_rectangle.Contains (new Point (bounds.Right, bounds.Y))) {
+ dc.DrawLine (SystemPens.ControlText, bounds.X, bounds.Y, bounds.Right-1, bounds.Y);
+ }
+ }
+ if (clip_rectangle.Contains (new Point(bounds.Right, bounds.Bottom))) {
+ // find out if bottom or right line to draw
+ if(clip_rectangle.Contains (new Point (bounds.Left, bounds.Bottom))) {
+ dc.DrawLine (SystemPens.ControlText, bounds.X, bounds.Bottom-1, bounds.Right-1, bounds.Bottom-1);
+ }
+ if(clip_rectangle.Contains (new Point (bounds.Right, bounds.Y))) {
+ dc.DrawLine (SystemPens.ControlText, bounds.Right-1, bounds.Y, bounds.Right-1, bounds.Bottom-1);
+ }
+ }
+ }
+ }
+
+ // darws a single part of the month calendar (with one month)
+ private void DrawSingleMonth(Graphics dc, Rectangle clip_rectangle, Rectangle rectangle, MonthCalendar mc, int row, int col)
+ {
+ // cache local copies of Marshal-by-ref internal members (gets around error CS0197)
+ Size title_size = (Size)((object)mc.title_size);
+ Size date_cell_size = (Size)((object)mc.date_cell_size);
+ DateTime current_month = (DateTime)((object)mc.current_month);
+
+ // set up some standard string formating variables
+ StringFormat text_format = new StringFormat();
+ text_format.LineAlignment = StringAlignment.Center;
+ text_format.Alignment = StringAlignment.Center;
+
+
+ // draw the title back ground
+ DateTime this_month = current_month.AddMonths (row*mc.CalendarDimensions.Width+col);
+ Rectangle title_rect = new Rectangle(rectangle.X, rectangle.Y, title_size.Width, title_size.Height);
+ if (title_rect.IntersectsWith (clip_rectangle)) {
+ dc.FillRectangle (ResPool.GetSolidBrush (mc.TitleBackColor), title_rect);
+ // draw the title
+ string title_text = this_month.ToString ("MMMM yyyy");
+ dc.DrawString (title_text, mc.Font, ResPool.GetSolidBrush (mc.TitleForeColor), title_rect, text_format);
+
+ // draw previous and next buttons if it's time
+ if (row == 0 && col == 0)
+ {
+ // draw previous button
+ DrawMonthCalendarButton (
+ dc,
+ rectangle,
+ mc,
+ title_size,
+ mc.button_x_offset,
+ (System.Drawing.Size)((object)mc.button_size),
+ true);
+ }
+ if (row == 0 && col == mc.CalendarDimensions.Width-1)
+ {
+ // draw next button
+ DrawMonthCalendarButton (
+ dc,
+ rectangle,
+ mc,
+ title_size,
+ mc.button_x_offset,
+ (System.Drawing.Size)((object)mc.button_size),
+ false);
+ }
+ }
+
+ // set the week offset and draw week nums if needed
+ int col_offset = (mc.ShowWeekNumbers) ? 1 : 0;
+ Rectangle day_name_rect = new Rectangle(
+ rectangle.X,
+ rectangle.Y + title_size.Height,
+ (7 + col_offset) * date_cell_size.Width,
+ date_cell_size.Height);
+ if (day_name_rect.IntersectsWith (clip_rectangle)) {
+ dc.FillRectangle (ResPool.GetSolidBrush (mc.BackColor), day_name_rect);
+ // draw the day names
+ DayOfWeek first_day_of_week = mc.GetDayOfWeek(mc.FirstDayOfWeek);
+ for (int i=0; i < 7; i++)
+ {
+ int position = i - (int) first_day_of_week;
+ if (position < 0)
+ {
+ position = 7 + position;
+ }
+ // draw it
+ Rectangle day_rect = new Rectangle(
+ day_name_rect.X + ((i + col_offset)* date_cell_size.Width),
+ day_name_rect.Y,
+ date_cell_size.Width,
+ date_cell_size.Height);
+ dc.DrawString (((DayOfWeek)i).ToString().Substring(0, 3), mc.Font, ResPool.GetSolidBrush (mc.TitleBackColor), day_rect, text_format);
+ }
+
+ // draw the vertical divider
+ int vert_divider_y = Math.Max(title_size.Height+ date_cell_size.Height-1, 0);
+ dc.DrawLine (
+ ResPool.GetPen (mc.ForeColor),
+ rectangle.X + (col_offset * date_cell_size.Width) + mc.divider_line_offset,
+ rectangle.Y + vert_divider_y,
+ rectangle.Right - mc.divider_line_offset,
+ rectangle.Y + vert_divider_y);
+ }
+
+
+ // draw the actual date items in the grid (including the week numbers)
+ Rectangle date_rect = new Rectangle (
+ rectangle.X,
+ rectangle.Y + title_size.Height + date_cell_size.Height,
+ date_cell_size.Width,
+ date_cell_size.Height);
+ int month_row_count = 0;
+ bool draw_week_num_divider = false;
+ DateTime current_date = mc.GetFirstDateInMonthGrid ( new DateTime (this_month.Year, this_month.Month, 1));
+ for (int i=0; i < 6; i++)
+ {
+ // establish if this row is in our clip_area
+ Rectangle row_rect = new Rectangle (
+ rectangle.X,
+ rectangle.Y + title_size.Height + (date_cell_size.Height * (i+1)),
+ date_cell_size.Width * 7,
+ date_cell_size.Height);
+ if (mc.ShowWeekNumbers) {
+ row_rect.Width += date_cell_size.Width;
+ }
+
+ bool draw_row = row_rect.IntersectsWith (clip_rectangle);
+ if (draw_row) {
+ dc.FillRectangle (ResPool.GetSolidBrush (mc.BackColor), row_rect);
+ }
+ // establish if this is a valid week to draw
+ if (mc.IsValidWeekToDraw (this_month, current_date, row, col)) {
+ month_row_count = i;
+ }
+
+ // draw the week number if required
+ if (mc.ShowWeekNumbers && month_row_count == i) {
+ if (!draw_week_num_divider) {
+ draw_week_num_divider = draw_row;
+ }
+ // get the week for this row
+ int week = mc.GetWeekOfYear (current_date);
+
+ if (draw_row) {
+ dc.DrawString (
+ week.ToString(),
+ mc.Font,
+ ResPool.GetSolidBrush (mc.TitleBackColor),
+ date_rect,
+ text_format);
+ }
+ date_rect.Offset(date_cell_size.Width, 0);
+ }
+
+ // only draw the days if we have to
+ if(month_row_count == i) {
+ for (int j=0; j < 7; j++)
+ {
+ if (draw_row) {
+ DrawMonthCalendarDate (
+ dc,
+ date_rect,
+ mc,
+ current_date,
+ this_month,
+ row,
+ col);
+ }
+
+ // move the day on
+ current_date = current_date.AddDays(1);
+ date_rect.Offset(date_cell_size.Width, 0);
+ }
+
+ // shift the rectangle down one row
+ int offset = (mc.ShowWeekNumbers) ? -8 : -7;
+ date_rect.Offset(offset*date_cell_size.Width, date_cell_size.Height);
+ }
+ }
+
+ // month_row_count is zero based, so add one
+ month_row_count++;
+
+ // draw week numbers if required
+ if (draw_week_num_divider) {
+ col_offset = 1;
+ dc.DrawLine (
+ ResPool.GetPen (mc.ForeColor),
+ rectangle.X + date_cell_size.Width - 1,
+ rectangle.Y + title_size.Height + date_cell_size.Height + mc.divider_line_offset,
+ rectangle.X + date_cell_size.Width - 1,
+ rectangle.Y + title_size.Height + date_cell_size.Height + (month_row_count * date_cell_size.Height) - mc.divider_line_offset);
+ }
+ text_format.Dispose ();
+ }
+
+ // draws the pervious or next button
+ private void DrawMonthCalendarButton (Graphics dc, Rectangle rectangle, MonthCalendar mc, Size title_size, int x_offset, Size button_size, bool is_previous)
+ {
+ bool is_clicked = false;
+ Rectangle button_rect;
+ Rectangle arrow_rect = new Rectangle (rectangle.X, rectangle.Y, 4, 7);
+ Point[] arrow_path = new Point[3];
+ // prepare the button
+ if (is_previous)
+ {
+ is_clicked = mc.is_previous_clicked;
+ button_rect = new Rectangle (
+ rectangle.X + 1 + x_offset,
+ rectangle.Y + 1 + ((title_size.Height - button_size.Height)/2),
+ Math.Max(button_size.Width - 1, 0),
+ Math.Max(button_size.Height - 1, 0));
+ arrow_rect.X = button_rect.X + ((button_rect.Width - arrow_rect.Width)/2);
+ arrow_rect.Y = button_rect.Y + ((button_rect.Height - arrow_rect.Height)/2);
+ if (is_clicked) {
+ arrow_rect.Offset(1,1);
+ }
+ arrow_path[0] = new Point (arrow_rect.Right, arrow_rect.Y);
+ arrow_path[1] = new Point (arrow_rect.X, arrow_rect.Y + arrow_rect.Height/2);
+ arrow_path[2] = new Point (arrow_rect.Right, arrow_rect.Bottom);
+ }
+ else
+ {
+ is_clicked = mc.is_next_clicked;
+ button_rect = new Rectangle (
+ rectangle.Right - 1 - x_offset - button_size.Width,
+ rectangle.Y + 1 + ((title_size.Height - button_size.Height)/2),
+ Math.Max(button_size.Width - 1, 0),
+ Math.Max(button_size.Height - 1, 0));
+ arrow_rect.X = button_rect.X + ((button_rect.Width - arrow_rect.Width)/2);
+ arrow_rect.Y = button_rect.Y + ((button_rect.Height - arrow_rect.Height)/2);
+ if (is_clicked) {
+ arrow_rect.Offset(1,1);
+ }
+ arrow_path[0] = new Point (arrow_rect.X, arrow_rect.Y);
+ arrow_path[1] = new Point (arrow_rect.Right, arrow_rect.Y + arrow_rect.Height/2);
+ arrow_path[2] = new Point (arrow_rect.X, arrow_rect.Bottom);
+ }
+
+ // fill the background
+ dc.FillRectangle (SystemBrushes.Control, button_rect);
+ // draw the border
+ if (is_clicked) {
+ dc.DrawRectangle (SystemPens.ControlDark, button_rect);
+ }
+ else {
+ CPDrawBorder3D (dc, button_rect, Border3DStyle.Raised, Border3DSide.All);
+ }
+ // draw the arrow
+ dc.FillPolygon (SystemBrushes.ControlText, arrow_path);
+ }
+
+
+ // draws one day in the calendar grid
+ private void DrawMonthCalendarDate (Graphics dc, Rectangle rectangle, MonthCalendar mc, DateTime date, DateTime month, int row, int col) {
+ Color date_color = mc.ForeColor;
+ Rectangle interior = new Rectangle (rectangle.X, rectangle.Y, Math.Max(rectangle.Width - 1, 0), Math.Max(rectangle.Height - 1, 0));
+
+ // find out if we are the lead of the first calendar or the trail of the last calendar
+ if (date.Year != month.Year || date.Month != month.Month) {
+ DateTime check_date = month.AddMonths (-1);
+ // check if it's the month before
+ if (check_date.Year == date.Year && check_date.Month == date.Month && row == 0 && col == 0) {
+ date_color = mc.TrailingForeColor;
+ } else {
+ // check if it's the month after
+ check_date = month.AddMonths (1);
+ if (check_date.Year == date.Year && check_date.Month == date.Month && row == mc.CalendarDimensions.Height-1 && col == mc.CalendarDimensions.Width-1) {
+ date_color = mc.TrailingForeColor;
+ } else {
+ return;
+ }
+ }
+ } else {
+ date_color = mc.ForeColor;
+ }
+
+
+ if (date == mc.SelectionStart && date == mc.SelectionEnd) {
+ // see if the date is in the start of selection
+ date_color = mc.BackColor;
+ // draw the left hand of the back ground
+ Rectangle selection_rect = Rectangle.Inflate(rectangle, -3, -3);
+ dc.FillPie (ResPool.GetSolidBrush (mc.TitleBackColor), selection_rect, 0, 359);
+ } else if (date == mc.SelectionStart) {
+ // see if the date is in the start of selection
+ date_color = mc.BackColor;
+ // draw the left hand of the back ground
+ Rectangle selection_rect = Rectangle.Inflate(rectangle, -3, -3);
+ dc.FillPie (ResPool.GetSolidBrush (mc.TitleBackColor), selection_rect, 90, 180);
+ // fill the other side as a straight rect
+ if (date < mc.SelectionEnd)
+ {
+ // use rectangle instead of rectangle to go all the way to edge of rect
+ selection_rect.X = (int) Math.Floor((double)(rectangle.X + rectangle.Width / 2));
+ selection_rect.Width = Math.Max(rectangle.Right - selection_rect.X, 0);
+ dc.FillRectangle (ResPool.GetSolidBrush (mc.TitleBackColor), selection_rect);
+ }
+ } else if (date == mc.SelectionEnd) {
+ // see if it is the end of selection
+ date_color = mc.BackColor;
+ // draw the left hand of the back ground
+ Rectangle selection_rect = Rectangle.Inflate(rectangle, -3, -3);
+ dc.FillPie (ResPool.GetSolidBrush (mc.TitleBackColor), selection_rect, 270, 180);
+ // fill the other side as a straight rect
+ if (date > mc.SelectionStart) {
+ selection_rect.X = rectangle.X;
+ selection_rect.Width = rectangle.Width - (rectangle.Width / 2);
+ dc.FillRectangle (ResPool.GetSolidBrush (mc.TitleBackColor), selection_rect);
+ }
+ } else if (date > mc.SelectionStart && date < mc.SelectionEnd) {
+ // now see if it's in the middle
+ date_color = mc.BackColor;
+ // draw the left hand of the back ground
+ Rectangle selection_rect = Rectangle.Inflate(rectangle, 0, -3);
+ dc.FillRectangle (ResPool.GetSolidBrush (mc.TitleBackColor), selection_rect);
+ }
+
+ // set up some standard string formating variables
+ StringFormat text_format = new StringFormat();
+ text_format.LineAlignment = StringAlignment.Center;
+ text_format.Alignment = StringAlignment.Center;
+
+
+ // establish if it's a bolded font
+ Font font;
+ if (mc.IsBoldedDate (date)) {
+ font = new Font (mc.Font.FontFamily, mc.Font.Size, mc.Font.Style | FontStyle.Bold);
+ } else {
+ font = mc.Font;
+ }
+
+ // just draw the date now
+ dc.DrawString (date.Day.ToString(), font, ResPool.GetSolidBrush (date_color), rectangle, text_format);
+
+ // today circle if needed
+ if (mc.ShowTodayCircle && date == DateTime.Now.Date) {
+ DrawTodayCircle (dc, interior);
+ }
+
+ // draw the selection grid
+ if (mc.is_date_clicked && mc.clicked_date == date) {
+ using (Pen pen = new Pen (Color.Black, 1) ) {
+ pen.DashStyle = DashStyle.Dot;
+ dc.DrawRectangle (pen, interior);
+ }
+ }
+ text_format.Dispose ();
+ }
+
+ private void DrawTodayCircle (Graphics dc, Rectangle rectangle) {
+ Color circle_color = Color.FromArgb (248, 0, 0);
+ // draw the left hand of the circle
+ Rectangle lhs_circle_rect = new Rectangle (rectangle.X + 1, rectangle.Y + 4, Math.Max(rectangle.Width - 2, 0), Math.Max(rectangle.Height - 5, 0));
+ Rectangle rhs_circle_rect = new Rectangle (rectangle.X + 1, rectangle.Y + 1, Math.Max(rectangle.Width - 2, 0), Math.Max(rectangle.Height - 2, 0));
+ Point [] curve_points = new Point [3];
+ curve_points [0] = new Point (lhs_circle_rect.X, rhs_circle_rect.Y + rhs_circle_rect.Height/12);
+ curve_points [1] = new Point (lhs_circle_rect.X + lhs_circle_rect.Width/9, rhs_circle_rect.Y);
+ curve_points [2] = new Point (lhs_circle_rect.X + lhs_circle_rect.Width/2 + 1, rhs_circle_rect.Y);
+
+ using (Pen pen = new Pen (circle_color, 2)) {
+ dc.DrawArc (pen, lhs_circle_rect, 90, 180);
+ dc.DrawArc (pen, rhs_circle_rect, 270, 180);
+ dc.DrawCurve (pen, curve_points);
+ dc.DrawLine (ResPool.GetPen (circle_color), curve_points [2], new Point (curve_points [2].X, lhs_circle_rect.Y));
+ }
+ }
+
+ #endregion // MonthCalendar
+
+ #region Panel
+ public override Size PanelDefaultSize {
+ get {
+ return new Size (200, 100);
+ }
+ }
+ #endregion // Panel
+
+ #region PictureBox
+ public override void DrawPictureBox (Graphics dc, Rectangle clip, PictureBox pb) {
+ Rectangle client = pb.ClientRectangle;
+
+ // FIXME - instead of drawing the whole picturebox every time
+ // intersect the clip rectangle with the drawn picture and only draw what's needed,
+ // Also, we only need a background fill where no image goes
+ if (pb.Image != null) {
+ switch (pb.SizeMode) {
+ case PictureBoxSizeMode.StretchImage:
+ dc.DrawImage (pb.Image, 0, 0, client.Width, client.Height);
+ break;
+
+ case PictureBoxSizeMode.CenterImage:
+ dc.FillRectangle(ResPool.GetSolidBrush(pb.BackColor), clip);
+ dc.DrawImage (pb.Image, (client.Width / 2) - (pb.Image.Width / 2), (client.Height / 2) - (pb.Image.Height / 2));
+ break;
+ default:
+ dc.FillRectangle(ResPool.GetSolidBrush(pb.BackColor), clip);
+ // Normal, AutoSize
+ dc.DrawImage(pb.Image, 0, 0, pb.Image.Width, pb.Image.Height);
+ break;
+ }
+
+ return;
+ }
+
+ // We only get here if no image is set. At least paint the background
+ dc.FillRectangle(ResPool.GetSolidBrush(pb.BackColor), clip);
+ }
+
+ public override Size PictureBoxDefaultSize {
+ get {
+ return new Size (100, 50);
+ }
+ }
+ #endregion // PictureBox
+
+ #region ProgressBar
+ public override void DrawProgressBar (Graphics dc, Rectangle clip_rect, ProgressBar ctrl)
+ {
+ Rectangle block_rect;
+ Rectangle client_area = ctrl.client_area;
+ int space_betweenblocks = 2;
+ int block_width;
+ int increment;
+ int barpos_pixels;
+
+ block_width = ((client_area.Height) * 2 ) / 3;
+ barpos_pixels = ((ctrl.Value - ctrl.Minimum) * client_area.Width) / (ctrl.Maximum - ctrl.Minimum);
+ increment = block_width + space_betweenblocks;
+
+ /* Draw border */
+ CPDrawBorder3D (dc, ctrl.ClientRectangle, Border3DStyle.SunkenInner, Border3DSide.All & ~Border3DSide.Middle, ColorControl);
+
+ /* Draw Blocks */
+ block_rect = new Rectangle (client_area.X, client_area.Y, block_width, client_area.Height);
+ while ((block_rect.X - client_area.X) < barpos_pixels) {
+
+ if (clip_rect.IntersectsWith (block_rect) == true) {
+ dc.FillRectangle (ResPool.GetSolidBrush (progressbarblock_color), block_rect);
+ }
+
+ block_rect.X += increment;
+ }
+ }
+
+ public override Size ProgressBarDefaultSize {
+ get {
+ return new Size (100, 23);
+ }
+ }
+
+ #endregion // ProgressBar
+
+ #region RadioButton
+ public override void DrawRadioButton (Graphics dc, Rectangle clip_rectangle, RadioButton radio_button) {
+ StringFormat text_format;
+ Rectangle client_rectangle;
+ Rectangle text_rectangle;
+ Rectangle radiobutton_rectangle;
+ int radiobutton_size = 12;
+ int radiobutton_space = 4;
+
+ client_rectangle = radio_button.ClientRectangle;
+ text_rectangle = client_rectangle;
+ radiobutton_rectangle = new Rectangle(text_rectangle.X, text_rectangle.Y, radiobutton_size, radiobutton_size);
+
+ text_format = new StringFormat();
+ text_format.Alignment = StringAlignment.Near;
+ text_format.LineAlignment = StringAlignment.Center;
+ text_format.HotkeyPrefix = HotkeyPrefix.Show;
+
+ /* Calculate the position of text and checkbox rectangle */
+ if (radio_button.appearance!=Appearance.Button) {
+ switch(radio_button.radiobutton_alignment) {
+ case ContentAlignment.BottomCenter: {
+ radiobutton_rectangle.X=(client_rectangle.Right-client_rectangle.Left)/2-radiobutton_size/2;
+ radiobutton_rectangle.Y=client_rectangle.Bottom-radiobutton_size;
+ text_rectangle.X=client_rectangle.X;
+ text_rectangle.Width=client_rectangle.Width;
+ text_rectangle.Height=client_rectangle.Height-radiobutton_size-radiobutton_space;
+ break;
+ }
+
+ case ContentAlignment.BottomLeft: {
+ radiobutton_rectangle.X=client_rectangle.Left;
+ radiobutton_rectangle.Y=client_rectangle.Bottom-radiobutton_size;
+ text_rectangle.X=client_rectangle.X+radiobutton_size+radiobutton_space;
+ text_rectangle.Width=client_rectangle.Width-radiobutton_size-radiobutton_space;
+ break;
+ }
+
+ case ContentAlignment.BottomRight: {
+ radiobutton_rectangle.X=client_rectangle.Right-radiobutton_size;
+ radiobutton_rectangle.Y=client_rectangle.Bottom-radiobutton_size;
+ text_rectangle.X=client_rectangle.X;
+ text_rectangle.Width=client_rectangle.Width-radiobutton_size-radiobutton_space;
+ break;
+ }
+
+ case ContentAlignment.MiddleCenter: {
+ radiobutton_rectangle.X=(client_rectangle.Right-client_rectangle.Left)/2-radiobutton_size/2;
+ radiobutton_rectangle.Y=(client_rectangle.Bottom-client_rectangle.Top)/2-radiobutton_size/2;
+ text_rectangle.X=client_rectangle.X;
+ text_rectangle.Width=client_rectangle.Width;
+ break;
+ }
+
+ default:
+ case ContentAlignment.MiddleLeft: {
+ radiobutton_rectangle.X=client_rectangle.Left;
+ radiobutton_rectangle.Y=(client_rectangle.Bottom-client_rectangle.Top)/2-radiobutton_size/2;
+ text_rectangle.X=client_rectangle.X+radiobutton_size+radiobutton_space;
+ text_rectangle.Width=client_rectangle.Width-radiobutton_size-radiobutton_space;
+ break;
+ }
+
+ case ContentAlignment.MiddleRight: {
+ radiobutton_rectangle.X=client_rectangle.Right-radiobutton_size;
+ radiobutton_rectangle.Y=(client_rectangle.Bottom-client_rectangle.Top)/2-radiobutton_size/2;
+ text_rectangle.X=client_rectangle.X;
+ text_rectangle.Width=client_rectangle.Width-radiobutton_size-radiobutton_space;
+ break;
+ }
+
+ case ContentAlignment.TopCenter: {
+ radiobutton_rectangle.X=(client_rectangle.Right-client_rectangle.Left)/2-radiobutton_size/2;
+ radiobutton_rectangle.Y=client_rectangle.Top;
+ text_rectangle.X=client_rectangle.X;
+ text_rectangle.Y=radiobutton_size+radiobutton_space;
+ text_rectangle.Width=client_rectangle.Width;
+ text_rectangle.Height=client_rectangle.Height-radiobutton_size-radiobutton_space;
+ break;
+ }
+
+ case ContentAlignment.TopLeft: {
+ radiobutton_rectangle.X=client_rectangle.Left;
+ radiobutton_rectangle.Y=client_rectangle.Top;
+ text_rectangle.X=client_rectangle.X+radiobutton_size+radiobutton_space;
+ text_rectangle.Width=client_rectangle.Width-radiobutton_size-radiobutton_space;
+ break;
+ }
+
+ case ContentAlignment.TopRight: {
+ radiobutton_rectangle.X=client_rectangle.Right-radiobutton_size;
+ radiobutton_rectangle.Y=client_rectangle.Top;
+ text_rectangle.X=client_rectangle.X;
+ text_rectangle.Width=client_rectangle.Width-radiobutton_size-radiobutton_space;
+ break;
+ }
+ }
+ } else {
+ text_rectangle.X=client_rectangle.X;
+ text_rectangle.Width=client_rectangle.Width;
+ }
+
+ /* Set the horizontal alignment of our text */
+ switch(radio_button.text_alignment) {
+ case ContentAlignment.BottomLeft:
+ case ContentAlignment.MiddleLeft:
+ case ContentAlignment.TopLeft: {
+ text_format.Alignment=StringAlignment.Near;
+ break;
+ }
+
+ case ContentAlignment.BottomCenter:
+ case ContentAlignment.MiddleCenter:
+ case ContentAlignment.TopCenter: {
+ text_format.Alignment=StringAlignment.Center;
+ break;
+ }
+
+ case ContentAlignment.BottomRight:
+ case ContentAlignment.MiddleRight:
+ case ContentAlignment.TopRight: {
+ text_format.Alignment=StringAlignment.Far;
+ break;
+ }
+ }
+
+ /* Set the vertical alignment of our text */
+ switch(radio_button.text_alignment) {
+ case ContentAlignment.TopLeft:
+ case ContentAlignment.TopCenter:
+ case ContentAlignment.TopRight: {
+ text_format.LineAlignment=StringAlignment.Near;
+ break;
+ }
+
+ case ContentAlignment.BottomLeft:
+ case ContentAlignment.BottomCenter:
+ case ContentAlignment.BottomRight: {
+ text_format.LineAlignment=StringAlignment.Far;
+ break;
+ }
+
+ case ContentAlignment.MiddleLeft:
+ case ContentAlignment.MiddleCenter:
+ case ContentAlignment.MiddleRight: {
+ text_format.LineAlignment=StringAlignment.Center;
+ break;
+ }
+ }
+
+ ButtonState state = ButtonState.Normal;
+ if (radio_button.FlatStyle == FlatStyle.Flat) {
+ state |= ButtonState.Flat;
+ }
+
+ if (radio_button.Checked) {
+ state |= ButtonState.Checked;
+ }
+
+ // Start drawing
+ RadioButton_DrawButton(radio_button, dc, state, radiobutton_rectangle);
+
+ RadioButton_DrawText(radio_button, text_rectangle, dc, text_format);
+
+ RadioButton_DrawFocus(radio_button, dc, text_rectangle);
+ text_format.Dispose ();
+ }
+
+ protected virtual void RadioButton_DrawButton(RadioButton radio_button, Graphics dc, ButtonState state, Rectangle radiobutton_rectangle)
+ {
+ SolidBrush sb = new SolidBrush(radio_button.BackColor);
+ dc.FillRectangle(sb, radio_button.ClientRectangle);
+ sb.Dispose();
+
+ if (radio_button.appearance==Appearance.Button) {
+ if (radio_button.FlatStyle == FlatStyle.Flat || radio_button.FlatStyle == FlatStyle.Popup) {
+ DrawFlatStyleButton(dc, radio_button.ClientRectangle, radio_button);
+ } else {
+ CPDrawButton(dc, radio_button.ClientRectangle, state);
+ }
+ } else {
+ // establish if we are rendering a flat style of some sort
+ if (radio_button.FlatStyle == FlatStyle.Flat || radio_button.FlatStyle == FlatStyle.Popup) {
+ DrawFlatStyleRadioButton (dc, radiobutton_rectangle, radio_button);
+ } else {
+ ControlPaint.DrawRadioButton (dc, radiobutton_rectangle, state);
+ }
+ }
+ }
+
+ protected virtual void RadioButton_DrawText(RadioButton radio_button, Rectangle text_rectangle, Graphics dc, StringFormat text_format)
+ {
+ SolidBrush sb;
+
+ // offset the text if it's pressed and a button
+ if (radio_button.Appearance == Appearance.Button) {
+ if (radio_button.Checked || (radio_button.Capture && radio_button.FlatStyle != FlatStyle.Flat)) {
+ text_rectangle.X ++;
+ text_rectangle.Y ++;
+ }
+
+ text_rectangle.Inflate(-4,-4);
+ }
+
+ /* Place the text; to be compatible with Windows place it after the radiobutton has been drawn */
+ dc.DrawString (radio_button.Text, radio_button.Font, ThemeEngine.Current.ResPool.GetSolidBrush (radio_button.ForeColor), text_rectangle, text_format);
+
+ if (radio_button.Enabled) {
+ sb = ResPool.GetSolidBrush(radio_button.ForeColor);
+ dc.DrawString(radio_button.Text, radio_button.Font, sb, text_rectangle, text_format);
+ } else if (radio_button.FlatStyle == FlatStyle.Flat) {
+ dc.DrawString(radio_button.Text, radio_button.Font, ResPool.GetSolidBrush (ControlPaint.DarkDark (this.ColorControl)), text_rectangle, text_format);
+ } else {
+ CPDrawStringDisabled(dc, radio_button.Text, radio_button.Font, this.ColorControlText, text_rectangle, text_format);
+ }
+ }
+
+ protected virtual void RadioButton_DrawFocus(RadioButton radio_button, Graphics dc, Rectangle text_rectangle)
+ {
+ if (radio_button.Focused) {
+ if (radio_button.FlatStyle != FlatStyle.Flat) {
+ DrawInnerFocusRectangle (dc, text_rectangle, radio_button.BackColor);
+ } else {
+ dc.DrawRectangle (ResPool.GetPen (radio_button.ForeColor), text_rectangle);
+ }
+ }
+ }
+
+ // renders a radio button with the Flat and Popup FlatStyle
+ protected void DrawFlatStyleRadioButton (Graphics graphics, Rectangle rectangle, RadioButton radio_button)
+ {
+ int lineWidth;
+
+ if (radio_button.Enabled) {
+ // draw the outer flatstyle arcs
+ if (radio_button.FlatStyle == FlatStyle.Flat) {
+ graphics.DrawArc (ResPool.GetPen (radio_button.ForeColor), rectangle, 0, 359);
+
+ // fill in the area depending on whether or not the mouse is hovering
+ if (radio_button.is_entered && radio_button.Capture) {
+ graphics.FillPie (ResPool.GetSolidBrush (ControlPaint.Light (radio_button.BackColor)), rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 0, 359);
+ } else {
+ graphics.FillPie (ResPool.GetSolidBrush (ControlPaint.LightLight (radio_button.BackColor)), rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 0, 359);
+ }
+ } else {
+ // must be a popup radio button
+ // fill the control
+ graphics.FillPie (ResPool.GetSolidBrush (ControlPaint.LightLight (radio_button.BackColor)), rectangle, 0, 359);
+
+ if (radio_button.is_entered || radio_button.Capture) {
+ // draw the popup 3d button knob
+ graphics.DrawArc (ResPool.GetPen (ControlPaint.Light (radio_button.BackColor)), rectangle.X+1, rectangle.Y+1, rectangle.Width-2, rectangle.Height-2, 0, 359);
+
+ graphics.DrawArc (ResPool.GetPen (ControlPaint.Dark (radio_button.BackColor)), rectangle, 135, 180);
+ graphics.DrawArc (ResPool.GetPen (ControlPaint.LightLight (radio_button.BackColor)), rectangle, 315, 180);
+
+ } else {
+ // just draw lighter flatstyle outer circle
+ graphics.DrawArc (ResPool.GetPen (ControlPaint.Dark (this.ColorControl)), rectangle, 0, 359);
+ }
+ }
+ } else {
+ // disabled
+ // fill control background color regardless of actual backcolor
+ graphics.FillPie (ResPool.GetSolidBrush (this.ColorControl), rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 0, 359);
+ // draw the ark as control dark
+ graphics.DrawArc (ResPool.GetPen (ControlPaint.Dark(this.ColorControl)), rectangle, 0, 359);
+ }
+
+ // draw the check
+ lineWidth = Math.Max (1, Math.Min(rectangle.Width, rectangle.Height)/3);
+ if (radio_button.Checked) {
+ SolidBrush buttonBrush;
+
+ if (!radio_button.Enabled) {
+ buttonBrush = ResPool.GetSolidBrush (ControlPaint.Dark (this.ColorControl));
+ } else if (radio_button.FlatStyle == FlatStyle.Popup && radio_button.is_entered && radio_button.Capture) {
+ buttonBrush = ResPool.GetSolidBrush (this.ColorControlText);
+ } else {
+ buttonBrush = ResPool.GetSolidBrush (radio_button.ForeColor);
+ }
+ graphics.FillPie (buttonBrush, rectangle.X+lineWidth, rectangle.Y+lineWidth, rectangle.Width-lineWidth*2, rectangle.Height-lineWidth*2, 0, 359);
+ }
+ }
+
+ public override Size RadioButtonDefaultSize {
+ get {
+ return new Size (104,24);
+ }
+ }
+ #endregion // RadioButton
+
+ #region ScrollBar
+ public override void DrawScrollBar (Graphics dc, Rectangle clip, ScrollBar bar)
+ {
+ int scrollbutton_width = bar.scrollbutton_width;
+ int scrollbutton_height = bar.scrollbutton_height;
+ Rectangle first_arrow_area;
+ Rectangle second_arrow_area;
+ Rectangle thumb_pos;
+
+ thumb_pos = bar.ThumbPos;
+
+ if (bar.vert) {
+ first_arrow_area = new Rectangle(0, 0, bar.Width, scrollbutton_height);
+ bar.FirstArrowArea = first_arrow_area;
+
+ second_arrow_area = new Rectangle(0, bar.ClientRectangle.Height - scrollbutton_height, bar.Width, scrollbutton_height);
+ bar.SecondArrowArea = second_arrow_area;
+
+ thumb_pos.Width = bar.Width;
+ bar.ThumbPos = thumb_pos;
+
+ /* Buttons */
+ if (clip.IntersectsWith (first_arrow_area))
+ CPDrawScrollButton (dc, first_arrow_area, ScrollButton.Up, bar.firstbutton_state);
+ if (clip.IntersectsWith (second_arrow_area))
+ CPDrawScrollButton (dc, second_arrow_area, ScrollButton.Down, bar.secondbutton_state);
+
+ /* Background */
+ switch (bar.thumb_moving) {
+ case ScrollBar.ThumbMoving.None: {
+ ScrollBar_Vertical_Draw_ThumbMoving_None(scrollbutton_height, bar, clip, dc);
+ break;
+ }
+ case ScrollBar.ThumbMoving.Forward: {
+ ScrollBar_Vertical_Draw_ThumbMoving_Forward(scrollbutton_height, bar, thumb_pos, clip, dc);
+ break;
+ }
+
+ case ScrollBar.ThumbMoving.Backwards: {
+ ScrollBar_Vertical_Draw_ThumbMoving_Backwards(scrollbutton_height, bar, thumb_pos, clip, dc);
+ break;
+ }
+
+ default:
+ break;
+ }
+ } else {
+ first_arrow_area = new Rectangle(0, 0, scrollbutton_width, bar.Height);
+ bar.FirstArrowArea = first_arrow_area;
+
+ second_arrow_area = new Rectangle (bar.ClientRectangle.Width - scrollbutton_width, 0, scrollbutton_width, bar.Height);
+ bar.SecondArrowArea = second_arrow_area;
+
+ thumb_pos.Height = bar.Height;
+ bar.ThumbPos = thumb_pos;
+
+ /* Buttons */
+ if (clip.IntersectsWith (first_arrow_area))
+ CPDrawScrollButton (dc, first_arrow_area, ScrollButton.Left, bar.firstbutton_state);
+ if (clip.IntersectsWith (second_arrow_area))
+ CPDrawScrollButton (dc, second_arrow_area, ScrollButton.Right, bar.secondbutton_state);
+
+ /* Background */
+ switch (bar.thumb_moving) {
+ case ScrollBar.ThumbMoving.None: {
+ ScrollBar_Horizontal_Draw_ThumbMoving_None(scrollbutton_width, bar, clip, dc);
+ break;
+ }
+
+ case ScrollBar.ThumbMoving.Forward: {
+ ScrollBar_Horizontal_Draw_ThumbMoving_Forward(scrollbutton_width, thumb_pos, bar, clip, dc);
+ break;
+ }
+
+ case ScrollBar.ThumbMoving.Backwards: {
+ ScrollBar_Horizontal_Draw_ThumbMoving_Backwards(scrollbutton_width, thumb_pos, bar, clip, dc);
+ break;
+ }
+ }
+ }
+
+ /* Thumb */
+ ScrollBar_DrawThumb(bar, thumb_pos, clip, dc);
+ }
+
+ protected virtual void ScrollBar_DrawThumb(ScrollBar bar, Rectangle thumb_pos, Rectangle clip, Graphics dc)
+ {
+ if (bar.Enabled && thumb_pos.Width > 0 && thumb_pos.Height > 0 && clip.IntersectsWith(thumb_pos))
+ DrawScrollButtonPrimitive(dc, thumb_pos, ButtonState.Normal);
+ }
+
+ protected virtual void ScrollBar_Vertical_Draw_ThumbMoving_None( int scrollbutton_height, ScrollBar bar, Rectangle clip, Graphics dc )
+ {
+ Rectangle r = new Rectangle( 0,
+ scrollbutton_height, bar.ClientRectangle.Width, bar.ClientRectangle.Height - ( scrollbutton_height * 2 ) );
+ Rectangle intersect = Rectangle.Intersect( clip, r );
+
+ if ( intersect != Rectangle.Empty )
+ {
+ Brush h = ResPool.GetHatchBrush( HatchStyle.Percent50, ColorScrollBar, Color.White);
+ dc.FillRectangle( h, intersect );
+ }
+ }
+
+ protected virtual void ScrollBar_Vertical_Draw_ThumbMoving_Forward( int scrollbutton_height, ScrollBar bar, Rectangle thumb_pos, Rectangle clip, Graphics dc )
+ {
+ Rectangle r = new Rectangle( 0, scrollbutton_height,
+ bar.ClientRectangle.Width, thumb_pos.Y - scrollbutton_height );
+ Rectangle intersect = Rectangle.Intersect( clip, r );
+
+ if ( intersect != Rectangle.Empty )
+ dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, ColorScrollBar, Color.White ), intersect );
+
+ r.X = 0;
+ r.Y = thumb_pos.Y + thumb_pos.Height;
+ r.Width = bar.ClientRectangle.Width;
+ r.Height = bar.ClientRectangle.Height - ( thumb_pos.Y + thumb_pos.Height ) - scrollbutton_height;
+
+ intersect = Rectangle.Intersect( clip, r );
+ if ( intersect != Rectangle.Empty )
+ dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, Color.FromArgb( 255, 63, 63, 63 ), Color.Black ), intersect );
+ }
+
+ protected virtual void ScrollBar_Vertical_Draw_ThumbMoving_Backwards( int scrollbutton_height, ScrollBar bar, Rectangle thumb_pos, Rectangle clip, Graphics dc )
+ {
+ Rectangle r = new Rectangle( 0, scrollbutton_height,
+ bar.ClientRectangle.Width, thumb_pos.Y - scrollbutton_height );
+ Rectangle intersect = Rectangle.Intersect( clip, r );
+
+ if ( intersect != Rectangle.Empty )
+ dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, Color.FromArgb( 255, 63, 63, 63 ), Color.Black ), intersect );
+
+ r.X = 0;
+ r.Y = thumb_pos.Y + thumb_pos.Height;
+ r.Width = bar.ClientRectangle.Width;
+ r.Height = bar.ClientRectangle.Height - ( thumb_pos.Y + thumb_pos.Height ) - scrollbutton_height;
+
+ intersect = Rectangle.Intersect( clip, r );
+ if ( intersect != Rectangle.Empty )
+ dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, ColorScrollBar, Color.White), intersect );
+ }
+
+ protected virtual void ScrollBar_Horizontal_Draw_ThumbMoving_None( int scrollbutton_width, ScrollBar bar, Rectangle clip, Graphics dc )
+ {
+ Rectangle r = new Rectangle( scrollbutton_width,
+ 0, bar.ClientRectangle.Width - ( scrollbutton_width * 2 ), bar.ClientRectangle.Height );
+ Rectangle intersect = Rectangle.Intersect( clip, r );
+
+ if ( intersect != Rectangle.Empty )
+ dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, ColorScrollBar, Color.White), intersect );
+ }
+
+ protected virtual void ScrollBar_Horizontal_Draw_ThumbMoving_Forward( int scrollbutton_width, Rectangle thumb_pos, ScrollBar bar, Rectangle clip, Graphics dc )
+ {
+ Rectangle r = new Rectangle( scrollbutton_width, 0,
+ thumb_pos.X - scrollbutton_width, bar.ClientRectangle.Height );
+ Rectangle intersect = Rectangle.Intersect( clip, r );
+
+ if ( intersect != Rectangle.Empty )
+ dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, ColorScrollBar, Color.White), intersect );
+
+ r.X = thumb_pos.X + thumb_pos.Width;
+ r.Y = 0;
+ r.Width = bar.ClientRectangle.Width - ( thumb_pos.X + thumb_pos.Width ) - scrollbutton_width;
+ r.Height = bar.ClientRectangle.Height;
+
+ intersect = Rectangle.Intersect( clip, r );
+ if ( intersect != Rectangle.Empty )
+ dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, Color.FromArgb( 255, 63, 63, 63 ), Color.Black ), intersect );
+ }
+
+ protected virtual void ScrollBar_Horizontal_Draw_ThumbMoving_Backwards( int scrollbutton_width, Rectangle thumb_pos, ScrollBar bar, Rectangle clip, Graphics dc )
+ {
+ Rectangle r = new Rectangle( scrollbutton_width, 0,
+ thumb_pos.X - scrollbutton_width, bar.ClientRectangle.Height );
+ Rectangle intersect = Rectangle.Intersect( clip, r );
+
+ if ( intersect != Rectangle.Empty )
+ dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, Color.FromArgb( 255, 63, 63, 63 ), Color.Black ), intersect );
+
+ r.X = thumb_pos.X + thumb_pos.Width;
+ r.Y = 0;
+ r.Width = bar.ClientRectangle.Width - ( thumb_pos.X + thumb_pos.Width ) - scrollbutton_width;
+ r.Height = bar.ClientRectangle.Height;
+
+ intersect = Rectangle.Intersect( clip, r );
+ if ( intersect != Rectangle.Empty )
+ dc.FillRectangle( ResPool.GetHatchBrush( HatchStyle.Percent50, ColorScrollBar, Color.White), intersect );
+ }
+
+ public override int ScrollBarButtonSize {
+ get { return 16; }
+ }
+ #endregion // ScrollBar
+
+ #region StatusBar
+ public override void DrawStatusBar (Graphics dc, Rectangle clip, StatusBar sb) {
+ Rectangle area = sb.ClientRectangle;
+ int horz_border = 2;
+ int vert_border = 2;
+
+ dc.FillRectangle (GetControlBackBrush (sb.BackColor), clip);
+
+ if (sb.Panels.Count == 0 && sb.Text != String.Empty) {
+ string text = sb.Text;
+ StringFormat string_format = new StringFormat ();
+ string_format.Trimming = StringTrimming.Character;
+ string_format.FormatFlags = StringFormatFlags.NoWrap;
+
+ if (text [0] == '\t') {
+ string_format.Alignment = StringAlignment.Center;
+ text = text.Substring (1);
+ if (text [0] == '\t') {
+ string_format.Alignment = StringAlignment.Far;
+ text = text.Substring (1);
+ }
+ }
+
+ dc.DrawString (text, sb.Font, ResPool.GetSolidBrush (sb.ForeColor),
+ new Rectangle(area.X + 2, area.Y + 2, area.Width - 4, area.Height - 4), string_format);
+ string_format.Dispose ();
+ } else if (sb.ShowPanels) {
+ SolidBrush br_forecolor = GetControlForeBrush (sb.ForeColor);
+ int prev_x = area.X + horz_border;
+ int y = area.Y + vert_border;
+ for (int i = 0; i < sb.Panels.Count; i++) {
+ Rectangle pr = new Rectangle (prev_x, y,
+ sb.Panels [i].Width, area.Height);
+ prev_x += pr.Width + StatusBarHorzGapWidth;
+ if (pr.IntersectsWith (clip))
+ DrawStatusBarPanel (dc, pr, i, br_forecolor, sb.Panels [i]);
+ }
+ }
+
+ if (sb.SizingGrip)
+ CPDrawSizeGrip (dc, ColorControl, area);
+
+ }
+
+
+ protected virtual void DrawStatusBarPanel (Graphics dc, Rectangle area, int index,
+ SolidBrush br_forecolor, StatusBarPanel panel) {
+ int border_size = 3; // this is actually const, even if the border style is none
+
+ area.Height -= border_size;
+ if (panel.BorderStyle != StatusBarPanelBorderStyle.None) {
+ Border3DStyle border_style = Border3DStyle.SunkenInner;
+ if (panel.BorderStyle == StatusBarPanelBorderStyle.Raised)
+ border_style = Border3DStyle.RaisedOuter;
+ CPDrawBorder3D(dc, area, border_style, Border3DSide.All, panel.Parent.BackColor);
+ }
+
+ if (panel.Style == StatusBarPanelStyle.OwnerDraw) {
+ StatusBarDrawItemEventArgs e = new StatusBarDrawItemEventArgs (
+ dc, panel.Parent.Font, area, index, DrawItemState.Default,
+ panel, panel.Parent.ForeColor, panel.Parent.BackColor);
+ panel.Parent.OnDrawItemInternal (e);
+ return;
+ }
+
+ int left = area.Left;
+ if (panel.Icon != null) {
+ left += 2;
+ dc.DrawIcon (panel.Icon, left, area.Top);
+ left += panel.Icon.Width;
+ }
+
+ if (panel.Text == String.Empty)
+ return;
+
+ string text = panel.Text;
+ StringFormat string_format = new StringFormat ();
+ string_format.Trimming = StringTrimming.Character;
+ string_format.FormatFlags = StringFormatFlags.NoWrap;
+
+ if (text [0] == '\t') {
+ string_format.Alignment = StringAlignment.Center;
+ text = text.Substring (1);
+ if (text [0] == '\t') {
+ string_format.Alignment = StringAlignment.Far;
+ text = text.Substring (1);
+ }
+ }
+
+ int x = left + border_size;
+ int y = border_size + 2;
+ Rectangle r = new Rectangle (x, y,
+ area.Right - x - border_size,
+ area.Bottom - y - border_size);
+
+ dc.DrawString (text, panel.Parent.Font, br_forecolor, r, string_format);
+ string_format.Dispose ();
+ }
+
+ public override int StatusBarSizeGripWidth {
+ get { return 15; }
+ }
+
+ public override int StatusBarHorzGapWidth {
+ get { return 3; }
+ }
+
+ public override Size StatusBarDefaultSize {
+ get {
+ return new Size (100, 22);
+ }
+ }
+ #endregion // StatusBar
+
+ public override void DrawTabControl (Graphics dc, Rectangle area, TabControl tab)
+ {
+ // Do we need to fill the back color? It can't be changed...
+ dc.FillRectangle (GetControlBackBrush (tab.BackColor), area);
+ Rectangle panel_rect = GetTabPanelRectExt (tab);
+
+ if (tab.Appearance == TabAppearance.Normal) {
+ CPDrawBorder3D (dc, panel_rect, Border3DStyle.RaisedInner, Border3DSide.Left | Border3DSide.Top, ColorControl);
+ CPDrawBorder3D (dc, panel_rect, Border3DStyle.Raised, Border3DSide.Right | Border3DSide.Bottom, ColorControl);
+ }
+
+ if (tab.Alignment == TabAlignment.Top) {
+ for (int r = tab.TabPages.Count; r > 0; r--) {
+ for (int i = tab.SliderPos; i < tab.TabPages.Count; i++) {
+ if (i == tab.SelectedIndex)
+ continue;
+ if (r != tab.TabPages [i].Row)
+ continue;
+ Rectangle rect = tab.GetTabRect (i);
+ if (!rect.IntersectsWith (area))
+ continue;
+ DrawTab (dc, tab.TabPages [i], tab, rect, false);
+ }
+ }
+ } else {
+ for (int r = 0; r < tab.TabPages.Count; r++) {
+ for (int i = tab.SliderPos; i < tab.TabPages.Count; i++) {
+ if (i == tab.SelectedIndex)
+ continue;
+ if (r != tab.TabPages [i].Row)
+ continue;
+ Rectangle rect = tab.GetTabRect (i);
+ if (!rect.IntersectsWith (area))
+ continue;
+ DrawTab (dc, tab.TabPages [i], tab, rect, false);
+ }
+ }
+ }
+
+ if (tab.SelectedIndex != -1 && tab.SelectedIndex >= tab.SliderPos) {
+ Rectangle rect = tab.GetTabRect (tab.SelectedIndex);
+ if (rect.IntersectsWith (area))
+ DrawTab (dc, tab.TabPages [tab.SelectedIndex], tab, rect, true);
+ }
+
+ if (tab.ShowSlider) {
+ Rectangle right = GetTabControlRightScrollRect (tab);
+ Rectangle left = GetTabControlLeftScrollRect (tab);
+ CPDrawScrollButton (dc, right, ScrollButton.Right, tab.RightSliderState);
+ CPDrawScrollButton (dc, left, ScrollButton.Left, tab.LeftSliderState);
+ }
+ }
+
+ public override Rectangle GetTabControlLeftScrollRect (TabControl tab)
+ {
+ switch (tab.Alignment) {
+ case TabAlignment.Top:
+ return new Rectangle (tab.ClientRectangle.Right - 34, tab.ClientRectangle.Top + 1, 17, 17);
+ default:
+ Rectangle panel_rect = GetTabPanelRectExt (tab);
+ return new Rectangle (tab.ClientRectangle.Right - 34, panel_rect.Bottom + 2, 17, 17);
+ }
+ }
+
+ public override Rectangle GetTabControlRightScrollRect (TabControl tab)
+ {
+ switch (tab.Alignment) {
+ case TabAlignment.Top:
+ return new Rectangle (tab.ClientRectangle.Right - 17, tab.ClientRectangle.Top + 1, 17, 17);
+ default:
+ Rectangle panel_rect = GetTabPanelRectExt (tab);
+ return new Rectangle (tab.ClientRectangle.Right - 17, panel_rect.Bottom + 2, 17, 17);
+ }
+ }
+
+ public override Size TabControlDefaultItemSize {
+ get { return new Size (42, 21); }
+ }
+
+ public override Point TabControlDefaultPadding {
+ get { return new Point (6, 3); }
+ }
+
+ public override int TabControlMinimumTabWidth {
+ get { return 42; }
+ }
+
+ public override Rectangle GetTabControlDisplayRectangle (TabControl tab)
+ {
+ Rectangle ext = GetTabPanelRectExt (tab);
+ // Account for border size
+ return new Rectangle (ext.Left + 2, ext.Top + 1, ext.Width - 6, ext.Height - 4);
+ }
+
+ public override Size TabControlGetSpacing (TabControl tab) {
+ switch (tab.Appearance) {
+ case TabAppearance.Normal:
+ return new Size (1, -2);
+ case TabAppearance.Buttons:
+ return new Size (3, 3);
+ case TabAppearance.FlatButtons:
+ return new Size (9, 3);
+ default:
+ throw new Exception ("Invalid Appearance value: " + tab.Appearance);
+ }
+ }
+
+ protected virtual Rectangle GetTabPanelRectExt (TabControl tab)
+ {
+ // Offset the tab from the top corner
+ Rectangle res = new Rectangle (tab.ClientRectangle.X + 2,
+ tab.ClientRectangle.Y,
+ tab.ClientRectangle.Width - 2,
+ tab.ClientRectangle.Height - 1);
+
+ if (tab.TabCount == 0)
+ return res;
+
+ int spacing = TabControlGetSpacing (tab).Height;
+ int offset = (tab.ItemSize.Height + spacing) * tab.RowCount + 3;
+
+ switch (tab.Alignment) {
+ case TabAlignment.Left:
+ res.X += offset;
+ res.Width -= offset;
+ break;
+ case TabAlignment.Right:
+ res.Width -= offset;
+ break;
+ case TabAlignment.Top:
+ res.Y += offset;
+ res.Height -= offset;
+ break;
+ case TabAlignment.Bottom:
+ res.Height -= offset;
+ break;
+ }
+
+ return res;
+ }
+
+ protected virtual int DrawTab (Graphics dc, TabPage page, TabControl tab, Rectangle bounds, bool is_selected)
+ {
+ int FlatButtonSpacing = 8;
+ Rectangle interior;
+ int res = bounds.Width;
+
+
+
+ // we can't fill the background right away because the bounds might be adjusted if the tab is selected
+
+ StringFormat string_format = new StringFormat ();
+ if (tab.Appearance == TabAppearance.Buttons || tab.Appearance == TabAppearance.FlatButtons) {
+ dc.FillRectangle (GetControlBackBrush (tab.BackColor), bounds);
+
+ // Separators
+ if (tab.Appearance == TabAppearance.FlatButtons) {
+ int width = bounds.Width;
+ bounds.Width += (FlatButtonSpacing - 2);
+ res = bounds.Width;
+ CPDrawBorder3D (dc, bounds, Border3DStyle.Etched, Border3DSide.Right);
+ bounds.Width = width;
+ }
+
+ if (is_selected) {
+ CPDrawBorder3D (dc, bounds, Border3DStyle.Sunken, Border3DSide.All);
+ } else if (tab.Appearance != TabAppearance.FlatButtons) {
+ CPDrawBorder3D (dc, bounds, Border3DStyle.Raised, Border3DSide.All);
+ }
+
+ interior = new Rectangle (bounds.Left + 2, bounds.Top + 2, bounds.Width - 4, bounds.Height - 4);
+
+
+ string_format.Alignment = StringAlignment.Center;
+ string_format.LineAlignment = StringAlignment.Center;
+ string_format.FormatFlags = StringFormatFlags.NoWrap;
+ } else {
+ Pen light = ResPool.GetPen (ControlPaint.LightLight (tab.BackColor));
+
+ switch (tab.Alignment) {
+
+ case TabAlignment.Top:
+
+
+ dc.FillRectangle (GetControlBackBrush (tab.BackColor), bounds);
+
+ dc.DrawLine (light, bounds.Left, bounds.Bottom, bounds.Left, bounds.Top + 3);
+ dc.DrawLine (light, bounds.Left, bounds.Top + 3, bounds.Left + 3, bounds.Top);
+ dc.DrawLine (light, bounds.Left + 3, bounds.Top, bounds.Right - 3, bounds.Top);
+
+ dc.DrawLine (SystemPens.ControlDark, bounds.Right - 1, bounds.Top + 1, bounds.Right - 1, bounds.Bottom);
+ dc.DrawLine (SystemPens.ControlDarkDark, bounds.Right - 1, bounds.Top + 2, bounds.Right, bounds.Top + 3);
+ dc.DrawLine (SystemPens.ControlDarkDark, bounds.Right, bounds.Top + 3, bounds.Right, bounds.Bottom);
+
+ interior = new Rectangle (bounds.Left + 4, bounds.Top + 4, bounds.Width - 8, bounds.Height - 8);
+
+ string_format.Alignment = StringAlignment.Center;
+ string_format.LineAlignment = StringAlignment.Center;
+ string_format.FormatFlags = StringFormatFlags.NoWrap;
+
+ break;
+
+ case TabAlignment.Bottom:
+
+ dc.FillRectangle (GetControlBackBrush (tab.BackColor), bounds);
+
+ dc.DrawLine (light, bounds.Left, bounds.Top, bounds.Left, bounds.Bottom - 3);
+ dc.DrawLine (light, bounds.Left, bounds.Bottom - 3, bounds.Left + 2, bounds.Bottom - 1);
+
+ dc.DrawLine (SystemPens.ControlDark, bounds.Left + 3, bounds.Bottom - 1, bounds.Right - 3, bounds.Bottom - 1);
+ dc.DrawLine (SystemPens.ControlDark, bounds.Right - 1, bounds.Bottom - 3, bounds.Right - 1, bounds.Top);
+
+ dc.DrawLine (SystemPens.ControlDarkDark, bounds.Left + 3, bounds.Bottom, bounds.Right - 3, bounds.Bottom);
+ dc.DrawLine (SystemPens.ControlDarkDark, bounds.Right - 3, bounds.Bottom, bounds.Right, bounds.Bottom - 3);
+ dc.DrawLine (SystemPens.ControlDarkDark, bounds.Right, bounds.Bottom - 3, bounds.Right, bounds.Top);
+
+ interior = new Rectangle (bounds.Left + 4, bounds.Top + 4, bounds.Width - 8, bounds.Height - 8);
+
+ string_format.Alignment = StringAlignment.Center;
+ string_format.LineAlignment = StringAlignment.Center;
+ string_format.FormatFlags = StringFormatFlags.NoWrap;
+
+ break;
+
+ case TabAlignment.Left:
+
+ dc.FillRectangle (GetControlBackBrush (tab.BackColor), bounds);
+
+ dc.DrawLine (light, bounds.Left, bounds.Bottom - 3, bounds.Left, bounds.Top + 3);
+ dc.DrawLine (light, bounds.Left, bounds.Top + 3, bounds.Left + 3, bounds.Top);
+ dc.DrawLine (light, bounds.Left + 3, bounds.Top, bounds.Right, bounds.Top);
+
+ dc.DrawLine (SystemPens.ControlDark, bounds.Right, bounds.Bottom - 1, bounds.Left + 2, bounds.Bottom - 1);
+
+ dc.DrawLine (SystemPens.ControlDarkDark, bounds.Right, bounds.Bottom, bounds.Left + 2, bounds.Bottom);
+ dc.DrawLine (SystemPens.ControlDarkDark, bounds.Left + 2, bounds.Bottom, bounds.Left, bounds.Bottom - 3);
+
+ interior = new Rectangle (bounds.Left + 4, bounds.Top + 4, bounds.Width - 8, bounds.Height - 8);
+
+ string_format.Alignment = StringAlignment.Center;
+ string_format.LineAlignment = StringAlignment.Center;
+ string_format.FormatFlags = StringFormatFlags.NoWrap;
+ string_format.FormatFlags = StringFormatFlags.DirectionVertical;
+
+ break;
+
+ default:
+ // TabAlignment.Right
+
+ dc.FillRectangle (GetControlBackBrush (tab.BackColor), bounds);
+
+ dc.DrawLine (light, bounds.Left, bounds.Top, bounds.Right - 3, bounds.Top);
+ dc.DrawLine (light, bounds.Right - 3, bounds.Top, bounds.Right, bounds.Top + 3);
+
+ dc.DrawLine (SystemPens.ControlDark, bounds.Right - 1, bounds.Top + 1, bounds.Right - 1, bounds.Bottom - 1);
+ dc.DrawLine (SystemPens.ControlDark, bounds.Left, bounds.Bottom - 1, bounds.Right - 2, bounds.Bottom - 1);
+
+ dc.DrawLine (SystemPens.ControlDarkDark, bounds.Right, bounds.Top + 3, bounds.Right, bounds.Bottom - 3);
+ dc.DrawLine (SystemPens.ControlDarkDark, bounds.Left, bounds.Bottom, bounds.Right - 3, bounds.Bottom);
+
+ interior = new Rectangle (bounds.Left + 4, bounds.Top + 4, bounds.Width - 8, bounds.Height - 8);
+
+ string_format.Alignment = StringAlignment.Center;
+ string_format.LineAlignment = StringAlignment.Center;
+ string_format.FormatFlags = StringFormatFlags.NoWrap;
+ string_format.FormatFlags = StringFormatFlags.DirectionVertical;
+
+ break;
+ }
+ }
+
+ if (tab.DrawMode == TabDrawMode.Normal && page.Text != null) {
+ if (tab.Alignment == TabAlignment.Left) {
+ int wo = interior.Width / 2;
+ int ho = interior.Height / 2;
+ dc.TranslateTransform (interior.X + wo, interior.Y + ho);
+ dc.RotateTransform (180);
+ dc.DrawString (page.Text, page.Font, ThemeEngine.Current.ResPool.GetSolidBrush (SystemColors.ControlText), 0, 0, string_format);
+ dc.ResetTransform ();
+ } else {
+ dc.DrawString (page.Text, page.Font,
+ ThemeEngine.Current.ResPool.GetSolidBrush (SystemColors.ControlText),
+ interior, string_format);
+ }
+ } else if (page.Text != null) {
+ DrawItemState state = DrawItemState.None;
+ if (page == tab.SelectedTab)
+ state |= DrawItemState.Selected;
+ DrawItemEventArgs e = new DrawItemEventArgs (dc,
+ tab.Font, bounds, tab.IndexForTabPage (page),
+ state, page.ForeColor, page.BackColor);
+ tab.OnDrawItemInternal (e);
+ return res;
+ }
+
+ if (page.Focused) {
+ CPDrawFocusRectangle (dc, interior, tab.ForeColor, tab.BackColor);
+ }
+
+ return res;
+ }
+
+ #region ToolBar
+ public override void DrawToolBar (Graphics dc, Rectangle clip_rectangle, ToolBar control) {
+ StringFormat format = new StringFormat ();
+ format.Trimming = StringTrimming.EllipsisWord;
+ if (control.textAlignment == ToolBarTextAlign.Underneath) {
+ format.LineAlignment = StringAlignment.Center;
+ format.Alignment = StringAlignment.Center;
+ } else {
+ format.LineAlignment = StringAlignment.Center;
+ format.Alignment = StringAlignment.Near;
+ }
+
+ // Exclude the area for divider
+ Rectangle paint_area = new Rectangle (0, ToolBarGripWidth / 2,
+ control.Width, control.Height - ToolBarGripWidth / 2);
+ bool flat = (control.Appearance == ToolBarAppearance.Flat);
+ dc.FillRectangle (ResPool.GetSolidBrush( DefaultControlBackColor ), paint_area);
+ if (control.Divider)
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), 0, 0, paint_area.Width, 0);
+
+ foreach (ToolBarButton button in control.Buttons) {
+
+ Image image = null;
+ Rectangle buttonArea = button.Rectangle;
+ Rectangle imgRect = Rectangle.Empty; // rect to draw the image
+ Rectangle txtRect = buttonArea; // rect to draw the text
+ Rectangle ddRect = Rectangle.Empty; // rect for the drop down arrow
+
+ // calculate different rects and draw the frame if its not separator button
+ if (button.Style != ToolBarButtonStyle.Separator) {
+ /* Adjustment for drop down arrow */
+ if (button.Style == ToolBarButtonStyle.DropDownButton && control.DropDownArrows) {
+ ddRect.X = buttonArea.X + buttonArea.Width - this.ToolBarDropDownWidth;
+ ddRect.Y = buttonArea.Y;
+ ddRect.Width = this.ToolBarDropDownWidth;
+ ddRect.Height = buttonArea.Height;
+ }
+
+ // calculate txtRect and imgRect, if imageIndex and imageList are present
+ if (button.ImageIndex > -1 && control.ImageList != null) {
+ if (button.ImageIndex < control.ImageList.Images.Count)
+ image = control.ImageList.Images [button.ImageIndex];
+ // draw the image at the centre if textalignment is underneath
+ if (control.TextAlign == ToolBarTextAlign.Underneath) {
+ imgRect.X = buttonArea.X + ((buttonArea.Width - ddRect.Width
+ - control.ImageSize.Width) / 2)
+ + this.ToolBarImageGripWidth;
+ imgRect.Y = buttonArea.Y + this.ToolBarImageGripWidth;
+ imgRect.Width = control.ImageSize.Width;
+ imgRect.Height = control.ImageSize.Height;
+
+ txtRect.X = buttonArea.X;
+ txtRect.Y = buttonArea.Y + imgRect.Height + 2 * this.ToolBarImageGripWidth;
+ txtRect.Width = buttonArea.Width - ddRect.Width;
+ txtRect.Height = buttonArea.Height - imgRect.Height
+ - 2 * this.ToolBarImageGripWidth;
+ }
+ else {
+ imgRect.X = buttonArea.X + this.ToolBarImageGripWidth;
+ imgRect.Y = buttonArea.Y + this.ToolBarImageGripWidth;
+ imgRect.Width = control.ImageSize.Width;
+ imgRect.Height = control.ImageSize.Height;
+
+ txtRect.X = buttonArea.X + imgRect.Width + 2 * this.ToolBarImageGripWidth;
+ txtRect.Y = buttonArea.Y;
+ txtRect.Width = buttonArea.Width - imgRect.Width
+ - 2 * this.ToolBarImageGripWidth - ddRect.Width;
+ txtRect.Height = buttonArea.Height;
+ }
+ }
+ /* Draw the button frame, only if it is not a separator */
+ if (flat) {
+ if (button.Pushed || button.Pressed) {
+ CPDrawBorder3D (dc, buttonArea, Border3DStyle.SunkenOuter, Border3DSide.All, ColorControl);
+ } else if (button.Hilight) {
+ dc.DrawRectangle (ResPool.GetPen (ColorControlText), buttonArea);
+ if (! ddRect.IsEmpty) {
+ dc.DrawLine (ResPool.GetPen (ColorControlText), ddRect.X, ddRect.Y, ddRect.X,
+ ddRect.Y + ddRect.Height);
+ buttonArea.Width -= this.ToolBarDropDownWidth;
+ }
+ }
+ }
+ else { // normal toolbar
+ if (button.Pushed || button.Pressed) {
+ CPDrawBorder3D (dc, buttonArea, Border3DStyle.SunkenInner,
+ Border3DSide.All, ColorControl);
+ if (! ddRect.IsEmpty) {
+ CPDrawBorder3D (dc, ddRect, Border3DStyle.SunkenInner,
+ Border3DSide.Left, ColorControl);
+ buttonArea.Width -= this.ToolBarDropDownWidth;
+ }
+ }
+ else {
+ CPDrawBorder3D (dc, buttonArea, Border3DStyle.RaisedInner,
+ Border3DSide.All, ColorControl);
+ if (! ddRect.IsEmpty) {
+ CPDrawBorder3D (dc, ddRect, Border3DStyle.RaisedInner,
+ Border3DSide.Left, ColorControl);
+ buttonArea.Width -= this.ToolBarDropDownWidth;
+ }
+ }
+ }
+ }
+ DrawToolBarButton (dc, button, control.Font, format, paint_area, buttonArea,
+ imgRect, image, txtRect, ddRect, flat);
+ }
+ format.Dispose ();
+ }
+
+ private void DrawToolBarButton (Graphics dc, ToolBarButton button, Font font, StringFormat format,
+ Rectangle controlArea, Rectangle buttonArea, Rectangle imgRect,
+ Image image, Rectangle txtRect, Rectangle ddRect, bool flat) {
+ if (! button.Visible)
+ return;
+
+ switch (button.Style) {
+
+ case ToolBarButtonStyle.Separator:
+ // separator is drawn only in the case of flat appearance
+ if (flat) {
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), buttonArea.X + 1, buttonArea.Y,
+ buttonArea.X + 1, buttonArea.Height);
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), buttonArea.X + 1 + (int) ResPool.GetPen (ColorControl).Width,
+ buttonArea.Y, buttonArea.X + 1 + (int) ResPool.GetPen (ColorControl).Width, buttonArea.Height);
+ /* draw a horizontal separator */
+ if (button.Wrapper) {
+ int y = buttonArea.Height + this.ToolBarSeparatorWidth / 2;
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), 0, y, controlArea.Width, y);
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), 0, y + 1 + (int) ResPool.GetPen (ColorControl).Width, controlArea.Width,
+ y + 1 + (int) ResPool.GetPen (ColorControl).Width);
+ }
+ }
+ break;
+
+ case ToolBarButtonStyle.ToggleButton:
+ Rectangle toggleArea = Rectangle.Empty;
+ toggleArea.X = buttonArea.X + this.ToolBarImageGripWidth;
+ toggleArea.Y = buttonArea.Y + this.ToolBarImageGripWidth;
+ toggleArea.Width = buttonArea.Width - 2 * this.ToolBarImageGripWidth;
+ toggleArea.Height = buttonArea.Height - 2 * this.ToolBarImageGripWidth;
+ if (button.PartialPush && button.Pushed) {
+ dc.FillRectangle (SystemBrushes.ControlLightLight, toggleArea);
+ if (! imgRect.IsEmpty) {
+ if (button.Enabled && image != null)
+ button.Parent.ImageList.Draw (dc, imgRect.X, imgRect.Y, imgRect.Width,
+ imgRect.Height, button.ImageIndex);
+ else {
+ dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (ColorGrayText), imgRect);
+ ControlPaint.DrawBorder3D (dc, imgRect, Border3DStyle.SunkenOuter,
+ Border3DSide.Right | Border3DSide.Bottom);
+ }
+ }
+ if (button.Enabled)
+ dc.DrawString (button.Text, font, SystemBrushes.ControlText, txtRect, format);
+ else
+ CPDrawStringDisabled (dc, button.Text, font, ColorControlLight, txtRect, format);
+ }
+
+ else if (button.PartialPush) {
+ dc.FillRectangle (SystemBrushes.ControlLight, toggleArea);
+ if (! imgRect.IsEmpty) {
+ if (button.Enabled && image != null)
+ button.Parent.ImageList.Draw (dc, imgRect.X, imgRect.Y, imgRect.Width,
+ imgRect.Height, button.ImageIndex);
+ else {
+ dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (ColorGrayText), imgRect);
+ ControlPaint.DrawBorder3D (dc, imgRect, Border3DStyle.SunkenOuter,
+ Border3DSide.Right | Border3DSide.Bottom);
+ }
+ }
+ if (button.Enabled)
+ dc.DrawString (button.Text, font, SystemBrushes.ControlText, txtRect, format);
+ else
+ CPDrawStringDisabled (dc, button.Text, font, ColorControlLight,
+ txtRect, format);
+ }
+
+ else if (button.Pushed) {
+ dc.FillRectangle (SystemBrushes.ControlLightLight, toggleArea);
+ if (! imgRect.IsEmpty) {
+ if (button.Enabled && image != null)
+ button.Parent.ImageList.Draw (dc, imgRect.X, imgRect.Y, imgRect.Width,
+ imgRect.Height, button.ImageIndex);
+ else {
+ dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (ColorGrayText), imgRect);
+ CPDrawBorder3D (dc, imgRect, Border3DStyle.SunkenOuter,
+ Border3DSide.Right | Border3DSide.Bottom, ColorControl);
+ }
+ }
+ if (button.Enabled)
+ dc.DrawString (button.Text, font, SystemBrushes.ControlText, txtRect, format);
+ else
+ CPDrawStringDisabled (dc, button.Text, font, ColorControlLight,
+ txtRect, format);
+ }
+
+ else {
+ dc.FillRectangle (SystemBrushes.Control, toggleArea);
+ if (! imgRect.IsEmpty) {
+ if (button.Enabled && image != null)
+ button.Parent.ImageList.Draw (dc, imgRect.X, imgRect.Y, imgRect.Width,
+ imgRect.Height, button.ImageIndex);
+ else {
+ dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (ColorGrayText), imgRect);
+ CPDrawBorder3D (dc, imgRect, Border3DStyle.SunkenOuter,
+ Border3DSide.Right | Border3DSide.Bottom, ColorControl);
+ }
+ }
+ if (button.Enabled)
+ dc.DrawString (button.Text, font, SystemBrushes.ControlText, txtRect, format);
+ else
+ CPDrawStringDisabled (dc, button.Text, font, ColorControlLight,
+ txtRect, format);
+ }
+ break;
+
+ case ToolBarButtonStyle.DropDownButton:
+ // draw the dropdown arrow
+ if (! ddRect.IsEmpty) {
+ PointF [] vertices = new PointF [3];
+ PointF ddCenter = new PointF (ddRect.X + (ddRect.Width/2.0f), ddRect.Y + (ddRect.Height/2.0f));
+ vertices [0].X = ddCenter.X - this.ToolBarDropDownArrowWidth / 2.0f + 0.5f;
+ vertices [0].Y = ddCenter.Y;
+ vertices [1].X = ddCenter.X + this.ToolBarDropDownArrowWidth / 2.0f + 0.5f;
+ vertices [1].Y = ddCenter.Y;
+ vertices [2].X = ddCenter.X + 0.5f; // 0.5 is added for adjustment
+ vertices [2].Y = ddCenter.Y + this.ToolBarDropDownArrowHeight;
+ dc.FillPolygon (SystemBrushes.ControlText, vertices);
+ }
+ goto case ToolBarButtonStyle.PushButton;
+
+ case ToolBarButtonStyle.PushButton:
+ if (! imgRect.IsEmpty){
+ if (button.Enabled && image != null)
+ button.Parent.ImageList.Draw (dc, imgRect.X, imgRect.Y, imgRect.Width, imgRect.Height,
+ button.ImageIndex);
+ else {
+ dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (ColorGrayText), imgRect);
+ CPDrawBorder3D (dc, imgRect, Border3DStyle.SunkenOuter,
+ Border3DSide.Right | Border3DSide.Bottom, ColorControl);
+ }
+ }
+ if (button.Enabled)
+ dc.DrawString (button.Text, font, SystemBrushes.ControlText, txtRect, format);
+ else
+ CPDrawStringDisabled (dc, button.Text, font, ColorControlLight,
+ txtRect, format);
+ break;
+ }
+ }
+
+ // Grip width for the ToolBar
+ public override int ToolBarGripWidth {
+ get { return 2;}
+ }
+
+ // Grip width for the Image on the ToolBarButton
+ public override int ToolBarImageGripWidth {
+ get { return 2;}
+ }
+
+ // width of the separator
+ public override int ToolBarSeparatorWidth {
+ get { return 4; }
+ }
+
+ // width of the dropdown arrow rect
+ public override int ToolBarDropDownWidth {
+ get { return 13; }
+ }
+
+ // width for the dropdown arrow on the ToolBarButton
+ public override int ToolBarDropDownArrowWidth {
+ get { return 5;}
+ }
+
+ // height for the dropdown arrow on the ToolBarButton
+ public override int ToolBarDropDownArrowHeight {
+ get { return 3;}
+ }
+
+ public override Size ToolBarDefaultSize {
+ get {
+ return new Size (100, 42);
+ }
+ }
+ #endregion // ToolBar
+
+ #region ToolTip
+ public override void DrawToolTip(Graphics dc, Rectangle clip_rectangle, ToolTip.ToolTipWindow control) {
+ dc.FillRectangle(ResPool.GetSolidBrush(this.ColorInfo), control.client_rect);
+ dc.DrawRectangle(ResPool.GetPen(this.ColorWindowFrame), 0, 0, control.Width-1, control.Height-1);
+ dc.DrawString(control.text, control.Font, ResPool.GetSolidBrush(this.ColorInfoText), control.client_rect, control.string_format);
+ }
+
+ public override Size ToolTipSize(ToolTip.ToolTipWindow tt, string text) {
+ SizeF sizef;
+
+ sizef = tt.DeviceContext.MeasureString(text, tt.Font);
+ return new Size((int)sizef.Width+2, (int)sizef.Height+3); // Need space for the border
+ }
+ #endregion // ToolTip
+
+ #region TrackBar
+ private void DrawTrackBar_Vertical (Graphics dc, Rectangle clip_rectangle, TrackBar tb,
+ ref Rectangle thumb_pos, ref Rectangle thumb_area, Brush br_thumb,
+ float ticks, int value_pos, bool mouse_value) {
+
+ Point toptick_startpoint = new Point ();
+ Point bottomtick_startpoint = new Point ();
+ Point channel_startpoint = new Point ();
+ float pixel_len;
+ float pixels_betweenticks;
+ const int space_from_right = 8;
+ const int space_from_left = 8;
+ Rectangle area = tb.ClientRectangle;
+
+ switch (tb.TickStyle) {
+ case TickStyle.BottomRight:
+ case TickStyle.None:
+ channel_startpoint.Y = 8;
+ channel_startpoint.X = 9;
+ bottomtick_startpoint.Y = 13;
+ bottomtick_startpoint.X = 24;
+ break;
+ case TickStyle.TopLeft:
+ channel_startpoint.Y = 8;
+ channel_startpoint.X = 19;
+ toptick_startpoint.Y = 13;
+ toptick_startpoint.X = 8;
+ break;
+ case TickStyle.Both:
+ channel_startpoint.Y = 8;
+ channel_startpoint.X = 18;
+ bottomtick_startpoint.Y = 13;
+ bottomtick_startpoint.X = 32;
+ toptick_startpoint.Y = 13;
+ toptick_startpoint.X = 8;
+ break;
+ default:
+ break;
+ }
+
+ thumb_area.X = area.X + channel_startpoint.X;
+ thumb_area.Y = area.Y + channel_startpoint.Y;
+ thumb_area.Height = area.Height - space_from_right - space_from_left;
+ thumb_area.Width = 4;
+
+ /* Draw channel */
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControlDark), channel_startpoint.X, channel_startpoint.Y,
+ 1, thumb_area.Height);
+
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControlDarkDark), channel_startpoint.X + 1, channel_startpoint.Y,
+ 1, thumb_area.Height);
+
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControlLight), channel_startpoint.X + 3, channel_startpoint.Y,
+ 1, thumb_area.Height);
+
+ pixel_len = thumb_area.Height - 11;
+ pixels_betweenticks = pixel_len / (tb.Maximum - tb.Minimum);
+
+ /* Convert thumb position from mouse position to value*/
+ if (mouse_value) {
+
+ if (value_pos >= channel_startpoint.Y)
+ value_pos = (int)(((float) (value_pos - channel_startpoint.Y)) / pixels_betweenticks);
+ else
+ value_pos = 0;
+
+ if (value_pos + tb.Minimum > tb.Maximum)
+ value_pos = tb.Maximum - tb.Minimum;
+
+ tb.Value = value_pos + tb.Minimum;
+ }
+
+ thumb_pos.Y = channel_startpoint.Y + (int) (pixels_betweenticks * (float) value_pos);
+
+ /* Draw thumb fixed 10x22 size */
+ thumb_pos.Width = 10;
+ thumb_pos.Height = 22;
+
+ switch (tb.TickStyle) {
+ case TickStyle.BottomRight:
+ case TickStyle.None: {
+ thumb_pos.X = channel_startpoint.X - 8;
+
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), thumb_pos.X, thumb_pos.Y, thumb_pos.X , thumb_pos.Y + 10);
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), thumb_pos.X, thumb_pos.Y, thumb_pos.X + 16, thumb_pos.Y);
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), thumb_pos.X + 16, thumb_pos.Y, thumb_pos.X + 16 + 4, thumb_pos.Y + 4);
+
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), thumb_pos.X +1, thumb_pos.Y + 9, thumb_pos.X +15, thumb_pos.Y +9);
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), thumb_pos.X + 16, thumb_pos.Y + 9, thumb_pos.X +16 + 4, thumb_pos.Y +9 - 4);
+
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), thumb_pos.X, thumb_pos.Y + 10, thumb_pos.X +16, thumb_pos.Y +10);
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), thumb_pos.X + 16, thumb_pos.Y + 10, thumb_pos.X +16 + 5, thumb_pos.Y +10 - 5);
+
+ dc.FillRectangle (br_thumb, thumb_pos.X + 1, thumb_pos.Y + 1, 16, 8);
+ dc.FillRectangle (br_thumb, thumb_pos.X + 17, thumb_pos.Y + 2, 1, 6);
+ dc.FillRectangle (br_thumb, thumb_pos.X + 18, thumb_pos.Y + 3, 1, 4);
+ dc.FillRectangle (br_thumb, thumb_pos.X + 19, thumb_pos.Y + 4, 1, 2);
+
+ break;
+ }
+ case TickStyle.TopLeft: {
+ thumb_pos.X = channel_startpoint.X - 10;
+
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), thumb_pos.X + 4, thumb_pos.Y, thumb_pos.X + 4 + 16, thumb_pos.Y);
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), thumb_pos.X + 4, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 4);
+
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), thumb_pos.X + 4, thumb_pos.Y + 9, thumb_pos.X + 4 + 16 , thumb_pos.Y+ 9);
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), thumb_pos.X + 4, thumb_pos.Y + 9, thumb_pos.X, thumb_pos.Y + 5);
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), thumb_pos.X + 19, thumb_pos.Y + 9, thumb_pos.X +19 , thumb_pos.Y+ 1);
+
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), thumb_pos.X + 4, thumb_pos.Y+ 10, thumb_pos.X + 4 + 16, thumb_pos.Y+ 10);
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), thumb_pos.X + 4, thumb_pos.Y + 10, thumb_pos.X -1, thumb_pos.Y+ 5);
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), thumb_pos.X + 20, thumb_pos.Y, thumb_pos.X+ 20, thumb_pos.Y + 10);
+
+ dc.FillRectangle (br_thumb, thumb_pos.X + 4, thumb_pos.Y + 1, 15, 8);
+ dc.FillRectangle (br_thumb, thumb_pos.X + 3, thumb_pos.Y + 2, 1, 6);
+ dc.FillRectangle (br_thumb, thumb_pos.X + 2, thumb_pos.Y + 3, 1, 4);
+ dc.FillRectangle (br_thumb, thumb_pos.X + 1, thumb_pos.Y + 4, 1, 2);
+
+ break;
+ }
+
+ case TickStyle.Both: {
+ thumb_pos.X = area.X + 10;
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), thumb_pos.X, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 9);
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), thumb_pos.X, thumb_pos.Y, thumb_pos.X + 19, thumb_pos.Y);
+
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), thumb_pos.X + 1, thumb_pos.Y + 9, thumb_pos.X+ 19, thumb_pos.Y + 9);
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), thumb_pos.X + 10, thumb_pos.Y+ 1, thumb_pos.X + 19, thumb_pos.Y + 8);
+
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), thumb_pos.X, thumb_pos.Y + 10, thumb_pos.X+ 20, thumb_pos.Y +10);
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), thumb_pos.X + 20, thumb_pos.Y, thumb_pos.X + 20, thumb_pos.Y+ 9);
+
+ dc.FillRectangle (br_thumb, thumb_pos.X + 1, thumb_pos.Y + 1, 18, 8);
+
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ pixel_len = thumb_area.Height - 11;
+ pixels_betweenticks = pixel_len / ticks;
+
+ thumb_area.X = thumb_pos.X;
+ thumb_area.Y = channel_startpoint.Y;
+ thumb_area.Width = thumb_pos.Height;
+
+ /* Draw ticks*/
+ Region outside = new Region (area);
+ outside.Exclude (thumb_area);
+
+ if (outside.IsVisible (clip_rectangle)) {
+ if (pixels_betweenticks > 0 && ((tb.TickStyle & TickStyle.BottomRight) == TickStyle.BottomRight ||
+ ((tb.TickStyle & TickStyle.Both) == TickStyle.Both))) {
+
+ for (float inc = 0; inc < (pixel_len + 1); inc += pixels_betweenticks) {
+ if (inc == 0 || (inc + pixels_betweenticks) >= pixel_len +1)
+ dc.DrawLine (ResPool.GetPen (pen_ticks_color), area.X + bottomtick_startpoint.X , area.Y + bottomtick_startpoint.Y + inc,
+ area.X + bottomtick_startpoint.X + 3, area.Y + bottomtick_startpoint.Y + inc);
+ else
+ dc.DrawLine (ResPool.GetPen (pen_ticks_color), area.X + bottomtick_startpoint.X, area.Y + bottomtick_startpoint.Y + inc,
+ area.X + bottomtick_startpoint.X + 2, area.Y + bottomtick_startpoint.Y + inc);
+ }
+ }
+
+ if (pixels_betweenticks > 0 && ((tb.TickStyle & TickStyle.TopLeft) == TickStyle.TopLeft ||
+ ((tb.TickStyle & TickStyle.Both) == TickStyle.Both))) {
+
+ pixel_len = thumb_area.Height - 11;
+ pixels_betweenticks = pixel_len / ticks;
+
+ for (float inc = 0; inc < (pixel_len + 1); inc += pixels_betweenticks) {
+ if (inc == 0 || (inc + pixels_betweenticks) >= pixel_len +1)
+ dc.DrawLine (ResPool.GetPen (pen_ticks_color), area.X + toptick_startpoint.X - 3 , area.Y + toptick_startpoint.Y + inc,
+ area.X + toptick_startpoint.X, area.Y + toptick_startpoint.Y + inc);
+ else
+ dc.DrawLine (ResPool.GetPen (pen_ticks_color), area.X + toptick_startpoint.X - 2, area.Y + toptick_startpoint.Y + inc,
+ area.X + toptick_startpoint.X, area.Y + toptick_startpoint.Y + inc);
+ }
+ }
+ }
+
+ outside.Dispose ();
+
+ }
+
+ /*
+ Horizontal trackbar
+
+ Does not matter the size of the control, Win32 always draws:
+ - Ticks starting from pixel 13, 8
+ - Channel starting at pos 8, 19 and ends at Width - 8
+ - Autosize makes always the control 40 pixels height
+ - Ticks are draw at (channel.Witdh - 10) / (Maximum - Minimum)
+
+ */
+ private void DrawTrackBar_Horizontal (Graphics dc, Rectangle clip_rectangle, TrackBar tb,
+ ref Rectangle thumb_pos, ref Rectangle thumb_area, Brush br_thumb,
+ float ticks, int value_pos, bool mouse_value) {
+ Point toptick_startpoint = new Point ();
+ Point bottomtick_startpoint = new Point ();
+ Point channel_startpoint = new Point ();
+ float pixel_len;
+ float pixels_betweenticks;
+ const int space_from_right = 8;
+ const int space_from_left = 8;
+ Rectangle area = tb.ClientRectangle;
+
+ switch (tb.TickStyle) {
+ case TickStyle.BottomRight:
+ case TickStyle.None:
+ channel_startpoint.X = 8;
+ channel_startpoint.Y = 9;
+ bottomtick_startpoint.X = 13;
+ bottomtick_startpoint.Y = 24;
+ break;
+ case TickStyle.TopLeft:
+ channel_startpoint.X = 8;
+ channel_startpoint.Y = 19;
+ toptick_startpoint.X = 13;
+ toptick_startpoint.Y = 8;
+ break;
+ case TickStyle.Both:
+ channel_startpoint.X = 8;
+ channel_startpoint.Y = 18;
+ bottomtick_startpoint.X = 13;
+ bottomtick_startpoint.Y = 32;
+ toptick_startpoint.X = 13;
+ toptick_startpoint.Y = 8;
+ break;
+ default:
+ break;
+ }
+
+ thumb_area.X = area.X + channel_startpoint.X;
+ thumb_area.Y = area.Y + channel_startpoint.Y;
+ thumb_area.Width = area.Width - space_from_right - space_from_left;
+ thumb_area.Height = 4;
+
+ /* Draw channel */
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControlDark), channel_startpoint.X, channel_startpoint.Y,
+ thumb_area.Width, 1);
+
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControlDarkDark), channel_startpoint.X, channel_startpoint.Y + 1,
+ thumb_area.Width, 1);
+
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControlLight), channel_startpoint.X, channel_startpoint.Y +3,
+ thumb_area.Width, 1);
+
+ pixel_len = thumb_area.Width - 11;
+ pixels_betweenticks = pixel_len / (tb.Maximum - tb.Minimum);
+
+ /* Convert thumb position from mouse position to value*/
+ if (mouse_value) {
+ if (value_pos >= channel_startpoint.X)
+ value_pos = (int)(((float) (value_pos - channel_startpoint.X)) / pixels_betweenticks);
+ else
+ value_pos = 0;
+
+ if (value_pos + tb.Minimum > tb.Maximum)
+ value_pos = tb.Maximum - tb.Minimum;
+
+ tb.Value = value_pos + tb.Minimum;
+ }
+
+ thumb_pos.X = channel_startpoint.X + (int) (pixels_betweenticks * (float) value_pos);
+
+ /* Draw thumb fixed 10x22 size */
+ thumb_pos.Width = 10;
+ thumb_pos.Height = 22;
+
+ switch (tb.TickStyle) {
+ case TickStyle.BottomRight:
+ case TickStyle.None: {
+ thumb_pos.Y = channel_startpoint.Y - 8;
+
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), thumb_pos.X, thumb_pos.Y, thumb_pos.X + 10, thumb_pos.Y);
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), thumb_pos.X, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 16);
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), thumb_pos.X, thumb_pos.Y + 16, thumb_pos.X + 4, thumb_pos.Y + 16 + 4);
+
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), thumb_pos.X + 9, thumb_pos.Y + 1, thumb_pos.X +9, thumb_pos.Y +15);
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), thumb_pos.X + 9, thumb_pos.Y + 16, thumb_pos.X +9 - 4, thumb_pos.Y +16 + 4);
+
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), thumb_pos.X + 10, thumb_pos.Y, thumb_pos.X +10, thumb_pos.Y +16);
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), thumb_pos.X + 10, thumb_pos.Y + 16, thumb_pos.X +10 - 5, thumb_pos.Y +16 + 5);
+
+ dc.FillRectangle (br_thumb, thumb_pos.X + 1, thumb_pos.Y + 1, 8, 16);
+ dc.FillRectangle (br_thumb, thumb_pos.X + 2, thumb_pos.Y + 17, 6, 1);
+ dc.FillRectangle (br_thumb, thumb_pos.X + 3, thumb_pos.Y + 18, 4, 1);
+ dc.FillRectangle (br_thumb, thumb_pos.X + 4, thumb_pos.Y + 19, 2, 1);
+ break;
+ }
+ case TickStyle.TopLeft: {
+ thumb_pos.Y = channel_startpoint.Y - 10;
+
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), thumb_pos.X, thumb_pos.Y + 4, thumb_pos.X, thumb_pos.Y + 4 + 16);
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), thumb_pos.X, thumb_pos.Y + 4, thumb_pos.X + 4, thumb_pos.Y);
+
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), thumb_pos.X + 9, thumb_pos.Y + 4, thumb_pos.X + 9, thumb_pos.Y + 4 + 16);
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), thumb_pos.X + 9, thumb_pos.Y + 4, thumb_pos.X + 5, thumb_pos.Y);
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), thumb_pos.X + 9, thumb_pos.Y + 19, thumb_pos.X + 1 , thumb_pos.Y +19);
+
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), thumb_pos.X + 10, thumb_pos.Y + 4, thumb_pos.X + 10, thumb_pos.Y + 4 + 16);
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), thumb_pos.X + 10, thumb_pos.Y + 4, thumb_pos.X + 5, thumb_pos.Y -1);
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), thumb_pos.X, thumb_pos.Y + 20, thumb_pos.X + 10, thumb_pos.Y + 20);
+
+ dc.FillRectangle (br_thumb, thumb_pos.X + 1, thumb_pos.Y + 4, 8, 15);
+ dc.FillRectangle (br_thumb, thumb_pos.X + 2, thumb_pos.Y + 3, 6, 1);
+ dc.FillRectangle (br_thumb, thumb_pos.X + 3, thumb_pos.Y + 2, 4, 1);
+ dc.FillRectangle (br_thumb, thumb_pos.X + 4, thumb_pos.Y + 1, 2, 1);
+ break;
+ }
+
+ case TickStyle.Both: {
+ thumb_pos.Y = area.Y + 10;
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), thumb_pos.X, thumb_pos.Y, thumb_pos.X + 9, thumb_pos.Y);
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), thumb_pos.X, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 19);
+
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), thumb_pos.X + 9, thumb_pos.Y + 1, thumb_pos.X + 9, thumb_pos.Y + 19);
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), thumb_pos.X + 1, thumb_pos.Y + 10, thumb_pos.X + 8, thumb_pos.Y + 19);
+
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), thumb_pos.X + 10, thumb_pos.Y, thumb_pos.X +10, thumb_pos.Y + 20);
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), thumb_pos.X, thumb_pos.Y + 20, thumb_pos.X + 9, thumb_pos.Y + 20);
+
+ dc.FillRectangle (br_thumb, thumb_pos.X + 1, thumb_pos.Y + 1, 8, 18);
+
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ pixel_len = thumb_area.Width - 11;
+ pixels_betweenticks = pixel_len / ticks;
+
+ /* Draw ticks*/
+ thumb_area.Y = thumb_pos.Y;
+ thumb_area.X = channel_startpoint.X;
+ thumb_area.Height = thumb_pos.Height;
+ Region outside = new Region (area);
+ outside.Exclude (thumb_area);
+
+ if (outside.IsVisible (clip_rectangle)) {
+ if (pixels_betweenticks > 0 && ((tb.TickStyle & TickStyle.BottomRight) == TickStyle.BottomRight ||
+ ((tb.TickStyle & TickStyle.Both) == TickStyle.Both))) {
+
+ for (float inc = 0; inc < (pixel_len + 1); inc += pixels_betweenticks) {
+ if (inc == 0 || (inc + pixels_betweenticks) >= pixel_len +1)
+ dc.DrawLine (ResPool.GetPen (pen_ticks_color), area.X + bottomtick_startpoint.X + inc , area.Y + bottomtick_startpoint.Y,
+ area.X + bottomtick_startpoint.X + inc , area.Y + bottomtick_startpoint.Y + 3);
+ else
+ dc.DrawLine (ResPool.GetPen (pen_ticks_color), area.X + bottomtick_startpoint.X + inc, area.Y + bottomtick_startpoint.Y,
+ area.X + bottomtick_startpoint.X + inc, area.Y + bottomtick_startpoint.Y + 2);
+ }
+ }
+
+ if (pixels_betweenticks > 0 && ((tb.TickStyle & TickStyle.TopLeft) == TickStyle.TopLeft ||
+ ((tb.TickStyle & TickStyle.Both) == TickStyle.Both))) {
+
+ for (float inc = 0; inc < (pixel_len + 1); inc += pixels_betweenticks) {
+ if (inc == 0 || (inc + pixels_betweenticks) >= pixel_len +1)
+ dc.DrawLine (ResPool.GetPen (pen_ticks_color), area.X + toptick_startpoint.X + inc , area.Y + toptick_startpoint.Y - 3,
+ area.X + toptick_startpoint.X + inc , area.Y + toptick_startpoint.Y);
+ else
+ dc.DrawLine (ResPool.GetPen (pen_ticks_color), area.X + toptick_startpoint.X + inc, area.Y + toptick_startpoint.Y - 2,
+ area.X + toptick_startpoint.X + inc, area.Y + toptick_startpoint.Y );
+ }
+ }
+ }
+
+ outside.Dispose ();
+ }
+
+ public override void DrawTrackBar (Graphics dc, Rectangle clip_rectangle, TrackBar tb)
+ {
+ Brush br_thumb;
+ int value_pos;
+ bool mouse_value;
+ float ticks = (tb.Maximum - tb.Minimum) / tb.tickFrequency; /* N of ticks draw*/
+ Rectangle area;
+ Rectangle thumb_pos = tb.ThumbPos;
+ Rectangle thumb_area = tb.ThumbArea;
+
+ if (tb.thumb_pressed) {
+ value_pos = tb.thumb_mouseclick;
+ mouse_value = true;
+ } else {
+ value_pos = tb.Value - tb.Minimum;
+ mouse_value = false;
+ }
+
+ area = tb.ClientRectangle;
+
+ if (tb.thumb_pressed == true) {
+ br_thumb = (Brush) ResPool.GetHatchBrush (HatchStyle.Percent50, ColorControlLight, ColorControl);
+ } else {
+ br_thumb = ResPool.GetSolidBrush (ColorControl);
+ }
+
+
+ /* Control Background */
+ if (tb.BackColor == DefaultControlBackColor) {
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControl), clip_rectangle);
+ } else {
+ dc.FillRectangle (ResPool.GetSolidBrush (tb.BackColor), clip_rectangle);
+ }
+
+
+ if (tb.Focused) {
+ dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, ColorControl, Color.Black), area.X, area.Y, area.Width - 1, 1);
+ dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, ColorControl, Color.Black), area.X, area.Y + area.Height - 1, area.Width - 1, 1);
+ dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, ColorControl, Color.Black), area.X, area.Y, 1, area.Height - 1);
+ dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, ColorControl, Color.Black), area.X + area.Width - 1, area.Y, 1, area.Height - 1);
+ }
+
+ if (tb.Orientation == Orientation.Vertical) {
+ DrawTrackBar_Vertical (dc, clip_rectangle, tb, ref thumb_pos, ref thumb_area,
+ br_thumb, ticks, value_pos, mouse_value);
+
+ } else {
+ DrawTrackBar_Horizontal (dc, clip_rectangle, tb, ref thumb_pos, ref thumb_area,
+ br_thumb, ticks, value_pos, mouse_value);
+ }
+
+ tb.ThumbPos = thumb_pos;
+ tb.ThumbArea = thumb_area;
+ }
+
+ public override Size TrackBarDefaultSize {
+ get {
+ return new Size (104, 42);
+ }
+ }
+
+ #endregion // TrackBar
+
+ #region VScrollBar
+ public override Size VScrollBarDefaultSize {
+ get {
+ return new Size (this.ScrollBarButtonSize, 80);
+ }
+ }
+ #endregion // VScrollBar
+
+ #region TreeView
+ public override Size TreeViewDefaultSize {
+ get {
+ return new Size (121, 97);
+ }
+ }
+
+ #endregion
+
+ #region ControlPaint
+ private enum DrawFrameControlStates {
+ ButtonCheck = 0x0000,
+ ButtonRadioImage = 0x0001,
+ ButtonRadioMask = 0x0002,
+ ButtonRadio = 0x0004,
+ Button3State = 0x0008,
+ ButtonPush = 0x0010,
+
+ CaptionClose = 0x0000,
+ CaptionMin = 0x0001,
+ CaptionMax = 0x0002,
+ CaptionRestore = 0x0004,
+ CaptionHelp = 0x0008,
+
+ MenuArrow = 0x0000,
+ MenuCheck = 0x0001,
+ MenuBullet = 0x0002,
+ MenuArrowRight = 0x0004,
+
+ ScrollUp = 0x0000,
+ ScrollDown = 0x0001,
+ ScrollLeft = 0x0002,
+ ScrollRight = 0x0003,
+ ScrollComboBox = 0x0005,
+ ScrollSizeGrip = 0x0008,
+ ScrollSizeGripRight = 0x0010,
+
+ Inactive = 0x0100,
+ Pushed = 0x0200,
+ Checked = 0x0400,
+ Transparent = 0x0800,
+ Hot = 0x1000,
+ AdjustRect = 0x2000,
+ Flat = 0x4000,
+ Mono = 0x8000
+
+ }
+
+ private enum DrawFrameControlTypes {
+ Caption = 1,
+ Menu = 2,
+ Scroll = 3,
+ Button = 4
+ }
+
+ public override void CPDrawBorder (Graphics graphics, Rectangle bounds, Color leftColor, int leftWidth,
+ ButtonBorderStyle leftStyle, Color topColor, int topWidth, ButtonBorderStyle topStyle,
+ Color rightColor, int rightWidth, ButtonBorderStyle rightStyle, Color bottomColor,
+ int bottomWidth, ButtonBorderStyle bottomStyle) {
+ DrawBorderInternal(graphics, bounds.Left, bounds.Top, bounds.Left, bounds.Bottom-1, leftWidth, leftColor, leftStyle, Border3DSide.Left);
+ DrawBorderInternal(graphics, bounds.Left, bounds.Top, bounds.Right-1, bounds.Top, topWidth, topColor, topStyle, Border3DSide.Top);
+ DrawBorderInternal(graphics, bounds.Right-1, bounds.Top, bounds.Right-1, bounds.Bottom-1, rightWidth, rightColor, rightStyle, Border3DSide.Right);
+ DrawBorderInternal(graphics, bounds.Left, bounds.Bottom-1, bounds.Right-1, bounds.Bottom-1, bottomWidth, bottomColor, bottomStyle, Border3DSide.Bottom);
+ }
+
+ public override void CPDrawBorder3D (Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides) {
+ CPDrawBorder3D(graphics, rectangle, style, sides, ColorControl);
+ }
+
+ private void CPDrawBorder3D (Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides, Color control_color) {
+ Pen penTopLeft;
+ Pen penTopLeftInner;
+ Pen penBottomRight;
+ Pen penBottomRightInner;
+ Rectangle rect= new Rectangle(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
+ bool doInner = false;
+
+ if ((style & Border3DStyle.Adjust)!=0) {
+ rect.Y-=2;
+ rect.X-=2;
+ rect.Width+=4;
+ rect.Height+=4;
+ }
+
+ /* default to flat */
+ penTopLeft=ResPool.GetPen(ControlPaint.Dark(control_color));
+ penTopLeftInner=ResPool.GetPen(ControlPaint.Dark(control_color));
+ penBottomRight=ResPool.GetPen(ControlPaint.Dark(control_color));
+ penBottomRightInner=ResPool.GetPen(ControlPaint.Dark(control_color));
+
+ if ((style & Border3DStyle.RaisedOuter)!=0) {
+ penTopLeft=ResPool.GetPen(ControlPaint.LightLight(control_color));
+ penBottomRight=ResPool.GetPen(ControlPaint.DarkDark(control_color));
+ if ((style & (Border3DStyle.RaisedInner | Border3DStyle.SunkenInner))!=0) {
+ doInner=true;
+ }
+ } else if ((style & Border3DStyle.SunkenOuter)!=0) {
+ penTopLeft=ResPool.GetPen(ControlPaint.DarkDark(control_color));
+ penBottomRight=ResPool.GetPen(ControlPaint.LightLight(control_color));
+ if ((style & (Border3DStyle.RaisedInner | Border3DStyle.SunkenInner))!=0) {
+ doInner=true;
+ }
+ }
+
+ if ((style & Border3DStyle.RaisedInner)!=0) {
+ if (doInner) {
+ penTopLeftInner=ResPool.GetPen(control_color);
+ penBottomRightInner=ResPool.GetPen(ControlPaint.Dark(control_color));
+ } else {
+ penTopLeft=ResPool.GetPen(ControlPaint.LightLight(control_color));
+ penBottomRight=ResPool.GetPen(ControlPaint.DarkDark(control_color));
+ }
+ } else if ((style & Border3DStyle.SunkenInner)!=0) {
+ if (doInner) {
+ penTopLeftInner=ResPool.GetPen(ControlPaint.Dark(control_color));
+ penBottomRightInner=ResPool.GetPen(control_color);
+ } else {
+ penTopLeft=ResPool.GetPen(ControlPaint.DarkDark(control_color));
+ penBottomRight=ResPool.GetPen(ControlPaint.LightLight(control_color));
+ }
+ }
+
+ if ((sides & Border3DSide.Middle)!=0) {
+ graphics.FillRectangle(ResPool.GetSolidBrush(control_color), rect);
+ }
+
+ if ((sides & Border3DSide.Left)!=0) {
+ graphics.DrawLine(penTopLeft, rect.Left, rect.Bottom-2, rect.Left, rect.Top);
+ if (doInner) {
+ graphics.DrawLine(penTopLeftInner, rect.Left+1, rect.Bottom-2, rect.Left+1, rect.Top);
+ }
+ }
+
+ if ((sides & Border3DSide.Top)!=0) {
+ graphics.DrawLine(penTopLeft, rect.Left, rect.Top, rect.Right-2, rect.Top);
+
+ if (doInner) {
+ if ((sides & Border3DSide.Left)!=0) {
+ graphics.DrawLine(penTopLeftInner, rect.Left+1, rect.Top+1, rect.Right-3, rect.Top+1);
+ } else {
+ graphics.DrawLine(penTopLeftInner, rect.Left, rect.Top+1, rect.Right-3, rect.Top+1);
+ }
+ }
+ }
+
+ if ((sides & Border3DSide.Right)!=0) {
+ graphics.DrawLine(penBottomRight, rect.Right-1, rect.Top, rect.Right-1, rect.Bottom-1);
+
+ if (doInner) {
+ if ((sides & Border3DSide.Top)!=0) {
+ graphics.DrawLine(penBottomRightInner, rect.Right-2, rect.Top+1, rect.Right-2, rect.Bottom-2);
+ } else {
+ graphics.DrawLine(penBottomRightInner, rect.Right-2, rect.Top, rect.Right-2, rect.Bottom-2);
+ }
+ }
+ }
+
+ if ((sides & Border3DSide.Bottom)!=0) {
+ int left=rect.Left;
+
+ if ((sides & Border3DSide.Left)!=0) {
+ left+=1;
+ }
+
+ graphics.DrawLine(penBottomRight, rect.Left, rect.Bottom-1, rect.Right-1, rect.Bottom-1);
+
+ if (doInner) {
+ if ((sides & Border3DSide.Right)!=0) {
+ graphics.DrawLine(penBottomRightInner, left, rect.Bottom-2, rect.Right-2, rect.Bottom-2);
+ } else {
+ graphics.DrawLine(penBottomRightInner, left, rect.Bottom-2, rect.Right-2, rect.Bottom-2);
+ }
+ }
+ }
+
+ }
+
+
+ public override void CPDrawButton (Graphics graphics, Rectangle rectangle, ButtonState state) {
+ DrawFrameControlStates dfcs=DrawFrameControlStates.ButtonPush;
+
+ if ((state & ButtonState.Pushed)!=0) {
+ dfcs |= DrawFrameControlStates.Pushed;
+ }
+
+ if ((state & ButtonState.Checked)!=0) {
+ dfcs |= DrawFrameControlStates.Checked;
+ }
+
+ if ((state & ButtonState.Flat)!=0) {
+ dfcs |= DrawFrameControlStates.Flat;
+ }
+
+ if ((state & ButtonState.Inactive)!=0) {
+ dfcs |= DrawFrameControlStates.Inactive;
+ }
+ DrawFrameControl(graphics, rectangle, DrawFrameControlTypes.Button, dfcs);
+ }
+
+
+ public override void CPDrawCaptionButton (Graphics graphics, Rectangle rectangle, CaptionButton button, ButtonState state) {
+ Rectangle captionRect;
+ int lineWidth;
+
+ CPDrawButton(graphics, rectangle, state);
+
+ if (rectangle.Width<rectangle.Height) {
+ captionRect=new Rectangle(rectangle.X+1, rectangle.Y+rectangle.Height/2-rectangle.Width/2+1, rectangle.Width-4, rectangle.Width-4);
+ } else {
+ captionRect=new Rectangle(rectangle.X+rectangle.Width/2-rectangle.Height/2+1, rectangle.Y+1, rectangle.Height-4, rectangle.Height-4);
+ }
+
+ if ((state & ButtonState.Pushed)!=0) {
+ captionRect=new Rectangle(rectangle.X+2, rectangle.Y+2, rectangle.Width-3, rectangle.Height-3);
+ }
+
+ /* Make sure we've got at least a line width of 1 */
+ lineWidth=Math.Max(1, captionRect.Width/7);
+
+ switch(button) {
+ case CaptionButton.Close: {
+ Pen pen;
+
+ if ((state & ButtonState.Inactive)!=0) {
+ pen=new Pen(ColorControlLight, lineWidth);
+ DrawCaptionHelper(graphics, ColorControlLight, pen, lineWidth, 1, captionRect, button);
+ pen.Dispose();
+
+ pen=new Pen(ColorControlDark, lineWidth);
+ DrawCaptionHelper(graphics, ColorControlDark, pen, lineWidth, 0, captionRect, button);
+ pen.Dispose();
+ return;
+ } else {
+ pen=new Pen(ColorControlText, lineWidth);
+ DrawCaptionHelper(graphics, ColorControlText, pen, lineWidth, 0, captionRect, button);
+ pen.Dispose();
+ return;
+ }
+ }
+
+ case CaptionButton.Help:
+ case CaptionButton.Maximize:
+ case CaptionButton.Minimize:
+ case CaptionButton.Restore: {
+ if ((state & ButtonState.Inactive)!=0) {
+ DrawCaptionHelper(graphics, ColorControlLight, SystemPens.ControlLightLight, lineWidth, 1, captionRect, button);
+
+ DrawCaptionHelper(graphics, ColorControlDark, SystemPens.ControlDark, lineWidth, 0, captionRect, button);
+ return;
+ } else {
+ DrawCaptionHelper(graphics, ColorControlText, SystemPens.ControlText, lineWidth, 0, captionRect, button);
+ return;
+ }
+ }
+ }
+ }
+
+
+ public override void CPDrawCheckBox (Graphics graphics, Rectangle rectangle, ButtonState state) {
+ DrawFrameControlStates dfcs=DrawFrameControlStates.ButtonCheck;
+
+ if ((state & ButtonState.Pushed)!=0) {
+ dfcs |= DrawFrameControlStates.Pushed;
+ }
+
+ if ((state & ButtonState.Checked)!=0) {
+ dfcs |= DrawFrameControlStates.Checked;
+ }
+
+ if ((state & ButtonState.Flat)!=0) {
+ dfcs |= DrawFrameControlStates.Flat;
+ }
+
+ if ((state & ButtonState.Inactive)!=0) {
+ dfcs |= DrawFrameControlStates.Inactive;
+ }
+
+ DrawFrameControl(graphics, rectangle, DrawFrameControlTypes.Button, dfcs);
+
+ }
+
+ public override void CPDrawComboButton (Graphics graphics, Rectangle rectangle, ButtonState state) {
+ Point[] arrow = new Point[3];
+ Point P1;
+ Point P2;
+ Point P3;
+ int centerX;
+ int centerY;
+ int shiftX;
+ int shiftY;
+ Rectangle rect;
+
+ if ((state & ButtonState.Checked)!=0) {
+ graphics.FillRectangle(ResPool.GetHatchBrush (HatchStyle.Percent50, ColorControlLightLight, ColorControlLight),rectangle);
+ }
+
+ if ((state & ButtonState.Flat)!=0) {
+ ControlPaint.DrawBorder(graphics, rectangle, ColorControlDark, ButtonBorderStyle.Solid);
+ } else {
+ if ((state & (ButtonState.Pushed | ButtonState.Checked))!=0) {
+ // this needs to render like a pushed button - jba
+ // CPDrawBorder3D(graphics, rectangle, Border3DStyle.Sunken, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorControl);
+ Rectangle trace_rectangle = new Rectangle(rectangle.X, rectangle.Y, Math.Max (rectangle.Width-1, 0), Math.Max (rectangle.Height-1, 0));
+ graphics.DrawRectangle (ResPool.GetPen (ControlPaint.Dark (ColorControl)), trace_rectangle);
+ } else {
+ CPDrawBorder3D(graphics, rectangle, Border3DStyle.Raised, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorControl);
+ }
+ }
+
+ rect=new Rectangle(rectangle.X+rectangle.Width/4, rectangle.Y+rectangle.Height/4, rectangle.Width/2, rectangle.Height/2);
+ centerX=rect.Left+rect.Width/2;
+ centerY=rect.Top+rect.Height/2;
+ shiftX=Math.Max(1, rect.Width/8);
+ shiftY=Math.Max(1, rect.Height/8);
+
+ if ((state & ButtonState.Pushed)!=0) {
+ shiftX++;
+ shiftY++;
+ }
+
+ rect.Y-=shiftY;
+ centerY-=shiftY;
+ P1=new Point(rect.Left, centerY);
+ P2=new Point(rect.Right, centerY);
+ P3=new Point(centerX, rect.Bottom);
+
+ arrow[0]=P1;
+ arrow[1]=P2;
+ arrow[2]=P3;
+
+ /* Draw the arrow */
+ if ((state & ButtonState.Inactive)!=0) {
+ graphics.FillPolygon(SystemBrushes.ControlLightLight, arrow, FillMode.Winding);
+
+ /* Move away from the shadow */
+ P1.X-=1; P1.Y-=1;
+ P2.X-=1; P2.Y-=1;
+ P3.X-=1; P3.Y-=1;
+
+ arrow[0]=P1;
+ arrow[1]=P2;
+ arrow[2]=P3;
+
+
+ graphics.FillPolygon(SystemBrushes.ControlDark, arrow, FillMode.Winding);
+ } else {
+ graphics.FillPolygon(SystemBrushes.ControlText, arrow, FillMode.Winding);
+ }
+ }
+
+
+ public override void CPDrawContainerGrabHandle (Graphics graphics, Rectangle bounds) {
+
+ Pen pen = new Pen(Color.Black, 1);
+ Rectangle rect = new Rectangle(bounds.X, bounds.Y, bounds.Width-1, bounds.Height-1); // Dunno why, but MS does it that way, too
+ int X;
+ int Y;
+
+ graphics.FillRectangle(ResPool.GetSolidBrush (ColorControlText), rect);
+ graphics.DrawRectangle(pen, rect);
+
+ X=rect.X+rect.Width/2;
+ Y=rect.Y+rect.Height/2;
+
+ /* Draw the cross */
+ graphics.DrawLine(pen, X, rect.Y+2, X, rect.Bottom-2);
+ graphics.DrawLine(pen, rect.X+2, Y, rect.Right-2, Y);
+
+ /* Draw 'arrows' for vertical lines */
+ graphics.DrawLine(pen, X-1, rect.Y+3, X+1, rect.Y+3);
+ graphics.DrawLine(pen, X-1, rect.Bottom-3, X+1, rect.Bottom-3);
+
+ /* Draw 'arrows' for horizontal lines */
+ graphics.DrawLine(pen, rect.X+3, Y-1, rect.X+3, Y+1);
+ graphics.DrawLine(pen, rect.Right-3, Y-1, rect.Right-3, Y+1);
+ pen.Dispose ();
+
+ }
+
+ public virtual void DrawFlatStyleFocusRectangle (Graphics graphics, Rectangle rectangle, ButtonBase button, Color foreColor, Color backColor) {
+ // make a rectange to trace around border of the button
+ Rectangle trace_rectangle = new Rectangle(rectangle.X, rectangle.Y, Math.Max (rectangle.Width-1, 0), Math.Max (rectangle.Height-1, 0));
+
+ Color outerColor = foreColor;
+ // adjust focus color according to the flatstyle
+ if (button.FlatStyle == FlatStyle.Popup && !button.is_pressed) {
+ outerColor = (backColor == ColorControl) ? ControlPaint.Dark(ColorControl) : ColorControlText;
+ }
+
+ // draw the outer rectangle
+ graphics.DrawRectangle (ResPool.GetPen (outerColor), trace_rectangle);
+
+ // draw the inner rectangle
+ if (button.FlatStyle == FlatStyle.Popup) {
+ DrawInnerFocusRectangle (graphics, Rectangle.Inflate (rectangle, -4, -4), backColor);
+ } else {
+ // draw a flat inner rectangle
+ Pen pen = ResPool.GetPen (ControlPaint.LightLight (backColor));
+ graphics.DrawRectangle(pen, Rectangle.Inflate (trace_rectangle, -4, -4));
+ }
+ }
+
+ public virtual void DrawInnerFocusRectangle(Graphics graphics, Rectangle rectangle, Color backColor)
+ {
+ // make a rectange to trace around border of the button
+ Rectangle trace_rectangle = new Rectangle(rectangle.X, rectangle.Y, Math.Max (rectangle.Width-1, 0), Math.Max (rectangle.Height-1, 0));
+
+#if NotUntilCairoIsFixed
+ Color colorBackInverted = Color.FromArgb (Math.Abs (backColor.R-255), Math.Abs (backColor.G-255), Math.Abs (backColor.B-255));
+ DashStyle oldStyle; // used for caching old penstyle
+ Pen pen = ResPool.GetPen (colorBackInverted);
+
+ oldStyle = pen.DashStyle;
+ pen.DashStyle = DashStyle.Dot;
+
+ graphics.DrawRectangle (pen, trace_rectangle);
+ pen.DashStyle = oldStyle;
+#else
+ CPDrawFocusRectangle(graphics, trace_rectangle, Color.Wheat, backColor);
+#endif
+ }
+
+
+ public override void CPDrawFocusRectangle (Graphics graphics, Rectangle rectangle, Color foreColor, Color backColor)
+ {
+ Rectangle rect = rectangle;
+ Pen pen;
+ HatchBrush brush;
+
+ if (backColor.GetBrightness () >= 0.5) {
+ foreColor = Color.Transparent;
+ backColor = Color.Black;
+
+ } else {
+ backColor = Color.FromArgb (Math.Abs (backColor.R-255), Math.Abs (backColor.G-255), Math.Abs (backColor.B-255));
+ foreColor = Color.Black;
+ }
+
+ brush = ResPool.GetHatchBrush (HatchStyle.Percent50, backColor, foreColor);
+ pen = new Pen (brush, 1);
+
+ rect.Width--;
+ rect.Height--;
+
+ graphics.DrawRectangle (pen, rect);
+ pen.Dispose ();
+ }
+
+ public override void CPDrawGrabHandle (Graphics graphics, Rectangle rectangle, bool primary, bool enabled) {
+ SolidBrush sb;
+ Pen pen;
+
+ if (primary==true) {
+ pen=new Pen(Color.Black, 1);
+ if (enabled==true) {
+ sb=ResPool.GetSolidBrush (ColorControlText);
+ } else {
+ sb=ResPool.GetSolidBrush (ColorControl);
+ }
+ } else {
+ pen=new Pen(Color.White, 1);
+ if (enabled==true) {
+ sb=ThemeEngine.Current.ResPool.GetSolidBrush (Color.Black);
+ } else {
+ sb=ResPool.GetSolidBrush (ColorControl);
+ }
+ }
+ graphics.FillRectangle(sb, rectangle);
+ graphics.DrawRectangle(pen, rectangle);
+ pen.Dispose();
+ }
+
+
+ public override void CPDrawGrid (Graphics graphics, Rectangle area, Size pixelsBetweenDots, Color backColor) {
+ Color foreColor;
+ int h;
+ int b;
+ int s;
+
+ ControlPaint.Color2HBS(backColor, out h, out b, out s);
+
+ if (b>127) {
+ foreColor=Color.Black;
+ } else {
+ foreColor=Color.White;
+ }
+
+#if false
+ /* Commented out until I take the time and figure out
+ which HatchStyle will match requirements. The code below
+ is only correct for Percent50.
+ */
+ if (pixelsBetweenDots.Width==pixelsBetweenDots.Height) {
+ HatchBrush brush=null;
+
+ switch(pixelsBetweenDots.Width) {
+ case 2: brush=new HatchBrush(HatchStyle.Percent50, foreColor, backColor); break;
+ case 4: brush=new HatchBrush(HatchStyle.Percent25, foreColor, backColor); break;
+ case 5: brush=new HatchBrush(HatchStyle.Percent20, foreColor, backColor); break;
+ default: {
+ /* Have to do it the slow way */
+ break;
+ }
+ }
+ if (brush!=null) {
+ graphics.FillRectangle(brush, area);
+ pen.Dispose();
+ brush.Dispose();
+ return;
+ }
+ }
+#endif
+ /* Slow method */
+
+ Bitmap bitmap = new Bitmap(area.Width, area.Height, graphics);
+
+ for (int x=0; x<area.Width; x+=pixelsBetweenDots.Width) {
+ for (int y=0; y<area.Height; y+=pixelsBetweenDots.Height) {
+ bitmap.SetPixel(x, y, foreColor);
+ }
+ }
+ graphics.DrawImage(bitmap, area.X, area.Y, area.Width, area.Height);
+ bitmap.Dispose();
+ }
+
+ public override void CPDrawImageDisabled (Graphics graphics, Image image, int x, int y, Color background) {
+ /*
+ Microsoft seems to ignore the background and simply make
+ the image grayscale. At least when having > 256 colors on
+ the display.
+ */
+
+ if (imagedisabled_attributes == null) {
+ imagedisabled_attributes = new ImageAttributes ();
+ ColorMatrix colorMatrix=new ColorMatrix(new float[][] {
+ // This table would create a perfect grayscale image, based on luminance
+ // new float[]{0.3f,0.3f,0.3f,0,0},
+ // new float[]{0.59f,0.59f,0.59f,0,0},
+ // new float[]{0.11f,0.11f,0.11f,0,0},
+ // new float[]{0,0,0,1,0,0},
+ // new float[]{0,0,0,0,1,0},
+ // new float[]{0,0,0,0,0,1}
+
+ // This table generates a image that is grayscaled and then
+ // brightened up. Seems to match MS close enough.
+ new float[]{0.2f,0.2f,0.2f,0,0},
+ new float[]{0.41f,0.41f,0.41f,0,0},
+ new float[]{0.11f,0.11f,0.11f,0,0},
+ new float[]{0.15f,0.15f,0.15f,1,0,0},
+ new float[]{0.15f,0.15f,0.15f,0,1,0},
+ new float[]{0.15f,0.15f,0.15f,0,0,1}
+ });
+
+ imagedisabled_attributes.SetColorMatrix (colorMatrix);
+ }
+
+ graphics.DrawImage(image, new Rectangle(x, y, image.Width, image.Height), 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, imagedisabled_attributes);
+
+ }
+
+
+ public override void CPDrawLockedFrame (Graphics graphics, Rectangle rectangle, bool primary) {
+ Pen penBorder;
+ Pen penInside;
+
+ if (primary) {
+ penBorder=new Pen(Color.White, 2);
+ penInside=new Pen(Color.Black, 1);
+ } else {
+ penBorder=new Pen(Color.Black, 2);
+ penInside=new Pen(Color.White, 1);
+ }
+ penBorder.Alignment=PenAlignment.Inset;
+ penInside.Alignment=PenAlignment.Inset;
+
+ graphics.DrawRectangle(penBorder, rectangle);
+ graphics.DrawRectangle(penInside, rectangle.X+2, rectangle.Y+2, rectangle.Width-5, rectangle.Height-5);
+ penBorder.Dispose();
+ penInside.Dispose();
+ }
+
+
+ public override void CPDrawMenuGlyph (Graphics graphics, Rectangle rectangle, MenuGlyph glyph) {
+ Rectangle rect;
+ int lineWidth;
+
+ // MS draws always the background white
+ graphics.FillRectangle(ResPool.GetSolidBrush (Color.White), rectangle);
+
+ switch(glyph) {
+ case MenuGlyph.Arrow: {
+ Point[] arrow = new Point[3];
+ Point P1;
+ Point P2;
+ Point P3;
+ int centerX;
+ int centerY;
+ int shiftX;
+
+ rect=new Rectangle(rectangle.X+rectangle.Width/4, rectangle.Y+rectangle.Height/4, rectangle.Width/2, rectangle.Height/2);
+ centerX=rect.Left+rect.Width/2;
+ centerY=rect.Top+rect.Height/2;
+ shiftX=Math.Max(1, rect.Width/8);
+
+ rect.X-=shiftX;
+ centerX-=shiftX;
+
+ P1=new Point(centerX, rect.Top-1);
+ P2=new Point(centerX, rect.Bottom);
+ P3=new Point(rect.Right, centerY);
+
+ arrow[0]=P1;
+ arrow[1]=P2;
+ arrow[2]=P3;
+
+ graphics.FillPolygon(SystemBrushes.ControlText, arrow, FillMode.Winding);
+
+ return;
+ }
+
+ case MenuGlyph.Bullet: {
+
+ lineWidth=Math.Max(2, rectangle.Width/3);
+ rect=new Rectangle(rectangle.X+lineWidth, rectangle.Y+lineWidth, rectangle.Width-lineWidth*2, rectangle.Height-lineWidth*2);
+
+ graphics.FillEllipse(ResPool.GetSolidBrush (ColorControlText), rect);
+
+ return;
+ }
+
+ case MenuGlyph.Checkmark: {
+ int Scale;
+
+ lineWidth=Math.Max(2, rectangle.Width/6);
+ Scale=Math.Max(1, rectangle.Width/12);
+
+ rect=new Rectangle(rectangle.X+lineWidth, rectangle.Y+lineWidth, rectangle.Width-lineWidth*2, rectangle.Height-lineWidth*2);
+
+ for (int i=0; i<lineWidth; i++) {
+ graphics.DrawLine(SystemPens.MenuText, rect.Left+lineWidth/2, rect.Top+lineWidth+i, rect.Left+lineWidth/2+2*Scale, rect.Top+lineWidth+2*Scale+i);
+ graphics.DrawLine(SystemPens.MenuText, rect.Left+lineWidth/2+2*Scale, rect.Top+lineWidth+2*Scale+i, rect.Left+lineWidth/2+6*Scale, rect.Top+lineWidth-2*Scale+i);
+ }
+ return;
+ }
+ }
+
+ }
+
+ public override void CPDrawRadioButton (Graphics graphics, Rectangle rectangle, ButtonState state) {
+ DrawFrameControlStates dfcs=DrawFrameControlStates.ButtonRadio;
+
+ if ((state & ButtonState.Pushed)!=0) {
+ dfcs |= DrawFrameControlStates.Pushed;
+ }
+
+ if ((state & ButtonState.Checked)!=0) {
+ dfcs |= DrawFrameControlStates.Checked;
+ }
+
+ if ((state & ButtonState.Flat)!=0) {
+ dfcs |= DrawFrameControlStates.Flat;
+ }
+
+ if ((state & ButtonState.Inactive)!=0) {
+ dfcs |= DrawFrameControlStates.Inactive;
+ }
+ DrawFrameControl(graphics, rectangle, DrawFrameControlTypes.Button, dfcs);
+
+ }
+
+
+ public override void CPDrawReversibleFrame (Rectangle rectangle, Color backColor, FrameStyle style) {
+
+ }
+
+
+ public override void CPDrawReversibleLine (Point start, Point end, Color backColor) {
+
+ }
+
+
+ /* Scroll button: regular button + direction arrow */
+ public override void CPDrawScrollButton (Graphics dc, Rectangle area, ScrollButton type, ButtonState state) {
+ bool enabled = (state == ButtonState.Inactive) ? false: true;
+
+ DrawScrollButtonPrimitive (dc, area, state);
+
+ // A lot of the following is adapted from the rewind project
+ Rectangle rect = new Rectangle (area.X - 3, area.Y - 3,
+ area.Width + 6, area.Height + 6);
+ int small_diam = rect.Width > rect.Height ? rect.Height : rect.Width;
+ if (rect.Width < rect.Height) {
+ rect.Y += (rect.Height - rect.Width) / 2;
+ rect.Height = small_diam;
+ } else if (rect.Width > rect.Height) {
+ rect.X += (rect.Width - rect.Height) / 2;
+ rect.Width = small_diam;
+ }
+
+ small_diam -= 2;
+
+ int tri = 290 * small_diam / 1000 - 1;
+ if (tri == 0)
+ tri = 1;
+
+ Point [] arrow = new Point [3];
+ for (int i = 0; i < 3; i++)
+ arrow [i] = new Point ();
+
+ switch(type) {
+ default:
+ case ScrollButton.Down:
+ arrow [2].X = rect.Left + 470 * small_diam / 1000 + 2;
+ arrow [2].Y = rect.Top + 687 * small_diam / 1000 + 1;
+ arrow [0].X = arrow [2].X - tri;
+ arrow [1].X = arrow [2].X + tri;
+ arrow [0].Y = arrow [1].Y = arrow [2].Y - tri;
+ break;
+
+ case ScrollButton.Up:
+ arrow [2].X = rect.Left + 470 * small_diam / 1000 + 2;
+ arrow [2].Y = rect.Bottom - (687 * small_diam / 1000 + 1);
+ arrow [0].X = arrow [2].X - tri;
+ arrow [1].X = arrow [2].X + tri;
+ arrow [0].Y = arrow [1].Y = arrow [2].Y + tri;
+ break;
+
+ case ScrollButton.Left:
+ arrow [2].X = rect.Right - (687 * small_diam / 1000 + 1);
+ arrow [2].Y = rect.Top + 470 * small_diam / 1000 + 2;
+ arrow [0].Y = arrow [2].Y - tri;
+ arrow [1].Y = arrow [2].Y + tri;
+ arrow [0].X = arrow [1].X = arrow [2].X + tri;
+ break;
+ case ScrollButton.Right:
+ arrow [2].X = rect.Left + 687 * small_diam / 1000 + 1;
+ arrow [2].Y = rect.Top + 470 * small_diam / 1000 + 2;
+ arrow [0].Y = arrow [2].Y - tri;
+ arrow [1].Y = arrow [2].Y + tri;
+ arrow [0].X = arrow [1].X = arrow [2].X - tri;
+ break;
+ }
+
+ /* Draw the arrow */
+ if ((state & ButtonState.Inactive)!=0) {
+ dc.FillPolygon (SystemBrushes.ControlLightLight, arrow, FillMode.Winding);
+
+ for (int i = 0; i < 3; i++) {
+ arrow [i].X--;
+ arrow [i].Y--;
+ }
+
+ dc.FillPolygon (SystemBrushes.ControlDark, arrow, FillMode.Winding);
+ } else {
+ dc.FillPolygon (SystemBrushes.ControlText, arrow, FillMode.Winding);
+ }
+ }
+
+ public override void CPDrawSelectionFrame (Graphics graphics, bool active, Rectangle outsideRect, Rectangle insideRect,
+ Color backColor) {
+
+ }
+
+
+ public override void CPDrawSizeGrip (Graphics dc, Color backColor, Rectangle bounds) {
+ Point pt = new Point (bounds.Right - 2, bounds.Bottom - 1);
+
+ dc.DrawLine (ResPool.GetPen (ColorControl), pt.X - 12, pt.Y, pt.X, pt.Y);
+ dc.DrawLine (ResPool.GetPen (ColorControl), pt.X, pt.Y, pt.X, pt.Y - 13);
+
+ // diagonals
+ for (int i = 0; i < 11; i += 4) {
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), pt.X - i, pt.Y, pt.X + 1, pt.Y - i - 2);
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), pt.X - i - 1, pt.Y, pt.X + 1, pt.Y - i - 2);
+ }
+
+ for (int i = 3; i < 13; i += 4)
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), pt.X - i, pt.Y, pt.X + 1, pt.Y - i - 1);
+ }
+
+
+ public override void CPDrawStringDisabled (Graphics graphics, string s, Font font, Color color, RectangleF layoutRectangle,
+ StringFormat format) {
+
+ graphics.DrawString(s, font, ResPool.GetSolidBrush (ThemeEngine.Current.ColorGrayText), layoutRectangle, format);
+
+ }
+
+ private static void DrawBorderInternal(Graphics graphics, int startX, int startY, int endX, int endY,
+ int width, Color color, ButtonBorderStyle style, Border3DSide side) {
+
+ Pen pen=new Pen(color, 1);
+
+ switch(style) {
+ case ButtonBorderStyle.Solid: {
+ pen.DashStyle=DashStyle.Solid;
+ break;
+ }
+
+ case ButtonBorderStyle.Dashed: {
+ pen.DashStyle=DashStyle.Dash;
+ break;
+ }
+
+ case ButtonBorderStyle.Dotted: {
+ pen.DashStyle=DashStyle.Dot;
+ break;
+ }
+
+ case ButtonBorderStyle.Inset: {
+ pen.DashStyle=DashStyle.Solid;
+ break;
+ }
+
+ case ButtonBorderStyle.Outset: {
+ pen.DashStyle=DashStyle.Solid;
+ break;
+ }
+
+ default:
+ case ButtonBorderStyle.None: {
+ pen.Dispose();
+ return;
+ }
+ }
+
+
+ switch(style) {
+ case ButtonBorderStyle.Outset: {
+ Color colorGrade;
+ int hue, brightness, saturation;
+ int brightnessSteps;
+ int brightnessDownSteps;
+
+ ControlPaint.Color2HBS(color, out hue, out brightness, out saturation);
+
+ brightnessDownSteps=brightness/width;
+ if (brightness>127) {
+ brightnessSteps=Math.Max(6, (160-brightness)/width);
+ } else {
+ brightnessSteps=(127-brightness)/width;
+ }
+
+ for (int i=0; i<width; i++) {
+ switch(side) {
+ case Border3DSide.Left: {
+ pen.Dispose();
+ colorGrade=ControlPaint.HBS2Color(hue, Math.Min(255, brightness+brightnessSteps*(width-i)), saturation);
+ pen=new Pen(colorGrade, 1);
+ graphics.DrawLine(pen, startX+i, startY+i, endX+i, endY-i);
+ break;
+ }
+
+ case Border3DSide.Right: {
+ pen.Dispose();
+ colorGrade=ControlPaint.HBS2Color(hue, Math.Max(0, brightness-brightnessDownSteps*(width-i)), saturation);
+ pen=new Pen(colorGrade, 1);
+ graphics.DrawLine(pen, startX-i, startY+i, endX-i, endY-i);
+ break;
+ }
+
+ case Border3DSide.Top: {
+ pen.Dispose();
+ colorGrade=ControlPaint.HBS2Color(hue, Math.Min(255, brightness+brightnessSteps*(width-i)), saturation);
+ pen=new Pen(colorGrade, 1);
+ graphics.DrawLine(pen, startX+i, startY+i, endX-i, endY+i);
+ break;
+ }
+
+ case Border3DSide.Bottom: {
+ pen.Dispose();
+ colorGrade=ControlPaint.HBS2Color(hue, Math.Max(0, brightness-brightnessDownSteps*(width-i)), saturation);
+ pen=new Pen(colorGrade, 1);
+ graphics.DrawLine(pen, startX+i, startY-i, endX-i, endY-i);
+ break;
+ }
+ }
+ }
+ break;
+ }
+
+ case ButtonBorderStyle.Inset: {
+ Color colorGrade;
+ int hue, brightness, saturation;
+ int brightnessSteps;
+ int brightnessDownSteps;
+
+ ControlPaint.Color2HBS(color, out hue, out brightness, out saturation);
+
+ brightnessDownSteps=brightness/width;
+ if (brightness>127) {
+ brightnessSteps=Math.Max(6, (160-brightness)/width);
+ } else {
+ brightnessSteps=(127-brightness)/width;
+ }
+
+ for (int i=0; i<width; i++) {
+ switch(side) {
+ case Border3DSide.Left: {
+ pen.Dispose();
+ colorGrade=ControlPaint.HBS2Color(hue, Math.Max(0, brightness-brightnessDownSteps*(width-i)), saturation);
+ pen=new Pen(colorGrade, 1);
+ graphics.DrawLine(pen, startX+i, startY+i, endX+i, endY-i);
+ break;
+ }
+
+ case Border3DSide.Right: {
+ pen.Dispose();
+ colorGrade=ControlPaint.HBS2Color(hue, Math.Min(255, brightness+brightnessSteps*(width-i)), saturation);
+ pen=new Pen(colorGrade, 1);
+ graphics.DrawLine(pen, startX-i, startY+i, endX-i, endY-i);
+ break;
+ }
+
+ case Border3DSide.Top: {
+ pen.Dispose();
+ colorGrade=ControlPaint.HBS2Color(hue, Math.Max(0, brightness-brightnessDownSteps*(width-i)), saturation);
+ pen=new Pen(colorGrade, 1);
+ graphics.DrawLine(pen, startX+i, startY+i, endX-i, endY+i);
+ break;
+ }
+
+ case Border3DSide.Bottom: {
+ pen.Dispose();
+ colorGrade=ControlPaint.HBS2Color(hue, Math.Min(255, brightness+brightnessSteps*(width-i)), saturation);
+ pen=new Pen(colorGrade, 1);
+ graphics.DrawLine(pen, startX+i, startY-i, endX-i, endY-i);
+ break;
+ }
+ }
+ }
+ break;
+ }
+
+ /*
+ I decided to have the for-loop duplicated for speed reasons;
+ that way we only have to switch once (as opposed to have the
+ for-loop around the switch)
+ */
+ default: {
+ switch(side) {
+ case Border3DSide.Left: {
+ for (int i=0; i<width; i++) {
+ graphics.DrawLine(pen, startX+i, startY+i, endX+i, endY-i);
+ }
+ break;
+ }
+
+ case Border3DSide.Right: {
+ for (int i=0; i<width; i++) {
+ graphics.DrawLine(pen, startX-i, startY+i, endX-i, endY-i);
+ }
+ break;
+ }
+
+ case Border3DSide.Top: {
+ for (int i=0; i<width; i++) {
+ graphics.DrawLine(pen, startX+i, startY+i, endX-i, endY+i);
+ }
+ break;
+ }
+
+ case Border3DSide.Bottom: {
+ for (int i=0; i<width; i++) {
+ graphics.DrawLine(pen, startX+i, startY-i, endX-i, endY-i);
+ }
+ break;
+ }
+ }
+ break;
+ }
+ }
+ pen.Dispose();
+ }
+
+ /*
+ This function actually draws the various caption elements.
+ This way we can scale them nicely, no matter what size, and they
+ still look like MS's scaled caption buttons. (as opposed to scaling a bitmap)
+ */
+
+ private static void DrawCaptionHelper(Graphics graphics, Color color, Pen pen, int lineWidth, int shift, Rectangle captionRect, CaptionButton button) {
+ switch(button) {
+ case CaptionButton.Close: {
+ pen.StartCap=LineCap.Triangle;
+ pen.EndCap=LineCap.Triangle;
+ if (lineWidth<2) {
+ graphics.DrawLine(pen, captionRect.Left+2*lineWidth+1+shift, captionRect.Top+2*lineWidth+shift, captionRect.Right-2*lineWidth+1+shift, captionRect.Bottom-2*lineWidth+shift);
+ graphics.DrawLine(pen, captionRect.Right-2*lineWidth+1+shift, captionRect.Top+2*lineWidth+shift, captionRect.Left+2*lineWidth+1+shift, captionRect.Bottom-2*lineWidth+shift);
+ }
+
+ graphics.DrawLine(pen, captionRect.Left+2*lineWidth+shift, captionRect.Top+2*lineWidth+shift, captionRect.Right-2*lineWidth+shift, captionRect.Bottom-2*lineWidth+shift);
+ graphics.DrawLine(pen, captionRect.Right-2*lineWidth+shift, captionRect.Top+2*lineWidth+shift, captionRect.Left+2*lineWidth+shift, captionRect.Bottom-2*lineWidth+shift);
+ return;
+ }
+
+ case CaptionButton.Help: {
+ StringFormat sf = new StringFormat();
+ Font font = new Font("Microsoft Sans Serif", captionRect.Height, FontStyle.Bold, GraphicsUnit.Pixel);
+
+ sf.Alignment=StringAlignment.Center;
+ sf.LineAlignment=StringAlignment.Center;
+
+
+ graphics.DrawString("?", font, ThemeEngine.Current.ResPool.GetSolidBrush (color), captionRect.X+captionRect.Width/2+shift, captionRect.Y+captionRect.Height/2+shift+lineWidth/2, sf);
+
+ sf.Dispose();
+ font.Dispose();
+
+ return;
+ }
+
+ case CaptionButton.Maximize: {
+ /* Top 'caption bar' line */
+ for (int i=0; i<Math.Max(2, lineWidth); i++) {
+ graphics.DrawLine(pen, captionRect.Left+lineWidth+shift, captionRect.Top+2*lineWidth+shift+i, captionRect.Right-lineWidth-lineWidth/2+shift, captionRect.Top+2*lineWidth+shift+i);
+ }
+
+ /* Left side line */
+ for (int i=0; i<Math.Max(1, lineWidth/2); i++) {
+ graphics.DrawLine(pen, captionRect.Left+lineWidth+shift+i, captionRect.Top+2*lineWidth+shift, captionRect.Left+lineWidth+shift+i, captionRect.Bottom-lineWidth+shift);
+ }
+
+ /* Right side line */
+ for (int i=0; i<Math.Max(1, lineWidth/2); i++) {
+ graphics.DrawLine(pen, captionRect.Right-lineWidth-lineWidth/2+shift+i, captionRect.Top+2*lineWidth+shift, captionRect.Right-lineWidth-lineWidth/2+shift+i, captionRect.Bottom-lineWidth+shift);
+ }
+
+ /* Bottom line */
+ for (int i=0; i<Math.Max(1, lineWidth/2); i++) {
+ graphics.DrawLine(pen, captionRect.Left+lineWidth+shift, captionRect.Bottom-lineWidth+shift-i, captionRect.Right-lineWidth-lineWidth/2+shift, captionRect.Bottom-lineWidth+shift-i);
+ }
+ return;
+ }
+
+ case CaptionButton.Minimize: {
+ /* Bottom line */
+ for (int i=0; i<Math.Max(2, lineWidth); i++) {
+ graphics.DrawLine(pen, captionRect.Left+lineWidth+shift, captionRect.Bottom-lineWidth+shift-i, captionRect.Right-3*lineWidth+shift, captionRect.Bottom-lineWidth+shift-i);
+ }
+ return;
+ }
+
+ case CaptionButton.Restore: {
+ /** First 'window' **/
+ /* Top 'caption bar' line */
+ for (int i=0; i<Math.Max(2, lineWidth); i++) {
+ graphics.DrawLine(pen, captionRect.Left+3*lineWidth+shift, captionRect.Top+2*lineWidth+shift-i, captionRect.Right-lineWidth-lineWidth/2+shift, captionRect.Top+2*lineWidth+shift-i);
+ }
+
+ /* Left side line */
+ for (int i=0; i<Math.Max(1, lineWidth/2); i++) {
+ graphics.DrawLine(pen, captionRect.Left+3*lineWidth+shift+i, captionRect.Top+2*lineWidth+shift, captionRect.Left+3*lineWidth+shift+i, captionRect.Top+4*lineWidth+shift);
+ }
+
+ /* Right side line */
+ for (int i=0; i<Math.Max(1, lineWidth/2); i++) {
+ graphics.DrawLine(pen, captionRect.Right-lineWidth-lineWidth/2+shift-i, captionRect.Top+2*lineWidth+shift, captionRect.Right-lineWidth-lineWidth/2+shift-i, captionRect.Top+5*lineWidth-lineWidth/2+shift);
+ }
+
+ /* Bottom line */
+ for (int i=0; i<Math.Max(1, lineWidth/2); i++) {
+ graphics.DrawLine(pen, captionRect.Right-3*lineWidth-lineWidth/2+shift, captionRect.Top+5*lineWidth-lineWidth/2+shift+1+i, captionRect.Right-lineWidth-lineWidth/2+shift, captionRect.Top+5*lineWidth-lineWidth/2+shift+1+i);
+ }
+
+ /** Second 'window' **/
+ /* Top 'caption bar' line */
+ for (int i=0; i<Math.Max(2, lineWidth); i++) {
+ graphics.DrawLine(pen, captionRect.Left+lineWidth+shift, captionRect.Top+4*lineWidth+shift+1-i, captionRect.Right-3*lineWidth-lineWidth/2+shift, captionRect.Top+4*lineWidth+shift+1-i);
+ }
+
+ /* Left side line */
+ for (int i=0; i<Math.Max(1, lineWidth/2); i++) {
+ graphics.DrawLine(pen, captionRect.Left+lineWidth+shift+i, captionRect.Top+4*lineWidth+shift+1, captionRect.Left+lineWidth+shift+i, captionRect.Bottom-lineWidth+shift);
+ }
+
+ /* Right side line */
+ for (int i=0; i<Math.Max(1, lineWidth/2); i++) {
+ graphics.DrawLine(pen, captionRect.Right-3*lineWidth-lineWidth/2+shift-i, captionRect.Top+4*lineWidth+shift+1, captionRect.Right-3*lineWidth-lineWidth/2+shift-i, captionRect.Bottom-lineWidth+shift);
+ }
+
+ /* Bottom line */
+ for (int i=0; i<Math.Max(1, lineWidth/2); i++) {
+ graphics.DrawLine(pen, captionRect.Left+lineWidth+shift, captionRect.Bottom-lineWidth+shift-i, captionRect.Right-3*lineWidth-lineWidth/2+shift, captionRect.Bottom-lineWidth+shift-i);
+ }
+
+ return;
+ }
+
+ }
+ }
+
+ [MonoTODO("Finish drawing code for Caption, Menu and Scroll")]
+ private void DrawFrameControl(Graphics graphics, Rectangle rectangle, DrawFrameControlTypes Type, DrawFrameControlStates State) {
+ // make a rectange to trace around border of the button
+ Rectangle trace_rectangle = new Rectangle(rectangle.X, rectangle.Y, Math.Max (rectangle.Width-1, 0), Math.Max (rectangle.Height-1, 0));
+ switch(Type) {
+ case DrawFrameControlTypes.Button: {
+
+ if ((State & DrawFrameControlStates.ButtonPush)!=0) {
+// JBA 31 oct 2004 - I don't think that button style should be rendered like this
+// /* Goes first, affects the background */
+// if ((State & DrawFrameControlStates.Checked)!=0) {
+// HatchBrush hatchBrush=new HatchBrush(HatchStyle.Percent50, ColorControlLightLight, ColorControlLight);
+// graphics.FillRectangle(hatchBrush,rectangle);
+// hatchBrush.Dispose();
+// }
+
+ if ((State & DrawFrameControlStates.Pushed)!=0 || (State & DrawFrameControlStates.Checked)!=0) {
+ graphics.DrawRectangle (ResPool.GetPen (ControlPaint.Dark (ColorControl)), trace_rectangle);
+ } else if ((State & DrawFrameControlStates.Flat)!=0) {
+ ControlPaint.DrawBorder(graphics, rectangle, ColorControlDark, ButtonBorderStyle.Solid);
+ } else if ((State & DrawFrameControlStates.Inactive)!=0) {
+ /* Same as normal, it would seem */
+ CPDrawBorder3D(graphics, rectangle, Border3DStyle.Raised, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorControl);
+ } else {
+ CPDrawBorder3D(graphics, rectangle, Border3DStyle.Raised, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorControl);
+ }
+ } else if ((State & DrawFrameControlStates.ButtonRadio)!=0) {
+ Pen penFatDark = new Pen(ColorControlDark, 1);
+ Pen penFatLight = new Pen(ColorControlLightLight, 1);
+ int lineWidth;
+
+ graphics.FillPie (ResPool.GetSolidBrush (this.ColorWindow), rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 0, 359);
+
+ graphics.DrawArc(penFatDark, rectangle.X+1, rectangle.Y+1, rectangle.Width-2, rectangle.Height-2, 135, 180);
+ graphics.DrawArc(penFatLight, rectangle.X+1, rectangle.Y+1, rectangle.Width-2, rectangle.Height-2, 315, 180);
+
+ graphics.DrawArc(SystemPens.ControlDark, rectangle, 135, 180);
+ graphics.DrawArc(SystemPens.ControlLightLight, rectangle, 315, 180);
+
+ lineWidth=Math.Max(1, Math.Min(rectangle.Width, rectangle.Height)/3);
+
+ if ((State & DrawFrameControlStates.Checked)!=0) {
+ SolidBrush buttonBrush;
+
+ if ((State & DrawFrameControlStates.Inactive)!=0) {
+ buttonBrush=(SolidBrush)SystemBrushes.ControlDark;
+ } else {
+ buttonBrush=(SolidBrush)SystemBrushes.ControlText;
+ }
+ graphics.FillPie(buttonBrush, rectangle.X+lineWidth, rectangle.Y+lineWidth, rectangle.Width-lineWidth*2, rectangle.Height-lineWidth*2, 0, 359);
+ }
+ penFatDark.Dispose();
+ penFatLight.Dispose();
+ } else if ((State & DrawFrameControlStates.ButtonRadioImage)!=0) {
+ throw new NotImplementedException () ;
+ } else if ((State & DrawFrameControlStates.ButtonRadioMask)!=0) {
+ throw new NotImplementedException ();
+ } else { /* Must be Checkbox */
+ Pen pen;
+ int lineWidth;
+ Rectangle rect;
+ int Scale;
+
+ /* Goes first, affects the background */
+ if ((State & DrawFrameControlStates.Pushed)!=0 ||
+ (State & DrawFrameControlStates.Inactive)!=0) {
+ graphics.FillRectangle(SystemBrushes.Control, rectangle);
+ } else {
+ graphics.FillRectangle(SystemBrushes.Window, rectangle);
+ }
+
+ /* Draw the sunken frame */
+ if ((State & DrawFrameControlStates.Flat)!=0) {
+ ControlPaint.DrawBorder(graphics, rectangle, ColorControlDark, ButtonBorderStyle.Solid);
+ } else {
+ CPDrawBorder3D(graphics, rectangle, Border3DStyle.Sunken, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorControl);
+ }
+
+ /* Make sure we've got at least a line width of 1 */
+ lineWidth=Math.Max(3, rectangle.Width/6);
+ Scale=Math.Max(1, rectangle.Width/12);
+
+ // define a rectangle inside the border area
+ rect=new Rectangle(rectangle.X+2, rectangle.Y+2, rectangle.Width-4, rectangle.Height-4);
+ if ((State & DrawFrameControlStates.Inactive)!=0) {
+ pen=SystemPens.ControlDark;
+ } else {
+ pen=SystemPens.ControlText;
+ }
+
+ if ((State & DrawFrameControlStates.Checked)!=0) {
+ /* Need to draw a check-mark */
+ for (int i=0; i<lineWidth; i++) {
+ graphics.DrawLine(pen, rect.Left+lineWidth/2, rect.Top+lineWidth+i, rect.Left+lineWidth/2+2*Scale, rect.Top+lineWidth+2*Scale+i);
+ graphics.DrawLine(pen, rect.Left+lineWidth/2+2*Scale, rect.Top+lineWidth+2*Scale+i, rect.Left+lineWidth/2+6*Scale, rect.Top+lineWidth-2*Scale+i);
+ }
+
+ }
+ }
+ return;
+ }
+
+ case DrawFrameControlTypes.Caption: {
+ // FIXME:
+ break;
+ }
+
+ case DrawFrameControlTypes.Menu: {
+ // FIXME:
+ break;
+ }
+
+ case DrawFrameControlTypes.Scroll: {
+ // FIXME:
+ break;
+ }
+ }
+ }
+
+ /* Generic scroll button */
+ public void DrawScrollButtonPrimitive (Graphics dc, Rectangle area, ButtonState state) {
+ if ((state & ButtonState.Pushed) == ButtonState.Pushed) {
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControl), area.X + 1,
+ area.Y + 1, area.Width - 2 , area.Height - 2);
+
+ dc.DrawRectangle (ResPool.GetPen (ColorControlDark), area.X,
+ area.Y, area.Width, area.Height);
+
+ return;
+ }
+
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControl), area.X, area.Y, area.Width, 1);
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControl), area.X, area.Y, 1, area.Height);
+
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControlLight), area.X + 1, area.Y + 1, area.Width - 1, 1);
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControlLight), area.X + 1, area.Y + 2, 1,
+ area.Height - 4);
+
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControlDark), area.X + 1, area.Y + area.Height - 2,
+ area.Width - 2, 1);
+
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControlDarkDark), area.X, area.Y + area.Height -1,
+ area.Width , 1);
+
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControlDark), area.X + area.Width - 2,
+ area.Y + 1, 1, area.Height -3);
+
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControlDarkDark), area.X + area.Width -1,
+ area.Y, 1, area.Height - 1);
+
+ dc.FillRectangle (ResPool.GetSolidBrush (ColorControl), area.X + 2,
+ area.Y + 2, area.Width - 4, area.Height - 4);
+
+ }
+
+ public override void CPDrawBorderStyle (Graphics dc, Rectangle area, BorderStyle border_style) {
+ switch (border_style){
+ case BorderStyle.Fixed3D:
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), area.X, area.Y, area.X +area.Width, area.Y);
+ dc.DrawLine (ResPool.GetPen (ColorControlDark), area.X, area.Y, area.X, area.Y + area.Height);
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), area.X , area.Y + area.Height - 1, area.X + area.Width ,
+ area.Y + area.Height - 1);
+ dc.DrawLine (ResPool.GetPen (ColorControlLight), area.X + area.Width -1 , area.Y, area.X + area.Width -1,
+ area.Y + area.Height);
+
+ dc.DrawLine (ResPool.GetPen (ColorActiveBorder), area.X + 1, area.Bottom - 2, area.Right - 2, area.Bottom - 2);
+ dc.DrawLine (ResPool.GetPen (ColorActiveBorder), area.Right - 2, area.Top + 1, area.Right - 2, area.Bottom - 2);
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), area.X + 1, area.Top + 1, area.X + 1, area.Bottom - 3);
+ dc.DrawLine (ResPool.GetPen (ColorControlDarkDark), area.X + 1, area.Top + 1, area.Right - 3, area.Top + 1);
+ break;
+ case BorderStyle.FixedSingle:
+ dc.DrawRectangle (ResPool.GetPen (ColorWindowFrame), area.X, area.Y, area.Width - 1, area.Height - 1);
+ break;
+ case BorderStyle.None:
+ default:
+ break;
+ }
+
+ }
+ #endregion // ControlPaint
+
+
+ } //class
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThreadExceptionDialog.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThreadExceptionDialog.cs
new file mode 100644
index 00000000000..9f63bb79e25
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThreadExceptionDialog.cs
@@ -0,0 +1,203 @@
+//
+// System.Windows.Forms.ThreadExceptionDialog.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.
+//
+// Authors:
+// Marek Safar marek.safar@seznam.cz
+//
+// Copyright (C) Novell Inc., 2004
+
+// COMPLETE - BUT DISABLED TEXTBOX
+
+using System;
+using System.Text;
+using System.Reflection;
+
+namespace System.Windows.Forms
+{
+ public class ThreadExceptionDialog: Form
+ {
+ Exception e;
+ bool details;
+
+ private System.Windows.Forms.Button buttonIgnore;
+ private System.Windows.Forms.Button buttonAbort;
+ private System.Windows.Forms.Button buttonDetails;
+ private System.Windows.Forms.Label labelException;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.TextBox textBoxDetails;
+ private System.Windows.Forms.Label helpText;
+
+ private void InitializeComponent()
+ {
+ this.helpText = new System.Windows.Forms.Label();
+ this.buttonAbort = new System.Windows.Forms.Button();
+ this.buttonIgnore = new System.Windows.Forms.Button();
+ this.buttonDetails = new System.Windows.Forms.Button();
+ this.labelException = new System.Windows.Forms.Label();
+ this.textBoxDetails = new System.Windows.Forms.TextBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.SuspendLayout();
+ //
+ // helpText
+ //
+ this.helpText.Location = new System.Drawing.Point(60, 8);
+ this.helpText.Name = "helpText";
+ this.helpText.Size = new System.Drawing.Size(356, 40);
+ this.helpText.TabIndex = 0;
+ this.helpText.Text = "An unhandled exception has occurred in you application. If you click Ignore the a" +
+ "pplication will ignore this error and attempt to continue. If you click Abort, t" +
+ "he application will quit immediately.";
+ //
+ // buttonAbort
+ //
+ this.buttonAbort.DialogResult = System.Windows.Forms.DialogResult.Abort;
+ this.buttonAbort.Location = new System.Drawing.Point(332, 112);
+ this.buttonAbort.Name = "buttonAbort";
+ this.buttonAbort.Size = new System.Drawing.Size(85, 23);
+ this.buttonAbort.TabIndex = 4;
+ this.buttonAbort.Text = "&Abort";
+ this.buttonAbort.Click += new System.EventHandler(this.buttonAbort_Click);
+ //
+ // buttonIgnore
+ //
+ this.buttonIgnore.DialogResult = System.Windows.Forms.DialogResult.Ignore;
+ this.buttonIgnore.Location = new System.Drawing.Point(236, 112);
+ this.buttonIgnore.Name = "buttonIgnore";
+ this.buttonIgnore.Size = new System.Drawing.Size(85, 23);
+ this.buttonIgnore.TabIndex = 3;
+ this.buttonIgnore.Text = "&Ignore";
+ //
+ // buttonDetails
+ //
+ this.buttonDetails.Location = new System.Drawing.Point(140, 112);
+ this.buttonDetails.Name = "buttonDetails";
+ this.buttonDetails.Size = new System.Drawing.Size(85, 23);
+ this.buttonDetails.TabIndex = 2;
+ this.buttonDetails.Text = "Show &Details";
+ this.buttonDetails.Click += new System.EventHandler(this.buttonDetails_Click);
+ //
+ // labelException
+ //
+ this.labelException.Location = new System.Drawing.Point(60, 64);
+ this.labelException.Name = "labelException";
+ this.labelException.Size = new System.Drawing.Size(356, 32);
+ this.labelException.TabIndex = 1;
+ //
+ // textBoxDetails
+ //
+ this.textBoxDetails.Location = new System.Drawing.Point(8, 168);
+ this.textBoxDetails.Multiline = true;
+ this.textBoxDetails.Name = "textBoxDetails";
+ this.textBoxDetails.ReadOnly = true;
+ this.textBoxDetails.ScrollBars = System.Windows.Forms.ScrollBars.Both;
+ this.textBoxDetails.Size = new System.Drawing.Size(408, 196);
+ this.textBoxDetails.TabIndex = 5;
+ this.textBoxDetails.TabStop = false;
+ this.textBoxDetails.Text = "";
+ this.textBoxDetails.WordWrap = false;
+ //
+ // label1
+ //
+ this.label1.Location = new System.Drawing.Point(8, 148);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(100, 16);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "Exception details";
+ //
+ // ThreadExceptionDialog
+ //
+ this.AcceptButton = this.buttonIgnore;
+ this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
+ this.CancelButton = this.buttonAbort;
+ this.ClientSize = new System.Drawing.Size(428, 374);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.textBoxDetails);
+ this.Controls.Add(this.labelException);
+ this.Controls.Add(this.buttonDetails);
+ this.Controls.Add(this.buttonIgnore);
+ this.Controls.Add(this.buttonAbort);
+ this.Controls.Add(this.helpText);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "ThreadExceptionDialog";
+ this.ShowInTaskbar = false;
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+ this.TopMost = true;
+ this.ResumeLayout(false);
+ }
+
+ public ThreadExceptionDialog (Exception e)
+ {
+ this.e = e;
+ InitializeComponent ();
+
+ this.labelException.Text = e.Message;
+ if (Form.ActiveForm != null)
+ this.Text = Form.ActiveForm.Text;
+ else
+ this.Text = "Mono";
+ this.buttonAbort.Enabled = Application.AllowQuit;
+ RefreshDetails ();
+ FillExceptionDetails ();
+ }
+
+ void buttonDetails_Click(object sender, System.EventArgs e)
+ {
+ details = !details;
+ RefreshDetails ();
+ }
+
+ void FillExceptionDetails ()
+ {
+ StringBuilder sb = new StringBuilder ();
+ sb.Append (e.ToString ());
+ sb.Append (Environment.NewLine + Environment.NewLine);
+ sb.Append ("Loaded assemblies:" + Environment.NewLine + Environment.NewLine);
+
+ foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies ()) {
+ AssemblyName an = a.GetName ();
+ sb.AppendFormat ("Name:\t{0}" + Environment.NewLine, an.Name);
+ sb.AppendFormat ("Version:\t{0}" + Environment.NewLine, an.Version);
+ sb.AppendFormat ("Location:\t{0}" + Environment.NewLine, an.CodeBase);
+ sb.Append (Environment.NewLine);
+ }
+ textBoxDetails.Text = sb.ToString ();
+ }
+
+ void RefreshDetails ()
+ {
+ if (details) {
+ buttonDetails.Text = "Hide &Details";
+ Height = 410;
+ return;
+ }
+ buttonDetails.Text = "Show &Details";
+ Height = 180;
+ }
+
+ void buttonAbort_Click(object sender, System.EventArgs e)
+ {
+ Application.Exit ();
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TickStyle.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TickStyle.cs
new file mode 100644
index 00000000000..873917dc0b9
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TickStyle.cs
@@ -0,0 +1,40 @@
+//
+// System.Windows.Forms.TickStyle.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.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+// Copyright (C) Novell Inc., 2004
+//
+//
+
+
+namespace System.Windows.Forms
+{
+ public enum TickStyle
+ {
+ None = 0,
+ TopLeft = 1,
+ BottomRight = 2,
+ Both = 3,
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Timer.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Timer.cs
new file mode 100644
index 00000000000..d0326df3e83
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Timer.cs
@@ -0,0 +1,147 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+
+using System;
+using System.Threading;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+ [DefaultProperty("Interval")]
+ [DefaultEvent("Tick")]
+ [ToolboxItemFilter("System.Windows.Forms", ToolboxItemFilterType.Allow)]
+ public class Timer : Component {
+
+ private bool enabled;
+ private IContainer container;
+ private int interval = 100;
+ private DateTime expires;
+
+ internal static readonly int Minimum = 15;
+
+ public Timer ()
+ {
+ enabled = false;
+ }
+
+ public Timer (IContainer container) : this ()
+ {
+ container.Add (this);
+ }
+
+ [DefaultValue (false)]
+ public virtual bool Enabled {
+ get {
+ return enabled;
+ }
+ set {
+ if (value != enabled) {
+ enabled = value;
+ if (value) {
+ XplatUI.SetTimer (this);
+ } else {
+ XplatUI.KillTimer (this);
+ }
+ }
+ }
+ }
+
+ [DefaultValue (100)]
+ public int Interval {
+ get {
+ return interval;
+ }
+ set {
+ if (interval == value) {
+ return;
+ }
+
+ interval = value;
+
+ // Use AddTicks so we get some rounding
+ expires = DateTime.Now.AddMilliseconds (interval > Minimum ? interval : Minimum);
+
+ if (enabled == true) {
+ XplatUI.KillTimer (this);
+ XplatUI.SetTimer (this);
+ }
+ }
+ }
+
+ public void Start ()
+ {
+ Enabled = true;
+ }
+
+ public void Stop ()
+ {
+ Enabled = false;
+ }
+
+ internal DateTime Expires {
+ get {
+ return expires;
+ }
+ }
+
+ public event EventHandler Tick;
+
+ public override string ToString ()
+ {
+ return base.ToString () + ", Interval: " + Interval;
+ }
+
+ internal void Update (DateTime update)
+ {
+ expires = update.AddMilliseconds (interval > Minimum ? interval : Minimum);
+ }
+
+ internal void FireTick ()
+ {
+ OnTick (EventArgs.Empty);
+ }
+
+
+ protected virtual void OnTick (EventArgs e)
+ {
+ if (Tick != null)
+ Tick (this, e);
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ base.Dispose (disposing);
+ Enabled = false;
+ }
+
+ private bool has_last_fire = false;
+ private DateTime last_fire;
+
+ internal void TickHandler (object sender, EventArgs e)
+ {
+ OnTick (e);
+ }
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBar.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBar.cs
new file mode 100644
index 00000000000..315e1d7d93a
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBar.cs
@@ -0,0 +1,982 @@
+//
+// System.Windows.Forms.ToolBar.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.
+//
+// Author:
+// Ravindra (rkumar@novell.com)
+//
+// TODO:
+// - Tooltip
+//
+// Copyright (C) Novell, Inc. 2004 (http://www.novell.com)
+//
+
+
+// NOT COMPLETE
+
+using System.Collections;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms
+{
+ [DefaultEvent ("ButtonClick")]
+ [DefaultProperty ("Buttons")]
+ [Designer ("System.Windows.Forms.Design.ToolBarDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+ public class ToolBar : Control
+ {
+ #region Instance Variables
+ internal ToolBarAppearance appearance;
+ internal bool autosize;
+ internal ToolBarButtonCollection buttons;
+ internal Size buttonSize;
+ internal bool divider;
+ internal bool dropDownArrows;
+ internal ImageList imageList;
+ internal ImeMode imeMode;
+ internal bool showToolTips;
+ internal ToolBarTextAlign textAlignment;
+ internal bool wrappable; // flag to make the toolbar wrappable
+ internal bool redraw; // flag to force redrawing the control
+ private bool size_specified; // flag to know if button size is fixed.
+ internal ToolBarButton currentButton; // the highlighted button
+ #endregion Instance Variables
+
+ #region Events
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler BackColorChanged;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler BackgroundImageChanged;
+
+ public event ToolBarButtonClickEventHandler ButtonClick;
+ public event ToolBarButtonClickEventHandler ButtonDropDown;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler ForeColorChanged;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler ImeModeChanged;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event PaintEventHandler Paint;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler RightToLeftChanged;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler TextChanged;
+ #endregion Events
+
+ #region Constructor
+ public ToolBar ()
+ {
+ appearance = ToolBarAppearance.Normal;
+ autosize = true;
+ background_color = ThemeEngine.Current.DefaultControlBackColor;
+ border_style = BorderStyle.None;
+ buttons = new ToolBarButtonCollection (this);
+ buttonSize = Size.Empty;
+ divider = true;
+ dropDownArrows = false;
+ foreground_color = ThemeEngine.Current.DefaultControlForeColor;
+ showToolTips = false;
+ textAlignment = ToolBarTextAlign.Underneath;
+ wrappable = true;
+ dock_style = DockStyle.Top;
+ redraw = true;
+ size_specified = false;
+
+ // event handlers
+ this.MouseDown += new MouseEventHandler (ToolBar_MouseDown);
+ this.MouseLeave += new EventHandler (ToolBar_MouseLeave);
+ this.MouseMove += new MouseEventHandler (ToolBar_MouseMove);
+ this.MouseUp += new MouseEventHandler (ToolBar_MouseUp);
+ base.Paint += new PaintEventHandler (ToolBar_Paint);
+
+ SetStyle (ControlStyles.UserPaint, false);
+ SetStyle (ControlStyles.FixedHeight, true);
+ }
+ #endregion Constructor
+
+ #region protected Properties
+ protected override CreateParams CreateParams
+ {
+ get { return base.CreateParams; }
+ }
+
+ protected override ImeMode DefaultImeMode {
+ get { return ImeMode.Disable; }
+ }
+
+ protected override Size DefaultSize {
+ get { return ThemeEngine.Current.ToolBarDefaultSize; }
+ }
+ #endregion
+
+ #region Public Properties
+ [DefaultValue (ToolBarAppearance.Normal)]
+ [Localizable (true)]
+ public ToolBarAppearance Appearance {
+ get { return appearance; }
+ set {
+ if (value == appearance)
+ return;
+
+ appearance = value;
+ Redraw (false);
+ }
+ }
+
+ [DefaultValue (true)]
+ [Localizable (true)]
+ public bool AutoSize {
+ get { return autosize; }
+ set {
+ if (value == autosize)
+ return;
+
+ autosize = value;
+ Redraw (true);
+ }
+ }
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public override Color BackColor {
+ get { return background_color; }
+ set {
+ if (value == background_color)
+ return;
+
+ background_color = value;
+ if (BackColorChanged != null)
+ BackColorChanged (this, new EventArgs ());
+ Redraw (false);
+ }
+ }
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public override Image BackgroundImage {
+ get { return background_image; }
+ set {
+ if (value == background_image)
+ return;
+
+ background_image = value;
+ if (BackgroundImageChanged != null)
+ BackgroundImageChanged (this, new EventArgs ());
+ Redraw (false);
+ }
+ }
+
+ [DefaultValue (BorderStyle.None)]
+ [DispIdAttribute (-504)]
+ public BorderStyle BorderStyle {
+ get { return InternalBorderStyle; }
+ set { InternalBorderStyle = value; }
+ }
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [Localizable (true)]
+ [MergableProperty (false)]
+ public ToolBarButtonCollection Buttons {
+ get { return buttons; }
+ }
+
+ [Localizable (true)]
+ [RefreshProperties (RefreshProperties.All)]
+ public Size ButtonSize {
+ get {
+ if (buttonSize.IsEmpty) {
+ if (buttons.Count == 0)
+ return new Size (39, 36);
+ else
+ return CalcButtonSize ();
+ }
+ return buttonSize;
+ }
+ set {
+ if (buttonSize.Width == value.Width && buttonSize.Height == value.Height)
+ return;
+
+ buttonSize = value;
+ size_specified = true;
+ Redraw (true);
+ }
+ }
+
+ [DefaultValue (true)]
+ public bool Divider {
+ get { return divider; }
+ set {
+ if (value == divider)
+ return;
+
+ divider = value;
+ Redraw (false);
+ }
+ }
+
+ [DefaultValue (DockStyle.Top)]
+ [Localizable (true)]
+ public override DockStyle Dock {
+ get { return base.Dock; }
+ set { base.Dock = value; }
+ }
+
+ [DefaultValue (false)]
+ [Localizable (true)]
+ public bool DropDownArrows {
+ get { return dropDownArrows; }
+ set {
+ if (value == dropDownArrows)
+ return;
+
+ dropDownArrows = value;
+ Redraw (true);
+ }
+ }
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public override Color ForeColor {
+ get { return foreground_color; }
+ set {
+ if (value == foreground_color)
+ return;
+
+ foreground_color = value;
+ if (ForeColorChanged != null)
+ ForeColorChanged (this, new EventArgs ());
+ Redraw (false);
+ }
+ }
+
+ [DefaultValue (null)]
+ public ImageList ImageList {
+ get { return imageList; }
+ set { imageList = value; }
+ }
+
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ public Size ImageSize {
+ get {
+ if (imageList == null)
+ return Size.Empty;
+
+ return imageList.ImageSize;
+ }
+ }
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new ImeMode ImeMode {
+ get { return imeMode; }
+ set {
+ if (value == imeMode)
+ return;
+
+ imeMode = value;
+ if (ImeModeChanged != null)
+ ImeModeChanged (this, new EventArgs ());
+ }
+ }
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public override RightToLeft RightToLeft {
+ get { return base.RightToLeft; }
+ set {
+ if (value == base.RightToLeft)
+ return;
+
+ base.RightToLeft = value;
+ if (RightToLeftChanged != null)
+ RightToLeftChanged (this, new EventArgs ());
+ }
+ }
+
+ [DefaultValue (false)]
+ [Localizable (true)]
+ public bool ShowToolTips {
+ get { return showToolTips; }
+ set { showToolTips = value; }
+ }
+
+ [DefaultValue (false)]
+ public new bool TabStop {
+ get { return base.TabStop; }
+ set { base.TabStop = value; }
+ }
+
+ [Bindable (false)]
+ [Browsable (false)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public override string Text {
+ get { return text; }
+ set {
+ if (value == text)
+ return;
+
+ text = value;
+ Redraw (true);
+ if (TextChanged != null)
+ TextChanged (this, new EventArgs ());
+ }
+ }
+
+ [DefaultValue (ToolBarTextAlign.Underneath)]
+ [Localizable (true)]
+ public ToolBarTextAlign TextAlign {
+ get { return textAlignment; }
+ set {
+ if (value == textAlignment)
+ return;
+
+ textAlignment = value;
+ Redraw (true);
+ }
+ }
+
+ [DefaultValue (true)]
+ [Localizable (true)]
+ public bool Wrappable {
+ get { return wrappable; }
+ set {
+ if (value == wrappable)
+ return;
+
+ wrappable = value;
+ Redraw (true);
+ }
+ }
+ #endregion Public Properties
+
+ #region Public Methods
+ public override string ToString ()
+ {
+ int count = this.Buttons.Count;
+
+ if (count == 0)
+ return string.Format ("System.Windows.Forms.ToolBar, Button.Count: 0");
+ else
+ return string.Format ("System.Windows.Forms.ToolBar, Button.Count: {0}, Buttons[0]: {1}",
+ count, this.Buttons [0].ToString ());
+ }
+ #endregion Public Methods
+
+ #region Internal Methods
+ internal Rectangle GetChildBounds (ToolBarButton button)
+ {
+ if (button.Style == ToolBarButtonStyle.Separator)
+ return new Rectangle (button.Location.X, button.Location.Y,
+ ThemeEngine.Current.ToolBarSeparatorWidth, this.ButtonSize.Height);
+
+ if (size_specified)
+ return new Rectangle (button.Location, this.ButtonSize);
+
+ SizeF sz = this.DeviceContext.MeasureString (button.Text, this.Font);
+ Size size = new Size ((int) Math.Ceiling (sz.Width), (int) Math.Ceiling (sz.Height));
+
+ if (imageList != null) {
+ // adjustment for the image grip
+ int imgWidth = this.ImageSize.Width + 2 * ThemeEngine.Current.ToolBarImageGripWidth;
+ int imgHeight = this.ImageSize.Height + 2 * ThemeEngine.Current.ToolBarImageGripWidth;
+
+ if (textAlignment == ToolBarTextAlign.Right) {
+ size.Width = imgWidth + size.Width;
+ size.Height = (size.Height > imgHeight) ? size.Height : imgHeight;
+ }
+ else {
+ size.Height = imgHeight + size.Height;
+ size.Width = (size.Width > imgWidth) ? size.Width : imgWidth;
+ }
+ }
+ if (button.Style == ToolBarButtonStyle.DropDownButton && this.dropDownArrows)
+ size.Width += ThemeEngine.Current.ToolBarDropDownWidth;
+
+ return new Rectangle (button.Location, size);
+ }
+ #endregion Internal Methods
+
+ #region Protected Methods
+ protected override void CreateHandle ()
+ {
+ base.CreateHandle ();
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ if (disposing)
+ imageList = null;
+
+ base.Dispose (disposing);
+ }
+
+ protected virtual void OnButtonClick (ToolBarButtonClickEventArgs e)
+ {
+ if (e.Button.Style == ToolBarButtonStyle.ToggleButton) {
+ if (! e.Button.Pushed)
+ e.Button.Pushed = true;
+ else
+ e.Button.Pushed = false;
+ }
+ e.Button.pressed = false;
+
+ Invalidate (e.Button.Rectangle);
+ Redraw (false);
+
+ if (ButtonClick != null)
+ ButtonClick (this, e);
+ else
+ return;
+ }
+
+ protected virtual void OnButtonDropDown (ToolBarButtonClickEventArgs e)
+ {
+ // Reset the flag set on DropDown
+ e.Button.dd_pressed = false;
+
+ if (ButtonDropDown != null)
+ ButtonDropDown (this, e);
+
+ if (e.Button.DropDownMenu == null)
+ return;
+
+ Point loc = new Point (e.Button.Location.X + 1,
+ e.Button.Rectangle.Bottom + 2);
+ ((ContextMenu) e.Button.DropDownMenu).Show (this, loc);
+ }
+
+ protected override void OnFontChanged (EventArgs e)
+ {
+ base.OnFontChanged (e);
+ Redraw (true);
+ }
+
+ protected override void OnHandleCreated (EventArgs e)
+ {
+ base.OnHandleCreated (e);
+ }
+
+ protected override void OnResize (EventArgs e)
+ {
+ base.OnResize (e);
+
+ if (this.Width <= 0 || this.Height <= 0 || this.Visible == false)
+ return;
+
+ Redraw (true);
+ }
+
+ protected override void SetBoundsCore (int x, int y, int width, int height, BoundsSpecified specified)
+ {
+ base.SetBoundsCore (x, y, width, height, specified);
+ }
+
+ protected override void WndProc (ref Message m)
+ {
+ base.WndProc (ref m);
+ }
+
+ #endregion Protected Methods
+
+ #region Private Methods
+ private void ToolBar_MouseDown (object sender, MouseEventArgs me)
+ {
+ if (! this.Enabled) return;
+
+ Point hit = new Point (me.X, me.Y);
+ this.Capture = true;
+
+ // draw the pushed button
+ foreach (ToolBarButton button in buttons) {
+ if (button.Enabled && button.Rectangle.Contains (hit)) {
+ // Mark the DropDown rect as pressed.
+ // We don't redraw the dropdown rect.
+ if (button.Style == ToolBarButtonStyle.DropDownButton) {
+ Rectangle ddRect = Rectangle.Empty;
+ Rectangle rect = button.Rectangle;
+ ddRect.Height = rect.Height;
+ ddRect.Width = ThemeEngine.Current.ToolBarDropDownWidth;
+ ddRect.X = rect.X + rect.Width - ddRect.Width;
+ ddRect.Y = rect.Y;
+ if (ddRect.Contains (hit)) {
+ button.dd_pressed = true;
+ break;
+ }
+ }
+ // If it is not dropdown then we treat it as a normal
+ // button press.
+ button.pressed = true;
+ button.inside = true;
+ Invalidate (button.Rectangle);
+ Redraw (false);
+ break;
+ }
+ }
+ }
+
+ private void ToolBar_MouseUp (object sender, MouseEventArgs me)
+ {
+ if (! this.Enabled) return;
+
+ Point hit = new Point (me.X, me.Y);
+ this.Capture = false;
+
+ // draw the normal button
+ foreach (ToolBarButton button in buttons) {
+ if (button.Enabled && button.Rectangle.Contains (hit)) {
+ if (button.Style == ToolBarButtonStyle.DropDownButton) {
+ Rectangle ddRect = Rectangle.Empty;
+ Rectangle rect = button.Rectangle;
+ ddRect.Height = rect.Height;
+ ddRect.Width = ThemeEngine.Current.ToolBarDropDownWidth;
+ ddRect.X = rect.X + rect.Width - ddRect.Width;
+ ddRect.Y = rect.Y;
+ // Fire a ButtonDropDown event
+ if (ddRect.Contains (hit)) {
+ if (button.dd_pressed)
+ this.OnButtonDropDown (new ToolBarButtonClickEventArgs (button));
+ continue;
+ }
+ }
+ // Fire a ButtonClick
+ if (button.pressed)
+ this.OnButtonClick (new ToolBarButtonClickEventArgs (button));
+ }
+ // Clear the button press flags, if any
+ else if (button.pressed) {
+ button.pressed = false;
+ Invalidate (button.Rectangle);
+ Redraw (false);
+ }
+ }
+ }
+
+ private void ToolBar_MouseLeave (object sender, EventArgs e)
+ {
+ if (! this.Enabled || appearance != ToolBarAppearance.Flat) return;
+
+ if (currentButton != null && currentButton.Hilight) {
+ currentButton.Hilight = false;
+ Invalidate (currentButton.Rectangle);
+ Redraw (false);
+ }
+ currentButton = null;
+ }
+
+ private void ToolBar_MouseMove (object sender, MouseEventArgs me)
+ {
+ if (! this.Enabled) return;
+
+ Point hit = new Point (me.X, me.Y);
+
+ if (this.Capture) {
+ // If the button was pressed and we leave, release the
+ // button press and vice versa
+ foreach (ToolBarButton button in buttons) {
+ if (button.pressed &&
+ (button.inside != button.Rectangle.Contains (hit))) {
+ button.inside = button.Rectangle.Contains (hit);
+ button.Hilight = false;
+ Invalidate (button.Rectangle);
+ Redraw (false);
+ break;
+ }
+ }
+ }
+ // following is only for flat style toolbar
+ else if (appearance == ToolBarAppearance.Flat) {
+ if (currentButton != null && currentButton.Rectangle.Contains (hit)) {
+ if (currentButton.Hilight || currentButton.Pushed)
+ return;
+ currentButton.Hilight = true;
+ Invalidate (currentButton.Rectangle);
+ Redraw (false);
+ }
+ else {
+ foreach (ToolBarButton button in buttons) {
+ if (button.Rectangle.Contains (hit) && button.Enabled) {
+ currentButton = button;
+ if (currentButton.Hilight || currentButton.Pushed)
+ continue;
+ currentButton.Hilight = true;
+ Invalidate (currentButton.Rectangle);
+ Redraw (false);
+ }
+ else if (button.Hilight) {
+ button.Hilight = false;
+ Invalidate (button.Rectangle);
+ Redraw (false);
+ }
+ }
+ }
+ }
+ }
+
+ private void ToolBar_Paint (object sender, PaintEventArgs pevent)
+ {
+ ThemeEngine.Current.DrawToolBar (pevent.Graphics, pevent.ClipRectangle, this);
+
+ if (Paint != null) {
+ Paint (this, pevent);
+ }
+ }
+
+ internal void Redraw (bool recalculate)
+ {
+ // if (recalculate) {
+ CalcToolBar ();
+ // }
+
+ redraw = true;
+ Refresh ();
+ }
+
+ private Size CalcButtonSize ()
+ {
+ String longestText = buttons [0].Text;
+ for (int i = 1; i < buttons.Count; i++) {
+ if (buttons[i].Text.Length > longestText.Length)
+ longestText = buttons[i].Text;
+ }
+
+ SizeF sz = this.DeviceContext.MeasureString (longestText, this.Font);
+ Size size = new Size ((int) Math.Ceiling (sz.Width), (int) Math.Ceiling (sz.Height));
+
+ if (imageList != null) {
+ // adjustment for the image grip
+ int imgWidth = this.ImageSize.Width + 2 * ThemeEngine.Current.ToolBarImageGripWidth;
+ int imgHeight = this.ImageSize.Height + 2 * ThemeEngine.Current.ToolBarImageGripWidth;
+
+ if (textAlignment == ToolBarTextAlign.Right) {
+ size.Width = imgWidth + size.Width;
+ size.Height = (size.Height > imgHeight) ? size.Height : imgHeight;
+ }
+ else {
+ size.Height = imgHeight + size.Height;
+ size.Width = (size.Width > imgWidth) ? size.Width : imgWidth;
+ }
+ }
+ return size;
+ }
+
+ /* Checks for the separators and sets the location of a button and its wrapper flag */
+ private void CalcToolBar ()
+ {
+ int wd = this.Width; // the amount of space we have for rest of the buttons
+ int ht = this.ButtonSize.Height; // all buttons are displayed with the same height
+ Point loc; // the location to place the next button, leave the space for border
+ loc = new Point (ThemeEngine.Current.ToolBarGripWidth, ThemeEngine.Current.ToolBarGripWidth);
+
+ // clear all the wrappers if toolbar is not wrappable
+ if (! wrappable && ! autosize) {
+ if (this.Height != this.DefaultSize.Height)
+ this.Height = this.DefaultSize.Height;
+ foreach (ToolBarButton button in buttons) {
+ button.Location = loc;
+ button.Wrapper = false;
+ loc.X = loc.X + button.Rectangle.Width;
+ }
+ }
+ else if (! wrappable) { // autosizeable
+ if (ht != this.Height)
+ this.Height = ht;
+ foreach (ToolBarButton button in buttons) {
+ button.Location = loc;
+ button.Wrapper = false;
+ loc.X = loc.X + button.Rectangle.Width;
+ }
+ }
+ else { // wrappable
+ bool seenSeparator = false;
+ int separatorIndex = -1;
+ ToolBarButton button;
+
+ for (int i = 0; i < buttons.Count; i++) {
+ button = buttons [i];
+ if (button.Visible) {
+ if (button.Style == ToolBarButtonStyle.Separator) {
+ wd -= ThemeEngine.Current.ToolBarSeparatorWidth;
+ if (wd > 0) {
+ button.Wrapper = false; // clear the old flag in case it was set
+ button.Location = loc;
+ loc.X = loc.X + ThemeEngine.Current.ToolBarSeparatorWidth;
+ }
+ else {
+ button.Wrapper = true;
+ button.Location = loc;
+ loc.X = ThemeEngine.Current.ToolBarGripWidth;
+ wd = this.Width;
+ // we need space to draw horizontal separator
+ loc.Y = loc.Y + ThemeEngine.Current.ToolBarSeparatorWidth + ht;
+ }
+ seenSeparator = true;
+ separatorIndex = i;
+ }
+ else {
+ Rectangle rect = button.Rectangle;
+ wd -= rect.Width;
+ if (wd > 0) {
+ button.Wrapper = false;
+ button.Location = loc;
+ loc.X = loc.X + rect.Width;
+ }
+ else if (seenSeparator) {
+ // wrap at the separator and reassign the locations
+ i = separatorIndex; // for loop is going to increment it
+ buttons [separatorIndex].Wrapper = true;
+ seenSeparator = false;
+ separatorIndex = -1;
+ loc.X = ThemeEngine.Current.ToolBarGripWidth;
+ // we need space to draw horizontal separator
+ loc.Y = loc.Y + ht + ThemeEngine.Current.ToolBarSeparatorWidth;
+ wd = this.Width;
+ continue;
+ }
+ else {
+ button.Wrapper = true;
+ wd = this.Width;
+ loc.X = 0;
+ loc.Y += ht;
+ button.Location = loc;
+ loc.X = loc.X + rect.Width;
+ }
+ }
+ }
+ else // don't consider invisible buttons
+ continue;
+ }
+ /* adjust the control height, if we are autosizeable */
+ if (autosize) // wrappable
+ if (this.Height != (loc.Y + ht + ThemeEngine.Current.ToolBarGripWidth))
+ this.Height = loc.Y + ht + ThemeEngine.Current.ToolBarGripWidth;
+ }
+ }
+
+ private void DumpToolBar (string msg)
+ {
+ Console.WriteLine (msg);
+ Console.WriteLine ("ToolBar: name: " + this.Text);
+ Console.WriteLine ("ToolBar: wd, ht: " + this.Size);
+ Console.WriteLine ("ToolBar: img size: " + this.ImageSize);
+ Console.WriteLine ("ToolBar: button sz: " + this.buttonSize);
+ Console.WriteLine ("ToolBar: textalignment: "+ this.TextAlign);
+ Console.WriteLine ("ToolBar: appearance: "+ this.Appearance);
+ Console.WriteLine ("ToolBar: wrappable: "+ this.Wrappable);
+ Console.WriteLine ("ToolBar: buttons count: " + this.Buttons.Count);
+
+ int i= 0;
+ foreach (ToolBarButton b in buttons) {
+ Console.WriteLine ("ToolBar: button [{0}]:",i++);
+ b.Dump ();
+ }
+ }
+ #endregion Private Methods
+
+ #region subclass
+ public class ToolBarButtonCollection : IList, ICollection, IEnumerable
+ {
+ #region instance variables
+ private ArrayList buttonsList;
+ private ToolBar owner;
+ #endregion
+
+ #region constructors
+ public ToolBarButtonCollection (ToolBar owner)
+ {
+ this.owner = owner;
+ this.buttonsList = new ArrayList ();
+ }
+ #endregion
+
+ #region properties
+ [Browsable (false)]
+ public virtual int Count {
+ get { return buttonsList.Count; }
+ }
+
+ public virtual bool IsReadOnly {
+ get { return buttonsList.IsReadOnly; }
+ }
+
+ public virtual ToolBarButton this [int index] {
+ get { return (ToolBarButton) buttonsList [index]; }
+ set {
+ value.SetParent (owner);
+ buttonsList [index] = value;
+ owner.Redraw (true);
+ }
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return buttonsList.IsSynchronized; }
+ }
+
+ object ICollection.SyncRoot {
+ get { return buttonsList.SyncRoot; }
+ }
+
+ bool IList.IsFixedSize {
+ get { return buttonsList.IsFixedSize; }
+ }
+
+ object IList.this [int index] {
+ get { return this [index]; }
+ set {
+ if (! (value is ToolBarButton))
+ throw new ArgumentException("Not of type ToolBarButton", "value");
+ this [index] = (ToolBarButton) value;
+ }
+ }
+ #endregion
+
+ #region methods
+ public int Add (string text)
+ {
+ ToolBarButton button = new ToolBarButton (text);
+ return this.Add (button);
+ }
+
+ public int Add (ToolBarButton button)
+ {
+ int result;
+ button.SetParent (owner);
+ result = buttonsList.Add (button);
+ owner.Redraw (true);
+ return result;
+ }
+
+ public void AddRange (ToolBarButton [] buttons)
+ {
+ foreach (ToolBarButton button in buttons)
+ Add (button);
+ }
+
+ public virtual void Clear ()
+ {
+ buttonsList.Clear ();
+ owner.Redraw (false);
+ }
+
+ public bool Contains (ToolBarButton button)
+ {
+ return buttonsList.Contains (button);
+ }
+
+ public virtual IEnumerator GetEnumerator ()
+ {
+ return buttonsList.GetEnumerator ();
+ }
+
+ void ICollection.CopyTo (Array dest, int index)
+ {
+ buttonsList.CopyTo (dest, index);
+ }
+
+ int IList.Add (object button)
+ {
+ if (! (button is ToolBarButton)) {
+ throw new ArgumentException("Not of type ToolBarButton", "button");
+ }
+
+ return this.Add ((ToolBarButton) button);
+ }
+
+ bool IList.Contains (object button)
+ {
+ if (! (button is ToolBarButton)) {
+ throw new ArgumentException("Not of type ToolBarButton", "button");
+ }
+
+ return this.Contains ((ToolBarButton) button);
+ }
+
+ int IList.IndexOf (object button)
+ {
+ if (! (button is ToolBarButton)) {
+ throw new ArgumentException("Not of type ToolBarButton", "button");
+ }
+
+ return this.IndexOf ((ToolBarButton) button);
+ }
+
+ void IList.Insert (int index, object button)
+ {
+ if (! (button is ToolBarButton)) {
+ throw new ArgumentException("Not of type ToolBarButton", "button");
+ }
+
+ this.Insert (index, (ToolBarButton) button);
+ }
+
+ void IList.Remove (object button)
+ {
+ if (! (button is ToolBarButton)) {
+ throw new ArgumentException("Not of type ToolBarButton", "button");
+ }
+
+ this.Remove ((ToolBarButton) button);
+ }
+
+ public int IndexOf (ToolBarButton button)
+ {
+ return buttonsList.IndexOf (button);
+ }
+
+ public void Insert (int index, ToolBarButton button)
+ {
+ buttonsList.Insert (index, button);
+ owner.Redraw (true);
+ }
+
+ public void Remove (ToolBarButton button)
+ {
+ buttonsList.Remove (button);
+ owner.Redraw (true);
+ }
+
+ public virtual void RemoveAt (int index)
+ {
+ buttonsList.RemoveAt (index);
+ owner.Redraw (true);
+ }
+ #endregion methods
+ }
+ #endregion subclass
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBarAppearance.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBarAppearance.cs
new file mode 100644
index 00000000000..e3366639c74
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBarAppearance.cs
@@ -0,0 +1,41 @@
+//
+// System.Windows.Forms.ToolBarAppearance.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 Novell, Inc.
+//
+// Authors:
+// Ravindra (rkumar@novell.com)
+//
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms
+{
+ [Serializable]
+ public enum ToolBarAppearance
+ {
+ Normal = 0,
+ Flat = 1
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBarButton.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBarButton.cs
new file mode 100644
index 00000000000..34c6ee3da2e
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBarButton.cs
@@ -0,0 +1,294 @@
+//
+// 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 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Ravindra (rkumar@novell.com)
+//
+// TODO:
+// - Adding a button to two toolbars
+//
+
+
+// NOT COMPLETE
+
+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;
+ private Point location = new Point (ThemeEngine.Current.ToolBarGripWidth,
+ ThemeEngine.Current.ToolBarGripWidth);
+ 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 wrapper = false; // to mark a wrapping button
+ 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 (! pushed)
+ hilight = value;
+ else
+ hilight = false;
+ }
+ }
+
+ internal Point Location {
+ get { return location; }
+ set { location = value; }
+ }
+
+ internal bool Pressed {
+ get {
+ if (pressed && inside)
+ return true;
+ else
+ return false;
+ }
+ set { pressed = value; }
+ }
+
+ internal bool Wrapper {
+ get { return wrapper; }
+ set { wrapper = 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;
+ if (parent != null)
+ parent.Redraw (false);
+ }
+ }
+
+ [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 (parent != null)
+ parent.Redraw (true);
+ }
+ }
+
+ [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;
+ if (parent != null)
+ parent.Redraw (false);
+ }
+ }
+
+ [DefaultValue (false)]
+ public bool Pushed {
+ get { return pushed; }
+ set {
+ if (value == pushed)
+ return;
+
+ pushed = value;
+ if (pushed)
+ hilight = false;
+ if (parent != null)
+ parent.Redraw (false);
+ }
+ }
+
+ public Rectangle Rectangle {
+ get {
+ if (parent == null)
+ return Rectangle.Empty;
+ else if (visible && parent.Visible)
+ return parent.GetChildBounds (this);
+ else
+ return Rectangle.Empty;
+ }
+ }
+
+ [DefaultValue (ToolBarButtonStyle.PushButton)]
+ [RefreshProperties (RefreshProperties.Repaint)]
+ public ToolBarButtonStyle Style {
+ get { return style; }
+ set {
+ if (value == style)
+ return;
+
+ style = value;
+ if (parent != null)
+ parent.Redraw (true);
+ }
+ }
+
+ [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)
+ {
+ this.parent = parent;
+ }
+
+ internal void Dump ()
+ {
+ Console.WriteLine ("TBButton: style: " + this.Style);
+ Console.WriteLine ("TBButton: wrapper: " + this.Wrapper);
+ Console.WriteLine ("TBButton: hilight: " + this.Hilight);
+ Console.WriteLine ("TBButton: loc: " + this.Location);
+ Console.WriteLine ("TBButton: rect: " + this.Rectangle);
+ Console.WriteLine ("TBButton: txt: " + this.Text);
+ Console.WriteLine ("TBButton: visible " + this.Visible);
+ Console.WriteLine ("TBButton: enabled: " + this.Enabled);
+ Console.WriteLine ("TBButton: image index: " + this.ImageIndex);
+ Console.WriteLine ("TBButton: pushed: " + this.Pushed);
+ Console.WriteLine ("TBButton: partial push: " + this.PartialPush);
+ }
+ #endregion
+
+ #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
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBarButtonClickEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBarButtonClickEventArgs.cs
new file mode 100644
index 00000000000..3f7deba81dc
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBarButtonClickEventArgs.cs
@@ -0,0 +1,57 @@
+//
+// System.Windows.Forms.ToolBarButtonClickEventArgs.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 Novell, Inc.
+//
+// Authors:
+// Ravindra (rkumar@novell.com)
+//
+//
+
+
+// COMPLETE
+
+using System;
+
+namespace System.Windows.Forms
+{
+ public class ToolBarButtonClickEventArgs : EventArgs
+ {
+ #region Local Variables
+ private ToolBarButton button;
+ #endregion
+
+ #region Public Constructors
+ public ToolBarButtonClickEventArgs (ToolBarButton button)
+ {
+ this.button = button;
+ }
+ #endregion Public Constructors
+
+ #region Public Instance Properties
+ public ToolBarButton Button {
+ get { return button; }
+ set { button = value; }
+ }
+ #endregion Instance Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBarButtonClickEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBarButtonClickEventHandler.cs
new file mode 100644
index 00000000000..c11b6b305c1
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBarButtonClickEventHandler.cs
@@ -0,0 +1,36 @@
+//
+// System.Windows.Forms.ToolBarButtonClickEventHandler.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 Novell, Inc.
+//
+// Authors:
+// Ravindra (rkumar@novell.com)
+//
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ [Serializable]
+ public delegate void ToolBarButtonClickEventHandler (object sender, ToolBarButtonClickEventArgs e);
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBarButtonStyle.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBarButtonStyle.cs
new file mode 100644
index 00000000000..328fec0bf57
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBarButtonStyle.cs
@@ -0,0 +1,42 @@
+//
+// System.Windows.Forms.ToolBarButtonStyle.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 Novell, Inc.
+//
+// Authors:
+// Ravindra (rkumar@novell.com)
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms
+{
+ [Serializable]
+ public enum ToolBarButtonStyle
+ {
+ PushButton = 1,
+ ToggleButton = 2,
+ Separator = 3,
+ DropDownButton =4
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBarTextAlign.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBarTextAlign.cs
new file mode 100644
index 00000000000..255205498ea
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBarTextAlign.cs
@@ -0,0 +1,40 @@
+//
+// System.Windows.Forms.ToolBarTextAlign.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 Novell, Inc.
+//
+// Authors:
+// Ravindra (rkumar@novell.com)
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms
+{
+ [Serializable]
+ public enum ToolBarTextAlign
+ {
+ Underneath = 0,
+ Right = 1
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolTip.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolTip.cs
new file mode 100644
index 00000000000..19efe7fe1bc
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolTip.cs
@@ -0,0 +1,453 @@
+// 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 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+
+// COMPLETE
+
+using System.Collections;
+using System.ComponentModel;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+ [ProvideProperty ("ToolTip", typeof(System.Windows.Forms.Control))]
+ [ToolboxItemFilter("System.Windows.Forms", ToolboxItemFilterType.Allow)]
+ public sealed class ToolTip : System.ComponentModel.Component, System.ComponentModel.IExtenderProvider {
+ #region Local variables
+ internal bool is_active;
+ internal int automatic_delay;
+ internal int autopop_delay;
+ internal int initial_delay;
+ internal int re_show_delay;
+ internal bool show_always;
+
+ internal ToolTipWindow tooltip_window; // The actual tooltip window
+ internal Hashtable tooltip_strings; // List of strings for each control, indexed by control
+ internal ArrayList controls;
+ internal Control active_control; // Control for which the tooltip is currently displayed
+ internal Control last_control; // last control the mouse was in
+ internal Size display_size; // Size of the screen
+ internal Timer timer; // Used for the various intervals
+ #endregion // Local variables
+
+ #region ToolTipWindow Class
+ internal class ToolTipWindow : Control {
+ #region ToolTipWindow Class Local Variables
+ internal StringFormat string_format;
+ internal ToolTip owner;
+ #endregion // ToolTipWindow Class Local Variables
+
+ #region ToolTipWindow Class Constructor
+ internal ToolTipWindow(ToolTip owner) : base() {
+ this.owner = owner;
+
+ string_format = new StringFormat();
+ string_format.LineAlignment = StringAlignment.Center;
+ string_format.Alignment = StringAlignment.Center;
+ string_format.FormatFlags = StringFormatFlags.NoWrap;
+
+ Visible = false;
+ Size = new Size(100, 20);
+ ForeColor = ThemeEngine.Current.ColorInfoText;
+ BackColor = ThemeEngine.Current.ColorInfo;
+
+ VisibleChanged += new EventHandler(ToolTipWindow_VisibleChanged);
+
+ SetStyle (ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
+ SetStyle (ControlStyles.ResizeRedraw | ControlStyles.Opaque, true);
+ }
+
+ #endregion // ToolTipWindow Class Constructor
+
+ #region ToolTipWindow Class Protected Instance Methods
+ protected override void OnCreateControl() {
+ base.OnCreateControl ();
+ XplatUI.SetTopmost(this.window.Handle, IntPtr.Zero, true);
+ }
+
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams cp;
+
+ cp = base.CreateParams;
+
+ cp.Style = (int)WindowStyles.WS_POPUP;
+ cp.Style |= (int)WindowStyles.WS_CLIPSIBLINGS;
+
+ cp.ExStyle = (int)(WindowStyles.WS_EX_TOOLWINDOW | WindowStyles.WS_EX_TOPMOST);
+
+ return cp;
+ }
+ }
+
+ protected override void OnPaint(PaintEventArgs pevent) {
+ // We don't do double-buffering on purpose:
+ // 1) we'd have to meddle with is_visible, it destroys the buffers if !visible
+ // 2) We don't draw much, no need to double buffer
+ ThemeEngine.Current.DrawToolTip(pevent.Graphics, ClientRectangle, this);
+
+ base.OnPaint(pevent);
+ }
+
+ protected override void Dispose(bool disposing) {
+ if (disposing) {
+ this.string_format.Dispose();
+ }
+ base.Dispose (disposing);
+ }
+
+ protected override void WndProc(ref Message m) {
+ if (m.Msg == (int)Msg.WM_SETFOCUS) {
+ if (m.WParam != IntPtr.Zero) {
+ XplatUI.SetFocus(m.WParam);
+ }
+ }
+ base.WndProc (ref m);
+ }
+
+
+ #endregion // ToolTipWindow Class Protected Instance Methods
+
+ #region ToolTipWindow Class Private Methods
+ private void ToolTipWindow_VisibleChanged(object sender, EventArgs e) {
+ Control control = (Control)sender;
+
+ if (control.is_visible) {
+ XplatUI.SetTopmost(control.window.Handle, IntPtr.Zero, true);
+ } else {
+ XplatUI.SetTopmost(control.window.Handle, IntPtr.Zero, false);
+ }
+ }
+ #endregion // ToolTipWindow Class Protected Instance Methods
+ }
+ #endregion // ToolTipWindow Class
+
+ #region Public Constructors & Destructors
+ public ToolTip() {
+ XplatUI.GetDisplaySize(out display_size);
+
+ // Defaults from MS
+ is_active = true;
+ automatic_delay = 500;
+ autopop_delay = 5000;
+ initial_delay = 500;
+ re_show_delay = 100;
+ show_always = false;
+
+ tooltip_strings = new Hashtable(5);
+ controls = new ArrayList(5);
+
+ tooltip_window = new ToolTipWindow(this);
+ tooltip_window.MouseLeave += new EventHandler(control_MouseLeave);
+
+ timer = new Timer();
+ timer.Enabled = false;
+ timer.Tick +=new EventHandler(timer_Tick);
+ }
+
+ public ToolTip(System.ComponentModel.IContainer cont) : this() {
+ // Dunno why I'd need the container
+ }
+
+ ~ToolTip() {
+ }
+ #endregion // Public Constructors & Destructors
+
+ #region Public Instance Properties
+ [DefaultValue (true)]
+ public bool Active {
+ get {
+ return is_active;
+ }
+
+ set {
+ if (is_active != value) {
+ is_active = value;
+
+ if (tooltip_window.Visible) {
+ tooltip_window.Visible = false;
+ active_control = null;
+ }
+ }
+ }
+ }
+
+ [DefaultValue (500)]
+ [RefreshProperties (RefreshProperties.All)]
+ public int AutomaticDelay {
+ get {
+ return automatic_delay;
+ }
+
+ set {
+ if (automatic_delay != value) {
+ automatic_delay = value;
+ autopop_delay = automatic_delay * 10;
+ initial_delay = automatic_delay;
+ re_show_delay = automatic_delay / 5;
+ }
+ }
+ }
+
+ [RefreshProperties (RefreshProperties.All)]
+ public int AutoPopDelay {
+ get {
+ return autopop_delay;
+ }
+
+ set {
+ if (autopop_delay != value) {
+ autopop_delay = value;
+ }
+ }
+ }
+
+ [RefreshProperties (RefreshProperties.All)]
+ public int InitialDelay {
+ get {
+ return initial_delay;
+ }
+
+ set {
+ if (initial_delay != value) {
+ initial_delay = value;
+ }
+ }
+ }
+
+ [RefreshProperties (RefreshProperties.All)]
+ public int ReshowDelay {
+ get {
+ return re_show_delay;
+ }
+
+ set {
+ if (re_show_delay != value) {
+ re_show_delay = value;
+ }
+ }
+ }
+
+ [DefaultValue (false)]
+ public bool ShowAlways {
+ get {
+ return show_always;
+ }
+
+ set {
+ if (show_always != value) {
+ show_always = value;
+ }
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Public Instance Methods
+ public bool CanExtend(object target) {
+ return false;
+ }
+
+ [Localizable (true)]
+ [DefaultValue ("")]
+ public string GetToolTip(Control control) {
+ string tooltip = (string)tooltip_strings[control];
+ if (tooltip == null)
+ return "";
+ return tooltip;
+ }
+
+ public void RemoveAll() {
+ tooltip_strings.Clear();
+ controls.Clear();
+ }
+
+ public void SetToolTip(Control control, string caption) {
+ tooltip_strings[control] = caption;
+
+ // no need for duplicates
+ if (!controls.Contains(control)) {
+ control.MouseEnter += new EventHandler(control_MouseEnter);
+ control.MouseMove += new MouseEventHandler(control_MouseMove);
+ control.MouseLeave += new EventHandler(control_MouseLeave);
+ controls.Add(control);
+ }
+
+ // if SetToolTip is called from a control and the mouse is currently over that control,
+ // make sure that tooltip_window.Text gets updated
+ if (caption != null && last_control == control) {
+ Size size = ThemeEngine.Current.ToolTipSize(tooltip_window, caption);
+ tooltip_window.Width = size.Width;
+ tooltip_window.Height = size.Height;
+ tooltip_window.Text = caption;
+ }
+ }
+
+ public override string ToString() {
+ return base.ToString() + " InitialDelay: " + initial_delay + ", ShowAlways: " + show_always;
+ }
+ #endregion // Public Instance Methods
+
+ #region Protected Instance Methods
+ protected override void Dispose(bool disposing) {
+ if (disposing) {
+ // Mop up the mess; or should we wait for the GC to kick in?
+ timer.Stop();
+ timer.Dispose();
+
+ // Not sure if we should clean up tooltip_window
+ tooltip_window.Dispose();
+
+ tooltip_strings.Clear();
+
+ controls.Clear();
+ }
+ }
+ #endregion // Protected Instance Methods
+
+ #region Private Methods
+ private void control_MouseEnter(object sender, EventArgs e) {
+ string text;
+
+ last_control = (Control)sender;
+
+ // Whatever we're displaying right now, we don't want it anymore
+ tooltip_window.Visible = false;
+ timer.Stop();
+
+ // if we're in the same control as before (how'd that happen?) or if we're not active, leave
+ if (!is_active || (active_control == (Control)sender)) {
+ return;
+ }
+
+ if (!show_always) {
+ if (((Control)sender).GetContainerControl().ActiveControl == null) {
+ return;
+ }
+ }
+
+ text = (string)tooltip_strings[sender];
+ if (text != null) {
+ Size size;
+
+ size = ThemeEngine.Current.ToolTipSize(tooltip_window, text);
+ tooltip_window.Width = size.Width;
+ tooltip_window.Height = size.Height;
+ tooltip_window.Text = text;
+
+ // FIXME - this needs to be improved; the tooltip will show up under the mouse, which is annoying; use cursor size once implemented
+
+ if ((Control.MousePosition.X+1+tooltip_window.Width) < display_size.Width) {
+ tooltip_window.Left = Control.MousePosition.X+1;
+ } else {
+ tooltip_window.Left = display_size.Width-tooltip_window.Width;
+ }
+
+ if ((Control.MousePosition.Y+tooltip_window.Height)<display_size.Height) {
+ tooltip_window.Top = Control.MousePosition.Y;
+ } else {
+ tooltip_window.Top = Control.MousePosition.Y-tooltip_window.Height;
+ }
+
+ // Since we get the mouse enter before the mouse leave, active_control will still be non-null if we were in a
+ // tooltip'd control; should prolly check on X11 too, and make sure that driver behaves the same way
+ if (active_control == null) {
+ timer.Interval = initial_delay;
+ } else {
+ timer.Interval = re_show_delay;
+ }
+
+ active_control = (Control)sender;
+
+ // We're all set, lets wake the timer (which will then make us visible)
+ timer.Enabled = true;
+ }
+ }
+
+ private void timer_Tick(object sender, EventArgs e) {
+ // Show our pretty selves
+ timer.Stop();
+
+ // FIXME - Should not need this check../
+ if (tooltip_window.IsDisposed) {
+ return;
+ }
+
+ if (!tooltip_window.Visible) {
+ // The initial_delay timer kicked in
+ tooltip_window.Visible = true;
+ timer.Interval = autopop_delay;
+ timer.Start();
+ } else {
+ // The autopop_delay timer happened
+ tooltip_window.Visible = false;
+ }
+ }
+
+
+ private bool MouseInControl(Control control) {
+ Point m;
+ Point c;
+ Size cw;
+
+ if (control == null) {
+ return false;
+ }
+
+ m = Control.MousePosition;
+ c = new Point(control.Bounds.X, control.Bounds.Y);
+ if (control.parent != null) {
+ c = control.parent.PointToScreen(c);
+ }
+ cw = control.ClientSize;
+
+ if (c.X<=m.X && m.X<(c.X+cw.Width) &&
+ c.Y<=m.Y && m.Y<(c.Y+cw.Height)) {
+ return true;
+ }
+ return false;
+ }
+
+ private void control_MouseLeave(object sender, EventArgs e) {
+ // In case the timer is still running, stop it
+ timer.Stop();
+
+ if (!MouseInControl(tooltip_window) && !MouseInControl(active_control)) {
+ active_control = null;
+ tooltip_window.Visible = false;
+ }
+
+ if (last_control == (Control)sender)
+ last_control = null;
+ }
+
+ private void control_MouseMove(object sender, MouseEventArgs e) {
+ // Restart the interval, the mouse moved
+ timer.Stop();
+ timer.Start();
+
+ }
+ #endregion // Private Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TrackBar.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TrackBar.cs
new file mode 100644
index 00000000000..48cb9818f0f
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TrackBar.cs
@@ -0,0 +1,694 @@
+//
+// System.Windows.Forms.TrackBar.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.
+//
+// Authors:
+// Jordi Mas i Hernandez, jordi@ximian.com
+//
+// TODO:
+// - The AutoSize functionality seems quite broken for vertical controls in .Net 1.1. Not
+// sure if we are implementing it the right way.
+//
+
+
+// NOT COMPLETE
+
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.Drawing.Drawing2D;
+using System.Timers;
+
+namespace System.Windows.Forms
+{
+ [Designer("System.Windows.Forms.Design.TrackBarDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+ [DefaultEvent ("Scroll")]
+ [DefaultProperty("Value")]
+ public class TrackBar : Control, ISupportInitialize
+ {
+ private int minimum;
+ private int maximum;
+ internal int tickFrequency;
+ private bool autosize;
+ private int position;
+ private int smallChange;
+ private int largeChange;
+ private Orientation orientation;
+ private TickStyle tickStyle;
+ private Rectangle thumb_pos = new Rectangle (); /* Current position and size of the thumb */
+ private Rectangle thumb_area = new Rectangle (); /* Area where the thumb can scroll */
+ internal bool thumb_pressed = false;
+ private System.Timers.Timer holdclick_timer = new System.Timers.Timer ();
+ internal int thumb_mouseclick;
+ private bool mouse_clickmove;
+
+ #region events
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler BackgroundImageChanged;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler Click;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler DoubleClick;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler FontChanged;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler ForeColorChanged;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler ImeModeChanged;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event PaintEventHandler Paint;
+
+ public event EventHandler Scroll;
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler TextChanged;
+ public event EventHandler ValueChanged;
+
+ #endregion // Events
+
+ public TrackBar ()
+ {
+ orientation = Orientation.Horizontal;
+ minimum = 0;
+ maximum = 10;
+ tickFrequency = 1;
+ autosize = true;
+ position = 0;
+ tickStyle = TickStyle.BottomRight;
+ smallChange = 1;
+ largeChange = 5;
+ mouse_clickmove = false;
+ MouseDown += new MouseEventHandler (OnMouseDownTB);
+ MouseUp += new MouseEventHandler (OnMouseUpTB);
+ MouseMove += new MouseEventHandler (OnMouseMoveTB);
+ holdclick_timer.Elapsed += new ElapsedEventHandler (OnFirstClickTimer);
+
+ SetStyle (ControlStyles.UserPaint | ControlStyles.Opaque, false);
+ }
+
+ #region Private & Internal Properties
+ internal Rectangle ThumbPos {
+ get {
+ return thumb_pos;
+ }
+
+ set {
+ thumb_pos = value;
+ }
+ }
+
+ internal Rectangle ThumbArea {
+ get {
+ return thumb_area;
+ }
+
+ set {
+ thumb_area = value;
+ }
+ }
+ #endregion // Private & Internal Properties
+
+ #region Public Properties
+
+ [DefaultValue (true)]
+ public bool AutoSize {
+ get { return autosize; }
+ set { autosize = value;}
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ [Browsable (false)]
+ public override Image BackgroundImage {
+ get { return base.BackgroundImage; }
+ set {
+ if (base.BackgroundImage == value)
+ return;
+
+ if (BackgroundImageChanged != null)
+ BackgroundImageChanged (this, EventArgs.Empty);
+
+ base.BackgroundImage = value;
+ }
+ }
+
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams createParams = base.CreateParams;
+ createParams.ClassName = XplatUI.DefaultClassName;
+
+ createParams.Style = (int) (
+ WindowStyles.WS_CHILD |
+ WindowStyles.WS_VISIBLE);
+
+ if (!is_enabled) {
+ createParams.Style |= (int)(WindowStyles.WS_DISABLED);
+ }
+
+ return createParams;
+ }
+ }
+
+ protected override ImeMode DefaultImeMode {
+ get {return ImeMode.Disable; }
+ }
+
+ protected override Size DefaultSize {
+ get { return ThemeEngine.Current.TrackBarDefaultSize; }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public override Font Font {
+ get { return base.Font; }
+ set { base.Font = value; }
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ [Browsable (false)]
+ public override Color ForeColor {
+ get { return base.ForeColor; }
+ set {
+ if (value == base.ForeColor)
+ return;
+
+ if (ForeColorChanged != null)
+ ForeColorChanged (this, EventArgs.Empty);
+
+ Refresh ();
+ }
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ [Browsable (false)]
+ public new ImeMode ImeMode {
+ get { return base.ImeMode; }
+ set {
+ if (value == base.ImeMode)
+ return;
+
+ base.ImeMode = value;
+ if (ImeModeChanged != null)
+ ImeModeChanged (this, EventArgs.Empty);
+ }
+ }
+
+ [DefaultValue (5)]
+ public int LargeChange
+ {
+ get { return largeChange; }
+ set {
+ if (value < 0)
+ throw new Exception( string.Format("Value '{0}' must be greater than or equal to 0.", value));
+
+ largeChange = value;
+ }
+ }
+
+ [DefaultValue (10)]
+ [RefreshProperties (RefreshProperties.All)]
+ public int Maximum {
+ get { return maximum; }
+ set {
+ if (maximum != value) {
+ maximum = value;
+
+ if (maximum < minimum)
+ minimum = maximum;
+
+ Refresh ();
+ }
+ }
+ }
+
+ [DefaultValue (0)]
+ [RefreshProperties (RefreshProperties.All)]
+ public int Minimum {
+ get { return minimum; }
+ set {
+
+ if (Minimum != value) {
+ minimum = value;
+
+ if (minimum > maximum)
+ maximum = minimum;
+
+ Refresh ();
+ }
+ }
+ }
+
+ [DefaultValue (Orientation.Horizontal)]
+ [Localizable (true)]
+ public Orientation Orientation {
+ get { return orientation; }
+ set {
+ if (!Enum.IsDefined (typeof (Orientation), value))
+ throw new InvalidEnumArgumentException (string.Format("Enum argument value '{0}' is not valid for Orientation", value));
+
+ /* Orientation can be changed once the control has been created */
+ if (orientation != value) {
+ orientation = value;
+
+ int old_witdh = Width;
+ Width = Height;
+ Height = old_witdh;
+ Refresh ();
+ }
+ }
+ }
+
+ [DefaultValue (1)]
+ public int SmallChange {
+ get { return smallChange;}
+ set {
+ if ( value < 0 )
+ throw new Exception( string.Format("Value '{0}' must be greater than or equal to 0.", value));
+
+ if (smallChange != value) {
+ smallChange = value;
+ }
+ }
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ [Bindable (false)]
+ [Browsable (false)]
+ public override string Text {
+ get { return base.Text; }
+ set {
+ if (value == base.Text)
+ return;
+
+ if (TextChanged != null)
+ TextChanged (this, EventArgs.Empty);
+
+ Refresh ();
+ }
+ }
+
+ [DefaultValue (1)]
+ public int TickFrequency {
+ get { return tickFrequency; }
+ set {
+ if ( value > 0 ) {
+ tickFrequency = value;
+ Refresh ();
+ }
+ }
+ }
+
+ [DefaultValue (TickStyle.BottomRight)]
+ public TickStyle TickStyle {
+ get { return tickStyle; }
+ set {
+ if (!Enum.IsDefined (typeof (TickStyle), value))
+ throw new InvalidEnumArgumentException (string.Format("Enum argument value '{0}' is not valid for TickStyle", value));
+
+ if (tickStyle != value) {
+ tickStyle = value;
+ Refresh ();
+ }
+ }
+ }
+
+ [DefaultValue (0)]
+ [Bindable (true)]
+ public int Value {
+ get { return position; }
+ set {
+ if (value < Minimum || value > Maximum)
+ throw new ArgumentException(
+ string.Format("'{0}' is not a valid value for 'Value'. 'Value' should be between 'Minimum' and 'Maximum'", value));
+
+ if (position != value) {
+ position = value;
+
+ if (ValueChanged != null)
+ ValueChanged (this, new EventArgs ());
+
+ Invalidate (thumb_area);
+ }
+ }
+ }
+
+ #endregion //Public Properties
+
+ #region Public Methods
+
+ public virtual void BeginInit ()
+ {
+
+ }
+
+ protected override void CreateHandle ()
+ {
+ base.CreateHandle ();
+ }
+
+
+ public virtual void EndInit ()
+ {
+
+ }
+
+ protected override bool IsInputKey (Keys keyData)
+ {
+ return base.IsInputKey (keyData);
+ }
+
+ protected override void OnBackColorChanged (EventArgs e)
+ {
+ base.OnBackColorChanged (e);
+ }
+
+ protected override void OnHandleCreated (EventArgs e)
+ {
+ base.OnHandleCreated (e);
+
+ if (AutoSize)
+ if (Orientation == Orientation.Horizontal)
+ Size = new Size (Width, 40);
+ else
+ Size = new Size (50, Height);
+
+ UpdatePos (Value, true);
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Advanced)]
+ protected override void OnMouseWheel (MouseEventArgs e)
+ {
+ base.OnMouseWheel (e);
+
+ if (!Enabled) return;
+
+ if (e.Delta > 0)
+ SmallDecrement ();
+ else
+ SmallIncrement ();
+ }
+
+ protected virtual void OnScroll (EventArgs e)
+ {
+ if (Scroll != null)
+ Scroll (this, e);
+ }
+
+ protected virtual void OnValueChanged (EventArgs e)
+ {
+ if (ValueChanged != null)
+ ValueChanged (this, e);
+ }
+
+ public void SetRange (int minValue, int maxValue)
+ {
+ Minimum = minValue;
+ Maximum = maxValue;
+ }
+
+ public override string ToString()
+ {
+ return string.Format("System.Windows.Forms.Trackbar, Minimum: {0}, Maximum: {1}, Value: {2}",
+ Minimum, Maximum, Value);
+ }
+
+
+ protected override void WndProc (ref Message m)
+ {
+ switch ((Msg) m.Msg) {
+
+ case Msg.WM_PAINT: {
+ PaintEventArgs paint_event;
+
+ paint_event = XplatUI.PaintEventStart (Handle, true);
+ OnPaintTB (paint_event);
+ XplatUI.PaintEventEnd (Handle, true);
+ return;
+ }
+
+ case Msg.WM_KEYDOWN:
+ OnKeyDownTB (new KeyEventArgs ((Keys)m.WParam.ToInt32 ()));
+ return;
+
+ case Msg.WM_ERASEBKGND:
+ m.Result = (IntPtr) 1; /* Disable background painting to avoid flickering */
+ return;
+
+ default:
+ break;
+ }
+
+ base.WndProc (ref m);
+ }
+
+ #endregion Public Methods
+
+ #region Private Methods
+
+ private void UpdatePos (int newPos, bool update_trumbpos)
+ {
+ if (newPos < minimum){
+ Value = minimum;
+ }
+ else {
+ if (newPos > maximum) {
+ Value = maximum;
+ }
+ else {
+ Value = newPos;
+ }
+ }
+ }
+
+ private void LargeIncrement ()
+ {
+ UpdatePos (position + LargeChange, true);
+ Invalidate (thumb_area);
+ OnScroll (new EventArgs ());
+ }
+
+ private void LargeDecrement ()
+ {
+ UpdatePos (position - LargeChange, true);
+ Invalidate (thumb_area);
+ OnScroll (new EventArgs ());
+ }
+
+ private void SmallIncrement ()
+ {
+ UpdatePos (position + SmallChange, true);
+ Invalidate (thumb_area);
+ OnScroll (new EventArgs ());
+ }
+
+ private void SmallDecrement ()
+ {
+ UpdatePos (position - SmallChange, true);
+ Invalidate (thumb_area);
+ OnScroll (new EventArgs ());
+ }
+
+ private void OnMouseUpTB (object sender, MouseEventArgs e)
+ {
+ if (!Enabled) return;
+
+ if (thumb_pressed == true || mouse_clickmove == true) {
+ thumb_pressed = false;
+ holdclick_timer.Enabled = false;
+ this.Capture = false;
+ Invalidate (thumb_area);
+ }
+ }
+
+ private void OnMouseDownTB (object sender, MouseEventArgs e)
+ {
+ if (!Enabled) return;
+
+ bool fire_timer = false;
+
+ Point point = new Point (e.X, e.Y);
+
+ if (orientation == Orientation.Horizontal) {
+
+ if (thumb_pos.Contains (point)) {
+ this.Capture = true;
+ thumb_pressed = true;
+ thumb_mouseclick = e.X;
+ Invalidate (thumb_area);
+ }
+ else {
+ if (ClientRectangle.Contains (point)) {
+ if (e.X > thumb_pos.X + thumb_pos.Width)
+ LargeIncrement ();
+ else
+ LargeDecrement ();
+
+ Invalidate (thumb_area);
+ fire_timer = true;
+ mouse_clickmove = true;
+ }
+ }
+ }
+ else {
+ if (thumb_pos.Contains (point)) {
+ this.Capture = true;
+ thumb_pressed = true;
+ thumb_mouseclick = e.Y;
+ Invalidate (thumb_area);
+
+ }
+ else {
+ if (ClientRectangle.Contains (point)) {
+ if (e.Y > thumb_pos.Y + thumb_pos.Height)
+ LargeIncrement ();
+ else
+ LargeDecrement ();
+
+ Invalidate (thumb_area);
+ fire_timer = true;
+ mouse_clickmove = true;
+ }
+ }
+ }
+
+ if (fire_timer) {
+ holdclick_timer.Interval = 300;
+ holdclick_timer.Enabled = true;
+ }
+ }
+
+ private void OnMouseMoveTB (object sender, MouseEventArgs e)
+ {
+ if (!Enabled) return;
+
+ /* Moving the thumb */
+ if (thumb_pressed) {
+
+ if (orientation == Orientation.Horizontal){
+ if (ClientRectangle.Contains (e.X, thumb_pos.Y))
+ thumb_mouseclick = e.X;
+ }
+ else {
+ if (ClientRectangle.Contains (thumb_pos.X, e.Y))
+ thumb_mouseclick = e.Y;
+ }
+
+ Invalidate (thumb_area);
+ OnScroll (new EventArgs ());
+ }
+ }
+
+ private void OnPaintTB (PaintEventArgs pevent)
+ {
+ if (Paint != null) {
+ Paint (this, pevent);
+ }
+ ThemeEngine.Current.DrawTrackBar (pevent.Graphics, pevent.ClipRectangle, this);
+ }
+
+ private void OnKeyDownTB (KeyEventArgs e)
+ {
+ switch (e.KeyCode) {
+
+ case Keys.Down:
+ case Keys.Right:
+ SmallIncrement ();
+ break;
+
+ case Keys.Up:
+ case Keys.Left:
+ SmallDecrement ();
+ break;
+
+ case Keys.PageUp:
+ LargeDecrement ();
+ break;
+
+ case Keys.PageDown:
+ LargeIncrement ();
+ break;
+
+ case Keys.Home:
+ Value = Minimum;
+ break;
+
+ case Keys.End:
+ Value = Maximum;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ private void OnFirstClickTimer (Object source, ElapsedEventArgs e)
+ {
+ Point pnt;
+ pnt = PointToClient (MousePosition);
+
+ if (thumb_area.Contains (pnt)) {
+ if (orientation == Orientation.Horizontal) {
+ if (pnt.X > thumb_pos.X + thumb_pos.Width)
+ LargeIncrement ();
+
+ if (pnt.X < thumb_pos.X)
+ LargeDecrement ();
+ }
+ else {
+ if (pnt.Y > thumb_pos.Y + thumb_pos.Height)
+ LargeIncrement ();
+
+ if (pnt.Y < thumb_pos.Y)
+ LargeDecrement ();
+ }
+
+ Invalidate (thumb_area);
+
+ }
+ }
+
+ protected override void SetBoundsCore (int x, int y,int width, int height, BoundsSpecified specified)
+ {
+ base.SetBoundsCore (x, y,width, height, specified);
+ }
+
+
+ #endregion // Private Methods
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNode.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNode.cs
new file mode 100644
index 00000000000..493fb73a638
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNode.cs
@@ -0,0 +1,678 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+// Kazuki Oikawa (kazuki@panicode.com)
+
+using System;
+using System.ComponentModel;
+using System.Drawing;
+using System.Runtime.Serialization;
+using System.Text;
+
+namespace System.Windows.Forms {
+ [TypeConverter(typeof(TreeNodeConverter))]
+ [Serializable]
+ public class TreeNode : MarshalByRefObject, ICloneable, ISerializable {
+ #region Fields
+ private TreeView tree_view;
+ internal TreeNode parent;
+
+ private string text;
+ private int image_index = -1;
+ private int selected_image_index = -1;
+ internal TreeNodeCollection nodes;
+
+ private bool is_expanded = false;
+ private Rectangle bounds = Rectangle.Empty;
+ private bool check;
+ private bool is_editing;
+ internal OwnerDrawPropertyBag prop_bag;
+
+ private object tag;
+
+ internal IntPtr handle;
+
+ #endregion // Fields
+
+ #region Internal Constructors
+ internal TreeNode (TreeView tree_view) : this ()
+ {
+ this.tree_view = tree_view;
+ is_expanded = true;
+ }
+
+ private TreeNode (SerializationInfo info, StreamingContext context) : this ()
+ {
+ Text = (string) info.GetValue ("Text", typeof (string));
+ prop_bag = (OwnerDrawPropertyBag) info.GetValue ("prop_bag", typeof (OwnerDrawPropertyBag));
+ image_index = (int) info.GetValue ("ImageIndex", typeof (int));
+ selected_image_index = (int) info.GetValue ("SelectedImageIndex", typeof (int));
+ tag = info.GetValue ("Tag", typeof (object));
+ check = (bool) info.GetValue ("Checked", typeof (bool));
+
+ int count = (int) info.GetValue ("NumberOfChildren", typeof (int));
+ for (int i = 0; i < count; i++) {
+ TreeNode node = (TreeNode) info.GetValue ("Child-" + i, typeof (TreeNode));
+ Nodes.Add (node);
+ }
+ }
+
+ #endregion // Internal Constructors
+
+ #region Public Constructors
+ public TreeNode ()
+ {
+ nodes = new TreeNodeCollection (this);
+ }
+
+ public TreeNode (string text) : this ()
+ {
+ Text = text;
+ }
+
+ public TreeNode (string text, TreeNode [] children) : this (text)
+ {
+ Nodes.AddRange (children);
+ }
+
+ public TreeNode (string text, int image_index, int selected_image_index) : this (text)
+ {
+ this.image_index = image_index;
+ this.selected_image_index = selected_image_index;
+ }
+
+ public TreeNode (string text, int image_index, int selected_image_index,
+ TreeNode [] children) : this (text, image_index, selected_image_index)
+ {
+ Nodes.AddRange (children);
+ }
+
+ #endregion // Public Constructors
+
+ #region ICloneable Members
+ public object Clone()
+ {
+ TreeNode tn = new TreeNode (text, image_index, selected_image_index);
+ if (nodes != null) {
+ foreach (TreeNode child in nodes)
+ tn.Nodes.Add ((TreeNode)child.Clone ());
+ }
+ tn.Tag = tag;
+ tn.Checked = Checked;
+ if (prop_bag != null)
+ tn.prop_bag = OwnerDrawPropertyBag.Copy (prop_bag);
+ return tn;
+ }
+
+ #endregion // ICloneable Members
+
+ #region ISerializable Members
+ void ISerializable.GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ info.AddValue ("Text", Text);
+ info.AddValue ("prop_bag", prop_bag, typeof (OwnerDrawPropertyBag));
+ info.AddValue ("ImageIndex", ImageIndex);
+ info.AddValue ("SelectedImageIndex", SelectedImageIndex);
+ info.AddValue ("Tag", Tag);
+ info.AddValue ("Checked", Checked);
+
+ info.AddValue ("NumberOfChildren", Nodes.Count);
+ for (int i = 0; i < Nodes.Count; i++)
+ info.AddValue ("Child-" + i, Nodes [i], typeof (TreeNode));
+ }
+ #endregion // ISerializable Members
+
+ #region Public Instance Properties
+ public Color BackColor {
+ get {
+ if (prop_bag != null)
+ return prop_bag.BackColor;
+ if (TreeView != null)
+ return TreeView.BackColor;
+ return Color.Empty;
+ }
+ set {
+ if (prop_bag == null)
+ prop_bag = new OwnerDrawPropertyBag ();
+ prop_bag.BackColor = value;
+
+ TreeView tree_view = TreeView;
+ if (tree_view != null)
+ tree_view.UpdateNode (this);
+ }
+ }
+
+ public Rectangle Bounds {
+ get { return bounds; }
+ }
+
+ public bool Checked {
+ get { return check; }
+ set {
+ if (check == value)
+ return;
+ check = value;
+
+ if (TreeView != null)
+ TreeView.UpdateNode (this);
+ }
+ }
+
+ public TreeNode FirstNode {
+ get {
+ if (nodes.Count > 0)
+ return nodes [0];
+ return null;
+ }
+ }
+
+ public Color ForeColor {
+ get {
+ if (prop_bag != null)
+ return prop_bag.ForeColor;
+ if (TreeView != null)
+ return TreeView.ForeColor;
+ return Color.Empty;
+ }
+ set {
+ if (prop_bag == null)
+ prop_bag = new OwnerDrawPropertyBag ();
+ prop_bag.ForeColor = value;
+
+ TreeView tree_view = TreeView;
+ if (tree_view != null)
+ tree_view.UpdateNode (this);
+ }
+ }
+
+ public string FullPath {
+ get {
+ if (TreeView == null)
+ throw new Exception ("No TreeView associated");
+
+ StringBuilder builder = new StringBuilder ();
+ BuildFullPath (builder);
+ return builder.ToString ();
+ }
+ }
+
+ [Localizable(true)]
+ public int ImageIndex {
+ get { return image_index; }
+ set {
+ if (image_index == value)
+ return;
+ image_index = value;
+ TreeView tree = TreeView;
+ if (tree != null)
+ tree.UpdateNode (this);
+ }
+ }
+
+ public bool IsEditing {
+ get { return is_editing; }
+ }
+
+ public bool IsExpanded {
+ get { return is_expanded; }
+ }
+
+ public bool IsSelected {
+ get {
+ if (TreeView == null)
+ return false;
+ return TreeView.SelectedNode == this;
+ }
+ }
+
+ public bool IsVisible {
+ get {
+ if (TreeView == null)
+ return false;
+
+ if (bounds.Y < 0 && bounds.Y > TreeView.ClientRectangle.Height)
+ return false;
+
+ TreeNode parent = Parent;
+ while (parent != null) {
+ if (!parent.IsExpanded)
+ return false;
+ parent = parent.Parent;
+ }
+ return true;
+ }
+ }
+
+ public TreeNode LastNode {
+ get {
+ return (nodes == null || nodes.Count == 0) ? null : nodes [nodes.Count - 1];
+ }
+ }
+
+ public TreeNode NextNode {
+ get {
+ if (parent == null)
+ return null;
+ int index = Index;
+ if (parent.Nodes.Count > index + 1)
+ return parent.Nodes [index + 1];
+ return null;
+ }
+ }
+
+ public TreeNode NextVisibleNode {
+ get {
+ OpenTreeNodeEnumerator o = new OpenTreeNodeEnumerator (this);
+ if (!o.MoveNext ())
+ return null;
+ TreeNode c = (TreeNode) o.Current;
+ if (!c.IsInClippingRect)
+ return null;
+ return c;
+ }
+ }
+
+ [Localizable(true)]
+ public Font NodeFont {
+ get {
+ if (prop_bag != null)
+ return prop_bag.Font;
+ if (TreeView != null)
+ return TreeView.Font;
+ return null;
+ }
+ set {
+ if (prop_bag == null)
+ prop_bag = new OwnerDrawPropertyBag ();
+ prop_bag.Font = value;
+ InvalidateWidth ();
+ }
+ }
+
+ [ListBindable(false)]
+ public TreeNodeCollection Nodes {
+ get {
+ if (nodes == null)
+ nodes = new TreeNodeCollection (this);
+ return nodes;
+ }
+ }
+
+ public TreeNode Parent {
+ get {
+ TreeView tree_view = TreeView;
+ if (tree_view != null && tree_view.root_node == parent)
+ return null;
+ return parent;
+ }
+ }
+
+ public TreeNode PrevNode {
+ get {
+ if (parent == null)
+ return null;
+ int index = Index;
+ if (index <= 0 || index > parent.Nodes.Count)
+ return null;
+ return parent.Nodes [index - 1];
+ }
+ }
+
+ public TreeNode PrevVisibleNode {
+ get {
+ OpenTreeNodeEnumerator o = new OpenTreeNodeEnumerator (this);
+ if (!o.MovePrevious ())
+ return null;
+ TreeNode c = (TreeNode) o.Current;
+ if (!c.IsInClippingRect)
+ return null;
+ return c;
+ }
+ }
+
+ [Localizable(true)]
+ public int SelectedImageIndex {
+ get { return selected_image_index; }
+ set { selected_image_index = value; }
+ }
+
+ [Bindable(true)]
+ [Localizable(false)]
+ [TypeConverter(typeof(System.ComponentModel.StringConverter))]
+ [DefaultValue(null)]
+ public object Tag {
+ get { return tag; }
+ set { tag = value; }
+ }
+
+ [Localizable(true)]
+ public string Text {
+ get {
+ if (text == null)
+ return String.Empty;
+ return text;
+ }
+ set {
+ if (text == value)
+ return;
+ text = value;
+ bounds.Width = 0;
+ }
+ }
+
+ public TreeView TreeView {
+ get {
+ if (tree_view != null)
+ return tree_view;
+ TreeNode walk = parent;
+ while (walk != null) {
+ if (walk.TreeView != null)
+ break;
+ walk = walk.parent;
+ }
+ if (walk == null)
+ return null;
+ return walk.TreeView;
+ }
+ }
+
+ public IntPtr Handle {
+ get {
+ // MS throws a NullReferenceException if the TreeView isn't set...
+ if (handle == IntPtr.Zero && TreeView != null)
+ handle = TreeView.CreateNodeHandle ();
+ return handle;
+ }
+ }
+
+ #endregion // Public Instance Properties
+
+
+ public static TreeNode FromHandle (TreeView tree, IntPtr handle)
+ {
+ if (handle == IntPtr.Zero)
+ return null;
+ // No arg checking on MS it just throws a NullRef if treeview is null
+ return tree.NodeFromHandle (handle);
+ }
+
+ #region Public Instance Methods
+ public void BeginEdit () {
+ is_editing = true;
+ }
+
+ public void Collapse () {
+ Collapse(false);
+ }
+
+ public void EndEdit (bool cancel) {
+ is_editing = false;
+ if (!cancel && TreeView != null)
+ Text = TreeView.LabelEditText;
+ }
+
+ public void Expand () {
+ Expand(false);
+ }
+
+ public void ExpandAll () {
+ ExpandRecursive (this);
+ if(TreeView != null)
+ TreeView.UpdateNode (TreeView.root_node);
+ }
+
+ public void EnsureVisible ()
+ {
+ if (TreeView == null)
+ return;
+
+ if (this.Parent != null)
+ ExpandParentRecursive (this.Parent);
+
+ if (bounds.Y < 0) {
+ TreeView.SetTop (this);
+ } else if (bounds.Bottom > TreeView.ViewportRectangle.Bottom) {
+ TreeView.SetBottom (this);
+ }
+ }
+
+ public int GetNodeCount (bool include_subtrees) {
+ if (!include_subtrees)
+ return Nodes.Count;
+
+ int count = 0;
+ GetNodeCountRecursive (this, ref count);
+
+ return count;
+ }
+
+ public void Remove () {
+ if (parent == null)
+ return;
+ int index = Index;
+ parent.Nodes.RemoveAt (index);
+ }
+
+ public void Toggle () {
+ if (is_expanded)
+ Collapse ();
+ else
+ Expand ();
+ }
+
+ public override String ToString () {
+ return String.Concat ("TreeNode: ", Text);
+ }
+
+ #endregion // Public Instance Methods
+
+ #region Internal & Private Methods and Properties
+
+ internal bool IsRoot {
+ get {
+ TreeView tree_view = TreeView;
+ if (tree_view == null)
+ return false;
+ if (tree_view.root_node == this)
+ return true;
+ return false;
+ }
+ }
+
+ bool BuildFullPath (StringBuilder path)
+ {
+ if (parent == null)
+ return false;
+
+ if (parent.BuildFullPath (path))
+ path.Append (TreeView.PathSeparator);
+
+ path.Append (text);
+ return true;
+ }
+
+ public int Index {
+ get {
+ if (parent == null)
+ return 0;
+ return parent.Nodes.IndexOf (this);
+ }
+ }
+
+ private void Expand (bool byInternal)
+ {
+ if (is_expanded)
+ return;
+ bool cancel = false;
+ if (TreeView != null) {
+ TreeViewCancelEventArgs e = new TreeViewCancelEventArgs (this, false, TreeViewAction.Expand);
+ TreeView.OnBeforeExpand (e);
+ cancel = e.Cancel;
+ }
+
+ if (!cancel) {
+ is_expanded = true;
+ if (TreeView != null)
+ TreeView.OnAfterExpand (new TreeViewEventArgs (this));
+ if (IsVisible && TreeView != null)
+ TreeView.UpdateBelow (this);
+ }
+ }
+
+ private void Collapse (bool byInternal)
+ {
+ if (!is_expanded)
+ return;
+
+ if (IsRoot)
+ return;
+
+ bool cancel = false;
+ if (TreeView != null) {
+ TreeViewCancelEventArgs e = new TreeViewCancelEventArgs (this, false, TreeViewAction.Collapse);
+ TreeView.OnBeforeCollapse (e);
+ cancel = e.Cancel;
+ }
+
+ if (!cancel) {
+ is_expanded = false;
+ if (TreeView != null)
+ TreeView.OnAfterCollapse (new TreeViewEventArgs (this));
+ if (IsVisible && TreeView != null)
+ TreeView.UpdateBelow (this);
+ if(!byInternal && TreeView != null && HasFocusInChildren ())
+ TreeView.SelectedNode = this;
+ }
+ }
+
+ private bool HasFocusInChildren()
+ {
+ if(TreeView == null) return false;
+ foreach(TreeNode node in nodes) {
+ if(node == TreeView.SelectedNode) return true;
+ if(node.HasFocusInChildren())
+ return true;
+ }
+ return false;
+ }
+
+ private void ExpandRecursive (TreeNode node)
+ {
+ node.Expand (true);
+ foreach (TreeNode child in node.Nodes) {
+ ExpandRecursive (child);
+ }
+ }
+
+ private void ExpandParentRecursive (TreeNode node)
+ {
+ node.Expand (true);
+ if (node.Parent != null)
+ ExpandParentRecursive (node.Parent);
+ }
+
+ internal void CollapseAll ()
+ {
+ CollapseRecursive (this);
+ }
+
+ internal void CollapseAllUncheck ()
+ {
+ CollapseUncheckRecursive (this);
+ }
+
+ private void CollapseRecursive (TreeNode node)
+ {
+ node.Collapse ();
+ foreach (TreeNode child in node.Nodes) {
+ CollapseRecursive (child);
+ }
+ }
+
+ private void CollapseUncheckRecursive (TreeNode node)
+ {
+ node.Collapse ();
+ node.Checked = false;
+ foreach (TreeNode child in node.Nodes) {
+ CollapseUncheckRecursive (child);
+ }
+ }
+
+ internal void SetNodes (TreeNodeCollection nodes)
+ {
+ this.nodes = nodes;
+ }
+
+ private void GetNodeCountRecursive (TreeNode node, ref int count)
+ {
+ count += node.Nodes.Count;
+ foreach (TreeNode child in node.Nodes) {
+ GetNodeCountRecursive (child, ref count);
+ }
+ }
+
+ internal bool NeedsWidth {
+ get { return bounds.Width == 0; }
+ }
+
+ internal void InvalidateWidth ()
+ {
+ bounds.Width = 0;
+ }
+
+ internal void SetWidth (int width)
+ {
+ bounds.Width = width;
+ }
+
+ internal void SetHeight (int height)
+ {
+ bounds.Height = height;
+ }
+
+ internal void SetPosition (int x, int y)
+ {
+ bounds.X = x;
+ bounds.Y = y;
+ }
+
+ internal void SetParent (TreeNode parent)
+ {
+ this.parent = parent;
+ }
+
+ private bool IsInClippingRect
+ {
+ get {
+ if (TreeView == null)
+ return false;
+ if (bounds.Y < 0 && bounds.Y > TreeView.ClientRectangle.Height)
+ return false;
+ return true;
+ }
+ }
+ #endregion // Internal & Private Methods and Properties
+
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNodeCollection.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNodeCollection.cs
new file mode 100644
index 00000000000..89b3bf75f1c
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNodeCollection.cs
@@ -0,0 +1,371 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+// TODO: Sorting
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Globalization;
+
+namespace System.Windows.Forms {
+ [Editor("System.Windows.Forms.Design.TreeNodeCollectionEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
+ public class TreeNodeCollection : IList, ICollection, IEnumerable {
+
+ private static readonly int OrigSize = 50;
+
+ private TreeNode owner;
+ private int count;
+ private TreeNode [] nodes;
+
+ private TreeNodeCollection ()
+ {
+ }
+
+ internal TreeNodeCollection (TreeNode owner)
+ {
+ this.owner = owner;
+ nodes = new TreeNode [OrigSize];
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public virtual int Count {
+ get { return count; }
+ }
+
+ public virtual bool IsReadOnly {
+ get { return false; }
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return false; }
+ }
+
+ object ICollection.SyncRoot {
+ get { return this; }
+ }
+
+ bool IList.IsFixedSize {
+ get { return false; }
+ }
+
+ object IList.this [int index] {
+ get {
+ if (index < 0 || index >= Count)
+ throw new ArgumentOutOfRangeException ("index");
+ return nodes [index];
+ }
+ set {
+ if (index < 0 || index >= Count)
+ throw new ArgumentOutOfRangeException ("index");
+ TreeNode node = (TreeNode) value;
+ node.parent = owner;
+ nodes [index] = node;
+ }
+ }
+
+ public virtual TreeNode this [int index] {
+ get {
+ if (index < 0 || index >= Count)
+ throw new ArgumentOutOfRangeException ("index");
+ return nodes [index];
+ }
+ set {
+ if (index < 0 || index >= Count)
+ throw new ArgumentOutOfRangeException ("index");
+ value.parent = owner;
+ nodes [index] = value;
+ }
+ }
+
+ public virtual TreeNode Add (string text)
+ {
+ TreeNode res = new TreeNode (text);
+ Add (res);
+ return res;
+ }
+
+ public virtual int Add (TreeNode node)
+ {
+ if (node == null)
+ throw new ArgumentNullException("node");
+
+ // Remove it from any old parents
+ node.Remove ();
+
+ int res;
+ TreeView tree_view = null;
+ if (owner != null)
+ tree_view = owner.TreeView;
+ if (tree_view != null && tree_view.Sorted) {
+ res = AddSorted (node);
+ } else {
+ node.parent = owner;
+ if (count >= nodes.Length)
+ Grow ();
+ nodes [count++] = node;
+ res = count;
+ }
+
+ if (owner != null && tree_view != null && (owner.IsExpanded || owner.IsRoot)) {
+ // XXX: Need to ensure the boxes for the nodes have been created
+ tree_view.UpdateBelow (owner);
+ } else if (owner != null && tree_view != null) {
+ tree_view.UpdateBelow (owner);
+ }
+
+ return res;
+ }
+
+ public virtual void AddRange (TreeNode [] nodes)
+ {
+ if (nodes == null)
+ throw new ArgumentNullException("node");
+
+ // We can't just use Array.Copy because the nodes also
+ // need to have some properties set when they are added.
+ for (int i = 0; i < nodes.Length; i++)
+ Add (nodes [i]);
+ }
+
+ public virtual void Clear ()
+ {
+ for (int i = 0; i < count; i++)
+ RemoveAt (i, false);
+
+ Array.Clear (nodes, 0, count);
+ count = 0;
+
+ TreeView tree_view = null;
+ if (owner != null) {
+ tree_view = owner.TreeView;
+ if (tree_view != null)
+ tree_view.UpdateBelow (owner);
+ }
+ }
+
+ public bool Contains (TreeNode node)
+ {
+ return (Array.BinarySearch (nodes, node) > 0);
+ }
+
+ public virtual void CopyTo (Array dest, int index)
+ {
+ nodes.CopyTo (dest, index);
+ }
+
+ public virtual IEnumerator GetEnumerator ()
+ {
+ return new TreeNodeEnumerator (this);
+ }
+
+ public int IndexOf (TreeNode node)
+ {
+ return Array.IndexOf (nodes, node);
+ }
+
+ public virtual void Insert (int index, TreeNode node)
+ {
+ node.parent = owner;
+
+ if (count >= nodes.Length)
+ Grow ();
+
+ Array.Copy (nodes, index, nodes, index + 1, count - index);
+ nodes [index] = node;
+ count++;
+ }
+
+ public void Remove (TreeNode node)
+ {
+ int index = IndexOf (node);
+ if (index > 0)
+ RemoveAt (index);
+ }
+
+ public virtual void RemoveAt (int index)
+ {
+ RemoveAt (index, true);
+ }
+
+ private void RemoveAt (int index, bool update)
+ {
+ TreeNode removed = nodes [index];
+
+ Array.Copy (nodes, index + 1, nodes, index, count - index);
+ count--;
+ if (nodes.Length > OrigSize && nodes.Length > (count * 2))
+ Shrink ();
+
+ TreeView tree_view = null;
+ if (owner != null)
+ tree_view = owner.TreeView;
+ if (tree_view != null && removed == tree_view.top_node) {
+ OpenTreeNodeEnumerator oe = new OpenTreeNodeEnumerator (removed);
+ if (oe.MoveNext () && oe.MoveNext ())
+ tree_view.top_node = oe.CurrentNode;
+ else
+ tree_view.top_node = null;
+ }
+
+ TreeNode parent = removed.parent;
+ removed.parent = null;
+
+ if (tree_view != null)
+ tree_view.UpdateBelow (parent);
+ }
+
+ int IList.Add (object node)
+ {
+ return Add ((TreeNode) node);
+ }
+
+ bool IList.Contains (object node)
+ {
+ return Contains ((TreeNode) node);
+ }
+
+ int IList.IndexOf (object node)
+ {
+ return IndexOf ((TreeNode) node);
+ }
+
+ void IList.Insert (int index, object node)
+ {
+ Insert (index, (TreeNode) node);
+ }
+
+ void IList.Remove (object node)
+ {
+ Remove ((TreeNode) node);
+ }
+
+ private int AddSorted (TreeNode node)
+ {
+ if (count >= nodes.Length)
+ Grow ();
+
+ CompareInfo compare = Application.CurrentCulture.CompareInfo;
+ int pos = 0;
+ bool found = false;
+ for (int i = 0; i < count; i++) {
+ pos = i;
+ int comp = compare.Compare (node.Text, nodes [i].Text);
+ if (comp < 0) {
+ found = true;
+ break;
+ }
+ }
+
+ // Stick it at the end
+ if (!found)
+ pos = count;
+
+ // Move the nodes up and adjust their indices
+ for (int i = count - 1; i >= pos; i--) {
+ nodes [i + 1] = nodes [i];
+ }
+ count++;
+ nodes [pos] = node;
+
+ node.parent = owner;
+ return count;
+ }
+
+ // Would be nice to do this without running through the collection twice
+ internal void Sort () {
+
+ Array.Sort (nodes, 0, count, new TreeNodeComparer (Application.CurrentCulture.CompareInfo));
+
+ for (int i = 0; i < count; i++) {
+ nodes [i].Nodes.Sort ();
+ }
+ }
+
+ private void Grow ()
+ {
+ TreeNode [] nn = new TreeNode [nodes.Length + 50];
+ Array.Copy (nodes, nn, nodes.Length);
+ nodes = nn;
+ }
+
+ private void Shrink ()
+ {
+ int len = (count > OrigSize ? count : OrigSize);
+ TreeNode [] nn = new TreeNode [len];
+ Array.Copy (nodes, nn, count);
+ nodes = nn;
+ }
+
+
+ internal class TreeNodeEnumerator : IEnumerator {
+
+ private TreeNodeCollection collection;
+ private int index = -1;
+
+ public TreeNodeEnumerator (TreeNodeCollection collection)
+ {
+ this.collection = collection;
+ }
+
+ public object Current {
+ get { return collection [index]; }
+ }
+
+ public bool MoveNext ()
+ {
+ if (index + 1 >= collection.Count)
+ return false;
+ index++;
+ return true;
+ }
+
+ public void Reset ()
+ {
+ index = 0;
+ }
+ }
+
+ private class TreeNodeComparer : IComparer {
+
+ private CompareInfo compare;
+
+ public TreeNodeComparer (CompareInfo compare)
+ {
+ this.compare = compare;
+ }
+
+ public int Compare (object x, object y)
+ {
+ TreeNode l = (TreeNode) x;
+ TreeNode r = (TreeNode) y;
+ int res = compare.Compare (l.Text, r.Text);
+
+ return (res == 0 ? l.Index - r.Index : res);
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNodeConverter.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNodeConverter.cs
new file mode 100644
index 00000000000..a0a4c93c918
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNodeConverter.cs
@@ -0,0 +1,54 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// NOT COMPLETE
+
+using System.ComponentModel;
+using System.Globalization;
+
+namespace System.Windows.Forms {
+ public class TreeNodeConverter : TypeConverter {
+
+ #region Public Instance Methods
+ public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
+ {
+ if (destinationType == typeof (string))
+ return true;
+ return base.CanConvertTo (context, destinationType);
+ }
+
+ public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture,
+ object value, Type destinationType)
+ {
+ // Regardless of the type of object passed in this does a ToString
+ if (destinationType == typeof (string) && value != null)
+ return value.ToString ();
+ return base.ConvertTo (context, culture, value, destinationType);
+ }
+
+ #endregion // Public Instance Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeView.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeView.cs
new file mode 100644
index 00000000000..d269121b4db
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeView.cs
@@ -0,0 +1,1575 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+// Kazuki Oikawa (kazuki@panicode.com)
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ [DefaultProperty("Nodes")]
+ [DefaultEvent("AfterSelect")]
+ [Designer("System.Windows.Forms.Design.TreeViewDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+ public class TreeView : Control {
+ #region Fields
+ private string path_separator = "\\";
+ private int item_height = -1;
+ private bool sorted;
+ internal TreeNode top_node;
+ internal TreeNode root_node;
+ internal bool nodes_added;
+ private TreeNodeCollection nodes;
+
+ private TreeNode selected_node = null;
+ private TreeNode focused_node = null;
+ private bool select_mmove = false;
+
+ private ImageList image_list;
+ private int image_index = -1;
+ private int selected_image_index = -1;
+
+ private bool full_row_select;
+ private bool hot_tracking;
+ private int indent = 19;
+
+ private TextBox edit_text_box;
+ private TreeNode edit_node;
+
+ private bool checkboxes;
+ private bool label_edit;
+ private bool scrollable;
+ private bool show_lines = true;
+ private bool show_root_lines = true;
+ private bool show_plus_minus = true;
+ private bool hide_selection = true;
+
+ private bool add_hscroll;
+ private bool add_vscroll;
+ private int max_node_width;
+ private VScrollBar vbar;
+ private int skipped_nodes;
+ private HScrollBar hbar;
+ private int hbar_offset;
+ private int used_height;
+ private bool update_node_bounds;
+
+ private int update_stack;
+ private bool update_needed;
+
+ private TreeViewEventHandler on_after_check;
+ private TreeViewEventHandler on_after_collapse;
+ private TreeViewEventHandler on_after_expand;
+ private NodeLabelEditEventHandler on_after_label_edit;
+ private TreeViewEventHandler on_after_select;
+ private TreeViewCancelEventHandler on_before_check;
+ private TreeViewCancelEventHandler on_before_collapse;
+ private TreeViewCancelEventHandler on_before_expand;
+ private NodeLabelEditEventHandler on_before_label_edit;
+ private TreeViewCancelEventHandler on_before_select;
+
+ private Pen dash;
+ private StringFormat string_format;
+ private int open_node_count = -1;
+
+ private int drag_begin_x = 0;
+ private int drag_begin_y = 0;
+ private long handle_count = 1;
+
+ #endregion // Fields
+
+ #region Public Constructors
+ public TreeView ()
+ {
+ base.background_color = ThemeEngine.Current.ColorWindow;
+ base.foreground_color = ThemeEngine.Current.ColorWindowText;
+
+ root_node = new TreeNode (this);
+ root_node.Text = "ROOT NODE";
+ nodes = new TreeNodeCollection (root_node);
+ root_node.SetNodes (nodes);
+
+ MouseDown += new MouseEventHandler (MouseDownHandler);
+ MouseUp += new MouseEventHandler(MouseUpHandler);
+ MouseMove += new MouseEventHandler(MouseMoveHandler);
+ SizeChanged += new EventHandler (SizeChangedHandler);
+ FontChanged += new EventHandler (FontChangedHandler);
+ LostFocus += new EventHandler (FocusChangedHandler);
+ GotFocus += new EventHandler (FocusChangedHandler);
+ MouseWheel += new MouseEventHandler(MouseWheelHandler);
+
+ SetStyle (ControlStyles.UserPaint | ControlStyles.StandardClick, false);
+
+ string_format = new StringFormat ();
+ string_format.LineAlignment = StringAlignment.Center;
+ string_format.Alignment = StringAlignment.Center;
+ }
+
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public override Color BackColor {
+ get { return base.BackColor;}
+ set { base.BackColor = value; }
+ }
+
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override Image BackgroundImage {
+ get { return base.BackgroundImage; }
+ set { base.BackgroundImage = value; }
+ }
+
+ [DefaultValue(BorderStyle.Fixed3D)]
+ [DispId(-504)]
+ public BorderStyle BorderStyle {
+ get { return InternalBorderStyle; }
+ set { InternalBorderStyle = value; }
+ }
+
+ [DefaultValue(false)]
+ public bool CheckBoxes {
+ get { return checkboxes; }
+ set {
+ if (value == checkboxes)
+ return;
+ checkboxes = value;
+
+ // Match a "bug" in the MS implementation where disabling checkboxes
+ // collapses the entire tree, but enabling them does not affect the
+ // state of the tree.
+ if (!checkboxes)
+ root_node.CollapseAllUncheck ();
+
+ Refresh ();
+ }
+ }
+
+ public override Color ForeColor {
+ get { return base.ForeColor; }
+ set { base.ForeColor = value; }
+ }
+ [DefaultValue(false)]
+ public bool FullRowSelect {
+ get { return full_row_select; }
+ set {
+ if (value == full_row_select)
+ return;
+ full_row_select = value;
+ Refresh ();
+ }
+ }
+ [DefaultValue(true)]
+ public bool HideSelection {
+ get { return hide_selection; }
+ set {
+ if (hide_selection == value)
+ return;
+ hide_selection = value;
+ this.Refresh ();
+ }
+ }
+
+ [DefaultValue(false)]
+ public bool HotTracking {
+ get { return hot_tracking; }
+ set { hot_tracking = value; }
+ }
+
+ [DefaultValue(0)]
+ [Editor("System.Windows.Forms.Design.ImageIndexEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
+ [Localizable(true)]
+ [TypeConverter(typeof(TreeViewImageIndexConverter))]
+ public int ImageIndex {
+ get { return image_index; }
+ set {
+ if (value < -1) {
+ throw new ArgumentException ("'" + value + "' is not a valid value for 'value'. " +
+ "'value' must be greater than or equal to 0.");
+ }
+ if (image_index == value)
+ return;
+ image_index = value;
+ Refresh ();
+ }
+ }
+
+ [DefaultValue(null)]
+ public ImageList ImageList {
+ get { return image_list; }
+ set {
+ image_list = value;
+ Refresh ();
+ }
+ }
+
+ [Localizable(true)]
+ public int Indent {
+ get { return indent; }
+ set {
+ if (indent == value)
+ return;
+ if (value > 32000) {
+ throw new ArgumentException ("'" + value + "' is not a valid value for 'Indent'. " +
+ "'Indent' must be less than or equal to 32000");
+ }
+ if (value < 0) {
+ throw new ArgumentException ("'" + value + "' is not a valid value for 'Indent'. " +
+ "'Indent' must be greater than or equal to 0.");
+ }
+ indent = value;
+ Refresh ();
+ }
+ }
+
+ [Localizable(true)]
+ public int ItemHeight {
+ get {
+ if (item_height == -1)
+ return FontHeight + 3;
+ return item_height;
+ }
+ set {
+ if (value == item_height)
+ return;
+ item_height = value;
+ Refresh ();
+ }
+ }
+
+ [DefaultValue(false)]
+ public bool LabelEdit {
+ get { return label_edit; }
+ set { label_edit = value; }
+ }
+
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
+ [MergableProperty(false)]
+ [Localizable(true)]
+ public TreeNodeCollection Nodes {
+ get { return nodes; }
+ }
+
+ [DefaultValue("\\")]
+ public string PathSeparator {
+ get { return path_separator; }
+ set { path_separator = value; }
+ }
+
+ [DefaultValue(true)]
+ public bool Scrollable {
+ get { return scrollable; }
+ set {
+ if (scrollable == value)
+ return;
+ scrollable = value;
+ }
+ }
+
+ [Editor("System.Windows.Forms.Design.ImageIndexEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
+ [TypeConverter(typeof(TreeViewImageIndexConverter))]
+ [Localizable(true)]
+ [DefaultValue(0)]
+ public int SelectedImageIndex {
+ get { return selected_image_index; }
+ set {
+ if (value < -1) {
+ throw new ArgumentException ("'" + value + "' is not a valid value for 'value'. " +
+ "'value' must be greater than or equal to 0.");
+ }
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public TreeNode SelectedNode {
+ get { return selected_node; }
+ set {
+ if (selected_node == value)
+ return;
+
+ TreeViewCancelEventArgs e = new TreeViewCancelEventArgs (value, false, TreeViewAction.Unknown);
+ OnBeforeSelect (e);
+
+ if (e.Cancel)
+ return;
+
+ Rectangle invalid = Rectangle.Empty;
+
+ if (selected_node != null) {
+ invalid = Bloat (selected_node.Bounds);
+ }
+ if (focused_node != null) {
+ invalid = Rectangle.Union (invalid,
+ Bloat (focused_node.Bounds));
+ }
+
+ if (value != null)
+ invalid = Rectangle.Union (invalid, Bloat (value.Bounds));
+
+ selected_node = value;
+ focused_node = value;
+
+ if (full_row_select) {
+ invalid.X = 0;
+ invalid.Width = ViewportRectangle.Width;
+ }
+
+ if (invalid != Rectangle.Empty)
+ Invalidate (invalid);
+
+ // We ensure its visible after we update because
+ // scrolling is used for insure visible
+ if (selected_node != null)
+ selected_node.EnsureVisible ();
+
+ OnAfterSelect (new TreeViewEventArgs (value, TreeViewAction.Unknown));
+ }
+ }
+
+ private Rectangle Bloat (Rectangle rect)
+ {
+ rect.Y--;
+ rect.X--;
+ rect.Height += 2;
+ rect.Width += 2;
+ return rect;
+ }
+
+ [DefaultValue(true)]
+ public bool ShowLines {
+ get { return show_lines; }
+ set {
+ if (show_lines == value)
+ return;
+ show_lines = value;
+ Refresh ();
+ }
+ }
+
+ [DefaultValue(true)]
+ public bool ShowPlusMinus {
+ get { return show_plus_minus; }
+ set {
+ if (show_plus_minus == value)
+ return;
+ show_plus_minus = value;
+ Refresh ();
+ }
+ }
+
+ [DefaultValue(true)]
+ public bool ShowRootLines {
+ get { return show_root_lines; }
+ set {
+ if (show_root_lines == value)
+ return;
+ show_root_lines = value;
+ Refresh ();
+ }
+ }
+
+ [DefaultValue(false)]
+ public bool Sorted {
+ get { return sorted; }
+ set {
+ if (sorted != value)
+ sorted = value;
+ if (sorted) {
+ Nodes.Sort ();
+ top_node = null;
+ Refresh ();
+ }
+ }
+ }
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [Bindable(false)]
+ public override string Text {
+ get { return base.Text; }
+ set { base.Text = value; }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public TreeNode TopNode {
+ get { return top_node; }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public int VisibleCount {
+ get {
+ return ClientRectangle.Height / ItemHeight;
+ }
+ }
+
+ #endregion // Public Instance Properties
+
+ #region Protected Instance Properties
+ protected override CreateParams CreateParams {
+ get {
+ CreateParams cp = base.CreateParams;
+ return cp;
+ }
+ }
+
+ protected override Size DefaultSize {
+ get { return new Size (121, 97); }
+ }
+
+ #endregion // Protected Instance Properties
+
+ #region Public Instance Methods
+ public void BeginUpdate () {
+ update_stack++;
+ }
+
+ public void CollapseAll ()
+ {
+ root_node.CollapseAll ();
+ }
+
+ public void EndUpdate ()
+ {
+ if (update_stack > 1) {
+ update_stack--;
+ } else {
+ update_stack = 0;
+ if (update_needed) {
+ Invalidate (ViewportRectangle);
+ update_needed = false;
+ }
+ }
+ }
+
+ public void ExpandAll () {
+ root_node.ExpandAll ();
+ }
+
+ public TreeNode GetNodeAt (Point pt) {
+ return GetNodeAt (pt.Y);
+ }
+
+ public TreeNode GetNodeAt (int x, int y)
+ {
+ return GetNodeAt (y);
+ }
+
+ private TreeNode GetNodeAtUseX (int x, int y) {
+ TreeNode node = GetNodeAt (y);
+ if (node == null || !(IsTextArea (node, x) || full_row_select))
+ return null;
+ return node;
+
+ }
+
+ public int GetNodeCount (bool include_subtrees) {
+ return root_node.GetNodeCount (include_subtrees);
+ }
+
+ public override string ToString () {
+ int count = Nodes.Count;
+ if (count <= 0)
+ return String.Concat (base.ToString (), "Node Count: 0");
+ return String.Concat (base.ToString (), "Node Count: ", count, " Nodes[0]: ", Nodes [0]);
+
+ }
+
+ #endregion // Public Instance Methods
+
+ #region Protected Instance Methods
+ protected override void CreateHandle () {
+ base.CreateHandle ();
+ }
+
+ protected override void Dispose (bool disposing) {
+ if (disposing)
+ image_list = null;
+
+ base.Dispose (disposing);
+ }
+
+ protected OwnerDrawPropertyBag GetItemRenderStyles (TreeNode node, int state) {
+ return node.prop_bag;
+ }
+
+ protected override bool IsInputKey (Keys key_data) {
+
+ if ((key_data & Keys.Alt) == 0) {
+ switch (key_data & Keys.KeyCode) {
+ case Keys.Enter:
+ case Keys.Escape:
+ case Keys.Prior:
+ case Keys.Next:
+ case Keys.End:
+ case Keys.Home:
+ case Keys.Left:
+ case Keys.Up:
+ case Keys.Right:
+ case Keys.Down:
+ return true;
+ }
+ }
+ return base.IsInputKey (key_data);
+ }
+
+ protected override void OnKeyDown (KeyEventArgs e)
+ {
+ OpenTreeNodeEnumerator ne;
+
+ switch (e.KeyData & Keys.KeyCode) {
+ case Keys.Add:
+ if (selected_node != null && selected_node.IsExpanded)
+ selected_node.Expand ();
+ break;
+ case Keys.Subtract:
+ if (selected_node != null && selected_node.IsExpanded)
+ selected_node.Collapse ();
+ break;
+ case Keys.Left:
+ if (selected_node != null) {
+ if (selected_node.IsExpanded)
+ selected_node.Collapse ();
+ else {
+ ne = new OpenTreeNodeEnumerator (selected_node);
+ if (ne.MovePrevious () && ne.MovePrevious ())
+ SelectedNode = ne.CurrentNode;
+ }
+ }
+ break;
+ case Keys.Right:
+ if (selected_node != null) {
+ if (!selected_node.IsExpanded)
+ selected_node.Expand ();
+ else {
+ ne = new OpenTreeNodeEnumerator (selected_node);
+ if (ne.MoveNext () && ne.MoveNext ())
+ SelectedNode = ne.CurrentNode;
+ }
+ }
+ break;
+ case Keys.Up:
+ if (selected_node != null) {
+ ne = new OpenTreeNodeEnumerator (selected_node);
+ if (ne.MovePrevious () && ne.MovePrevious ())
+ SelectedNode = ne.CurrentNode;
+ }
+ break;
+ case Keys.Down:
+ if (selected_node != null) {
+ ne = new OpenTreeNodeEnumerator (selected_node);
+ if (ne.MoveNext () && ne.MoveNext ())
+ SelectedNode = ne.CurrentNode;
+ }
+ break;
+ case Keys.Home:
+ if (root_node.Nodes.Count > 0) {
+ ne = new OpenTreeNodeEnumerator (root_node.Nodes [0]);
+ if (ne.MoveNext ())
+ SelectedNode = ne.CurrentNode;
+ }
+ break;
+ case Keys.End:
+ if (root_node.Nodes.Count > 0) {
+ ne = new OpenTreeNodeEnumerator (root_node.Nodes [0]);
+ while (ne.MoveNext ())
+ { }
+ SelectedNode = ne.CurrentNode;
+ }
+ break;
+ case Keys.PageDown:
+ if (selected_node != null) {
+ ne = new OpenTreeNodeEnumerator (selected_node);
+ int move = ViewportRectangle.Height / ItemHeight;
+ for (int i = 0; i < move && ne.MoveNext (); i++) {
+
+ }
+ SelectedNode = ne.CurrentNode;
+ }
+ break;
+ case Keys.PageUp:
+ if (selected_node != null) {
+ ne = new OpenTreeNodeEnumerator (selected_node);
+ int move = ViewportRectangle.Height / ItemHeight;
+ for (int i = 0; i < move && ne.MovePrevious (); i++)
+ { }
+ SelectedNode = ne.CurrentNode;
+ }
+ break;
+ case Keys.Multiply:
+ if (selected_node != null)
+ selected_node.ExpandAll ();
+ break;
+ }
+ base.OnKeyDown (e);
+
+ if (!e.Handled && checkboxes &&
+ selected_node != null &&
+ (e.KeyData & Keys.KeyCode) == Keys.Space) {
+ TreeViewCancelEventArgs args = new TreeViewCancelEventArgs (
+ selected_node, false, TreeViewAction.ByKeyboard);
+ OnBeforeCheck (args);
+ if (!args.Cancel) {
+ selected_node.Checked = !selected_node.Checked;
+ OnAfterCheck (new TreeViewEventArgs (selected_node, TreeViewAction.ByKeyboard));
+ }
+ e.Handled = true;
+ }
+ }
+
+ protected override void OnKeyPress (KeyPressEventArgs e)
+ {
+ base.OnKeyPress (e);
+ if (e.KeyChar == ' ')
+ e.Handled = true;
+ }
+
+ protected override void OnKeyUp (KeyEventArgs e)
+ {
+ base.OnKeyUp (e);
+ if ((e.KeyData & Keys.KeyCode) == Keys.Space)
+ e.Handled = true;
+ }
+
+ protected virtual void OnItemDrag (ItemDragEventArgs e)
+ {
+ if (ItemDrag != null)
+ ItemDrag (this, e);
+ }
+
+ protected virtual void OnAfterCheck (TreeViewEventArgs e) {
+ if (on_after_check != null)
+ on_after_check (this, e);
+ }
+
+ protected internal virtual void OnAfterCollapse (TreeViewEventArgs e) {
+ if (on_after_collapse != null)
+ on_after_collapse (this, e);
+ }
+
+ protected internal virtual void OnAfterExpand (TreeViewEventArgs e) {
+ if (on_after_expand != null)
+ on_after_expand (this, e);
+ }
+
+ protected virtual void OnAfterLabelEdit (NodeLabelEditEventArgs e) {
+ if (on_after_label_edit != null)
+ on_after_label_edit (this, e);
+ }
+
+ protected virtual void OnAfterSelect (TreeViewEventArgs e) {
+ if (on_after_select != null)
+ on_after_select (this, e);
+ }
+
+ protected virtual void OnBeforeCheck (TreeViewCancelEventArgs e) {
+ if (on_before_check != null)
+ on_before_check (this, e);
+ }
+
+ protected internal virtual void OnBeforeCollapse (TreeViewCancelEventArgs e) {
+ if (on_before_collapse != null)
+ on_before_collapse (this, e);
+ }
+
+ protected internal virtual void OnBeforeExpand (TreeViewCancelEventArgs e) {
+ if (on_before_expand != null)
+ on_before_expand (this, e);
+ }
+
+ protected virtual void OnBeforeLabelEdit (NodeLabelEditEventArgs e) {
+ if (on_before_label_edit != null)
+ on_before_label_edit (this, e);
+ }
+
+ protected virtual void OnBeforeSelect (TreeViewCancelEventArgs e) {
+ if (on_before_select != null)
+ on_before_select (this, e);
+ }
+
+ protected override void OnHandleCreated (EventArgs e) {
+ base.OnHandleCreated (e);
+
+ vbar = new ImplicitVScrollBar ();
+ hbar = new ImplicitHScrollBar ();
+
+ vbar.Visible = false;
+ hbar.Visible = false;
+ vbar.ValueChanged += new EventHandler (VScrollBarValueChanged);
+ hbar.ValueChanged += new EventHandler (HScrollBarValueChanged);
+
+ SuspendLayout ();
+ Controls.AddImplicit (vbar);
+ Controls.AddImplicit (hbar);
+ ResumeLayout ();
+ }
+
+ protected override void OnHandleDestroyed (EventArgs e) {
+ base.OnHandleDestroyed (e);
+ }
+
+ protected override void WndProc(ref Message m) {
+ switch ((Msg) m.Msg) {
+ case Msg.WM_PAINT: {
+ PaintEventArgs paint_event;
+
+ paint_event = XplatUI.PaintEventStart (Handle, true);
+ DoPaint (paint_event);
+ XplatUI.PaintEventEnd (Handle, true);
+ return;
+ }
+ case Msg.WM_LBUTTONDBLCLK:
+ int val = m.LParam.ToInt32();
+ DoubleClickHandler (null, new
+ MouseEventArgs (MouseButtons.Left,
+ 2, val & 0xffff,
+ (val>>16) & 0xffff, 0));
+ break;
+ }
+ base.WndProc (ref m);
+ }
+
+ #endregion // Protected Instance Methods
+
+ #region Internal & Private Methods and Properties
+ internal string LabelEditText {
+ get {
+ if (edit_text_box == null)
+ return String.Empty;
+ return edit_text_box.Text;
+ }
+ }
+
+ internal IntPtr CreateNodeHandle ()
+ {
+ return (IntPtr) handle_count++;
+ }
+
+ internal TreeNode NodeFromHandle (IntPtr handle)
+ {
+ // This method is called rarely, so instead of maintaining a table
+ // we just walk the tree nodes to find the matching handle
+ return NodeFromHandleRecursive (root_node, handle);
+ }
+
+ private TreeNode NodeFromHandleRecursive (TreeNode node, IntPtr handle)
+ {
+ if (node.handle == handle)
+ return node;
+ foreach (TreeNode child in node.Nodes) {
+ TreeNode match = NodeFromHandleRecursive (child, handle);
+ if (match != null)
+ return match;
+ }
+ return null;
+ }
+
+ // TODO: we shouldn't have to compute this on the fly
+ internal Rectangle ViewportRectangle {
+ get {
+ Rectangle res = ClientRectangle;
+
+ if (vbar != null && vbar.Visible)
+ res.Width -= vbar.Width;
+ if (hbar != null && hbar.Visible)
+ res.Height -= hbar.Height;
+ return res;
+ }
+ }
+
+ private TreeNode GetNodeAt (int y)
+ {
+ if (nodes.Count <= 0)
+ return null;
+
+ if (top_node == null)
+ top_node = nodes [0];
+
+ OpenTreeNodeEnumerator o = new OpenTreeNodeEnumerator (TopNode);
+ int move = y / ItemHeight;
+ for (int i = -1; i < move; i++) {
+ if (!o.MoveNext ())
+ return null;
+ }
+
+ return o.CurrentNode;
+ }
+
+ private bool IsTextArea (TreeNode node, int x)
+ {
+ return node != null && node.Bounds.Left <= x && node.Bounds.Right >= x;
+ }
+
+ private bool IsSelectableArea (TreeNode node, int x)
+ {
+ if (node == null)
+ return false;
+ int l = node.Bounds.Left;
+ if (ImageList != null)
+ l -= ImageList.ImageSize.Width;
+ return l <= x && node.Bounds.Right >= x;
+
+ }
+
+ private bool IsPlusMinusArea (TreeNode node, int x)
+ {
+ if (node.Nodes.Count == 0 || (node.parent == root_node && !show_root_lines))
+ return false;
+
+ int l = node.Bounds.Left + 5;
+
+ if (show_root_lines || node.Parent != null)
+ l -= indent;
+ if (ImageList != null)
+ l -= ImageList.ImageSize.Width + 3;
+ if (checkboxes)
+ l -= 19;
+ return (x > l && x < l + 8);
+ }
+
+ private bool IsCheckboxArea (TreeNode node, int x)
+ {
+ int l = node.Bounds.Left + 5;
+
+ if (show_root_lines || node.Parent != null)
+ l -= indent;
+ if (ImageList != null)
+ l -= ImageList.ImageSize.Width + 3;
+ return (x > l && x < l + 10);
+ }
+
+ internal void SetTop (TreeNode node)
+ {
+ OpenTreeNodeEnumerator walk = new OpenTreeNodeEnumerator (root_node);
+ int offset = 0;
+
+ while (walk.CurrentNode != node && walk.MoveNext ())
+ offset++;
+
+ vbar.Value = offset;
+ }
+
+ internal void SetBottom (TreeNode node)
+ {
+ OpenTreeNodeEnumerator walk = new OpenTreeNodeEnumerator (node);
+
+ int bottom = ViewportRectangle.Bottom;
+ int offset = 0;
+ while (walk.MovePrevious ()) {
+ if (walk.CurrentNode.Bounds.Bottom <= bottom)
+ break;
+ offset++;
+ }
+ vbar.Value += offset;
+ }
+
+ internal void UpdateBelow (TreeNode node)
+ {
+ if (update_stack > 0) {
+ update_needed = true;
+ return;
+ }
+
+ if (node == root_node) {
+ Refresh ();
+ return;
+ }
+
+ // We need to update the current node so the plus/minus block gets update too
+ Rectangle invalid = new Rectangle (0, node.Bounds.Top - 1,
+ Width, Height - node.Bounds.Top + 1);
+ Invalidate (invalid);
+ }
+
+ internal void UpdateNode (TreeNode node)
+ {
+ if (update_stack > 0) {
+ update_needed = true;
+ return;
+ }
+
+ if (node == root_node) {
+ Refresh ();
+ return;
+ }
+
+ Rectangle invalid = new Rectangle (0, node.Bounds.Top - 1, Width,
+ node.Bounds.Height + 1);
+ Invalidate (invalid);
+ }
+
+ internal void UpdateNodePlusMinus (TreeNode node)
+ {
+ if (update_stack > 0) {
+ update_needed = true;
+ return;
+ }
+
+ int l = node.Bounds.Left + 5;
+
+ if (show_root_lines || node.Parent != null)
+ l -= indent;
+ if (ImageList != null)
+ l -= ImageList.ImageSize.Width + 3;
+ if (checkboxes)
+ l -= 19;
+
+ Invalidate (new Rectangle (l, node.Bounds.Top, 8, node.Bounds.Height));
+ }
+
+ private void DoPaint (PaintEventArgs pe)
+ {
+ if (Width <= 0 || Height <= 0 || Visible == false)
+ return;
+
+ Draw (pe.ClipRectangle, pe.Graphics);
+ }
+
+ private void Draw (Rectangle clip, Graphics dc)
+ {
+ if (top_node == null && Nodes.Count > 0)
+ top_node = nodes [0];
+
+ if (selected_node == null && Nodes.Count > 0)
+ SelectedNode = nodes [0];
+
+ // Decide if we need a scrollbar
+ int old_open_node_count = open_node_count;
+
+ //Rectangle fill = ClientRectangle;
+ add_vscroll = false;
+ add_hscroll = false;
+
+ dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (BackColor), clip);
+
+ Color dash_color = ControlPaint.Dark (BackColor);
+ if (dash_color == BackColor)
+ dash_color = ControlPaint.Light (BackColor);
+ dash = new Pen (dash_color, 1);
+ dash.DashStyle = DashStyle.Dot;
+
+ int depth = 0;
+ int item_height = ItemHeight;
+ int height = ClientRectangle.Height;
+
+ open_node_count = 0;
+ used_height = 0;
+ foreach (TreeNode node in nodes) {
+ DrawNode (node, dc, clip, ref depth, item_height, height);
+ depth = 0;
+ }
+
+ add_vscroll = (open_node_count * ItemHeight) > ClientRectangle.Height;
+
+ if (max_node_width > ClientRectangle.Width)
+ add_hscroll = true;
+
+ if (add_vscroll)
+ add_hscroll = max_node_width > ClientRectangle.Width - ThemeEngine.Current.VScrollBarDefaultSize.Width;
+ if (add_hscroll)
+ add_vscroll = (open_node_count * ItemHeight) > ClientRectangle.Height - ThemeEngine.Current.HScrollBarDefaultSize.Height;
+
+ if (add_hscroll) {
+ AddHorizontalScrollBar ();
+ } else if (hbar != null) {
+ hbar_offset = 0;
+ hbar.Visible = false;
+ }
+
+ if (add_vscroll) {
+ AddVerticalScrollBar (open_node_count, old_open_node_count != open_node_count);
+ } else if (vbar != null) {
+ vbar.Visible = false;
+ skipped_nodes = 0;
+ }
+
+ if (add_hscroll && add_vscroll) {
+ Rectangle corner = new Rectangle (hbar.Right, vbar.Bottom, vbar.Width, hbar.Height);
+ if (clip.IntersectsWith (corner))
+ dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (ThemeEngine.Current.ColorControl), corner);
+ }
+ }
+
+ private void DrawNodePlusMinus (TreeNode node, Graphics dc, int x, int middle)
+ {
+ dc.DrawRectangle (SystemPens.ControlDark, x, middle - 4, 8, 8);
+
+ if (node.IsExpanded) {
+ dc.DrawLine (SystemPens.ControlDarkDark, x + 2, middle, x + 6, middle);
+ } else {
+ dc.DrawLine (SystemPens.ControlDarkDark, x + 2, middle, x + 6, middle);
+ dc.DrawLine (SystemPens.ControlDarkDark, x + 4, middle - 2, x + 4, middle + 2);
+ }
+ }
+
+ private void DrawNodeCheckBox (TreeNode node, Graphics dc, int x, int middle)
+ {
+ using(Pen pen = new Pen (Color.Black, 2) )
+ dc.DrawRectangle (pen, x+ 3, middle - 4, 11, 11);
+
+ if (node.Checked) {
+ using(Pen check_pen = new Pen (Color.Black, 1)) {
+ dc.DrawLine (check_pen, x + 6, middle + 0, x + 8, middle + 3);
+ dc.DrawLine (check_pen, x + 6, middle + 1, x + 8, middle + 4);
+
+ dc.DrawLine (check_pen, x + 7, middle + 3, x + 13, middle - 2);
+ dc.DrawLine (check_pen, x + 7, middle + 4, x + 13, middle - 1);
+ }
+ }
+ }
+
+ private void DrawNodeLines (TreeNode node, Graphics dc, bool visible, Pen dash, int x, int y,
+ int middle, int item_height, int node_count)
+ {
+ int ladjust = 9; // left adjust
+ int radjust = 0; // right adjust
+
+ if (node_count > 0 && show_plus_minus)
+ ladjust = 13;
+ if (checkboxes)
+ radjust = 3;
+
+ dc.DrawLine (dash, x - indent + ladjust, middle, x + radjust, middle);
+
+ //if (!visible)
+ // return;
+
+ int ly = 0;
+ if (node.PrevNode != null) {
+ int prevadjust = (node.Nodes.Count > 0 && show_plus_minus ? (node.PrevNode.Nodes.Count == 0 ? 0 : 4) :
+ (node.PrevNode.Nodes.Count == 0 ? 0 : 4));
+ int myadjust = (node.Nodes.Count > 0 && show_plus_minus ? 4 : 0);
+ ly = node.PrevNode.Bounds.Bottom - (item_height / 2) + prevadjust;
+ dc.DrawLine (dash, x - indent + 9, middle - myadjust, x - indent + 9, ly);
+ } else if (node.Parent != null) {
+ int myadjust = (node.Nodes.Count > 0 && show_plus_minus ? 4 : 0);
+ ly = node.Parent.Bounds.Bottom + 1;
+ dc.DrawLine (dash, x - indent + 9, middle - myadjust, x - indent + 9, ly);
+ }
+ }
+
+ private void DrawNodeImage (TreeNode node, Graphics dc, Rectangle clip, int x, int y)
+ {
+ // Rectangle r = new Rectangle (x, y + 2, ImageList.ImageSize.Width, ImageList.ImageSize.Height);
+
+ if (!RectsIntersect (clip, x, y + 2, ImageList.ImageSize.Width, ImageList.ImageSize.Height))
+ return;
+
+ if (node.ImageIndex > -1 && ImageList != null && node.ImageIndex < ImageList.Images.Count) {
+ ImageList.Draw (dc, x, y + 2, ImageList.ImageSize.Width,
+ ImageList.ImageSize.Height, node.ImageIndex);
+ } else if (ImageIndex > -1 && ImageList != null && ImageIndex < ImageList.Images.Count) {
+ ImageList.Draw (dc, x, y + 2, ImageList.ImageSize.Width,
+ ImageList.ImageSize.Height, ImageIndex);
+ }
+ }
+
+ private void DrawEditNode (TreeNode node)
+ {
+ SuspendLayout ();
+
+ if (edit_text_box == null) {
+ edit_text_box = new TextBox ();
+ edit_text_box.BorderStyle = BorderStyle.FixedSingle;
+ edit_text_box.KeyUp += new KeyEventHandler (EditTextBoxKeyDown);
+ edit_text_box.Leave += new EventHandler (EditTextBoxLeave);
+ Controls.AddImplicit (edit_text_box);
+ }
+
+ edit_text_box.Bounds = node.Bounds;
+ edit_text_box.Width += 4;
+
+ edit_text_box.Text = node.Text;
+ edit_text_box.Visible = true;
+ edit_text_box.Focus ();
+ edit_text_box.SelectAll ();
+
+ ResumeLayout ();
+ }
+
+ private void EditTextBoxKeyDown (object sender, KeyEventArgs e)
+ {
+ if (e.KeyCode == Keys.Return)
+ EndEdit ();
+ }
+
+ private void EditTextBoxLeave (object sender, EventArgs e)
+ {
+ EndEdit ();
+ }
+
+ private void EndEdit ()
+ {
+ edit_text_box.Visible = false;
+ edit_node.EndEdit (false);
+ UpdateNode(edit_node);
+ }
+
+ private void UpdateNodeBounds (TreeNode node, int x, int y, int item_height, Graphics dc)
+ {
+ Font font = node.NodeFont;
+ if (node.NodeFont == null)
+ font = Font;
+
+ if (node.NeedsWidth || update_node_bounds)
+ node.SetWidth ((int) dc.MeasureString (node.Text, font, 0,
+ string_format).Width + 3);
+ node.SetHeight (item_height);
+ node.SetPosition (x, y);
+ }
+
+ private void DrawSelectionAndFocus(TreeNode node, Graphics dc, Rectangle r)
+ {
+ if (Focused && focused_node == node) {
+ ControlPaint.DrawFocusRectangle (dc, r, ForeColor, BackColor);
+ }
+ r.Inflate(-1, -1);
+ if ((!HideSelection || Focused) && SelectedNode == node)
+ dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (ThemeEngine.Current.ColorHighlight), r);
+ else
+ dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (node.BackColor), r);
+ }
+
+ private void DrawStaticNode (TreeNode node, Graphics dc)
+ {
+ if (!full_row_select)
+ DrawSelectionAndFocus(node, dc, node.Bounds);
+
+ Font font = node.NodeFont;
+ if (node.NodeFont == null)
+ font = Font;
+ Color text_color = ((Focused || !HideSelection) && SelectedNode == node ?
+ ThemeEngine.Current.ColorHighlightText : node.ForeColor);
+ dc.DrawString (node.Text, font,
+ ThemeEngine.Current.ResPool.GetSolidBrush (text_color),
+ node.Bounds, string_format);
+ }
+
+ private void DrawNode (TreeNode node, Graphics dc, Rectangle clip, ref int depth, int item_height, int max_height)
+ {
+ open_node_count++;
+ int x = (!show_root_lines && node.Parent != null ? depth - 1 : depth) * indent - hbar_offset;
+ int y = item_height * (open_node_count - skipped_nodes - 1);
+ bool visible = (y >= 0 && y < max_height);
+ int _n_count = node.nodes.Count;
+ int middle = y + (item_height / 2);
+
+ // The thing is totally out of the clipping rectangle
+ if (clip.Top > y + ItemHeight || clip.Bottom < y)
+ visible = false;
+
+ if (visible && full_row_select) {
+ Rectangle r = new Rectangle(1, y+2, ViewportRectangle.Width-2, item_height);
+ DrawSelectionAndFocus(node, dc, r);
+ }
+
+ if (show_root_lines || node.Parent != null) {
+ x += 5;
+ if (_n_count > 0) {
+ if (show_plus_minus && visible) {
+ DrawNodePlusMinus (node, dc, x, middle);
+ }
+ }
+ x += indent - 5;
+ }
+
+ int ox = x;
+
+ if (checkboxes) {
+ if (visible)
+ DrawNodeCheckBox (node, dc, ox, middle);
+ ox += 19;
+ }
+
+ if (show_lines)
+ DrawNodeLines (node, dc, visible, dash, x, y, middle, item_height, _n_count);
+
+ if (ImageList != null) {
+ if (visible)
+ DrawNodeImage (node, dc, clip, ox, y);
+ // MS leaves the space for the image if the ImageList is
+ // non null regardless of whether or not an image is drawn
+ ox += ImageList.ImageSize.Width + 3; // leave a little space so the text isn't against the image
+ }
+
+ UpdateNodeBounds (node, ox, y, item_height, dc);
+
+ bool bounds_in_clip = clip.IntersectsWith (node.Bounds) || full_row_select;
+ if (visible && bounds_in_clip) {
+ if (node.IsEditing)
+ DrawEditNode (node);
+ else
+ DrawStaticNode (node, dc);
+ }
+
+ if (node.Bounds.Right > max_node_width) {
+ max_node_width = node.Bounds.Right;
+ if (max_node_width > ClientRectangle.Width && !add_hscroll) {
+ max_height -= ItemHeight;
+ add_hscroll = true;
+ }
+ }
+
+ if (node.Bounds.Bottom > used_height)
+ used_height = node.Bounds.Bottom;
+
+ depth++;
+ if (node.IsExpanded) {
+ for (int i = 0; i < _n_count; i++) {
+ int tdepth = depth;
+ DrawNode (node.nodes [i], dc, clip, ref tdepth, item_height, max_height);
+ }
+ }
+
+ }
+
+ private void AddVerticalScrollBar (int total_nodes, bool count_changed)
+ {
+ vbar.Bounds = new Rectangle (ClientRectangle.Width - vbar.Width,
+ 0, vbar.Width, (add_hscroll ? Height - ThemeEngine.Current.HScrollBarDefaultSize.Height : Height));
+
+ if (count_changed) {
+ vbar.Maximum = total_nodes;
+ int height = ClientRectangle.Height;
+ vbar.LargeChange = height / ItemHeight;
+ }
+
+ vbar.Visible = true;
+ }
+
+ private void AddHorizontalScrollBar ()
+ {
+ hbar.Bounds = new Rectangle (ClientRectangle.Left,
+ ClientRectangle.Bottom - hbar.Height,
+ (add_vscroll ? Width - ThemeEngine.Current.VScrollBarDefaultSize.Width : Width), hbar.Height);
+
+ int width = ClientRectangle.Width;
+ if (vbar.Visible)
+ width -= vbar.Width;
+
+ hbar.SmallChange = 15;
+ hbar.LargeChange = 50;
+ int num_pixels = max_node_width - width;
+ hbar.Maximum = num_pixels + 50;
+ hbar.Visible = true;
+ }
+
+ private void SizeChangedHandler (object sender, EventArgs e)
+ {
+ SuspendLayout ();
+
+ if (max_node_width > ClientRectangle.Width && ClientRectangle.Width >= 0) {
+ add_hscroll = true;
+ AddHorizontalScrollBar ();
+ return;
+ }
+
+ if (used_height > ClientRectangle.Height && ClientRectangle.Height >= 0) {
+ add_vscroll = true;
+ AddVerticalScrollBar (open_node_count, true);
+ return;
+ }
+
+ if (vbar != null && vbar.Visible) {
+ int height = (hbar != null && hbar.Visible ? Height - hbar.Height : Height);
+ vbar.SetBounds (Right - vbar.Width, 0, 0, height, BoundsSpecified.X | BoundsSpecified.Height);
+ }
+
+ if (hbar != null && hbar.Visible) {
+ int width = (vbar != null && vbar.Visible ? Width - vbar.Width : Width);
+ hbar.SetBounds (0, Bottom - hbar.Height, width, 0, BoundsSpecified.Y | BoundsSpecified.Width);
+ }
+
+ ResumeLayout ();
+ }
+
+ private void VScrollBarValueChanged (object sender, EventArgs e)
+ {
+ SetVScrollPos (vbar.Value, null);
+ }
+
+ private void SetVScrollPos (int pos, TreeNode new_top)
+ {
+ if (pos < 0)
+ pos = 0;
+
+ if (skipped_nodes == pos)
+ return;
+
+ int old_skip = skipped_nodes;
+ skipped_nodes = pos;
+ int diff = old_skip - skipped_nodes;
+
+ // Determine the new top node if we have to
+ if (new_top == null) {
+ if (top_node == null)
+ top_node = nodes [0];
+
+ OpenTreeNodeEnumerator walk = new OpenTreeNodeEnumerator (TopNode);
+ if (diff < 0) {
+ for (int i = diff; i <= 0; i++)
+ walk.MoveNext ();
+ new_top = walk.CurrentNode;
+ } else {
+ for (int i = 0; i <= diff; i++)
+ walk.MovePrevious ();
+ new_top = walk.CurrentNode;
+ }
+ }
+
+ top_node = new_top;
+ int y_move = diff * ItemHeight;
+ XplatUI.ScrollWindow (Handle, ViewportRectangle, 0, y_move, false);
+ }
+
+ private void HScrollBarValueChanged(object sender, EventArgs e)
+ {
+ int old_offset = hbar_offset;
+ hbar_offset = hbar.Value;
+
+ if (hbar_offset < 0)
+ hbar_offset = 0;
+
+ XplatUI.ScrollWindow (Handle, ViewportRectangle, old_offset - hbar_offset, 0, false);
+ }
+
+ private void MouseWheelHandler(object sender, MouseEventArgs e) {
+ if (vbar == null || !vbar.Visible) {
+ return;
+ }
+
+ if (e.Delta < 0) {
+ vbar.Value = Math.Min(vbar.Value + SystemInformation.MouseWheelScrollLines, vbar.Maximum);
+ } else {
+ vbar.Value = Math.Max(0, vbar.Value - SystemInformation.MouseWheelScrollLines);
+ }
+ }
+
+ private void FontChangedHandler (object sender, EventArgs e)
+ {
+ update_node_bounds = true;
+ }
+
+ private void FocusChangedHandler (object sender, EventArgs e)
+ {
+ if (selected_node != null)
+ UpdateNode (selected_node);
+ }
+
+ private void MouseDownHandler (object sender, MouseEventArgs e)
+ {
+ TreeNode node = GetNodeAt (e.Y);
+ if (node == null)
+ return;
+
+ if (show_plus_minus && IsPlusMinusArea (node, e.X)) {
+ node.Toggle ();
+ return;
+ } else if (checkboxes && IsCheckboxArea (node, e.X)) {
+ node.Checked = !node.Checked;
+ UpdateNode(node);
+ return;
+ } else if (IsSelectableArea (node, e.X) || full_row_select) {
+ TreeNode old_selected = selected_node;
+ SelectedNode = node;
+ if (label_edit && e.Clicks == 1 && selected_node == old_selected) {
+ node.BeginEdit ();
+ if (edit_node != null) {
+ edit_node.EndEdit (false);
+ UpdateNode (edit_node);
+ }
+ edit_node = node;
+ UpdateNode (edit_node);
+ } else if (selected_node != focused_node) {
+ select_mmove = true;
+ }
+ }
+ }
+
+ private void MouseUpHandler (object sender, MouseEventArgs e) {
+
+ drag_begin_x = -1;
+ drag_begin_y = -1;
+
+ OnClick (EventArgs.Empty);
+
+ if (!select_mmove)
+ return;
+
+ select_mmove = false;
+
+ TreeViewCancelEventArgs ce = new TreeViewCancelEventArgs (selected_node, false, TreeViewAction.ByMouse);
+ OnBeforeSelect (ce);
+
+ Rectangle invalid;
+ if (!ce.Cancel) {
+ if (focused_node != null) {
+ invalid = Rectangle.Union (Bloat (focused_node.Bounds),
+ Bloat (selected_node.Bounds));
+ } else {
+ invalid = Bloat (selected_node.Bounds);
+ }
+ focused_node = selected_node;
+ OnAfterSelect (new TreeViewEventArgs (selected_node, TreeViewAction.ByMouse));
+
+ Invalidate (invalid);
+ } else {
+ selected_node = focused_node;
+ }
+
+
+ }
+
+ private void MouseMoveHandler (object sender, MouseEventArgs e) {
+
+ if (e.Button == MouseButtons.Left || e.Button == MouseButtons.Right) {
+ if (drag_begin_x == -1 && drag_begin_y == -1) {
+ drag_begin_x = e.X;
+ drag_begin_y = e.Y;
+ } else {
+ double rise = Math.Pow (drag_begin_x - e.X, 2);
+ double run = Math.Pow (drag_begin_y - e.Y, 2);
+ double move = Math.Sqrt (rise + run);
+ if (move > 3) {
+ TreeNode drag = GetNodeAtUseX (e.X, e.Y);
+
+ if (drag != null) {
+ OnItemDrag (new ItemDragEventArgs (e.Button, drag));
+ }
+ drag_begin_x = -1;
+ drag_begin_y = -1;
+ }
+ }
+
+ }
+ if(!select_mmove)
+ return;
+ TreeNode node = GetNodeAtUseX (e.X,e.Y);
+ if(node == selected_node)
+ return;
+
+ selected_node = focused_node;
+ select_mmove = false;
+ Refresh();
+ }
+
+ private void DoubleClickHandler (object sender, MouseEventArgs e) {
+ TreeNode node = GetNodeAtUseX (e.X,e.Y);
+ if(node != null) {
+ node.Toggle();
+ }
+ }
+
+
+ private bool RectsIntersect (Rectangle r, int left, int top, int width, int height)
+ {
+ return !((r.Left > left + width) || (r.Right < left) ||
+ (r.Top > top + height) || (r.Bottom < top));
+ }
+
+ #endregion // Internal & Private Methods and Properties
+
+ #region Events
+ public event ItemDragEventHandler ItemDrag;
+
+ public event TreeViewEventHandler AfterCheck {
+ add { on_after_check += value; }
+ remove { on_after_check -= value; }
+ }
+
+ public event TreeViewEventHandler AfterCollapse {
+ add { on_after_collapse += value; }
+ remove { on_after_collapse -= value; }
+ }
+
+ public event TreeViewEventHandler AfterExpand {
+ add { on_after_expand += value; }
+ remove { on_after_expand -= value; }
+ }
+
+ public event NodeLabelEditEventHandler AfterLabelEdit {
+ add { on_after_label_edit += value; }
+ remove { on_after_label_edit -= value; }
+ }
+
+ public event TreeViewEventHandler AfterSelect {
+ add { on_after_select += value; }
+ remove { on_after_select -= value; }
+ }
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public event EventHandler BackgroundImageChanged {
+ add { base.BackgroundImageChanged += value; }
+ remove { base.BackgroundImageChanged -= value; }
+ }
+
+ public event TreeViewCancelEventHandler BeforeCheck {
+ add { on_before_check += value; }
+ remove { on_before_check -= value; }
+ }
+
+ public event TreeViewCancelEventHandler BeforeCollapse {
+ add { on_before_collapse += value; }
+ remove { on_before_collapse -= value; }
+ }
+
+ public event TreeViewCancelEventHandler BeforeExpand {
+ add { on_before_expand += value; }
+ remove { on_before_expand -= value; }
+ }
+
+ public event NodeLabelEditEventHandler BeforeLabelEdit {
+ add { on_before_label_edit += value; }
+ remove { on_before_label_edit -= value; }
+ }
+
+ public event TreeViewCancelEventHandler BeforeSelect {
+ add { on_before_select += value; }
+ remove { on_before_select -= value; }
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ [Browsable (false)]
+ public new event PaintEventHandler Paint {
+ add { base.Paint += value; }
+ remove { base.Paint -= value; }
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ [Browsable (false)]
+ public new event EventHandler TextChanged {
+ add { base.TextChanged += value; }
+ remove { base.TextChanged -= value; }
+ }
+ #endregion // Events
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeViewAction.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeViewAction.cs
new file mode 100644
index 00000000000..66ffb6f8c97
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeViewAction.cs
@@ -0,0 +1,35 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+namespace System.Windows.Forms {
+
+ public enum TreeViewAction {
+ Unknown,
+ ByKeyboard,
+ ByMouse,
+ Collapse,
+ Expand
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeViewCancelEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeViewCancelEventArgs.cs
new file mode 100644
index 00000000000..c87b8337534
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeViewCancelEventArgs.cs
@@ -0,0 +1,52 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+
+using System;
+using System.ComponentModel;
+
+
+namespace System.Windows.Forms {
+
+ public class TreeViewCancelEventArgs : CancelEventArgs {
+
+ private TreeNode node;
+ private TreeViewAction action;
+
+ public TreeViewCancelEventArgs (TreeNode node, bool cancel, TreeViewAction action) : base (cancel)
+ {
+ this.node = node;
+ this.action = action;
+ }
+
+ public TreeNode Node {
+ get { return node; }
+ }
+
+ public TreeViewAction Action {
+ get { return action; }
+ }
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeViewCancelEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeViewCancelEventHandler.cs
new file mode 100644
index 00000000000..b3be92c1d33
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeViewCancelEventHandler.cs
@@ -0,0 +1,31 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+
+namespace System.Windows.Forms {
+
+ public delegate void TreeViewCancelEventHandler (object sender, TreeViewCancelEventArgs e);
+
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeViewEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeViewEventArgs.cs
new file mode 100644
index 00000000000..0c89a6c958c
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeViewEventArgs.cs
@@ -0,0 +1,51 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+namespace System.Windows.Forms {
+
+ public class TreeViewEventArgs : EventArgs {
+
+ private TreeNode node;
+ private TreeViewAction action;
+
+ public TreeViewEventArgs (TreeNode node)
+ {
+ this.node = node;
+ }
+
+ public TreeViewEventArgs (TreeNode node, TreeViewAction action) : this (node)
+ {
+ this.action = action;
+ }
+
+ public TreeViewAction Action {
+ get { return action; }
+ }
+
+ public TreeNode Node {
+ get { return node; }
+ }
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeViewEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeViewEventHandler.cs
new file mode 100644
index 00000000000..99447d20251
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeViewEventHandler.cs
@@ -0,0 +1,30 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+namespace System.Windows.Forms {
+
+ public delegate void TreeViewEventHandler (object sender, TreeViewEventArgs e);
+
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeViewImageIndexConverter.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeViewImageIndexConverter.cs
new file mode 100644
index 00000000000..669fd4e2701
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeViewImageIndexConverter.cs
@@ -0,0 +1,45 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+
+
+using System;
+using System.Drawing;
+using System.Collections;
+
+
+namespace System.Windows.Forms {
+
+ public class TreeViewImageIndexConverter : ImageIndexConverter {
+
+ public TreeViewImageIndexConverter ()
+ {
+ }
+
+ protected override bool IncludeNoneAsStandardValue {
+ get { return false; }
+ }
+ }
+
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/UICues.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/UICues.cs
new file mode 100644
index 00000000000..8320367cac8
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/UICues.cs
@@ -0,0 +1,41 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+
+ [Flags]
+ public enum UICues {
+ None = 0x00000000,
+ ShowFocus = 0x00000001,
+ ShowKeyboard = 0x00000002,
+ Shown = 0x00000003,
+ ChangeFocus = 0x00000004,
+ ChangeKeyboard = 0x00000008,
+ Changed = 0x0000000C
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/UICuesEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/UICuesEventArgs.cs
new file mode 100644
index 00000000000..95ce41bf2e5
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/UICuesEventArgs.cs
@@ -0,0 +1,87 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public class UICuesEventArgs : EventArgs {
+ private UICues cues;
+
+ #region Public Constructors
+ public UICuesEventArgs(UICues uicues) {
+ this.cues = uicues;
+ }
+ #endregion
+
+ #region Public Instance Properties
+ public UICues Changed {
+ get {
+ return (cues & UICues.Changed);
+ }
+ }
+
+ public bool ChangeFocus {
+ get {
+ if ((cues & UICues.ChangeFocus)==0) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+ }
+
+ public bool ChangeKeyboard {
+ get {
+ if ((cues & UICues.ChangeKeyboard)==0) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+ }
+
+ public bool ShowFocus {
+ get {
+ if ((cues & UICues.ShowFocus)==0) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+ }
+
+ public bool ShowKeyboard {
+ get {
+ if ((cues & UICues.ShowKeyboard)==0) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/UICuesEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/UICuesEventHandler.cs
new file mode 100644
index 00000000000..0e6e424a306
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/UICuesEventHandler.cs
@@ -0,0 +1,32 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public delegate void UICuesEventHandler (Object Sender, UICuesEventArgs e);
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/UpDownBase.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/UpDownBase.cs
new file mode 100644
index 00000000000..cc71a16d4d7
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/UpDownBase.cs
@@ -0,0 +1,680 @@
+// 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) 2005 Novell, Inc.
+//
+// Authors:
+// Jonathan Gilbert <logic@deltaq.org>
+//
+// Integration into MWF:
+// Peter Bartok <pbartok@novell.com>
+//
+
+// COMPLETE
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Drawing;
+using System.Runtime.InteropServices;
+using System.Windows.Forms;
+
+namespace System.Windows.Forms
+{
+ [Designer("System.Windows.Forms.Design.UpDownBaseDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+ public abstract class UpDownBase : System.Windows.Forms.ContainerControl {
+ #region UpDownSpinner Sub-class
+ internal sealed class UpDownSpinner : Control {
+ #region Local Variables
+ private const int InitialRepeatDelay = 50;
+ private UpDownBase owner;
+ private Timer tmrRepeat;
+ private Rectangle top_button_rect;
+ private Rectangle bottom_button_rect;
+ private int mouse_pressed;
+ private int mouse_x;
+ private int mouse_y;
+ private int repeat_delay;
+ private int repeat_counter;
+ #endregion // Local Variables
+
+ #region Constructors
+ public UpDownSpinner(UpDownBase owner) {
+ this.owner = owner;
+
+ mouse_pressed = 0;
+
+ this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
+ this.SetStyle(ControlStyles.DoubleBuffer, true);
+ this.SetStyle(ControlStyles.Opaque, true);
+ this.SetStyle(ControlStyles.ResizeRedraw, true);
+ this.SetStyle(ControlStyles.UserPaint, true);
+ this.SetStyle(ControlStyles.Selectable, false);
+
+ tmrRepeat = new Timer();
+
+ tmrRepeat.Enabled = false;
+ tmrRepeat.Interval = 10;
+ tmrRepeat.Tick += new EventHandler(tmrRepeat_Tick);
+
+ compute_rects();
+ }
+ #endregion // Constructors
+
+ #region Private & Internal Methods
+ private void compute_rects() {
+ int top_button_height;
+ int bottom_button_height;
+
+ top_button_height = ClientSize.Height / 2;
+ bottom_button_height = ClientSize.Height - top_button_height;
+
+ top_button_rect = new Rectangle(0, 0, ClientSize.Width, top_button_height);
+ bottom_button_rect = new Rectangle(0, top_button_height, ClientSize.Width, bottom_button_height);
+ }
+
+ private void redraw(Graphics graphics) {
+ ButtonState top_button_state;
+ ButtonState bottom_button_state;
+
+ top_button_state = bottom_button_state = ButtonState.Normal;
+
+ if (mouse_pressed != 0) {
+ if ((mouse_pressed == 1) && top_button_rect.Contains(mouse_x, mouse_y)) {
+ top_button_state = ButtonState.Pushed;
+ }
+
+ if ((mouse_pressed == 2) && bottom_button_rect.Contains(mouse_x, mouse_y)) {
+ bottom_button_state = ButtonState.Pushed;
+ }
+ }
+
+ ControlPaint.DrawScrollButton(graphics, top_button_rect, ScrollButton.Up, top_button_state);
+ ControlPaint.DrawScrollButton(graphics, bottom_button_rect, ScrollButton.Down, bottom_button_state);
+ }
+
+ private void tmrRepeat_Tick(object sender, EventArgs e) {
+ if (repeat_delay > 1) {
+ repeat_counter++;
+
+ if (repeat_counter < repeat_delay) {
+ return;
+ }
+
+ repeat_counter = 0;
+ repeat_delay = (repeat_delay * 3 / 4);
+ }
+
+ if (mouse_pressed == 0) {
+ tmrRepeat.Enabled = false;
+ }
+
+ if ((mouse_pressed == 1) && top_button_rect.Contains(mouse_x, mouse_y)) {
+ owner.UpButton();
+ }
+
+ if ((mouse_pressed == 2) && bottom_button_rect.Contains(mouse_x, mouse_y)) {
+ owner.DownButton();
+ }
+ }
+ #endregion // Private & Internal Methods
+
+ #region Protected Instance Methods
+ protected override void OnMouseDown(MouseEventArgs e) {
+ this.Select(owner.txtView);
+
+ if (e.Button != MouseButtons.Left) {
+ return;
+ }
+
+ if (top_button_rect.Contains(e.X, e.Y)) {
+ mouse_pressed = 1;
+ owner.UpButton();
+ } else if (bottom_button_rect.Contains(e.X, e.Y)) {
+ mouse_pressed = 2;
+ owner.DownButton();
+ }
+
+ mouse_x = e.X;
+ mouse_y = e.Y;
+ Capture = true;
+
+ tmrRepeat.Enabled = true;
+ repeat_counter = 0;
+ repeat_delay = InitialRepeatDelay;
+
+ using (Graphics g = CreateGraphics()) {
+ redraw(g);
+ }
+ }
+
+ protected override void OnMouseMove(MouseEventArgs e) {
+ ButtonState before, after;
+
+ before = ButtonState.Normal;
+ if ((mouse_pressed == 1) && top_button_rect.Contains(mouse_x, mouse_y))
+ before = ButtonState.Pushed;
+ if ((mouse_pressed == 2) && bottom_button_rect.Contains(mouse_x, mouse_y))
+ before = ButtonState.Pushed;
+
+ mouse_x = e.X;
+ mouse_y = e.Y;
+
+ after = ButtonState.Normal;
+ if ((mouse_pressed == 1) && top_button_rect.Contains(mouse_x, mouse_y))
+ after = ButtonState.Pushed;
+ if ((mouse_pressed == 2) && bottom_button_rect.Contains(mouse_x, mouse_y))
+ after = ButtonState.Pushed;
+
+ if (before != after) {
+ if (after == ButtonState.Pushed) {
+ tmrRepeat.Enabled = true;
+ repeat_counter = 0;
+ repeat_delay = InitialRepeatDelay;
+
+ // fire off one right now too for good luck
+ if (mouse_pressed == 1)
+ owner.UpButton();
+ if (mouse_pressed == 2)
+ owner.DownButton();
+ }
+ else
+ tmrRepeat.Enabled = false;
+
+ using (Graphics g = CreateGraphics()) {
+ redraw(g);
+ }
+ }
+ }
+
+ protected override void OnMouseUp(MouseEventArgs e) {
+ mouse_pressed = 0;
+ Capture = false;
+
+ using (Graphics g = CreateGraphics()) {
+ redraw(g);
+ }
+ }
+
+ protected override void OnMouseWheel(MouseEventArgs e) {
+ if (e.Delta > 0)
+ owner.UpButton();
+ else if (e.Delta < 0)
+ owner.DownButton();
+ }
+
+ protected override void OnPaint(PaintEventArgs e) {
+ redraw(e.Graphics);
+ }
+
+ protected override void OnResize(EventArgs e) {
+ base.OnResize(e);
+ compute_rects();
+ }
+ #endregion // Protected Instance Methods
+ }
+ #endregion // UpDownSpinner Sub-class
+
+ #region Local Variables
+ internal TextBox txtView;
+ private UpDownSpinner spnSpinner;
+ private bool _InterceptArrowKeys = true;
+ private LeftRightAlignment _UpDownAlign;
+ private bool changing_text;
+ private bool user_edit;
+ #endregion // Local Variables
+
+ #region Public Constructors
+ public UpDownBase() {
+ _UpDownAlign = LeftRightAlignment.Right;
+ border_style = BorderStyle.Fixed3D;
+
+ spnSpinner = new UpDownSpinner(this);
+
+ txtView = new TextBox();
+ txtView.ModifiedChanged += new EventHandler(OnChanged);
+ txtView.AcceptsReturn = true;
+ txtView.AutoSize = false;
+ txtView.BorderStyle = BorderStyle.None;
+ txtView.Location = new System.Drawing.Point(17, 17);
+ txtView.TabIndex = 0;
+
+ SuspendLayout ();
+ Controls.AddImplicit (txtView);
+ Controls.AddImplicit (spnSpinner);
+ ResumeLayout ();
+
+ this.ActiveControl = txtView;
+
+ Height = PreferredHeight;
+ base.BackColor = txtView.BackColor;
+
+ txtView.MouseWheel += new MouseEventHandler(txtView_MouseWheel);
+
+ txtView.KeyDown += new KeyEventHandler(OnTextBoxKeyDown);
+ txtView.KeyPress += new KeyPressEventHandler(OnTextBoxKeyPress);
+ txtView.LostFocus += new EventHandler(OnTextBoxLostFocus);
+ txtView.Resize += new EventHandler(OnTextBoxResize);
+ txtView.TextChanged += new EventHandler(OnTextBoxTextChanged);
+
+ txtView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
+ this.Paint +=new PaintEventHandler(UpDownBase_Paint);
+
+ SetStyle(ControlStyles.FixedHeight, true);
+
+ UpdateEditText();
+ }
+ #endregion
+
+ #region Private Methods
+ void reseat_controls() {
+ int text_displacement = 0;
+
+ int spinner_width = 16;
+ //int spinner_width = ClientSize.Height;
+
+ if (_UpDownAlign == LeftRightAlignment.Left) {
+ spnSpinner.Bounds = new Rectangle(0, 0, spinner_width, ClientSize.Height);
+ text_displacement = spnSpinner.Width;
+
+ spnSpinner.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left;
+ } else {
+ spnSpinner.Bounds = new Rectangle(ClientSize.Width - spinner_width, 0, spinner_width, ClientSize.Height);
+
+ spnSpinner.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right;
+ }
+
+ txtView.Bounds = new Rectangle(text_displacement, 0, ClientSize.Width - spinner_width, Height);
+ }
+
+ private void txtView_MouseWheel(object sender, MouseEventArgs e) {
+ if (e.Delta > 0) {
+ UpButton();
+ } else if (e.Delta < 0) {
+ DownButton();
+ }
+ }
+
+
+ private void UpDownBase_Paint(object sender, PaintEventArgs e) {
+ e.Graphics.FillRectangle(ThemeEngine.Current.ResPool.GetSolidBrush(BackColor), ClientRectangle);
+ }
+ #endregion // Private Methods
+
+ #region Public Instance Properties
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool AutoScroll {
+ get {
+ return base.AutoScroll;
+ }
+
+ set {
+ base.AutoScroll = value;
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Size AutoScrollMargin {
+ get {
+ return base.AutoScrollMargin;
+ }
+
+ set {
+ base.AutoScrollMargin = value;
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Size AutoScrollMinSize {
+ get {
+ return base.AutoScrollMinSize;
+ }
+
+ set {
+ base.AutoScrollMinSize = value;
+ }
+ }
+
+ public override Color BackColor {
+ get {
+ return base.BackColor;
+ }
+
+ set {
+ base.BackColor = value;
+ txtView.BackColor = value;
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override Image BackgroundImage {
+ get {
+ return base.BackgroundImage;
+ }
+ set {
+ base.BackgroundImage = value;
+ txtView.BackgroundImage = value;
+ }
+ }
+
+
+ [DefaultValue(BorderStyle.Fixed3D)]
+ [DispId(-504)]
+ public BorderStyle BorderStyle {
+ get { return InternalBorderStyle; }
+ set { InternalBorderStyle = value; }
+ }
+
+ public override ContextMenu ContextMenu {
+ get {
+ return base.ContextMenu;
+ }
+ set {
+ base.ContextMenu = value;
+ txtView.ContextMenu = value;
+ spnSpinner.ContextMenu = value;
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public DockPaddingEdges DockPadding {
+ get {
+ return base.DockPadding;
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public override bool Focused {
+ get {
+ return txtView.Focused;
+ }
+ }
+
+ public override Color ForeColor {
+ get {
+ return base.ForeColor;
+ }
+ set {
+ base.ForeColor = value;
+ txtView.ForeColor = value;
+ }
+ }
+
+ [DefaultValue(true)]
+ public bool InterceptArrowKeys {
+ get {
+ return _InterceptArrowKeys;
+ }
+ set {
+ _InterceptArrowKeys = value;
+ }
+ }
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public int PreferredHeight {
+ get {
+ // For some reason, the TextBox's PreferredHeight does not
+ // change when the Font property is assigned. Without a
+ // border, it will always be Font.Height anyway.
+ //int text_box_preferred_height = (txtView != null) ? txtView.PreferredHeight : Font.Height;
+ int text_box_preferred_height = Font.Height;
+
+ switch (border_style) {
+ case BorderStyle.FixedSingle:
+ case BorderStyle.Fixed3D:
+ text_box_preferred_height += 3; // magic number? :-)
+
+ return text_box_preferred_height + 4;
+
+ case BorderStyle.None:
+ default:
+ return text_box_preferred_height;
+ }
+ }
+ }
+
+ [DefaultValue(false)]
+ public bool ReadOnly {
+ get {
+ return txtView.ReadOnly;
+ }
+ set {
+ txtView.ReadOnly = value;
+ }
+ }
+
+ [Localizable(true)]
+ public override string Text {
+ get {
+ return txtView.Text;
+ }
+ set {
+ bool suppress_validation = changing_text;
+
+ txtView.Text = value;
+
+ if (!suppress_validation)
+ ValidateEditText();
+ }
+ }
+
+ [DefaultValue(HorizontalAlignment.Left)]
+ [Localizable(true)]
+ public HorizontalAlignment TextAlign {
+ get {
+ return txtView.TextAlign;
+ }
+ set{
+ txtView.TextAlign = value;
+ }
+ }
+
+ [DefaultValue(LeftRightAlignment.Right)]
+ [Localizable(true)]
+ public LeftRightAlignment UpDownAlign {
+ get {
+ return _UpDownAlign;
+ }
+ set {
+ _UpDownAlign = value;
+
+ reseat_controls();
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Protected Instance Properties
+ protected bool ChangingText {
+ get {
+ return changing_text;
+ }
+ set {
+ changing_text = value;
+ }
+ }
+
+ protected override CreateParams CreateParams {
+ get {
+ return base.CreateParams;
+ }
+ }
+
+ protected override Size DefaultSize {
+ get {
+ return new Size(120, this.PreferredHeight);
+ }
+ }
+
+ protected bool UserEdit {
+ get {
+ return user_edit;
+ }
+ set {
+ user_edit = value;
+ }
+ }
+ #endregion // Protected Instance Properties
+
+ #region Public Instance Methods
+ public abstract void DownButton();
+ public void Select(int start, int length) {
+ txtView.Select(start, length);
+ }
+
+ public abstract void UpButton();
+ #endregion // Public Instance Methods
+
+ #region Protected Instance Methods
+ protected override void Dispose(bool disposing) {
+ if (disposing) {
+ txtView.Dispose();
+ txtView = null;
+
+ spnSpinner.Dispose();
+ spnSpinner = null;
+ }
+ base.Dispose (disposing);
+ }
+
+ [MonoTODO]
+ protected virtual void OnChanged(object source, EventArgs e) {
+ // FIXME
+ }
+
+ protected override void OnFontChanged(EventArgs e) {
+ txtView.Font = this.Font;
+ Height = PreferredHeight;
+ }
+
+ protected override void OnHandleCreated(EventArgs e) {
+ base.OnHandleCreated (e);
+ }
+
+ protected override void OnLayout(LayoutEventArgs e) {
+ base.OnLayout(e);
+ }
+
+ protected override void OnMouseWheel(MouseEventArgs e) {
+ // prevent this event from firing twice for the same mouse action!
+ if (GetChildAtPoint(new Point(e.X, e.Y)) == null)
+ txtView_MouseWheel(null, e);
+ }
+
+ protected virtual void OnTextBoxKeyDown(object source, KeyEventArgs e) {
+ if (_InterceptArrowKeys) {
+ if ((e.KeyCode == Keys.Up) || (e.KeyCode == Keys.Down)) {
+ e.Handled = true;
+
+ if (e.KeyCode == Keys.Up)
+ UpButton();
+ if (e.KeyCode == Keys.Down)
+ DownButton();
+ }
+ }
+
+ OnKeyDown(e);
+ }
+
+ protected virtual void OnTextBoxKeyPress(object source, KeyPressEventArgs e) {
+ if (e.KeyChar == '\r') {
+ e.Handled = true;
+ ValidateEditText();
+ }
+ OnKeyPress(e);
+ }
+
+ protected virtual void OnTextBoxLostFocus(object source, EventArgs e) {
+ if (user_edit) {
+ ValidateEditText();
+ }
+ }
+
+ protected virtual void OnTextBoxResize(object source, EventArgs e) {
+ // compute the new height, taking the border into account
+ Height = PreferredHeight;
+
+ // let anchoring reposition the controls
+ }
+
+ protected virtual void OnTextBoxTextChanged(object source, EventArgs e) {
+ if (changing_text) {
+ ChangingText = false;
+ } else {
+ UserEdit = true;
+ }
+
+ OnTextChanged(e);
+ }
+
+ protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified) {
+ base.SetBoundsCore(x, y, width, height, specified);
+
+ if ((specified & BoundsSpecified.Size) != BoundsSpecified.None) {
+ reseat_controls();
+ }
+ }
+
+ protected abstract void UpdateEditText();
+
+ protected virtual void ValidateEditText() {
+ // to be overridden by subclassers
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected override void WndProc(ref Message m) {
+ base.WndProc (ref m);
+ }
+ #endregion // Protected Instance Methods
+
+ #region Events
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler BackgroundImageChanged;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler MouseEnter;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler MouseHover;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event EventHandler MouseLeave;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new event MouseEventHandler MouseMove;
+ #endregion // Events
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/UpDownEventArgs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/UpDownEventArgs.cs
new file mode 100644
index 00000000000..e0174bb11c6
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/UpDownEventArgs.cs
@@ -0,0 +1,49 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public class UpDownEventArgs : EventArgs {
+ #region Local Variables
+ private int button_id;
+ #endregion // Local Variables
+
+ #region Public Constructors
+ public UpDownEventArgs(int buttonPushed) {
+ button_id = buttonPushed;
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ public int ButtonID {
+ get {
+ return button_id;
+ }
+ }
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/UpDownEventHandler.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/UpDownEventHandler.cs
new file mode 100644
index 00000000000..b91d9e4dea2
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/UpDownEventHandler.cs
@@ -0,0 +1,31 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+ public delegate void UpDownEventHandler(object source, UpDownEventArgs e);
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/UserControl.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/UserControl.cs
new file mode 100644
index 00000000000..ee06d476007
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/UserControl.cs
@@ -0,0 +1,103 @@
+// 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-2005 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+
+// COMPLETE
+
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+ [DefaultEvent("Load")]
+ [DesignerCategory("UserControl")]
+ [Designer("System.Windows.Forms.Design.ControlDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
+ [Designer("System.Windows.Forms.Design.UserControlDocumentDesigner, " + Consts.AssemblySystem_Design, typeof(IRootDesigner))]
+ public class UserControl : ContainerControl {
+ #region Public Constructors
+ public UserControl() {
+ }
+ #endregion // Public Constructors
+
+ #region Public Instance Properties
+ protected override Size DefaultSize {
+ get {
+ return new Size(150, 150);
+ }
+ }
+
+
+ [Bindable(false)]
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override string Text {
+ get {
+ return base.Text;
+ }
+
+ set {
+ base.Text = value;
+ }
+ }
+ #endregion // Public Instance Properties
+
+ #region Protected Instance Methods
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected override void OnCreateControl() {
+ base.OnCreateControl();
+
+ // The OnCreateControl isn't neccessarily raised *before* it
+ // becomes first visible, but that's the best we've got
+ OnLoad(EventArgs.Empty);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected virtual void OnLoad(EventArgs e) {
+ if (Load != null) Load(this, e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected override void OnMouseDown(MouseEventArgs e) {
+ base.OnMouseDown(e);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ protected override void WndProc(ref Message m) {
+ base.WndProc(ref m);
+ }
+ #endregion // Protected Instance Methods
+
+ #region Events
+ public event EventHandler Load;
+
+ [Browsable(false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler TextChanged;
+ #endregion // Events
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/VScrollBar.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/VScrollBar.cs
new file mode 100644
index 00000000000..8d5550071b0
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/VScrollBar.cs
@@ -0,0 +1,76 @@
+//
+// System.Windows.Forms.HScrollBar.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-2005, Novell, Inc.
+//
+// Authors:
+// Jordi Mas i Hernandez jordi@ximian.com
+//
+//
+//
+
+
+using System.Drawing;
+using System.ComponentModel;
+
+namespace System.Windows.Forms
+{
+ public class VScrollBar : ScrollBar
+ {
+ #region events
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ [Browsable (false)]
+ public new event EventHandler RightToLeftChanged;
+
+ #endregion Events
+
+ public VScrollBar()
+ {
+ vert = true;
+ }
+
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ [Browsable (false)]
+ public override RightToLeft RightToLeft {
+ get { return base.RightToLeft; }
+ set {
+ if (RightToLeft == value)
+ return;
+
+ base.RightToLeft = value;
+
+ if (RightToLeftChanged != null)
+ RightToLeftChanged (this, EventArgs.Empty);
+
+ }
+ }
+
+ protected override Size DefaultSize {
+ get { return ThemeEngine.Current.VScrollBarDefaultSize; }
+ }
+
+ protected override CreateParams CreateParams {
+ get { return base.CreateParams; }
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/View.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/View.cs
new file mode 100644
index 00000000000..5347823b51e
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/View.cs
@@ -0,0 +1,37 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Ravindra (rkumar@novell.com)
+//
+
+
+namespace System.Windows.Forms
+{
+ [Serializable]
+ public enum View
+ {
+ LargeIcon = 0,
+ Details = 1,
+ SmallIcon = 2,
+ List = 3
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Win32DnD.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Win32DnD.cs
new file mode 100644
index 00000000000..b85f172e254
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Win32DnD.cs
@@ -0,0 +1,1097 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Bartok (pbartok@novell.com)
+//
+//
+
+// NOT COMPLETE
+
+using System;
+using System.Collections;
+using System.Drawing;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Runtime.InteropServices;
+using System.Runtime.Serialization;
+using System.Text;
+
+namespace System.Windows.Forms {
+ internal class Win32DnD {
+ #region Local Variables
+ private const uint DATADIR_GET = 1;
+ private const uint S_OK = 0x00000000;
+ private const uint S_FALSE = 0x00000001;
+ private const uint DRAGDROP_S_DROP = 0x00040100;
+ private const uint DRAGDROP_S_CANCEL = 0x00040101;
+ private const uint DRAGDROP_S_USEDEFAULTCURSORS = 0x00040102;
+ private const uint E_NOTIMPL = unchecked((uint)0x80004001);
+ private const uint E_NOINTERFACE = unchecked((uint)0x80004002);
+ private const uint E_FAIL = unchecked((uint)0x80004005);
+ private const uint OLE_E_ADVISENOTSUPPORTED = unchecked((uint)0x80040003);
+ private const uint DV_E_FORMATETC = unchecked((uint)0x80040064);
+
+ // To call function pointers
+ private static MethodInfo GetDataMethod;
+ private static object[] GetDataArgs;
+
+ // IDataObject Delegates
+ private static QueryInterfaceDelegate DOQueryInterface;
+ private static AddRefDelegate DOAddRef;
+ private static ReleaseDelegate DORelease;
+ private static GetDataDelegate GetData;
+ private static GetDataHereDelegate GetDataHere;
+ private static QueryGetDataDelegate QueryGetData;
+ private static GetCanonicalFormatEtcDelegate GetCanonicalFormatEtc;
+ private static SetDataDelegate SetData;
+ private static EnumFormatEtcDelegate EnumFormatEtc;
+ private static DAdviseDelegate DAdvise;
+ private static DUnadviseDelegate DUnadvise;
+ private static EnumDAdviseDelegate EnumDAdvise;
+
+ // IDropSource Delegates
+ private static QueryInterfaceDelegate DSQueryInterface;
+ private static AddRefDelegate DSAddRef;
+ private static ReleaseDelegate DSRelease;
+ private static QueryContinueDragDelegate QueryContinueDrag;
+ private static GiveFeedbackDelegate GiveFeedback;
+
+ // IDropTarget Delegates
+ private static QueryInterfaceDelegate DTQueryInterface;
+ private static AddRefDelegate DTAddRef;
+ private static ReleaseDelegate DTRelease;
+ private static DragEnterDelegate DragEnter;
+ private static DragOverDelegate DragOver;
+ private static DragLeaveDelegate DragLeave;
+ private static DropDelegate Drop;
+
+ private static DragEventArgs DragDropEventArgs;
+ private static GiveFeedbackEventArgs DragFeedbackEventArgs;
+ private static QueryContinueDragEventArgs DragContinueEventArgs;
+ private static ArrayList DragFormats;
+ private static FORMATETC[] DragFormatArray;
+ private static ArrayList DragMediums;
+ #endregion // Local Variables
+
+ #region Delegate Definitions
+ // IUnknown
+ internal delegate uint QueryInterfaceDelegate(IntPtr @this, ref Guid riid, IntPtr ppvObject);
+ internal delegate uint AddRefDelegate(IntPtr @this);
+ internal delegate uint ReleaseDelegate(IntPtr @this);
+
+ // IDataObject
+ internal delegate uint GetDataDelegate(IntPtr @this, ref FORMATETC pformatetcIn, IntPtr pmedium);
+ internal delegate uint GetDataHereDelegate(IntPtr @this, ref FORMATETC pformatetc, ref STGMEDIUM pmedium);
+ internal delegate uint QueryGetDataDelegate(IntPtr @this, ref FORMATETC pformatetc);
+ internal delegate uint GetCanonicalFormatEtcDelegate(IntPtr @this, ref FORMATETC pformatetcIn, IntPtr pformatetcOut);
+ internal delegate uint SetDataDelegate(IntPtr @this, ref FORMATETC pformatetc, ref STGMEDIUM pmedium, bool release);
+ internal delegate uint EnumFormatEtcDelegate(IntPtr @this, uint direction, IntPtr ppenumFormatEtc);
+ internal delegate uint DAdviseDelegate(IntPtr @this, ref FORMATETC pformatetc, uint advf, IntPtr pAdvSink, ref uint pdwConnection);
+ internal delegate uint DUnadviseDelegate(IntPtr @this, uint pdwConnection);
+ internal delegate uint EnumDAdviseDelegate(IntPtr @this, IntPtr ppenumAdvise);
+
+ // IDropSource
+ internal delegate uint QueryContinueDragDelegate(IntPtr @this, bool fEscapePressed, uint grfkeyState);
+ internal delegate uint GiveFeedbackDelegate(IntPtr @this, uint pdwEffect);
+
+ // IDropTarget
+ internal delegate uint DragEnterDelegate(IntPtr @this, IntPtr pDataObj, uint grfkeyState, IntPtr pt_x, IntPtr pt_y, IntPtr pdwEffect);
+ internal delegate uint DragOverDelegate(IntPtr @this, uint grfkeyState, IntPtr pt_x, IntPtr pt_y, IntPtr pdwEffect);
+ internal delegate uint DragLeaveDelegate(IntPtr @this);
+ internal delegate uint DropDelegate(IntPtr @this, IntPtr pDataObj, uint grfkeyState, IntPtr pt_x, IntPtr pt_y, IntPtr pdwEffect);
+ #endregion // Delegate Definitions
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct FORMATETC {
+ [MarshalAs(UnmanagedType.U2)]
+ internal ClipboardFormats cfFormat;
+ internal IntPtr ptd;
+ internal DVASPECT dwAspect;
+ internal int lindex;
+ internal TYMED tymed;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct STGMEDIUM {
+ internal TYMED tymed;
+ internal IntPtr hHandle;
+ internal IntPtr pUnkForRelease;
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
+ internal struct DROPFILES {
+ internal uint pFiles;
+ internal uint pt_x;
+ internal uint pt_y;
+ internal bool fNC;
+ internal bool fWide;
+ internal string pText;
+ }
+
+ internal enum DVASPECT {
+ DVASPECT_CONTENT = 1,
+ DVASPECT_THUMBNAIL = 2,
+ DVASPECT_ICON = 4,
+ DVASPECT_DOCPRINT = 8
+ }
+
+ internal enum TYMED {
+ TYMED_HGLOBAL = 1,
+ TYMED_FILE = 2,
+ TYMED_ISTREAM = 4,
+ TYMED_ISTORAGE = 8,
+ TYMED_GDI = 16,
+ TYMED_MFPICT = 32,
+ TYMED_ENHMF = 64,
+ TYMED_NULL = 0
+ }
+
+ private static readonly Guid IID_IUnknown = new Guid("00000000-0000-0000-C000-000000000046");
+ private static readonly Guid IID_IDataObject = new Guid("0000010e-0000-0000-C000-000000000046");
+ private static readonly Guid IID_IDropSource = new Guid("00000121-0000-0000-C000-000000000046");
+ private static readonly Guid IID_IDropTarget = new Guid("00000122-0000-0000-C000-000000000046");
+
+ internal Win32DnD() {
+ // Required for all other OLE functions to work
+ Win32OleInitialize(IntPtr.Zero);
+
+ // We reuse those
+ DragDropEventArgs = new DragEventArgs(new DataObject(DataFormats.FileDrop, new string[0]), 0, 0, 0, DragDropEffects.None, DragDropEffects.None);
+ DragFeedbackEventArgs = new GiveFeedbackEventArgs(DragDropEffects.None, true);
+ DragContinueEventArgs = new QueryContinueDragEventArgs(0, false, DragAction.Continue);
+ DragFormats = new ArrayList();
+ DragFormatArray = new FORMATETC[0];
+ DragMediums = new ArrayList();
+
+ // Set up delegates
+ // IDataObject
+ DOQueryInterface = new QueryInterfaceDelegate(ComIDataObject.QueryInterface);
+ DOAddRef = new AddRefDelegate(ComIDataObject.AddRef);
+ DORelease = new ReleaseDelegate(ComIDataObject.Release);
+ GetData = new GetDataDelegate(ComIDataObject.GetData);
+ GetDataHere = new GetDataHereDelegate(ComIDataObject.GetDataHere);
+ QueryGetData = new QueryGetDataDelegate(ComIDataObject.QueryGetData);
+ GetCanonicalFormatEtc = new GetCanonicalFormatEtcDelegate(ComIDataObject.GetCanonicalFormatEtc);
+ SetData = new SetDataDelegate(ComIDataObject.SetData);
+ EnumFormatEtc = new EnumFormatEtcDelegate(ComIDataObject.EnumFormatEtc);
+ DAdvise = new DAdviseDelegate(ComIDataObject.DAdvise);
+ DUnadvise = new DUnadviseDelegate(ComIDataObject.DUnadvise);
+ EnumDAdvise = new EnumDAdviseDelegate(ComIDataObject.EnumDAdvise);
+
+ // IDropSource
+ DSQueryInterface = new QueryInterfaceDelegate(ComIDropSource.QueryInterface);
+ DSAddRef = new AddRefDelegate(ComIDropSource.AddRef);
+ DSRelease = new ReleaseDelegate(ComIDropSource.Release);
+ QueryContinueDrag = new QueryContinueDragDelegate(ComIDropSource.QueryContinueDrag);
+ GiveFeedback = new GiveFeedbackDelegate(ComIDropSource.GiveFeedback);
+
+ // IDropTarget
+ DTQueryInterface = new QueryInterfaceDelegate(ComIDropTarget.QueryInterface);
+ DTAddRef = new AddRefDelegate(ComIDropTarget.AddRef);
+ DTRelease = new ReleaseDelegate(ComIDropTarget.Release);
+ DragEnter = new DragEnterDelegate(ComIDropTarget.DragEnter);
+ DragOver = new DragOverDelegate(ComIDropTarget.DragOver);
+ DragLeave = new DragLeaveDelegate(ComIDropTarget.DragLeave);
+ Drop = new DropDelegate(ComIDropTarget.Drop);
+ }
+
+ internal class ComIDataObject {
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct DataObjectStruct {
+ internal IntPtr vtbl;
+ internal QueryInterfaceDelegate QueryInterface;
+ internal AddRefDelegate AddRef;
+ internal ReleaseDelegate Release;
+ internal GetDataDelegate GetData;
+ internal GetDataHereDelegate GetDataHere;
+ internal QueryGetDataDelegate QueryGetData;
+ internal GetCanonicalFormatEtcDelegate GetCanonicalFormatEtc;
+ internal SetDataDelegate SetData;
+ internal EnumFormatEtcDelegate EnumFormatEtc;
+ internal DAdviseDelegate DAdvise;
+ internal DUnadviseDelegate DUnadvise;
+ internal EnumDAdviseDelegate EnumDAdvise;
+ }
+
+ internal static IntPtr GetUnmanaged() {
+ DataObjectStruct data_object;
+ IntPtr data_object_ptr;
+ long offset;
+
+ data_object = new DataObjectStruct();
+
+ data_object.QueryInterface = Win32DnD.DOQueryInterface;
+ data_object.AddRef = Win32DnD.DOAddRef;
+ data_object.Release = Win32DnD.DORelease;
+ data_object.GetData = Win32DnD.GetData;
+ data_object.GetDataHere = Win32DnD.GetDataHere;
+ data_object.QueryGetData = Win32DnD.QueryGetData;
+ data_object.GetCanonicalFormatEtc = Win32DnD.GetCanonicalFormatEtc;
+ data_object.SetData = Win32DnD.SetData;
+ data_object.EnumFormatEtc = Win32DnD.EnumFormatEtc;
+ data_object.DAdvise = Win32DnD.DAdvise;
+ data_object.DUnadvise = Win32DnD.DUnadvise;
+ data_object.EnumDAdvise = Win32DnD.EnumDAdvise;
+
+ data_object_ptr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(DataObjectStruct)));
+ Marshal.StructureToPtr(data_object, data_object_ptr, false);
+
+ // Update vtbl pointer
+ offset = data_object_ptr.ToInt64();
+ offset += Marshal.SizeOf(typeof(IntPtr));
+ Marshal.WriteIntPtr(data_object_ptr, new IntPtr(offset));
+
+ return data_object_ptr;
+ }
+
+ internal static void ReleaseUnmanaged(IntPtr data_object_ptr) {
+ Marshal.FreeHGlobal(data_object_ptr);
+ }
+
+ internal static uint QueryInterface(IntPtr @this, ref Guid riid, IntPtr ppvObject) {
+ try {
+ if (IID_IUnknown.Equals(riid) || IID_IDataObject.Equals(riid)) {
+ Marshal.WriteIntPtr(ppvObject, @this);
+ return S_OK;
+ }
+ }
+
+ catch (Exception e) {
+ Console.WriteLine("Got exception {0}", e.Message);
+ }
+
+ Marshal.WriteIntPtr(ppvObject, IntPtr.Zero);
+ return E_NOINTERFACE;
+ }
+
+ internal static uint AddRef(IntPtr @this) {
+ // We only use this for DnD, try and fake it
+ return 1;
+ }
+
+ internal static uint Release(IntPtr @this) {
+ // We only use this for DnD, try and fake it
+ return 0;
+ }
+
+ internal static STGMEDIUM medium = new STGMEDIUM();
+ internal static uint GetData(IntPtr this_, ref FORMATETC pformatetcIn, IntPtr pmedium) {
+ int index;
+
+ index = FindFormat(pformatetcIn);
+ if (index != -1) {
+ medium.tymed = TYMED.TYMED_HGLOBAL;
+ medium.hHandle = XplatUIWin32.DupGlobalMem(((STGMEDIUM)DragMediums[index]).hHandle);
+ medium.pUnkForRelease = IntPtr.Zero;
+ try {
+ Marshal.StructureToPtr(medium, pmedium, false);
+ }
+ catch (Exception e) {
+ Console.WriteLine("Error: {0}", e.Message);
+ }
+ return S_OK;
+ }
+
+ return DV_E_FORMATETC;
+ }
+
+ internal static uint GetDataHere(IntPtr @this, ref FORMATETC pformatetc, ref STGMEDIUM pmedium) {
+ return DV_E_FORMATETC;
+ }
+
+ internal static uint QueryGetData(IntPtr @this, ref FORMATETC pformatetc) {
+ if (FindFormat(pformatetc) != -1) {
+ return S_OK;
+ }
+ return DV_E_FORMATETC;
+ }
+
+ internal static uint GetCanonicalFormatEtc(IntPtr @this, ref FORMATETC pformatetcIn, IntPtr pformatetcOut) {
+ Marshal.WriteIntPtr(pformatetcOut, Marshal.SizeOf(typeof(IntPtr)), IntPtr.Zero);
+ return E_NOTIMPL;
+ }
+
+ internal static uint SetData(IntPtr this_, ref FORMATETC pformatetc, ref STGMEDIUM pmedium, bool release) {
+ return E_NOTIMPL;
+ }
+
+ internal static uint EnumFormatEtc(IntPtr this_, uint direction, IntPtr ppenumFormatEtc) {
+ if (direction == DATADIR_GET) {
+ IntPtr ppenum_ptr;
+
+ ppenum_ptr = IntPtr.Zero;
+ DragFormatArray = new FORMATETC[DragFormats.Count];
+
+ for (int i = 0; i < DragFormats.Count; i++) {
+ DragFormatArray[i] = (FORMATETC)DragFormats[i];
+ }
+ Win32SHCreateStdEnumFmtEtc((uint)DragFormatArray.Length, DragFormatArray, ref ppenum_ptr);
+ Marshal.WriteIntPtr(ppenumFormatEtc, ppenum_ptr);
+ return S_OK;
+ }
+ return E_NOTIMPL;
+ }
+
+ internal static uint DAdvise(IntPtr this_, ref FORMATETC pformatetc, uint advf, IntPtr pAdvSink, ref uint pdwConnection) {
+ return OLE_E_ADVISENOTSUPPORTED;
+ }
+
+ internal static uint DUnadvise(IntPtr this_, uint pdwConnection) {
+ return OLE_E_ADVISENOTSUPPORTED;
+ }
+
+ internal static uint EnumDAdvise(IntPtr this_, IntPtr ppenumAdvise) {
+ return OLE_E_ADVISENOTSUPPORTED;
+ }
+ }
+
+ internal class ComIDataObjectUnmanaged {
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct IDataObjectUnmanaged {
+ internal IntPtr QueryInterface;
+ internal IntPtr AddRef;
+ internal IntPtr Release;
+ internal IntPtr GetData;
+ internal IntPtr GetDataHere;
+ internal IntPtr QueryGetData;
+ internal IntPtr GetCanonicalFormatEtc;
+ internal IntPtr SetData;
+ internal IntPtr EnumFormatEtc;
+ internal IntPtr DAdvise;
+ internal IntPtr DUnadvise;
+ internal IntPtr EnumDAdvise;
+ }
+
+ private static bool Initialized;
+ private static MethodInfo GetDataMethod;
+ private static MethodInfo GetDataHereMethod;
+ private static MethodInfo QueryGetDataMethod;
+ private static MethodInfo GetCanonicalFormatEtcMethod;
+ private static MethodInfo SetDataMethod;
+ private static MethodInfo EnumFormatEtcMethod;
+ private static MethodInfo DAdviseMethod;
+ private static MethodInfo DUnadviseMethod;
+ private static MethodInfo EnumDAdviseMethod;
+ private static object[] MethodArguments;
+
+ private IDataObjectUnmanaged vtbl;
+ private IntPtr @this;
+
+ internal ComIDataObjectUnmanaged(IntPtr data_object_ptr) {
+ if (!Initialized) {
+ Initialize();
+ }
+
+ vtbl = new IDataObjectUnmanaged();
+ @this = data_object_ptr;
+ try {
+ vtbl = (IDataObjectUnmanaged)Marshal.PtrToStructure(Marshal.ReadIntPtr(data_object_ptr), typeof(IDataObjectUnmanaged));
+ }
+
+ catch (Exception e) {
+ Console.WriteLine("Exception {0}", e.Message);
+ }
+ }
+
+ private static void Initialize() {
+ AssemblyName assembly;
+ AssemblyBuilder assembly_builder;
+
+ if (Initialized) {
+ return;
+ }
+
+ assembly = new AssemblyName();
+ assembly.Name = "XplatUIWin32.FuncPtrInterface";
+ assembly_builder = AppDomain.CurrentDomain.DefineDynamicAssembly(assembly, AssemblyBuilderAccess.Run);
+
+ MethodArguments = new object[6];
+ GetDataMethod = CreateFuncPtrInterface(assembly_builder, "GetData", typeof(uint), 3);
+ GetDataHereMethod = CreateFuncPtrInterface(assembly_builder, "GetDataHere", typeof(uint), 3);
+ QueryGetDataMethod = CreateFuncPtrInterface(assembly_builder, "QueryGetData", typeof(uint), 2);
+ GetCanonicalFormatEtcMethod = CreateFuncPtrInterface(assembly_builder, "GetCanonicalFormatEtc", typeof(uint), 3);
+ SetDataMethod = CreateFuncPtrInterface(assembly_builder, "SetData", typeof(uint), 4);
+ EnumFormatEtcMethod = CreateFuncPtrInterface(assembly_builder, "EnumFormatEtc", typeof(uint), 3);
+ DAdviseMethod = CreateFuncPtrInterface(assembly_builder, "DAdvise", typeof(uint), 5);
+ DUnadviseMethod = CreateFuncPtrInterface(assembly_builder, "DUnadvise", typeof(uint), 2);
+ EnumDAdviseMethod = CreateFuncPtrInterface(assembly_builder, "EnumDAdvise", typeof(uint), 2);
+
+ Initialized = true;
+ }
+
+ internal uint QueryInterface(Guid riid, IntPtr ppvObject) {
+ uint ret;
+ IntPtr riid_ptr;
+
+ riid_ptr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Guid)));
+ Marshal.StructureToPtr(riid, riid_ptr, false);
+
+ MethodArguments[0] = vtbl.QueryInterface;
+ MethodArguments[1] = this.@this;
+ MethodArguments[2] = riid_ptr;
+ MethodArguments[3] = ppvObject;
+
+ try {
+ ret = (uint)GetDataMethod.Invoke(null, MethodArguments);
+ }
+
+ catch (Exception e) {
+ Console.WriteLine("Caught exception {0}", e.Message);
+ ret = E_FAIL;
+ }
+
+ Marshal.FreeHGlobal(riid_ptr);
+
+ return ret;
+ }
+
+ internal uint AddRef() {
+ // We only use this for DnD, try and fake it
+ return 1;
+ }
+
+ internal uint Release() {
+ // We only use this for DnD, try and fake it
+ return 0;
+ }
+
+ internal uint GetData(FORMATETC pformatetcIn, ref STGMEDIUM pmedium) {
+ uint ret;
+ IntPtr pformatetcIn_ptr;
+ IntPtr pmedium_ptr;
+
+ pformatetcIn_ptr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(FORMATETC)));
+ Marshal.StructureToPtr(pformatetcIn, pformatetcIn_ptr, false);
+
+ pmedium_ptr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(STGMEDIUM)));
+
+ MethodArguments[0] = vtbl.GetData;
+ MethodArguments[1] = this.@this;
+ MethodArguments[2] = pformatetcIn_ptr;
+ MethodArguments[3] = pmedium_ptr;
+
+ try {
+ ret = (uint)GetDataMethod.Invoke(null, MethodArguments);
+ Marshal.PtrToStructure(pmedium_ptr, pmedium);
+ }
+
+ catch (Exception e) {
+ Console.WriteLine("Caught exception {0}", e.Message);
+ ret = E_FAIL;
+ }
+
+ Marshal.FreeHGlobal(pformatetcIn_ptr);
+ Marshal.FreeHGlobal(pmedium_ptr);
+
+ return ret;
+ }
+
+ internal uint GetDataHere(FORMATETC pformatetc, ref STGMEDIUM pmedium) {
+ return E_NOTIMPL;
+ }
+
+ internal uint QueryGetData(FORMATETC pformatetc) {
+ uint ret;
+ IntPtr pformatetc_ptr;
+
+ pformatetc_ptr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(FORMATETC)));
+ Marshal.StructureToPtr(pformatetc, pformatetc_ptr, false);
+
+ MethodArguments[0] = vtbl.GetData;
+ MethodArguments[1] = this.@this;
+ MethodArguments[2] = pformatetc_ptr;
+
+ try {
+ ret = (uint)QueryGetDataMethod.Invoke(null, MethodArguments);
+ }
+
+ catch (Exception e) {
+ Console.WriteLine("Caught exception {0}", e.Message);
+ ret = E_FAIL;
+ }
+
+ Marshal.FreeHGlobal(pformatetc_ptr);
+
+ return ret;
+ }
+
+ internal uint GetCanonicalFormatEtc(FORMATETC pformatetcIn, ref FORMATETC pformatetcOut) {
+ return E_NOTIMPL;
+ }
+
+ internal uint SetData(FORMATETC pformatetc, STGMEDIUM pmedium, bool release) {
+ return E_NOTIMPL;
+ }
+
+ internal uint EnumFormatEtc(uint direction, IntPtr ppenumFormatEtc) {
+ return E_NOTIMPL;
+ }
+
+ internal uint DAdvise(FORMATETC pformatetc, uint advf, IntPtr pAdvSink, ref uint pdwConnection) {
+ return OLE_E_ADVISENOTSUPPORTED;
+ }
+
+ internal uint DUnadvise(uint pdwConnection) {
+ return OLE_E_ADVISENOTSUPPORTED;
+ }
+
+ internal uint EnumDAdvise(IntPtr ppenumAdvise) {
+ return OLE_E_ADVISENOTSUPPORTED;
+ }
+ }
+
+
+ internal class ComIDropSource {
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct IDropSource {
+ internal IntPtr vtbl;
+ internal IntPtr Window;
+ internal QueryInterfaceDelegate QueryInterface;
+ internal AddRefDelegate AddRef;
+ internal ReleaseDelegate Release;
+ internal QueryContinueDragDelegate QueryContinueDrag;
+ internal GiveFeedbackDelegate GiveFeedback;
+ }
+
+ internal static IntPtr GetUnmanaged(IntPtr Window) {
+ IDropSource drop_source;
+ IntPtr drop_source_ptr;
+ long offset;
+
+ drop_source = new IDropSource();
+ drop_source.QueryInterface = Win32DnD.DSQueryInterface;
+ drop_source.AddRef = Win32DnD.DSAddRef;
+ drop_source.Release = Win32DnD.DSRelease;
+ drop_source.QueryContinueDrag = Win32DnD.QueryContinueDrag;
+ drop_source.GiveFeedback = Win32DnD.GiveFeedback;
+ drop_source.Window = Window;
+
+ drop_source_ptr = Marshal.AllocHGlobal(Marshal.SizeOf(drop_source));
+ Marshal.StructureToPtr(drop_source, drop_source_ptr, false);
+
+ // Update vtbl pointer
+ offset = drop_source_ptr.ToInt64();
+ offset += 2 * Marshal.SizeOf(typeof(IntPtr));
+ Marshal.WriteIntPtr(drop_source_ptr, new IntPtr(offset));
+
+ return drop_source_ptr;
+ }
+
+ internal static void ReleaseUnmanaged(IntPtr drop_source_ptr) {
+ Marshal.FreeHGlobal(drop_source_ptr);
+ }
+
+ internal static uint QueryInterface(IntPtr @this, ref Guid riid, IntPtr ppvObject) {
+ try {
+ if (IID_IUnknown.Equals(riid) || IID_IDropSource.Equals(riid)) {
+ Marshal.WriteIntPtr(ppvObject, @this);
+ return S_OK;
+ }
+ }
+
+ catch (Exception e) {
+ Console.WriteLine("Got exception {0}", e.Message);
+ }
+
+ Marshal.WriteIntPtr(ppvObject, IntPtr.Zero);
+ return E_NOINTERFACE;
+ }
+
+ internal static uint AddRef(IntPtr @this) {
+ // We only use this for DnD, try and fake it
+ return 1;
+ }
+
+ internal static uint Release(IntPtr @this) {
+ // We only use this for DnD, try and fake it
+ return 0;
+ }
+
+ internal static uint QueryContinueDrag(IntPtr @this, bool fEscapePressed, uint grfkeyState) {
+ IntPtr window;
+
+ window = Marshal.ReadIntPtr(@this, Marshal.SizeOf(typeof(IntPtr)));
+
+ // LAMESPEC? - according to MSDN, when the any mousebutton is *pressed* it defaults to Drop.
+ // According to COM customary behaviour it's the other way round; which is what we do here
+ if (fEscapePressed) {
+ DragContinueEventArgs.drag_action = DragAction.Cancel;
+ } else if ((grfkeyState & (1+2+16)) == 0) { // Left, middle and right mouse button not pressed
+ DragContinueEventArgs.drag_action = DragAction.Drop;
+ } else {
+ DragContinueEventArgs.drag_action = DragAction.Continue;
+ }
+
+ DragContinueEventArgs.escape_pressed = fEscapePressed;
+ DragContinueEventArgs.key_state = (int)grfkeyState;
+
+ Control.FromHandle(window).DndContinueDrag(DragContinueEventArgs);
+
+ if (DragContinueEventArgs.drag_action == DragAction.Cancel) {
+ return DRAGDROP_S_CANCEL;
+ } else if (DragContinueEventArgs.drag_action == DragAction.Drop) {
+ return DRAGDROP_S_DROP;
+ }
+ return S_OK;
+ }
+
+ internal static uint GiveFeedback(IntPtr @this, uint pdwEffect) {
+ IntPtr window;
+
+ window = Marshal.ReadIntPtr(@this, Marshal.SizeOf(typeof(IntPtr)));
+
+ DragFeedbackEventArgs.effect = (DragDropEffects)pdwEffect;
+ DragFeedbackEventArgs.use_default_cursors = true;
+
+ Control.FromHandle(window).DndFeedback(DragFeedbackEventArgs);
+
+ if (DragFeedbackEventArgs.use_default_cursors) {
+ return DRAGDROP_S_USEDEFAULTCURSORS;
+ }
+ return S_OK;
+ }
+ }
+
+ internal class ComIDropTarget {
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct IDropTarget {
+ internal IntPtr vtbl;
+ internal IntPtr Window;
+ internal QueryInterfaceDelegate QueryInterface;
+ internal AddRefDelegate AddRef;
+ internal ReleaseDelegate Release;
+
+ internal DragEnterDelegate DragEnter;
+ internal DragOverDelegate DragOver;
+ internal DragLeaveDelegate DragLeave;
+ internal DropDelegate Drop;
+ }
+
+ internal static IntPtr GetUnmanaged(IntPtr Window) {
+ IDropTarget drop_target;
+ IntPtr drop_target_ptr;
+ long offset;
+
+ drop_target = new IDropTarget();
+ drop_target.QueryInterface = Win32DnD.DTQueryInterface;
+ drop_target.AddRef = Win32DnD.DTAddRef;
+ drop_target.Release = Win32DnD.DTRelease;
+ drop_target.DragEnter = Win32DnD.DragEnter;
+ drop_target.DragOver = Win32DnD.DragOver;
+ drop_target.DragLeave = Win32DnD.DragLeave;
+ drop_target.Drop = Win32DnD.Drop;
+ drop_target.Window = Window;
+
+ drop_target_ptr = Marshal.AllocHGlobal(Marshal.SizeOf(drop_target));
+ Marshal.StructureToPtr(drop_target, drop_target_ptr, false);
+
+ // Update vtbl pointer
+ offset = drop_target_ptr.ToInt64();
+ offset += 2 * Marshal.SizeOf(typeof(IntPtr));
+ Marshal.WriteIntPtr(drop_target_ptr, new IntPtr(offset));
+
+ return drop_target_ptr;
+ }
+
+ internal static void ReleaseUnmanaged(IntPtr drop_target_ptr) {
+ Marshal.FreeHGlobal(drop_target_ptr);
+ }
+
+ internal static uint QueryInterface(IntPtr @this, ref Guid riid, IntPtr ppvObject) {
+ try {
+ if (IID_IUnknown.Equals(riid) || IID_IDropTarget.Equals(riid)) {
+ Marshal.WriteIntPtr(ppvObject, @this);
+ return S_OK;
+ }
+ }
+
+ catch (Exception e) {
+ Console.WriteLine("Got exception {0}", e.Message);
+ }
+
+ Marshal.WriteIntPtr(ppvObject, IntPtr.Zero);
+ return E_NOINTERFACE;
+ }
+
+ internal static uint AddRef(IntPtr @this) {
+ // We only use this for DnD, try and fake it
+ return 1;
+ }
+
+ internal static uint Release(IntPtr @this) {
+ // We only use this for DnD, try and fake it
+ return 0;
+ }
+
+ internal static uint DragEnter(IntPtr @this, IntPtr pDataObj, uint grfkeyState, IntPtr pt_x, IntPtr pt_y, IntPtr pdwEffect) {
+ IntPtr window;
+
+ window = Marshal.ReadIntPtr(@this, Marshal.SizeOf(typeof(IntPtr)));
+
+ DragDropEventArgs.x = pt_x.ToInt32();
+ DragDropEventArgs.y = pt_y.ToInt32();
+ DragDropEventArgs.allowed_effect = (DragDropEffects)Marshal.ReadIntPtr(pdwEffect).ToInt32();
+ DragDropEventArgs.current_effect = DragDropEventArgs.AllowedEffect;
+ DragDropEventArgs.keystate = (int)grfkeyState;
+
+ Control.FromHandle(window).DndEnter(DragDropEventArgs);
+
+ Marshal.WriteInt32(pdwEffect, (int)DragDropEventArgs.Effect);
+
+ return S_OK;
+ }
+
+ internal static uint DragOver(IntPtr @this, uint grfkeyState, IntPtr pt_x, IntPtr pt_y, IntPtr pdwEffect) {
+ IntPtr window;
+
+ window = Marshal.ReadIntPtr(@this, Marshal.SizeOf(typeof(IntPtr)));
+
+ DragDropEventArgs.x = pt_x.ToInt32();
+ DragDropEventArgs.y = pt_y.ToInt32();
+ DragDropEventArgs.allowed_effect = (DragDropEffects)Marshal.ReadIntPtr(pdwEffect).ToInt32();
+ DragDropEventArgs.current_effect = DragDropEventArgs.AllowedEffect;
+ DragDropEventArgs.keystate = (int)grfkeyState;
+
+ Control.FromHandle(window).DndOver(DragDropEventArgs);
+
+ Marshal.WriteInt32(pdwEffect, (int)DragDropEventArgs.Effect);
+
+ return S_OK;
+ }
+
+ internal static uint DragLeave(IntPtr @this) {
+ IntPtr window;
+
+ window = Marshal.ReadIntPtr(@this, Marshal.SizeOf(typeof(IntPtr)));
+
+ Control.FromHandle(window).DndLeave(EventArgs.Empty);
+
+ return S_OK;
+ }
+
+ internal static uint Drop(IntPtr @this, IntPtr pDataObj, uint grfkeyState, IntPtr pt_x, IntPtr pt_y, IntPtr pdwEffect) {
+ throw new Exception("Yeah baby, gimme a ride to WM_DROPFILES land");
+
+ #if InTheFuture
+ ComIDataObjectUnmanaged data_object;
+ FORMATETC format;
+ STGMEDIUM medium;
+ uint result;
+ IntPtr mem;
+
+
+ data_object = new ComIDataObjectUnmanaged(pDataObj);
+
+ format = new FORMATETC();
+ format.cfFormat = ClipboardFormats.CF_HDROP;
+ format.ptd = IntPtr.Zero;
+ format.dwAspect = DVASPECT.DVASPECT_CONTENT;
+ format.lindex = -1;
+ format.tymed = TYMED.TYMED_HGLOBAL;
+
+ medium = new STGMEDIUM();
+ medium.tymed = TYMED.TYMED_HGLOBAL;
+
+ //mem = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(IntPtr)));
+ //result = data_object.QueryInterface(IID_IDataObject, mem);
+ //Marshal.FreeHGlobal(mem);
+
+ //result = data_object.AddRef();
+
+ result = data_object.QueryGetData(format);
+
+ result = data_object.GetData(format, ref medium);
+
+ return E_NOTIMPL;
+ #endif
+ }
+ }
+
+ internal static bool HandleWMDropFiles(ref MSG msg) {
+ IntPtr hDrop;
+ int count;
+ StringBuilder sb;
+ string[] dropfiles;
+
+ hDrop = msg.wParam;
+ count = Win32DragQueryFile(hDrop, -1, IntPtr.Zero, 0);
+
+ dropfiles = new string[count];
+
+ sb = new StringBuilder(256);
+ for (int i = 0; i < count; i++) {
+ Win32DragQueryFile(hDrop, i, sb, sb.Capacity);
+ dropfiles[i] = sb.ToString();
+ }
+
+ DragDropEventArgs.Data.SetData(DataFormats.FileDrop, dropfiles);
+
+ Control.FromHandle(msg.hwnd).DndDrop(DragDropEventArgs);
+
+ return true;
+ }
+
+ private static bool AddFormatAndMedium(ClipboardFormats cfFormat, object data) {
+ STGMEDIUM medium;
+ FORMATETC format;
+ IntPtr hmem;
+ IntPtr hmem_ptr;
+ byte[] b;
+
+ switch(cfFormat) {
+ case ClipboardFormats.CF_TEXT: {
+ hmem = Marshal.StringToHGlobalAnsi((string)data);
+ break;
+ }
+
+ case ClipboardFormats.CF_UNICODETEXT: {
+ hmem = Marshal.StringToHGlobalUni((string)data);
+ break;
+ }
+
+ case ClipboardFormats.CF_HDROP: {
+ IEnumerator e;
+ StringBuilder sb;
+ long hmem_string_ptr;
+ IntPtr string_buffer;
+ int string_buffer_size;
+
+ sb = new StringBuilder();
+
+ // Make sure object is enumerable; otherwise
+ if ((data is string) || !(data is IEnumerable)) {
+ sb.Append(data.ToString());
+ sb.Append('\0');
+ sb.Append('\0');
+ } else {
+ e = ((IEnumerable)data).GetEnumerator();
+ while (e.MoveNext()) {
+ sb.Append(e.Current.ToString());
+ sb.Append('\0');
+ }
+ sb.Append('\0');
+ }
+
+ string_buffer = Marshal.StringToHGlobalUni(sb.ToString());
+ string_buffer_size = (int)XplatUIWin32.Win32GlobalSize(string_buffer);
+
+ // Write DROPFILES structure
+ hmem = XplatUIWin32.Win32GlobalAlloc(XplatUIWin32.GAllocFlags.GMEM_MOVEABLE | XplatUIWin32.GAllocFlags.GMEM_DDESHARE, 0x14 + string_buffer_size);
+ hmem_ptr = XplatUIWin32.Win32GlobalLock(hmem);
+ Marshal.WriteInt32(hmem_ptr, 0x14); // pFiles
+ Marshal.WriteInt32(hmem_ptr, 1 * Marshal.SizeOf(typeof(uint)), 0); // point.x
+ Marshal.WriteInt32(hmem_ptr, 2 * Marshal.SizeOf(typeof(uint)), 0); // point.y
+ Marshal.WriteInt32(hmem_ptr, 3 * Marshal.SizeOf(typeof(uint)), 0); // fNc
+ Marshal.WriteInt32(hmem_ptr, 4 * Marshal.SizeOf(typeof(uint)), 1); // fWide
+
+ hmem_string_ptr = (long)hmem_ptr;
+ hmem_string_ptr += 0x14;
+
+ XplatUIWin32.Win32CopyMemory(new IntPtr(hmem_string_ptr), string_buffer, string_buffer_size);
+ Marshal.FreeHGlobal(string_buffer);
+ XplatUIWin32.Win32GlobalUnlock(hmem_ptr);
+
+ break;
+ }
+
+ case ClipboardFormats.CF_DIB: {
+ b = XplatUIWin32.ImageToDIB((Image)data);
+
+ hmem = XplatUIWin32.Win32GlobalAlloc(XplatUIWin32.GAllocFlags.GMEM_MOVEABLE | XplatUIWin32.GAllocFlags.GMEM_DDESHARE, b.Length);
+ hmem_ptr = XplatUIWin32.Win32GlobalLock(hmem);
+ Marshal.Copy(b, 0, hmem_ptr, b.Length);
+ XplatUIWin32.Win32GlobalUnlock(hmem);
+ break;
+ }
+
+ default: {
+ hmem = IntPtr.Zero;
+ break;
+ }
+ }
+
+ if (hmem != IntPtr.Zero) {
+ medium = new STGMEDIUM();
+ medium.tymed = TYMED.TYMED_HGLOBAL;
+ medium.hHandle = hmem;
+ medium.pUnkForRelease = IntPtr.Zero;
+ DragMediums.Add(medium);
+
+ format = new FORMATETC();
+ format.ptd = IntPtr.Zero;
+ format.dwAspect = DVASPECT.DVASPECT_CONTENT;
+ format.lindex = -1;
+ format.tymed = TYMED.TYMED_HGLOBAL;
+ format.cfFormat = cfFormat;
+ DragFormats.Add(format);
+
+ return true;
+ }
+
+ return false;
+ }
+
+ private static int FindFormat(FORMATETC pformatetc) {
+ for (int i = 0; i < DragFormats.Count; i++) {
+ if ((((FORMATETC)DragFormats[i]).cfFormat == pformatetc.cfFormat) &&
+ (((FORMATETC)DragFormats[i]).dwAspect == pformatetc.dwAspect) &&
+ ((((FORMATETC)DragFormats[i]).tymed & pformatetc.tymed)) != 0) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ private static void BuildFormats(object data) {
+
+ DragFormats.Clear();
+ DragMediums.Clear();
+
+ // Build our formats based on object data
+ if (data is String) {
+ AddFormatAndMedium(ClipboardFormats.CF_TEXT, data);
+ AddFormatAndMedium(ClipboardFormats.CF_UNICODETEXT, data);
+ AddFormatAndMedium(ClipboardFormats.CF_HDROP, data);
+ } else if (data is Bitmap) {
+ AddFormatAndMedium(ClipboardFormats.CF_DIB, data);
+ } else if (data is ICollection) {
+ // FIXME - test with .Net and found how this is handled
+ AddFormatAndMedium(ClipboardFormats.CF_HDROP, data);
+ } else if (data is ISerializable) {
+ // FIXME - test with .Net and found how this is handled
+ }
+ }
+
+ internal static DragDropEffects StartDrag(IntPtr Window, object data, DragDropEffects allowed) {
+ IntPtr result;
+ IntPtr data_object;
+ IntPtr drop_source;
+
+ BuildFormats(data);
+
+ data_object = ComIDataObject.GetUnmanaged();
+ drop_source = ComIDropSource.GetUnmanaged(Window);
+
+ result = (IntPtr)DragDropEffects.None;
+
+ Win32DoDragDrop(data_object, drop_source, (IntPtr)allowed, ref result);
+
+ // Cleanup again
+ ComIDataObject.ReleaseUnmanaged(data_object);
+ ComIDropSource.ReleaseUnmanaged(drop_source);
+ DragFormats.Clear();
+ DragFormatArray = null;
+ DragMediums.Clear();
+
+ return (DragDropEffects)result.ToInt32();
+ }
+
+ internal static bool UnregisterDropTarget(IntPtr Window) {
+ Win32RevokeDragDrop(Window);
+ return true;
+ }
+
+ internal static bool RegisterDropTarget(IntPtr Window) {
+ Hwnd hwnd;
+ IntPtr drop_target;
+ uint result;
+
+ hwnd = Hwnd.ObjectFromWindow(Window);
+ if (hwnd == null) {
+ return false;
+ }
+
+ drop_target = ComIDropTarget.GetUnmanaged(Window);
+ hwnd.marshal_free_list.Add(drop_target);
+ result = Win32RegisterDragDrop(Window, drop_target);
+
+ if (result != S_OK) {
+ return false;
+ }
+ return true;
+ }
+
+ // Thanks, Martin
+ static MethodInfo CreateFuncPtrInterface(AssemblyBuilder assembly, string MethodName, Type ret_type, int param_count) {
+ ModuleBuilder mb;
+ TypeBuilder tb;
+ Type[] il_param_types;
+ Type[] param_types;
+
+ mb = assembly.DefineDynamicModule("XplatUIWin32.FuncInterface" + MethodName);
+ tb = mb.DefineType ("XplatUIWin32.FuncInterface" + MethodName, TypeAttributes.Public);
+
+ param_types = new Type[param_count];
+ il_param_types = new Type[param_count + 1];
+
+ il_param_types[param_count] = typeof(IntPtr);
+ for (int i = 0; i < param_count; i++) {
+ param_types[i] = typeof(IntPtr);
+ il_param_types[i] = typeof(IntPtr);
+ }
+
+ MethodBuilder method = tb.DefineMethod (
+ MethodName, MethodAttributes.Static | MethodAttributes.Public,
+ ret_type, il_param_types);
+
+ ILGenerator ig = method.GetILGenerator ();
+ if (param_count > 5) ig.Emit (OpCodes.Ldarg_S, 6);
+ if (param_count > 4) ig.Emit (OpCodes.Ldarg_S, 5);
+ if (param_count > 3) ig.Emit (OpCodes.Ldarg_S, 4);
+ if (param_count > 2) ig.Emit (OpCodes.Ldarg_3);
+ if (param_count > 1) ig.Emit (OpCodes.Ldarg_2);
+ if (param_count > 0) ig.Emit (OpCodes.Ldarg_1);
+ ig.Emit (OpCodes.Ldarg_0);
+ ig.EmitCalli (OpCodes.Calli, CallingConvention.StdCall, ret_type, param_types);
+ ig.Emit (OpCodes.Ret);
+
+ Type t = tb.CreateType ();
+ MethodInfo m = t.GetMethod (MethodName);
+
+ return m;
+ }
+
+ [DllImport ("ole32.dll", EntryPoint="RegisterDragDrop", CallingConvention=CallingConvention.StdCall)]
+ private extern static uint Win32RegisterDragDrop(IntPtr Window, IntPtr pDropTarget);
+
+ [DllImport ("ole32.dll", EntryPoint="RevokeDragDrop", CallingConvention=CallingConvention.StdCall)]
+ private extern static int Win32RevokeDragDrop(IntPtr Window);
+
+ [DllImport ("ole32.dll", EntryPoint="DoDragDrop", CallingConvention=CallingConvention.StdCall)]
+ private extern static uint Win32DoDragDrop(IntPtr pDataObject, IntPtr pDropSource, IntPtr dwOKEffect, ref IntPtr pdwEffect);
+
+ [DllImport ("shell32.dll", EntryPoint="DragAcceptFiles", CallingConvention=CallingConvention.StdCall)]
+ private extern static int Win32DragAcceptFiles(IntPtr Window, bool fAccept);
+
+ [DllImport ("ole32.dll", EntryPoint="OleInitialize", CallingConvention=CallingConvention.StdCall)]
+ private extern static int Win32OleInitialize(IntPtr pvReserved);
+
+ [DllImport ("shell32.dll", EntryPoint="DragQueryFileW", CharSet=CharSet.Unicode, CallingConvention=CallingConvention.StdCall)]
+ private extern static int Win32DragQueryFile(IntPtr hDrop, int iFile, IntPtr lpszFile, int cch);
+
+ [DllImport ("shell32.dll", EntryPoint="DragQueryFileW", CharSet=CharSet.Unicode, CallingConvention=CallingConvention.StdCall)]
+ private extern static int Win32DragQueryFile(IntPtr hDrop, int iFile, StringBuilder lpszFile, int cch);
+
+ [DllImport ("shell32.dll", EntryPoint="SHCreateStdEnumFmtEtc", CallingConvention=CallingConvention.StdCall)]
+ private extern static uint Win32SHCreateStdEnumFmtEtc(uint cfmt, FORMATETC[] afmt, ref IntPtr ppenumFormatEtc);
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/X11DesktopColors.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/X11DesktopColors.cs
new file mode 100644
index 00000000000..c9dd446f020
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/X11DesktopColors.cs
@@ -0,0 +1,286 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Peter Dennis Bartok (pbartok@novell.com)
+// Alexander Olk (alex.olk@googlemail.com)
+//
+//
+
+using System.Drawing;
+using System.Runtime.InteropServices;
+using System.IO;
+
+namespace System.Windows.Forms {
+ internal class X11DesktopColors {
+ #region Structs & Enums
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct GdkColorStruct {
+ internal int pixel;
+ internal short red;
+ internal short green;
+ internal short blue;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct GtkStyleStruct {
+ [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst=12)]
+ internal byte[] obj; /* GObject is 12 bytes*/
+ [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst=5)]
+ internal GdkColorStruct[] fg;
+ [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst=5)]
+ internal GdkColorStruct[] bg;
+ [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst=5)]
+ internal GdkColorStruct[] light;
+ [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst=5)]
+ internal GdkColorStruct[] dark;
+ [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst=5)]
+ internal GdkColorStruct[] mid;
+ [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst=5)]
+ internal GdkColorStruct[] text;
+ [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst=5)]
+ internal GdkColorStruct[] baseclr;
+ [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst=5)]
+ internal GdkColorStruct[] text_aa; /* Halfway between text/base */
+
+ internal GdkColorStruct black;
+ internal GdkColorStruct white;
+
+ /* TODO: There is more stuff that we will add when we need it*/
+ }
+
+ private enum Desktop {
+ Gtk,
+ KDE,
+ Unknown
+ }
+ #endregion // Structs & Enums
+
+ #region Local Variables
+ static private Desktop desktop;
+ #endregion // Local Variables
+
+ #region Constructors
+ static X11DesktopColors() {
+ FindDesktopEnvironment();
+
+ switch(desktop) {
+ case Desktop.Gtk: {
+ //IntPtr dispmgr;
+ //IntPtr gdkdisplay;
+ IntPtr widget;
+ IntPtr style_ptr;
+ GtkStyleStruct style;
+ int argc = 0;
+ string argv = "";
+
+ try {
+ gtk_init_check (out argc, argv);
+ //dispmgr = gdk_display_manager_get ();
+ //gdkdisplay = gdk_display_manager_get_default_display (dispmgr);
+ gtk_init_check (out argc, argv);
+
+ widget = gtk_invisible_new ();
+ gtk_widget_ensure_style (widget);
+ style_ptr = gtk_widget_get_style (widget);
+
+ style = (GtkStyleStruct) Marshal.PtrToStructure (style_ptr, typeof (GtkStyleStruct));
+
+ ThemeEngine.Current.ColorControl = ColorFromGdkColor (style.bg[0]);
+ ThemeEngine.Current.ColorControlText = ColorFromGdkColor (style.fg[0]);
+ ThemeEngine.Current.ColorControlDark = ColorFromGdkColor (style.dark[0]);
+ ThemeEngine.Current.ColorControlLight = ColorFromGdkColor (style.light[0]);
+ ThemeEngine.Current.ColorControlLightLight = ControlPaint.Light(ColorFromGdkColor (style.light[0]));
+ ThemeEngine.Current.ColorControlDarkDark = ControlPaint.Dark(ColorFromGdkColor (style.dark[0]));
+
+ widget = gtk_menu_new ();
+ gtk_widget_ensure_style (widget);
+ style_ptr = gtk_widget_get_style (widget);
+
+ style = (GtkStyleStruct) Marshal.PtrToStructure (style_ptr, typeof (GtkStyleStruct));
+
+ ThemeEngine.Current.ColorMenu = ColorFromGdkColor (style.bg [0]);
+ ThemeEngine.Current.ColorMenuText = ColorFromGdkColor (style.text [0]);
+ Console.WriteLine("Gtk colorscheme read");
+ }
+
+ catch (DllNotFoundException) {
+ Console.WriteLine("Gtk not found (missing LD_LIBRARY_PATH to libgtk-x11-2.0.so?), using built-in colorscheme");
+ }
+
+ catch {
+ Console.WriteLine("Gtk colorscheme read failure, using built-in colorscheme");
+ }
+ break;
+ }
+
+ case Desktop.KDE: {
+ if ( ReadKDEColorsheme() )
+ Console.WriteLine("KDE colorscheme read");
+ else
+ Console.WriteLine("KDE colorscheme read failure, using built-in colorscheme");
+ break;
+ }
+
+ default: {
+ Console.WriteLine("Unknown desktop manager, using default colors");
+ break;
+ }
+ }
+ }
+ #endregion // Constructors
+
+ #region Properties
+ static void FindDesktopEnvironment() {
+ desktop = Desktop.Gtk;
+ string session = Environment.GetEnvironmentVariable("DESKTOP_SESSION");
+
+ if ( session != null ) {
+ session = session.ToUpper( );
+
+ if ( session == "DEFAULT" ) {
+ string helper = Environment.GetEnvironmentVariable("KDE_FULL_SESSION");
+
+ if ( helper != null )
+ desktop = Desktop.KDE;
+ } else
+ if ( session == "KDE" )
+ desktop = Desktop.KDE;
+ }
+ }
+ #endregion // Properties
+
+ #region Methods
+ static internal void Initialize() {
+ // Do nothing; all is done in our static ctor
+ }
+
+ private static Color ColorFromGdkColor (GdkColorStruct gtkcolor) {
+ return Color.FromArgb (255,
+ (gtkcolor.red >> 8) & 0xff,
+ (gtkcolor.green >> 8) & 0xff,
+ (gtkcolor.blue >> 8) & 0xff );
+ }
+
+ private static bool ReadKDEColorsheme() {
+ string full_kdegloabals_filename = Environment.GetFolderPath(Environment.SpecialFolder.Personal)
+ + "/"
+ + ".kde/share/config/kdeglobals";
+
+ if (!File.Exists(full_kdegloabals_filename))
+ return false;
+
+ StreamReader sr = new StreamReader(full_kdegloabals_filename);
+
+ string line = sr.ReadLine();
+
+ Color tmp_color;
+
+ while (line != null) {
+ line = line.Trim();
+
+ if (line.StartsWith( "background=")) {
+ tmp_color = GetColorFromKDEString(line);
+
+ if (tmp_color != Color.Empty) {
+ ThemeEngine.Current.ColorControl = tmp_color;
+ ThemeEngine.Current.ColorMenu = tmp_color;
+ }
+ } else
+ if (line.StartsWith( "foreground=")) {
+ tmp_color = GetColorFromKDEString(line);
+
+ if (tmp_color != Color.Empty) {
+ ThemeEngine.Current.ColorControlText = tmp_color;
+ ThemeEngine.Current.ColorMenuText = tmp_color;
+ }
+ } else
+ if (line.StartsWith("selectBackground")) {
+ tmp_color = GetColorFromKDEString(line);
+
+ if (tmp_color != Color.Empty) {
+ ThemeEngine.Current.ColorHighlight = tmp_color;
+ }
+ } else
+ if (line.StartsWith("selectForeground")) {
+ tmp_color = GetColorFromKDEString(line);
+
+ if (tmp_color != Color.Empty) {
+ ThemeEngine.Current.ColorHighlightText = tmp_color;
+ }
+ }
+
+ line = sr.ReadLine();
+ }
+
+ sr.Close();
+
+ return true;
+ }
+
+ private static Color GetColorFromKDEString(string line) {
+ string[] split = line.Split(new char[] {'='});
+
+ if (split.Length > 0) {
+ line = split[1];
+
+ split = line.Split(new char[] {','});
+
+ if (split.Length == 3) {
+ int r = System.Convert.ToInt32(split[0]);
+ int g = System.Convert.ToInt32(split[1]);
+ int b = System.Convert.ToInt32(split[2]);
+
+ return Color.FromArgb(r, g, b);
+ }
+ }
+
+ return Color.Empty;
+ }
+ #endregion // Methods
+
+ #region DllImports
+ [DllImport("libgtk-x11-2.0.so")]
+ static extern bool gtk_init_check (out int argc, string argv);
+
+ [DllImport("libgdk-x11-2.0.so")]
+ internal static extern IntPtr gdk_display_manager_get ();
+
+ [DllImport("libgdk-x11-2.0.so")]
+ internal static extern IntPtr gdk_display_manager_get_default_display (IntPtr display_manager);
+
+ [DllImport("libgtk-x11-2.0.so")]
+ static extern IntPtr gtk_invisible_new ();
+
+ [DllImport("libgtk-x11-2.0.so")]
+ static extern IntPtr gtk_menu_new ();
+
+ [DllImport("libgtk-x11-2.0.so")]
+ static extern IntPtr gtk_menu_item_new_with_label (string label);
+
+ [DllImport("libgtk-x11-2.0.so")]
+ static extern void gtk_widget_ensure_style (IntPtr raw);
+
+ [DllImport("libgtk-x11-2.0.so")]
+ static extern IntPtr gtk_widget_get_style (IntPtr raw);
+ #endregion // DllImports
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/X11Dnd.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/X11Dnd.cs
new file mode 100644
index 00000000000..4e0ec3600ac
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/X11Dnd.cs
@@ -0,0 +1,1208 @@
+// 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) 2005 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+//
+//
+
+
+using System;
+using System.IO;
+using System.Text;
+using System.Drawing;
+using System.Collections;
+using System.Runtime.Serialization;
+using System.Runtime.InteropServices;
+using System.Runtime.Serialization.Formatters.Binary;
+
+namespace System.Windows.Forms {
+
+ internal class X11Dnd {
+
+ private enum State {
+ Accepting,
+ Dragging
+ }
+
+ private enum DragState {
+ None,
+ Beginning,
+ Dragging,
+ Entered
+ }
+
+ private interface IDataConverter {
+ void GetData (X11Dnd dnd, DataObject data, ref XEvent xevent);
+ void SetData (X11Dnd dnd, object data, ref XEvent xevent);
+ }
+
+ private delegate void MimeConverter (IntPtr dsp,
+ DataObject data, ref XEvent xevent);
+
+ private class MimeHandler {
+ public string Name;
+ public IntPtr Type;
+ public IntPtr NonProtocol;
+ public IDataConverter Converter;
+
+ public MimeHandler (string name, IDataConverter converter)
+ {
+ Name = name;
+ Converter = converter;
+ }
+
+ public override string ToString ()
+ {
+ return "MimeHandler {" + Name + "}";
+ }
+ }
+
+ private MimeHandler [] MimeHandlers = {
+// new MimeHandler ("WCF_DIB"),
+// new MimeHandler ("image/gif", new MimeConverter (ImageConverter)),
+// new MimeHandler ("text/rtf", new MimeConverter (RtfConverter)),
+// new MimeHandler ("text/richtext", new MimeConverter (RtfConverter)),
+
+ new MimeHandler ("text/plain", new TextConverter ()),
+ new MimeHandler ("text/html", new HtmlConverter ()),
+ new MimeHandler ("text/uri-list", new UriListConverter ()),
+ new MimeHandler ("application/x-mono-serialized-object",
+ new SerializedObjectConverter ())
+ };
+
+ private class SerializedObjectConverter : IDataConverter {
+
+ public void GetData (X11Dnd dnd, DataObject data, ref XEvent xevent)
+ {
+ MemoryStream stream = dnd.GetData (ref xevent);
+ BinaryFormatter bf = new BinaryFormatter ();
+
+ if (stream.Length == 0)
+ return;
+
+ stream.Seek (0, 0);
+ object obj = bf.Deserialize (stream);
+ data.SetData (obj);
+ }
+
+ public void SetData (X11Dnd dnd, object data, ref XEvent xevent)
+ {
+ if (data == null)
+ return;
+
+ MemoryStream stream = new MemoryStream ();
+ BinaryFormatter bf = new BinaryFormatter ();
+
+ bf.Serialize (stream, data);
+
+ IntPtr buffer = Marshal.AllocHGlobal ((int) stream.Length);
+ stream.Seek (0, 0);
+
+ for (int i = 0; i < stream.Length; i++) {
+ Marshal.WriteByte (buffer, i, (byte) stream.ReadByte ());
+ }
+
+ dnd.SetProperty (ref xevent, buffer, (int) stream.Length);
+ }
+ }
+
+ private class HtmlConverter : IDataConverter {
+
+ public void GetData (X11Dnd dnd, DataObject data, ref XEvent xevent)
+ {
+ string text = dnd.GetText (ref xevent, false);
+ if (text == null)
+ return;
+ data.SetData (DataFormats.Text, text);
+ data.SetData (DataFormats.UnicodeText, text);
+ }
+
+ public void SetData (X11Dnd dnd, object data, ref XEvent xevent)
+ {
+ IntPtr buffer;
+ int len;
+ string str = data as string;
+
+ if (str == null)
+ return;
+
+ if (xevent.SelectionRequestEvent.target == (int) Atom.XA_STRING) {
+ byte [] bytes = Encoding.ASCII.GetBytes (str);
+ buffer = Marshal.AllocHGlobal (bytes.Length);
+ len = bytes.Length;
+ for (int i = 0; i < len; i++)
+ Marshal.WriteByte (buffer, i, bytes [i]);
+ } else {
+ buffer = Marshal.StringToHGlobalAnsi (str);
+ len = 0;
+ while (Marshal.ReadByte (buffer, len) != 0)
+ len++;
+ }
+
+ dnd.SetProperty (ref xevent, buffer, len);
+
+ Marshal.FreeHGlobal (buffer);
+ }
+ }
+
+ private class TextConverter : IDataConverter {
+
+ public void GetData (X11Dnd dnd, DataObject data, ref XEvent xevent)
+ {
+ string text = dnd.GetText (ref xevent, true);
+ if (text == null)
+ return;
+ data.SetData (DataFormats.Text, text);
+ data.SetData (DataFormats.UnicodeText, text);
+ }
+
+ public void SetData (X11Dnd dnd, object data, ref XEvent xevent)
+ {
+ IntPtr buffer;
+ int len;
+ string str = data as string;
+
+ if (data == null)
+ return;
+
+ if (xevent.SelectionRequestEvent.target == (int) Atom.XA_STRING) {
+ byte [] bytes = Encoding.ASCII.GetBytes (str);
+ buffer = Marshal.AllocHGlobal (bytes.Length);
+ len = bytes.Length;
+ for (int i = 0; i < len; i++)
+ Marshal.WriteByte (buffer, i, bytes [i]);
+ } else {
+ buffer = Marshal.StringToHGlobalAnsi (str);
+ len = 0;
+ while (Marshal.ReadByte (buffer, len) != 0)
+ len++;
+ }
+
+ dnd.SetProperty (ref xevent, buffer, len);
+
+ Marshal.FreeHGlobal (buffer);
+ }
+ }
+
+ private class UriListConverter : IDataConverter {
+
+ public void GetData (X11Dnd dnd, DataObject data, ref XEvent xevent)
+ {
+ string text = dnd.GetText (ref xevent, false);
+ if (text == null)
+ return;
+
+ // TODO: Do this in a loop instead of just splitting
+ ArrayList uri_list = new ArrayList ();
+ string [] lines = text.Split (new char [] { '\r', '\n' });
+ foreach (string line in lines) {
+ // # is a comment line (see RFC 2483)
+ if (line.StartsWith ("#"))
+ continue;
+ try {
+ Uri uri = new Uri (line);
+ uri_list.Add (uri.LocalPath);
+ } catch { }
+ }
+
+ string [] l = (string []) uri_list.ToArray (typeof (string));
+ if (l.Length < 1)
+ return;
+ data.SetData (DataFormats.FileDrop, l);
+ data.SetData ("FileName", l [0]);
+ data.SetData ("FileNameW", l [0]);
+ }
+
+ public void SetData (X11Dnd dnd, object data, ref XEvent xevent)
+ {
+ string [] uri_list = data as string [];
+
+ if (uri_list == null)
+ return;
+
+ StringBuilder res = new StringBuilder ();
+ foreach (string uri_str in uri_list) {
+ Uri uri = new Uri (uri_str);
+ res.Append (uri.ToString ());
+ res.Append ("\r\n");
+ }
+
+ IntPtr buffer = Marshal.StringToHGlobalAnsi ((string) data);
+ int len = 0;
+ while (Marshal.ReadByte (buffer, len) != 0)
+ len++;
+
+ dnd.SetProperty (ref xevent, buffer, len);
+ }
+ }
+
+ private class DragData {
+ public IntPtr Window;
+ public DragState State;
+ public object Data;
+ public IntPtr Action;
+ public IntPtr [] SupportedTypes;
+ public MouseButtons MouseState;
+
+ public IntPtr LastWindow;
+ public IntPtr LastTopLevel;
+
+ public bool WillAccept;
+
+ public void Reset ()
+ {
+ State = DragState.None;
+ Data = null;
+ SupportedTypes = null;
+ WillAccept = false;
+ }
+ }
+
+ private class DropData {
+
+ }
+
+ // This version seems to be the most common
+ private static readonly uint [] XdndVersion = new uint [] { 4 };
+
+ private IntPtr display;
+ private DragData drag_data;
+
+ private IntPtr XdndAware;
+ private IntPtr XdndSelection;
+ private IntPtr XdndEnter;
+ private IntPtr XdndLeave;
+ private IntPtr XdndPosition;
+ private IntPtr XdndDrop;
+ private IntPtr XdndFinished;
+ private IntPtr XdndStatus;
+ private IntPtr XdndTypeList;
+ private IntPtr XdndActionCopy;
+ private IntPtr XdndActionMove;
+ private IntPtr XdndActionLink;
+ private IntPtr XdndActionPrivate;
+ private IntPtr XdndActionList;
+ private IntPtr XdndActionDescription;
+ private IntPtr XdndActionAsk;
+
+ private State state;
+
+ private int converts_pending;
+ private bool position_recieved;
+ private bool status_sent;
+ private IntPtr target;
+ private IntPtr source;
+ private IntPtr toplevel;
+ private DataObject data;
+
+ private IntPtr drag_action;
+ private Control control;
+ private int pos_x, pos_y;
+ private DragDropEffects allowed;
+ private DragEventArgs drag_event;
+
+ private Cursor CursorNo;
+ private Cursor CursorCopy;
+ private Cursor CursorMove;
+ private Cursor CursorLink;
+ private IntPtr CurrentCursorHandle;
+
+ public X11Dnd (IntPtr display)
+ {
+ this.display = display;
+ Init ();
+ }
+
+ public void SetAllowDrop (Hwnd hwnd, bool allow)
+ {
+ if (hwnd.allow_drop == allow)
+ return;
+
+ XChangeProperty (display, hwnd.whole_window, XdndAware,
+ (IntPtr) Atom.XA_ATOM, 32,
+ PropertyMode.Replace, XdndVersion, allow ? 1 : 0);
+ hwnd.allow_drop = allow;
+ }
+
+ public DragDropEffects StartDrag (IntPtr handle, object data,
+ DragDropEffects allowed_effects)
+ {
+ drag_data = new DragData ();
+ drag_data.Window = handle;
+ drag_data.State = DragState.Beginning;
+ drag_data.MouseState = XplatUIX11.MouseState;
+ drag_data.Data = data;
+ drag_data.SupportedTypes = DetermineSupportedTypes (data);
+
+ drag_data.Action = ActionFromEffect (allowed_effects);
+
+ if (CursorNo == null) {
+ // Make sure the cursors are created
+ CursorNo = new Cursor (typeof (X11Dnd), "DnDNo.cur");
+ CursorCopy = new Cursor (typeof (X11Dnd), "DnDCopy.cur");
+ CursorMove = new Cursor (typeof (X11Dnd), "DnDMove.cur");
+ CursorLink = new Cursor (typeof (X11Dnd), "DnDLink.cur");
+ }
+
+ drag_data.LastTopLevel = IntPtr.Zero;
+ return DragDropEffects.Copy;
+ }
+
+ public void HandleButtonRelease (ref XEvent xevent)
+ {
+ if (drag_data == null)
+ return;
+
+ if (!((drag_data.MouseState == MouseButtons.Left &&
+ xevent.ButtonEvent.button == 1) ||
+ (drag_data.MouseState == MouseButtons.Right &&
+ xevent.ButtonEvent.button == 3)))
+ return;
+
+ if (drag_data.State == DragState.Beginning) {
+ state = State.Accepting;
+ } else if (drag_data.State != DragState.None) {
+
+ if (drag_data.WillAccept) {
+ SendDrop (drag_data.LastTopLevel, xevent.AnyEvent.window,
+ xevent.ButtonEvent.time);
+ }
+
+ XplatUIX11.XUngrabPointer (display, 0);
+ drag_data.State = DragState.None;
+ // WE can't reset the drag data yet as it is still
+ // most likely going to be used by the SelectionRequest
+ // handlers
+ }
+ }
+
+ public bool HandleMotionNotify (ref XEvent xevent)
+ {
+ if (drag_data == null)
+ return false;
+
+ if (drag_data.State == DragState.Beginning) {
+ int suc;
+
+ drag_data.State = DragState.Dragging;
+
+ suc = XplatUIX11.XSetSelectionOwner (display, (int) XdndSelection,
+ drag_data.Window,
+ xevent.ButtonEvent.time);
+
+ if (suc == 0) {
+ Console.Error.WriteLine ("Could not take ownership of XdndSelection aborting drag.");
+ drag_data.Reset ();
+ return false;
+ }
+
+ suc = XGrabPointer (display, xevent.AnyEvent.window,
+ false,
+ EventMask.ButtonMotionMask |
+ EventMask.PointerMotionMask |
+ EventMask.ButtonPressMask |
+ EventMask.ButtonReleaseMask,
+ GrabMode.GrabModeAsync,
+ GrabMode.GrabModeAsync,
+ IntPtr.Zero, IntPtr.Zero/*CursorCopy.Handle*/, 0);
+
+ if (suc != 0) {
+ Console.Error.WriteLine ("Could not grab pointer aborting drag.");
+ drag_data.Reset ();
+ return false;
+ }
+
+ drag_data.State = DragState.Dragging;
+ } else if (drag_data.State != DragState.None) {
+ bool dnd_aware = false;
+ IntPtr toplevel = IntPtr.Zero;
+ IntPtr window = XplatUIX11.RootWindowHandle;
+
+ IntPtr root, child;
+ int x_temp, y_temp;
+ int mask_return;
+
+ while (XQueryPointer (display,
+ window,
+ out root, out child,
+ out x_temp, out y_temp,
+ out xevent.MotionEvent.x,
+ out xevent.MotionEvent.y,
+ out mask_return)) {
+
+ if (!dnd_aware) {
+ dnd_aware = IsWindowDndAware (window);
+ if (dnd_aware) {
+ toplevel = window;
+ xevent.MotionEvent.x_root = x_temp;
+ xevent.MotionEvent.y_root = y_temp;
+ }
+ }
+
+ if (child == IntPtr.Zero)
+ break;
+
+ window = child;
+ }
+
+ if (window != drag_data.LastWindow && drag_data.State == DragState.Entered) {
+ drag_data.State = DragState.Dragging;
+
+ // TODO: Send a Leave if this is an MWF window
+
+ if (toplevel != drag_data.LastTopLevel)
+ SendLeave (drag_data.LastTopLevel, xevent.MotionEvent.window);
+ }
+
+ drag_data.State = DragState.Entered;
+ if (toplevel != drag_data.LastTopLevel) {
+ // Entering a new toplevel window
+ SendEnter (toplevel, drag_data.Window, drag_data.SupportedTypes);
+ } else {
+ // Already in a toplevel window, so send a position
+ SendPosition (toplevel, drag_data.Window,
+ drag_data.Action,
+ xevent.MotionEvent.x_root,
+ xevent.MotionEvent.y_root,
+ xevent.MotionEvent.time);
+ }
+
+ drag_data.LastTopLevel = toplevel;
+ drag_data.LastWindow = window;
+ return true;
+ }
+ return false;
+ }
+
+ // DEBUG CODE REMOVE
+ private string GetText (IntPtr handle) {
+ string text = String.Empty;
+ IntPtr textptr;
+
+ textptr = IntPtr.Zero;
+
+ XFetchName (display, handle, ref textptr);
+ if (textptr != IntPtr.Zero) {
+ text = Marshal.PtrToStringAnsi(textptr);
+ XFree (textptr);
+ }
+
+ return text;
+ }
+
+
+ // return true if the event is handled here
+ public bool HandleClientMessage (ref XEvent xevent)
+ {
+ // most common so we check it first
+ if (xevent.ClientMessageEvent.message_type == XdndPosition)
+ return Accepting_HandlePositionEvent (ref xevent);
+ if (xevent.ClientMessageEvent.message_type == XdndEnter)
+ return Accepting_HandleEnterEvent (ref xevent);
+ if (xevent.ClientMessageEvent.message_type == XdndDrop)
+ return Accepting_HandleDropEvent (ref xevent);
+ if (xevent.ClientMessageEvent.message_type == XdndLeave)
+ return Accepting_HandleLeaveEvent (ref xevent);
+ if (xevent.ClientMessageEvent.message_type == XdndStatus)
+ return HandleStatusEvent (ref xevent);
+
+ return false;
+ }
+
+ public bool HandleSelectionNotifyEvent (ref XEvent xevent)
+ {
+ if (source != XGetSelectionOwner (display, XdndSelection))
+ return false;
+
+ MimeHandler handler = FindHandler ((IntPtr) xevent.SelectionEvent.target);
+ if (handler == null)
+ return false;
+ if (data == null)
+ data = new DataObject ();
+
+ handler.Converter.GetData (this, data, ref xevent);
+
+ converts_pending--;
+ if (converts_pending <= 0 && position_recieved) {
+ drag_event = new DragEventArgs (data, 0, pos_x, pos_y,
+ allowed, DragDropEffects.None);
+ control.DndEnter (drag_event);
+ SendStatus (source, drag_event.Effect);
+ status_sent = true;
+ }
+ return true;
+ }
+
+ public bool HandleSelectionRequestEvent (ref XEvent xevent)
+ {
+ if (xevent.SelectionRequestEvent.selection != (int) XdndSelection)
+ return false;
+
+ MimeHandler handler = FindHandler ((IntPtr) xevent.SelectionRequestEvent.target);
+ if (handler == null)
+ return false;
+
+ handler.Converter.SetData (this, drag_data.Data, ref xevent);
+
+ return true;
+ }
+
+ private void SetProperty (ref XEvent xevent, IntPtr data, int length)
+ {
+ XEvent sel = new XEvent();
+ sel.SelectionEvent.type = XEventName.SelectionNotify;
+ sel.SelectionEvent.send_event = true;
+ sel.SelectionEvent.display = display;
+ sel.SelectionEvent.selection = xevent.SelectionRequestEvent.selection;
+ sel.SelectionEvent.target = xevent.SelectionRequestEvent.target;
+ sel.SelectionEvent.requestor = xevent.SelectionRequestEvent.requestor;
+ sel.SelectionEvent.time = xevent.SelectionRequestEvent.time;
+ sel.SelectionEvent.property = 0;
+
+ XplatUIX11.XChangeProperty (display, xevent.SelectionRequestEvent.requestor,
+ xevent.SelectionRequestEvent.property,
+ xevent.SelectionRequestEvent.target,
+ 8, PropertyMode.Replace, data, length);
+ sel.SelectionEvent.property = xevent.SelectionRequestEvent.property;
+
+ XSendEvent (display, xevent.SelectionRequestEvent.requestor, false,
+ EventMask.NoEventMask, ref sel);
+ return;
+ }
+
+ private void Reset ()
+ {
+ ResetSourceData ();
+ ResetTargetData ();
+ }
+
+ private void ResetSourceData ()
+ {
+ converts_pending = 0;
+ data = null;
+ }
+
+ private void ResetTargetData ()
+ {
+ position_recieved = false;
+ status_sent = false;
+ }
+
+ private bool Accepting_HandleEnterEvent (ref XEvent xevent)
+ {
+ Reset ();
+
+ source = xevent.ClientMessageEvent.ptr1;
+ toplevel = xevent.AnyEvent.window;
+ target = IntPtr.Zero;
+
+ ConvertData (ref xevent);
+
+ return true;
+ }
+
+ private bool Accepting_HandlePositionEvent (ref XEvent xevent)
+ {
+ pos_x = (int) xevent.ClientMessageEvent.ptr3 >> 16;
+ pos_y = (int) xevent.ClientMessageEvent.ptr3 & 0xFFFF;
+
+ allowed = EffectFromAction (xevent.ClientMessageEvent.ptr5);
+
+ IntPtr parent, child, new_child;
+ parent = XplatUIX11.XRootWindow (display, 0);
+ child = toplevel;
+ while (true) {
+ int xd, yd;
+ new_child = IntPtr.Zero;
+
+ if (!XplatUIX11.XTranslateCoordinates (display,
+ parent, child, pos_x, pos_y,
+ out xd, out yd, out new_child))
+ break;
+ if (new_child == IntPtr.Zero)
+ break;
+ child = new_child;
+ }
+
+ if (target != child) {
+ // We have moved into a new control
+ // or into a control for the first time
+ Finish ();
+ }
+ target = child;
+ Hwnd hwnd = Hwnd.ObjectFromHandle (target);
+ Control c = Control.FromHandle (hwnd.client_window);
+
+ if (c == null)
+ return true;
+ if (!c.allow_drop) {
+ SendStatus (source, DragDropEffects.None);
+ Finish ();
+ return true;
+ }
+
+ control = c;
+ position_recieved = true;
+
+ if (converts_pending > 0)
+ return true;
+ if (!status_sent) {
+ drag_event = new DragEventArgs (data, 0, pos_x, pos_y,
+ allowed, DragDropEffects.None);
+ control.DndEnter (drag_event);
+ SendStatus (source, drag_event.Effect);
+ status_sent = true;
+ } else {
+ drag_event.x = pos_x;
+ drag_event.y = pos_y;
+ SendStatus (source, drag_event.Effect);
+ control.DndOver (drag_event);
+ }
+
+ return true;
+ }
+
+ private void Finish ()
+ {
+ if (control != null) {
+ if (drag_event == null) {
+ if (data == null)
+ data = new DataObject ();
+ drag_event = new DragEventArgs (data,
+ 0, pos_x, pos_y,
+ allowed, DragDropEffects.None);
+ }
+ control.DndLeave (drag_event);
+ }
+ ResetTargetData ();
+ }
+
+ private bool Accepting_HandleDropEvent (ref XEvent xevent)
+ {
+ if (control != null && drag_event != null) {
+ drag_event = new DragEventArgs (data,
+ 0, pos_x, pos_y,
+ allowed, DragDropEffects.None);
+ control.DndDrop (drag_event);
+ }
+ SendFinished ();
+ return true;
+ }
+
+ private bool Accepting_HandleLeaveEvent (ref XEvent xevent)
+ {
+ if (control != null && drag_event != null)
+ control.DndLeave (drag_event);
+ // Reset ();
+ return true;
+ }
+
+ private bool HandleStatusEvent (ref XEvent xevent)
+ {
+ if (drag_data != null && drag_data.State == DragState.Entered) {
+ drag_data.WillAccept = ((int) xevent.ClientMessageEvent.ptr2 & 0x1) != 0;
+ Cursor cursor = CursorNo;
+ if (drag_data.WillAccept) {
+ // Same order as on MS
+ IntPtr action = xevent.ClientMessageEvent.ptr5;
+ if (action == XdndActionCopy)
+ cursor = CursorCopy;
+ else if (action == XdndActionLink)
+ cursor = CursorLink;
+ else if (action == XdndActionMove)
+ cursor = CursorMove;
+
+ }
+
+ // TODO: Try not to set the cursor so much
+ //if (cursor.Handle != CurrentCursorHandle) {
+ XChangeActivePointerGrab (display,
+ EventMask.ButtonMotionMask |
+ EventMask.PointerMotionMask |
+ EventMask.ButtonPressMask |
+ EventMask.ButtonReleaseMask,
+ cursor.Handle, IntPtr.Zero);
+ CurrentCursorHandle = cursor.Handle;
+ //}
+ }
+ return true;
+ }
+
+ private DragDropEffects EffectFromAction (IntPtr action)
+ {
+ DragDropEffects allowed = DragDropEffects.None;
+
+ if (action == XdndActionCopy)
+ allowed = DragDropEffects.Copy;
+ else if (action == XdndActionMove)
+ allowed |= DragDropEffects.Move;
+ if (action == XdndActionLink)
+ allowed |= DragDropEffects.Link;
+ return allowed;
+ }
+
+ private IntPtr ActionFromEffect (DragDropEffects effect)
+ {
+ IntPtr action = IntPtr.Zero;
+
+ // We can't OR together actions on XDND so sadly the primary
+ // is the only one shown here
+ if ((effect & DragDropEffects.Copy) != 0)
+ action = XdndActionCopy;
+ else if ((effect & DragDropEffects.Move) != 0)
+ action = XdndActionMove;
+ else if ((effect & DragDropEffects.Link) != 0)
+ action = XdndActionLink;
+ return action;
+ }
+
+ private bool ConvertData (ref XEvent xevent)
+ {
+ bool match = false;
+
+ if (source != XplatUIX11.XGetSelectionOwner (display, (int) XdndSelection)) {
+ return false;
+ }
+
+ Control mwfcontrol = MwfWindow (source);
+
+ if (mwfcontrol != null && drag_data != null) {
+ DataObject dragged = drag_data.Data as DataObject;
+ if (dragged != null) {
+ data = dragged;
+ } else {
+ if (data == null)
+ data = new DataObject ();
+ SetDataWithFormats (drag_data.Data);
+ }
+ return true;
+ }
+
+ foreach (IntPtr atom in SourceSupportedList (ref xevent)) {
+ MimeHandler handler = FindHandler (atom);
+ if (handler == null)
+ continue;
+ XConvertSelection (display, XdndSelection, handler.Type,
+ handler.NonProtocol, toplevel, 0 /* CurrentTime */);
+ converts_pending++;
+ match = true;
+ }
+ return match;
+ }
+
+ private void SetDataWithFormats (object value)
+ {
+ if (value is string) {
+ data.SetData (DataFormats.Text, value);
+ data.SetData (DataFormats.UnicodeText, value);
+ }
+
+ data.SetData (value);
+ }
+
+ private MimeHandler FindHandler (IntPtr atom)
+ {
+ if (atom == IntPtr.Zero)
+ return null;
+ foreach (MimeHandler handler in MimeHandlers) {
+ if (handler.Type == atom)
+ return handler;
+ }
+ return null;
+ }
+
+ private MimeHandler FindHandler (string name)
+ {
+ foreach (MimeHandler handler in MimeHandlers) {
+ if (handler.Name == name)
+ return handler;
+ }
+ return null;
+ }
+
+ private void SendStatus (IntPtr source, DragDropEffects effect)
+ {
+ XEvent xevent = new XEvent ();
+
+ xevent.AnyEvent.type = XEventName.ClientMessage;
+ xevent.AnyEvent.display = display;
+ xevent.ClientMessageEvent.window = source;
+ xevent.ClientMessageEvent.message_type = XdndStatus;
+ xevent.ClientMessageEvent.format = 32;
+ xevent.ClientMessageEvent.ptr1 = toplevel;
+ if (effect != DragDropEffects.None)
+ xevent.ClientMessageEvent.ptr2 = (IntPtr) 1;
+
+ xevent.ClientMessageEvent.ptr5 = ActionFromEffect (effect);
+ XSendEvent (display, source, false, 0, ref xevent);
+ }
+
+ private void SendEnter (IntPtr handle, IntPtr from, IntPtr [] supported)
+ {
+ XEvent xevent = new XEvent ();
+
+ xevent.AnyEvent.type = XEventName.ClientMessage;
+ xevent.AnyEvent.display = display;
+ xevent.ClientMessageEvent.window = handle;
+ xevent.ClientMessageEvent.message_type = XdndEnter;
+ xevent.ClientMessageEvent.format = 32;
+ xevent.ClientMessageEvent.ptr1 = from;
+
+ // (int) xevent.ClientMessageEvent.ptr2 & 0x1)
+ // int ptr2 = 0x1;
+ // xevent.ClientMessageEvent.ptr2 = (IntPtr) ptr2;
+ // (e)->xclient.data.l[1] = ((e)->xclient.data.l[1] & ~(0xFF << 24)) | ((v) << 24)
+ xevent.ClientMessageEvent.ptr2 = (IntPtr) (XdndVersion [0] << 24);
+
+ if (supported.Length > 0)
+ xevent.ClientMessageEvent.ptr3 = supported [0];
+ if (supported.Length > 1)
+ xevent.ClientMessageEvent.ptr4 = supported [1];
+ if (supported.Length > 2)
+ xevent.ClientMessageEvent.ptr5 = supported [2];
+
+ XSendEvent (display, handle, false, 0, ref xevent);
+ }
+
+ private void SendDrop (IntPtr handle, IntPtr from, IntPtr time)
+ {
+ XEvent xevent = new XEvent ();
+
+ xevent.AnyEvent.type = XEventName.ClientMessage;
+ xevent.AnyEvent.display = display;
+ xevent.ClientMessageEvent.window = handle;
+ xevent.ClientMessageEvent.message_type = XdndDrop;
+ xevent.ClientMessageEvent.format = 32;
+ xevent.ClientMessageEvent.ptr1 = from;
+ xevent.ClientMessageEvent.ptr3 = time;
+
+ XSendEvent (display, handle, false, 0, ref xevent);
+ }
+
+ private void SendPosition (IntPtr handle, IntPtr from, IntPtr action, int x, int y, IntPtr time)
+ {
+ XEvent xevent = new XEvent ();
+
+ xevent.AnyEvent.type = XEventName.ClientMessage;
+ xevent.AnyEvent.display = display;
+ xevent.ClientMessageEvent.window = handle;
+ xevent.ClientMessageEvent.message_type = XdndPosition;
+ xevent.ClientMessageEvent.format = 32;
+ xevent.ClientMessageEvent.ptr1 = from;
+ xevent.ClientMessageEvent.ptr3 = (IntPtr) ((x << 16) | (y & 0xFFFF));
+ xevent.ClientMessageEvent.ptr4 = time;
+ xevent.ClientMessageEvent.ptr5 = action;
+
+ XSendEvent (display, handle, false, 0, ref xevent);
+ }
+
+ private void SendLeave (IntPtr handle, IntPtr from)
+ {
+ XEvent xevent = new XEvent ();
+
+ xevent.AnyEvent.type = XEventName.ClientMessage;
+ xevent.AnyEvent.display = display;
+ xevent.ClientMessageEvent.window = handle;
+ xevent.ClientMessageEvent.message_type = XdndLeave;
+ xevent.ClientMessageEvent.format = 32;
+ xevent.ClientMessageEvent.ptr1 = from;
+
+ XSendEvent (display, handle, false, 0, ref xevent);
+ }
+
+ private void SendFinished ()
+ {
+ XEvent xevent = new XEvent ();
+
+ xevent.AnyEvent.type = XEventName.ClientMessage;
+ xevent.AnyEvent.display = display;
+ xevent.ClientMessageEvent.window = source;
+ xevent.ClientMessageEvent.message_type = XdndFinished;
+ xevent.ClientMessageEvent.format = 32;
+ xevent.ClientMessageEvent.ptr1 = toplevel;
+
+ XSendEvent (display, source, false, 0, ref xevent);
+ }
+
+ // There is a somewhat decent amount of overhead
+ // involved in setting up dnd so we do it lazily
+ // as a lot of applications do not even use it.
+ private void Init ()
+ {
+ XdndAware = XInternAtom (display, "XdndAware", false);
+ XdndEnter = XInternAtom (display, "XdndEnter", false);
+ XdndLeave = XInternAtom (display, "XdndLeave", false);
+ XdndPosition = XInternAtom (display, "XdndPosition", false);
+ XdndStatus = XInternAtom (display, "XdndStatus", false);
+ XdndDrop = XInternAtom (display, "XdndDrop", false);
+ XdndSelection = XInternAtom (display, "XdndSelection", false);
+ XdndFinished = XInternAtom (display, "XdndFinished", false);
+ XdndTypeList = XInternAtom (display, "XdndTypeList", false);
+ XdndActionCopy = XInternAtom (display, "XdndActionCopy", false);
+ XdndActionMove = XInternAtom (display, "XdndActionMove", false);
+ XdndActionLink = XInternAtom (display, "XdndActionLink", false);
+ XdndActionPrivate = XInternAtom (display, "XdndActionPrivate", false);
+ XdndActionList = XInternAtom (display, "XdndActionList", false);
+ XdndActionDescription = XInternAtom (display, "XdndActionDescription", false);
+ XdndActionAsk = XInternAtom (display, "XdndActionAsk", false);
+
+ foreach (MimeHandler handler in MimeHandlers) {
+ handler.Type = XInternAtom (display, handler.Name, false);
+ handler.NonProtocol = XInternAtom (display,
+ String.Concat ("MWFNonP+", handler.Name), false);
+ }
+
+ }
+
+ private IntPtr [] SourceSupportedList (ref XEvent xevent)
+ {
+ IntPtr [] res;
+
+
+ if (((int) xevent.ClientMessageEvent.ptr2 & 0x1) == 0) {
+ res = new IntPtr [3];
+ res [0] = xevent.ClientMessageEvent.ptr3;
+ res [1] = xevent.ClientMessageEvent.ptr4;
+ res [2] = xevent.ClientMessageEvent.ptr5;
+ } else {
+ IntPtr type;
+ int format, count, remaining;
+ IntPtr data = IntPtr.Zero;
+
+ XGetWindowProperty (display, source, XdndTypeList,
+ 0, 32, false, (IntPtr) Atom.XA_ATOM,
+ out type, out format, out count,
+ out remaining, out data);
+
+ res = new IntPtr [count];
+ for (int i = 0; i < count; i++) {
+ res [i] = (IntPtr) Marshal.ReadInt32 (data, i *
+ Marshal.SizeOf (typeof (int)));
+ }
+
+ XFree (data);
+ }
+
+ return res;
+ }
+
+ private string GetText (ref XEvent xevent, bool unicode)
+ {
+ int nread = 0;
+ int nitems;
+ int bytes_after;
+
+ StringBuilder builder = new StringBuilder ();
+ do {
+ IntPtr actual_type;
+ int actual_fmt;
+ IntPtr data = IntPtr.Zero;
+
+ if (0 != XGetWindowProperty (display,
+ xevent.AnyEvent.window,
+ (IntPtr) xevent.SelectionEvent.property,
+ 0, 0xffffff, false,
+ (IntPtr) Atom.AnyPropertyType, out actual_type,
+ out actual_fmt, out nitems, out bytes_after,
+ out data)) {
+ XFree (data);
+ break;
+ }
+
+ if (unicode)
+ builder.Append (Marshal.PtrToStringUni (data));
+ else
+ builder.Append (Marshal.PtrToStringAnsi (data));
+ nread += nitems;
+
+ XFree (data);
+ } while (bytes_after > 0);
+ if (nread == 0)
+ return null;
+ return builder.ToString ();
+ }
+
+ private MemoryStream GetData (ref XEvent xevent)
+ {
+ int nread = 0;
+ int nitems;
+ int bytes_after;
+
+ MemoryStream res = new MemoryStream ();
+ do {
+ IntPtr actual_type;
+ int actual_fmt;
+ IntPtr data = IntPtr.Zero;
+
+ if (0 != XGetWindowProperty (display,
+ xevent.AnyEvent.window,
+ (IntPtr) xevent.SelectionEvent.property,
+ 0, 0xffffff, false,
+ (IntPtr) Atom.AnyPropertyType, out actual_type,
+ out actual_fmt, out nitems, out bytes_after,
+ out data)) {
+ XFree (data);
+ break;
+ }
+
+ for (int i = 0; i < nitems; i++)
+ res.WriteByte (Marshal.ReadByte (data, i));
+ nread += nitems;
+
+ XFree (data);
+ } while (bytes_after > 0);
+ return res;
+ }
+
+ private Control MwfWindow (IntPtr window)
+ {
+ Hwnd hwnd = Hwnd.ObjectFromHandle (window);
+ if (hwnd == null)
+ return null;
+
+ Control res = Control.FromHandle (hwnd.client_window);
+ return res;
+ }
+
+ private bool IsWindowDndAware (IntPtr handle)
+ {
+ bool res = true;
+ // Check the version number, we need greater than 3
+ IntPtr actual;
+ int format, count, remaining;
+ IntPtr data = IntPtr.Zero;
+
+ XGetWindowProperty (display, handle, XdndAware, 0, 0x8000000, false,
+ (IntPtr) Atom.XA_ATOM, out actual, out format,
+ out count, out remaining, out data);
+
+ if (actual != (IntPtr) Atom.XA_ATOM || format != 32 ||
+ count == 0 || data == IntPtr.Zero) {
+ if (data != IntPtr.Zero)
+ XFree (data);
+ return false;
+ }
+
+ int version = Marshal.ReadInt32 (data, 0);
+
+ if (version < 3) {
+ Console.Error.WriteLine ("XDND Version too old (" + version + ").");
+ XFree (data);
+ return false;
+ }
+
+ // First type is actually the XDND version
+ if (count > 1) {
+ res = false;
+ for (int i = 1; i < count; i++) {
+ IntPtr type = (IntPtr) Marshal.ReadInt32 (data, i *
+ Marshal.SizeOf (typeof (int)));
+ for (int j = 0; j < drag_data.SupportedTypes.Length; j++) {
+ if (drag_data.SupportedTypes [j] == type) {
+ res = true;
+ break;
+ }
+ }
+ }
+ }
+
+ XFree (data);
+ return res;
+ }
+
+ private IntPtr [] DetermineSupportedTypes (object data)
+ {
+ ArrayList res = new ArrayList ();
+
+ if (data is string) {
+ MimeHandler handler = FindHandler ("text/plain");
+ if (handler != null)
+ res.Add (handler.Type);
+ }/* else if (data is Bitmap)
+ res.Add (data);
+
+ */
+
+ if (data is IDataObject) {
+
+
+ }
+
+ if (data is ISerializable) {
+ MimeHandler handler = FindHandler ("application/x-mono-serialized-object");
+ if (handler != null)
+ res.Add (handler.Type);
+ }
+
+ return (IntPtr []) res.ToArray (typeof (IntPtr));
+ }
+
+ [DllImport ("libX11")]
+ private extern static string XGetAtomName (IntPtr display, IntPtr atom);
+
+ [DllImport ("libX11")]
+ private extern static IntPtr XInternAtom (IntPtr display, string atom_name, bool only_if_exists);
+
+ [DllImport ("libX11")]
+ private extern static int XChangeProperty (IntPtr display, IntPtr window, IntPtr property,
+ IntPtr format, int type, PropertyMode mode, uint [] atoms, int nelements);
+
+ [DllImport ("libX11")]
+ private extern static int XGetWindowProperty (IntPtr display, IntPtr window,
+ IntPtr atom, int long_offset, int long_length, bool delete,
+ IntPtr req_type, out IntPtr actual_type, out int actual_format,
+ out int nitems, out int bytes_after, out IntPtr prop);
+
+ [DllImport ("libX11")]
+ internal extern static int XSendEvent (IntPtr display, IntPtr window,
+ bool propagate, EventMask event_mask, ref XEvent send_event);
+
+ [DllImport ("libX11")]
+ internal extern static int XConvertSelection (IntPtr display, IntPtr selection,
+ IntPtr target, IntPtr property, IntPtr requestor, int time);
+
+ [DllImport ("libX11")]
+ internal extern static IntPtr XGetSelectionOwner (IntPtr display, IntPtr selection);
+
+ [DllImport ("libX11")]
+ internal extern static int XGrabPointer (IntPtr display, IntPtr window,
+ bool owner_events, EventMask event_mask, GrabMode pointer_mode,
+ GrabMode keyboard_mode, IntPtr confine_to, IntPtr cursor, uint timestamp);
+
+ [DllImport ("libX11")]
+ internal extern static bool XQueryPointer (IntPtr display, IntPtr window, out IntPtr root,
+ out IntPtr child, out int root_x, out int root_y, out int win_x,
+ out int win_y, out int keys_buttons);
+
+ [DllImport ("libX11")]
+ internal extern static int XAllowEvents (IntPtr display, int event_mode, IntPtr time);
+
+ [DllImport ("libX11")]
+ internal extern static int XFree(IntPtr data);
+
+ [DllImport ("libX11")]
+ internal extern static int XFetchName (IntPtr display, IntPtr window, ref IntPtr window_name);
+ [DllImport ("libX11")]
+ internal extern static int XChangeActivePointerGrab (IntPtr display, EventMask event_mask, IntPtr cursor, IntPtr time);
+ }
+
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/X11Keyboard.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/X11Keyboard.cs
new file mode 100644
index 00000000000..e68f8ead190
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/X11Keyboard.cs
@@ -0,0 +1,686 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Jackson Harper (jackson@ximian.com)
+//
+//
+
+
+//
+// TODO:
+// - dead chars are not translated properly
+// - There is a lot of potential for optimmization in here
+//
+using System;
+using System.Text;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+
+ internal class X11Keyboard {
+
+ private IntPtr display;
+ private int min_keycode, max_keycode, keysyms_per_keycode, syms;
+ private int [] keyc2vkey = new int [256];
+ private int [] keyc2scan = new int [256];
+ private byte [] key_state_table = new byte [256];
+ private bool num_state, cap_state;
+ private KeyboardLayout layout = KeyboardLayouts.Layouts [0];
+
+ // TODO
+ private int NumLockMask;
+ private int AltGrMask;
+
+ public X11Keyboard (IntPtr display)
+ {
+ this.display = display;
+ DetectLayout ();
+ CreateConversionArray (layout);
+ }
+
+ public Keys ModifierKeys {
+ get {
+ Keys keys = Keys.None;
+ if ((key_state_table [(int) VirtualKeys.VK_SHIFT] & 0x80) != 0)
+ keys |= Keys.Shift;
+ if ((key_state_table [(int) VirtualKeys.VK_CONTROL] & 0x80) != 0)
+ keys |= Keys.Control;
+ if ((key_state_table [(int) VirtualKeys.VK_MENU] & 0x80) != 0)
+ keys |= Keys.Alt;
+ return keys;
+ }
+ }
+
+ public void KeyEvent (IntPtr hwnd, XEvent xevent, ref MSG msg)
+ {
+ XKeySym keysym;
+
+ XLookupString (ref xevent, IntPtr.Zero, 0, out keysym, IntPtr.Zero);
+ if (((int) keysym >= (int) MiscKeys.XK_ISO_Lock &&
+ (int) keysym <= (int) MiscKeys.XK_ISO_Last_Group_Lock) ||
+ (int) keysym == (int) MiscKeys.XK_Mode_switch) {
+ UpdateKeyState (xevent);
+ return;
+ }
+
+ if ((xevent.KeyEvent.keycode >> 8) == 0x10)
+ xevent.KeyEvent.keycode = xevent.KeyEvent.keycode & 0xFF;
+
+ int event_time = (int)xevent.KeyEvent.time;
+
+ AltGrMask = xevent.KeyEvent.state & (0x6000 | (int) KeyMasks.ModMasks);
+ int vkey = EventToVkey (xevent);
+ if (vkey == 0)
+ return;
+
+ switch ((VirtualKeys) (vkey & 0xFF)) {
+ case VirtualKeys.VK_NUMLOCK:
+ GenerateMessage (VirtualKeys.VK_NUMLOCK, 0x45, xevent.type, event_time);
+ break;
+ case VirtualKeys.VK_CAPITAL:
+ GenerateMessage (VirtualKeys.VK_CAPITAL, 0x3A, xevent.type, event_time);
+ break;
+ default:
+
+ if (((key_state_table [(int) VirtualKeys.VK_NUMLOCK] & 0x01) == 0) != ((xevent.KeyEvent.state & NumLockMask) == 0)) {
+ GenerateMessage (VirtualKeys.VK_NUMLOCK, 0x45, XEventName.KeyPress, event_time);
+ GenerateMessage (VirtualKeys.VK_NUMLOCK, 0x45, XEventName.KeyRelease, event_time);
+ }
+
+ if (((key_state_table [(int) VirtualKeys.VK_CAPITAL] & 0x01) == 0) != ((xevent.KeyEvent.state & (int) KeyMasks.LockMask) == 0)) {
+ GenerateMessage (VirtualKeys.VK_CAPITAL, 0x3A, XEventName.KeyPress, event_time);
+ GenerateMessage (VirtualKeys.VK_CAPITAL, 0x3A, XEventName.KeyRelease, event_time);
+ }
+
+ num_state = false;
+ cap_state = false;
+
+ int bscan = (keyc2scan [xevent.KeyEvent.keycode] & 0xFF);
+ KeybdEventFlags dw_flags = KeybdEventFlags.None;
+ if (xevent.type == XEventName.KeyRelease)
+ dw_flags |= KeybdEventFlags.KeyUp;
+ if ((vkey & 0x100) != 0)
+ dw_flags |= KeybdEventFlags.ExtendedKey;
+ msg = SendKeyboardInput ((VirtualKeys) (vkey & 0xFF), bscan, dw_flags, event_time);
+ msg.hwnd = hwnd;
+ break;
+ }
+ }
+
+ public bool TranslateMessage (ref MSG msg)
+ {
+ bool res = false;
+
+ if (msg.message >= Msg.WM_KEYFIRST && msg.message <= Msg.WM_KEYLAST)
+ res = true;
+
+ if (msg.message != Msg.WM_KEYDOWN && msg.message != Msg.WM_SYSKEYDOWN)
+ return res;
+
+ string buffer;
+ Msg message;
+
+ int tu = ToUnicode ((int) msg.wParam, Control.HighOrder ((int) msg.lParam), out buffer);
+ switch (tu) {
+ case 1:
+ message = (msg.message == Msg.WM_KEYDOWN ? Msg.WM_CHAR : Msg.WM_SYSCHAR);
+ XplatUI.PostMessage (msg.hwnd, message, (IntPtr) buffer [0], msg.lParam);
+ break;
+ case -1:
+ message = (msg.message == Msg.WM_KEYDOWN ? Msg.WM_DEADCHAR : Msg.WM_SYSDEADCHAR);
+ XplatUI.PostMessage (msg.hwnd, message, (IntPtr) buffer [0], msg.lParam);
+ return true;
+ }
+
+ return res;
+ }
+
+ private int ToUnicode (int vkey, int scan, out string buffer)
+ {
+ if ((scan & 0x8000) != 0) {
+ buffer = String.Empty;
+ return 0;
+ }
+
+ XEvent e = new XEvent ();
+ e.KeyEvent.display = display;
+ e.KeyEvent.keycode = 0;
+ e.KeyEvent.state = 0;
+
+ if ((key_state_table [(int) VirtualKeys.VK_SHIFT] & 0x80) != 0) {
+ e.KeyEvent.state |= (int) KeyMasks.ShiftMask;
+ }
+
+ if ((key_state_table [(int) VirtualKeys.VK_CAPITAL] & 0x01) != 0) {
+ e.KeyEvent.state |= (int) KeyMasks.LockMask;
+ }
+
+ if ((key_state_table [(int) VirtualKeys.VK_CONTROL] & 0x80) != 0) {
+ e.KeyEvent.state |= (int) KeyMasks.ControlMask;
+ }
+
+ if ((key_state_table [(int) VirtualKeys.VK_NUMLOCK] & 0x01) != 0) {
+ e.KeyEvent.state |= NumLockMask;
+ }
+
+ e.KeyEvent.state |= AltGrMask;
+
+ for (int keyc = min_keycode; (keyc <= max_keycode) && (e.KeyEvent.keycode == 0); keyc++) {
+ // find keycode that could have generated this vkey
+ if ((keyc2vkey [keyc] & 0xFF) == vkey) {
+ // filter extended bit because it is not known
+ e.KeyEvent.keycode = keyc;
+ if ((EventToVkey (e) & 0xFF) != vkey) {
+ // Wrong one (ex: because of num,lock state)
+ e.KeyEvent.keycode = 0;
+ }
+ }
+ }
+
+ if ((vkey >= (int) VirtualKeys.VK_NUMPAD0) && (vkey <= (int) VirtualKeys.VK_NUMPAD9))
+ e.KeyEvent.keycode = XKeysymToKeycode (display, vkey - (int) VirtualKeys.VK_NUMPAD0 + (int) KeypadKeys.XK_KP_0);
+
+ if (vkey == (int) VirtualKeys.VK_DECIMAL)
+ e.KeyEvent.keycode = XKeysymToKeycode (display, (int) KeypadKeys.XK_KP_Decimal);
+
+ if (e.KeyEvent.keycode == 0) {
+ // And I couldn't find the keycode so i returned the vkey and was like whatever
+ Console.Error.WriteLine ("unknown virtual key {0:X}", vkey);
+ buffer = String.Empty;
+ return vkey;
+ }
+
+ IntPtr buf = Marshal.AllocHGlobal (2);
+ XKeySym t;
+ int res = XLookupString (ref e, buf, 2, out t, IntPtr.Zero);
+ int keysym = (int) t;
+
+ buffer = String.Empty;
+ if (res == 0) {
+ int dead_char = MapDeadKeySym (keysym);
+ if (dead_char != 0) {
+ byte [] bytes = new byte [1];
+ bytes [0] = (byte) dead_char;
+ Encoding encoding = Encoding.GetEncoding (layout.CodePage);
+ buffer = new string (encoding.GetChars (bytes));
+ res = -1;
+ }
+ } else {
+ // Shift + arrow, shift + home, ....
+ // X returns a char for it, but windows doesn't
+ if (((e.KeyEvent.state & NumLockMask) == 0) && ((e.KeyEvent.state & (int) KeyMasks.ShiftMask) != 0) &&
+ (keysym >= (int) KeypadKeys.XK_KP_0) && (keysym <= (int) KeypadKeys.XK_KP_9)) {
+ buffer = String.Empty;
+ res = 0;
+ }
+
+ // CTRL + number, X returns chars, windows does not
+ if ((e.KeyEvent.state & (int) KeyMasks.ControlMask) != 0) {
+ if (((keysym >= 33) && (keysym < 'A')) || ((keysym > 'Z') && (keysym < 'a'))) {
+ buffer = String.Empty;
+ res = 0;
+ }
+ }
+
+ // X returns a char for delete key on extended keyboards, windows does not
+ if (keysym == (int) TtyKeys.XK_Delete) {
+ buffer = String.Empty;
+ res = 0;
+ }
+
+ if (res != 0) {
+ byte [] bytes = new byte [2];
+ bytes [0] = Marshal.ReadByte (buf);
+ bytes [1] = Marshal.ReadByte (buf, 1);
+ Encoding encoding = Encoding.GetEncoding (layout.CodePage);
+ buffer = new string (encoding.GetChars (bytes));
+ }
+ }
+
+ return res;
+ }
+
+ private MSG SendKeyboardInput (VirtualKeys vkey, int scan, KeybdEventFlags dw_flags, int time)
+ {
+ Msg message;
+
+ if ((dw_flags & KeybdEventFlags.KeyUp) != 0) {
+ bool sys_key = (key_state_table [(int) VirtualKeys.VK_MENU] & 0x80) != 0 &&
+ ((key_state_table [(int) VirtualKeys.VK_CONTROL] & 0x80) == 0);
+ key_state_table [(int) vkey] &= unchecked ((byte) ~0x80);
+ message = (sys_key ? Msg.WM_SYSKEYUP : Msg.WM_KEYUP);
+ } else {
+ if ((key_state_table [(int) vkey] & 0x80) == 0) {
+ key_state_table [(int) vkey] ^= 0x01;
+ }
+ key_state_table [(int) vkey] |= 0x80;
+ bool sys_key = (key_state_table [(int) VirtualKeys.VK_MENU] & 0x80) != 0 &&
+ ((key_state_table [(int) VirtualKeys.VK_CONTROL] & 0x80) == 0);
+ message = (sys_key ? Msg.WM_SYSKEYDOWN : Msg.WM_KEYDOWN);
+ }
+
+ MSG msg = new MSG ();
+ msg.message = message;
+ msg.wParam = (IntPtr) vkey;
+ if ((key_state_table [(int) VirtualKeys.VK_MENU] & 0x80) != 0)
+ msg.lParam = new IntPtr (0x20000000);
+ else
+ msg.lParam = IntPtr.Zero;
+
+ return msg;
+ }
+
+ private void GenerateMessage (VirtualKeys vkey, int scan, XEventName type, int event_time)
+ {
+ bool state = (vkey == VirtualKeys.VK_NUMLOCK ? num_state : cap_state);
+ KeybdEventFlags up, down;
+
+ if (state) {
+ // The INTERMEDIARY state means : just after a 'press' event, if a 'release' event comes,
+ // don't treat it. It's from the same key press. Then the state goes to ON.
+ // And from there, a 'release' event will switch off the toggle key.
+ SetState (vkey, false);
+ } else {
+ down = (vkey == VirtualKeys.VK_NUMLOCK ? KeybdEventFlags.ExtendedKey : KeybdEventFlags.None);
+ up = (vkey == VirtualKeys.VK_NUMLOCK ? KeybdEventFlags.ExtendedKey :
+ KeybdEventFlags.None) | KeybdEventFlags.KeyUp;
+ if ((key_state_table [(int) vkey] & 0x1) != 0) { // it was on
+ if (type != XEventName.KeyPress) {
+ SendKeyboardInput (vkey, scan, down, event_time);
+ SendKeyboardInput (vkey, scan, up, event_time);
+ SetState (vkey, false);
+ key_state_table [(int) vkey] &= unchecked ((byte) ~0x01);
+ }
+ } else {
+ if (type == XEventName.KeyPress) {
+ SendKeyboardInput (vkey, scan, down, event_time);
+ SendKeyboardInput (vkey, scan, up, event_time);
+ SetState (vkey, true);
+ key_state_table [(int) vkey] |= 0x01;
+ }
+ }
+ }
+ }
+
+ private void UpdateKeyState (XEvent xevent)
+ {
+ int vkey = EventToVkey (xevent);
+
+ switch (xevent.type) {
+ case XEventName.KeyRelease:
+ key_state_table [(int) vkey] &= unchecked ((byte) ~0x80);
+ break;
+ case XEventName.KeyPress:
+ if ((key_state_table [(int) vkey] & 0x80) == 0) {
+ key_state_table [(int) vkey] ^= 0x01;
+ }
+ key_state_table [(int) vkey] |= 0x80;
+ break;
+ }
+ }
+
+ private void SetState (VirtualKeys key, bool state)
+ {
+ if (VirtualKeys.VK_NUMLOCK == key)
+ num_state = state;
+ else
+ cap_state = state;
+ }
+
+ public int EventToVkey (XEvent e)
+ {
+ XKeySym ks;
+
+ XLookupString (ref e, IntPtr.Zero, 0, out ks, IntPtr.Zero);
+ int keysym = (int) ks;
+
+ if ((keysym >= 0xFFAE) && (keysym <= 0xFFB9) && (keysym != 0xFFAF)
+ && ((e.KeyEvent.state & NumLockMask) !=0)) {
+ // Only the Keypad keys 0-9 and . send different keysyms
+ // depending on the NumLock state
+ return KeyboardLayouts.nonchar_key_vkey [keysym & 0xFF];
+ }
+
+ return keyc2vkey [e.KeyEvent.keycode];
+ }
+
+ public void CreateConversionArray (KeyboardLayout layout)
+ {
+
+ XEvent e2 = new XEvent ();
+ int keysym = 0;
+ int [] ckey = new int [] { 0, 0, 0, 0 };
+
+ e2.KeyEvent.display = display;
+ e2.KeyEvent.state = 0;
+
+ int oem_vkey = (int) VirtualKeys.VK_OEM_7;
+ for (int keyc = min_keycode; keyc <= max_keycode; keyc++) {
+ int vkey = 0;
+ int scan = 0;
+
+ e2.KeyEvent.keycode = keyc;
+ XKeySym t;
+ XLookupString (ref e2, IntPtr.Zero, 0, out t, IntPtr.Zero);
+ keysym = (int) t;
+ if (keysym != 0) {
+ if ((keysym >> 8) == 0xFF) {
+ vkey = KeyboardLayouts.nonchar_key_vkey [keysym & 0xFF];
+ scan = KeyboardLayouts.nonchar_key_scan [keysym & 0xFF];
+ // Set extended bit
+ if ((scan & 0x100) != 0)
+ vkey |= 0x100;
+ } else if (keysym == 0x20) { // spacebar
+ vkey = (int) VirtualKeys.VK_SPACE;
+ scan = 0x39;
+ } else {
+ // Search layout dependent scancodes
+ int maxlen = 0;
+ int maxval = -1;;
+ int ok;
+
+ for (int i = 0; i < syms; i++) {
+ keysym = (int) XKeycodeToKeysym (display, keyc, i);
+ if ((keysym < 0x800) && (keysym != ' '))
+ ckey [i] = keysym & 0xFF;
+ else
+ ckey [i] = MapDeadKeySym (keysym);
+ }
+
+ for (int keyn = 0; keyn < layout.Key.Length; keyn++) {
+ int i = 0;
+ int ml = (layout.Key [keyn].Length > 4 ? 4 : layout.Key [keyn].Length);
+ for (ok = layout.Key [keyn][i]; (ok != 0) && (i < ml); i++) {
+ if (layout.Key [keyn][i] != ckey [i])
+ ok = 0;
+ if ((ok != 0) || (i > maxlen)) {
+ maxlen = i;
+ maxval = keyn;
+ }
+ if (ok != 0)
+ break;
+ }
+ }
+ if (maxval >= 0) {
+ scan = layout.Scan [maxval];
+ vkey = (int) layout.VKey [maxval];
+ }
+
+ }
+
+ for (int i = 0; (i < keysyms_per_keycode) && (vkey == 0); i++) {
+ keysym = (int) XLookupKeysym (ref e2, i);
+ if ((keysym >= (int) VirtualKeys.VK_0 && keysym <= (int) VirtualKeys.VK_9) ||
+ (keysym >= (int) VirtualKeys.VK_A && keysym <= (int) VirtualKeys.VK_Z)) {
+ vkey = keysym;
+ }
+ }
+
+ for (int i = 0; (i < keysyms_per_keycode) && (vkey == 0); i++) {
+ keysym = (int) XLookupKeysym (ref e2, i);
+ switch ((char) keysym) {
+ case ';':
+ vkey = (int) VirtualKeys.VK_OEM_1;
+ break;
+ case '/':
+ vkey = (int) VirtualKeys.VK_OEM_2;
+ break;
+ case '`':
+ vkey = (int) VirtualKeys.VK_OEM_3;
+ break;
+ case '[':
+ vkey = (int) VirtualKeys.VK_OEM_4;
+ break;
+ case '\\':
+ vkey = (int) VirtualKeys.VK_OEM_5;
+ break;
+ case ']':
+ vkey = (int) VirtualKeys.VK_OEM_6;
+ break;
+ case '\'':
+ vkey = (int) VirtualKeys.VK_OEM_7;
+ break;
+ case ',':
+ vkey = (int) VirtualKeys.VK_OEM_COMMA;
+ break;
+ case '.':
+ vkey = (int) VirtualKeys.VK_OEM_PERIOD;
+ break;
+ case '-':
+ vkey = (int) VirtualKeys.VK_OEM_MINUS;
+ break;
+ case '+':
+ vkey = (int) VirtualKeys.VK_OEM_PLUS;
+ break;
+
+ }
+ }
+
+ if (vkey == 0) {
+ switch (++oem_vkey) {
+ case 0xc1:
+ oem_vkey = 0xDB;
+ break;
+ case 0xE5:
+ oem_vkey = 0xE9;
+ break;
+ case 0xF6:
+ oem_vkey = 0xF5;
+ break;
+ }
+ vkey = oem_vkey;
+ }
+ }
+ keyc2vkey [e2.KeyEvent.keycode] = vkey;
+ keyc2scan [e2.KeyEvent.keycode] = scan;
+ }
+
+
+ }
+
+ public void DetectLayout ()
+ {
+ XDisplayKeycodes (display, out min_keycode, out max_keycode);
+ IntPtr ksp = XGetKeyboardMapping (display, (byte) min_keycode,
+ max_keycode + 1 - min_keycode, out keysyms_per_keycode);
+ XplatUIX11.XFree (ksp);
+
+ syms = keysyms_per_keycode;
+ if (syms > 4) {
+ //Console.Error.WriteLine ("{0} keysymbols per a keycode is not supported, setting to 4", syms);
+ syms = 2;
+ }
+
+ IntPtr modmap_unmanaged;
+ XModifierKeymap xmk = new XModifierKeymap ();
+
+ modmap_unmanaged = XGetModifierMapping (display);
+ xmk = (XModifierKeymap) Marshal.PtrToStructure (modmap_unmanaged, typeof (XModifierKeymap));
+
+ int mmp = 0;
+ for (int i = 0; i < 8; i++) {
+ for (int j = 0; j < xmk.max_keypermod; j++, mmp++) {
+ byte b = Marshal.ReadByte (xmk.modifiermap, mmp);
+ if (b != 0) {
+ for (int k = 0; k < keysyms_per_keycode; k++) {
+ if ((int) XKeycodeToKeysym (display, b, k) == (int) MiscKeys.XK_Num_Lock)
+ NumLockMask = 1 << i;
+ }
+ }
+ }
+ }
+ XFreeModifiermap (modmap_unmanaged);
+
+ int [] ckey = new int [4];
+ KeyboardLayout layout = null;
+ int max_score = 0;
+ int max_seq = 0;
+
+ foreach (KeyboardLayout current in KeyboardLayouts.Layouts) {
+ int ok = 0;
+ int score = 0;
+ int match = 0;
+ int seq = 0;
+ int pkey = -1;
+ int key = min_keycode;
+
+ for (int keyc = min_keycode; keyc <= max_keycode; keyc++) {
+ for (int i = 0; i < syms; i++) {
+ int keysym = (int) XKeycodeToKeysym (display, keyc, i);
+
+ if ((keysym != 0xFF1B) && (keysym < 0x800) && (keysym != ' ')) {
+ ckey [i] = keysym & 0xFF;
+ } else {
+ ckey [i] = MapDeadKeySym (keysym);
+ }
+ }
+ if (ckey [0] != 0) {
+
+ for (key = 0; key < current.Key.Length; key++) {
+ ok = 0;
+ int ml = (current.Key [key].Length > syms ? syms : current.Key [key].Length);
+ for (int i = 0; (ok >= 0) && (i < ml); i++) {
+ if (ckey [i] != 0 && current.Key [key][i] == (char) ckey [i]) {
+ ok++;
+ }
+ if (ckey [i] != 0 && current.Key [key][i] != (char) ckey [i])
+ ok = -1;
+ }
+ if (ok >= 0) {
+ score += ok;
+ break;
+ }
+ }
+ if (ok > 0) {
+ match++;
+ if (key > pkey)
+ seq++;
+ pkey = key;
+ } else {
+ score -= syms;
+ }
+ }
+ }
+
+ if ((score > max_score) || ((score == max_score) && (seq > max_seq))) {
+ // best match so far
+ layout = current;
+ max_score = score;
+ max_seq = seq;
+ }
+ }
+
+ if (layout != null) {
+ this.layout = layout;
+ Console.WriteLine (Locale.GetText("Keyboard") + ": " + layout.Comment);
+ } else {
+ Console.WriteLine (Locale.GetText("Keyboard layout not recognized, using default layout: " + layout.Comment));
+ }
+ }
+
+ // TODO
+ private int MapDeadKeySym (int val)
+ {
+ switch (val) {
+ case (int) DeadKeys.XK_dead_tilde :
+ case 0x1000FE7E : // Xfree's Dtilde
+ return '~';
+ case (int) DeadKeys.XK_dead_acute :
+ case 0x1000FE27 : // Xfree's XK_Dacute_accent
+ return 0xb4;
+ case (int) DeadKeys.XK_dead_circumflex:
+ case 0x1000FE5E : // Xfree's XK_.Dcircumflex_accent
+ return '^';
+ case (int) DeadKeys.XK_dead_grave :
+ case 0x1000FE60 : // Xfree's XK_.Dgrave_accent
+ return '`';
+ case (int) DeadKeys.XK_dead_diaeresis :
+ case 0x1000FE22 : // Xfree's XK_.Ddiaeresis
+ return 0xa8;
+ case (int) DeadKeys.XK_dead_cedilla :
+ return 0xb8;
+ case (int) DeadKeys.XK_dead_macron :
+ return '-';
+ case (int) DeadKeys.XK_dead_breve :
+ return 0xa2;
+ case (int) DeadKeys.XK_dead_abovedot :
+ return 0xff;
+ case (int) DeadKeys.XK_dead_abovering :
+ return '0';
+ case (int) DeadKeys.XK_dead_doubleacute :
+ return 0xbd;
+ case (int) DeadKeys.XK_dead_caron :
+ return 0xb7;
+ case (int) DeadKeys.XK_dead_ogonek :
+ return 0xb2;
+ }
+
+ return 0;
+ }
+
+ [DllImport ("libX11")]
+ internal extern static int XLookupString(ref XEvent xevent, IntPtr buffer, int num_bytes, out IntPtr keysym, IntPtr status);
+ internal static int XLookupString (ref XEvent xevent, IntPtr buffer, int num_bytes, out XKeySym keysym, IntPtr status) {
+ IntPtr keysym_ret;
+ int ret;
+
+ ret = XLookupString (ref xevent, buffer, num_bytes, out keysym_ret, status);
+ keysym = (XKeySym)keysym_ret.ToInt32();
+
+ return ret;
+ }
+
+ [DllImport ("libX11", EntryPoint="XLookupKeysym")]
+ private static extern IntPtr XLookupKeysymX11(ref XEvent xevent, int index);
+ private static XKeySym XLookupKeysym(ref XEvent xevent, int index) {
+ return (XKeySym)XLookupKeysymX11(ref xevent, index).ToInt32();
+ }
+
+ [DllImport ("libX11")]
+ private static extern IntPtr XGetKeyboardMapping (IntPtr display, byte first_keycode, int keycode_count,
+ out int keysyms_per_keycode_return);
+
+ [DllImport ("libX11")]
+ private static extern void XDisplayKeycodes (IntPtr display, out int min, out int max);
+
+ [DllImport ("libX11", EntryPoint="XKeycodeToKeysym")]
+ private static extern IntPtr XKeycodeToKeysymX11(IntPtr display, int keycode, int index);
+ private static XKeySym XKeycodeToKeysym(IntPtr display, int keycode, int index) {
+ return (XKeySym)XKeycodeToKeysymX11(display, keycode, index).ToInt32();
+ }
+
+ [DllImport ("libX11")]
+ private static extern int XKeysymToKeycode (IntPtr display, IntPtr keysym);
+ private static int XKeysymToKeycode (IntPtr display, int keysym) {
+ return XKeysymToKeycode(display, (IntPtr)keysym);
+ }
+
+ [DllImport ("libX11")]
+ internal extern static IntPtr XGetModifierMapping (IntPtr display);
+
+ [DllImport ("libX11")]
+ internal extern static int XFreeModifiermap (IntPtr modmap);
+
+ }
+
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/X11Structs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/X11Structs.cs
new file mode 100644
index 00000000000..24dd0e944ac
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/X11Structs.cs
@@ -0,0 +1,1580 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// NOT COMPLETE
+
+using System;
+using System.ComponentModel;
+using System.Collections;
+using System.Drawing;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+
+/// X11 Version
+namespace System.Windows.Forms {
+ //
+ // In the structures below, fields of type long are mapped to IntPtr.
+ // This will work on all platforms where sizeof(long)==sizeof(void*), which
+ // is almost all platforms except WIN64.
+ //
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XAnyEvent {
+ internal XEventName type;
+ internal IntPtr serial;
+ internal bool send_event;
+ internal IntPtr display;
+ internal IntPtr window;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XKeyEvent {
+ internal XEventName type;
+ internal IntPtr serial;
+ internal bool send_event;
+ internal IntPtr display;
+ internal IntPtr window;
+ internal IntPtr root;
+ internal IntPtr subwindow;
+ internal IntPtr time;
+ internal int x;
+ internal int y;
+ internal int x_root;
+ internal int y_root;
+ internal int state;
+ internal int keycode;
+ internal bool same_screen;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XButtonEvent {
+ internal XEventName type;
+ internal IntPtr serial;
+ internal bool send_event;
+ internal IntPtr display;
+ internal IntPtr window;
+ internal IntPtr root;
+ internal IntPtr subwindow;
+ internal IntPtr time;
+ internal int x;
+ internal int y;
+ internal int x_root;
+ internal int y_root;
+ internal int state;
+ internal int button;
+ internal bool same_screen;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XMotionEvent {
+ internal XEventName type;
+ internal IntPtr serial;
+ internal bool send_event;
+ internal IntPtr display;
+ internal IntPtr window;
+ internal IntPtr root;
+ internal IntPtr subwindow;
+ internal IntPtr time;
+ internal int x;
+ internal int y;
+ internal int x_root;
+ internal int y_root;
+ internal int state;
+ internal byte is_hint;
+ internal bool same_screen;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XCrossingEvent {
+ internal XEventName type;
+ internal IntPtr serial;
+ internal bool send_event;
+ internal IntPtr display;
+ internal IntPtr window;
+ internal IntPtr root;
+ internal IntPtr subwindow;
+ internal IntPtr time;
+ internal int x;
+ internal int y;
+ internal int x_root;
+ internal int y_root;
+ internal NotifyMode mode;
+ internal NotifyDetail detail;
+ internal bool same_screen;
+ internal bool focus;
+ internal int state;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XFocusChangeEvent {
+ internal XEventName type;
+ internal IntPtr serial;
+ internal bool send_event;
+ internal IntPtr display;
+ internal IntPtr window;
+ internal int mode;
+ internal NotifyDetail detail;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XKeymapEvent {
+ internal XEventName type;
+ internal IntPtr serial;
+ internal bool send_event;
+ internal IntPtr display;
+ internal IntPtr window;
+ internal byte key_vector0;
+ internal byte key_vector1;
+ internal byte key_vector2;
+ internal byte key_vector3;
+ internal byte key_vector4;
+ internal byte key_vector5;
+ internal byte key_vector6;
+ internal byte key_vector7;
+ internal byte key_vector8;
+ internal byte key_vector9;
+ internal byte key_vector10;
+ internal byte key_vector11;
+ internal byte key_vector12;
+ internal byte key_vector13;
+ internal byte key_vector14;
+ internal byte key_vector15;
+ internal byte key_vector16;
+ internal byte key_vector17;
+ internal byte key_vector18;
+ internal byte key_vector19;
+ internal byte key_vector20;
+ internal byte key_vector21;
+ internal byte key_vector22;
+ internal byte key_vector23;
+ internal byte key_vector24;
+ internal byte key_vector25;
+ internal byte key_vector26;
+ internal byte key_vector27;
+ internal byte key_vector28;
+ internal byte key_vector29;
+ internal byte key_vector30;
+ internal byte key_vector31;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XExposeEvent {
+ internal XEventName type;
+ internal IntPtr serial;
+ internal bool send_event;
+ internal IntPtr display;
+ internal IntPtr window;
+ internal int x;
+ internal int y;
+ internal int width;
+ internal int height;
+ internal int count;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XGraphicsExposeEvent {
+ internal XEventName type;
+ internal IntPtr serial;
+ internal bool send_event;
+ internal IntPtr display;
+ internal IntPtr drawable;
+ internal int x;
+ internal int y;
+ internal int width;
+ internal int height;
+ internal int count;
+ internal int major_code;
+ internal int minor_code;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XNoExposeEvent {
+ internal XEventName type;
+ internal IntPtr serial;
+ internal bool send_event;
+ internal IntPtr display;
+ internal IntPtr drawable;
+ internal int major_code;
+ internal int minor_code;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XVisibilityEvent {
+ internal XEventName type;
+ internal IntPtr serial;
+ internal bool send_event;
+ internal IntPtr display;
+ internal IntPtr window;
+ internal int state;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XCreateWindowEvent {
+ internal XEventName type;
+ internal IntPtr serial;
+ internal bool send_event;
+ internal IntPtr display;
+ internal IntPtr parent;
+ internal IntPtr window;
+ internal int x;
+ internal int y;
+ internal int width;
+ internal int height;
+ internal int border_width;
+ internal bool override_redirect;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XDestroyWindowEvent {
+ internal XEventName type;
+ internal IntPtr serial;
+ internal bool send_event;
+ internal IntPtr display;
+ internal IntPtr xevent;
+ internal IntPtr window;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XUnmapEvent {
+ internal XEventName type;
+ internal IntPtr serial;
+ internal bool send_event;
+ internal IntPtr display;
+ internal IntPtr xevent;
+ internal IntPtr window;
+ internal bool from_configure;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XMapEvent {
+ internal XEventName type;
+ internal IntPtr serial;
+ internal bool send_event;
+ internal IntPtr display;
+ internal IntPtr xevent;
+ internal IntPtr window;
+ internal bool override_redirect;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XMapRequestEvent {
+ internal XEventName type;
+ internal IntPtr serial;
+ internal bool send_event;
+ internal IntPtr display;
+ internal IntPtr parent;
+ internal IntPtr window;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XReparentEvent {
+ internal XEventName type;
+ internal IntPtr serial;
+ internal bool send_event;
+ internal IntPtr display;
+ internal IntPtr xevent;
+ internal IntPtr window;
+ internal IntPtr parent;
+ internal int x;
+ internal int y;
+ internal bool override_redirect;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XConfigureEvent {
+ internal XEventName type;
+ internal IntPtr serial;
+ internal bool send_event;
+ internal IntPtr display;
+ internal IntPtr xevent;
+ internal IntPtr window;
+ internal int x;
+ internal int y;
+ internal int width;
+ internal int height;
+ internal int border_width;
+ internal IntPtr above;
+ internal bool override_redirect;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XGravityEvent {
+ internal XEventName type;
+ internal IntPtr serial;
+ internal bool send_event;
+ internal IntPtr display;
+ internal IntPtr xevent;
+ internal IntPtr window;
+ internal int x;
+ internal int y;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XResizeRequestEvent {
+ internal XEventName type;
+ internal IntPtr serial;
+ internal bool send_event;
+ internal IntPtr display;
+ internal IntPtr window;
+ internal int width;
+ internal int height;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XConfigureRequestEvent {
+ internal XEventName type;
+ internal IntPtr serial;
+ internal bool send_event;
+ internal IntPtr display;
+ internal IntPtr window;
+ internal int width;
+ internal int height;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XCirculateEvent {
+ internal XEventName type;
+ internal IntPtr serial;
+ internal bool send_event;
+ internal IntPtr display;
+ internal IntPtr xevent;
+ internal IntPtr window;
+ internal int place;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XCirculateRequestEvent {
+ internal XEventName type;
+ internal IntPtr serial;
+ internal bool send_event;
+ internal IntPtr display;
+ internal IntPtr parent;
+ internal IntPtr window;
+ internal int place;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XPropertyEvent {
+ internal XEventName type;
+ internal IntPtr serial;
+ internal bool send_event;
+ internal IntPtr display;
+ internal IntPtr window;
+ internal int atom;
+ internal IntPtr time;
+ internal int state;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XSelectionClearEvent {
+ internal XEventName type;
+ internal IntPtr serial;
+ internal bool send_event;
+ internal IntPtr display;
+ internal IntPtr window;
+ internal int selection;
+ internal IntPtr time;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XSelectionRequestEvent {
+ internal XEventName type;
+ internal IntPtr serial;
+ internal bool send_event;
+ internal IntPtr display;
+ internal IntPtr owner;
+ internal IntPtr requestor;
+ internal int selection;
+ internal int target;
+ internal int property;
+ internal IntPtr time;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XSelectionEvent {
+ internal XEventName type;
+ internal IntPtr serial;
+ internal bool send_event;
+ internal IntPtr display;
+ internal IntPtr requestor;
+ internal int selection;
+ internal int target;
+ internal int property;
+ internal IntPtr time;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XColormapEvent {
+ internal XEventName type;
+ internal IntPtr serial;
+ internal bool send_event;
+ internal IntPtr display;
+ internal IntPtr window;
+ internal IntPtr colormap;
+ internal bool c_new;
+ internal int state;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XClientMessageEvent {
+ internal XEventName type;
+ internal IntPtr serial;
+ internal bool send_event;
+ internal IntPtr display;
+ internal IntPtr window;
+ internal IntPtr message_type;
+ internal int format;
+ internal IntPtr ptr1;
+ internal IntPtr ptr2;
+ internal IntPtr ptr3;
+ internal IntPtr ptr4;
+ internal IntPtr ptr5;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XMappingEvent {
+ internal XEventName type;
+ internal IntPtr serial;
+ internal bool send_event;
+ internal IntPtr display;
+ internal IntPtr window;
+ internal int request;
+ internal int first_keycode;
+ internal int count;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XErrorEvent {
+ internal XEventName type;
+ internal IntPtr display;
+ internal IntPtr resourceid;
+ internal IntPtr serial;
+ internal byte error_code;
+ internal XRequest request_code;
+ internal byte minor_code;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XTimerNotifyEvent {
+ internal XEventName type;
+ internal EventHandler handler;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XEventPad {
+ internal IntPtr pad0;
+ internal IntPtr pad1;
+ internal IntPtr pad2;
+ internal IntPtr pad3;
+ internal IntPtr pad4;
+ internal IntPtr pad5;
+ internal IntPtr pad6;
+ internal IntPtr pad7;
+ internal IntPtr pad8;
+ internal IntPtr pad9;
+ internal IntPtr pad10;
+ internal IntPtr pad11;
+ internal IntPtr pad12;
+ internal IntPtr pad13;
+ internal IntPtr pad14;
+ internal IntPtr pad15;
+ internal IntPtr pad16;
+ internal IntPtr pad17;
+ internal IntPtr pad18;
+ internal IntPtr pad19;
+ internal IntPtr pad20;
+ internal IntPtr pad21;
+ internal IntPtr pad22;
+ internal IntPtr pad23;
+ }
+
+ [StructLayout(LayoutKind.Explicit)]
+ internal struct XEvent {
+ [ FieldOffset(0) ] internal XEventName type;
+ [ FieldOffset(0) ] internal XAnyEvent AnyEvent;
+ [ FieldOffset(0) ] internal XKeyEvent KeyEvent;
+ [ FieldOffset(0) ] internal XButtonEvent ButtonEvent;
+ [ FieldOffset(0) ] internal XMotionEvent MotionEvent;
+ [ FieldOffset(0) ] internal XCrossingEvent CrossingEvent;
+ [ FieldOffset(0) ] internal XFocusChangeEvent FocusChangeEvent;
+ [ FieldOffset(0) ] internal XExposeEvent ExposeEvent;
+ [ FieldOffset(0) ] internal XGraphicsExposeEvent GraphicsExposeEvent;
+ [ FieldOffset(0) ] internal XNoExposeEvent NoExposeEvent;
+ [ FieldOffset(0) ] internal XVisibilityEvent VisibilityEvent;
+ [ FieldOffset(0) ] internal XCreateWindowEvent CreateWindowEvent;
+ [ FieldOffset(0) ] internal XDestroyWindowEvent DestroyWindowEvent;
+ [ FieldOffset(0) ] internal XUnmapEvent UnmapEvent;
+ [ FieldOffset(0) ] internal XMapEvent MapEvent;
+ [ FieldOffset(0) ] internal XMapRequestEvent MapRequestEvent;
+ [ FieldOffset(0) ] internal XReparentEvent ReparentEvent;
+ [ FieldOffset(0) ] internal XConfigureEvent ConfigureEvent;
+ [ FieldOffset(0) ] internal XGravityEvent GravityEvent;
+ [ FieldOffset(0) ] internal XResizeRequestEvent ResizeRequestEvent;
+ [ FieldOffset(0) ] internal XConfigureRequestEvent ConfigureRequestEvent;
+ [ FieldOffset(0) ] internal XCirculateEvent CirculateEvent;
+ [ FieldOffset(0) ] internal XCirculateRequestEvent CirculateRequestEvent;
+ [ FieldOffset(0) ] internal XPropertyEvent PropertyEvent;
+ [ FieldOffset(0) ] internal XSelectionClearEvent SelectionClearEvent;
+ [ FieldOffset(0) ] internal XSelectionRequestEvent SelectionRequestEvent;
+ [ FieldOffset(0) ] internal XSelectionEvent SelectionEvent;
+ [ FieldOffset(0) ] internal XColormapEvent ColormapEvent;
+ [ FieldOffset(0) ] internal XClientMessageEvent ClientMessageEvent;
+ [ FieldOffset(0) ] internal XMappingEvent MappingEvent;
+ [ FieldOffset(0) ] internal XErrorEvent ErrorEvent;
+ [ FieldOffset(0) ] internal XKeymapEvent KeymapEvent;
+ [ FieldOffset(0) ] internal XTimerNotifyEvent TimerNotifyEvent;
+
+ //[MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst=24)]
+ //[ FieldOffset(0) ] internal int[] pad;
+ [ FieldOffset(0) ] internal XEventPad Pad;
+ public override string ToString() {
+ return type.ToString();
+ }
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XSetWindowAttributes {
+ internal IntPtr background_pixmap;
+ internal IntPtr background_pixel;
+ internal IntPtr border_pixmap;
+ internal IntPtr border_pixel;
+ internal Gravity bit_gravity;
+ internal Gravity win_gravity;
+ internal int backing_store;
+ internal IntPtr backing_planes;
+ internal IntPtr backing_pixel;
+ internal bool save_under;
+ internal IntPtr event_mask;
+ internal IntPtr do_not_propagate_mask;
+ internal bool override_redirect;
+ internal IntPtr colormap;
+ internal IntPtr cursor;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XWindowAttributes {
+ internal int x;
+ internal int y;
+ internal int width;
+ internal int height;
+ internal int border_width;
+ internal int depth;
+ internal IntPtr visual;
+ internal IntPtr root;
+ internal int c_class;
+ internal Gravity bit_gravity;
+ internal Gravity win_gravity;
+ internal int backing_store;
+ internal IntPtr backing_planes;
+ internal IntPtr backing_pixel;
+ internal bool save_under;
+ internal IntPtr colormap;
+ internal bool map_installed;
+ internal MapState map_state;
+ internal IntPtr all_event_masks;
+ internal IntPtr your_event_mask;
+ internal IntPtr do_not_propagate_mask;
+ internal bool override_direct;
+ internal IntPtr screen;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XTextProperty {
+ internal string value;
+ internal IntPtr encoding;
+ internal int format;
+ internal IntPtr nitems;
+ }
+
+ internal enum XWindowClass {
+ InputOutput = 1,
+ InputOnly = 2
+ }
+
+ internal enum XEventName {
+ KeyPress = 2,
+ KeyRelease = 3,
+ ButtonPress = 4,
+ ButtonRelease = 5,
+ MotionNotify = 6,
+ EnterNotify = 7,
+ LeaveNotify = 8,
+ FocusIn = 9,
+ FocusOut = 10,
+ KeymapNotify = 11,
+ Expose = 12,
+ GraphicsExpose = 13,
+ NoExpose = 14,
+ VisibilityNotify = 15,
+ CreateNotify = 16,
+ DestroyNotify = 17,
+ UnmapNotify = 18,
+ MapNotify = 19,
+ MapRequest = 20,
+ ReparentNotify = 21,
+ ConfigureNotify = 22,
+ ConfigureRequest = 23,
+ GravityNotify = 24,
+ ResizeRequest = 25,
+ CirculateNotify = 26,
+ CirculateRequest = 27,
+ PropertyNotify = 28,
+ SelectionClear = 29,
+ SelectionRequest = 30,
+ SelectionNotify = 31,
+ ColormapNotify = 32,
+ ClientMessage = 33,
+ MappingNotify = 34,
+ TimerNotify = 100,
+
+ LASTEvent
+ }
+
+ [Flags]
+ internal enum SetWindowValuemask {
+ Nothing = 0,
+ BackPixmap = 1,
+ BackPixel = 2,
+ BorderPixmap = 4,
+ BorderPixel = 8,
+ BitGravity = 16,
+ WinGravity = 32,
+ BackingStore = 64,
+ BackingPlanes = 128,
+ BackingPixel = 256,
+ OverrideRedirect = 512,
+ SaveUnder = 1024,
+ EventMask = 2048,
+ DontPropagate = 4096,
+ ColorMap = 8192,
+ Cursor = 16384
+ }
+
+ internal enum CreateWindowArgs {
+ CopyFromParent = 0,
+ ParentRelative = 1,
+ InputOutput = 1,
+ InputOnly = 2
+ }
+
+ internal enum Gravity {
+ ForgetGravity = 0,
+ NorthWestGravity= 1,
+ NorthGravity = 2,
+ NorthEastGravity= 3,
+ WestGravity = 4,
+ CenterGravity = 5,
+ EastGravity = 6,
+ SouthWestGravity= 7,
+ SouthGravity = 8,
+ SouthEastGravity= 9,
+ StaticGravity = 10
+ }
+
+ internal enum XKeySym {
+ XK_BackSpace = 0xFF08,
+ XK_Tab = 0xFF09,
+ XK_Clear = 0xFF0B,
+ XK_Return = 0xFF0D,
+ XK_Home = 0xFF50,
+ XK_Left = 0xFF51,
+ XK_Up = 0xFF52,
+ XK_Right = 0xFF53,
+ XK_Down = 0xFF54,
+ XK_Page_Up = 0xFF55,
+ XK_Page_Down = 0xFF56,
+ XK_End = 0xFF57,
+ XK_Begin = 0xFF58,
+ XK_Menu = 0xFF67,
+ XK_Shift_L = 0xFFE1,
+ XK_Shift_R = 0xFFE2,
+ XK_Control_L = 0xFFE3,
+ XK_Control_R = 0xFFE4,
+ XK_Caps_Lock = 0xFFE5,
+ XK_Shift_Lock = 0xFFE6,
+ XK_Meta_L = 0xFFE7,
+ XK_Meta_R = 0xFFE8,
+ XK_Alt_L = 0xFFE9,
+ XK_Alt_R = 0xFFEA,
+ XK_Super_L = 0xFFEB,
+ XK_Super_R = 0xFFEC,
+ XK_Hyper_L = 0xFFED,
+ XK_Hyper_R = 0xFFEE,
+ }
+
+ [Flags]
+ internal enum EventMask {
+ NoEventMask = 0,
+ KeyPressMask = 1<<0,
+ KeyReleaseMask = 1<<1,
+ ButtonPressMask = 1<<2,
+ ButtonReleaseMask = 1<<3,
+ EnterWindowMask = 1<<4,
+ LeaveWindowMask = 1<<5,
+ PointerMotionMask = 1<<6,
+ PointerMotionHintMask = 1<<7,
+ Button1MotionMask = 1<<8,
+ Button2MotionMask = 1<<9,
+ Button3MotionMask = 1<<10,
+ Button4MotionMask = 1<<11,
+ Button5MotionMask = 1<<12,
+ ButtonMotionMask = 1<<13,
+ KeymapStateMask = 1<<14,
+ ExposureMask = 1<<15,
+ VisibilityChangeMask = 1<<16,
+ StructureNotifyMask = 1<<17,
+ ResizeRedirectMask = 1<<18,
+ SubstructureNotifyMask = 1<<19,
+ SubstructureRedirectMask= 1<<20,
+ FocusChangeMask = 1<<21,
+ PropertyChangeMask = 1<<22,
+ ColormapChangeMask = 1<<23,
+ OwnerGrabButtonMask = 1<<24
+ }
+
+ internal enum GrabMode {
+ GrabModeSync = 0,
+ GrabModeAsync = 1
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XStandardColormap {
+ internal IntPtr colormap;
+ internal IntPtr red_max;
+ internal IntPtr red_mult;
+ internal IntPtr green_max;
+ internal IntPtr green_mult;
+ internal IntPtr blue_max;
+ internal IntPtr blue_mult;
+ internal IntPtr base_pixel;
+ internal IntPtr visualid;
+ internal IntPtr killid;
+ }
+
+ [StructLayout(LayoutKind.Sequential, Pack=2)]
+ internal struct XColor {
+ internal IntPtr pixel;
+ internal ushort red;
+ internal ushort green;
+ internal ushort blue;
+ internal byte flags;
+ internal byte pad;
+ }
+
+ internal enum Atom {
+ AnyPropertyType = 0,
+ XA_PRIMARY = 1,
+ XA_SECONDARY = 2,
+ XA_ARC = 3,
+ XA_ATOM = 4,
+ XA_BITMAP = 5,
+ XA_CARDINAL = 6,
+ XA_COLORMAP = 7,
+ XA_CURSOR = 8,
+ XA_CUT_BUFFER0 = 9,
+ XA_CUT_BUFFER1 = 10,
+ XA_CUT_BUFFER2 = 11,
+ XA_CUT_BUFFER3 = 12,
+ XA_CUT_BUFFER4 = 13,
+ XA_CUT_BUFFER5 = 14,
+ XA_CUT_BUFFER6 = 15,
+ XA_CUT_BUFFER7 = 16,
+ XA_DRAWABLE = 17,
+ XA_FONT = 18,
+ XA_INTEGER = 19,
+ XA_PIXMAP = 20,
+ XA_POINT = 21,
+ XA_RECTANGLE = 22,
+ XA_RESOURCE_MANAGER = 23,
+ XA_RGB_COLOR_MAP = 24,
+ XA_RGB_BEST_MAP = 25,
+ XA_RGB_BLUE_MAP = 26,
+ XA_RGB_DEFAULT_MAP = 27,
+ XA_RGB_GRAY_MAP = 28,
+ XA_RGB_GREEN_MAP = 29,
+ XA_RGB_RED_MAP = 30,
+ XA_STRING = 31,
+ XA_VISUALID = 32,
+ XA_WINDOW = 33,
+ XA_WM_COMMAND = 34,
+ XA_WM_HINTS = 35,
+ XA_WM_CLIENT_MACHINE = 36,
+ XA_WM_ICON_NAME = 37,
+ XA_WM_ICON_SIZE = 38,
+ XA_WM_NAME = 39,
+ XA_WM_NORMAL_HINTS = 40,
+ XA_WM_SIZE_HINTS = 41,
+ XA_WM_ZOOM_HINTS = 42,
+ XA_MIN_SPACE = 43,
+ XA_NORM_SPACE = 44,
+ XA_MAX_SPACE = 45,
+ XA_END_SPACE = 46,
+ XA_SUPERSCRIPT_X = 47,
+ XA_SUPERSCRIPT_Y = 48,
+ XA_SUBSCRIPT_X = 49,
+ XA_SUBSCRIPT_Y = 50,
+ XA_UNDERLINE_POSITION = 51,
+ XA_UNDERLINE_THICKNESS = 52,
+ XA_STRIKEOUT_ASCENT = 53,
+ XA_STRIKEOUT_DESCENT = 54,
+ XA_ITALIC_ANGLE = 55,
+ XA_X_HEIGHT = 56,
+ XA_QUAD_WIDTH = 57,
+ XA_WEIGHT = 58,
+ XA_POINT_SIZE = 59,
+ XA_RESOLUTION = 60,
+ XA_COPYRIGHT = 61,
+ XA_NOTICE = 62,
+ XA_FONT_NAME = 63,
+ XA_FAMILY_NAME = 64,
+ XA_FULL_NAME = 65,
+ XA_CAP_HEIGHT = 66,
+ XA_WM_CLASS = 67,
+ XA_WM_TRANSIENT_FOR = 68,
+
+ XA_LAST_PREDEFINED = 68
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XScreen {
+ internal IntPtr ext_data;
+ internal IntPtr display;
+ internal IntPtr root;
+ internal int width;
+ internal int height;
+ internal int mwidth;
+ internal int mheight;
+ internal int ndepths;
+ internal IntPtr depths;
+ internal int root_depth;
+ internal IntPtr root_visual;
+ internal IntPtr default_gc;
+ internal IntPtr cmap;
+ internal IntPtr white_pixel;
+ internal IntPtr black_pixel;
+ internal int max_maps;
+ internal int min_maps;
+ internal int backing_store;
+ internal bool save_unders;
+ internal IntPtr root_input_mask;
+ }
+
+ [Flags]
+ internal enum ChangeWindowFlags {
+ CWX = 1<<0,
+ CWY = 1<<1,
+ CWWidth = 1<<2,
+ CWHeight = 1<<3,
+ CWBorderWidth = 1<<4,
+ CWSibling = 1<<5,
+ CWStackMode = 1<<6
+ }
+
+ internal enum StackMode {
+ Above = 0,
+ Below = 1,
+ TopIf = 2,
+ BottomIf = 3,
+ Opposite = 4
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XWindowChanges {
+ internal int x;
+ internal int y;
+ internal int width;
+ internal int height;
+ internal int border_width;
+ internal IntPtr sibling;
+ internal StackMode stack_mode;
+ }
+
+ [Flags]
+ internal enum ColorFlags {
+ DoRed = 1<<0,
+ DoGreen = 1<<1,
+ DoBlue = 1<<2
+ }
+
+ internal enum NotifyMode {
+ NotifyNormal = 0,
+ NotifyGrab = 1,
+ NotifyUngrab = 2
+ }
+
+ internal enum NotifyDetail {
+ NotifyAncestor = 0,
+ NotifyVirtual = 1,
+ NotifyInferior = 2,
+ NotifyNonlinear = 3,
+ NotifyNonlinearVirtual = 4,
+ NotifyPointer = 5,
+ NotifyPointerRoot = 6,
+ NotifyDetailNone = 7
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct MotifWmHints {
+ internal IntPtr flags;
+ internal IntPtr functions;
+ internal IntPtr decorations;
+ internal IntPtr input_mode;
+ internal IntPtr status;
+ }
+
+ [Flags]
+ internal enum MotifFlags {
+ Functions = 1,
+ Decorations = 2,
+ InputMode = 4,
+ Status = 8
+ }
+
+ [Flags]
+ internal enum MotifFunctions {
+ All = 0x01,
+ Resize = 0x02,
+ Move = 0x04,
+ Minimize = 0x08,
+ Maximize = 0x10,
+ Close = 0x20
+ }
+
+ [Flags]
+ internal enum MotifDecorations {
+ All = 0x01,
+ Border = 0x02,
+ ResizeH = 0x04,
+ Title = 0x08,
+ Menu = 0x10,
+ Minimize = 0x20,
+ Maximize = 0x40,
+
+ }
+
+ [Flags]
+ internal enum MotifInputMode {
+ Modeless = 0,
+ ApplicationModal = 1,
+ SystemModal = 2,
+ FullApplicationMondal = 3
+ }
+
+ [Flags]
+ internal enum KeyMasks {
+ ShiftMask = (1 << 0),
+ LockMask = (1 << 1),
+ ControlMask = (1 << 2),
+ Mod1Mask = (1 << 3),
+ Mod2Mask = (1 << 4),
+ Mod3Mask = (1 << 5),
+ Mod4Mask = (1 << 6),
+ Mod5Mask = (1 << 7),
+
+ ModMasks = Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask
+ }
+
+ [StructLayout (LayoutKind.Sequential)]
+ internal struct XModifierKeymap {
+ public int max_keypermod;
+ public IntPtr modifiermap;
+ }
+
+ internal enum PropertyMode {
+ Replace = 0,
+ Prepend = 1,
+ Append = 2
+ }
+
+ [StructLayout (LayoutKind.Sequential)]
+ internal struct XKeyBoardState {
+ int key_click_percent;
+ int bell_percent;
+ uint bell_pitch, bell_duration;
+ IntPtr led_mask;
+ int global_auto_repeat;
+ AutoRepeats auto_repeats;
+
+ [StructLayout (LayoutKind.Explicit)]
+ struct AutoRepeats {
+ [FieldOffset (0)]
+ byte first;
+
+ [FieldOffset (31)]
+ byte last;
+ }
+ }
+
+ [Flags]
+ internal enum GCFunction {
+ GCFunction = 1<<0,
+ GCPlaneMask = 1<<1,
+ GCForeground = 1<<2,
+ GCBackground = 1<<3,
+ GCLineWidth = 1<<4,
+ GCLineStyle = 1<<5,
+ GCCapStyle = 1<<6,
+ GCJoinStyle = 1<<7,
+ GCFillStyle = 1<<8,
+ GCFillRule = 1<<9,
+ GCTile = 1<<10,
+ GCStipple = 1<<11,
+ GCTileStipXOrigin = 1<<12,
+ GCTileStipYOrigin = 1<<13,
+ GCFont = 1<<14,
+ GCSubwindowMode = 1<<15,
+ GCGraphicsExposures = 1<<16,
+ GCClipXOrigin = 1<<17,
+ GCClipYOrigin = 1<<18,
+ GCClipMask = 1<<19,
+ GCDashOffset = 1<<20,
+ GCDashList = 1<<21,
+ GCArcMode = 1<<22
+ }
+
+ internal enum GCJoinStyle {
+ JoinMiter = 0,
+ JoinRound = 1,
+ JoinBevel = 2
+ }
+
+ internal enum GCLineStyle {
+ LineSolid = 0,
+ LineOnOffDash = 1,
+ LineDoubleDash = 2
+ }
+
+ internal enum GCCapStyle {
+ CapNotLast = 0,
+ CapButt = 1,
+ CapRound = 2,
+ CapProjecting = 3
+ }
+
+ internal enum GCFillStyle {
+ FillSolid = 0,
+ FillTiled = 1,
+ FillStippled = 2,
+ FillOpaqueStppled = 3
+ }
+
+ internal enum GCFillRule {
+ EvenOddRule = 0,
+ WindingRule = 1
+ }
+
+ internal enum GCArcMode {
+ ArcChord = 0,
+ ArcPieSlice = 1
+ }
+
+ internal enum GCSubwindowMode {
+ ClipByChildren = 0,
+ IncludeInferiors = 1
+ }
+
+ [StructLayout (LayoutKind.Sequential)]
+ internal struct XGCValues {
+ internal GXFunction function;
+ internal IntPtr plane_mask;
+ internal IntPtr foreground;
+ internal IntPtr background;
+ internal int line_width;
+ internal GCLineStyle line_style;
+ internal GCCapStyle cap_style;
+ internal GCJoinStyle join_style;
+ internal GCFillStyle fill_style;
+ internal GCFillRule fill_rule;
+ internal GCArcMode arc_mode;
+ internal IntPtr tile;
+ internal IntPtr stipple;
+ internal int ts_x_origin;
+ internal int ts_y_origin;
+ internal IntPtr font;
+ internal GCSubwindowMode subwindow_mode;
+ internal bool graphics_exposures;
+ internal int clip_x_origin;
+ internal int clib_y_origin;
+ internal IntPtr clip_mask;
+ internal int dash_offset;
+ internal byte dashes;
+ }
+
+ internal enum GXFunction {
+ GXclear = 0x0, /* 0 */
+ GXand = 0x1, /* src AND dst */
+ GXandReverse = 0x2, /* src AND NOT dst */
+ GXcopy = 0x3, /* src */
+ GXandInverted = 0x4, /* NOT src AND dst */
+ GXnoop = 0x5, /* dst */
+ GXxor = 0x6, /* src XOR dst */
+ GXor = 0x7, /* src OR dst */
+ GXnor = 0x8, /* NOT src AND NOT dst */
+ GXequiv = 0x9, /* NOT src XOR dst */
+ GXinvert = 0xa, /* NOT dst */
+ GXorReverse = 0xb, /* src OR NOT dst */
+ GXcopyInverted = 0xc, /* NOT src */
+ GXorInverted = 0xd, /* NOT src OR dst */
+ GXnand = 0xe, /* NOT src OR NOT dst */
+ GXset = 0xf /* 1 */
+ }
+
+ internal enum NetWindowManagerState {
+ Remove = 0,
+ Add = 1,
+ Toggle = 2
+ }
+
+ internal enum RevertTo {
+ None = 0,
+ PointerRoot = 1,
+ Parent = 2
+ }
+
+ internal enum MapState {
+ IsUnmapped = 0,
+ IsUnviewable = 1,
+ IsViewable = 2
+ }
+
+ internal enum CursorFontShape {
+ XC_X_cursor = 0,
+ XC_arrow = 2,
+ XC_based_arrow_down = 4,
+ XC_based_arrow_up = 6,
+ XC_boat = 8,
+ XC_bogosity = 10,
+ XC_bottom_left_corner = 12,
+ XC_bottom_right_corner = 14,
+ XC_bottom_side = 16,
+ XC_bottom_tee = 18,
+ XC_box_spiral = 20,
+ XC_center_ptr = 22,
+
+ XC_circle = 24,
+ XC_clock = 26,
+ XC_coffee_mug = 28,
+ XC_cross = 30,
+ XC_cross_reverse = 32,
+ XC_crosshair = 34,
+ XC_diamond_cross = 36,
+ XC_dot = 38,
+ XC_dotbox = 40,
+ XC_double_arrow = 42,
+ XC_draft_large = 44,
+ XC_draft_small = 46,
+
+ XC_draped_box = 48,
+ XC_exchange = 50,
+ XC_fleur = 52,
+ XC_gobbler = 54,
+ XC_gumby = 56,
+ XC_hand1 = 58,
+ XC_hand2 = 60,
+ XC_heart = 62,
+ XC_icon = 64,
+ XC_iron_cross = 66,
+ XC_left_ptr = 68,
+ XC_left_side = 70,
+
+ XC_left_tee = 72,
+ XC_left_button = 74,
+ XC_ll_angle = 76,
+ XC_lr_angle = 78,
+ XC_man = 80,
+ XC_middlebutton = 82,
+ XC_mouse = 84,
+ XC_pencil = 86,
+ XC_pirate = 88,
+ XC_plus = 90,
+ XC_question_arrow = 92,
+ XC_right_ptr = 94,
+
+ XC_right_side = 96,
+ XC_right_tee = 98,
+ XC_rightbutton = 100,
+ XC_rtl_logo = 102,
+ XC_sailboat = 104,
+ XC_sb_down_arrow = 106,
+ XC_sb_h_double_arrow = 108,
+ XC_sb_left_arrow = 110,
+ XC_sb_right_arrow = 112,
+ XC_sb_up_arrow = 114,
+ XC_sb_v_double_arrow = 116,
+ XC_sb_shuttle = 118,
+
+ XC_sizing = 120,
+ XC_spider = 122,
+ XC_spraycan = 124,
+ XC_star = 126,
+ XC_target = 128,
+ XC_tcross = 130,
+ XC_top_left_arrow = 132,
+ XC_top_left_corner = 134,
+ XC_top_right_corner = 136,
+ XC_top_side = 138,
+ XC_top_tee = 140,
+ XC_trek = 142,
+
+ XC_ul_angle = 144,
+ XC_umbrella = 146,
+ XC_ur_angle = 148,
+ XC_watch = 150,
+ XC_xterm = 152,
+ XC_num_glyphs = 154
+ }
+
+ internal enum SystrayRequest {
+ SYSTEM_TRAY_REQUEST_DOCK = 0,
+ SYSTEM_TRAY_BEGIN_MESSAGE = 1,
+ SYSTEM_TRAY_CANCEL_MESSAGE = 2
+ }
+
+ [Flags]
+ internal enum XSizeHintsFlags {
+ USPosition = (1 << 0),
+ USSize = (1 << 1),
+ PPosition = (1 << 2),
+ PSize = (1 << 3),
+ PMinSize = (1 << 4),
+ PMaxSize = (1 << 5),
+ PResizeInc = (1 << 6),
+ PAspect = (1 << 7),
+ PAllHints = (PPosition | PSize | PMinSize | PMaxSize | PResizeInc | PAspect),
+ PBaseSize = (1 << 8),
+ PWinGravity = (1 << 9),
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XSizeHints {
+ internal IntPtr flags;
+ internal int x;
+ internal int y;
+ internal int width;
+ internal int height;
+ internal int min_width;
+ internal int min_height;
+ internal int max_width;
+ internal int max_height;
+ internal int width_inc;
+ internal int height_inc;
+ internal int min_aspect_x;
+ internal int min_aspect_y;
+ internal int max_aspect_x;
+ internal int max_aspect_y;
+ internal int base_width;
+ internal int base_height;
+ internal int win_gravity;
+ }
+
+ [Flags]
+ internal enum XWMHintsFlags {
+ InputHint = (1 << 0),
+ StateHint = (1 << 1),
+ IconPixmapHint = (1 << 2),
+ IconWindowHint = (1 << 3),
+ IconPositionHint = (1 << 4),
+ IconMaskHint = (1 << 5),
+ WindowGroupHint = (1 << 6),
+ AllHints = (InputHint | StateHint | IconPixmapHint | IconWindowHint | IconPositionHint | IconMaskHint | WindowGroupHint)
+ }
+
+ internal enum XInitialState {
+ DontCareState = 0,
+ NormalState = 1,
+ ZoomState = 2,
+ IconicState = 3,
+ InactiveState = 4
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XWMHints {
+ internal IntPtr flags;
+ internal bool input;
+ internal XInitialState initial_state;
+ internal IntPtr icon_pixmap;
+ internal IntPtr icon_window;
+ internal int icon_x;
+ internal int icon_y;
+ internal IntPtr icon_mask;
+ internal IntPtr window_group;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct XIconSize {
+ internal int min_width;
+ internal int min_height;
+ internal int max_width;
+ internal int max_height;
+ internal int width_inc;
+ internal int height_inc;
+ }
+
+ internal enum NA {
+ WM_PROTOCOLS,
+ WM_DELETE_WINDOW,
+ WM_TAKE_FOCUS,
+
+ _NET_SUPPORTED,
+ _NET_CLIENT_LIST,
+ _NET_NUMBER_OF_DESKTOPS,
+ _NET_DESKTOP_GEOMETRY,
+ _NET_DESKTOP_VIEWPORT,
+ _NET_CURRENT_DESKTOP,
+ _NET_DESKTOP_NAMES,
+ _NET_ACTIVE_WINDOW,
+ _NET_WORKAREA,
+ _NET_SUPPORTING_WM_CHECK,
+ _NET_VIRTUAL_ROOTS,
+ _NET_DESKTOP_LAYOUT,
+ _NET_SHOWING_DESKTOP,
+
+ _NET_CLOSE_WINDOW,
+ _NET_MOVERESIZE_WINDOW,
+ _NET_WM_MOVERESIZE,
+ _NET_RESTACK_WINDOW,
+ _NET_REQUEST_FRAME_EXTENTS,
+
+ _NET_WM_NAME,
+ _NET_WM_VISIBLE_NAME,
+ _NET_WM_ICON_NAME,
+ _NET_WM_VISIBLE_ICON_NAME,
+ _NET_WM_DESKTOP,
+ _NET_WM_WINDOW_TYPE,
+ _NET_WM_STATE,
+ _NET_WM_ALLOWED_ACTIONS,
+ _NET_WM_STRUT,
+ _NET_WM_STRUT_PARTIAL,
+ _NET_WM_ICON_GEOMETRY,
+ _NET_WM_ICON,
+ _NET_WM_PID,
+ _NET_WM_HANDLED_ICONS,
+ _NET_WM_USER_TIME,
+ _NET_FRAME_EXTENTS,
+
+ _NET_WM_PING,
+ _NET_WM_SYNC_REQUEST,
+
+ _NET_SYSTEM_TRAY_S,
+ _NET_SYSTEM_TRAY_ORIENTATION,
+ _NET_SYSTEM_TRAY_OPCODE,
+
+ _NET_WM_STATE_MAXIMIZED_HORZ,
+ _NET_WM_STATE_MAXIMIZED_VERT,
+
+ _XEMBED,
+ _XEMBED_INFO,
+
+ _MOTIF_WM_HINTS,
+
+ _NET_WM_STATE_NO_TASKBAR,
+ _NET_WM_STATE_ABOVE,
+ _NET_WM_STATE_MODAL,
+ _NET_WM_CONTEXT_HELP,
+
+ _NET_WM_WINDOW_OPACITY,
+
+ CLIPBOARD,
+ DIB,
+ OEMTEXT,
+ UNICODETEXT,
+ TARGETS,
+
+ LAST_NET_ATOM
+ }
+
+ internal struct CaretStruct {
+ internal Timer Timer; // Blink interval
+ internal IntPtr Hwnd; // Window owning the caret
+ internal IntPtr Window; // Actual X11 handle of the window
+ internal int X; // X position of the caret
+ internal int Y; // Y position of the caret
+ internal int Width; // Width of the caret; if no image used
+ internal int Height; // Height of the caret, if no image used
+ internal int Visible; // Counter for visible/hidden
+ internal bool On; // Caret blink display state: On/Off
+ internal IntPtr gc; // Graphics context
+ internal bool Paused; // Don't update right now
+ }
+
+ internal struct HoverStruct {
+ internal Timer Timer; // for hovering
+ internal IntPtr Window; // Last window we entered; used to generate WM_MOUSEHOVER (handle is X11 handle)
+ internal int X; // Last MouseMove X coordinate; used to generate WM_MOUSEHOVER
+ internal int Y; // Last MouseMove Y coordinate; used to generate WM_MOUSEHOVER
+ internal int Interval; // in milliseconds, how long to hold before hover is generated
+ internal int Atom; // X Atom
+ }
+
+ internal struct ClickStruct {
+ internal IntPtr Hwnd; //
+ internal Msg Message; //
+ internal IntPtr wParam; //
+ internal IntPtr lParam; //
+ internal long Time; // Last time we received a mouse click
+ internal bool Pending; // True if we haven't sent the last mouse click
+ }
+
+ internal struct GrabStruct {
+ internal bool Confined; // Is the current grab (if any) confined to grab_area?
+ internal IntPtr Hwnd; // The window that is grabbed
+ internal Rectangle Area; // The area the current grab is confined to
+ }
+
+ internal struct ClipboardStruct {
+ internal object Item; // Object on the clipboard
+ internal object Type; // Type if object on the clipboard
+ internal ArrayList Formats; // list of formats available in the clipboard
+ internal bool Retrieving; // true if we are requesting an item
+ internal bool Enumerating; // true if we are enumerating through all known types
+ internal XplatUI.ObjectToClipboard Converter;
+ }
+
+ internal delegate int XErrorHandler(IntPtr DisplayHandle, ref XErrorEvent error_event);
+
+ internal enum XRequest : byte {
+ X_CreateWindow = 1,
+ X_ChangeWindowAttributes = 2,
+ X_GetWindowAttributes = 3,
+ X_DestroyWindow = 4,
+ X_DestroySubwindows = 5,
+ X_ChangeSaveSet = 6,
+ X_ReparentWindow = 7,
+ X_MapWindow = 8,
+ X_MapSubwindows = 9,
+ X_UnmapWindow = 10,
+ X_UnmapSubwindows = 11,
+ X_ConfigureWindow = 12,
+ X_CirculateWindow = 13,
+ X_GetGeometry = 14,
+ X_QueryTree = 15,
+ X_InternAtom = 16,
+ X_GetAtomName = 17,
+ X_ChangeProperty = 18,
+ X_DeleteProperty = 19,
+ X_GetProperty = 20,
+ X_ListProperties = 21,
+ X_SetSelectionOwner = 22,
+ X_GetSelectionOwner = 23,
+ X_ConvertSelection = 24,
+ X_SendEvent = 25,
+ X_GrabPointer = 26,
+ X_UngrabPointer = 27,
+ X_GrabButton = 28,
+ X_UngrabButton = 29,
+ X_ChangeActivePointerGrab = 30,
+ X_GrabKeyboard = 31,
+ X_UngrabKeyboard = 32,
+ X_GrabKey = 33,
+ X_UngrabKey = 34,
+ X_AllowEvents = 35,
+ X_GrabServer = 36,
+ X_UngrabServer = 37,
+ X_QueryPointer = 38,
+ X_GetMotionEvents = 39,
+ X_TranslateCoords = 40,
+ X_WarpPointer = 41,
+ X_SetInputFocus = 42,
+ X_GetInputFocus = 43,
+ X_QueryKeymap = 44,
+ X_OpenFont = 45,
+ X_CloseFont = 46,
+ X_QueryFont = 47,
+ X_QueryTextExtents = 48,
+ X_ListFonts = 49,
+ X_ListFontsWithInfo = 50,
+ X_SetFontPath = 51,
+ X_GetFontPath = 52,
+ X_CreatePixmap = 53,
+ X_FreePixmap = 54,
+ X_CreateGC = 55,
+ X_ChangeGC = 56,
+ X_CopyGC = 57,
+ X_SetDashes = 58,
+ X_SetClipRectangles = 59,
+ X_FreeGC = 60,
+ X_ClearArea = 61,
+ X_CopyArea = 62,
+ X_CopyPlane = 63,
+ X_PolyPoint = 64,
+ X_PolyLine = 65,
+ X_PolySegment = 66,
+ X_PolyRectangle = 67,
+ X_PolyArc = 68,
+ X_FillPoly = 69,
+ X_PolyFillRectangle = 70,
+ X_PolyFillArc = 71,
+ X_PutImage = 72,
+ X_GetImage = 73,
+ X_PolyText8 = 74,
+ X_PolyText16 = 75,
+ X_ImageText8 = 76,
+ X_ImageText16 = 77,
+ X_CreateColormap = 78,
+ X_FreeColormap = 79,
+ X_CopyColormapAndFree = 80,
+ X_InstallColormap = 81,
+ X_UninstallColormap = 82,
+ X_ListInstalledColormaps = 83,
+ X_AllocColor = 84,
+ X_AllocNamedColor = 85,
+ X_AllocColorCells = 86,
+ X_AllocColorPlanes = 87,
+ X_FreeColors = 88,
+ X_StoreColors = 89,
+ X_StoreNamedColor = 90,
+ X_QueryColors = 91,
+ X_LookupColor = 92,
+ X_CreateCursor = 93,
+ X_CreateGlyphCursor = 94,
+ X_FreeCursor = 95,
+ X_RecolorCursor = 96,
+ X_QueryBestSize = 97,
+ X_QueryExtension = 98,
+ X_ListExtensions = 99,
+ X_ChangeKeyboardMapping = 100,
+ X_GetKeyboardMapping = 101,
+ X_ChangeKeyboardControl = 102,
+ X_GetKeyboardControl = 103,
+ X_Bell = 104,
+ X_ChangePointerControl = 105,
+ X_GetPointerControl = 106,
+ X_SetScreenSaver = 107,
+ X_GetScreenSaver = 108,
+ X_ChangeHosts = 109,
+ X_ListHosts = 110,
+ X_SetAccessControl = 111,
+ X_SetCloseDownMode = 112,
+ X_KillClient = 113,
+ X_RotateProperties = 114,
+ X_ForceScreenSaver = 115,
+ X_SetPointerMapping = 116,
+ X_GetPointerMapping = 117,
+ X_SetModifierMapping = 118,
+ X_GetModifierMapping = 119,
+ X_NoOperation = 127
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XEventQueue.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XEventQueue.cs
new file mode 100644
index 00000000000..313bafd8b05
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XEventQueue.cs
@@ -0,0 +1,109 @@
+//
+// System.Windows.Forms.XEventQueue
+//
+// Author(s):
+// Jackson Harper (jackson@ximian.com)
+//
+// Copyright (C) Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using System.Threading;
+using System.Collections;
+
+
+namespace System.Windows.Forms {
+
+ internal class XEventQueue {
+
+ private XQueue xqueue;
+ private XQueue lqueue; // Events inserted from threads other then the main X thread
+
+ private static readonly int InitialXEventSize = 100;
+ private static readonly int InitialLXEventSize = 10;
+
+ public XEventQueue ()
+ {
+ xqueue = new XQueue (InitialXEventSize);
+ lqueue = new XQueue (InitialLXEventSize);
+ }
+
+ public int Count {
+ get {
+ lock (lqueue) {
+ return xqueue.Count + lqueue.Count;
+ }
+ }
+ }
+
+ public void Enqueue (XEvent xevent)
+ {
+ xqueue.Enqueue (xevent);
+ }
+
+ public void EnqueueLocked (XEvent xevent)
+ {
+ lock (lqueue) {
+ lqueue.Enqueue (xevent);
+ }
+ }
+
+ public XEvent Dequeue ()
+ {
+ if (xqueue.Count == 0) {
+ lock (lqueue) {
+ return lqueue.Dequeue ();
+ }
+ }
+ return xqueue.Dequeue ();
+ }
+
+ private class XQueue {
+
+ private XEvent [] xevents;
+ private int head;
+ private int tail;
+ private int size;
+
+ public XQueue (int size)
+ {
+ xevents = new XEvent [size];
+ }
+
+ public int Count {
+ get { return size; }
+ }
+
+ public void Enqueue (XEvent xevent)
+ {
+ if (size == xevents.Length)
+ Grow ();
+
+ xevents [tail] = xevent;
+ tail = (tail + 1) % xevents.Length;
+ size++;
+ }
+
+ public XEvent Dequeue ()
+ {
+ if (size < 1)
+ throw new Exception ("Attempt to dequeue empty queue.");
+ XEvent res = xevents [head];
+ head = (head + 1) % xevents.Length;
+ size--;
+ return res;
+ }
+
+ private void Grow ()
+ {
+ int newcap = (xevents.Length * 2);
+ XEvent [] na = new XEvent [newcap];
+ xevents.CopyTo (na, 0);
+ xevents = na;
+ head = 0;
+ tail = head + size;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs
new file mode 100644
index 00000000000..8b6ae7e18ed
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs
@@ -0,0 +1,874 @@
+// 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.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+
+// NOT COMPLETE
+
+// define to log API calls to stdout
+#undef DriverDebug
+#undef DriverDebugPaint
+#undef DriverDebugCreate
+#undef DriverDebugDestroy
+#undef DriverDebugState
+
+using System;
+using System.Drawing;
+using System.ComponentModel;
+using System.Collections;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+using System.Threading;
+
+/// X11 Version
+namespace System.Windows.Forms {
+ internal class XplatUI {
+ #region Local Variables
+ static XplatUIDriver driver;
+ static String default_class_name;
+ #endregion // Local Variables
+
+ #region Private Methods
+ internal static string Window(IntPtr handle) {
+ return String.Format("'{0}' ({1:X})", Control.FromHandle(handle), handle.ToInt32());
+ }
+ #endregion // Private Methods
+
+ #region Subclasses
+ public class State {
+ static public Keys ModifierKeys {
+ get {
+ return driver.ModifierKeys;
+ }
+ }
+
+ static public MouseButtons MouseButtons {
+ get {
+ return driver.MouseButtons;
+ }
+ }
+
+ static public Point MousePosition {
+ get {
+ return driver.MousePosition;
+ }
+ }
+
+ }
+ #endregion // Subclasses
+
+ #region Constructor & Destructor
+ static XplatUI() {
+ Console.WriteLine("Mono System.Windows.Forms Assembly [Revision: 54007; built: 2005/12/6 14:35:24]");
+
+ // Don't forget to throw the mac in here somewhere, too
+ default_class_name="SWFClass";
+
+ // check for Unix platforms - see FAQ for more details
+ // http://www.mono-project.com/FAQ:_Technical#How_to_detect_the_execution_platform_.3F
+ int platform = (int) Environment.OSVersion.Platform;
+ if ((platform == 4) || (platform == 128)) {
+ if (Environment.GetEnvironmentVariable ("MONO_MWF_USE_QUARTZ_BACKEND") != null)
+ driver=XplatUIOSX.GetInstance();
+ else
+ driver=XplatUIX11.GetInstance();
+ } else {
+ driver=XplatUIWin32.GetInstance();
+ }
+
+ driver.InitializeDriver();
+
+ // Initialize things that need to be done after the driver is ready
+ DataFormats.GetFormat(0);
+ }
+ #endregion // Constructor & Destructor
+
+ #region Public Static Properties
+ internal static string DefaultClassName {
+ get {
+ return default_class_name;
+ }
+
+ set {
+ default_class_name=value;
+ }
+ }
+
+ static public int CaptionHeight {
+ get {
+ return driver.Caption;
+ }
+ }
+
+ static public Size CursorSize {
+ get {
+ return driver.CursorSize;
+ }
+ }
+
+ static public bool DragFullWindows {
+ get {
+ return driver.DragFullWindows;
+ }
+ }
+
+ static public Size DragSize {
+ get {
+ return driver.DragSize;
+ }
+ }
+
+ public static Size FrameBorderSize {
+ get {
+ return driver.FrameBorderSize;
+ }
+ }
+
+ static public Size IconSize {
+ get {
+ return driver.IconSize;
+ }
+ }
+
+ static public int KeyboardSpeed {
+ get {
+ return driver.KeyboardSpeed;
+ }
+ }
+
+ static public int KeyboardDelay {
+ get {
+ return driver.KeyboardSpeed;
+ }
+ }
+
+ static public Size MaxWindowTrackSize {
+ get {
+ return driver.MaxWindowTrackSize;
+ }
+ }
+
+ static public Size MinimizedWindowSize {
+ get {
+ return driver.MinimizedWindowSize;
+ }
+ }
+
+ static public Size MinimizedWindowSpacingSize {
+ get {
+ return driver.MinimizedWindowSpacingSize;
+ }
+ }
+
+ static public Size MinimumWindowSize {
+ get {
+ return driver.MinimumWindowSize;
+ }
+ }
+
+ static public Size MinWindowTrackSize {
+ get {
+ return driver.MinWindowTrackSize;
+ }
+ }
+
+ static public Size SmallIconSize {
+ get {
+ return driver.SmallIconSize;
+ }
+ }
+
+ static public int MouseButtonCount {
+ get {
+ return driver.MouseButtonCount;
+ }
+ }
+
+ static public bool MouseButtonsSwapped {
+ get {
+ return driver.MouseButtonsSwapped;
+ }
+ }
+
+ static public bool MouseWheelPresent {
+ get {
+ return driver.MouseWheelPresent;
+ }
+ }
+
+ static public Rectangle VirtualScreen {
+ get {
+ return driver.VirtualScreen;
+ }
+ }
+
+ static public Rectangle WorkingArea {
+ get {
+ return driver.WorkingArea;
+ }
+ }
+ #endregion // Public Static Properties
+
+ #region Events
+ internal static event EventHandler Idle {
+ add {
+ driver.Idle += value;
+ }
+ remove {
+ driver.Idle -= value;
+ }
+ }
+
+ #endregion // Events
+
+ #region Public Static Methods
+ internal static void Activate(IntPtr handle) {
+ #if DriverDebug
+ Console.WriteLine("Activate({0}): Called", Window(handle));
+ #endif
+ driver.Activate(handle);
+ }
+
+ internal static void AudibleAlert() {
+ #if DriverDebug
+ Console.WriteLine("AudibleAlert(): Called");
+ #endif
+ driver.AudibleAlert();
+ }
+
+ internal static bool CalculateWindowRect(IntPtr handle, ref Rectangle ClientRect, int Style, int ExStyle, Menu menu, out Rectangle WindowRect) {
+ #if DriverDebug
+ Console.WriteLine("CalculateWindowRect({0}): Called", Window(handle));
+ #endif
+ return driver.CalculateWindowRect(handle, ref ClientRect, Style, ExStyle, menu, out WindowRect);
+ }
+
+ internal static void CaretVisible(IntPtr handle, bool visible) {
+ #if DriverDebug
+ Console.WriteLine("CaretVisible({0:X}, {1}): Called", handle.ToInt32(), visible);
+ #endif
+ driver.CaretVisible(handle, visible);
+ }
+
+ internal static void CreateCaret(IntPtr handle, int width, int height) {
+ #if DriverDebug
+ Console.WriteLine("CreateCaret({0:X}), {1}, {2}: Called", handle.ToInt32(), width, height);
+ #endif
+ driver.CreateCaret(handle, width, height);
+ }
+
+ internal static IntPtr CreateWindow(CreateParams cp) {
+ #if DriverDebug || DriverDebugCreate
+ Console.WriteLine("CreateWindow(): Called");
+ #endif
+ return driver.CreateWindow(cp);
+ }
+
+ internal static IntPtr CreateWindow(IntPtr Parent, int X, int Y, int Width, int Height) {
+ #if DriverDebug || DriverDebugCreate
+ Console.WriteLine("CreateWindow(): Called");
+ #endif
+ return driver.CreateWindow(Parent, X, Y, Width, Height);
+ }
+
+ internal static void ClientToScreen(IntPtr handle, ref int x, ref int y) {
+ #if DriverDebug
+ Console.WriteLine("ClientToScreen({0}, {1}, {2}): Called", Window(handle), x, y);
+ #endif
+ driver.ClientToScreen(handle, ref x, ref y);
+ }
+
+ internal static int[] ClipboardAvailableFormats(IntPtr handle) {
+ #if DriverDebug
+ Console.WriteLine("ClipboardAvailableTypes({0:X}): Called", handle.ToInt32());
+ #endif
+ return driver.ClipboardAvailableFormats(handle);
+ }
+
+ internal static void ClipboardClose(IntPtr handle) {
+ #if DriverDebug
+ Console.WriteLine("ClipboardClose({0:X}): Called", handle.ToInt32());
+ #endif
+ driver.ClipboardClose(handle);
+ }
+
+ internal static int ClipboardGetID(IntPtr handle, string format) {
+ #if DriverDebug
+ Console.WriteLine("ClipboardGetID({0:X}, {1}): Called", handle.ToInt32(), format);
+ #endif
+ return driver.ClipboardGetID(handle, format);
+ }
+
+ internal static IntPtr ClipboardOpen() {
+ #if DriverDebug
+ Console.WriteLine("ClipboardOpen(): Called");
+ #endif
+ return driver.ClipboardOpen();
+ }
+
+ internal static void ClipboardStore(IntPtr handle, object obj, int type, XplatUI.ObjectToClipboard converter) {
+ #if DriverDebug
+ Console.WriteLine("ClipboardStore({0:X}, {1}, {2}): Called", handle.ToInt32(), obj, type, converter);
+ #endif
+ driver.ClipboardStore(handle, obj, type, converter);
+ }
+
+ internal static object ClipboardRetrieve(IntPtr handle, int type, XplatUI.ClipboardToObject converter) {
+ #if DriverDebug
+ Console.WriteLine("ClipboardRetrieve({0:X}, type, {1}): Called", handle.ToInt32(), converter);
+ #endif
+ return driver.ClipboardRetrieve(handle, type, converter);
+ }
+
+ internal static IntPtr DefineCursor(Bitmap bitmap, Bitmap mask, Color cursor_pixel, Color mask_pixel, int xHotSpot, int yHotSpot) {
+ #if DriverDebug
+ Console.WriteLine("DefineCursor(...): Called");
+ #endif
+ return driver.DefineCursor(bitmap, mask, cursor_pixel, mask_pixel, xHotSpot, yHotSpot);
+ }
+
+ internal static IntPtr DefineStdCursor(StdCursor id) {
+ return driver.DefineStdCursor(id);
+ }
+
+ internal static IntPtr DefWndProc(ref Message msg) {
+ return driver.DefWndProc(ref msg);
+ }
+
+ internal static void DestroyCaret(IntPtr handle) {
+ #if DriverDebug
+ Console.WriteLine("DestroyCaret({0:X}): Called", handle.ToInt32());
+ #endif
+ driver.DestroyCaret(handle);
+ }
+
+ internal static void DestroyCursor(IntPtr cursor) {
+ #if DriverDebug
+ Console.WriteLine("DestroyCursor({0:X}): Called", cursor.ToInt32());
+ #endif
+ driver.DestroyCursor(cursor);
+ }
+
+ internal static void DestroyWindow(IntPtr handle) {
+ #if DriverDebug || DriverDebugDestroy
+ Console.WriteLine("DestroyWindow({0}): Called", Window(handle));
+ #endif
+ driver.DestroyWindow(handle);
+ }
+
+ internal static IntPtr DispatchMessage(ref MSG msg) {
+ return driver.DispatchMessage(ref msg);
+ }
+
+ internal static void DoEvents() {
+ driver.DoEvents();
+ }
+
+ internal static void DrawReversibleRectangle(IntPtr handle, Rectangle rect, int line_width) {
+ #if DriverDebug
+ Console.WriteLine("DrawReversibleRectangle({0}, {1}, {2}): Called", Window(handle), rect, line_width);
+ #endif
+ driver.DrawReversibleRectangle(handle, rect, line_width);
+ }
+
+ internal static void EnableThemes() {
+ driver.EnableThemes();
+ }
+
+ internal static void EnableWindow(IntPtr handle, bool Enable) {
+ #if DriverDebug || DriverDebugState
+ Console.WriteLine("EnableWindow({0}, {1}): Called", Window(handle), Enable);
+ #endif
+ driver.EnableWindow(handle, Enable);
+ }
+
+ internal static void EndLoop(Thread thread) {
+ #if DriverDebug
+ Console.WriteLine("EndLoop({0:X}): Called", thread.GetHashCode());
+ #endif
+ driver.EndLoop(thread);
+ }
+
+ internal static IntPtr GetActive() {
+ #if DriverDebug
+ Console.WriteLine("GetActive(): Called");
+ #endif
+ return driver.GetActive();
+ }
+
+ internal static SizeF GetAutoScaleSize(Font font) {
+ #if DriverDebug
+ Console.WriteLine("GetAutoScaleSize({0}): Called", font);
+ #endif
+ return driver.GetAutoScaleSize(font);
+ }
+
+ internal static void GetCursorInfo(IntPtr cursor, out int width, out int height, out int hotspot_x, out int hotspot_y) {
+ #if DriverDebug
+ Console.WriteLine("GetCursorInfo({0}): Called", cursor.ToInt32());
+ #endif
+ driver.GetCursorInfo(cursor, out width, out height, out hotspot_x, out hotspot_y);
+ }
+
+ internal static void GetCursorPos(IntPtr handle, out int x, out int y) {
+ #if DriverDebug
+ Console.WriteLine("GetCursorPos({0}): Called", Window(handle));
+ #endif
+ driver.GetCursorPos(handle, out x, out y);
+ }
+
+ internal static void GetDisplaySize(out Size size) {
+ #if DriverDebug
+ Console.WriteLine("GetDisplaySize(): Called");
+ #endif
+ driver.GetDisplaySize(out size);
+ }
+
+ internal static bool GetFontMetrics(Graphics g, Font font, out int ascent, out int descent) {
+ #if DriverDebug
+ Console.WriteLine("GetFontMetrics(): Called");
+ #endif
+ return driver.GetFontMetrics(g, font, out ascent, out descent);
+ }
+
+ internal static Graphics GetMenuDC(IntPtr handle, IntPtr ncpaint_region) {
+ #if DriverDebug
+ Console.WriteLine("GetMenuDC({0}): Called", Window(handle));
+ #endif
+ return driver.GetMenuDC(handle, ncpaint_region);
+ }
+
+ internal static Point GetMenuOrigin(IntPtr handle) {
+ #if DriverDebug
+ Console.WriteLine("GetMenuOrigin({0}): Called", Window(handle));
+ #endif
+ return driver.GetMenuOrigin(handle);
+ }
+
+ internal static bool GetMessage(ref MSG msg, IntPtr hWnd, int wFilterMin, int wFilterMax) {
+ return driver.GetMessage(ref msg, hWnd, wFilterMin, wFilterMax);
+ }
+
+ internal static IntPtr GetParent(IntPtr handle) {
+ #if DriverDebug
+ Console.WriteLine("GetParent({0}): Called", Window(handle));
+ #endif
+ return driver.GetParent(handle);
+ }
+
+ internal static bool GetText(IntPtr handle, out string text) {
+ #if DriverDebug
+ Console.WriteLine("GetText({0}): Called", Window(handle));
+ #endif
+ return driver.GetText(handle, out text);
+ }
+
+ internal static void GetWindowPos(IntPtr handle, bool is_toplevel, out int x, out int y, out int width, out int height, out int client_width, out int client_height) {
+ #if DriverDebug
+ Console.WriteLine("GetWindowPos({0}): Called", Window(handle));
+ #endif
+ driver.GetWindowPos(handle, is_toplevel, out x, out y, out width, out height, out client_width, out client_height);
+ }
+
+ internal static FormWindowState GetWindowState(IntPtr handle) {
+ #if DriverDebug
+ Console.WriteLine("GetWindowState({0}): Called", Window(handle));
+ #endif
+ return driver.GetWindowState(handle);
+ }
+
+ internal static void GrabInfo(out IntPtr handle, out bool GrabConfined, out Rectangle GrabArea) {
+ #if DriverDebug
+ Console.WriteLine("GrabInfo(): Called");
+ #endif
+ driver.GrabInfo(out handle, out GrabConfined, out GrabArea);
+ }
+
+ internal static void GrabWindow(IntPtr handle, IntPtr ConfineToHwnd) {
+ #if DriverDebug
+ Console.WriteLine("GrabWindow({0}, {1}): Called", Window(handle), Window(ConfineToHwnd));
+ #endif
+ driver.GrabWindow(handle, ConfineToHwnd);
+ }
+
+ internal static void HandleException(Exception e) {
+ driver.HandleException(e);
+ }
+
+ internal static void Invalidate(IntPtr handle, Rectangle rc, bool clear) {
+ #if DriverDebug
+ Console.WriteLine("Invalidate({0}, {1}, {2}): Called", Window(handle), rc, clear);
+ #endif
+ driver.Invalidate(handle, rc, clear);
+ }
+
+ internal static bool IsEnabled(IntPtr handle) {
+ #if DriverDebug || DriverDebugState
+ Console.WriteLine("IsEnabled({0}): Called, Result={1}", Window(handle), driver.IsEnabled(handle));
+ #endif
+ return driver.IsEnabled(handle);
+ }
+
+ internal static bool IsVisible(IntPtr handle) {
+ #if DriverDebug || DriverDebugState
+ Console.WriteLine("IsVisible({0}): Called, Result={1}", Window(handle), driver.IsVisible(handle));
+ #endif
+ return driver.IsVisible(handle);
+ }
+
+ internal static void KillTimer (Timer timer)
+ {
+ #if DriverDebug
+ Console.WriteLine("KillTimer({0}): Called", timer);
+ #endif
+ driver.KillTimer (timer);
+ }
+
+ internal static void MenuToScreen(IntPtr handle, ref int x, ref int y) {
+ #if DriverDebug
+ Console.WriteLine("MenuToScreen({0}, {1}, {2}): Called", Window(handle), x, y);
+ #endif
+ driver.MenuToScreen(handle, ref x, ref y);
+ }
+
+ internal static void OverrideCursor(IntPtr cursor) {
+ #if DriverDebug
+ Console.WriteLine("OverrideCursor({0:X}): Called", cursor.ToInt32());
+ #endif
+ driver.OverrideCursor(cursor);
+ }
+
+ internal static void PaintEventEnd(IntPtr handle, bool client) {
+ #if DriverDebug || DriverDebugPaint
+ Console.WriteLine("PaintEventEnd({0}, {1}): Called from thread {2}", Window(handle), client, Thread.CurrentThread.GetHashCode());
+ #endif
+ driver.PaintEventEnd(handle, client);
+ }
+
+ internal static PaintEventArgs PaintEventStart(IntPtr handle, bool client) {
+ #if DriverDebug || DriverDebugPaint
+ Console.WriteLine("PaintEventStart({0}, {1}): Called from thread {2}", Window(handle), client, Thread.CurrentThread.GetHashCode());
+ #endif
+ return driver.PaintEventStart(handle, client);
+ }
+
+ internal static bool PeekMessage(ref MSG msg, IntPtr hWnd, int wFilterMin, int wFilterMax, uint flags) {
+ return driver.PeekMessage(ref msg, hWnd, wFilterMin, wFilterMax, flags);
+ }
+
+ internal static bool PostMessage(IntPtr hwnd, Msg message, IntPtr wParam, IntPtr lParam) {
+ #if DriverDebug
+ Console.WriteLine("PostMessage({0}, {1}, {2:X}, {3:X}): Called", Window(hwnd), message, wParam.ToInt32(), lParam.ToInt32());
+ #endif
+ return driver.PostMessage(hwnd, message, wParam, lParam);
+ }
+
+ internal static bool PostMessage(ref MSG msg) {
+ #if DriverDebug
+ Console.WriteLine("PostMessage({0}): Called", msg);
+ #endif
+ return driver.PostMessage(msg.hwnd, msg.message, msg.wParam, msg.lParam);
+ }
+
+ internal static void PostQuitMessage(int exitCode) {
+ #if DriverDebug
+ Console.WriteLine("PostQuitMessage({0}): Called", exitCode);
+ #endif
+ driver.PostQuitMessage(exitCode);
+ }
+
+ internal static void ReleaseMenuDC(IntPtr handle, Graphics dc) {
+ #if DriverDebug
+ Console.WriteLine("ReleaseMenuDC({0:X}): Called", handle.ToInt32());
+ #endif
+ driver.ReleaseMenuDC(handle, dc);
+ }
+
+ internal static void ScreenToClient(IntPtr handle, ref int x, ref int y) {
+ #if DriverDebug
+ Console.WriteLine("ScreenToClient({0}, {1}, {2}): Called", Window(handle), x, y);
+ #endif
+ driver.ScreenToClient (handle, ref x, ref y);
+ }
+
+ internal static void ScreenToMenu(IntPtr handle, ref int x, ref int y) {
+ #if DriverDebug
+ Console.WriteLine("ScreenToMenu({0}, {1}, {2}): Called", Window(handle), x, y);
+ #endif
+ driver.ScreenToMenu(handle, ref x, ref y);
+ }
+
+ internal static void ScrollWindow(IntPtr handle, Rectangle rectangle, int XAmount, int YAmount, bool with_children) {
+ #if DriverDebug
+ Console.WriteLine("ScrollWindow({0}, {1}, {2}, {3}, {4}): Called", Window(handle), rectangle, XAmount, YAmount, with_children);
+ #endif
+ driver.ScrollWindow(handle, rectangle, XAmount, YAmount, with_children);
+ }
+
+ internal static void ScrollWindow(IntPtr handle, int XAmount, int YAmount, bool with_children) {
+ #if DriverDebug
+ Console.WriteLine("ScrollWindow({0}, {2}, {3}, {4}): Called", Window(handle), XAmount, YAmount, with_children);
+ #endif
+ driver.ScrollWindow(handle, XAmount, YAmount, with_children);
+ }
+
+ internal static void SendAsyncMethod (AsyncMethodData data) {
+ #if DriverDebug
+ Console.WriteLine("SendAsyncMethod({0}): Called", data);
+ #endif
+ driver.SendAsyncMethod (data);
+ }
+
+ internal static IntPtr SendMessage (IntPtr handle, Msg message, IntPtr wParam, IntPtr lParam) {
+ #if DriverDebug
+ Console.WriteLine("SendMessage ({0}, {1}, {2:X}, {3:X}): Called", Window(handle), message, wParam.ToInt32(), lParam.ToInt32());
+ #endif
+ return driver.SendMessage (handle, message, wParam, lParam);
+ }
+
+ internal static void SendMessage (ref Message m) {
+ #if DriverDebug
+ Console.WriteLine("SendMessage ({0}): Called", m);
+ #endif
+ m.Result = driver.SendMessage(m.HWnd, (Msg)m.Msg, m.WParam, m.LParam);
+ }
+
+ internal static void SetAllowDrop (IntPtr handle, bool value)
+ {
+ #if DriverDebug
+ Console.WriteLine ("SetAllowDrop({0}, {1}): Called", handle, value);
+ #endif
+ driver.SetAllowDrop (handle, value);
+ }
+
+ internal static void SetBorderStyle(IntPtr handle, FormBorderStyle border_style) {
+ #if DriverDebug
+ Console.WriteLine("SetBorderStyle({0}, {1}): Called", Window(handle), border_style);
+ #endif
+ driver.SetBorderStyle(handle, border_style);
+ }
+
+ internal static void SetCaretPos(IntPtr handle, int x, int y) {
+ #if DriverDebug
+ Console.WriteLine("SetCaretPos({0}, {1}, {2}): Called", Window(handle), x, y);
+ #endif
+ driver.SetCaretPos(handle, x, y);
+ }
+
+ internal static void SetCursor(IntPtr handle, IntPtr cursor) {
+ #if DriverDebug
+ Console.WriteLine("SetCursor({0}, {1:X}): Called", Window(handle), cursor.ToInt32());
+ #endif
+ driver.SetCursor(handle, cursor);
+ }
+
+ internal static void SetCursorPos(IntPtr handle, int x, int y) {
+ #if DriverDebug
+ Console.WriteLine("SetCursorPos({0}, {1}, {2}): Called", Window(handle), x, y);
+ #endif
+ driver.SetCursorPos(handle, x, y);
+ }
+
+ internal static void SetFocus(IntPtr handle) {
+ #if DriverDebug
+ Console.WriteLine("SetFocus({0}): Called", Window(handle));
+ #endif
+ driver.SetFocus(handle);
+ }
+
+ internal static void SetIcon(IntPtr handle, Icon icon) {
+ #if DriverDebug
+ Console.WriteLine("SetIcon({0}, {1}): Called", Window(handle), icon);
+ #endif
+ driver.SetIcon(handle, icon);
+ }
+
+ internal static void SetMenu(IntPtr handle, Menu menu) {
+ #if DriverDebug
+ Console.WriteLine("SetMenu({0}, {1}): Called", Window(handle), menu);
+ #endif
+ driver.SetMenu(handle, menu);
+ }
+
+ internal static void SetModal(IntPtr handle, bool Modal) {
+ #if DriverDebug || DriverDebugState
+ Console.WriteLine("SetModal({0}, {1}): Called", Window(handle), Modal);
+ #endif
+ driver.SetModal(handle, Modal);
+ }
+
+ internal static IntPtr SetParent(IntPtr handle, IntPtr hParent) {
+ #if DriverDebug
+ Console.WriteLine("SetParent({0}, {1:X}): Called", Window(handle), Window(hParent));
+ #endif
+ return driver.SetParent(handle, hParent);
+ }
+
+ internal static void SetTimer (Timer timer)
+ {
+ #if DriverDebug
+ Console.WriteLine("SetTimer({0}): Called", timer);
+ #endif
+ driver.SetTimer (timer);
+ }
+
+ internal static bool SetTopmost(IntPtr handle, IntPtr hWndOwner, bool Enabled) {
+ #if DriverDebug
+ Console.WriteLine("SetTopMost({0}, {1}, {2}): Called", Window(handle), Window(hWndOwner), Enabled);
+ #endif
+ return driver.SetTopmost(handle, hWndOwner, Enabled);
+ }
+
+ internal static bool SetVisible(IntPtr handle, bool visible) {
+ #if DriverDebug || DriverDebugState
+ Console.WriteLine("SetVisible({0}, {1}): Called", Window(handle), visible);
+ #endif
+ return driver.SetVisible(handle, visible);
+ }
+
+ internal static void SetWindowPos(IntPtr handle, int x, int y, int width, int height) {
+ #if DriverDebug
+ Console.WriteLine("SetWindowPos({0}, {1}, {2}, {3}, {4}): Called", Window(handle), x, y, width, height);
+ #endif
+ driver.SetWindowPos(handle, x, y, width, height);
+ }
+
+ internal static void SetWindowState(IntPtr handle, FormWindowState state) {
+ #if DriverDebug || DriverDebugState
+ Console.WriteLine("SetWindowState({0} {1}): Called", Window(handle), state);
+ #endif
+ driver.SetWindowState(handle, state);
+ }
+
+ internal static void SetWindowStyle(IntPtr handle, CreateParams cp) {
+ #if DriverDebug
+ Console.WriteLine("SetWindowStyle({0}): Called", Window(handle));
+ #endif
+ driver.SetWindowStyle(handle, cp);
+ }
+
+ internal static void SetWindowTransparency(IntPtr handle, double transparency, Color key)
+ {
+ #if DriverDebug
+ Console.WriteLine("SetWindowTransparency({0}): Called", Window(handle));
+ #endif
+ driver.SetWindowTransparency(handle, transparency, key);
+ }
+
+ internal static bool SetZOrder(IntPtr handle, IntPtr AfterhWnd, bool Top, bool Bottom) {
+ #if DriverDebug
+ Console.WriteLine("SetZOrder({0}, {1:X}, {2}, {3}): Called", Window(handle), Window(AfterhWnd), Top, Bottom);
+ #endif
+ return driver.SetZOrder(handle, AfterhWnd, Top, Bottom);
+ }
+
+ internal static void ShowCursor(bool show) {
+ #if DriverDebug
+ Console.WriteLine("ShowCursor({0}): Called", show);
+ #endif
+ driver.ShowCursor(show);
+ }
+
+ internal static DragDropEffects StartDrag(IntPtr handle, object data, DragDropEffects allowedEffects) {
+ #if DriverDebug
+ Console.WriteLine ("StartDrag({0}, {1}, {2}): Called", Window(handle), data, allowedEffects);
+ #endif
+ return driver.StartDrag (handle, data, allowedEffects);
+ }
+
+ internal static void StartLoop(Thread thread) {
+ #if DriverDebug
+ Console.WriteLine("StartLoop({0:X}): Called", thread.GetHashCode());
+ #endif
+ driver.StartLoop(thread);
+ }
+
+ internal static bool SupportsTransparency() {
+ #if DriverDebug
+ Console.WriteLine("SupportsTransparency(): Called, result={1}", driver.SupportsTransparency());
+ #endif
+ return driver.SupportsTransparency();
+ }
+
+ internal static bool SystrayAdd(IntPtr handle, string tip, Icon icon, out ToolTip tt) {
+ #if DriverDebug
+ Console.WriteLine("SystrayAdd({0}, {1}): Called", Window(handle), tip);
+ #endif
+ return driver.SystrayAdd(handle, tip, icon, out tt);
+ }
+
+ internal static void SystrayChange(IntPtr handle, string tip, Icon icon, ref ToolTip tt) {
+ #if DriverDebug
+ Console.WriteLine("SystrayChange({0}, {1}): Called", Window(handle), tip);
+ #endif
+ driver.SystrayChange(handle, tip, icon, ref tt);
+ }
+
+ internal static void SystrayRemove(IntPtr handle, ref ToolTip tt) {
+ #if DriverDebug
+ Console.WriteLine("SystrayRemove({0}): Called", Window(handle));
+ #endif
+ driver.SystrayRemove(handle, ref tt);
+ }
+
+ internal static bool Text(IntPtr handle, string text) {
+ #if DriverDebug
+ Console.WriteLine("Text({0}, {1}): Called", Window(handle), text);
+ #endif
+ return driver.Text(handle, text);
+ }
+
+ internal static bool TranslateMessage(ref MSG msg) {
+ return driver.TranslateMessage(ref msg);
+ }
+
+ internal static void UngrabWindow(IntPtr handle) {
+ #if DriverDebug
+ Console.WriteLine("UngrabWindow({0}): Called", Window(handle));
+ #endif
+ driver.UngrabWindow(handle);
+ }
+
+ internal static void UpdateWindow(IntPtr handle) {
+ #if DriverDebug
+ Console.WriteLine("UpdateWindow({0}): Called", Window(handle));
+ #endif
+ driver.UpdateWindow(handle);
+ }
+
+ // Santa's little helper
+ internal static void Version() {
+ Console.WriteLine("Xplat version $Revision: $");
+ }
+
+ internal static void Where() {
+ XplatUIX11.Where();
+ }
+ #endregion // Public Static Methods
+
+ #region Delegates
+ public delegate bool ClipboardToObject(int type, IntPtr data, out object obj);
+ public delegate bool ObjectToClipboard(ref int type, object obj, out byte[] data);
+ #endregion // Delegates
+
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIDriver.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIDriver.cs
new file mode 100644
index 00000000000..3bc9d9cbb45
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIDriver.cs
@@ -0,0 +1,306 @@
+// 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.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+// Sebastien Pouliot sebastien@ximian.com
+//
+
+// COMPLETE
+
+using System.Drawing;
+using System.Threading;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ internal abstract class XplatUIDriver {
+ internal abstract IntPtr InitializeDriver();
+ internal abstract void ShutdownDriver(IntPtr token);
+ internal delegate IntPtr WndProc(IntPtr hwnd, Msg msg, IntPtr wParam, IntPtr lParam);
+
+
+ #region XplatUI Driver Properties
+ internal virtual Color ForeColor {
+ get {
+ return ThemeEngine.Current.DefaultWindowForeColor;
+ }
+ }
+
+ internal virtual Color BackColor {
+ get {
+ return ThemeEngine.Current.DefaultWindowBackColor;
+ }
+ }
+
+ internal virtual Font Font {
+ get {
+ return ThemeEngine.Current.DefaultFont;
+ }
+ }
+
+ internal virtual Keys ModifierKeys {
+ get {
+ return Keys.None;
+ }
+ }
+
+ internal virtual MouseButtons MouseButtons {
+ get {
+ return MouseButtons.None;
+ }
+ }
+
+ internal virtual Point MousePosition {
+ get {
+ return Point.Empty;
+ }
+ }
+
+ internal virtual bool DropTarget {
+ get {
+ return false;
+ }
+
+ set {
+ }
+ }
+
+ internal abstract int Caption { get; }
+ internal abstract Size CursorSize { get; }
+ internal abstract bool DragFullWindows { get; }
+ internal abstract Size DragSize { get; }
+ internal abstract Size FrameBorderSize { get; }
+ internal abstract Size IconSize { get; }
+ internal abstract Size MaxWindowTrackSize { get; }
+ internal abstract Size MinimizedWindowSize { get; }
+ internal abstract Size MinimizedWindowSpacingSize { get; }
+ internal abstract Size MinimumWindowSize { get; }
+ internal abstract Size MinWindowTrackSize { get; }
+ internal abstract Size SmallIconSize { get; }
+ internal abstract int MouseButtonCount { get; }
+ internal abstract bool MouseButtonsSwapped { get; }
+ internal abstract bool MouseWheelPresent { get; }
+ internal abstract Rectangle VirtualScreen { get; }
+ internal abstract Rectangle WorkingArea { get; }
+ #endregion // XplatUI Driver Properties
+
+ internal abstract event EventHandler Idle;
+
+ #region XplatUI Driver Methods
+ internal abstract void AudibleAlert();
+
+ internal abstract void EnableThemes();
+
+ internal abstract void GetDisplaySize(out Size size);
+
+ internal abstract IntPtr CreateWindow(CreateParams cp);
+ internal abstract IntPtr CreateWindow(IntPtr Parent, int X, int Y, int Width, int Height);
+ internal abstract void DestroyWindow(IntPtr handle);
+
+ internal abstract FormWindowState GetWindowState(IntPtr handle);
+ internal abstract void SetWindowState(IntPtr handle, FormWindowState state);
+
+ internal abstract void SetWindowStyle(IntPtr handle, CreateParams cp);
+
+ internal abstract void SetWindowTransparency(IntPtr handle, double transparency, Color key);
+ internal abstract bool SupportsTransparency();
+
+ internal virtual void SetAllowDrop (IntPtr handle, bool value)
+ {
+ Console.Error.WriteLine ("Drag and Drop is currently " +
+ "not supported on this platform");
+ }
+
+ internal virtual DragDropEffects StartDrag(IntPtr handle, object data, DragDropEffects allowedEffects) {
+ Console.Error.WriteLine ("Drag and Drop is currently " +
+ "not supported on this platform");
+ return DragDropEffects.None;
+ }
+
+ internal abstract void SetBorderStyle(IntPtr handle, FormBorderStyle border_style);
+ internal abstract void SetMenu(IntPtr handle, Menu menu);
+
+ internal abstract bool GetText(IntPtr handle, out string text);
+ internal abstract bool Text(IntPtr handle, string text);
+ internal abstract bool SetVisible(IntPtr handle, bool visible);
+ internal abstract bool IsVisible(IntPtr handle);
+ internal abstract bool IsEnabled(IntPtr handle);
+ internal abstract IntPtr SetParent(IntPtr handle, IntPtr parent);
+ internal abstract IntPtr GetParent(IntPtr handle);
+
+ internal abstract void UpdateWindow(IntPtr handle);
+ internal abstract PaintEventArgs PaintEventStart(IntPtr handle, bool client);
+ internal abstract void PaintEventEnd(IntPtr handle, bool client);
+
+ internal abstract void SetWindowPos(IntPtr handle, int x, int y, int width, int height);
+ internal abstract void GetWindowPos(IntPtr handle, bool is_toplevel, out int x, out int y, out int width, out int height, out int client_width, out int client_height);
+ internal abstract void Activate(IntPtr handle);
+ internal abstract void EnableWindow(IntPtr handle, bool Enable);
+ internal abstract void SetModal(IntPtr handle, bool Modal);
+ internal abstract void Invalidate(IntPtr handle, Rectangle rc, bool clear);
+ internal abstract IntPtr DefWndProc(ref Message msg);
+ internal abstract void HandleException(Exception e);
+ internal abstract void DoEvents();
+ internal abstract bool PeekMessage(ref MSG msg, IntPtr hWnd, int wFilterMin, int wFilterMax, uint flags);
+ internal abstract void PostQuitMessage(int exitCode);
+ internal abstract bool GetMessage(ref MSG msg, IntPtr hWnd, int wFilterMin, int wFilterMax);
+ internal abstract bool TranslateMessage(ref MSG msg);
+ internal abstract IntPtr DispatchMessage(ref MSG msg);
+
+ internal abstract bool SetZOrder(IntPtr hWnd, IntPtr AfterhWnd, bool Top, bool Bottom);
+ internal abstract bool SetTopmost(IntPtr hWnd, IntPtr hWndOwner, bool Enabled);
+
+ internal abstract bool CalculateWindowRect(IntPtr hWnd, ref Rectangle ClientRect, int Style, int ExStyle, Menu menu, out Rectangle WindowRect);
+
+ internal abstract void SetCursor(IntPtr hwnd, IntPtr cursor);
+ internal abstract void ShowCursor(bool show);
+ internal abstract void OverrideCursor(IntPtr cursor);
+ internal abstract IntPtr DefineCursor(Bitmap bitmap, Bitmap mask, Color cursor_pixel, Color mask_pixel, int xHotSpot, int yHotSpot);
+ internal abstract IntPtr DefineStdCursor(StdCursor id);
+ internal abstract void DestroyCursor(IntPtr cursor);
+ internal abstract void GetCursorInfo(IntPtr cursor, out int width, out int height, out int hotspot_x, out int hotspot_y);
+
+ internal abstract void GetCursorPos(IntPtr hwnd, out int x, out int y);
+ internal abstract void SetCursorPos(IntPtr hwnd, int x, int y);
+
+ internal abstract void ScreenToClient(IntPtr hwnd, ref int x, ref int y);
+ internal abstract void ClientToScreen(IntPtr hwnd, ref int x, ref int y);
+
+ internal abstract void GrabWindow(IntPtr hwnd, IntPtr ConfineToHwnd);
+ internal abstract void GrabInfo(out IntPtr hwnd, out bool GrabConfined, out Rectangle GrabArea);
+ internal abstract void UngrabWindow(IntPtr hwnd);
+
+ internal abstract void SendAsyncMethod (AsyncMethodData method);
+ internal abstract void SetTimer (Timer timer);
+ internal abstract void KillTimer (Timer timer);
+
+ internal abstract void CreateCaret(IntPtr hwnd, int width, int height);
+ internal abstract void DestroyCaret(IntPtr hwnd);
+ internal abstract void SetCaretPos(IntPtr hwnd, int x, int y);
+ internal abstract void CaretVisible(IntPtr hwnd, bool visible);
+
+ internal abstract void SetFocus(IntPtr hwnd);
+ internal abstract IntPtr GetActive();
+
+ internal abstract void ScrollWindow(IntPtr hwnd, Rectangle rectangle, int XAmount, int YAmount, bool with_children);
+ internal abstract void ScrollWindow(IntPtr hwnd, int XAmount, int YAmount, bool with_children);
+
+ internal abstract bool GetFontMetrics(Graphics g, Font font, out int ascent, out int descent);
+
+ internal abstract bool SystrayAdd(IntPtr hwnd, string tip, Icon icon, out ToolTip tt);
+ internal abstract bool SystrayChange(IntPtr hwnd, string tip, Icon icon, ref ToolTip tt);
+ internal abstract void SystrayRemove(IntPtr hwnd, ref ToolTip tt);
+
+ internal abstract Graphics GetMenuDC(IntPtr hwnd, IntPtr ncpaint_region);
+ internal abstract Point GetMenuOrigin(IntPtr hwnd);
+ internal abstract void ReleaseMenuDC(IntPtr hwnd, Graphics dc);
+ internal abstract void MenuToScreen(IntPtr hwnd, ref int x, ref int y);
+ internal abstract void ScreenToMenu(IntPtr hwnd, ref int x, ref int y);
+
+ internal abstract void SetIcon(IntPtr handle, Icon icon);
+
+ internal abstract void ClipboardClose(IntPtr handle);
+ internal abstract IntPtr ClipboardOpen();
+ internal abstract int ClipboardGetID(IntPtr handle, string format);
+ internal abstract void ClipboardStore(IntPtr handle, object obj, int id, XplatUI.ObjectToClipboard converter);
+ internal abstract int[] ClipboardAvailableFormats(IntPtr handle);
+ internal abstract object ClipboardRetrieve(IntPtr handle, int id, XplatUI.ClipboardToObject converter);
+
+ internal abstract void DrawReversibleRectangle(IntPtr handle, Rectangle rect, int line_width);
+
+ internal abstract SizeF GetAutoScaleSize(Font font);
+
+ internal abstract IntPtr SendMessage(IntPtr hwnd, Msg message, IntPtr wParam, IntPtr lParam);
+ internal abstract bool PostMessage(IntPtr hwnd, Msg message, IntPtr wParam, IntPtr lParam);
+
+ internal abstract void StartLoop(Thread thread);
+ internal abstract void EndLoop(Thread thread);
+
+ // System information
+ internal abstract int KeyboardSpeed { get; }
+ internal abstract int KeyboardDelay { get; }
+
+#endregion // XplatUI Driver Methods
+ }
+
+ internal class XplatUIDriverSupport {
+ #region XplatUI Driver Support Methods
+#if NET_2_0
+ internal static void ExecutionCallback (object state)
+ {
+ AsyncMethodData data = (AsyncMethodData) state;
+ AsyncMethodResult result = data.Result;
+ object ret = data.Method.DynamicInvoke (data.Args);
+ if (result != null) {
+ result.Complete (ret);
+ }
+ }
+
+ internal static void ExecuteClientMessage (GCHandle gchandle)
+ {
+ AsyncMethodData data = (AsyncMethodData) gchandle.Target;
+ try {
+ if (data.Context == null) {
+ ExecutionCallback (data);
+ } else {
+ ExecutionContext.Run (data.Context, new ContextCallback (ExecutionCallback), data);
+ }
+ }
+ finally {
+ gchandle.Free ();
+ }
+ }
+#else
+ // for NET_1_0 and NET_1_1 no (public) ExecutionContext exists
+ // so we must use the System.Threading.CompressedStack class
+ internal static void ExecuteClientMessage (GCHandle gchandle) {
+ AsyncMethodData data = (AsyncMethodData) gchandle.Target;
+ CompressedStack original = null;
+
+#if !MWF_ON_MSRUNTIME
+ // Stack is non-null only if the security manager is active
+ if (data.Stack != null) {
+ original = Thread.CurrentThread.GetCompressedStack ();
+ Thread.CurrentThread.SetCompressedStack (data.Stack);
+ }
+#endif
+
+ try {
+ AsyncMethodResult result = data.Result;
+ object ret = data.Method.DynamicInvoke (data.Args);
+ result.Complete (ret);
+ }
+ finally {
+#if !MWF_ON_MSRUNTIME
+ if (data.Stack != null) {
+ // whatever occurs we must revert to the original compressed
+ // stack (null being a valid, empty, value in this case).
+ Thread.CurrentThread.SetCompressedStack (original);
+ }
+#endif
+ gchandle.Free ();
+ }
+ }
+#endif
+
+ #endregion // XplatUI Driver Support Methods
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIOSX.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIOSX.cs
new file mode 100644
index 00000000000..790eeeeb59d
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIOSX.cs
@@ -0,0 +1,2067 @@
+// 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.
+//
+// Authors:
+// Geoff Norton <gnorton@customerdna.com>
+//
+//
+
+// This really doesn't work at all; please dont file bugs on it yet.
+
+// MAJOR TODO:
+// Fix clipping of children
+// Wire up keyboard
+
+using System;
+using System.Threading;
+using System.Drawing;
+using System.ComponentModel;
+using System.Collections;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+
+/// OSX Version
+namespace System.Windows.Forms {
+
+ // The Carbon Event callback delegate
+ delegate int CarbonEventDelegate (IntPtr inCallRef, IntPtr inEvent, IntPtr userData);
+
+ internal class XplatUIOSX : XplatUIDriver {
+
+ #region Local Variables
+
+ // General driver variables
+ private static XplatUIOSX Instance;
+ private static int RefCount;
+ private static bool ThemesEnabled;
+ private static IntPtr FocusWindow;
+
+ // Mouse
+ private static MouseButtons MouseState;
+ private static Point MousePosition;
+ private static Hwnd MouseWindow;
+
+ // OSX Specific
+ private static GrabStruct Grab;
+ private static OSXCaret Caret;
+ private static OSXHover Hover;
+ private CarbonEventDelegate CarbonEventHandler;
+ private static Hashtable WindowMapping;
+ private static Hashtable WindowBackgrounds;
+ private static Hwnd GrabWindowHwnd;
+ private static IntPtr FosterParent;
+ private static int TitleBarHeight;
+ private static int MenuBarHeight;
+ private static EventTypeSpec [] viewEvents = new EventTypeSpec [] {
+ new EventTypeSpec (OSXConstants.kEventClassControl, OSXConstants.kEventControlSetFocusPart),
+ new EventTypeSpec (OSXConstants.kEventClassControl, OSXConstants.kEventControlClick),
+ new EventTypeSpec (OSXConstants.kEventClassControl, OSXConstants.kEventControlContextualMenuClick),
+ new EventTypeSpec (OSXConstants.kEventClassControl, OSXConstants.kEventControlTrack),
+ new EventTypeSpec (OSXConstants.kEventClassControl, OSXConstants.kEventControlSimulateHit),
+ new EventTypeSpec (OSXConstants.kEventClassControl, OSXConstants.kEventControlBoundsChanged),
+ new EventTypeSpec (OSXConstants.kEventClassControl, OSXConstants.kEventControlDraw)
+ };
+ private static EventTypeSpec [] windowEvents = new EventTypeSpec[] {
+ //new EventTypeSpec (OSXConstants.kEventClassMouse, OSXConstants.kEventMouseEntered),
+ //new EventTypeSpec (OSXConstants.kEventClassMouse, OSXConstants.kEventMouseExited),
+ new EventTypeSpec (OSXConstants.kEventClassMouse, OSXConstants.kEventMouseMoved),
+ //new EventTypeSpec (OSXConstants.kEventClassMouse, OSXConstants.kEventMouseDragged),
+ //new EventTypeSpec (OSXConstants.kEventClassMouse, OSXConstants.kEventMouseWheelMoved),
+ new EventTypeSpec (OSXConstants.kEventClassWindow, OSXConstants.kEventWindowBoundsChanged),
+ new EventTypeSpec (OSXConstants.kEventClassWindow, OSXConstants.kEventWindowClose),
+ new EventTypeSpec (OSXConstants.kEventClassKeyboard, OSXConstants.kEventRawKeyDown),
+ new EventTypeSpec (OSXConstants.kEventClassKeyboard, OSXConstants.kEventRawKeyRepeat),
+ new EventTypeSpec (OSXConstants.kEventClassKeyboard, OSXConstants.kEventRawKeyUp)
+ };
+
+
+ // Message loop
+ private static Queue MessageQueue;
+ private static bool GetMessageResult;
+
+ // Timers
+ private ArrayList TimerList;
+
+ static readonly object lockobj = new object ();
+
+ // Event Handlers
+ internal override event EventHandler Idle;
+
+ #endregion
+
+ #region Constructors
+ private XplatUIOSX() {
+
+ RefCount = 0;
+ TimerList = new ArrayList ();
+ MessageQueue = new Queue ();
+
+ Initialize ();
+ }
+
+ ~XplatUIOSX() {
+ // FIXME: Clean up the FosterParent here.
+ }
+
+ #endregion
+
+ #region Singleton specific code
+
+ public static XplatUIOSX GetInstance() {
+ lock (lockobj) {
+ if (Instance == null) {
+ Instance = new XplatUIOSX ();
+ }
+ RefCount++;
+ }
+ return Instance;
+ }
+
+ public int Reference {
+ get {
+ return RefCount;
+ }
+ }
+
+ #endregion
+
+ #region Internal methods
+
+ internal void Initialize () {
+
+ // Initialize the Event Handler delegate
+ CarbonEventHandler = new CarbonEventDelegate (EventCallback);
+
+ // Initilize the mouse controls
+ Hover.Interval = 500;
+ Hover.Timer = new Timer ();
+ Hover.Timer.Enabled = false;
+ Hover.Timer.Interval = Hover.Interval;
+ Hover.Timer.Tick += new EventHandler (HoverCallback);
+ Hover.X = -1;
+ Hover.Y = -1;
+ MouseState = MouseButtons.None;
+ MousePosition = Point.Empty;
+
+ // Initialize the Caret
+ Caret.Timer = new Timer ();
+ Caret.Timer.Interval = 500;
+ Caret.Timer.Tick += new EventHandler (CaretCallback);
+
+ // Initialize the OSX Specific stuff
+ WindowMapping = new Hashtable ();
+ WindowBackgrounds = new Hashtable ();
+
+ // Initialize the FosterParent
+ IntPtr rect = IntPtr.Zero;
+ SetRect (ref rect, (short)0, (short)0, (short)0, (short)0);
+ CheckError (CreateNewWindow (WindowClass.kDocumentWindowClass, WindowAttributes.kWindowStandardHandlerAttribute | WindowAttributes.kWindowCloseBoxAttribute | WindowAttributes.kWindowFullZoomAttribute | WindowAttributes.kWindowCollapseBoxAttribute | WindowAttributes.kWindowResizableAttribute | WindowAttributes.kWindowCompositingAttribute, ref rect, ref FosterParent), "CreateFosterParent ()");
+
+ // Get some values about bar heights
+ Rect structRect = new Rect ();
+ Rect contentRect = new Rect ();
+ CheckError (GetWindowBounds (FosterParent, 32, ref structRect), "GetWindowBounds ()");
+ CheckError (GetWindowBounds (FosterParent, 33, ref contentRect), "GetWindowBounds ()");
+
+ TitleBarHeight = Math.Abs(structRect.top - contentRect.top);
+ MenuBarHeight = GetMBarHeight ();
+
+ // Focus
+ FocusWindow = IntPtr.Zero;
+
+ // Message loop
+ GetMessageResult = true;
+ }
+
+ #endregion
+
+ #region Private methods
+ #endregion
+
+ #region Callbacks
+
+ private void CaretCallback (object sender, EventArgs e) {
+ if (Caret.Paused) {
+ return;
+ }
+
+ if (!Caret.On) {
+ ShowCaret ();
+ } else {
+ HideCaret ();
+ }
+ }
+
+ private void HoverCallback (object sender, EventArgs e) {
+ if ((Hover.X == MousePosition.X) && (Hover.Y == MousePosition.Y)) {
+ MSG msg = new MSG ();
+ msg.hwnd = Hover.Hwnd;
+ msg.message = Msg.WM_MOUSEHOVER;
+ msg.wParam = GetMousewParam (0);
+ msg.lParam = (IntPtr)((ushort)Hover.X << 16 | (ushort)Hover.X);
+ MessageQueue.Enqueue (msg);
+ }
+ }
+
+ internal int EventCallback (IntPtr inCallRef, IntPtr inEvent, IntPtr handle) {
+ uint eventClass = GetEventClass (inEvent);
+ uint eventKind = GetEventKind (inEvent);
+ int retVal = 0;
+ lock (MessageQueue) {
+ switch (eventClass) {
+ // keyboard
+ case OSXConstants.kEventClassKeyboard: {
+ retVal = ProcessKeyboardEvent (inEvent, eventKind, handle);
+ break;
+ }
+ //window
+ case OSXConstants.kEventClassWindow: {
+ retVal = ProcessWindowEvent (inEvent, eventKind, handle);
+ break;
+ }
+ // mouse
+ case OSXConstants.kEventClassMouse: {
+ retVal = ProcessMouseEvent (inEvent, eventKind, handle);
+ break;
+ }
+ // control
+ case OSXConstants.kEventClassControl: {
+ retVal = ProcessControlEvent (inEvent, eventKind, handle);
+ break;
+ }
+ default: {
+ Console.WriteLine ("WARNING: Unhandled eventClass {0}", eventClass);
+ break;
+ }
+ }
+ }
+
+ return retVal;
+ }
+
+ #endregion
+
+ #region Private Methods
+
+ // This sucks write a real driver
+ private int ProcessKeyboardEvent (IntPtr inEvent, uint eventKind, IntPtr handle) {
+ MSG msg = new MSG ();
+ byte charCode = 0x00;
+ GetEventParameter (inEvent, OSXConstants.EventParamName.kEventParamKeyMacCharCodes, OSXConstants.EventParamType.typeChar, IntPtr.Zero, (uint)Marshal.SizeOf (typeof (byte)), IntPtr.Zero, ref charCode);
+ IntPtr cntrl = IntPtr.Zero;
+ CheckError (GetKeyboardFocus (handle, ref cntrl), "GetKeyboardFocus()");
+ msg.hwnd = cntrl;
+ msg.lParam = IntPtr.Zero;
+ switch (charCode) {
+ case 28:
+ charCode = 0x25;
+ break;
+ case 29:
+ charCode = 0x27;
+ break;
+ case 30:
+ charCode = 0x26;
+ break;
+ case 31:
+ charCode = 0x28;
+ break;
+ }
+ msg.wParam = (IntPtr)charCode;
+ switch (eventKind) {
+ // keydown
+ case OSXConstants.kEventRawKeyDown: {
+ msg.message = Msg.WM_KEYDOWN;
+ break;
+ }
+ // repeat
+ case OSXConstants.kEventRawKeyRepeat: {
+ msg.message = Msg.WM_KEYDOWN;
+ break;
+ }
+ // keyup
+ case OSXConstants.kEventRawKeyUp: {
+ msg.message = Msg.WM_KEYUP;
+ break;
+ }
+ }
+ MessageQueue.Enqueue (msg);
+ return -9874;
+ }
+
+ private int ProcessWindowEvent (IntPtr inEvent, uint eventKind, IntPtr handle) {
+ MSG msg = new MSG ();
+ switch (eventKind) {
+ // Someone closed a window
+ case OSXConstants.kEventWindowClose: {
+ // This is our real window; so we have to post to the corresponding view
+ // FIXME: Should we doublehash the table to get the real window handle without this loop?
+ IDictionaryEnumerator e = WindowMapping.GetEnumerator ();
+ while (e.MoveNext ()) {
+ if ((IntPtr)e.Value == handle) {
+ NativeWindow.WndProc((IntPtr)e.Key, Msg.WM_DESTROY, IntPtr.Zero, IntPtr.Zero);
+ }
+ }
+ return 0;
+ }
+ case OSXConstants.kEventWindowBoundsChanged: {
+ // This is our real window; so we have to resize the corresponding view as well
+ // FIXME: Should we doublehash the table to get the real window handle without this loop?
+
+ IDictionaryEnumerator e = WindowMapping.GetEnumerator ();
+ while (e.MoveNext ()) {
+ if ((IntPtr)e.Value == handle) {
+ Hwnd hwnd = Hwnd.ObjectFromHandle ((IntPtr) e.Key);
+ // Get the bounds of the window
+ Rect bounds = new Rect ();
+ CheckError (GetWindowBounds (handle, 33, ref bounds), "GetWindowBounds ()");
+ HIRect r = new HIRect ();
+
+ // Get our frame for the Handle
+ CheckError (HIViewGetFrame (hwnd.Handle, ref r), "HIViewGetFrame ()");
+ r.size.width = bounds.right-bounds.left;
+ r.size.height = bounds.bottom-bounds.top;
+ // Set the view to the new size
+ CheckError (HIViewSetFrame (hwnd.WholeWindow, ref r), "HIViewSetFrame ()");
+
+ // Update the hwnd internal size representation
+ hwnd.x = (int)r.origin.x;
+ hwnd.y = (int)r.origin.y;
+ hwnd.width = (int)r.size.width;
+ hwnd.height = (int)r.size.height;
+ Rectangle client_rect = hwnd.ClientRect;
+
+ r.size.width = client_rect.Width;
+ r.size.height = client_rect.Height;
+ r.origin.x = client_rect.X;
+ r.origin.y = client_rect.Y;
+
+ // Update the client area too
+ CheckError (HIViewSetFrame (hwnd.ClientWindow, ref r));
+
+ // Add the message to the queue
+ msg.message = Msg.WM_WINDOWPOSCHANGED;
+ msg.hwnd = hwnd.Handle;
+ msg.wParam = IntPtr.Zero;
+ msg.lParam = IntPtr.Zero;
+ MessageQueue.Enqueue (msg);
+
+ return 0;
+ }
+ }
+ break;
+ }
+ }
+ return -9874;
+ }
+
+ private int ProcessMouseEvent (IntPtr inEvent, uint eventKind, IntPtr handle) {
+ MSG msg = new MSG ();
+
+ switch (eventKind) {
+ case OSXConstants.kEventMouseMoved: {
+ // Where is the mouse in global coordinates
+ QDPoint pt = new QDPoint ();
+ GetEventParameter (inEvent, OSXConstants.EventParamName.kEventParamMouseLocation, OSXConstants.EventParamType.typeQDPoint, IntPtr.Zero, (uint)Marshal.SizeOf (typeof (QDPoint)), IntPtr.Zero, ref pt);
+
+ // Where is the mouse in the window
+ Rect window_bounds = new Rect ();
+ GetWindowBounds (handle, 33, ref window_bounds);
+ CGPoint window_pt = new CGPoint ((short) (pt.x - window_bounds.left), (short) (pt.y - window_bounds.top));
+
+ IntPtr window_handle = IntPtr.Zero;
+ HIViewFindByID (HIViewGetRoot (handle), new HIViewID (OSXConstants.kEventClassWindow, 1), ref window_handle);
+
+ // Determine which control was hit
+ IntPtr view_handle = IntPtr.Zero;
+ HIViewGetSubviewHit (window_handle, ref window_pt, true, ref view_handle);
+
+ // Convert the point to view local coordinates
+ HIViewConvertPoint (ref window_pt, window_handle, view_handle);
+
+ Hwnd hwnd = Hwnd.ObjectFromHandle (view_handle);
+
+ if (hwnd == null)
+ return -9874;
+
+ // Generate the message
+ msg.hwnd = hwnd.Handle;
+ msg.message = Msg.WM_MOUSEMOVE;
+ msg.lParam = (IntPtr) ((ushort)window_pt.y << 16 | (ushort)window_pt.x);
+ msg.wParam = GetMousewParam (0);
+ MousePosition.X = (int)window_pt.x;
+ MousePosition.Y = (int)window_pt.y;
+
+ Hover.Hwnd = msg.hwnd;
+ Hover.Timer.Enabled = true;
+ MessageQueue.Enqueue (msg);
+ return -9874;
+ }
+ }
+ return -9874;
+ }
+
+ private int ProcessControlEvent (IntPtr inEvent, uint eventKind, IntPtr handle) {
+ GetEventParameter (inEvent, OSXConstants.EventParamName.kEventParamDirectObject, OSXConstants.EventParamType.typeControlRef, IntPtr.Zero, (uint)Marshal.SizeOf (typeof (IntPtr)), IntPtr.Zero, ref handle);
+ Hwnd hwnd = Hwnd.ObjectFromHandle (handle);
+ MSG msg = new MSG ();
+
+ switch (eventKind) {
+ case OSXConstants.kEventControlDraw: {
+
+ if(!hwnd.visible || !HIViewIsVisible (handle))
+ return 0;
+
+ /*
+ IntPtr rgnhandle = IntPtr.Zero;
+ GetEventParameter (inEvent, OSXConstants.EventParamName.kEventParamRgnHandle, OSXConstants.EventParamType.typeQDRgnHandle, IntPtr.Zero, (uint)Marshal.SizeOf (typeof (IntPtr)), IntPtr.Zero, ref rgnhandle);
+ IntPtr duprgn = NewRgn ();
+ CopyRgn (rgnhandle, duprgn);
+ ClipRegions [hwnd.Handle] = duprgn;
+ */
+
+ // Get the dirty area
+ HIRect bounds = new HIRect ();
+ HIViewGetBounds (handle, ref bounds);
+
+ bool client = (hwnd.ClientWindow == handle ? true : false);
+
+ if (!client && bounds.origin.x >= hwnd.ClientRect.X && bounds.origin.y >= hwnd.ClientRect.Y) {
+ // This is a paint on WholeWindow inside the clientRect; we can safely discard this
+ return 0;
+ }
+
+ hwnd.AddInvalidArea ((int)bounds.origin.x, (int)bounds.origin.y, (int)bounds.size.width, (int)bounds.size.height);
+ if (WindowBackgrounds [hwnd] != null) {
+ Color c = (Color)WindowBackgrounds [hwnd];
+ IntPtr contextref = IntPtr.Zero;
+ GetEventParameter (inEvent, OSXConstants.EventParamName.kEventParamCGContextRef, OSXConstants.EventParamType.typeCGContextRef, IntPtr.Zero, (uint)Marshal.SizeOf (typeof (IntPtr)), IntPtr.Zero, ref contextref);
+ CGContextSetRGBFillColor (contextref, (float)c.R/255, (float)c.G/255, (float)c.B/255, (float)c.A/255);
+ CGContextFillRect (contextref, bounds);
+ }
+
+ // Add a paint to the queue
+ msg.hwnd = hwnd.Handle;
+ msg.message = Msg.WM_PAINT;
+ msg.wParam = IntPtr.Zero;
+ msg.lParam = IntPtr.Zero;
+ MessageQueue.Enqueue (msg);
+
+ return 0;
+ }
+ case OSXConstants.kEventControlBoundsChanged: {
+ // This can happen before our HWND is created so we need to check to make sure its not null
+ if (hwnd != null) {
+ // Get the bounds
+ HIRect bounds = new HIRect ();
+ HIViewGetFrame (handle, ref bounds);
+ // Update the hwnd size
+ hwnd.x = (int)bounds.origin.x;
+ hwnd.y = (int)bounds.origin.y;
+ hwnd.width = (int)bounds.size.width;
+ hwnd.height = (int)bounds.size.height;
+
+ // TODO: Do we need to send a paint here or does BoundsChanged make a ControlDraw for the exposed area?
+ }
+ return 0;
+ }
+ case OSXConstants.kEventControlTrack: {
+ // get the point that was hit
+ QDPoint point = new QDPoint ();
+ CheckError (GetEventParameter (inEvent, OSXConstants.EventParamName.kEventParamMouseLocation, OSXConstants.EventParamType.typeQDPoint, IntPtr.Zero, (uint)Marshal.SizeOf (typeof (QDPoint)), IntPtr.Zero, ref point), "GetEventParameter() MouseLocation");
+ MouseTrackingResult mousestatus = MouseTrackingResult.kMouseTrackingMouseDown;
+ IntPtr modifiers = IntPtr.Zero;
+
+ while (mousestatus != MouseTrackingResult.kMouseTrackingMouseUp) {
+ CheckTimers (DateTime.Now);
+ if (mousestatus == MouseTrackingResult.kMouseTrackingMouseDragged) {
+ QDPoint realpoint = point;
+ int x = point.x;
+ int y = point.y;
+ ScreenToClient (hwnd.Handle, ref x, ref y);
+ realpoint.x = (short)x;
+ realpoint.y = (short)y;
+ NativeWindow.WndProc (hwnd.Handle, Msg.WM_MOUSEMOVE, GetMousewParam (0), (IntPtr) ((ushort)realpoint.y << 16 | (ushort)realpoint.x));
+ }
+ // Process the rest of the event queue
+ while (MessageQueue.Count > 0) {
+ msg = (MSG)MessageQueue.Dequeue ();
+ NativeWindow.WndProc (msg.hwnd, msg.message, msg.wParam, msg.lParam);
+ }
+ TrackMouseLocationWithOptions ((IntPtr)(-1), 0, 0.01, ref point, ref modifiers, ref mousestatus);
+ }
+
+ msg.hwnd = hwnd.Handle;
+
+ bool client = (hwnd.ClientWindow == handle ? true : false);
+
+ int wparam = (int)GetMousewParam (0);
+ switch (MouseState) {
+ case MouseButtons.Left:
+ MouseState &= ~MouseButtons.Left;
+ msg.message = (client ? Msg.WM_LBUTTONUP : Msg.WM_NCLBUTTONUP);
+ wparam &= (int)MsgButtons.MK_LBUTTON;
+ break;
+ case MouseButtons.Middle:
+ MouseState &= ~MouseButtons.Middle;
+ msg.message = (client ? Msg.WM_MBUTTONUP : Msg.WM_NCMBUTTONUP);
+ wparam &= (int)MsgButtons.MK_MBUTTON;
+ break;
+ case MouseButtons.Right:
+ MouseState &= ~MouseButtons.Right;
+ msg.message = (client ? Msg.WM_RBUTTONUP : Msg.WM_NCRBUTTONUP);
+ wparam &= (int)MsgButtons.MK_RBUTTON;
+ break;
+ }
+ int x2 = point.x;
+ int y2 = point.y;
+ ScreenToClient (hwnd.Handle, ref x2, ref y2);
+ point.x = (short)x2;
+ point.y = (short)y2;
+
+ msg.wParam = (IntPtr)wparam;
+
+ msg.lParam = (IntPtr) ((ushort)point.y << 16 | (ushort)point.x);
+ MousePosition.X = (int)point.x;
+ MousePosition.Y = (int)point.y;
+ //NativeWindow.WndProc (msg.hwnd, msg.message, msg.lParam, msg.wParam);
+ MessageQueue.Enqueue (msg);
+
+ IntPtr window = GetControlOwner (hwnd.Handle);
+ SetKeyboardFocus (window, hwnd.Handle, 1);
+
+ return 0;
+ }
+ case OSXConstants.kEventControlContextualMenuClick:
+ case OSXConstants.kEventControlClick: {
+ // get the point that was hit
+ QDPoint point = new QDPoint ();
+ CheckError (GetEventParameter (inEvent, OSXConstants.EventParamName.kEventParamMouseLocation, OSXConstants.EventParamType.typeQDPoint, IntPtr.Zero, (uint)Marshal.SizeOf (typeof (QDPoint)), IntPtr.Zero, ref point), "GetEventParameter() MouseLocation");
+ QDPoint trackpoint = point;
+ int x = point.x;
+ int y = point.y;
+ ScreenToClient (hwnd.Handle, ref x, ref y);
+ point.x = (short)x;
+ point.y = (short)y;
+
+ // which button was pressed?
+ ushort button = 0;
+ GetEventParameter (inEvent, OSXConstants.EventParamName.kEventParamMouseButton, OSXConstants.EventParamType.typeMouseButton, IntPtr.Zero, (uint)Marshal.SizeOf (typeof (ushort)), IntPtr.Zero, ref button);
+ if (button == 2) {
+ point.x = (short)MousePosition.X;
+ point.y = (short)MousePosition.Y;
+ }
+
+ msg.hwnd = hwnd.Handle;
+
+ bool client = (hwnd.ClientWindow == handle ? true : false);
+
+ int wparam = (int)GetMousewParam (0);
+ switch (button) {
+ case 1:
+ MouseState |= MouseButtons.Left;
+ msg.message = (client ? Msg.WM_LBUTTONDOWN : Msg.WM_NCLBUTTONDOWN);
+ wparam |= (int)MsgButtons.MK_LBUTTON;
+ break;
+ case 2:
+ MouseState |= MouseButtons.Right;
+ msg.message = (client ? Msg.WM_RBUTTONDOWN : Msg.WM_NCRBUTTONDOWN);
+ wparam |= (int)MsgButtons.MK_RBUTTON;
+ break;
+ case 3:
+ MouseState |= MouseButtons.Middle;
+ msg.message = (client ? Msg.WM_MBUTTONDOWN : Msg.WM_NCMBUTTONDOWN);
+ wparam |= (int)MsgButtons.MK_MBUTTON;
+ break;
+ }
+ msg.wParam = (IntPtr)wparam;
+
+ msg.lParam = (IntPtr) ((ushort)point.y << 16 | (ushort)point.x);
+ MousePosition.X = (int)point.x;
+ MousePosition.Y = (int)point.y;
+ NativeWindow.WndProc (msg.hwnd, msg.message, msg.wParam, msg.lParam);
+
+ TrackControl (handle, trackpoint, IntPtr.Zero);
+ return 0;
+ }
+ case OSXConstants.kEventControlSetFocusPart: {
+ // This handles setting focus
+ short pcode = 1;
+ GetEventParameter (inEvent, OSXConstants.EventParamName.kEventParamControlPart, OSXConstants.EventParamType.typeControlPartCode, IntPtr.Zero, (uint)Marshal.SizeOf (typeof (short)), IntPtr.Zero, ref pcode);
+ switch (pcode) {
+ case 0:
+ case -1:
+ case -2:
+ pcode = 0;
+ break;
+ }
+ SetEventParameter (inEvent, OSXConstants.EventParamName.kEventParamControlPart, OSXConstants.EventParamType.typeControlPartCode, (uint)Marshal.SizeOf (typeof (short)), ref pcode);
+ return 0;
+ }
+ }
+ return -9874;
+ }
+ private IntPtr GetMousewParam(int Delta) {
+ int result = 0;
+
+ if ((MouseState & MouseButtons.Left) != 0) {
+ result |= (int)MsgButtons.MK_LBUTTON;
+ }
+
+ if ((MouseState & MouseButtons.Middle) != 0) {
+ result |= (int)MsgButtons.MK_MBUTTON;
+ }
+
+ if ((MouseState & MouseButtons.Right) != 0) {
+ result |= (int)MsgButtons.MK_RBUTTON;
+ }
+
+ return (IntPtr)result;
+ }
+
+ private double NextTimeout ()
+ {
+ DateTime now = DateTime.Now;
+ int timeout = 0x7FFFFFF;
+ lock (TimerList) {
+ foreach (Timer timer in TimerList) {
+ int next = (int) (timer.Expires - now).TotalMilliseconds;
+ if (next < 0)
+ return 0;
+ if (next < timeout)
+ timeout = next;
+ }
+ }
+ if (timeout < Timer.Minimum)
+ timeout = Timer.Minimum;
+
+ return (double)((double)timeout/1000);
+ }
+
+ private void CheckTimers (DateTime now)
+ {
+ lock (TimerList) {
+ int count = TimerList.Count;
+ if (count == 0)
+ return;
+ for (int i = 0; i < TimerList.Count; i++) {
+ Timer timer = (Timer) TimerList [i];
+ if (timer.Enabled && timer.Expires <= now) {
+ timer.FireTick ();
+ timer.Update (now);
+ }
+ }
+ }
+ }
+
+ internal void InvertCaret () {
+ IntPtr window = GetControlOwner (Caret.Hwnd);
+ SetPortWindowPort (window);
+ Rect r = new Rect ();
+ GetWindowPortBounds (window, ref r);
+ r.top += (short)Caret.Y;
+ r.left += (short)Caret.X;
+ r.bottom = (short)(r.top + Caret.Height);
+ r.right = (short)(r.left + Caret.Width);
+ InvertRect (ref r);
+ }
+
+ private void SetHwndStyles(Hwnd hwnd, CreateParams cp) {
+ throw new NotImplementedException();
+ }
+
+ internal void ShowCaret () {
+ if (Caret.On)
+ return;
+ Caret.On = true;
+ InvertCaret ();
+ }
+
+ internal void HideCaret () {
+ if (!Caret.On)
+ return;
+ Caret.On = false;
+ InvertCaret ();
+ }
+
+ internal void InstallTracking (Hwnd hwnd) {
+ // This is currently not used
+
+ /*
+ if (hwnd.client_region_ptr != IntPtr.Zero) {
+ ReleaseMouseTrackingRegion (hwnd.client_region_ptr);
+ hwnd.client_region_ptr = IntPtr.Zero;
+ }
+ if (hwnd.whole_region_ptr != IntPtr.Zero) {
+ ReleaseMouseTrackingRegion (hwnd.whole_region_ptr);
+ hwnd.whole_region_ptr = IntPtr.Zero;
+ }
+ // Setup the new track region
+ if (hwnd.visible) {
+ HIRect client_bounds = new HIRect ();
+ HIViewGetBounds (hwnd.client_window, ref client_bounds);
+ HIViewConvertRect (ref client_bounds, hwnd.client_window, IntPtr.Zero);
+
+ IntPtr rgn = NewRgn ();
+ SetRectRgn (rgn, (short)client_bounds.origin.x, (short)client_bounds.origin.y, (short)(client_bounds.origin.x+hwnd.ClientRect.Width), (short)(client_bounds.origin.y+hwnd.ClientRect.Height));
+ CreateMouseTrackingRegion (GetControlOwner (hwnd.client_window), rgn, IntPtr.Zero, 0, hwnd.client_region_id, hwnd.client_window, IntPtr.Zero, ref hwnd.client_region_ptr);
+ Console.WriteLine (hwnd.ClientRect);
+ Console.WriteLine ("Created a mouse trcaking region on the client window @ {0}x{1} {2}x{3}", (short)client_bounds.origin.x, (short)client_bounds.origin.y, (short)(client_bounds.origin.x+hwnd.ClientRect.Width), (short)(client_bounds.origin.y+hwnd.ClientRect.Height));
+ if (hwnd.ClientRect.X > 0 && hwnd.ClientRect.Y > 0) {
+ HIRect window_bounds = new HIRect ();
+ HIViewGetBounds (hwnd.whole_window, ref window_bounds);
+ HIViewConvertRect (ref window_bounds, hwnd.whole_window, IntPtr.Zero);
+ rgn = NewRgn ();
+ SetRectRgn (rgn, (short)window_bounds.origin.x, (short)window_bounds.origin.y, (short)(window_bounds.origin.x+hwnd.ClientRect.X), (short)(window_bounds.origin.y+hwnd.ClientRect.Y));
+ CreateMouseTrackingRegion (GetControlOwner (hwnd.whole_window), rgn, IntPtr.Zero, 0, hwnd.whole_region_id, hwnd.whole_window, IntPtr.Zero, ref hwnd.whole_region_ptr);
+ Console.WriteLine ("Created a mouse trcaking region on the whole window @ {0}x{1} {2}x{3}", (short)window_bounds.origin.x, (short)window_bounds.origin.y, (short)(window_bounds.origin.x+hwnd.ClientRect.X), (short)(window_bounds.origin.y+hwnd.ClientRect.Y));
+ }
+ }
+ */
+ }
+
+ internal void CheckError (int result, string error) {
+ if (result != 0)
+ throw new Exception ("XplatUIOSX.cs::" + error + "() Carbon subsystem threw an error: " + result);
+ }
+
+ internal void CheckError (int result) {
+ if (result != 0)
+ throw new Exception ("XplatUIOSX.cs::Carbon subsystem threw an error: " + result);
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ internal override IntPtr InitializeDriver() {
+ return IntPtr.Zero;
+ }
+
+ internal override void ShutdownDriver(IntPtr token) {
+ }
+
+ internal override void EnableThemes() {
+ ThemesEnabled = true;
+ }
+
+ internal override void Activate(IntPtr handle) {
+ ActivateWindow (GetControlOwner (handle), true);
+ }
+
+ internal override void AudibleAlert() {
+ throw new NotImplementedException();
+ }
+
+ internal override void CaretVisible (IntPtr hwnd, bool visible) {
+ if (Caret.Hwnd == hwnd) {
+ if (visible) {
+ if (Caret.Visible < 1) {
+ Caret.Visible++;
+ Caret.On = false;
+ if (Caret.Visible == 1) {
+ ShowCaret ();
+ Caret.Timer.Start ();
+ }
+ }
+ } else {
+ Caret.Visible--;
+ if (Caret.Visible == 0) {
+ Caret.Timer.Stop ();
+ HideCaret ();
+ }
+ }
+ }
+ }
+
+ internal override bool CalculateWindowRect(IntPtr hWnd, ref Rectangle ClientRect, int Style, int ExStyle, Menu menu, out Rectangle WindowRect) {
+ FormBorderStyle border_style;
+ TitleStyle title_style;
+
+ title_style = TitleStyle.None;
+ if ((Style & (int)WindowStyles.WS_CAPTION) != 0) {
+ if ((ExStyle & (int)WindowStyles.WS_EX_TOOLWINDOW) != 0) {
+ title_style = TitleStyle.Tool;
+ } else {
+ title_style = TitleStyle.Normal;
+ }
+ }
+
+ border_style = FormBorderStyle.None;
+ if ((ExStyle & (int)WindowStyles.WS_EX_WINDOWEDGE) != 0) {
+ if ((ExStyle & (int)WindowStyles.WS_EX_TOOLWINDOW) != 0) {
+ if ((Style & (int)WindowStyles.WS_THICKFRAME) != 0) {
+ border_style = FormBorderStyle.SizableToolWindow;
+ } else {
+ border_style = FormBorderStyle.FixedToolWindow;
+ }
+ } else if ((ExStyle & (int)WindowStyles.WS_EX_DLGMODALFRAME) != 0) {
+ border_style = FormBorderStyle.FixedDialog;
+ } else if ((ExStyle & (int)WindowStyles.WS_THICKFRAME) != 0) {
+ border_style = FormBorderStyle.Sizable;
+ } else {
+ border_style = FormBorderStyle.FixedSingle;
+ }
+ } else {
+ border_style = FormBorderStyle.Fixed3D;
+ }
+
+ WindowRect = Hwnd.GetWindowRectangle(border_style, menu, title_style,
+ SystemInformation.CaptionHeight,
+ SystemInformation.ToolWindowCaptionHeight, ClientRect);
+
+ return true;
+ }
+
+ internal override void ClientToScreen(IntPtr handle, ref int x, ref int y) {
+ CGPoint pt = new CGPoint ();
+ Rect wBounds = new Rect ();
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+ pt.x = x;
+ pt.y = y;
+
+ GetWindowBounds (GetControlOwner (hwnd.client_window), 32, ref wBounds);
+ HIViewConvertPoint (ref pt, handle, IntPtr.Zero);
+
+ x = (int)(pt.x+wBounds.left);
+ y = (int)(pt.y+wBounds.top);
+ }
+
+ internal override int[] ClipboardAvailableFormats(IntPtr handle) {
+ return null;
+ }
+
+ internal override void ClipboardClose(IntPtr handle) {
+ throw new NotImplementedException();
+ }
+
+ internal override int ClipboardGetID(IntPtr handle, string format) {
+ return 0;
+ }
+
+ internal override IntPtr ClipboardOpen() {
+ throw new NotImplementedException();
+ }
+
+ internal override object ClipboardRetrieve(IntPtr handle, int id, XplatUI.ClipboardToObject converter) {
+ throw new NotImplementedException();
+ }
+
+ internal override void ClipboardStore(IntPtr handle, object obj, int type, XplatUI.ObjectToClipboard converter) {
+ throw new NotImplementedException();
+ }
+
+ internal override void CreateCaret (IntPtr hwnd, int width, int height) {
+ if (Caret.Hwnd != IntPtr.Zero)
+ DestroyCaret (Caret.Hwnd);
+
+ Caret.Hwnd = hwnd;
+ Caret.Width = width;
+ Caret.Height = height;
+ Caret.Visible = 0;
+ Caret.On = false;
+ }
+
+ internal override IntPtr CreateWindow(CreateParams cp) {
+ IntPtr windowHnd = IntPtr.Zero;
+ IntPtr parentHnd = cp.Parent;
+ bool realWindow = false;
+ Rectangle clientRect;
+ Hwnd hwnd = new Hwnd ();
+
+ SetHwndStyles (hwnd, cp);
+
+ if (parentHnd == IntPtr.Zero) {
+ if ((cp.Style & (int)(WindowStyles.WS_CHILD))!=0) {
+ // This is a child view that is going to be parentless;
+ realWindow = false;
+ CheckError (HIViewFindByID (HIViewGetRoot (FosterParent), new HIViewID (OSXConstants.kEventClassWindow, 1), ref parentHnd), "HIViewFindByID ()");
+ } else if ((cp.Style & (int)(WindowStyles.WS_POPUP))!=0) {
+ // This is a popup window that will be real.
+ if (cp.X < 1) cp.X = 0;
+ if (cp.Y < 1) cp.Y = 0;
+ realWindow = true;
+ } else {
+ // This is a real root window too
+ if (cp.X < 1) cp.X = 0;
+ if (cp.Y < 1) cp.Y = 0;
+ realWindow = true;
+ }
+ } else {
+ realWindow = false;
+ }
+
+ if (realWindow) {
+ WindowClass windowklass = WindowClass.kOverlayWindowClass;
+ WindowAttributes attributes = WindowAttributes.kWindowCompositingAttribute | WindowAttributes.kWindowStandardHandlerAttribute;
+ if ((cp.Style & ((int)WindowStyles.WS_MINIMIZEBOX)) != 0) {
+ attributes |= WindowAttributes.kWindowCollapseBoxAttribute;
+ }
+ if ((cp.Style & ((int)WindowStyles.WS_MAXIMIZEBOX)) != 0) {
+ attributes |= WindowAttributes.kWindowResizableAttribute | WindowAttributes.kWindowHorizontalZoomAttribute | WindowAttributes.kWindowVerticalZoomAttribute;
+ }
+ if ((cp.Style & ((int)WindowStyles.WS_SYSMENU)) != 0) {
+ attributes |= WindowAttributes.kWindowCloseBoxAttribute;
+ }
+ if ((cp.ExStyle & ((int)WindowStyles.WS_EX_TOOLWINDOW)) != 0) {
+ attributes = WindowAttributes.kWindowStandardHandlerAttribute | WindowAttributes.kWindowCompositingAttribute;
+ }
+ if ((cp.Style & ((int)WindowStyles.WS_CAPTION)) != 0) {
+ windowklass = WindowClass.kDocumentWindowClass;
+ }
+
+ IntPtr rect = IntPtr.Zero;
+ IntPtr viewHnd = IntPtr.Zero;
+ SetRect (ref rect, (short)cp.X, (short)(cp.Y + MenuBarHeight + TitleBarHeight), (short)(cp.Width+cp.X), (short)(cp.Height+cp.Y+MenuBarHeight+TitleBarHeight));
+ CheckError (CreateNewWindow (windowklass, attributes, ref rect, ref windowHnd), "CreateNewWindow ()");
+
+ CheckError (InstallEventHandler (GetWindowEventTarget (windowHnd), CarbonEventHandler, (uint)windowEvents.Length, windowEvents, windowHnd, IntPtr.Zero), "InstallEventHandler ()");
+ CheckError (HIViewFindByID (HIViewGetRoot (windowHnd), new HIViewID (OSXConstants.kEventClassWindow, 1), ref viewHnd), "HIViewFindByID ()");
+ parentHnd = viewHnd;
+ }
+ hwnd.X = cp.X;
+ hwnd.Y = cp.Y;
+ hwnd.Width = cp.Width;
+ hwnd.Height = cp.Height;
+ hwnd.Parent = Hwnd.ObjectFromHandle (cp.Parent);
+ hwnd.visible = false;
+ clientRect = hwnd.ClientRect;
+
+ HIRect r = new HIRect (0, 0, cp.Width, cp.Height);
+ CheckError (HIObjectCreate (__CFStringMakeConstantString ("com.apple.hiview"), 0, ref hwnd.whole_window), "HIObjectCreate ()");
+ CheckError (InstallEventHandler (GetControlEventTarget (hwnd.whole_window), CarbonEventHandler, (uint)viewEvents.Length, viewEvents, hwnd.whole_window, IntPtr.Zero), "InstallEventHandler ()");
+ CheckError (HIViewChangeFeatures (hwnd.whole_window, 1 << 1, 0), "HIViewChangeFeatures ()");
+ CheckError (HIViewSetFrame (hwnd.whole_window, ref r), "HIViewSetFrame ()");
+ hwnd.WholeWindow = hwnd.whole_window;
+
+ r = new HIRect (0, 0, clientRect.Width, clientRect.Height);
+ CheckError (HIObjectCreate (__CFStringMakeConstantString ("com.apple.hiview"), 0, ref hwnd.client_window), "HIObjectCreate ()");
+ CheckError (InstallEventHandler (GetControlEventTarget (hwnd.client_window), CarbonEventHandler, (uint)viewEvents.Length, viewEvents, hwnd.client_window, IntPtr.Zero), "InstallEventHandler ()");
+ CheckError (HIViewChangeFeatures (hwnd.client_window, 1 << 1, 0), "HIViewChangeFeatures ()");
+ CheckError (HIViewSetFrame (hwnd.client_window, ref r), "HIViewSetFrame ()");
+ hwnd.ClientWindow = hwnd.client_window;
+
+ CheckError (HIViewAddSubview (hwnd.whole_window, hwnd.client_window));
+ CheckError (HIViewPlaceInSuperviewAt (hwnd.client_window, clientRect.X, clientRect.Y));
+
+ if (parentHnd != IntPtr.Zero && parentHnd != hwnd.WholeWindow) {
+ CheckError (HIViewAddSubview (parentHnd, hwnd.whole_window), "HIViewAddSubview ()");
+ CheckError (HIViewPlaceInSuperviewAt (hwnd.whole_window, cp.X, cp.Y), "HIPlaceInSuperviewAt ()");
+ if ((cp.Style & (int)(WindowStyles.WS_VISIBLE))!=0) {
+ CheckError (HIViewSetVisible (hwnd.whole_window, true), "HIViewSetVisible ()");
+ CheckError (HIViewSetVisible (hwnd.client_window, true), "HIViewSetVisible ()");
+ hwnd.visible = true;
+ } else {
+ CheckError (HIViewSetVisible (hwnd.whole_window, false), "HIViewSetVisible ()");
+ CheckError (HIViewSetVisible (hwnd.client_window, false), "HIViewSetVisible ()");
+ hwnd.visible = false;
+ }
+ }
+ if (realWindow) {
+ WindowMapping [hwnd.Handle] = windowHnd;
+ if ((cp.Style & (int)(WindowStyles.WS_VISIBLE))!=0) {
+ CheckError (ShowWindow (windowHnd));
+ CheckError (HIViewSetVisible (hwnd.whole_window, true), "HIViewSetVisible ()");
+ CheckError (HIViewSetVisible (hwnd.client_window, true), "HIViewSetVisible ()");
+ hwnd.visible = true;
+ }
+ if ((cp.Style & (int)(WindowStyles.WS_POPUP))!=0) {
+ CheckError (HIViewSetVisible (hwnd.whole_window, true), "HIViewSetVisible ()");
+ CheckError (HIViewSetVisible (hwnd.client_window, true), "HIViewSetVisible ()");
+ hwnd.visible = true;
+ }
+ }
+
+ return hwnd.Handle;
+ }
+
+ internal override IntPtr CreateWindow(IntPtr Parent, int X, int Y, int Width, int Height) {
+ CreateParams create_params = new CreateParams();
+
+ create_params.Caption = "";
+ create_params.X = X;
+ create_params.Y = Y;
+ create_params.Width = Width;
+ create_params.Height = Height;
+
+ create_params.ClassName=XplatUI.DefaultClassName;
+ create_params.ClassStyle = 0;
+ create_params.ExStyle=0;
+ create_params.Parent=IntPtr.Zero;
+ create_params.Param=0;
+
+ return CreateWindow(create_params);
+ }
+
+ [MonoTODO]
+ internal override IntPtr DefineCursor(Bitmap bitmap, Bitmap mask, Color cursor_pixel, Color mask_pixel, int xHotSpot, int yHotSpot) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ internal override IntPtr DefineStdCursor(StdCursor id) {
+ switch (id) {
+ case StdCursor.AppStarting:
+ return (IntPtr)ThemeCursor.kThemeSpinningCursor;
+ case StdCursor.Arrow:
+ return (IntPtr)ThemeCursor.kThemeArrowCursor;
+ case StdCursor.Cross:
+ return (IntPtr)ThemeCursor.kThemeCrossCursor;
+ case StdCursor.Default:
+ return (IntPtr)ThemeCursor.kThemeArrowCursor;
+ case StdCursor.Hand:
+ return (IntPtr)ThemeCursor.kThemeOpenHandCursor;
+ case StdCursor.Help:
+ return (IntPtr)ThemeCursor.kThemeArrowCursor;
+ case StdCursor.HSplit:
+ return (IntPtr)ThemeCursor.kThemeResizeLeftRightCursor;
+ case StdCursor.IBeam:
+ return (IntPtr)ThemeCursor.kThemeIBeamCursor;
+ case StdCursor.No:
+ return (IntPtr)ThemeCursor.kThemeNotAllowedCursor;
+ case StdCursor.NoMove2D:
+ return (IntPtr)ThemeCursor.kThemeNotAllowedCursor;
+ case StdCursor.NoMoveHoriz:
+ return (IntPtr)ThemeCursor.kThemeNotAllowedCursor;
+ case StdCursor.NoMoveVert:
+ return (IntPtr)ThemeCursor.kThemeNotAllowedCursor;
+ case StdCursor.PanEast:
+ return (IntPtr)ThemeCursor.kThemeResizeRightCursor;
+ case StdCursor.PanNE:
+ return (IntPtr)ThemeCursor.kThemeArrowCursor;
+ case StdCursor.PanNorth:
+ return (IntPtr)ThemeCursor.kThemeArrowCursor;
+ case StdCursor.PanNW:
+ return (IntPtr)ThemeCursor.kThemeArrowCursor;
+ case StdCursor.PanSE:
+ return (IntPtr)ThemeCursor.kThemeArrowCursor;
+ case StdCursor.PanSouth:
+ return (IntPtr)ThemeCursor.kThemeArrowCursor;
+ case StdCursor.PanSW:
+ return (IntPtr)ThemeCursor.kThemeArrowCursor;
+ case StdCursor.PanWest:
+ return (IntPtr)ThemeCursor.kThemeResizeLeftCursor;
+ case StdCursor.SizeAll:
+ return (IntPtr)ThemeCursor.kThemeResizeLeftRightCursor;
+ case StdCursor.SizeNESW:
+ return (IntPtr)ThemeCursor.kThemeArrowCursor;
+ case StdCursor.SizeNS:
+ return (IntPtr)ThemeCursor.kThemeArrowCursor;
+ case StdCursor.SizeNWSE:
+ return (IntPtr)ThemeCursor.kThemeArrowCursor;
+ case StdCursor.SizeWE:
+ return (IntPtr)ThemeCursor.kThemeArrowCursor;
+ case StdCursor.UpArrow:
+ return (IntPtr)ThemeCursor.kThemeArrowCursor;
+ case StdCursor.VSplit:
+ return (IntPtr)ThemeCursor.kThemeArrowCursor;
+ case StdCursor.WaitCursor:
+ return (IntPtr)ThemeCursor.kThemeSpinningCursor;
+ default:
+ return (IntPtr)ThemeCursor.kThemeArrowCursor;
+ }
+ }
+
+ internal override IntPtr DefWndProc(ref Message msg) {
+ Hwnd hwnd = Hwnd.ObjectFromHandle (msg.HWnd);
+ switch ((Msg)msg.Msg) {
+ case Msg.WM_DESTROY: {
+ if (WindowMapping [hwnd.Handle] != null)
+
+ Exit ();
+ break;
+ }
+ }
+ return IntPtr.Zero;
+ }
+
+ internal override void DestroyCaret (IntPtr hwnd) {
+ if (Caret.Hwnd == hwnd) {
+ if (Caret.Visible == 1) {
+ Caret.Timer.Stop ();
+ HideCaret ();
+ }
+ Caret.Hwnd = IntPtr.Zero;
+ Caret.Visible = 0;
+ Caret.On = false;
+ }
+ }
+
+ [MonoTODO]
+ internal override void DestroyCursor(IntPtr cursor) {
+ throw new NotImplementedException ();
+ }
+
+ internal override void DestroyWindow(IntPtr handle) {
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+ if ((hwnd.whole_window != IntPtr.Zero) && HIViewGetSuperview (hwnd.whole_window) != IntPtr.Zero)
+ CheckError (HIViewRemoveFromSuperview (handle), "HIViewRemoveFromSuperview ()");
+
+ if (WindowMapping [hwnd.Handle] != null) {
+ DisposeWindow ((IntPtr)(WindowMapping [hwnd.Handle]));
+ }
+ CFRelease (hwnd.ClientWindow);
+ CFRelease (hwnd.WholeWindow);
+ }
+
+ internal override IntPtr DispatchMessage(ref MSG msg) {
+ return NativeWindow.WndProc(msg.hwnd, msg.message, msg.wParam, msg.lParam);
+ }
+
+ internal override void DoEvents() {
+ }
+
+ internal override void EnableWindow(IntPtr handle, bool Enable) {
+ //Like X11 we need not do anything here
+ }
+
+ internal override void EndLoop(Thread thread) {
+ throw new NotImplementedException();
+ }
+
+ internal void Exit() {
+ GetMessageResult = false;
+ ExitToShell ();
+ }
+
+ internal override IntPtr GetActive() {
+ foreach (DictionaryEntry entry in WindowMapping)
+ if (IsWindowActive ((IntPtr)(entry.Value)))
+ return (IntPtr)(entry.Key);
+
+ return IntPtr.Zero;
+ }
+
+ [MonoTODO]
+ internal override void GetCursorInfo(IntPtr cursor, out int width, out int height, out int hotspot_x, out int hotspot_y) {
+ throw new NotImplementedException ();
+ }
+
+ internal override void GetDisplaySize(out Size size) {
+ HIRect bounds = CGDisplayBounds (CGMainDisplayID ());
+ size = new Size ((int)bounds.size.width, (int)bounds.size.height);
+ }
+
+ internal override IntPtr GetParent(IntPtr handle) {
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+ if (hwnd != null && hwnd.parent != null) {
+ return hwnd.parent.Handle;
+ }
+ return IntPtr.Zero;
+ }
+
+ internal override void GetCursorPos(IntPtr handle, out int x, out int y) {
+ QDPoint pt = new QDPoint ();
+ GetGlobalMouse (ref pt);
+ x = pt.x;
+ y = pt.y;
+ }
+
+ internal override bool GetFontMetrics(Graphics g, Font font, out int ascent, out int descent) {
+ return GetFontMetrics(g.GetHdc(), font.ToHfont(), out ascent, out descent);
+ }
+
+ [MonoTODO]
+ internal override Graphics GetMenuDC(IntPtr hwnd, IntPtr ncpaint_region) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ internal override Point GetMenuOrigin(IntPtr hwnd) {
+ throw new NotImplementedException();
+ }
+
+ internal override bool GetMessage(ref MSG msg, IntPtr hWnd, int wFilterMin, int wFilterMax) {
+ IntPtr evtRef = IntPtr.Zero;
+ IntPtr target = GetEventDispatcherTarget();
+ CheckTimers (DateTime.Now);
+ ReceiveNextEvent (0, IntPtr.Zero, 0, true, ref evtRef);
+ if (evtRef != IntPtr.Zero && target != IntPtr.Zero) {
+ SendEventToEventTarget (evtRef, target);
+ ReleaseEvent (evtRef);
+ }
+
+ lock (MessageQueue) {
+ if (MessageQueue.Count <= 0) {
+ if (Idle != null)
+ Idle (this, EventArgs.Empty);
+ else if (TimerList.Count == 0) {
+ ReceiveNextEvent (0, IntPtr.Zero, Convert.ToDouble ("0." + Timer.Minimum), true, ref evtRef);
+ if (evtRef != IntPtr.Zero && target != IntPtr.Zero) {
+ SendEventToEventTarget (evtRef, target);
+ ReleaseEvent (evtRef);
+ }
+ } else {
+ ReceiveNextEvent (0, IntPtr.Zero, NextTimeout (), true, ref evtRef);
+ if (evtRef != IntPtr.Zero && target != IntPtr.Zero) {
+ SendEventToEventTarget (evtRef, target);
+ ReleaseEvent (evtRef);
+ }
+ }
+ msg.hwnd = IntPtr.Zero;
+ msg.message = Msg.WM_ENTERIDLE;
+ return GetMessageResult;
+ }
+ msg = (MSG) MessageQueue.Dequeue ();
+ }
+ return GetMessageResult;
+ }
+
+ [MonoTODO]
+ internal override bool GetText(IntPtr handle, out string text) {
+ throw new NotImplementedException ();
+ }
+
+ internal override void GetWindowPos(IntPtr handle, bool is_toplevel, out int x, out int y, out int width, out int height, out int client_width, out int client_height) {
+ Hwnd hwnd = Hwnd.ObjectFromHandle (handle);
+ Rectangle rect = hwnd.ClientRect;
+
+ x = hwnd.x;
+ y = hwnd.y;
+ width = hwnd.width;
+ height = hwnd.height;
+
+ client_width = rect.Width;
+ client_height = rect.Height;
+ }
+
+ internal override FormWindowState GetWindowState(IntPtr hwnd) {
+ IntPtr window = GetControlOwner (hwnd);
+
+ if (IsWindowCollapsed (window))
+ return FormWindowState.Minimized;
+ if (IsWindowInStandardState (window, IntPtr.Zero, IntPtr.Zero))
+ return FormWindowState.Maximized;
+
+ return FormWindowState.Normal;
+ }
+
+ internal override void GrabInfo(out IntPtr handle, out bool GrabConfined, out Rectangle GrabArea) {
+ handle = Grab.Hwnd;
+ GrabConfined = Grab.Confined;
+ GrabArea = Grab.Area;
+ }
+
+ internal override void GrabWindow(IntPtr handle, IntPtr confine_to_handle) {
+ GrabWindowHwnd = Hwnd.ObjectFromHandle (handle);
+ }
+
+ internal override void UngrabWindow(IntPtr hwnd) {
+ GrabWindowHwnd = null;
+ Grab.Hwnd = IntPtr.Zero;
+ Grab.Confined = false;
+ }
+
+ internal override void HandleException(Exception e) {
+ StackTrace st = new StackTrace(e);
+ Console.WriteLine("Exception '{0}'", e.Message+st.ToString());
+ Console.WriteLine("{0}{1}", e.Message, st.ToString());
+ }
+
+ internal override void Invalidate (IntPtr handle, Rectangle rc, bool clear) {
+ Hwnd hwnd = Hwnd.ObjectFromHandle (handle);
+
+ if (hwnd.visible && HIViewIsVisible (handle)) {
+ MSG msg = new MSG ();
+ msg.hwnd = hwnd.Handle;
+ msg.wParam = IntPtr.Zero;
+ msg.lParam = IntPtr.Zero;
+ msg.message = Msg.WM_PAINT;
+ MessageQueue.Enqueue (msg);
+ // This is currently causing some graphics corruption
+ //hwnd.AddInvalidArea (rc.X, rc.Y, rc.Width, rc.Height);
+ hwnd.AddInvalidArea (0, 0, hwnd.ClientRect.Width, hwnd.ClientRect.Height);
+ hwnd.expose_pending = true;
+ }
+ }
+
+ internal override bool IsEnabled(IntPtr handle) {
+ return Hwnd.ObjectFromHandle(handle).Enabled;
+ }
+
+ internal override bool IsVisible(IntPtr handle) {
+ return Hwnd.ObjectFromHandle(handle).visible;
+ }
+
+ internal override void KillTimer(Timer timer) {
+ lock (TimerList) {
+ TimerList.Remove(timer);
+ }
+ }
+
+ internal override void MenuToScreen(IntPtr handle, ref int x, ref int y) {
+ CGPoint pt = new CGPoint ();
+ Rect wBounds = new Rect ();
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+ pt.x = x;
+ pt.y = y;
+
+ GetWindowBounds (GetControlOwner (hwnd.whole_window), 32, ref wBounds);
+ HIViewConvertPoint (ref pt, handle, IntPtr.Zero);
+
+ x = (int)(pt.x+wBounds.left);
+ y = (int)(pt.y+wBounds.top);
+ }
+
+ [MonoTODO]
+ internal override void OverrideCursor(IntPtr cursor) {
+ throw new NotImplementedException ();
+ }
+
+ internal override PaintEventArgs PaintEventStart(IntPtr handle, bool client) {
+ PaintEventArgs paint_event;
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+ if (Caret.Visible == 1) {
+ Caret.Paused = true;
+ HideCaret();
+ }
+
+ hwnd.client_dc = Graphics.FromHwnd (hwnd.client_window);
+ paint_event = new PaintEventArgs(hwnd.client_dc, hwnd.invalid);
+
+ return paint_event;
+ }
+
+ internal override void PaintEventEnd(IntPtr handle, bool client) {
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+ hwnd.ClearInvalidArea();
+
+ hwnd.client_dc.Flush();
+ hwnd.client_dc.Dispose();
+ hwnd.client_dc = null;
+ hwnd.expose_pending = false;
+
+ if (Caret.Visible == 1) {
+ ShowCaret();
+ Caret.Paused = false;
+ }
+ }
+
+ internal override bool PeekMessage(ref MSG msg, IntPtr hWnd, int wFilterMin, int wFilterMax, uint flags) {
+ Console.WriteLine("XplatUIOSX.PeekMessage");
+ return true;
+ }
+
+ internal override bool PostMessage (IntPtr hwnd, Msg message, IntPtr wParam, IntPtr lParam) {
+ MSG msg = new MSG();
+ msg.hwnd = hwnd;
+ msg.message = message;
+ msg.wParam = wParam;
+ msg.lParam = lParam;
+ MessageQueue.Enqueue (msg);
+ return true;
+ }
+
+ [MonoTODO]
+ internal override void PostQuitMessage(int exitCode) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ internal override void ReleaseMenuDC(IntPtr hwnd, Graphics dc) {
+ throw new NotImplementedException();
+ }
+
+ internal override void ScreenToClient(IntPtr handle, ref int x, ref int y) {
+ CGPoint pt = new CGPoint ();
+ Rect wBounds = new Rect ();
+
+ GetWindowBounds (GetControlOwner (handle), 32, ref wBounds);
+ pt.x = (x-wBounds.left);
+ pt.y = (y-wBounds.top);
+ HIViewConvertPoint (ref pt, IntPtr.Zero, handle);
+
+ x = (int)pt.x;
+ y = (int)pt.y;
+ }
+
+ [MonoTODO]
+ internal override void ScreenToMenu(IntPtr handle, ref int x, ref int y) {
+ CGPoint pt = new CGPoint ();
+ Rect wBounds = new Rect ();
+
+ GetWindowBounds (GetControlOwner (handle), 32, ref wBounds);
+ pt.x = (x-wBounds.left);
+ pt.y = (y-wBounds.top);
+ HIViewConvertPoint (ref pt, IntPtr.Zero, handle);
+
+ x = (int)pt.x;
+ y = (int)pt.y;
+ }
+
+ internal override void ScrollWindow(IntPtr handle, Rectangle area, int XAmount, int YAmount, bool clear) {
+ //IntPtr rect = IntPtr.Zero;
+ //HIRect vBounds = new HIRect ();
+
+ Hwnd hwnd = Hwnd.ObjectFromHandle(handle);
+
+ /*
+ if (hwnd.invalid != Rectangle.Empty) {
+ // BIG FAT WARNING. This only works with how we use this function right now
+ // where we basically still scroll the whole window, but work around areas
+ // that are covered by our children
+
+ hwnd.invalid.X += XAmount;
+ hwnd.invalid.Y += YAmount;
+
+ if (hwnd.invalid.X < 0) {
+ hwnd.invalid.Width += hwnd.invalid.X;
+ hwnd.invalid.X =0;
+ }
+
+ if (hwnd.invalid.Y < 0) {
+ hwnd.invalid.Height += hwnd.invalid.Y;
+ hwnd.invalid.Y =0;
+ }
+ }*/
+
+ HIRect scrollrect = new HIRect ();
+ scrollrect.origin.x = area.X;
+ scrollrect.origin.y = area.Y;
+ scrollrect.size.width = area.Width;
+ scrollrect.size.height = area.Height;
+ HIViewScrollRect (hwnd.Handle, ref scrollrect, (float)XAmount, (float)-YAmount);
+ /*
+ HIViewGetBounds (hwnd.client_window, ref vBounds);
+ HIViewConvertRect (ref vBounds, hwnd.client_window, IntPtr.Zero);
+ SetRect (ref rect, (short)(vBounds.origin.x+area.X), (short)(vBounds.origin.y-TitleBarHeight+area.Y), (short)(vBounds.origin.x+area.Width), (short)(vBounds.origin.y+area.Height-TitleBarHeight));
+ ScrollRect (ref rect, (short)XAmount, (short)-YAmount, IntPtr.Zero);
+ */
+ // Generate an expose for the area exposed by the horizontal scroll
+ /*
+ if (XAmount > 0) {
+ hwnd.AddInvalidArea (area.X, area.Y, XAmount, area.Height);
+ } else if (XAmount < 0) {
+ hwnd.AddInvalidArea (XAmount + area.X + area.Width, area.Y, -XAmount, area.Height);
+ }
+
+ // Generate an expose for the area exposed by the vertical scroll
+ if (YAmount > 0) {
+ hwnd.AddInvalidArea (area.X, area.Y, area.Width, YAmount);
+ } else if (YAmount < 0) {
+ hwnd.AddInvalidArea (area.X, YAmount + area.Y + area.Height, area.Width, -YAmount);
+ }
+
+ UpdateWindow (handle);
+ */
+ }
+
+
+ internal override void ScrollWindow(IntPtr hwnd, int XAmount, int YAmount, bool clear) {
+ throw new NotImplementedException("");
+ }
+
+ [MonoTODO]
+ internal override void SendAsyncMethod (AsyncMethodData method) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ internal override IntPtr SendMessage (IntPtr hwnd, Msg message, IntPtr wParam, IntPtr lParam) {
+ throw new NotImplementedException ();
+ }
+
+ internal override void SetCaretPos (IntPtr hwnd, int x, int y) {
+ if (Caret.Hwnd == hwnd) {
+ CGPoint cpt = new CGPoint ();
+ cpt.x = x;
+ cpt.y = y;
+ HIViewConvertPoint (ref cpt, hwnd, IntPtr.Zero);
+ Caret.Timer.Stop ();
+ HideCaret ();
+ Caret.X = (int)cpt.x;
+ Caret.Y = (int)cpt.y-23;
+ if (Caret.Visible == 1) {
+ ShowCaret ();
+ Caret.Timer.Start ();
+ }
+ }
+ }
+
+ internal override void SetCursor(IntPtr window, IntPtr cursor) {
+ SetThemeCursor ((uint) cursor);
+ }
+
+ internal override void SetCursorPos(IntPtr handle, int x, int y) {
+ CGDisplayMoveCursorToPoint (CGMainDisplayID (), new CGPoint (x, y));
+ }
+
+ internal override void SetFocus(IntPtr handle) {
+ if (FocusWindow != IntPtr.Zero) {
+ PostMessage(FocusWindow, Msg.WM_KILLFOCUS, handle, IntPtr.Zero);
+ }
+ PostMessage(handle, Msg.WM_SETFOCUS, FocusWindow, IntPtr.Zero);
+ FocusWindow = handle;
+ }
+
+ [MonoTODO]
+ internal override void SetIcon(IntPtr handle, Icon icon) {
+ throw new NotImplementedException();
+ }
+
+
+ internal override void SetModal(IntPtr handle, bool Modal) {
+ IntPtr hWnd = GetControlOwner (Hwnd.ObjectFromHandle (handle).WholeWindow);
+ if (Modal)
+ BeginAppModalStateForWindow (hWnd);
+ else
+ EndAppModalStateForWindow (hWnd);
+ return;
+ }
+
+ internal override IntPtr SetParent(IntPtr handle, IntPtr parent) {
+ Hwnd hwnd = Hwnd.ObjectFromHandle (handle);
+
+ hwnd.parent = Hwnd.ObjectFromHandle (parent);
+ if (HIViewGetSuperview (hwnd.whole_window) != IntPtr.Zero) {
+ CheckError (HIViewRemoveFromSuperview (hwnd.whole_window), "HIViewRemoveFromSuperview ()");
+ }
+ CheckError (HIViewAddSubview (hwnd.parent.client_window, hwnd.whole_window));
+ CheckError (HIViewAddSubview (hwnd.whole_window, hwnd.client_window));
+ HIViewPlaceInSuperviewAt (hwnd.client_window, hwnd.ClientRect.X, hwnd.ClientRect.Y);
+
+ return IntPtr.Zero;
+ }
+
+ internal override void SetTimer (Timer timer) {
+ lock (TimerList) {
+ TimerList.Add (timer);
+ }
+ }
+
+ internal override bool SetTopmost(IntPtr hWnd, IntPtr hWndOwner, bool Enabled) {
+ HIViewSetZOrder (hWnd, 1, IntPtr.Zero);
+ return true;
+ }
+
+
+ internal override bool SetVisible(IntPtr handle, bool visible) {
+ Hwnd hwnd = Hwnd.ObjectFromHandle (handle);
+ object window = WindowMapping [hwnd.Handle];
+ if (window != null)
+ if (visible)
+ ShowWindow ((IntPtr)window);
+ else
+ HideWindow ((IntPtr)window);
+
+ HIViewSetVisible (hwnd.whole_window, visible);
+ HIViewSetVisible (hwnd.client_window, visible);
+ hwnd.visible = visible;
+ return true;
+ }
+
+ internal override void SetBorderStyle(IntPtr handle, FormBorderStyle border_style) {
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+ hwnd.border_style = border_style;
+
+ // FIXME - do we need to trigger some resize?
+ }
+
+ internal override void SetMenu(IntPtr handle, Menu menu) {
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+ hwnd.menu = menu;
+
+ // FIXME - do we need to trigger some resize?
+ }
+
+ internal override void SetWindowPos(IntPtr handle, int x, int y, int width, int height) {
+ Hwnd hwnd = Hwnd.ObjectFromHandle (handle);
+ Rectangle client_rect = Hwnd.GetClientRectangle(hwnd.border_style, hwnd.menu,
+ hwnd.title_style, SystemInformation.CaptionHeight,
+ SystemInformation.ToolWindowCaptionHeight, width, height);
+
+ // Save a server roundtrip (and prevent a feedback loop)
+ if ((hwnd.x == x) && (hwnd.y == y) && (hwnd.width == width) && (hwnd.height == height)) {
+ return;
+ }
+
+
+ if (WindowMapping [hwnd.Handle] != null) {
+ if (y <= MenuBarHeight+TitleBarHeight) {
+ y+=MenuBarHeight+TitleBarHeight;
+ }
+ IntPtr rect = IntPtr.Zero;
+ SetRect (ref rect, (short)x, (short)y, (short)(x+width), (short)(y+height));
+ CheckError (SetWindowBounds ((IntPtr) WindowMapping [hwnd.Handle], 33, ref rect), "SetWindowBounds ()");
+ HIRect r = new HIRect (0, 0, width, height);
+ CheckError (HIViewSetFrame (hwnd.whole_window, ref r), "HIViewSetFrame ()");
+ r = new HIRect (client_rect.X, client_rect.Y, client_rect.X+client_rect.Width, client_rect.Y+client_rect.Height);
+ CheckError (HIViewSetFrame (hwnd.client_window, ref r), "HIViewSetFrame ()");
+ } else {
+ HIRect r = new HIRect (x, y, width, height);
+ CheckError (HIViewSetFrame (hwnd.whole_window, ref r), "HIViewSetFrame ()");
+ r = new HIRect (client_rect.X, client_rect.Y, client_rect.X+client_rect.Width, client_rect.Y+client_rect.Height);
+ CheckError (HIViewSetFrame (hwnd.client_window, ref r), "HIViewSetFrame ()");
+ }
+ }
+
+ internal override void SetWindowState(IntPtr hwnd, FormWindowState state) {
+ IntPtr window = GetControlOwner (hwnd);
+
+ switch (state) {
+ case FormWindowState.Minimized: {
+ CollapseWindow (window, true);
+ break;
+ }
+ case FormWindowState.Normal: {
+ ZoomWindow (window, 7, false);
+ break;
+ }
+ case FormWindowState.Maximized: {
+ ZoomWindow (window, 8, false);
+ break;
+ }
+ }
+ }
+
+ internal override void SetWindowStyle(IntPtr handle, CreateParams cp) {
+ Hwnd hwnd = Hwnd.ObjectFromHandle (handle);
+ SetHwndStyles(hwnd, cp);
+
+ if (WindowMapping [hwnd.Handle] != null) {
+ WindowAttributes attributes = WindowAttributes.kWindowCompositingAttribute | WindowAttributes.kWindowStandardHandlerAttribute;
+ if ((cp.Style & ((int)WindowStyles.WS_MINIMIZEBOX)) != 0) {
+ attributes |= WindowAttributes.kWindowCollapseBoxAttribute;
+ }
+ if ((cp.Style & ((int)WindowStyles.WS_MAXIMIZEBOX)) != 0) {
+ attributes |= WindowAttributes.kWindowResizableAttribute | WindowAttributes.kWindowHorizontalZoomAttribute | WindowAttributes.kWindowVerticalZoomAttribute;
+ }
+ if ((cp.Style & ((int)WindowStyles.WS_SYSMENU)) != 0) {
+ attributes |= WindowAttributes.kWindowCloseBoxAttribute;
+ }
+ if ((cp.ExStyle & ((int)WindowStyles.WS_EX_TOOLWINDOW)) != 0) {
+ attributes = WindowAttributes.kWindowStandardHandlerAttribute | WindowAttributes.kWindowCompositingAttribute;
+ }
+
+ WindowAttributes outAttributes = WindowAttributes.kWindowNoAttributes;
+ GetWindowAttributes ((IntPtr)WindowMapping [hwnd.Handle], ref outAttributes);
+ ChangeWindowAttributes ((IntPtr)WindowMapping [hwnd.Handle], attributes, outAttributes);
+ }
+ }
+
+ internal override void SetWindowTransparency(IntPtr handle, double transparency, Color key) {
+ }
+
+ internal override bool SupportsTransparency() {
+ return false;
+ }
+
+ internal override bool SetZOrder(IntPtr handle, IntPtr after_handle, bool Top, bool Bottom) {
+ Hwnd hwnd = Hwnd.ObjectFromHandle (handle);
+
+ if (Top) {
+ HIViewSetZOrder (hwnd.whole_window, 2, IntPtr.Zero);
+ return true;
+ } else if (!Bottom) {
+ Hwnd after_hwnd = Hwnd.ObjectFromHandle (after_handle);
+ HIViewSetZOrder (hwnd.whole_window, 2, after_hwnd.whole_window);
+ } else {
+ HIViewSetZOrder (hwnd.whole_window, 1, IntPtr.Zero);
+ return true;
+ }
+ return false;
+ }
+
+ internal override void ShowCursor(bool show) {
+ if (show)
+ CGDisplayShowCursor (CGMainDisplayID ());
+ else
+ CGDisplayHideCursor (CGMainDisplayID ());
+ }
+
+ internal override void StartLoop(Thread thread) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ internal override bool SystrayAdd(IntPtr hwnd, string tip, Icon icon, out ToolTip tt) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ internal override bool SystrayChange(IntPtr hwnd, string tip, Icon icon, ref ToolTip tt) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ internal override void SystrayRemove(IntPtr hwnd, ref ToolTip tt) {
+ throw new NotImplementedException();
+ }
+
+ internal override bool Text(IntPtr handle, string text) {
+ Hwnd hwnd = Hwnd.ObjectFromHandle (handle);
+ if (WindowMapping [hwnd.Handle] != null) {
+ CheckError (SetWindowTitleWithCFString ((IntPtr)(WindowMapping [hwnd.Handle]), __CFStringMakeConstantString (text)));
+ }
+ CheckError (SetControlTitleWithCFString (hwnd.whole_window, __CFStringMakeConstantString (text)));
+ CheckError (SetControlTitleWithCFString (hwnd.client_window, __CFStringMakeConstantString (text)));
+ return true;
+ }
+
+ internal override void UpdateWindow(IntPtr handle) {
+ Hwnd hwnd = Hwnd.ObjectFromHandle (handle);
+
+ if (hwnd.visible && HIViewIsVisible (handle) && !hwnd.expose_pending) {
+ MSG msg = new MSG ();
+ msg.message = Msg.WM_PAINT;
+ msg.hwnd = hwnd.Handle;
+ msg.lParam = IntPtr.Zero;
+ msg.wParam = IntPtr.Zero;
+ MessageQueue.Enqueue (msg);
+ }
+ }
+
+ internal override bool TranslateMessage(ref MSG msg) {
+ bool res = false;
+ Hwnd hwnd = Hwnd.ObjectFromHandle (msg.hwnd);
+
+ switch (msg.message) {
+ case Msg.WM_MOUSEMOVE: {
+ // We're grabbed
+ if (GrabWindowHwnd != null) {
+ if (GrabWindowHwnd.Handle != hwnd.Handle) {
+ return false;
+ }
+ } else {
+ if (MouseWindow != null) {
+ if (MouseWindow.Handle != hwnd.Handle) {
+ PostMessage (MouseWindow.Handle, Msg.WM_MOUSE_LEAVE, IntPtr.Zero, IntPtr.Zero);
+ PostMessage (hwnd.Handle, Msg.WM_MOUSE_ENTER, IntPtr.Zero, IntPtr.Zero);
+ MouseWindow = hwnd;
+ }
+ } else {
+ MouseWindow = hwnd;
+ }
+ }
+ break;
+ }
+ case Msg.WM_SETFOCUS: {
+ break;
+ }
+
+ }
+
+ // This is a hideous temporary keyboard hack to bind some keys
+ if (msg.message >= Msg.WM_KEYFIRST && msg.message <= Msg.WM_KEYLAST)
+ res = true;
+
+ if (msg.message != Msg.WM_KEYDOWN && msg.message != Msg.WM_SYSKEYDOWN)
+ return res;
+
+ if ((int)msg.wParam >= (int)'0' && (int)msg.wParam <= (int)'z') {
+ Msg message;
+ message = Msg.WM_CHAR;
+ PostMessage (msg.hwnd, message, msg.wParam, msg.lParam);
+ }
+ return true;
+ }
+
+ internal override void DrawReversibleRectangle(IntPtr handle, Rectangle rect, int line_width) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ internal override SizeF GetAutoScaleSize(Font font) {
+ throw new NotImplementedException();
+ }
+ #endregion
+
+ #region System information
+ internal override int KeyboardSpeed { get{ throw new NotImplementedException(); } }
+ internal override int KeyboardDelay { get{ throw new NotImplementedException(); } }
+
+ internal override int Caption { get{ throw new NotImplementedException(); } }
+ internal override Size CursorSize { get{ throw new NotImplementedException(); } }
+ internal override bool DragFullWindows { get{ throw new NotImplementedException(); } }
+ internal override Size DragSize { get{ throw new NotImplementedException(); } }
+ internal override Size FrameBorderSize { get{ throw new NotImplementedException(); } }
+ internal override Size IconSize { get{ throw new NotImplementedException(); } }
+ internal override Size MaxWindowTrackSize { get{ throw new NotImplementedException(); } }
+ internal override Size MinimizedWindowSize { get{ throw new NotImplementedException(); } }
+ internal override Size MinimizedWindowSpacingSize { get{ throw new NotImplementedException(); } }
+ internal override Size MinimumWindowSize { get{ throw new NotImplementedException(); } }
+ internal override Size MinWindowTrackSize { get{ throw new NotImplementedException(); } }
+ internal override Size SmallIconSize { get{ throw new NotImplementedException(); } }
+ internal override int MouseButtonCount { get{ throw new NotImplementedException(); } }
+ internal override bool MouseButtonsSwapped { get{ throw new NotImplementedException(); } }
+ internal override bool MouseWheelPresent { get{ throw new NotImplementedException(); } }
+ internal override Rectangle VirtualScreen { get{ throw new NotImplementedException(); } }
+ internal override Rectangle WorkingArea {
+ get {
+ HIRect bounds = CGDisplayBounds (CGMainDisplayID ());
+ return new Rectangle ((int)bounds.origin.x, (int)bounds.origin.y, (int)bounds.size.width, (int)bounds.size.height);
+ }
+ }
+ #endregion
+
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int HIViewSetNeedsDisplayInRegion (IntPtr view, IntPtr rgn, bool needsDisplay);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int HIViewGetSubviewHit (IntPtr contentView, ref CGPoint point, bool tval, ref IntPtr outPtr);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int HIViewGetViewForMouseEvent (IntPtr inView, IntPtr inEvent, ref IntPtr outView);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int HIViewConvertPoint (ref CGPoint point, IntPtr pView, IntPtr cView);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int HIViewChangeFeatures (IntPtr aView, ulong bitsin, ulong bitsout);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int HIViewFindByID (IntPtr rootWnd, HIViewID id, ref IntPtr outPtr);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern IntPtr HIViewGetRoot (IntPtr hWnd);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int HIObjectCreate (IntPtr cfStr, uint what, ref IntPtr hwnd);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int HIViewSetNeedsDisplay (IntPtr viewHnd, bool update);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int HIViewGetFrame (IntPtr viewHnd, ref HIRect rect);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int HIViewSetFrame (IntPtr viewHnd, ref HIRect rect);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int HIViewPlaceInSuperviewAt (IntPtr view, float x, float y);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int HIViewAddSubview (IntPtr parentHnd, IntPtr childHnd);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern IntPtr HIViewGetNextView (IntPtr aView);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern IntPtr HIViewGetPreviousView (IntPtr aView);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern IntPtr HIViewGetFirstSubview (IntPtr aView);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern IntPtr HIViewGetSuperview (IntPtr aView);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int HIViewRemoveFromSuperview (IntPtr aView);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int HIViewSetVisible (IntPtr vHnd, bool visible);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern bool HIViewIsVisible (IntPtr vHnd);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int HIViewGetBounds (IntPtr vHnd, ref HIRect r);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int HIViewScrollRect (IntPtr vHnd, ref HIRect rect, float x, float y);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int HIViewScrollRect (IntPtr vHnd, IntPtr rect, float x, float y);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int HIViewSetZOrder (IntPtr hWnd, int cmd, IntPtr oHnd);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int HIViewSetBoundsOrigin (IntPtr vHnd, float x, float y);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int HIViewConvertRect (ref HIRect r, IntPtr a, IntPtr b);
+
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern void ScrollRect (ref IntPtr r, short dh, short dv, IntPtr rgnHandle);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern void SetRect (ref IntPtr r, short left, short top, short right, short bottom);
+
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ static extern int CreateEvent (IntPtr allocator, uint classid, uint kind, double when, uint attributes, ref IntPtr outEvent);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ static extern int InstallEventHandler (IntPtr window, CarbonEventDelegate handlerProc, uint numtypes, EventTypeSpec [] typeList, IntPtr userData, IntPtr handlerRef);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern IntPtr GetControlOwner (IntPtr aView);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ static extern int ActivateWindow (IntPtr windowHnd, bool inActivate);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ static extern bool IsWindowActive (IntPtr windowHnd);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ static extern int SetKeyboardFocus (IntPtr windowHdn, IntPtr cntrlHnd, short partcode);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ static extern int GetKeyboardFocus (IntPtr handle, ref IntPtr cntrl);
+
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern IntPtr GetWindowEventTarget (IntPtr window);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern IntPtr GetControlEventTarget (IntPtr aControl);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern IntPtr GetEventDispatcherTarget ();
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int SendEventToEventTarget (IntPtr evt, IntPtr target);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int ReleaseEvent (IntPtr evt);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int ReceiveNextEvent (uint evtCount, IntPtr evtTypes, double timeout, bool processEvt, ref IntPtr evt);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ static extern uint GetEventClass (IntPtr eventRef);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ static extern uint GetEventKind (IntPtr eventRef);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ static extern int GetEventParameter (IntPtr evt, OSXConstants.EventParamName inName, OSXConstants.EventParamType inType, IntPtr outActualType, uint bufSize, IntPtr outActualSize, ref byte outData);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ static extern int GetEventParameter (IntPtr evt, OSXConstants.EventParamName inName, OSXConstants.EventParamType inType, IntPtr outActualType, uint bufSize, IntPtr outActualSize, ref IntPtr outData);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ static extern int GetEventParameter (IntPtr evt, OSXConstants.EventParamName inName, OSXConstants.EventParamType inType, IntPtr outActualType, uint bufSize, IntPtr outActualSize, ref ushort outData);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ static extern int GetEventParameter (IntPtr evt, OSXConstants.EventParamName inName, OSXConstants.EventParamType inType, IntPtr outActualType, uint bufSize, IntPtr outActualSize, ref short outData);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ static extern int GetEventParameter (IntPtr evt, OSXConstants.EventParamName inName, OSXConstants.EventParamType inType, IntPtr outActualType, uint bufSize, IntPtr outActualSize, ref QDPoint outData);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ static extern int SetEventParameter (IntPtr evt, OSXConstants.EventParamName inName, OSXConstants.EventParamType inType, uint bufSize, ref short outData);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ static extern int SetEventParameter (IntPtr evt, OSXConstants.EventParamName inName, OSXConstants.EventParamType inType, uint bufSize, ref IntPtr outData);
+
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern void CGContextFlush (IntPtr cgc);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int CGContextFillRect (IntPtr cgc, HIRect r);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern CGAffineTransform CGContextGetTextMatrix (IntPtr cgContext);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int CGContextSetTextMatrix (IntPtr cgContext, CGAffineTransform ctm);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int CGContextSetRGBFillColor (IntPtr cgContext, float r, float g, float b, float alpha);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int CGContextSetRGBStrokeColor (IntPtr cgContext, float r, float g, float b, float alpha);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int CGContextSetTextDrawingMode (IntPtr cgContext, int drawingMode);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int CGContextSelectFont (IntPtr cgContext, string fontName, float size, int textEncoding);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int CGContextShowTextAtPoint (IntPtr cgContext, float x, float y, string text, int length);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int CGContextClipToRect (IntPtr cgContext, HIRect clip);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern void CreateCGContextForPort (IntPtr port, ref IntPtr cgc);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern bool IsWindowCollapsed (IntPtr hWnd);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern bool IsWindowInStandardState (IntPtr hWnd, IntPtr a, IntPtr b);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern void CollapseWindow (IntPtr hWnd, bool collapse);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern void ZoomWindow (IntPtr hWnd, short partCode, bool front);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int GetWindowAttributes (IntPtr hWnd, ref WindowAttributes outAttributes);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int ChangeWindowAttributes (IntPtr hWnd, WindowAttributes inAttributes, WindowAttributes outAttributes);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern IntPtr GetWindowPort (IntPtr hWnd);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ static extern int SetPortWindowPort (IntPtr hWnd);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ static extern int GetGlobalMouse (ref QDPoint outData);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ static extern int GlobalToLocal (ref QDPoint outData);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ static extern int LocalToGlobal (ref QDPoint outData);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ static extern int TrackControl (IntPtr handle, QDPoint point, IntPtr data);
+
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int BeginAppModalStateForWindow (IntPtr window);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int EndAppModalStateForWindow (IntPtr window);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int CreateNewWindow (WindowClass klass, WindowAttributes attributes, ref IntPtr r, ref IntPtr window);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int DisposeWindow (IntPtr wHnd);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int ShowWindow (IntPtr wHnd);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int HideWindow (IntPtr wHnd);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int SetWindowBounds (IntPtr wHnd, uint reg, ref IntPtr rect);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int GetWindowPortBounds (IntPtr wHnd, ref Rect rect);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int GetWindowBounds (IntPtr wHnd, uint reg, ref Rect rect);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int InvertRect (ref Rect r);
+
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int SetControlTitleWithCFString (IntPtr hWnd, IntPtr titleCFStr);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int SetWindowTitleWithCFString (IntPtr hWnd, IntPtr titleCFStr);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern IntPtr __CFStringMakeConstantString (string cString);
+
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern void CGContextRestoreGState (IntPtr ctx);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern void CGContextSaveGState (IntPtr ctx);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern void CGContextTranslateCTM (IntPtr ctx, double tx, double ty);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern void CGContextScaleCTM (IntPtr ctx, double tx, double ty);
+
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ static extern int SetWindowContentColor (IntPtr hWnd, ref RGBColor backColor);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ static extern int TrackMouseLocationWithOptions (IntPtr port, int options, double eventtimeout, ref QDPoint point, ref IntPtr modifier, ref MouseTrackingResult status);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ static extern int CreateMouseTrackingRegion (IntPtr windowref, IntPtr rgn, IntPtr clip, int options, MouseTrackingRegionID rid, IntPtr refcon, IntPtr evttargetref, ref IntPtr mousetrackref);
+ [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ static extern int ReleaseMouseTrackingRegion (IntPtr region_handle);
+
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal static extern int CFRelease (IntPtr wHnd);
+
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal extern static IntPtr NewRgn ();
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal extern static void CopyRgn (IntPtr srcrgn, IntPtr destrgn);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal extern static void SetRectRgn (IntPtr rgn, short left, short top, short right, short bottom);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal extern static void DisposeRgn (IntPtr rgn);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal extern static void ExitToShell ();
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal extern static short GetMBarHeight ();
+
+ #region Cursor imports
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal extern static HIRect CGDisplayBounds (IntPtr displayID);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal extern static IntPtr CGMainDisplayID ();
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal extern static void CGDisplayShowCursor (IntPtr display);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal extern static void CGDisplayHideCursor (IntPtr display);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal extern static void CGDisplayMoveCursorToPoint (IntPtr display, CGPoint point);
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ internal extern static void SetThemeCursor (uint inCursor);
+ #endregion
+
+ [DllImport ("gdiplus", EntryPoint="GetFontMetrics")]
+ internal extern static bool GetFontMetrics(IntPtr graphicsObject, IntPtr nativeObject, out int ascent, out int descent);
+ }
+
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIStructs.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIStructs.cs
new file mode 100644
index 00000000000..7e182440d08
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIStructs.cs
@@ -0,0 +1,799 @@
+// 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.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+
+
+// NOT COMPLETE
+
+using System;
+using System.Drawing;
+using System.Runtime.InteropServices;
+
+namespace System.Windows.Forms {
+ internal enum WindowStyles : int {
+ WS_OVERLAPPED = 0x00000000,
+ WS_POPUP = unchecked((int)0x80000000),
+ WS_CHILD = 0x40000000,
+ WS_MINIMIZE = 0x20000000,
+ WS_VISIBLE = 0x10000000,
+ WS_DISABLED = 0x08000000,
+ WS_CLIPSIBLINGS = 0x04000000,
+ WS_CLIPCHILDREN = 0x02000000,
+ WS_MAXIMIZE = 0x01000000,
+ WS_CAPTION = 0x00C00000,
+ WS_BORDER = 0x00800000,
+ WS_DLGFRAME = 0x00400000,
+ WS_VSCROLL = 0x00200000,
+ WS_HSCROLL = 0x00100000,
+ WS_SYSMENU = 0x00080000,
+ WS_THICKFRAME = 0x00040000,
+ WS_GROUP = 0x00020000,
+ WS_TABSTOP = 0x00010000,
+ WS_MINIMIZEBOX = 0x00020000,
+ WS_MAXIMIZEBOX = 0x00010000,
+ WS_TILED = 0x00000000,
+ WS_ICONIC = 0x20000000,
+ WS_SIZEBOX = 0x00040000,
+ WS_POPUPWINDOW = unchecked((int)0x80880000),
+ WS_OVERLAPPEDWINDOW = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX,
+ WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW,
+ WS_CHILDWINDOW = WS_CHILD,
+
+ // Extended Styles
+ WS_EX_DLGMODALFRAME = 0x00000001,
+ WS_EX_DRAGDETECT = 0x00000002,
+ WS_EX_NOPARENTNOTIFY = 0x00000004,
+ WS_EX_TOPMOST = 0x00000008,
+ WS_EX_ACCEPTFILES = 0x00000010,
+ WS_EX_TRANSPARENT = 0x00000020,
+
+ WS_EX_MDICHILD = 0x00000040,
+ WS_EX_TOOLWINDOW = 0x00000080,
+ WS_EX_WINDOWEDGE = 0x00000100,
+ WS_EX_CLIENTEDGE = 0x00000200,
+ WS_EX_CONTEXTHELP = 0x00000400,
+
+ WS_EX_RIGHT = 0x00001000,
+ WS_EX_LEFT = 0x00000000,
+ WS_EX_RTLREADING = 0x00002000,
+ WS_EX_LTRREADING = 0x00000000,
+ WS_EX_LEFTSCROLLBAR = 0x00004000,
+ WS_EX_LAYERED = 0x00080000,
+ WS_EX_RIGHTSCROLLBAR = 0x00000000,
+
+ WS_EX_CONTROLPARENT = 0x00010000,
+ WS_EX_STATICEDGE = 0x00020000,
+ WS_EX_APPWINDOW = 0x00040000,
+ WS_EX_NOINHERITLAYOUT = 0x00100000,
+ WS_EX_LAYOUTRTL = 0x00400000,
+ WS_EX_COMPOSITED = 0x02000000,
+ WS_EX_NOACTIVATE = 0x08000000,
+
+ WS_EX_OVERLAPPEDWINDOW = WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE,
+ WS_EX_PALETTEWINDOW = WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST
+ }
+
+ internal enum Msg {
+ WM_NULL = 0x0000,
+ WM_CREATE = 0x0001,
+ WM_DESTROY = 0x0002,
+ WM_MOVE = 0x0003,
+ WM_SIZE = 0x0005,
+ WM_ACTIVATE = 0x0006,
+ WM_SETFOCUS = 0x0007,
+ WM_KILLFOCUS = 0x0008,
+ // public const uint WM_SETVISIBLE = 0x0009;
+ WM_ENABLE = 0x000A,
+ WM_SETREDRAW = 0x000B,
+ WM_SETTEXT = 0x000C,
+ WM_GETTEXT = 0x000D,
+ WM_GETTEXTLENGTH = 0x000E,
+ WM_PAINT = 0x000F,
+ WM_CLOSE = 0x0010,
+ WM_QUERYENDSESSION = 0x0011,
+ WM_QUIT = 0x0012,
+ WM_QUERYOPEN = 0x0013,
+ WM_ERASEBKGND = 0x0014,
+ WM_SYSCOLORCHANGE = 0x0015,
+ WM_ENDSESSION = 0x0016,
+ // public const uint WM_SYSTEMERROR = 0x0017;
+ WM_SHOWWINDOW = 0x0018,
+ WM_CTLCOLOR = 0x0019,
+ WM_WININICHANGE = 0x001A,
+ WM_SETTINGCHANGE = 0x001A,
+ WM_DEVMODECHANGE = 0x001B,
+ WM_ACTIVATEAPP = 0x001C,
+ WM_FONTCHANGE = 0x001D,
+ WM_TIMECHANGE = 0x001E,
+ WM_CANCELMODE = 0x001F,
+ WM_SETCURSOR = 0x0020,
+ WM_MOUSEACTIVATE = 0x0021,
+ WM_CHILDACTIVATE = 0x0022,
+ WM_QUEUESYNC = 0x0023,
+ WM_GETMINMAXINFO = 0x0024,
+ WM_PAINTICON = 0x0026,
+ WM_ICONERASEBKGND = 0x0027,
+ WM_NEXTDLGCTL = 0x0028,
+ // public const uint WM_ALTTABACTIVE = 0x0029;
+ WM_SPOOLERSTATUS = 0x002A,
+ WM_DRAWITEM = 0x002B,
+ WM_MEASUREITEM = 0x002C,
+ WM_DELETEITEM = 0x002D,
+ WM_VKEYTOITEM = 0x002E,
+ WM_CHARTOITEM = 0x002F,
+ WM_SETFONT = 0x0030,
+ WM_GETFONT = 0x0031,
+ WM_SETHOTKEY = 0x0032,
+ WM_GETHOTKEY = 0x0033,
+ // public const uint WM_FILESYSCHANGE = 0x0034;
+ // public const uint WM_ISACTIVEICON = 0x0035;
+ // public const uint WM_QUERYPARKICON = 0x0036;
+ WM_QUERYDRAGICON = 0x0037,
+ WM_COMPAREITEM = 0x0039,
+ // public const uint WM_TESTING = 0x003a;
+ // public const uint WM_OTHERWINDOWCREATED = 0x003c;
+ WM_GETOBJECT = 0x003D,
+ // public const uint WM_ACTIVATESHELLWINDOW = 0x003e;
+ WM_COMPACTING = 0x0041,
+ WM_COMMNOTIFY = 0x0044 ,
+ WM_WINDOWPOSCHANGING = 0x0046,
+ WM_WINDOWPOSCHANGED = 0x0047,
+ WM_POWER = 0x0048,
+ WM_COPYDATA = 0x004A,
+ WM_CANCELJOURNAL = 0x004B,
+ WM_NOTIFY = 0x004E,
+ WM_INPUTLANGCHANGEREQUEST = 0x0050,
+ WM_INPUTLANGCHANGE = 0x0051,
+ WM_TCARD = 0x0052,
+ WM_HELP = 0x0053,
+ WM_USERCHANGED = 0x0054,
+ WM_NOTIFYFORMAT = 0x0055,
+ WM_CONTEXTMENU = 0x007B,
+ WM_STYLECHANGING = 0x007C,
+ WM_STYLECHANGED = 0x007D,
+ WM_DISPLAYCHANGE = 0x007E,
+ WM_GETICON = 0x007F,
+
+ // Non-Client messages
+ WM_SETICON = 0x0080,
+ WM_NCCREATE = 0x0081,
+ WM_NCDESTROY = 0x0082,
+ WM_NCCALCSIZE = 0x0083,
+ WM_NCHITTEST = 0x0084,
+ WM_NCPAINT = 0x0085,
+ WM_NCACTIVATE = 0x0086,
+ WM_GETDLGCODE = 0x0087,
+ WM_SYNCPAINT = 0x0088,
+ // public const uint WM_SYNCTASK = 0x0089;
+ WM_NCMOUSEMOVE = 0x00A0,
+ WM_NCLBUTTONDOWN = 0x00A1,
+ WM_NCLBUTTONUP = 0x00A2,
+ WM_NCLBUTTONDBLCLK = 0x00A3,
+ WM_NCRBUTTONDOWN = 0x00A4,
+ WM_NCRBUTTONUP = 0x00A5,
+ WM_NCRBUTTONDBLCLK = 0x00A6,
+ WM_NCMBUTTONDOWN = 0x00A7,
+ WM_NCMBUTTONUP = 0x00A8,
+ WM_NCMBUTTONDBLCLK = 0x00A9,
+ // public const uint WM_NCXBUTTONDOWN = 0x00ab;
+ // public const uint WM_NCXBUTTONUP = 0x00ac;
+ // public const uint WM_NCXBUTTONDBLCLK = 0x00ad;
+ WM_KEYDOWN = 0x0100,
+ WM_KEYFIRST = 0x0100,
+ WM_KEYUP = 0x0101,
+ WM_CHAR = 0x0102,
+ WM_DEADCHAR = 0x0103,
+ WM_SYSKEYDOWN = 0x0104,
+ WM_SYSKEYUP = 0x0105,
+ WM_SYSCHAR = 0x0106,
+ WM_SYSDEADCHAR = 0x0107,
+ WM_KEYLAST = 0x0108,
+ WM_IME_STARTCOMPOSITION = 0x010D,
+ WM_IME_ENDCOMPOSITION = 0x010E,
+ WM_IME_COMPOSITION = 0x010F,
+ WM_IME_KEYLAST = 0x010F,
+ WM_INITDIALOG = 0x0110,
+ WM_COMMAND = 0x0111,
+ WM_SYSCOMMAND = 0x0112,
+ WM_TIMER = 0x0113,
+ WM_HSCROLL = 0x0114,
+ WM_VSCROLL = 0x0115,
+ WM_INITMENU = 0x0116,
+ WM_INITMENUPOPUP = 0x0117,
+ // public const uint WM_SYSTIMER = 0x0118;
+ WM_MENUSELECT = 0x011F,
+ WM_MENUCHAR = 0x0120,
+ WM_ENTERIDLE = 0x0121,
+ WM_MENURBUTTONUP = 0x0122,
+ WM_MENUDRAG = 0x0123,
+ WM_MENUGETOBJECT = 0x0124,
+ WM_UNINITMENUPOPUP = 0x0125,
+ WM_MENUCOMMAND = 0x0126,
+ // public const uint WM_CHANGEUISTATE = 0x0127;
+ // public const uint WM_UPDATEUISTATE = 0x0128;
+ // public const uint WM_QUERYUISTATE = 0x0129;
+
+ // public const uint WM_LBTRACKPOINT = 0x0131;
+ WM_CTLCOLORMSGBOX = 0x0132,
+ WM_CTLCOLOREDIT = 0x0133,
+ WM_CTLCOLORLISTBOX = 0x0134,
+ WM_CTLCOLORBTN = 0x0135,
+ WM_CTLCOLORDLG = 0x0136,
+ WM_CTLCOLORSCROLLBAR = 0x0137,
+ WM_CTLCOLORSTATIC = 0x0138,
+ WM_MOUSEMOVE = 0x0200,
+ WM_MOUSEFIRST = 0x0200,
+ WM_LBUTTONDOWN = 0x0201,
+ WM_LBUTTONUP = 0x0202,
+ WM_LBUTTONDBLCLK = 0x0203,
+ WM_RBUTTONDOWN = 0x0204,
+ WM_RBUTTONUP = 0x0205,
+ WM_RBUTTONDBLCLK = 0x0206,
+ WM_MBUTTONDOWN = 0x0207,
+ WM_MBUTTONUP = 0x0208,
+ WM_MBUTTONDBLCLK = 0x0209,
+ WM_MOUSEWHEEL = 0x020A,
+ WM_MOUSELAST = 0x020D,
+ // public const uint WM_XBUTTONDOWN = 0x020B;
+ // public const uint WM_XBUTTONUP = 0x020C;
+ // public const uint WM_XBUTTONDBLCLK = 0x020D;
+ WM_PARENTNOTIFY = 0x0210,
+ WM_ENTERMENULOOP = 0x0211,
+ WM_EXITMENULOOP = 0x0212,
+ WM_NEXTMENU = 0x0213,
+ WM_SIZING = 0x0214,
+ WM_CAPTURECHANGED = 0x0215,
+ WM_MOVING = 0x0216,
+ // public const uint WM_POWERBROADCAST = 0x0218;
+ WM_DEVICECHANGE = 0x0219,
+ WM_MDICREATE = 0x0220,
+ WM_MDIDESTROY = 0x0221,
+ WM_MDIACTIVATE = 0x0222,
+ WM_MDIRESTORE = 0x0223,
+ WM_MDINEXT = 0x0224,
+ WM_MDIMAXIMIZE = 0x0225,
+ WM_MDITILE = 0x0226,
+ WM_MDICASCADE = 0x0227,
+ WM_MDIICONARRANGE = 0x0228,
+ WM_MDIGETACTIVE = 0x0229,
+ /* D&D messages */
+ // public const uint WM_DROPOBJECT = 0x022A;
+ // public const uint WM_QUERYDROPOBJECT = 0x022B;
+ // public const uint WM_BEGINDRAG = 0x022C;
+ // public const uint WM_DRAGLOOP = 0x022D;
+ // public const uint WM_DRAGSELECT = 0x022E;
+ // public const uint WM_DRAGMOVE = 0x022F;
+ WM_MDISETMENU = 0x0230,
+ WM_ENTERSIZEMOVE = 0x0231,
+ WM_EXITSIZEMOVE = 0x0232,
+ WM_DROPFILES = 0x0233,
+ WM_MDIREFRESHMENU = 0x0234,
+ WM_IME_SETCONTEXT = 0x0281,
+ WM_IME_NOTIFY = 0x0282,
+ WM_IME_CONTROL = 0x0283,
+ WM_IME_COMPOSITIONFULL = 0x0284,
+ WM_IME_SELECT = 0x0285,
+ WM_IME_CHAR = 0x0286,
+ WM_IME_REQUEST = 0x0288,
+ WM_IME_KEYDOWN = 0x0290,
+ WM_IME_KEYUP = 0x0291,
+ WM_MOUSEHOVER = 0x02A1,
+ WM_MOUSELEAVE = 0x02A3,
+ WM_CUT = 0x0300,
+ WM_COPY = 0x0301,
+ WM_PASTE = 0x0302,
+ WM_CLEAR = 0x0303,
+ WM_UNDO = 0x0304,
+ WM_RENDERFORMAT = 0x0305,
+ WM_RENDERALLFORMATS = 0x0306,
+ WM_DESTROYCLIPBOARD = 0x0307,
+ WM_DRAWCLIPBOARD = 0x0308,
+ WM_PAINTCLIPBOARD = 0x0309,
+ WM_VSCROLLCLIPBOARD = 0x030A,
+ WM_SIZECLIPBOARD = 0x030B,
+ WM_ASKCBFORMATNAME = 0x030C,
+ WM_CHANGECBCHAIN = 0x030D,
+ WM_HSCROLLCLIPBOARD = 0x030E,
+ WM_QUERYNEWPALETTE = 0x030F,
+ WM_PALETTEISCHANGING = 0x0310,
+ WM_PALETTECHANGED = 0x0311,
+ WM_HOTKEY = 0x0312,
+ WM_PRINT = 0x0317,
+ WM_PRINTCLIENT = 0x0318,
+ WM_HANDHELDFIRST = 0x0358,
+ WM_HANDHELDLAST = 0x035F,
+ WM_AFXFIRST = 0x0360,
+ WM_AFXLAST = 0x037F,
+ WM_PENWINFIRST = 0x0380,
+ WM_PENWINLAST = 0x038F,
+ WM_APP = 0x8000,
+ WM_USER = 0x0400,
+
+ // Our "private" ones
+ WM_MOUSE_ENTER = 0x0401,
+ WM_MOUSE_LEAVE = 0x0402,
+ WM_ASYNC_MESSAGE = 0x0403,
+ WM_REFLECT = WM_USER + 0x1c00,
+ WM_CLOSE_INTERNAL = WM_USER + 0x1c01
+ }
+
+#if notdef
+ internal enum Msg {
+ WM_NULL = 0x0000,
+ WM_CREATE = 0x0001,
+ WM_DESTROY = 0x0002,
+ WM_MOVE = 0x0003,
+ WM_SIZE = 0x0005,
+ WM_ACTIVATE = 0x0006,
+ WM_SETFOCUS = 0x0007,
+ WM_KILLFOCUS = 0x0008,
+ WM_SETVISIBLE = 0x0009,
+ WM_ENABLE = 0x000A,
+ // ...
+ WM_PAINT = 0x000F,
+ WM_CLOSE = 0x0010,
+ WM_QUERYENDSESSION = 0x0011,
+ WM_QUIT = 0x0012,
+ WM_QUERYOPEN = 0x0013,
+ WM_ERASEBKGND = 0x0014,
+ WM_SYSCOLORCHANGE = 0x0015,
+
+ // ...
+ WM_WINDOWPOSCHANGED = 0x0046,
+
+ // ...
+ WM_KEYFIRST = 0x0100,
+ WM_KEYDOWN = 0x0100,
+ WM_KEYUP = 0x0101,
+ WM_CHAR = 0x0102,
+ WM_DEADCHAR = 0x0103,
+ WM_SYSKEYDOWN = 0x0104,
+ WM_SYSKEYUP = 0x0105,
+ WM_SYS1CHAR = 0x0106,
+ WM_SYSDEADCHAR = 0x0107,
+ WM_KEYLAST = 0x0108,
+
+ // ...
+ WM_MOUSEFIRST = 0x0200,
+ WM_MOUSEMOVE = 0x0200,
+ WM_LBUTTONDOWN = 0x0201,
+ WM_LBUTTONUP = 0x0202,
+ WM_LBUTTONDBLCLK = 0x0203,
+ WM_RBUTTONDOWN = 0x0204,
+ WM_RBUTTONUP = 0x0205,
+ WM_RBUTTONDBLCLK = 0x0206,
+ WM_MBUTTONDOWN = 0x0207,
+ WM_MBUTTONUP = 0x0208,
+ WM_MBUTTONDBLCLK = 0x0209,
+ WM_MOUSEWHEEL = 0x020A,
+ WM_MOUSELAST = 0x020D,
+ // ...
+ WM_MOUSEHOVER = 0x02A1,
+ WM_MOUSELEAVE = 0x02A3,
+ }
+#endif
+
+ internal enum MsgButtons {
+ MK_LBUTTON = 0x0001,
+ MK_RBUTTON = 0x0002,
+ MK_SHIFT = 0x0004,
+ MK_CONTROL = 0x0008,
+ MK_MBUTTON = 0x0010,
+ MK_XBUTTON1 = 0x0020,
+ MK_XBUTTON2 = 0x0040,
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct POINT {
+ internal int x;
+ internal int y;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct MSG {
+ internal IntPtr hwnd;
+ internal Msg message;
+ internal IntPtr wParam;
+ internal IntPtr lParam;
+ internal uint time;
+ internal POINT pt;
+ }
+
+ internal enum WindowActiveFlags {
+ WA_INACTIVE = 0,
+ WA_ACTIVE = 1,
+ WA_CLICKACTIVE = 2
+ }
+
+ internal enum KeybdEventFlags {
+ None = 0,
+ ExtendedKey = 0x0001,
+ KeyUp = 0x0002
+ }
+
+ internal enum VirtualKeys {
+ VK_LBUTTON = 0x01,
+ VK_RBUTTON = 0x02,
+ VK_CANCEL = 0x03,
+ VK_MBUTTON = 0x04,
+ VK_XBUTTON1 = 0x05,
+ VK_XBUTTON2 = 0x06,
+ VK_BACK = 0x08,
+ VK_TAB = 0x09,
+ VK_CLEAR = 0x0C,
+ VK_RETURN = 0x0D,
+ VK_SHIFT = 0x10,
+ VK_CONTROL = 0x11,
+ VK_MENU = 0x12,
+ VK_PAUSE = 0x13,
+ VK_CAPITAL = 0x14,
+ VK_ESCAPE = 0x1B,
+ VK_SPACE = 0x20,
+ VK_PRIOR = 0x21,
+ VK_NEXT = 0x22,
+ VK_END = 0x23,
+ VK_HOME = 0x24,
+ VK_LEFT = 0x25,
+ VK_UP = 0x26,
+ VK_RIGHT = 0x27,
+ VK_DOWN = 0x28,
+ VK_SELECT = 0x29,
+ VK_PRINT = 0x2A,
+ VK_EXECUTE = 0x2B,
+ VK_SNAPSHOT = 0x2C,
+ VK_INSERT = 0x2D,
+ VK_DELETE = 0x2E,
+ VK_HELP = 0x2F,
+ VK_0 = 0x30,
+ VK_1 = 0x31,
+ VK_2 = 0x32,
+ VK_3 = 0x33,
+ VK_4 = 0x34,
+ VK_5 = 0x35,
+ VK_6 = 0x36,
+ VK_7 = 0x37,
+ VK_8 = 0x38,
+ VK_9 = 0x39,
+ VK_A = 0x41,
+ VK_B = 0x42,
+ VK_C = 0x43,
+ VK_D = 0x44,
+ VK_E = 0x45,
+ VK_F = 0x46,
+ VK_G = 0x47,
+ VK_H = 0x48,
+ VK_I = 0x49,
+ VK_J = 0x4A,
+ VK_K = 0x4B,
+ VK_L = 0x4C,
+ VK_M = 0x4D,
+ VK_N = 0x4E,
+ VK_O = 0x4F,
+ VK_P = 0x50,
+ VK_Q = 0x51,
+ VK_R = 0x52,
+ VK_S = 0x53,
+ VK_T = 0x54,
+ VK_U = 0x55,
+ VK_V = 0x56,
+ VK_W = 0x57,
+ VK_X = 0x58,
+ VK_Y = 0x59,
+ VK_Z = 0x5A,
+ VK_LWIN = 0x5B,
+ VK_RWIN = 0x5C,
+ VK_APPS = 0x5D,
+ VK_NUMPAD0 = 0x60,
+ VK_NUMPAD1 = 0x61,
+ VK_NUMPAD2 = 0x62,
+ VK_NUMPAD3 = 0x63,
+ VK_NUMPAD4 = 0x64,
+ VK_NUMPAD5 = 0x65,
+ VK_NUMPAD6 = 0x66,
+ VK_NUMPAD7 = 0x67,
+ VK_NUMPAD8 = 0x68,
+ VK_NUMPAD9 = 0x69,
+ VK_MULTIPLY = 0x6A,
+ VK_ADD = 0x6B,
+ VK_SEPARATOR = 0x6C,
+ VK_SUBTRACT = 0x6D,
+ VK_DECIMAL = 0x6E,
+ VK_DIVIDE = 0x6F,
+ VK_F1 = 0x70,
+ VK_F2 = 0x71,
+ VK_F3 = 0x72,
+ VK_F4 = 0x73,
+ VK_F5 = 0x74,
+ VK_F6 = 0x75,
+ VK_F7 = 0x76,
+ VK_F8 = 0x77,
+ VK_F9 = 0x78,
+ VK_F10 = 0x79,
+ VK_F11 = 0x7A,
+ VK_F12 = 0x7B,
+ VK_F13 = 0x7C,
+ VK_F14 = 0x7D,
+ VK_F15 = 0x7E,
+ VK_F16 = 0x7F,
+ VK_F17 = 0x80,
+ VK_F18 = 0x81,
+ VK_F19 = 0x82,
+ VK_F20 = 0x83,
+ VK_F21 = 0x84,
+ VK_F22 = 0x85,
+ VK_F23 = 0x86,
+ VK_F24 = 0x87,
+ VK_NUMLOCK = 0x90,
+ VK_SCROLL = 0x91,
+ VK_LSHIFT = 0xA0,
+ VK_RSHIFT = 0xA1,
+ VK_LCONTROL = 0xA2,
+ VK_RCONTROL = 0xA3,
+ VK_LMENU = 0xA4,
+ VK_RMENU = 0xA5,
+ VK_OEM_1 = 0xBA,
+ VK_OEM_PLUS = 0xBB,
+ VK_OEM_COMMA = 0xBC,
+ VK_OEM_MINUS = 0xBD,
+ VK_OEM_PERIOD = 0xBE,
+ VK_OEM_2 = 0xBF,
+ VK_OEM_3 = 0xC0,
+ VK_OEM_4 = 0xDB,
+ VK_OEM_5 = 0xDC,
+ VK_OEM_6 = 0xDD,
+ VK_OEM_7 = 0xDE,
+ VK_OEM_8 = 0xDF,
+ VK_OEM_AX = 0xE1,
+ VK_OEM_102 = 0xE2,
+ VK_ICO_HELP = 0xE3,
+ VK_ICO_00 = 0xE4,
+ VK_PROCESSKEY = 0xE5,
+ VK_ATTN = 0xF6,
+ VK_CRSEL = 0xF7,
+ VK_EXSEL = 0xF8,
+ VK_EREOF = 0xF9,
+ VK_PLAY = 0xFA,
+ VK_ZOOM = 0xFB,
+ VK_NONAME = 0xFC,
+ VK_PA1 = 0xFD,
+ VK_OEM_CLEAR = 0xFE,
+ }
+
+ internal enum TtyKeys {
+ XK_BackSpace = 0xff08, /* Back space, back char */
+ XK_Tab = 0xff09,
+ XK_Linefeed = 0xff0a, /* Linefeed, LF */
+ XK_Clear = 0xff0b,
+ XK_Return = 0xff0d, /* Return, enter */
+ XK_Pause = 0xff13, /* Pause, hold */
+ XK_Scroll_Lock = 0xff14,
+ XK_Sys_Req = 0xff15,
+ XK_Escape = 0xff1b,
+ XK_Delete = 0xffff /* Delete, rubout */
+ }
+
+ internal enum MiscKeys {
+ XK_ISO_Lock = 0xfe01,
+ XK_ISO_Last_Group_Lock = 0xfe0f,
+ XK_Select = 0xff60,
+ XK_Print = 0xff61,
+ XK_Execute = 0xff62,
+ XK_Insert = 0xff63,
+ XK_Undo = 0xff65,
+ XK_Redo = 0xff66,
+ XK_Menu = 0xff67,
+ XK_Find = 0xff68,
+ XK_Cancel = 0xff69,
+ XK_Help = 0xff6a,
+ XK_Break = 0xff6b,
+ XK_Mode_switch = 0xff7e,
+ XK_script_switch = 0xff7e,
+ XK_Num_Lock = 0xff7f
+ }
+
+ internal enum KeypadKeys {
+ XK_KP_Space = 0xff80,
+ XK_KP_Tab = 0xff89,
+ XK_KP_Enter = 0xff8d, /* Enter */
+ XK_KP_F1 = 0xff91, /* PF1, KP_A, ... */
+ XK_KP_F2 = 0xff92,
+ XK_KP_F3 = 0xff93,
+ XK_KP_F4 = 0xff94,
+ XK_KP_Home = 0xff95,
+ XK_KP_Left = 0xff96,
+ XK_KP_Up = 0xff97,
+ XK_KP_Right = 0xff98,
+ XK_KP_Down = 0xff99,
+ XK_KP_Prior = 0xff9a,
+ XK_KP_Page_Up = 0xff9a,
+ XK_KP_Next = 0xff9b,
+ XK_KP_Page_Down = 0xff9b,
+ XK_KP_End = 0xff9c,
+ XK_KP_Begin = 0xff9d,
+ XK_KP_Insert = 0xff9e,
+ XK_KP_Delete = 0xff9f,
+ XK_KP_Equal = 0xffbd, /* Equals */
+ XK_KP_Multiply = 0xffaa,
+ XK_KP_Add = 0xffab,
+ XK_KP_Separator = 0xffac, /* Separator, often comma */
+ XK_KP_Subtract = 0xffad,
+ XK_KP_Decimal = 0xffae,
+ XK_KP_Divide = 0xffaf,
+
+ XK_KP_0 = 0xffb0,
+ XK_KP_1 = 0xffb1,
+ XK_KP_2 = 0xffb2,
+ XK_KP_3 = 0xffb3,
+ XK_KP_4 = 0xffb4,
+ XK_KP_5 = 0xffb5,
+ XK_KP_6 = 0xffb6,
+ XK_KP_7 = 0xffb7,
+ XK_KP_8 = 0xffb8,
+ XK_KP_9 = 0xffb9
+ }
+
+ internal enum DeadKeys {
+ XK_dead_grave = 0xfe50,
+ XK_dead_acute = 0xfe51,
+ XK_dead_circumflex = 0xfe52,
+ XK_dead_tilde = 0xfe53,
+ XK_dead_macron = 0xfe54,
+ XK_dead_breve = 0xfe55,
+ XK_dead_abovedot = 0xfe56,
+ XK_dead_diaeresis = 0xfe57,
+ XK_dead_abovering = 0xfe58,
+ XK_dead_doubleacute = 0xfe59,
+ XK_dead_caron = 0xfe5a,
+ XK_dead_cedilla = 0xfe5b,
+ XK_dead_ogonek = 0xfe5c,
+ XK_dead_iota = 0xfe5d,
+ XK_dead_voiced_sound = 0xfe5e,
+ XK_dead_semivoiced_sound = 0xfe5f,
+ XK_dead_belowdot = 0xfe60,
+ XK_dead_hook = 0xfe61,
+ XK_dead_horn = 0xfe62
+
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct HELPINFO {
+ internal uint cbSize;
+ internal int iContextType;
+ internal int iCtrlId;
+ internal IntPtr hItemHandle;
+ internal uint dwContextId;
+ internal POINT MousePos;
+ }
+
+ internal enum PeekMessageFlags {
+ PM_NOREMOVE = 0x00000000,
+ PM_REMOVE = 0x00000001,
+ PM_NOYIELD = 0x00000002
+ }
+
+ internal enum StdCursor {
+ Default = 0,
+ AppStarting = 1,
+ Arrow = 2,
+ Cross = 3,
+ Hand = 4,
+ Help = 5,
+ HSplit = 6,
+ IBeam = 7,
+ No = 8,
+ NoMove2D = 9,
+ NoMoveHoriz = 10,
+ NoMoveVert = 11,
+ PanEast = 12,
+ PanNE = 13,
+ PanNorth = 14,
+ PanNW = 15,
+ PanSE = 16,
+ PanSouth = 17,
+ PanSW = 18,
+ PanWest = 19,
+ SizeAll = 20,
+ SizeNESW = 21,
+ SizeNS = 22,
+ SizeNWSE = 23,
+ SizeWE = 24,
+ UpArrow = 25,
+ VSplit = 26,
+ WaitCursor = 27
+ }
+
+ internal enum HitTest {
+ HTERROR = -2,
+ HTTRANSPARENT = -1,
+ HTNOWHERE = 0,
+ HTCLIENT = 1,
+ HTCAPTION = 2,
+ HTSYSMENU = 3,
+ HTGROWBOX = 4,
+ HTSIZE = HTGROWBOX,
+ HTMENU = 5,
+ HTHSCROLL = 6,
+ HTVSCROLL = 7,
+ HTMINBUTTON = 8,
+ HTMAXBUTTON = 9,
+ HTLEFT = 10,
+ HTRIGHT = 11,
+ HTTOP = 12,
+ HTTOPLEFT = 13,
+ HTTOPRIGHT = 14,
+ HTBOTTOM = 15,
+ HTBOTTOMLEFT = 16,
+ HTBOTTOMRIGHT = 17,
+ HTBORDER = 18,
+ HTREDUCE = HTMINBUTTON,
+ HTZOOM = HTMAXBUTTON,
+ HTSIZEFIRST = HTLEFT,
+ HTSIZELAST = HTBOTTOMRIGHT,
+ HTOBJECT = 19,
+ HTCLOSE = 20,
+ HTHELP = 21
+ }
+
+ internal enum TitleStyle {
+ None = 0,
+ Normal = 1,
+ Tool = 2
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct BITMAPINFOHEADER {
+ internal uint biSize;
+ internal int biWidth;
+ internal int biHeight;
+ internal ushort biPlanes;
+ internal ushort biBitCount;
+ internal uint biCompression;
+ internal uint biSizeImage;
+ internal int biXPelsPerMeter;
+ internal int biYPelsPerMeter;
+ internal uint biClrUsed;
+ internal uint biClrImportant;
+ }
+
+ internal enum ClipboardFormats : ushort {
+ CF_TEXT = 1,
+ CF_BITMAP = 2,
+ CF_METAFILEPICT = 3,
+ CF_SYLK = 4,
+ CF_DIF = 5,
+ CF_TIFF = 6,
+ CF_OEMTEXT = 7,
+ CF_DIB = 8,
+ CF_PALETTE = 9,
+ CF_PENDATA = 10,
+ CF_RIFF = 11,
+ CF_WAVE = 12,
+ CF_UNICODETEXT = 13,
+ CF_ENHMETAFILE = 14,
+ CF_HDROP = 15,
+ CF_LOCALE = 16,
+ CF_DIBV5 = 17
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
new file mode 100644
index 00000000000..22ea23a4c9a
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
@@ -0,0 +1,2500 @@
+// 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.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+// NOT COMPLETE
+
+using System;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.ComponentModel;
+using System.Collections;
+using System.Diagnostics;
+using System.IO;
+using System.Runtime.InteropServices;
+using System.Text;
+
+
+/// Win32 Version
+namespace System.Windows.Forms {
+ internal class XplatUIWin32 : XplatUIDriver {
+ #region Local Variables
+ private static XplatUIWin32 instance;
+ private static int ref_count;
+ private static IntPtr FosterParent;
+
+ internal static MouseButtons mouse_state;
+ internal static Point mouse_position;
+ internal static bool grab_confined;
+ internal static IntPtr grab_hwnd;
+ internal static Rectangle grab_area;
+ internal static WndProc wnd_proc;
+ internal static IntPtr prev_mouse_hwnd;
+ internal static IntPtr override_cursor;
+
+ internal static bool themes_enabled;
+ private Hashtable timer_list;
+ private static Queue message_queue;
+ private static IntPtr clip_magic = new IntPtr(27051977);
+
+ private static Win32DnD DnD;
+ #endregion // Local Variables
+
+ #region Private Structs
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
+ private struct WNDCLASS {
+ internal int style;
+ internal WndProc lpfnWndProc;
+ internal int cbClsExtra;
+ internal int cbWndExtra;
+ internal IntPtr hInstance;
+ internal IntPtr hIcon;
+ internal IntPtr hCursor;
+ internal IntPtr hbrBackground;
+ [MarshalAs(UnmanagedType.LPWStr)]
+ internal string lpszMenuName;
+ [MarshalAs(UnmanagedType.LPWStr)]
+ internal string lpszClassName;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct RECT {
+ internal int left;
+ internal int top;
+ internal int right;
+ internal int bottom;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct POINT {
+ internal int x;
+ internal int y;
+ }
+
+ internal enum SPIAction {
+ SPI_GETWORKAREA = 0x0030
+ }
+
+ internal enum WindowPlacementFlags {
+ SW_HIDE = 0,
+ SW_SHOWNORMAL = 1,
+ SW_NORMAL = 1,
+ SW_SHOWMINIMIZED = 2,
+ SW_SHOWMAXIMIZED = 3,
+ SW_MAXIMIZE = 3,
+ SW_SHOWNOACTIVATE = 4,
+ SW_SHOW = 5,
+ SW_MINIMIZE = 6,
+ SW_SHOWMINNOACTIVE = 7,
+ SW_SHOWNA = 8,
+ SW_RESTORE = 9,
+ SW_SHOWDEFAULT = 10,
+ SW_FORCEMINIMIZE = 11,
+ SW_MAX = 11
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ private struct WINDOWPLACEMENT {
+ internal uint length;
+ internal uint flags;
+ internal WindowPlacementFlags showCmd;
+ internal POINT ptMinPosition;
+ internal POINT ptMaxPosition;
+ internal RECT rcNormalPosition;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct NCCALCSIZE_PARAMS {
+ internal RECT rgrc1;
+ internal RECT rgrc2;
+ internal RECT rgrc3;
+ internal IntPtr lppos;
+ }
+
+ [Flags]
+ private enum TMEFlags {
+ TME_HOVER = 0x00000001,
+ TME_LEAVE = 0x00000002,
+ TME_QUERY = unchecked((int)0x40000000),
+ TME_CANCEL = unchecked((int)0x80000000)
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ private struct TRACKMOUSEEVENT {
+ internal int size;
+ internal TMEFlags dwFlags;
+ internal IntPtr hWnd;
+ internal int dwHoverTime;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ private struct PAINTSTRUCT {
+ internal IntPtr hdc;
+ internal int fErase;
+ internal RECT rcPaint;
+ internal int fRestore;
+ internal int fIncUpdate;
+ internal int Reserved1;
+ internal int Reserved2;
+ internal int Reserved3;
+ internal int Reserved4;
+ internal int Reserved5;
+ internal int Reserved6;
+ internal int Reserved7;
+ internal int Reserved8;
+ }
+
+ internal enum ClassStyle {
+ CS_VREDRAW = 0x00000001,
+ CS_HREDRAW = 0x00000002,
+ CS_KEYCVTWINDOW = 0x00000004,
+ CS_DBLCLKS = 0x00000008,
+ CS_OWNDC = 0x00000020,
+ CS_CLASSDC = 0x00000040,
+ CS_PARENTDC = 0x00000080,
+ CS_NOKEYCVT = 0x00000100,
+ CS_NOCLOSE = 0x00000200,
+ CS_SAVEBITS = 0x00000800,
+ CS_BYTEALIGNCLIENT = 0x00001000,
+ CS_BYTEALIGNWINDOW = 0x00002000,
+ CS_GLOBALCLASS = 0x00004000,
+ CS_IME = 0x00010000
+ }
+
+ internal enum SetWindowPosZOrder {
+ HWND_TOP = 0,
+ HWND_BOTTOM = 1,
+ HWND_TOPMOST = -1,
+ HWND_NOTOPMOST = -2
+ }
+
+ [Flags]
+ internal enum SetWindowPosFlags {
+ SWP_ASYNCWINDOWPOS = 0x4000,
+ SWP_DEFERERASE = 0x2000,
+ SWP_DRAWFRAME = 0x0020,
+ SWP_FRAMECHANGED = 0x0020,
+ SWP_HIDEWINDOW = 0x0080,
+ SWP_NOACTIVATE = 0x0010,
+ SWP_NOCOPYBITS = 0x0100,
+ SWP_NOMOVE = 0x0002,
+ SWP_NOOWNERZORDER = 0x0200,
+ SWP_NOREDRAW = 0x0008,
+ SWP_NOREPOSITION = 0x0200,
+ SWP_NOENDSCHANGING = 0x0400,
+ SWP_NOSIZE = 0x0001,
+ SWP_NOZORDER = 0x0004,
+ SWP_SHOWWINDOW = 0x0040
+ }
+
+ internal enum GetSysColorIndex {
+ COLOR_SCROLLBAR = 0,
+ COLOR_BACKGROUND = 1,
+ COLOR_ACTIVECAPTION = 2,
+ COLOR_INACTIVECAPTION = 3,
+ COLOR_MENU = 4,
+ COLOR_WINDOW = 5,
+ COLOR_WINDOWFRAME = 6,
+ COLOR_MENUTEXT = 7,
+ COLOR_WINDOWTEXT = 8,
+ COLOR_CAPTIONTEXT = 9,
+ COLOR_ACTIVEBORDER = 10,
+ COLOR_INACTIVEBORDER = 11,
+ COLOR_APPWORKSPACE = 12,
+ COLOR_HIGHLIGHT = 13,
+ COLOR_HIGHLIGHTTEXT = 14,
+ COLOR_BTNFACE = 15,
+ COLOR_BTNSHADOW = 16,
+ COLOR_GRAYTEXT = 17,
+ COLOR_BTNTEXT = 18,
+ COLOR_INACTIVECAPTIONTEXT = 19,
+ COLOR_BTNHIGHLIGHT = 20,
+ COLOR_3DDKSHADOW = 21,
+ COLOR_3DLIGHT = 22,
+ COLOR_INFOTEXT = 23,
+ COLOR_INFOBK = 24,
+
+ COLOR_HOTLIGHT = 26,
+ COLOR_GRADIENTACTIVECAPTION = 27,
+ COLOR_GRADIENTINACTIVECAPTION = 28,
+ COLOR_MENUHIGHLIGHT = 29,
+ COLOR_MENUBAR = 30,
+
+ COLOR_DESKTOP = 1,
+ COLOR_3DFACE = 16,
+ COLOR_3DSHADOW = 16,
+ COLOR_3DHIGHLIGHT = 20,
+ COLOR_3DHILIGHT = 20,
+ COLOR_BTNHILIGHT = 20,
+ COLOR_MAXVALUE = 24,/* Maximum value */
+ }
+
+ private enum LoadCursorType {
+ First = 32512,
+ IDC_ARROW = 32512,
+ IDC_IBEAM = 32513,
+ IDC_WAIT = 32514,
+ IDC_CROSS = 32515,
+ IDC_UPARROW = 32516,
+ IDC_SIZE = 32640,
+ IDC_ICON = 32641,
+ IDC_SIZENWSE = 32642,
+ IDC_SIZENESW = 32643,
+ IDC_SIZEWE = 32644,
+ IDC_SIZENS = 32645,
+ IDC_SIZEALL = 32646,
+ IDC_NO = 32648,
+ IDC_HAND = 32649,
+ IDC_APPSTARTING = 32650,
+ IDC_HELP = 32651,
+ Last = 32651
+ }
+
+ [Flags]
+ private enum WindowLong {
+ GWL_WNDPROC = -4,
+ GWL_HINSTANCE = -6,
+ GWL_HWNDPARENT = -8,
+ GWL_STYLE = -16,
+ GWL_EXSTYLE = -20,
+ GWL_USERDATA = -21,
+ GWL_ID = -12
+ }
+
+ [Flags]
+ private enum LogBrushStyle {
+ BS_SOLID = 0,
+ BS_NULL = 1,
+ BS_HATCHED = 2,
+ BS_PATTERN = 3,
+ BS_INDEXED = 4,
+ BS_DIBPATTERN = 5,
+ BS_DIBPATTERNPT = 6,
+ BS_PATTERN8X8 = 7,
+ BS_DIBPATTERN8X8 = 8,
+ BS_MONOPATTERN = 9
+ }
+
+ [Flags]
+ private enum LogBrushHatch {
+ HS_HORIZONTAL = 0, /* ----- */
+ HS_VERTICAL = 1, /* ||||| */
+ HS_FDIAGONAL = 2, /* \\\\\ */
+ HS_BDIAGONAL = 3, /* ///// */
+ HS_CROSS = 4, /* +++++ */
+ HS_DIAGCROSS = 5, /* xxxxx */
+ }
+
+ internal struct COLORREF {
+ internal byte R;
+ internal byte G;
+ internal byte B;
+ internal byte A;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ private struct LOGBRUSH {
+ internal LogBrushStyle lbStyle;
+ internal COLORREF lbColor;
+ internal LogBrushHatch lbHatch;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct TEXTMETRIC {
+ internal int tmHeight;
+ internal int tmAscent;
+ internal int tmDescent;
+ internal int tmInternalLeading;
+ internal int tmExternalLeading;
+ internal int tmAveCharWidth;
+ internal int tmMaxCharWidth;
+ internal int tmWeight;
+ internal int tmOverhang;
+ internal int tmDigitizedAspectX;
+ internal int tmDigitizedAspectY;
+ internal short tmFirstChar;
+ internal short tmLastChar;
+ internal short tmDefaultChar;
+ internal short tmBreakChar;
+ internal byte tmItalic;
+ internal byte tmUnderlined;
+ internal byte tmStruckOut;
+ internal byte tmPitchAndFamily;
+ internal byte tmCharSet;
+ }
+
+ [Flags]
+ private enum ScrollWindowExFlags {
+ SW_NONE = 0x0000,
+ SW_SCROLLCHILDREN = 0x0001,
+ SW_INVALIDATE = 0x0002,
+ SW_ERASE = 0x0004,
+ SW_SMOOTHSCROLL = 0x0010
+ }
+
+ internal enum SystemMetrics {
+ SM_CXSCREEN = 0,
+ SM_CYSCREEN = 1,
+ SM_CXVSCROLL = 2,
+ SM_CYHSCROLL = 3,
+ SM_CYCAPTION = 4,
+ SM_CXBORDER = 5,
+ SM_CYBORDER = 6,
+ SM_CXDLGFRAME = 7,
+ SM_CYDLGFRAME = 8,
+ SM_CYVTHUMB = 9,
+ SM_CXHTHUMB = 10,
+ SM_CXICON = 11,
+ SM_CYICON = 12,
+ SM_CXCURSOR = 13,
+ SM_CYCURSOR = 14,
+ SM_CYMENU = 15,
+ SM_CXFULLSCREEN = 16,
+ SM_CYFULLSCREEN = 17,
+ SM_CYKANJIWINDOW = 18,
+ SM_MOUSEPRESENT = 19,
+ SM_CYVSCROLL = 20,
+ SM_CXHSCROLL = 21,
+ SM_DEBUG = 22,
+ SM_SWAPBUTTON = 23,
+ SM_RESERVED1 = 24,
+ SM_RESERVED2 = 25,
+ SM_RESERVED3 = 26,
+ SM_RESERVED4 = 27,
+ SM_CXMIN = 28,
+ SM_CYMIN = 29,
+ SM_CXSIZE = 30,
+ SM_CYSIZE = 31,
+ SM_CXFRAME = 32,
+ SM_CYFRAME = 33,
+ SM_CXMINTRACK = 34,
+ SM_CYMINTRACK = 35,
+ SM_CXDOUBLECLK = 36,
+ SM_CYDOUBLECLK = 37,
+ SM_CXICONSPACING = 38,
+ SM_CYICONSPACING = 39,
+ SM_MENUDROPALIGNMENT = 40,
+ SM_PENWINDOWS = 41,
+ SM_DBCSENABLED = 42,
+ SM_CMOUSEBUTTONS = 43,
+ SM_CXFIXEDFRAME = SM_CXDLGFRAME,
+ SM_CYFIXEDFRAME = SM_CYDLGFRAME,
+ SM_CXSIZEFRAME = SM_CXFRAME,
+ SM_CYSIZEFRAME = SM_CYFRAME,
+ SM_SECURE = 44,
+ SM_CXEDGE = 45,
+ SM_CYEDGE = 46,
+ SM_CXMINSPACING = 47,
+ SM_CYMINSPACING = 48,
+ SM_CXSMICON = 49,
+ SM_CYSMICON = 50,
+ SM_CYSMCAPTION = 51,
+ SM_CXSMSIZE = 52,
+ SM_CYSMSIZE = 53,
+ SM_CXMENUSIZE = 54,
+ SM_CYMENUSIZE = 55,
+ SM_ARRANGE = 56,
+ SM_CXMINIMIZED = 57,
+ SM_CYMINIMIZED = 58,
+ SM_CXMAXTRACK = 59,
+ SM_CYMAXTRACK = 60,
+ SM_CXMAXIMIZED = 61,
+ SM_CYMAXIMIZED = 62,
+ SM_NETWORK = 63,
+ SM_CLEANBOOT = 67,
+ SM_CXDRAG = 68,
+ SM_CYDRAG = 69,
+ SM_SHOWSOUNDS = 70,
+ SM_CXMENUCHECK = 71,
+ SM_CYMENUCHECK = 72,
+ SM_SLOWMACHINE = 73,
+ SM_MIDEASTENABLED = 74,
+ SM_MOUSEWHEELPRESENT = 75,
+ SM_XVIRTUALSCREEN = 76,
+ SM_YVIRTUALSCREEN = 77,
+ SM_CXVIRTUALSCREEN = 78,
+ SM_CYVIRTUALSCREEN = 79,
+ SM_CMONITORS = 80,
+ SM_SAMEDISPLAYFORMAT = 81,
+ SM_IMMENABLED = 82,
+ SM_CXFOCUSBORDER = 83,
+ SM_CYFOCUSBORDER = 84,
+ SM_TABLETPC = 86,
+ SM_MEDIACENTER = 87,
+ SM_CMETRICS = 88
+ }
+
+ // We'll only support _WIN32_IE < 0x0500 for now
+ internal enum NotifyIconMessage {
+ NIM_ADD = 0x00000000,
+ NIM_MODIFY = 0x00000001,
+ NIM_DELETE = 0x00000002,
+ }
+
+ [Flags]
+ internal enum NotifyIconFlags {
+ NIF_MESSAGE = 0x00000001,
+ NIF_ICON = 0x00000002,
+ NIF_TIP = 0x00000004,
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
+ internal struct NOTIFYICONDATA {
+ internal uint cbSize;
+ internal IntPtr hWnd;
+ internal uint uID;
+ internal NotifyIconFlags uFlags;
+ internal uint uCallbackMessage;
+ internal IntPtr hIcon;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst=64)]
+ internal string szTip;
+ }
+
+ [Flags]
+ internal enum DCExFlags {
+ DCX_WINDOW = 0x00000001,
+ DCX_CACHE = 0x00000002,
+ DCX_NORESETATTRS = 0x00000004,
+ DCX_CLIPCHILDREN = 0x00000008,
+ DCX_CLIPSIBLINGS = 0x00000010,
+ DCX_PARENTCLIP = 0x00000020,
+ DCX_EXCLUDERGN = 0x00000040,
+ DCX_INTERSECTRGN = 0x00000080,
+ DCX_EXCLUDEUPDATE = 0x00000100,
+ DCX_INTERSECTUPDATE = 0x00000200,
+ DCX_LOCKWINDOWUPDATE = 0x00000400,
+ DCX_USESTYLE = 0x00010000,
+ DCX_VALIDATE = 0x00200000
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
+ internal struct CLIENTCREATESTRUCT {
+ internal IntPtr hWindowMenu;
+ internal uint idFirstChild;
+ }
+
+ private enum ClassLong : int {
+ GCL_MENUNAME = -8,
+ GCL_HBRBACKGROUND = -10,
+ GCL_HCURSOR = -12,
+ GCL_HICON = -14,
+ GCL_HMODULE = -16,
+ GCL_CBWNDEXTRA = -18,
+ GCL_CBCLSEXTRA = -20,
+ GCL_WNDPROC = -24,
+ GCL_STYLE = -26,
+ GCW_ATOM = -32,
+ GCL_HICONSM = -34
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
+ internal struct MINMAXINFO {
+ internal POINT ptReserved;
+ internal POINT ptMaxSize;
+ internal POINT ptMaxPosition;
+ internal POINT ptMinTrackSize;
+ internal POINT ptMaxTrackSize;
+ }
+
+ [Flags]
+ internal enum GAllocFlags : uint {
+ GMEM_FIXED = 0x0000,
+ GMEM_MOVEABLE = 0x0002,
+ GMEM_NOCOMPACT = 0x0010,
+ GMEM_NODISCARD = 0x0020,
+ GMEM_ZEROINIT = 0x0040,
+ GMEM_MODIFY = 0x0080,
+ GMEM_DISCARDABLE = 0x0100,
+ GMEM_NOT_BANKED = 0x1000,
+ GMEM_SHARE = 0x2000,
+ GMEM_DDESHARE = 0x2000,
+ GMEM_NOTIFY = 0x4000,
+ GMEM_LOWER = GMEM_NOT_BANKED,
+ GMEM_VALID_FLAGS = 0x7F72,
+ GMEM_INVALID_HANDLE = 0x8000,
+ GHND = (GMEM_MOVEABLE | GMEM_ZEROINIT),
+ GPTR = (GMEM_FIXED | GMEM_ZEROINIT)
+ }
+
+ internal enum ROP2DrawMode : int {
+ R2_BLACK = 1,
+ R2_NOTMERGEPEN = 2,
+ R2_MASKNOTPEN = 3,
+ R2_NOTCOPYPEN = 4,
+ R2_MASKPENNOT = 5,
+ R2_NOT = 6,
+ R2_XORPEN = 7,
+ R2_NOTMASKPEN = 8,
+ R2_MASKPEN = 9,
+ R2_NOTXORPEN = 10,
+ R2_NOP = 11,
+ R2_MERGENOTPEN = 12,
+ R2_COPYPEN = 13,
+ R2_MERGEPENNOT = 14,
+ R2_MERGEPEN = 15,
+ R2_WHITE = 16,
+ R2_LAST = 16
+ }
+
+ internal enum PenStyle : int {
+ PS_SOLID = 0,
+ PS_DASH = 1,
+ PS_DOT = 2,
+ PS_DASHDOT = 3,
+ PS_DASHDOTDOT = 4,
+ PS_NULL = 5,
+ PS_INSIDEFRAME = 6,
+ PS_USERSTYLE = 7,
+ PS_ALTERNATE = 8
+ }
+
+ internal enum StockObject : int {
+ WHITE_BRUSH = 0,
+ LTGRAY_BRUSH = 1,
+ GRAY_BRUSH = 2,
+ DKGRAY_BRUSH = 3,
+ BLACK_BRUSH = 4,
+ NULL_BRUSH = 5,
+ HOLLOW_BRUSH = NULL_BRUSH,
+ WHITE_PEN = 6,
+ BLACK_PEN = 7,
+ NULL_PEN = 8,
+ OEM_FIXED_FONT = 10,
+ ANSI_FIXED_FONT = 11,
+ ANSI_VAR_FONT = 12,
+ SYSTEM_FONT = 13,
+ DEVICE_DEFAULT_FONT = 14,
+ DEFAULT_PALETTE = 15,
+ SYSTEM_FIXED_FONT = 16
+ }
+
+ internal enum HatchStyle : int {
+ HS_HORIZONTAL = 0,
+ HS_VERTICAL = 1,
+ HS_FDIAGONAL = 2,
+ HS_BDIAGONAL = 3,
+ HS_CROSS = 4,
+ HS_DIAGCROSS = 5
+ }
+
+ [Flags]
+ internal enum SndFlags : int {
+ SND_SYNC = 0x0000,
+ SND_ASYNC = 0x0001,
+ SND_NODEFAULT = 0x0002,
+ SND_MEMORY = 0x0004,
+ SND_LOOP = 0x0008,
+ SND_NOSTOP = 0x0010,
+ SND_NOWAIT = 0x00002000,
+ SND_ALIAS = 0x00010000,
+ SND_ALIAS_ID = 0x00110000,
+ SND_FILENAME = 0x00020000,
+ SND_RESOURCE = 0x00040004,
+ SND_PURGE = 0x0040,
+ SND_APPLICATION = 0x0080,
+ }
+
+ [Flags]
+ internal enum LayeredWindowAttributes : int {
+ LWA_COLORKEY = 0x1,
+ LWA_ALPHA = 0x2,
+ }
+
+
+ #endregion
+
+ #region Constructor & Destructor
+ private XplatUIWin32() {
+ WNDCLASS wndClass;
+ bool result;
+
+ // Handle singleton stuff first
+ ref_count=0;
+
+ DnD = new Win32DnD();
+
+ mouse_state = MouseButtons.None;
+ mouse_position = Point.Empty;
+
+ message_queue = new Queue();
+
+ themes_enabled = false;
+
+ // Prepare 'our' window class
+ wnd_proc = new WndProc(NativeWindow.WndProc);
+ wndClass.style = (int)(ClassStyle.CS_OWNDC | ClassStyle.CS_DBLCLKS);
+ wndClass.lpfnWndProc = wnd_proc;
+ wndClass.cbClsExtra = 0;
+ wndClass.cbWndExtra = 0;
+ wndClass.hbrBackground = IntPtr.Zero;
+ wndClass.hCursor = Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_ARROW);
+ wndClass.hIcon = IntPtr.Zero;
+ wndClass.hInstance = IntPtr.Zero;
+ wndClass.lpszClassName = XplatUI.DefaultClassName;
+ wndClass.lpszMenuName = "";
+
+ result=Win32RegisterClass(ref wndClass);
+ if (result==false) {
+ Win32MessageBox(IntPtr.Zero, "Could not register the "+XplatUI.DefaultClassName+" window class, win32 error " + Win32GetLastError().ToString(), "Oops", 0);
+ }
+
+ FosterParent=Win32CreateWindow(0, "static", "Foster Parent Window", (int)(WindowStyles.WS_OVERLAPPEDWINDOW | WindowStyles.WS_EX_TOOLWINDOW), 0, 0, 0, 0, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
+
+ if (FosterParent==IntPtr.Zero) {
+ Win32MessageBox(IntPtr.Zero, "Could not create foster window, win32 error " + Win32GetLastError().ToString(), "Oops", 0);
+ }
+
+ timer_list = new Hashtable ();
+ }
+ #endregion // Constructor & Destructor
+
+ #region Private Support Methods
+ private static IntPtr DefWndProc(IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) {
+ return Win32DefWindowProc(hWnd, msg, wParam, lParam);
+ }
+
+ private static bool MessageWaiting {
+ get {
+ if (message_queue.Count == 0) {
+ return false;
+ }
+ return true;
+ }
+ }
+
+ private static bool RetrieveMessage(ref MSG msg) {
+ MSG message;
+
+ if (message_queue.Count == 0) {
+ return false;
+ }
+
+ message = (MSG)message_queue.Dequeue();
+ msg = message;
+
+ return true;
+ }
+
+ private static bool StoreMessage(ref MSG msg) {
+ MSG message = new MSG();
+
+ message = msg;
+ message_queue.Enqueue(message);
+
+ return true;
+ }
+
+ internal static String AnsiToString(IntPtr ansi_data) {
+ return (string)Marshal.PtrToStringAnsi(ansi_data);
+ }
+
+ internal static String UnicodeToString(IntPtr unicode_data) {
+ return (string)Marshal.PtrToStringUni(unicode_data);
+ }
+
+ internal static Image DIBtoImage(IntPtr dib_data) {
+ BITMAPINFOHEADER bmi;
+ int ncolors;
+ int imagesize;
+ int palettesize;
+ Bitmap bmp;
+ BitmapData bits;
+ ColorPalette pal;
+ int[] palette;
+ byte[] imagebits;
+ int bytesPerLine;
+
+ bmi = (BITMAPINFOHEADER)Marshal.PtrToStructure(dib_data, typeof(BITMAPINFOHEADER));
+
+ ncolors = (int)bmi.biClrUsed;
+ if (ncolors == 0) {
+ if (bmi.biBitCount < 24) {
+ ncolors = (int)(1 << bmi.biBitCount);
+ }
+ }
+ palettesize = ncolors * 4;
+
+ imagesize = (int)bmi.biSizeImage;
+ if (imagesize == 0) {
+ imagesize = (int)(((((bmi.biWidth * bmi.biBitCount) + 31) & ~31) >> 3) * bmi.biHeight);
+ }
+
+ switch(bmi.biBitCount) {
+ case 1: { // Monochrome
+ bmp = new Bitmap(bmi.biWidth, bmi.biHeight, PixelFormat.Format1bppIndexed);
+ palette = new int[2];
+ break;
+ }
+
+ case 4: { // 4bpp
+ bmp = new Bitmap(bmi.biWidth, bmi.biHeight, PixelFormat.Format4bppIndexed);
+ palette = new int[16];
+ break;
+ }
+
+ case 8: { // 8bpp
+ bmp = new Bitmap(bmi.biWidth, bmi.biHeight, PixelFormat.Format8bppIndexed);
+ palette = new int[256];
+ break;
+ }
+
+ case 24:
+ case 32: { // 32bpp
+ bmp = new Bitmap(bmi.biWidth, bmi.biHeight, PixelFormat.Format32bppArgb);
+ palette = new int[0];
+ break;
+ }
+
+ default: {
+ throw new Exception("Unexpected number of bits:" + bmi.biBitCount.ToString());
+ }
+ }
+
+ if (bmi.biBitCount < 24) {
+ pal = bmp.Palette; // Managed palette
+ Marshal.Copy((IntPtr)((int)dib_data + Marshal.SizeOf(typeof(BITMAPINFOHEADER))), palette, 0, palette.Length);
+
+ for (int i = 0; i < ncolors; i++) {
+ pal.Entries[i] = Color.FromArgb(palette[i] & unchecked((int)0xff000000));
+ }
+ }
+
+ bytesPerLine = (int)((((bmi.biWidth * bmi.biBitCount) + 31) & ~31) >> 3);
+ bits = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.WriteOnly, bmp.PixelFormat);
+
+ imagebits = new byte[bytesPerLine];
+
+ for (int y = 0; y < bmi.biHeight; y++) {
+ // Copy from source to managed
+ Marshal.Copy((IntPtr)((int)dib_data + Marshal.SizeOf(typeof(BITMAPINFOHEADER)) + palette.Length * 4 + bytesPerLine * y), imagebits, 0, bytesPerLine);
+
+ // Copy from managed to dest
+ Marshal.Copy(imagebits, 0, (IntPtr)((int)bits.Scan0 + bits.Stride * (bmi.biHeight - 1 - y)), imagebits.Length);
+ }
+
+ bmp.UnlockBits(bits);
+
+ return bmp;
+ }
+
+ internal static byte[] ImageToDIB(Image image) {
+ MemoryStream ms;
+ byte[] buffer;
+ byte[] retbuf;
+
+ ms = new MemoryStream();
+ image.Save(ms, ImageFormat.Bmp);
+ buffer = ms.GetBuffer();
+
+ // Filter out the file header
+ retbuf = new byte[buffer.Length];
+ Array.Copy(buffer, 14, retbuf, 0, buffer.Length - 14);
+ return retbuf;
+ }
+
+ internal static IntPtr DupGlobalMem(IntPtr mem) {
+ IntPtr dup;
+ IntPtr dup_ptr;
+ IntPtr mem_ptr;
+ uint len;
+
+ len = Win32GlobalSize(mem);
+ mem_ptr = Win32GlobalLock(mem);
+
+ dup = Win32GlobalAlloc(GAllocFlags.GMEM_MOVEABLE, (int)len);
+ dup_ptr = Win32GlobalLock(dup);
+
+ Win32CopyMemory(dup_ptr, mem_ptr, (int)len);
+
+ Win32GlobalUnlock(mem);
+ Win32GlobalUnlock(dup);
+
+ return dup;
+ }
+ #endregion // Private Support Methods
+
+ #region Static Properties
+ internal override Keys ModifierKeys {
+ get {
+ short state;
+ Keys key_state;
+
+ key_state = Keys.None;
+
+ state = Win32GetKeyState(VirtualKeys.VK_SHIFT);
+ if ((state & 0x8000) != 0) {
+ key_state |= Keys.Shift;
+ }
+ state = Win32GetKeyState(VirtualKeys.VK_CONTROL);
+ if ((state & 0x8000) != 0) {
+ key_state |= Keys.Control;
+ }
+
+ state = Win32GetKeyState(VirtualKeys.VK_MENU);
+ if ((state & 0x8000) != 0) {
+ key_state |= Keys.Alt;
+ }
+
+ return key_state;
+ }
+ }
+
+ internal override MouseButtons MouseButtons {
+ get {
+ return mouse_state;
+ }
+ }
+
+ internal override Point MousePosition {
+ get {
+ return mouse_position;
+ }
+ }
+
+ internal override bool DropTarget {
+ get {
+ return false;
+ }
+
+ set {
+ if (value) {
+ //throw new NotImplementedException("Need to figure out D'n'D for Win32");
+ }
+ }
+ }
+
+ internal override int Caption {
+ get {
+ return Win32GetSystemMetrics(SystemMetrics.SM_CYCAPTION);
+ }
+ }
+
+ internal override Size CursorSize {
+ get {
+ return new Size(Win32GetSystemMetrics(SystemMetrics.SM_CXCURSOR), Win32GetSystemMetrics(SystemMetrics.SM_CYCURSOR));
+ }
+ }
+
+ internal override bool DragFullWindows {
+ get {
+ return true;
+ }
+ }
+
+ internal override Size DragSize {
+ get {
+ return new Size(Win32GetSystemMetrics(SystemMetrics.SM_CXDRAG), Win32GetSystemMetrics(SystemMetrics.SM_CYDRAG));
+ }
+ }
+
+ internal override Size FrameBorderSize {
+ get {
+ return new Size(Win32GetSystemMetrics(SystemMetrics.SM_CXFRAME), Win32GetSystemMetrics(SystemMetrics.SM_CYFRAME));
+ }
+ }
+
+ internal override Size IconSize {
+ get {
+ return new Size(Win32GetSystemMetrics(SystemMetrics.SM_CXICON), Win32GetSystemMetrics(SystemMetrics.SM_CYICON));
+ }
+ }
+
+ internal override Size MaxWindowTrackSize {
+ get {
+ return new Size(Win32GetSystemMetrics(SystemMetrics.SM_CXMAXTRACK), Win32GetSystemMetrics(SystemMetrics.SM_CYMAXTRACK));
+ }
+ }
+
+ internal override Size MinimizedWindowSize {
+ get {
+ return new Size(Win32GetSystemMetrics(SystemMetrics.SM_CXMINIMIZED), Win32GetSystemMetrics(SystemMetrics.SM_CYMINIMIZED));
+ }
+ }
+
+ internal override Size MinimizedWindowSpacingSize {
+ get {
+ return new Size(Win32GetSystemMetrics(SystemMetrics.SM_CXMINSPACING), Win32GetSystemMetrics(SystemMetrics.SM_CYMINSPACING));
+ }
+ }
+
+ internal override Size MinimumWindowSize {
+ get {
+ return new Size(Win32GetSystemMetrics(SystemMetrics.SM_CXMIN), Win32GetSystemMetrics(SystemMetrics.SM_CYMIN));
+ }
+ }
+
+ internal override Size MinWindowTrackSize {
+ get {
+ return new Size(Win32GetSystemMetrics(SystemMetrics.SM_CXMINTRACK), Win32GetSystemMetrics(SystemMetrics.SM_CYMINTRACK));
+ }
+ }
+
+ internal override Size SmallIconSize {
+ get {
+ return new Size(Win32GetSystemMetrics(SystemMetrics.SM_CXSMICON), Win32GetSystemMetrics(SystemMetrics.SM_CYSMICON));
+ }
+ }
+
+ internal override int MouseButtonCount {
+ get {
+ return Win32GetSystemMetrics(SystemMetrics.SM_CMOUSEBUTTONS);
+ }
+ }
+
+ internal override bool MouseButtonsSwapped {
+ get {
+ return Win32GetSystemMetrics(SystemMetrics.SM_SWAPBUTTON) != 0;
+ }
+ }
+
+ internal override bool MouseWheelPresent {
+ get {
+ return Win32GetSystemMetrics(SystemMetrics.SM_MOUSEWHEELPRESENT) != 0;
+ }
+ }
+
+ internal override Rectangle VirtualScreen {
+ get {
+ return new Rectangle( Win32GetSystemMetrics(SystemMetrics.SM_XVIRTUALSCREEN), Win32GetSystemMetrics(SystemMetrics.SM_YVIRTUALSCREEN),
+ Win32GetSystemMetrics(SystemMetrics.SM_CXVIRTUALSCREEN), Win32GetSystemMetrics(SystemMetrics.SM_CYVIRTUALSCREEN));
+ }
+ }
+
+ internal override Rectangle WorkingArea {
+ get {
+ RECT rect;
+
+ rect = new RECT();
+ Win32SystemParametersInfo(SPIAction.SPI_GETWORKAREA, 0, ref rect, 0);
+ return new Rectangle(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);
+ //return new Rectangle(0, 0, Win32GetSystemMetrics(SystemMetrics.SM.SM_CXSCREEN), Win32GetSystemMetrics(SystemMetrics.SM_CYSCREEN));
+ }
+ }
+ #endregion // Static Properties
+
+ #region Singleton Specific Code
+ public static XplatUIWin32 GetInstance() {
+ if (instance==null) {
+ instance=new XplatUIWin32();
+ }
+ ref_count++;
+ return instance;
+ }
+
+ public int Reference {
+ get {
+ return ref_count;
+ }
+ }
+ #endregion
+
+ #region Public Static Methods
+ internal override IntPtr InitializeDriver() {
+ return IntPtr.Zero;
+ }
+
+ internal override void ShutdownDriver(IntPtr token) {
+ Console.WriteLine("XplatUIWin32 ShutdownDriver called");
+ }
+
+
+ internal void Version() {
+ Console.WriteLine("Xplat version $revision: $");
+ }
+
+ internal override void AudibleAlert() {
+ Win32PlaySound("Default", IntPtr.Zero, SndFlags.SND_ALIAS | SndFlags.SND_ASYNC | SndFlags.SND_NOSTOP | SndFlags.SND_NOWAIT);
+ }
+
+ internal override void GetDisplaySize(out Size size) {
+ RECT rect;
+
+ Win32GetWindowRect(Win32GetDesktopWindow(), out rect);
+
+ size = new Size(rect.right - rect.left, rect.bottom - rect.top);
+ }
+
+ internal override void EnableThemes() {
+ themes_enabled=true;
+ }
+
+ internal override IntPtr CreateWindow(CreateParams cp) {
+ IntPtr WindowHandle;
+ IntPtr ParentHandle;
+ Hwnd hwnd;
+
+ hwnd = new Hwnd();
+
+ ParentHandle=cp.Parent;
+
+ if ((ParentHandle==IntPtr.Zero) && (cp.Style & (int)(WindowStyles.WS_CHILD))!=0) {
+ // We need to use our foster parent window until this poor child gets it's parent assigned
+ ParentHandle = FosterParent;
+ }
+
+ if ( ((cp.Style & (int)(WindowStyles.WS_CHILD))==0) && ((cp.ExStyle & (int)WindowStyles.WS_EX_APPWINDOW) == 0)) {
+ // If we want to be hidden from the taskbar we need to be 'owned' by
+ // something not on the taskbar. FosterParent is just that
+ ParentHandle = FosterParent;
+ }
+
+ WindowHandle = Win32CreateWindow((uint)cp.ExStyle, cp.ClassName, cp.Caption, (uint)cp.Style, cp.X, cp.Y, cp.Width, cp.Height, ParentHandle, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
+
+ if (WindowHandle==IntPtr.Zero) {
+ uint error = Win32GetLastError();
+
+ Win32MessageBox(IntPtr.Zero, "Error : " + error.ToString(), "Failed to create window, class '"+cp.ClassName+"'", 0);
+ }
+
+ hwnd.ClientWindow = WindowHandle;
+
+ Win32SetWindowLong(WindowHandle, WindowLong.GWL_USERDATA, (uint)ThemeEngine.Current.DefaultControlBackColor.ToArgb());
+
+ return WindowHandle;
+ }
+
+ internal override IntPtr CreateWindow(IntPtr Parent, int X, int Y, int Width, int Height) {
+ CreateParams create_params = new CreateParams();
+
+ create_params.Caption = "";
+ create_params.X = X;
+ create_params.Y = Y;
+ create_params.Width = Width;
+ create_params.Height = Height;
+
+ create_params.ClassName=XplatUI.DefaultClassName;
+ create_params.ClassStyle = 0;
+ create_params.ExStyle=0;
+ create_params.Parent=IntPtr.Zero;
+ create_params.Param=0;
+
+ return CreateWindow(create_params);
+ }
+
+ internal override void DestroyWindow(IntPtr handle) {
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+ Win32DestroyWindow(handle);
+ hwnd.Dispose();
+ return;
+ }
+
+ internal override FormWindowState GetWindowState(IntPtr handle) {
+ uint style;
+
+ style = Win32GetWindowLong(handle, WindowLong.GWL_STYLE);
+ if ((style & (uint)WindowStyles.WS_MAXIMIZE) != 0) {
+ return FormWindowState.Maximized;
+ } else if ((style & (uint)WindowStyles.WS_MINIMIZE) != 0) {
+ return FormWindowState.Minimized;
+ }
+ return FormWindowState.Normal;
+ }
+
+ internal override void SetWindowState(IntPtr hwnd, FormWindowState state) {
+ switch(state) {
+ case FormWindowState.Normal: {
+ Win32ShowWindow(hwnd, WindowPlacementFlags.SW_RESTORE);
+ return;
+ }
+
+ case FormWindowState.Minimized: {
+ Win32ShowWindow(hwnd, WindowPlacementFlags.SW_MINIMIZE);
+ return;
+ }
+
+ case FormWindowState.Maximized: {
+ Win32ShowWindow(hwnd, WindowPlacementFlags.SW_MAXIMIZE);
+ return;
+ }
+ }
+ }
+
+ internal override void SetWindowStyle(IntPtr handle, CreateParams cp) {
+ Win32SetWindowLong(handle, WindowLong.GWL_STYLE, (uint)cp.Style);
+ Win32SetWindowLong(handle, WindowLong.GWL_EXSTYLE, (uint)cp.ExStyle);
+ }
+
+
+ internal override void SetWindowTransparency(IntPtr handle, double transparency, Color key) {
+ LayeredWindowAttributes lwa = LayeredWindowAttributes.LWA_ALPHA;
+ byte opacity = (byte)(transparency*255);
+ COLORREF clrRef = new COLORREF();
+ if (key != Color.Empty) {
+ clrRef.R = key.R;
+ clrRef.G = key.G;
+ clrRef.B = key.B;
+ lwa = (LayeredWindowAttributes)( (int)lwa | (int)LayeredWindowAttributes.LWA_COLORKEY );
+ }
+ RECT rc;
+ rc.right = 1000;
+ rc.bottom = 1000;
+ Win32SetLayeredWindowAttributes(handle, clrRef, opacity, lwa);
+ }
+
+ internal override bool SupportsTransparency() {
+ // We might check with the OS, but I think we're only >=W2k
+ return true;
+ }
+
+ internal override void UpdateWindow(IntPtr handle) {
+ Win32UpdateWindow(handle);
+ }
+
+ [MonoTODO("FIXME - Add support for internal table of windows/DCs for cleanup; handle client=false to draw in NC area")]
+ internal override PaintEventArgs PaintEventStart(IntPtr handle, bool client) {
+ IntPtr hdc;
+ PAINTSTRUCT ps;
+ PaintEventArgs paint_event;
+ RECT rect;
+ Rectangle clip_rect;
+ Hwnd hwnd;
+
+ clip_rect = new Rectangle();
+ rect = new RECT();
+ ps = new PAINTSTRUCT();
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+ if (Win32GetUpdateRect(handle, ref rect, false)) {
+ hdc = Win32BeginPaint(handle, ref ps);
+
+ hwnd.user_data = (object)ps;
+
+ clip_rect = new Rectangle(ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right-ps.rcPaint.left, ps.rcPaint.bottom-ps.rcPaint.top);
+ } else {
+ hdc = Win32GetDC(handle);
+ // FIXME: Add the DC to internal list
+ clip_rect = new Rectangle(rect.top, rect.left, rect.right-rect.left, rect.bottom-rect.top);
+ }
+
+ hwnd.client_dc = Graphics.FromHdc(hdc);
+ paint_event = new PaintEventArgs(hwnd.client_dc, clip_rect);
+
+ return paint_event;
+ }
+
+ internal override void PaintEventEnd(IntPtr handle, bool client) {
+ Hwnd hwnd;
+ PAINTSTRUCT ps;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+ hwnd.client_dc.Dispose();
+
+ if (hwnd.user_data != null) {
+ ps = (PAINTSTRUCT)hwnd.user_data;
+ Win32EndPaint(handle, ref ps);
+ }
+ }
+
+
+ internal override void SetWindowPos(IntPtr handle, int x, int y, int width, int height) {
+ Win32MoveWindow(handle, x, y, width, height, true);
+ return;
+ }
+
+ internal override void GetWindowPos(IntPtr handle, bool is_toplevel, out int x, out int y, out int width, out int height, out int client_width, out int client_height) {
+ RECT rect;
+ POINT pt;
+
+ Win32GetWindowRect(handle, out rect);
+ width = rect.right - rect.left;
+ height = rect.bottom - rect.top;
+
+ pt.x=rect.left;
+ pt.y=rect.top;
+ Win32ScreenToClient(Win32GetParent(handle), ref pt);
+ x = pt.x;
+ y = pt.y;
+
+ Win32GetClientRect(handle, out rect);
+ client_width = rect.right - rect.left;
+ client_height = rect.bottom - rect.top;
+ return;
+ }
+
+ internal override void Activate(IntPtr handle) {
+ Win32SetActiveWindow(handle);
+ }
+
+ internal override void Invalidate(IntPtr handle, Rectangle rc, bool clear) {
+ RECT rect;
+
+ rect.left=rc.Left;
+ rect.top=rc.Top;
+ rect.right=rc.Right;
+ rect.bottom=rc.Bottom;
+ Win32InvalidateRect(handle, ref rect, clear);
+ }
+
+ internal override IntPtr DefWndProc(ref Message msg) {
+ msg.Result=Win32DefWindowProc(msg.HWnd, (Msg)msg.Msg, msg.WParam, msg.LParam);
+ return msg.Result;
+ }
+
+ internal override void HandleException(Exception e) {
+ StackTrace st = new StackTrace(e);
+ Win32MessageBox(IntPtr.Zero, e.Message+st.ToString(), "Exception", 0);
+ Console.WriteLine("{0}{1}", e.Message, st.ToString());
+ }
+
+ internal override void DoEvents() {
+ MSG msg = new MSG();
+
+ if (override_cursor != IntPtr.Zero) {
+ Cursor.Current = null;
+ }
+
+ while (Win32PeekMessage(ref msg, IntPtr.Zero, 0, 0, (uint)PeekMessageFlags.PM_REMOVE)==true) {
+ XplatUI.TranslateMessage(ref msg);
+ XplatUI.DispatchMessage(ref msg);
+ }
+ }
+
+ internal override bool PeekMessage(ref MSG msg, IntPtr hWnd, int wFilterMin, int wFilterMax, uint flags) {
+ return Win32PeekMessage(ref msg, hWnd, wFilterMin, wFilterMax, flags);
+ }
+
+ internal override void PostQuitMessage(int exitCode) {
+ Win32PostQuitMessage(exitCode);
+ }
+
+ internal override bool GetMessage(ref MSG msg, IntPtr hWnd, int wFilterMin, int wFilterMax) {
+ bool result;
+
+ if (RetrieveMessage(ref msg)) {
+ return true;
+ }
+
+ result = Win32GetMessage(ref msg, hWnd, wFilterMin, wFilterMax);
+
+ // We need to fake WM_MOUSE_ENTER/WM_MOUSE_LEAVE
+ switch (msg.message) {
+ case Msg.WM_LBUTTONDOWN: {
+ mouse_state |= MouseButtons.Left;
+ break;
+ }
+
+ case Msg.WM_MBUTTONDOWN: {
+ mouse_state |= MouseButtons.Middle;
+ break;
+ }
+
+ case Msg.WM_RBUTTONDOWN: {
+ mouse_state |= MouseButtons.Right;
+ break;
+ }
+
+ case Msg.WM_LBUTTONUP: {
+ mouse_state &= ~MouseButtons.Left;
+ break;
+ }
+
+ case Msg.WM_MBUTTONUP: {
+ mouse_state &= ~MouseButtons.Middle;
+ break;
+ }
+
+ case Msg.WM_RBUTTONUP: {
+ mouse_state &= ~MouseButtons.Right;
+ break;
+ }
+
+ case Msg.WM_ASYNC_MESSAGE: {
+ XplatUIDriverSupport.ExecuteClientMessage((GCHandle)msg.lParam);
+ break;
+ }
+
+ case Msg.WM_MOUSEMOVE: {
+ if (msg.hwnd != prev_mouse_hwnd) {
+ TRACKMOUSEEVENT tme;
+
+ // The current message will be sent out next time around
+ StoreMessage(ref msg);
+
+ // This is the message we want to send at this point
+ msg.message = Msg.WM_MOUSE_ENTER;
+
+ prev_mouse_hwnd = msg.hwnd;
+
+ tme = new TRACKMOUSEEVENT();
+ tme.size = Marshal.SizeOf(tme);
+ tme.hWnd = msg.hwnd;
+ tme.dwFlags = TMEFlags.TME_LEAVE | TMEFlags.TME_HOVER;
+ Win32TrackMouseEvent(ref tme);
+ return result;
+ }
+ break;
+ }
+
+ case Msg.WM_DROPFILES: {
+ return Win32DnD.HandleWMDropFiles(ref msg);
+ }
+
+ case Msg.WM_MOUSELEAVE: {
+ prev_mouse_hwnd = IntPtr.Zero;
+ msg.message=Msg.WM_MOUSE_LEAVE;
+ break;
+ }
+
+ case Msg.WM_TIMER: {
+ Timer timer=(Timer)timer_list[(int)msg.wParam];
+
+ if (timer != null) {
+ timer.FireTick();
+ }
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ internal override bool TranslateMessage(ref MSG msg) {
+ return Win32TranslateMessage(ref msg);
+ }
+
+ internal override IntPtr DispatchMessage(ref MSG msg) {
+ return Win32DispatchMessage(ref msg);
+ }
+
+ internal override bool SetZOrder(IntPtr hWnd, IntPtr AfterhWnd, bool Top, bool Bottom) {
+ if (Top) {
+ Win32SetWindowPos(hWnd, SetWindowPosZOrder.HWND_TOP, 0, 0, 0, 0, SetWindowPosFlags.SWP_NOMOVE | SetWindowPosFlags.SWP_NOSIZE);
+ return true;
+ } else if (!Bottom) {
+ Win32SetWindowPos(hWnd, AfterhWnd, 0, 0, 0, 0, SetWindowPosFlags.SWP_NOMOVE | SetWindowPosFlags.SWP_NOSIZE);
+ } else {
+ Win32SetWindowPos(hWnd, (IntPtr)SetWindowPosZOrder.HWND_BOTTOM, 0, 0, 0, 0, SetWindowPosFlags.SWP_NOMOVE | SetWindowPosFlags.SWP_NOSIZE);
+ return true;
+ }
+ return false;
+ }
+
+ internal override bool SetTopmost(IntPtr hWnd, IntPtr hWndOwner, bool Enabled) {
+ if (Enabled) {
+ Win32SetWindowPos(hWnd, SetWindowPosZOrder.HWND_TOPMOST, 0, 0, 0, 0, SetWindowPosFlags.SWP_NOMOVE | SetWindowPosFlags.SWP_NOSIZE);
+ return true;
+ } else {
+ Win32SetWindowPos(hWnd, SetWindowPosZOrder.HWND_NOTOPMOST, 0, 0, 0, 0, SetWindowPosFlags.SWP_NOMOVE | SetWindowPosFlags.SWP_NOSIZE);
+ return true;
+ }
+ }
+
+ internal override bool Text(IntPtr handle, string text) {
+ Win32SetWindowText(handle, text);
+ return true;
+ }
+
+ internal override bool GetText(IntPtr handle, out string text) {
+ StringBuilder sb;
+
+ sb = new StringBuilder(256);
+ Win32GetWindowText(handle, sb, sb.Capacity);
+ text = sb.ToString();
+ return true;
+ }
+
+ internal override bool SetVisible(IntPtr handle, bool visible) {
+ if (visible) {
+ Win32ShowWindow(handle, WindowPlacementFlags.SW_SHOWNORMAL);
+ } else {
+ Win32ShowWindow(handle, WindowPlacementFlags.SW_HIDE);
+ }
+ return true;
+ }
+
+ internal override bool IsEnabled(IntPtr handle) {
+ return IsWindowEnabled (handle);
+ }
+
+ internal override bool IsVisible(IntPtr handle) {
+ return IsWindowVisible (handle);
+ }
+
+ internal override IntPtr SetParent(IntPtr handle, IntPtr parent) {
+ return Win32SetParent(handle, parent);
+ }
+
+ internal override IntPtr GetParent(IntPtr handle) {
+ return Win32GetParent(handle);
+ }
+
+ internal override void GrabWindow(IntPtr hWnd, IntPtr ConfineToHwnd) {
+ grab_hwnd = hWnd;
+ Win32SetCapture(hWnd);
+ }
+
+ internal override void GrabInfo(out IntPtr hWnd, out bool GrabConfined, out Rectangle GrabArea) {
+ hWnd = grab_hwnd;
+ GrabConfined = grab_confined;
+ GrabArea = grab_area;
+ }
+
+ internal override void UngrabWindow(IntPtr hWnd) {
+ Win32ReleaseCapture();
+ grab_hwnd = IntPtr.Zero;
+ }
+
+ internal override bool CalculateWindowRect(IntPtr hWnd, ref Rectangle ClientRect, int Style, int ExStyle, Menu menu, out Rectangle WindowRect) {
+ RECT rect;
+
+ rect.left=ClientRect.Left;
+ rect.top=ClientRect.Top;
+ rect.right=ClientRect.Right;
+ rect.bottom=ClientRect.Bottom;
+
+ if (!Win32AdjustWindowRectEx(ref rect, Style, menu != null, ExStyle)) {
+ WindowRect = new Rectangle(ClientRect.Left, ClientRect.Top, ClientRect.Width, ClientRect.Height);
+ return false;
+ }
+
+ WindowRect = new Rectangle(rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top);
+ return true;
+ }
+
+ internal override void SetCursor(IntPtr window, IntPtr cursor) {
+ Win32SetCursor(cursor);
+ return;
+ }
+
+ internal override void ShowCursor(bool show) {
+ Win32ShowCursor(show);
+ }
+
+ internal override void OverrideCursor(IntPtr cursor) {
+ Win32SetCursor(cursor);
+ }
+
+ internal override IntPtr DefineCursor(Bitmap bitmap, Bitmap mask, Color cursor_pixel, Color mask_pixel, int xHotSpot, int yHotSpot) {
+ IntPtr cursor;
+ Bitmap cursor_bitmap;
+ Bitmap cursor_mask;
+ Byte[] cursor_bits;
+ Byte[] mask_bits;
+ Color pixel;
+ int width;
+ int height;
+
+ // Win32 only allows creation cursors of a certain size
+ if ((bitmap.Width != Win32GetSystemMetrics(SystemMetrics.SM_CXCURSOR)) || (bitmap.Width != Win32GetSystemMetrics(SystemMetrics.SM_CXCURSOR))) {
+ cursor_bitmap = new Bitmap(bitmap, new Size(Win32GetSystemMetrics(SystemMetrics.SM_CXCURSOR), Win32GetSystemMetrics(SystemMetrics.SM_CXCURSOR)));
+ cursor_mask = new Bitmap(mask, new Size(Win32GetSystemMetrics(SystemMetrics.SM_CXCURSOR), Win32GetSystemMetrics(SystemMetrics.SM_CXCURSOR)));
+ } else {
+ cursor_bitmap = bitmap;
+ cursor_mask = mask;
+ }
+
+ width = cursor_bitmap.Width;
+ height = cursor_bitmap.Height;
+
+ cursor_bits = new Byte[(width / 8) * height];
+ mask_bits = new Byte[(width / 8) * height];
+
+ for (int y = 0; y < height; y++) {
+ for (int x = 0; x < width; x++) {
+ pixel = cursor_bitmap.GetPixel(x, y);
+
+ if (pixel == cursor_pixel) {
+ cursor_bits[y * width / 8 + x / 8] |= (byte)(0x80 >> (x % 8));
+ }
+
+ pixel = cursor_mask.GetPixel(x, y);
+
+ if (pixel == mask_pixel) {
+ mask_bits[y * width / 8 + x / 8] |= (byte)(0x80 >> (x % 8));
+ }
+ }
+ }
+
+ cursor = Win32CreateCursor(IntPtr.Zero, xHotSpot, yHotSpot, width, height, mask_bits, cursor_bits);
+
+ return cursor;
+ }
+
+ [MonoTODO("Define the missing cursors")]
+ internal override IntPtr DefineStdCursor(StdCursor id) {
+ switch(id) {
+ case StdCursor.AppStarting: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_APPSTARTING);
+ case StdCursor.Arrow: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_ARROW);
+ case StdCursor.Cross: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_CROSS);
+ case StdCursor.Default: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_ARROW);
+ case StdCursor.Hand: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_HAND);
+ case StdCursor.Help: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_HELP);
+ case StdCursor.HSplit: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_ARROW); // FIXME
+ case StdCursor.IBeam: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_IBEAM);
+ case StdCursor.No: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_NO);
+ case StdCursor.NoMove2D: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_ARROW); // FIXME
+ case StdCursor.NoMoveHoriz: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_ARROW); // FIXME
+ case StdCursor.NoMoveVert: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_ARROW); // FIXME
+ case StdCursor.PanEast: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_ARROW); // FIXME
+ case StdCursor.PanNE: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_ARROW); // FIXME
+ case StdCursor.PanNorth: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_ARROW); // FIXME
+ case StdCursor.PanNW: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_ARROW); // FIXME
+ case StdCursor.PanSE: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_ARROW); // FIXME
+ case StdCursor.PanSouth: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_ARROW); // FIXME
+ case StdCursor.PanSW: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_ARROW); // FIXME
+ case StdCursor.PanWest: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_ARROW); // FIXME
+ case StdCursor.SizeAll: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_SIZEALL);
+ case StdCursor.SizeNESW: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_SIZENESW);
+ case StdCursor.SizeNS: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_SIZENS);
+ case StdCursor.SizeNWSE: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_SIZENWSE);
+ case StdCursor.SizeWE: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_SIZEWE);
+ case StdCursor.UpArrow: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_UPARROW);
+ case StdCursor.VSplit: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_ARROW); // FIXME
+ case StdCursor.WaitCursor: return Win32LoadCursor(IntPtr.Zero, LoadCursorType.IDC_WAIT);
+ }
+ throw new NotImplementedException ();
+ }
+
+ internal override void DestroyCursor(IntPtr cursor) {
+ if ((cursor.ToInt32() < (int)LoadCursorType.First) || (cursor.ToInt32() > (int)LoadCursorType.Last)) {
+ Win32DestroyCursor(cursor);
+ }
+ }
+
+ [MonoTODO]
+ internal override void GetCursorInfo(IntPtr cursor, out int width, out int height, out int hotspot_x, out int hotspot_y) {
+ throw new NotImplementedException ();
+ }
+
+ internal override void SetCursorPos(IntPtr handle, int x, int y) {
+ Win32SetCursorPos(x, y);
+ }
+
+ internal override void EnableWindow(IntPtr handle, bool Enable) {
+ Win32EnableWindow(handle, Enable);
+ }
+
+ internal override void EndLoop(System.Threading.Thread thread) {
+ // Nothing to do
+ }
+
+ internal override void StartLoop(System.Threading.Thread thread) {
+ // Nothing to do
+ }
+
+ internal override void SetModal(IntPtr handle, bool Modal) {
+ // we do nothing on Win32
+ }
+
+ internal override void GetCursorPos(IntPtr handle, out int x, out int y) {
+ POINT pt;
+
+ Win32GetCursorPos(out pt);
+
+ if (handle!=IntPtr.Zero) {
+ Win32ScreenToClient(handle, ref pt);
+ }
+
+ x=pt.x;
+ y=pt.y;
+ }
+
+ internal override void ScreenToClient(IntPtr handle, ref int x, ref int y)
+ {
+ POINT pnt = new POINT();
+
+ pnt.x = x;
+ pnt.y = y;
+ Win32ScreenToClient (handle, ref pnt);
+
+ x = pnt.x;
+ y = pnt.y;
+ }
+
+ internal override void ClientToScreen(IntPtr handle, ref int x, ref int y) {
+ POINT pnt = new POINT();
+
+ pnt.x = x;
+ pnt.y = y;
+
+ Win32ClientToScreen(handle, ref pnt);
+
+ x = pnt.x;
+ y = pnt.y;
+ }
+
+ internal override void ScreenToMenu(IntPtr handle, ref int x, ref int y) {
+ RECT rect;
+
+ Win32GetWindowRect(handle, out rect);
+ x -= rect.left + SystemInformation.FrameBorderSize.Width;
+ y -= rect.top + SystemInformation.FrameBorderSize.Height + ThemeEngine.Current.CaptionHeight;
+ return;
+ }
+
+ internal override void MenuToScreen(IntPtr handle, ref int x, ref int y) {
+ RECT rect;
+
+ Win32GetWindowRect(handle, out rect);
+ x += rect.left + SystemInformation.FrameBorderSize.Width;
+ y += rect.top + SystemInformation.FrameBorderSize.Height + ThemeEngine.Current.CaptionHeight;
+ return;
+ }
+
+ internal override void SendAsyncMethod (AsyncMethodData method)
+ {
+ Win32PostMessage(FosterParent, Msg.WM_ASYNC_MESSAGE, IntPtr.Zero, (IntPtr)GCHandle.Alloc (method));
+ }
+
+ internal override void SetTimer (Timer timer)
+ {
+ int index;
+
+ index = timer.GetHashCode();
+
+ lock (timer_list) {
+ timer_list[index]=timer;
+ }
+
+ Win32SetTimer(FosterParent, index, (uint)timer.Interval, IntPtr.Zero);
+ }
+
+ internal override void KillTimer (Timer timer)
+ {
+ int index;
+
+ index = timer.GetHashCode();
+
+ Win32KillTimer(FosterParent, index);
+
+ lock (timer_list) {
+ timer_list.Remove(index);
+ }
+ }
+
+
+ private void CaretCallback(object sender, EventArgs e) {
+ Console.WriteLine("CaretCallback hit");
+ }
+
+ internal override void CreateCaret(IntPtr hwnd, int width, int height) {
+ Win32CreateCaret(hwnd, IntPtr.Zero, width, height);
+ }
+
+ internal override void DestroyCaret(IntPtr hwnd) {
+ Win32DestroyCaret();
+ }
+
+ internal override void SetCaretPos(IntPtr hwnd, int x, int y) {
+ Win32SetCaretPos(x, y);
+ }
+
+ internal override void CaretVisible(IntPtr hwnd, bool visible) {
+ if (visible) {
+ Win32ShowCaret(hwnd);
+ } else {
+ Win32HideCaret(hwnd);
+ }
+ }
+
+ internal override void SetFocus(IntPtr hwnd) {
+ Win32SetFocus(hwnd);
+ }
+
+ internal override IntPtr GetActive() {
+ return Win32GetActiveWindow();
+ }
+
+ internal override bool GetFontMetrics(Graphics g, Font font, out int ascent, out int descent) {
+ IntPtr dc;
+ TEXTMETRIC tm;
+
+ tm = new TEXTMETRIC();
+
+ dc = Win32GetDC(IntPtr.Zero);
+ Win32SelectObject(dc, font.ToHfont());
+ if (Win32GetTextMetrics(dc, ref tm) == false) {
+ Win32ReleaseDC(IntPtr.Zero, dc);
+ ascent = 0;
+ descent = 0;
+ return false;
+ }
+ Win32ReleaseDC(IntPtr.Zero, dc);
+
+ ascent = tm.tmAscent;
+ descent = tm.tmDescent;
+
+ return true;
+ }
+
+ internal override void ScrollWindow(IntPtr hwnd, Rectangle rectangle, int XAmount, int YAmount, bool with_children) {
+ RECT rect;
+
+ rect = new RECT();
+ rect.left = rectangle.X;
+ rect.top = rectangle.Y;
+ rect.right = rectangle.Right;
+ rect.bottom = rectangle.Bottom;
+
+ Win32ScrollWindowEx(hwnd, XAmount, YAmount, ref rect, ref rect, IntPtr.Zero, IntPtr.Zero, ScrollWindowExFlags.SW_INVALIDATE | ScrollWindowExFlags.SW_ERASE | (with_children ? ScrollWindowExFlags.SW_SCROLLCHILDREN : ScrollWindowExFlags.SW_NONE));
+ Win32UpdateWindow(hwnd);
+ }
+
+ internal override void ScrollWindow(IntPtr hwnd, int XAmount, int YAmount, bool with_children) {
+ Win32ScrollWindowEx(hwnd, XAmount, YAmount, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, ScrollWindowExFlags.SW_INVALIDATE | ScrollWindowExFlags.SW_ERASE | (with_children ? ScrollWindowExFlags.SW_SCROLLCHILDREN : ScrollWindowExFlags.SW_NONE));
+ }
+
+ internal override bool SystrayAdd(IntPtr hwnd, string tip, Icon icon, out ToolTip tt) {
+ NOTIFYICONDATA nid;
+
+ nid = new NOTIFYICONDATA();
+
+ nid.cbSize = (uint)Marshal.SizeOf(nid);
+ nid.hWnd = hwnd;
+ nid.uID = 1;
+ nid.uCallbackMessage = (uint)Msg.WM_USER;
+ nid.uFlags = NotifyIconFlags.NIF_MESSAGE;
+
+ if (tip != null) {
+ nid.szTip = tip;
+ nid.uFlags |= NotifyIconFlags.NIF_TIP;
+ }
+
+ if (icon != null) {
+ nid.hIcon = icon.Handle;
+ nid.uFlags |= NotifyIconFlags.NIF_ICON;
+ }
+
+ tt = null;
+
+ return Win32Shell_NotifyIcon(NotifyIconMessage.NIM_ADD, ref nid);
+ }
+
+ internal override bool SystrayChange(IntPtr hwnd, string tip, Icon icon, ref ToolTip tt) {
+ NOTIFYICONDATA nid;
+
+ nid = new NOTIFYICONDATA();
+
+ nid.cbSize = (uint)Marshal.SizeOf(nid);
+ nid.hIcon = icon.Handle;
+ nid.hWnd = hwnd;
+ nid.uID = 1;
+ nid.uCallbackMessage = (uint)Msg.WM_USER;
+ nid.uFlags = NotifyIconFlags.NIF_MESSAGE;
+
+ if (tip != null) {
+ nid.szTip = tip;
+ nid.uFlags |= NotifyIconFlags.NIF_TIP;
+ }
+
+ if (icon != null) {
+ nid.hIcon = icon.Handle;
+ nid.uFlags |= NotifyIconFlags.NIF_ICON;
+ }
+
+ return Win32Shell_NotifyIcon(NotifyIconMessage.NIM_MODIFY, ref nid);
+ }
+
+ internal override void SystrayRemove(IntPtr hwnd, ref ToolTip tt) {
+ NOTIFYICONDATA nid;
+
+ nid = new NOTIFYICONDATA();
+
+ nid.cbSize = (uint)Marshal.SizeOf(nid);
+ nid.hWnd = hwnd;
+ nid.uID = 1;
+ nid.uFlags = 0;
+
+ Win32Shell_NotifyIcon(NotifyIconMessage.NIM_DELETE, ref nid);
+ }
+
+
+ internal override void SetBorderStyle(IntPtr handle, FormBorderStyle border_style) {
+ uint style;
+ uint exstyle;
+
+ style = Win32GetWindowLong(handle, WindowLong.GWL_STYLE);
+ exstyle = Win32GetWindowLong(handle, WindowLong.GWL_EXSTYLE);
+
+ switch (border_style) {
+ case FormBorderStyle.None: {
+ style &= ~(uint)WindowStyles.WS_BORDER;
+ exstyle &= ~(uint)WindowStyles.WS_EX_CLIENTEDGE;
+ break;
+ }
+
+ case FormBorderStyle.FixedSingle: {
+ style |= (uint)WindowStyles.WS_BORDER;
+ exstyle &= ~(uint)WindowStyles.WS_EX_CLIENTEDGE;
+ break;
+ }
+
+ case FormBorderStyle.Fixed3D: {
+ style &= ~(uint)WindowStyles.WS_BORDER;
+ exstyle |= (uint)WindowStyles.WS_EX_CLIENTEDGE;
+ break;
+ }
+ }
+
+ Win32SetWindowLong(handle, WindowLong.GWL_STYLE, style);
+ Win32SetWindowLong(handle, WindowLong.GWL_EXSTYLE, exstyle);
+
+ Win32SetWindowPos(handle, IntPtr.Zero, 0, 0, 0, 0,
+ SetWindowPosFlags.SWP_FRAMECHANGED | SetWindowPosFlags.SWP_NOMOVE | SetWindowPosFlags.SWP_NOSIZE | SetWindowPosFlags.SWP_NOACTIVATE);
+ }
+
+ internal override void SetMenu(IntPtr handle, Menu menu) {
+ // Trigger WM_NCCALC
+ Win32SetWindowPos(handle, IntPtr.Zero, 0, 0, 0, 0, SetWindowPosFlags.SWP_FRAMECHANGED | SetWindowPosFlags.SWP_NOMOVE | SetWindowPosFlags.SWP_NOSIZE);
+ }
+
+
+ internal override Graphics GetMenuDC(IntPtr hwnd, IntPtr ncpaint_region) {
+ IntPtr hdc;
+ Graphics g;
+
+ // GDI+ Broken:
+ // hdc = Win32GetDCEx(hwnd, ncpaint_region, DCExFlags.DCX_WINDOW | DCExFlags.DCX_INTERSECTRGN | DCExFlags.DCX_USESTYLE);
+ hdc = Win32GetDCEx(hwnd, ncpaint_region, DCExFlags.DCX_WINDOW);
+
+ g = Graphics.FromHdc(hdc);
+
+ Win32ReleaseDC(hwnd, hdc);
+
+ return g;
+ }
+
+ internal override Point GetMenuOrigin(IntPtr handle) {
+ return new Point(SystemInformation.FrameBorderSize.Width, SystemInformation.FrameBorderSize.Height + ThemeEngine.Current.CaptionHeight);
+ }
+
+
+ internal override void ReleaseMenuDC(IntPtr hwnd, Graphics dc) {
+ dc.Dispose();
+ }
+
+ internal override void SetIcon(IntPtr hwnd, Icon icon) {
+ Win32SendMessage(hwnd, Msg.WM_SETICON, (IntPtr)1, icon.Handle); // 1 = large icon (0 would be small)
+ }
+
+ internal override void ClipboardClose(IntPtr handle) {
+ if (handle != clip_magic) {
+ throw new ArgumentException("handle is not a valid clipboard handle");
+ }
+ Win32CloseClipboard();
+ }
+
+ internal override int ClipboardGetID(IntPtr handle, string format) {
+ if (handle != clip_magic) {
+ throw new ArgumentException("handle is not a valid clipboard handle");
+ }
+ if (format == "Text" ) return 1;
+ else if (format == "Bitmap" ) return 2;
+ else if (format == "MetaFilePict" ) return 3;
+ else if (format == "SymbolicLink" ) return 4;
+ else if (format == "DataInterchangeFormat" ) return 5;
+ else if (format == "Tiff" ) return 6;
+ else if (format == "OEMText" ) return 7;
+ else if (format == "DeviceIndependentBitmap" ) return 8;
+ else if (format == "Palette" ) return 9;
+ else if (format == "PenData" ) return 10;
+ else if (format == "RiffAudio" ) return 11;
+ else if (format == "WaveAudio" ) return 12;
+ else if (format == "UnicodeText" ) return 13;
+ else if (format == "EnhancedMetafile" ) return 14;
+ else if (format == "FileDrop" ) return 15;
+ else if (format == "Locale" ) return 16;
+
+ return (int)Win32RegisterClipboardFormat(format);
+ }
+
+ internal override IntPtr ClipboardOpen() {
+ Win32OpenClipboard(FosterParent);
+ return clip_magic;
+ }
+
+ internal override int[] ClipboardAvailableFormats(IntPtr handle) {
+ uint format;
+ int[] result;
+ int count;
+
+ if (handle != clip_magic) {
+ return null;
+ }
+
+ // Count first
+ count = 0;
+ format = 0;
+ do {
+ format = Win32EnumClipboardFormats(format);
+ if (format != 0) {
+ count++;
+ }
+ } while (format != 0);
+
+ // Now assign
+ result = new int[count];
+ count = 0;
+ format = 0;
+ do {
+ format = Win32EnumClipboardFormats(format);
+ if (format != 0) {
+ result[count++] = (int)format;
+ }
+ } while (format != 0);
+
+ return result;
+ }
+
+
+ internal override object ClipboardRetrieve(IntPtr handle, int type, XplatUI.ClipboardToObject converter) {
+ IntPtr hmem;
+ IntPtr data;
+ object obj;
+
+ if (handle != clip_magic) {
+ throw new ArgumentException("handle is not a valid clipboard handle");
+ }
+
+ hmem = Win32GetClipboardData((uint)type);
+ if (hmem == IntPtr.Zero) {
+ return null;
+ }
+
+ data = Win32GlobalLock(hmem);
+ if (data == IntPtr.Zero) {
+ uint error = Win32GetLastError();
+ Console.WriteLine("Error: {0}", error);
+ return null;
+ }
+
+ obj = null;
+
+ if (type == DataFormats.GetFormat(DataFormats.Rtf).Id) {
+ obj = AnsiToString(data);
+ } else switch ((ClipboardFormats)type) {
+ case ClipboardFormats.CF_TEXT: {
+ obj = AnsiToString(data);
+ break;
+ }
+
+ case ClipboardFormats.CF_DIB: {
+ obj = DIBtoImage(data);
+ break;
+ }
+
+ case ClipboardFormats.CF_UNICODETEXT: {
+ obj = UnicodeToString(data);
+ break;
+ }
+
+ default: {
+ if (converter != null && !converter(type, data, out obj)) {
+ obj = null;
+ }
+ break;
+ }
+ }
+ Win32GlobalUnlock(hmem);
+
+ return obj;
+
+ }
+
+ internal override void ClipboardStore(IntPtr handle, object obj, int type, XplatUI.ObjectToClipboard converter) {
+ byte[] data;
+ IntPtr hmem;
+ IntPtr hmem_ptr;
+
+ if (handle != clip_magic) {
+ throw new ArgumentException("handle is not a valid clipboard handle");
+ }
+
+ if (obj == null) {
+ // Just clear it
+ Win32EmptyClipboard();
+ return;
+ }
+
+ if (type == -1) {
+ if (obj is string) {
+ type = (int)ClipboardFormats.CF_UNICODETEXT;
+ } else if (obj is Image) {
+ type = (int)ClipboardFormats.CF_DIB;
+ }
+ }
+
+ if (type == DataFormats.GetFormat(DataFormats.Rtf).Id) {
+ hmem = Marshal.StringToHGlobalAnsi((string)obj);
+ Win32SetClipboardData((uint)type, hmem);
+ return;
+ } else switch((ClipboardFormats)type) {
+ case ClipboardFormats.CF_UNICODETEXT: {
+ hmem = Marshal.StringToHGlobalUni((string)obj);
+ Win32SetClipboardData((uint)type, hmem);
+ return;
+ }
+
+ case ClipboardFormats.CF_TEXT: {
+ hmem = Marshal.StringToHGlobalAnsi((string)obj);
+ Win32SetClipboardData((uint)type, hmem);
+ return;
+ }
+
+ case ClipboardFormats.CF_BITMAP:
+ case ClipboardFormats.CF_DIB: {
+ data = ImageToDIB((Image)obj);
+
+ hmem = Win32GlobalAlloc(GAllocFlags.GMEM_MOVEABLE | GAllocFlags.GMEM_DDESHARE, data.Length);
+ hmem_ptr = Win32GlobalLock(hmem);
+ Marshal.Copy(data, 0, hmem_ptr, data.Length);
+ Win32GlobalUnlock(hmem);
+ Win32SetClipboardData((uint)ClipboardFormats.CF_DIB, hmem);
+ return;
+ }
+
+ default: {
+ if (converter != null && converter(ref type, obj, out data)) {
+ hmem = Win32GlobalAlloc(GAllocFlags.GMEM_MOVEABLE | GAllocFlags.GMEM_DDESHARE, data.Length);
+ hmem_ptr = Win32GlobalLock(hmem);
+ Marshal.Copy(data, 0, hmem_ptr, data.Length);
+ Win32GlobalUnlock(hmem);
+ Win32SetClipboardData((uint)type, hmem);
+ }
+ return;
+ }
+ }
+ }
+
+ internal override void SetAllowDrop(IntPtr hwnd, bool allowed) {
+ if (allowed) {
+ Win32DnD.RegisterDropTarget(hwnd);
+ } else {
+ Win32DnD.UnregisterDropTarget(hwnd);
+ }
+ }
+
+ internal override DragDropEffects StartDrag(IntPtr hwnd, object data, DragDropEffects allowedEffects) {
+ return Win32DnD.StartDrag(hwnd, data, allowedEffects);
+ }
+
+ internal override void DrawReversibleRectangle(IntPtr handle, Rectangle rect, int line_width) {
+ IntPtr hdc;
+ IntPtr pen;
+ IntPtr oldpen;
+ POINT pt;
+
+ pt = new POINT();
+ pt.x = 0;
+ pt.y = 0;
+ Win32ClientToScreen(handle, ref pt);
+
+ // If we want the standard hatch pattern we would
+ // need to create a brush
+
+ // Grab a pen
+ pen = Win32CreatePen(PenStyle.PS_SOLID, line_width, IntPtr.Zero);
+
+ hdc = Win32GetDC(IntPtr.Zero);
+ Win32SetROP2(hdc, ROP2DrawMode.R2_NOT);
+ oldpen = Win32SelectObject(hdc, pen);
+
+ // We might need to add clipping to the WindowRect of 'handle' - right now we're drawing on the desktop
+
+ Win32MoveToEx(hdc, pt.x + rect.Left, pt.y + rect.Top, IntPtr.Zero);
+ if ((rect.Width > 0) && (rect.Height > 0)) {
+ Win32LineTo(hdc, pt.x + rect.Right, pt.y + rect.Top);
+ Win32LineTo(hdc, pt.x + rect.Right, pt.y + rect.Bottom);
+ Win32LineTo(hdc, pt.x + rect.Left, pt.y + rect.Bottom);
+ Win32LineTo(hdc, pt.x + rect.Left, pt.y + rect.Top);
+ } else {
+ if (rect.Width > 0) {
+ Win32LineTo(hdc, pt.x + rect.Right, pt.y + rect.Top);
+ } else {
+ Win32LineTo(hdc, pt.x + rect.Left, pt.y + rect.Bottom);
+ }
+ }
+
+ Win32SelectObject(hdc, oldpen);
+ Win32DeleteObject(pen);
+ Win32ReleaseDC(IntPtr.Zero, hdc);
+ }
+
+ internal override SizeF GetAutoScaleSize(Font font) {
+ Graphics g;
+ float width;
+ string magic_string = "The quick brown fox jumped over the lazy dog.";
+ double magic_number = 44.549996948242189;
+
+ g = Graphics.FromHwnd(FosterParent);
+
+ width = (float) (g.MeasureString (magic_string, font).Width / magic_number);
+ return new SizeF(width, font.Height);
+ }
+
+ internal override IntPtr SendMessage (IntPtr hwnd, Msg message, IntPtr wParam, IntPtr lParam) {
+ return Win32SendMessage(hwnd, message, wParam, lParam);
+ }
+
+ internal override bool PostMessage (IntPtr hwnd, Msg message, IntPtr wParam, IntPtr lParam) {
+ return Win32PostMessage(hwnd, message, wParam, lParam);
+ }
+
+ internal override int KeyboardSpeed {
+ get {
+ Console.WriteLine ("KeyboardSpeed: need to query Windows");
+
+ //
+ // Return values range from 0 to 31 which map to 2.5 to 30 repetitions per second.
+ //
+ return 0;
+ }
+ }
+
+ internal override int KeyboardDelay {
+ get {
+ Console.WriteLine ("KeyboardDelay: need to query Windows");
+
+ //
+ // Return values must range from 0 to 4, 0 meaning 250ms,
+ // and 4 meaning 1000 ms.
+ //
+ return 1;
+ }
+ }
+
+ internal override event EventHandler Idle;
+
+ // Santa's little helper
+ static void Where() {
+ Console.WriteLine("Here: {0}", new StackTrace().ToString());
+ }
+ #endregion // Public Static Methods
+
+ #region Win32 Imports
+ [DllImport ("kernel32.dll", EntryPoint="GetLastError", CallingConvention=CallingConvention.StdCall)]
+ private extern static uint Win32GetLastError();
+
+ [DllImport ("user32.dll", EntryPoint="CreateWindowExW", CharSet=CharSet.Unicode, CallingConvention=CallingConvention.StdCall)]
+ internal extern static IntPtr Win32CreateWindow(uint dwExStyle, string lpClassName, string lpWindowName, uint dwStyle, int x, int y, int nWidth, int nHeight, IntPtr hWndParent, IntPtr hMenu, IntPtr hInstance, IntPtr lParam);
+
+ [DllImport ("user32.dll", EntryPoint="DestroyWindow", CallingConvention=CallingConvention.StdCall)]
+ internal extern static bool Win32DestroyWindow(IntPtr hWnd);
+
+ [DllImport ("user32.dll", EntryPoint="PeekMessageW", CharSet=CharSet.Unicode, CallingConvention=CallingConvention.StdCall)]
+ internal extern static bool Win32PeekMessage(ref MSG msg, IntPtr hWnd, int wFilterMin, int wFilterMax, uint flags);
+
+ [DllImport ("user32.dll", EntryPoint="GetMessageW", CharSet=CharSet.Unicode, CallingConvention=CallingConvention.StdCall)]
+ internal extern static bool Win32GetMessage(ref MSG msg, IntPtr hWnd, int wFilterMin, int wFilterMax);
+
+ [DllImport ("user32.dll", EntryPoint="TranslateMessage", CallingConvention=CallingConvention.StdCall)]
+ internal extern static bool Win32TranslateMessage(ref MSG msg);
+
+ [DllImport ("user32.dll", EntryPoint="DispatchMessageW", CharSet=CharSet.Unicode, CallingConvention=CallingConvention.StdCall)]
+ internal extern static IntPtr Win32DispatchMessage(ref MSG msg);
+
+ [DllImport ("user32.dll", EntryPoint="MoveWindow", CallingConvention=CallingConvention.StdCall)]
+ internal extern static bool Win32MoveWindow(IntPtr hWnd, int x, int y, int width, int height, bool repaint);
+
+ [DllImport ("user32.dll", EntryPoint="SetWindowPos", CallingConvention=CallingConvention.StdCall)]
+ internal extern static bool Win32SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, SetWindowPosFlags Flags);
+
+ [DllImport ("user32.dll", EntryPoint="SetWindowPos", CallingConvention=CallingConvention.StdCall)]
+ internal extern static bool Win32SetWindowPos(IntPtr hWnd, SetWindowPosZOrder pos, int x, int y, int cx, int cy, SetWindowPosFlags Flags);
+
+ [DllImport ("user32.dll", EntryPoint="SetWindowTextW", CharSet=CharSet.Unicode, CallingConvention=CallingConvention.StdCall)]
+ internal extern static bool Win32SetWindowText(IntPtr hWnd, string lpString);
+
+ [DllImport ("user32.dll", EntryPoint="GetWindowTextW", CharSet=CharSet.Unicode, CallingConvention=CallingConvention.StdCall)]
+ internal extern static bool Win32GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount);
+
+ [DllImport ("user32.dll", EntryPoint="SetParent", CallingConvention=CallingConvention.StdCall)]
+ internal extern static IntPtr Win32SetParent(IntPtr hWnd, IntPtr hParent);
+
+ [DllImport ("user32.dll", EntryPoint="RegisterClassW", CharSet=CharSet.Unicode, CallingConvention=CallingConvention.StdCall)]
+ private extern static bool Win32RegisterClass(ref WNDCLASS wndClass);
+
+ [DllImport ("user32.dll", EntryPoint="LoadCursorW", CharSet=CharSet.Unicode, CallingConvention=CallingConvention.StdCall)]
+ private extern static IntPtr Win32LoadCursor(IntPtr hInstance, LoadCursorType type);
+
+ [DllImport ("user32.dll", EntryPoint="ShowCursor", CallingConvention=CallingConvention.StdCall)]
+ private extern static IntPtr Win32ShowCursor(bool bShow);
+
+ [DllImport ("user32.dll", EntryPoint="SetCursor", CallingConvention=CallingConvention.StdCall)]
+ private extern static IntPtr Win32SetCursor(IntPtr hCursor);
+
+ [DllImport ("user32.dll", EntryPoint="CreateCursor", CallingConvention=CallingConvention.StdCall)]
+ private extern static IntPtr Win32CreateCursor(IntPtr hInstance, int xHotSpot, int yHotSpot, int nWidth, int nHeight, Byte[] pvANDPlane, Byte[] pvORPlane);
+
+ [DllImport ("user32.dll", EntryPoint="DestroyCursor", CallingConvention=CallingConvention.StdCall)]
+ private extern static bool Win32DestroyCursor(IntPtr hCursor);
+
+ [DllImport ("user32.dll", EntryPoint="DefWindowProcW", CharSet=CharSet.Unicode, CallingConvention=CallingConvention.StdCall)]
+ private extern static IntPtr Win32DefWindowProc(IntPtr hWnd, Msg Msg, IntPtr wParam, IntPtr lParam);
+
+ [DllImport ("user32.dll", EntryPoint="DefDlgProcW", CharSet=CharSet.Unicode, CallingConvention=CallingConvention.StdCall)]
+ private extern static IntPtr Win32DefDlgProc(IntPtr hWnd, Msg Msg, IntPtr wParam, IntPtr lParam);
+
+ [DllImport ("user32.dll", EntryPoint="PostQuitMessage", CallingConvention=CallingConvention.StdCall)]
+ private extern static IntPtr Win32PostQuitMessage(int nExitCode);
+
+ [DllImport ("user32.dll", EntryPoint="UpdateWindow", CallingConvention=CallingConvention.StdCall)]
+ private extern static IntPtr Win32UpdateWindow(IntPtr hWnd);
+
+ [DllImport ("user32.dll", EntryPoint="GetUpdateRect", CallingConvention=CallingConvention.StdCall)]
+ private extern static bool Win32GetUpdateRect(IntPtr hWnd, ref RECT rect, bool erase);
+
+ [DllImport ("user32.dll", EntryPoint="BeginPaint", CallingConvention=CallingConvention.StdCall)]
+ private extern static IntPtr Win32BeginPaint(IntPtr hWnd, ref PAINTSTRUCT ps);
+
+ [DllImport ("user32.dll", EntryPoint="EndPaint", CallingConvention=CallingConvention.StdCall)]
+ private extern static bool Win32EndPaint(IntPtr hWnd, ref PAINTSTRUCT ps);
+
+ [DllImport ("user32.dll", EntryPoint="GetDC", CallingConvention=CallingConvention.StdCall)]
+ private extern static IntPtr Win32GetDC(IntPtr hWnd);
+
+ [DllImport ("user32.dll", EntryPoint="GetDCEx", CallingConvention=CallingConvention.StdCall)]
+ private extern static IntPtr Win32GetDCEx(IntPtr hWnd, IntPtr hRgn, DCExFlags flags);
+
+ [DllImport ("user32.dll", EntryPoint="ReleaseDC", CallingConvention=CallingConvention.StdCall)]
+ private extern static IntPtr Win32ReleaseDC(IntPtr hWnd, IntPtr hDC);
+
+ [DllImport ("user32.dll", EntryPoint="MessageBoxW", CharSet=CharSet.Unicode, CallingConvention=CallingConvention.StdCall)]
+ private extern static IntPtr Win32MessageBox(IntPtr hParent, string pText, string pCaption, uint uType);
+
+ [DllImport ("user32.dll", EntryPoint="InvalidateRect", CallingConvention=CallingConvention.StdCall)]
+ private extern static IntPtr Win32InvalidateRect(IntPtr hWnd, ref RECT lpRect, bool bErase);
+
+ [DllImport ("user32.dll", EntryPoint="InvalidateRect", CallingConvention=CallingConvention.StdCall)]
+ private extern static IntPtr Win32InvalidateRect(IntPtr hWnd, IntPtr lpRect, bool bErase);
+
+ [DllImport ("user32.dll", EntryPoint="SetCapture", CallingConvention=CallingConvention.StdCall)]
+ private extern static IntPtr Win32SetCapture(IntPtr hWnd);
+
+ [DllImport ("user32.dll", EntryPoint="ReleaseCapture", CallingConvention=CallingConvention.StdCall)]
+ private extern static IntPtr Win32ReleaseCapture();
+
+ [DllImport ("user32.dll", EntryPoint="GetWindowRect", CallingConvention=CallingConvention.StdCall)]
+ private extern static IntPtr Win32GetWindowRect(IntPtr hWnd, out RECT rect);
+
+ [DllImport ("user32.dll", EntryPoint="GetClientRect", CallingConvention=CallingConvention.StdCall)]
+ private extern static IntPtr Win32GetClientRect(IntPtr hWnd, out RECT rect);
+
+ [DllImport ("user32.dll", EntryPoint="ScreenToClient", CallingConvention=CallingConvention.StdCall)]
+ private extern static bool Win32ScreenToClient(IntPtr hWnd, ref POINT pt);
+
+ [DllImport ("user32.dll", EntryPoint="ClientToScreen", CallingConvention=CallingConvention.StdCall)]
+ private extern static bool Win32ClientToScreen(IntPtr hWnd, ref POINT pt);
+
+ [DllImport ("user32.dll", EntryPoint="GetParent", CallingConvention=CallingConvention.StdCall)]
+ private extern static IntPtr Win32GetParent(IntPtr hWnd);
+
+ [DllImport ("user32.dll", EntryPoint="SetActiveWindow", CallingConvention=CallingConvention.StdCall)]
+ private extern static IntPtr Win32SetActiveWindow(IntPtr hWnd);
+
+ [DllImport ("user32.dll", EntryPoint="AdjustWindowRectEx", CallingConvention=CallingConvention.StdCall)]
+ private extern static bool Win32AdjustWindowRectEx(ref RECT lpRect, int dwStyle, bool bMenu, int dwExStyle);
+
+ [DllImport ("user32.dll", EntryPoint="GetCursorPos", CallingConvention=CallingConvention.StdCall)]
+ private extern static bool Win32GetCursorPos(out POINT lpPoint);
+
+ [DllImport ("user32.dll", EntryPoint="SetCursorPos", CallingConvention=CallingConvention.StdCall)]
+ private extern static bool Win32SetCursorPos(int x, int y);
+
+ [DllImport ("user32.dll", EntryPoint="GetWindowPlacement", CallingConvention=CallingConvention.StdCall)]
+ private extern static bool Win32GetWindowPlacement(IntPtr hWnd, ref WINDOWPLACEMENT lpwndpl);
+
+ [DllImport ("user32.dll", EntryPoint="TrackMouseEvent", CallingConvention=CallingConvention.StdCall)]
+ private extern static bool Win32TrackMouseEvent(ref TRACKMOUSEEVENT tme);
+
+ [DllImport ("gdi32.dll", EntryPoint="CreateBrushIndirect", CallingConvention=CallingConvention.StdCall)]
+ private extern static IntPtr Win32CreateBrushIndirect(ref LOGBRUSH lb);
+
+ [DllImport ("user32.dll", EntryPoint="FillRect", CallingConvention=CallingConvention.StdCall)]
+ private extern static int Win32FillRect(IntPtr hdc, ref RECT rect, IntPtr hbr);
+
+ [DllImport ("user32.dll", EntryPoint="SetWindowLong", CallingConvention=CallingConvention.StdCall)]
+ private extern static uint Win32SetWindowLong(IntPtr hwnd, WindowLong index, uint value);
+
+ [DllImport ("user32.dll", EntryPoint="GetWindowLong", CallingConvention=CallingConvention.StdCall)]
+ private extern static uint Win32GetWindowLong(IntPtr hwnd, WindowLong index);
+
+ [DllImport ("user32.dll", EntryPoint="SetLayeredWindowAttributes", CallingConvention=CallingConvention.StdCall)]
+ private extern static uint Win32SetLayeredWindowAttributes (IntPtr hwnd, COLORREF crKey, byte bAlpha, LayeredWindowAttributes dwFlags);
+
+ [DllImport ("gdi32.dll", EntryPoint="DeleteObject", CallingConvention=CallingConvention.StdCall)]
+ private extern static bool Win32DeleteObject(IntPtr o);
+
+ [DllImport ("user32.dll", EntryPoint="GetKeyState", CallingConvention=CallingConvention.StdCall)]
+ private extern static short Win32GetKeyState(VirtualKeys nVirtKey);
+
+ [DllImport ("user32.dll", EntryPoint="GetDesktopWindow", CallingConvention=CallingConvention.StdCall)]
+ private extern static IntPtr Win32GetDesktopWindow();
+
+ [DllImport ("user32.dll", EntryPoint="SetTimer", CallingConvention=CallingConvention.StdCall)]
+ private extern static IntPtr Win32SetTimer(IntPtr hwnd, int nIDEvent, uint uElapse, IntPtr timerProc);
+
+ [DllImport ("user32.dll", EntryPoint="KillTimer", CallingConvention=CallingConvention.StdCall)]
+ private extern static IntPtr Win32KillTimer(IntPtr hwnd, int nIDEvent);
+
+ [DllImport ("user32.dll", EntryPoint="ShowWindow", CallingConvention=CallingConvention.StdCall)]
+ private extern static IntPtr Win32ShowWindow(IntPtr hwnd, WindowPlacementFlags nCmdShow);
+
+ [DllImport ("user32.dll", EntryPoint="EnableWindow", CallingConvention=CallingConvention.StdCall)]
+ private extern static IntPtr Win32EnableWindow(IntPtr hwnd, bool Enabled);
+
+ [DllImport ("user32.dll", EntryPoint="SetFocus", CallingConvention=CallingConvention.StdCall)]
+ internal extern static IntPtr Win32SetFocus(IntPtr hwnd);
+
+ [DllImport ("user32.dll", EntryPoint="CreateCaret", CallingConvention=CallingConvention.StdCall)]
+ internal extern static bool Win32CreateCaret(IntPtr hwnd, IntPtr hBitmap, int nWidth, int nHeight);
+
+ [DllImport ("user32.dll", EntryPoint="DestroyCaret", CallingConvention=CallingConvention.StdCall)]
+ private extern static bool Win32DestroyCaret();
+
+ [DllImport ("user32.dll", EntryPoint="ShowCaret", CallingConvention=CallingConvention.StdCall)]
+ private extern static bool Win32ShowCaret(IntPtr hwnd);
+
+ [DllImport ("user32.dll", EntryPoint="HideCaret", CallingConvention=CallingConvention.StdCall)]
+ private extern static bool Win32HideCaret(IntPtr hwnd);
+
+ [DllImport ("user32.dll", EntryPoint="SetCaretPos", CallingConvention=CallingConvention.StdCall)]
+ private extern static bool Win32SetCaretPos(int X, int Y);
+
+ [DllImport ("user32.dll", EntryPoint="GetCaretBlinkTime", CallingConvention=CallingConvention.StdCall)]
+ private extern static uint Win32GetCaretBlinkTime();
+
+ [DllImport ("gdi32.dll", EntryPoint="GetTextMetricsW", CharSet=CharSet.Unicode, CallingConvention=CallingConvention.StdCall)]
+ internal extern static bool Win32GetTextMetrics(IntPtr hdc, ref TEXTMETRIC tm);
+
+ [DllImport ("gdi32.dll", EntryPoint="SelectObject", CallingConvention=CallingConvention.StdCall)]
+ internal extern static IntPtr Win32SelectObject(IntPtr hdc, IntPtr hgdiobject);
+
+ [DllImport ("user32.dll", EntryPoint="ScrollWindowEx", CallingConvention=CallingConvention.StdCall)]
+ private extern static bool Win32ScrollWindowEx(IntPtr hwnd, int dx, int dy, ref RECT prcScroll, ref RECT prcClip, IntPtr hrgnUpdate, out RECT prcUpdate, ScrollWindowExFlags flags);
+
+ [DllImport ("user32.dll", EntryPoint="ScrollWindowEx", CallingConvention=CallingConvention.StdCall)]
+ private extern static bool Win32ScrollWindowEx(IntPtr hwnd, int dx, int dy, ref RECT prcScroll, ref RECT prcClip, IntPtr hrgnUpdate, IntPtr prcUpdate, ScrollWindowExFlags flags);
+
+ [DllImport ("user32.dll", EntryPoint="ScrollWindowEx", CallingConvention=CallingConvention.StdCall)]
+ private extern static bool Win32ScrollWindowEx(IntPtr hwnd, int dx, int dy, ref RECT prcScroll, IntPtr prcClip, IntPtr hrgnUpdate, IntPtr prcUpdate, ScrollWindowExFlags flags);
+
+ [DllImport ("user32.dll", EntryPoint="ScrollWindowEx", CallingConvention=CallingConvention.StdCall)]
+ private extern static bool Win32ScrollWindowEx(IntPtr hwnd, int dx, int dy, IntPtr prcScroll, IntPtr prcClip, IntPtr hrgnUpdate, IntPtr prcUpdate, ScrollWindowExFlags flags);
+
+ [DllImport ("user32.dll", EntryPoint="GetActiveWindow", CallingConvention=CallingConvention.StdCall)]
+ private extern static IntPtr Win32GetActiveWindow();
+
+ [DllImport ("user32.dll", EntryPoint="GetSystemMetrics", CallingConvention=CallingConvention.StdCall)]
+ private extern static int Win32GetSystemMetrics(SystemMetrics nIndex);
+
+ [DllImport ("shell32.dll", EntryPoint="Shell_NotifyIconW", CharSet=CharSet.Unicode, CallingConvention=CallingConvention.StdCall)]
+ private extern static bool Win32Shell_NotifyIcon(NotifyIconMessage dwMessage, ref NOTIFYICONDATA lpData);
+
+ [DllImport ("gdi32.dll", EntryPoint="CreateRectRgn", CallingConvention=CallingConvention.StdCall)]
+ internal extern static IntPtr Win32CreateRectRgn(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect);
+
+ [DllImport ("user32.dll", EntryPoint="IsWindowEnabled", CallingConvention=CallingConvention.StdCall)]
+ private extern static bool IsWindowEnabled(IntPtr hwnd);
+
+ [DllImport ("user32.dll", EntryPoint="IsWindowVisible", CallingConvention=CallingConvention.StdCall)]
+ private extern static bool IsWindowVisible(IntPtr hwnd);
+
+ [DllImport ("user32.dll", EntryPoint="SetClassLong", CallingConvention=CallingConvention.StdCall)]
+ private extern static bool Win32SetClassLong(IntPtr hwnd, ClassLong nIndex, IntPtr dwNewLong);
+
+ [DllImport ("user32.dll", EntryPoint="SendMessageW", CharSet=CharSet.Unicode, CallingConvention=CallingConvention.StdCall)]
+ private extern static IntPtr Win32SendMessage(IntPtr hwnd, Msg msg, IntPtr wParam, IntPtr lParam);
+
+ [DllImport ("user32.dll", EntryPoint="PostMessageW", CharSet=CharSet.Unicode, CallingConvention=CallingConvention.StdCall)]
+ private extern static bool Win32PostMessage(IntPtr hwnd, Msg msg, IntPtr wParam, IntPtr lParam);
+
+ [DllImport ("user32.dll", EntryPoint="SystemParametersInfoW", CharSet=CharSet.Unicode, CallingConvention=CallingConvention.StdCall)]
+ private extern static bool Win32SystemParametersInfo(SPIAction uiAction, uint uiParam, ref RECT rect, uint fWinIni);
+
+ [DllImport ("user32.dll", EntryPoint="OpenClipboard", CallingConvention=CallingConvention.StdCall)]
+ private extern static bool Win32OpenClipboard(IntPtr hwnd);
+
+ [DllImport ("user32.dll", EntryPoint="EmptyClipboard", CallingConvention=CallingConvention.StdCall)]
+ private extern static bool Win32EmptyClipboard();
+
+ [DllImport ("user32.dll", EntryPoint="RegisterClipboardFormatW", CharSet=CharSet.Unicode, CallingConvention=CallingConvention.StdCall)]
+ private extern static uint Win32RegisterClipboardFormat(string format);
+
+ [DllImport ("user32.dll", EntryPoint="CloseClipboard", CallingConvention=CallingConvention.StdCall)]
+ private extern static bool Win32CloseClipboard();
+
+ [DllImport ("user32.dll", EntryPoint="EnumClipboardFormats", CallingConvention=CallingConvention.StdCall)]
+ private extern static uint Win32EnumClipboardFormats(uint format);
+
+ [DllImport ("user32.dll", EntryPoint="GetClipboardData", CallingConvention=CallingConvention.StdCall)]
+ private extern static IntPtr Win32GetClipboardData(uint format);
+
+ [DllImport ("user32.dll", EntryPoint="SetClipboardData", CallingConvention=CallingConvention.StdCall)]
+ private extern static IntPtr Win32SetClipboardData(uint format, IntPtr handle);
+
+ [DllImport ("kernel32.dll", EntryPoint="GlobalAlloc", CallingConvention=CallingConvention.StdCall)]
+ internal extern static IntPtr Win32GlobalAlloc(GAllocFlags Flags, int dwBytes);
+
+ [DllImport ("kernel32.dll", EntryPoint="CopyMemory", CallingConvention=CallingConvention.StdCall)]
+ internal extern static void Win32CopyMemory(IntPtr Destination, IntPtr Source, int length);
+
+ [DllImport ("kernel32.dll", EntryPoint="GlobalFree", CallingConvention=CallingConvention.StdCall)]
+ internal extern static IntPtr Win32GlobalFree(IntPtr hMem);
+
+ [DllImport ("kernel32.dll", EntryPoint="GlobalSize", CallingConvention=CallingConvention.StdCall)]
+ internal extern static uint Win32GlobalSize(IntPtr hMem);
+
+ [DllImport ("kernel32.dll", EntryPoint="GlobalLock", CallingConvention=CallingConvention.StdCall)]
+ internal extern static IntPtr Win32GlobalLock(IntPtr hMem);
+
+ [DllImport ("kernel32.dll", EntryPoint="GlobalUnlock", CallingConvention=CallingConvention.StdCall)]
+ internal extern static IntPtr Win32GlobalUnlock(IntPtr hMem);
+
+ [DllImport ("gdi32.dll", EntryPoint="SetROP2", CallingConvention=CallingConvention.StdCall)]
+ internal extern static int Win32SetROP2(IntPtr hdc, ROP2DrawMode fnDrawMode);
+
+ [DllImport ("gdi32.dll", EntryPoint="MoveToEx", CallingConvention=CallingConvention.StdCall)]
+ internal extern static bool Win32MoveToEx(IntPtr hdc, int x, int y, ref POINT lpPoint);
+
+ [DllImport ("gdi32.dll", EntryPoint="MoveToEx", CallingConvention=CallingConvention.StdCall)]
+ internal extern static bool Win32MoveToEx(IntPtr hdc, int x, int y, IntPtr lpPoint);
+
+ [DllImport ("gdi32.dll", EntryPoint="LineTo", CallingConvention=CallingConvention.StdCall)]
+ internal extern static bool Win32LineTo(IntPtr hdc, int x, int y);
+
+ [DllImport ("gdi32.dll", EntryPoint="CreatePen", CallingConvention=CallingConvention.StdCall)]
+ internal extern static IntPtr Win32CreatePen(PenStyle fnPenStyle, int nWidth, ref COLORREF color);
+
+ [DllImport ("gdi32.dll", EntryPoint="CreatePen", CallingConvention=CallingConvention.StdCall)]
+ internal extern static IntPtr Win32CreatePen(PenStyle fnPenStyle, int nWidth, IntPtr color);
+
+ [DllImport ("gdi32.dll", EntryPoint="GetStockObject", CallingConvention=CallingConvention.StdCall)]
+ internal extern static IntPtr Win32GetStockObject(StockObject fnObject);
+
+ [DllImport ("gdi32.dll", EntryPoint="CreateHatchBrush", CallingConvention=CallingConvention.StdCall)]
+ internal extern static IntPtr Win32CreateHatchBrush(HatchStyle fnStyle, IntPtr color);
+
+ [DllImport ("gdi32.dll", EntryPoint="CreateHatchBrush", CallingConvention=CallingConvention.StdCall)]
+ internal extern static IntPtr Win32CreateHatchBrush(HatchStyle fnStyle, ref COLORREF color);
+
+ [DllImport ("winmm.dll", EntryPoint="PlaySoundW", CallingConvention=CallingConvention.StdCall, CharSet=CharSet.Unicode)]
+ internal extern static IntPtr Win32PlaySound(string pszSound, IntPtr hmod, SndFlags fdwSound);
+ #endregion
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
new file mode 100644
index 00000000000..d655d87b345
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
@@ -0,0 +1,4226 @@
+// 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.
+//
+// Authors:
+// Peter Bartok pbartok@novell.com
+//
+//
+
+// NOTE:
+// This driver understands the following environment variables: (Set the var to enable feature)
+//
+// MONO_XEXCEPTIONS = throw an exception when a X11 error is encountered;
+// by default a message is displayed but execution continues
+//
+// MONO_XSYNC = perform all X11 commands synchronous; this is slower but
+// helps in debugging errors
+//
+
+// NOT COMPLETE
+
+// define to log Window handles and relationships to stdout
+#undef DriverDebug
+
+// Extra detailed debug
+#undef DriverDebugExtra
+
+using System;
+using System.ComponentModel;
+using System.Collections;
+using System.Diagnostics;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Drawing.Imaging;
+using System.IO;
+using System.Net;
+using N = System.Net;
+using System.Net.Sockets;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading;
+
+// Only do the poll when building with mono for now
+#if __MonoCS__
+using Mono.Unix.Native;
+#endif
+
+/// X11 Version
+namespace System.Windows.Forms {
+ internal class XplatUIX11 : XplatUIDriver {
+ #region Local Variables
+ // General
+ static volatile XplatUIX11 Instance;
+ private static int RefCount;
+ private static object XlibLock; // Our locking object
+ private static bool ThemesEnabled;
+
+ // General X11
+ private static IntPtr DisplayHandle; // X11 handle to display
+ private static int ScreenNo; // Screen number used
+ private static IntPtr DefaultColormap; // Colormap for screen
+ private static IntPtr CustomVisual; // Visual for window creation
+ private static IntPtr CustomColormap; // Colormap for window creation
+ private static IntPtr RootWindow; // Handle of the root window for the screen/display
+ private static IntPtr FosterParent; // Container to hold child windows until their parent exists
+ private static XErrorHandler ErrorHandler; // Error handler delegate
+ private static bool ErrorExceptions; // Throw exceptions on X errors
+ private static bool PostQuitState; // True if we've got an pending exit
+
+ // Clipboard
+ private static IntPtr ClipMagic = new IntPtr(27051977);
+ private static ClipboardStruct Clipboard; // Our clipboard
+
+ // Communication
+ private static int PostAtom; // PostMessage atom
+ private static int AsyncAtom; // Support for async messages
+
+ // Message Loop
+ private static XEventQueue MessageQueue; // Holds our queued up events
+ #if __MonoCS__ //
+ private static Pollfd[] pollfds; // For watching the X11 socket
+ #endif //
+ private static X11Keyboard Keyboard; //
+ private static X11Dnd Dnd;
+ private static Socket listen; //
+ private static Socket wake; //
+ private static Socket wake_receive; //
+ private static byte[] network_buffer; //
+
+
+ // Focus tracking
+ private static IntPtr ActiveWindow; // Handle of the active window
+ private static IntPtr FocusWindow; // Handle of the window with keyboard focus (if any)
+
+ // Modality support
+ private static Stack ModalWindows; // Stack of our modal windows
+
+ // Systray
+ private static IntPtr SystrayMgrWindow; // Handle of the Systray Manager window
+
+ // Cursors
+ private static IntPtr LastCursorWindow; // The last window we set the cursor on
+ private static IntPtr LastCursorHandle; // The handle that was last set on LastCursorWindow
+ private static IntPtr OverrideCursorHandle; // The cursor that is set to override any other cursors
+
+ // Caret
+ private static CaretStruct Caret; //
+
+ // Support for Window Styles
+ private static int[] NetAtoms; // All atoms we know
+
+ // mouse hover message generation
+ private static HoverStruct HoverState; //
+
+ // double click message generation
+ private static ClickStruct ClickPending; //
+
+ // Support for mouse grab
+ private static GrabStruct Grab; //
+
+ // State
+ private static Point MousePosition; // Last position of mouse, in screen coords
+ internal static MouseButtons MouseState; // Last state of mouse buttons
+
+ // Timers
+ private static ArrayList TimerList; // Holds SWF.Timers
+
+ // 'Constants'
+ private static int DoubleClickInterval; // msec; max interval between clicks to count as double click
+
+ const EventMask SelectInputMask = EventMask.ButtonPressMask |
+ EventMask.ButtonReleaseMask |
+ EventMask.KeyPressMask |
+ EventMask.KeyReleaseMask |
+ EventMask.EnterWindowMask |
+ EventMask.LeaveWindowMask |
+ EventMask.ExposureMask |
+ EventMask.FocusChangeMask |
+ EventMask.PointerMotionMask |
+ EventMask.VisibilityChangeMask |
+ EventMask.SubstructureNotifyMask |
+ EventMask.StructureNotifyMask;
+
+ static readonly object lockobj = new object ();
+
+ #endregion // Local Variables
+ #region Constructors
+ private XplatUIX11() {
+ // Handle singleton stuff first
+ RefCount = 0;
+
+ // Now regular initialization
+ XlibLock = new object ();
+ MessageQueue = new XEventQueue ();
+ TimerList = new ArrayList ();
+ XInitThreads();
+
+ ErrorExceptions = false;
+
+ // X11 Initialization
+ SetDisplay(XOpenDisplay(IntPtr.Zero));
+ X11DesktopColors.Initialize();
+
+ // Handle any upcoming errors; we re-set it here, X11DesktopColor stuff might have stolen it (gtk does)
+ ErrorHandler = new XErrorHandler(HandleError);
+ XSetErrorHandler(ErrorHandler);
+ }
+ #endregion // Constructors
+
+ #region Singleton Specific Code
+ public static XplatUIX11 GetInstance() {
+ lock (lockobj) {
+ if (Instance == null) {
+ Instance=new XplatUIX11();
+ }
+ RefCount++;
+ }
+ return Instance;
+ }
+
+ public int Reference {
+ get {
+ return RefCount;
+ }
+ }
+ #endregion
+
+ #region Internal Properties
+ internal static IntPtr Display {
+ get {
+ return DisplayHandle;
+ }
+
+ set {
+ XplatUIX11.GetInstance().SetDisplay(value);
+ }
+ }
+
+ internal static int Screen {
+ get {
+ return ScreenNo;
+ }
+
+ set {
+ ScreenNo = value;
+ }
+ }
+
+ internal static IntPtr RootWindowHandle {
+ get {
+ return RootWindow;
+ }
+
+ set {
+ RootWindow = value;
+ }
+ }
+
+ internal static IntPtr Visual {
+ get {
+ return CustomVisual;
+ }
+
+ set {
+ CustomVisual = value;
+ }
+ }
+
+ internal static IntPtr ColorMap {
+ get {
+ return CustomColormap;
+ }
+
+ set {
+ CustomColormap = value;
+ }
+ }
+ #endregion
+
+ #region XExceptionClass
+ internal class XException : ApplicationException {
+ IntPtr Display;
+ IntPtr ResourceID;
+ IntPtr Serial;
+ XRequest RequestCode;
+ byte ErrorCode;
+ byte MinorCode;
+
+ public XException(IntPtr Display, IntPtr ResourceID, IntPtr Serial, byte ErrorCode, XRequest RequestCode, byte MinorCode) {
+ this.Display = Display;
+ this.ResourceID = ResourceID;
+ this.Serial = Serial;
+ this.RequestCode = RequestCode;
+ this.ErrorCode = ErrorCode;
+ this.MinorCode = MinorCode;
+ }
+
+ public override string Message {
+ get {
+ return GetMessage(Display, ResourceID, Serial, ErrorCode, RequestCode, MinorCode);
+ }
+ }
+
+ public static string GetMessage(IntPtr Display, IntPtr ResourceID, IntPtr Serial, byte ErrorCode, XRequest RequestCode, byte MinorCode) {
+ StringBuilder sb;
+ string x_error_text;
+ string error;
+
+ sb = new StringBuilder(160);
+ XGetErrorText(Display, ErrorCode, sb, sb.Capacity);
+ x_error_text = sb.ToString();
+
+ error = String.Format("\n Error: {0}\n Request: {1:D} ({2})\n Resource ID: 0x{3:x}\n Serial: {4}", x_error_text, RequestCode, RequestCode, ResourceID.ToInt32(), Serial);
+ return error;
+ }
+ }
+ #endregion // XExceptionClass
+
+ #region Internal Methods
+ internal void SetDisplay(IntPtr display_handle) {
+ if (display_handle != IntPtr.Zero) {
+ Hwnd hwnd;
+
+ if ((DisplayHandle != IntPtr.Zero) && (FosterParent != IntPtr.Zero)) {
+ hwnd = Hwnd.ObjectFromHandle(FosterParent);
+ XDestroyWindow(DisplayHandle, FosterParent);
+ hwnd.Dispose();
+ }
+
+ if (DisplayHandle != IntPtr.Zero) {
+ XCloseDisplay(DisplayHandle);
+ }
+
+ DisplayHandle=display_handle;
+
+ // We need to tell System.Drawing our DisplayHandle. FromHdcInternal has
+ // been hacked to do this for us.
+ Graphics.FromHdcInternal (DisplayHandle);
+
+ // Debugging support
+ if (Environment.GetEnvironmentVariable ("MONO_XSYNC") != null) {
+ XSynchronize(DisplayHandle, true);
+ }
+
+ if (Environment.GetEnvironmentVariable ("MONO_XEXCEPTIONS") != null) {
+ ErrorExceptions = true;
+ }
+
+ // Generic X11 setup
+ ScreenNo = 0;
+ RootWindow = XRootWindow(DisplayHandle, ScreenNo);
+ DefaultColormap = XDefaultColormap(DisplayHandle, ScreenNo);
+
+ // Create the foster parent
+ FosterParent=XCreateSimpleWindow(DisplayHandle, RootWindow, 0, 0, 1, 1, 4, 0, 0);
+ if (FosterParent==IntPtr.Zero) {
+ Console.WriteLine("XplatUIX11 Constructor failed to create FosterParent");
+ }
+
+ hwnd = new Hwnd();
+ hwnd.WholeWindow = FosterParent;
+ hwnd.ClientWindow = FosterParent;
+
+ // For sleeping on the X11 socket
+ listen = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);
+ IPEndPoint ep = new IPEndPoint(IPAddress.Loopback, 0);
+ listen.Bind(ep);
+ listen.Listen(1);
+
+ // To wake up when a timer is ready
+ network_buffer = new byte[10];
+
+ wake = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);
+ wake.Connect(listen.LocalEndPoint);
+ wake_receive = listen.Accept();
+
+ #if __MonoCS__
+ pollfds = new Pollfd [2];
+ pollfds [0] = new Pollfd ();
+ pollfds [0].fd = XConnectionNumber (DisplayHandle);
+ pollfds [0].events = PollEvents.POLLIN;
+
+ pollfds [1] = new Pollfd ();
+ pollfds [1].fd = wake_receive.Handle.ToInt32 ();
+ pollfds [1].events = PollEvents.POLLIN;
+ #endif
+
+ Keyboard = new X11Keyboard(DisplayHandle);
+ Dnd = new X11Dnd (DisplayHandle);
+
+ PostQuitState = false;
+
+ DoubleClickInterval = 500;
+
+ HoverState.Interval = 500;
+ HoverState.Timer = new Timer();
+ HoverState.Timer.Enabled = false;
+ HoverState.Timer.Interval = HoverState.Interval;
+ HoverState.Timer.Tick +=new EventHandler(MouseHover);
+ HoverState.X = -1;
+ HoverState.Y = -1;
+
+ ActiveWindow = IntPtr.Zero;
+ FocusWindow = IntPtr.Zero;
+ ModalWindows = new Stack(3);
+
+ MouseState = MouseButtons.None;
+ MousePosition = new Point(0, 0);
+
+ Caret.Timer = new Timer();
+ Caret.Timer.Interval = 500; // FIXME - where should this number come from?
+ Caret.Timer.Tick += new EventHandler(CaretCallback);
+
+ SetupAtoms();
+
+ // Grab atom changes off the root window to catch certain WM events
+ XSelectInput(DisplayHandle, RootWindow, EventMask.PropertyChangeMask);
+
+ // Handle any upcoming errors
+ ErrorHandler = new XErrorHandler(HandleError);
+ XSetErrorHandler(ErrorHandler);
+ } else {
+ throw new ArgumentNullException("Display", "Could not open display (X-Server required. Check you DISPLAY environment variable)");
+ }
+ }
+
+ internal static void Where() {
+ Console.WriteLine("Here: {0}\n", WhereString());
+ }
+
+ internal static string WhereString() {
+ StackTrace stack;
+ StackFrame frame;
+ string newline;
+ string unknown;
+ StringBuilder sb;
+ MethodBase method;
+
+ newline = String.Format("{0}\t {1} ", Environment.NewLine, Locale.GetText("at"));
+ unknown = Locale.GetText("<unknown method>");
+ sb = new StringBuilder();
+ stack = new StackTrace(true);
+
+ for (int i = 0; i < stack.FrameCount; i++) {
+ frame = stack.GetFrame(i);
+ sb.Append(newline);
+
+ method = frame.GetMethod();
+ if (method != null) {
+ #if not
+ sb.AppendFormat(frame.ToString());
+ #endif
+ if (frame.GetFileLineNumber() != 0) {
+ sb.AppendFormat("{0}.{1} () [{2}:{3}]", method.DeclaringType.FullName, method.Name, Path.GetFileName(frame.GetFileName()), frame.GetFileLineNumber());
+ } else {
+ sb.AppendFormat("{0}.{1} ()", method.DeclaringType.FullName, method.Name);
+ }
+ } else {
+ sb.Append(unknown);
+ }
+ }
+ return sb.ToString();
+ }
+ #endregion // Internal Methods
+
+ #region Private Methods
+ private static void SetupAtoms() {
+ NetAtoms = new int[(int)NA.LAST_NET_ATOM];
+
+ NetAtoms[(int)NA.WM_PROTOCOLS] = XInternAtom(DisplayHandle, "WM_PROTOCOLS", false);
+ NetAtoms[(int)NA.WM_DELETE_WINDOW] = XInternAtom(DisplayHandle, "WM_DELETE_WINDOW", false);
+ NetAtoms[(int)NA.WM_TAKE_FOCUS] = XInternAtom(DisplayHandle, "WM_TAKE_FOCUS", false);
+
+ NetAtoms[(int)NA._NET_SUPPORTED] = XInternAtom(DisplayHandle, "_NET_SUPPORTED", false);
+ NetAtoms[(int)NA._NET_CLIENT_LIST] = XInternAtom(DisplayHandle, "_NET_CLIENT_LIST", false);
+ NetAtoms[(int)NA._NET_NUMBER_OF_DESKTOPS] = XInternAtom(DisplayHandle, "_NET_NUMBER_OF_DESKTOPS", false);
+ NetAtoms[(int)NA._NET_DESKTOP_GEOMETRY] = XInternAtom(DisplayHandle, "_NET_DESKTOP_GEOMETRY", false);
+ NetAtoms[(int)NA._NET_DESKTOP_VIEWPORT] = XInternAtom(DisplayHandle, "_NET_DESKTOP_VIEWPORT", false);
+ NetAtoms[(int)NA._NET_CURRENT_DESKTOP] = XInternAtom(DisplayHandle, "_NET_CURRENT_DESKTOP", false);
+ NetAtoms[(int)NA._NET_DESKTOP_NAMES] = XInternAtom(DisplayHandle, "_NET_DESKTOP_NAMES", false);
+ NetAtoms[(int)NA._NET_ACTIVE_WINDOW] = XInternAtom(DisplayHandle, "_NET_ACTIVE_WINDOW", false);
+ NetAtoms[(int)NA._NET_WORKAREA] = XInternAtom(DisplayHandle, "_NET_WORKAREA", false);
+ NetAtoms[(int)NA._NET_SUPPORTING_WM_CHECK] = XInternAtom(DisplayHandle, "_NET_SUPPORTING_WM_CHECK", false);
+ NetAtoms[(int)NA._NET_VIRTUAL_ROOTS] = XInternAtom(DisplayHandle, "_NET_VIRTUAL_ROOTS", false);
+ NetAtoms[(int)NA._NET_DESKTOP_LAYOUT] = XInternAtom(DisplayHandle, "_NET_DESKTOP_LAYOUT", false);
+ NetAtoms[(int)NA._NET_SHOWING_DESKTOP] = XInternAtom(DisplayHandle, "_NET_SHOWING_DESKTOP", false);
+
+ NetAtoms[(int)NA._NET_CLOSE_WINDOW] = XInternAtom(DisplayHandle, "_NET_CLOSE_WINDOW", false);
+ NetAtoms[(int)NA._NET_MOVERESIZE_WINDOW] = XInternAtom(DisplayHandle, "_NET_MOVERESIZE_WINDOW", false);
+ NetAtoms[(int)NA._NET_WM_MOVERESIZE] = XInternAtom(DisplayHandle, "_NET_WM_MOVERESIZE", false);
+ NetAtoms[(int)NA._NET_RESTACK_WINDOW] = XInternAtom(DisplayHandle, "_NET_RESTACK_WINDOW", false);
+ NetAtoms[(int)NA._NET_REQUEST_FRAME_EXTENTS] = XInternAtom(DisplayHandle, "_NET_REQUEST_FRAME_EXTENTS", false);
+
+ NetAtoms[(int)NA._NET_WM_NAME] = XInternAtom(DisplayHandle, "_NET_WM_NAME", false);
+ NetAtoms[(int)NA._NET_WM_VISIBLE_NAME] = XInternAtom(DisplayHandle, "_NET_WM_VISIBLE_NAME", false);
+ NetAtoms[(int)NA._NET_WM_ICON_NAME] = XInternAtom(DisplayHandle, "_NET_WM_ICON_NAME", false);
+ NetAtoms[(int)NA._NET_WM_VISIBLE_ICON_NAME] = XInternAtom(DisplayHandle, "_NET_WM_VISIBLE_ICON_NAME", false);
+ NetAtoms[(int)NA._NET_WM_DESKTOP] = XInternAtom(DisplayHandle, "_NET_WM_DESKTOP", false);
+ NetAtoms[(int)NA._NET_WM_WINDOW_TYPE] = XInternAtom(DisplayHandle, "_NET_WM_WINDOW_TYPE", false);
+ NetAtoms[(int)NA._NET_WM_STATE] = XInternAtom(DisplayHandle, "_NET_WM_STATE", false);
+ NetAtoms[(int)NA._NET_WM_ALLOWED_ACTIONS] = XInternAtom(DisplayHandle, "_NET_WM_ALLOWED_ACTIONS", false);
+ NetAtoms[(int)NA._NET_WM_STRUT] = XInternAtom(DisplayHandle, "_NET_WM_STRUT", false);
+ NetAtoms[(int)NA._NET_WM_STRUT_PARTIAL] = XInternAtom(DisplayHandle, "_NET_WM_STRUT_PARTIAL", false);
+ NetAtoms[(int)NA._NET_WM_ICON_GEOMETRY] = XInternAtom(DisplayHandle, "_NET_WM_ICON_GEOMETRY", false);
+ NetAtoms[(int)NA._NET_WM_ICON] = XInternAtom(DisplayHandle, "_NET_WM_ICON", false);
+ NetAtoms[(int)NA._NET_WM_PID] = XInternAtom(DisplayHandle, "_NET_WM_PID", false);
+ NetAtoms[(int)NA._NET_WM_HANDLED_ICONS] = XInternAtom(DisplayHandle, "_NET_WM_HANDLED_ICONS", false);
+ NetAtoms[(int)NA._NET_WM_USER_TIME] = XInternAtom(DisplayHandle, "_NET_WM_USER_TIME", false);
+ NetAtoms[(int)NA._NET_FRAME_EXTENTS] = XInternAtom(DisplayHandle, "_NET_FRAME_EXTENTS", false);
+
+ NetAtoms[(int)NA._NET_WM_PING] = XInternAtom(DisplayHandle, "_NET_WM_PING", false);
+ NetAtoms[(int)NA._NET_WM_SYNC_REQUEST] = XInternAtom(DisplayHandle, "_NET_WM_SYNC_REQUEST", false);
+
+ NetAtoms[(int)NA._NET_SYSTEM_TRAY_S] = XInternAtom(DisplayHandle, "_NET_SYSTEM_TRAY_S" + ScreenNo.ToString(), false);
+ NetAtoms[(int)NA._NET_SYSTEM_TRAY_OPCODE] = XInternAtom(DisplayHandle, "_NET_SYSTEM_TRAY_OPCODE", false);
+ NetAtoms[(int)NA._NET_SYSTEM_TRAY_ORIENTATION] = XInternAtom(DisplayHandle, "_NET_SYSTEM_TRAY_ORIENTATION", false);
+
+ NetAtoms[(int)NA._NET_WM_STATE_MAXIMIZED_HORZ] = XInternAtom(DisplayHandle, "_NET_WM_STATE_MAXIMIZED_HORZ", false);
+ NetAtoms[(int)NA._NET_WM_STATE_MAXIMIZED_VERT] = XInternAtom(DisplayHandle, "_NET_WM_STATE_MAXIMIZED_VERT", false);
+
+ NetAtoms[(int)NA._XEMBED] = XInternAtom(DisplayHandle, "_XEMBED", false);
+ NetAtoms[(int)NA._XEMBED_INFO] = XInternAtom(DisplayHandle, "_XEMBED_INFO", false);
+
+ NetAtoms[(int)NA._MOTIF_WM_HINTS] = XInternAtom(DisplayHandle, "_MOTIF_WM_HINTS", false);
+
+ NetAtoms[(int)NA._NET_WM_STATE_NO_TASKBAR] = XInternAtom(DisplayHandle, "_NET_WM_STATE_NO_TASKBAR", false);
+ NetAtoms[(int)NA._NET_WM_STATE_ABOVE] = XInternAtom(DisplayHandle, "_NET_WM_STATE_ABOVE", false);
+ NetAtoms[(int)NA._NET_WM_STATE_MODAL] = XInternAtom(DisplayHandle, "_NET_WM_STATE_MODAL", false);
+ NetAtoms[(int)NA._NET_WM_CONTEXT_HELP] = XInternAtom(DisplayHandle, "_NET_WM_CONTEXT_HELP", false);
+ NetAtoms[(int)NA._NET_WM_WINDOW_OPACITY] = XInternAtom(DisplayHandle, "_NET_WM_WINDOW_OPACITY", false);
+
+ // Clipboard support
+ NetAtoms[(int)NA.CLIPBOARD] = XInternAtom (DisplayHandle, "CLIPBOARD", false);
+ NetAtoms[(int)NA.DIB] = (int)Atom.XA_PIXMAP;
+ NetAtoms[(int)NA.OEMTEXT] = XInternAtom(DisplayHandle, "COMPOUND_TEXT", false);
+ NetAtoms[(int)NA.UNICODETEXT] = XInternAtom(DisplayHandle, "UTF8_STRING", false);
+ NetAtoms[(int)NA.TARGETS] = XInternAtom(DisplayHandle, "TARGETS", false);
+
+ // Special Atoms
+ AsyncAtom = XInternAtom(DisplayHandle, "_SWF_AsyncAtom", false);
+ PostAtom = XInternAtom (DisplayHandle, "_SWF_PostMessageAtom", false);
+ HoverState.Atom = XInternAtom(DisplayHandle, "_SWF_HoverAtom", false);
+ }
+
+ private void GetSystrayManagerWindow() {
+ XGrabServer(DisplayHandle);
+ SystrayMgrWindow = XGetSelectionOwner(DisplayHandle, NetAtoms[(int)NA._NET_SYSTEM_TRAY_S]);
+ XUngrabServer(DisplayHandle);
+ XFlush(DisplayHandle);
+ }
+
+ private void SendNetWMMessage(IntPtr window, IntPtr message_type, IntPtr l0, IntPtr l1, IntPtr l2) {
+ XEvent xev;
+
+ xev = new XEvent();
+ xev.ClientMessageEvent.type = XEventName.ClientMessage;
+ xev.ClientMessageEvent.send_event = true;
+ xev.ClientMessageEvent.window = window;
+ xev.ClientMessageEvent.message_type = message_type;
+ xev.ClientMessageEvent.format = 32;
+ xev.ClientMessageEvent.ptr1 = l0;
+ xev.ClientMessageEvent.ptr2 = l1;
+ xev.ClientMessageEvent.ptr3 = l2;
+ XSendEvent(DisplayHandle, RootWindow, false, EventMask.SubstructureRedirectMask | EventMask.SubstructureNotifyMask, ref xev);
+ }
+
+ private void SendNetClientMessage(IntPtr window, IntPtr message_type, IntPtr l0, IntPtr l1, IntPtr l2) {
+ XEvent xev;
+
+ xev = new XEvent();
+ xev.ClientMessageEvent.type = XEventName.ClientMessage;
+ xev.ClientMessageEvent.send_event = true;
+ xev.ClientMessageEvent.window = window;
+ xev.ClientMessageEvent.message_type = message_type;
+ xev.ClientMessageEvent.format = 32;
+ xev.ClientMessageEvent.ptr1 = l0;
+ xev.ClientMessageEvent.ptr2 = l1;
+ xev.ClientMessageEvent.ptr3 = l2;
+ XSendEvent(DisplayHandle, window, false, EventMask.NoEventMask, ref xev);
+ }
+
+ private void DeriveStyles(IntPtr handle, int Style, int ExStyle, out FormBorderStyle border_style, out TitleStyle title_style, out int caption_height, out int tool_caption_height) {
+
+ // Only MDI windows get caption_heights
+ caption_height = 0;
+ tool_caption_height = 19;
+
+ if ((Style & (int) WindowStyles.WS_OVERLAPPEDWINDOW) == 0) {
+ if ((Style & (int) WindowStyles.WS_BORDER) != 0) {
+ border_style = FormBorderStyle.FixedSingle;
+ } else if ((ExStyle & (int) WindowStyles.WS_EX_CLIENTEDGE) != 0) {
+ border_style = FormBorderStyle.Fixed3D;
+ } else {
+ border_style = FormBorderStyle.None;
+ }
+ title_style = TitleStyle.None;
+ } else {
+ bool is_mdi = false;
+
+ if ((ExStyle & (int) WindowStyles.WS_EX_MDICHILD) != 0) {
+ caption_height = 26;
+ is_mdi = true;
+ }
+
+ title_style = TitleStyle.None;
+ if ((Style & (int)WindowStyles.WS_CAPTION) != 0) {
+ if ((ExStyle & (int)WindowStyles.WS_EX_TOOLWINDOW) != 0) {
+ title_style = TitleStyle.Tool;
+ } else {
+ title_style = TitleStyle.Normal;
+ }
+ }
+
+ if (!is_mdi) {
+ border_style = FormBorderStyle.None;
+ if ((ExStyle & (int)WindowStyles.WS_EX_WINDOWEDGE) != 0) {
+ if ((ExStyle & (int)WindowStyles.WS_EX_TOOLWINDOW) != 0) {
+ if ((Style & (int)WindowStyles.WS_THICKFRAME) != 0) {
+ border_style = FormBorderStyle.SizableToolWindow;
+ } else {
+ border_style = FormBorderStyle.FixedToolWindow;
+ }
+ } else if ((ExStyle & (int)WindowStyles.WS_EX_DLGMODALFRAME) != 0) {
+ border_style = FormBorderStyle.FixedDialog;
+ } else if ((ExStyle & (int)WindowStyles.WS_THICKFRAME) != 0) {
+ border_style = FormBorderStyle.Sizable;
+ } else {
+ border_style = FormBorderStyle.FixedSingle;
+ }
+ } else {
+ border_style = FormBorderStyle.Fixed3D;
+ }
+ } else {
+ if ((Style & (int) WindowStyles.WS_OVERLAPPEDWINDOW) != 0 ||
+ (ExStyle & (int) WindowStyles.WS_EX_TOOLWINDOW) != 0)
+ border_style = (FormBorderStyle) 0xFFFF;
+ else
+ border_style = FormBorderStyle.None;
+ }
+ }
+ }
+
+ private void SetHwndStyles(Hwnd hwnd, CreateParams cp) {
+ DeriveStyles(hwnd.Handle, cp.Style, cp.ExStyle, out hwnd.border_style, out hwnd.title_style, out hwnd.caption_height, out hwnd.tool_caption_height);
+ }
+
+ private void SetWMStyles(Hwnd hwnd, CreateParams cp) {
+ MotifWmHints mwmHints;
+ MotifFunctions functions;
+ MotifDecorations decorations;
+ uint[] atoms;
+ int atom_count;
+ Rectangle client_rect;
+
+ mwmHints = new MotifWmHints();
+ functions = 0;
+ decorations = 0;
+
+ mwmHints.flags = (IntPtr)(MotifFlags.Functions | MotifFlags.Decorations);
+ mwmHints.functions = (IntPtr)0;
+ mwmHints.decorations = (IntPtr)0;
+
+ if ((cp.Style & (int)WindowStyles.WS_CAPTION) != 0) {
+ functions |= MotifFunctions.Move;
+ decorations |= MotifDecorations.Title | MotifDecorations.Menu;
+ }
+
+ if ((cp.Style & ((int)WindowStyles.WS_THICKFRAME)) != 0) {
+ functions |= MotifFunctions.Move | MotifFunctions.Resize;
+ decorations |= MotifDecorations.Border | MotifDecorations.ResizeH;
+ }
+
+ if ((cp.Style & ((int)WindowStyles.WS_MINIMIZEBOX)) != 0) {
+ functions |= MotifFunctions.Minimize;
+ decorations |= MotifDecorations.Minimize;
+ }
+
+ if ((cp.Style & ((int)WindowStyles.WS_MAXIMIZEBOX)) != 0) {
+ functions |= MotifFunctions.Maximize;
+ decorations |= MotifDecorations.Maximize;
+ }
+
+ if ((cp.Style & ((int)WindowStyles.WS_SYSMENU)) != 0) {
+ functions |= MotifFunctions.Close;
+ }
+
+ if ((cp.ExStyle & ((int)WindowStyles.WS_EX_DLGMODALFRAME)) != 0) {
+ decorations |= MotifDecorations.Border;
+ }
+
+ if ((cp.Style & ((int)WindowStyles.WS_DLGFRAME)) != 0) {
+ decorations |= MotifDecorations.Border;
+ }
+
+ if ((cp.Style & ((int)WindowStyles.WS_BORDER)) != 0) {
+ decorations |= MotifDecorations.Border;
+ }
+
+ if ((cp.ExStyle & ((int)WindowStyles.WS_EX_TOOLWINDOW)) != 0) {
+ functions = 0;
+ decorations = 0;
+ }
+
+ mwmHints.functions = (IntPtr)functions;
+ mwmHints.decorations = (IntPtr)decorations;
+
+ client_rect = hwnd.ClientRect;
+ lock (XlibLock) {
+ XChangeProperty(DisplayHandle, hwnd.whole_window, NetAtoms[(int)NA._MOTIF_WM_HINTS], NetAtoms[(int)NA._MOTIF_WM_HINTS], 32, PropertyMode.Replace, ref mwmHints, 5);
+
+ if (((cp.Style & (int)WindowStyles.WS_POPUP) != 0) && (hwnd.parent != null) && (hwnd.parent.whole_window != IntPtr.Zero)) {
+ XSetTransientForHint(DisplayHandle, hwnd.whole_window, hwnd.parent.whole_window);
+ }
+ XMoveResizeWindow(DisplayHandle, hwnd.client_window, client_rect.X, client_rect.Y, client_rect.Width, client_rect.Height);
+
+ atoms = new uint[8];
+ atom_count = 0;
+
+ if ((cp.ExStyle & ((int)WindowStyles.WS_EX_TOOLWINDOW)) != 0) {
+ atoms[atom_count++] = (uint)NetAtoms[(int)NA._NET_WM_STATE_NO_TASKBAR];
+ }
+
+ XChangeProperty(DisplayHandle, hwnd.whole_window, NetAtoms[(int)NA._NET_WM_STATE], Atom.XA_ATOM, 32, PropertyMode.Replace, atoms, atom_count);
+
+ atom_count = 0;
+ atoms[atom_count++] = (uint)NetAtoms[(int)NA.WM_DELETE_WINDOW];
+ if ((cp.ExStyle & (int)WindowStyles.WS_EX_CONTEXTHELP) != 0) {
+ atoms[atom_count++] = (uint)NetAtoms[(int)NA._NET_WM_CONTEXT_HELP];
+ }
+
+ XSetWMProtocols(DisplayHandle, hwnd.whole_window, atoms, atom_count);
+ }
+ }
+
+ private void SetIcon(Hwnd hwnd, Icon icon) {
+ Bitmap bitmap;
+ int size;
+ uint[] data;
+ int index;
+
+ bitmap = icon.ToBitmap();
+ index = 0;
+ size = bitmap.Width * bitmap.Height + 2;
+ data = new uint[size];
+
+ data[index++] = (uint)bitmap.Width;
+ data[index++] = (uint)bitmap.Height;
+
+ for (int y = 0; y < bitmap.Height; y++) {
+ for (int x = 0; x < bitmap.Width; x++) {
+ data[index++] = (uint)bitmap.GetPixel(x, y).ToArgb();
+ }
+ }
+ XChangeProperty(DisplayHandle, hwnd.whole_window, NetAtoms[(int)NA._NET_WM_ICON], Atom.XA_CARDINAL, 32, PropertyMode.Replace, data, size);
+ }
+
+ private IntPtr ImageToPixmap(Image image) {
+ return IntPtr.Zero;
+ }
+
+ private void WakeupMain () {
+ wake.Send (new byte [] { 0xFF });
+ }
+
+ private void TranslatePropertyToClipboard(int property) {
+ Atom actual_atom;
+ int actual_format;
+ int nitems;
+ int bytes_after;
+ IntPtr prop = IntPtr.Zero;
+
+ Clipboard.Item = null;
+
+ XGetWindowProperty(DisplayHandle, FosterParent, property, 0, 0x7fffffff, true, Atom.AnyPropertyType, out actual_atom, out actual_format, out nitems, out bytes_after, ref prop);
+
+ if (nitems > 0) {
+ if (property == (int)Atom.XA_STRING) {
+ Clipboard.Item = Marshal.PtrToStringAnsi(prop);
+ } else if (property == (int)Atom.XA_BITMAP) {
+ // FIXME - convert bitmap to image
+ } else if (property == (int)Atom.XA_PIXMAP) {
+ // FIXME - convert pixmap to image
+ } else if (property == NetAtoms[(int)NA.OEMTEXT]) {
+ Clipboard.Item = Marshal.PtrToStringAnsi(prop);
+ } else if (property == NetAtoms[(int)NA.UNICODETEXT]) {
+ Clipboard.Item = Marshal.PtrToStringAnsi(prop);
+ }
+
+ XFree(prop);
+ }
+ }
+
+ private void AddExpose (XEvent xevent) {
+ Hwnd hwnd;
+
+ hwnd = Hwnd.GetObjectFromWindow(xevent.AnyEvent.window);
+
+ // Don't waste time
+ //if (hwnd == null || !hwnd.visible) { // Can'd check visible; we might loose expose for whole_windows
+ if (hwnd == null) {
+ return;
+ }
+
+ if (xevent.AnyEvent.window == hwnd.client_window) {
+ hwnd.AddInvalidArea(xevent.ExposeEvent.x, xevent.ExposeEvent.y, xevent.ExposeEvent.width, xevent.ExposeEvent.height);
+
+ if (!hwnd.expose_pending) {
+ MessageQueue.Enqueue(xevent);
+ hwnd.expose_pending = true;
+ }
+ } else {
+ if (!hwnd.nc_expose_pending) {
+ MessageQueue.Enqueue(xevent);
+ hwnd.nc_expose_pending = true;
+ }
+ }
+ }
+
+ private void InvalidateWholeWindow(IntPtr handle) {
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+ InvalidateWholeWindow(handle, new Rectangle(0, 0, hwnd.Width, hwnd.Height));
+ }
+
+ private void InvalidateWholeWindow(IntPtr handle, Rectangle rectangle) {
+ Hwnd hwnd;
+ XEvent xevent;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+
+ xevent = new XEvent ();
+ xevent.type = XEventName.Expose;
+ xevent.ExposeEvent.display = DisplayHandle;
+ xevent.ExposeEvent.window = hwnd.whole_window;
+
+ xevent.ExposeEvent.x = rectangle.X;
+ xevent.ExposeEvent.y = rectangle.Y;
+ xevent.ExposeEvent.width = rectangle.Width;
+ xevent.ExposeEvent.height = rectangle.Height;
+
+ AddExpose (xevent);
+ }
+
+ private void WholeToScreen(IntPtr handle, ref int x, ref int y) {
+ int dest_x_return;
+ int dest_y_return;
+ IntPtr child;
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+ lock (XlibLock) {
+ XTranslateCoordinates(DisplayHandle, hwnd.whole_window, RootWindow, x, y, out dest_x_return, out dest_y_return, out child);
+ }
+
+ x = dest_x_return;
+ y = dest_y_return;
+ }
+
+ private void AddConfigureNotify (XEvent xevent) {
+ Hwnd hwnd;
+
+ hwnd = Hwnd.GetObjectFromWindow(xevent.ConfigureEvent.window);
+
+ // Don't waste time
+ if (hwnd == null) {
+ return;
+ }
+
+ if (xevent.ConfigureEvent.window == hwnd.whole_window) {
+ if (!hwnd.reparented) {
+ hwnd.x = xevent.ConfigureEvent.x;
+ hwnd.y = xevent.ConfigureEvent.y;
+ } else {
+ int dummy_int;
+ IntPtr dummy_ptr;
+
+ XGetGeometry(DisplayHandle, XGetParent(hwnd.whole_window), out dummy_ptr, out hwnd.x, out hwnd.y, out dummy_int, out dummy_int, out dummy_int, out dummy_int);
+ }
+
+ hwnd.width = xevent.ConfigureEvent.width;
+ hwnd.height = xevent.ConfigureEvent.height;
+
+ if (!hwnd.configure_pending) {
+ MessageQueue.Enqueue(xevent);
+ hwnd.configure_pending = true;
+ }
+ }
+ // We drop configure events for Client windows
+ }
+
+ private void ShowCaret() {
+ if ((Caret.gc == IntPtr.Zero) || Caret.On) {
+ return;
+ }
+ Caret.On = true;
+
+ lock (XlibLock) {
+ XDrawLine(DisplayHandle, Caret.Window, Caret.gc, Caret.X, Caret.Y, Caret.X, Caret.Y + Caret.Height);
+ }
+ }
+
+ private void HideCaret() {
+ if ((Caret.gc == IntPtr.Zero) || !Caret.On) {
+ return;
+ }
+ Caret.On = false;
+
+ lock (XlibLock) {
+ XDrawLine(DisplayHandle, Caret.Window, Caret.gc, Caret.X, Caret.Y, Caret.X, Caret.Y + Caret.Height);
+ }
+ }
+
+ private int NextTimeout (DateTime now) {
+ int timeout = Int32.MaxValue;
+ lock (TimerList) {
+ foreach (Timer timer in TimerList) {
+ int next = (int) (timer.Expires - now).TotalMilliseconds;
+ if (next < 0) {
+ return 0; // Have a timer that has already expired
+ }
+
+ if (next < timeout) {
+ timeout = next;
+ }
+ }
+ }
+ if (timeout < Timer.Minimum) {
+ timeout = Timer.Minimum;
+ }
+
+ return timeout;
+ }
+
+ private void CheckTimers (DateTime now) {
+ lock (TimerList) {
+ int count;
+
+ count = TimerList.Count;
+
+ if (count == 0) {
+ return;
+ }
+
+ for (int i = 0; i < TimerList.Count; i++) {
+ Timer timer;
+
+ timer = (Timer) TimerList[i];
+
+ if (timer.Enabled && timer.Expires <= now) {
+ timer.Update (now);
+ timer.FireTick ();
+ }
+ }
+ }
+ }
+
+ private void UpdateMessageQueue () {
+ DateTime now;
+ int pending;
+
+ now = DateTime.Now;
+
+ lock (XlibLock) {
+ pending = XPending (DisplayHandle);
+ }
+
+ if (pending == 0) {
+ if (Idle != null) {
+ Idle (this, EventArgs.Empty);
+ }
+
+ lock (XlibLock) {
+ pending = XPending (DisplayHandle);
+ }
+ }
+
+ if (pending == 0) {
+ int timeout;
+
+ timeout = NextTimeout (now);
+ if (timeout > 0) {
+ #if __MonoCS__
+ Syscall.poll (pollfds, (uint) pollfds.Length, timeout);
+ // Clean out buffer, so we're not busy-looping on the same data
+ if (pollfds[1].revents != 0) {
+ wake_receive.Receive(network_buffer, 0, 1, SocketFlags.None);
+ }
+ #endif
+ lock (XlibLock) {
+ pending = XPending (DisplayHandle);
+ }
+ }
+ }
+
+ CheckTimers (now);
+
+ if (pending == 0) {
+ lock (XlibLock) {
+ pending = XPending (DisplayHandle);
+ }
+ }
+
+ while (pending > 0) {
+ XEvent xevent = new XEvent ();
+
+ lock (XlibLock) {
+ XNextEvent (DisplayHandle, ref xevent);
+ }
+//Console.WriteLine("Got x event {0}", xevent);
+ switch (xevent.type) {
+ case XEventName.Expose:
+ AddExpose (xevent);
+ break;
+
+ case XEventName.SelectionClear: {
+ // Should we do something?
+ break;
+ }
+
+ case XEventName.SelectionRequest: {
+ if (Dnd.HandleSelectionRequestEvent (ref xevent))
+ break;
+ XEvent sel_event;
+
+ sel_event = new XEvent();
+ sel_event.SelectionEvent.type = XEventName.SelectionNotify;
+ sel_event.SelectionEvent.send_event = true;
+ sel_event.SelectionEvent.display = DisplayHandle;
+ sel_event.SelectionEvent.selection = xevent.SelectionRequestEvent.selection;
+ sel_event.SelectionEvent.target = xevent.SelectionRequestEvent.target;
+ sel_event.SelectionEvent.requestor = xevent.SelectionRequestEvent.requestor;
+ sel_event.SelectionEvent.time = xevent.SelectionRequestEvent.time;
+ sel_event.SelectionEvent.property = 0;
+
+ // Seems that some apps support asking for supported types
+ if (xevent.SelectionEvent.target == NetAtoms[(int)NA.TARGETS]) {
+ uint[] atoms;
+ int atom_count;
+
+ atoms = new uint[5];
+ atom_count = 0;
+
+ if (Clipboard.Item is String) {
+ atoms[atom_count++] = (uint)Atom.XA_STRING;
+ atoms[atom_count++] = (uint)NetAtoms[(int)NA.OEMTEXT];
+ atoms[atom_count++] = (uint)NetAtoms[(int)NA.UNICODETEXT];
+ } else if (Clipboard.Item is Image) {
+ atoms[atom_count++] = (uint)Atom.XA_PIXMAP;
+ atoms[atom_count++] = (uint)Atom.XA_BITMAP;
+ } else {
+ // FIXME - handle other types
+ }
+
+ XChangeProperty(DisplayHandle, xevent.SelectionEvent.requestor, xevent.SelectionRequestEvent.property, xevent.SelectionRequestEvent.target, 32, PropertyMode.Replace, atoms, atom_count);
+ } else if (Clipboard.Item is string) {
+ IntPtr buffer;
+ int buflen;
+
+ buflen = 0;
+
+ if (xevent.SelectionRequestEvent.target == (int)Atom.XA_STRING) {
+ Byte[] bytes;
+
+ bytes = new ASCIIEncoding().GetBytes((string)Clipboard.Item);
+ buffer = Marshal.AllocHGlobal(bytes.Length);
+ buflen = bytes.Length;
+
+ for (int i = 0; i < buflen; i++) {
+ Marshal.WriteByte(buffer, i, bytes[i]);
+ }
+ } else if (xevent.SelectionRequestEvent.target == NetAtoms[(int)NA.OEMTEXT]) {
+ // FIXME - this should encode into ISO2022
+ buffer = Marshal.StringToHGlobalAnsi((string)Clipboard.Item);
+ while (Marshal.ReadByte(buffer, buflen) != 0) {
+ buflen++;
+ }
+ } else if (xevent.SelectionRequestEvent.target == NetAtoms[(int)NA.UNICODETEXT]) {
+ buffer = Marshal.StringToHGlobalAnsi((string)Clipboard.Item);
+ while (Marshal.ReadByte(buffer, buflen) != 0) {
+ buflen++;
+ }
+ } else {
+ buffer = IntPtr.Zero;
+ }
+
+ if (buffer != IntPtr.Zero) {
+ XChangeProperty(DisplayHandle, xevent.SelectionRequestEvent.requestor, xevent.SelectionRequestEvent.property, xevent.SelectionRequestEvent.target, 8, PropertyMode.Replace, buffer, buflen);
+ sel_event.SelectionEvent.property = xevent.SelectionRequestEvent.property;
+ Marshal.FreeHGlobal(buffer);
+ }
+ } else if (Clipboard.Item is Image) {
+ if (xevent.SelectionEvent.target == (int)Atom.XA_PIXMAP) {
+ // FIXME - convert image and store as property
+ } else if (xevent.SelectionEvent.target == (int)Atom.XA_PIXMAP) {
+ // FIXME - convert image and store as property
+ }
+ }
+
+ XSendEvent(DisplayHandle, xevent.SelectionRequestEvent.requestor, false, EventMask.NoEventMask, ref sel_event);
+ break;
+ }
+
+ case XEventName.SelectionNotify: {
+ if (Clipboard.Enumerating) {
+ Clipboard.Enumerating = false;
+ if (xevent.SelectionEvent.property != 0) {
+ XDeleteProperty(DisplayHandle, FosterParent, xevent.SelectionEvent.property);
+ if (!Clipboard.Formats.Contains(xevent.SelectionEvent.property)) {
+ Clipboard.Formats.Add(xevent.SelectionEvent.property);
+ #if DriverDebugExtra
+ Console.WriteLine("Got supported clipboard atom format: {0}", xevent.SelectionEvent.property);
+ #endif
+ }
+ }
+ } else if (Clipboard.Retrieving) {
+ Clipboard.Retrieving = false;
+ if (xevent.SelectionEvent.property != 0) {
+ TranslatePropertyToClipboard(xevent.SelectionEvent.property);
+ } else {
+ Clipboard.Item = null;
+ }
+ } else {
+ Dnd.HandleSelectionNotifyEvent (ref xevent);
+ }
+ break;
+ }
+
+ case XEventName.KeyPress:
+ case XEventName.KeyRelease:
+ case XEventName.ButtonPress:
+ case XEventName.ButtonRelease:
+ case XEventName.MotionNotify:
+ case XEventName.EnterNotify:
+ case XEventName.LeaveNotify:
+ case XEventName.CreateNotify:
+ case XEventName.DestroyNotify:
+ case XEventName.FocusIn:
+ case XEventName.FocusOut:
+ case XEventName.ClientMessage:
+ case XEventName.ReparentNotify:
+ MessageQueue.Enqueue (xevent);
+ break;
+
+ case XEventName.ConfigureNotify:
+ AddConfigureNotify(xevent);
+ break;
+
+ case XEventName.PropertyNotify:
+ if (xevent.PropertyEvent.atom == NetAtoms[(int)NA._NET_ACTIVE_WINDOW]) {
+ Atom actual_atom;
+ int actual_format;
+ int nitems;
+ int bytes_after;
+ IntPtr prop = IntPtr.Zero;
+ IntPtr prev_active;;
+
+ prev_active = ActiveWindow;
+ XGetWindowProperty(DisplayHandle, RootWindow, NetAtoms[(int)NA._NET_ACTIVE_WINDOW], 0, 1, false, Atom.XA_WINDOW, out actual_atom, out actual_format, out nitems, out bytes_after, ref prop);
+ if ((nitems > 0) && (prop != IntPtr.Zero)) {
+ ActiveWindow = Hwnd.GetHandleFromWindow((IntPtr)Marshal.ReadInt32(prop));
+ XFree(prop);
+
+ if (prev_active != ActiveWindow) {
+ if (prev_active != IntPtr.Zero) {
+ PostMessage(prev_active, Msg.WM_ACTIVATE, (IntPtr)WindowActiveFlags.WA_INACTIVE, IntPtr.Zero);
+ }
+ if (ActiveWindow != IntPtr.Zero) {
+ PostMessage(ActiveWindow, Msg.WM_ACTIVATE, (IntPtr)WindowActiveFlags.WA_ACTIVE, IntPtr.Zero);
+ }
+ }
+ if (ModalWindows.Count == 0) {
+ break;
+ } else {
+ // Modality handling, if we are modal and the new active window is one
+ // of ours but not the modal one, switch back to the modal window
+
+ if (NativeWindow.FindWindow(ActiveWindow) != null) {
+ if (ActiveWindow != (IntPtr)ModalWindows.Peek()) {
+ Activate((IntPtr)ModalWindows.Peek());
+ }
+ }
+ break;
+ }
+ }
+ }
+ break;
+
+ }
+
+ lock (XlibLock) {
+ pending = XPending (DisplayHandle);
+ }
+ }
+ }
+
+ private IntPtr GetMousewParam(int Delta) {
+ int result = 0;
+
+ if ((MouseState & MouseButtons.Left) != 0) {
+ result |= (int)MsgButtons.MK_LBUTTON;
+ }
+
+ if ((MouseState & MouseButtons.Middle) != 0) {
+ result |= (int)MsgButtons.MK_MBUTTON;
+ }
+
+ if ((MouseState & MouseButtons.Right) != 0) {
+ result |= (int)MsgButtons.MK_RBUTTON;
+ }
+
+ Keys mods = ModifierKeys;
+ if ((mods & Keys.Control) != 0) {
+ result |= (int)MsgButtons.MK_CONTROL;
+ }
+
+ if ((mods & Keys.Shift) != 0) {
+ result |= (int)MsgButtons.MK_SHIFT;
+ }
+
+ result |= Delta << 16;
+
+ return (IntPtr)result;
+ }
+ private IntPtr XGetParent(IntPtr handle) {
+ IntPtr Root;
+ IntPtr Parent;
+ IntPtr Children;
+ int ChildCount;
+
+ lock (XlibLock) {
+ XQueryTree(DisplayHandle, handle, out Root, out Parent, out Children, out ChildCount);
+ }
+
+ if (Children!=IntPtr.Zero) {
+ lock (XlibLock) {
+ XFree(Children);
+ }
+ }
+ return Parent;
+ }
+
+ private int HandleError(IntPtr display, ref XErrorEvent error_event) {
+ if (ErrorExceptions) {
+ throw new XException(error_event.display, error_event.resourceid, error_event.serial, error_event.error_code, error_event.request_code, error_event.minor_code);
+ } else {
+ Console.WriteLine("X11 Error encountered: {0}{1}\n", XException.GetMessage(error_event.display, error_event.resourceid, error_event.serial, error_event.error_code, error_event.request_code, error_event.minor_code), WhereString());
+ }
+ return 0;
+ }
+
+ private void DestroyChildWindow(Control c) {
+ Hwnd hwnd;
+ int i;
+ Control[] controls;
+
+ if (c != null) {
+ controls = c.child_controls.GetAllControls ();
+
+ for (i = 0; i < controls.Length; i++) {
+ hwnd = Hwnd.ObjectFromHandle(controls[i].Handle);
+
+ if (hwnd != null) {
+ hwnd.destroy_pending = true;
+ }
+ DestroyChildWindow(controls[i]);
+ }
+ }
+ }
+
+ #endregion // Private Methods
+
+ #region Callbacks
+ private void MouseHover(object sender, EventArgs e) {
+ if ((HoverState.X == MousePosition.X) && (HoverState.Y == MousePosition.Y)) {
+ XEvent xevent;
+
+ HoverState.Timer.Enabled = false;
+
+ if (HoverState.Window != IntPtr.Zero) {
+ xevent = new XEvent ();
+
+ xevent.type = XEventName.ClientMessage;
+ xevent.ClientMessageEvent.display = DisplayHandle;
+ xevent.ClientMessageEvent.window = (IntPtr)HoverState.Window;
+ xevent.ClientMessageEvent.message_type = (IntPtr)HoverState.Atom;
+ xevent.ClientMessageEvent.format = 32;
+ xevent.ClientMessageEvent.ptr1 = (IntPtr) (HoverState.Y << 16 | HoverState.X);
+
+ MessageQueue.EnqueueLocked (xevent);
+
+ WakeupMain ();
+ }
+ }
+ }
+
+ private void CaretCallback(object sender, EventArgs e) {
+ if (Caret.Paused) {
+ return;
+ }
+ Caret.On = !Caret.On;
+
+ XDrawLine(DisplayHandle, Caret.Hwnd, Caret.gc, Caret.X, Caret.Y, Caret.X, Caret.Y + Caret.Height);
+ }
+ #endregion // Callbacks
+
+ #region Public Properties
+
+ internal override int Caption {
+ get {
+ return 25;
+ }
+ }
+
+ internal override Size CursorSize {
+ get {
+ int x;
+ int y;
+
+ if (XQueryBestCursor(DisplayHandle, RootWindow, 32, 32, out x, out y) != 0) {
+ return new Size(x, y);
+ } else {
+ return new Size(16, 16);
+ }
+ }
+ }
+
+ internal override bool DragFullWindows {
+ get {
+ return true;
+ }
+ }
+
+ internal override Size DragSize {
+ get {
+ return new Size(4, 4);
+ }
+ }
+
+ internal override Size FrameBorderSize {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ internal override Size IconSize {
+ get {
+ IntPtr list;
+ XIconSize size;
+ int count;
+
+ if (XGetIconSizes(DisplayHandle, RootWindow, out list, out count) != 0) {
+ long current;
+ int largest;
+
+ current = (long)list;
+ largest = 0;
+
+ size = new XIconSize();
+
+ for (int i = 0; i < count; i++) {
+ size = (XIconSize)Marshal.PtrToStructure((IntPtr)current, size.GetType());
+ current += Marshal.SizeOf(size);
+
+ // Look for our preferred size
+ if (size.min_width == 32) {
+ XFree(list);
+ return new Size(32, 32);
+ }
+
+ if (size.max_width == 32) {
+ XFree(list);
+ return new Size(32, 32);
+ }
+
+ if (size.min_width < 32 && size.max_width > 32) {
+ int x;
+
+ // check if we can fit one
+ x = size.min_width;
+ while (x < size.max_width) {
+ x += size.width_inc;
+ if (x == 32) {
+ XFree(list);
+ return new Size(32, 32);
+ }
+ }
+ }
+
+ if (largest < size.max_width) {
+ largest = size.max_width;
+ }
+ }
+
+ // We didn't find a match or we wouldn't be here
+ return new Size(largest, largest);
+
+ } else {
+ return new Size(32, 32);
+ }
+ }
+ }
+
+ internal override int KeyboardSpeed {
+ get{
+ //
+ // A lot harder: need to do:
+ // XkbQueryExtension(0x08051008, 0xbfffdf4c, 0xbfffdf50, 0xbfffdf54, 0xbfffdf58) = 1
+ // XkbAllocKeyboard(0x08051008, 0xbfffdf4c, 0xbfffdf50, 0xbfffdf54, 0xbfffdf58) = 0x080517a8
+ // XkbGetControls(0x08051008, 1, 0x080517a8, 0xbfffdf54, 0xbfffdf58) = 0
+ //
+ // And from that we can tell the repetition rate
+ //
+ // Notice, the values must map to:
+ // [0, 31] which maps to 2.5 to 30 repetitions per second.
+ //
+ return 0;
+ }
+ }
+
+ internal override int KeyboardDelay {
+ get {
+ //
+ // Return values must range from 0 to 4, 0 meaning 250ms,
+ // and 4 meaning 1000 ms.
+ //
+ return 1; // ie, 500 ms
+ }
+ }
+
+ internal override Size MaxWindowTrackSize {
+ get {
+ return new Size (WorkingArea.Width, WorkingArea.Height);
+ }
+ }
+
+ internal override Size MinimizedWindowSize {
+ get {
+ return new Size(1, 1);
+ }
+ }
+
+ internal override Size MinimizedWindowSpacingSize {
+ get {
+ return new Size(1, 1);
+ }
+ }
+
+ internal override Size MinimumWindowSize {
+ get {
+ return new Size(1, 1);
+ }
+ }
+
+ internal override Size MinWindowTrackSize {
+ get {
+ return new Size(1, 1);
+ }
+ }
+
+ internal override Keys ModifierKeys {
+ get {
+ return Keyboard.ModifierKeys;
+ }
+ }
+
+ internal override Size SmallIconSize {
+ get {
+ IntPtr list;
+ XIconSize size;
+ int count;
+
+ if (XGetIconSizes(DisplayHandle, RootWindow, out list, out count) != 0) {
+ long current;
+ int smallest;
+
+ current = (long)list;
+ smallest = 0;
+
+ size = new XIconSize();
+
+ for (int i = 0; i < count; i++) {
+ size = (XIconSize)Marshal.PtrToStructure((IntPtr)current, size.GetType());
+ current += Marshal.SizeOf(size);
+
+ // Look for our preferred size
+ if (size.min_width == 16) {
+ XFree(list);
+ return new Size(16, 16);
+ }
+
+ if (size.max_width == 16) {
+ XFree(list);
+ return new Size(16, 16);
+ }
+
+ if (size.min_width < 16 && size.max_width > 16) {
+ int x;
+
+ // check if we can fit one
+ x = size.min_width;
+ while (x < size.max_width) {
+ x += size.width_inc;
+ if (x == 16) {
+ XFree(list);
+ return new Size(16, 16);
+ }
+ }
+ }
+
+ if (smallest == 0 || smallest > size.min_width) {
+ smallest = size.min_width;
+ }
+ }
+
+ // We didn't find a match or we wouldn't be here
+ return new Size(smallest, smallest);
+
+ } else {
+ return new Size(16, 16);
+ }
+ }
+ }
+
+ internal override int MouseButtonCount {
+ get {
+ return 3;
+ }
+ }
+
+ internal override bool MouseButtonsSwapped {
+ get {
+ return false; // FIXME - how to detect?
+ }
+ }
+
+ internal override bool MouseWheelPresent {
+ get {
+ return true; // FIXME - how to detect?
+ }
+ }
+
+ internal override Rectangle VirtualScreen {
+ get {
+ return WorkingArea;
+ }
+ }
+
+ internal override Rectangle WorkingArea {
+ get {
+ Atom actual_atom;
+ int actual_format;
+ int nitems;
+ int bytes_after;
+ IntPtr prop = IntPtr.Zero;
+ int width;
+ int height;
+
+ XGetWindowProperty(DisplayHandle, RootWindow, NetAtoms[(int)NA._NET_DESKTOP_GEOMETRY], 0, 256, false, Atom.XA_CARDINAL, out actual_atom, out actual_format, out nitems, out bytes_after, ref prop);
+ if ((nitems == 2) && (prop != IntPtr.Zero)) {
+ width = Marshal.ReadInt32(prop, 0);
+ height = Marshal.ReadInt32(prop, 4);
+
+ XFree(prop);
+ return new Rectangle(0, 0, width, height);
+ } else {
+ XWindowAttributes attributes=new XWindowAttributes();
+
+ lock (XlibLock) {
+ XGetWindowAttributes(DisplayHandle, XRootWindow(DisplayHandle, 0), ref attributes);
+ }
+
+ return new Rectangle(0, 0, attributes.width, attributes.height);
+ }
+ }
+ }
+ #endregion // Public properties
+
+ #region Public Static Methods
+ internal override IntPtr InitializeDriver() {
+ lock (this) {
+ if (DisplayHandle==IntPtr.Zero) {
+ SetDisplay(XOpenDisplay(IntPtr.Zero));
+ }
+ }
+ return IntPtr.Zero;
+ }
+
+ internal override void ShutdownDriver(IntPtr token) {
+ lock (this) {
+ if (DisplayHandle!=IntPtr.Zero) {
+ XCloseDisplay(DisplayHandle);
+ DisplayHandle=IntPtr.Zero;
+ }
+ }
+ }
+
+ internal override void EnableThemes() {
+ ThemesEnabled = true;
+ }
+
+
+ internal override void Activate(IntPtr handle) {
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+ if (hwnd != null) lock (XlibLock) {
+ SendNetWMMessage(hwnd.whole_window, (IntPtr)NetAtoms[(int)NA._NET_ACTIVE_WINDOW], IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
+ //XRaiseWindow(DisplayHandle, handle);
+ }
+ return;
+ }
+
+ internal override void AudibleAlert() {
+ XBell(DisplayHandle, 0);
+ return;
+ }
+
+
+ internal override void CaretVisible(IntPtr handle, bool visible) {
+ // Visible is cumulative; two hides require two shows before the caret is visible again
+ if (Caret.Hwnd == handle) {
+ if (visible) {
+ if (Caret.Visible < 1) {
+ Caret.Visible++;
+ Caret.On = false;
+ if (Caret.Visible == 1) {
+ ShowCaret();
+ Caret.Timer.Start();
+ }
+ }
+ } else {
+ Caret.Visible--;
+ if (Caret.Visible == 0) {
+ Caret.Timer.Stop();
+ HideCaret();
+ }
+ }
+ }
+ }
+
+ internal override bool CalculateWindowRect(IntPtr handle, ref Rectangle ClientRect, int Style, int ExStyle, Menu menu, out Rectangle WindowRect) {
+ FormBorderStyle border_style;
+ TitleStyle title_style;
+ int caption_height;
+ int tool_caption_height;
+
+ DeriveStyles(handle, Style, ExStyle, out border_style, out title_style,
+ out caption_height, out tool_caption_height);
+
+ WindowRect = Hwnd.GetWindowRectangle(border_style, menu, title_style,
+ caption_height, tool_caption_height,
+ ClientRect);
+
+ return true;
+ }
+
+ internal override void ClientToScreen(IntPtr handle, ref int x, ref int y) {
+ int dest_x_return;
+ int dest_y_return;
+ IntPtr child;
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+ lock (XlibLock) {
+ XTranslateCoordinates(DisplayHandle, hwnd.client_window, RootWindow, x, y, out dest_x_return, out dest_y_return, out child);
+ }
+
+ x = dest_x_return;
+ y = dest_y_return;
+ }
+
+ internal override int[] ClipboardAvailableFormats(IntPtr handle) {
+ DataFormats.Format f;
+ int[] result;
+
+ f = DataFormats.Format.List;
+
+ if (XGetSelectionOwner(DisplayHandle, NetAtoms[(int)NA.CLIPBOARD]) == IntPtr.Zero) {
+ return null;
+ }
+
+ Clipboard.Formats = new ArrayList();
+
+ while (f != null) {
+ XConvertSelection(DisplayHandle, NetAtoms[(int)NA.CLIPBOARD], f.Id, f.Id, FosterParent, IntPtr.Zero);
+
+ Clipboard.Enumerating = true;
+ while (Clipboard.Enumerating) {
+ UpdateMessageQueue();
+ }
+ f = f.Next;
+ }
+
+ result = new int[Clipboard.Formats.Count];
+
+ for (int i = 0; i < Clipboard.Formats.Count; i++) {
+ result[i] = (int)Clipboard.Formats[i];
+ }
+
+ Clipboard.Formats = null;
+ return result;
+ }
+
+ internal override void ClipboardClose(IntPtr handle) {
+ if (handle != ClipMagic) {
+ throw new ArgumentException("handle is not a valid clipboard handle");
+ }
+ return;
+ }
+
+ internal override int ClipboardGetID(IntPtr handle, string format) {
+ if (handle != ClipMagic) {
+ throw new ArgumentException("handle is not a valid clipboard handle");
+ }
+
+ if (format == "Text" ) return (int)Atom.XA_STRING;
+ else if (format == "Bitmap" ) return (int)Atom.XA_BITMAP;
+ //else if (format == "MetaFilePict" ) return 3;
+ //else if (format == "SymbolicLink" ) return 4;
+ //else if (format == "DataInterchangeFormat" ) return 5;
+ //else if (format == "Tiff" ) return 6;
+ else if (format == "OEMText" ) return XInternAtom(DisplayHandle, "COMPOUND_TEXT", false);
+ else if (format == "DeviceIndependentBitmap" ) return (int)Atom.XA_PIXMAP;
+ else if (format == "Palette" ) return (int)Atom.XA_COLORMAP; // Useless
+ //else if (format == "PenData" ) return 10;
+ //else if (format == "RiffAudio" ) return 11;
+ //else if (format == "WaveAudio" ) return 12;
+ else if (format == "UnicodeText" ) return XInternAtom(DisplayHandle, "UTF8_STRING", false);
+ //else if (format == "EnhancedMetafile" ) return 14;
+ //else if (format == "FileDrop" ) return 15;
+ //else if (format == "Locale" ) return 16;
+
+ return XInternAtom(DisplayHandle, format, false);
+ }
+
+ internal override IntPtr ClipboardOpen() {
+ return ClipMagic;
+ }
+
+ internal override object ClipboardRetrieve(IntPtr handle, int type, XplatUI.ClipboardToObject converter) {
+ XConvertSelection(DisplayHandle, NetAtoms[(int)NA.CLIPBOARD], type, type, FosterParent, IntPtr.Zero);
+
+ Clipboard.Retrieving = true;
+ while (Clipboard.Retrieving) {
+ UpdateMessageQueue();
+ }
+
+ return Clipboard.Item;
+ }
+
+ internal override void ClipboardStore(IntPtr handle, object obj, int type, XplatUI.ObjectToClipboard converter) {
+ Clipboard.Item = obj;
+ Clipboard.Type = type;
+ Clipboard.Converter = converter;
+
+ if (obj != null) {
+ XSetSelectionOwner(DisplayHandle, NetAtoms[(int)NA.CLIPBOARD], FosterParent, IntPtr.Zero);
+ } else {
+ // Clearing the selection
+ XSetSelectionOwner(DisplayHandle, NetAtoms[(int)NA.CLIPBOARD], IntPtr.Zero, IntPtr.Zero);
+ }
+ }
+
+ internal override void CreateCaret(IntPtr handle, int width, int height) {
+ XGCValues gc_values;
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+ if (Caret.Hwnd != IntPtr.Zero) {
+ DestroyCaret(Caret.Hwnd);
+ }
+
+ Caret.Hwnd = handle;
+ Caret.Window = hwnd.client_window;
+ Caret.Width = width;
+ Caret.Height = height;
+ Caret.Visible = 0;
+ Caret.On = false;
+
+ gc_values = new XGCValues();
+ gc_values.line_width = width;
+
+ Caret.gc = XCreateGC(DisplayHandle, Caret.Window, GCFunction.GCLineWidth, ref gc_values);
+ if (Caret.gc == IntPtr.Zero) {
+ Caret.Hwnd = IntPtr.Zero;
+ return;
+ }
+
+ XSetFunction(DisplayHandle, Caret.gc, GXFunction.GXinvert);
+ }
+
+ internal override IntPtr CreateWindow(CreateParams cp) {
+ XSetWindowAttributes Attributes;
+ Hwnd hwnd;
+ int X;
+ int Y;
+ int Width;
+ int Height;
+ IntPtr ParentHandle;
+ IntPtr WholeWindow;
+ IntPtr ClientWindow;
+ Rectangle ClientRect;
+ SetWindowValuemask ValueMask;
+
+
+ hwnd = new Hwnd();
+
+ Attributes = new XSetWindowAttributes();
+ X = cp.X;
+ Y = cp.Y;
+ Width = cp.Width;
+ Height = cp.Height;
+
+ if (Width<1) Width=1;
+ if (Height<1) Height=1;
+
+ if (cp.Parent != IntPtr.Zero) {
+ ParentHandle = Hwnd.ObjectFromHandle(cp.Parent).client_window;
+ } else {
+ if ((cp.Style & (int)WindowStyles.WS_CHILD) != 0) {
+ // We need to use our foster parent window until this poor child gets it's parent assigned
+ ParentHandle=FosterParent;
+ } else if ((cp.Style & (int)WindowStyles.WS_POPUP) != 0) {
+ ParentHandle=RootWindow;
+ } else {
+ // Default position on screen, if window manager doesn't place us somewhere else
+ if (X<1) X = 50;
+ if (Y<1) Y = 50;
+ ParentHandle=RootWindow;
+ }
+ }
+
+ ValueMask = SetWindowValuemask.BitGravity | SetWindowValuemask.WinGravity;
+
+ Attributes.bit_gravity = Gravity.NorthWestGravity;
+ Attributes.win_gravity = Gravity.NorthWestGravity;
+
+ // Save what's under the toolwindow
+ if ((cp.ExStyle & (int)WindowStyles.WS_EX_TOOLWINDOW) != 0) {
+ Attributes.save_under = true;
+ ValueMask |= SetWindowValuemask.SaveUnder;
+ }
+
+
+ // If we're a popup without caption we override the WM
+ if ((cp.Style & ((int)WindowStyles.WS_POPUP)) != 0) {
+ if ((cp.Style & (int)WindowStyles.WS_CAPTION) == 0) {
+ Attributes.override_redirect = true;
+ ValueMask |= SetWindowValuemask.OverrideRedirect;
+ }
+ }
+
+ hwnd.x = X;
+ hwnd.y = Y;
+ hwnd.width = Width;
+ hwnd.height = Height;
+ hwnd.parent = Hwnd.ObjectFromHandle(cp.Parent);
+
+ if ((cp.Style & ((int)WindowStyles.WS_DISABLED)) != 0) {
+ hwnd.enabled = false;
+ }
+
+ ClientRect = hwnd.ClientRect;
+ ClientWindow = IntPtr.Zero;
+
+ lock (XlibLock) {
+ WholeWindow = XCreateWindow(DisplayHandle, ParentHandle, X, Y, Width, Height, 0, (int)CreateWindowArgs.CopyFromParent, (int)CreateWindowArgs.InputOutput, IntPtr.Zero, ValueMask, ref Attributes);
+ if (WholeWindow != IntPtr.Zero) {
+ ValueMask &= ~(SetWindowValuemask.OverrideRedirect | SetWindowValuemask.SaveUnder);
+
+ if (CustomVisual != IntPtr.Zero && CustomColormap != IntPtr.Zero) {
+ ValueMask = SetWindowValuemask.ColorMap;
+ Attributes.colormap = CustomColormap;
+ }
+ ClientWindow = XCreateWindow(DisplayHandle, WholeWindow, ClientRect.X, ClientRect.Y, ClientRect.Width, ClientRect.Height, 0, (int)CreateWindowArgs.CopyFromParent, (int)CreateWindowArgs.InputOutput, CustomVisual, ValueMask, ref Attributes);
+ }
+ }
+
+ if ((WholeWindow == IntPtr.Zero) || (ClientWindow == IntPtr.Zero)) {
+ throw new Exception("Could not create X11 windows");
+ }
+
+ hwnd.WholeWindow = WholeWindow;
+ hwnd.ClientWindow = ClientWindow;
+
+ #if DriverDebug
+ Console.WriteLine("Created window {0:X} / {1:X} parent {2:X}", ClientWindow.ToInt32(), WholeWindow.ToInt32(), hwnd.parent != null ? hwnd.parent.Handle.ToInt32() : 0);
+ #endif
+
+ lock (XlibLock) {
+ XSelectInput(DisplayHandle, hwnd.whole_window, SelectInputMask);
+ XSelectInput(DisplayHandle, hwnd.client_window, SelectInputMask);
+
+ if ((cp.Style & (int)WindowStyles.WS_VISIBLE) != 0) {
+ XMapWindow(DisplayHandle, hwnd.whole_window);
+ XMapWindow(DisplayHandle, hwnd.client_window);
+ hwnd.visible = true;
+ }
+ }
+
+ SetWMStyles(hwnd, cp);
+
+ // for now make all windows dnd enabled
+ Dnd.SetAllowDrop (hwnd, true);
+
+ // Set caption/window title
+ Text(hwnd.Handle, cp.Caption);
+
+ return hwnd.Handle;
+ }
+
+ internal override IntPtr CreateWindow(IntPtr Parent, int X, int Y, int Width, int Height) {
+ CreateParams create_params = new CreateParams();
+
+ create_params.Caption = "";
+ create_params.X = X;
+ create_params.Y = Y;
+ create_params.Width = Width;
+ create_params.Height = Height;
+
+ create_params.ClassName=XplatUI.DefaultClassName;
+ create_params.ClassStyle = 0;
+ create_params.ExStyle=0;
+ create_params.Parent=IntPtr.Zero;
+ create_params.Param=0;
+
+ return CreateWindow(create_params);
+ }
+
+ internal override IntPtr DefineCursor(Bitmap bitmap, Bitmap mask, Color cursor_pixel, Color mask_pixel, int xHotSpot, int yHotSpot) {
+ IntPtr cursor;
+ Bitmap cursor_bitmap;
+ Bitmap cursor_mask;
+ Byte[] cursor_bits;
+ Byte[] mask_bits;
+ Color c_pixel;
+ Color m_pixel;
+ int width;
+ int height;
+ IntPtr cursor_pixmap;
+ IntPtr mask_pixmap;
+ XColor fg;
+ XColor bg;
+ bool and;
+ bool xor;
+
+ if (XQueryBestCursor(DisplayHandle, RootWindow, bitmap.Width, bitmap.Height, out width, out height) == 0) {
+ return IntPtr.Zero;
+ }
+
+ // Win32 only allows creation cursors of a certain size
+ if ((bitmap.Width != width) || (bitmap.Width != height)) {
+ cursor_bitmap = new Bitmap(bitmap, new Size(width, height));
+ cursor_mask = new Bitmap(mask, new Size(width, height));
+ } else {
+ cursor_bitmap = bitmap;
+ cursor_mask = mask;
+ }
+
+ width = cursor_bitmap.Width;
+ height = cursor_bitmap.Height;
+
+ cursor_bits = new Byte[(width / 8) * height];
+ mask_bits = new Byte[(width / 8) * height];
+
+ for (int y = 0; y < height; y++) {
+ for (int x = 0; x < width; x++) {
+ c_pixel = cursor_bitmap.GetPixel(x, y);
+ m_pixel = cursor_mask.GetPixel(x, y);
+
+ and = c_pixel == cursor_pixel;
+ xor = m_pixel == mask_pixel;
+
+ if (!and && !xor) {
+ // Black
+ // cursor_bits[y * width / 8 + x / 8] &= (byte)~((1 << (x % 8))); // The bit already is 0
+ mask_bits[y * width / 8 + x / 8] |= (byte)(1 << (x % 8));
+ } else if (and && !xor) {
+ // White
+ cursor_bits[y * width / 8 + x / 8] |= (byte)(1 << (x % 8));
+ mask_bits[y * width / 8 + x / 8] |= (byte)(1 << (x % 8));
+#if notneeded
+ } else if (and && !xor) {
+ // Screen
+ } else if (and && xor) {
+ // Inverse Screen
+
+ // X11 doesn't know the 'reverse screen' concept, so we'll treat them the same
+ // we want both to be 0 so nothing to be done
+ //cursor_bits[y * width / 8 + x / 8] &= (byte)~((1 << (x % 8)));
+ //mask_bits[y * width / 8 + x / 8] |= (byte)(01 << (x % 8));
+#endif
+ }
+ }
+ }
+
+ cursor_pixmap = XCreatePixmapFromBitmapData(DisplayHandle, RootWindow, cursor_bits, width, height, (IntPtr)1, (IntPtr)0, 1);
+ mask_pixmap = XCreatePixmapFromBitmapData(DisplayHandle, RootWindow, mask_bits, width, height, (IntPtr)1, (IntPtr)0, 1);
+ fg = new XColor();
+ bg = new XColor();
+
+ fg.pixel = XWhitePixel(DisplayHandle, ScreenNo);
+ fg.red = (ushort)65535;
+ fg.green = (ushort)65535;
+ fg.blue = (ushort)65535;
+
+ bg.pixel = XBlackPixel(DisplayHandle, ScreenNo);
+
+ cursor = XCreatePixmapCursor(DisplayHandle, cursor_pixmap, mask_pixmap, ref fg, ref bg, xHotSpot, yHotSpot);
+
+ XFreePixmap(DisplayHandle, cursor_pixmap);
+ XFreePixmap(DisplayHandle, mask_pixmap);
+
+ return cursor;
+ }
+
+ internal override IntPtr DefineStdCursor(StdCursor id) {
+ CursorFontShape shape;
+ IntPtr cursor;
+
+ // FIXME - define missing shapes
+
+ switch (id) {
+ case StdCursor.AppStarting: {
+ shape = CursorFontShape.XC_watch;
+ break;
+ }
+
+ case StdCursor.Arrow: {
+ return IntPtr.Zero;
+ }
+
+ case StdCursor.Cross: {
+ shape = CursorFontShape.XC_crosshair;
+ break;
+ }
+
+ case StdCursor.Default: {
+ return IntPtr.Zero;
+ }
+
+ case StdCursor.Hand: {
+ shape = CursorFontShape.XC_hand1;
+ break;
+ }
+
+ case StdCursor.Help: {
+ shape = CursorFontShape.XC_question_arrow;
+ break;
+ }
+
+ case StdCursor.HSplit: {
+ shape = CursorFontShape.XC_sb_v_double_arrow;
+ break;
+ }
+
+ case StdCursor.IBeam: {
+ shape = CursorFontShape.XC_xterm;
+ break;
+ }
+
+ case StdCursor.No: {
+ shape = CursorFontShape.XC_circle;
+ break;
+ }
+
+ case StdCursor.NoMove2D: {
+ shape = CursorFontShape.XC_fleur;
+ break;
+ }
+
+ case StdCursor.NoMoveHoriz: {
+ shape = CursorFontShape.XC_fleur;
+ break;
+ }
+
+ case StdCursor.NoMoveVert: {
+ shape = CursorFontShape.XC_fleur;
+ break;
+ }
+
+ case StdCursor.PanEast: {
+ shape = CursorFontShape.XC_fleur;
+ break;
+ }
+
+ case StdCursor.PanNE: {
+ shape = CursorFontShape.XC_fleur;
+ break;
+ }
+
+ case StdCursor.PanNorth: {
+ shape = CursorFontShape.XC_fleur;
+ break;
+ }
+
+ case StdCursor.PanNW: {
+ shape = CursorFontShape.XC_fleur;
+ break;
+ }
+
+ case StdCursor.PanSE: {
+ shape = CursorFontShape.XC_fleur;
+ break;
+ }
+
+ case StdCursor.PanSouth: {
+ shape = CursorFontShape.XC_fleur;
+ break;
+ }
+
+ case StdCursor.PanSW: {
+ shape = CursorFontShape.XC_fleur;
+ break;
+ }
+
+ case StdCursor.PanWest: {
+ shape = CursorFontShape.XC_sizing;
+ break;
+ }
+
+ case StdCursor.SizeAll: {
+ shape = CursorFontShape.XC_fleur;
+ break;
+ }
+
+ case StdCursor.SizeNESW: {
+ shape = CursorFontShape.XC_top_right_corner;
+ break;
+ }
+
+ case StdCursor.SizeNS: {
+ shape = CursorFontShape.XC_sb_v_double_arrow;
+ break;
+ }
+
+ case StdCursor.SizeNWSE: {
+ shape = CursorFontShape.XC_top_left_corner;
+ break;
+ }
+
+ case StdCursor.SizeWE: {
+ shape = CursorFontShape.XC_sb_h_double_arrow;
+ break;
+ }
+
+ case StdCursor.UpArrow: {
+ shape = CursorFontShape.XC_center_ptr;
+ break;
+ }
+
+ case StdCursor.VSplit: {
+ shape = CursorFontShape.XC_sb_h_double_arrow;
+ break;
+ }
+
+ case StdCursor.WaitCursor: {
+ shape = CursorFontShape.XC_watch;
+ break;
+ }
+
+ default: {
+ return IntPtr.Zero;
+ }
+ }
+
+ lock (XlibLock) {
+ cursor = XCreateFontCursor(DisplayHandle, shape);
+ }
+ return cursor;
+ }
+
+ internal override IntPtr DefWndProc(ref Message msg) {
+ return IntPtr.Zero;
+ }
+
+ internal override void DestroyCaret(IntPtr handle) {
+ if (Caret.Hwnd == handle) {
+ if (Caret.Visible == 1) {
+ Caret.Timer.Stop();
+ HideCaret();
+ }
+ if (Caret.gc != IntPtr.Zero) {
+ XFreeGC(DisplayHandle, Caret.gc);
+ Caret.gc = IntPtr.Zero;
+ }
+ Caret.Hwnd = IntPtr.Zero;
+ Caret.Visible = 0;
+ Caret.On = false;
+ }
+ }
+
+ internal override void DestroyCursor(IntPtr cursor) {
+ lock (XlibLock) {
+ XFreeCursor(DisplayHandle, cursor);
+ }
+ }
+
+ internal override void DestroyWindow(IntPtr handle) {
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+ if (hwnd == null) {
+ #if DriverDebug
+ Console.WriteLine("window {0:X} already destroyed", handle.ToInt32());
+ #endif
+ return;
+ }
+
+ #if DriverDebug
+ Console.WriteLine("Destroying window {0:X}", handle.ToInt32());
+ #endif
+
+ // Make sure if the caret is in the window, that we destroy the caret, too
+ if (Caret.Hwnd == hwnd.client_window) {
+ DestroyCaret(handle);
+ }
+
+ // The window is a goner, don't send it stuff like WM_PAINT anymore
+ hwnd.destroy_pending = true;
+
+ // Mark our children as gone as well
+ DestroyChildWindow(Control.ControlNativeWindow.ControlFromHandle(handle));
+
+ lock (XlibLock) {
+ if (hwnd.client_window != IntPtr.Zero) {
+ XDestroyWindow(DisplayHandle, hwnd.client_window);
+ }
+
+ if ((hwnd.whole_window != IntPtr.Zero) && (hwnd.whole_window != hwnd.client_window)) {
+ XDestroyWindow(DisplayHandle, hwnd.whole_window);
+ }
+ }
+ }
+
+ internal override IntPtr DispatchMessage(ref MSG msg) {
+ return NativeWindow.WndProc(msg.hwnd, msg.message, msg.wParam, msg.lParam);
+ }
+
+ internal override void DrawReversibleRectangle(IntPtr handle, Rectangle rect, int line_width) {
+ Hwnd hwnd;
+ XGCValues gc_values;
+ IntPtr gc;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+ gc_values = new XGCValues();
+
+ gc_values.subwindow_mode = GCSubwindowMode.IncludeInferiors;
+ gc_values.line_width = line_width;
+ gc_values.foreground = XBlackPixel(DisplayHandle, ScreenNo);
+
+ // This logic will give us true rubber bands: (libsx, SANE_XOR)
+ //mask = foreground ^ background;
+ //XSetForeground(DisplayHandle, gc, 0xffffffff);
+ //XSetBackground(DisplayHandle, gc, background);
+ //XSetFunction(DisplayHandle, gc, GXxor);
+ //XSetPlaneMask(DisplayHandle, gc, mask);
+
+
+ gc = XCreateGC(DisplayHandle, hwnd.client_window, GCFunction.GCSubwindowMode | GCFunction.GCLineWidth | GCFunction.GCForeground, ref gc_values);
+ uint foreground;
+ uint background;
+
+ Control control;
+ control = Control.FromHandle(handle);
+
+ XColor xcolor = new XColor();
+
+ xcolor.red = (ushort)(control.ForeColor.R * 257);
+ xcolor.green = (ushort)(control.ForeColor.G * 257);
+ xcolor.blue = (ushort)(control.ForeColor.B * 257);
+ XAllocColor(DisplayHandle, DefaultColormap, ref xcolor);
+ foreground = (uint)xcolor.pixel.ToInt32();
+
+ xcolor.red = (ushort)(control.BackColor.R * 257);
+ xcolor.green = (ushort)(control.BackColor.G * 257);
+ xcolor.blue = (ushort)(control.BackColor.B * 257);
+ XAllocColor(DisplayHandle, DefaultColormap, ref xcolor);
+ background = (uint)xcolor.pixel.ToInt32();
+
+ uint mask = foreground ^ background;
+
+ XSetForeground(DisplayHandle, gc, 0xffffffff);
+ XSetBackground(DisplayHandle, gc, background);
+ XSetFunction(DisplayHandle, gc, GXFunction.GXxor);
+ XSetPlaneMask(DisplayHandle, gc, mask);
+
+ if ((rect.Width > 0) && (rect.Height > 0)) {
+ XDrawRectangle(DisplayHandle, hwnd.client_window, gc, rect.Left, rect.Top, rect.Width, rect.Height);
+ } else {
+ if (rect.Width > 0) {
+ XDrawLine(DisplayHandle, hwnd.client_window, gc, rect.X, rect.Y, rect.Right, rect.Y);
+ } else {
+ XDrawLine(DisplayHandle, hwnd.client_window, gc, rect.X, rect.Y, rect.X, rect.Bottom);
+ }
+ }
+ XFreeGC(DisplayHandle, gc);
+ }
+
+ internal override void DoEvents() {
+ MSG msg = new MSG ();
+
+ if (OverrideCursorHandle != IntPtr.Zero) {
+ OverrideCursorHandle = IntPtr.Zero;
+ }
+
+ while (PeekMessage(ref msg, IntPtr.Zero, 0, 0, (uint)PeekMessageFlags.PM_REMOVE)) {
+ TranslateMessage (ref msg);
+ DispatchMessage (ref msg);
+ }
+ }
+
+ internal override void EnableWindow(IntPtr handle, bool Enable) {
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+ if (hwnd != null) {
+ hwnd.Enabled = Enable;
+ }
+ }
+
+ internal override void EndLoop(Thread thread) {
+ // This is where we one day will shut down the loop for the thread
+ }
+
+
+ internal override IntPtr GetActive() {
+ Atom actual_atom;
+ int actual_format;
+ int nitems;
+ int bytes_after;
+ IntPtr prop = IntPtr.Zero;
+ IntPtr active = IntPtr.Zero;
+
+ XGetWindowProperty(DisplayHandle, RootWindow, NetAtoms[(int)NA._NET_ACTIVE_WINDOW], 0, 1, false, Atom.XA_WINDOW, out actual_atom, out actual_format, out nitems, out bytes_after, ref prop);
+ if ((nitems > 0) && (prop != IntPtr.Zero)) {
+ active = (IntPtr)Marshal.ReadInt32(prop);
+ XFree(prop);
+ }
+
+ if (active != IntPtr.Zero) {
+ Hwnd hwnd;
+
+ hwnd = Hwnd.GetObjectFromWindow(active);
+ if (hwnd != null) {
+ active = hwnd.Handle;
+ } else {
+ active = IntPtr.Zero;
+ }
+ }
+ return active;
+ }
+
+ internal override void GetCursorInfo(IntPtr cursor, out int width, out int height, out int hotspot_x, out int hotspot_y) {
+ throw new NotImplementedException ();
+ }
+
+ internal override void GetDisplaySize(out Size size) {
+ XWindowAttributes attributes=new XWindowAttributes();
+
+ lock (XlibLock) {
+ // FIXME - use _NET_WM messages instead?
+ XGetWindowAttributes(DisplayHandle, XRootWindow(DisplayHandle, 0), ref attributes);
+ }
+
+ size = new Size(attributes.width, attributes.height);
+ }
+
+ internal override SizeF GetAutoScaleSize(Font font) {
+ Graphics g;
+ float width;
+ string magic_string = "The quick brown fox jumped over the lazy dog.";
+ double magic_number = 44.549996948242189;
+
+ g = Graphics.FromHwnd(FosterParent);
+
+ width = (float) (g.MeasureString (magic_string, font).Width / magic_number);
+ return new SizeF(width, font.Height);
+ }
+
+ internal override IntPtr GetParent(IntPtr handle) {
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+ if (hwnd != null && hwnd.parent != null) {
+ return hwnd.parent.Handle;
+ }
+ return IntPtr.Zero;
+ }
+
+ internal override void GetCursorPos(IntPtr handle, out int x, out int y) {
+ IntPtr use_handle;
+ IntPtr root;
+ IntPtr child;
+ int root_x;
+ int root_y;
+ int win_x;
+ int win_y;
+ int keys_buttons;
+
+ if (handle != IntPtr.Zero) {
+ use_handle = Hwnd.ObjectFromHandle(handle).client_window;
+ } else {
+ use_handle = RootWindow;
+ }
+
+ lock (XlibLock) {
+ XQueryPointer(DisplayHandle, use_handle, out root, out child, out root_x, out root_y, out win_x, out win_y, out keys_buttons);
+ }
+
+ if (handle != IntPtr.Zero) {
+ x = win_x;
+ y = win_y;
+ } else {
+ x = root_x;
+ y = root_y;
+ }
+ }
+
+ internal override bool GetFontMetrics(Graphics g, Font font, out int ascent, out int descent) {
+ return GetFontMetrics(g.GetHdc(), font.ToHfont(), out ascent, out descent);
+ }
+
+ internal override Graphics GetMenuDC(IntPtr handle, IntPtr ncpaint_region) {
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+ return Graphics.FromHwnd(hwnd.whole_window);
+ }
+
+ internal override Point GetMenuOrigin(IntPtr handle) {
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+ if (hwnd != null) {
+ return hwnd.MenuOrigin;
+ }
+ return Point.Empty;
+ }
+
+ internal override bool GetMessage(ref MSG msg, IntPtr handle, int wFilterMin, int wFilterMax) {
+ XEvent xevent;
+ bool client;
+ Hwnd hwnd;
+
+ ProcessNextMessage:
+
+ if (MessageQueue.Count > 0) {
+ xevent = (XEvent) MessageQueue.Dequeue ();
+ } else {
+ UpdateMessageQueue ();
+
+ if (MessageQueue.Count > 0) {
+ xevent = (XEvent) MessageQueue.Dequeue ();
+ } else {
+ if (!PostQuitState) {
+ msg.hwnd= IntPtr.Zero;
+ msg.message = Msg.WM_ENTERIDLE;
+ return true;
+ }
+
+ // We reset ourselves so GetMessage can be called again
+ PostQuitState = false;
+
+ return false;
+ }
+ }
+
+ // FIXME - handle filtering
+
+ hwnd = Hwnd.GetObjectFromWindow(xevent.AnyEvent.window);
+
+ // Handle messages for windows that are already or are about to be destroyed
+ if (hwnd == null || hwnd.destroy_pending) {
+ // We need to let the DestroyNotify go through so that the owning control can learn about it, too
+ if (hwnd == null || xevent.type != XEventName.DestroyNotify) {
+ #if DriverDebug
+ Console.WriteLine("GetMessage(): Got message {0} for non-existent or already destroyed window {1:X}", xevent.type, xevent.AnyEvent.window.ToInt32());
+ #endif
+ goto ProcessNextMessage;
+ }
+ }
+
+ if (hwnd.client_window == xevent.AnyEvent.window) {
+ client = true;
+ //Console.WriteLine("Client message, sending to window {0:X}", msg.hwnd.ToInt32());
+ } else {
+ client = false;
+ //Console.WriteLine("Non-Client message, sending to window {0:X}", msg.hwnd.ToInt32());
+ }
+
+ msg.hwnd = hwnd.Handle;
+
+ //
+ // If you add a new event to this switch make sure to add it in
+ // UpdateMessage also unless it is not coming through the X event system.
+ //
+ switch(xevent.type) {
+ case XEventName.KeyPress: {
+ Keyboard.KeyEvent (FocusWindow, xevent, ref msg);
+ break;
+ }
+
+ case XEventName.KeyRelease: {
+ Keyboard.KeyEvent (FocusWindow, xevent, ref msg);
+ break;
+ }
+
+ case XEventName.ButtonPress: {
+ switch(xevent.ButtonEvent.button) {
+ case 1: {
+ MouseState |= MouseButtons.Left;
+ if (client) {
+ msg.message = Msg.WM_LBUTTONDOWN;
+ } else {
+ msg.message = Msg.WM_NCLBUTTONDOWN;
+ WholeToScreen (msg.hwnd, ref xevent.ButtonEvent.x, ref xevent.ButtonEvent.y);
+ }
+ // TODO: For WM_NCLBUTTONDOWN wParam specifies a hit-test value not the virtual keys down
+ msg.wParam=GetMousewParam(0);
+ break;
+ }
+
+ case 2: {
+ MouseState |= MouseButtons.Middle;
+ if (client) {
+ msg.message = Msg.WM_MBUTTONDOWN;
+ } else {
+ msg.message = Msg.WM_NCMBUTTONDOWN;
+ WholeToScreen (msg.hwnd, ref xevent.ButtonEvent.x, ref xevent.ButtonEvent.y);
+ }
+ msg.wParam=GetMousewParam(0);
+ break;
+ }
+
+ case 3: {
+ MouseState |= MouseButtons.Right;
+ if (client) {
+ msg.message = Msg.WM_RBUTTONDOWN;
+ } else {
+ msg.message = Msg.WM_NCRBUTTONDOWN;
+ WholeToScreen (msg.hwnd, ref xevent.ButtonEvent.x, ref xevent.ButtonEvent.y);
+ }
+ msg.wParam=GetMousewParam(0);
+ break;
+ }
+
+ case 4: {
+ msg.message=Msg.WM_MOUSEWHEEL;
+ msg.wParam=GetMousewParam(120);
+ break;
+ }
+
+ case 5: {
+ msg.message=Msg.WM_MOUSEWHEEL;
+ msg.wParam=GetMousewParam(-120);
+ break;
+ }
+
+ }
+
+ msg.lParam=(IntPtr) (xevent.ButtonEvent.y << 16 | xevent.ButtonEvent.x);
+ MousePosition.X = xevent.ButtonEvent.x;
+ MousePosition.Y = xevent.ButtonEvent.y;
+
+ if (!hwnd.Enabled) {
+ IntPtr dummy;
+
+ msg.hwnd = hwnd.EnabledHwnd;
+ XTranslateCoordinates(DisplayHandle, xevent.AnyEvent.window, Hwnd.ObjectFromHandle(msg.hwnd).ClientWindow, xevent.ButtonEvent.x, xevent.ButtonEvent.y, out xevent.ButtonEvent.x, out xevent.ButtonEvent.y, out dummy);
+ msg.lParam = (IntPtr)(MousePosition.Y << 16 | MousePosition.X);
+ }
+
+ if (Grab.Hwnd != IntPtr.Zero) {
+ msg.hwnd = Grab.Hwnd;
+ }
+
+ if (!ClickPending.Pending) {
+ ClickPending.Pending = true;
+ ClickPending.Hwnd = msg.hwnd;
+ ClickPending.Message = msg.message;
+ ClickPending.wParam = msg.wParam;
+ ClickPending.lParam = msg.lParam;
+ ClickPending.Time = (long)xevent.ButtonEvent.time;
+ } else {
+ if ((((long)xevent.ButtonEvent.time - ClickPending.Time) < DoubleClickInterval) && (msg.wParam == ClickPending.wParam) && (msg.lParam == ClickPending.lParam) && (msg.message == ClickPending.Message)) {
+ // Looks like a genuine double click, clicked twice on the same spot with the same keys
+ switch(xevent.ButtonEvent.button) {
+ case 1: {
+ msg.message = client ? Msg.WM_LBUTTONDBLCLK : Msg.WM_NCLBUTTONDBLCLK;
+ break;
+ }
+
+ case 2: {
+ msg.message = client ? Msg.WM_MBUTTONDBLCLK : Msg.WM_NCMBUTTONDBLCLK;
+ break;
+ }
+
+ case 3: {
+ msg.message = client ? Msg.WM_RBUTTONDBLCLK : Msg.WM_NCRBUTTONDBLCLK;
+ break;
+ }
+ }
+ }
+ ClickPending.Pending = false;
+ }
+
+ break;
+ }
+
+ case XEventName.ButtonRelease: {
+ Dnd.HandleButtonRelease (ref xevent);
+ switch(xevent.ButtonEvent.button) {
+ case 1: {
+ MouseState &= ~MouseButtons.Left;
+ if (client) {
+ msg.message = Msg.WM_LBUTTONUP;
+ } else {
+ msg.message = Msg.WM_NCLBUTTONUP;
+ WholeToScreen (msg.hwnd, ref xevent.ButtonEvent.x, ref xevent.ButtonEvent.y);
+ }
+ msg.wParam=GetMousewParam(0);
+ break;
+ }
+
+ case 2: {
+ MouseState &= ~MouseButtons.Middle;
+ if (client) {
+ msg.message = Msg.WM_MBUTTONUP;
+ } else {
+ msg.message = Msg.WM_NCMBUTTONUP;
+ WholeToScreen (msg.hwnd, ref xevent.ButtonEvent.x, ref xevent.ButtonEvent.y);
+ }
+ msg.wParam=GetMousewParam(0);
+ break;
+ }
+
+ case 3: {
+ MouseState &= ~MouseButtons.Right;
+ if (client) {
+ msg.message = Msg.WM_RBUTTONUP;
+ } else {
+ msg.message = Msg.WM_NCRBUTTONUP;
+ WholeToScreen (msg.hwnd, ref xevent.ButtonEvent.x, ref xevent.ButtonEvent.y);
+ }
+ msg.wParam=GetMousewParam(0);
+ break;
+ }
+
+ case 4: {
+ goto ProcessNextMessage;
+ }
+
+ case 5: {
+ goto ProcessNextMessage;
+ }
+ }
+
+ if (!hwnd.Enabled) {
+ IntPtr dummy;
+
+ msg.hwnd = hwnd.EnabledHwnd;
+ XTranslateCoordinates(DisplayHandle, xevent.AnyEvent.window, Hwnd.ObjectFromHandle(msg.hwnd).ClientWindow, xevent.ButtonEvent.x, xevent.ButtonEvent.y, out xevent.ButtonEvent.x, out xevent.ButtonEvent.y, out dummy);
+ msg.lParam = (IntPtr)(MousePosition.Y << 16 | MousePosition.X);
+ }
+
+ if (Grab.Hwnd != IntPtr.Zero) {
+ msg.hwnd = Grab.Hwnd;
+ }
+
+ msg.lParam=(IntPtr) (xevent.ButtonEvent.y << 16 | xevent.ButtonEvent.x);
+ MousePosition.X = xevent.ButtonEvent.x;
+ MousePosition.Y = xevent.ButtonEvent.y;
+ break;
+ }
+
+ case XEventName.MotionNotify: {
+ if (client) {
+ #if DriverDebugExtra
+ Console.WriteLine("GetMessage(): Window {0:X} MotionNotify x={1} y={2}", client ? hwnd.client_window.ToInt32() : hwnd.whole_window.ToInt32(), xevent.MotionEvent.x, xevent.MotionEvent.y);
+ #endif
+
+ if (Dnd.HandleMotionNotify (ref xevent))
+ goto ProcessNextMessage;
+ if (Grab.Hwnd != IntPtr.Zero) {
+ msg.hwnd = Grab.Hwnd;
+ } else {
+ NativeWindow.WndProc(msg.hwnd, Msg.WM_SETCURSOR, msg.hwnd, (IntPtr)HitTest.HTCLIENT);
+ }
+
+ msg.message = Msg.WM_MOUSEMOVE;
+ msg.wParam = GetMousewParam(0);
+ msg.lParam = (IntPtr) (xevent.MotionEvent.y << 16 | xevent.MotionEvent.x & 0xFFFF);
+
+ if (!hwnd.Enabled) {
+ IntPtr dummy;
+
+ msg.hwnd = hwnd.EnabledHwnd;
+ XTranslateCoordinates(DisplayHandle, xevent.AnyEvent.window, Hwnd.ObjectFromHandle(msg.hwnd).ClientWindow, xevent.MotionEvent.x, xevent.MotionEvent.y, out xevent.MotionEvent.x, out xevent.MotionEvent.y, out dummy);
+ msg.lParam = (IntPtr)(MousePosition.Y << 16 | MousePosition.X);
+ }
+
+ HoverState.X = MousePosition.X = xevent.MotionEvent.x;
+ HoverState.Y = MousePosition.Y = xevent.MotionEvent.y;
+
+ break;
+ } else {
+ #if DriverDebugExtra
+ Console.WriteLine("GetMessage(): non-client area {0:X} MotionNotify x={1} y={2}", client ? hwnd.client_window.ToInt32() : hwnd.whole_window.ToInt32(), xevent.MotionEvent.x, xevent.MotionEvent.y);
+ #endif
+ msg.message = Msg.WM_NCMOUSEMOVE;
+ msg.lParam = (IntPtr) (xevent.MotionEvent.y << 16 | xevent.MotionEvent.x & 0xFFFF);
+
+ if (!hwnd.Enabled) {
+ IntPtr dummy;
+
+ msg.hwnd = hwnd.EnabledHwnd;
+ XTranslateCoordinates(DisplayHandle, xevent.AnyEvent.window, Hwnd.ObjectFromHandle(msg.hwnd).ClientWindow, xevent.MotionEvent.x, xevent.MotionEvent.y, out xevent.MotionEvent.x, out xevent.MotionEvent.y, out dummy);
+ msg.lParam = (IntPtr)(MousePosition.Y << 16 | MousePosition.X);
+ }
+
+ #if notyet
+ // Not sure we need this...
+ HitTest ht;
+ ht = NativeWindow.WndProc(hwnd.client_window, Msg.WM_NCHITTEST, IntPtr.Zero, msg.lParam);
+ #endif
+
+ MousePosition.X = xevent.MotionEvent.x;
+ MousePosition.Y = xevent.MotionEvent.y;
+ }
+
+ break;
+ }
+
+ case XEventName.EnterNotify: {
+ if (!hwnd.Enabled) {
+ goto ProcessNextMessage;
+ }
+ if (xevent.CrossingEvent.mode != NotifyMode.NotifyNormal) {
+ goto ProcessNextMessage;
+ }
+ msg.message = Msg.WM_MOUSE_ENTER;
+ HoverState.Timer.Enabled = true;
+ HoverState.Window = xevent.CrossingEvent.window;
+ break;
+ }
+
+ case XEventName.LeaveNotify: {
+ if (!hwnd.Enabled) {
+ goto ProcessNextMessage;
+ }
+ if (xevent.CrossingEvent.mode != NotifyMode.NotifyNormal) {
+ goto ProcessNextMessage;
+ }
+ msg.message=Msg.WM_MOUSE_LEAVE;
+ HoverState.Timer.Enabled = false;
+ HoverState.Window = IntPtr.Zero;
+ break;
+ }
+
+ #if later
+ case XEventName.CreateNotify: {
+ if (client && (xevent.ConfigureEvent.xevent == xevent.ConfigureEvent.window)) {
+ msg.message = WM_CREATE;
+ // Set up CreateStruct
+ } else {
+ goto ProcessNextMessage;
+ }
+ break;
+ }
+ #endif
+
+
+ case XEventName.ReparentNotify: {
+ if (hwnd.parent == null) { // Toplevel
+ if (xevent.ReparentEvent.parent != IntPtr.Zero) {
+ // We need to adjust x/y
+ int dummy_int;
+ IntPtr dummy_ptr;
+
+ hwnd.Reparented = true;
+
+ XGetGeometry(DisplayHandle, XGetParent(hwnd.whole_window), out dummy_ptr, out hwnd.x, out hwnd.y, out dummy_int, out dummy_int, out dummy_int, out dummy_int);
+ msg.message = Msg.WM_WINDOWPOSCHANGED;
+ if (hwnd.opacity != 0xffffffff) {
+ uint opacity;
+
+ opacity = hwnd.opacity;
+ XChangeProperty(DisplayHandle, XGetParent(hwnd.whole_window), NetAtoms[(int)NA._NET_WM_WINDOW_OPACITY], Atom.XA_CARDINAL, 32, PropertyMode.Replace, ref opacity, 1);
+ }
+ } else {
+ hwnd.Reparented = false;
+ goto ProcessNextMessage;
+ }
+ }
+ break;
+ }
+
+ case XEventName.ConfigureNotify: {
+ if (!client && (xevent.ConfigureEvent.xevent == xevent.ConfigureEvent.window)) { // Ignore events for children (SubstructureNotify) and client areas
+ XplatUIWin32.NCCALCSIZE_PARAMS ncp;
+ IntPtr ptr;
+ Rectangle rect;
+
+ #if DriverDebugExtra
+ Console.WriteLine("GetMessage(): Window {0:X} ConfigureNotify x={1} y={2} width={3} height={4}", hwnd.client_window.ToInt32(), xevent.ConfigureEvent.x, xevent.ConfigureEvent.y, xevent.ConfigureEvent.width, xevent.ConfigureEvent.height);
+ #endif
+ msg.message = Msg.WM_WINDOWPOSCHANGED;
+ hwnd.configure_pending = false;
+
+ // We need to adjust our client window to track the resize of whole_window
+ rect = hwnd.DefaultClientRect;
+
+ ncp = new XplatUIWin32.NCCALCSIZE_PARAMS();
+ ptr = Marshal.AllocHGlobal(Marshal.SizeOf(ncp));
+
+ ncp.rgrc1.left = rect.Left;
+ ncp.rgrc1.top = rect.Top;
+ ncp.rgrc1.right = rect.Right;
+ ncp.rgrc1.bottom = rect.Bottom;
+
+ Marshal.StructureToPtr(ncp, ptr, true);
+ NativeWindow.WndProc(hwnd.client_window, Msg.WM_NCCALCSIZE, (IntPtr)1, ptr);
+ ncp = (XplatUIWin32.NCCALCSIZE_PARAMS)Marshal.PtrToStructure(ptr, typeof(XplatUIWin32.NCCALCSIZE_PARAMS));
+ Marshal.FreeHGlobal(ptr);
+
+ // FIXME - debug this with Menus, need to set hwnd.ClientRect
+
+ rect = new Rectangle(ncp.rgrc1.left, ncp.rgrc1.top, ncp.rgrc1.right - ncp.rgrc1.left, ncp.rgrc1.bottom - ncp.rgrc1.top);
+
+ XMoveResizeWindow(DisplayHandle, hwnd.client_window, rect.X, rect.Y, rect.Width, rect.Height);
+ } else {
+ goto ProcessNextMessage;
+ }
+
+ msg.lParam=IntPtr.Zero; // FIXME - Generate LPWINDOWPOS structure and pass on
+ break;
+ }
+
+ case XEventName.FocusIn: {
+ if (!hwnd.Enabled) {
+ goto ProcessNextMessage;
+ }
+ msg.message=Msg.WM_SETFOCUS;
+ msg.wParam=IntPtr.Zero;
+ break;
+ }
+
+ case XEventName.FocusOut: {
+ if (!hwnd.Enabled) {
+ goto ProcessNextMessage;
+ }
+ msg.message=Msg.WM_KILLFOCUS;
+ msg.wParam=IntPtr.Zero;
+ break;
+ }
+
+ case XEventName.Expose: {
+ if (PostQuitState) {
+ goto ProcessNextMessage;
+ }
+
+
+ if (client) {
+ if (!hwnd.expose_pending) {
+ goto ProcessNextMessage;
+ }
+ } else {
+ if (!hwnd.nc_expose_pending) {
+ goto ProcessNextMessage;
+ }
+
+ switch (hwnd.border_style) {
+ case FormBorderStyle.Fixed3D: {
+ Graphics g;
+
+ g = Graphics.FromHwnd(hwnd.whole_window);
+ ControlPaint.DrawBorder3D(g, new Rectangle(0, 0, hwnd.Width, hwnd.Height));
+ g.Dispose();
+ break;
+ }
+
+ case FormBorderStyle.FixedSingle: {
+ Graphics g;
+
+ g = Graphics.FromHwnd(hwnd.whole_window);
+ ControlPaint.DrawBorder(g, new Rectangle(0, 0, hwnd.Width, hwnd.Height), Color.Black, ButtonBorderStyle.Solid);
+ g.Dispose();
+ break;
+ }
+ }
+ #if DriverDebugExtra
+ Console.WriteLine("GetMessage(): Window {0:X} Exposed non-client area {1},{2} {3}x{4}", hwnd.client_window.ToInt32(), xevent.ExposeEvent.x, xevent.ExposeEvent.y, xevent.ExposeEvent.width, xevent.ExposeEvent.height);
+ #endif
+
+ Rectangle rect = new Rectangle (xevent.ExposeEvent.x, xevent.ExposeEvent.y, xevent.ExposeEvent.width, xevent.ExposeEvent.height);
+ Region region = new Region (rect);
+ IntPtr hrgn = region.GetHrgn (null); // Graphics object isn't needed
+ msg.message = Msg.WM_NCPAINT;
+ msg.wParam = hrgn;
+ hwnd.nc_expose_pending = false;
+ break;
+ }
+ #if DriverDebugExtra
+ Console.WriteLine("GetMessage(): Window {0:X} Exposed area {1},{2} {3}x{4}", hwnd.client_window.ToInt32(), xevent.ExposeEvent.x, xevent.ExposeEvent.y, xevent.ExposeEvent.width, xevent.ExposeEvent.height);
+ #endif
+ if (Caret.Visible == 1) {
+ Caret.Paused = true;
+ HideCaret();
+ }
+
+ if (Caret.Visible == 1) {
+ ShowCaret();
+ Caret.Paused = false;
+ }
+ msg.message = Msg.WM_PAINT;
+ break;
+ }
+
+ case XEventName.DestroyNotify: {
+
+ // This is a bit tricky, we don't receive our own DestroyNotify, we only get those for our children
+ hwnd = Hwnd.ObjectFromHandle(xevent.DestroyWindowEvent.window);
+
+ // We may get multiple for the same window, act only one the first (when Hwnd still knows about it)
+ if ((hwnd != null) && (hwnd.client_window == xevent.DestroyWindowEvent.window)) {
+ msg.hwnd = hwnd.client_window;
+ msg.message=Msg.WM_DESTROY;
+ hwnd.Dispose();
+
+ #if DriverDebug
+ Console.WriteLine("Got DestroyNotify on Window {0:X}", msg.hwnd.ToInt32());
+ #endif
+ } else {
+ goto ProcessNextMessage;
+ }
+
+ break;
+ }
+
+ case XEventName.ClientMessage: {
+ if (Dnd.HandleClientMessage (ref xevent)) {
+ goto ProcessNextMessage;
+ }
+
+ if (xevent.ClientMessageEvent.message_type == (IntPtr)AsyncAtom) {
+ XplatUIDriverSupport.ExecuteClientMessage((GCHandle)xevent.ClientMessageEvent.ptr1);
+ break;
+ }
+
+ if (xevent.ClientMessageEvent.message_type == (IntPtr)HoverState.Atom) {
+ msg.message = Msg.WM_MOUSEHOVER;
+ msg.wParam = GetMousewParam(0);
+ msg.lParam = (IntPtr) (xevent.ClientMessageEvent.ptr1);
+ break;
+ }
+
+ if (xevent.ClientMessageEvent.message_type == (IntPtr)PostAtom) {
+ msg.hwnd = xevent.ClientMessageEvent.ptr1;
+ msg.message = (Msg) xevent.ClientMessageEvent.ptr2.ToInt32 ();
+ msg.wParam = xevent.ClientMessageEvent.ptr3;
+ msg.lParam = xevent.ClientMessageEvent.ptr4;
+ break;
+ }
+
+ #if dontcare
+ if (xevent.ClientMessageEvent.message_type == (IntPtr)NetAtoms[(int)NA._XEMBED]) {
+ Console.WriteLine("GOT EMBED MESSAGE {0:X}", xevent.ClientMessageEvent.ptr2.ToInt32());
+ break;
+ }
+ #endif
+
+ if (xevent.ClientMessageEvent.message_type == (IntPtr)NetAtoms[(int)NA.WM_PROTOCOLS]) {
+ if (xevent.ClientMessageEvent.ptr1 == (IntPtr)NetAtoms[(int)NA.WM_DELETE_WINDOW]) {
+ msg.message = Msg.WM_CLOSE;
+ Graphics.FromHdcInternal (IntPtr.Zero);
+ break;
+ }
+
+ // We should not get this, but I'll leave the code in case we need it in the future
+ if (xevent.ClientMessageEvent.ptr1 == (IntPtr)NetAtoms[(int)NA.WM_TAKE_FOCUS]) {
+ goto ProcessNextMessage;
+ }
+ }
+ break;
+ }
+
+ case XEventName.TimerNotify: {
+ xevent.TimerNotifyEvent.handler (this, EventArgs.Empty);
+ break;
+ }
+
+ default: {
+ goto ProcessNextMessage;
+ }
+ }
+
+ return true;
+ }
+
+ internal override bool GetText(IntPtr handle, out string text) {
+ IntPtr textptr;
+
+ textptr = IntPtr.Zero;
+
+ lock (XlibLock) {
+ // FIXME - use _NET properties
+ XFetchName(DisplayHandle, Hwnd.ObjectFromHandle(handle).whole_window, ref textptr);
+ }
+ if (textptr != IntPtr.Zero) {
+ text = Marshal.PtrToStringAnsi(textptr);
+ XFree(textptr);
+ return true;
+ } else {
+ text = "";
+ return false;
+ }
+ }
+
+ internal override void GetWindowPos(IntPtr handle, bool is_toplevel, out int x, out int y, out int width, out int height, out int client_width, out int client_height) {
+ Hwnd hwnd;
+ Rectangle rect;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+ if (hwnd != null) {
+ x = hwnd.x;
+ y = hwnd.y;
+ width = hwnd.width;
+ height = hwnd.height;
+
+ rect = Hwnd.GetClientRectangle(hwnd.border_style, hwnd.menu, hwnd.title_style, hwnd.caption_height, hwnd.tool_caption_height, width, height);
+
+ client_width = rect.Width;
+ client_height = rect.Height;
+
+ return;
+ }
+
+ // Should we throw an exception or fail silently?
+ // throw new ArgumentException("Called with an invalid window handle", "handle");
+
+ x = 0;
+ y = 0;
+ width = 0;
+ height = 0;
+ client_width = 0;
+ client_height = 0;
+ }
+
+ internal override FormWindowState GetWindowState(IntPtr handle) {
+ Atom actual_atom;
+ int actual_format;
+ int nitems;
+ int bytes_after;
+ IntPtr prop = IntPtr.Zero;
+ IntPtr atom;
+ int maximized;
+ XWindowAttributes attributes;
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+ maximized = 0;
+ XGetWindowProperty(DisplayHandle, hwnd.whole_window, NetAtoms[(int)NA._NET_WM_STATE], 0, 256, false, Atom.XA_ATOM, out actual_atom, out actual_format, out nitems, out bytes_after, ref prop);
+ if ((nitems > 0) && (prop != IntPtr.Zero)) {
+ for (int i = 0; i < nitems; i++) {
+ atom = (IntPtr)Marshal.ReadInt32(prop, i * 4);
+ if ((atom == (IntPtr)NetAtoms[(int)NA._NET_WM_STATE_MAXIMIZED_HORZ]) || (atom == (IntPtr)NetAtoms[(int)NA._NET_WM_STATE_MAXIMIZED_VERT])) {
+ maximized++;
+ }
+ }
+ XFree(prop);
+ }
+
+ if (maximized == 2) {
+ return FormWindowState.Maximized;
+ }
+
+
+ attributes = new XWindowAttributes();
+ XGetWindowAttributes(DisplayHandle, handle, ref attributes);
+ if (attributes.map_state == MapState.IsUnmapped) {
+ return FormWindowState.Minimized;
+ }
+
+ return FormWindowState.Normal;
+ }
+
+ internal override void GrabInfo(out IntPtr handle, out bool GrabConfined, out Rectangle GrabArea) {
+ handle = Grab.Hwnd;
+ GrabConfined = Grab.Confined;
+ GrabArea = Grab.Area;
+ }
+
+ internal override void GrabWindow(IntPtr handle, IntPtr confine_to_handle) {
+ Hwnd hwnd;
+ IntPtr confine_to_window;
+
+ confine_to_window = IntPtr.Zero;
+
+ if (confine_to_handle != IntPtr.Zero) {
+ XWindowAttributes attributes = new XWindowAttributes();
+
+ hwnd = Hwnd.ObjectFromHandle(confine_to_handle);
+
+ lock (XlibLock) {
+ XGetWindowAttributes(DisplayHandle, hwnd.client_window, ref attributes);
+ }
+ Grab.Area.X = attributes.x;
+ Grab.Area.Y = attributes.y;
+ Grab.Area.Width = attributes.width;
+ Grab.Area.Height = attributes.height;
+ Grab.Confined = true;
+ confine_to_window = hwnd.client_window;
+ }
+
+ Grab.Hwnd = handle;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+ lock (XlibLock) {
+ XGrabPointer(DisplayHandle, hwnd.client_window, false,
+ EventMask.ButtonPressMask | EventMask.ButtonMotionMask |
+ EventMask.ButtonReleaseMask | EventMask.PointerMotionMask,
+ GrabMode.GrabModeAsync, GrabMode.GrabModeAsync, confine_to_window, 0, 0);
+ }
+ }
+
+ internal override void UngrabWindow(IntPtr hwnd) {
+ lock (XlibLock) {
+ XUngrabPointer(DisplayHandle, 0);
+ XFlush(DisplayHandle);
+ }
+ Grab.Hwnd = IntPtr.Zero;
+ Grab.Confined = false;
+ }
+
+ internal override void HandleException(Exception e) {
+ StackTrace st = new StackTrace(e, true);
+ Console.WriteLine("Exception '{0}'", e.Message+st.ToString());
+ Console.WriteLine("{0}{1}", e.Message, st.ToString());
+ }
+
+ internal override void Invalidate(IntPtr handle, Rectangle rc, bool clear) {
+ Hwnd hwnd;
+ XEvent xevent;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+
+ xevent = new XEvent ();
+ xevent.type = XEventName.Expose;
+ xevent.ExposeEvent.display = DisplayHandle;
+ xevent.ExposeEvent.window = hwnd.client_window;
+
+ if (clear) {
+ xevent.ExposeEvent.x = hwnd.X;
+ xevent.ExposeEvent.y = hwnd.Y;
+ xevent.ExposeEvent.width = hwnd.Width;
+ xevent.ExposeEvent.height = hwnd.Height;
+ } else {
+ xevent.ExposeEvent.x = rc.X;
+ xevent.ExposeEvent.y = rc.Y;
+ xevent.ExposeEvent.width = rc.Width;
+ xevent.ExposeEvent.height = rc.Height;
+ }
+
+ AddExpose (xevent);
+ }
+
+ internal override bool IsEnabled(IntPtr handle) {
+ return Hwnd.ObjectFromHandle(handle).Enabled;
+ }
+
+ internal override bool IsVisible(IntPtr handle) {
+ return Hwnd.ObjectFromHandle(handle).visible;
+ }
+
+ internal override void KillTimer(Timer timer) {
+ lock (TimerList) {
+ TimerList.Remove(timer);
+ }
+ }
+
+ internal override void MenuToScreen(IntPtr handle, ref int x, ref int y) {
+ int dest_x_return;
+ int dest_y_return;
+ IntPtr child;
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+ lock (XlibLock) {
+ XTranslateCoordinates(DisplayHandle, hwnd.whole_window, RootWindow, x, y, out dest_x_return, out dest_y_return, out child);
+ }
+
+ x = dest_x_return;
+ y = dest_y_return;
+ }
+
+ internal override void OverrideCursor(IntPtr cursor) {
+ OverrideCursorHandle = cursor;
+ }
+
+ internal override PaintEventArgs PaintEventStart(IntPtr handle, bool client) {
+ PaintEventArgs paint_event;
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+ if (Caret.Visible == 1) {
+ Caret.Paused = true;
+ HideCaret();
+ }
+
+ if (client) {
+ hwnd.client_dc = Graphics.FromHwnd (hwnd.client_window);
+ hwnd.client_dc.SetClip(hwnd.invalid);
+ paint_event = new PaintEventArgs(hwnd.client_dc, hwnd.invalid);
+ hwnd.expose_pending = false;
+
+ return paint_event;
+ } else {
+ hwnd.client_dc = Graphics.FromHwnd (hwnd.whole_window);
+ paint_event = new PaintEventArgs(hwnd.client_dc, new Rectangle(0, 0, hwnd.width, hwnd.height));
+ hwnd.nc_expose_pending = false;
+
+ return paint_event;
+ }
+ }
+
+ internal override void PaintEventEnd(IntPtr handle, bool client) {
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+ if (client) {
+ hwnd.ClearInvalidArea();
+ }
+
+ hwnd.client_dc.Flush();
+ hwnd.client_dc.Dispose();
+ hwnd.client_dc = null;
+
+ if (Caret.Visible == 1) {
+ ShowCaret();
+ Caret.Paused = false;
+ }
+ }
+
+ internal override bool PeekMessage(ref MSG msg, IntPtr hWnd, int wFilterMin, int wFilterMax, uint flags) {
+ bool pending;
+
+ // FIXME - imlement filtering
+
+ if ((flags & (uint)PeekMessageFlags.PM_REMOVE) == 0) {
+ throw new NotImplementedException("PeekMessage PM_NOREMOVE is not implemented yet"); // FIXME - Implement PM_NOREMOVE flag
+ }
+
+ pending = false;
+ if (MessageQueue.Count > 0) {
+ pending = true;
+ } else {
+ // Only call UpdateMessageQueue if real events are pending
+ // otherwise we go to sleep on the socket
+ if (XPending(DisplayHandle) != 0) {
+ UpdateMessageQueue();
+ pending = true;
+ }
+ }
+
+ CheckTimers(DateTime.Now);
+
+ if (!pending) {
+ return false;
+ }
+ return GetMessage(ref msg, hWnd, wFilterMin, wFilterMax);
+ }
+
+ // FIXME - I think this should just enqueue directly
+ internal override bool PostMessage (IntPtr handle, Msg message, IntPtr wparam, IntPtr lparam) {
+ XEvent xevent = new XEvent ();
+ Hwnd hwnd = Hwnd.ObjectFromHandle(handle);
+
+ xevent.type = XEventName.ClientMessage;
+ xevent.ClientMessageEvent.display = DisplayHandle;
+
+ if (hwnd != null) {
+ xevent.ClientMessageEvent.window = hwnd.whole_window;
+ } else {
+ xevent.ClientMessageEvent.window = IntPtr.Zero;
+ }
+
+ xevent.ClientMessageEvent.message_type = (IntPtr) PostAtom;
+ xevent.ClientMessageEvent.format = 32;
+ xevent.ClientMessageEvent.ptr1 = handle;
+ xevent.ClientMessageEvent.ptr2 = (IntPtr) message;
+ xevent.ClientMessageEvent.ptr3 = wparam;
+ xevent.ClientMessageEvent.ptr4 = lparam;
+
+ MessageQueue.Enqueue (xevent);
+
+ return true;
+ }
+
+ internal override void PostQuitMessage(int exitCode) {
+ XFlush(DisplayHandle);
+ PostQuitState = true;
+
+ // Remove our display handle from S.D
+ Graphics.FromHdcInternal (IntPtr.Zero);
+ }
+
+ internal override void ReleaseMenuDC(IntPtr handle, Graphics dc) {
+ dc.Dispose();
+ }
+
+ internal override void ScreenToClient(IntPtr handle, ref int x, ref int y) {
+ int dest_x_return;
+ int dest_y_return;
+ IntPtr child;
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+ lock (XlibLock) {
+ XTranslateCoordinates (DisplayHandle, RootWindow, hwnd.client_window, x, y, out dest_x_return, out dest_y_return, out child);
+ }
+
+ x = dest_x_return;
+ y = dest_y_return;
+ }
+
+ internal override void ScreenToMenu(IntPtr handle, ref int x, ref int y) {
+ int dest_x_return;
+ int dest_y_return;
+ IntPtr child;
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+ lock (XlibLock) {
+ XTranslateCoordinates (DisplayHandle, RootWindow, hwnd.whole_window, x, y, out dest_x_return, out dest_y_return, out child);
+ }
+
+ x = dest_x_return;
+ y = dest_y_return;
+ }
+
+ internal override void ScrollWindow(IntPtr handle, Rectangle area, int XAmount, int YAmount, bool with_children) {
+ Hwnd hwnd;
+ IntPtr gc;
+ XGCValues gc_values;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+ if (hwnd.invalid != Rectangle.Empty) {
+ // BIG FAT WARNING. This only works with how we use this function right now
+ // where we basically still scroll the whole window, but work around areas
+ // that are covered by our children
+
+ hwnd.invalid.X += XAmount;
+ hwnd.invalid.Y += YAmount;
+
+ if (hwnd.invalid.X < 0) {
+ hwnd.invalid.Width += hwnd.invalid.X;
+ hwnd.invalid.X =0;
+ }
+
+ if (hwnd.invalid.Y < 0) {
+ hwnd.invalid.Height += hwnd.invalid.Y;
+ hwnd.invalid.Y =0;
+ }
+ }
+
+ gc_values = new XGCValues();
+
+ if (with_children) {
+ gc_values.subwindow_mode = GCSubwindowMode.IncludeInferiors;
+ }
+
+ gc = XCreateGC(DisplayHandle, hwnd.client_window, 0, ref gc_values);
+
+ XCopyArea(DisplayHandle, hwnd.client_window, hwnd.client_window, gc, area.X - XAmount, area.Y - YAmount, area.Width, area.Height, area.X, area.Y);
+
+ // Generate an expose for the area exposed by the horizontal scroll
+ if (XAmount > 0) {
+ hwnd.AddInvalidArea (area.X, area.Y, XAmount, area.Height);
+ } else if (XAmount < 0) {
+ hwnd.AddInvalidArea (XAmount + area.X + area.Width, area.Y, -XAmount, area.Height);
+ }
+
+ // Generate an expose for the area exposed by the vertical scroll
+ if (YAmount > 0) {
+ hwnd.AddInvalidArea (area.X, area.Y, area.Width, YAmount);
+ } else if (YAmount < 0) {
+ hwnd.AddInvalidArea (area.X, YAmount + area.Y + area.Height, area.Width, -YAmount);
+ }
+ XFreeGC(DisplayHandle, gc);
+
+ UpdateWindow(handle);
+ }
+
+ internal override void ScrollWindow(IntPtr handle, int XAmount, int YAmount, bool with_children) {
+ Hwnd hwnd;
+
+ hwnd = Hwnd.GetObjectFromWindow(handle);
+
+ ScrollWindow(handle, hwnd.ClientRect, XAmount, YAmount, with_children);
+ }
+
+ internal override void SendAsyncMethod (AsyncMethodData method) {
+ XEvent xevent = new XEvent ();
+
+ xevent.type = XEventName.ClientMessage;
+ xevent.ClientMessageEvent.display = DisplayHandle;
+ xevent.ClientMessageEvent.window = FosterParent;
+ xevent.ClientMessageEvent.message_type = (IntPtr)AsyncAtom;
+ xevent.ClientMessageEvent.format = 32;
+ xevent.ClientMessageEvent.ptr1 = (IntPtr) GCHandle.Alloc (method);
+
+ MessageQueue.EnqueueLocked (xevent);
+
+ WakeupMain ();
+ }
+
+ internal override IntPtr SendMessage (IntPtr hwnd, Msg message, IntPtr wParam, IntPtr lParam) {
+ return NativeWindow.WndProc(hwnd, message, wParam, lParam);
+ }
+
+ internal override void SetAllowDrop (IntPtr handle, bool value)
+ {
+ // We allow drop on all windows
+ }
+
+ internal override DragDropEffects StartDrag (IntPtr handle, object data,
+ DragDropEffects allowed_effects)
+ {
+ Hwnd hwnd = Hwnd.ObjectFromHandle (handle);
+
+ if (hwnd == null)
+ throw new ArgumentException ("Attempt to begin drag from invalid window handle (" + handle.ToInt32 () + ").");
+
+ return Dnd.StartDrag (hwnd.client_window, data, allowed_effects);
+ }
+
+ internal override void SetBorderStyle(IntPtr handle, FormBorderStyle border_style) {
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+ hwnd.border_style = border_style;
+
+ XMoveResizeWindow(DisplayHandle, hwnd.client_window, hwnd.ClientRect.X, hwnd.ClientRect.Y, hwnd.ClientRect.Width, hwnd.ClientRect.Height);
+
+ InvalidateWholeWindow(handle);
+ }
+
+ internal override void SetCaretPos(IntPtr handle, int x, int y) {
+ if (Caret.Hwnd == handle) {
+ Caret.Timer.Stop();
+ HideCaret();
+
+ Caret.X = x;
+ Caret.Y = y;
+
+ if (Caret.Visible == 1) {
+ ShowCaret();
+ Caret.Timer.Start();
+ }
+ }
+ }
+
+ internal override void SetCursor(IntPtr handle, IntPtr cursor) {
+ Hwnd hwnd;
+
+ if (OverrideCursorHandle == IntPtr.Zero) {
+ if ((LastCursorWindow == handle) && (LastCursorHandle == cursor)) {
+ return;
+ }
+
+ LastCursorHandle = cursor;
+ LastCursorWindow = handle;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+ lock (XlibLock) {
+ if (cursor != IntPtr.Zero) {
+ XDefineCursor(DisplayHandle, hwnd.whole_window, cursor);
+ } else {
+ XUndefineCursor(DisplayHandle, hwnd.whole_window);
+ }
+ }
+ return;
+ }
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+ lock (XlibLock) {
+ XDefineCursor(DisplayHandle, hwnd.whole_window, OverrideCursorHandle);
+ }
+ }
+
+ internal override void SetCursorPos(IntPtr handle, int x, int y) {
+ if (handle == IntPtr.Zero) {
+ lock (XlibLock) {
+ XWarpPointer(DisplayHandle, IntPtr.Zero, IntPtr.Zero, 0, 0, 0, 0, x, y);
+ }
+ return;
+ } else {
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+ lock (XlibLock) {
+ XWarpPointer(DisplayHandle, IntPtr.Zero, hwnd.client_window, 0, 0, 0, 0, x, y);
+ }
+ return;
+ }
+ }
+
+ internal override void SetFocus(IntPtr handle) {
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+ if (FocusWindow != IntPtr.Zero) {
+ PostMessage(FocusWindow, Msg.WM_KILLFOCUS, hwnd.client_window, IntPtr.Zero);
+ }
+ PostMessage(hwnd.client_window, Msg.WM_SETFOCUS, FocusWindow, IntPtr.Zero);
+ FocusWindow = hwnd.client_window;
+
+ //XSetInputFocus(DisplayHandle, Hwnd.ObjectFromHandle(handle).client_window, RevertTo.None, IntPtr.Zero);
+ }
+
+ internal override void SetIcon(IntPtr handle, Icon icon) {
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+ if (hwnd != null) {
+ SetIcon(hwnd, icon);
+ }
+ }
+
+ internal override void SetMenu(IntPtr handle, Menu menu) {
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+ hwnd.menu = menu;
+
+ // FIXME - do we need to trigger some resize?
+ }
+
+ internal override void SetModal(IntPtr handle, bool Modal) {
+ if (Modal) {
+ ModalWindows.Push(handle);
+ } else {
+ if (ModalWindows.Contains(handle)) {
+ ModalWindows.Pop();
+ }
+ if (ModalWindows.Count > 0) {
+ Activate((IntPtr)ModalWindows.Peek());
+ }
+ }
+ }
+
+ internal override IntPtr SetParent(IntPtr handle, IntPtr parent) {
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+ hwnd.parent = Hwnd.ObjectFromHandle(parent);
+
+ lock (XlibLock) {
+ #if DriverDebug
+ Console.WriteLine("Parent for window {0:X} / {1:X} = {2:X} (Handle:{3:X})", hwnd.ClientWindow.ToInt32(), hwnd.WholeWindow.ToInt32(), hwnd.parent != null ? hwnd.parent.Handle.ToInt32() : 0, parent.ToInt32());
+ #endif
+ XReparentWindow(DisplayHandle, hwnd.whole_window, hwnd.parent.client_window, hwnd.x, hwnd.y);
+ }
+
+ return IntPtr.Zero;
+ }
+
+ internal override void SetTimer (Timer timer) {
+ lock (TimerList) {
+ TimerList.Add(timer);
+ }
+ WakeupMain ();
+ }
+
+ internal override bool SetTopmost(IntPtr handle, IntPtr handle_owner, bool enabled) {
+ Hwnd hwnd;
+ Hwnd hwnd_owner;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+ if (handle_owner != IntPtr.Zero) {
+ hwnd_owner = Hwnd.ObjectFromHandle(handle_owner);
+ } else {
+ hwnd_owner = null;
+ }
+
+ if (enabled) {
+ lock (XlibLock) {
+ if (hwnd_owner != null) {
+ XSetTransientForHint(DisplayHandle, hwnd.whole_window, hwnd_owner.whole_window);
+ } else {
+ XSetTransientForHint(DisplayHandle, hwnd.whole_window, FosterParent);
+ }
+ }
+ } else {
+ lock (XlibLock) {
+ XDeleteProperty(DisplayHandle, hwnd.whole_window, (int)Atom.XA_WM_TRANSIENT_FOR);
+ }
+ }
+ return true;
+ }
+
+ internal override bool SetVisible(IntPtr handle, bool visible) {
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+ hwnd.visible = visible;
+
+ lock (XlibLock) {
+ if (visible) {
+ XMapWindow(DisplayHandle, hwnd.whole_window);
+ XMapWindow(DisplayHandle, hwnd.client_window);
+ } else {
+ XUnmapWindow(DisplayHandle, hwnd.whole_window);
+ }
+ }
+ return true;
+ }
+
+ internal override void SetWindowPos(IntPtr handle, int x, int y, int width, int height) {
+ Hwnd hwnd;
+ Rectangle client_rect;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+ // X requires a sanity check for width & height; otherwise it dies
+ if (hwnd.zero_sized && width > 0 && height > 0) {
+ if (hwnd.visible) {
+ XMapWindow(DisplayHandle, hwnd.whole_window);
+ }
+ hwnd.zero_sized = false;
+ }
+
+ if (width < 1) {
+ hwnd.zero_sized = true;
+ XUnmapWindow(DisplayHandle, hwnd.whole_window);
+ }
+
+ if (height < 1) {
+ hwnd.zero_sized = true;
+ XUnmapWindow(DisplayHandle, hwnd.whole_window);
+ }
+
+ client_rect = Hwnd.GetClientRectangle(hwnd.border_style, hwnd.menu, hwnd.title_style, hwnd.caption_height, hwnd.tool_caption_height, width, height);
+
+ // Save a server roundtrip (and prevent a feedback loop)
+ if ((hwnd.x == x) && (hwnd.y == y) &&
+ (hwnd.width == width) && (hwnd.height == height) &&
+ (hwnd.ClientRect == client_rect)) {
+ return;
+ }
+
+ if (!hwnd.zero_sized) {
+ lock (XlibLock) {
+ XMoveResizeWindow(DisplayHandle, hwnd.whole_window, x, y, width, height);
+ XMoveResizeWindow(DisplayHandle, hwnd.client_window, client_rect.X, client_rect.Y, client_rect.Width, client_rect.Height);
+ }
+ }
+
+ // Prevent an old queued ConfigureNotify from setting our width with outdated data, set it now
+ hwnd.width = width;
+ hwnd.height = height;
+ }
+
+ internal override void SetWindowState(IntPtr handle, FormWindowState state) {
+ FormWindowState current_state;
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+ current_state = GetWindowState(handle);
+
+ if (current_state == state) {
+ return;
+ }
+
+ switch(state) {
+ case FormWindowState.Normal: {
+ lock (XlibLock) {
+ if (current_state == FormWindowState.Minimized) {
+ XMapWindow(DisplayHandle, hwnd.whole_window);
+ XMapWindow(DisplayHandle, hwnd.client_window);
+ } else if (current_state == FormWindowState.Maximized) {
+ SendNetWMMessage(hwnd.whole_window, (IntPtr)(uint)NetAtoms[(int)NA._NET_WM_STATE], (IntPtr)2 /* toggle */, (IntPtr)NetAtoms[(int)NA._NET_WM_STATE_MAXIMIZED_HORZ], (IntPtr)NetAtoms[(int)NA._NET_WM_STATE_MAXIMIZED_VERT]);
+ }
+ }
+ Activate(handle);
+ return;
+ }
+
+ case FormWindowState.Minimized: {
+ lock (XlibLock) {
+ if (current_state == FormWindowState.Maximized) {
+ SendNetWMMessage(hwnd.whole_window, (IntPtr)NetAtoms[(int)NA._NET_WM_STATE], (IntPtr)2 /* toggle */, (IntPtr)NetAtoms[(int)NA._NET_WM_STATE_MAXIMIZED_HORZ], (IntPtr)NetAtoms[(int)NA._NET_WM_STATE_MAXIMIZED_VERT]);
+ }
+ XIconifyWindow(DisplayHandle, hwnd.whole_window, 0);
+ }
+ return;
+ }
+
+ case FormWindowState.Maximized: {
+ lock (XlibLock) {
+ if (current_state == FormWindowState.Minimized) {
+ XMapWindow(DisplayHandle, hwnd.whole_window);
+ XMapWindow(DisplayHandle, hwnd.client_window);
+ }
+
+ SendNetWMMessage(hwnd.whole_window, (IntPtr)NetAtoms[(int)NA._NET_WM_STATE], (IntPtr)1 /* Add */, (IntPtr)NetAtoms[(int)NA._NET_WM_STATE_MAXIMIZED_HORZ], (IntPtr)NetAtoms[(int)NA._NET_WM_STATE_MAXIMIZED_VERT]);
+ }
+ Activate(handle);
+ return;
+ }
+ }
+ }
+
+ internal override void SetWindowStyle(IntPtr handle, CreateParams cp) {
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+ SetHwndStyles(hwnd, cp);
+ SetWMStyles(hwnd, cp);
+ }
+
+ internal override void SetWindowTransparency(IntPtr handle, double transparency, Color key) {
+ Hwnd hwnd;
+ uint opacity;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+ if (hwnd == null) {
+ return;
+ }
+
+ hwnd.opacity = (uint)(0xffffffff * transparency);
+ opacity = hwnd.opacity;
+
+ if (hwnd.reparented) {
+ XChangeProperty(DisplayHandle, XGetParent(hwnd.whole_window), NetAtoms[(int)NA._NET_WM_WINDOW_OPACITY], Atom.XA_CARDINAL, 32, PropertyMode.Replace, ref opacity, 1);
+ }
+ }
+
+ internal override bool SetZOrder(IntPtr handle, IntPtr after_handle, bool top, bool bottom) {
+ Hwnd hwnd = Hwnd.ObjectFromHandle(handle);
+
+ if (top) {
+ lock (XlibLock) {
+ XRaiseWindow(DisplayHandle, hwnd.whole_window);
+ }
+ return true;
+ } else if (!bottom) {
+ Hwnd after_hwnd = null;
+
+ if (after_handle != IntPtr.Zero) {
+ after_hwnd = Hwnd.ObjectFromHandle(after_handle);
+ }
+
+ XWindowChanges values = new XWindowChanges();
+
+ if (after_hwnd == null) {
+ throw new ArgumentNullException("after_handle", "Need sibling to adjust z-order");
+ }
+ values.sibling = after_hwnd.whole_window;
+ values.stack_mode = StackMode.Below;
+
+ lock (XlibLock) {
+ XConfigureWindow(DisplayHandle, hwnd.whole_window, ChangeWindowFlags.CWStackMode | ChangeWindowFlags.CWSibling, ref values);
+ }
+ } else {
+ // Bottom
+ lock (XlibLock) {
+ XLowerWindow(DisplayHandle, hwnd.whole_window);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ internal override void ShowCursor(bool show) {
+ ; // FIXME - X11 doesn't 'hide' the cursor. we could create an empty cursor
+ }
+
+ internal override void StartLoop(Thread thread) {
+ // Future place for prepping a new queue for this specific thread
+ }
+
+ internal override bool SupportsTransparency() {
+ // We need to check if the x compositing manager is running
+ return true;
+ }
+
+ internal override bool SystrayAdd(IntPtr handle, string tip, Icon icon, out ToolTip tt) {
+ GetSystrayManagerWindow();
+
+ if (SystrayMgrWindow != IntPtr.Zero) {
+ uint[] atoms;
+ XSizeHints size_hints;
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+ #if DriverDebug
+ Console.WriteLine("Adding Systray Whole:{0:X}, Client:{1:X}", hwnd.whole_window.ToInt32(), hwnd.client_window.ToInt32());
+ #endif
+
+ XUnmapWindow(DisplayHandle, hwnd.whole_window);
+ XUnmapWindow(DisplayHandle, hwnd.client_window);
+
+ // Oh boy.
+ XDestroyWindow(DisplayHandle, hwnd.client_window);
+ hwnd.client_window = hwnd.whole_window;
+
+ size_hints = new XSizeHints();
+
+ size_hints.flags = (IntPtr)(XSizeHintsFlags.PMinSize | XSizeHintsFlags.PMaxSize | XSizeHintsFlags.PBaseSize);
+ size_hints.min_width = icon.Width;
+ size_hints.min_height = icon.Height;
+
+ size_hints.max_width = icon.Width;
+ size_hints.max_height = icon.Height;
+
+ size_hints.base_width = icon.Width;
+ size_hints.base_height = icon.Height;
+ XSetWMNormalHints(DisplayHandle, hwnd.whole_window, ref size_hints);
+
+ atoms = new uint[2];
+ atoms[0] = 1; // Version 1
+ atoms[1] = 0; // We're not mapped
+
+ // This line cost me 3 days...
+ XChangeProperty(DisplayHandle, hwnd.whole_window, NetAtoms[(int)NA._XEMBED_INFO], NetAtoms[(int)NA._XEMBED_INFO], 32, PropertyMode.Replace, atoms, 2);
+
+ // Need to pick some reasonable defaults
+ tt = new ToolTip();
+ tt.AutomaticDelay = 100;
+ tt.InitialDelay = 250;
+ tt.ReshowDelay = 250;
+ tt.ShowAlways = true;
+
+ if ((tip != null) && (tip != string.Empty)) {
+ tt.SetToolTip(Control.FromHandle(handle), tip);
+ tt.Active = true;
+ } else {
+ tt.Active = false;
+ }
+
+ // Make sure the window exists
+ XSync(DisplayHandle, hwnd.whole_window);
+
+ SendNetClientMessage(SystrayMgrWindow, (IntPtr)NetAtoms[(int)NA._NET_SYSTEM_TRAY_OPCODE], IntPtr.Zero, (IntPtr)SystrayRequest.SYSTEM_TRAY_REQUEST_DOCK, hwnd.whole_window);
+ return true;
+ }
+ tt = null;
+ return false;
+ }
+
+ internal override bool SystrayChange(IntPtr handle, string tip, Icon icon, ref ToolTip tt) {
+ Control control;
+
+ control = Control.FromHandle(handle);
+ if (control != null && tt != null) {
+ tt.SetToolTip(control, tip);
+ tt.Active = true;
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ internal override void SystrayRemove(IntPtr handle, ref ToolTip tt) {
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+ XUnmapWindow(DisplayHandle, hwnd.whole_window);
+ SetParent(hwnd.whole_window, FosterParent);
+
+ // The caller can now re-dock it later...
+ if (tt != null) {
+ tt.Dispose();
+ tt = null;
+ }
+ }
+
+ internal override bool Text(IntPtr handle, string text) {
+ lock (XlibLock) {
+ // FIXME - use _NET properties
+ XStoreName(DisplayHandle, Hwnd.ObjectFromHandle(handle).whole_window, text);
+ }
+ return true;
+ }
+
+ internal override bool TranslateMessage(ref MSG msg) {
+ return Keyboard.TranslateMessage (ref msg);
+ }
+
+ internal override void UpdateWindow(IntPtr handle) {
+// XEvent xevent;
+ Hwnd hwnd;
+
+ hwnd = Hwnd.ObjectFromHandle(handle);
+
+// if (!hwnd.visible || hwnd.expose_pending) {
+ if (!hwnd.visible || hwnd.destroy_pending) {
+ return;
+ }
+
+ SendMessage(handle, Msg.WM_PAINT, IntPtr.Zero, IntPtr.Zero);
+#if not
+#if true
+ xevent = new XEvent();
+ xevent.type = XEventName.Expose;
+ xevent.ExposeEvent.display = DisplayHandle;
+ xevent.ExposeEvent.window = hwnd.client_window;
+
+ MessageQueue.Enqueue(xevent);
+ hwnd.expose_pending = true;
+#else
+ // This would force an immediate paint (SendMessage, instead of PostMessage)
+ if (!hwnd.visible) {
+ return;
+ }
+
+ if (!hwnd.expose_pending) {
+ xevent = new XEvent();
+ xevent.type = XEventName.Expose;
+ xevent.ExposeEvent.display = DisplayHandle;
+ xevent.ExposeEvent.window = hwnd.client_window;
+
+ MessageQueue.Enqueue(xevent);
+ hwnd.expose_pending = true;
+ }
+ NativeWindow.WndProc(hwnd.client_window, Msg.WM_PAINT, IntPtr.Zero, IntPtr.Zero);
+#endif
+#endif
+ }
+ #endregion // Public Static Methods
+
+ #region Events
+ internal override event EventHandler Idle;
+ #endregion // Events
+
+ #region X11 Imports
+ [DllImport ("libX11", EntryPoint="XOpenDisplay")]
+ internal extern static IntPtr XOpenDisplay(IntPtr display);
+ [DllImport ("libX11", EntryPoint="XCloseDisplay")]
+ internal extern static int XCloseDisplay(IntPtr display);
+ [DllImport ("libX11", EntryPoint="XSynchronize")]
+ internal extern static IntPtr XSynchronize(IntPtr display, bool onoff);
+
+ [DllImport ("libX11", EntryPoint="XCreateWindow")]
+ internal extern static IntPtr XCreateWindow(IntPtr display, IntPtr parent, int x, int y, int width, int height, int border_width, int depth, int xclass, IntPtr visual, SetWindowValuemask valuemask, ref XSetWindowAttributes attributes);
+ [DllImport ("libX11", EntryPoint="XCreateSimpleWindow")]
+ internal extern static IntPtr XCreateSimpleWindow(IntPtr display, IntPtr parent, int x, int y, int width, int height, int border_width, int border, int background);
+ [DllImport ("libX11", EntryPoint="XMapWindow")]
+ internal extern static int XMapWindow(IntPtr display, IntPtr window);
+ [DllImport ("libX11", EntryPoint="XUnmapWindow")]
+ internal extern static int XUnmapWindow(IntPtr display, IntPtr window);
+ [DllImport ("libX11", EntryPoint="XMapSubwindows")]
+ internal extern static int XMapSubindows(IntPtr display, IntPtr window);
+ [DllImport ("libX11", EntryPoint="XUnmapSubwindows")]
+ internal extern static int XUnmapSubwindows(IntPtr display, IntPtr window);
+ [DllImport ("libX11", EntryPoint="XRootWindow")]
+ internal extern static IntPtr XRootWindow(IntPtr display, int screen_number);
+ [DllImport ("libX11", EntryPoint="XNextEvent")]
+ internal extern static IntPtr XNextEvent(IntPtr display, ref XEvent xevent);
+ [DllImport ("libX11")]
+ internal extern static int XConnectionNumber (IntPtr diplay);
+ [DllImport ("libX11")]
+ internal extern static int XPending (IntPtr diplay);
+ [DllImport ("libX11")]
+ internal extern static bool XCheckWindowEvent (IntPtr display, IntPtr window, EventMask mask, ref XEvent xevent);
+ [DllImport ("libX11")]
+ internal extern static bool XCheckMaskEvent (IntPtr display, EventMask mask, ref XEvent xevent);
+ [DllImport ("libX11", EntryPoint="XSelectInput")]
+ internal extern static IntPtr XSelectInput(IntPtr display, IntPtr window, EventMask mask);
+
+ [DllImport ("libX11", EntryPoint="XDestroyWindow")]
+ internal extern static int XDestroyWindow(IntPtr display, IntPtr window);
+
+ [DllImport ("libX11", EntryPoint="XReparentWindow")]
+ internal extern static int XReparentWindow(IntPtr display, IntPtr window, IntPtr parent, int x, int y);
+ [DllImport ("libX11", EntryPoint="XMoveResizeWindow")]
+ internal extern static int XMoveResizeWindow(IntPtr display, IntPtr window, int x, int y, int width, int height);
+
+ [DllImport ("libX11", EntryPoint="XResizeWindow")]
+ internal extern static int XResizeWindow(IntPtr display, IntPtr window, int width, int height);
+
+ [DllImport ("libX11", EntryPoint="XGetWindowAttributes")]
+ internal extern static int XGetWindowAttributes(IntPtr display, IntPtr window, ref XWindowAttributes attributes);
+
+ [DllImport ("libX11", EntryPoint="XFlush")]
+ internal extern static int XFlush(IntPtr display);
+
+ [DllImport ("libX11", EntryPoint="XSetWMName")]
+ internal extern static int XSetWMName(IntPtr display, IntPtr window, ref XTextProperty text_prop);
+
+ [DllImport ("libX11", EntryPoint="XStoreName")]
+ internal extern static int XStoreName(IntPtr display, IntPtr window, string window_name);
+
+ [DllImport ("libX11", EntryPoint="XFetchName")]
+ internal extern static int XFetchName(IntPtr display, IntPtr window, ref IntPtr window_name);
+
+ [DllImport ("libX11", EntryPoint="XSendEvent")]
+ internal extern static int XSendEvent(IntPtr display, IntPtr window, bool propagate, EventMask event_mask, ref XEvent send_event);
+
+ [DllImport ("libX11", EntryPoint="XQueryTree")]
+ internal extern static int XQueryTree(IntPtr display, IntPtr window, out IntPtr root_return, out IntPtr parent_return, out IntPtr children_return, out int nchildren_return);
+
+ [DllImport ("libX11", EntryPoint="XFree")]
+ internal extern static int XFree(IntPtr data);
+
+ [DllImport ("libX11", EntryPoint="XRaiseWindow")]
+ internal extern static int XRaiseWindow(IntPtr display, IntPtr window);
+
+ [DllImport ("libX11", EntryPoint="XLowerWindow")]
+ internal extern static uint XLowerWindow(IntPtr display, IntPtr window);
+
+ [DllImport ("libX11", EntryPoint="XConfigureWindow")]
+ internal extern static uint XConfigureWindow(IntPtr display, IntPtr window, ChangeWindowFlags value_mask, ref XWindowChanges values);
+
+ [DllImport ("libX11", EntryPoint="XInternAtom")]
+ internal extern static int XInternAtom(IntPtr display, string atom_name, bool only_if_exists);
+
+ [DllImport ("libX11", EntryPoint="XSetWMProtocols")]
+ internal extern static int XSetWMProtocols(IntPtr display, IntPtr window, uint[] protocols, int count);
+
+ [DllImport ("libX11", EntryPoint="XGrabPointer")]
+ internal extern static int XGrabPointer(IntPtr display, IntPtr window, bool owner_events, EventMask event_mask, GrabMode pointer_mode, GrabMode keyboard_mode, IntPtr confine_to, uint cursor, uint timestamp);
+
+ [DllImport ("libX11", EntryPoint="XUngrabPointer")]
+ internal extern static int XUngrabPointer(IntPtr display, uint timestamp);
+
+ [DllImport ("libX11", EntryPoint="XQueryPointer")]
+ internal extern static bool XQueryPointer(IntPtr display, IntPtr window, out IntPtr root, out IntPtr child, out int root_x, out int root_y, out int win_x, out int win_y, out int keys_buttons);
+
+ [DllImport ("libX11", EntryPoint="XTranslateCoordinates")]
+ internal extern static bool XTranslateCoordinates (IntPtr display, IntPtr src_w, IntPtr dest_w, int src_x, int src_y, out int intdest_x_return, out int dest_y_return, out IntPtr child_return);
+
+ [DllImport ("libX11", EntryPoint="XGetGeometry")]
+ internal extern static bool XGetGeometry(IntPtr display, IntPtr window, out IntPtr root, out int x, out int y, out int width, out int height, out int border_width, out int depth);
+
+ [DllImport ("libX11", EntryPoint="XGetGeometry")]
+ internal extern static bool XGetGeometry(IntPtr display, IntPtr window, IntPtr root, out int x, out int y, out int width, out int height, IntPtr border_width, IntPtr depth);
+
+ [DllImport ("libX11", EntryPoint="XGetGeometry")]
+ internal extern static bool XGetGeometry(IntPtr display, IntPtr window, IntPtr root, out int x, out int y, IntPtr width, IntPtr height, IntPtr border_width, IntPtr depth);
+
+ [DllImport ("libX11", EntryPoint="XGetGeometry")]
+ internal extern static bool XGetGeometry(IntPtr display, IntPtr window, IntPtr root, IntPtr x, IntPtr y, out int width, out int height, IntPtr border_width, IntPtr depth);
+
+ [DllImport ("libX11", EntryPoint="XWarpPointer")]
+ internal extern static uint XWarpPointer(IntPtr display, IntPtr src_w, IntPtr dest_w, int src_x, int src_y, uint src_width, uint src_height, int dest_x, int dest_y);
+
+ [DllImport ("libX11", EntryPoint="XClearWindow")]
+ internal extern static int XClearWindow(IntPtr display, IntPtr window);
+
+ [DllImport ("libX11", EntryPoint="XClearArea")]
+ internal extern static int XClearArea(IntPtr display, IntPtr window, int x, int y, int width, int height, bool exposures);
+
+ // Colormaps
+ [DllImport ("libX11", EntryPoint="XDefaultScreenOfDisplay")]
+ internal extern static IntPtr XDefaultScreenOfDisplay(IntPtr display);
+
+ [DllImport ("libX11", EntryPoint="XScreenNumberOfScreen")]
+ internal extern static int XScreenNumberOfScreen(IntPtr display, IntPtr Screen);
+
+ [DllImport ("libX11", EntryPoint="XDefaultVisual")]
+ internal extern static IntPtr XDefaultVisual(IntPtr display, int screen_number);
+
+ [DllImport ("libX11", EntryPoint="XDefaultDepth")]
+ internal extern static uint XDefaultDepth(IntPtr display, int screen_number);
+
+ [DllImport ("libX11", EntryPoint="XDefaultColormap")]
+ internal extern static IntPtr XDefaultColormap(IntPtr display, int screen_number);
+
+ [DllImport ("libX11", EntryPoint="XLookupColor")]
+ internal extern static int XLookupColor(IntPtr display, IntPtr Colormap, string Coloranem, ref XColor exact_def_color, ref XColor screen_def_color);
+
+ [DllImport ("libX11", EntryPoint="XAllocColor")]
+ internal extern static int XAllocColor(IntPtr display, IntPtr Colormap, ref XColor colorcell_def);
+
+ [DllImport ("libX11", EntryPoint="XSetTransientForHint")]
+ internal extern static int XSetTransientForHint(IntPtr display, IntPtr window, IntPtr prop_window);
+
+ [DllImport ("libX11", EntryPoint="XChangeProperty")]
+ internal extern static int XChangeProperty(IntPtr display, IntPtr window, int property, int type, int format, PropertyMode mode, ref MotifWmHints data, int nelements);
+
+ [DllImport ("libX11", EntryPoint="XChangeProperty")]
+ internal extern static int XChangeProperty(IntPtr display, IntPtr window, int property, Atom format, int type, PropertyMode mode, uint[] atoms, int nelements);
+
+ [DllImport ("libX11", EntryPoint="XChangeProperty")]
+ internal extern static int XChangeProperty(IntPtr display, IntPtr window, int property, Atom format, int type, PropertyMode mode, ref uint value, int nelements);
+
+ [DllImport ("libX11", EntryPoint="XChangeProperty")]
+ internal extern static int XChangeProperty(IntPtr display, IntPtr window, int property, int format, int type, PropertyMode mode, uint[] atoms, int nelements);
+
+ [DllImport ("libX11", EntryPoint="XChangeProperty")]
+ internal extern static int XChangeProperty(IntPtr display, IntPtr window, int property, int format, int type, PropertyMode mode, IntPtr atoms, int nelements);
+
+ [DllImport ("libX11", EntryPoint="XChangeProperty")]
+ internal extern static int XChangeProperty(IntPtr display, IntPtr window, int property, Atom format, int type, PropertyMode mode, IntPtr atoms, int nelements);
+
+ [DllImport ("libX11", EntryPoint="XChangeProperty", CharSet=CharSet.Ansi)]
+ internal extern static int XChangeProperty(IntPtr display, IntPtr window, int property, int type, int format, PropertyMode mode, string text, int text_length);
+
+ [DllImport ("libX11", EntryPoint="XDeleteProperty")]
+ internal extern static int XDeleteProperty(IntPtr display, IntPtr window, int property);
+
+ [DllImport ("gdiplus", EntryPoint="GetFontMetrics")]
+ internal extern static bool GetFontMetrics(IntPtr graphicsObject, IntPtr nativeObject, out int ascent, out int descent);
+
+ // Drawing
+ [DllImport ("libX11", EntryPoint="XCreateGC")]
+ internal extern static IntPtr XCreateGC(IntPtr display, IntPtr window, GCFunction valuemask, ref XGCValues values);
+
+ [DllImport ("libX11", EntryPoint="XFreeGC")]
+ internal extern static int XFreeGC(IntPtr display, IntPtr gc);
+
+ [DllImport ("libX11", EntryPoint="XSetFunction")]
+ internal extern static int XSetFunction(IntPtr display, IntPtr gc, GXFunction function);
+
+ [DllImport ("libX11", EntryPoint="XDrawLine")]
+ internal extern static int XDrawLine(IntPtr display, IntPtr drawable, IntPtr gc, int x1, int y1, int x2, int y2);
+
+ [DllImport ("libX11", EntryPoint="XDrawRectangle")]
+ internal extern static int XDrawRectangle(IntPtr display, IntPtr drawable, IntPtr gc, int x1, int y1, int width, int height);
+
+ [DllImport ("libX11", EntryPoint="XSetWindowBackground")]
+ internal extern static int XSetWindowBackground(IntPtr display, IntPtr window, IntPtr background);
+
+ [DllImport ("libX11", EntryPoint="XCopyArea")]
+ internal extern static int XCopyArea(IntPtr display, IntPtr src, IntPtr dest, IntPtr gc, int src_x, int src_y, int width, int height, int dest_x, int dest_y);
+
+ [DllImport ("libX11", EntryPoint="XGetAtomName")]
+ internal extern static string XGetAtomName(IntPtr display, int atom);
+
+ [DllImport ("libX11", EntryPoint="XGetWindowProperty")]
+ internal extern static int XGetWindowProperty(IntPtr display, IntPtr window, int atom, int long_offset, int long_length, bool delete, Atom req_type, out Atom actual_type, out int actual_format, out int nitems, out int bytes_after, ref IntPtr prop);
+
+ [DllImport ("libX11", EntryPoint="XSetInputFocus")]
+ internal extern static int XSetInputFocus(IntPtr display, IntPtr window, RevertTo revert_to, IntPtr time);
+
+ [DllImport ("libX11", EntryPoint="XIconifyWindow")]
+ internal extern static int XIconifyWindow(IntPtr display, IntPtr window, int screen_number);
+
+ [DllImport ("libX11", EntryPoint="XDefineCursor")]
+ internal extern static int XDefineCursor(IntPtr display, IntPtr window, IntPtr cursor);
+
+ [DllImport ("libX11", EntryPoint="XUndefineCursor")]
+ internal extern static int XUndefineCursor(IntPtr display, IntPtr window);
+
+ [DllImport ("libX11", EntryPoint="XFreeCursor")]
+ internal extern static int XFreeCursor(IntPtr display, IntPtr cursor);
+
+ [DllImport ("libX11", EntryPoint="XCreateFontCursor")]
+ internal extern static IntPtr XCreateFontCursor(IntPtr display, CursorFontShape shape);
+
+ [DllImport ("libX11", EntryPoint="XCreatePixmapCursor")]
+ internal extern static IntPtr XCreatePixmapCursor(IntPtr display, IntPtr source, IntPtr mask, ref XColor foreground_color, ref XColor background_color, int x_hot, int y_hot);
+
+ [DllImport ("libX11", EntryPoint="XCreatePixmapFromBitmapData")]
+ internal extern static IntPtr XCreatePixmapFromBitmapData(IntPtr display, IntPtr drawable, byte[] data, int width, int height, IntPtr fg, IntPtr bg, int depth);
+
+ [DllImport ("libX11", EntryPoint="XFreePixmap")]
+ internal extern static IntPtr XFreePixmap(IntPtr display, IntPtr pixmap);
+
+ [DllImport ("libX11", EntryPoint="XQueryBestCursor")]
+ internal extern static int XQueryBestCursor(IntPtr display, IntPtr drawable, int width, int height, out int best_width, out int best_height);
+
+ [DllImport ("libX11", EntryPoint="XWhitePixel")]
+ internal extern static IntPtr XWhitePixel(IntPtr display, int screen_no);
+
+ [DllImport ("libX11", EntryPoint="XBlackPixel")]
+ internal extern static IntPtr XBlackPixel(IntPtr display, int screen_no);
+
+ [DllImport ("libX11", EntryPoint="XGrabServer")]
+ internal extern static void XGrabServer(IntPtr display);
+
+ [DllImport ("libX11", EntryPoint="XUngrabServer")]
+ internal extern static void XUngrabServer(IntPtr display);
+
+ [DllImport ("libX11", EntryPoint="XSetWMNormalHints")]
+ internal extern static void XSetWMNormalHints(IntPtr display, IntPtr window, ref XSizeHints hints);
+
+ [DllImport ("libX11", EntryPoint="XSetWMHints")]
+ internal extern static void XSetWMHints(IntPtr display, IntPtr window, ref XWMHints wmhints);
+
+ [DllImport ("libX11", EntryPoint="XSync")]
+ internal extern static void XSync(IntPtr display, IntPtr window);
+
+ [DllImport ("libX11", EntryPoint="XGetIconSizes")]
+ internal extern static int XGetIconSizes(IntPtr display, IntPtr window, out IntPtr size_list, out int count);
+
+ [DllImport ("libX11", EntryPoint="XSetErrorHandler")]
+ internal extern static IntPtr XSetErrorHandler(XErrorHandler error_handler);
+
+ [DllImport ("libX11", EntryPoint="XGetErrorText")]
+ internal extern static IntPtr XGetErrorText(IntPtr display, byte code, StringBuilder buffer, int length);
+
+ [DllImport ("libX11", EntryPoint="XInitThreads")]
+ internal extern static int XInitThreads();
+
+ [DllImport ("libX11", EntryPoint="XConvertSelection")]
+ internal extern static int XConvertSelection(IntPtr display, int selection, int target, int property, IntPtr requestor, IntPtr time);
+
+ [DllImport ("libX11", EntryPoint="XGetSelectionOwner")]
+ internal extern static IntPtr XGetSelectionOwner(IntPtr display, int selection);
+
+ [DllImport ("libX11", EntryPoint="XSetSelectionOwner")]
+ internal extern static int XSetSelectionOwner(IntPtr display, int selection, IntPtr owner, IntPtr time);
+
+ [DllImport ("libX11", EntryPoint="XSetPlaneMask")]
+ internal extern static int XSetPlaneMask(IntPtr display, IntPtr gc, uint mask);
+
+ [DllImport ("libX11", EntryPoint="XSetForeground")]
+ internal extern static int XSetForeground(IntPtr display, IntPtr gc, uint foreground);
+
+ [DllImport ("libX11", EntryPoint="XSetBackground")]
+ internal extern static int XSetBackground(IntPtr display, IntPtr gc, uint background);
+
+ [DllImport ("libX11", EntryPoint="XBell")]
+ internal extern static int XBell(IntPtr display, int percent);
+ #endregion
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms_test.dll.sources b/mcs/class/Managed.Windows.Forms/System.Windows.Forms_test.dll.sources
new file mode 100644
index 00000000000..6eba7fb5eb8
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms_test.dll.sources
@@ -0,0 +1,51 @@
+System.Windows.Forms/ButtonTest.cs
+System.Windows.Forms/CheckBoxEventTest.cs
+System.Windows.Forms/CheckBoxTest.cs
+System.Windows.Forms/CheckedListBoxEventTest.cs
+System.Windows.Forms/CheckedListBoxTest.cs
+System.Windows.Forms/ComboBoxTest.cs
+System.Windows.Forms/Common.cs
+System.Windows.Forms/ControlEventTest.cs
+System.Windows.Forms/ControlTest.cs
+System.Windows.Forms/ControlPaintTest.cs
+System.Windows.Forms/ControlStyleTest.cs
+System.Windows.Forms/CursorTest.cs
+System.Windows.Forms/DataGridTableStyleTest.cs
+System.Windows.Forms/DataGridTest.cs
+System.Windows.Forms/DataGridTextBoxColumnTest.cs
+System.Windows.Forms/DataGridViewAdvancedBorderStyleTest.cs
+System.Windows.Forms/DataGridViewBandTest.cs
+System.Windows.Forms/DataGridViewCellStyleTest.cs
+System.Windows.Forms/DataGridViewCellTest.cs
+System.Windows.Forms/DataGridViewElementTest.cs
+System.Windows.Forms/DataGridViewRowTest.cs
+System.Windows.Forms/DataGridViewTest.cs
+System.Windows.Forms/GridColumnStylesCollectionTest.cs
+System.Windows.Forms/GridTableStylesCollectionTest.cs
+System.Windows.Forms/GroupBoxTest.cs
+System.Windows.Forms/ImageListTest.cs
+System.Windows.Forms/LabelPropertyTest.cs
+System.Windows.Forms/LabelTest.cs
+System.Windows.Forms/ListBoxEventTest.cs
+System.Windows.Forms/ListBoxTest.cs
+System.Windows.Forms/ListViewCollectionsTest.cs
+System.Windows.Forms/ListViewEventTest.cs
+System.Windows.Forms/ListViewTest.cs
+System.Windows.Forms/ListViewItemTest.cs
+System.Windows.Forms/MenuTest.cs
+System.Windows.Forms/MenuItemTest.cs
+System.Windows.Forms/MonthCalendarTest.cs
+System.Windows.Forms/PictureBoxTest.cs
+System.Windows.Forms/ProgressBarTest.cs
+System.Windows.Forms/RadioButtonTest.cs
+System.Windows.Forms/RichTextBoxTest.cs
+System.Windows.Forms/ScrollBarTest.cs
+System.Windows.Forms/StatusBarTest.cs
+System.Windows.Forms/TestImageIndexConverter.cs
+System.Windows.Forms/ToolBarTest.cs
+System.Windows.Forms/ToolTipTest.cs
+System.Windows.Forms/TreeNodeTest.cs
+System.Windows.Forms/TreeViewTest.cs
+System.Resources/CompatTest.cs
+System.Resources/CultureTest.cs
+System.Resources/WriterTest.cs
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Resources/ChangeLog b/mcs/class/Managed.Windows.Forms/Test/System.Resources/ChangeLog
new file mode 100644
index 00000000000..ae72a33c991
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Resources/ChangeLog
@@ -0,0 +1,8 @@
+2005-12-01 Robert Jordan <robertj@gmx.net>
+
+ * CompatTest.cs, compat*.resx: Compatibility unit tests.
+ * WriterTest.cs: Unit tests for ResXResourceWriter.
+
+2005-11-30 Robert Jordan <robertj@gmx.net>
+
+ * CultureTest.cs: Unit tests for the culture-invariance.
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Resources/CompatTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Resources/CompatTest.cs
new file mode 100644
index 00000000000..453d5ba6774
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Resources/CompatTest.cs
@@ -0,0 +1,51 @@
+//
+// CompatTest.cs: Compatibility unit tests for ResXResourceReader.
+//
+// Authors:
+// Robert Jordan <robertj@gmx.net>
+//
+
+using System;
+using System.Collections;
+using System.Drawing;
+using System.IO;
+using System.Resources;
+using NUnit.Framework;
+
+namespace MonoTests.System.Resources
+{
+ [TestFixture]
+ public class CompatTest
+ {
+ class Helper
+ {
+ public static void TestReader (string fileName)
+ {
+ ResXResourceReader r = new ResXResourceReader (fileName);
+ Hashtable h = new Hashtable();
+ foreach (DictionaryEntry e in r) {
+ h.Add (e.Key, e.Value);
+ }
+ r.Close ();
+
+ Assert.AreEqual ("hola", (string) h["String"], fileName + "#1");
+ Assert.AreEqual ("hello", (string) h["String2"], fileName + "#2");
+ Assert.AreEqual (42, (int) h["Int"], fileName + "#3");
+ Assert.AreEqual (PlatformID.Win32NT, (PlatformID) h["Enum"], fileName + "#4");
+ Assert.AreEqual (43, ((Point) h["Convertible"]).X, fileName + "#5");
+ Assert.AreEqual (2, (byte) ((ArrayList) h["Serializable"])[1], fileName + "#6");
+ Assert.AreEqual (13, ((byte[]) h["ByteArray"])[1], fileName + "#7");
+ Assert.AreEqual (16, ((byte[]) h["ByteArray2"])[1], fileName + "#8");
+ Assert.AreEqual (1013, ((int[]) h["IntArray"])[1], fileName + "#9");
+ Assert.AreEqual ("world", ((string[]) h["StringArray"])[1], fileName + "#10");
+ }
+ }
+
+ [Test]
+ public void TestReader ()
+ {
+ Helper.TestReader ("Test/System.Resources/compat_1_1.resx");
+ Helper.TestReader ("Test/System.Resources/compat_2_0.resx");
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Resources/CultureTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Resources/CultureTest.cs
new file mode 100644
index 00000000000..1c9e65114ce
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Resources/CultureTest.cs
@@ -0,0 +1,59 @@
+//
+// CultureTest.cs: Test cases for culture-invariant string convertions
+//
+// Authors:
+// Robert Jordan <robertj@gmx.net>
+//
+
+using System;
+using System.Collections;
+using System.Globalization;
+using System.Drawing;
+using System.IO;
+using System.Resources;
+using System.Threading;
+using NUnit.Framework;
+
+namespace MonoTests.System.Resources
+{
+ [TestFixture]
+ public class CultureTest
+ {
+ string fileName = Path.GetTempFileName ();
+
+ [Test]
+ public void TestWriter ()
+ {
+ Thread.CurrentThread.CurrentCulture =
+ Thread.CurrentThread.CurrentUICulture = new CultureInfo ("de-DE");
+
+ ResXResourceWriter w = new ResXResourceWriter (fileName);
+ w.AddResource ("point", new Point (42, 43));
+ w.Generate ();
+ w.Close ();
+ }
+
+ [Test]
+ public void TestReader ()
+ {
+ Thread.CurrentThread.CurrentCulture =
+ Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;
+
+ int count = 0;
+ ResXResourceReader r = new ResXResourceReader (fileName);
+ IDictionaryEnumerator e = r.GetEnumerator ();
+ while (e.MoveNext ()) {
+ if ((string)e.Key == "point") {
+ Assert.AreEqual (typeof (Point), e.Value.GetType (), "#1");
+ Point p = (Point) e.Value;
+ Assert.AreEqual (42, p.X, "#2");
+ Assert.AreEqual (43, p.Y, "#3");
+ count++;
+ }
+ }
+ r.Close ();
+ File.Delete (fileName);
+ Assert.AreEqual (1, count, "#100");
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Resources/WriterTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Resources/WriterTest.cs
new file mode 100644
index 00000000000..a5f20d556b5
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Resources/WriterTest.cs
@@ -0,0 +1,60 @@
+//
+// WriterTest.cs: Unit Tests for ResXResourceWriter.
+//
+// Authors:
+// Robert Jordan <robertj@gmx.net>
+//
+
+using System;
+using System.Collections;
+using System.Drawing;
+using System.IO;
+using System.Resources;
+using NUnit.Framework;
+
+namespace MonoTests.System.Resources
+{
+ [TestFixture]
+ public class WriterTest
+ {
+ string fileName = Path.GetTempFileName ();
+
+ [Test]
+ public void TestWriter ()
+ {
+ ResXResourceWriter w = new ResXResourceWriter (fileName);
+ w.AddResource ("String", "hola");
+ w.AddResource ("String2", (object) "hello");
+ w.AddResource ("Int", 42);
+ w.AddResource ("Enum", PlatformID.Win32NT);
+ w.AddResource ("Convertible", new Point (43, 45));
+ w.AddResource ("Serializable", new ArrayList(new byte[] {1, 2, 3, 4}));
+ w.AddResource ("ByteArray", new byte[] {12, 13, 14});
+ w.AddResource ("ByteArray2", (object) new byte[] {15, 16, 17});
+ w.AddResource ("IntArray", new int[] {1012, 1013, 1014});
+ w.AddResource ("StringArray", new string[] {"hello", "world"});
+ w.Generate ();
+ w.Close ();
+
+ ResXResourceReader r = new ResXResourceReader (fileName);
+ Hashtable h = new Hashtable();
+ foreach (DictionaryEntry e in r) {
+ h.Add (e.Key, e.Value);
+ }
+ r.Close ();
+
+ Assert.AreEqual ("hola", (string) h["String"], "#1");
+ Assert.AreEqual ("hello", (string) h["String2"], "#2");
+ Assert.AreEqual (42, (int) h["Int"], "#3");
+ Assert.AreEqual (PlatformID.Win32NT, (PlatformID) h["Enum"], "#4");
+ Assert.AreEqual (43, ((Point) h["Convertible"]).X, "#5");
+ Assert.AreEqual (2, (byte) ((ArrayList) h["Serializable"])[1], "#6");
+ Assert.AreEqual (13, ((byte[]) h["ByteArray"])[1], "#7");
+ Assert.AreEqual (16, ((byte[]) h["ByteArray2"])[1], "#8");
+ Assert.AreEqual (1013, ((int[]) h["IntArray"])[1], "#9");
+ Assert.AreEqual ("world", ((string[]) h["StringArray"])[1], "#10");
+
+ File.Delete (fileName);
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Resources/compat_1_1.resx b/mcs/class/Managed.Windows.Forms/Test/System.Resources/compat_1_1.resx
new file mode 100644
index 00000000000..bbf08ef6e1a
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Resources/compat_1_1.resx
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 1.3 (NET_1_1)
+
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>1.3</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="String">
+ <value>hola</value>
+ </data>
+ <data name="String2">
+ <value>hello</value>
+ </data>
+ <data name="Int" type="System.Int32, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>42</value>
+ </data>
+ <data name="Enum" type="System.PlatformID, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>Win32NT</value>
+ </data>
+ <data name="Convertible" type="System.Drawing.Point, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>43, 45</value>
+ </data>
+ <data name="Serializable" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>
+ AAEAAAD/////AQAAAAAAAAAEAQAAABxTeXN0ZW0uQ29sbGVjdGlvbnMuQXJyYXlMaXN0AwAAAAZfaXRl
+ bXMFX3NpemUIX3ZlcnNpb24FAAAICAkCAAAABAAAAAEAAAAQAgAAAAQAAAAIAgEIAgIIAgMIAgQL
+</value>
+ </data>
+ <data name="ByteArray" type="System.Byte[], mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>DA0O</value>
+ </data>
+ <data name="ByteArray2" type="System.Byte[], mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>DxAR</value>
+ </data>
+ <data name="IntArray" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>AAEAAAD/////AQAAAAAAAAAPAQAAAAMAAAAI9AMAAPUDAAD2AwAACw==</value>
+ </data>
+ <data name="StringArray" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>AAEAAAD/////AQAAAAAAAAARAQAAAAIAAAAGAgAAAAVoZWxsbwYDAAAABXdvcmxkCw==</value>
+ </data>
+</root>
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Resources/compat_2_0.resx b/mcs/class/Managed.Windows.Forms/Test/System.Resources/compat_2_0.resx
new file mode 100644
index 00000000000..ca1fb642744
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Resources/compat_2_0.resx
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0 (NET_2_0)
+
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="String" xml:space="preserve">
+ <value>hola</value>
+ </data>
+ <data name="String2" xml:space="preserve">
+ <value>hello</value>
+ </data>
+ <assembly alias="mscorlib" name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ <data name="Int" type="System.Int32, mscorlib">
+ <value>42</value>
+ </data>
+ <data name="Enum" type="System.PlatformID, mscorlib">
+ <value>Win32NT</value>
+ </data>
+ <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+ <data name="Convertible" type="System.Drawing.Point, System.Drawing">
+ <value>43, 45</value>
+ </data>
+ <data name="Serializable" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>
+ AAEAAAD/////AQAAAAAAAAAEAQAAABxTeXN0ZW0uQ29sbGVjdGlvbnMuQXJyYXlMaXN0AwAAAAZfaXRl
+ bXMFX3NpemUIX3ZlcnNpb24FAAAICAkCAAAABAAAAAEAAAAQAgAAAAQAAAAIAgEIAgIIAgMIAgQL
+</value>
+ </data>
+ <data name="ByteArray" type="System.Byte[], mscorlib">
+ <value>DA0O</value>
+ </data>
+ <data name="ByteArray2" type="System.Byte[], mscorlib">
+ <value>DxAR</value>
+ </data>
+ <data name="IntArray" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>AAEAAAD/////AQAAAAAAAAAPAQAAAAMAAAAI9AMAAPUDAAD2AwAACw==</value>
+ </data>
+ <data name="StringArray" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>AAEAAAD/////AQAAAAAAAAARAQAAAAIAAAAGAgAAAAVoZWxsbwYDAAAABXdvcmxkCw==</value>
+ </data>
+</root>
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ButtonTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ButtonTest.cs
new file mode 100644
index 00000000000..f792e8de509
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ButtonTest.cs
@@ -0,0 +1,104 @@
+//
+// Copyright (c) 2005 Novell, Inc.
+//
+// Authors:
+// Ritvik Mayank (mritvik@novell.com)
+//
+
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ [Ignore ("This test has to be completly reviewed")]
+ public class ButtonTest
+ {
+ [Test]
+ public void FlatStyleTest ()
+ {
+ Button B1 = new Button ();
+ Assert.AreEqual (FlatStyle.Standard, B1.FlatStyle, "#1");
+ }
+
+ [Test]
+ public void ImageTest ()
+ {
+ Button B1 = new Button ();
+ B1.Visible = true;
+ B1.Image = Image.FromFile ("M.gif");
+ Assert.AreEqual (ContentAlignment.MiddleCenter, B1.ImageAlign, "#2");
+ }
+
+ [Test]
+ public void ImageListTest ()
+ {
+ Button B1 = new Button ();
+ B1.Image = Image.FromFile ("M.gif");
+ Assert.AreEqual (null, B1.ImageList, "#3a");
+ ImageList ImageList1 = new ImageList ();
+ ImageList1.Images.Add(Image.FromFile ("M.gif"));
+ B1.ImageList = ImageList1;
+ Assert.AreEqual (-1, B1.ImageIndex, "#3b");
+ B1.ImageIndex = 0;
+ Assert.AreEqual (1, B1.ImageList.Images.Count, "#3c");
+ Assert.AreEqual (16, B1.ImageList.ImageSize.Height, "#3d");
+ Assert.AreEqual (16, B1.ImageList.ImageSize.Width, "#3e");
+ }
+
+ [Test]
+ public void IMeModeTest ()
+ {
+ Button B1 = new Button ();
+ Assert.AreEqual (ImeMode.Disable, B1.ImeMode, "#4");
+ }
+
+ [Test]
+ public void TextAlignTest ()
+ {
+ Button B1 = new Button ();
+ Assert.AreEqual (ContentAlignment.MiddleCenter, B1.TextAlign, "#5");
+ }
+
+ [Test]
+ public void DialogResultTest ()
+ {
+ Form f = new Form ();
+ Button B1 = new Button ();
+ B1.Text = "DialogResult";
+ B1.DialogResult = DialogResult.No;
+ B1.TextAlign = ContentAlignment.BottomRight;
+ B1.Visible = true;
+ f.Controls.Add (B1);
+ Assert.AreEqual (DialogResult.No, B1.DialogResult, "#6");
+ }
+
+ [Test]
+ public void PerformClickTest ()
+ {
+ Form f = new Form ();
+ Button B1 = new Button ();
+ B1.Text = "DialogResult";
+ B1.Visible = true;
+ f.Controls.Add (B1);
+ B1.PerformClick ();
+ Assert.AreEqual (DialogResult.None, B1.DialogResult, "#7");
+ }
+
+ [Test]
+ public void NotifyDefaultTest ()
+ {
+ Button B1 = new Button ();
+ Assert.AreEqual ("System.Windows.Forms.Button, Text: ", B1.ToString (), "#8");
+ }
+
+ [Test]
+ public void ToStringTest ()
+ {
+ Button B1 = new Button ();
+ Assert.AreEqual ("System.Windows.Forms.Button, Text: " , B1.ToString (), "#9");
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
new file mode 100644
index 00000000000..31ccf113d46
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
@@ -0,0 +1,253 @@
+2005-12-01 Jackson Harper <jackson@ximian.com>
+
+ * TreeNodeTest.cs: TreeNodeTest.cs : Added namespace +
+ SingleNodeIndexTest.
+ - Fixed warning CS0219. Patches by Dieter Bremes
+
+2005-11-12 Pedro Martínez Juliá <pedromj@gmail.com>
+
+ * DataGridViewElementTest.cs DataGridViewBandTest.cs
+ DataGridViewCellTest.cs DataGridViewAdvancedBorderStyleTest.cs
+ DataGridViewCellStyleTest.cs DataGridViewRowTest.cs DataGridViewTest.cs:
+
+ Add some DataGridView tests.
+
+2005-11-11 Ankit Jain <jankit@novell.com>
+
+ * RichTextBoxTest.cs: Fix typos.
+
+2005-11-09 Peter Dennis Bartok <pbartok@novell.com>
+
+ * RichTextBoxTest.cs: Added Find() tests
+
+2005-11-05 Kornél Pál <kornelpal@hotmail.com>
+
+ * LabelPropertyTest.cs: Updated product version to 1.1.4322.2032 (1.1 SP1).
+
+2005-10-18 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ListViewCollectionsTest.cs: Add tests for the ListView Collections
+
+2005-10-17 Ritvik Mayank <mritvik@novell.com>
+
+ * TabControlTest.cs : Added test case for TabControl
+
+2005-10-16 Ritvik Mayank <mritvik@novell.com>
+
+ * TrackBarTest.cs : Added test case for TrackBar
+
+2005-10-16 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * DataGridBoolColumn.cs: fixes warning
+
+2005-10-10 Peter Dennis Bartok <pbartok@novell.com>
+
+ * GenerateControlStyleTest.cs, ControlStyleTest.cs: Flipped
+ order for want and actual to avoid misleading errors
+
+2005-10-07 Peter Dennis Bartok <pbartok@novell.com>
+
+ * GenerateControlStyleTest.cs: Code to auto-generate the
+ source file ControlStyleTest.cs
+ * ControlStyleTest.cs: Tests for testing ControlStyles
+
+2005-09-28 Hisham Mardam Bey <hisham.mardambey@gmail.com>
+
+ * Common.cs : Add common things here.
+ * LabelTest.cs : Remove common declarations to Common.cs
+ * ScrollBarTest.cs : Remove common declarations to Common.cs
+ Add more propery range / exception tests
+ Add more event order tests
+ Fix Mouse tests.
+ Add event arg tests.
+
+2005-09-27 Hisham Mardam Bey <hisham.mardambey@gmail.com>
+
+ * LabelTest.cs : Added more event tests (external handlers)
+ Added event arg checks
+ Fixed OnPaint tests.
+ Seperated invalidation tests.
+
+2005-09-26 Hisham Mardam Bey <hisham.mardambey@gmail.com>
+
+ * ScrollBarTest.cs : Add more tests for event firing order
+ Messages to simulate mouse events
+
+2005-09-23 Ritvik Mayank <mritvik@novell.com>
+
+ * ErrorProviderTest.cs : Added test case for ErrorProvider
+
+2005-09-23 Hisham Mardam Bey <hisham.mardambey@gmail.com>
+
+ * LabelTest.cs : Added messages to simulate Key* events.
+ Key* events have tests now.
+
+2005-09-22 Hisham Mardam Bey <hisham.mardambey@gmail.com>
+
+ * LabelTest.cs : Implement event firing order tests.
+ * ScrollBarTest.cs : Implement event firing order tests.
+
+2005-09-22 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * MenuTest.cs: Fixes some tests
+ * MenuItemTest.cs: New unit test
+
+2005-09-21 Hisham Mardam Bey <hisham.mardambey@gmail.com>
+
+ * LabelTest.cs : Several new tests.
+ * ScrollBarTest.cs : Several new tests.
+ * bitmaps : added dir containing images for tests.
+
+2005-09-21 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ListViewItemTest.cs: New unit test
+
+2005-09-20 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ButtonTest.cs, LabelTest.cs, ControlEventTest.cs, ScrollBarTest.cs,
+ LabelPropertyTest.cs, ProgressBarTest.cs, StatusBarTest.cs,
+ ImageListTest.cs, MonthCalendarTest.cs, ControlTest.cs,
+ ListBoxEventTest.cs, TreeViewTest.cs, TestImageIndexConverter.cs,
+ ToolBarTest.cs, MenuTest.cs
+
+ Remove all the tests that are giving errors. All of them should
+ be reviewed. Right now having this text throwing 40 errors do not
+ help at all to do regression testing. Peter has already assigned
+ a group of controls to every developer that will be tested and
+ reviewed.
+
+2005-09-20 Ritvik Mayank <mritvik@novell.com>
+
+ * PictureBoxTest.cs : Test case for PictureBox
+
+2005-09-08 Ritvik Mayank <mritvik@novell.com>
+
+ * MonthCalendarTest.cs : Test case for MonthCalendar
+
+2005-08-29 Ritvik Mayank <mritvik@novell.com>
+
+ * ProgressBarTest.cs : Test case for ProgressBar
+ * ToolBarTest.cs : Test case for ToolBar
+ * ToolTipTest.cs : Test case for ToolTip
+ * RichTextBoxTest.cs : Test case for RichTextBox
+
+2005-08-16 Martin Baulig <martin@ximian.com>
+
+ * ControlTest.cs: Renamed namespace `MWF.Test' -> `MWF.MonoTest'
+ to make it compile.
+
+2005-08-16 Ritvik Mayank <mritvik@novell.com>
+
+ * ScrollBarTest.cs, ImageListTest.cs, CheckedListBoxTest.cs, CheckedListBoxEventTest.cs, MenuTest.cs,
+ ListViewTest.cs: enhancement and cleanup
+
+2005-08-16 Ritvik Mayank <mritvik@novell.com>
+
+ * ImageListTest.cs : Test case for ImageList
+ * RadioButtonTest.cs : Test case for RadioButton
+ * ScrollBarTest.cs : Test case for ScrollBar
+ * StatusBatTest.cs : Test case for StatusBar
+
+2005-08-10 Ritvik Mayank <mritvik@novell.com>
+
+ * ControlTest.cs : Commented out test for GetChildAtPointSkip (feature not
+ yet implemented)
+
+2005-08-08 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * ComboBoxTest.cs: new tests for properties, exceptions, and colletions
+ * ListBoxTest.cs: new tests for properties, exceptions, and colletionss
+
+2005-08-06 Ritvik Mayank <mritvik@novell.com>
+
+ * ComboBoxTest.cs, ListBoxTest.cs : Cleanup, added few more tests
+
+2005-08-05 Ritvik Mayank <mritvik@novell.com>
+
+ * ButtonTest.cs, ImageListTest.cs, ControlEventTest.cs,
+ LabelPropertyTest.cs, CheckBoxTest.cs, ListBoxEventTest.cs,
+ CheckBoxEventTest.cs, CheckedListBoxTest.cs, TextBoxTest.cs,
+ CheckedListBoxEventTest.cs, FormTest.cs, MenuTest.cs,
+ FormEventTest.cs, GroupBoxTest.cs, ListViewTest.cs,
+ ListViewEventTest.cs :
+ Cleanup, Ignored tests which need manual intervention,
+ work still in progress.
+
+2005-08-05 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * DataGridTextBoxColumnTest.cs: test fixes and enhancements
+ * GridTableStylesCollectionTest.cs: test fixes and enhancements
+ * DataGridTest.cs: test fixes and enhancements
+ * DataGridCellTest.cs: New unit test
+ * GridColumnStylesCollectionTest.cs: test fixes and enhancements
+ * DataGridTableStyleTest.cs: test fixes and enhancements
+
+2005-08-04 Peter Dennis Bartok <pbartok@novell.com>
+
+ * ControlTest.cs: Cleanup, fixed commented out tests with syntax
+ errors, streamlined a few tests, added full tab order test, still
+ work in progress
+
+2005-08-02 Ritvik Mayank <mritvik@novell.com>
+
+ * FormTest.cs : Test case for Form
+ * GropBoxTest : Test case for GroupBox
+ * MenuTest.cs : Test case for Menu
+ * ImageListTest.cs : Test case for ImageList
+
+2005-07-26 Ritvik Mayank <mritvik@novell.com>
+
+ * ListViewTest.cs : Test case for ListView
+ * ListViewEventTest.cs : Test case for ListView events
+ * ComboBoxTest.cs : Test case for ComboBox
+ * FormEventTest.cs : Test case for Form events
+
+2005-07-12 Ritvik Mayank <mritvik@novell.com>
+
+ * CheckBoxTest.cs : Test case for CheckBox
+ * CheckBoxEventTest.cs : Test case for CheckBox events
+ * CheckedListBoxTest.cs : Test case for CheckedListBox
+ * CheckedListBoxEventTest.cs : Test case for CheckedListBox events
+
+2005-07-05 Jordi Mas i Hernandez <jordi@ximian.com>
+
+ * DataGridTextBoxColumnTest.cs: Test case
+ * GridTableStylesCollectionTest.cs: Test case
+ * DataGridTest.cs: Test case
+ * GridColumnStylesCollectionTest.cs: Test case
+ * DataGridTableStyleTest.cs: Test case
+
+
+2005-07-04 Ritvik Mayank <mritvik@novell.com>
+
+ * ListBoxTest.cs : Test Cases for ListBox Properties and Methods
+ * ListBoxEventTest.cs : Test Cases for ListBox Events
+
+2005-06-13 Ritvik Mayank <mritvik@novell.com>
+
+ * TextBoxTest.cs : Test Cases for TextBox
+ * BUttonTest.cs : Test Cases for Buttons
+
+2005-05-11 Ritvik Mayank <mritvik@novell.com>
+
+ * ControlEventTest.cs : Test Cases for Events
+
+2005-05-02 Ritvik Mayank <mritvik@novell.com>
+
+ * ControlTest.cs : Minor modifications
+
+2005-05-02 Ritvik Mayank <mritvik@novell.com>
+
+ * ControlTest.cs : Test for Control
+
+2005-04-25 Ritvik Mayank <mritvik@novell.com>
+ * LabelPropertyTest.cs : Test for Label
+
+2004-11-29 Marek Safar <marek.safar@seznam.cz>
+ * TreeViewTest.cs : Test for TreeView
+ * TreeNodeTest.cs : Test for TreeNode
+
+2004-11-29 Ravindra <rkumar@novell.com>
+ * ImageIndexConverter.cs : Test for ImageIndexConversion.
+
+
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/CheckBoxEventTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/CheckBoxEventTest.cs
new file mode 100644
index 00000000000..a81d3764894
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/CheckBoxEventTest.cs
@@ -0,0 +1,65 @@
+//
+// Copyright (c) 2005 Novell, Inc.
+//
+// Authors:
+// Ritvik Mayank (mritvik@novell.com)
+//
+
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ public class CheckBoxEventTest
+ {
+ static bool eventhandled = false;
+ public void CheckBox_EventHandler (object sender,EventArgs e)
+ {
+ eventhandled = true;
+ }
+
+ [Test]
+ public void ApperanceEventTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ CheckBox chkbox = new CheckBox ();
+ chkbox.Visible = true;
+ myform.Controls.Add (chkbox);
+ chkbox.AppearanceChanged += new EventHandler (CheckBox_EventHandler);
+ chkbox.Appearance = Appearance.Button;
+ Assert.AreEqual (true, eventhandled, "#A1");
+ }
+
+ [Test]
+ public void CheckedChangedEventTest ()
+ {
+ eventhandled = false;
+ Form myform = new Form ();
+ myform.Visible = true;
+ CheckBox chkbox = new CheckBox ();
+ chkbox.Visible = true;
+ myform.Controls.Add (chkbox);
+ chkbox.CheckedChanged += new EventHandler (CheckBox_EventHandler);
+ chkbox.CheckState = CheckState.Indeterminate;
+ Assert.AreEqual (true, eventhandled, "#A2");
+ }
+
+ [Test]
+ public void CheckStateChangedEventTest ()
+ {
+ eventhandled = false;
+ Form myform = new Form ();
+ myform.Visible = true;
+ CheckBox chkbox = new CheckBox ();
+ chkbox.Visible = true;
+ myform.Controls.Add (chkbox);
+ chkbox.CheckStateChanged += new EventHandler (CheckBox_EventHandler);
+ chkbox.CheckState = CheckState.Checked;
+ Assert.AreEqual (true, eventhandled, "#A3");
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/CheckBoxTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/CheckBoxTest.cs
new file mode 100644
index 00000000000..2fd428da8fb
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/CheckBoxTest.cs
@@ -0,0 +1,40 @@
+//
+// Copyright (c) 2005 Novell, Inc.
+//
+// Authors:
+// Ritvik Mayank (mritvik@novell.com)
+//
+
+using System;
+using System.Collections;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Reflection;
+using NUnit.Framework;
+using System.Threading;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ public class CheckBoxTest
+ {
+ [Test]
+ public void CheckBoxPropertyTest ()
+ {
+ Form myform = new Form ();
+ CheckBox mychkbox = new CheckBox();
+ myform.Controls.Add (mychkbox);
+ Assert.AreEqual (Appearance.Normal, mychkbox.Appearance, "#1");
+ mychkbox.Appearance = Appearance.Button;
+ Assert.AreEqual (Appearance.Button, mychkbox.Appearance, "#2");
+ Assert.AreEqual (true, mychkbox.AutoCheck, "#3");
+ mychkbox.AutoCheck = false;
+ Assert.AreEqual (false, mychkbox.AutoCheck, "#4");
+ Assert.AreEqual (false, mychkbox.Checked, "#5");
+ Assert.AreEqual (CheckState.Unchecked, mychkbox.CheckState, "#6");
+ Assert.AreEqual (ContentAlignment.MiddleLeft, mychkbox.CheckAlign, "#7");
+ Assert.AreEqual (ContentAlignment.MiddleLeft, mychkbox.TextAlign, "#8");
+ Assert.AreEqual (false, mychkbox.ThreeState, "#9");
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/CheckedListBoxEventTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/CheckedListBoxEventTest.cs
new file mode 100644
index 00000000000..8bd1fe0b0dc
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/CheckedListBoxEventTest.cs
@@ -0,0 +1,42 @@
+//
+// Copyright (c) 2005 Novell, Inc.
+//
+// Authors:
+// Ritvik Mayank (mritvik@novell.com)
+//
+
+using System;
+using NUnit.Framework;
+using System.Windows.Forms;
+using System.Drawing;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ public class CheckedListBoxItemCheckEvent
+ {
+ static bool eventhandled = false;
+ public void ItemCheck_EventHandler (object sender,ItemCheckEventArgs e)
+ {
+ eventhandled = true;
+ }
+
+ [Test]
+ public void ItemCheckTest ()
+ {
+ Form myform = new Form ();
+ CheckedListBox mychklstbox = new CheckedListBox ();
+ mychklstbox.Items.Add ("test1");
+ mychklstbox.Items.Add ("test2");
+ //Test ItemCheck Event
+ mychklstbox.ItemCheck += new ItemCheckEventHandler (ItemCheck_EventHandler);
+ mychklstbox.Items.Add ("test1",CheckState.Checked);
+ myform.Controls.Add (mychklstbox);
+ myform.Show ();
+ Assert.AreEqual (true, eventhandled, "#A1");
+ eventhandled = false;
+ mychklstbox.SetItemChecked (1,true);
+ Assert.AreEqual (true, eventhandled, "#A2");
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/CheckedListBoxTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/CheckedListBoxTest.cs
new file mode 100644
index 00000000000..f88b583d5ef
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/CheckedListBoxTest.cs
@@ -0,0 +1,133 @@
+//
+// Copyright (c) 2005 Novell, Inc.
+//
+// Authors:
+// Ritvik Mayank (mritvik@novell.com)
+//
+
+using System;
+using System.Collections;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Reflection;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ public class CheckedListBoxTest
+ {
+ [Test]
+ public void CheckedListBoxPropertyTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ CheckedListBox mychklistbox = new CheckedListBox ();
+ ArrayList checked_items = new ArrayList (2);
+ ArrayList checked_pos = new ArrayList (2);
+ mychklistbox.Items.Add ("test1", true);
+ checked_items.Add ("test1"); checked_pos.Add (0);
+ mychklistbox.Items.Add ("test2");
+ mychklistbox.Items.Add ("test3", true);
+ checked_items.Add ("test3"); checked_pos.Add (2);
+ mychklistbox.Visible = true;
+ myform.Controls.Add (mychklistbox);
+ Assert.AreEqual (checked_items.Count, mychklistbox.CheckedIndices.Count, "#1");
+ Assert.AreEqual (checked_items.Count, mychklistbox.CheckedItems.Count, "#2");
+ foreach (object o in mychklistbox.CheckedItems)
+ {
+ Assert.IsTrue (checked_items.Contains (o),"#3");
+ checked_items.Remove (o);
+ }
+
+ Assert.AreEqual (0, checked_items.Count);
+ for (int i = 0; i < mychklistbox.Items.Count; ++i)
+ {
+ if (checked_pos.Contains (i))
+ Assert.AreEqual (CheckState.Checked, mychklistbox.GetItemCheckState (i),"#4");
+ else
+ Assert.IsFalse (CheckState.Checked == mychklistbox.GetItemCheckState (i),"#5");
+ }
+ Assert.AreEqual (false, mychklistbox.CheckOnClick, "#6");
+ Assert.AreEqual (3, mychklistbox.Items.Count, "#7");
+ Assert.AreEqual (SelectionMode.One, mychklistbox.SelectionMode, "#8");
+ Assert.AreEqual (false , mychklistbox.ThreeDCheckBoxes, "#9");
+ }
+
+ [Test]
+ public void GetItemCheckedTest ()
+ {
+ Form f = new Form ();
+ f.Visible = true;
+ CheckedListBox mychklistbox = new CheckedListBox ();
+ mychklistbox.Items.Add ("test1",true);
+ mychklistbox.Items.Add ("test2",CheckState.Indeterminate);
+ mychklistbox.Items.Add ("test3");
+ mychklistbox.Visible = true;
+ f.Controls.Add (mychklistbox);
+ Assert.AreEqual (true, mychklistbox.GetItemChecked (0), "#10");
+ Assert.AreEqual (true, mychklistbox.GetItemChecked (1), "#11");
+ Assert.AreEqual (false, mychklistbox.GetItemChecked (2), "#12");
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentOutOfRangeException) )]
+ public void GetItemCheckedExceptionTest ()
+ {
+ CheckedListBox mychklistbox = new CheckedListBox ();
+ mychklistbox.Items.Add ("test1",true);
+ Assert.AreEqual (true, mychklistbox.GetItemChecked (1), "#13");
+ }
+
+ [Test]
+ public void GetItemCheckStateTest ()
+ {
+ Form f = new Form ();
+ f.Visible = true;
+ CheckedListBox mychklistbox = new CheckedListBox ();
+ mychklistbox.Items.Add ("test1",true);
+ mychklistbox.Items.Add ("test2",CheckState.Indeterminate);
+ mychklistbox.Items.Add ("test3");
+ mychklistbox.Visible = true;
+ f.Controls.Add (mychklistbox);
+ Assert.AreEqual (CheckState.Checked, mychklistbox.GetItemCheckState (0), "#14");
+ Assert.AreEqual (CheckState.Indeterminate, mychklistbox.GetItemCheckState (1), "#15");
+ Assert.AreEqual (CheckState.Unchecked, mychklistbox.GetItemCheckState (2), "#16");
+ }
+
+ [Test]
+ public void SetItemCheckedTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ CheckedListBox mychklistbox = new CheckedListBox ();
+ mychklistbox.Items.Add ("test1");
+ mychklistbox.Items.Add ("test2");
+ mychklistbox.Visible = true;
+ myform.Controls.Add (mychklistbox);
+ mychklistbox.SetItemChecked (0,true);
+ mychklistbox.SetItemChecked (1,false);
+ Assert.AreEqual (CheckState.Checked, mychklistbox.GetItemCheckState (0), "#17");
+ Assert.AreEqual (CheckState.Unchecked, mychklistbox.GetItemCheckState (1), "#18");
+ }
+
+ [Test]
+ public void SetItemCheckStateTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ CheckedListBox mychklistbox = new CheckedListBox ();
+ mychklistbox.Items.Add ("test1");
+ mychklistbox.Items.Add ("test2");
+ mychklistbox.Items.Add ("test3");
+ mychklistbox.Visible = true;
+ myform.Controls.Add (mychklistbox);
+ mychklistbox.SetItemCheckState (0,CheckState.Checked);
+ mychklistbox.SetItemCheckState (1,CheckState.Indeterminate);
+ mychklistbox.SetItemCheckState (2,CheckState.Unchecked);
+ Assert.AreEqual (CheckState.Checked, mychklistbox.GetItemCheckState (0), "#19");
+ Assert.AreEqual (CheckState.Indeterminate, mychklistbox.GetItemCheckState (1), "#20");
+ Assert.AreEqual (CheckState.Unchecked, mychklistbox.GetItemCheckState (2), "#21");
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ComboBoxTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ComboBoxTest.cs
new file mode 100644
index 00000000000..67765f281d6
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ComboBoxTest.cs
@@ -0,0 +1,326 @@
+//
+// ComboBoxTest.cs: Test cases for ComboBox.
+//
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Ritvik Mayank <mritvik@novell.com>
+// Jordi Mas i Hernandez <jordi@ximian.com>
+
+
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Reflection;
+using NUnit.Framework;
+using System.Collections;
+using System.ComponentModel;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ public class ComboBoxTest
+ {
+ [Test]
+ public void ComboBoxPropertyTest ()
+ {
+ ComboBox mycmbbox = new ComboBox ();
+ Assert.AreEqual (DrawMode.Normal, mycmbbox.DrawMode, "#1");
+ Assert.AreEqual (ComboBoxStyle.DropDown, mycmbbox.DropDownStyle, "#2");
+ Assert.AreEqual (121, mycmbbox.DropDownWidth, "#3");
+ Assert.AreEqual (false, mycmbbox.DroppedDown, "#4");
+ Assert.AreEqual (true, mycmbbox.IntegralHeight, "#5");
+ Assert.AreEqual (0, mycmbbox.Items.Count, "#6");
+ //Assert.AreEqual (15, mycmbbox.ItemHeight, "#7"); // Note: Item height depends on the current font.
+ Assert.AreEqual (8, mycmbbox.MaxDropDownItems, "#8");
+ Assert.AreEqual (0, mycmbbox.MaxLength, "#9");
+ Assert.AreEqual (20, mycmbbox.PreferredHeight, "#10");
+ Assert.AreEqual (-1, mycmbbox.SelectedIndex, "#11");
+ Assert.AreEqual (null, mycmbbox.SelectedItem, "#12");
+ Assert.AreEqual ("", mycmbbox.SelectedText, "#13");
+ Assert.AreEqual (0, mycmbbox.SelectionLength, "#14");
+ Assert.AreEqual (0, mycmbbox.SelectionStart, "#15");
+ Assert.AreEqual (false, mycmbbox.Sorted, "#16");
+ Assert.AreEqual ("", mycmbbox.Text, "#17");
+ }
+
+ [Test]
+ public void BeginEndUpdateTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ ComboBox cmbbox = new ComboBox ();
+ cmbbox.Items.Add ("A");
+ cmbbox.Visible = true;
+ myform.Controls.Add (cmbbox);
+ cmbbox.BeginUpdate ();
+ for (int x = 1 ; x < 5000 ; x++) {
+ cmbbox.Items.Add ("Item " + x.ToString ());
+ }
+ cmbbox.EndUpdate ();
+ }
+
+ [Test]
+ public void FindStringTest ()
+ {
+ ComboBox cmbbox = new ComboBox ();
+ cmbbox.FindString ("Hola", -5); // No exception, it's empty
+ int x = cmbbox.FindString ("Hello");
+ Assert.AreEqual (-1, x, "#19");
+ cmbbox.Items.AddRange(new object[] {"ACBD", "ABDC", "ACBD", "ABCD"});
+ String myString = "ABC";
+ x = cmbbox.FindString (myString);
+ Assert.AreEqual (3, x, "#191");
+ x = cmbbox.FindString (string.Empty);
+ Assert.AreEqual (0, x, "#192");
+ x = cmbbox.FindString ("NonExistant");
+ Assert.AreEqual (-1, x, "#193");
+ }
+
+ [Test]
+ public void FindStringExactTest ()
+ {
+ ComboBox cmbbox = new ComboBox ();
+ cmbbox.FindStringExact ("Hola", -5); // No exception, it's empty
+ int x = cmbbox.FindStringExact ("Hello");
+ Assert.AreEqual (-1, x, "#20");
+ cmbbox.Items.AddRange (new object[] {"ABCD","ABC","ABDC"});
+ String myString = "ABC";
+ x = cmbbox.FindStringExact (myString);
+ Assert.AreEqual (1, x, "#201");
+ x = cmbbox.FindStringExact (string.Empty);
+ Assert.AreEqual (-1, x, "#202");
+ x = cmbbox.FindStringExact ("NonExistant");
+ Assert.AreEqual (-1, x, "#203");
+ }
+
+ [Test]
+ public void GetItemHeightTest ()
+ {
+ ComboBox cmbbox = new ComboBox ();
+ cmbbox.Items.Add ("ABC");
+ cmbbox.Items.Add ("BCD");
+ cmbbox.Items.Add ("DEF");
+ int x = -1;
+ x = cmbbox.GetItemHeight (x);
+ Assert.IsTrue (cmbbox.ItemHeight > 0, "#21");
+ }
+
+
+ //
+ // Exceptions
+ //
+
+ [Test]
+ [ExpectedException (typeof (InvalidEnumArgumentException))]
+ public void DropDownStyleException ()
+ {
+ ComboBox cmbbox = new ComboBox ();
+ cmbbox.DropDownStyle = (ComboBoxStyle) 10;
+ }
+
+ [Test]
+ [ExpectedException (typeof (InvalidEnumArgumentException))]
+ public void DrawModeException ()
+ {
+ ComboBox cmbbox = new ComboBox ();
+ cmbbox.DrawMode = (DrawMode) 10;
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void DropDownWidthException ()
+ {
+ ComboBox cmbbox = new ComboBox ();
+ cmbbox.DropDownWidth = 0;
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void ItemHeightException ()
+ {
+ ComboBox cmbbox = new ComboBox ();
+ cmbbox.ItemHeight = -1;
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentOutOfRangeException))]
+ public void SelectedIndexException ()
+ {
+ ComboBox cmbbox = new ComboBox ();
+ cmbbox.SelectedIndex = -2;
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentOutOfRangeException))]
+ public void FindStringExactMinException ()
+ {
+ ComboBox cmbbox = new ComboBox ();
+ cmbbox.Items.AddRange(new object[] {"ACBD", "ABDC", "ACBD", "ABCD"});
+ cmbbox.FindStringExact ("Hola", -2);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentOutOfRangeException))]
+ public void FindStringExactMaxException ()
+ {
+ ComboBox cmbbox = new ComboBox ();
+ cmbbox.Items.AddRange(new object[] {"ACBD", "ABDC", "ACBD", "ABCD"});
+ cmbbox.FindStringExact ("Hola", 3);
+ }
+
+ //
+ // Events
+ //
+ private bool eventFired;
+ private DrawItemEventArgs drawItemsArgs;
+ private void DrawItemEventH (object sender, DrawItemEventArgs e)
+ {
+ eventFired = true;
+ drawItemsArgs = e;
+ }
+
+ private void GenericHandler (object sender, EventArgs e)
+ {
+ eventFired = true;
+ }
+
+ [Ignore ("Bugs in X11 prevent this test to run properly")]
+ public void DrawItemEventTest ()
+ {
+ eventFired = false;
+ drawItemsArgs = null;
+ Form myform = new Form ();
+ ComboBox cmbbox = new ComboBox ();
+ cmbbox.DropDownStyle = ComboBoxStyle.Simple;
+ cmbbox.DrawMode = DrawMode.OwnerDrawFixed;
+ cmbbox.DrawItem += new DrawItemEventHandler (DrawItemEventH);
+
+ myform.Controls.Add (cmbbox);
+ cmbbox.Items.AddRange(new object[] {"Item1"});
+
+ myform.Visible = true;
+ cmbbox.Visible = true;
+ cmbbox.Refresh ();
+
+ Assert.AreEqual (true, eventFired, "DW1");
+ Assert.AreEqual (0, drawItemsArgs.Index, "DW2");
+ }
+
+ [Test]
+ public void DropDownStyleEventTest ()
+ {
+ eventFired = false;
+ ComboBox cmbbox = new ComboBox ();
+ cmbbox.DropDownStyleChanged += new EventHandler (GenericHandler);
+ cmbbox.DropDownStyle = ComboBoxStyle.Simple;
+
+ Assert.AreEqual (true, eventFired, "DI1");
+ }
+
+ [Test]
+ public void SelectedIndextTest ()
+ {
+ eventFired = false;
+ ComboBox cmbbox = new ComboBox ();
+ cmbbox.Items.AddRange(new object[] {"Item1", "Item2"});
+ cmbbox.SelectedIndexChanged += new EventHandler (GenericHandler);
+ cmbbox.SelectedIndex = 1;
+ Assert.AreEqual (true, eventFired, "SI1");
+ }
+
+ }
+
+ [TestFixture]
+ public class ComboBoxObjectCollectionTest
+ {
+ [Test]
+ public void ComboBoxObjectCollectionPropertyTest ()
+ {
+ ComboBox.ObjectCollection col = new ComboBox.ObjectCollection (new ComboBox ());
+ Assert.AreEqual (false, col.IsReadOnly, "#B1");
+ Assert.AreEqual (false, ((ICollection)col).IsSynchronized, "#B2");
+ Assert.AreEqual (col, ((ICollection)col).SyncRoot, "#B3");
+ Assert.AreEqual (false, ((IList)col).IsFixedSize, "#B4");
+ }
+
+ [Test]
+ public void AddTest ()
+ {
+ ComboBox.ObjectCollection col = new ComboBox.ObjectCollection (new ComboBox ());
+ col.Add ("Item1");
+ col.Add ("Item2");
+ Assert.AreEqual (2, col.Count, "#C1");
+ }
+
+ [Test]
+ public void ClearTest ()
+ {
+ ComboBox.ObjectCollection col = new ComboBox.ObjectCollection (new ComboBox ());
+ col.Add ("Item1");
+ col.Add ("Item2");
+ col.Clear ();
+ Assert.AreEqual (0, col.Count, "#D1");
+ }
+
+ [Test]
+ public void ContainsTest ()
+ {
+ ComboBox.ObjectCollection col = new ComboBox.ObjectCollection (new ComboBox ());
+ object obj = "Item1";
+ col.Add (obj);
+ Assert.AreEqual (true, col.Contains ("Item1"), "#E1");
+ Assert.AreEqual (false, col.Contains ("Item2"), "#E2");
+ }
+
+ [Test]
+ public void IndexOfTest ()
+ {
+ ComboBox.ObjectCollection col = new ComboBox.ObjectCollection (new ComboBox ());
+ col.Add ("Item1");
+ col.Add ("Item2");
+ Assert.AreEqual (1, col.IndexOf ("Item2"), "#F1");
+ }
+
+ [Test]
+ public void RemoveTest ()
+ {
+ ComboBox.ObjectCollection col = new ComboBox.ObjectCollection (new ComboBox ());
+ col.Add ("Item1");
+ col.Add ("Item2");
+ col.Remove ("Item1");
+ Assert.AreEqual (1, col.Count, "#G1");
+ }
+
+ [Test]
+ public void RemoveAtTest ()
+ {
+ ComboBox.ObjectCollection col = new ComboBox.ObjectCollection (new ComboBox ());
+ col.Add ("Item1");
+ col.Add ("Item2");
+ col.RemoveAt (0);
+ Assert.AreEqual (1, col.Count, "#H1");
+ Assert.AreEqual (true, col.Contains ("Item2"), "#H1");
+ }
+ }
+
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/Common.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/Common.cs
new file mode 100644
index 00000000000..d02e9424b36
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/Common.cs
@@ -0,0 +1,251 @@
+using System;
+using NUnit.Framework;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Collections;
+
+namespace MonoTests.System.Windows.Forms
+{
+ internal enum WndMsg {
+ WM_NULL = 0x0000,
+ WM_CREATE = 0x0001,
+ WM_DESTROY = 0x0002,
+ WM_MOVE = 0x0003,
+ WM_SIZE = 0x0005,
+ WM_ACTIVATE = 0x0006,
+ WM_SETFOCUS = 0x0007,
+ WM_KILLFOCUS = 0x0008,
+ //public const uint WM_SETVISIBLE = 0x0009;
+ WM_ENABLE = 0x000A,
+ WM_SETREDRAW = 0x000B,
+ WM_SETTEXT = 0x000C,
+ WM_GETTEXT = 0x000D,
+ WM_GETTEXTLENGTH = 0x000E,
+ WM_PAINT = 0x000F,
+ WM_CLOSE = 0x0010,
+ WM_QUERYENDSESSION = 0x0011,
+ WM_QUIT = 0x0012,
+ WM_QUERYOPEN = 0x0013,
+ WM_ERASEBKGND = 0x0014,
+ WM_SYSCOLORCHANGE = 0x0015,
+ WM_ENDSESSION = 0x0016,
+ //public const uint WM_SYSTEMERROR = 0x0017;
+ WM_SHOWWINDOW = 0x0018,
+ WM_CTLCOLOR = 0x0019,
+ WM_WININICHANGE = 0x001A,
+ WM_SETTINGCHANGE = 0x001A,
+ WM_DEVMODECHANGE = 0x001B,
+ WM_ACTIVATEAPP = 0x001C,
+ WM_FONTCHANGE = 0x001D,
+ WM_TIMECHANGE = 0x001E,
+ WM_CANCELMODE = 0x001F,
+ WM_SETCURSOR = 0x0020,
+ WM_MOUSEACTIVATE = 0x0021,
+ WM_CHILDACTIVATE = 0x0022,
+ WM_QUEUESYNC = 0x0023,
+ WM_GETMINMAXINFO = 0x0024,
+ WM_PAINTICON = 0x0026,
+ WM_ICONERASEBKGND = 0x0027,
+ WM_NEXTDLGCTL = 0x0028,
+ //public const uint WM_ALTTABACTIVE = 0x0029;
+ WM_SPOOLERSTATUS = 0x002A,
+ WM_DRAWITEM = 0x002B,
+ WM_MEASUREITEM = 0x002C,
+ WM_DELETEITEM = 0x002D,
+ WM_VKEYTOITEM = 0x002E,
+ WM_CHARTOITEM = 0x002F,
+ WM_SETFONT = 0x0030,
+ WM_GETFONT = 0x0031,
+ WM_SETHOTKEY = 0x0032,
+ WM_GETHOTKEY = 0x0033,
+ //public const uint WM_FILESYSCHANGE = 0x0034;
+ //public const uint WM_ISACTIVEICON = 0x0035;
+ //public const uint WM_QUERYPARKICON = 0x0036;
+ WM_QUERYDRAGICON = 0x0037,
+ WM_COMPAREITEM = 0x0039,
+ //public const uint WM_TESTING = 0x003a;
+ //public const uint WM_OTHERWINDOWCREATED = 0x003c;
+ WM_GETOBJECT = 0x003D,
+ //public const uint WM_ACTIVATESHELLWINDOW = 0x003e;
+ WM_COMPACTING = 0x0041,
+ WM_COMMNOTIFY = 0x0044 ,
+ WM_WINDOWPOSCHANGING = 0x0046,
+ WM_WINDOWPOSCHANGED = 0x0047,
+ WM_POWER = 0x0048,
+ WM_COPYDATA = 0x004A,
+ WM_CANCELJOURNAL = 0x004B,
+ WM_NOTIFY = 0x004E,
+ WM_INPUTLANGCHANGEREQUEST = 0x0050,
+ WM_INPUTLANGCHANGE = 0x0051,
+ WM_TCARD = 0x0052,
+ WM_HELP = 0x0053,
+ WM_USERCHANGED = 0x0054,
+ WM_NOTIFYFORMAT = 0x0055,
+ WM_CONTEXTMENU = 0x007B,
+ WM_STYLECHANGING = 0x007C,
+ WM_STYLECHANGED = 0x007D,
+ WM_DISPLAYCHANGE = 0x007E,
+ WM_GETICON = 0x007F,
+
+ // Non-Client messages
+ WM_SETICON = 0x0080,
+ WM_NCCREATE = 0x0081,
+ WM_NCDESTROY = 0x0082,
+ WM_NCCALCSIZE = 0x0083,
+ WM_NCHITTEST = 0x0084,
+ WM_NCPAINT = 0x0085,
+ WM_NCACTIVATE = 0x0086,
+ WM_GETDLGCODE = 0x0087,
+ WM_SYNCPAINT = 0x0088,
+ //public const uint WM_SYNCTASK = 0x0089;
+ WM_NCMOUSEMOVE = 0x00A0,
+ WM_NCLBUTTONDOWN = 0x00A1,
+ WM_NCLBUTTONUP = 0x00A2,
+ WM_NCLBUTTONDBLCLK = 0x00A3,
+ WM_NCRBUTTONDOWN = 0x00A4,
+ WM_NCRBUTTONUP = 0x00A5,
+ WM_NCRBUTTONDBLCLK = 0x00A6,
+ WM_NCMBUTTONDOWN = 0x00A7,
+ WM_NCMBUTTONUP = 0x00A8,
+ WM_NCMBUTTONDBLCLK = 0x00A9,
+ //public const uint WM_NCXBUTTONDOWN = 0x00ab;
+ //public const uint WM_NCXBUTTONUP = 0x00ac;
+ //public const uint WM_NCXBUTTONDBLCLK = 0x00ad;
+ WM_KEYDOWN = 0x0100,
+ WM_KEYFIRST = 0x0100,
+ WM_KEYUP = 0x0101,
+ WM_CHAR = 0x0102,
+ WM_DEADCHAR = 0x0103,
+ WM_SYSKEYDOWN = 0x0104,
+ WM_SYSKEYUP = 0x0105,
+ WM_SYSCHAR = 0x0106,
+ WM_SYSDEADCHAR = 0x0107,
+ WM_KEYLAST = 0x0108,
+ WM_IME_STARTCOMPOSITION = 0x010D,
+ WM_IME_ENDCOMPOSITION = 0x010E,
+ WM_IME_COMPOSITION = 0x010F,
+ WM_IME_KEYLAST = 0x010F,
+ WM_INITDIALOG = 0x0110,
+ WM_COMMAND = 0x0111,
+ WM_SYSCOMMAND = 0x0112,
+ WM_TIMER = 0x0113,
+ WM_HSCROLL = 0x0114,
+ WM_VSCROLL = 0x0115,
+ WM_INITMENU = 0x0116,
+ WM_INITMENUPOPUP = 0x0117,
+ //public const uint WM_SYSTIMER = 0x0118;
+ WM_MENUSELECT = 0x011F,
+ WM_MENUCHAR = 0x0120,
+ WM_ENTERIDLE = 0x0121,
+ WM_MENURBUTTONUP = 0x0122,
+ WM_MENUDRAG = 0x0123,
+ WM_MENUGETOBJECT = 0x0124,
+ WM_UNINITMENUPOPUP = 0x0125,
+ WM_MENUCOMMAND = 0x0126,
+ //public const uint WM_CHANGEUISTATE = 0x0127;
+ //public const uint WM_UPDATEUISTATE = 0x0128;
+ //public const uint WM_QUERYUISTATE = 0x0129;
+ //
+ //public const uint WM_LBTRACKPOINT = 0x0131;
+ WM_CTLCOLORMSGBOX = 0x0132,
+ WM_CTLCOLOREDIT = 0x0133,
+ WM_CTLCOLORLISTBOX = 0x0134,
+ WM_CTLCOLORBTN = 0x0135,
+ WM_CTLCOLORDLG = 0x0136,
+ WM_CTLCOLORSCROLLBAR = 0x0137,
+ WM_CTLCOLORSTATIC = 0x0138,
+ WM_MOUSEMOVE = 0x0200,
+ WM_MOUSEFIRST = 0x0200,
+ WM_LBUTTONDOWN = 0x0201,
+ WM_LBUTTONUP = 0x0202,
+ WM_LBUTTONDBLCLK = 0x0203,
+ WM_RBUTTONDOWN = 0x0204,
+ WM_RBUTTONUP = 0x0205,
+ WM_RBUTTONDBLCLK = 0x0206,
+ WM_MBUTTONDOWN = 0x0207,
+ WM_MBUTTONUP = 0x0208,
+ WM_MBUTTONDBLCLK = 0x0209,
+ WM_MOUSEWHEEL = 0x020A,
+ WM_MOUSELAST = 0x020D,
+ //public const uint WM_XBUTTONDOWN = 0x020B;
+ //public const uint WM_XBUTTONUP = 0x020C;
+ //public const uint WM_XBUTTONDBLCLK = 0x020D;
+ WM_PARENTNOTIFY = 0x0210,
+ WM_ENTERMENULOOP = 0x0211,
+ WM_EXITMENULOOP = 0x0212,
+ WM_NEXTMENU = 0x0213,
+ WM_SIZING = 0x0214,
+ WM_CAPTURECHANGED = 0x0215,
+ WM_MOVING = 0x0216,
+ //public const uint WM_POWERBROADCAST = 0x0218;
+ WM_DEVICECHANGE = 0x0219,
+ WM_MDICREATE = 0x0220,
+ WM_MDIDESTROY = 0x0221,
+ WM_MDIACTIVATE = 0x0222,
+ WM_MDIRESTORE = 0x0223,
+ WM_MDINEXT = 0x0224,
+ WM_MDIMAXIMIZE = 0x0225,
+ WM_MDITILE = 0x0226,
+ WM_MDICASCADE = 0x0227,
+ WM_MDIICONARRANGE = 0x0228,
+ WM_MDIGETACTIVE = 0x0229,
+ /* D&D messages */
+ //public const uint WM_DROPOBJECT = 0x022A;
+ //public const uint WM_QUERYDROPOBJECT = 0x022B;
+ //public const uint WM_BEGINDRAG = 0x022C;
+ //public const uint WM_DRAGLOOP = 0x022D;
+ //public const uint WM_DRAGSELECT = 0x022E;
+ //public const uint WM_DRAGMOVE = 0x022F;
+ WM_MDISETMENU = 0x0230,
+ WM_ENTERSIZEMOVE = 0x0231,
+ WM_EXITSIZEMOVE = 0x0232,
+ WM_DROPFILES = 0x0233,
+ WM_MDIREFRESHMENU = 0x0234,
+ WM_IME_SETCONTEXT = 0x0281,
+ WM_IME_NOTIFY = 0x0282,
+ WM_IME_CONTROL = 0x0283,
+ WM_IME_COMPOSITIONFULL = 0x0284,
+ WM_IME_SELECT = 0x0285,
+ WM_IME_CHAR = 0x0286,
+ WM_IME_REQUEST = 0x0288,
+ WM_IME_KEYDOWN = 0x0290,
+ WM_IME_KEYUP = 0x0291,
+ WM_MOUSEHOVER = 0x02A1,
+ WM_MOUSELEAVE = 0x02A3,
+ WM_CUT = 0x0300,
+ WM_COPY = 0x0301,
+ WM_PASTE = 0x0302,
+ WM_CLEAR = 0x0303,
+ WM_UNDO = 0x0304,
+ WM_RENDERFORMAT = 0x0305,
+ WM_RENDERALLFORMATS = 0x0306,
+ WM_DESTROYCLIPBOARD = 0x0307,
+ WM_DRAWCLIPBOARD = 0x0308,
+ WM_PAINTCLIPBOARD = 0x0309,
+ WM_VSCROLLCLIPBOARD = 0x030A,
+ WM_SIZECLIPBOARD = 0x030B,
+ WM_ASKCBFORMATNAME = 0x030C,
+ WM_CHANGECBCHAIN = 0x030D,
+ WM_HSCROLLCLIPBOARD = 0x030E,
+ WM_QUERYNEWPALETTE = 0x030F,
+ WM_PALETTEISCHANGING = 0x0310,
+ WM_PALETTECHANGED = 0x0311,
+ WM_HOTKEY = 0x0312,
+ WM_PRINT = 0x0317,
+ WM_PRINTCLIENT = 0x0318,
+ WM_HANDHELDFIRST = 0x0358,
+ WM_HANDHELDLAST = 0x035F,
+ WM_AFXFIRST = 0x0360,
+ WM_AFXLAST = 0x037F,
+ WM_PENWINFIRST = 0x0380,
+ WM_PENWINLAST = 0x038F,
+ WM_APP = 0x8000,
+ WM_USER = 0x0400,
+
+ // Our "private" ones
+ WM_MOUSE_ENTER = 0x0401,
+ WM_MOUSE_LEAVE = 0x0402,
+ WM_ASYNC_MESSAGE = 0x0403,
+ WM_REFLECT = WM_USER + 0x1c00
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ControlEventTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ControlEventTest.cs
new file mode 100644
index 00000000000..e44734c03d3
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ControlEventTest.cs
@@ -0,0 +1,300 @@
+
+using System;
+using NUnit.Framework;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Threading;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ [Ignore ("This test has to be completly reviewed")]
+ public class EventClass
+ {
+ static bool eventhandled = false;
+ public static void Event_Handler1 (object sender, EventArgs e)
+ {
+ eventhandled = true;
+ }
+
+ [Test]
+ public void BackColorChangedTest ()
+ {
+ Control c = new Control ();
+ // Test BackColorChanged Event
+ c.BackColorChanged += new EventHandler (Event_Handler1);
+ c.BackColor = Color.Black;
+ Assert.AreEqual (true, eventhandled, "#A1");
+
+ }
+
+ [Test]
+ public void BgrndImageChangedTest ()
+ {
+ Control c = new Control ();
+ // Test BackgroundImageChanged Event
+ c.BackgroundImageChanged += new EventHandler (Event_Handler1);
+ string abc = "M.gif";
+ eventhandled = false;
+ c.BackgroundImage = Image.FromFile (abc);
+ Assert.AreEqual (true, eventhandled, "#A2");
+ }
+
+ [Test]
+ public void BindingContextChangedTest ()
+ {
+ Control c = new Control ();
+ // Test BindingContextChanged Event
+ c.BindingContextChanged += new EventHandler (Event_Handler1);
+ BindingContext bcG1 = new BindingContext ();
+ eventhandled = false;
+ c.BindingContext = bcG1;
+ Assert.AreEqual (true, eventhandled, "#A3");
+
+ }
+
+ [Test]
+ public void CausesValidationChangedTest ()
+ {
+ Control c = new Control ();
+ // Test CausesValidationChanged Event
+ c.CausesValidationChanged += new EventHandler (Event_Handler1);
+ eventhandled = false;
+ c.CausesValidation = false;
+ Assert.AreEqual (true, eventhandled, "#A4");
+
+ }
+
+ [Test]
+ public void CursorChangedTest ()
+ {
+ Control c = new Control ();
+ // Test CursorChanged Event
+ c.CursorChanged += new EventHandler (Event_Handler1);
+ eventhandled = false;
+ c.Cursor = Cursors.Hand;
+ Assert.AreEqual (true, eventhandled, "#A6");
+ }
+
+ [Test]
+ public void DisposedTest ()
+ {
+ Control c = new Control ();
+ // Test Disposed Event
+ c.Disposed += new EventHandler (Event_Handler1);
+ eventhandled = false;
+ c.Dispose ();
+ Assert.AreEqual (true, eventhandled, "#A7");
+ }
+
+ [Test]
+ public void DockChangedTest ()
+ {
+ Control c = new Control ();
+ // Test DockChanged Event
+ c.DockChanged += new EventHandler (Event_Handler1);
+ eventhandled = false;
+ c.Dock = DockStyle.Bottom;
+ Assert.AreEqual (true, eventhandled, "#A8");
+ }
+
+ [Test]
+ public void EnabledChangedTest ()
+ {
+ Control c = new Control ();
+ // Test EnabledChanged Event
+ c.EnabledChanged += new EventHandler (Event_Handler1);
+ eventhandled = false;
+ c.Enabled = false;
+ Assert.AreEqual (true, eventhandled, "#A9");
+ }
+
+ [Test]
+ public void FontChangedTest ()
+ {
+ Control c = new Control ();
+ // Test FontChanged Event
+ c.FontChanged += new EventHandler (Event_Handler1);
+ eventhandled = false;
+ c.Font = new Font (c.Font, FontStyle.Bold);
+ Assert.AreEqual (true, eventhandled, "#A11");
+ }
+
+ [Test]
+ public void ForeColorChangedTest ()
+ {
+ Control c = new Control ();
+ // Test ForeColorChanged Event
+ c.ForeColorChanged += new EventHandler (Event_Handler1);
+ eventhandled = false;
+ c.ForeColor = Color.Red;
+ Assert.AreEqual (true, eventhandled, "#A12");
+ }
+
+ [Test]
+ public void HandleCreatedTest ()
+ {
+ Control c = new Control ();
+ // Test HandleCreated Event
+ c.HandleCreated += new EventHandler (Event_Handler1);
+ eventhandled = false;
+ c.Handle.GetType ();
+ Assert.AreEqual (true, eventhandled, "#A15");
+ }
+
+ [Test]
+ public void ImeModeChangedTest ()
+ {
+ Control c = new Control ();
+ // Test ImeModeChanged Event
+ c.ImeModeChanged += new EventHandler (Event_Handler1);
+ eventhandled = false;
+ c.ImeMode = ImeMode.Off;
+ Assert.AreEqual (true, eventhandled, "#A19");
+ }
+
+ [Test]
+ public void LocationChangedTest ()
+ {
+ Control c = new Control ();
+ // Test LocationChanged Event
+ c.LocationChanged += new EventHandler (Event_Handler1);
+ eventhandled = false;
+ c.Left = 20;
+ Assert.AreEqual (true, eventhandled, "#A20");
+ }
+
+ [Test]
+ public void ResizeTest ()
+ {
+ Control c = new Control ();
+ // Test Resize Event
+ c.Resize += new EventHandler (Event_Handler1);
+ eventhandled = false;
+ c.Height = 20;
+ Assert.AreEqual (true, eventhandled, "#A22");
+ }
+
+ [Test]
+ public void RightToLeftChangedTest ()
+ {
+ Control c = new Control ();
+ // Test RightToLeftChanged Event
+ c.RightToLeftChanged += new EventHandler (Event_Handler1);
+ eventhandled = false;
+ c.RightToLeft = RightToLeft.Yes;
+ Assert.AreEqual (true, eventhandled, "#A23");
+ }
+
+ [Test]
+ public void SizeChangedTest ()
+ {
+ Control c = new Control ();
+ // Test SizeChanged Event
+ c.SizeChanged += new EventHandler (Event_Handler1);
+ eventhandled = false;
+ c.Height = 80;
+ Assert.AreEqual (true, eventhandled, "#A24");
+ }
+
+ [Test]
+ public void TabIndexChangedTest ()
+ {
+ Control c = new Control ();
+ // Test TabIndexChanged Event
+ c.TabIndexChanged += new EventHandler (Event_Handler1);
+ eventhandled = false;
+ c.TabIndex = 1;
+ Assert.AreEqual (true, eventhandled, "#A27");
+ }
+
+ [Test]
+ public void TabStopChangedTest ()
+ {
+ Control c = new Control ();
+ // Test TabStopChanged Event
+ c.TabStopChanged += new EventHandler (Event_Handler1);
+ eventhandled = false;
+ c.TabStop = false;
+ Assert.AreEqual (true, eventhandled, "#A28");
+ }
+
+ [Test]
+ public void TextChangedTest ()
+ {
+ Control c = new Control ();
+ // Test TextChanged Event
+ c.TextChanged += new EventHandler (Event_Handler1);
+ eventhandled = false;
+ c.Text = "some Text";
+ Assert.AreEqual (true, eventhandled, "#A29");
+ }
+
+ [Test]
+ public void VisibleChangedTest ()
+ {
+ Control c = new Control ();
+ // Test VisibleChanged Event
+ c.VisibleChanged += new EventHandler (Event_Handler1);
+ eventhandled = false;
+ c.Visible = false;
+ Assert.AreEqual (true, eventhandled, "#A30");
+ }
+ }
+
+
+ [TestFixture]
+ public class LayoutEventClass
+ {
+ static bool eventhandled = false;
+ public static void LayoutEvent (object sender, LayoutEventArgs e)
+ {
+ eventhandled = true;
+ }
+
+ [Test]
+ public void LayoutTest ()
+ {
+ Control c = new Control ();
+ c.Layout += new LayoutEventHandler (LayoutEvent);
+ eventhandled = false;
+ c.Visible = true;
+ c.Height = 100;
+ Assert.AreEqual (true, eventhandled, "#D1");
+
+ }
+ }
+
+ [TestFixture]
+ public class ControlAddRemoveEventClass
+ {
+ static bool eventhandled = false;
+ public static void ControlEvent (object sender, ControlEventArgs e)
+ {
+ eventhandled = true;
+ }
+
+ [Test]
+ public void ControlAddedTest ()
+ {
+ Control c = new Control ();
+ c.ControlAdded += new ControlEventHandler (ControlEvent);
+ TextBox TB = new TextBox ();
+ eventhandled = false;
+ c.Controls.Add (TB);
+ Assert.AreEqual (true, eventhandled, "#F1");
+ }
+
+ [Test]
+ public void ControlRemovedTest ()
+ {
+ Control c = new Control ();
+ c.ControlRemoved += new ControlEventHandler (ControlEvent);
+ TextBox TB = new TextBox ();
+ c.Controls.Add (TB);
+ eventhandled = false;
+ c.Controls.Remove (TB);
+ Assert.AreEqual (true, eventhandled, "#F2");
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ControlPaintTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ControlPaintTest.cs
new file mode 100644
index 00000000000..f1bca95c8f7
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ControlPaintTest.cs
@@ -0,0 +1,150 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Jordi Mas i Hernandez <jordi@ximian.com>
+//
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Drawing;
+using System.Windows.Forms;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Forms
+{
+
+ [TestFixture]
+ class ControlPaintTest
+ {
+ [Test]
+ public void DarkTest ()
+ {
+ Color color;
+
+ // Non control colours
+ color = Color.FromArgb (255, 100, 0, 50);
+ color = ControlPaint.Dark (color);
+ Assert.AreEqual (255, color.A, "testdark#1A");
+ Assert.AreEqual (34, color.R, "testdark#1R");
+ Assert.AreEqual (0, color.G, "testdark#1G");
+ Assert.AreEqual (17, color.B, "testdark#1B");
+
+ color = Color.FromArgb (255, 40, 50, 60);
+ color = ControlPaint.Dark (color);
+ Assert.AreEqual (255, color.A, "testdark#2A");
+ Assert.AreEqual (14, color.R, "testdark#2R");
+ Assert.AreEqual (17, color.G, "testdark#2G");
+ Assert.AreEqual (20, color.B, "testdark#2B");
+
+ // Non-control colours using a specific percentage
+ color = Color.FromArgb (255, 20, 50, 40);
+ color = ControlPaint.Dark (color, 0.8f);
+ Assert.AreEqual (255, color.A, "testdark#3A");
+ Assert.AreEqual (3, color.R, "testdark#3R");
+ Assert.AreEqual (7, color.G, "testdark#3G");
+ Assert.AreEqual (6, color.B, "testdark#3B");
+
+ color = Color.FromArgb (255, 100, 0, 50);
+ color = ControlPaint.Dark (color, 0.6f);
+ Assert.AreEqual (255, color.A, "testdark#4A");
+ Assert.AreEqual (28, color.R, "testdark#4R");
+ Assert.AreEqual (0, color.G, "testdark#4G");
+ Assert.AreEqual (14, color.B, "testdark#4B");
+
+ // Fixed Control colours
+ color = Color.FromKnownColor (KnownColor.Control);
+ color = ControlPaint.Dark (color, 1f);
+ Assert.AreEqual (Color.FromKnownColor (KnownColor.ControlDarkDark), color, "testdark#5");
+
+ color = Color.FromKnownColor (KnownColor.Control);
+ color = ControlPaint.Dark (color, 0f);
+ Assert.AreEqual (Color.FromKnownColor (KnownColor.ControlDark), color, "testdark#6");
+
+ // Calculated non control fixed colour
+ color = Color.FromKnownColor (KnownColor.Control);
+ color = ControlPaint.Dark (color, 0.5f);
+
+ int r_sub, g_sub, b_sub;
+ Color new_color;
+ float per = 0.5f;
+
+ r_sub = Color.FromKnownColor (KnownColor.ControlDarkDark).R -
+ Color.FromKnownColor (KnownColor.ControlDark).R;
+ g_sub = Color.FromKnownColor (KnownColor.ControlDarkDark).G -
+ Color.FromKnownColor (KnownColor.ControlDark).G;
+ b_sub = Color.FromKnownColor (KnownColor.ControlDarkDark).B -
+ Color.FromKnownColor (KnownColor.ControlDark).B;
+
+ new_color = Color.FromArgb (Color.FromKnownColor (KnownColor.ControlDark).A,
+ (int) (Color.FromKnownColor (KnownColor.ControlDark).R + (r_sub * per)),
+ (int) (Color.FromKnownColor (KnownColor.ControlDark).G + (g_sub * per)),
+ (int) (Color.FromKnownColor (KnownColor.ControlDark).B + (b_sub * per)));
+
+ Assert.AreEqual (new_color, color, "testdark#7");
+ }
+
+ [Test]
+ public void LightTest ()
+ {
+ Color color;
+
+ // Non control colours
+
+ // Non-control colours using a specific percentage
+
+ // Fixed Control colours
+ color = Color.FromKnownColor (KnownColor.Control);
+ color = ControlPaint.Light (color, 1f);
+ Assert.AreEqual (Color.FromKnownColor (KnownColor.ControlLightLight), color, "testlight#5");
+
+ color = Color.FromKnownColor (KnownColor.Control);
+ color = ControlPaint.Light (color, 0f);
+ Assert.AreEqual (Color.FromKnownColor (KnownColor.ControlLight), color, "testlight#6");
+
+ // Calculated non control fixed colour
+ color = Color.FromKnownColor (KnownColor.Control);
+ color = ControlPaint.Light (color, 0.5f);
+
+ int r_sub, g_sub, b_sub;
+ Color new_color;
+ float per = 0.5f;
+
+ r_sub = Color.FromKnownColor (KnownColor.ControlLightLight).R -
+ Color.FromKnownColor (KnownColor.ControlLight).R;
+ g_sub = Color.FromKnownColor (KnownColor.ControlLightLight).G -
+ Color.FromKnownColor (KnownColor.ControlLight).G;
+ b_sub = Color.FromKnownColor (KnownColor.ControlLightLight).B -
+ Color.FromKnownColor (KnownColor.ControlLight).B;
+
+ new_color = Color.FromArgb (Color.FromKnownColor (KnownColor.ControlLight).A,
+ (int) (Color.FromKnownColor (KnownColor.ControlLight).R + (r_sub * per)),
+ (int) (Color.FromKnownColor (KnownColor.ControlLight).G + (g_sub * per)),
+ (int) (Color.FromKnownColor (KnownColor.ControlLight).B + (b_sub * per)));
+
+ Assert.AreEqual (new_color, color, "testlight#7");
+
+ }
+
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ControlStyleTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ControlStyleTest.cs
new file mode 100644
index 00000000000..77568afb8d8
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ControlStyleTest.cs
@@ -0,0 +1,961 @@
+//
+// ControlStyleTest.cs (Auto-generated by GenerateControlStyleTest.cs).
+//
+// Author:
+// Peter Dennis Bartok (pbartok@novell.com)
+//
+// (C) 2005 Novell, Inc. (http://www.novell.com)
+//
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Reflection;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Forms {
+ [TestFixture]
+ public class TestControlStyle {
+
+ static Array style_values = Enum.GetValues(typeof(ControlStyles));
+ static string[] style_names = Enum.GetNames(typeof(ControlStyles));
+
+ public static string[] GetStyles(Control control) {
+ string[] result;
+
+ result = new string[style_names.Length];
+
+ for (int i = 0; i < style_values.Length; i++) {
+ result[i] = style_names[i] + "=" + control.GetType().GetMethod("GetStyle", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(control, new object[1] {(ControlStyles)style_values.GetValue(i)});
+ }
+
+ return result;
+ }
+
+ [Test]
+ public void ControlStyleTest ()
+ {
+ string[] Control_want = {
+ "ContainerControl=False",
+ "UserPaint=True",
+ "Opaque=False",
+ "ResizeRedraw=False",
+ "FixedWidth=False",
+ "FixedHeight=False",
+ "StandardClick=True",
+ "Selectable=True",
+ "UserMouse=False",
+ "SupportsTransparentBackColor=False",
+ "StandardDoubleClick=True",
+ "AllPaintingInWmPaint=True",
+ "CacheText=False",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=False"
+ };
+
+ Assert.AreEqual(Control_want, GetStyles(new Control()), "ControlStyles");
+ }
+
+
+ [Test]
+ public void ButtonStyleTest ()
+ {
+ string[] Button_want = {
+ "ContainerControl=False",
+ "UserPaint=True",
+ "Opaque=True",
+ "ResizeRedraw=True",
+ "FixedWidth=False",
+ "FixedHeight=False",
+ "StandardClick=False",
+ "Selectable=True",
+ "UserMouse=True",
+ "SupportsTransparentBackColor=True",
+ "StandardDoubleClick=False",
+ "AllPaintingInWmPaint=True",
+ "CacheText=True",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=True"
+ };
+
+ Assert.AreEqual(Button_want, GetStyles(new Button()), "ButtonStyles");
+ }
+
+
+ [Test]
+ public void CheckBoxStyleTest ()
+ {
+ string[] CheckBox_want = {
+ "ContainerControl=False",
+ "UserPaint=True",
+ "Opaque=True",
+ "ResizeRedraw=True",
+ "FixedWidth=False",
+ "FixedHeight=False",
+ "StandardClick=False",
+ "Selectable=True",
+ "UserMouse=True",
+ "SupportsTransparentBackColor=True",
+ "StandardDoubleClick=False",
+ "AllPaintingInWmPaint=True",
+ "CacheText=True",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=True"
+ };
+
+ Assert.AreEqual(CheckBox_want, GetStyles(new CheckBox()), "CheckBoxStyles");
+ }
+
+
+ [Test]
+ public void RadioButtonStyleTest ()
+ {
+ string[] RadioButton_want = {
+ "ContainerControl=False",
+ "UserPaint=True",
+ "Opaque=True",
+ "ResizeRedraw=True",
+ "FixedWidth=False",
+ "FixedHeight=False",
+ "StandardClick=False",
+ "Selectable=True",
+ "UserMouse=True",
+ "SupportsTransparentBackColor=True",
+ "StandardDoubleClick=True",
+ "AllPaintingInWmPaint=True",
+ "CacheText=True",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=True"
+ };
+
+ Assert.AreEqual(RadioButton_want, GetStyles(new RadioButton()), "RadioButtonStyles");
+ }
+
+
+ [Test]
+ public void DataGridStyleTest ()
+ {
+ string[] DataGrid_want = {
+ "ContainerControl=False",
+ "UserPaint=True",
+ "Opaque=False",
+ "ResizeRedraw=False",
+ "FixedWidth=False",
+ "FixedHeight=False",
+ "StandardClick=True",
+ "Selectable=True",
+ "UserMouse=True",
+ "SupportsTransparentBackColor=False",
+ "StandardDoubleClick=True",
+ "AllPaintingInWmPaint=True",
+ "CacheText=False",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=False"
+ };
+
+ Assert.AreEqual(DataGrid_want, GetStyles(new DataGrid()), "DataGridStyles");
+ }
+
+
+ [Test]
+ public void DateTimePickerStyleTest ()
+ {
+ string[] DateTimePicker_want = {
+ "ContainerControl=False",
+ "UserPaint=False",
+ "Opaque=False",
+ "ResizeRedraw=False",
+ "FixedWidth=False",
+ "FixedHeight=True",
+ "StandardClick=False",
+ "Selectable=True",
+ "UserMouse=False",
+ "SupportsTransparentBackColor=False",
+ "StandardDoubleClick=True",
+ "AllPaintingInWmPaint=True",
+ "CacheText=False",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=False"
+ };
+
+ Assert.AreEqual(DateTimePicker_want, GetStyles(new DateTimePicker()), "DateTimePickerStyles");
+ }
+
+
+ [Test]
+ public void GroupBoxStyleTest ()
+ {
+ string[] GroupBox_want = {
+ "ContainerControl=True",
+ "UserPaint=True",
+ "Opaque=False",
+ "ResizeRedraw=True",
+ "FixedWidth=False",
+ "FixedHeight=False",
+ "StandardClick=True",
+ "Selectable=False",
+ "UserMouse=False",
+ "SupportsTransparentBackColor=True",
+ "StandardDoubleClick=True",
+ "AllPaintingInWmPaint=True",
+ "CacheText=False",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=False"
+ };
+
+ Assert.AreEqual(GroupBox_want, GetStyles(new GroupBox()), "GroupBoxStyles");
+ }
+
+
+ [Test]
+ public void LabelStyleTest ()
+ {
+ string[] Label_want = {
+ "ContainerControl=False",
+ "UserPaint=True",
+ "Opaque=False",
+ "ResizeRedraw=True",
+ "FixedWidth=False",
+ "FixedHeight=False",
+ "StandardClick=True",
+ "Selectable=False",
+ "UserMouse=False",
+ "SupportsTransparentBackColor=True",
+ "StandardDoubleClick=True",
+ "AllPaintingInWmPaint=True",
+ "CacheText=False",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=True"
+ };
+
+ Assert.AreEqual(Label_want, GetStyles(new Label()), "LabelStyles");
+ }
+
+
+ [Test]
+ public void LinkLabelStyleTest ()
+ {
+ string[] LinkLabel_want = {
+ "ContainerControl=False",
+ "UserPaint=True",
+ "Opaque=True",
+ "ResizeRedraw=True",
+ "FixedWidth=False",
+ "FixedHeight=False",
+ "StandardClick=True",
+ "Selectable=False",
+ "UserMouse=False",
+ "SupportsTransparentBackColor=True",
+ "StandardDoubleClick=True",
+ "AllPaintingInWmPaint=True",
+ "CacheText=False",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=True"
+ };
+
+ Assert.AreEqual(LinkLabel_want, GetStyles(new LinkLabel()), "LinkLabelStyles");
+ }
+
+
+ [Test]
+ public void ComboBoxStyleTest ()
+ {
+ string[] ComboBox_want = {
+ "ContainerControl=False",
+ "UserPaint=False",
+ "Opaque=False",
+ "ResizeRedraw=False",
+ "FixedWidth=False",
+ "FixedHeight=False",
+ "StandardClick=False",
+ "Selectable=True",
+ "UserMouse=False",
+ "SupportsTransparentBackColor=False",
+ "StandardDoubleClick=True",
+ "AllPaintingInWmPaint=True",
+ "CacheText=False",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=False"
+ };
+
+ Assert.AreEqual(ComboBox_want, GetStyles(new ComboBox()), "ComboBoxStyles");
+ }
+
+
+ [Test]
+ public void ListBoxStyleTest ()
+ {
+ string[] ListBox_want = {
+ "ContainerControl=False",
+ "UserPaint=False",
+ "Opaque=False",
+ "ResizeRedraw=False",
+ "FixedWidth=False",
+ "FixedHeight=False",
+ "StandardClick=False",
+ "Selectable=True",
+ "UserMouse=False",
+ "SupportsTransparentBackColor=False",
+ "StandardDoubleClick=True",
+ "AllPaintingInWmPaint=True",
+ "CacheText=False",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=False"
+ };
+
+ Assert.AreEqual(ListBox_want, GetStyles(new ListBox()), "ListBoxStyles");
+ }
+
+
+ [Test]
+ public void CheckedListBoxStyleTest ()
+ {
+ string[] CheckedListBox_want = {
+ "ContainerControl=False",
+ "UserPaint=False",
+ "Opaque=False",
+ "ResizeRedraw=True",
+ "FixedWidth=False",
+ "FixedHeight=False",
+ "StandardClick=False",
+ "Selectable=True",
+ "UserMouse=False",
+ "SupportsTransparentBackColor=False",
+ "StandardDoubleClick=True",
+ "AllPaintingInWmPaint=True",
+ "CacheText=False",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=False"
+ };
+
+ Assert.AreEqual(CheckedListBox_want, GetStyles(new CheckedListBox()), "CheckedListBoxStyles");
+ }
+
+
+ [Test]
+ public void ListViewStyleTest ()
+ {
+ string[] ListView_want = {
+ "ContainerControl=False",
+ "UserPaint=False",
+ "Opaque=False",
+ "ResizeRedraw=False",
+ "FixedWidth=False",
+ "FixedHeight=False",
+ "StandardClick=False",
+ "Selectable=True",
+ "UserMouse=False",
+ "SupportsTransparentBackColor=False",
+ "StandardDoubleClick=True",
+ "AllPaintingInWmPaint=True",
+ "CacheText=False",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=False"
+ };
+
+ Assert.AreEqual(ListView_want, GetStyles(new ListView()), "ListViewStyles");
+ }
+
+
+ [Test]
+ public void MdiClientStyleTest ()
+ {
+ string[] MdiClient_want = {
+ "ContainerControl=False",
+ "UserPaint=True",
+ "Opaque=False",
+ "ResizeRedraw=False",
+ "FixedWidth=False",
+ "FixedHeight=False",
+ "StandardClick=True",
+ "Selectable=False",
+ "UserMouse=False",
+ "SupportsTransparentBackColor=False",
+ "StandardDoubleClick=True",
+ "AllPaintingInWmPaint=True",
+ "CacheText=False",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=False"
+ };
+
+ Assert.AreEqual(MdiClient_want, GetStyles(new MdiClient()), "MdiClientStyles");
+ }
+
+
+ [Test]
+ public void MonthCalendarStyleTest ()
+ {
+ string[] MonthCalendar_want = {
+ "ContainerControl=False",
+ "UserPaint=False",
+ "Opaque=False",
+ "ResizeRedraw=False",
+ "FixedWidth=False",
+ "FixedHeight=False",
+ "StandardClick=False",
+ "Selectable=True",
+ "UserMouse=False",
+ "SupportsTransparentBackColor=False",
+ "StandardDoubleClick=True",
+ "AllPaintingInWmPaint=True",
+ "CacheText=False",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=False"
+ };
+
+ Assert.AreEqual(MonthCalendar_want, GetStyles(new MonthCalendar()), "MonthCalendarStyles");
+ }
+
+
+ [Test]
+ public void PictureBoxStyleTest ()
+ {
+ string[] PictureBox_want = {
+ "ContainerControl=False",
+ "UserPaint=True",
+ "Opaque=False",
+ "ResizeRedraw=False",
+ "FixedWidth=False",
+ "FixedHeight=False",
+ "StandardClick=True",
+ "Selectable=False",
+ "UserMouse=False",
+ "SupportsTransparentBackColor=True",
+ "StandardDoubleClick=True",
+ "AllPaintingInWmPaint=True",
+ "CacheText=False",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=True"
+ };
+
+ Assert.AreEqual(PictureBox_want, GetStyles(new PictureBox()), "PictureBoxStyles");
+ }
+
+
+ [Test]
+ public void ProgressBarStyleTest ()
+ {
+ string[] ProgressBar_want = {
+ "ContainerControl=False",
+ "UserPaint=False",
+ "Opaque=False",
+ "ResizeRedraw=False",
+ "FixedWidth=False",
+ "FixedHeight=False",
+ "StandardClick=True",
+ "Selectable=False",
+ "UserMouse=False",
+ "SupportsTransparentBackColor=False",
+ "StandardDoubleClick=True",
+ "AllPaintingInWmPaint=True",
+ "CacheText=False",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=False"
+ };
+
+ Assert.AreEqual(ProgressBar_want, GetStyles(new ProgressBar()), "ProgressBarStyles");
+ }
+
+
+ [Test]
+ public void ScrollableControlStyleTest ()
+ {
+ string[] ScrollableControl_want = {
+ "ContainerControl=True",
+ "UserPaint=True",
+ "Opaque=False",
+ "ResizeRedraw=False",
+ "FixedWidth=False",
+ "FixedHeight=False",
+ "StandardClick=True",
+ "Selectable=True",
+ "UserMouse=False",
+ "SupportsTransparentBackColor=False",
+ "StandardDoubleClick=True",
+ "AllPaintingInWmPaint=False",
+ "CacheText=False",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=False"
+ };
+
+ Assert.AreEqual(ScrollableControl_want, GetStyles(new ScrollableControl()), "ScrollableControlStyles");
+ }
+
+
+ [Test]
+ public void ContainerControlStyleTest ()
+ {
+ string[] ContainerControl_want = {
+ "ContainerControl=True",
+ "UserPaint=True",
+ "Opaque=False",
+ "ResizeRedraw=False",
+ "FixedWidth=False",
+ "FixedHeight=False",
+ "StandardClick=True",
+ "Selectable=True",
+ "UserMouse=False",
+ "SupportsTransparentBackColor=False",
+ "StandardDoubleClick=True",
+ "AllPaintingInWmPaint=False",
+ "CacheText=False",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=False"
+ };
+
+ Assert.AreEqual(ContainerControl_want, GetStyles(new ContainerControl()), "ContainerControlStyles");
+ }
+
+
+ [Test]
+ public void FormStyleTest ()
+ {
+ string[] Form_want = {
+ "ContainerControl=True",
+ "UserPaint=True",
+ "Opaque=False",
+ "ResizeRedraw=False",
+ "FixedWidth=False",
+ "FixedHeight=False",
+ "StandardClick=True",
+ "Selectable=True",
+ "UserMouse=False",
+ "SupportsTransparentBackColor=False",
+ "StandardDoubleClick=True",
+ "AllPaintingInWmPaint=False",
+ "CacheText=False",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=False"
+ };
+
+ Assert.AreEqual(Form_want, GetStyles(new Form()), "FormStyles");
+ }
+
+
+ [Test]
+ public void PropertyGridStyleTest ()
+ {
+ string[] PropertyGrid_want = {
+ "ContainerControl=True",
+ "UserPaint=True",
+ "Opaque=False",
+ "ResizeRedraw=False",
+ "FixedWidth=False",
+ "FixedHeight=False",
+ "StandardClick=True",
+ "Selectable=True",
+ "UserMouse=False",
+ "SupportsTransparentBackColor=False",
+ "StandardDoubleClick=True",
+ "AllPaintingInWmPaint=False",
+ "CacheText=False",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=False"
+ };
+
+ Assert.AreEqual(PropertyGrid_want, GetStyles(new PropertyGrid()), "PropertyGridStyles");
+ }
+
+
+ [Test]
+ public void DomainUpDownStyleTest ()
+ {
+ string[] DomainUpDown_want = {
+ "ContainerControl=True",
+ "UserPaint=True",
+ "Opaque=False",
+ "ResizeRedraw=False",
+ "FixedWidth=False",
+ "FixedHeight=True",
+ "StandardClick=True",
+ "Selectable=True",
+ "UserMouse=False",
+ "SupportsTransparentBackColor=False",
+ "StandardDoubleClick=True",
+ "AllPaintingInWmPaint=False",
+ "CacheText=False",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=False"
+ };
+
+ Assert.AreEqual(DomainUpDown_want, GetStyles(new DomainUpDown()), "DomainUpDownStyles");
+ }
+
+
+ [Test]
+ public void NumericUpDownStyleTest ()
+ {
+ string[] NumericUpDown_want = {
+ "ContainerControl=True",
+ "UserPaint=True",
+ "Opaque=False",
+ "ResizeRedraw=False",
+ "FixedWidth=False",
+ "FixedHeight=True",
+ "StandardClick=True",
+ "Selectable=True",
+ "UserMouse=False",
+ "SupportsTransparentBackColor=False",
+ "StandardDoubleClick=True",
+ "AllPaintingInWmPaint=False",
+ "CacheText=False",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=False"
+ };
+
+ Assert.AreEqual(NumericUpDown_want, GetStyles(new NumericUpDown()), "NumericUpDownStyles");
+ }
+
+
+ [Test]
+ public void UserControlStyleTest ()
+ {
+ string[] UserControl_want = {
+ "ContainerControl=True",
+ "UserPaint=True",
+ "Opaque=False",
+ "ResizeRedraw=False",
+ "FixedWidth=False",
+ "FixedHeight=False",
+ "StandardClick=True",
+ "Selectable=True",
+ "UserMouse=False",
+ "SupportsTransparentBackColor=False",
+ "StandardDoubleClick=True",
+ "AllPaintingInWmPaint=False",
+ "CacheText=False",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=False"
+ };
+
+ Assert.AreEqual(UserControl_want, GetStyles(new UserControl()), "UserControlStyles");
+ }
+
+
+ [Test]
+ public void PanelStyleTest ()
+ {
+ string[] Panel_want = {
+ "ContainerControl=True",
+ "UserPaint=True",
+ "Opaque=False",
+ "ResizeRedraw=False",
+ "FixedWidth=False",
+ "FixedHeight=False",
+ "StandardClick=True",
+ "Selectable=False",
+ "UserMouse=False",
+ "SupportsTransparentBackColor=True",
+ "StandardDoubleClick=True",
+ "AllPaintingInWmPaint=False",
+ "CacheText=False",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=False"
+ };
+
+ Assert.AreEqual(Panel_want, GetStyles(new Panel()), "PanelStyles");
+ }
+
+
+ [Test]
+ public void TabPageStyleTest ()
+ {
+ string[] TabPage_want = {
+ "ContainerControl=True",
+ "UserPaint=True",
+ "Opaque=False",
+ "ResizeRedraw=False",
+ "FixedWidth=False",
+ "FixedHeight=False",
+ "StandardClick=True",
+ "Selectable=False",
+ "UserMouse=False",
+ "SupportsTransparentBackColor=True",
+ "StandardDoubleClick=True",
+ "AllPaintingInWmPaint=False",
+ "CacheText=True",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=False"
+ };
+
+ Assert.AreEqual(TabPage_want, GetStyles(new TabPage()), "TabPageStyles");
+ }
+
+
+ [Test]
+ public void HScrollBarStyleTest ()
+ {
+ string[] HScrollBar_want = {
+ "ContainerControl=False",
+ "UserPaint=False",
+ "Opaque=False",
+ "ResizeRedraw=False",
+ "FixedWidth=False",
+ "FixedHeight=False",
+ "StandardClick=False",
+ "Selectable=True",
+ "UserMouse=False",
+ "SupportsTransparentBackColor=False",
+ "StandardDoubleClick=True",
+ "AllPaintingInWmPaint=True",
+ "CacheText=False",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=False"
+ };
+
+ Assert.AreEqual(HScrollBar_want, GetStyles(new HScrollBar()), "HScrollBarStyles");
+ }
+
+
+ [Test]
+ public void VScrollBarStyleTest ()
+ {
+ string[] VScrollBar_want = {
+ "ContainerControl=False",
+ "UserPaint=False",
+ "Opaque=False",
+ "ResizeRedraw=False",
+ "FixedWidth=False",
+ "FixedHeight=False",
+ "StandardClick=False",
+ "Selectable=True",
+ "UserMouse=False",
+ "SupportsTransparentBackColor=False",
+ "StandardDoubleClick=True",
+ "AllPaintingInWmPaint=True",
+ "CacheText=False",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=False"
+ };
+
+ Assert.AreEqual(VScrollBar_want, GetStyles(new VScrollBar()), "VScrollBarStyles");
+ }
+
+
+ [Test]
+ public void SplitterStyleTest ()
+ {
+ string[] Splitter_want = {
+ "ContainerControl=False",
+ "UserPaint=True",
+ "Opaque=False",
+ "ResizeRedraw=False",
+ "FixedWidth=False",
+ "FixedHeight=False",
+ "StandardClick=True",
+ "Selectable=False",
+ "UserMouse=False",
+ "SupportsTransparentBackColor=False",
+ "StandardDoubleClick=True",
+ "AllPaintingInWmPaint=True",
+ "CacheText=False",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=False"
+ };
+
+ Assert.AreEqual(Splitter_want, GetStyles(new Splitter()), "SplitterStyles");
+ }
+
+
+ [Test]
+ public void StatusBarStyleTest ()
+ {
+ string[] StatusBar_want = {
+ "ContainerControl=False",
+ "UserPaint=False",
+ "Opaque=False",
+ "ResizeRedraw=False",
+ "FixedWidth=False",
+ "FixedHeight=False",
+ "StandardClick=True",
+ "Selectable=False",
+ "UserMouse=False",
+ "SupportsTransparentBackColor=False",
+ "StandardDoubleClick=True",
+ "AllPaintingInWmPaint=True",
+ "CacheText=False",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=False"
+ };
+
+ Assert.AreEqual(StatusBar_want, GetStyles(new StatusBar()), "StatusBarStyles");
+ }
+
+
+ [Test]
+ public void TabControlStyleTest ()
+ {
+ string[] TabControl_want = {
+ "ContainerControl=False",
+ "UserPaint=False",
+ "Opaque=False",
+ "ResizeRedraw=False",
+ "FixedWidth=False",
+ "FixedHeight=False",
+ "StandardClick=True",
+ "Selectable=True",
+ "UserMouse=False",
+ "SupportsTransparentBackColor=False",
+ "StandardDoubleClick=True",
+ "AllPaintingInWmPaint=True",
+ "CacheText=False",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=False"
+ };
+
+ Assert.AreEqual(TabControl_want, GetStyles(new TabControl()), "TabControlStyles");
+ }
+
+
+ [Test]
+ public void RichTextBoxStyleTest ()
+ {
+ string[] RichTextBox_want = {
+ "ContainerControl=False",
+ "UserPaint=False",
+ "Opaque=False",
+ "ResizeRedraw=False",
+ "FixedWidth=False",
+ "FixedHeight=False",
+ "StandardClick=False",
+ "Selectable=True",
+ "UserMouse=False",
+ "SupportsTransparentBackColor=False",
+ "StandardDoubleClick=True",
+ "AllPaintingInWmPaint=True",
+ "CacheText=False",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=False"
+ };
+
+ Assert.AreEqual(RichTextBox_want, GetStyles(new RichTextBox()), "RichTextBoxStyles");
+ }
+
+
+ [Test]
+ public void TextBoxStyleTest ()
+ {
+ string[] TextBox_want = {
+ "ContainerControl=False",
+ "UserPaint=False",
+ "Opaque=False",
+ "ResizeRedraw=False",
+ "FixedWidth=False",
+ "FixedHeight=True",
+ "StandardClick=False",
+ "Selectable=True",
+ "UserMouse=False",
+ "SupportsTransparentBackColor=False",
+ "StandardDoubleClick=False",
+ "AllPaintingInWmPaint=True",
+ "CacheText=False",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=False"
+ };
+
+ Assert.AreEqual(TextBox_want, GetStyles(new TextBox()), "TextBoxStyles");
+ }
+
+
+ [Test]
+ public void DataGridTextBoxStyleTest ()
+ {
+ string[] DataGridTextBox_want = {
+ "ContainerControl=False",
+ "UserPaint=False",
+ "Opaque=False",
+ "ResizeRedraw=False",
+ "FixedWidth=False",
+ "FixedHeight=True",
+ "StandardClick=False",
+ "Selectable=True",
+ "UserMouse=False",
+ "SupportsTransparentBackColor=False",
+ "StandardDoubleClick=False",
+ "AllPaintingInWmPaint=True",
+ "CacheText=False",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=False"
+ };
+
+ Assert.AreEqual(DataGridTextBox_want, GetStyles(new DataGridTextBox()), "DataGridTextBoxStyles");
+ }
+
+
+ [Test]
+ public void ToolBarStyleTest ()
+ {
+ string[] ToolBar_want = {
+ "ContainerControl=False",
+ "UserPaint=False",
+ "Opaque=False",
+ "ResizeRedraw=False",
+ "FixedWidth=False",
+ "FixedHeight=True",
+ "StandardClick=True",
+ "Selectable=True",
+ "UserMouse=False",
+ "SupportsTransparentBackColor=False",
+ "StandardDoubleClick=True",
+ "AllPaintingInWmPaint=True",
+ "CacheText=False",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=False"
+ };
+
+ Assert.AreEqual(ToolBar_want, GetStyles(new ToolBar()), "ToolBarStyles");
+ }
+
+
+ [Test]
+ public void TrackBarStyleTest ()
+ {
+ string[] TrackBar_want = {
+ "ContainerControl=False",
+ "UserPaint=False",
+ "Opaque=False",
+ "ResizeRedraw=False",
+ "FixedWidth=False",
+ "FixedHeight=False",
+ "StandardClick=True",
+ "Selectable=True",
+ "UserMouse=False",
+ "SupportsTransparentBackColor=False",
+ "StandardDoubleClick=True",
+ "AllPaintingInWmPaint=True",
+ "CacheText=False",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=False"
+ };
+
+ Assert.AreEqual(TrackBar_want, GetStyles(new TrackBar()), "TrackBarStyles");
+ }
+
+
+ [Test]
+ public void TreeViewStyleTest ()
+ {
+ string[] TreeView_want = {
+ "ContainerControl=False",
+ "UserPaint=False",
+ "Opaque=False",
+ "ResizeRedraw=False",
+ "FixedWidth=False",
+ "FixedHeight=False",
+ "StandardClick=False",
+ "Selectable=True",
+ "UserMouse=False",
+ "SupportsTransparentBackColor=False",
+ "StandardDoubleClick=True",
+ "AllPaintingInWmPaint=True",
+ "CacheText=False",
+ "EnableNotifyMessage=False",
+ "DoubleBuffer=False"
+ };
+
+ Assert.AreEqual(TreeView_want, GetStyles(new TreeView()), "TreeViewStyles");
+ }
+
+
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ControlTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ControlTest.cs
new file mode 100644
index 00000000000..68b08bdde30
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ControlTest.cs
@@ -0,0 +1,746 @@
+//
+// Copyright (c) 2005 Novell, Inc.
+//
+// Authors:
+// Ritvik Mayank (mritvik@novell.com)
+//
+
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Threading;
+using System.Reflection;
+using System.Runtime.Remoting;
+
+using NUnit.Framework;
+
+namespace MWF.MonoTest
+{
+ [TestFixture]
+ [Ignore ("This test has to be completly reviewed")]
+ public class ControlTest
+ {
+ internal static void TestAccessibility(Control c, string Default, string Description, string Name, AccessibleRole Role) {
+ Assert.AreEqual(false, c.AccessibilityObject == null, "Acc1");
+ Assert.AreEqual(Default, c.AccessibleDefaultActionDescription, "Acc2");
+ Assert.AreEqual(Description, c.AccessibleDescription, "Acc3");
+ Assert.AreEqual(Name, c.AccessibleName, "Acc4");
+ Assert.AreEqual(Role, c.AccessibleRole, "Acc5");
+ }
+
+ [Test]
+ public void PubPropTest()
+ {
+ Control c = new Control();
+
+ TestAccessibility(c, null, null, null, AccessibleRole.Default);
+
+ // A
+ Assert.AreEqual(false, c.AllowDrop , "A1");
+ Assert.AreEqual(AnchorStyles.Top | AnchorStyles.Left, c.Anchor, "A2");
+
+ // B
+ Assert.AreEqual("Control", c.BackColor.Name , "B1");
+ Assert.AreEqual(null, c.BackgroundImage, "B2");
+ Assert.AreEqual(null, c.BindingContext, "B3");
+ Assert.AreEqual(0, c.Bottom, "B4");
+ Assert.AreEqual (new Rectangle (0,0, 0, 0) , c.Bounds , "B5");
+
+ // C
+ Assert.AreEqual(false, c.CanFocus, "C1");
+ Assert.AreEqual(true, c.CanSelect, "C2");
+ Assert.AreEqual(false, c.Capture, "C3");
+ Assert.AreEqual(true, c.CausesValidation, "C4");
+ Assert.AreEqual (new Rectangle(0, 0, 0, 0) , c.ClientRectangle , "C5");
+ Assert.AreEqual (new Size(0, 0), c.ClientSize , "C6");
+
+ string name = c.CompanyName;
+ if (!name.Equals("Mono Project, Novell, Inc.") && !name.Equals("Microsoft Corporation")) {
+ Assert.Fail("CompanyName property does not match any accepted value - C7");
+ }
+ Assert.AreEqual(null, c.Container, "C8");
+ Assert.AreEqual(false, c.ContainsFocus, "C9");
+ Assert.AreEqual(null, c.ContextMenu, "C10");
+ Assert.AreEqual(0, c.Controls.Count, "C11");
+ Assert.AreEqual(true, c.Created, "C12");
+ Assert.AreEqual(Cursors.Default, c.Cursor, "C13");
+
+ // D
+ Assert.AreEqual(false, c.DataBindings == null, "D1");
+ Assert.AreEqual("Control", Control.DefaultBackColor.Name, "D2");
+ Assert.AreEqual("ControlText", Control.DefaultForeColor.Name, "D3");
+ Assert.AreEqual(FontStyle.Regular, Control.DefaultFont.Style, "D4");
+ Assert.AreEqual (new Rectangle(0, 0, 0, 0), c.DisplayRectangle , "D5");
+ Assert.AreEqual(false, c.Disposing, "D6");
+ Assert.AreEqual(DockStyle.None, c.Dock, "D7");
+
+ // E
+ Assert.AreEqual(true, c.Enabled, "E1");
+
+ // F
+ Assert.AreEqual(false, c.Focused, "F1");
+ Assert.AreEqual(FontStyle.Regular, c.Font.Style, "F2");
+ Assert.AreEqual(SystemColors.ControlText, c.ForeColor, "F3");
+
+ // G
+
+ // H
+ Assert.AreEqual (((IWin32Window)c).Handle, c.Handle, "H1");
+ Assert.AreEqual(false, c.HasChildren, "H2");
+ Assert.AreEqual(0, c.Height, "H3");
+
+ // I
+ Assert.AreEqual (ImeMode.NoControl, c.ImeMode, "I1");
+ Assert.AreEqual(false, c.InvokeRequired, "I2");
+ Assert.AreEqual(false, c.IsAccessible, "I3");
+ Assert.AreEqual(false, c.IsDisposed, "I4");
+ Assert.AreEqual(true, c.IsHandleCreated, "I5");
+
+ // J
+
+ // K
+
+ // L
+ Assert.AreEqual(0, c.Left, "L1");
+ Assert.AreEqual(Point.Empty, c.Location, "L2");
+
+ // M
+ Assert.AreEqual(Keys.None, Control.ModifierKeys, "M1");
+ Assert.AreEqual(false, Control.MousePosition.IsEmpty, "M2");
+ Assert.AreEqual(MouseButtons.None, Control.MouseButtons, "M3");
+
+ // N
+ Assert.AreEqual("", c.Name, "N1");
+
+ // O
+
+ // P
+ Assert.AreEqual(null, c.Parent, "P1");
+ name = c.ProductName;
+ if (!name.Equals("Novell Mono MWF") && !name.Equals("Microsoft (R) .NET Framework"))
+ Assert.Fail("ProductName property does not match any accepted value - P2");
+
+ name = c.ProductVersion;
+ if (!name.Equals("1.1.4322.2032")) {
+ Assert.Fail("This test is being run against the wrong framework version.\nExpected is Net 1.1sp1. - P3");
+ }
+
+ // R
+ Assert.AreEqual(false, c.RecreatingHandle, "R1");
+ Assert.AreEqual(null, c.Region, "R2");
+ Assert.AreEqual(0, c.Right, "R3");
+ Assert.AreEqual(RightToLeft.No, c.RightToLeft, "R4");
+
+ // S
+ Assert.AreEqual(null, c.Site, "S1");
+ Assert.AreEqual (new Size(0, 0), c.Size, "S2");
+
+ // T
+ Assert.AreEqual(0, c.TabIndex , "T1");
+ Assert.AreEqual(true, c.TabStop, "T2");
+ Assert.AreEqual(null, c.Tag, "T3");
+ Assert.AreEqual("", c.Text, "T4");
+ Assert.AreEqual(0, c.Top, "T5");
+ Assert.AreEqual(null, c.TopLevelControl, "T6");
+
+ // U
+
+ // V
+ Assert.AreEqual(true, c.Visible, "V1");
+
+ // W
+ Assert.AreEqual(0, c.Width, "W1");
+
+ // XYZ
+ }
+
+ [Test]
+ public void RelationTest() {
+ Control c1;
+ Control c2;
+
+ c1 = new Control();
+ c2 = new Control();
+
+ Assert.AreEqual(true , c1.Visible , "Rel1");
+ Assert.AreEqual(false, c1.Contains(c2) , "Rel2");
+ Assert.AreEqual("System.Windows.Forms.Control", c1.ToString() , "Rel3");
+
+ c1.Controls.Add(c2);
+ Assert.AreEqual(true , c2.Visible , "Rel4");
+ Assert.AreEqual(true, c1.Contains(c2) , "Rel5");
+
+ c1.Anchor = AnchorStyles.Top;
+ c1.SuspendLayout ();
+ c1.Anchor = AnchorStyles.Left ;
+ c1.ResumeLayout ();
+ Assert.AreEqual(AnchorStyles.Left , c1.Anchor, "Rel6");
+
+ c1.SetBounds(10, 20, 30, 40) ;
+ Assert.AreEqual(new Rectangle(10, 20, 30, 40), c1.Bounds, "Rel7");
+
+ Assert.AreEqual(c1, c2.Parent, "Rel8");
+ }
+
+ private string TestControl(Control container, Control start, bool forward) {
+ Control ctl;
+
+ ctl = container.GetNextControl(start, forward);
+
+ if (ctl == null) {
+ return null;
+ }
+
+ return ctl.Text;
+ }
+
+ [Test]
+ public void TabOrder() {
+ Form form;
+ Control active;
+
+ Label label1 = new Label(); // To test non-tabstop items as well
+ Label label2 = new Label();
+
+ GroupBox group1 = new GroupBox();
+ GroupBox group2 = new GroupBox();
+ GroupBox group3 = new GroupBox();
+
+ TextBox text1 = new TextBox();
+
+ RadioButton radio11 = new RadioButton();
+ RadioButton radio12 = new RadioButton();
+ RadioButton radio13 = new RadioButton();
+ RadioButton radio14 = new RadioButton();
+ RadioButton radio21 = new RadioButton();
+ RadioButton radio22 = new RadioButton();
+ RadioButton radio23 = new RadioButton();
+ RadioButton radio24 = new RadioButton();
+ RadioButton radio31 = new RadioButton();
+ RadioButton radio32 = new RadioButton();
+ RadioButton radio33 = new RadioButton();
+ RadioButton radio34 = new RadioButton();
+
+ form = new Form();
+
+ form.ClientSize = new System.Drawing.Size (520, 520);
+ Assert.AreEqual(new Size(520, 520), form.ClientSize, "Tab1");
+
+ form.Text = "SWF Taborder Test App Form";
+ Assert.AreEqual("SWF Taborder Test App Form", form.Text, "Tab2");
+
+ label1.Location = new Point(10, 10);
+ Assert.AreEqual(new Point(10, 10), label1.Location, "Tab3");
+ label1.Text = "Label1";
+ form.Controls.Add(label1);
+
+ label2.Location = new Point(200, 10);
+ label2.Text = "Label2";
+ form.Controls.Add(label2);
+
+ group1.Text = "Group1";
+ group2.Text = "Group2";
+ group3.Text = "Group3";
+
+ group1.Size = new Size(200, 400);
+ group2.Size = new Size(200, 400);
+ group3.Size = new Size(180, 180);
+ Assert.AreEqual(new Size(180, 180), group3.Size, "Tab4");
+
+ group1.Location = new Point(10, 40);
+ group2.Location = new Point(220, 40);
+ group3.Location = new Point(10, 210);
+
+ group1.TabIndex = 30;
+ Assert.AreEqual(30, group1.TabIndex, "Tab5");
+ group1.TabStop = true;
+
+ // Don't assign, test automatic assignment
+ //group2.TabIndex = 0;
+ group2.TabStop = true;
+ Assert.AreEqual(0, group2.TabIndex, "Tab6");
+
+ group3.TabIndex = 35;
+ group3.TabStop = true;
+
+ // Test default tab index
+ Assert.AreEqual(0, radio11.TabIndex, "Tab7");
+
+ text1.Text = "Edit Control";
+
+ radio11.Text = "Radio 1-1 [Tab1]";
+ radio12.Text = "Radio 1-2 [Tab2]";
+ radio13.Text = "Radio 1-3 [Tab3]";
+ radio14.Text = "Radio 1-4 [Tab4]";
+
+ radio21.Text = "Radio 2-1 [Tab4]";
+ radio22.Text = "Radio 2-2 [Tab3]";
+ radio23.Text = "Radio 2-3 [Tab2]";
+ radio24.Text = "Radio 2-4 [Tab1]";
+
+ radio31.Text = "Radio 3-1 [Tab1]";
+ radio32.Text = "Radio 3-2 [Tab3]";
+ radio33.Text = "Radio 3-3 [Tab2]";
+ radio34.Text = "Radio 3-4 [Tab4]";
+
+ // We don't assign TabIndex for radio1X; test automatic assignment
+ text1.TabStop = true;
+ radio11.TabStop = true;
+
+ radio21.TabIndex = 4;
+ radio22.TabIndex = 3;
+ radio23.TabIndex = 2;
+ radio24.TabIndex = 1;
+ radio24.TabStop = true;
+
+ radio31.TabIndex = 11;
+ radio31.TabStop = true;
+ radio32.TabIndex = 13;
+ radio33.TabIndex = 12;
+ radio34.TabIndex = 14;
+
+ text1.Location = new Point(10, 100);
+
+ radio11.Location = new Point(10, 20);
+ radio12.Location = new Point(10, 40);
+ radio13.Location = new Point(10, 60);
+ radio14.Location = new Point(10, 80);
+
+ radio21.Location = new Point(10, 20);
+ radio22.Location = new Point(10, 40);
+ radio23.Location = new Point(10, 60);
+ radio24.Location = new Point(10, 80);
+
+ radio31.Location = new Point(10, 20);
+ radio32.Location = new Point(10, 40);
+ radio33.Location = new Point(10, 60);
+ radio34.Location = new Point(10, 80);
+
+ text1.Size = new Size(150, text1.PreferredHeight);
+
+ radio11.Size = new Size(150, 20);
+ radio12.Size = new Size(150, 20);
+ radio13.Size = new Size(150, 20);
+ radio14.Size = new Size(150, 20);
+
+ radio21.Size = new Size(150, 20);
+ radio22.Size = new Size(150, 20);
+ radio23.Size = new Size(150, 20);
+ radio24.Size = new Size(150, 20);
+
+ radio31.Size = new Size(150, 20);
+ radio32.Size = new Size(150, 20);
+ radio33.Size = new Size(150, 20);
+ radio34.Size = new Size(150, 20);
+
+ group1.Controls.Add(text1);
+
+ group1.Controls.Add(radio11);
+ group1.Controls.Add(radio12);
+ group1.Controls.Add(radio13);
+ group1.Controls.Add(radio14);
+
+ group2.Controls.Add(radio21);
+ group2.Controls.Add(radio22);
+ group2.Controls.Add(radio23);
+ group2.Controls.Add(radio24);
+
+ group3.Controls.Add(radio31);
+ group3.Controls.Add(radio32);
+ group3.Controls.Add(radio33);
+ group3.Controls.Add(radio34);
+
+ form.Controls.Add(group1);
+ form.Controls.Add(group2);
+ group2.Controls.Add(group3);
+
+ // Perform some tests, the TabIndex stuff below will alter the outcome
+ Assert.AreEqual(null, TestControl(group2, radio34, true), "Tab8");
+ Assert.AreEqual(31, group2.TabIndex, "Tab9");
+
+ // Does the taborder of containers and non-selectable things change behaviour?
+ label1.TabIndex = 5;
+ label2.TabIndex = 4;
+ group1.TabIndex = 3;
+ group2.TabIndex = 1;
+
+ // Start verification
+ Assert.AreEqual(null, TestControl(group2, radio34, true), "Tab10");
+ Assert.AreEqual(radio24.Text, TestControl(group2, group2, true), "Tab11");
+ Assert.AreEqual(radio31.Text, TestControl(group2, group3, true), "Tab12");
+ Assert.AreEqual(null, TestControl(group1, radio14, true), "Tab13");
+ Assert.AreEqual(radio23.Text, TestControl(group2, radio24, true), "Tab14");
+ Assert.AreEqual(group3.Text, TestControl(group2, radio21, true), "Tab15");
+ Assert.AreEqual(radio13.Text, TestControl(form, radio12, true), "Tab16");
+ Assert.AreEqual(label2.Text, TestControl(form, radio14, true), "Tab17");
+ Assert.AreEqual(group1.Text, TestControl(form, radio34, true), "Tab18");
+ Assert.AreEqual(radio23.Text, TestControl(group2, radio24, true), "Tab19");
+
+ // Sanity checks
+ Assert.AreEqual(null, TestControl(radio11, radio21, true), "Tab20");
+ Assert.AreEqual(text1.Text, TestControl(group1, radio21, true), "Tab21");
+
+ Assert.AreEqual(radio14.Text, TestControl(form, label2, false), "Tab22");
+ Assert.AreEqual(radio21.Text, TestControl(group2, group3, false), "Tab23");
+
+ Assert.AreEqual(4, radio21.TabIndex, "Tab24");
+ Assert.AreEqual(1, radio11.TabIndex, "Tab25");
+ Assert.AreEqual(3, radio13.TabIndex, "Tab26");
+ Assert.AreEqual(35, group3.TabIndex, "Tab27");
+ Assert.AreEqual(1, group2.TabIndex, "Tab28");
+
+ Assert.AreEqual(label1.Text, TestControl(form, form, false), "Tab29");
+ Assert.AreEqual(radio14.Text, TestControl(group1, group1, false), "Tab30");
+ Assert.AreEqual(radio34.Text, TestControl(group3, group3, false), "Tab31");
+
+ Assert.AreEqual(null, TestControl(label1, label1, false), "Tab31");
+ Assert.AreEqual(null, TestControl(radio11, radio21, false), "Tab32");
+ }
+
+ [Test]
+ public void ScaleTest()
+ {
+ Control r1 = new Control();
+
+ r1.Width = 40;
+ r1.Height = 20;
+ r1.Scale(2);
+ Assert.AreEqual(80, r1.Width, "Scale1");
+ Assert.AreEqual(40, r1.Height, "Scale2");
+ }
+
+ [Test]
+ public void TextTest()
+ {
+ Control r1 = new Control();
+ r1.Text = "Hi" ;
+ Assert.AreEqual("Hi" , r1.Text , "Text1");
+
+ r1.ResetText();
+ Assert.AreEqual("" , r1.Text , "Text2");
+ }
+
+ [Test]
+ public void PubMethodTest7()
+ {
+ Control r1 = new Control();
+ r1.RightToLeft = RightToLeft.Yes ;
+ r1.ResetRightToLeft() ;
+ Assert.AreEqual(RightToLeft.No , r1.RightToLeft , "#81");
+ r1.ImeMode = ImeMode.Off ;
+ r1.ResetImeMode () ;
+ Assert.AreEqual(ImeMode.NoControl , r1.ImeMode , "#82");
+ r1.ForeColor= SystemColors.GrayText ;
+ r1.ResetForeColor() ;
+ Assert.AreEqual(SystemColors.ControlText , r1.ForeColor , "#83");
+ //r1.Font = Font.FromHdc();
+ r1.ResetFont () ;
+ //Assert.AreEqual(FontFamily.GenericSansSerif , r1.Font , "#83");
+ r1.Cursor = Cursors.Hand ;
+ r1.ResetCursor () ;
+ Assert.AreEqual(Cursors.Default , r1.Cursor , "#83");
+ //r1.DataBindings = System.Windows.Forms.Binding ;
+ //r1.ResetBindings() ;
+ //Assert.AreEqual(ControlBindingsCollection , r1.DataBindings , "#83");
+ r1.BackColor = System.Drawing.Color.Black ;
+ r1.ResetBackColor() ;
+ Assert.AreEqual( SystemColors.Control , r1.BackColor , "#84");
+ r1.BackColor = System.Drawing.Color.Black ;
+ r1.Refresh() ;
+ Assert.AreEqual( null , r1.Region , "#85");
+ Rectangle M = new Rectangle(10, 20, 30 ,40);
+ r1.RectangleToScreen(M) ;
+ Assert.AreEqual( null , r1.Region , "#86");
+
+ }
+
+ [Test]
+ public void ScreenClientCoords()
+ {
+ Label l;
+ Point p1;
+ Point p2;
+ Point p3;
+
+ l = new Label();
+ l.Left = 10;
+ l.Top = 12;
+ l.Visible = true;
+ p1 = new Point (10,10);
+ p2 = l.PointToScreen(p1);
+ p3 = l.PointToClient(p2);
+
+ Assert.AreEqual (p1, p3, "SC1");
+ }
+
+ [Test]
+ public void ContainsTest ()
+ {
+ Control t = new Control ();
+ Control s = new Control ();
+
+ t.Controls.Add (s);
+
+ Assert.AreEqual (true, t.Contains (s), "Con1");
+ Assert.AreEqual (false, s.Contains (t), "Con2");
+ Assert.AreEqual (false, s.Contains (null), "Con3");
+ Assert.AreEqual (false, t.Contains (new Control ()), "Con4");
+ }
+
+ [Test]
+ public void CreateHandleTest ()
+ {
+ Control parent;
+ Control child;
+
+ parent = null;
+ child = null;
+
+ try {
+ parent = new Control ();
+ child = new Control ();
+
+ parent.Visible = true;
+ parent.Controls.Add (child);
+
+ Assert.IsFalse (parent.IsHandleCreated, "CH1");
+ Assert.IsFalse (child.IsHandleCreated, "CH2");
+
+ parent.CreateControl ();
+ Assert.IsNotNull (parent.Handle, "CH3");
+ Assert.IsNotNull (child.Handle, "CH4");
+ Assert.IsTrue (parent.IsHandleCreated, "CH5");
+ Assert.IsTrue (child.IsHandleCreated, "CH6");
+ } finally {
+ if (parent != null)
+ parent.Dispose ();
+ if (child != null)
+ child.Dispose ();
+ }
+
+ // Accessing Handle Property creates the handle
+ try {
+ parent = new Control ();
+ parent.Visible = true;
+ child = new Control ();
+ parent.Controls.Add (child);
+ Assert.IsFalse (parent.IsHandleCreated, "CH7");
+ Assert.IsFalse (child.IsHandleCreated, "CH8");
+ Assert.IsNotNull (parent.Handle, "CH9");
+ Assert.IsTrue (parent.IsHandleCreated, "CH10");
+ Assert.IsTrue (child.IsHandleCreated, "CH11");
+ } finally {
+ if (parent != null)
+ parent.Dispose ();
+ if (child != null)
+ child.Dispose ();
+ }
+ }
+
+ [Test]
+ public void CreateGraphicsTest ()
+ {
+ Graphics g = null;
+ Pen p = null;
+
+ try {
+ Control c = new Control ();
+ c.SetBounds (0,0, 20, 20);
+ g = c.CreateGraphics ();
+ Assert.IsNotNull (g, "Graph1");
+ } finally {
+ if (p != null)
+ p.Dispose ();
+ if (g != null)
+ g.Dispose ();
+ }
+ }
+
+ bool delegateCalled = false;
+ public delegate void TestDelegate ();
+
+ [Test]
+ [ExpectedException(typeof(System.InvalidOperationException))]
+ public void InvokeException1 () {
+ Control c = new Control ();
+ IAsyncResult result;
+
+ result = c.BeginInvoke (new TestDelegate (delegate_call));
+ c.EndInvoke (result);
+ }
+
+ [Test]
+ public void InvokeTest () {
+ Control c = null;
+
+ try {
+ c = new Control ();
+ IAsyncResult result;
+
+ c.CreateControl ();
+ result = c.BeginInvoke (new TestDelegate (delegate_call));
+ c.EndInvoke (result);
+ Assert.AreEqual (true, delegateCalled, "Invoke1");
+ } finally {
+ if (c != null)
+ c.Dispose ();
+ }
+ }
+
+ public void delegate_call () {
+ delegateCalled = true;
+ }
+
+ [Test]
+ public void FindFormTest () {
+ Form f = new Form ();
+
+ f.Name = "form";
+ Control c = null;
+
+ try {
+ f.Controls.Add (c = new Control ());
+ Assert.AreEqual (f.Name, c.FindForm ().Name, "Find1");
+
+ f.Controls.Remove (c);
+
+ GroupBox g = new GroupBox ();
+ g.Name = "box";
+ f.Controls.Add (g);
+ g.Controls.Add (c);
+
+ Assert.AreEqual (f.Name, f.FindForm ().Name, "Find2");
+
+ g.Controls.Remove (c);
+ Assert.IsNull(c.FindForm (), "Find3");
+
+ } finally {
+ if (c != null)
+ c.Dispose ();
+ if (f != null)
+ f.Dispose ();
+ }
+ }
+
+ [Test]
+ public void FocusTest ()
+ {
+ Form f = null;
+ Button c = null, d = null;
+
+ try {
+ f = new Form ();
+ f.Visible = true;
+ c = new Button ();
+ c.Visible = true;
+ f.Controls.Add (c);
+
+ d = new Button ();
+ d.Visible = false;
+ f.Controls.Add (d);
+
+ Assert.IsTrue (c.CanFocus, "Focus1");
+ Assert.IsFalse (c.Focused, "Focus2");
+ c.Focus ();
+ Assert.IsTrue (c.Focused, "Focus3");
+ d.Focus ();
+ Assert.IsFalse (d.Focused, "Focus4");
+
+ d.Visible = true;
+ d.Focus ();
+ Assert.IsTrue (d.Focused, "Focus5");
+ Assert.IsFalse (c.Focused, "Focus6");
+
+ c.Enabled = false;
+ Assert.IsFalse (c.Focused, "Focus7");
+ } finally {
+ if (f != null)
+ f.Dispose ();
+ if (c != null)
+ c.Dispose ();
+ if (d != null)
+ d.Dispose ();
+ }
+ }
+
+ [Test]
+ public void FromHandleTest ()
+ {
+ Control c1 = null;
+ Control c2 = null;
+
+ try {
+ c1 = new Control ();
+ c2 = new Control ();
+
+ c1.Name = "parent";
+ c2.Name = "child";
+ c1.Controls.Add(c2);
+
+ // Handle
+ Assert.AreEqual (c1.Name, Control.FromHandle (c1.Handle).Name, "Handle1");
+ Assert.IsNull (Control.FromHandle (IntPtr.Zero), "Handle2");
+
+ // ChildHandle
+ Assert.AreEqual (c1.Name, Control.FromChildHandle (c1.Handle).Name, "Handle3");
+ Assert.IsNull (Control.FromChildHandle (IntPtr.Zero), "Handle4");
+
+
+ } finally {
+ if (c1 != null)
+ c1.Dispose ();
+
+ if (c2 != null)
+ c2.Dispose ();
+ }
+ }
+
+ [Test]
+ public void GetChildAtPointTest ()
+ {
+ Control c = null, d = null, e = null;
+
+ try {
+ c = new Control ();
+ c.Name = "c1";
+ c.SetBounds (0, 0, 100, 100);
+
+ d = new Control ();
+ d.Name = "d1";
+ d.SetBounds (10, 10, 40, 40);
+ c.Controls.Add (d);
+
+ e = new Control ();
+ e.Name = "e1";
+ e.SetBounds (55, 55, 10, 10);
+
+ Control l = c.GetChildAtPoint (new Point (15, 15));
+ Assert.AreEqual (d.Name, l.Name, "Child1");
+ Assert.IsFalse (e.Name == l.Name, "Child2");
+
+ l = c.GetChildAtPoint (new Point (57, 57));
+ Assert.IsNull (l, "Child3");
+
+ l = c.GetChildAtPoint (new Point (10, 10));
+ Assert.AreEqual (d.Name, l.Name, "Child4");
+
+ // GetChildAtPointSkip is not implemented and the following test is breaking for Net_2_0 profile
+// #if NET_2_0
+// c.Controls.Add (e);
+// e.Visible = false;
+// l = c.GetChildAtPoint (new Point (57, 57), GetChildAtPointSkip.Invisible);
+// Assert.IsNull (l, "Child5");
+
+// e.Visible = true;
+// l = c.GetChildAtPoint (new Point (57, 57), GetChildAtPointSkip.Invisible);
+// Assert.AreSame (e.Name, l.Name, "Child6");
+// #endif // NET_2_0
+ } finally {
+ if (c != null)
+ c.Dispose ();
+ if (d != null)
+ d.Dispose ();
+ }
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/CursorTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/CursorTest.cs
new file mode 100644
index 00000000000..e7123e1891d
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/CursorTest.cs
@@ -0,0 +1,29 @@
+//
+// Copyright (c) 2005 Novell, Inc.
+//
+// Authors:
+// Miguel de Icaza
+//
+
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ public class CursorTest
+ {
+ [Test]
+ public void LoadCursorKind2 ()
+ {
+ //
+ // This test tries to load a cursor with type 1
+ // this contains an and mask, it used to crash
+ //
+
+ new Cursor (typeof (CursorTest).Assembly.GetManifestResourceStream ("a.cur"));
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridCellTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridCellTest.cs
new file mode 100644
index 00000000000..5213c36003a
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridCellTest.cs
@@ -0,0 +1,56 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Jordi Mas i Hernandez <jordi@ximian.com>
+//
+//
+
+using System;
+using System.ComponentModel;
+using System.Windows.Forms;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ class DataGridCellTest
+ {
+ private bool eventhandled;
+
+
+ [Test]
+ public void TestDefaultValues ()
+ {
+ DataGridCell cell = new DataGridCell (5, 10);
+
+ Assert.AreEqual (5, cell.RowNumber, "A1 RowNumber");
+ Assert.AreEqual (10, cell.ColumnNumber, "A2 ColumnNumber");
+
+ cell.ColumnNumber = 20;
+ cell.RowNumber = 30;
+
+ Assert.AreEqual (30, cell.RowNumber, "A3 RowNumber");
+ Assert.AreEqual (20, cell.ColumnNumber, "A4 ColumnNumber");
+ }
+
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridTableStyleTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridTableStyleTest.cs
new file mode 100644
index 00000000000..97cbda27cb3
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridTableStyleTest.cs
@@ -0,0 +1,270 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Jordi Mas i Hernandez <jordi@ximian.com>
+//
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Drawing;
+using System.Windows.Forms;
+using System.Xml;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ class DataGridTableStyleTest
+ {
+ private bool eventhandled;
+
+ [TearDown]
+ public void Clean() {}
+
+ [SetUp]
+ public void GetReady ()
+ {
+ }
+
+ [Test]
+ public void TestDefaultValues ()
+ {
+ DataGridTableStyle dg = new DataGridTableStyle ();
+
+ Assert.AreEqual (true, dg.AllowSorting, "AllowSorting property");
+ Assert.AreEqual (true, dg.ColumnHeadersVisible, "ColumnHeadersVisible property");
+ Assert.AreEqual (DataGridLineStyle.Solid, dg.GridLineStyle, "GridLineStyle property");
+ Assert.AreEqual (75, dg.PreferredColumnWidth, "PreferredColumnWidth property");
+ Assert.AreEqual (16, dg.PreferredRowHeight, "PreferredRowHeight property");
+ Assert.AreEqual (false, dg.ReadOnly, "ReadOnly property");
+ Assert.AreEqual (true, dg.RowHeadersVisible, "RowHeadersVisible property");
+ Assert.AreEqual (35, dg.RowHeaderWidth, "RowHeaderWidth property");
+ }
+
+ [Test]
+ public void TestAllowSortingChangedEvent ()
+ {
+ DataGridTableStyle dg = new DataGridTableStyle ();
+ eventhandled = false;
+ dg.AllowSortingChanged += new EventHandler (OnEventHandler);
+ dg.AllowSorting = !dg.AllowSorting;
+ Assert.AreEqual (true, eventhandled, "A1");
+ }
+
+ [Test]
+ public void TestAlternatingBackColorChangedEvent ()
+ {
+ DataGridTableStyle dg = new DataGridTableStyle ();
+ eventhandled = false;
+ dg.AlternatingBackColorChanged += new EventHandler (OnEventHandler);
+ dg.AlternatingBackColor = Color.Red;
+ Assert.AreEqual (true, eventhandled, "A1");
+ }
+
+ [Ignore ("Microsoft lunches ForeColor event instead of BackColor")]
+ public void TestBackColorChangedEvent ()
+ {
+ DataGridTableStyle dg = new DataGridTableStyle ();
+ eventhandled = false;
+ dg.BackColorChanged += new EventHandler (OnEventHandler);
+ dg.BackColor = Color.Yellow;
+ Assert.AreEqual (true, eventhandled, "A1");
+ }
+
+ [Test]
+ public void TestColumnHeadersVisibleChangedEvent ()
+ {
+ DataGridTableStyle dg = new DataGridTableStyle ();
+ eventhandled = false;
+ dg.ColumnHeadersVisibleChanged += new EventHandler (OnEventHandler);
+ dg.ColumnHeadersVisible = !dg.ColumnHeadersVisible;
+ Assert.AreEqual (true, eventhandled, "A1");
+ }
+
+ [Ignore ("Microsoft lunches BackColor event instead of ForeColor")]
+ public void TestForeColorChangedEvent ()
+ {
+ DataGridTableStyle dg = new DataGridTableStyle ();
+ eventhandled = false;
+ dg.ForeColorChanged += new EventHandler (OnEventHandler);
+ dg.ForeColor = Color.Red;
+ Assert.AreEqual (true, eventhandled, "A1");
+ }
+
+ [Test]
+ public void TestGridLineColorChangedEvent ()
+ {
+ DataGridTableStyle dg = new DataGridTableStyle ();
+ eventhandled = false;
+ dg.GridLineColorChanged += new EventHandler (OnEventHandler);
+ dg.GridLineColor = Color.Red;
+ Assert.AreEqual (true, eventhandled, "A1");
+ }
+
+ [Test]
+ public void TestGridLineStyleChangedEvent ()
+ {
+ DataGridTableStyle dg = new DataGridTableStyle ();
+ eventhandled = false;
+ dg.GridLineStyleChanged += new EventHandler (OnEventHandler);
+ dg.GridLineStyle = DataGridLineStyle.None;
+ Assert.AreEqual (true, eventhandled, "A1");
+ }
+
+ [Test]
+ public void TestHeaderBackColorChangedEvent ()
+ {
+ DataGridTableStyle dg = new DataGridTableStyle ();
+ eventhandled = false;
+ dg.HeaderBackColorChanged += new EventHandler (OnEventHandler);
+ dg.HeaderBackColor = Color.Red;
+ Assert.AreEqual (true, eventhandled, "A1");
+ }
+
+ [Test]
+ public void TestHeaderFontChangedEvent ()
+ {
+ DataGridTableStyle dg = new DataGridTableStyle ();
+ eventhandled = false;
+ dg.HeaderFontChanged += new EventHandler (OnEventHandler);
+ dg.HeaderFont = new Font ("Arial", 20);
+ Assert.AreEqual (true, eventhandled, "A1");
+ }
+
+ [Test]
+ public void TestHeaderForeColorChangedEvent ()
+ {
+ DataGridTableStyle dg = new DataGridTableStyle ();
+ eventhandled = false;
+ dg.HeaderForeColorChanged += new EventHandler (OnEventHandler);
+ dg.HeaderForeColor = Color.Red;
+ Assert.AreEqual (true, eventhandled, "A1");
+ }
+
+ [Test]
+ public void TestLinkColorChangedEvent ()
+ {
+ DataGridTableStyle dg = new DataGridTableStyle ();
+ eventhandled = false;
+ dg.LinkColorChanged += new EventHandler (OnEventHandler);
+ dg.LinkColor = Color.Red;
+ Assert.AreEqual (true, eventhandled, "A1");
+ }
+
+
+ [Ignore ("Microsoft is not firing any event")]
+ public void TestLinkHoverColorChangedEvent ()
+ {
+ DataGridTableStyle dg = new DataGridTableStyle ();
+ eventhandled = false;
+ dg.LinkHoverColorChanged += new EventHandler (OnEventHandler);
+ dg.LinkHoverColor = Color.Red;
+ Assert.AreEqual (true, eventhandled, "A1");
+ }
+
+ [Test]
+ public void TestMappingNameChangedEvent ()
+ {
+ DataGridTableStyle dg = new DataGridTableStyle ();
+ eventhandled = false;
+ dg.MappingNameChanged += new EventHandler (OnEventHandler);
+ dg.MappingName = "name1";
+ Assert.AreEqual (true, eventhandled, "A1");
+ }
+
+ [Test]
+ public void TestPreferredColumnWidthChangedEvent ()
+ {
+ DataGridTableStyle dg = new DataGridTableStyle ();
+ eventhandled = false;
+ dg.PreferredColumnWidthChanged += new EventHandler (OnEventHandler);
+ dg.PreferredColumnWidth = dg.PreferredColumnWidth++;
+ Assert.AreEqual (true, eventhandled, "A1");
+ }
+
+ [Test]
+ public void TestPreferredRowHeightChangedEvent ()
+ {
+ DataGridTableStyle dg = new DataGridTableStyle ();
+ eventhandled = false;
+ dg.PreferredRowHeightChanged += new EventHandler (OnEventHandler);
+ dg.PreferredRowHeight = dg.PreferredRowHeight++;
+ Assert.AreEqual (true, eventhandled, "A1");
+ }
+ [Test]
+ public void TestReadOnlyChangedEvent ()
+ {
+ DataGridTableStyle dg = new DataGridTableStyle ();
+ eventhandled = false;
+ dg.ReadOnlyChanged += new EventHandler (OnEventHandler);
+ dg.ReadOnly = !dg.ReadOnly;
+ Assert.AreEqual (true, eventhandled, "A1");
+ }
+
+ [Test]
+ public void TestRowHeadersVisibleChangedEvent ()
+ {
+ DataGridTableStyle dg = new DataGridTableStyle ();
+ eventhandled = false;
+ dg.RowHeadersVisibleChanged += new EventHandler (OnEventHandler);
+ dg.RowHeadersVisible = !dg.RowHeadersVisible;
+ Assert.AreEqual (true, eventhandled, "A1");
+ }
+
+ [Test]
+ public void TestRowHeaderWidthChangedEvent ()
+ {
+ DataGridTableStyle dg = new DataGridTableStyle ();
+ eventhandled = false;
+ dg.RowHeaderWidthChanged += new EventHandler (OnEventHandler);
+ dg.RowHeaderWidth = dg.RowHeaderWidth++;
+ Assert.AreEqual (true, eventhandled, "A1");
+ }
+
+ [Test]
+ public void TestSelectionBackColorChangedEvent ()
+ {
+ DataGridTableStyle dg = new DataGridTableStyle ();
+ eventhandled = false;
+ dg.SelectionBackColorChanged += new EventHandler (OnEventHandler);
+ dg.SelectionBackColor = Color.Red;
+ Assert.AreEqual (true, eventhandled, "A1");
+ }
+
+ [Test]
+ public void TestSelectionForeColorChangedEvent ()
+ {
+ DataGridTableStyle dg = new DataGridTableStyle ();
+ eventhandled = false;
+ dg.SelectionForeColorChanged += new EventHandler (OnEventHandler);
+ dg.SelectionForeColor = Color.Red;
+ Assert.AreEqual (true, eventhandled, "A1");
+ }
+
+ public void OnEventHandler (object sender, EventArgs e)
+ {
+ eventhandled = true;
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridTest.cs
new file mode 100644
index 00000000000..77b061906a1
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridTest.cs
@@ -0,0 +1,314 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Jordi Mas i Hernandez <jordi@ximian.com>
+//
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Drawing;
+using System.Windows.Forms;
+using System.Xml;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Forms
+{
+ // Helper classes
+
+ class TestDataGrid : DataGrid
+ {
+ public TestDataGrid ()
+ {
+
+ }
+
+ public CurrencyManager Manager {
+ get {
+ return ListManager;
+ }
+ }
+ }
+
+ [TestFixture]
+ class DataGridTest
+ {
+ private bool eventhandled;
+
+ [TearDown]
+ public void Clean() {}
+
+ [SetUp]
+ public void GetReady ()
+ {
+ }
+
+ [Test]
+ public void TestDefaultValues ()
+ {
+ DataGrid dg = new DataGrid ();
+
+ Assert.AreEqual (true, dg.AllowNavigation, "AllowNavigation property");
+ Assert.AreEqual (true, dg.AllowSorting, "AllowSorting property");
+ Assert.AreEqual (BorderStyle.Fixed3D, dg.BorderStyle, "BorderStyle property");
+ Assert.AreEqual (string.Empty, dg.CaptionText, "CaptionText property");
+ Assert.AreEqual (true, dg.CaptionVisible, "CaptionVisible property");
+ Assert.AreEqual (true, dg.ColumnHeadersVisible, "ColumnHeadersVisible property");
+ Assert.AreEqual (new DataGridCell (), dg.CurrentCell, "CurrentCell property");
+ Assert.AreEqual (-1, dg.CurrentRowIndex, "CurrentRowIndex property");
+ Assert.AreEqual (string.Empty, dg.DataMember, "DataMember property");
+ Assert.AreEqual (null, dg.DataSource, "DataSource property");
+ Assert.AreEqual (0, dg.FirstVisibleColumn, "FirstVisibleColumn property");
+ Assert.AreEqual (false, dg.FlatMode, "FlatMode property");
+ Assert.AreEqual (DataGridLineStyle.Solid, dg.GridLineStyle, "GridLineStyle property");
+ Assert.AreEqual (DataGridParentRowsLabelStyle.Both, dg.ParentRowsLabelStyle, "ParentRowsLabelStyle property");
+ Assert.AreEqual (true, dg.ParentRowsVisible, "ParentRowsVisible property");
+ Assert.AreEqual (75, dg.PreferredColumnWidth, "PreferredColumnWidth property");
+ //Assert.AreEqual (16, dg.PreferredRowHeight, "PreferredRowHeight property");
+ Assert.AreEqual (false, dg.ReadOnly, "ReadOnly property");
+ Assert.AreEqual (true, dg.RowHeadersVisible, "RowHeadersVisible property");
+ Assert.AreEqual (35, dg.RowHeaderWidth, "RowHeaderWidth property");
+ Assert.AreEqual (null, dg.Site, "Site property");
+ Assert.AreEqual (string.Empty, dg.Text, "Text property");
+ Assert.AreEqual (0, dg.VisibleColumnCount, "VisibleColumnCount property");
+ }
+
+ [Test]
+ public void TestAllowNavigationChangedEvent ()
+ {
+ DataGrid dg = new DataGrid ();
+ eventhandled = false;
+ dg.AllowNavigationChanged += new EventHandler (OnEventHandler);
+ dg.AllowNavigation = !dg.AllowNavigation;
+ Assert.AreEqual (true, eventhandled, "A1");
+ }
+
+ [Test]
+ public void TestBackgroundColorChangedEvent ()
+ {
+ DataGrid dg = new DataGrid ();
+ eventhandled = false;
+ dg.BackgroundColorChanged += new EventHandler (OnEventHandler);
+ dg.BackgroundColor = Color.Red;
+ Assert.AreEqual (true, eventhandled, "A1");
+ }
+
+ [Test]
+ public void TestBorderStyleChangedEvent ()
+ {
+ DataGrid dg = new DataGrid ();
+ eventhandled = false;
+ dg.BorderStyleChanged += new EventHandler (OnEventHandler);
+ dg.BorderStyle = BorderStyle.None;
+ Assert.AreEqual (true, eventhandled, "A1");
+ }
+
+ [Test]
+ public void TestCaptionVisibleChangedEvent ()
+ {
+ DataGrid dg = new DataGrid ();
+ eventhandled = false;
+ dg.CaptionVisibleChanged += new EventHandler (OnEventHandler);
+ dg.CaptionVisible = !dg.CaptionVisible;
+ Assert.AreEqual (true, eventhandled, "A1");
+ }
+
+ [Test]
+ public void TestFlatModeChangedEvent ()
+ {
+ DataGrid dg = new DataGrid ();
+ eventhandled = false;
+ dg.FlatModeChanged += new EventHandler (OnEventHandler);
+ dg.FlatMode = !dg.FlatMode;
+ Assert.AreEqual (true, eventhandled, "A1");
+ }
+
+ [Test]
+ public void TestParentRowsLabelStyleChangedEvent ()
+ {
+ DataGrid dg = new DataGrid ();
+ eventhandled = false;
+ dg.ParentRowsLabelStyleChanged += new EventHandler (OnEventHandler);
+ dg.ParentRowsLabelStyle = DataGridParentRowsLabelStyle.None;
+ Assert.AreEqual (true, eventhandled, "A1");
+ }
+
+ [Test]
+ public void TestParentRowsVisibleChangedEvent ()
+ {
+ DataGrid dg = new DataGrid ();
+ eventhandled = false;
+ dg.ParentRowsVisibleChanged += new EventHandler (OnEventHandler);
+ dg.ParentRowsVisible = !dg.ParentRowsVisible;
+ Assert.AreEqual (true, eventhandled, "A1");
+ }
+
+ [Test]
+ public void TestReadOnlyChangedEvent ()
+ {
+ DataGrid dg = new DataGrid ();
+ eventhandled = false;
+ dg.ReadOnlyChanged += new EventHandler (OnEventHandler);
+ dg.ReadOnly = !dg.ReadOnly;
+ Assert.AreEqual (true, eventhandled, "A1");
+ }
+
+ public void OnEventHandler (object sender, EventArgs e)
+ {
+ eventhandled = true;
+ }
+
+ // Property exceptions
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void GridLineColorException ()
+ {
+ DataGrid dg = new DataGrid ();
+ dg.GridLineColor = Color.Empty;
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void HeaderBackColorException ()
+ {
+ DataGrid dg = new DataGrid ();
+ dg.HeaderBackColor = Color.Empty;
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void PreferredColumnWidthException ()
+ {
+ DataGrid dg = new DataGrid ();
+ dg.PreferredColumnWidth = -1;
+ }
+
+ [Test]
+ public void ResetAlternatingBackColor ()
+ {
+ DataGrid dg = new DataGrid ();
+ DataGrid dg2 = new DataGrid ();
+ dg2.AlternatingBackColor = Color.Red;
+ dg2.ResetAlternatingBackColor ();
+ Assert.AreEqual (dg.AlternatingBackColor, dg2.AlternatingBackColor, "A1");
+ }
+
+ // Test reset colour methods
+ [Test]
+ public void ResetBackColorMethod ()
+ {
+ DataGrid dg = new DataGrid ();
+ DataGrid dg2 = new DataGrid ();
+ dg2.BackColor = Color.Red;
+ dg2.ResetBackColor ();
+ Assert.AreEqual (dg.BackColor, dg2.BackColor, "A1");
+ }
+
+ [Test]
+ public void ResetForeColorMethod ()
+ {
+ DataGrid dg = new DataGrid ();
+ DataGrid dg2 = new DataGrid ();
+ dg2.ForeColor = Color.Red;
+ dg2.ResetForeColor ();
+ Assert.AreEqual (dg.ForeColor, dg2.ForeColor, "A1");
+ }
+
+ [Test]
+ public void ResetGridLineColorMethod ()
+ {
+ DataGrid dg = new DataGrid ();
+ DataGrid dg2 = new DataGrid ();
+ dg2.GridLineColor = Color.Red;
+ dg2.ResetGridLineColor ();
+ Assert.AreEqual (dg.GridLineColor, dg2.GridLineColor, "A1");
+ }
+
+ [Test]
+ public void ResetHeaderBackColorMethod ()
+ {
+ DataGrid dg = new DataGrid ();
+ DataGrid dg2 = new DataGrid ();
+ dg2.HeaderBackColor = Color.Red;
+ dg2.ResetHeaderBackColor ();
+ Assert.AreEqual (dg.HeaderBackColor, dg2.HeaderBackColor, "A1");
+ }
+
+ [Test]
+ public void ResetHeaderFontMethod ()
+ {
+ }
+
+ [Test]
+ public void ResetHeaderForeColorMethod ()
+ {
+ DataGrid dg = new DataGrid ();
+ DataGrid dg2 = new DataGrid ();
+ dg2.HeaderForeColor = Color.Red;
+ dg2.ResetHeaderForeColor ();
+ Assert.AreEqual (dg.HeaderForeColor, dg2.HeaderForeColor, "A1");
+ }
+
+ [Test]
+ public void ResetLinkColorMethod ()
+ {
+ DataGrid dg = new DataGrid ();
+ DataGrid dg2 = new DataGrid ();
+ dg2.LinkColor = Color.Red;
+ dg2.ResetLinkColor ();
+ Assert.AreEqual (dg.LinkColor, dg2.LinkColor, "A1");
+ }
+
+ [Test]
+ public void ResetLinkHoverColor ()
+ {
+ DataGrid dg = new DataGrid ();
+ DataGrid dg2 = new DataGrid ();
+ dg2.LinkHoverColor = Color.Red;
+ dg2.ResetLinkHoverColor ();
+ Assert.AreEqual (dg.LinkHoverColor, dg2.LinkHoverColor, "A1");
+ }
+
+ [Test]
+ public void ResetSelectionBackColor ()
+ {
+ DataGrid dg = new DataGrid ();
+ DataGrid dg2 = new DataGrid ();
+ dg2.SelectionBackColor = Color.Red;
+ dg2.ResetSelectionBackColor ();
+ Assert.AreEqual (dg.SelectionBackColor, dg2.SelectionBackColor, "A1");
+ }
+
+ [Test]
+ public void ResetSelectionForeColor ()
+ {
+ DataGrid dg = new DataGrid ();
+ DataGrid dg2 = new DataGrid ();
+ dg2.SelectionForeColor = Color.Red;
+ dg2.ResetSelectionForeColor ();
+ Assert.AreEqual (dg.SelectionForeColor, dg2.SelectionForeColor, "A1");
+ }
+
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridTextBoxColumnTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridTextBoxColumnTest.cs
new file mode 100644
index 00000000000..601faae3cfd
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridTextBoxColumnTest.cs
@@ -0,0 +1,105 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Jordi Mas i Hernandez <jordi@ximian.com>
+//
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Drawing;
+using System.Windows.Forms;
+using System.Xml;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ class DataGridTextBoxColumnTest
+ {
+ private bool eventhandled;
+ private object Element;
+ private CollectionChangeAction Action;
+
+ [Test]
+ public void TestDefaultValues ()
+ {
+ DataGridTextBoxColumn col = new DataGridTextBoxColumn ();
+
+ Assert.AreEqual (HorizontalAlignment.Left, col.Alignment, "HorizontalAlignment property");
+ Assert.AreEqual ("", col.HeaderText, "HeaderText property");
+ Assert.AreEqual ("", col.MappingName, "MappingName property");
+ Assert.AreEqual ("(null)", col.NullText, "NullText property");
+ Assert.AreEqual (false, col.ReadOnly, "ReadOnly property");
+ Assert.AreEqual (-1, col.Width, "Width property");
+ Assert.AreEqual ("", col.Format, "Format property");
+ Assert.AreEqual (null, col.FormatInfo, "FormatInfo property");
+ }
+
+ [Test]
+ public void TestMappingNameChangedEvent ()
+ {
+ DataGridTextBoxColumn col = new DataGridTextBoxColumn ();
+ eventhandled = false;
+ col.MappingNameChanged += new EventHandler (OnEventHandler);
+ col.MappingName = "name1";
+ Assert.AreEqual (true, eventhandled, "A1");
+ }
+
+ [Test]
+ public void TestAlignmentChangedEvent ()
+ {
+ DataGridTextBoxColumn col = new DataGridTextBoxColumn ();
+ eventhandled = false;
+ col.AlignmentChanged += new EventHandler (OnEventHandler);
+ col.Alignment = HorizontalAlignment.Center;
+ Assert.AreEqual (true, eventhandled, "A1");
+ }
+
+ [Test]
+ public void TestHeaderTextChangedEvent ()
+ {
+ DataGridTextBoxColumn col = new DataGridTextBoxColumn ();
+ eventhandled = false;
+ col.HeaderTextChanged += new EventHandler (OnEventHandler);
+ col.HeaderText = "Header";
+ Assert.AreEqual (true, eventhandled, "A1");
+ }
+
+ [Test]
+ public void TestNullTextChangedEvent ()
+ {
+ DataGridTextBoxColumn col = new DataGridTextBoxColumn ();
+ eventhandled = false;
+ col.NullTextChanged += new EventHandler (OnEventHandler);
+ col.NullText = "Null";
+ Assert.AreEqual (true, eventhandled, "A1");
+ }
+
+
+ private void OnEventHandler (object sender, EventArgs e)
+ {
+ eventhandled = true;
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewAdvancedBorderStyleTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewAdvancedBorderStyleTest.cs
new file mode 100644
index 00000000000..7d125797913
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewAdvancedBorderStyleTest.cs
@@ -0,0 +1,149 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using NUnit.Framework;
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+using System.ComponentModel;
+using System.Collections;
+
+namespace MonoTests.System.Windows.Forms {
+
+ [TestFixture]
+ public class DataGridViewAdvancedBorderStyleTest : Assertion {
+
+ private DataGridViewAdvancedBorderStyle style;
+
+ [SetUp]
+ public void GetReady() {
+ style = new DataGridViewAdvancedBorderStyle();
+ }
+
+ [TearDown]
+ public void Clean() {
+ }
+
+ [Test]
+ public void TestDefaultValues () {
+ AssertEquals("All property before any change", DataGridViewAdvancedCellBorderStyle.None, style.All);
+ style.Left = DataGridViewAdvancedCellBorderStyle.Single;
+ AssertEquals("All property after changes", DataGridViewAdvancedCellBorderStyle.NotSet, style.All);
+ style.All = DataGridViewAdvancedCellBorderStyle.Single;
+ AssertEquals("All property after changes", DataGridViewAdvancedCellBorderStyle.Single, style.All);
+ AssertEquals("Left property after changes", DataGridViewAdvancedCellBorderStyle.Single, style.Left);
+ AssertEquals("Right property after changes", DataGridViewAdvancedCellBorderStyle.Single, style.Right);
+ AssertEquals("Top property after changes", DataGridViewAdvancedCellBorderStyle.Single, style.Top);
+ AssertEquals("Bottom property after changes", DataGridViewAdvancedCellBorderStyle.Single, style.Bottom);
+ }
+
+ [Test]
+ [ExpectedException(typeof(InvalidEnumArgumentException))]
+ public void TestLeftInvalidEnumArgumentException () {
+ style.Left = (DataGridViewAdvancedCellBorderStyle) 8;
+ }
+
+ [Test]
+ [ExpectedException(typeof(ArgumentException))]
+ public void TestLeftArgumentException1 () {
+ style.Left = DataGridViewAdvancedCellBorderStyle.NotSet;
+ }
+
+ /*
+ [Test]
+ [ExpectedException(typeof(ArgumentException))]
+ public void TestLeftArgumentException2 () {
+ Control.RightToLeft = true;
+ style.Left = DataGridViewAdvancedCellBorderStyle.InsetDouble;
+ }
+
+ [Test]
+ [ExpectedException(typeof(ArgumentException))]
+ public void TestLeftArgumentException3 () {
+ Control.RightToLeft = true;
+ style.Left = DataGridViewAdvancedCellBorderStyle.OutsetDouble;
+ }
+ */
+
+ [Test]
+ [ExpectedException(typeof(InvalidEnumArgumentException))]
+ public void TestRightInvalidEnumArgumentException () {
+ style.Right = (DataGridViewAdvancedCellBorderStyle) 8;
+ }
+
+ [Test]
+ [ExpectedException(typeof(ArgumentException))]
+ public void TestRightArgumentException1 () {
+ style.Right = DataGridViewAdvancedCellBorderStyle.NotSet;
+ }
+
+ /*
+ [Test]
+ [ExpectedException(typeof(ArgumentException))]
+ public void TestRightArgumentException2 () {
+ Control.RightToLeft = false;
+ style.Right = DataGridViewAdvancedCellBorderStyle.InsetDouble;
+ }
+
+ [Test]
+ [ExpectedException(typeof(ArgumentException))]
+ public void TestRightArgumentException3 () {
+ Control.RightToLeft = false;
+ style.Right = DataGridViewAdvancedCellBorderStyle.OutsetDouble;
+ }
+ */
+
+ [Test]
+ [ExpectedException(typeof(InvalidEnumArgumentException))]
+ public void TestTopInvalidEnumArgumentException () {
+ style.Top = (DataGridViewAdvancedCellBorderStyle) 8;
+ }
+
+ [Test]
+ [ExpectedException(typeof(ArgumentException))]
+ public void TestTopArgumentException () {
+ style.Top = DataGridViewAdvancedCellBorderStyle.NotSet;
+ }
+
+ [Test]
+ [ExpectedException(typeof(InvalidEnumArgumentException))]
+ public void TestBottomInvalidEnumArgumentException () {
+ style.Bottom = (DataGridViewAdvancedCellBorderStyle) 8;
+ }
+
+ [Test]
+ [ExpectedException(typeof(ArgumentException))]
+ public void TestBottomArgumentException () {
+ style.Bottom = DataGridViewAdvancedCellBorderStyle.NotSet;
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewBandTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewBandTest.cs
new file mode 100644
index 00000000000..475237c7d14
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewBandTest.cs
@@ -0,0 +1,73 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using NUnit.Framework;
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+using System.ComponentModel;
+using System.Collections;
+
+namespace MonoTests.System.Windows.Forms {
+
+ [TestFixture]
+ public class DataGridViewBandTest : Assertion {
+
+ [SetUp]
+ public void GetReady() {}
+
+ [TearDown]
+ public void Clean() {}
+
+ [Test]
+ public void TestDefaultValues () {
+ DataGridViewBand band = new DataGridViewBand();
+ // AssertEquals("ContextMenuStrip property", null, band.ContextMenuStrip);
+ AssertEquals("Frozen", false, band.Frozen);
+ AssertEquals("HasDefaultCellStyle property", false, band.HasDefaultCellStyle);
+ AssertEquals("Index property", -1, band.Index);
+ AssertEquals("InheritedStyle property", null, band.InheritedStyle);
+ AssertEquals("ReadOnly property", false, band.ReadOnly);
+ AssertEquals("Resizable property", DataGridViewTriState.True, band.Resizable);
+ AssertEquals("Selected property", false, band.Selected);
+ AssertEquals("Tag property", null, band.Tag);
+ AssertEquals("Visible property", true, band.Visible);
+ }
+
+ [Test]
+ [ExpectedException(typeof(InvalidOperationException))]
+ public void TestSelectedInvalidOperationException () {
+ DataGridViewBand band = new DataGridViewBand();
+ band.Selected = true;
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewCellStyleTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewCellStyleTest.cs
new file mode 100644
index 00000000000..269ab9fb9fb
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewCellStyleTest.cs
@@ -0,0 +1,125 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using NUnit.Framework;
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+using System.ComponentModel;
+using System.Collections;
+using System.Globalization;
+
+namespace MonoTests.System.Windows.Forms {
+
+ [TestFixture]
+ public class DataGridViewCellStyleTest : Assertion {
+
+ DataGridViewCellStyle style;
+
+ [SetUp]
+ public void GetReady() {
+ style = new DataGridViewCellStyle();
+ }
+
+ [TearDown]
+ public void Clean() {
+ style = new DataGridViewCellStyle();
+ }
+
+ [Test]
+ public void TestDefaultValues () {
+ AssertEquals("Alignment property", DataGridViewContentAlignment.NotSet, style.Alignment);
+ AssertEquals("BackColor property", Color.Empty, style.BackColor);
+ AssertEquals("Font property", null, style.Font);
+ AssertEquals("ForeColor property", Color.Empty, style.ForeColor);
+ AssertEquals("Format property", String.Empty, style.Format);
+ AssertEquals("FormatProvider property", CultureInfo.CurrentUICulture, style.FormatProvider);
+ AssertEquals("IsFormatProviderDefault property", true, style.IsFormatProviderDefault);
+ AssertEquals("IsNullValueDefault property", true, style.IsNullValueDefault);
+ AssertEquals("NullValue property", "(null)", style.NullValue);
+ AssertEquals("SelectionBackColor property", Color.Empty, style.SelectionBackColor);
+ AssertEquals("SelectionForeColor property", Color.Empty, style.SelectionForeColor);
+ AssertEquals("Tag property", null, style.Tag);
+ AssertEquals("WrapMode property", DataGridViewTriState.NotSet, style.WrapMode);
+ }
+
+ [Test]
+ public void TestApplyStyle () {
+ DataGridViewCellStyle style_aux = new DataGridViewCellStyle();
+ style.ApplyStyle(style_aux);
+ AssertEquals("ApplyStyle method", style_aux, style);
+ }
+
+ [Test]
+ public void TestClone () {
+ DataGridViewCellStyle style_aux = (DataGridViewCellStyle) style.Clone();
+ AssertEquals("Clone method", style_aux, style);
+ }
+
+ [Test]
+ public void TestEquals () {
+ DataGridViewCellStyle style_aux = (DataGridViewCellStyle) style.Clone();
+ AssertEquals("Equals method", true, (style_aux.Equals(style)));
+ }
+
+ [Test]
+ [ExpectedException(typeof(InvalidEnumArgumentException))]
+ public void TestAlignmentInvalidEnumArgumentException () {
+ style.Alignment = DataGridViewContentAlignment.BottomCenter | DataGridViewContentAlignment.BottomRight;
+ }
+
+ [Test]
+ [ExpectedException(typeof(ArgumentException))]
+ public void TestSelectionBackColorArgumentException () {
+ style.SelectionBackColor = Color.FromArgb(100, Color.Red);
+ }
+
+ [Test]
+ [ExpectedException(typeof(InvalidEnumArgumentException))]
+ public void TestWrapModeInvalidEnumArgumentException () {
+ style.WrapMode = (DataGridViewTriState) 3;
+ }
+
+ /*
+ [Test]
+ [ExpectedException(typeof(Exception))]
+ public void TestException () {
+ ConcreteCollection myCollection;
+ myCollection = new ConcreteCollection();
+ ....
+ AssertEquals ("#UniqueID", expected, actual);
+ ....
+ Fail ("Message");
+ }
+ */
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewCellTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewCellTest.cs
new file mode 100644
index 00000000000..4b133b16760
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewCellTest.cs
@@ -0,0 +1,74 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using NUnit.Framework;
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+using System.ComponentModel;
+using System.Collections;
+
+namespace MonoTests.System.Windows.Forms {
+
+ [TestFixture]
+ public class DataGridViewCellTest : Assertion {
+
+ [SetUp]
+ public void GetReady() {}
+
+ [TearDown]
+ public void Clean() {}
+
+ [Test]
+ public void TestDefaultValues () {
+ }
+
+ [Test]
+ [ExpectedException(typeof(InvalidEnumArgumentException))]
+ public void TestException () {
+ throw new InvalidEnumArgumentException();
+ }
+
+ /*
+ [Test]
+ [ExpectedException(typeof(Exception))]
+ public void TestException () {
+ ConcreteCollection myCollection;
+ myCollection = new ConcreteCollection();
+ ....
+ AssertEquals ("#UniqueID", expected, actual);
+ ....
+ Fail ("Message");
+ }
+ */
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewElementTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewElementTest.cs
new file mode 100644
index 00000000000..36d9306dda2
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewElementTest.cs
@@ -0,0 +1,57 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using NUnit.Framework;
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+using System.ComponentModel;
+using System.Collections;
+
+namespace MonoTests.System.Windows.Forms {
+
+ [TestFixture]
+ public class DataGridViewElementTest : Assertion {
+
+ [SetUp]
+ public void GetReady() {}
+
+ [TearDown]
+ public void Clean() {}
+
+ [Test]
+ public void TestDefaultValues () {
+ DataGridViewElement element = new DataGridViewElement();
+ AssertEquals("DataGridView property", null, element.DataGridView);
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewRowTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewRowTest.cs
new file mode 100644
index 00000000000..41cfde87aa0
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewRowTest.cs
@@ -0,0 +1,64 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using NUnit.Framework;
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+using System.ComponentModel;
+using System.Collections;
+
+namespace MonoTests.System.Windows.Forms {
+
+ [TestFixture]
+ public class DataGridViewRowTest : Assertion {
+
+ [SetUp]
+ public void GetReady() {}
+
+ [TearDown]
+ public void Clean() {}
+
+ [Test]
+ public void TestDefaultValues () {
+ }
+
+ [Test]
+ [ExpectedException(typeof(InvalidOperationException))]
+ public void TestVisibleInvalidOperationException () {
+ DataGridView grid = new DataGridView();
+ DataGridViewRow row = new DataGridViewRow();
+ grid.Rows.Add(row);
+ row.Visible = false;
+ }
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewTest.cs
new file mode 100644
index 00000000000..a0dd21e9ce0
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewTest.cs
@@ -0,0 +1,282 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Pedro Martínez Juliá <pedromj@gmail.com>
+//
+
+
+#if NET_2_0
+
+using NUnit.Framework;
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+using System.ComponentModel;
+using System.Collections;
+
+namespace MonoTests.System.Windows.Forms {
+
+ [TestFixture]
+ public class DataGridViewTest : Assertion {
+
+ [SetUp]
+ public void GetReady() {}
+
+ [TearDown]
+ public void Clean() {}
+
+ [Test]
+ public void TestDefaultValues () {
+ DataGridView grid = new DataGridView();
+ AssertEquals("AllowUserToAddRows property", true, grid.AllowUserToAddRows);
+ AssertEquals("AllowUserToDeleteRows property", true, grid.AllowUserToDeleteRows);
+ AssertEquals("AllowUserToOrderColumns property", false, grid.AllowUserToOrderColumns);
+ AssertEquals("AllowUserToResizeColumns property", true, grid.AllowUserToResizeColumns);
+ AssertEquals("AllowUserToResizeRows property", true, grid.AllowUserToResizeRows);
+ AssertEquals("AlternatingRowsDefaultCellStyle property", new DataGridViewCellStyle(), grid.AlternatingRowsDefaultCellStyle);
+ AssertEquals("AutoGenerateColumns property", true, grid.AutoGenerateColumns);
+ AssertEquals("AutoSizeRowsMode property", DataGridViewAutoSizeRowsMode.None, grid.AutoSizeRowsMode);
+ AssertEquals("BackColor property", Control.DefaultBackColor, grid.BackColor);
+ AssertEquals("BackgroundColor property", SystemColors.AppWorkspace, grid.BackgroundColor);
+ AssertEquals("BorderStyle property", BorderStyle.FixedSingle, grid.BorderStyle);
+ AssertEquals("ClipboardCopyMode property", DataGridViewClipboardCopyMode.EnableWithAutoHeaderText, grid.ClipboardCopyMode);
+ AssertEquals("ColumnHeadersDefaultCellStyle.BackColor property", SystemColors.Control, grid.ColumnHeadersDefaultCellStyle.BackColor);
+ AssertEquals("ColumnHeadersDefaultCellStyle.ForeColor property", SystemColors.WindowText, grid.ColumnHeadersDefaultCellStyle.ForeColor);
+ AssertEquals("ColumnHeadersDefaultCellStyle.SelectionBackColor property", SystemColors.Highlight, grid.ColumnHeadersDefaultCellStyle.SelectionBackColor);
+ AssertEquals("ColumnHeadersDefaultCellStyle.SelectionForeColor property", SystemColors.HighlightText, grid.ColumnHeadersDefaultCellStyle.SelectionForeColor);
+ AssertEquals("ColumnHeadersDefaultCellStyle.Font property", grid.Font, grid.ColumnHeadersDefaultCellStyle.Font);
+ AssertEquals("ColumnHeadersDefaultCellStyle.Alignment property", DataGridViewContentAlignment.MiddleLeft, grid.ColumnHeadersDefaultCellStyle.Alignment);
+ AssertEquals("ColumnHeadersDefaultCellStyle.WrapMode property", DataGridViewTriState.True, grid.ColumnHeadersDefaultCellStyle.WrapMode);
+ AssertEquals("ColumnHeadersHeight property", 23, grid.ColumnHeadersHeight);
+ AssertEquals("ColumnHeadersHeightSizeMode property", DataGridViewColumnHeadersHeightSizeMode.EnableResizing, grid.ColumnHeadersHeightSizeMode);
+ AssertEquals("ColumnHeadersVisible property", true, grid.ColumnHeadersVisible);
+ AssertEquals("DataMember property", String.Empty, grid.DataMember);
+ AssertEquals("DefaultCellStyle.BackColor property", SystemColors.Control, grid.DefaultCellStyle.BackColor);
+ AssertEquals("DefaultCellStyle.ForeColor property", SystemColors.WindowText, grid.DefaultCellStyle.ForeColor);
+ AssertEquals("DefaultCellStyle.SelectionBackColor property", SystemColors.Highlight, grid.DefaultCellStyle.SelectionBackColor);
+ AssertEquals("DefaultCellStyle.SelectionForeColor property", SystemColors.HighlightText, grid.DefaultCellStyle.SelectionForeColor);
+ AssertEquals("DefaultCellStyle.Font property", grid.Font, grid.DefaultCellStyle.Font);
+ AssertEquals("DefaultCellStyle.Alignment property", DataGridViewContentAlignment.MiddleLeft, grid.DefaultCellStyle.Alignment);
+ AssertEquals("DefaultCellStyle.WrapMode property", DataGridViewTriState.True, grid.DefaultCellStyle.WrapMode);
+ AssertEquals("EditMode property", DataGridViewEditMode.EditOnKeystrokeOrF2, grid.EditMode);
+ AssertEquals("Font property", Control.DefaultFont, grid.Font);
+ AssertEquals("ForeColor property", Control.DefaultForeColor, grid.ForeColor);
+ AssertEquals("GridColor property", Color.FromKnownColor(KnownColor.ControlDarkDark), grid.GridColor);
+ AssertEquals("MultiSelect property", true, grid.MultiSelect);
+ AssertEquals("NewRowIndex property", grid.Rows.Count - 1, grid.NewRowIndex);
+ AssertEquals("Padding property", Padding.Empty, grid.Padding);
+ AssertEquals("ReadOnly property", false, grid.ReadOnly);
+ AssertEquals("RowHeadersVisible property", true, grid.RowHeadersVisible);
+ AssertEquals("RowHeadersWidth property", 43, grid.RowHeadersWidth);
+ AssertEquals("SelectionMode property", DataGridViewSelectionMode.RowHeaderSelect, grid.SelectionMode);
+ AssertEquals("ShowCellErrors property", true, grid.ShowCellErrors);
+ AssertEquals("ShowEditingIcon property", true, grid.ShowEditingIcon);
+ AssertEquals("UserSetCursor property", Cursor.Current, grid.UserSetCursor);
+ AssertEquals("VirtualMode property", false, grid.VirtualMode);
+ }
+
+ #region AutoSizeColumnsModeExceptions
+
+ [Test]
+ [ExpectedException(typeof(InvalidEnumArgumentException))]
+ public void TestAutoSizeColumnsModeInvalidEnumArgumentException () {
+ DataGridView grid = new DataGridView();
+ grid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill | DataGridViewAutoSizeColumnsMode.None;
+ }
+
+ [Test]
+ [ExpectedException(typeof(InvalidOperationException))]
+ public void TestAutoSizeColumnsModeInvalidOperationException1 () {
+ DataGridView grid = new DataGridView();
+ grid.ColumnHeadersVisible = false;
+ DataGridViewColumn col = new DataGridViewColumn();
+ col.AutoSizeMode = DataGridViewAutoSizeColumnMode.NotSet;
+ grid.Columns.Add(col);
+ grid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.ColumnHeader;
+ }
+
+ [Test]
+ [ExpectedException(typeof(InvalidOperationException))]
+ public void TestAutoSizeColumnsModeInvalidOperationException2 () {
+ DataGridView grid = new DataGridView();
+ DataGridViewColumn col = new DataGridViewColumn();
+ col.AutoSizeMode = DataGridViewAutoSizeColumnMode.NotSet;
+ col.Frozen = true;
+ grid.Columns.Add(col);
+ grid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
+ }
+
+ #endregion
+
+ #region AutoSizeRowsModeExceptions
+
+ [Test]
+ [ExpectedException(typeof(InvalidEnumArgumentException))]
+ public void TestAutoSizeRowsModeInvalidEnumArgumentException () {
+ DataGridView grid = new DataGridView();
+ grid.AutoSizeRowsMode = (DataGridViewAutoSizeRowsMode) 4;
+ }
+
+ [Test]
+ [ExpectedException(typeof(InvalidOperationException))]
+ public void TestAutoSizeRowsModeInvalidOperationException1 () {
+ DataGridView grid = new DataGridView();
+ grid.RowHeadersVisible = false;
+ grid.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllHeaders;
+ }
+
+ [Test]
+ [ExpectedException(typeof(InvalidOperationException))]
+ public void TestAutoSizeRowsModeInvalidOperationException2 () {
+ DataGridView grid = new DataGridView();
+ grid.RowHeadersVisible = false;
+ grid.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.DisplayedHeaders;
+ }
+
+ #endregion
+
+ [Test]
+ [ExpectedException(typeof(ArgumentException))]
+ public void TestBackgroundColorArgumentException () {
+ DataGridView grid = new DataGridView();
+ grid.BackgroundColor = Color.Empty;
+ }
+
+ [Test]
+ [ExpectedException(typeof(InvalidEnumArgumentException))]
+ public void TestBorderStyleInvalidEnumArgumentException () {
+ DataGridView grid = new DataGridView();
+ grid.BorderStyle = BorderStyle.FixedSingle | BorderStyle.Fixed3D;
+ }
+
+ [Test]
+ [ExpectedException(typeof(ArgumentException))]
+ public void TestColumnCountArgumentException () {
+ DataGridView grid = new DataGridView();
+ grid.ColumnCount = -1;
+ }
+
+ [Test]
+ [ExpectedException(typeof(InvalidOperationException))]
+ public void TestColumnCountInvalidOperationException () {
+ DataGridView grid = new DataGridView();
+ grid.DataSource = new ArrayList();
+ grid.ColumnCount = 0;
+ }
+
+ [Test]
+ [ExpectedException(typeof(ArgumentException))]
+ public void TestColumnHeadersHeightArgumentException () {
+ DataGridView grid = new DataGridView();
+ grid.ColumnHeadersHeight = 3;
+ }
+
+ [Test]
+ [ExpectedException(typeof(InvalidEnumArgumentException))]
+ public void TestColumnHeadersHeightSizeModeInvalidEnumArgumentException () {
+ DataGridView grid = new DataGridView();
+ grid.ColumnHeadersHeightSizeMode = (DataGridViewColumnHeadersHeightSizeMode) 3;
+ }
+
+ [Test]
+ [ExpectedException(typeof(ArgumentException))]
+ public void TestCurrentCellArgumentException () {
+ DataGridView grid = new DataGridView();
+ grid.CurrentCell = new DataGridViewTextBoxCell();
+ }
+
+ [Test]
+ [ExpectedException(typeof(ArgumentException))]
+ public void TestRowHeadersWidthArgumentException () {
+ DataGridView grid = new DataGridView();
+ grid.RowHeadersWidth = 3;
+ }
+
+ [Test]
+ [ExpectedException(typeof(InvalidEnumArgumentException))]
+ public void TestDataGridViewRowHeadersWidthSizeModeInvalidEnumArgumentException () {
+ DataGridView grid = new DataGridView();
+ grid.RowHeadersWidthSizeMode = (DataGridViewRowHeadersWidthSizeMode) 5;
+ }
+
+ [Test]
+ [ExpectedException(typeof(InvalidEnumArgumentException))]
+ public void TestScrollBarsInvalidEnumArgumentException () {
+ DataGridView grid = new DataGridView();
+ grid.ScrollBars = (ScrollBars) 4;
+ }
+
+ [Test]
+ [ExpectedException(typeof(InvalidEnumArgumentException))]
+ public void TestSelectionModeInvalidEnumArgumentException () {
+ DataGridView grid = new DataGridView();
+ grid.SelectionMode = (DataGridViewSelectionMode) 5;
+ }
+
+ [Test]
+ [ExpectedException(typeof(InvalidEnumArgumentException))]
+ public void TestAutoResizeRowsInvalidEnumArgumentException () {
+ DataGridView grid = new DataGridView();
+ grid.AutoResizeRows((DataGridViewAutoSizeRowsMode) 4);
+ }
+
+ [Test]
+ [ExpectedException(typeof(InvalidOperationException))]
+ public void TestAutoResizeRowsInvalidOperationException1 () {
+ DataGridView grid = new DataGridView();
+ grid.RowHeadersVisible = false;
+ grid.AutoResizeRows(DataGridViewAutoSizeRowsMode.AllHeaders);
+ }
+
+ [Test]
+ [ExpectedException(typeof(InvalidOperationException))]
+ public void TestAutoResizeRowsInvalidOperationException2 () {
+ DataGridView grid = new DataGridView();
+ grid.RowHeadersVisible = false;
+ grid.AutoResizeRows(DataGridViewAutoSizeRowsMode.DisplayedHeaders);
+ }
+
+ [Test]
+ [ExpectedException(typeof(ArgumentException))]
+ public void TestAutoResizeRowsArgumentException () {
+ DataGridView grid = new DataGridView();
+ grid.AutoResizeRows(DataGridViewAutoSizeRowsMode.None);
+ }
+
+ /*
+ [Test]
+ [ExpectedException(typeof(Exception))]
+ public void TestException () {
+ ConcreteCollection myCollection;
+ myCollection = new ConcreteCollection();
+ ....
+ AssertEquals ("#UniqueID", expected, actual);
+ ....
+ Fail ("Message");
+ }
+ */
+
+ }
+
+}
+
+#endif
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ErrorProviderTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ErrorProviderTest.cs
new file mode 100644
index 00000000000..182b9a0673d
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ErrorProviderTest.cs
@@ -0,0 +1,98 @@
+//
+// ErrorProviderTest.cs: Test cases for ErrorProvider.
+//
+// Author:
+// Ritvik Mayank (mritvik@novell.com)
+//
+// (C) 2005 Novell, Inc. (http://www.novell.com)
+//
+
+using System;
+using NUnit.Framework;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Data;
+using System.Runtime.Remoting;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ public class ErrorProviderTest
+ {
+
+ [Test]
+ public void ErrorProviderPropertyTest ()
+ {
+ ErrorProvider myErrorProvider = new ErrorProvider ();
+
+ // B
+ Assert.AreEqual (250, myErrorProvider.BlinkRate, "#B1");
+ Assert.AreEqual (ErrorBlinkStyle.BlinkIfDifferentError, myErrorProvider.BlinkStyle, "#B2");
+
+ // C
+ Assert.AreEqual (null, myErrorProvider.ContainerControl, "#C1");
+
+ // D
+ Assert.AreEqual (null, myErrorProvider.DataMember, "#D1");
+ Assert.AreEqual (null, myErrorProvider.DataSource, "#D2");
+
+ // I
+ Assert.AreEqual (16, myErrorProvider.Icon.Height, "#I1");
+ Assert.AreEqual (16, myErrorProvider.Icon.Width, "#I2");
+
+ // S
+ Assert.AreEqual (null, myErrorProvider.Site, "#S1");
+ }
+
+ [Test]
+ public void BindToDateAndErrorsTest ()
+ {
+ ErrorProvider myErrorProvider = new ErrorProvider ();
+ DataSet myDataSet= new DataSet();
+ myErrorProvider.DataSource = myDataSet;
+ myErrorProvider.DataMember = "Customers";
+ Assert.AreEqual (myDataSet, myErrorProvider.DataSource, "#Bind1");
+ Assert.AreEqual ("Customers", myErrorProvider.DataMember, "#Bind2");
+ }
+
+ [Test]
+ public void CanExtendTest ()
+ {
+ Control myControl = new Control ();
+ Form myForm = new Form ();
+ ToolBar myToolBar = new ToolBar ();
+ ErrorProvider myErrorProvider = new ErrorProvider ();
+ Assert.AreEqual (myErrorProvider.CanExtend (myControl), true, "#ext1");
+ Assert.AreEqual (myErrorProvider.CanExtend (myToolBar), false, "#ext2");
+ Assert.AreEqual (myErrorProvider.CanExtend (myForm), false, "#ext3");
+ }
+
+ [Test]
+ public void GetandSetErrorTest ()
+ {
+ Form myForm = new Form ();
+ Label myLabel = new Label ();
+ ErrorProvider myErrorProvider = new ErrorProvider ();
+ myErrorProvider.SetError(myLabel, "New Error msg for Label");
+ Assert.AreEqual ("New Error msg for Label", myErrorProvider.GetError (myLabel), "#getset1");
+ }
+
+ [Test]
+ public void GetandSetIconAlignmentTest ()
+ {
+ TextBox myTextBox = new TextBox ();
+ ErrorProvider myErrorProvider = new ErrorProvider ();
+ myErrorProvider.SetIconAlignment (myTextBox, ErrorIconAlignment.MiddleRight);
+ Assert.AreEqual (ErrorIconAlignment.MiddleRight, myErrorProvider.GetIconAlignment (myTextBox), "#getset2");
+ }
+
+ [Test]
+ public void GetandSetIconPaddingTest ()
+ {
+ Form myForm = new Form ();
+ ErrorProvider myErrorProvider = new ErrorProvider ();
+ myErrorProvider.SetIconPadding (myForm, 2);
+ Assert.AreEqual (2, myErrorProvider.GetIconPadding (myForm), "#getset3");
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/FormEventTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/FormEventTest.cs
new file mode 100644
index 00000000000..e396aa1ea51
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/FormEventTest.cs
@@ -0,0 +1,237 @@
+//
+// Copyright (c) 2005 Novell, Inc.
+//
+// Authors:
+// Ritvik Mayank (mritvik@novell.com)
+//
+
+using System;
+using NUnit.Framework;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Collections;
+using System.ComponentModel;
+using System.Threading;
+using System.Globalization;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ public class FormEvent
+ {
+ static bool eventhandled = false;
+ public void New_EventHandler (object sender, EventArgs e)
+ {
+ eventhandled = true;
+ }
+
+ [Test, Ignore ("Manual Intervention")]
+ public void ActivatedTest ()
+ {
+ Form myform = new Form ();
+ myform.Activated += new EventHandler (New_EventHandler);
+ myform.Activate ();
+ myform.ShowDialog ();
+ Assert.AreEqual (true, eventhandled, "#A1");
+ }
+
+ [Test, Ignore ("Manual Intervention")]
+ public void ClosedTest ()
+ {
+ Form myform = new Form ();
+ myform.Closed += new EventHandler (New_EventHandler);
+ eventhandled = false;
+ myform.Close ();
+ myform.ShowDialog ();
+ Assert.AreEqual (true, eventhandled, "#A2");
+ }
+
+ [Test, Ignore ("Manual Intervention")]
+ public void DeactivateTest ()
+ {
+ Form myform = new Form ();
+ myform.Deactivate += new EventHandler (New_EventHandler);
+ eventhandled = false;
+ myform.Close ();
+ myform.Activate ();
+ myform.ShowDialog ();
+ Assert.AreEqual (true, eventhandled, "#A3");
+ }
+
+ [Test, Ignore ("Manual Intervention")]
+ public void LoadTest ()
+ {
+ Form myform = new Form ();
+ myform.Load += new EventHandler (New_EventHandler);
+ eventhandled = false;
+ myform.ShowDialog ();
+ Assert.AreEqual (true, eventhandled, "#A4");
+ myform.Dispose ();
+ }
+
+ class MyForm : Form
+ {
+ public void MaximizeBoundsTest ()
+ {
+ this.MaximizedBounds = new Rectangle (10,10,100,100);
+ }
+ }
+
+ [Test]
+ public void MaximizedBoundsChangedTest ()
+ {
+ MyForm myform = new MyForm ();
+ myform.MaximizedBoundsChanged += new EventHandler (New_EventHandler);
+ eventhandled = false;
+ myform.MaximizeBoundsTest ();
+ Assert.AreEqual (true, eventhandled, "#A5");
+ myform.Dispose ();
+ }
+
+ [Test]
+ public void MaximumSizeChangedTest ()
+ {
+ Form myform = new Form ();
+ myform.MaximumSizeChanged += new EventHandler (New_EventHandler);
+ eventhandled = false;
+ myform.MaximumSize = new Size (500, 500);
+ Assert.AreEqual (true, eventhandled, "#A6");
+ myform.Dispose ();
+ }
+
+ [Test, Ignore ("Manual Intervention")]
+ public void MdiChildActivateTest ()
+ {
+ Form parent = new Form ();
+ Form child = new Form ();
+ parent.IsMdiContainer = true;
+ child.IsMdiContainer = false;
+ child.MdiParent = parent;
+ parent.MdiChildActivate += new EventHandler (New_EventHandler);
+ eventhandled = false;
+ using (parent)
+ {
+ child.Visible = true;
+ parent.Show ();
+ Assert.AreEqual (true, eventhandled, "#A7");
+ eventhandled = false;
+ child.Close ();
+ Assert.AreEqual (true, eventhandled, "#A8");
+ }
+ }
+
+ [Test]
+ public void MinimumSizeChangedTest ()
+ {
+ Form myform = new Form ();
+ myform.MinimumSizeChanged += new EventHandler (New_EventHandler);
+ eventhandled = false;
+ myform.MinimumSize = new Size(100, 100);
+ Assert.AreEqual (true, eventhandled, "#A10");
+ myform.Dispose ();
+ }
+ }
+
+ [TestFixture]
+ public class ClosingEvent
+ {
+ bool cancel = true;
+ CancelEventArgs args = null;
+ public void Closing_Handler (object sender, CancelEventArgs e)
+ {
+ e.Cancel = cancel;
+ args = e;
+ }
+
+ [Test, Ignore ("visual test")]
+ public void ClosingEventTest ()
+ {
+ Form myform = new Form ();
+ myform.Closing += new CancelEventHandler (Closing_Handler);
+ myform.Show ();
+ args = null;
+ myform.Close ();
+ Assert.AreEqual (true, args != null, "#A11");
+ Assert.AreEqual (true, myform.Visible, "#A12");
+ cancel = false;
+ args = null;
+ myform.Close ();
+ Assert.AreEqual (true, args != null, "#A13");
+ Assert.AreEqual (false, myform.Visible, "#A14");
+ }
+ }
+
+ [TestFixture,Ignore ("Test Breaks")]
+ public class InputLanguageChangedEvent
+ {
+ static bool eventhandled = false;
+ public void InputLanguage_Handler (object sender,InputLanguageChangedEventArgs e)
+ {
+ eventhandled = true;
+ }
+
+ [Test]
+ public void InputLanguageChangedEventTest ()
+ {
+ Form myform = new Form ();
+ CultureInfo oldci = Thread.CurrentThread.CurrentCulture;
+ CultureInfo oldcui = Thread.CurrentThread.CurrentUICulture;
+ InputLanguage oldil = InputLanguage.CurrentInputLanguage;
+ try
+ {
+ if (InputLanguage.InstalledInputLanguages.Count > 1)
+ {
+ InputLanguage.CurrentInputLanguage = InputLanguage.InstalledInputLanguages[0];
+ myform.InputLanguageChanged += new InputLanguageChangedEventHandler (InputLanguage_Handler);
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("ta-IN");
+ Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
+ InputLanguage.CurrentInputLanguage = InputLanguage.InstalledInputLanguages[1];
+ Assert.AreEqual (true, eventhandled, "#A15");
+ }
+ }
+ finally
+ {
+ Thread.CurrentThread.CurrentCulture = oldci;
+ Thread.CurrentThread.CurrentUICulture = oldcui;
+ InputLanguage.CurrentInputLanguage = oldil;
+ }
+ }
+ }
+
+ [TestFixture,Ignore ("Test Breaks")]
+ public class InputLanguageChangingdEvent
+ {
+ static bool eventhandled = false;
+ public void InputLangChanging_Handler(object sender,InputLanguageChangingEventArgs e)
+ {
+ eventhandled = true;
+ }
+
+ [Test]
+ public void InputLanguageChangingEventTest ()
+ {
+ Form myform = new Form ();
+ CultureInfo oldci = Thread.CurrentThread.CurrentCulture;
+ CultureInfo oldcui = Thread.CurrentThread.CurrentUICulture;
+ InputLanguage oldil = InputLanguage.CurrentInputLanguage;
+ try
+ {
+ if (InputLanguage.InstalledInputLanguages.Count > 1)
+ {
+ InputLanguage.CurrentInputLanguage = InputLanguage.InstalledInputLanguages[0];
+ myform.InputLanguageChanging += new InputLanguageChangingEventHandler (InputLangChanging_Handler);
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("ta-IN");
+ Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
+ InputLanguage.CurrentInputLanguage = InputLanguage.InstalledInputLanguages[1];
+ Assert.AreEqual (true, eventhandled, "#A16");
+ }
+ }
+ finally
+ {
+ Thread.CurrentThread.CurrentCulture = oldci;
+ Thread.CurrentThread.CurrentUICulture = oldcui;
+ InputLanguage.CurrentInputLanguage = oldil;
+ }
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/FormTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/FormTest.cs
new file mode 100644
index 00000000000..c83c72fefd5
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/FormTest.cs
@@ -0,0 +1,175 @@
+//
+// FormTest.cs: Test cases for Form.
+//
+// Author:
+// Ritvik Mayank (mritvik@novell.com)
+//
+// (C) 2005 Novell, Inc. (http://www.novell.com)
+//
+
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Reflection;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ public class FormTest
+ {
+ [Test]
+ public void FormPropertyTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ myform.Text = "NewForm";
+ myform.Name = "FormTest";
+ Assert.AreEqual (null, myform.AcceptButton, "#1");
+ //Assert.AreEqual (null, myform.ActiveMdiChild, "#2");
+ //System.NotImplementedException for ActiveMdiChild. Feature not implemented.
+ Assert.AreEqual (false, myform.AutoScale, "#3");
+ Assert.AreEqual (13, myform.AutoScaleBaseSize.Height, "#4");
+ Assert.AreEqual (5, myform.AutoScaleBaseSize.Width, "#5");
+ Assert.AreEqual (null, myform.CancelButton, "#6");
+ Assert.AreEqual (273, myform.ClientSize.Height, "#7");
+ Assert.AreEqual (292, myform.ClientSize.Width, "#8");
+ Assert.AreEqual (true, myform.ControlBox, "#9");
+ Assert.IsTrue (myform.DesktopBounds.X > 0, "#10a");
+ Assert.IsTrue (myform.DesktopBounds.Y > 0, "#10b");
+ Assert.AreEqual (300, myform.DesktopBounds.Height, "#10c");
+ Assert.AreEqual (300, myform.DesktopBounds.Width, "#10d");
+ Assert.IsTrue (myform.DesktopLocation.X > 0, "#11a");
+ Assert.IsTrue (myform.DesktopLocation.Y > 0, "#11b");
+ Assert.AreEqual (DialogResult.None, myform.DialogResult, "#12");
+ Assert.AreEqual (FormBorderStyle.Sizable, myform.FormBorderStyle, "#13");
+ Assert.AreEqual (false, myform.HelpButton, "#14");
+ Assert.AreEqual ("System.Drawing.Icon", myform.Icon.GetType ().ToString (), "#15");
+ Assert.AreEqual (false, myform.IsMdiChild, "#16");
+ Assert.AreEqual (false, myform.IsMdiContainer, "#17");
+ Assert.AreEqual (false, myform.KeyPreview, "#18");
+ Assert.AreEqual (true, myform.MaximizeBox, "#19");
+ Assert.AreEqual (0, myform.MaximumSize.Height, "#20a");
+ Assert.AreEqual (0, myform.MaximumSize.Width, "#20b");
+ Assert.AreEqual (0, myform.MdiChildren.Length, "#21a");
+ Assert.AreEqual (1, myform.MdiChildren.Rank, "#21b");
+ Assert.AreEqual (false, myform.MdiChildren.IsSynchronized, "#21c");
+ Assert.AreEqual (null, myform.MdiParent, "#22");
+ Assert.AreEqual (null, myform.Menu, "#23");
+ //Assert.AreEqual (null, myform.MergedMenu, "#24");
+ //System.NotImplementedException for MergedMenu. Feature not implemented.
+ Assert.AreEqual (true, myform.MinimizeBox, "#25");
+ Assert.AreEqual (0, myform.MinimumSize.Height, "#26a");
+ Assert.AreEqual (0, myform.MinimumSize.Width, "#26b");
+ Assert.AreEqual (true, myform.MinimumSize.IsEmpty, "#26c");
+ Assert.AreEqual (false, myform.Modal, "#27");
+ //Assert.AreEqual (1, myform.Opacity, "#28");
+ //System.NotImplementedException for Opacity. Feature not implemented.
+ Assert.AreEqual (0, myform.OwnedForms.Length, "#29a");
+ Assert.AreEqual (1, myform.OwnedForms.Rank, "#29b");
+ Assert.AreEqual (null, myform.Owner, "#30");
+ Assert.AreEqual (true, myform.ShowInTaskbar, "#31");
+ Assert.AreEqual (300, myform.Size.Height, "#32a");
+ Assert.AreEqual (300, myform.Size.Width, "#32b");
+ Assert.AreEqual (SizeGripStyle.Auto, myform.SizeGripStyle, "#33");
+ Assert.AreEqual (FormStartPosition.WindowsDefaultLocation, myform.StartPosition, "#34");
+ Assert.AreEqual (true, myform.TopLevel, "#35");
+ Assert.AreEqual (false, myform.TopMost, "#36");
+ Assert.AreEqual (Color.Empty, myform.TransparencyKey, "#37");
+ Assert.AreEqual (FormWindowState.Normal, myform.WindowState, "#38");
+ }
+
+ [Test]
+ public void ActivateTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ myform.Text = "NewForm";
+ myform.Name = "FormTest";
+ myform.Activate ();
+ Assert.AreEqual (true, myform.Focus (), "#40");
+ }
+
+ [Test]
+ public void AddOwnedFormTest ()
+ {
+ Form parent = new Form ();
+ parent.Text = "NewParent";
+ Form ownedForm = new Form ();
+ ownedForm.Text = "Owned Form";
+ parent.AddOwnedForm (ownedForm);
+ ownedForm.Show ();
+ Assert.AreEqual ("NewParent", ownedForm.Owner.Text, "#41");
+ }
+
+ [Test]
+ public void CloseTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ myform.Text = "NewForm";
+ myform.Name = "FormTest";
+ myform.Close ();
+ Assert.IsTrue (myform.Size.Height > 0, "#42");
+ }
+
+ [Test]
+ [Ignore ("System.NotImplementedException. LayoutMdi not implemented")]
+ public void LayoutMdiTest ()
+ {
+ Form parent = new Form ();
+ Form child = new Form ();
+ parent.IsMdiContainer = true;
+ child.IsMdiContainer = false;
+ child.MdiParent = parent;
+ parent.LayoutMdi (MdiLayout.TileHorizontal);
+ child.Visible = true;
+ parent.Show ();
+ }
+
+ [Test]
+ public void RemoveOwnedFormTest ()
+ {
+ Form myform = new Form ();
+ myform.Text = "NewForm";
+ myform.Name = "FormTest";
+ myform.RemoveOwnedForm (myform);
+ myform.Show ();
+ Assert.AreEqual (null, myform.Owner, "#44");
+ }
+
+ [Test]
+ public void SetDesktopBoundsTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ myform.Text = "NewForm";
+ myform.Name = "FormTest";
+ myform.SetDesktopBounds (10, 10, 200 , 200);
+ Assert.AreEqual (200, myform.DesktopBounds.Height, "#45");
+ }
+
+ [Test]
+ public void SetDesktopLocationTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ myform.Text = "NewForm";
+ myform.Name = "FormTest";
+ myform.SetDesktopLocation (10, 10);
+ Assert.AreEqual (10, myform.DesktopLocation.X, "#46");
+ }
+
+ [Test, Ignore ("Needs Manual Intervention")]
+ public void ShowDialogTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = false;
+ myform.Text = "NewForm";
+ myform.Name = "FormTest";
+ myform.ShowDialog ();
+ Assert.AreEqual (DialogResult.Cancel, myform.DialogResult, "#47");
+ myform.Dispose ();
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/GenerateControlStyleTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/GenerateControlStyleTest.cs
new file mode 100644
index 00000000000..9e030762a49
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/GenerateControlStyleTest.cs
@@ -0,0 +1,129 @@
+//
+// This code generates the ControlStylesTest.cs test
+//
+// Author: Peter Dennis Bartok (pbartok@novell.com)
+//
+
+
+using System.Windows.Forms;
+using System.Drawing;
+using System;
+using System.Reflection;
+using System.IO;
+using System.Text;
+
+namespace TestApp {
+ class MainForm {
+ static Array style_values = Enum.GetValues(typeof(ControlStyles));
+ static string[] style_names = Enum.GetNames(typeof(ControlStyles));
+ static string TestHeader = "//\n" +
+ "// ControlStyleTest.cs (Auto-generated by GenerateControlStyleTest.cs).\n" +
+ "//\n" +
+ "// Author: \n" +
+ "// Peter Dennis Bartok (pbartok@novell.com)\n" +
+ "//\n" +
+ "// (C) 2005 Novell, Inc. (http://www.novell.com)\n" +
+ "//\n" +
+ "using System;\n" +
+ "using System.Windows.Forms;\n" +
+ "using System.Drawing;\n" +
+ "using System.Reflection;\n" +
+ "using NUnit.Framework;\n\n" +
+ "namespace MonoTests.System.Windows.Forms {\n" +
+ "\t[TestFixture]\n" +
+ "\tpublic class TestControlStyle {\n\n" +
+ "\t\tstatic Array style_values = Enum.GetValues(typeof(ControlStyles));\n" +
+ "\t\tstatic string[] style_names = Enum.GetNames(typeof(ControlStyles));\n\n" +
+ " public static string[] GetStyles(Control control) {\n" +
+ " string[] result;\n\n" +
+ " result = new string[style_names.Length];\n\n" +
+ " for (int i = 0; i < style_values.Length; i++) {\n" +
+ " result[i] = style_names[i] + \"=\" + control.GetType().GetMethod(\"GetStyle\", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(control, new object[1] {(ControlStyles)style_values.GetValue(i)});\n" +
+ " }\n\n" +
+ " return result;\n" +
+ " }\n";
+ static string TestFooter = "\t}\n}\n";
+
+ public static string[] GetStyles(Control control) {
+ string[] result;
+
+ result = new string[style_names.Length];
+
+ for (int i = 0; i < style_values.Length; i++) {
+ result[i] = style_names[i] + "=" + control.GetType().GetMethod("GetStyle", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(control, new object[1] {(ControlStyles)style_values.GetValue(i)});
+ }
+
+ return result;
+ }
+
+ public static void TestStyles(StreamWriter file, Control control, string name) {
+ string[] results;
+
+ results = GetStyles(control);
+
+ file.WriteLine("\t\t[Test]");
+ file.WriteLine("\t\tpublic void {0}StyleTest ()", name);
+ file.WriteLine("\t\t{");
+
+ file.WriteLine("\t\t\tstring[] {0}_want = {{", name);
+ for (int i=0; i < results.Length; i++) {
+ if ((i+1) != results.Length) {
+ file.WriteLine("\t\t\t\t\"{0}\",", results[i]);
+ } else {
+ file.WriteLine("\t\t\t\t\"{0}\"", results[i]);
+ }
+ }
+ file.WriteLine("\t\t\t};\n");
+ file.WriteLine("\t\t\tAssert.AreEqual({0}_want, GetStyles(new {0}()), \"{0}Styles\");", name);
+ file.WriteLine("\t\t}\n\n");
+ }
+
+ public static void Main(string[] args) {
+ using (StreamWriter file = new StreamWriter("c:\\ControlStyleTest.cs", false, Encoding.ASCII, 1024)) {
+ file.WriteLine(TestHeader);
+ TestStyles(file, new Control(), "Control");
+ TestStyles(file, new Button(), "Button");
+ TestStyles(file, new CheckBox(), "CheckBox");
+ TestStyles(file, new RadioButton(), "RadioButton");
+ TestStyles(file, new DataGrid(), "DataGrid");
+ TestStyles(file, new DateTimePicker(), "DateTimePicker");
+ TestStyles(file, new GroupBox(), "GroupBox");
+ TestStyles(file, new Label(), "Label");
+ TestStyles(file, new LinkLabel(), "LinkLabel");
+ TestStyles(file, new ComboBox(), "ComboBox");
+ TestStyles(file, new ListBox(), "ListBox");
+ TestStyles(file, new CheckedListBox(), "CheckedListBox");
+ TestStyles(file, new ListView(), "ListView");
+ TestStyles(file, new MdiClient(), "MdiClient");
+ TestStyles(file, new MonthCalendar(), "MonthCalendar");
+ TestStyles(file, new PictureBox(), "PictureBox");
+ // Mono doesn't support yet
+ //TestStyles(file, new PrintPreviewControl(), "PrintPreviewControl");
+ TestStyles(file, new ProgressBar(), "ProgressBar");
+ TestStyles(file, new ScrollableControl(), "ScrollableControl");
+ TestStyles(file, new ContainerControl(), "ContainerControl");
+ TestStyles(file, new Form(), "Form");
+ TestStyles(file, new PropertyGrid(), "PropertyGrid");
+ TestStyles(file, new DomainUpDown(), "DomainUpDown");
+ TestStyles(file, new NumericUpDown(), "NumericUpDown");
+ TestStyles(file, new UserControl(), "UserControl");
+ TestStyles(file, new Panel(), "Panel");
+ TestStyles(file, new TabPage(), "TabPage");
+ TestStyles(file, new HScrollBar(), "HScrollBar");
+ TestStyles(file, new VScrollBar(), "VScrollBar");
+ TestStyles(file, new Splitter(), "Splitter");
+ TestStyles(file, new StatusBar(), "StatusBar");
+ TestStyles(file, new TabControl(), "TabControl");
+ TestStyles(file, new RichTextBox(), "RichTextBox");
+ TestStyles(file, new TextBox(), "TextBox");
+ TestStyles(file, new DataGridTextBox(), "DataGridTextBox");
+ TestStyles(file, new ToolBar(), "ToolBar");
+ TestStyles(file, new TrackBar(), "TrackBar");
+ TestStyles(file, new TreeView(), "TreeView");
+ file.WriteLine(TestFooter);
+ }
+ }
+ }
+
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/GridColumnStylesCollectionTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/GridColumnStylesCollectionTest.cs
new file mode 100644
index 00000000000..ee12067c62e
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/GridColumnStylesCollectionTest.cs
@@ -0,0 +1,199 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Jordi Mas i Hernandez <jordi@ximian.com>
+//
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Drawing;
+using System.Windows.Forms;
+using System.Xml;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ class GridColumnStylesCollectionTest
+ {
+ private bool eventhandled;
+ private object Element;
+ private CollectionChangeAction Action;
+ private int times;
+
+
+ [Test]
+ public void TestDefaultValues ()
+ {
+ DataGridTableStyle ts = new DataGridTableStyle ();
+ GridColumnStylesCollection sc = ts.GridColumnStyles;
+
+ Assert.AreEqual (false, sc.IsSynchronized, "IsSynchronized property");
+ Assert.AreEqual (0, sc.Count, "Count");
+ Assert.AreEqual (sc, sc.SyncRoot, "SyncRoot property");
+ Assert.AreEqual (false, ((IList)sc).IsFixedSize, "IsFixedSize property");
+ Assert.AreEqual (false, sc.IsReadOnly, "IsReadOnly property");
+ }
+
+ [Test]
+ public void TestAdd ()
+ {
+ DataGridTableStyle ts = new DataGridTableStyle ();
+ GridColumnStylesCollection sc = ts.GridColumnStyles;
+ sc.CollectionChanged += new CollectionChangeEventHandler (OnCollectionEventHandler);
+
+ // Add single
+ ResetEventData ();
+ DataGridTextBoxColumn col1 = new DataGridTextBoxColumn ();
+ col1.MappingName = "Column1";
+ sc.Add (col1);
+ Assert.AreEqual (true, eventhandled);
+ Assert.AreEqual (col1, Element);
+ Assert.AreEqual (CollectionChangeAction.Add, Action);
+
+ // Add multiple
+ ResetEventData ();
+ DataGridTextBoxColumn elem1 = new DataGridTextBoxColumn ();
+ DataGridTextBoxColumn elem2 = new DataGridTextBoxColumn ();
+ sc.AddRange (new DataGridTextBoxColumn [] {elem1, elem2});
+ Assert.AreEqual (true, eventhandled, "A1");
+ Assert.AreEqual (CollectionChangeAction.Add, Action, "A2");
+ Assert.AreEqual (elem2, Element, "A3");
+
+ }
+
+ [Test]
+ public void TestAddRange ()
+ {
+ DataGridTableStyle ts = new DataGridTableStyle ();
+ GridColumnStylesCollection sc = ts.GridColumnStyles;
+ sc.CollectionChanged += new CollectionChangeEventHandler (OnCollectionEventHandler);
+
+ ResetEventData ();
+ DataGridTextBoxColumn col1 = new DataGridTextBoxColumn ();
+ col1.MappingName = "Column1";
+
+ DataGridTextBoxColumn col2 = new DataGridTextBoxColumn ();
+ col2.MappingName = "Column2";
+ sc.AddRange (new DataGridColumnStyle[] {col1, col2});
+
+ Assert.AreEqual (true, eventhandled, "A1");
+ Assert.AreEqual (col2, Element, "A2");
+ Assert.AreEqual (CollectionChangeAction.Add, Action, "A3");
+ Assert.AreEqual (2, times, "A4");
+ }
+
+ [Test]
+ public void TestRemove ()
+ {
+ DataGridTableStyle ts = new DataGridTableStyle ();
+ GridColumnStylesCollection sc = ts.GridColumnStyles;
+ sc.CollectionChanged += new CollectionChangeEventHandler (OnCollectionEventHandler);
+
+ // Add single
+ DataGridTextBoxColumn col1 = new DataGridTextBoxColumn ();
+ col1.MappingName = "Column1";
+ sc.Add (col1);
+
+ DataGridTextBoxColumn col2 = new DataGridTextBoxColumn ();
+ col2.MappingName = "Column2";
+ sc.Add (col2);
+
+ DataGridTextBoxColumn col3 = new DataGridTextBoxColumn ();
+ col3.MappingName = "Column3";
+ sc.Add (col3);
+
+ ResetEventData ();
+ sc.Remove (col2);
+ Assert.AreEqual (true, eventhandled, "A1");
+ Assert.AreEqual (col2, Element, "A2");
+ Assert.AreEqual (CollectionChangeAction.Remove, Action, "A3");
+ Assert.AreEqual (2, sc.Count, "A4");
+
+ ResetEventData ();
+ sc.RemoveAt (0);
+ Assert.AreEqual (true, eventhandled, "A5");
+ Assert.AreEqual (col1, Element, "A6");
+ Assert.AreEqual (CollectionChangeAction.Remove, Action, "A6");
+ Assert.AreEqual (1, sc.Count, "A7");
+
+ ResetEventData ();
+ sc.Clear ();
+ Assert.AreEqual (null, Element, "A8");
+ Assert.AreEqual (CollectionChangeAction.Refresh, Action, "A9");
+
+ }
+
+ [Test]
+ public void TestIndexContains ()
+ {
+ DataGridTableStyle ts = new DataGridTableStyle ();
+ GridColumnStylesCollection sc = ts.GridColumnStyles;
+ sc.CollectionChanged += new CollectionChangeEventHandler (OnCollectionEventHandler);
+
+ // Add single
+ DataGridTextBoxColumn col1 = new DataGridTextBoxColumn ();
+ col1.MappingName = "Column1";
+ sc.Add (col1);
+
+ DataGridTextBoxColumn col2 = new DataGridTextBoxColumn ();
+ col2.MappingName = "Column2";
+ sc.Add (col2);
+
+ DataGridTextBoxColumn col3 = new DataGridTextBoxColumn ();
+ col3.MappingName = "Column3";
+ sc.Add (col3);
+
+ ResetEventData ();
+ IList ilist = (IList) sc;
+ Assert.AreEqual (1, ilist.IndexOf (col2), "A1");
+ Assert.AreEqual (false, sc.Contains ("nothing"), "A2");
+ Assert.AreEqual (true, sc.Contains (col3), "A3");
+ }
+
+ private void ResetEventData ()
+ {
+ times = 0;
+ eventhandled = false;
+ Element = null;
+ Action = (CollectionChangeAction) 0;
+ }
+
+ private void OnEventHandler (object sender, EventArgs e)
+ {
+ eventhandled = true;
+ }
+
+ private void OnCollectionEventHandler (object sender, CollectionChangeEventArgs e)
+ {
+ eventhandled = true;
+ Element = e.Element;
+ Action = e.Action;
+ times++;
+ }
+
+
+ }
+
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/GridTableStylesCollectionTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/GridTableStylesCollectionTest.cs
new file mode 100644
index 00000000000..708f284587b
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/GridTableStylesCollectionTest.cs
@@ -0,0 +1,193 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Jordi Mas i Hernandez <jordi@ximian.com>
+//
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Drawing;
+using System.Windows.Forms;
+using System.Xml;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ class GridTableStylesCollectionTest
+ {
+ private bool eventhandled;
+ private object Element;
+ private CollectionChangeAction Action;
+ private int times;
+
+ [Test]
+ public void TestDefaultValues ()
+ {
+ DataGrid grid = new DataGrid ();
+ GridTableStylesCollection sc = grid.TableStyles;
+
+ Assert.AreEqual (false, sc.IsSynchronized, "IsSynchronized property");
+ Assert.AreEqual (0, sc.Count, "Count");
+ Assert.AreEqual (sc, sc.SyncRoot, "SyncRoot property");
+ Assert.AreEqual (false, ((IList)sc).IsFixedSize, "IsFixedSize property");
+ Assert.AreEqual (false, sc.IsReadOnly, "IsReadOnly property");
+ }
+
+ [Test]
+ public void TestAdd ()
+ {
+ DataGrid grid = new DataGrid ();
+ GridTableStylesCollection sc = grid.TableStyles;
+ sc.CollectionChanged += new CollectionChangeEventHandler (OnCollectionEventHandler);
+
+ // Add single
+ ResetEventData ();
+ DataGridTableStyle ts = new DataGridTableStyle ();
+ ts.MappingName = "Table1";
+ sc.Add (ts);
+ Assert.AreEqual (true, eventhandled, "A1");
+ Assert.AreEqual (ts, Element, "A2");
+ Assert.AreEqual (CollectionChangeAction.Add, Action, "A3");
+
+ // Add multiple
+ ResetEventData ();
+ sc.AddRange (new DataGridTableStyle [] {new DataGridTableStyle (), new DataGridTableStyle ()});
+ Assert.AreEqual (true, eventhandled, "A4");
+ Assert.AreEqual (null, Element, "A5");
+ Assert.AreEqual (CollectionChangeAction.Refresh, Action, "A6");
+ }
+
+ [Test]
+ public void TestAddRange ()
+ {
+ DataGrid grid = new DataGrid ();
+ GridTableStylesCollection sc = grid.TableStyles;
+ sc.CollectionChanged += new CollectionChangeEventHandler (OnCollectionEventHandler);
+
+ ResetEventData ();
+ DataGridTableStyle ts1 = new DataGridTableStyle ();
+ ts1.MappingName = "Table1";
+
+ DataGridTableStyle ts2 = new DataGridTableStyle ();
+ ts2.MappingName = "Table2";
+ sc.AddRange (new DataGridTableStyle[] {ts1, ts2});
+
+ Assert.AreEqual (true, eventhandled, "A1");
+ Assert.AreEqual (null, Element, "A2");
+ Assert.AreEqual (CollectionChangeAction.Refresh, Action, "A3");
+ Assert.AreEqual (1, times, "A4");
+ }
+
+ [Test]
+ public void TestRemove ()
+ {
+ DataGrid grid = new DataGrid ();
+ GridTableStylesCollection sc = grid.TableStyles;
+ sc.CollectionChanged += new CollectionChangeEventHandler (OnCollectionEventHandler);
+
+ // Add single
+ DataGridTableStyle ts1 = new DataGridTableStyle ();
+ ts1.MappingName = "Table1";
+ sc.Add (ts1);
+
+ DataGridTableStyle ts2 = new DataGridTableStyle ();
+ ts2.MappingName = "Table2";
+ sc.Add (ts2);
+
+ DataGridTableStyle ts3 = new DataGridTableStyle ();
+ ts3.MappingName = "Table3";
+ sc.Add (ts3);
+
+ ResetEventData ();
+ sc.Remove (ts2);
+ Assert.AreEqual (true, eventhandled, "A1");
+ Assert.AreEqual (ts2, Element, "A2");
+ Assert.AreEqual (CollectionChangeAction.Remove, Action, "A3");
+ Assert.AreEqual (2, sc.Count, "A4");
+
+ ResetEventData ();
+ sc.RemoveAt (0);
+ Assert.AreEqual (true, eventhandled, "A5");
+ Assert.AreEqual (ts1, Element, "A6");
+ Assert.AreEqual (CollectionChangeAction.Remove, Action, "A7");
+ Assert.AreEqual (1, sc.Count, "A8");
+
+ ResetEventData ();
+ sc.Clear ();
+ Assert.AreEqual (null, Element, "A9");
+ Assert.AreEqual (CollectionChangeAction.Refresh, Action, "A10");
+
+ }
+
+ [Test]
+ public void TestIndexContains ()
+ {
+ DataGrid grid = new DataGrid ();
+ GridTableStylesCollection sc = grid.TableStyles;
+ sc.CollectionChanged += new CollectionChangeEventHandler (OnCollectionEventHandler);
+
+ // Add single
+ DataGridTableStyle ts1 = new DataGridTableStyle ();
+ ts1.MappingName = "Table1";
+ sc.Add (ts1);
+
+ DataGridTableStyle ts2 = new DataGridTableStyle ();
+ ts2.MappingName = "Table2";
+ sc.Add (ts2);
+
+ DataGridTableStyle ts3 = new DataGridTableStyle ();
+ ts3.MappingName = "Table3";
+ sc.Add (ts3);
+
+ ResetEventData ();
+ IList ilist = (IList) sc;
+ Assert.AreEqual (1, ilist.IndexOf (ts2), "A1");
+ Assert.AreEqual (false, sc.Contains ("nothing"), "A2");
+ Assert.AreEqual (true, sc.Contains (ts3), "A3");
+ }
+
+ private void ResetEventData ()
+ {
+ times = 0;
+ eventhandled = false;
+ Element = null;
+ Action = (CollectionChangeAction) 0;
+ }
+
+ private void OnEventHandler (object sender, EventArgs e)
+ {
+ eventhandled = true;
+ }
+
+ private void OnCollectionEventHandler (object sender, CollectionChangeEventArgs e)
+ {
+ times++;
+ eventhandled = true;
+ Element = e.Element;
+ Action = e.Action;
+ }
+
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/GroupBoxTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/GroupBoxTest.cs
new file mode 100644
index 00000000000..9d9ed081e09
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/GroupBoxTest.cs
@@ -0,0 +1,40 @@
+//
+// GroupBoxTest.cs: Test cases for GroupBox.
+//
+// Author:
+// Ritvik Mayank (mritvik@novell.com)
+//
+// (C) 2005 Novell, Inc. (http://www.novell.com)
+//
+
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Reflection;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ public class GroupBoxTest
+ {
+ [Test]
+ public void GroupBoxPropertyTest ()
+ {
+ Form myform = new Form ();
+ GroupBox mygrpbox = new GroupBox ();
+ RadioButton myradiobutton1 = new RadioButton ();
+ RadioButton myradiobutton2 = new RadioButton ();
+ mygrpbox.Controls.Add (myradiobutton1);
+ mygrpbox.Controls.Add (myradiobutton2);
+ myform.Show ();
+ Assert.AreEqual (FlatStyle.Standard, mygrpbox.FlatStyle, "#1");
+ mygrpbox.FlatStyle = FlatStyle.Popup;
+ Assert.AreEqual (FlatStyle.Popup, mygrpbox.FlatStyle, "#2");
+ mygrpbox.FlatStyle = FlatStyle.Flat;
+ Assert.AreEqual (FlatStyle.Flat, mygrpbox.FlatStyle, "#3");
+ mygrpbox.FlatStyle = FlatStyle.System;
+ Assert.AreEqual (FlatStyle.System, mygrpbox.FlatStyle, "#4");
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ImageListTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ImageListTest.cs
new file mode 100644
index 00000000000..f2cf0200890
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ImageListTest.cs
@@ -0,0 +1,94 @@
+//
+// ImageImageListTest.cs: Test cases for ImageImageList.
+//
+// Author:
+// Ritvik Mayank (mritvik@novell.com)
+//
+// (C) 2005 Novell, Inc. (http://www.novell.com)
+//
+
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Reflection;
+using NUnit.Framework;
+using System.Threading;
+
+
+namespace MonoTests.System.Windows.Forms
+{
+
+ [TestFixture]
+ [Ignore ("This test has to be completly reviewed")]
+ public class ImageListTest
+ {
+ [Test]
+ public void ImageListPropertyTest ()
+ {
+ ImageList myimagelist = new ImageList ();
+
+ // C
+ Assert.AreEqual (ColorDepth.Depth8Bit, myimagelist.ColorDepth, "#C1");
+ myimagelist.ColorDepth = ColorDepth.Depth32Bit;
+ Assert.AreEqual (ColorDepth.Depth32Bit, myimagelist.ColorDepth, "#C2");
+ Assert.AreEqual (0, myimagelist.Images.Count, "#C3");
+ // H
+ Assert.AreEqual (false, myimagelist.HandleCreated, "#H1");
+ myimagelist.Handle.ToInt32 ();
+ Assert.AreEqual (true, myimagelist.HandleCreated, "#H2");
+ Assert.AreEqual ("System.IntPtr", myimagelist.Handle.GetType ().FullName, "#H3");
+
+ // I
+ Image myImage = Image.FromFile("M.gif");
+ myimagelist.Images.Add (myImage);
+ Assert.AreEqual (1, myimagelist.Images.Count, "#I1");
+ Assert.AreEqual (16, myimagelist.ImageSize.Height, "#I2");
+ Assert.AreEqual (16, myimagelist.ImageSize.Width, "#I3");
+ // [MonoTODO ("Add test for ImageStream")]
+ // [MonoTODO ("Test for Draw Method (visual test)")]
+
+ // T
+ Assert.AreEqual (Color.Transparent, myimagelist.TransparentColor, "#T1");
+ }
+
+ [Test]
+ public void ToStringMethodTest ()
+ {
+ ImageList myimagelist = new ImageList ();
+ Assert.AreEqual ("System.Windows.Forms.ImageList Images.Count: 0, ImageSize: {Width=16, Height=16}", myimagelist.ToString (), "#T3");
+ }
+
+ [TestFixture]
+ [Ignore ("This test has to be completly reviewed")]
+ public class ImageListRecreateHandleEventClass
+ {
+ static bool eventhandled = false;
+ public static void RecreateHandle_EventHandler (object sender, EventArgs e)
+ {
+ eventhandled = true;
+ }
+
+ [Test]
+ public void RecreateHandleEvenTest ()
+ {
+ Form myform = new Form ();
+ Graphics mygraphics = null;
+ ImageList myimagelist = new ImageList ();
+ Image myImage = Image.FromFile("M.gif");
+ myimagelist.Images.Add (myImage);
+ myimagelist.ColorDepth = ColorDepth.Depth8Bit;
+ myimagelist.ImageSize = new Size (50,50);
+ myimagelist.RecreateHandle += new EventHandler (RecreateHandle_EventHandler);
+ mygraphics = Graphics.FromHwnd(myform.Handle);
+ myimagelist.Draw(mygraphics, new Point(5, 5), 0);
+ myimagelist.ImageSize = new Size (100,100);
+ Assert.AreEqual (true, eventhandled, "#1");
+ eventhandled = false;
+ myimagelist.Images.Add (myImage);
+ myimagelist.ColorDepth = ColorDepth.Depth32Bit;
+ Assert.AreEqual (true, eventhandled, "#2");
+ }
+
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/LabelPropertyTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/LabelPropertyTest.cs
new file mode 100644
index 00000000000..6b284f50240
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/LabelPropertyTest.cs
@@ -0,0 +1,138 @@
+//
+// Copyright (c) 2005 Novell, Inc.
+//
+// Authors:
+// Ritvik Mayank (mritvik@novell.com)
+//
+// $Log: LabelPropertyTest.cs,v $
+// Adding tests for Label
+//
+
+
+
+using System;
+using NUnit.Framework;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Runtime.Remoting;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ [Ignore ("This test has to be completly reviewed")]
+ public class LabelTest {
+
+ [Test]
+ public void PubPropTest ()
+ {
+ Label l = new Label ();
+
+ Assert.AreEqual (false, l.AllowDrop , "#1");
+ Assert.AreEqual (false, l.AccessibilityObject == null, "#2");
+ Assert.AreEqual (false , l.AutoSize , "#3");
+ Assert.AreEqual (AnchorStyles.Top | AnchorStyles.Left, l.Anchor, "#4");
+ Assert.AreEqual (false, l.AutoSize, "#5");
+
+ Assert.AreEqual ("Control", l.BackColor.Name , "#6");
+ Assert.AreEqual (null, l.BindingContext, "#7");
+ Assert.AreEqual (null, l.BackgroundImage, "#8");
+ Assert.AreEqual (BorderStyle.None , l.BorderStyle, "#9");
+ Assert.AreEqual (23, l.Bottom, "#10");
+ Assert.AreEqual (new Rectangle (0,0,100,23), l.Bounds, "#11");
+
+ Assert.AreEqual (false, l.CanFocus, "#12");
+ Assert.AreEqual (false, l.CanSelect, "#13");
+ Assert.AreEqual (false, l.Capture, "#14");
+ Assert.AreEqual (true, l.CausesValidation, "#15");
+ Assert.AreEqual (new Rectangle (0,0,100,23), l.ClientRectangle, "#16");
+ Assert.AreEqual (23, l.ClientSize.Height, "#17a");
+ Assert.AreEqual (100, l.ClientSize.Width, "#17b");
+ Assert.AreEqual ("Mono Project, Novell, Inc.", l.CompanyName, "#18");
+ Assert.AreEqual (null, l.Container, "#19");
+ Assert.AreEqual (false, l.ContainsFocus, "#20");
+ Assert.AreEqual (null, l.ContextMenu, "#21");
+ Assert.AreEqual (true, l.Created, "#23");
+ Assert.AreEqual (Cursors.Default , l.Cursor, "#24");
+
+ Assert.AreEqual (false, l.DataBindings == null , "#25");
+ Assert.AreEqual (false, l.Disposing , "#27");
+ Assert.AreEqual (DockStyle.None, l.Dock, "#28");
+
+ Assert.AreEqual (true, l.Enabled, "#29");
+
+ Assert.AreEqual (FlatStyle.Standard, l.FlatStyle, "#30");
+ Assert.AreEqual (false, l.Focused, "#31");
+ Assert.AreEqual (FontFamily.GenericSansSerif, l.Font.FontFamily, "#32");
+ Assert.AreEqual (SystemColors.ControlText, l.ForeColor, "#33");
+
+ Assert.AreEqual (((IWin32Window)l).Handle, l.Handle, "#34");
+ Assert.AreEqual (false, l.HasChildren, "#35");
+ Assert.AreEqual (23, l.Height, "#36");
+
+ Assert.AreEqual (null, l.Image, "#37");
+ Assert.AreEqual (ContentAlignment.MiddleCenter, l.ImageAlign, "#38");
+ Assert.AreEqual (-1, l.ImageIndex, "#39");
+ Assert.AreEqual (null, l.ImageList, "#40");
+ Assert.AreEqual (false, l.InvokeRequired, "#42");
+ Assert.AreEqual (false, l.IsAccessible, "#43");
+ Assert.AreEqual (false, l.IsDisposed, "#44");
+ Assert.AreEqual (true, l.IsHandleCreated, "#45");
+
+ Assert.AreEqual (0, l.Left, "#46");
+ Assert.AreEqual (Point.Empty, l.Location, "#47");
+
+ Assert.AreEqual ("", l.Name, "#48a");
+ l.Name = "New Label";
+ Assert.AreEqual ("New Label", l.Name, "#48b");
+
+ Assert.AreEqual (null, l.Parent, "#49");
+ Assert.AreEqual (16, l.PreferredHeight, "#50");
+ Assert.AreEqual (0, l.PreferredWidth, "#51");
+ Assert.AreEqual ("Novell Mono MWF", l.ProductName, "#52");
+ Assert.AreEqual ("1.1.4322.2032", l.ProductVersion, "#53");
+
+ Assert.AreEqual (false, l.RecreatingHandle, "#54");
+ Assert.AreEqual (null, l.Region, "#55");
+ Assert.AreEqual (100, l.Right, "#56");
+ Assert.AreEqual (RightToLeft.No, l.RightToLeft, "#57");
+
+ Assert.AreEqual (null, l.Site, "#58");
+ Assert.AreEqual (23, l.Size.Height, "#59a");
+ Assert.AreEqual (100, l.Size.Width, "#59b");
+
+ Assert.AreEqual (0, l.TabIndex, "#60");
+ Assert.AreEqual (null, l.Tag, "#61");
+ Assert.AreEqual ("", l.Text, "#62");
+ Assert.AreEqual (ContentAlignment.TopLeft, l.TextAlign, "#63");
+ Assert.AreEqual (0, l.Top, "#64");
+ Assert.AreEqual (null, l.TopLevelControl, "#65");
+
+ Assert.AreEqual (true, l.UseMnemonic, "#66");
+
+ Assert.AreEqual (true, l.Visible, "#67");
+
+ Assert.AreEqual (100, l.Width, "#68");
+ }
+
+ [Test]
+ public void LabelEqualsTest () {
+ Label s1 = new Label ();
+ Label s2 = new Label ();
+ s1.Text = "abc";
+ s2.Text = "abc";
+ Assert.AreEqual (false, s1.Equals (s2), "#69");
+ Assert.AreEqual (true, s1.Equals (s1), "#70");
+ }
+
+ [Test]
+ public void LabelScaleTest () {
+ Label r1 = new Label ();
+ r1.Width = 40;
+ r1.Height = 20 ;
+ r1.Scale (2);
+ Assert.AreEqual (80, r1.Width, "#71");
+ Assert.AreEqual (40, r1.Height, "#72");
+
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/LabelTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/LabelTest.cs
new file mode 100644
index 00000000000..236ee26e3b0
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/LabelTest.cs
@@ -0,0 +1,970 @@
+//
+// Copyright (c) 2005 Novell, Inc.
+//
+// Authors:
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+//
+//
+
+using System;
+using NUnit.Framework;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Collections;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+
+ public class LabelTest2
+ {
+
+ [Test]
+ public void PubPropTest ()
+ {
+ Label l = new Label ();
+
+ // A
+ Assert.AreEqual (false, l.AutoSize, "A1");
+ l.AutoSize = true;
+ Assert.AreEqual (true, l.AutoSize, "A2");
+ l.AutoSize = false;
+ Assert.AreEqual (false, l.AutoSize, "A3");
+
+ // B
+ Assert.AreEqual (null, l.BackgroundImage, "B1");
+ l.BackgroundImage = Image.FromFile ("Test/System.Windows.Forms/bitmaps/a.png");
+ Assert.IsNotNull (l.BackgroundImage, "B2");
+ Bitmap bmp = (Bitmap)l.BackgroundImage;
+ Assert.IsNotNull (bmp.GetPixel (0, 0), "B3");
+
+ Assert.AreEqual (BorderStyle.None, l.BorderStyle, "B4");
+ l.BorderStyle = BorderStyle.FixedSingle;
+ Assert.AreEqual (BorderStyle.FixedSingle, l.BorderStyle, "B5");
+ l.BorderStyle = BorderStyle.Fixed3D;
+ Assert.AreEqual (BorderStyle.Fixed3D, l.BorderStyle, "B6");
+ l.BorderStyle = BorderStyle.None;
+ Assert.AreEqual (BorderStyle.None, l.BorderStyle, "B7");
+
+ // C
+ string name = l.CompanyName;
+ if (!name.Equals("Mono Project, Novell, Inc.") && !name.Equals("Microsoft Corporation")) {
+ Assert.Fail("CompanyName property does not match any accepted value - C1");
+ }
+
+ // F
+ Assert.AreEqual (FlatStyle.Standard, l.FlatStyle, "F1");
+ l.FlatStyle = FlatStyle.Flat;
+ Assert.AreEqual (FlatStyle.Flat, l.FlatStyle, "F1");
+ l.FlatStyle = FlatStyle.Popup;
+ Assert.AreEqual (FlatStyle.Popup, l.FlatStyle, "F2");
+ l.FlatStyle = FlatStyle.Standard;
+ Assert.AreEqual (FlatStyle.Standard, l.FlatStyle, "F3");
+ l.FlatStyle = FlatStyle.System;
+ Assert.AreEqual (FlatStyle.System, l.FlatStyle, "F4");
+
+ // I
+ Assert.AreEqual (ContentAlignment.MiddleCenter, l.ImageAlign, "I1");
+ l.ImageAlign = ContentAlignment.TopLeft;
+ Assert.AreEqual (ContentAlignment.TopLeft, l.ImageAlign, "I2");
+ l.ImageAlign = ContentAlignment.TopCenter;
+ Assert.AreEqual (ContentAlignment.TopCenter, l.ImageAlign, "I3");
+ l.ImageAlign = ContentAlignment.TopRight;
+ Assert.AreEqual (ContentAlignment.TopRight, l.ImageAlign, "I4");
+ l.ImageAlign = ContentAlignment.MiddleLeft;
+ Assert.AreEqual (ContentAlignment.MiddleLeft, l.ImageAlign, "I5");
+ l.ImageAlign = ContentAlignment.MiddleCenter;
+ Assert.AreEqual (ContentAlignment.MiddleCenter, l.ImageAlign, "I6");
+ l.ImageAlign = ContentAlignment.MiddleRight;
+ Assert.AreEqual (ContentAlignment.MiddleRight, l.ImageAlign, "I7");
+ l.ImageAlign = ContentAlignment.BottomLeft;
+ Assert.AreEqual (ContentAlignment.BottomLeft, l.ImageAlign, "I8");
+ l.ImageAlign = ContentAlignment.BottomCenter;
+ Assert.AreEqual (ContentAlignment.BottomCenter, l.ImageAlign, "I9");
+ l.ImageAlign = ContentAlignment.BottomRight;
+ Assert.AreEqual (ContentAlignment.BottomRight, l.ImageAlign, "I10");
+ Assert.AreEqual (-1, l.ImageIndex, "I11");
+ Assert.AreEqual (null, l.ImageList, "I12");
+ Assert.AreEqual (null, l.Image, "I13");
+ l.Image = Image.FromFile ("Test/System.Windows.Forms/bitmaps/a.png");
+ Assert.IsNotNull (l.Image, "I14");
+ bmp = (Bitmap)l.Image;
+ Assert.IsNotNull (bmp.GetPixel (0, 0), "I15");
+
+ ImageList il = new ImageList ();
+ il.ColorDepth = ColorDepth.Depth32Bit;
+ il.ImageSize = new Size (15, 15);
+ il.Images.Add (Image.FromFile ("Test/System.Windows.Forms/bitmaps/a.png"));
+ l.ImageList = il;
+ l.ImageIndex = 0;
+
+ Assert.AreEqual (0, l.ImageIndex, "I16");
+ Assert.IsNotNull (l.ImageList, "I17");
+
+ // PreferredHeight
+ // PregerredWidth
+ // RenderTransparent
+ //
+ // T
+ // Assert.AreEqual (false, l.TabStop, "T1");
+ Assert.AreEqual (ContentAlignment.TopLeft, l.TextAlign, "T2");
+
+ // U
+ Assert.AreEqual (true, l.UseMnemonic, "U1");
+ l.UseMnemonic = false;
+ Assert.AreEqual (false, l.UseMnemonic, "U2");
+ }
+
+ [Test]
+ public void LabelEqualsTest ()
+ {
+ Label s1 = new Label ();
+ Label s2 = new Label ();
+ s1.Text = "abc";
+ s2.Text = "abc";
+ Assert.AreEqual (false, s1.Equals (s2), "E1");
+ Assert.AreEqual (true, s1.Equals (s1), "E2");
+ }
+
+ [Test]
+ public void LabelScaleTest ()
+ {
+ Label r1 = new Label ();
+ r1.Width = 40;
+ r1.Height = 20 ;
+ r1.Scale (2);
+ Assert.AreEqual (80, r1.Width, "W1");
+ Assert.AreEqual (40, r1.Height, "H1");
+ }
+
+ [Test]
+ public void PubMethodTest ()
+ {
+ Label l = new Label ();
+
+ l.Text = "My Label";
+
+ Assert.AreEqual ("System.Windows.Forms.Label, Text: My Label", l.ToString (), "T1");
+
+ }
+ }
+
+ [TestFixture]
+ public class LabelEventTest
+ {
+ static bool eventhandled = false;
+ public void Label_EventHandler (object sender,EventArgs e)
+ {
+ eventhandled = true;
+ }
+
+ public void Label_KeyDownEventHandler (object sender, KeyEventArgs e)
+ {
+ eventhandled = true;
+ }
+
+ [Test]
+ public void AutoSizeChangedChangedTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ Label l = new Label ();
+ l.Visible = true;
+ myform.Controls.Add (l);
+ l.AutoSizeChanged += new EventHandler (Label_EventHandler);
+ l.AutoSize = true;
+ Assert.AreEqual (true, eventhandled, "B4");
+ eventhandled = false;
+ }
+
+ [Test]
+ public void BackgroundImageChangedTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ Label l = new Label ();
+ l.Visible = true;
+ myform.Controls.Add (l);
+ l.BackgroundImageChanged += new EventHandler (Label_EventHandler);
+ l.BackgroundImage = Image.FromFile ("Test/System.Windows.Forms/bitmaps/a.png");
+ Assert.AreEqual (true, eventhandled, "B4");
+ eventhandled = false;
+ }
+
+ [Test]
+ public void ImeModeChangedTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ Label l = new Label ();
+ l.Visible = true;
+ myform.Controls.Add (l);
+ l.ImeModeChanged += new EventHandler (Label_EventHandler);
+ l.ImeMode = ImeMode.Katakana;
+ Assert.AreEqual (true, eventhandled, "I16");
+ eventhandled = false;
+ }
+
+ [Test]
+ public void KeyDownTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyLabel l = new MyLabel ();
+ l.Visible = true;
+ myform.Controls.Add (l);
+ l.KeyDown += new KeyEventHandler (Label_KeyDownEventHandler);
+ l.KeyPressA ();
+
+ Assert.AreEqual (true, eventhandled, "K1");
+ eventhandled = false;
+ }
+
+ [Test]
+ public void TabStopChangedTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ Label l = new Label ();
+ l.Visible = true;
+ myform.Controls.Add (l);
+ l.TabStopChanged += new EventHandler (Label_EventHandler);
+ l.TabStop = true;
+ Assert.AreEqual (true, eventhandled, "T3");
+ eventhandled = false;
+ }
+
+ [Test]
+ public void TextAlignChangedTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ Label l = new Label ();
+ l.Visible = true;
+ myform.Controls.Add (l);
+ l.TextAlignChanged += new EventHandler (Label_EventHandler);
+ l.TextAlign = ContentAlignment.TopRight;
+ Assert.AreEqual (true, eventhandled, "T4");
+ eventhandled = false;
+ }
+ }
+
+public class MyLabelInvalidate : MyLabel
+ {
+ //protected ArrayList results = new ArrayList ();
+ public MyLabelInvalidate () : base ()
+ {}
+
+ protected override void OnInvalidated (InvalidateEventArgs e)
+ {
+ base.OnInvalidated (e);
+ string res = (string)results [results.Count - 1];
+ results [results.Count - 1 ] = string.Concat (res, "," + e.InvalidRect.ToString ());
+ //results.Add ("OnInvalidate," + e.InvalidRect.ToString ());
+ }
+
+ //public ArrayList Results {
+ // get { return results; }
+ //}
+
+ }
+
+public class MyLabel : Label
+ {
+ protected ArrayList results = new ArrayList ();
+ public MyLabel () : base ()
+ { }
+
+ protected override void OnAutoSizeChanged (EventArgs e)
+ {
+ results.Add ("OnAutoSizeChanged");
+ base.OnAutoSizeChanged (e);
+ }
+
+ protected override void OnBackgroundImageChanged (EventArgs e)
+ {
+ results.Add ("OnBackgroundImageChanged");
+ base.OnBackgroundImageChanged (e);
+ }
+
+ protected override void OnImeModeChanged (EventArgs e)
+ {
+ results.Add ("OnImeModeChanged");
+ base.OnImeModeChanged (e);
+ }
+
+ protected override void OnKeyDown (KeyEventArgs e)
+ {
+ results.Add ("OnKeyDown,"+(char)e.KeyValue);
+ base.OnKeyDown (e);
+ }
+
+ protected override void OnKeyPress (KeyPressEventArgs e)
+ {
+ results.Add ("OnKeyPress,"+e.KeyChar.ToString ());
+ base.OnKeyPress (e);
+ }
+
+ protected override void OnKeyUp (KeyEventArgs e)
+ {
+ results.Add ("OnKeyUp,"+(char)e.KeyValue);
+ base.OnKeyUp (e);
+ }
+
+ protected override void OnHandleCreated (EventArgs e)
+ {
+ results.Add ("OnHandleCreated");
+ base.OnHandleCreated (e);
+ }
+
+ protected override void OnBindingContextChanged (EventArgs e)
+ {
+ results.Add ("OnBindingContextChanged");
+ base.OnBindingContextChanged (e);
+ }
+
+ protected override void OnInvalidated (InvalidateEventArgs e)
+ {
+ results.Add("OnInvalidated");
+ base.OnInvalidated (e);
+ }
+
+ protected override void OnResize (EventArgs e)
+ {
+ results.Add("OnResize");
+ base.OnResize (e);
+ }
+
+ protected override void OnSizeChanged (EventArgs e)
+ {
+ results.Add("OnSizeChanged");
+ base.OnSizeChanged (e);
+ }
+
+ protected override void OnLayout (LayoutEventArgs e)
+ {
+ results.Add("OnLayout");
+ base.OnLayout (e);
+ }
+
+ protected override void OnVisibleChanged (EventArgs e)
+ {
+ results.Add("OnVisibleChanged");
+ base.OnVisibleChanged (e);
+ }
+
+ protected override void OnPaint (PaintEventArgs e)
+ {
+ results.Add("OnPaint");
+ base.OnPaint (e);
+ }
+
+ public void KeyPressA()
+ {
+ Message m;
+
+ m = new Message();
+
+ m.Msg = (int)WndMsg.WM_KEYDOWN;
+ m.HWnd = this.Handle;
+ m.WParam = (IntPtr)0x41;
+ m.LParam = (IntPtr)0x1e0001;
+ this.WndProc(ref m);
+
+ m.Msg = (int)WndMsg.WM_CHAR;
+ m.HWnd = this.Handle;
+ m.WParam = (IntPtr)0x61;
+ m.LParam = (IntPtr)0x1e0001;
+ this.WndProc(ref m);
+
+ m.Msg = (int)WndMsg.WM_KEYUP;
+ m.HWnd = this.Handle;
+ m.WParam = (IntPtr)0x41;
+ m.LParam = (IntPtr)unchecked((int)0xC01e0001);
+ this.WndProc(ref m);
+ }
+
+ public void KeyDownA()
+ {
+ Message m;
+
+ m = new Message();
+
+ m.Msg = (int)WndMsg.WM_KEYDOWN;
+ m.HWnd = this.Handle;
+ m.WParam = (IntPtr)0x41;
+ m.LParam = (IntPtr)0x1e0001;
+ this.WndProc(ref m);
+
+ m.Msg = (int)WndMsg.WM_CHAR;
+ m.HWnd = this.Handle;
+ m.WParam = (IntPtr)0x61;
+ m.LParam = (IntPtr)0x1e0001;
+ this.WndProc(ref m);
+ }
+
+ public void KeyUpA()
+ {
+ Message m;
+
+ m = new Message();
+
+ m.Msg = (int)WndMsg.WM_KEYUP;
+ m.HWnd = this.Handle;
+ m.WParam = (IntPtr)0x41;
+ m.LParam = (IntPtr)unchecked((int)0xC01e0001);
+ this.WndProc(ref m);
+ }
+
+ public ArrayList Results {
+ get { return results; }
+ }
+ }
+
+ [TestFixture]
+ public class LabelTestEventsOrder
+ {
+ public string [] ArrayListToString (ArrayList arrlist)
+ {
+ string [] retval = new string [arrlist.Count];
+ for (int i = 0; i < arrlist.Count; i++)
+ retval[i] = (string)arrlist[i];
+ return retval;
+ }
+
+ [Test]
+ public void CreateEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "OnHandleCreated",
+ "OnBindingContextChanged",
+ "OnBindingContextChanged"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyLabel l = new MyLabel ();
+ myform.Controls.Add (l);
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (l.Results));
+ }
+
+ [Test]
+ public void SizeChangedEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "OnHandleCreated",
+ "OnBindingContextChanged",
+ "OnBindingContextChanged",
+ "OnSizeChanged",
+ "OnResize",
+ "OnInvalidated",
+ "OnLayout"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyLabel l = new MyLabel ();
+ myform.Controls.Add (l);
+ l.Size = new Size (150, 20);
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (l.Results));
+ }
+
+ [Test]
+ public void AutoSizeChangedEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "OnHandleCreated",
+ "OnBindingContextChanged",
+ "OnBindingContextChanged",
+ "OnSizeChanged",
+ "OnResize",
+ "OnInvalidated",
+ "OnLayout",
+ "OnAutoSizeChanged"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyLabel l = new MyLabel ();
+ myform.Controls.Add (l);
+ l.AutoSize = true;
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (l.Results));
+ }
+
+ [Test]
+ public void BackgroundImageChangedEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "OnHandleCreated",
+ "OnBindingContextChanged",
+ "OnBindingContextChanged",
+ "OnBackgroundImageChanged",
+ "OnInvalidated"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyLabel l = new MyLabel ();
+ myform.Controls.Add (l);
+ l.BackgroundImage = Image.FromFile ("Test/System.Windows.Forms/bitmaps/a.png");
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (l.Results));
+ }
+
+ [Test]
+ public void ImeModeChangedChangedEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "OnHandleCreated",
+ "OnBindingContextChanged",
+ "OnBindingContextChanged",
+ "OnImeModeChanged"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyLabel l = new MyLabel ();
+ myform.Controls.Add (l);
+ l.ImeMode = ImeMode.Katakana;
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (l.Results));
+ }
+
+ [Test]
+ public void KeyPressEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "OnHandleCreated",
+ "OnBindingContextChanged",
+ "OnBindingContextChanged",
+ "OnKeyDown,A",
+ "OnKeyPress,a",
+ "OnKeyUp,A"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyLabel l = new MyLabel ();
+ myform.Controls.Add (l);
+ l.KeyPressA ();
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (l.Results));
+ }
+
+ [Test]
+ public void TabStopChangedEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "OnHandleCreated",
+ "OnBindingContextChanged",
+ "OnBindingContextChanged"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyLabel l = new MyLabel ();
+ myform.Controls.Add (l);
+ l.TabStop = true;
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (l.Results));
+ }
+
+ [Test]
+ public void TextAlignChangedEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "OnHandleCreated",
+ "OnBindingContextChanged",
+ "OnBindingContextChanged",
+ "OnInvalidated"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyLabel l = new MyLabel ();
+ myform.Controls.Add (l);
+ l.TextAlign = ContentAlignment.TopRight;
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (l.Results));
+ }
+
+ [Test]
+ public void InvalidateEventsOrder ()
+ {
+ Rectangle rect = new Rectangle (new Point (0,0), new Size (2, 2));
+
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyLabelInvalidate l = new MyLabelInvalidate ();
+ myform.Controls.Add (l);
+ l.TextAlign = ContentAlignment.TopRight;
+
+ string [] EventsWanted = {
+ "OnHandleCreated",
+ "OnBindingContextChanged",
+ "OnBindingContextChanged",
+ "OnInvalidated,{X=0,Y=0,Width="+l.Size.Width+",Height="+l.Size.Height+"}",
+ "OnInvalidated," + rect.ToString ()
+ };
+
+ l.Invalidate (rect);
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (l.Results));
+
+ }
+
+ [Test]
+ public void PaintEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "OnHandleCreated",
+ "OnBindingContextChanged",
+ "OnBindingContextChanged",
+ "OnInvalidated",
+ "OnInvalidated",
+ "OnPaint"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyLabel l = new MyLabel ();
+ myform.Controls.Add (l);
+ l.TextAlign = ContentAlignment.TopRight;
+ l.Refresh ();
+ Assert.AreEqual (EventsWanted, ArrayListToString (l.Results));
+ }
+
+ }
+
+public class MyLabel2 : Label
+ {
+ protected ArrayList results = new ArrayList ();
+ public MyLabel2 () : base ()
+ {
+ this.AutoSizeChanged += new EventHandler (AutoSizeChanged_Handler);
+ this.HandleCreated += new EventHandler (HandleCreated_Handler);
+ this.BindingContextChanged += new EventHandler (BindingContextChanged_Handler);
+ this.BackgroundImageChanged += new EventHandler (BackgroundImageChanged_Handler);
+ this.ImeModeChanged += new EventHandler (ImeModeChanged_Handler);
+ this.KeyDown += new KeyEventHandler (KeyDown_Handler);
+ this.KeyPress += new KeyPressEventHandler (KeyPress_Handler);
+ this.KeyUp += new KeyEventHandler (KeyUp_Handler);
+ this.Invalidated += new InvalidateEventHandler (Invalidated_Handler);
+ this.Resize += new EventHandler (Resize_Handler);
+ this.SizeChanged += new EventHandler (SizeChanged_Handler);
+ this.Layout += new LayoutEventHandler (Layout_Handler);
+ this.VisibleChanged += new EventHandler (VisibleChanged_Handler);
+ this.Paint += new PaintEventHandler (Paint_Handler);
+ }
+
+ protected void AutoSizeChanged_Handler (object sender, EventArgs e)
+ {
+ results.Add ("AutoSizeChanged");
+ }
+
+ protected void BackgroundImageChanged_Handler (object sender, EventArgs e)
+ {
+ results.Add ("BackgroundImageChanged");
+ }
+
+ protected void ImeModeChanged_Handler (object sender, EventArgs e)
+ {
+ results.Add ("ImeModeChanged");
+ }
+
+ protected void KeyDown_Handler (object sender, KeyEventArgs e)
+ {
+ results.Add ("KeyDown,"+(char)e.KeyValue);
+ }
+
+ protected void KeyPress_Handler (object sender, KeyPressEventArgs e)
+ {
+ results.Add ("KeyPress,"+e.KeyChar.ToString ());
+ }
+
+ protected void KeyUp_Handler (object sender, KeyEventArgs e)
+ {
+ results.Add ("KeyUp,"+(char)e.KeyValue);
+ }
+
+ protected void HandleCreated_Handler (object sender, EventArgs e)
+ {
+ results.Add ("HandleCreated");
+ }
+
+ protected void BindingContextChanged_Handler (object sender, EventArgs e)
+ {
+ results.Add ("BindingContextChanged");
+ }
+
+ protected void Invalidated_Handler (object sender, InvalidateEventArgs e)
+ {
+ results.Add("Invalidated");
+ }
+
+ protected void Resize_Handler (object sender, EventArgs e)
+ {
+ results.Add("Resize");
+ }
+
+ protected void SizeChanged_Handler (object sender, EventArgs e)
+ {
+ results.Add("SizeChanged");
+ }
+
+ protected void Layout_Handler (object sender, LayoutEventArgs e)
+ {
+ results.Add("Layout");
+ }
+
+ protected void VisibleChanged_Handler (object sender, EventArgs e)
+ {
+ results.Add("VisibleChanged");
+ }
+
+ protected void Paint_Handler (object sender, PaintEventArgs e)
+ {
+ results.Add("Paint");
+ }
+
+ public void KeyPressA()
+ {
+ Message m;
+
+ m = new Message();
+
+ m.Msg = (int)WndMsg.WM_KEYDOWN;
+ m.HWnd = this.Handle;
+ m.WParam = (IntPtr)0x41;
+ m.LParam = (IntPtr)0x1e0001;
+ this.WndProc(ref m);
+
+ m.Msg = (int)WndMsg.WM_CHAR;
+ m.HWnd = this.Handle;
+ m.WParam = (IntPtr)0x61;
+ m.LParam = (IntPtr)0x1e0001;
+ this.WndProc(ref m);
+
+ m.Msg = (int)WndMsg.WM_KEYUP;
+ m.HWnd = this.Handle;
+ m.WParam = (IntPtr)0x41;
+ m.LParam = (IntPtr)unchecked((int)0xC01e0001);
+ this.WndProc(ref m);
+ }
+
+ public void KeyDownA()
+ {
+ Message m;
+
+ m = new Message();
+
+ m.Msg = (int)WndMsg.WM_KEYDOWN;
+ m.HWnd = this.Handle;
+ m.WParam = (IntPtr)0x41;
+ m.LParam = (IntPtr)0x1e0001;
+ this.WndProc(ref m);
+
+ m.Msg = (int)WndMsg.WM_CHAR;
+ m.HWnd = this.Handle;
+ m.WParam = (IntPtr)0x61;
+ m.LParam = (IntPtr)0x1e0001;
+ this.WndProc(ref m);
+ }
+
+ public void KeyUpA()
+ {
+ Message m;
+
+ m = new Message();
+
+ m.Msg = (int)WndMsg.WM_KEYUP;
+ m.HWnd = this.Handle;
+ m.WParam = (IntPtr)0x41;
+ m.LParam = (IntPtr)unchecked((int)0xC01e0001);
+ this.WndProc(ref m);
+ }
+
+ public ArrayList Results {
+ get { return results; }
+ }
+ }
+
+ [TestFixture]
+ public class LabelTestEventsOrder2
+ {
+ public string [] ArrayListToString (ArrayList arrlist)
+ {
+ string [] retval = new string [arrlist.Count];
+ for (int i = 0; i < arrlist.Count; i++)
+ retval[i] = (string)arrlist[i];
+ return retval;
+ }
+
+ [Test]
+ public void CreateEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "HandleCreated",
+ "BindingContextChanged",
+ "BindingContextChanged"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyLabel2 l = new MyLabel2 ();
+ myform.Controls.Add (l);
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (l.Results));
+ }
+
+ [Test]
+ public void SizeChangedEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "HandleCreated",
+ "BindingContextChanged",
+ "BindingContextChanged",
+ "Invalidated",
+ "Layout",
+ "Resize",
+ "SizeChanged"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyLabel2 l = new MyLabel2 ();
+ myform.Controls.Add (l);
+ l.Size = new Size (150, 20);
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (l.Results));
+ }
+
+ [Test]
+ public void AutoSizeChangedEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "HandleCreated",
+ "BindingContextChanged",
+ "BindingContextChanged",
+ "Invalidated",
+ "Layout",
+ "Resize",
+ "SizeChanged",
+ "AutoSizeChanged"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyLabel2 l = new MyLabel2 ();
+ myform.Controls.Add (l);
+ l.AutoSize = true;
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (l.Results));
+ }
+
+ [Test]
+ public void BackgroundImageChangedEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "HandleCreated",
+ "BindingContextChanged",
+ "BindingContextChanged",
+ "Invalidated",
+ "BackgroundImageChanged"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyLabel2 l = new MyLabel2 ();
+ myform.Controls.Add (l);
+ l.BackgroundImage = Image.FromFile ("Test/System.Windows.Forms/bitmaps/a.png");
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (l.Results));
+ }
+
+ [Test]
+ public void ImeModeChangedChangedEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "HandleCreated",
+ "BindingContextChanged",
+ "BindingContextChanged",
+ "ImeModeChanged"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyLabel2 l = new MyLabel2 ();
+ myform.Controls.Add (l);
+ l.ImeMode = ImeMode.Katakana;
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (l.Results));
+ }
+
+ [Test]
+ public void KeyPressEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "HandleCreated",
+ "BindingContextChanged",
+ "BindingContextChanged",
+ "KeyDown,A",
+ "KeyPress,a",
+ "KeyUp,A"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyLabel2 l = new MyLabel2 ();
+ myform.Controls.Add (l);
+ l.KeyPressA ();
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (l.Results));
+ }
+
+ [Test]
+ public void TabStopChangedEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "HandleCreated",
+ "BindingContextChanged",
+ "BindingContextChanged"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyLabel2 l = new MyLabel2 ();
+ myform.Controls.Add (l);
+ l.TabStop = true;
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (l.Results));
+ }
+
+ [Test]
+ public void TextAlignChangedEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "HandleCreated",
+ "BindingContextChanged",
+ "BindingContextChanged",
+ "Invalidated"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyLabel2 l = new MyLabel2 ();
+ myform.Controls.Add (l);
+ l.TextAlign = ContentAlignment.TopRight;
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (l.Results));
+ }
+
+ [Test]
+ public void PaintEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "HandleCreated",
+ "BindingContextChanged",
+ "BindingContextChanged",
+ "Invalidated",
+ "Invalidated",
+ "Paint"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyLabel2 l = new MyLabel2 ();
+ myform.Controls.Add (l);
+ l.TextAlign = ContentAlignment.TopRight;
+ l.Refresh ();
+ Assert.AreEqual (EventsWanted, ArrayListToString (l.Results));
+ }
+
+ }
+
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ListBoxEventTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ListBoxEventTest.cs
new file mode 100644
index 00000000000..65d35511832
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ListBoxEventTest.cs
@@ -0,0 +1,65 @@
+//
+// Copyright (c) 2005 Novell, Inc.
+//
+// Authors:
+// Ritvik Mayank (mritvik@novell.com)
+//
+
+using System;
+using NUnit.Framework;
+using System.Windows.Forms;
+using System.Drawing;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ [Ignore ("This test has to be completly reviewed")]
+ public class ListBoxDrawItemEvent
+ {
+ static bool eventhandled = false;
+ public void DrawItem_EventHandler (object sender,DrawItemEventArgs e)
+ {
+ eventhandled = true;
+ }
+
+ [Test]
+ public void DrawItemTest ()
+ {
+ Form myform = new Form ();
+ ListBox lb1 = new ListBox ();
+ lb1.Items.Add ("A");
+ // Test DrawItem Event
+ lb1.DrawItem += new DrawItemEventHandler (DrawItem_EventHandler);
+ lb1.DrawMode = DrawMode.OwnerDrawFixed;
+ myform.Controls.Add (lb1);
+ myform.Show ();
+ Assert.AreEqual (true, eventhandled, "#A1");
+ }
+
+ [TestFixture]
+ [Ignore ("This test has to be completly reviewed")]
+ public class ListBoxMeasureItemEvent
+ {
+ static bool eventhandled = false;
+ public void MeasureItem_EventHandler (object sender,MeasureItemEventArgs e)
+ {
+ eventhandled = true;
+ }
+
+ [Test]
+ public void MeasureItemTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ ListBox lb1 = new ListBox ();
+ lb1.Items.Add ("B");
+ lb1.Visible = true;
+ myform.Controls.Add (lb1);
+ // Test MeasureItem Event
+ lb1.MeasureItem += new MeasureItemEventHandler (MeasureItem_EventHandler);
+ lb1.DrawMode = DrawMode.OwnerDrawVariable;
+ Assert.AreEqual (true, eventhandled, "#A2");
+ }
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ListBoxTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ListBoxTest.cs
new file mode 100644
index 00000000000..d946b7a38fb
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ListBoxTest.cs
@@ -0,0 +1,351 @@
+//
+// ComboBoxTest.cs: Test cases for ComboBox.
+//
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+// Ritvik Mayank <mritvik@novell.com>
+// Jordi Mas i Hernandez <jordi@ximian.com>
+//
+
+
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Reflection;
+using NUnit.Framework;
+using System.Collections;
+using System.ComponentModel;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ public class ListBoxTest
+ {
+ [Test]
+ public void ListBoxPropertyTest ()
+ {
+ ListBox lb1 = new ListBox ();
+ Assert.AreEqual (0, lb1.ColumnWidth, "#1");
+ Assert.AreEqual (DrawMode.Normal, lb1.DrawMode, "#2");
+ Assert.AreEqual (0, lb1.HorizontalExtent, "#3");
+ Assert.AreEqual (false, lb1.HorizontalScrollbar, "#4");
+ Assert.AreEqual (true, lb1.IntegralHeight, "#5");
+ //Assert.AreEqual (13, lb1.ItemHeight, "#6"); // Note: Item height depends on the current font.
+ lb1.Items.Add ("a");
+ lb1.Items.Add ("b");
+ lb1.Items.Add ("c");
+ Assert.AreEqual (3, lb1.Items.Count, "#7");
+ Assert.AreEqual (false, lb1.MultiColumn, "#8");
+ //Assert.AreEqual (46, lb1.PreferredHeight, "#9"); // Note: Item height depends on the current font.
+ //Assert.AreEqual (RightToLeft.No , lb1.RightToLeft, "#10"); // Depends on Windows version
+ Assert.AreEqual (false, lb1.ScrollAlwaysVisible, "#11");
+ Assert.AreEqual (-1, lb1.SelectedIndex, "#12");
+ lb1.SetSelected (2,true);
+ Assert.AreEqual (2, lb1.SelectedIndices[0], "#13");
+ Assert.AreEqual ("c", lb1.SelectedItem, "#14");
+ Assert.AreEqual ("c", lb1.SelectedItems[0], "#15");
+ Assert.AreEqual (SelectionMode.One, lb1.SelectionMode, "#16");
+ lb1.SetSelected (2,false);
+ Assert.AreEqual (false, lb1.Sorted, "#17");
+ Assert.AreEqual ("", lb1.Text, "#18");
+ Assert.AreEqual (0, lb1.TopIndex, "#19");
+ Assert.AreEqual (true, lb1.UseTabStops, "#20");
+ }
+
+ [Test]
+ public void BeginEndUpdateTest ()
+ {
+ Form f = new Form ();
+ f.Visible = true;
+ ListBox lb1 = new ListBox ();
+ lb1.Items.Add ("A");
+ lb1.Visible = true;
+ f.Controls.Add (lb1);
+ lb1.BeginUpdate ();
+ for (int x = 1; x < 5000; x++)
+ {
+ lb1.Items.Add ("Item " + x.ToString ());
+ }
+ lb1.EndUpdate ();
+ lb1.SetSelected (1, true);
+ lb1.SetSelected (3, true);
+ Assert.AreEqual (true, lb1.SelectedItems.Contains ("Item 3"), "#21");
+ }
+
+ [Test]
+ public void ClearSelectedTest ()
+ {
+ Form f = new Form ();
+ f.Visible = true;
+ ListBox lb1 = new ListBox ();
+ lb1.Items.Add ("A");
+ lb1.Visible = true;
+ f.Controls.Add (lb1);
+ lb1.SetSelected (0, true);
+ Assert.AreEqual ("A", lb1.SelectedItems [0].ToString (),"#22");
+ lb1.ClearSelected ();
+ Assert.AreEqual (0, lb1.SelectedItems.Count,"#23");
+ }
+
+ [Ignore ("It depends on user system settings")]
+ public void GetItemHeightTest ()
+ {
+ Form f = new Form ();
+ ListBox lb1 = new ListBox ();
+ lb1.Visible = true;
+ f.Controls.Add (lb1);
+ lb1.Items.Add ("A");
+ Assert.AreEqual (13, lb1.GetItemHeight (0) , "#28");
+ }
+
+ [Ignore ("It depends on user system settings")]
+ public void GetItemRectangleTest ()
+ {
+ Form f = new Form ();
+ f.Visible = true;
+ ListBox lb1 = new ListBox ();
+ lb1.Visible = true;
+ f.Controls.Add (lb1);
+ lb1.Items.Add ("A");
+ Assert.AreEqual (new Rectangle(0,0,116,13), lb1.GetItemRectangle (0), "#29");
+ }
+
+ [Test]
+ public void GetSelectedTest ()
+ {
+ ListBox lb1 = new ListBox ();
+ lb1.Items.Add ("A");
+ lb1.Items.Add ("B");
+ lb1.Items.Add ("C");
+ lb1.Items.Add ("D");
+ lb1.Sorted = true;
+ lb1.SetSelected (0,true);
+ lb1.SetSelected (2,true);
+ lb1.TopIndex=0;
+ Assert.AreEqual (true, lb1.GetSelected (0), "#30");
+ lb1.SetSelected (2,false);
+ Assert.AreEqual (false, lb1.GetSelected (2), "#31");
+ }
+
+ [Test]
+ public void IndexFromPointTest ()
+ {
+ ListBox lb1 = new ListBox ();
+ lb1.Items.Add ("A");
+ Point pt = new Point (100,100);
+ lb1.IndexFromPoint (pt);
+ Assert.AreEqual (-1, lb1.IndexFromPoint (100,100), "#32");
+ }
+
+ [Test]
+ public void FindStringTest ()
+ {
+ ListBox cmbbox = new ListBox ();
+ cmbbox.FindString ("Hola", -5); // No exception, it's empty
+ int x = cmbbox.FindString ("Hello");
+ Assert.AreEqual (-1, x, "#19");
+ cmbbox.Items.AddRange(new object[] {"ACBD", "ABDC", "ACBD", "ABCD"});
+ String myString = "ABC";
+ x = cmbbox.FindString (myString);
+ Assert.AreEqual (3, x, "#191");
+ x = cmbbox.FindString (string.Empty);
+ Assert.AreEqual (0, x, "#192");
+ x = cmbbox.FindString ("NonExistant");
+ Assert.AreEqual (-1, x, "#193");
+ }
+
+ [Test]
+ public void FindStringExactTest ()
+ {
+ ListBox cmbbox = new ListBox ();
+ cmbbox.FindStringExact ("Hola", -5); // No exception, it's empty
+ int x = cmbbox.FindStringExact ("Hello");
+ Assert.AreEqual (-1, x, "#20");
+ cmbbox.Items.AddRange (new object[] {"ABCD","ABC","ABDC"});
+ String myString = "ABC";
+ x = cmbbox.FindStringExact (myString);
+ Assert.AreEqual (1, x, "#201");
+ x = cmbbox.FindStringExact (string.Empty);
+ Assert.AreEqual (-1, x, "#202");
+ x = cmbbox.FindStringExact ("NonExistant");
+ Assert.AreEqual (-1, x, "#203");
+ }
+
+ //
+ // Exceptions
+ //
+
+ [Test]
+ [ExpectedException (typeof (InvalidEnumArgumentException))]
+ public void BorderStyleException ()
+ {
+ ListBox lstbox = new ListBox ();
+ lstbox.BorderStyle = (BorderStyle) 10;
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void ColumnWidthException ()
+ {
+ ListBox lstbox = new ListBox ();
+ lstbox.ColumnWidth = -1;
+ }
+
+ [Test]
+ [ExpectedException (typeof (InvalidEnumArgumentException))]
+ public void DrawModeException ()
+ {
+ ListBox lstbox = new ListBox ();
+ lstbox.DrawMode = (DrawMode) 10;
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void DrawModeAndMultiColumnException ()
+ {
+ ListBox lstbox = new ListBox ();
+ lstbox.MultiColumn = true;
+ lstbox.DrawMode = DrawMode.OwnerDrawVariable;
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentOutOfRangeException))]
+ public void ItemHeightException ()
+ {
+ ListBox lstbox = new ListBox ();
+ lstbox.ItemHeight = 256;
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentOutOfRangeException))]
+ public void SelectedIndexException ()
+ {
+ ListBox lstbox = new ListBox ();
+ lstbox.SelectedIndex = -2;
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void SelectedIndexModeNoneException ()
+ {
+ ListBox lstbox = new ListBox ();
+ lstbox.SelectionMode = SelectionMode.None;
+ lstbox.SelectedIndex = -1;
+ }
+
+ [Test]
+ [ExpectedException (typeof (InvalidEnumArgumentException))]
+ public void SelectionModeException ()
+ {
+ ListBox lstbox = new ListBox ();
+ lstbox.SelectionMode = (SelectionMode) 10;
+ }
+
+ //
+ // Events
+ //
+ private bool eventFired;
+
+ private void GenericHandler (object sender, EventArgs e)
+ {
+ eventFired = true;
+ }
+
+
+ }
+
+ [TestFixture]
+ public class ListBoxObjectCollectionTest
+ {
+ [Test]
+ public void ComboBoxObjectCollectionPropertyTest ()
+ {
+ ListBox.ObjectCollection col = new ListBox.ObjectCollection (new ListBox ());
+ Assert.AreEqual (false, col.IsReadOnly, "#B1");
+ Assert.AreEqual (false, ((ICollection)col).IsSynchronized, "#B2");
+ Assert.AreEqual (col, ((ICollection)col).SyncRoot, "#B3");
+ Assert.AreEqual (false, ((IList)col).IsFixedSize, "#B4");
+ }
+
+ [Test]
+ public void AddTest ()
+ {
+ ListBox.ObjectCollection col = new ListBox.ObjectCollection (new ListBox ());
+ col.Add ("Item1");
+ col.Add ("Item2");
+ Assert.AreEqual (2, col.Count, "#C1");
+ }
+
+ [Test]
+ public void ClearTest ()
+ {
+ ListBox.ObjectCollection col = new ListBox.ObjectCollection (new ListBox ());
+ col.Add ("Item1");
+ col.Add ("Item2");
+ col.Clear ();
+ Assert.AreEqual (0, col.Count, "#D1");
+ }
+
+ [Test]
+ public void ContainsTest ()
+ {
+ ListBox.ObjectCollection col = new ListBox.ObjectCollection (new ListBox ());
+ object obj = "Item1";
+ col.Add (obj);
+ Assert.AreEqual (true, col.Contains ("Item1"), "#E1");
+ Assert.AreEqual (false, col.Contains ("Item2"), "#E2");
+ }
+
+ [Test]
+ public void IndexOfTest ()
+ {
+ ListBox.ObjectCollection col = new ListBox.ObjectCollection (new ListBox ());
+ col.Add ("Item1");
+ col.Add ("Item2");
+ Assert.AreEqual (1, col.IndexOf ("Item2"), "#F1");
+ }
+
+ [Test]
+ public void RemoveTest ()
+ {
+ ListBox.ObjectCollection col = new ListBox.ObjectCollection (new ListBox ());
+ col.Add ("Item1");
+ col.Add ("Item2");
+ col.Remove ("Item1");
+ Assert.AreEqual (1, col.Count, "#G1");
+ }
+
+ [Test]
+ public void RemoveAtTest ()
+ {
+ ListBox.ObjectCollection col = new ListBox.ObjectCollection (new ListBox ());
+ col.Add ("Item1");
+ col.Add ("Item2");
+ col.RemoveAt (0);
+ Assert.AreEqual (1, col.Count, "#H1");
+ Assert.AreEqual (true, col.Contains ("Item2"), "#H1");
+ }
+
+
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ListViewCollectionsTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ListViewCollectionsTest.cs
new file mode 100644
index 00000000000..3cde0af7b9f
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ListViewCollectionsTest.cs
@@ -0,0 +1,243 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Jordi Mas i Hernandez <jordi@ximian.com>
+//
+//
+
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Reflection;
+using System.Collections;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ public class ListViewCollectionsTest
+ {
+ /*
+ ColumnHeaderCollection
+ */
+ [Test]
+ public void ColumnHeaderCollectionTest_PropertiesTest ()
+ {
+ ListView listview = new ListView ();
+
+ // Properties
+ Assert.AreEqual (false, listview.Columns.IsReadOnly, "ColumnHeaderCollectionTest_PropertiesTest#1");
+ Assert.AreEqual (true, ((ICollection)listview.Columns).IsSynchronized, "ColumnHeaderCollectionTest_PropertiesTest#2");
+ Assert.AreEqual (listview.Columns, ((ICollection)listview.Columns).SyncRoot, "ColumnHeaderCollectionTest_PropertiesTest#3");
+ Assert.AreEqual (false, ((IList)listview.Columns).IsFixedSize, "ColumnHeaderCollectionTest_PropertiesTest#4");
+ Assert.AreEqual (0, listview.Columns.Count, "ColumnHeaderCollectionTest_PropertiesTest#5");
+ }
+
+ [Test]
+ public void ColumnHeaderCollectionTest_AddTest ()
+ {
+ ListView listview = new ListView ();
+
+ // Duplicated elements with same text added
+ listview.Columns.Add (new ColumnHeader ());
+ listview.Columns.Add (new ColumnHeader ());
+ Assert.AreEqual (2, listview.Columns.Count, "ColumnHeaderCollectionTest_AddTest#1");
+ Assert.AreEqual ("ColumnHeader", listview.Columns[0].Text, "ColumnHeaderCollectionTest_AddTest#2");
+ }
+
+ [Test]
+ public void ColumnHeaderCollectionTest_ClearTest ()
+ {
+ ListView listview = new ListView ();
+
+ // Duplicated elements with same text added
+ listview.Columns.Add (new ColumnHeader ());
+ listview.Columns.Clear ();
+ Assert.AreEqual (0, listview.Columns.Count, "ColumnHeaderCollectionTest_ClearTest#1");
+ }
+
+ // Exceptions
+ [Test, ExpectedException (typeof (ArgumentOutOfRangeException))]
+ public void ColumnHeaderCollectionTest_GetItem_ExceptionTest ()
+ {
+ // Duplicated elements not added
+ ListView listview = new ListView ();
+ ColumnHeader item = listview.Columns[5];
+ }
+
+ /*
+ CheckedIndexCollection
+ */
+ [Test]
+ public void CheckedIndexCollectionTest_PropertiesTest ()
+ {
+ ListView listview = new ListView ();
+
+ // Properties
+ Assert.AreEqual (true, listview.CheckedIndices.IsReadOnly, "CheckedIndexCollectionTest_PropertiesTest#1");
+ Assert.AreEqual (false, ((ICollection)listview.CheckedIndices).IsSynchronized, "CheckedIndexCollectionTest_PropertiesTest#2");
+ Assert.AreEqual (listview.CheckedIndices, ((ICollection)listview.CheckedIndices).SyncRoot, "CheckedIndexCollectionTest_PropertiesTest#3");
+ Assert.AreEqual (true, ((IList)listview.CheckedIndices).IsFixedSize, "CheckedIndexCollectionTest_PropertiesTest#4");
+ Assert.AreEqual (0, listview.CheckedIndices.Count, "CheckedIndexCollectionTest_PropertiesTest#5");
+ }
+
+
+ // Exceptions
+ [Test, ExpectedException (typeof (NotSupportedException))]
+ public void CheckedIndexCollectionTest_Add_ExceptionTest ()
+ {
+ ListView listview = new ListView ();
+ ((IList)listview.CheckedIndices).Add (5);
+ }
+
+ [Test, ExpectedException (typeof (NotSupportedException))]
+ public void CheckedIndexCollectionTest_Remove_ExceptionTest ()
+ {
+ ListView listview = new ListView ();
+ ((IList)listview.CheckedIndices).Remove (5);
+ }
+
+ [Test, ExpectedException (typeof (NotSupportedException))]
+ public void CheckedIndexCollectionTest_RemoveAt_ExceptionTest ()
+ {
+ ListView listview = new ListView ();
+ ((IList)listview.CheckedIndices).RemoveAt (5);
+ }
+
+ /*
+ CheckedItemCollection
+ */
+ [Test]
+ public void CheckedItemCollectionTest_PropertiesTest ()
+ {
+ ListView listview = new ListView ();
+
+ // Properties
+ Assert.AreEqual (true, listview.CheckedItems.IsReadOnly, "CheckedItemCollectionTest_PropertiesTest#1");
+ Assert.AreEqual (false, ((ICollection)listview.CheckedItems).IsSynchronized, "CheckedItemCollectionTest_PropertiesTest#2");
+ Assert.AreEqual (listview.CheckedItems, ((ICollection)listview.CheckedItems).SyncRoot, "CheckedItemCollectionTest_PropertiesTest#3");
+ Assert.AreEqual (true, ((IList)listview.CheckedItems).IsFixedSize, "CheckedItemCollectionTest_PropertiesTest#4");
+ Assert.AreEqual (0, listview.CheckedItems.Count, "CheckedItemCollectionTest_PropertiesTest#5");
+ }
+
+
+ // Exceptions
+ [Test, ExpectedException (typeof (NotSupportedException))]
+ public void CheckedItemCollectionTest_PropertiesTest_Add_ExceptionTest ()
+ {
+ ListView listview = new ListView ();
+ ((IList)listview.CheckedItems).Add (5);
+ }
+
+ [Test, ExpectedException (typeof (NotSupportedException))]
+ public void CheckedItemCollectionTest_PropertiesTest_Remove_ExceptionTest ()
+ {
+ ListView listview = new ListView ();
+ ((IList)listview.CheckedItems).Remove (5);
+ }
+
+ [Test, ExpectedException (typeof (NotSupportedException))]
+ public void CheckedItemCollectionTest_PropertiesTest_RemoveAt_ExceptionTest ()
+ {
+ ListView listview = new ListView ();
+ ((IList)listview.CheckedItems).RemoveAt (5);
+ }
+
+ /*
+ SelectedIndexCollection
+ */
+ [Test]
+ public void SelectedIndexCollectionTest_PropertiesTest ()
+ {
+ ListView listview = new ListView ();
+
+ // Properties
+ Assert.AreEqual (true, listview.SelectedIndices.IsReadOnly, "SelectedIndexCollectionTest_PropertiesTest#1");
+ Assert.AreEqual (false, ((ICollection)listview.SelectedIndices).IsSynchronized, "SelectedIndexCollectionTest_PropertiesTest#2");
+ Assert.AreEqual (listview.SelectedIndices, ((ICollection)listview.SelectedIndices).SyncRoot, "SelectedIndexCollectionTest_PropertiesTest#3");
+ Assert.AreEqual (true, ((IList)listview.SelectedIndices).IsFixedSize, "SelectedIndexCollectionTest_PropertiesTest#4");
+ Assert.AreEqual (0, listview.SelectedIndices.Count, "SelectedIndexCollectionTest_PropertiesTest#5");
+ }
+
+
+ // Exceptions
+ [Test, ExpectedException (typeof (NotSupportedException))]
+ public void SelectedIndexCollectionTest_Add_ExceptionTest ()
+ {
+ ListView listview = new ListView ();
+ ((IList)listview.SelectedIndices).Add (5);
+ }
+
+ [Test, ExpectedException (typeof (NotSupportedException))]
+ public void SelectedIndexCollectionTest_Remove_ExceptionTest ()
+ {
+ ListView listview = new ListView ();
+ ((IList)listview.SelectedIndices).Remove (5);
+ }
+
+ [Test, ExpectedException (typeof (NotSupportedException))]
+ public void SelectedIndexCollectionTest_RemoveAt_ExceptionTest ()
+ {
+ ListView listview = new ListView ();
+ ((IList)listview.SelectedIndices).RemoveAt (5);
+ }
+
+ /*
+ SelectedItemCollection
+ */
+ [Test]
+ public void SelectedItemCollectionTest_PropertiesTest ()
+ {
+ ListView listview = new ListView ();
+
+ // Properties
+ Assert.AreEqual (true, listview.SelectedItems.IsReadOnly, "SelectedItemCollectionTest_PropertiesTest#1");
+ Assert.AreEqual (false, ((ICollection)listview.SelectedItems).IsSynchronized, "SelectedItemCollectionTest_PropertiesTest#2");
+ Assert.AreEqual (listview.SelectedItems, ((ICollection)listview.SelectedItems).SyncRoot, "SelectedItemCollectionTest_PropertiesTest#3");
+ Assert.AreEqual (true, ((IList)listview.SelectedItems).IsFixedSize, "SelectedItemCollectionTest_PropertiesTest#4");
+ Assert.AreEqual (0, listview.SelectedItems.Count, "SelectedItemCollectionTest_PropertiesTest#5");
+ }
+
+
+ // Exceptions
+ [Test, ExpectedException (typeof (NotSupportedException))]
+ public void SelectedItemCollectionTest_PropertiesTest_Add_ExceptionTest ()
+ {
+ ListView listview = new ListView ();
+ ((IList)listview.SelectedItems).Add (5);
+ }
+
+ [Test, ExpectedException (typeof (NotSupportedException))]
+ public void SelectedItemCollectionTest_PropertiesTest_Remove_ExceptionTest ()
+ {
+ ListView listview = new ListView ();
+ ((IList)listview.SelectedItems).Remove (5);
+ }
+
+ [Test, ExpectedException (typeof (NotSupportedException))]
+ public void SelectedItemCollectionTest_PropertiesTest_RemoveAt_ExceptionTest ()
+ {
+ ListView listview = new ListView ();
+ ((IList)listview.SelectedItems).RemoveAt (5);
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ListViewEventTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ListViewEventTest.cs
new file mode 100644
index 00000000000..9294bc2a168
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ListViewEventTest.cs
@@ -0,0 +1,208 @@
+//
+// ListViewEventTest.cs: Test cases for ListView events.
+//
+// Author:
+// Ritvik Mayank (mritvik@novell.com)
+//
+// (C) 2005 Novell, Inc. (http://www.novell.com)
+//
+
+using System;
+using NUnit.Framework;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Collections;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture, Ignore ("Needs Manual Intervention")]
+ public class ListViewEvent
+ {
+ static bool eventhandled = false;
+ public void LabelEdit_EventHandler (object sender,LabelEditEventArgs e)
+ {
+ eventhandled = true;
+ }
+
+ [Test]
+ public void AfterLabelEditTest ()
+ {
+ Form myform = new Form ();
+ ListView mylistview = new ListView ();
+ mylistview.LabelEdit = true ;
+ mylistview.AfterLabelEdit += new LabelEditEventHandler (LabelEdit_EventHandler);
+ mylistview.View = View.Details;
+ mylistview.SetBounds (10, 10, 200, 200, BoundsSpecified.All);
+ mylistview.Columns.Add ("A", -2, HorizontalAlignment.Center);
+ mylistview.Columns.Add ("B", -2, HorizontalAlignment.Center);
+ ListViewItem item1 = new ListViewItem ("A", -1);
+ mylistview.Items.Add (item1);
+ myform.Controls.Add (mylistview);
+ myform.ShowDialog ();
+ Assert.AreEqual (true, eventhandled, "#A1");
+ }
+
+ [Test]
+ public void BeforeLabelEditTest ()
+ {
+ Form myform = new Form ();
+ ListView mylistview = new ListView ();
+ mylistview.LabelEdit = true ;
+ mylistview.BeforeLabelEdit += new LabelEditEventHandler (LabelEdit_EventHandler);
+ eventhandled = false;
+ mylistview.View = View.Details;
+ mylistview.SetBounds (10, 10, 200, 200, BoundsSpecified.All);
+ mylistview.Columns.Add ("A", -2, HorizontalAlignment.Center);
+ mylistview.Columns.Add ("B", -2, HorizontalAlignment.Center);
+ ListViewItem item1 = new ListViewItem ("A", -1);
+ mylistview.Items.Add (item1);
+ myform.Controls.Add (mylistview);
+ myform.ShowDialog ();
+ Assert.AreEqual (true, eventhandled, "#A2");
+ }
+ }
+
+ [TestFixture, Ignore ("Needs Manual Intervention")]
+
+ public class ColumnClickEvent
+ {
+ static bool eventhandled = false;
+ public void ColumnClickEventHandler (object sender, ColumnClickEventArgs e)
+ {
+ eventhandled = true;
+ }
+
+ [Test]
+ public void ColumnClickTest ()
+ {
+ Form myform = new Form ();
+ ListView mylistview = new ListView ();
+
+ mylistview.LabelEdit = true ;
+ mylistview.ColumnClick += new ColumnClickEventHandler (ColumnClickEventHandler);
+ mylistview.View = View.Details;
+ mylistview.SetBounds (10, 10, 200, 200, BoundsSpecified.All);
+ mylistview.Columns.Add ("A", -2, HorizontalAlignment.Center);
+ mylistview.Columns.Add ("B", -2, HorizontalAlignment.Center);
+ ListViewItem item1 = new ListViewItem ("A", -1);
+ mylistview.Items.Add (item1);
+ myform.Controls.Add (mylistview);
+ myform.ShowDialog ();
+ mylistview.Sort ();
+ Assert.AreEqual (true, eventhandled, "#A3");
+ }
+ }
+
+ [TestFixture, Ignore ("Needs Manual Intervention")]
+
+ public class MyEvent
+ {
+ static bool eventhandled = false;
+ public void New_EventHandler (object sender, EventArgs e)
+ {
+ eventhandled = true;
+ }
+
+ [Test]
+ public void ItemActivateTest ()
+ {
+ Form myform = new Form ();
+ ListView mylistview = new ListView ();
+ mylistview.Activation = ItemActivation.OneClick;
+ mylistview.LabelEdit = true ;
+ mylistview.ItemActivate += new EventHandler (New_EventHandler);
+ mylistview.View = View.Details;
+ mylistview.SetBounds (10, 10, 200, 200, BoundsSpecified.All);
+ mylistview.Columns.Add ("A", -2, HorizontalAlignment.Center);
+ mylistview.Columns.Add ("B", -2, HorizontalAlignment.Center);
+ ListViewItem item1 = new ListViewItem ("A", -1);
+ mylistview.Items.Add (item1);
+ myform.Controls.Add (mylistview);
+ myform.ShowDialog ();
+ Assert.AreEqual (true, eventhandled, "#A4");
+ }
+
+ [Test]
+ public void SelectedIndexChangedTest ()
+ {
+ Form myform = new Form ();
+ ListView mylistview = new ListView ();
+ mylistview.LabelEdit = true ;
+ mylistview.SelectedIndexChanged += new EventHandler (New_EventHandler);
+ eventhandled = false;
+ mylistview.View = View.Details;
+ mylistview.SetBounds (10, 10, 200, 200, BoundsSpecified.All);
+ mylistview.Columns.Add ("A", -2, HorizontalAlignment.Center);
+ mylistview.Columns.Add ("B", -2, HorizontalAlignment.Center);
+ ListViewItem item1 = new ListViewItem ("A", -1);
+ mylistview.Items.Add (item1);
+ myform.Controls.Add (mylistview);
+ myform.ShowDialog ();
+ Assert.AreEqual (true, eventhandled, "#A5");
+ }
+ }
+
+ [TestFixture, Ignore ("Needs Manual Intervention")]
+
+ public class ItemCheckEvent
+ {
+ static bool eventhandled = false;
+ public void ItemCheckEventHandler (object sender, ItemCheckEventArgs e)
+
+ {
+ eventhandled = true;
+ }
+
+ [Test]
+ public void ItemCheckTest ()
+ {
+ Form myform = new Form ();
+ ListView mylistview = new ListView ();
+ mylistview.CheckBoxes = true;
+ mylistview.LabelEdit = true ;
+ mylistview.ItemCheck += new ItemCheckEventHandler (ItemCheckEventHandler);
+ mylistview.View = View.Details;
+ mylistview.SetBounds (10, 10, 200, 200, BoundsSpecified.All);
+ mylistview.Columns.Add ("A", -2, HorizontalAlignment.Center);
+ mylistview.Columns.Add ("B", -2, HorizontalAlignment.Center);
+ ListViewItem item1 = new ListViewItem ("A", -1);
+ mylistview.Items.Add (item1);
+ myform.Controls.Add (mylistview);
+ myform.ShowDialog ();
+ mylistview.Visible = true;
+ Assert.AreEqual (true, eventhandled, "#A6");
+ }
+ }
+
+
+ [TestFixture, Ignore ("Needs Manual Intervention")]
+
+ public class ItemDragEvent
+ {
+ static bool eventhandled = false;
+ public void ItemDragEventHandler (object sender, ItemDragEventArgs e)
+
+ {
+ eventhandled = true;
+ }
+
+ [Test]
+ public void ItemDragTest ()
+ {
+ Form myform = new Form ();
+ ListView mylistview = new ListView ();
+ mylistview.ItemDrag += new ItemDragEventHandler (ItemDragEventHandler);
+ mylistview.View = View.Details;
+ mylistview.SetBounds (10, 10, 200, 200, BoundsSpecified.All);
+ mylistview.Columns.Add ("A", -2, HorizontalAlignment.Center);
+ mylistview.Columns.Add ("B", -2, HorizontalAlignment.Center);
+ ListViewItem item1 = new ListViewItem ("A", -1);
+ mylistview.Items.Add (item1);
+ myform.Controls.Add (mylistview);
+ myform.ShowDialog ();
+ mylistview.Visible = true;
+ mylistview.DoDragDrop (mylistview.SelectedItems, DragDropEffects.Link);
+ Assert.AreEqual (true, eventhandled, "#A7");
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ListViewItemTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ListViewItemTest.cs
new file mode 100644
index 00000000000..e16b5023c44
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ListViewItemTest.cs
@@ -0,0 +1,88 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Jordi Mas i Hernandez <jordi@ximian.com>
+//
+//
+
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Reflection;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ public class ListViewItemTest
+ {
+ [Test]
+ public void ListViewItemConstructors ()
+ {
+ Font fnt = new Font ("Arial", 12);
+ ListViewItem item1 = new ListViewItem ("Hello folks");
+ Assert.AreEqual ("Hello folks", item1.Text, "Constructor#1");
+
+ ListViewItem item2 = new ListViewItem (new string [] {"Element1", "Element2"},
+ -1, Color.Blue, Color.Red, fnt);
+
+ Assert.AreEqual (item2.ForeColor, Color.Blue, "Constructor#2");
+ Assert.AreEqual (item2.BackColor, Color.Red, "Constructor#3");
+
+ Assert.AreEqual (2, item2.SubItems.Count,"Constructor#4");
+ Assert.AreEqual (Color.Blue, item2.SubItems[0].ForeColor,"Constructor#5");
+ Assert.AreEqual (Color.Red, item2.SubItems[0].BackColor, "Constructor#6");
+ Assert.AreEqual (fnt, item2.SubItems[0].Font, "Constructor#7");
+ Assert.AreEqual ("Element1", item2.SubItems[0].Text, "Constructor#8");
+ Assert.AreEqual ("Element2", item2.SubItems[1].Text, "Constructor#12");
+ }
+
+ [Test]
+ public void ListViewItemDefaultValues ()
+ {
+ ListViewItem item = new ListViewItem ();
+
+ Assert.AreEqual (false, item.Focused, "DefaultValues#3");
+ Assert.AreEqual (false, item.Checked, "DefaultValues#4");
+ Assert.AreEqual (string.Empty, item.Text, "DefaultValues#5");
+ Assert.AreEqual (true, item.UseItemStyleForSubItems, "DefaultValues#6");
+ }
+
+ [Test]
+ public void ListViewItemTestClone ()
+ {
+ ListViewItem item1 = new ListViewItem ("Hello");
+ item1.ForeColor = Color.Blue;
+ item1.BackColor = Color.Red;
+ item1.Font = new Font ("Arial", 14);
+ item1.SubItems.Add ("Element2");
+
+ ListViewItem item2 = (ListViewItem) item1.Clone ();
+ Assert.AreEqual (item2.ForeColor, Color.Blue, "Clone#1");
+ Assert.AreEqual (item2.BackColor, Color.Red, "Clone#2");
+ Assert.AreEqual (item2.Text, "Hello", "Clone#3");
+ Assert.AreEqual (item2.Font, item1.Font, "Clone#4");
+ Assert.AreEqual (2, item2.SubItems.Count, "Clone#5");
+ Assert.AreEqual (item2.SubItems[1].Text, "Element2", "Clone#6");
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ListViewTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ListViewTest.cs
new file mode 100644
index 00000000000..f5f4f0c6f62
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ListViewTest.cs
@@ -0,0 +1,136 @@
+//
+// ListViewTest.cs: Test cases for ListView.
+//
+// Author:
+// Ritvik Mayank (mritvik@novell.com)
+//
+// (C) 2005 Novell, Inc. (http://www.novell.com)
+//
+
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Reflection;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ public class ListViewTest
+ {
+ [Test]
+ public void ListViewPropertyTest ()
+ {
+ ListView mylistview = new ListView ();
+ Assert.AreEqual (ItemActivation.Standard, mylistview.Activation, "#1");
+ Assert.AreEqual (ListViewAlignment.Top, mylistview.Alignment, "#2");
+ Assert.AreEqual (false, mylistview.AllowColumnReorder, "#3");
+ Assert.AreEqual (true, mylistview.AutoArrange, "#4");
+ Assert.AreEqual (BorderStyle.Fixed3D , mylistview.BorderStyle, "#5");
+ Assert.AreEqual (false, mylistview.CheckBoxes, "#6");
+ Assert.AreEqual (0, mylistview.CheckedIndices.Count, "#7");
+ Assert.AreEqual (0, mylistview.CheckedItems.Count, "#8");
+ Assert.AreEqual (0, mylistview.Columns.Count, "#9");
+ Assert.AreEqual (null, mylistview.FocusedItem, "#10");
+ Assert.AreEqual (false, mylistview.FullRowSelect, "#11");
+ Assert.AreEqual (false, mylistview.GridLines, "#12");
+ Assert.AreEqual (ColumnHeaderStyle.Clickable, mylistview.HeaderStyle, "#13");
+ Assert.AreEqual (true, mylistview.HideSelection, "#14");
+ Assert.AreEqual (false, mylistview.HoverSelection, "#15");
+ ListViewItem item1 = new ListViewItem ("A", -1);
+ mylistview.Items.Add (item1);
+ Assert.AreEqual (1, mylistview.Items.Count, "#16");
+ Assert.AreEqual (false, mylistview.LabelEdit, "#17");
+ Assert.AreEqual (true, mylistview.LabelWrap, "#18");
+ Assert.AreEqual (null, mylistview.LargeImageList, "#19");
+ Assert.AreEqual (null, mylistview.ListViewItemSorter, "#20");
+ Assert.AreEqual (true, mylistview.MultiSelect, "#21");
+ Assert.AreEqual (true, mylistview.Scrollable, "#22");
+ Assert.AreEqual (0, mylistview.SelectedIndices.Count, "#23");
+ Assert.AreEqual (0, mylistview.SelectedItems.Count, "#24");
+ Assert.AreEqual (null, mylistview.SmallImageList, "#25");
+ Assert.AreEqual (null, mylistview.LargeImageList, "#26");
+ Assert.AreEqual (SortOrder.None, mylistview.Sorting, "#27");
+ Assert.AreEqual (null, mylistview.StateImageList, "#28");
+ Assert.AreEqual (View.LargeIcon, mylistview.View, "#29");
+ mylistview.View = View.List;
+ Assert.AreEqual (false, mylistview.TopItem.Checked, "#30");
+ }
+
+ [Test]
+ public void ArrangeIconsTest ()
+ {
+ Form myform = new Form ();
+ ListView mylistview = new ListView ();
+ myform.Controls.Add (mylistview);
+ mylistview.Items.Add ("Item 1");
+ mylistview.Items.Add ("Item 2");
+ mylistview.View = View.LargeIcon;
+ mylistview.ArrangeIcons ();
+ }
+
+ [Test]
+ public void BeginEndUpdateTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ ListView mylistview = new ListView();
+ mylistview.Items.Add ("A");
+ mylistview.Visible = true;
+ myform.Controls.Add (mylistview);
+ mylistview.BeginUpdate ();
+ for(int x = 1 ; x < 5000 ; x++){
+ mylistview.Items.Add ("Item " + x.ToString());
+ }
+ mylistview.EndUpdate ();
+ }
+
+ [Test]
+ public void ClearTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ ListView mylistview = new ListView ();
+ mylistview.Items.Add ("A");
+ mylistview.Columns.Add ("Item Column", -2, HorizontalAlignment.Left);
+ mylistview.Visible = true;
+ myform.Controls.Add (mylistview);
+ Assert.AreEqual (1, mylistview.Columns.Count, "#31");
+ Assert.AreEqual (1, mylistview.Items.Count, "#32");
+ mylistview.Clear ();
+ Assert.AreEqual (0, mylistview.Columns.Count, "#33");
+ Assert.AreEqual (0, mylistview.Items.Count, "#34");
+ }
+
+ [Test]
+ public void EnsureVisibleTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ ListView mylistview = new ListView ();
+ mylistview.Items.Add ("A");
+ myform.Controls.Add (mylistview);
+ mylistview.BeginUpdate ();
+ for(int x = 1 ; x < 5000 ; x++) {
+ mylistview.Items.Add ("Item " + x.ToString());
+ }
+ mylistview.EndUpdate ();
+ mylistview.EnsureVisible (4999);
+ }
+
+ [Test]
+ public void GetItemRectTest ()
+ {
+ ListView mylistview = new ListView ();
+ mylistview.Items.Add ("Item 1");
+ mylistview.Items.Add ("Item 2");
+ Rectangle r = mylistview.GetItemRect (1);
+ Assert.AreEqual (0, r.Top, "#35a");
+ Assert.IsTrue (r.Bottom > 0, "#35b");
+ Assert.IsTrue (r.Right > 0, "#35c");
+ Assert.IsTrue (r.Left > 0, "#35d");
+ Assert.IsTrue (r.Height > 0, "#35e");
+ Assert.IsTrue (r.Width > 0, "#35f");
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/MenuItemTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/MenuItemTest.cs
new file mode 100644
index 00000000000..aad692b1188
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/MenuItemTest.cs
@@ -0,0 +1,170 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Author:
+// Jordi Mas i Hernandez <jordi@ximian.com>
+//
+//
+
+
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Reflection;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ public class MenuItemTest
+ {
+ [Test]
+ public void MenuItemDefaultValues ()
+ {
+ MenuItem mi = new MenuItem ();
+
+ Assert.AreEqual (false, mi.BarBreak, "DefaultValues#1");
+ Assert.AreEqual (false, mi.Break, "DefaultValues#2");
+ Assert.AreEqual (false, mi.Checked, "DefaultValues#3");
+ Assert.AreEqual (false, mi.DefaultItem, "DefaultValues#4");
+ Assert.AreEqual (true, mi.Enabled, "DefaultValues#5");
+ Assert.AreEqual (-1, mi.Index, "DefaultValues#6");
+ Assert.AreEqual (false, mi.IsParent, "DefaultValues#7");
+
+ // TODO: MDI is not completed yet
+ //Assert.AreEqual (, mi.MdiList, "DefaultValues#8");
+
+ Assert.AreEqual (0, mi.MergeOrder, "DefaultValues#9");
+ Assert.AreEqual (MenuMerge.Add, mi.MergeType, "DefaultValues#10");
+ Assert.AreEqual ('\0', mi.Mnemonic, "DefaultValues#11");
+
+ Assert.AreEqual (false, mi.OwnerDraw, "DefaultValues#12");
+ Assert.AreEqual (null, mi.Parent, "DefaultValues#13");
+ Assert.AreEqual (false, mi.RadioCheck, "DefaultValues#14");
+ Assert.AreEqual (Shortcut.None, mi.Shortcut, "DefaultValues#15");
+ Assert.AreEqual (true, mi.ShowShortcut, "DefaultValues#16");
+ Assert.AreEqual (string.Empty, mi.Text, "DefaultValues#17");
+ Assert.AreEqual (true, mi.Visible, "DefaultValues#18");
+ }
+
+ [Test]
+ public void MenuItemConstructors ()
+ {
+ MenuItem mi;
+ MenuItem subitem1 = new MenuItem ("SubItem1");
+ MenuItem subitem2 = new MenuItem ("SubItem2");
+ MenuItem subitem3 = new MenuItem ("SubItem3");
+
+ {
+ mi = new MenuItem ("Item1");
+ Assert.AreEqual ("Item1", mi.Text, "Constructor#1");
+ }
+
+ {
+ mi = new MenuItem ("Item2", new MenuItem [] {subitem1,
+ subitem2, subitem3});
+
+ Assert.AreEqual ("Item2", mi.Text, "Constructor#2");
+ Assert.AreEqual (3, mi.MenuItems.Count, "Constructor#3");
+
+ Assert.AreEqual ("SubItem1", mi.MenuItems[0].Text, "Constructor#4");
+ Assert.AreEqual (mi, mi.MenuItems[0].Parent, "Constructor#5");
+
+ Assert.AreEqual ("SubItem2", mi.MenuItems[1].Text, "Constructor#6");
+ Assert.AreEqual (mi, mi.MenuItems[1].Parent, "Constructor#7");
+
+ Assert.AreEqual ("SubItem3", mi.MenuItems[2].Text, "Constructor#8");
+ Assert.AreEqual (mi, mi.MenuItems[2].Parent, "Constructor#9");
+ }
+
+ }
+
+ [Test]
+ public void MenuItemSimpleMerge ()
+ {
+ MainMenu mymainmenu1 = new MainMenu ();
+ MainMenu mymainmenu2 = new MainMenu ();
+ MenuItem mymenuitem1 = new MenuItem ();
+ MenuItem mymenuitem2 = new MenuItem ();
+ mymenuitem1.Text = "A";
+ mymenuitem2.Text = "B";
+ mymainmenu1.MenuItems.Add (mymenuitem1);
+ mymainmenu2.MenuItems.Add (mymenuitem2);
+ mymainmenu1.MergeMenu (mymainmenu2);
+ Assert.AreEqual (2, mymainmenu1.MenuItems.Count, "SimpleMerge#1");
+ }
+
+ [Test]
+ public void MenuItemMerge ()
+ {
+ MenuItem item1 = new MenuItem ("File (0)"); // Position 0
+ MenuItem item2 = new MenuItem ("Print the file (1)"); // Position 1
+ MenuItem item3 = new MenuItem ("Print Preview (2)"); // Position 2
+ MenuItem item4 = new MenuItem ("-"); // Position 3
+ MenuItem item5 = new MenuItem ("Recent files (4)"); // Position 4
+ MenuItem item6 = new MenuItem ("Exit (5)"); // Position 5
+
+ MenuItem item10 = new MenuItem ("Compare... (6)"); // Replace pos 3
+ MenuItem item11 = new MenuItem ("Sort (7)");
+ MenuItem item12 = new MenuItem ("Conversions (8)");
+ MenuItem item13 = new MenuItem ("Specials Functions (9)");
+ MenuItem item14 = new MenuItem ("Another option... (10)");
+
+ MenuItem item20 = new MenuItem ("autors.doc");
+ MenuItem item21 = new MenuItem ("testing.html");
+ MenuItem item22 = new MenuItem ("proves.txt");
+
+ MenuItem[] first_items = new MenuItem[] {item1, item2, item3, item4, item5, item6};
+ MenuItem[] second_items = new MenuItem[] {item10, item11, item12, item13, item14};
+ MenuItem[] third_items = new MenuItem[] {item20, item21, item22};
+
+ item14.MergeType = MenuMerge.Remove;
+ item10.MergeOrder = 40;
+
+ item11.MergeType = MenuMerge.Replace;
+ item11.MergeOrder = 30;
+ item12.MergeOrder = 5;
+ item10.MergeType = MenuMerge.MergeItems;
+
+ ContextMenu first_menu = new ContextMenu (first_items);
+ ContextMenu second_menu = new ContextMenu (second_items);
+ ContextMenu third_menu = new ContextMenu (third_items);
+
+ first_menu.MergeMenu (second_menu);
+ first_menu.MergeMenu (third_menu);
+
+ Assert.AreEqual ("File (0)", first_menu.MenuItems[0].Text, "ItemMerge#1");
+ Assert.AreEqual ("Print the file (1)", first_menu.MenuItems[1].Text, "ItemMerge#2");
+ Assert.AreEqual ("Print Preview (2)", first_menu.MenuItems[2].Text, "ItemMerge#3");
+ Assert.AreEqual ("-", first_menu.MenuItems[3].Text, "ItemMerge#4");
+ Assert.AreEqual ("Recent files (4)", first_menu.MenuItems[4].Text, "ItemMerge#5");
+ Assert.AreEqual ("Exit (5)", first_menu.MenuItems[5].Text, "ItemMerge#6");
+ Assert.AreEqual ("Specials Functions (9)", first_menu.MenuItems[6].Text, "ItemMerge#7");
+ Assert.AreEqual ("autors.doc", first_menu.MenuItems[7].Text, "ItemMerge#8");
+ Assert.AreEqual ("testing.html", first_menu.MenuItems[8].Text, "ItemMerge#9");
+ Assert.AreEqual ("proves.txt", first_menu.MenuItems[9].Text, "ItemMerge#10");
+ Assert.AreEqual ("Conversions (8)", first_menu.MenuItems[10].Text, "ItemMerge#11");
+ Assert.AreEqual ("Sort (7)", first_menu.MenuItems[11].Text, "ItemMerge#11");
+ Assert.AreEqual ("Compare... (6)", first_menu.MenuItems[12].Text, "ItemMerge#11");
+ }
+
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/MenuTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/MenuTest.cs
new file mode 100644
index 00000000000..176e36cba30
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/MenuTest.cs
@@ -0,0 +1,86 @@
+//
+// MenuTest.cs: Test cases for Menu, MainMenu
+//
+// Author:
+// Ritvik Mayank (mritvik@novell.com)
+//
+// (C) 2005 Novell, Inc. (http://www.novell.com)
+//
+
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Reflection;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ public class MenuTest
+ {
+ [Test]
+ public void MenuPropertyTest ()
+ {
+ Menu mymenu = new MainMenu ();
+ Assert.AreEqual ("System.IntPtr", mymenu.Handle.GetType().FullName, "#1");
+ Assert.AreEqual (false, mymenu.IsParent, "#2");
+ // TODO: MDI is not completed yet
+ //Assert.AreEqual (null, mymenu.MdiListItem, "#3");
+ Assert.AreEqual (0, mymenu.MenuItems.Count,"#4");
+ mymenu.MenuItems.Add ("newmenu1");
+ mymenu.MenuItems.Add ("newmenu2");
+ Assert.AreEqual (2, mymenu.MenuItems.Count,"#5");
+ MainMenu mymainmenu = new MainMenu ();
+ Assert.AreEqual (RightToLeft.Inherit, mymainmenu.RightToLeft,"#6");
+ }
+
+ [Test]
+ public void GetMainMenuTest ()
+ {
+ MainMenu mymainmenu = new MainMenu ();
+ MenuItem mymenuitem = new MenuItem ();
+ mymenuitem.Text = "menu 1";
+ mymainmenu.MenuItems.Add (mymenuitem);
+ Assert.AreEqual (mymainmenu, mymenuitem.GetMainMenu (), "#7");
+ }
+
+ [Test]
+ public void CloneMenuTest ()
+ {
+ MainMenu mymainmenu1 = new MainMenu ();
+ MenuItem menuitem1 = new MenuItem ();
+ MenuItem menuitem2 = new MenuItem ();
+ menuitem1.Text = "item1";
+ menuitem2.Text = "item2";
+ mymainmenu1.MenuItems.Add (menuitem1);
+ mymainmenu1.MenuItems.Add (menuitem2);
+ MainMenu mymainmenu2 = mymainmenu1.CloneMenu ();
+ Assert.AreEqual ("item1", mymainmenu2.MenuItems[0].Text, "#9");
+ }
+
+ [Test]
+ public void GetFormTest ()
+ {
+ Form myform = new Form ();
+ myform.Name = "New Form";
+ MainMenu mymainmenu1 = new MainMenu ();
+ MenuItem menuitem1 = new MenuItem ();
+ menuitem1.Text = "item1";
+ mymainmenu1.MenuItems.Add (menuitem1);
+ myform.Menu = mymainmenu1;
+ Assert.AreEqual ("New Form", mymainmenu1.GetForm().Name, "#10");
+ }
+
+ [Test]
+ public void GetContextMenuTest ()
+ {
+ Form myform = new Form ();
+ ContextMenu mycontextmenu = new ContextMenu ();
+ myform.ContextMenu= mycontextmenu;
+ MenuItem menuItem1 = new MenuItem ();
+ menuItem1.Text = "1";
+ mycontextmenu.MenuItems.Add (menuItem1);
+ Assert.AreEqual (mycontextmenu, menuItem1.GetContextMenu (),"#11");
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/MonthCalendarTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/MonthCalendarTest.cs
new file mode 100644
index 00000000000..a7574750f60
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/MonthCalendarTest.cs
@@ -0,0 +1,166 @@
+//
+// MonthCalendarTest.cs: Test case for MonthCalendar
+//
+// Authors:
+// Ritvik Mayank (mritvik@novell.com)
+//
+// (C) 2005 Novell, Inc. (http://www.novell.com)
+//
+
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Reflection;
+using NUnit.Framework;
+
+namespace MonoTests.Syetem.Windows.Forms
+{
+ [TestFixture]
+ [Ignore ("This test has to be completly reviewed")]
+ public class MonthCalendarTest
+ {
+ [Test]
+ public void MonthCalendarPropertyTest ()
+ {
+ Form myfrm = new Form ();
+ MonthCalendar myMonthCal1 = new MonthCalendar ();
+ MonthCalendar myMonthCal2 = new MonthCalendar ();
+ myMonthCal1.Name = "MonthCendar";
+ myMonthCal1.TabIndex = 1;
+ DateTime myDateTime = new DateTime ();
+
+ // A
+ myMonthCal1.AddAnnuallyBoldedDate (new DateTime (2005, 09, 01));
+ Assert.AreEqual (new DateTime (2005, 09, 01), myMonthCal1.AnnuallyBoldedDates.GetValue (0), "#A1");
+
+ // B
+ Assert.AreEqual ("Window", myMonthCal1.BackColor.Name, "#B1");
+ myMonthCal1.AddBoldedDate (new DateTime (2005, 09, 01));
+ Assert.AreEqual (new DateTime (2005, 09, 01), myMonthCal1.BoldedDates.GetValue (0), "#B2");
+
+ // C
+ Assert.AreEqual (1, myMonthCal1.CalendarDimensions.Height, "#C1");
+ Assert.AreEqual (1, myMonthCal1.CalendarDimensions.Width, "#C2");
+ Assert.AreEqual (false, myMonthCal1.CalendarDimensions.IsEmpty, "#C3");
+
+ // F
+ Assert.AreEqual (Day.Default, myMonthCal1.FirstDayOfWeek, "#F1");
+ myMonthCal1.FirstDayOfWeek = Day.Sunday;
+ Assert.AreEqual (Day.Sunday, myMonthCal1.FirstDayOfWeek, "#F2");
+ Assert.AreEqual ("WindowText", myMonthCal1.ForeColor.Name, "#F3");
+
+ // M
+ Assert.AreEqual (new DateTime (9998,12,31), myMonthCal1.MaxDate, "#M1");
+ Assert.AreEqual (7, myMonthCal1.MaxSelectionCount, "#M2");
+ Assert.AreEqual (new DateTime (1753,1,1), myMonthCal1.MinDate, "#M3");
+ myMonthCal1.AddMonthlyBoldedDate (new DateTime (2005, 09, 01));
+ Assert.AreEqual (new DateTime(2005, 09, 01), myMonthCal1.MonthlyBoldedDates.GetValue (0), "#M4");
+
+ // S
+ Assert.AreEqual (0, myMonthCal1.ScrollChange, "#S1");
+ myMonthCal1.SelectionStart = new DateTime (2005,09,02);
+ myMonthCal1.SelectionEnd = new DateTime (2005,09,03);
+ Assert.AreEqual (new DateTime (2005,09,03), myMonthCal1.SelectionEnd, "#S2");
+ //Assert.AreEqual (new SelectionRange (new DateTime(2005,09,02), new DateTime(2005,09,03)), myMonthCal1.SelectionRange, "#S3");
+ Assert.AreEqual (new DateTime (2005,09,02), myMonthCal1.SelectionStart, "#S4");
+ Assert.AreEqual (true, myMonthCal1.ShowToday, "#S5");
+ Assert.AreEqual (true, myMonthCal1.ShowTodayCircle, "#S6");
+ Assert.AreEqual (false, myMonthCal1.ShowWeekNumbers, "#S7");
+ Assert.AreEqual (153, myMonthCal1.SingleMonthSize.Height, "#S8a");
+ Assert.AreEqual (176, myMonthCal1.SingleMonthSize.Width, "#S8b");
+ Assert.AreEqual (null, myMonthCal1.Site, "#S9");
+ // T
+ Assert.AreEqual ("ActiveCaption", myMonthCal1.TitleBackColor.Name, "#T1");
+ Assert.AreEqual ("ActiveCaptionText", myMonthCal1.TitleForeColor.Name, "#T2");
+ Assert.AreEqual (DateTime.Today, myMonthCal1.TodayDate, "#T3");
+ Assert.AreEqual (false, myMonthCal1.TodayDateSet, "#T4");
+ Assert.AreEqual ("GrayText", myMonthCal1.TrailingForeColor.Name, "#T5");
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void MonthCalMaxSelectionCountException ()
+ {
+ MonthCalendar myMonthCal1 = new MonthCalendar ();
+ myMonthCal1.MaxSelectionCount = 0 ; // value is less than 1
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void MonthCalMaxDateException ()
+ {
+ MonthCalendar myMonthCal1 = new MonthCalendar ();
+ myMonthCal1.MaxDate = new DateTime (1752, 1, 1, 0, 0, 0, 0); // value is less than min date (01/01/1753)
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void MonthCalMinDateException ()
+ {
+ MonthCalendar myMonthCal1 = new MonthCalendar ();
+ myMonthCal1.MinDate = new DateTime(1752, 1, 1, 0, 0, 0, 0); // Date earlier than 01/01/1753
+ myMonthCal1.MinDate = new DateTime(9999, 12, 31, 0, 0, 0, 0); // Date greater than max date (01/01/1753)
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void MonthCalSelectRangeException ()
+ {
+ MonthCalendar myMonthCal1 = new MonthCalendar ();
+ myMonthCal1.SelectionRange = new SelectionRange (new DateTime (1752, 01, 01), new DateTime (1752, 01, 02));
+ myMonthCal1.SelectionRange = new SelectionRange (new DateTime (9999, 12, 30), new DateTime (9999, 12, 31));
+ }
+
+ [Test]
+ public void AddAnnuallyBoldedDateTest ()
+ {
+ Form myForm = new Form ();
+ MonthCalendar myMonthCal = new MonthCalendar ();
+ myMonthCal.AddAnnuallyBoldedDate (new DateTime (2005, 09, 01));
+ myForm.Controls.Add (myMonthCal);
+ Assert.AreEqual (new DateTime (2005, 09, 01), myMonthCal.AnnuallyBoldedDates.GetValue (0), "#add1");
+ }
+
+ [Test]
+ public void AddBoldedDateTest ()
+ {
+ Form myForm = new Form ();
+ MonthCalendar myMonthCal = new MonthCalendar ();
+ myMonthCal.AddBoldedDate (new DateTime (2005, 09, 02));
+ myForm.Controls.Add (myMonthCal);
+ Assert.AreEqual (new DateTime (2005, 09, 02), myMonthCal.BoldedDates.GetValue (0), "#add2");
+ }
+
+ [Test]
+ public void AddMonthlyBoldedDateTest ()
+ {
+ Form myForm = new Form ();
+ MonthCalendar myMonthCal = new MonthCalendar ();
+ myMonthCal.AddMonthlyBoldedDate (new DateTime (2005, 09, 03));
+ myForm.Controls.Add (myMonthCal);
+ Assert.AreEqual (new DateTime (2005, 09, 03), myMonthCal.MonthlyBoldedDates.GetValue (0), "#add2");
+ }
+
+ [Test]
+ public void GetDispalyRangeTest ()
+ {
+ Form myForm = new Form ();
+ MonthCalendar myMonthCal = new MonthCalendar ();
+ myForm.Controls.Add (myMonthCal);
+ SelectionRange mySelRange = new SelectionRange ();
+ mySelRange.Start = new DateTime (2005, 09, 01);
+ mySelRange.End = new DateTime (2005, 09, 30);
+ Assert.AreEqual (mySelRange.Start, myMonthCal.GetDisplayRange (true).Start, "#Get1");
+ Assert.AreEqual (mySelRange.End, myMonthCal.GetDisplayRange (true).End, "#Get22");
+ }
+
+ [Test]
+ public void HitTest ()
+ {
+ Form myForm = new Form ();
+ MonthCalendar myMonthCal = new MonthCalendar ();
+ myForm.Controls.Add (myMonthCal);
+ Assert.AreEqual (new DateTime (01, 01, 01), myMonthCal.HitTest(10, 10).Time, "#Hit1");
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/PictureBoxTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/PictureBoxTest.cs
new file mode 100644
index 00000000000..3b0151afefb
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/PictureBoxTest.cs
@@ -0,0 +1,82 @@
+//
+// PictureBoxTest.cs: Test cases for PictureBox.
+//
+// Author:
+// Ritvik Mayank (mritvik@novell.com)
+//
+// (C) 2005 Novell, Inc. (http://www.novell.com)
+//
+
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Reflection;
+using NUnit.Framework;
+using System.Threading;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ public class PictureBoxTest
+ {
+ [Test]
+ public void PictureBoxPropertyTest ()
+ {
+ Form myForm = new Form ();
+ PictureBox myPicBox = new PictureBox ();
+ myForm.Controls.Add (myPicBox);
+
+ // B
+ Assert.AreEqual (BorderStyle.None, myPicBox.BorderStyle, "#B1");
+ myPicBox.BorderStyle = BorderStyle.Fixed3D;
+ Assert.AreEqual (BorderStyle.Fixed3D, myPicBox.BorderStyle, "#B2");
+
+ // I
+ Assert.AreEqual (null, myPicBox.Image, "#I1");
+ Image myImage = Image.FromFile("M.gif");
+ myPicBox.Image = myImage;
+ Assert.AreEqual (60, myPicBox.Image.Height, "#I2");
+ Assert.AreEqual (150, myPicBox.Image.Width, "#I3");
+
+ // P
+ Assert.AreEqual (PictureBoxSizeMode.Normal, myPicBox.SizeMode, "#P1");
+ myPicBox.SizeMode = PictureBoxSizeMode.AutoSize;
+ Assert.AreEqual (PictureBoxSizeMode.AutoSize, myPicBox.SizeMode, "#P2");
+ }
+
+
+ [Test, Ignore ("This seems to fail.")]
+ public void ToStringMethodTest ()
+ {
+ PictureBox myPicBox = new PictureBox ();
+ Assert.AreEqual ("System.Windows.Forms.PictureBox, SizeMode: Normal", myPicBox.ToString (), "#T1");
+ }
+
+ [TestFixture]
+ public class PictureBoxSizeModeEventClass
+ {
+ static bool eventhandled = false;
+ public static void SizeMode_EventHandler (object sender, EventArgs e)
+ {
+ eventhandled = true;
+ }
+
+ [Test]
+ public void PictureBoxEvenTest ()
+ {
+ Form myForm = new Form ();
+ PictureBox myPicBox = new PictureBox ();
+ myForm.Controls.Add (myPicBox);
+ myPicBox.SizeModeChanged += new EventHandler (SizeMode_EventHandler);
+ myPicBox.SizeMode = PictureBoxSizeMode.AutoSize;
+ Assert.AreEqual (true, eventhandled, "#SM1");
+ eventhandled = false;
+ myPicBox.SizeMode = PictureBoxSizeMode.CenterImage;
+ Assert.AreEqual (true, eventhandled, "#SM2");
+ eventhandled = false;
+ myPicBox.SizeMode = PictureBoxSizeMode.StretchImage;
+ Assert.AreEqual (true, eventhandled, "#SM3");
+ }
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ProgressBarTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ProgressBarTest.cs
new file mode 100644
index 00000000000..0b93e3db00b
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ProgressBarTest.cs
@@ -0,0 +1,84 @@
+//
+// ProgressBarTest.cs: Test cases for ProgressBar.
+//
+// Author:
+// Ritvik Mayank (mritvik@novell.com)
+//
+// (C) 2005 Novell, Inc. (http://www.novell.com)
+//
+
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Reflection;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ [Ignore ("This test has to be completly reviewed")]
+ public class ProgressBarBaseTest
+ {
+ [Test]
+ public void ProgressBarPropertyTest ()
+ {
+ ProgressBar myProgressBar = new ProgressBar ();
+
+ // A
+ Assert.AreEqual (false, myProgressBar.AllowDrop, "#A1");
+
+ // B
+ Assert.AreEqual ("Control", myProgressBar.BackColor.Name, "#B1");
+ myProgressBar.BackColor = Color.White;
+ Assert.AreEqual (255, myProgressBar.BackColor.R, "#B2");
+ Assert.AreEqual (null, myProgressBar.BackgroundImage, "#B3");
+ string gif = "M.gif";
+ myProgressBar.BackgroundImage = Image.FromFile (gif);
+ // comparing image objects fails on MS .Net so using Size property
+ Assert.AreEqual (Image.FromFile(gif, true).Size, myProgressBar.BackgroundImage.Size, "#B4");
+
+ // F
+ Assert.AreEqual (8.25, myProgressBar.Font.Size, "#F1");
+ Assert.AreEqual (FontStyle.Regular, myProgressBar.Font.Style, "#F2");
+ Assert.AreEqual ("ControlText", myProgressBar.ForeColor.Name, "#F3");
+
+ // M
+ Assert.AreEqual (100, myProgressBar.Maximum, "#M1");
+ Assert.AreEqual (0, myProgressBar.Minimum, "#M2");
+
+ // R
+ Assert.AreEqual (RightToLeft.No, myProgressBar.RightToLeft, "#R1");
+
+ // S
+ Assert.AreEqual (10, myProgressBar.Step, "#S1");
+
+ // T
+ Assert.AreEqual ("", myProgressBar.Text, "#T1");
+ myProgressBar.Text = "New ProgressBar";
+ Assert.AreEqual ("New ProgressBar", myProgressBar.Text, "#T2");
+
+ // V
+ Assert.AreEqual (0, myProgressBar.Value, "#V1");
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void ValueTest ()
+ {
+ ProgressBar myProgressBar = new ProgressBar ();
+ myProgressBar.Value = -1;
+ myProgressBar.Value = 100;
+ }
+
+ [Test]
+ public void ToStringMethodTest ()
+ {
+ ProgressBar myProgressBar = new ProgressBar ();
+ myProgressBar.Text = "New ProgressBar";
+ Assert.AreEqual ("System.Windows.Forms.ProgressBar, Minimum: 0, Maximum: 100, Value: 0", myProgressBar.ToString (), "#T3");
+ }
+ // [MonoTODO("Add test for method Increment (Visual Test)")]
+ // [MonoTODO("Add test for method PerformStep (Visual Test)")]
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/RadioButtonTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/RadioButtonTest.cs
new file mode 100644
index 00000000000..b16dcc70427
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/RadioButtonTest.cs
@@ -0,0 +1,104 @@
+//
+// RadioRadioButtonTest.cs: Test cases for RadioRadioButton.
+//
+// Author:
+// Ritvik Mayank (mritvik@novell.com)
+//
+// (C) 2005 Novell, Inc. (http://www.novell.com)
+//
+
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ public class RadioButtonTest
+ {
+ [Test]
+ public void RadioButtonPropertyTest ()
+ {
+ RadioButton rButton1 = new RadioButton ();
+
+ // A
+ Assert.AreEqual (Appearance.Normal, rButton1.Appearance, "#A1");
+ Assert.AreEqual (true, rButton1.AutoCheck, "#A2");
+
+ // C
+ Assert.AreEqual (false, rButton1.Checked, "#C1");
+ Assert.AreEqual (ContentAlignment.MiddleLeft, rButton1.CheckAlign, "#C2");
+
+ // S
+ Assert.AreEqual (null, rButton1.Site, "#S1");
+
+ // T
+ rButton1.Text = "New RadioButton";
+ Assert.AreEqual ("New RadioButton", rButton1.Text, "#T1");
+ Assert.AreEqual (ContentAlignment.MiddleLeft, rButton1.TextAlign, "#T2");
+ }
+
+ [Test]
+ public void ToStringTest ()
+ {
+ RadioButton rButton1 = new RadioButton ();
+ Assert.AreEqual ("System.Windows.Forms.RadioButton, Checked: False" , rButton1.ToString (), "#9");
+ }
+ }
+
+ [TestFixture]
+ public class RadioButtonEventTestClass
+ {
+ static bool eventhandled = false;
+ public static void RadioButton_EventHandler (object sender, EventArgs e)
+ {
+ eventhandled = true;
+ }
+
+ [Test]
+ public void PanelClickTest ()
+ {
+ Form myForm = new Form ();
+ RadioButton rButton1 = new RadioButton ();
+ rButton1.Select ();
+ rButton1.Visible = true;
+ myForm.Controls.Add (rButton1);
+ eventhandled = false;
+ rButton1.Click += new EventHandler (RadioButton_EventHandler);
+ myForm.Show ();
+ rButton1.PerformClick ();
+ Assert.AreEqual (true, eventhandled, "#2");
+ }
+
+ [Test]
+ public void ApperanceChangedTest ()
+ {
+ Form myForm = new Form ();
+ RadioButton rButton1 = new RadioButton ();
+ rButton1.Select ();
+ rButton1.Visible = true;
+ myForm.Controls.Add (rButton1);
+ rButton1.Appearance = Appearance.Normal;
+ eventhandled = false;
+ rButton1.AppearanceChanged += new EventHandler (RadioButton_EventHandler);
+ rButton1.Appearance = Appearance.Button;
+ Assert.AreEqual (true, eventhandled, "#2");
+ }
+
+ [Test]
+ public void CheckedChangedTest ()
+ {
+ Form myForm = new Form ();
+ RadioButton rButton1 = new RadioButton ();
+ rButton1.Select ();
+ rButton1.Visible = true;
+ myForm.Controls.Add (rButton1);
+ rButton1.Checked = false;
+ eventhandled = false;
+ rButton1.CheckedChanged += new EventHandler (RadioButton_EventHandler);
+ rButton1.Checked = true;
+ Assert.AreEqual (true, eventhandled, "#3");
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/RichTextBoxTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/RichTextBoxTest.cs
new file mode 100644
index 00000000000..64a74b79077
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/RichTextBoxTest.cs
@@ -0,0 +1,187 @@
+//
+// RichTextBoxTest.cs: Test cases for RichTextBox.
+//
+// Author:
+// Ritvik Mayank (mritvik@novell.com)
+//
+// (C) 2005 Novell, Inc. (http://www.novell.com)
+//
+
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Reflection;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ public class RichTextBoxBaseTest
+ {
+#if not
+ [Test]
+ public void RichTextBoxPropertyTest ()
+ {
+ RichTextBox rTBox = new RichTextBox ();
+
+ // A
+ Assert.AreEqual (false, rTBox.AllowDrop, "#A1");
+ rTBox.Multiline = true;
+ rTBox.AcceptsTab = true;
+ SendKeys.SendWait ("^%");
+ Assert.AreEqual (false, rTBox.AutoSize, "#A2");
+ Assert.AreEqual (false, rTBox.AutoWordSelection, "#A3");
+
+
+ // B
+ rTBox.BackColor = Color.White;
+ Assert.AreEqual (null, rTBox.BackgroundImage, "#B1");
+ string gif = "M.gif";
+ rTBox.BackgroundImage = Image.FromFile (gif);
+ // comparing image objects fails on MS .Net so using Size property
+ Assert.AreEqual (Image.FromFile(gif, true).Size, rTBox.BackgroundImage.Size, "#B2");
+ Assert.AreEqual (0, rTBox.BulletIndent, "#B3");
+
+ // C
+ Assert.AreEqual (false, rTBox.CanRedo, "#C1");
+ rTBox.Paste ();
+ Assert.AreEqual (false, rTBox.CanRedo, "#C2");
+ rTBox.ClearUndo ();
+ Assert.AreEqual (false, rTBox.CanRedo, "#C3");
+
+ // D
+ Assert.AreEqual (true, rTBox.DetectUrls, "#D1");
+
+ // F
+ Assert.AreEqual (FontStyle.Regular, rTBox.Font.Style, "#F1");
+ Assert.AreEqual ("WindowText", rTBox.ForeColor.Name, "#F2");
+
+ //M
+ Assert.AreEqual (2147483647, rTBox.MaxLength, "#M1");
+ Assert.AreEqual (true, rTBox.Multiline, "#M2");
+ rTBox.WordWrap = false;
+ Assert.AreEqual (true, rTBox.Multiline, "#M3");
+
+ // R
+ Assert.AreEqual ("", rTBox.RedoActionName, "#R1");
+ Assert.AreEqual (0, rTBox.RightMargin, "#R2");
+
+ // [MonoTODO ("Assert.AreEqual (false, rTBox.Rtf, "#R3");") ]
+
+ // S
+
+ // [MonoTODO ("Assert.AreEqual (ScrollBars.Both, rTBox.ScrollBars, "#S1");")]
+ Assert.AreEqual (RichTextBoxScrollBars.Both, rTBox.ScrollBars, "#S1");
+ Assert.AreEqual ("", rTBox.SelectedText, "#S3");
+ rTBox.Text = "sample TextBox";
+ Assert.AreEqual (HorizontalAlignment.Left, rTBox.SelectionAlignment, "#S5");
+ Assert.AreEqual (false, rTBox.SelectionBullet, "#S6");
+ Assert.AreEqual (0, rTBox.SelectionCharOffset, "#S7");
+ //Assert.AreEqual (Color.Black, rTBox.SelectionColor, "#S8"); // Random color
+ Assert.AreEqual ("Courier New", rTBox.SelectionFont.Name, "#S9a");
+ Assert.AreEqual (FontStyle.Regular, rTBox.SelectionFont.Style, "#S9b");
+ Assert.AreEqual (0, rTBox.SelectionHangingIndent, "#S10");
+ Assert.AreEqual (0, rTBox.SelectionIndent, "#S11");
+ Assert.AreEqual (0, rTBox.SelectionLength, "#S12");
+ Assert.AreEqual (false, rTBox.SelectionProtected, "#S13");
+ Assert.AreEqual (0, rTBox.SelectionRightIndent, "#S14");
+ Assert.AreEqual (false, rTBox.ShowSelectionMargin, "#S15");
+ // [MonoTODO ("Assert.AreEqual (, rTBox.SelectionTabs, "#S16");")]
+ // [MonoTODO("Assert.AreEqual (TypeCode.Empty, rTBox.SelectionType, "#S17");")]
+
+ // T
+ Assert.AreEqual ("sample TextBox", rTBox.Text, "#T1");
+ Assert.AreEqual (14, rTBox.TextLength, "#T2");
+
+ // UVW
+ Assert.AreEqual ("", rTBox.UndoActionName, "#U1");
+
+ // XYZ
+ Assert.AreEqual (1, rTBox.ZoomFactor, "#Z1");
+
+ }
+
+ [Test]
+ public void CanPasteTest ()
+ {
+ RichTextBox rTextBox = new RichTextBox ();
+ Bitmap myBitmap = new Bitmap ("M.gif");
+ Clipboard.SetDataObject (myBitmap);
+ DataFormats.Format myFormat = DataFormats.GetFormat (DataFormats.Bitmap);
+ Assert.AreEqual (true, rTextBox.CanPaste (myFormat), "#Mtd1");
+ }
+#endif
+
+ [Test]
+ public void FindCharTest ()
+ {
+ RichTextBox rTextBox = new RichTextBox ();
+ rTextBox.Text = "something";
+ Assert.AreEqual (2, rTextBox.Find (new char [] {'m'}), "#Mtd3");
+ Assert.AreEqual (-1, rTextBox.Find (new char [] {'t'},5), "#Mtd3a");
+ Assert.AreEqual (4, rTextBox.Find (new char [] {'t'},4,5), "#Mtd3b");
+ }
+
+ [Test]
+ public void FindStringTest ()
+ {
+ RichTextBox rTextBox = new RichTextBox ();
+ rTextBox.Text = "sample text for richtextbox";
+ int indexToText1 = rTextBox.Find ("for");
+ Assert.AreEqual (12, indexToText1, "#Mtd4");
+ int indexToText2 = rTextBox.Find ("for", 0, 14, RichTextBoxFinds.MatchCase);
+ Assert.AreEqual (-1, indexToText2, "#Mtd5");
+ int indexToText3 = rTextBox.Find ("for", 0, 15, RichTextBoxFinds.MatchCase);
+ Assert.AreEqual (12, indexToText3, "#Mtd6");
+ int indexToText4 = rTextBox.Find ("richtextbox", 0, RichTextBoxFinds.MatchCase);
+ Assert.AreEqual (16, indexToText4, "#Mtd7");
+ int indexToText5 = rTextBox.Find ("text", RichTextBoxFinds.MatchCase);
+ Assert.AreEqual (7, indexToText5, "#Mtd8");
+ }
+
+ [Test]
+ public void FindTest() {
+ RichTextBox t = new RichTextBox();
+
+ t.Text = "Testtext and arglblah may not be what we're looking for\n, but blah Blah is";
+
+ Assert.AreEqual(t.Find(new char[] {'b', 'l', 'a', 'h'}), 9, "Find1");
+ Assert.AreEqual(t.Find(new char[] {'b', 'l', 'a', 'h'}, 20), 20, "Find2");
+ Assert.AreEqual(t.Find(new char[] {'b', 'l', 'a', 'h'}, 25, 30), -1, "Find3");
+ Assert.AreEqual(t.Find("blah"), 17, "Find4");
+ Assert.AreEqual(t.Find("blah", 10, 30, RichTextBoxFinds.None), 17, "Find5");
+ Assert.AreEqual(t.Find("blah", 10, 30, RichTextBoxFinds.WholeWord), -1, "Find6");
+ Assert.AreEqual(t.Find("blah", 10, 30, RichTextBoxFinds.MatchCase), 17, "Find7");
+ Assert.AreEqual(t.Find("blah", 10, 70, RichTextBoxFinds.Reverse), 62, "Find8");
+ Assert.AreEqual(t.Find("blah", 10, 73, RichTextBoxFinds.Reverse), 67, "Find9");
+ Assert.AreEqual(t.Find("blah", 10, 73, RichTextBoxFinds.Reverse | RichTextBoxFinds.MatchCase), 62, "Find10");
+ Assert.AreEqual(t.Find("blah", 10, RichTextBoxFinds.None), 17, "Find11");
+ Assert.AreEqual(t.Find("blah", 10, RichTextBoxFinds.WholeWord), 62, "Find12");
+ Assert.AreEqual(t.Find("blah", 10, RichTextBoxFinds.MatchCase), 17, "Find13");
+ Assert.AreEqual(t.Find("blah", 10, RichTextBoxFinds.Reverse), 67, "Find14");
+ Assert.AreEqual(t.Find("blah", 10, RichTextBoxFinds.Reverse | RichTextBoxFinds.MatchCase), 62, "Find15");
+ Assert.AreEqual(t.Find("blah", RichTextBoxFinds.Reverse), 67, "Find16");
+ Assert.AreEqual(t.Find("blah", RichTextBoxFinds.MatchCase), 17, "Find17");
+ Assert.AreEqual(t.Find("blah", RichTextBoxFinds.WholeWord), 62, "Find18");
+
+ // Special cases
+ Assert.AreEqual(t.Find("blah", 10, 11, RichTextBoxFinds.None), -1, "Find19"); // Range to short to ever match
+ Assert.AreEqual(t.Find("blah", 17, 18, RichTextBoxFinds.None), -1, "Find20"); // Range to short to ever match, but starts matching
+ Assert.AreEqual(t.Find("is", RichTextBoxFinds.WholeWord), 72, "Find21"); // Last word in document
+ Assert.AreEqual(t.Find("for", RichTextBoxFinds.WholeWord), 52, "Find22"); // word followed by \n
+ Assert.AreEqual(t.Find("Testtext", RichTextBoxFinds.WholeWord), 0, "Find23"); // First word in document
+ Assert.AreEqual(t.Find("Testtext", RichTextBoxFinds.WholeWord | RichTextBoxFinds.Reverse), 0, "Find24"); // First word in document, searched in reverse
+ }
+
+ [Test]
+ public void GetCharFromPositionTest ()
+ {
+ Form myForm = new Form ();
+ RichTextBox rTextBox = new RichTextBox ();
+ rTextBox.Text = "sample text for richtextbox";
+ myForm.Controls.Add (rTextBox);
+ Assert.AreEqual ('m', rTextBox.GetCharFromPosition (new Point (10, 10)), "#21");
+ }
+ //[MonoTODO("Add test for method Paste (Visual Test)")]
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ScrollBarTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ScrollBarTest.cs
new file mode 100644
index 00000000000..0c0e2897a70
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ScrollBarTest.cs
@@ -0,0 +1,1453 @@
+//
+// Copyright (c) 2005 Novell, Inc.
+//
+// Authors:
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+// Ritvik Mayank (mritvik@novell.com)
+//
+//
+
+using System;
+using NUnit.Framework;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Collections;
+
+namespace MonoTests.System.Windows.Forms
+{
+
+public class MyScrollBar : HScrollBar
+ {
+ private ArrayList results = new ArrayList ();
+ public MyScrollBar () : base ()
+ {}
+
+ protected override void OnBackColorChanged (EventArgs e)
+ {
+ results.Add ("OnBackColorChanged");
+ base.OnBackColorChanged (e);
+ }
+
+ protected override void OnBackgroundImageChanged (EventArgs e)
+ {
+ results.Add ("OnBackgroundImageChanged");
+ base.OnBackgroundImageChanged (e);
+ }
+
+ protected override void OnClick (EventArgs e)
+ {
+ results.Add ("OnClick");
+ base.OnClick (e);
+ }
+
+ protected override void OnDoubleClick (EventArgs e)
+ {
+ results.Add ("OnDoubleClick");
+ base.OnDoubleClick (e);
+ }
+
+ protected override void OnFontChanged (EventArgs e)
+ {
+ results.Add ("OnFontChanged");
+ base.OnFontChanged (e);
+ }
+
+ protected override void OnForeColorChanged (EventArgs e)
+ {
+ results.Add ("OnForeColorChanged");
+ base.OnForeColorChanged (e);
+ }
+
+ protected override void OnImeModeChanged (EventArgs e)
+ {
+ results.Add ("OnImeModeChanged");
+ base.OnImeModeChanged (e);
+ }
+
+ protected override void OnMouseDown (MouseEventArgs e)
+ {
+ results.Add ("OnMouseDown");
+ base.OnMouseDown (e);
+ }
+
+ protected override void OnMouseMove (MouseEventArgs e)
+ {
+ results.Add ("OnMouseMove");
+ base.OnMouseMove (e);
+ }
+
+ protected override void OnMouseEnter (EventArgs e)
+ {
+ results.Add ("OnMouseEnter");
+ base.OnMouseEnter (e);
+ }
+
+ protected override void OnMouseLeave (EventArgs e)
+ {
+ results.Add ("OnMouseLeave");
+ base.OnMouseLeave (e);
+ }
+
+ protected override void OnMouseHover (EventArgs e)
+ {
+ results.Add ("OnMouseHover");
+ base.OnMouseHover (e);
+ }
+
+ protected override void OnMouseUp (MouseEventArgs e)
+ {
+ results.Add ("OnMouseUp");
+ base.OnMouseUp (e);
+ }
+
+ protected override void OnHandleCreated (EventArgs e)
+ {
+ results.Add ("OnHandleCreated");
+ base.OnHandleCreated (e);
+ }
+
+ protected override void OnBindingContextChanged (EventArgs e)
+ {
+ results.Add ("OnBindingContextChanged");
+ base.OnBindingContextChanged (e);
+ }
+
+ protected override void OnInvalidated (InvalidateEventArgs e)
+ {
+ results.Add("OnInvalidated");
+ base.OnInvalidated (e);
+ }
+
+ protected override void OnResize (EventArgs e)
+ {
+ results.Add("OnResize");
+ base.OnResize (e);
+ }
+
+ protected override void OnSizeChanged (EventArgs e)
+ {
+ results.Add("OnSizeChanged");
+ base.OnSizeChanged (e);
+ }
+
+ protected override void OnLayout (LayoutEventArgs e)
+ {
+ results.Add("OnLayout");
+ base.OnLayout (e);
+ }
+
+ protected override void OnVisibleChanged (EventArgs e)
+ {
+ results.Add("OnVisibleChanged");
+ base.OnVisibleChanged (e);
+ }
+
+ protected override void OnScroll (ScrollEventArgs e)
+ {
+ results.Add("OnScroll");
+ base.OnScroll (e);
+ }
+
+ protected override void OnTextChanged (EventArgs e)
+ {
+ results.Add("OnTextChanged");
+ base.OnTextChanged (e);
+ }
+
+ protected override void OnValueChanged (EventArgs e)
+ {
+ results.Add("OnValueChanged");
+ base.OnValueChanged (e);
+ }
+
+ protected override void OnPaint (PaintEventArgs e)
+ {
+ results.Add("OnPaint");
+ base.OnPaint (e);
+ }
+
+ public ArrayList Results {
+ get { return results; }
+ }
+
+ public void MoveMouse ()
+ {
+ Message m;
+
+ m = new Message ();
+
+ m.Msg = (int)WndMsg.WM_NCHITTEST;
+ m.HWnd = this.Handle;
+ m.WParam = (IntPtr)0x0;
+ m.LParam = (IntPtr)0x1c604ea;
+ this.WndProc(ref m);
+
+ m.Msg = (int)WndMsg.WM_SETCURSOR;
+ m.HWnd = this.Handle;
+ m.WParam = (IntPtr)0x100448;
+ m.LParam = (IntPtr)0x2000001;
+ this.WndProc(ref m);
+
+ m.Msg = (int)WndMsg.WM_MOUSEFIRST;
+ m.HWnd = this.Handle;
+ m.WParam = (IntPtr)0x0;
+ m.LParam = (IntPtr)0x14000b;
+ this.WndProc(ref m);
+
+ m.Msg = (int)WndMsg.WM_MOUSEHOVER;
+ m.HWnd = this.Handle;
+ m.WParam = (IntPtr)0x0;
+ m.LParam = (IntPtr)0x14000b;
+ this.WndProc(ref m);
+ }
+
+ public void MouseClick()
+ {
+
+ Message m;
+
+ m = new Message();
+
+ m.Msg = (int)WndMsg.WM_LBUTTONDOWN;
+ m.HWnd = this.Handle;
+ m.WParam = (IntPtr)0x01;
+ m.LParam = (IntPtr)0x9004f;
+ this.WndProc(ref m);
+
+ m = new Message();
+
+ m.Msg = (int)WndMsg.WM_LBUTTONUP;
+ m.HWnd = this.Handle;
+ m.WParam = (IntPtr)0x01;
+ m.LParam = (IntPtr)0x9004f;
+ this.WndProc(ref m);
+ }
+
+ public void MouseDoubleClick ()
+ {
+ MouseClick ();
+ MouseClick ();
+ }
+ public void MouseRightDown()
+ {
+ Message m;
+
+ m = new Message();
+
+ m.Msg = (int)WndMsg.WM_RBUTTONDOWN;
+ m.HWnd = this.Handle;
+ m.WParam = (IntPtr)0x01;
+ m.LParam = (IntPtr)0x9004f;
+ this.WndProc(ref m);
+ }
+
+ public void MouseRightUp()
+ {
+ Message m;
+
+ m = new Message();
+
+ m.Msg = (int)WndMsg.WM_RBUTTONUP;
+ m.HWnd = this.Handle;
+ m.WParam = (IntPtr)0x01;
+ m.LParam = (IntPtr)0x9004f;
+ this.WndProc(ref m);
+ }
+
+ public void ScrollNow ()
+ {
+ Message m;
+
+ m = new Message ();
+
+ m.Msg = 8468;
+ m.HWnd = this.Handle;
+ m.WParam = (IntPtr)0x1;
+ m.LParam = (IntPtr)0x1a051a;
+ this.WndProc(ref m);
+
+ m.Msg = 233;
+ m.HWnd = this.Handle;
+ m.WParam = (IntPtr)0x1;
+ m.LParam = (IntPtr)0x12eb34;
+ this.WndProc(ref m);
+ }
+ }
+ [TestFixture]
+ public class ScrollbarTest
+ {
+ [Test]
+ public void PubPropTest ()
+ {
+ MyScrollBar myscrlbar = new MyScrollBar ();
+
+ // B
+ myscrlbar.BackColor = Color.Red;
+ Assert.AreEqual (255, myscrlbar.BackColor.R, "B2");
+ myscrlbar.BackgroundImage = Image.FromFile ("Test/System.Windows.Forms/bitmaps/a.png");
+ Assert.AreEqual (16, myscrlbar.BackgroundImage.Height, "B3");
+
+ // F
+ Assert.AreEqual ("ff000000", myscrlbar.ForeColor.Name, "F1");
+
+ // I
+ //Assert.AreEqual (ImeMode.Disable, myscrlbar.ImeMode, "I1");
+
+ // L
+ Assert.AreEqual (10, myscrlbar.LargeChange, "L1");
+
+ // M
+ Assert.AreEqual (100, myscrlbar.Maximum, "M1");
+ Assert.AreEqual (0, myscrlbar.Minimum, "M2");
+ myscrlbar.Maximum = 300;
+ myscrlbar.Minimum = 100;
+ Assert.AreEqual (300, myscrlbar.Maximum, "M3");
+ Assert.AreEqual (100, myscrlbar.Minimum, "M4");
+
+ // S
+ Assert.AreEqual (null, myscrlbar.Site, "S1");
+ Assert.AreEqual (1, myscrlbar.SmallChange, "S2");
+ myscrlbar.SmallChange = 10;
+ Assert.AreEqual (10, myscrlbar.SmallChange, "S3");
+
+ // T
+ Assert.AreEqual (false, myscrlbar.TabStop, "T1");
+ myscrlbar.TabStop = true;
+ Assert.AreEqual (true, myscrlbar.TabStop, "T2");
+ Assert.AreEqual ("", myscrlbar.Text, "T3");
+ myscrlbar.Text = "MONO SCROLLBAR";
+ Assert.AreEqual ("MONO SCROLLBAR", myscrlbar.Text, "T4");
+
+ // V
+ Assert.AreEqual (100, myscrlbar.Value, "V1");
+ myscrlbar.Value = 150;
+ Assert.AreEqual (150, myscrlbar.Value, "V2");
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void ExceptionValueTest ()
+ {
+ MyScrollBar myscrlbar = new MyScrollBar ();
+ myscrlbar.Minimum = 10;
+ myscrlbar.Maximum = 20;
+ myscrlbar.Value = 9;
+ myscrlbar.Value = 21;
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void ExceptionSmallChangeTest ()
+ {
+ MyScrollBar myscrlbar = new MyScrollBar ();
+ myscrlbar.SmallChange = -1;
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void ExceptionLargeChangeTest ()
+ {
+ MyScrollBar myscrlbar = new MyScrollBar ();
+ myscrlbar.LargeChange = -1;
+ }
+
+ [Test, Ignore ("Look into this")]
+ public void PubMethodTest ()
+ {
+ MyScrollBar myscrlbar = new MyScrollBar ();
+ myscrlbar.Text = "New HScrollBar";
+ Assert.AreEqual ("System.Windows.Forms.HScrollBar, Minimum: 0, Maximum: 100, Value: 0",
+ myscrlbar.ToString (), "T5");
+ }
+ }
+
+ [TestFixture]
+ public class ScrollBarEventTest
+ {
+ static bool eventhandled = false;
+ public void ScrollBar_EventHandler (object sender,EventArgs e)
+ {
+ eventhandled = true;
+ }
+
+ public void ScrollBarMouse_EventHandler (object sender,MouseEventArgs e)
+ {
+ eventhandled = true;
+ }
+
+ public void ScrollBarScroll_EventHandler (object sender,ScrollEventArgs e)
+ {
+ eventhandled = true;
+ }
+
+ public void ScrollBarPaint_EventHandler (object sender,PaintEventArgs e)
+ {
+ eventhandled = true;
+ }
+
+ [Test]
+ public void BackColorChangedTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ ScrollBar myHscrlbar = new HScrollBar ();
+ myform.Controls.Add (myHscrlbar);
+ myHscrlbar.BackColorChanged += new EventHandler (ScrollBar_EventHandler);
+ myHscrlbar.BackColor = Color.Red;
+ Assert.AreEqual (true, eventhandled, "B4");
+ eventhandled = false;
+ }
+
+ [Test]
+ public void BackgroundImageChangedTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ ScrollBar myHscrlbar = new HScrollBar ();
+ myform.Controls.Add (myHscrlbar);
+ myHscrlbar.BackgroundImageChanged += new EventHandler (ScrollBar_EventHandler);
+ myHscrlbar.BackgroundImage = Image.FromFile ("Test/System.Windows.Forms/bitmaps/a.png");
+ Assert.AreEqual (true, eventhandled, "B5");
+ eventhandled = false;
+ }
+
+ [Test, Ignore ("Need to send proper Click / DoubleClick")]
+ public void ClickTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar myHscrlbar = new MyScrollBar ();
+ myform.Controls.Add (myHscrlbar);
+ myHscrlbar.Click += new EventHandler (ScrollBar_EventHandler);
+ myHscrlbar.MouseClick ();
+
+ Assert.AreEqual (false, eventhandled, "C1");
+ }
+
+ [Test, Ignore ("Need to send proper Click / DoubleClick")]
+ public void DoubleClickTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar myHscrlbar = new MyScrollBar ();
+ myform.Controls.Add (myHscrlbar);
+ myHscrlbar.DoubleClick += new EventHandler (ScrollBar_EventHandler);
+ myHscrlbar.MouseDoubleClick ();
+
+ Assert.AreEqual (false, eventhandled, "D1");
+ }
+
+ [Test]
+ public void FontChangedTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ ScrollBar myHscrlbar = new HScrollBar ();
+ myform.Controls.Add (myHscrlbar);
+ myHscrlbar.FontChanged += new EventHandler (ScrollBar_EventHandler);
+ FontDialog myFontDialog = new FontDialog();
+ myHscrlbar.Font = myFontDialog.Font;
+ Assert.AreEqual (true, eventhandled, "F2");
+ eventhandled = false;
+ }
+
+ [Test]
+ public void ForeColorChangedTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ ScrollBar myHscrlbar = new HScrollBar ();
+ myform.Controls.Add (myHscrlbar);
+ myHscrlbar.ForeColorChanged += new EventHandler (ScrollBar_EventHandler);
+ myHscrlbar.ForeColor = Color.Azure;
+ Assert.AreEqual (true, eventhandled, "F3");
+ eventhandled = false;
+ }
+
+ [Test]
+ public void ImeModehangedTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ ScrollBar myHscrlbar = new HScrollBar ();
+ myform.Controls.Add (myHscrlbar);
+ myHscrlbar.ImeModeChanged += new EventHandler (ScrollBar_EventHandler);
+ myHscrlbar.ImeMode = ImeMode.Katakana;
+ Assert.AreEqual (true, eventhandled, "I2");
+ eventhandled = false;
+ }
+
+ [Test]
+ public void MouseDownTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar myHscrlbar = new MyScrollBar ();
+ myform.Controls.Add (myHscrlbar);
+ myHscrlbar.MouseDown += new MouseEventHandler (ScrollBarMouse_EventHandler);
+ myHscrlbar.MouseRightDown ();
+
+ Assert.AreEqual (true, eventhandled, "M5");
+ eventhandled = false;
+ }
+
+ [Test]
+ public void MouseMoveTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar myHscrlbar = new MyScrollBar ();
+ myform.Controls.Add (myHscrlbar);
+ myHscrlbar.MouseMove += new MouseEventHandler (ScrollBarMouse_EventHandler);
+ myHscrlbar.MoveMouse ();
+
+ Assert.AreEqual (true, eventhandled, "M6");
+ eventhandled = false;
+ }
+
+ [Test]
+ public void MouseUpTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar myHscrlbar = new MyScrollBar ();
+ myform.Controls.Add (myHscrlbar);
+ myHscrlbar.MouseUp += new MouseEventHandler (ScrollBarMouse_EventHandler);
+ myHscrlbar.MouseRightUp ();
+
+ Assert.AreEqual (true, eventhandled, "M7");
+ eventhandled = false;
+ }
+
+ [Test, Ignore ("How can we force it to pain?")]
+ public void PaintTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar myHscrlbar = new MyScrollBar ();
+ myform.Controls.Add (myHscrlbar);
+ myHscrlbar.Paint += new PaintEventHandler (ScrollBarPaint_EventHandler);
+
+ myHscrlbar.Refresh ();
+
+ Assert.AreEqual (true, eventhandled, "P1");
+ eventhandled = false;
+ }
+
+ [Test]
+ public void ScrollTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar myHscrlbar = new MyScrollBar ();
+ myform.Controls.Add (myHscrlbar);
+ myHscrlbar.Scroll += new ScrollEventHandler (ScrollBarScroll_EventHandler);
+ myHscrlbar.ScrollNow ();
+
+ Assert.AreEqual (true, eventhandled, "S4");
+ eventhandled = false;
+ }
+
+ [Test]
+ public void TextChangedTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar myHscrlbar = new MyScrollBar ();
+ myform.Controls.Add (myHscrlbar);
+ myHscrlbar.TextChanged += new EventHandler (ScrollBar_EventHandler);
+ myHscrlbar.Text = "foo";
+
+ Assert.AreEqual (true, eventhandled, "T6");
+ eventhandled = false;
+ }
+
+ [Test]
+ public void ValueChangeTest ()
+ {
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar myHscrlbar = new MyScrollBar ();
+ myform.Controls.Add (myHscrlbar);
+ myHscrlbar.Value = 40 ;
+ myHscrlbar.ValueChanged += new EventHandler (ScrollBar_EventHandler);
+ myHscrlbar.Value = 50 ;
+ Assert.AreEqual (true, eventhandled, "V3");
+ eventhandled = false;
+ }
+ }
+
+public class MyHScrollBar : HScrollBar
+ {
+ public MyHScrollBar () : base ()
+ {
+ }
+
+ public Size MyDefaultSize {
+ get { return DefaultSize; }
+ }
+
+ public CreateParams MyCreateParams {
+ get { return CreateParams; }
+ }
+ }
+
+ [TestFixture]
+ public class MyHScrollBarTest
+ {
+ [Test]
+ public void ProtectedTest ()
+ {
+ MyHScrollBar msbar = new MyHScrollBar ();
+
+ Assert.AreEqual (80, msbar.MyDefaultSize.Width, "D1");
+ Assert.AreEqual (21, msbar.MyDefaultSize.Height, "D2");
+ }
+ }
+
+public class MyVScrollBar : VScrollBar
+ {
+ public MyVScrollBar () : base ()
+ {
+ }
+
+ public Size MyDefaultSize {
+ get { return DefaultSize; }
+ }
+
+ public CreateParams MyCreateParams {
+ get { return CreateParams; }
+ }
+ }
+
+ [TestFixture]
+ public class MyVScrollBarTest
+ {
+ [Test]
+ public void PubMethodTest ()
+ {
+ MyVScrollBar msbar = new MyVScrollBar ();
+
+ Assert.AreEqual (RightToLeft.No, msbar.RightToLeft, "R1");
+
+ }
+
+ [Test]
+ public void ProtMethodTest ()
+ {
+ MyVScrollBar msbar = new MyVScrollBar ();
+
+ Assert.AreEqual (21, msbar.MyDefaultSize.Width, "D3");
+ Assert.AreEqual (80, msbar.MyDefaultSize.Height, "D4");
+ }
+ }
+
+ [TestFixture]
+ public class HScrollBarTestEventsOrder
+ {
+ public string [] ArrayListToString (ArrayList arrlist)
+ {
+ string [] retval = new string [arrlist.Count];
+ for (int i = 0; i < arrlist.Count; i++)
+ retval[i] = (string)arrlist[i];
+ return retval;
+ }
+
+ [Test]
+ public void CreateEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "OnHandleCreated",
+ "OnBindingContextChanged",
+ "OnBindingContextChanged"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar s = new MyScrollBar ();
+ myform.Controls.Add (s);
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (s.Results));
+ }
+
+ [Test]
+ public void BackColorChangedEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "OnHandleCreated",
+ "OnBindingContextChanged",
+ "OnBindingContextChanged",
+ "OnBackColorChanged",
+ "OnInvalidated"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar s = new MyScrollBar ();
+ myform.Controls.Add (s);
+ s.BackColor = Color.Aqua;
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (s.Results));
+ }
+
+ [Test]
+ public void BackgroundImageChangedEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "OnHandleCreated",
+ "OnBindingContextChanged",
+ "OnBindingContextChanged",
+ "OnBackgroundImageChanged",
+ "OnInvalidated"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar s = new MyScrollBar ();
+ myform.Controls.Add (s);
+ s.BackgroundImage = Image.FromFile ("Test/System.Windows.Forms/bitmaps/a.png");
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (s.Results));
+ }
+
+ [Test, Ignore ("Need to send proper Click / DoubleClick")]
+ public void ClickEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "OnHandleCreated",
+ "OnBindingContextChanged",
+ "OnBindingContextChanged"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar s = new MyScrollBar ();
+ myform.Controls.Add (s);
+ s.MouseClick ();
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (s.Results));
+ }
+
+ [Test, Ignore ("Need to send proper Click / DoubleClick")]
+ public void DoubleClickEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "OnHandleCreated",
+ "OnBindingContextChanged",
+ "OnBindingContextChanged"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar s = new MyScrollBar ();
+ myform.Controls.Add (s);
+ s.MouseDoubleClick ();
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (s.Results));
+ }
+
+ [Test]
+ public void FontChangedEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "OnHandleCreated",
+ "OnBindingContextChanged",
+ "OnBindingContextChanged"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar s = new MyScrollBar ();
+ myform.Controls.Add (s);
+ FontDialog myFontDialog = new FontDialog();
+ s.Font = myFontDialog.Font;
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (s.Results));
+ }
+
+ [Test]
+ public void ForeColorChangedEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "OnHandleCreated",
+ "OnBindingContextChanged",
+ "OnBindingContextChanged",
+ "OnForeColorChanged",
+ "OnInvalidated"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar s = new MyScrollBar ();
+ myform.Controls.Add (s);
+ s.ForeColor = Color.Aqua;
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (s.Results));
+ }
+
+ [Test]
+ public void ImeModeChangedChangedEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "OnHandleCreated",
+ "OnBindingContextChanged",
+ "OnBindingContextChanged",
+ "OnImeModeChanged"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar s = new MyScrollBar ();
+ myform.Controls.Add (s);
+ s.ImeMode = ImeMode.Katakana;
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (s.Results));
+ }
+
+ [Test]
+ public void MouseDownEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "OnHandleCreated",
+ "OnBindingContextChanged",
+ "OnBindingContextChanged",
+ "OnMouseDown"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar s = new MyScrollBar ();
+ myform.Controls.Add (s);
+ s.MouseRightDown ();
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (s.Results));
+ }
+
+ [Test]
+ public void MouseMoveEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "OnHandleCreated",
+ "OnBindingContextChanged",
+ "OnBindingContextChanged",
+ "OnMouseMove",
+ "OnMouseHover"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar s = new MyScrollBar ();
+ myform.Controls.Add (s);
+ s.MoveMouse ();
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (s.Results));
+ }
+
+ [Test]
+ public void MouseUpEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "OnHandleCreated",
+ "OnBindingContextChanged",
+ "OnBindingContextChanged",
+ "OnMouseUp"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar s = new MyScrollBar ();
+ myform.Controls.Add (s);
+ s.MouseRightUp ();
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (s.Results));
+ }
+
+ [Test]
+ public void PaintEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "OnHandleCreated",
+ "OnBindingContextChanged",
+ "OnBindingContextChanged",
+ "OnInvalidated"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar s = new MyScrollBar ();
+ myform.Controls.Add (s);
+ s.Visible = true;
+ s.Refresh ();
+ Assert.AreEqual (EventsWanted, ArrayListToString (s.Results));
+ }
+
+ [Test]
+ public void ScrollEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "OnHandleCreated",
+ "OnBindingContextChanged",
+ "OnBindingContextChanged",
+ "OnScroll",
+ "OnValueChanged"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar s = new MyScrollBar ();
+ myform.Controls.Add (s);
+ s.ScrollNow ();
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (s.Results));
+ }
+
+ [Test]
+ public void TextChangedEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "OnHandleCreated",
+ "OnBindingContextChanged",
+ "OnBindingContextChanged",
+ "OnTextChanged"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar s = new MyScrollBar ();
+ myform.Controls.Add (s);
+ s.Text = "foobar";
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (s.Results));
+ }
+
+ [Test]
+ public void ValueChangedEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "OnHandleCreated",
+ "OnBindingContextChanged",
+ "OnBindingContextChanged",
+ "OnValueChanged"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar s = new MyScrollBar ();
+ myform.Controls.Add (s);
+ s.Value = 10;
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (s.Results));
+ }
+ }
+
+public class MyScrollBar2 : HScrollBar
+ {
+ protected ArrayList results = new ArrayList ();
+ public MyScrollBar2 () : base ()
+ {
+ this.HandleCreated += new EventHandler (HandleCreated_Handler);
+ this.BackColorChanged += new EventHandler (BackColorChanged_Handler);
+ this.BackgroundImageChanged += new EventHandler (BackgroundImageChanged_Handler);
+ this.BindingContextChanged += new EventHandler (BindingContextChanged_Handler);
+ this.Click += new EventHandler (Click_Handler);
+ this.DoubleClick += new EventHandler (DoubleClick_Handler);
+ this.FontChanged += new EventHandler (FontChanged_Handler);
+ this.ForeColorChanged += new EventHandler (ForeColorChanged_Handler);
+ this.ImeModeChanged += new EventHandler (ImeModeChanged_Handler);
+ this.MouseDown += new MouseEventHandler (MouseDown_Handler);
+ this.MouseMove += new MouseEventHandler (MouseMove_Handler);
+ this.MouseUp += new MouseEventHandler (MouseUp_Handler);
+ this.Invalidated += new InvalidateEventHandler (Invalidated_Handler);
+ this.Resize += new EventHandler (Resize_Handler);
+ this.SizeChanged += new EventHandler (SizeChanged_Handler);
+ this.Layout += new LayoutEventHandler (Layout_Handler);
+ this.VisibleChanged += new EventHandler (VisibleChanged_Handler);
+ this.Paint += new PaintEventHandler (Paint_Handler);
+ this.Scroll += new ScrollEventHandler (Scroll_Handler);
+ this.TextChanged += new EventHandler (TextChanged_Handler);
+ this.ValueChanged += new EventHandler (ValueChanged_Handler);
+ }
+
+ protected void HandleCreated_Handler (object sender, EventArgs e)
+ {
+ results.Add ("HandleCreated");
+ }
+
+ protected void BackColorChanged_Handler (object sender, EventArgs e)
+ {
+ results.Add ("BackColorChanged");
+ }
+
+ protected void BackgroundImageChanged_Handler (object sender, EventArgs e)
+ {
+ results.Add ("BackgroundImageChanged");
+ }
+
+ protected void Click_Handler (object sender, EventArgs e)
+ {
+ results.Add ("Click");
+ }
+
+ protected void DoubleClick_Handler (object sender, EventArgs e)
+ {
+ results.Add ("DoubleClick");
+ }
+
+ protected void FontChanged_Handler (object sender, EventArgs e)
+ {
+ results.Add ("FontChanged");
+ }
+
+ protected void ForeColorChanged_Handler (object sender, EventArgs e)
+ {
+ results.Add ("ForeColorChanged");
+ }
+
+ protected void ImeModeChanged_Handler (object sender, EventArgs e)
+ {
+ results.Add ("ImeModeChanged");
+ }
+
+ protected void MouseDown_Handler (object sender, MouseEventArgs e)
+ {
+ results.Add ("MouseDown");
+ }
+
+ protected void MouseMove_Handler (object sender, MouseEventArgs e)
+ {
+ results.Add ("MouseMove");
+ }
+
+ protected void MouseUp_Handler (object sender, MouseEventArgs e)
+ {
+ results.Add ("MouseUp");
+ }
+
+ protected void BindingContextChanged_Handler (object sender, EventArgs e)
+ {
+ results.Add ("BindingContextChanged");
+ }
+
+ protected void Invalidated_Handler (object sender, InvalidateEventArgs e)
+ {
+ results.Add("Invalidated");
+ }
+
+ protected void Resize_Handler (object sender, EventArgs e)
+ {
+ results.Add("Resize");
+ }
+
+ protected void SizeChanged_Handler (object sender, EventArgs e)
+ {
+ results.Add("SizeChanged");
+ }
+
+ protected void Layout_Handler (object sender, LayoutEventArgs e)
+ {
+ results.Add("Layout");
+ }
+
+ protected void VisibleChanged_Handler (object sender, EventArgs e)
+ {
+ results.Add("VisibleChanged");
+ }
+
+ protected void Paint_Handler (object sender, PaintEventArgs e)
+ {
+ results.Add("Paint");
+ }
+
+ protected void Scroll_Handler (object sender, ScrollEventArgs e)
+ {
+ results.Add ("Scroll");
+ }
+
+ protected void TextChanged_Handler (object sender, EventArgs e)
+ {
+ results.Add ("TextChanged");
+ }
+
+ protected void ValueChanged_Handler (object sender, EventArgs e)
+ {
+ results.Add ("ValueChanged");
+ }
+
+ public ArrayList Results {
+ get { return results; }
+ }
+
+ public void MoveMouse ()
+ {
+ Message m;
+
+ m = new Message ();
+
+ m.Msg = (int)WndMsg.WM_NCHITTEST;
+ m.HWnd = this.Handle;
+ m.WParam = (IntPtr)0x0;
+ m.LParam = (IntPtr)0x1c604ea;
+ this.WndProc(ref m);
+
+ m.Msg = (int)WndMsg.WM_SETCURSOR;
+ m.HWnd = this.Handle;
+ m.WParam = (IntPtr)0x100448;
+ m.LParam = (IntPtr)0x2000001;
+ this.WndProc(ref m);
+
+ m.Msg = (int)WndMsg.WM_MOUSEFIRST;
+ m.HWnd = this.Handle;
+ m.WParam = (IntPtr)0x0;
+ m.LParam = (IntPtr)0x14000b;
+ this.WndProc(ref m);
+
+ m.Msg = (int)WndMsg.WM_MOUSEHOVER;
+ m.HWnd = this.Handle;
+ m.WParam = (IntPtr)0x0;
+ m.LParam = (IntPtr)0x14000b;
+ this.WndProc(ref m);
+ }
+
+ public void MouseRightDown()
+ {
+ Message m;
+
+ m = new Message();
+
+ m.Msg = (int)WndMsg.WM_RBUTTONDOWN;
+ m.HWnd = this.Handle;
+ m.WParam = (IntPtr)0x01;
+ m.LParam = (IntPtr)0x9004f;
+ this.WndProc(ref m);
+ }
+
+ public void MouseClick()
+ {
+ Message m;
+
+ m = new Message();
+
+ m.Msg = (int)WndMsg.WM_LBUTTONDOWN;
+ m.HWnd = this.Handle;
+ m.WParam = (IntPtr)0x01;
+ m.LParam = (IntPtr)0x9004f;
+ this.WndProc(ref m);
+
+ m = new Message();
+
+ m.Msg = (int)WndMsg.WM_LBUTTONUP;
+ m.HWnd = this.Handle;
+ m.WParam = (IntPtr)0x01;
+ m.LParam = (IntPtr)0x9004f;
+ this.WndProc(ref m);
+ }
+
+ public void MouseDoubleClick ()
+ {
+ MouseClick ();
+ MouseClick ();
+ }
+
+ public void MouseRightUp()
+ {
+ Message m;
+
+ m = new Message();
+
+ m.Msg = (int)WndMsg.WM_RBUTTONUP;
+ m.HWnd = this.Handle;
+ m.WParam = (IntPtr)0x01;
+ m.LParam = (IntPtr)0x9004f;
+ this.WndProc(ref m);
+ }
+
+ public void ScrollNow ()
+ {
+ Message m;
+
+ m = new Message ();
+
+ m.Msg = 8468;
+ m.HWnd = this.Handle;
+ m.WParam = (IntPtr)0x1;
+ m.LParam = (IntPtr)0x1a051a;
+ this.WndProc(ref m);
+
+ m.Msg = 233;
+ m.HWnd = this.Handle;
+ m.WParam = (IntPtr)0x1;
+ m.LParam = (IntPtr)0x12eb34;
+ this.WndProc(ref m);
+ }
+ }
+
+ [TestFixture]
+ public class HScrollBarTestEventsOrder2
+ {
+ public string [] ArrayListToString (ArrayList arrlist)
+ {
+ string [] retval = new string [arrlist.Count];
+ for (int i = 0; i < arrlist.Count; i++)
+ retval[i] = (string)arrlist[i];
+ return retval;
+ }
+
+ [Test]
+ public void CreateEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "HandleCreated",
+ "BindingContextChanged",
+ "BindingContextChanged"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar2 s = new MyScrollBar2 ();
+ myform.Controls.Add (s);
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (s.Results));
+ }
+
+ [Test]
+ public void BackColorChangedEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "HandleCreated",
+ "BindingContextChanged",
+ "BindingContextChanged",
+ "Invalidated",
+ "BackColorChanged"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar2 s = new MyScrollBar2 ();
+ myform.Controls.Add (s);
+ s.BackColor = Color.Aqua;
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (s.Results));
+ }
+
+ [Test]
+ public void BackgroundImageChangedEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "HandleCreated",
+ "BindingContextChanged",
+ "BindingContextChanged",
+ "Invalidated",
+ "BackgroundImageChanged"
+
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar2 s = new MyScrollBar2 ();
+ myform.Controls.Add (s);
+ s.BackgroundImage = Image.FromFile ("Test/System.Windows.Forms/bitmaps/a.png");
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (s.Results));
+ }
+
+ [Test, Ignore ("Need to send proper Click / DoubleClick")]
+ public void ClickEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "HandleCreated",
+ "BindingContextChanged",
+ "BindingContextChanged"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar2 s = new MyScrollBar2 ();
+ myform.Controls.Add (s);
+ s.MouseClick ();
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (s.Results));
+ }
+
+ [Test, Ignore ("Need to send proper Click / DoubleClick")]
+ public void DoubleClickEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "HandleCreated",
+ "BindingContextChanged",
+ "BindingContextChanged"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar2 s = new MyScrollBar2 ();
+ myform.Controls.Add (s);
+ s.MouseDoubleClick ();
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (s.Results));
+ }
+
+ [Test]
+ public void FontChangedEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "HandleCreated",
+ "BindingContextChanged",
+ "BindingContextChanged"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar2 s = new MyScrollBar2 ();
+ myform.Controls.Add (s);
+ FontDialog myFontDialog = new FontDialog();
+ s.Font = myFontDialog.Font;
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (s.Results));
+ }
+
+ [Test]
+ public void ForeColorChangedEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "HandleCreated",
+ "BindingContextChanged",
+ "BindingContextChanged",
+ "Invalidated",
+ "ForeColorChanged"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar2 s = new MyScrollBar2 ();
+ myform.Controls.Add (s);
+ s.ForeColor = Color.Aqua;
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (s.Results));
+ }
+
+ [Test]
+ public void ImeModeChangedChangedEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "HandleCreated",
+ "BindingContextChanged",
+ "BindingContextChanged",
+ "ImeModeChanged"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar2 s = new MyScrollBar2 ();
+ myform.Controls.Add (s);
+ s.ImeMode = ImeMode.Katakana;
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (s.Results));
+ }
+
+ [Test]
+ public void MouseDownEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "HandleCreated",
+ "BindingContextChanged",
+ "BindingContextChanged",
+ "MouseDown"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar2 s = new MyScrollBar2 ();
+ myform.Controls.Add (s);
+ s.MouseRightDown ();
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (s.Results));
+ }
+
+ [Test]
+ public void MouseMoveEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "HandleCreated",
+ "BindingContextChanged",
+ "BindingContextChanged",
+ "MouseMove"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar2 s = new MyScrollBar2 ();
+ myform.Controls.Add (s);
+ s.MoveMouse ();
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (s.Results));
+ }
+
+ [Test]
+ public void MouseUpEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "HandleCreated",
+ "BindingContextChanged",
+ "BindingContextChanged",
+ "MouseUp"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar2 s = new MyScrollBar2 ();
+ myform.Controls.Add (s);
+ s.MouseRightUp ();
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (s.Results));
+ }
+
+ [Test]
+ public void PaintEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "HandleCreated",
+ "BindingContextChanged",
+ "BindingContextChanged",
+ "Invalidated"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar2 s = new MyScrollBar2 ();
+ myform.Controls.Add (s);
+ s.Visible = true;
+ s.Refresh ();
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (s.Results));
+ }
+
+ [Test]
+ public void ScrollEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "HandleCreated",
+ "BindingContextChanged",
+ "BindingContextChanged",
+ "Scroll",
+ "ValueChanged"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar2 s = new MyScrollBar2 ();
+ myform.Controls.Add (s);
+ s.ScrollNow ();
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (s.Results));
+ }
+
+ [Test]
+ public void TextChangedEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "HandleCreated",
+ "BindingContextChanged",
+ "BindingContextChanged",
+ "TextChanged"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar2 s = new MyScrollBar2 ();
+ myform.Controls.Add (s);
+ s.Text = "foobar";
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (s.Results));
+ }
+
+ [Test]
+ public void ValueChangedEventsOrder ()
+ {
+ string[] EventsWanted = {
+ "HandleCreated",
+ "BindingContextChanged",
+ "BindingContextChanged",
+ "ValueChanged"
+ };
+ Form myform = new Form ();
+ myform.Visible = true;
+ MyScrollBar2 s = new MyScrollBar2 ();
+ myform.Controls.Add (s);
+ s.Value = 10;
+
+ Assert.AreEqual (EventsWanted, ArrayListToString (s.Results));
+ }
+ }
+
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/StatusBarTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/StatusBarTest.cs
new file mode 100644
index 00000000000..a2bfe319124
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/StatusBarTest.cs
@@ -0,0 +1,75 @@
+//
+// StatusBarTest.cs: Test cases for StatusBar.
+//
+// Author:
+// Ritvik Mayank (mritvik@novell.com)
+//
+// (C) 2005 Novell, Inc. (http://www.novell.com)
+//
+
+using System;
+using NUnit.Framework;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Runtime.Remoting;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ [Ignore ("This test has to be completly reviewed")]
+ public class StatusBarTest
+ {
+
+ [Test]
+ public void StatusBarPropertyTest ()
+ {
+ Form myform = new Form ();
+ StatusBar mysbar = new StatusBar ();
+ StatusBarPanel sbarpanel1 = new StatusBarPanel ();
+ StatusBarPanel sbarpanel2 = new StatusBarPanel ();
+ sbarpanel1.Text = "Status Quo";
+ sbarpanel2.Text = "State 2";
+ mysbar.Panels.Add (sbarpanel1);
+ mysbar.Panels.Add (sbarpanel2);
+ myform.Controls.Add (mysbar);
+
+ // B
+ Assert.AreEqual ("Control", mysbar.BackColor.Name, "#B1");
+ mysbar.BackColor = Color.Red;
+ Assert.AreEqual (212, mysbar.BackColor.R, "#B2");
+ mysbar.BackgroundImage = Image.FromFile ("M.gif");
+ Assert.AreEqual (60, mysbar.BackgroundImage.Height, "#B3");
+
+ // D
+ Assert.AreEqual (DockStyle.Bottom, mysbar.Dock, "#D1");
+
+ // F
+ Assert.AreEqual (8.25, mysbar.Font.Size, "#F1");
+ Assert.AreEqual ("ControlText", mysbar.ForeColor.Name, "#F2");
+
+ // P
+ Assert.AreEqual (sbarpanel1.Text, mysbar.Panels [0].Text , "#P1");
+
+ // S
+ Assert.AreEqual (false, mysbar.ShowPanels, "#S1");
+ Assert.AreEqual (true, mysbar.SizingGrip, "#S2");
+ Assert.AreEqual (null, mysbar.Site, "#S3");
+
+ // T
+ Assert.AreEqual ("", mysbar.Text, "#T1");
+ mysbar.Text = "MONO STATUSBAR";
+ Assert.AreEqual ("MONO STATUSBAR", mysbar.Text, "#T2");
+
+ }
+
+ [Test]
+ public void ToStringMethodTest ()
+ {
+ StatusBar mysbar = new StatusBar ();
+ mysbar.Text = "New StatusBar";
+ Assert.AreEqual ("System.Windows.Forms.StatusBar, Panels.Count: 0", mysbar.ToString (), "#T3");
+ }
+ //[MonoTODO ("Test case for DrawItem")]
+ //[MonoTODO ("Test case for PanelClick")]
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TabControlTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TabControlTest.cs
new file mode 100644
index 00000000000..ede33a91594
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TabControlTest.cs
@@ -0,0 +1,87 @@
+//
+// TabControlTest.cs: Test cases for TabControl.
+//
+// Author:
+// Ritvik Mayank (mritvik@novell.com)
+//
+// (C) 2005 Novell, Inc. (http://www.novell.com)
+//
+
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Reflection;
+using NUnit.Framework;
+
+[TestFixture]
+public class TabControlTest
+{
+ [Test]
+ public void TabControlPropertyTest ()
+ {
+ Form myForm = new Form ();
+ TabControl myTabControl = new TabControl ();
+ myTabControl.Visible = true;
+ myTabControl.Name = "Mono TabControl";
+
+ // A
+ Assert.AreEqual (TabAlignment.Top, myTabControl.Alignment, "A1");
+ Assert.AreEqual (TabAppearance.Normal, myTabControl.Appearance, "#A2");
+
+ // D
+ Assert.AreEqual (4, myTabControl.DisplayRectangle.X, "#D1");
+ Assert.AreEqual (4, myTabControl.DisplayRectangle.Y, "#D2");
+ Assert.AreEqual (192, myTabControl.DisplayRectangle.Width, "#D3");
+ Assert.AreEqual (92, myTabControl.DisplayRectangle.Height, "#D4");
+ Assert.AreEqual (TabDrawMode.Normal, myTabControl.DrawMode, "#D5");
+
+ // H
+ Assert.AreEqual (false, myTabControl.HotTrack, "#H1");
+
+ // I
+ Assert.AreEqual (null, myTabControl.ImageList, "#I1");
+ Assert.AreEqual (18, myTabControl.ItemSize.Height, "#I2");
+ Assert.AreEqual (0, myTabControl.ItemSize.Width, "#I3");
+
+ // M
+ Assert.AreEqual (false, myTabControl.Multiline, "#M1");
+
+ // P
+ Assert.AreEqual (6, myTabControl.Padding.X, "#P1");
+ Assert.AreEqual (3, myTabControl.Padding.Y, "#P1");
+
+ // R
+ Assert.AreEqual (0, myTabControl.RowCount, "#R1");
+
+ // S
+ Assert.AreEqual (-1, myTabControl.SelectedIndex, "#S1");
+ Assert.AreEqual (null, myTabControl.SelectedTab, "#S2");
+ Assert.AreEqual (false, myTabControl.ShowToolTips, "#S3");
+ Assert.AreEqual (TabSizeMode.Normal, myTabControl.SizeMode, "#S4");
+
+ // T
+ Assert.AreEqual (0, myTabControl.TabCount, "#T1");
+ Assert.AreEqual (0, myTabControl.TabPages.Count, "#T2");
+ }
+
+ [Test]
+ public void GetTabRectTest ()
+ {
+ TabControl myTabControl = new TabControl ();
+ TabPage myTabPage = new TabPage();
+ myTabControl.Controls.Add(myTabPage);
+ myTabPage.TabIndex = 0;
+ Rectangle myTabRect = new Rectangle ();
+ Assert.AreEqual (2, myTabControl.GetTabRect (0).X, "#GetT1");
+ Assert.AreEqual (2, myTabControl.GetTabRect (0).Y, "#GetT2");
+ Assert.AreEqual (42, myTabControl.GetTabRect (0).Width, "#GetT3");
+ Assert.AreEqual (18, myTabControl.GetTabRect (0).Height, "#GetT4");
+ }
+
+ [Test]
+ public void ToStringTest ()
+ {
+ TabControl myTabControl = new TabControl ();
+ Assert.AreEqual ("System.Windows.Forms.TabControl, TabPages.Count: 0", myTabControl.ToString(), "#Str1");
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TestImageIndexConverter.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TestImageIndexConverter.cs
new file mode 100644
index 00000000000..679dcef4ea2
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TestImageIndexConverter.cs
@@ -0,0 +1,157 @@
+// 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 Novell, Inc.
+//
+// Authors:
+// Ravindra (rkumar@novell.com)
+//
+//
+
+using NUnit.Framework;
+using System;
+using System.ComponentModel;
+using System.Windows.Forms;
+using System.Globalization;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ [Ignore ("This test has to be completly reviewed")]
+ public class ImageIndexConverterTest
+ {
+ ToolBarButton button;
+ PropertyDescriptorCollection pdc;
+ ImageIndexConverter ic;
+
+ public ImageIndexConverterTest ()
+ {
+ button = new ToolBarButton ();
+ pdc = TypeDescriptor.GetProperties (button);
+ ic = (ImageIndexConverter) pdc.Find ("ImageIndex", true).Converter;
+ }
+
+ [TearDown]
+ public void TearDown () { }
+
+ [SetUp]
+ public void SetUp () { }
+
+ [Test]
+ public void TestCanConvertFrom ()
+ {
+ Assert.IsFalse (ic.CanConvertFrom (typeof (byte)), "CanConvertFromByte must be false.");
+ Assert.IsFalse (ic.CanConvertFrom (typeof (char)), "CanConvertFromChar must be false.");
+ Assert.IsFalse (ic.CanConvertFrom (typeof (int)), "CanConvertFromInt must be false.");
+ Assert.IsFalse (ic.CanConvertFrom (typeof (float)), "CanConvertFromFloat must be false.");
+ Assert.IsFalse (ic.CanConvertFrom (typeof (long)), "CanConvertFromLong must be false.");
+ Assert.IsFalse (ic.CanConvertFrom (typeof (double)), "CanConvertFromDouble must be false.");
+ Assert.IsTrue (ic.CanConvertFrom (typeof (string)), "CanConvertFromString must be true.");
+ Assert.IsFalse (ic.CanConvertFrom (typeof (object)), "CanConvertFromObject must be false.");
+ }
+
+ [Test]
+ public void TestCanConvertTo ()
+ {
+ Assert.IsTrue (ic.CanConvertTo (typeof (byte)), "CanConvertToByte must be true.");
+ Assert.IsTrue (ic.CanConvertTo (typeof (char)), "CanConvertToChar must be true.");
+ Assert.IsTrue (ic.CanConvertTo (typeof (int)), "CanConvertToInt must be true.");
+ Assert.IsTrue (ic.CanConvertTo (typeof (float)), "CanConvertToFloat must be true.");
+ Assert.IsTrue (ic.CanConvertTo (typeof (long)), "CanConvertToLong must be true.");
+ Assert.IsTrue (ic.CanConvertTo (typeof (double)), "CanConvertToDouble must be true.");
+ Assert.IsTrue (ic.CanConvertTo (typeof (string)), "CanConvertToString must be true.");
+ Assert.IsFalse (ic.CanConvertTo (typeof (object)), "CanConvertToObject must be false.");
+ }
+
+ [Test]
+ public void TestConvertFrom ()
+ {
+ Assert.AreEqual (-12, (int) ic.ConvertFrom (null, CultureInfo.InvariantCulture, "-12"), "ConvertFromStr -12");
+ Assert.AreEqual (-1, (int) ic.ConvertFrom (null, CultureInfo.InvariantCulture, "-1"), "ConvertFromStr -1");
+ Assert.AreEqual (1, (int) ic.ConvertFrom (null, CultureInfo.InvariantCulture, "1"), "ConvertFromStr 1");
+
+ try {
+ ic.ConvertFrom (null, CultureInfo.InvariantCulture, 1.2f);
+ Assert.Fail ("ConvertFromFloat did not throw exception.");
+ } catch (Exception e) {
+ Assert.IsTrue (e is NotSupportedException, "ConvertFromFloat did not throw NotSupportedException.");
+ }
+
+ try {
+ ic.ConvertFrom (null, CultureInfo.InvariantCulture, 1);
+ Assert.Fail ("ConvertFromInt did not throw exception.");
+ } catch (Exception e) {
+ Assert.IsTrue (e is NotSupportedException, "ConvertFromInt did not throw NotSupportedException.");
+ }
+ }
+
+ [Test]
+ public void TestConvertTo ()
+ {
+ Assert.AreEqual ("(none)", ic.ConvertTo (null, CultureInfo.InvariantCulture, -1, typeof (string)), "ConvertInt_Minus1_ToStr");
+ Assert.AreEqual ("0", ic.ConvertTo (null, CultureInfo.InvariantCulture, 0, typeof (string)), "ConvertInt_0_ToStr");
+ Assert.AreEqual ("1", ic.ConvertTo (null, CultureInfo.InvariantCulture, 1, typeof (string)), "ConvertInt_1_ToStr");
+ Assert.AreEqual (0, ic.ConvertTo (null, CultureInfo.InvariantCulture, 0, typeof (int)), "ConvertInt_0_ToInt");
+ Assert.AreEqual ("(none)", ic.ConvertTo (null, CultureInfo.InvariantCulture, "(none)", typeof (string)), "ConvertStr_none_ToStr");
+ Assert.AreEqual ("-1", ic.ConvertTo (null, CultureInfo.InvariantCulture, "-1", typeof (string)), "ConvertStr_Minus1_ToStr");
+ Assert.AreEqual (-1, ic.ConvertTo (null, CultureInfo.InvariantCulture, -1, typeof (int)), "ConvertInt_Minus1_ToInt");
+ Assert.AreEqual (1, ic.ConvertTo (null, CultureInfo.InvariantCulture, 1, typeof (int)), "ConvertInt_1_ToInt");
+ Assert.AreEqual (-1, ic.ConvertTo (null, CultureInfo.InvariantCulture, "-1", typeof (int)), "ConvertStr_Minus1_ToInt");
+ Assert.AreEqual (0, ic.ConvertTo (null, CultureInfo.InvariantCulture, "0", typeof (int)), "ConvertStr_0_ToInt");
+ Assert.AreEqual (1, ic.ConvertTo (null, CultureInfo.InvariantCulture, "1", typeof (int)), "ConvertStr_1_ToInt");
+
+ Assert.AreEqual (2, ic.ConvertTo (null, CultureInfo.InvariantCulture, 1.5f, typeof (int)), "ConvertFloat_1_5_ToInt must return 2.");
+
+ try {
+ ic.ConvertTo (null, CultureInfo.InvariantCulture, "-1.5f", typeof (int));
+ Assert.Fail("ConvertFloatStrToInt must throw exception.");
+ } catch (Exception e) {
+ Assert.IsTrue (e is FormatException, "ConvertFloatStrToInt must throw FormatException.");
+ }
+
+ Assert.AreEqual (1.5, ic.ConvertTo (null, CultureInfo.InvariantCulture, 1.5f, typeof (float)), "ConvertFloat_1_5_ToFloat");
+ }
+
+ [Test]
+ public void TestGetCreateInstanceSupported ()
+ {
+ Assert.IsFalse (ic.GetCreateInstanceSupported (), "GetCreateInstance must return false.");
+ }
+
+ [Test]
+ public void TestGetStandardValuesSupported ()
+ {
+ Assert.IsTrue (ic.GetStandardValuesSupported (), "GetStandardValuesSupported must return true.");
+ }
+
+ [Test]
+ public void TestGetStandardValuesExclusive ()
+ {
+ Assert.IsFalse (ic.GetStandardValuesExclusive (), "GetStandardValuesExclusive must return false.");
+ }
+
+ [Test]
+ public void TestGetStandardValues ()
+ {
+ TypeConverter.StandardValuesCollection stdVals = ic.GetStandardValues (null);
+ Assert.AreEqual (1, stdVals.Count, "StandardValues count must be 1.");
+ Assert.AreEqual (-1, stdVals [0], "Standard Value count must be -1.");
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TextBoxTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TextBoxTest.cs
new file mode 100644
index 00000000000..c7b6e66aefd
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TextBoxTest.cs
@@ -0,0 +1,191 @@
+//
+// Copyright (c) 2005 Novell, Inc.
+//
+// Authors:
+// Ritvik Mayank (mritvik@novell.com)
+//
+
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Reflection;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ public class TextBoxBaseTest
+ {
+ [Test]
+ public void TextBoxBasePropertyTest ()
+ {
+ TextBox tb = new TextBox ();
+ Assert.AreEqual (false, tb.AcceptsTab, "#1a");
+ tb.Multiline = true;
+ tb.AcceptsTab = true;
+ SendKeys.SendWait ("^%");
+ Assert.AreEqual (true, tb.AcceptsTab, "#1b");
+ Assert.AreEqual (true, tb.AutoSize, "#2");
+ Assert.AreEqual ("Window", tb.BackColor.Name, "#3a");
+ tb.BackColor = Color.White;
+ Assert.AreEqual ("White", tb.BackColor.Name, "#3b");
+ Assert.AreEqual (null, tb.BackgroundImage, "#4a");
+ string gif = "M.gif";
+ tb.BackgroundImage = Image.FromFile (gif);
+ // comparing image objects fails on MS .Net so using Size property
+ Assert.AreEqual (Image.FromFile(gif, true).Size, tb.BackgroundImage.Size, "#4b");
+
+ Assert.AreEqual (BorderStyle.Fixed3D, tb.BorderStyle, "#5");
+ Assert.AreEqual (false, tb.CanUndo, "#6a");
+ tb.Paste ();
+ Assert.AreEqual (true, tb.CanUndo, "#6b");
+ tb.ClearUndo ();
+ Assert.AreEqual (false, tb.CanUndo, "#6c");
+ Assert.AreEqual ("WindowText", tb.ForeColor.Name, "#7");
+ Assert.AreEqual (true, tb.HideSelection, "#8");
+ Assert.AreEqual (1, tb.Lines.Length, "#9");
+ Assert.AreEqual (32767, tb.MaxLength, "#10");
+ Assert.AreEqual (true, tb.Modified, "#11");
+ Assert.AreEqual (true, tb.Multiline, "#12a");
+ tb.WordWrap = false;
+ Assert.AreEqual (true, tb.Multiline, "#12b");
+ tb.AcceptsReturn = true;
+ Assert.AreEqual (true, tb.Multiline, "#12c");
+ Assert.AreEqual (20, tb.PreferredHeight, "#13");
+ Assert.AreEqual (false, tb.ReadOnly, "#14");
+ Assert.AreEqual ("", tb.SelectedText, "#15");
+ tb.Text = "sample TextBox";
+ Assert.AreEqual (0, tb.SelectionLength, "#16b");
+ Assert.AreEqual (0, tb.SelectionStart, "#17");
+ tb.WordWrap = false;
+ tb.AcceptsReturn = true;
+ Assert.AreEqual ("sample TextBox", tb.Text, "#18");
+ Assert.AreEqual (14, tb.TextLength, "#19");
+ Assert.AreEqual (false, tb.WordWrap, "#20");
+ }
+
+ [Test]
+ public void TextBoxPropertyTest ()
+ {
+ TextBox tb = new TextBox ();
+ Assert.AreEqual (false, tb.AcceptsReturn, "#21");
+ Assert.AreEqual (CharacterCasing.Normal, tb.CharacterCasing, "#22");
+ Assert.AreEqual ('\0', tb.PasswordChar, "#23");
+ tb.PasswordChar = '*';
+ Assert.AreEqual ('*', tb.PasswordChar, "#23b");
+ Assert.AreEqual (ScrollBars.None, tb.ScrollBars, "#24");
+ Assert.AreEqual (-1, tb.SelectionLength, "#25");
+ Assert.AreEqual (HorizontalAlignment.Left , tb.TextAlign, "#26");
+ }
+
+ [Test]
+ public void AppendTextTest ()
+ {
+ Form f = new Form ();
+ f.Visible = true;
+ TextBox tb1 = new TextBox ();
+ tb1.Visible = true;
+ tb1.Text = "TextBox1";
+ TextBox tb2 = new TextBox ();
+ tb2.Visible = true;
+ f.Controls.Add (tb1);
+ f.Controls.Add (tb2);
+ tb2.AppendText (tb1.Text);
+ Assert.AreEqual ("TextBox1", tb2.Text, "#27");
+ }
+
+ [Test]
+ public void ClearTest ()
+ {
+ TextBox tb1 = new TextBox ();
+ tb1.Text = "TextBox1";
+ Assert.AreEqual ("TextBox1", tb1.Text, "#28a" );
+ tb1.Clear ();
+ Assert.AreEqual ("", tb1.Text, "#28b");
+ }
+
+ [Test]
+ public void ClearUndoTest ()
+ {
+ TextBox tb1 = new TextBox ();
+ tb1.Text = "TextBox1";
+ tb1.SelectionLength = 4;
+ tb1.Copy ();
+ Assert.AreEqual ("Text", tb1.SelectedText, "#29a");
+ tb1.Paste ();
+ Assert.AreEqual (true, tb1.CanUndo, "#29b");
+ tb1.ClearUndo ();
+ Assert.AreEqual (false, tb1.CanUndo, "#29c");
+ }
+
+ [Test]
+ public void CopyTest ()
+ {
+ TextBox tb1 = new TextBox ();
+ tb1.Text = "ABCDE";
+ tb1.SelectionLength = 4;
+ tb1.Copy ();
+ Assert.AreEqual ("ABCD", tb1.SelectedText, "#30");
+ }
+
+ [Test]
+ public void CutTest ()
+ {
+ TextBox tb1 = new TextBox ();
+ tb1.Text = "ABCDE";
+ tb1.SelectionLength = 4;
+ tb1.Cut ();
+ Assert.AreEqual ("E", tb1.Text, "#31");
+ }
+
+ [Test]
+ public void PasteTest ()
+ {
+ TextBox tb1 = new TextBox ();
+ tb1.Text = "ABCDE";
+ tb1.SelectionLength = 4;
+ tb1.SelectionStart = tb1.SelectionStart + tb1.SelectionLength;
+ tb1.Paste ();
+ Assert.AreEqual ("ABCDABCD", tb1.Text, "#32");
+ }
+
+ [Test]
+ public void SelectTest ()
+ {
+ TextBox tb1 = new TextBox ();
+ tb1.Text = "This is a sample test.";
+ tb1.Select (0, 4);
+ Assert.AreEqual ("This", tb1.SelectedText, "#33");
+ }
+
+ [Test]
+ public void SelectAllTest ()
+ {
+ TextBox tb1 = new TextBox ();
+ tb1.Text = "This is a sample test.";
+ tb1.SelectAll ();
+ Assert.AreEqual ("This is a sample test.", tb1.SelectedText, "#34");
+ }
+
+ [Test]
+ public void ToStringTest ()
+ {
+ TextBox tb1 = new TextBox ();
+ Assert.AreEqual ("System.Windows.Forms.TextBox, Text: ", tb1.ToString(), "#35");
+ }
+
+ [Test]
+ public void UndoTest1 ()
+ {
+ TextBox tb1 = new TextBox ();
+ tb1.Text = "ABCDE";
+ tb1.SelectionLength = 4;
+ tb1.Copy ();
+ tb1.SelectionStart = tb1.SelectionStart + tb1.SelectionLength;
+ tb1.Paste ();
+ tb1.Undo ();
+ Assert.AreEqual ("ABCDE", tb1.Text, "#36");
+ }
+
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolBarTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolBarTest.cs
new file mode 100644
index 00000000000..271671a0825
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolBarTest.cs
@@ -0,0 +1,97 @@
+//
+// ToolBarTest.cs: Test cases for ToolBar.
+//
+// Author:
+// Ritvik Mayank (mritvik@novell.com)
+//
+// (C) 2005 Novell, Inc. (http://www.novell.com)
+//
+
+using System;
+using NUnit.Framework;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Runtime.Remoting;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ [Ignore ("This test has to be completly reviewed")]
+ public class ToolBarTest
+ {
+
+ [Test]
+ public void ToolBarPropertyTest ()
+ {
+ Form myform = new Form ();
+ ToolBar myToolBar = new ToolBar ();
+ ToolBarButton myToolBarButton1 = new ToolBarButton ();
+ ToolBarButton myToolBarButton2 = new ToolBarButton ();
+ myToolBarButton1.Text = "A";
+ myToolBarButton2.Text = "B";
+ myToolBar.Buttons.Add (myToolBarButton1);
+ myToolBar.Buttons.Add (myToolBarButton2);
+ myform.Controls.Add (myToolBar);
+
+ // A
+ Assert.AreEqual (ToolBarAppearance.Normal, myToolBar.Appearance, "#A1");
+ Assert.AreEqual (true, myToolBar.AutoSize, "#A2");
+
+ // B
+ Assert.AreEqual ("Control", myToolBar.BackColor.Name, "#B1");
+ myToolBar.BackColor = Color.Red;
+ Assert.AreEqual (255, myToolBar.BackColor.R, "#B2");
+ myToolBar.BackgroundImage = Image.FromFile ("M.gif");
+ Assert.AreEqual (60, myToolBar.BackgroundImage.Height, "#B3");
+ Assert.AreEqual (BorderStyle.None, myToolBar.BorderStyle, "#B4");
+ myToolBar.BorderStyle = BorderStyle.Fixed3D;
+ Assert.AreEqual (BorderStyle.Fixed3D, myToolBar.BorderStyle, "#B5");
+ Assert.AreEqual (2, myToolBar.Buttons.Count, "#B6");
+ Assert.AreEqual ("B", myToolBar.Buttons [1].Text, "#B7");
+ Assert.AreEqual (39, myToolBar.ButtonSize.Width, "#B8");
+ Assert.AreEqual (36, myToolBar.ButtonSize.Height, "#B9");
+
+ // D
+ Assert.AreEqual (DockStyle.Top, myToolBar.Dock, "#D1");
+ Assert.AreEqual (true, myToolBar.Divider, "#D2");
+ Assert.AreEqual (true, myToolBar.DropDownArrows, "#D3");
+
+ // F
+ Assert.AreEqual ("ControlText", myToolBar.ForeColor.Name, "#F2");
+
+ // I
+ ImageList myImageList = new ImageList ();
+ myImageList.Images.Add (Image.FromFile ("M.gif"));
+ myToolBar.ImageList = myImageList;
+ Assert.AreEqual (1, myToolBar.ImageList.Images.Count, "#I1");
+ Assert.AreEqual (16, myToolBar.ImageSize.Height, "#I2");
+ Assert.AreEqual (16, myToolBar.ImageSize.Width, "#I3");
+ Assert.AreEqual (ImeMode.Disable, myToolBar.ImeMode, "#I4");
+
+ // R
+ Assert.AreEqual (RightToLeft.No, myToolBar.RightToLeft, "#R1");
+
+ // S
+ Assert.AreEqual (true, myToolBar.ShowToolTips, "#S1");
+
+ // T
+ Assert.AreEqual ("", myToolBar.Text, "#T1");
+ myToolBar.Text = "MONO TOOLBAR";
+ Assert.AreEqual ("MONO TOOLBAR", myToolBar.Text, "#T2");
+ Assert.AreEqual (ToolBarTextAlign.Underneath, myToolBar.TextAlign, "#T3");
+
+ // WXYZ
+ Assert.AreEqual (true, myToolBar.Wrappable, "#W1");
+ }
+
+ [Test]
+ public void ToStringMethodTest ()
+ {
+ ToolBar myToolBar = new ToolBar ();
+ myToolBar.Text = "New ToolBar";
+ Assert.AreEqual ("System.Windows.Forms.ToolBar, Buttons.Count: 0", myToolBar.ToString (), "#T3");
+ }
+ }
+ // [MonoTODO ("Add test for ButtonClickEvent (Visual Test)"]
+ // [MonoTODO ("Add test for ButtonDropDownEvent (Visual Test)"]
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolTipTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolTipTest.cs
new file mode 100644
index 00000000000..8287bf30ccf
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolTipTest.cs
@@ -0,0 +1,71 @@
+//
+// ToolTipTest.cs: Test cases for ToolTip.
+//
+// Author:
+// Ritvik Mayank (mritvik@novell.com)
+//
+// (C) 2005 Novell, Inc. (http://www.novell.com)
+//
+
+using System;
+using NUnit.Framework;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Runtime.Remoting;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ public class ToolTipTest
+ {
+
+ [Test]
+ public void ToolTipPropertyTest ()
+ {
+ ToolTip myToolTip = new ToolTip ();
+
+ // A
+ Assert.AreEqual (true, myToolTip.Active, "#A1");
+ Assert.AreEqual (5000, myToolTip.AutoPopDelay, "#A2");
+ Assert.AreEqual (5000, myToolTip.AutoPopDelay, "#A3");
+
+ // I
+ Assert.AreEqual (500, myToolTip.InitialDelay, "#I1");
+
+ // R
+ Assert.AreEqual (100, myToolTip.ReshowDelay, "#R1");
+
+ // S
+ Assert.AreEqual (false, myToolTip.ShowAlways, "#S1");
+ }
+
+ [Test]
+ public void GetAndSetToolTipTest ()
+ {
+ ToolTip myToolTip = new ToolTip ();
+ Button myButton = new Button ();
+ myToolTip.ShowAlways = true;
+ myToolTip.SetToolTip (myButton, "My Button");
+ string myString = myToolTip.GetToolTip (myButton);
+ Assert.AreEqual ("My Button", myString, "#Mtd1");
+ }
+
+ [Test]
+ public void RemoveToolTipTest ()
+ {
+ ToolTip myToolTip = new ToolTip ();
+ Button myButton = new Button ();
+ myToolTip.ShowAlways = true;
+ myToolTip.SetToolTip (myButton, "My Button");
+ myToolTip.RemoveAll ();
+ Assert.AreEqual ("", myToolTip.GetToolTip (myButton), "#Mtd2");
+ }
+
+ [Test]
+ public void ToStringTest ()
+ {
+ ToolTip myToolTip = new ToolTip ();
+ Assert.AreEqual ("System.Windows.Forms.ToolTip InitialDelay: 500, ShowAlways: False", myToolTip.ToString (), "#Mtd3");
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TrackBarTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TrackBarTest.cs
new file mode 100644
index 00000000000..ad36f4712ba
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TrackBarTest.cs
@@ -0,0 +1,79 @@
+//
+// TrackBarTest.cs: Test cases for TrackBar.
+//
+// Author:
+// Ritvik Mayank (mritvik@novell.com)
+//
+// (C) 2005 Novell, Inc. (http://www.novell.com)
+//
+
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Reflection;
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ public class TrackBarBaseTest
+ {
+ [Test]
+ public void TrackBarPropertyTest ()
+ {
+ TrackBar myTrackBar = new TrackBar ();
+
+ // A
+ Assert.AreEqual (true, myTrackBar.AutoSize, "#A1");
+
+ // L
+ Assert.AreEqual (5, myTrackBar.LargeChange, "#L1");
+
+ // M
+ Assert.AreEqual (10, myTrackBar.Maximum, "#M1");
+ Assert.AreEqual (0, myTrackBar.Minimum, "#M2");
+
+ // O
+ Assert.AreEqual (Orientation.Horizontal, myTrackBar.Orientation, "#O1");
+
+ // S
+ Assert.AreEqual (1, myTrackBar.SmallChange, "#S1");
+
+ // T
+ Assert.AreEqual (1, myTrackBar.TickFrequency, "#T1");
+ Assert.AreEqual (TickStyle.BottomRight, myTrackBar.TickStyle, "#T2");
+ Assert.AreEqual ("", myTrackBar.Text, "#T3");
+ myTrackBar.Text = "New TrackBar";
+ Assert.AreEqual ("New TrackBar", myTrackBar.Text, "#T4");
+
+ // V
+ Assert.AreEqual (0, myTrackBar.Value, "#V1");
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentOutOfRangeException))]
+ public void LargeChangeTest ()
+ {
+ TrackBar myTrackBar = new TrackBar ();
+ myTrackBar.LargeChange = -1;
+ }
+
+ [Test]
+ public void SetRangeTest ()
+ {
+ TrackBar myTrackBar = new TrackBar ();
+ myTrackBar.SetRange (2,9);
+ Assert.AreEqual (9, myTrackBar.Maximum, "#setM1");
+ Assert.AreEqual (2, myTrackBar.Minimum, "#setM2");
+ }
+
+ [Test]
+ public void ToStringMethodTest ()
+ {
+ TrackBar myTrackBar = new TrackBar ();
+ myTrackBar.Text = "New TrackBar";
+ Assert.AreEqual ("System.Windows.Forms.TrackBar, Minimum: 0, Maximum: 10, Value: 0", myTrackBar.ToString (), "#T3");
+ }
+ }
+}
+
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TreeNodeTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TreeNodeTest.cs
new file mode 100644
index 00000000000..d269db9c720
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TreeNodeTest.cs
@@ -0,0 +1,162 @@
+using System;
+using NUnit.Framework;
+using System.Windows.Forms;
+using SystemDrawingNamespace = System.Drawing;
+
+namespace MonoTests.System.Windows.Forms {
+
+
+ [TestFixture]
+ public class TreeNodeTest {
+
+ [Test]
+ public void EmptyCtorTest ()
+ {
+ TreeNode tn = new TreeNode ();
+ Assert.AreEqual ("", tn.Text, "#1");
+ Assert.AreEqual (0, tn.Nodes.Count, "#2");
+ Assert.AreEqual (-1, tn.ImageIndex, "#3");
+ Assert.AreEqual (-1, tn.SelectedImageIndex, "#4");
+
+ // Set simple properties
+ tn.Text = null;
+ Assert.AreEqual ("", tn.Text, "#5");
+ tn.ImageIndex = 67;
+ Assert.AreEqual (67, tn.ImageIndex, "#6");
+ tn.SelectedImageIndex = 99;
+ Assert.AreEqual (99, tn.SelectedImageIndex, "#7");
+ }
+
+ [Test]
+ public void CtorTest () {
+ TreeNode tn = new TreeNode ("label1");
+
+ Assert.AreEqual ("label1", tn.Text);
+ Assert.AreEqual (0, tn.Nodes.Count);
+ Assert.AreEqual (-1, tn.ImageIndex, "II");
+ Assert.AreEqual (-1, tn.SelectedImageIndex, "SI");
+
+ Assert.IsNull (tn.FirstNode);
+ Assert.IsNull (tn.LastNode);
+ Assert.AreEqual ("", new TreeNode (null).Text);
+ }
+
+ [Test]
+ public void CtorTest2 ()
+ {
+ TreeNode tn = new TreeNode ("a1", new TreeNode[] { new TreeNode ("aa1"), new TreeNode ("aa2") } );
+
+ Assert.AreEqual ("a1", tn.Text);
+ Assert.AreEqual (-1, tn.ImageIndex, "II");
+ Assert.AreEqual (-1, tn.SelectedImageIndex, "SI");
+
+ Assert.AreEqual ("aa1", tn.Nodes [0].Text, "#1");
+ Assert.AreEqual ("aa2", tn.Nodes [1].Text, "#2");
+ Assert.AreSame (tn.FirstNode, tn.Nodes [0], "#3");
+ Assert.AreSame (tn.LastNode, tn.Nodes [1], "#4");
+ }
+
+ [Test]
+ public void CtorTest3 ()
+ {
+ TreeNode tn = new TreeNode ("a", 5, 9);
+
+ Assert.AreEqual ("a", tn.Text);
+ Assert.IsNotNull (tn.Nodes);
+ Assert.AreEqual (5, tn.ImageIndex);
+ Assert.AreEqual (9, tn.SelectedImageIndex);
+ Assert.AreEqual ("", new TreeNode (null, 0, 0).Text);
+ }
+
+ [Test, ExpectedException (typeof (ArgumentNullException))]
+ public void CtorException1 ()
+ {
+ new TreeNode ("", 1, 1, null);
+ }
+
+ [Test, ExpectedException (typeof (ArgumentNullException))]
+ public void CtorException2 () {
+ new TreeNode ("tt", null);
+ }
+
+ [Test]
+ public void Traverse ()
+ {
+ TreeNode tn_1 = new TreeNode ("1");
+ TreeNode tn_2 = new TreeNode ("2");
+ TreeNode tn_3 = new TreeNode ("3");
+ TreeNode tn = new TreeNode ("lev1");
+ tn.Nodes.Add (tn_1);
+ Assert.AreSame (tn, tn_1.Parent, "#1");
+ Assert.IsNull (tn_1.NextNode, "#2");
+ Assert.AreEqual (0, tn_1.Parent.Index, "#3");
+ tn.Nodes.Add (tn_2);
+ Assert.IsNull (tn_1.NextNode.NextNode, "#33");
+ tn.Nodes.Add (tn_3);
+ Assert.AreEqual (2, tn_3.Index, "#4");
+
+ Assert.AreEqual (3, tn.Nodes.Count, "#5");
+ Assert.AreSame (tn_2, tn_2.NextNode.PrevNode, "#6");
+ Assert.IsNull (tn_1.PrevNode, "#7");
+ }
+
+ [Test, ExpectedException (typeof (Exception))]
+ public void FullPathException ()
+ {
+ string s = new TreeNode ("").FullPath;
+ // Prevent CS0219, will never write anything
+ // due to previous statement throwing Exception
+ Console.WriteLine(s);
+ }
+
+ [Test]
+ public void FullPathTest ()
+ {
+ TreeNode tn_1 = new TreeNode ("A");
+ TreeNode tn_2 = new TreeNode ("B");
+ tn_2.Nodes.Add (tn_1);
+
+ TreeView tv = new TreeView ();
+ tv.Nodes.Add (tn_1);
+ tv.Nodes [0].Nodes.Add (tn_2);
+
+ Assert.AreEqual ("A", tn_1.FullPath, "#1");
+ Assert.AreEqual ("A", tv.Nodes[0].FullPath, "#2");
+ Assert.AreEqual (@"A\B", tn_2.FullPath, "#3");
+ tv.PathSeparator = "_separator_";
+ Assert.AreEqual ("A_separator_B", tn_2.FullPath, "#4");
+ }
+
+ [Test]
+ public void CloneTest ()
+ {
+ TreeNode orig = new TreeNode ("text", 2, 3, new TreeNode [] { new TreeNode ("child", 22, 33) });
+ orig.Tag = FlatStyle.Flat;
+ orig.Checked = true;
+ orig.BackColor = SystemDrawingNamespace.Color.AliceBlue;
+ orig.ForeColor = SystemDrawingNamespace.Color.Beige;
+
+ TreeNode clone = (TreeNode)orig.Clone ();
+ Assert.AreEqual ("text", clone.Text, "#1");
+ Assert.AreEqual (2, clone.ImageIndex, "#2");
+ Assert.AreEqual (3, clone.SelectedImageIndex, "#3");
+ Assert.AreEqual (1, clone.Nodes.Count, "#4");
+ Assert.AreEqual (FlatStyle.Flat, clone.Tag, "#5");
+ Assert.IsTrue (clone.Checked, "#6");
+ Assert.AreEqual ("child", clone.Nodes [0].Text, "#10");
+ Assert.AreEqual (22, clone.Nodes [0].ImageIndex, "#11");
+ Assert.AreEqual (SystemDrawingNamespace.Color.AliceBlue, clone.BackColor, "#12");
+ Assert.AreEqual (SystemDrawingNamespace.Color.Beige, clone.ForeColor, "#13");
+ }
+
+ [Test]
+ public void SingleNodeIndexTest ()
+ {
+ TreeNode tn_1 = new TreeNode ("A");
+ Assert.AreEqual (0, tn_1.Index, "#1");
+ TreeView tv = new TreeView ();
+ tv.Nodes.Add (tn_1);
+ Assert.AreEqual (0, tn_1.Index, "#2");
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TreeViewTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TreeViewTest.cs
new file mode 100644
index 00000000000..226fccf1774
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TreeViewTest.cs
@@ -0,0 +1,34 @@
+using System;
+using NUnit.Framework;
+using System.Windows.Forms;
+using System.Drawing;
+
+[TestFixture]
+public class TreeViewTest {
+
+ [Test]
+ [Ignore ("This test has to be completly reviewed")]
+ public void DefaultCtor ()
+ {
+ TreeView tv = new TreeView ();
+ Assert.AreEqual (121, tv.Width, "#1");
+ Assert.AreEqual (97, tv.Height, "#2");
+ //Assert.AreEqual (BorderStyle.Fixed3D, tv.BorderStyle, "#3");
+
+ // Windows specific
+ Assert.AreEqual (SystemColors.Window, tv.BackColor);
+ }
+
+ [Test]
+ public void SimpleShowTest ()
+ {
+ Form f = new Form ();
+ TreeView tv = new TreeView ();
+ //tv.BorderStyle = BorderStyle.FixedSingle;
+ tv.Location = new Point (20, 20);
+ //tv.Text = "adssssss";
+
+ f.Controls.Add (tv);
+ f.Show ();
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/bitmaps/a.png b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/bitmaps/a.png
new file mode 100644
index 00000000000..c3eb05e9767
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/bitmaps/a.png
Binary files differ
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/tests-ms.sh b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/tests-ms.sh
new file mode 100755
index 00000000000..a3fe29033b4
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/tests-ms.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+if [ $# -eq 0 ]; then
+ echo "You should give a list of test names such as: "
+ echo "$0 System.Windows.Forms.ListViewItemTest"
+ echo "or"
+ echo "$0 all"
+ exit 1
+fi
+
+export MSNet=Yes
+cp ../../System.Windows.Forms_test_default.dll .
+topdir=../../../..
+NUNITCONSOLE=$topdir/class/lib/default/nunit-console.exe
+MONO_PATH=$topdir/nunit20:$topdir/class/lib:.
+
+for i in $@; do
+ if [ "$i" = "all" ]; then
+ fixture=""
+ else
+ fixture="/fixture:MonoTests.${i}"
+ fi
+ MONO_PATH=$MONO_PATH \
+ ${NUNITCONSOLE} System.Windows.Forms_test_default.dll $fixture
+done
+
+
+
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/tests.sh b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/tests.sh
new file mode 100755
index 00000000000..d440326d899
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/tests.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+if [ $# -eq 0 ]; then
+ echo "You should give a list of test names such as: "
+ echo "$0 System.Windows.Forms.ListViewItemTest"
+ echo "or"
+ echo "$0 all"
+ exit 1
+fi
+
+cp ../../System.Windows.Forms_test_default.dll .
+
+topdir=../../../..
+NUNITCONSOLE=$topdir/class/lib/default/nunit-console.exe
+MONO_PATH=$topdir/nunit20:$topdir/class/lib/default:.
+
+
+for i in $@; do
+ if [ "$i" = "all" ]; then
+ fixture=""
+ else
+ fixture="/fixture:MonoTests.${i}"
+ fi
+ MONO_PATH=$MONO_PATH \
+ mono --debug ${NUNITCONSOLE} System.Windows.Forms_test_default.dll $fixture
+done
+
+
+
diff --git a/mcs/class/Managed.Windows.Forms/Test/resources/a.cur b/mcs/class/Managed.Windows.Forms/Test/resources/a.cur
new file mode 100644
index 00000000000..f82e40ac462
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/Test/resources/a.cur
Binary files differ
diff --git a/mcs/class/Managed.Windows.Forms/build-csproj b/mcs/class/Managed.Windows.Forms/build-csproj
new file mode 100755
index 00000000000..63fc8be1b8e
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/build-csproj
@@ -0,0 +1,215 @@
+#!/bin/sh
+#
+# I got tired of editing the SWF.csproj
+# This script will generated it from our System.Windows.Forms.dll.sources
+#
+#
+
+tr=tr
+OutFile=SWF.csproj
+Source=System.Windows.Forms.dll.sources
+Resource=System.Windows.Forms.dll.resources
+
+SWFhead()
+{
+cat << EOT
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.10.3077"
+ SchemaVersion = "2.0"
+ ProjectGuid = "{5E6430B2-6B9F-4E76-802E-20207EF80391}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "System.Windows.Forms"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ PreBuildEvent = ""
+ PostBuildEvent = ""
+ RootNamespace = ""
+ RunPostBuildEvent = "OnBuildSuccess"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "true"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "NET_1_1"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "1"
+ />
+ <Config
+ Name = "Debug 2.0"
+ AllowUnsafeBlocks = "true"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "NET_2_0"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "1"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "true"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "NET_1_1"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "false"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "1"
+ />
+ <Config
+ Name = "Release 2.0"
+ AllowUnsafeBlocks = "true"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "NET_2_0"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "false"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "1"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "Accessibility"
+ AssemblyName = "Accessibility"
+ HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Accessibility.dll"
+ />
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
+ />
+ <Reference
+ Name = "System.Drawing"
+ AssemblyName = "System.Drawing"
+ HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Drawing.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.XML"
+ HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+EOT
+}
+
+SWFfilelist()
+{
+cat $Source | while read SRC; do
+# Don't do AssemblyInfo, it's got signing requests and such that we don't want
+if [ "x$SRC" != "xAssembly/AssemblyInfo.cs" ] ; then
+SRC=`echo $SRC | $tr '/' '\\\\'`
+cat << EOT
+ <File
+ RelPath = "$SRC"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+EOT
+fi
+done
+}
+
+SWFresourcelist()
+{
+cat $Resource | while read SRC; do
+# Don't do AssemblyInfo, it's got signing requests and such that we don't want
+if [ "x$SRC" != "xAssembly/AssemblyInfo.cs" ] ; then
+SRC=`echo $SRC | $tr '/' '\\\\'`
+SRC=`echo $SRC | $tr '/' '\\\\' | sed 's/-resource://' | awk -F , '{print " RelPath = \"" $1 "\"\n CustomToolNameSpace = \"" $2 "\""}' | fgrep -v \"\"`
+
+cat << EOT
+ <File
+$SRC
+ BuildAction = "EmbeddedResource"
+ />
+EOT
+fi
+done
+}
+
+SWFtail()
+{
+cat << EOT
+ <File
+ RelPath = "Consts.cs"
+ Link = "../../build/common/Consts.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MonoTODOAttribute.cs"
+ Link = "../../build/common/MonoTODOAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+EOT
+}
+
+SWFhead > $OutFile
+SWFfilelist >> $OutFile
+SWFresourcelist >> $OutFile
+SWFtail >> $OutFile
+
diff --git a/mcs/class/Managed.Windows.Forms/resources/ChangeLog b/mcs/class/Managed.Windows.Forms/resources/ChangeLog
new file mode 100644
index 00000000000..0f0347d4629
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/resources/ChangeLog
@@ -0,0 +1,45 @@
+2005-11-01 Peter Dennis Bartok <pbartok@novell.com>
+
+ * DnDLink.cur: Added
+
+2005-10-31 Peter Dennis Bartok <pbartok@novell.com>
+
+ * DnDNo.cur: Added
+ * DnDCopy.cur: Added
+ * DnDMove.cur: Added
+
+2005-10-13 Peter Dennis Bartok <pbartok@novell.com>
+
+ * SplitterNS.cur: Added
+ * SplitterWE.cur: Added
+
+2005-10-06 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.resx: Created and added mono default icon
+ * System.Windows.Forms.resources.prebuilt: Updated
+
+2005-09-07 Jonathan Chambers <jonathan.chambers@ansys.com>
+
+ * System.Windows.Forms.resources.prebuilt: Update
+ * System.Windows.Forms.resx: Added images and strings for PropertyGrid
+ toolbar buttons.
+
+2005-05-05 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.resx, System.Windows.Forms.en.resx,
+ System.Windows.Forms.de.resx: Added errorProvider icon
+ * System.Windows.Forms.resources.prebuilt,
+ System.Windows.Forms.en.resources.prebuilt,
+ System.Windows.Forms.de.resources.prebuilt: Updated
+
+2005-03-16 Alexander Olk <xenomorph2@onlinehome.de>
+
+ * System.Windows.Forms.resx, System.Windows.Forms.en.resx,
+ System.Windows.Forms.de.resx:
+ - Corrected one FileDialog bitmap
+
+2005-02-13 Peter Bartok <pbartok@novell.com>
+
+ * System.Windows.Forms.resx: Added
+ * System.Windows.Forms.en.resx: Added
+ * System.Windows.Forms.de.resx: Added
diff --git a/mcs/class/Managed.Windows.Forms/resources/DnDCopy.cur b/mcs/class/Managed.Windows.Forms/resources/DnDCopy.cur
new file mode 100644
index 00000000000..99b5574f801
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/resources/DnDCopy.cur
Binary files differ
diff --git a/mcs/class/Managed.Windows.Forms/resources/DnDLink.cur b/mcs/class/Managed.Windows.Forms/resources/DnDLink.cur
new file mode 100644
index 00000000000..3ba787aa39d
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/resources/DnDLink.cur
Binary files differ
diff --git a/mcs/class/Managed.Windows.Forms/resources/DnDMove.cur b/mcs/class/Managed.Windows.Forms/resources/DnDMove.cur
new file mode 100644
index 00000000000..0150e0e5236
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/resources/DnDMove.cur
Binary files differ
diff --git a/mcs/class/Managed.Windows.Forms/resources/DnDNo.cur b/mcs/class/Managed.Windows.Forms/resources/DnDNo.cur
new file mode 100644
index 00000000000..b002e96b36d
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/resources/DnDNo.cur
Binary files differ
diff --git a/mcs/class/Managed.Windows.Forms/resources/SplitterNS.cur b/mcs/class/Managed.Windows.Forms/resources/SplitterNS.cur
new file mode 100644
index 00000000000..2f32171d33c
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/resources/SplitterNS.cur
Binary files differ
diff --git a/mcs/class/Managed.Windows.Forms/resources/SplitterWE.cur b/mcs/class/Managed.Windows.Forms/resources/SplitterWE.cur
new file mode 100644
index 00000000000..64fa72d497c
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/resources/SplitterWE.cur
Binary files differ
diff --git a/mcs/class/Managed.Windows.Forms/resources/System.Windows.Forms.de.resources.prebuilt b/mcs/class/Managed.Windows.Forms/resources/System.Windows.Forms.de.resources.prebuilt
new file mode 100644
index 00000000000..03e50c81c30
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/resources/System.Windows.Forms.de.resources.prebuilt
Binary files differ
diff --git a/mcs/class/Managed.Windows.Forms/resources/System.Windows.Forms.de.resx b/mcs/class/Managed.Windows.Forms/resources/System.Windows.Forms.de.resx
new file mode 100644
index 00000000000..75bee5ab207
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/resources/System.Windows.Forms.de.resx
@@ -0,0 +1,831 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 1.3
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">1.3</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1">this is my long string</data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ [base64 mime encoded serialized .NET Framework object]
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ [base64 mime encoded string representing a byte array form of the .NET Framework object]
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used forserialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>1.3</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="last_open" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAADftJREFUaEPVmntY
+ 1FUax0efbbtaarr12D5bu6WbopZ5SVs1a3fV2rQsUcu8FJqlKCZkF9t1H7VUFBQVCXVFzTIIROU+DJoK
+ iCggKgjC3JgZ5sZlbiAzot993zMMgjLjpT/W5Xk+npnf5Zz3e8573vOeM3YaGG0ddv89nX7fWSLpJKG/
+ zuJf91+nTq3XWq/SffdntHtOfGm91/bdlnrb1t2J/q4CpvT3usiu1XKHn+YkNRwuNV2GN0qMLvjivNEJ
+ X5wzONERX2VZry5IdWwCIPk1SIIyGjKuXr0Kb1y5cgU3o7m5Gd64fPkyOiK+xAGZvOkKiVj1fyuAheVr
+ m5oDUx1L71TE/3QEWICLKDU2XZmb5PjoTkTcVAC71q9xIXYtby7kEWBpdOKIvKF59kGH/+2KuGsElOjt
+ iCu2Xp6e6Bh3OyLuCgHWRop0JEBWVoetefUu/3j78FsVcXcIuORCqYEElNfh+1NGfHu4pum1H+39bkXE
+ XSUgq0VAaFYVlqaaGl+KsT15MxF3rYCQAwp8ctBo/9Nma09fIv5nAgp1jQjKuCxYlOHCwnQXAltYQOWC
+ NDcTfrLuvSsFcAiVKZoFmfLLXnk3wb7zjgV44r+vVMFbnG8b+10uF3zhdDrREY2XmvDefvsOnwIWptmk
+ 3vIVz/U7NcBjVFNTE3xx6dIlNDY23oC9oRHT99u3+xaQapV664HbMcCbEWxYQ0ODTxwOBzrCYm/AjET7
+ Np8CApPrpdw4s7vYgJAs1TVkSoTcAsGZCtyMT9MrMG1DHEbODsbgie/Db9RYPP3cMPiNHIshE6Zj1Owl
+ eC98H/YUqGGz2QS1FjtmHrBH+xQw/1BNpsPRQD3gHbvdAV/YbHZqsGNyc09gypSpeLT7oxj8wmAsXvwp
+ wsPC8eOP+5CeniHK8PANWLIkGEOGDEX3bt0xebI/jh49BlOdDbNuKuBgTaYvA/ie1WrzicViRX19ewoK
+ ivDOO5Px5B+exLrQdSgpKYXRaLoppaUXhKCnnvojJkx8C6+vztzncwQ+OWDOtFhsYOKKqxF6XIV1zDEF
+ wo4rEZ5NcHlcgQ1UbqTvETkqQolNxOZcFSJPEFRupTKK+GD5BvTo+RhWrFyFqiqNMFqvNyA5OQVBixbj
+ r6/+Fc8/9zx69+6N5wY+h1fGvIp5H32M+PgE6HTV4nmtVofVq9egW/eernt/e6/XVFvy8X6jrLbWAqZS
+ V4PzVTU4pzbjLFGsMhFmFClNKFQaUaAw4jRxisiXG3CSyKs0ILfCgJyLBhy9oMXUmXPRt28/nDyZ39rb
+ UVFR8OvXHwEfBiAxMREqlUpEnK+//lpEJ7VajaSkJMz/ZD4G9B+AVatWCcEs5PTpAvR+prf9kYcf2UXb
+ 8d9cPxqSefH6LLO5Hr4wmergC4OhBsycOXMxbux4KJUq0fiZM8UYP+41zJo5i9433bAW8ES9PkTztc9C
+ luKlES8hOztH1KNWV2Hs2HENJOL7GwR89LM+y2isowfroNbVQqGtcaMxQ0WlmkZFrTNDrTWjikptdQ10
+ AjOqqdTra6g0Y+WKbzBo0AvUu2rRaHh4uHCTtLQ0n4tYR2vMkSNHkJCQgBHDR4hRqq7WC1ccOGCg/YH7
+ H1jWVoRkbmx1FhvCbCP//jylDEuJz5LLEJx0AcHJF7DkUCmW0OdPqVx86AKCDpZiEbHwQCkCiSnr4/G7
+ x5/A+XPnhfHr1q2HP0WS+vr62zbeYrHgiSeeQGlpqQjtn1LUWrp0qaiXJ3iPR3vYyZVGeERI5v6kO6yl
+ 3vWFRmOCL14cNgJRUd+JRjhsDnp+EAUFy20bz6MREBCAwMDA1nd5joweNRqpqWmi/pidMXi4y8PnSUQn
+ FiGZs093WK1mP/OOSmUk1+iY6O9iyOAXaA4YRQQZNnQY8vLy7sj42NhY9O/fXyxibV3r4sWLwh0VCqUQ
+ QZHLSgLeFQICftAeVlKEYWRnNEg6VYVk5nQVUgsILok0+pxOZBDSwipkFmqQWaTBsBGjsWf3HlFxMC1G
+ Kyl03ix34vtOpwd3IieXy9GrVy8UFRWJe9fXsWPHDsx4f4ZoJzY2Dt26disSAj78XnNELjdSBUbspTi/
+ RVaJzbIKbCIiiI2ZFQiXXkRYRjnCqFyfXo7QtHKsTS3Hv2Lz0KVLVzHBuHe4l3jIfWeeLnrGiaZLTvJx
+ Ll2UJ7ndZEP4xpZrdJ2euV7Iy6NfRn7+KTHSDz34UCONQk/JB3s0Ry5SDPdFebkeHbF69Ua89eYk0Svb
+ tm3HV19+5dV4NoaNYqMvkdGNtJFvaCAcLiz/1wqMH/+6+MzX+B4/wyKdbYRERkZixYoVor23J73d0LlT
+ 5zmS2bs0v5SVGeCLCxf06Ig5AQsofK4UFU6bOs2r77caT+c/wnAy1G5zwmZxIkuWTVHn96is0MJa777G
+ 9/gZIYTeYeE8qlqtFjwK3N7ataHo+kjXbZJZMZpfSksNFKIM+OGoEttlcuyQKbAzy02MQI5dVO6mUnBY
+ jj3EqL9NxE6KClzh8BeHdxg2Pca7XcVtuJWMLDmvwI7teymdeBY/x6agxuRCrdmFuloXLPUuIcRhJ8H0
+ DovwuFN/v/6iPZ53PXv0lEpm7tQcPXdOD+bHI0r8J5MEENuJbVI5ojPk+C69kpBja1olIoktqRXYQuWz
+ A4aKjJIrpEWmQ/cRbsM932K8hXq5WmfDM0/3xqwZs/GP197CsV/O4vTJSpSc1UEpp1Xf0IR6EsIjwoL5
+ XY8Azp24Pak0kzPcEsmMHVVHi4v18MWZM3pKC25k8ODhrQIoX0FISIjIcTyTWPQ++zy5AvcmG1RX40JB
+ fjlG/WW0iDh+/QYiInw31nwTheX/DMMXS1ciaOEXFO9j3SLESNC5ES1iXD/nSpwnZWRIeVE7L5mxXXOs
+ qMhAlXmnsFAPpqCgug16vDZ+EnbF7BI9MmTwELHrahuBeAJy77M/26xO1Ne5YKbfG/QaJ+bPC4Zf34GI
+ 2Z6M8nNOQUWpE8oK8nWlCwatEzX0rIXesdO7TU3u0Opxod27dqMHu9D70Zpjp08bKOsz4D/pKmxJkiMy
+ WYGodpAb0ffoZHKrFAW2p7p53X8evv12tRAw4Y0JYvlv1/tCAPe+2x3Yx43VTuhULigvuoTRJYUunD1J
+ 5NPxYoETF887oWIRaidMeveI8SjwaPLqzh3F7a1ZsxaU3G2TTP9Oeyw/30Dx1YCYNMrpk5SIJLYwhyjf
+ P6hAxAE5ocDGRDk2EOGJlYQc7y5ahzcmvCUq5Nw9LCysQwF2ch9LHfUoTVQ99WyVwoVK6m02uDDXhbwj
+ Tpz8xYkzeeQqZ2hRK3NBw6Ogc4vmCc0dExcXJ3Ijbm/SpLcdtA58IHlvq/Z4Xp6RQqB3TpwwgMnNbU96
+ ehn1QleR7p49ew5jXh7TsQCaiK0CyH2q5C5UlLh7/3S2C9lSJ3JlbjGlhSTggrOdgAaHW8BU2ppy0ODN
+ zoMPPMgLWQ/Ju5Ha4zk5RvgiO9tAuXnHDH9xjEiwuFfenPim2LB4UgV3BHJPYI4+3Jvs29y78jKn6G12
+ nwISUZBDbnTKhbKzTijKXcLN2N34Pa4vOzsbI/8yUrTD++hu3boXilRi2hZd9vHjJjBrYpVYG6tCKJXr
+ 4mhbSaz/maAyLI62lfQ5PF6FDS1EUBnwWTT6USThZI4jBe+8eMHhRt0rr3vhYjdgf2a/1pF/qytpFMiN
+ yordrlRCPc/Gc+/zCFVXkWByOfZ9Tss5TeE0ggX49fOztSZz0zZXZx89aqZTADMiE6oQuV+DzVRuiid+
+ dpcbqQyPVSOshfVUrv9JjdCfSCyVffxeRETEptbeGT9ufMsouFOHa2sALVZklJF8myepmgxV0GTm0WB4
+ YvP8YIFGEtpIEUyk2LQV9dQfHb3tapeHulxLp6dG6HMOHzbDTU2HZGWZ4YuoKBkef6yX2EJyD334QQBC
+ Q0NF710/ChwWeTKze1TTfNCpKeKQu7DLsOEcYuvI1Xjk2HhOsSdOmCjq5Q0TLV7tNzRTNhpyZLJa+CIz
+ swa+kErNCApaR0M7QGSlvK2cTEcqDGeOIoHjHIjCKbsSpwrsThznTfQ7sonEsGvxd54vbDi7TeCCQIz9
+ +1jK08pFnXRYYL/vvvuD220p/cONOVJpHS3N7cnIqKPVzk16eq1P0tJqae9bC3//QIpEr1JqrhA9tnfv
+ D2Ll5MXOSQsRC2mbD/EEFSutjefJtXyHTyjY5z1uw4cEY8a84qCd2A3npJLJYabctLR6MsA7qan1tKXz
+ TkpKHZikpBpM8Q/C00/3oaiWK0RUVsoxc8ZMcRa0Z8+e1tMJdi+ZTNYadmtra4W7vPP2O3jjH2+IsMzv
+ 5+WdxFNPPmUn46No4na+4VRi8vqa3JQUKxngneRkCx1KeScpqZ6Mt7Ty+ecxlCk+jmXL/tl6SnHs2HH6
+ vkycNLxApxejRo5C32f7ivSY99BD6VgxJDhEJGmeo5Tly/+Nrt0edd7zm3tmeDudk0z9wbpsXrwt8eN4
+ 2wHi4CdMgu0QMz/BlsQsSLAlB+63pbSQunC/LXVhoi2NyvRFTKItPchNxuJEm3TxAZv0/Y0nsvsMHWvq
+ 0fPx5pUrv7laXHxWGOZBoVCIw6+Kisp218/RRF397Rr87rFeV/487O9107+MmOnzaPFmP6L92vs07ANp
+ 47GPVk4LZazWBQsCmzmP4cXv4MFDYn7w98DAhc19+vzZQuc+Vno+lt4bdCtt/6r/KXIrDXie4WMQYght
+ A0Mojm+lcJhC5NNpdCp9j6Lrn9H9YZ7jklut+7/JKVwBwotNkwAAAABJRU5ErkJggg==
+</value>
+ </data>
+ <data name="Red">
+ <value>Rot</value>
+ </data>
+ <data name="folder_with_paper" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAALEwAA
+ CxMBAJqcGAAAD0tJREFUaEPFmQlUVFeaxx/IUguKRo12MkmnuxM98cwkJmPapMdsRpOMY5bOMn1cMsak
+ R4OmoygtoJSC7IqyFzsoigIqKEsha0GxF1XUvldRFEUJKGuxC9Q330NRcAFcMqlz/tz77rvvvf/vu+t7
+ WBG/wu8/N26k4m3fHhgYeHkQ/3R3d6vUSqUSywZQll/hkU/vlv9w3kdlHPVezoxP2Oty0DN0j6v3cXdv
+ 5h6v46f/6h92/hM3r7B1+9x93nFjeP7p6T31Kd1pv5u7raev3wpmXPwhoVLVfIlVdvNMZhWcyuRbQhIK
+ bgZEZpo9/KKvM3xOcv1PhHh5+vrORVk/pcc/+W0Q4K3UjMwglaHJ1Dk4NNLc2WPJ4aggIEkKgam9lqPx
+ 6rGUXPEoX6kfUjUZFYHBwQzUs0/+5KdwBzcG44M8NjsSjWk6BgZHe8csYB4dA1VzJ5wv0MAvx4VwmqWB
+ InUraMwD0D4wOCDV6eSJKSm/eAcG/uEpWHi8W7gxjtA9vLw/YBWXxqsajbqO/qGx3lGACXUOjoBY3wGJ
+ uUpIl5sg63oPcPuH4drwKHQMDI/WiiRV6Veydx4+6vv7x3Pw+FdZMY74zA9jxr2fkp55Xtfc1tbZP2Ix
+ DwNMVjcetwyOgbjvJpxp74OEG2bI6OwHXu8wtA9ZoLVnYLSaLy48nZK+3fXgkUWPb+cRrlyyZCmx5bvt
+ 9n6BJ9cnp1zMacUwd/VboHsApqgLj1uwvBYpIlt7IPl6H5y+3gtxbWZIwbzSPAo38Hzzjd6RGr6s2NM7
+ 4Nt9LgdtUFaPYOfRqyKAfcDx0E2sgnKWsaXX3NFjsXSaATp7p8rYMwbF7UOQ1NoLZ1Hx18zjSmwxw6lW
+ TFHKrhFo6x61NDZ3d1VzZUVo/hOU46O7msUVb7+9Zg7KISw88Uc2R8DSNnS0t3cBdJDqvqsbeKzvGANW
+ 6wCcudYLSaZeSEDFN99OTWaIQ53Gc+ev9YGo/Sa03BgZ0zV23Shm87Ijmac+ddrl/MwsLM2+yrp1G2wP
+ HvR9MSrq7LaiYj5bo+3sutEOcK9a2i2guj4KLNMgJDaZIRaVaETz9yjBaIYkLIvB85dN/SBqG4GWtpEx
+ taa972p+bWJsXOrH27btfHot8e033z3j7x/x+eXMUpFe3zfQ1gZA6vokmdosIGtB88ZBCNX3QGIj9ncU
+ sxG7jAEHcBMaNmArYD4JFYnlZ5v6IBrTi8Z+ULWOjt9PIr7WyWJVM48FRq/55uutFNTsI/2wmruc/rk8
+ MiKFIRG3DRubRiwt13CAolonSdI8Chca+8FP1wXp+j4Ib+iB6AbsKo1oVo/9H9NkVKweobA8HeuebOiG
+ U3icSJ5HTdxPwG++fjmDE4PmX0HNfrX+5BNiqZMT8QGDQfzv8ePEfiaT8E5KIiLOnLG9dO7cH4QX0reP
+ iOqlFkPDMJiMANdui9c4Aucb+oGpw2jr+iBI0wNxWow4HkfoeiAey2IbeiFKh90JlYD5EG03JDcgHNaJ
+ QqVgPhHPKZrGoKnh5oiAZ9KmnStkbvvO6aVPP/7Cbtpm2LaNsEGtuHKF8CgvJ7K5XIJbV0eIeDxCzecT
+ xvp6op3Pt+2rrfndWGnJARDV88GgG4UGvQXKdMNwVtsHcRo0qDFDuNoM0epeiMSUicfRWM5ERWM+BtNx
+ IVw8ppHj52+JzCdq+uCKbhBE+lHQqQaH6qqNmqT4bD9fb+aK/3hn7cMhXFwIKmpzZSVRo9MRoyYTAQ9T
+ Tc3LUMnxBBFPChLNKISpelAYRRUCKDGyyh6IwTRCiQBYHo3lEXhM5mPIOigyH4dpONaNwjx5HIb141UY
+ CBRLMwRi7RjoFMPDZUXqhuTEq64+R5ivvvynV+c8sCUCAwkHlLtIRCinMz9xrqryVSgp8IIqQTN4yzsh
+ TtEHEYpeCJbj7IL5QFk3xOBxFCpUgbMRppGYhiMIWRaNOibvHq8bosAA4LlEzAfgdXFyHOSKfriqHAaD
+ CsaVny2WJ0RlO//ixHj+gQBBQYQDioEA6tkANDVZQ13tCsi8cBSUkiE4I+uHBBlGD+WLJpKlfXBSisZk
+ GGk0dFLWAxEy7Dp4PhzTECkObrzGH+vGShEKy/wwf07aD0EkPB4Xy4dBL8c1BaWTjY3lZYqE/l4x+xHg
+ /lYICCDoKFcEUMwGgKyj01GBx30NcjPDoKLWCGniAQgXo2FJHxwX90Ak5iMkZghFg0wsC8d8CIpMmeLe
+ 8ToxYoS7XR4jQQhxNyRg3WLJTRALb4KophtKcmWQlV4yFnwsUPb37WujN2yw+2bVKhs6gtzdcnh5EXTU
+ XgSQzhaguRkhtFSoKFsFZQVxkF+hg1TBAIQK0bQAzQp6IITMC7EbiTDqIiybEFle3wP+FQbwKhTD0bwa
+ 8L9aDgFXi+BsfiHk518FTkEWcApToTSfOZqdccCYmrKxICT495G7d1NdNm+2nzsF4MABgobaIRQSotkC
+ kPVIiIYGKygrXg+c/NNQWN4Msbw+YPIxwrUdEFBhggC2DnzZcvAvlUBQqRCOlfLgWFkNRJVWgm/BZQjK
+ TYbg7CgIzwmGizlBcDXXD4pyD0Nx3gFLWeHu4drKLSZuzepCheLF2MrKBf5eXnRnFNkCd3+7dhFU1FYE
+ 4M8WwGgkoLGRBCBALLaFwrz/grxL53GGaoPAKgOcLFGAT1YpuKWmgVdKPHifDwOf1AA4lnYYQtP/CSGZ
+ P8MFzl7IER8AjuoQSJWHQa88Mq4GBQOUov0j/JqtbTVV/5qj1T4XYTItOlZRseCoiwvtRxT54eDub+tW
+ goL6CgFqZwPQ1ESATEZAaSkBOTkEZGVZQ1rqXEiKXwlxkT/B6WQGxFx2hXNl7sASMiBX4gEsySHIxzRP
+ ehBYUjcolbpDjtwVKuUHQSY/DDo5Gr8tuWAv1Fb+tZNd8kqVXr80tLl58XESoLx8AeOHHyj/jaJMAfjs
+ M8Ie9TEuWJVkt5gMoVAQUFNjBWy2NWrOuEpLbaCqyhYEAjsEsUdRQCKhAp+3CMpLXwdO8fdQXrUP2EI3
+ KJS7Q7HiIJSgilAT+XyFO1TLMfIyBmhkR3CmuSUpfzeI69fjvV5pq65aVGA0LgoizZPicBa44iD+FGU/
+ BWDNGsIW9RauwCV6/VQALtdq3DCXa39HdXUU7DZU7D40hL0rY5MDaLWLQCxYDZL67cAXu0IFmiRNTxYb
+ o16F5TLZYdBI0ThKI0YY3i40vxaU8pdALndsraubdwdAq10YlJ8/3/nNN23eQNlOAVi2jJiDegm3Ebkq
+ FWGZ3ALl5dZQWWk3xehk0/fmjUY6qFXPgETwHpr5O9RjVylTkBDuwEaQUhQZeTWa194x7w6y+p0gqPsQ
+ lIrnwGCYi4Gg3+Dx5rGxBU6Q0edynzmZmjpv1+LFVktQ923wyDnVsaCAuCAWEyNTAeZgd7GfNcAEkFKx
+ GFvhfYTYDQKZB3ButwJX7nEn6mTktTgupPwdUM99FzRqRyADQN4DAToQoGICgMWaHxQc7LBtyvR5z7Js
+ k5VFJOEmrn8qANnfKY8MYDQ6gAqjKeS9B1LBfuDJDoEE+7v6dtRJ86RE3O9BxP8zGl6I0/It87cBuuvr
+ 53InALKzHX18fenfTLcrtbp0iYiqqSG6JuZ4jYYYH6w83qMDkCYMhnkI8SJG9yOQCJ1BLWGMm74VeQYI
+ a7eAVPjvoNU8eyfykwDMCCAwGheOd6HLlx0PubnRNky7rU5LI4Krq4m2CYDaWgLN24JKRX3kFpgwYmic
+ B3LpC7h73QhK4R40fhjUOPeLeVtxsK9E84vR/NTJ4HYL9AsEDjIEOEkCXLzouH/nTsr70wKkpBABVVWE
+ kQQgFyocEyAS2WHT3v+A6Qby/QPbAUTCF0HC/xLk9U4grd8C9bwVoNfPf+i9dTraoFDooCYBmpsXHcMB
+ 7PTFF3arpgVITiY88Z1ANwGQn2+NAI8+gB8GJxL8EaorXkPzy2YMCgLcRAA9CaDXLzyekjJv2+uv2yyb
+ FiAxkXBHgPEdKdkCTxuAHBONGHWDwXHGLolrzKhE4mBC82FFRfNDExLmfrZ0qTW5iXv4LyaGcMa1YHxD
+ dwvABlvg8Qbwo3SxB9VtbKRZlEr6Dbl8QWxa2rwT4eEOax/4LjAZJzyccOJwiDoSwGAgoLDQFlfc3waA
+ HNg6Hb2Lz5+fgtH3DQx0eGfa6JMnT5wgfigrIyrJzRquyMDh2OGS/vgz0JO2gsFA76mtdcxkMh08PDzo
+ b8wI4OdHbMEdJlurvbXTlErtccv8ZDPQk0AggBkBWCEhdOeff6aumBEAvwd9zWYT+WT08/KsQKOhzDhb
+ PInBma5FgF4ud16Rvz9t51df2f9xRoD9+4mNJSVEllJpBbm51uPvvTM95Nc8j63fX1bmUOHjQ/129Wqb
+ JTMC7NhBrCsqIi6qVCSAzW8OgGvBQGYmrS4wkLL2hResaTMC/O1vxJrCQuIcCcBi2f5WAGPYqjdRQ2o1
+ rTMujlIdFUWZeQCTdOvWEatw+5B0C8DutwDAdxG6GdVsMjnI1GoHTlQUNSksjLp8xuiTFVauJJZlZBDh
+ PJ41VFRQcK/yq8xAGF16D8qEJlUGg0O9WOxQVVhIL7l0iZ6Zmko/lZxMD4uLo/kGB9Ncdu+2/+qnn+xn
+ 9/+zpUuJJfHxhH9hofWYUkl94C5xFoMWo0h2AXoP7u/b9Hq6QSSiaaqqaGIOh1bJZtPyioroqVev0mNz
+ cuhBGRl0j3Pn6D/FxNC/PnGCvu7oUfq7rq60Pzs5Ud/YtIny6kcf2T734Ye203+dntQ8DiEhVocyMuaQ
+ fXC6GWi8n6LBPtyzdMvltHaJhGYSi2laNCsWCulV9fX0vLo6emp5OT36yhWaX2IizQUj+qOnJ+1bZ2fa
+ BvyysPbLL+3e+ctfbF5bvnzOv6CHqS/qs+oz91eyCQ21dk5Pt+lDgxbcRo8aDLQR7EpDqAGUGdWFplsa
+ Guga7KO8mhp68eXL1EunTlFjw8OpPp6e1J9x0dmyeTPli/Xr7T7CHeTKBQusFqIe/GX5MY0+9LKwMJt/
+ pKbadWMXGNJo6NcrKmgNWVlUQVoapeDUKUpyWBgFv45R9u7ZY/8/339v9/mmTbZvenjY/y4+nuqIAHMR
+ gIYAVASgIIAdAtiieWvU07b64Pvt22fzHoNh63v6NNUjIYGy48wZyufnz1PeTU6mvMVkUv7N25vy8q5d
+ 9i/gy8XS1attFz7/vDXt2Wet/3+ie4/l/wOchKPj6Tjd4QAAAABJRU5ErkJggg==
+</value>
+ </data>
+ <data name="monitor-computer" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAD31JREFUaEPVmQdY
+ VHe6xvFe9+59dJPsJttMTNas2WQfs4nuborGGzVmLdHYwIKiG0VAI6BIH5A6dJDelCkgRXrvvXcQaYJU
+ UXoRLAgMzHu/cxRkaJZr7j7L87xMOTPnvL//+/2/859zFgGQ+rf+YwD+nfWTm9/p2fTWWk7c5x+f4v+w
+ +ke+7V9VfGLWnA8t/VQrtv5TrbiWT7TiOz7WiO1b/flXx15mIF8KQFDQ958eOb3L9P2KvlKyDVdQtA11
+ UrwYmXDaJaVcyS2jTskts1nBNevOSdesHiWX1AHNS6n3nMKLxyILGlB9ewiDw+MQizGlkZFRrF+/Xuf/
+ DNBzX/Tft++OrsipaNzkF5PxozA81Z0fkZFyJb7omjC+pJYXV9J0Obb0tkdUcbdbWE6fV2TOvcjMClFx
+ zS103h3GqEgsYWzS5NiYCM3NLUhLS4e3tw94PP6UzM0t2O9s3LjR5KUACgoKLlbV3Gi6VlnbVlRe1ZWe
+ W9SbllM4VFJRI2pu68TDR2OYmJjb2KRBZntHRyfy8vLh7x8APl/AijHq5cWHUOiD1NR0FkIkkhx9Hk/A
+ Amzbts3ypQDS09O9Ozq7MD6BBdXXfxclpeUICQkDjzHHGnxsVCAQIi4uAbW1NzA8/GjOFKaXzPTnzPeJ
+ H7t377Z7KYDExESlkrKKMRpoVNc2ICIqjsx5w4svpEcSTwg+GQwLi0B5eQUGB4deyOB8xiffZwZiRATI
+ 7D/o8lIA1dXVq5NS0gfvjQBGxlx0dnW/UoPPArjsJQBz7O+OHLvxmzV/k6Nz0pIXAZFqbGxcmpSS1tP/
+ EHD14OERjQYzIqPjwBhJ9KS0mJifZeZltntRGTLHPukpEKs0d4p3efBavlbXjl2143vz1377u0+eBcO2
+ 0dj4xDud9wB7Vx6GHoEdkfukB6PAQ9IwlRejnwLOi0q0i4592kMg5g5DbENTyInkPjwu1s/Mvy9rZlm6
+ 5aSS4MPPPj9O6bw2E4gFCA4Nb2i7C9g689D7AKz6aFSYkRkYBqhDYpDA5oNj5g+bGolJ7UWS8/bxQ3Pv
+ GFQJwJ6Mu5F4IxD7koJHIY4iJY5BHN3dLzb09m2T5+jH/2PvPsvfv7P8M3YZxPzzueJX1dQH2Ln5oJV2
+ 1j4EdJCYVJjR6b4P9JBYMBILRmLAXhSOuijb7SZITMkFh4SjomUQ590F4ktk2pt0lUyHk+LIeCopRwRx
+ CamSOnCdaEJsLfAZfvvbPb3/9dcNoSyAg5NzakXrfVyJyEBmWRNa+oHWAeAWiUnmNunOINDOaCG450iN
+ LctpJRkVm4jsqg6cd/SEP5kOJcWQksl4FqmQjF8jCVLSRWsOnej6hZx6h5RDygOpbDGkpJUDWABTrplN
+ bNZ1JBa3QBiahvoe4GbvYzVQMo2kJoJqJrUQFAtHUCwcQbFwc4CxyT2jJBNSsxFf2IRT5/RH9x0+cWeX
+ vFIPr7xyPI9Mh1bfEK//56neX8qe7ZAyCRqUyhiDVA4ZnpS0ylUWwMjIaO8l34jholYRuI4+qOwEqkjV
+ XUANqbYbuEGqI7BJuAaCY8FIDNiLwk2WZEp2KYJTq2Bq40UnwiHk5DSAo2fTu2H73p5FWp79Ukn3JU1P
+ B5BRDWQBeDzeO9aOngOFtwADWz5KbwNld4By0rV2oIJ0vQOoJLFgLwg3V0lOJpdZXAthdBGMbXgswKTO
+ apr1SIw2Y5zK5meuWfilggmkMkSQ2n82iAVwdnZexLWy785pBjhWfOS3AgUkBqiIURtQTCohsOeBY1Mj
+ sak9I7ncila4BWXCcAGA/whsxFu6Xlil54UDYfVYa34VUqmPGIDgqeW0nqHZrfRGQMuSjwx6zGwCskjZ
+ BMWA5bYAeaSZcCwYaRKMTY4SY5OjxNjkFijJfKpPa3489KzmTuC36i7Y4p4KxZIJHM8ahEzAtacAB849
+ BVDT1K1PqgfULQRgHpNvAimk1AYgjcTAzQRj4QiKhaPEWDhKjE3uOVJj4Aob78PIJRS6NHBzldAHF4Q4
+ FHETGwx42GTsjb/p8/A7NSdIZU1A6oBayFQCCqeVy6KqxqBh44eI66OIrQXibgDxpIQ6IJERgT0v3Fyp
+ zQVXfGsCWja+0LKYAaDBZefASiqbb1wS8D7nMpaahUAq5eHTSX1Q7fF5gNEB2aMhvKRGmPlkwy22AWFV
+ QDgpohqIJEXVANGkGAKbC44FI7GpPSO5mXDqlj7QsPBGTc3g00n8BODnNnFYFH5n7k508HzYFMD273Zo
+ GLpFit2TboPjmYKr14DACiCIFHwdCCGFVgJhJBaMxIK9BBxTkil1IriFFEDTSggDzyRo2wWirKxzFsCs
+ TkSpLAppfdyFDqmHPwXYvn2dgob5/SulE1A09oFPKXCF5FsG+JH8y4EAEgM2C46gWLgFUoupnoBTWDnO
+ 0Ugrc4VQNveFXXgdu19GGrYhyM9vmQJQfZLAFED8XbxuFICVVEqrFAwhFdnJAERMAUhLSy/d/88z/cIS
+ 4LiBEF5FAI9RMcAnCeh9Zps3QbFwBMXCPTFAzWEWmH1ELc6YXcEpEyGUTHxgGlABQbGY3Q+/aAKGgnyo
+ Gl2GtoknHFyuSpTQJMDP3fOwXOcS1loEQT73AZTomN/SnGABZDWfAjDzYIe0XOelQuAYzXzXPMAtH3An
+ eRQAniRm22XSJBwLRmLBSLZRzVDi+kPeQIATNAgcfiE888bZ7zCyiW2Hipk/1IwuwcDsMqKjiyU6z/Qu
+ pKph2suM/grywpjeH1zFdqKdHin4VO0i/Qbog9ThGQCbtu1pYYwf4Qhhnw04kBxpJ04k51zAhcSCkRgw
+ y+h2KJgG4Zi+AMf0BFBzzYRT5ii7nZEzrcY0XNNwxuAytIw94e4ZTj9Lu+Y1PR/AkdhWbKCy/ojK51cc
+ PhaFtT2e1Ee0oiSuC32xfnMNY/qQjhBW6YB1Bo0ayTbzsUxj+nDCLByyOgLI6gpwyi4JVkkPWNBJ6QU2
+ YI+KGz7ba4Jz2jZITq58LsPTzTPPVdUfJ/CWih1+T2fhxbzS2Z3oiLYkwKrVn2ebRPXh8IWrMIgfgX7U
+ EI6ZxUJaS4D92gL8YB4Nk5i7sCGYSZknDUPOOHx4vazF+AdbbPHG5gy8tncUr22rh7IyR5yUVCGeae55
+ Xk8CzNWFpt47oh0tkcCKlX/2ULRLwVl+DXaqukHWMBSc0G6Yp0FCZ/lVY9sUrdp2HdMe+Pjrkw+XSbdj
+ udyEpPbWIDGxgq4LRcLIyAFcrut4UdHt507juQDkdGIkAN588025bQoWY0bJgPE06UYM4aCe39j3ikYj
+ MkoaY2ZuHhMZdXVw9vKH3Gl78SrFcczUhwcr6EpczZThkpJ22NsLoa9vI3Zx8RdVVfUvCKNy3rRvwdFn
+ 5oCMSpIEwOuvv/7Hv2yQGeLEi3HCsXBit+rFcWVzD1gLA2id04qawUEJCcNioMflY91Z0SytOVIk3rJz
+ d5uRseNAVdWAhFkGzNzcDZqapqLg4MzxuUpqXgD/OqzYp9j3P1v39Ur9+p2tEgDL3n33vZWfrh06Z+GM
+ 0Ny8WYZnAvhEx8HK3hfbdMZmadOpYmTdvAknX9/732zbkX327IXy1NQq0UyzQUEZTCrQ0bEYSU+vm5ov
+ yudNniaQOY5fnLa4t+nQqQ6uhcdARUUPXRGMekBXKVZMAXy2fv1WjpVVw0yT872uHBhAbPk1uhjmCBmD
+ IRwwGZXQTpU8pNfXg/1cSen49n37rnz44SdHDx9WCLe39+6cWUKVlf3w8AjBuXOGYzRfHskraT+UulQ4
+ /mdphW75M5wu6mZP4W+PSAKsWr16h1tg4N1nma/o70dJTw/yOzqQfecO0qisuBau2HkqGidtRiQkcz4L
+ 0ZWV7OcKOjuR1dyMnQcOxDEnzCVLlizbuPE7a+pSxQkJ5aMzUymk9biCsh6+3ys3UF19d9ZcqWoephJ0
+ 76cE3mUTkFNSKlnIPGO8uLsbOazpW0hsakJM/U1E3LgBF14IpOVtoO76SEJHtVPhX1KCGCoj5vPpt27B
+ LzNzfM3atbKTK2AysOijj1btOXhQPsjGxquNKY3pMPLyZ9unvy4t7YCJiXODtPRRwYoVH6xnrwvR36/t
+ +ILR+QDKenvZEWcMJDQ2IZK6T3B1NfwqKuBdVgbry/5QVLeHMX9YQif1E3ApNxf+FdcRQp+PqqtnQbbJ
+ 7E+c63Ih+Xjr66+3mP74o25uTEzRI8b4JEBgYPo9JSWNtC+/3KBJn1s6/ftSixcv/ktAcop4LgDGfB6Z
+ Z0olroF+I9TUsoYEpaW0PiqkJUYu9Fy8oGHoAvurDyV0xjgGF9PS4FlYCGFpGQKuX0d4bS2kj5+gXw0L
+ 35d7//0/bdm//wffr77a3Lxnz2H+8uUrvpjvO0wCSzmW1qKZANepbAqpdjNutSG+sZE9OGOeT2XhSjcy
+ LmZmwjwlFWdsHWFkdQn8yAcSOm8aDm5iIuyzsmjdlE+r2VL4XbuGb7/fS78gXt2NRXYOyMge6ynv6pJo
+ m8zo57a3I6WlBdHUTYKqqtiS8SgoIFPZrHmDuHgouLmDY2SP4MQhhNA1nElpmwfDIDYOlqlpcMzOoZVs
+ IdRt7PHl2k0vdR9g3gSYDevWfeOoY2hOl1KenqxKqdswkzaZukcU1X1gZRVbCu75BTT6WTBLToE+GTwX
+ HEILLyO4C/ORlHMPkcmd0LW6gh/0LVlABpQBVrvoCMUzmv3Llr373itPgLmpICsrn2ls7ojI3Hw2iXKm
+ /imB1JZWtpMwE9envJwdSWZErai+jalEODExOKFvin2yilA2dcRRrjXUQ8OgFxsLk0RaraakQIFjBDsH
+ 7webN+/Qe5Xm2S40raUtoQkT4uDkPcF1cEVUYRGKqKwy29rY7sG0zKvU15kUPNkJnAOb9Aw2CQZENyIC
+ F2jEDeMTWOPGlI6SuRVU9c1ga8vvXLt246lXbV4C4ElPXbR1624HX9+EQf+AZJhau8LUyR3BBBNPXSjy
+ Rh07F67QGZhXXMLOB2dqlQ5UIkxZWSYlQcXBGWcucGFq5Y709Fpa73Br1qz54tufwvwsgMmDvP32u2t2
+ 7TroyeFYVZMJscA7GlZ2l8G1caeO4wyOpQM0zW2hybWFDvci9Kn0jCxcYEcXhpOTr9O94Nh7Cgrn09at
+ 26Qz112VVwkjsZibuWM6+OK//33diePHVYPV1AwzdXUtq8zM3O54e8cNM0YjIwvErq5XBy5csGvS0uKW
+ qKhwEnfuPOD13nt/XP0qTS60rwUB5jlj/ozA3v/DH1Z+98Ybv/qSnv/m/8vsnH7+lQd/Fcf+X104LlAR
+ 5z/iAAAAAElFTkSuQmCC
+</value>
+ </data>
+ <data name="paper" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAACYAAAAmCAYAAACoPemuAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAChxJREFUWEfNmPl3
+ lPUVxmvX32p/6p/gsdqqgCxCIlpwqxU3IgWDtaBAlYTsxEjAEFBCksmiEEDBgBANmx7coIh7gklm35dk
+ 9n3L7DOJTZ4+b0LSOTXIkNPT05zznPedmTfJJ/fe5977zQ0AfvJ/+SWA/afmzll4+4svVB4sKqruKC6m
+ tlR3bCmhSqs7SgSVUeXVHaWCKqo7yiqpquqO8q1X14MPP9w40++62ns/gBIeXLggf63FnIbXA/h8gD8A
+ BIJAMAyEIkA4SsWB4SQQSQHRDBAbBeLfA4kxavyH2lxRO7Z02f3HcoW7Kph5MA2PC/+G82fBDRNwCi6R
+ BTdydbiG/Wewq+3s94uX/nF3LnAzgi2Yn7/WbEzD7cR/Da626TSOXgLKtu9PL1qc//y14K4KNqRPw2UH
+ 3I4sOC/TOhW5EFN7jcjFs9JaVHcKO44DnZ8B6za/Eps3f/6yH4ObEWz+nXmFJm0KLityh4ux5qbSmmbN
+ XUlr/J+T9VZYcRIFTGLtUeDIhXE88XRR6Kabb77puop//ry8QqMmBacZcF4DLpAduRngYjSEALemrBs3
+ M4ErdwE1nUDHxyN4YMUz7l/feONvZoKbOWICmCoFxyDgmIKzZaXVTbdOpVVw7BSc4NgpODo2eiVygmMr
+ 6jvxl9JurC47iU21p1G15wyqXz2Ce5c9NJA72Ny8QoMiBbuJYDnATbSTH4GLMq0T7eRKWrPbyR5RS2/O
+ YHfOWbJGJ03CZgB+KzdgpdqNzboAKg0h1BjCqDYGUWrwY73Rhwe0dtyvc+BBnR3PDvlQbg2h1h5GvSOM
+ bfYgSmx+rDa78SeTfUIFFhc8349N97oGUcvl6wLTipOw6oDfKczYoglgpz6CRkMELcYIRINR7DEN42UC
+ bjB48Te9B88ZPaixhLDXFkG7PYIDzihed0XQ4BpGlT2AjVYv/m7zotThh390fLoR721p/S5nsHmMmGYg
+ CYsGaFVHcVAbxzFDEu9QXaYkTlDHTQm8bY6jfZCw5gjaqKP2BN5zJXHKncJZ6pSbr718zhNDhzuCDm8E
+ b/miCIyMT6aV7aSxra0vd7A7lqxR9yVhVgF5SjueVHvxoiaIrbphbNOFUaMLoVwfxLN6H5ZrHLhbY8cy
+ ar3Jj/KhEHZYwqizMpVMa7E5gKdMbtxncGC50Y7Hh9xwpsama66xtf36wFSXkxhSAu8rUzivGsHn2lF8
+ rhM0gi/0GXxp4pU6P5TGec7VC5Y0vnaM4FvnKHpcGVx2p3HZw6tvFF9507joT+FiIIUvQmkEBcdema8E
+ y92Vc29fslrRk8CgHJgns+BhpQvrlH4Uq4MoZ+TKtUFsZt2tUnsYURsWKC3IU1mxlvX2gokmGQyhajDI
+ awAbhvxYYXAiX2tFnsaCh4wO2GJj08O/sfX16wOTf5OASQpskvtQIw+hURVFuzqGfaoY3tDE0K6L4lWm
+ tlzjR5HOhzKdH3tpiPYh1qQ5hkOWGA5aaQAbn2Nqq5nSlyx+1NmC8MTGp6dEU+sb4pxrbO5tS1bLvkrA
+ yG+ploWwW04nKqOEiuOgJoH9BNyvjaFZG8UObYh1F0SdPox2YxQdQ3G8SVMcpo5Y4uiw8jnLMF6xBFFP
+ 1zbah+GKjE+uTRxhTa37JDmDzSGY9MsEDP0sfpkNTyo82KQIoko5jBpVGC+pQqig1tIUy2iOfJUN96kc
+ WMeolbHXbTOFUUttM4VQxNQWGNw0iA33am0ooBGsobHJtYlToqllH/Pyw2V1xpE05w+LV4kvxaGnX84O
+ pPGxOIML0lF8Jh+Z0CXVKC5qRvCJOo0PtEl8oEvhnJ7FbcrgkmAK8yi+NGfwjYWFb+V79gw+cdBEjiQ+
+ d2fgyZqvzS0dspzB7vj94lUDF+PQsSffKbXiEbkbz8rZCuRhlCtCKFMGsZFmeIqRvFthxwKFFUsZuUIN
+ 2wrTWsW0VhnYXhi9DWwpj+pcWKRm8VOPGVww+8amR1iz6DrB+i/Eoe0BqgZYGwOsMTGLWprAQUkch2QJ
+ dMhiaFNEUa8MYwfTuksdxj7W3WF9nI04ManBBA6ZomgzRVDPtL7K9Lax3py+8cl1nZFrFh1QXFfE+s/H
+ ofkGeF7sQ8VACHUEa5LG0CiJYq+UQLIItjOCRYzkJqUPxaoAdmjC2KPlJKBjRVQrR9geA0cXo/eiwYdS
+ ox/b2EosboJx4RTgmppnA/Y1cJfYisclLH4JUyMdxkvUVmkYm2UBFMo8WCazI09uw3KFA39V8Zezz9Wy
+ jWzXsvg5JV6gIQo0LtwtGERtx0qmdcg1NrE2CQedZtEhtvEci/+OW+8q6D8fg4Zgx3s4+3oz+KB3BB9d
+ HsWHfWl81D+CczTFOUkGp6UpdMuTOM016WP1CD6lLtAYF7UZXOSEOG9g4ZvSeJ/z9dxgCv/ghHByXfdy
+ p/MSrrn5EAffLMAWSGz4s8SN9eIASsVhlFGlYha1JIDVMi/yGbGFjNhSRmwNI1aiDqGS9VapYUth9Naz
+ pazQuHEXI3YPI/ao1gWjbQweHnQEuOamN9WzAnutl2tML5tmbxKdvQkc4ww99l0CR/oTeKs/PmGKvRKa
+ g3X3pjyBE5ytXYoE3lUn8S6bcaeGZqEpWnURvKHnM4YYLNZxuHnQEeBEzW9xh5lFxFb1e7BxIICqfrqv
+ LzKh7f0RbOXrUjr2abEHq6QePCP1oljO+lJG8IpiGDtV3ETo1irO1w1qHwpUbqymNmp9MJjH4BJWdcKJ
+ mg5rcwa7/dZFK/s+jU7U2HKxA0+JvdhMZ1b1sfivqJhQ6+jY+/n5vVIHHpG5sJFgNYTaTtVxSrzMVlKi
+ pElUXjygdOAhpRNPc/DrB8fgtPAExoOOqPEw19EcI5YN1sniP9GTwkka4HRPBmd7RnCG15NUd28anZe5
+ CDKt7/TTJBIaQkpjSDP4UJHBOUGqDE6pUzjBtHZpEzjDKWE2jsMxxBMY4USNb88OLF/iwAqm6jm2iy0D
+ YVT0D6OkP4Tn+7n2MJJLxDYskthxj8yJQva0LRz6lexvldxIShjBDQo/HlO6sZgTQtBjTKfGMDZ50CEc
+ wXiymEXEDnIv62Thd/WyLfSk0f1tGu99ywjw/hijeaAnjgOM2iHqeB+fYRs5Q52WcL2W8cp2cpzt5LAy
+ MaEummJQNz5x0BHgRHs7cwe77ZaFT3z3SWSixnKVllNCGGHCfNXzeCFsJsLaZOJSM8gxPcTBI2zEZjYH
+ C8tdOOgIcKKGTmPOEZsN2MQfcA24wRngRA1HGbccUzlrsFnAifYc45H6fwGWDccz9nRaudkLaTUxrcJZ
+ YiqtBKMFcgS75aZ5jzbUHve1737fK6ht11lPtlrrz3im1LLzlHtKorqT7mnt5P3ObpeovtvVsovX3e+5
+ WgS9JqjLKai1ocu56snn9DmD8Z/FN1C/ytIveZ+tX/D1lH7O+yn9jPfZ+ilfT0n4mRO61j/thM//BR1x
+ NCLR9Yu7AAAAAElFTkSuQmCC
+</value>
+ </data>
+ <data name="mbox_error.png" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAABcQwAA
+ XEMBOS4mtwAABChJREFUaEPVmVuITVEYx5fLmXGdaTSa3Br3mDAeCIlxeRAiRBE6pWQy5dJMETURDZHL
+ FHIrzYuEGCK5ZR4kxIMm5VqIcnkh0ZAs/2/sc2adddl77bP32efMqX9n5uy91/r/1rfWty67A+ectesP
+ AbRntWvzrb0n7NZHd+wHzYaqoO3QPmgvVAuthqZDRWHVGwoADE2BDnZk7Dm+aVDZ6KEDOCoITCAAGIh3
+ YuyRpWE3qGsUtXRA0gJAZTM7M0YtaNPSfu65gDLL/ID4BkAFu7yMTwTYKgidnqPz8z3QFmgFVG4HXWUL
+ YQ0A0z3zGKNQa1t0MX4/D/2gvOChT7h+AprhDnPYBsIKAKZ75zP2WGc+DhNPLUyboJrw7CwzyGkvCE8A
+ mI51YeyBbH4gKr0SwLgMdAxlYVzpotvgBuEJEGPsnGyeWuxziOYTMAgxH6GH2GGCcAWA8RrZ/MIMGBej
+ 8d480OfpIIwAMD5SNl+RYfMJkFeop68aiRe+ANB1kFTa+mQB/n4dEQCBIN3pxkOtDKGNAIxPklv/ZITm
+ E5GoViG+UzoXIbQAWNM0iABRdR05M9GcUqxCVLsCECH0VwRozELrJ2B2qgBPvACWi+aHZ9E8QXzUj4Ux
+ CQilC8H8KRFgc5YBCGKOCrHBCID1zksR4HYOAOxXAc5oAWjZIGcfDPu2xVkRNlLxeDQqKUnWe1cFaDYB
+ DBUBBsitX16O5yL6VFQkAb5o0qkJYIIIMC5HAGgcaBZ6ecqmHuanigDY6Kau7bMUAQJAbpdn5gIdQMoM
+ jHDkDACW9DJAVx1AygJuSI4AfFPNt5jGQA85C/0RIWIxzktLo1F+fjL6tE+QfCVXpspEhnXQW/Hm+zkw
+ DxxXARrdZuKzIkBdDgAsVQG2ugFUigDKQI4Y6Bfq66YCTHYD6C+PA5oJvY5KMnX9qGr+jed+AACXRYgl
+ WQQoUwHqbADmy1G4mgUIHGvrtpWDPQFaJwjGmkQITBD8d4QQzagLGVEGOGK1J3YAcPKXWsDKiABo7qHk
+ IdVP++E+1gAOxAEZgjbamRqwiXIX6LtOpWxeWUpob2DsngyBVy8ZgaAlw1y9eePxoufRIswPgz7IEHS8
+ iK1baCB3UJYm41A3atI1rHEeMERhPArCviK1X2L7xncHhKDNykZ9q5N5OlQuDgzgjIexKOyZDEH/0zHg
+ NggvyKwjAmd8HYQ9uC5V0m/XoUI381ZjICXnojVQKL0GMlXKR+PaGqgewo38FnQDwgKr9W0NZbJBLs87
+ Zdd7GffVhZTU9f8V6lc3kDSvUYQX2Zr3HQEpGr1QGV5/sZ9pmhWj+A5l1PgxHigCEkh3VL4WwhGSr7eW
+ Lbj/IrQsHeOhAUgwhTCEgzS2CcI+hF1ywG46Y+cQvtdD06COQYxnBCAMQ37L8JzI/BYY9f3/AJQMVypF
+ n/EwAAAAAElFTkSuQmCC
+</value>
+ </data>
+ <data name="No">
+ <value>Nein</value>
+ </data>
+ <data name="folder" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAABMNJREFUaEPtmW1o
+ U1cYx5+mSZPcvHax6GTIGBNfPlUp6FBERIeonTCoyHBWOuyLVKE207UYCY3isszg2iTFpJ2hXW1ybReb
+ tkq0nQhN04rECSW0VavWFtlg3YeBjK3b2TkdnV1y09x7d+dtsIHny3055/87z8t9zkkGQgjS+kcA0tnS
+ WvxM9KTz6i8CLATvvT4hhEutdNkyWLtzJxw4ehQ+PXsWvnS5oKWhAXouXYLwsWPgEMMjjB7AYlWFhVBh
+ s4H74kUINDXBYHs7TEaj8MfEBKDJyUQbHIQXGzfCerYQeA5q1SrIy8+HT8rK4JTJBE4837f19dBfWQmj
+ +L6CzViMABYLhJ49YxbKJH72WnU12GcnxQIyly6Fd7Ztg4JDh+B4VRXYrFb4xuGA3sZGiAUCMHXvHvMc
+ fX0wrdfD27wA8MRZHR3wfD6hye4NDMBPdXVwDYfV3dZWmAyHYfrpU+4LMTwMaMMGeJ8vgD4Ugl/4AAj5
+ zu7dUMQXQNrWBj8KKYbPWCTs5gKQyFi5Upa7ejUY/nWdiRIn7WM+kwrxDsmLQECCSktlvSYTVXf+vCbg
+ dmvv+v26511d+t9WrMhamxIAl8X7QohJNsaDB4Bu3MhAPl8mNhk2OfL7KWxqdOuWHj15sgRXukRratI9
+ xp7ISAngdkPffwUgVSwSAXTligQLlM6I9PmU2FQoGNSioSEDo0gm4bPXnE5tT3zEMJZRpxOusQWIxQB1
+ dUlQa6sUWxY2BTYK0bQG9fdno/Fx5tWcT2iyexaL2s0KwG4HPxOAz0eEyrDJsSmxqdH16zo0MsJ9NfkA
+ FBcrP2MFcO4ceOIB7twBdPu2nrPb+QhleufhQwPavFmezwrg9GmwxwP4/RJBw4ErWDCo+xknsJYVgNEI
+ 5niAy5dloq0+gfV4tFGmks+YxMXFUJkIoBAVwGZTt7EG2LcPDicCUKICGI2qL1gDkA5ybjdKPjwdHVpR
+ AfbulZewBli3Dt4j9X3WC93dEjQ8/GpKJVNyRyLZ0/EtxD9tOyMVwFukJ58FIB8prlVDyOe93sQWIhUA
+ FQzC1EsAuagAtbXq3mStddJNfUsLjL8EUIoKYDarGjgDeL0wRADIHph0iUKGBNexiooU1ZwBPB6IEADS
+ UZKmjOukQj0/OsrcQsybA+QmPjIJEQCazsReEK6j5Ap29SpzC5ES4MIFaCMAZMPBdVIhn3e5NPfn2xsn
+ TWJ8BPI1AfD7xW0hampUIV4AZjN89TeASlQPlJUpfbwATp4Ey8gIoO5ucVqIsTEDunlT/+uuXcwtRMoc
+ OHIETnR2ShDZSAgZ03PHItvNcDh7urlZN4FjfcBqVbdXVVG1hYXKE1u2ZH1IUfBmqrOhpDmwfz+U0rQw
+ LUQ0+safNK2bcrs139vtmk6TSV1fUqI4tWOH7OOcHHgXb1QkqYRy/g5s3w4f0TT7FiIWM+DTBt0Lr1c7
+ 5nBoe86cUTWWl1M1e/YoDq9ZI1uPRcr5iuSVA3l5sJWcLsx1+aNHM3H5e3Oz5gePRx21WlV+o1H5eUGB
+ vDw3V7oVi9T8HyJ5ASxfDksqKuSjTqfqO7OZch08qDy+aZP8Aywy51WL5AWwkEQuAixkb7w+f/ItVC8s
+ ekBsz6S9B/4C+eG8h3vJrfkAAAAASUVORK5CYII=
+</value>
+ </data>
+ <data name="Green">
+ <value>Grün</value>
+ </data>
+ <data name="Define Colours &gt;&gt;">
+ <value>Farben definieren &gt;&gt;</value>
+ </data>
+ <data name="Ignore">
+ <value>Ignorieren</value>
+ </data>
+ <data name="Help">
+ <value>Hilfe</value>
+ </data>
+ <data name="Add Colours">
+ <value>Farben hinzufügen</value>
+ </data>
+ <data name="Retry">
+ <value>Wiederholen</value>
+ </data>
+ <data name="mbox_info.png" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAABcQwAA
+ XEMBOS4mtwAABL5JREFUaEPVmX1olVUcx0+3ba6VDmP7w15w+TJ0rJc/EhuytuqP0Gz4UqhoDoLYcOAW
+ TpQFW2KaKFZihbMg/CdCxTeU0VK2P0SdzD9CGlsrfGtg7Y81pFjiPH5/u7vee16fc577aHcXvmz3uec5
+ 5/s5v3N+5zzneYRzzib0hwAmsia0+bHRE3XvYzg+DS2E6qAt0G5oF9QMfQC9Bk2Nqt1IAGCoHPqCsVgf
+ /tKkctHFccDSdGDSAoCBasYe7XY0bINqo6iFAQkFgMbeYCyLetClp33KHEGdJT4g3gBo4NNg46/A9PtQ
+ M7QL2gk1QWugF12A6lwhnAFgejJjORRqg4F3cP0w9M9YarDrT/z+DfS6DeYrFwgnAJguZGzSJb35apj4
+ xcG0CaoT975pAvk+CCIQAKazGcvtUs0XodGTaRiXgVpRV5YO5IANwgEg+5Bqnnrsr0DzM2ZwvnEj5ytW
+ BA2pxO+XUOccHcRWE4QVAMYbVfNLA43T+C8q4nx4GM2Of/budYX4wzTR39ZBGAFgfK5qvsLJPAHU1yfN
+ 039DQ64AVO436Ck5Er96AmQfFgGmoMLfnQEWLxYBurt9AKhsm24oNcsQ2gjAeJna+986m0+k0G3bOB8Y
+ 4Pz8ec5LsWEITq9ymQ0yxC1K56kQBoDYARHAfej4m7SB0ZpSIENssALEFyx2VwQ4FqL3wvS47p5PZICf
+ gwBWi+aL/0fzBHRTNxdeSEAoQwjmvxMBNnsDlJVxXlGhV2FhmMgskiEaLAA5/SLAGS+Aqiox+8jfenvD
+ AHwmA/ygBYhvG+TN2i0vgAULOB8dNUN0dIQBOCsDXDYBzBIBnvUyn8hAxcWcL1/O+eBgEqS1lfPKSs6z
+ ssIADCrp1AQwXwR4ORRAAuTKlSRATU0Y46n3KBu9HIIQJjHMvyoClGcQwGQ5ClN0ANIKPD+DAHJlgMd0
+ ANIGbmaGAAzL5kdMc+AJNQvdCQ0R3Ryg5wQhO97fmWoWstg1sfCFDADYLwMcs63EB0WA7RkAsFIG+MgG
+ UCsChJ/I0Qyh/2A+TwbAchk/lNbthZ5R5wGthP55PBqAfbL5qw7PA+yECPGuM0BuLufTp8d140ZyIWtq
+ il8rKPDtiBIZYLsLQJUahVNOEO3t9s0c7ZNoS+EW0d2yefqOs47kOw3bQ32nCDEXN98ObLinxw5Av65d
+ 6wJwGW3FZICvU81r58D9yYFzPzUK7wUClJdz3tJiVgN28nl5QQC09lDyEHI/PQ9PcwYYo2PscxWCHrSD
+ DKT7+xLd0KmVzVsjkBKJcypE3QOCoC3DWzrzxuNFh6NFNhsAAyoEHS/2RwjSgbqUjEMwnbqeN64D2jAx
+ Ng8VDaoQ2WhgR5oQ9LDyoa7X6RodKiPxmt+kBkYgZSi9hMp6VQiaaHQM+DHU5wHThbLroRyT+R/RVr7N
+ vNMcEHIuegOV0msgU6O4/jxUA+2BjkCnoXboIERvayiTPWe5f6zuPUHGvYaQkrrir1D/toOEen9GEV7m
+ at47AlI0nkRjO6F/IwC5jjoafYynFQEJ5HE0vg464wkygvJHoVVhjEcGIMHkw9AiaBO0Hzo+DvbT+Nz5
+ En/roUoolo7xBwIQhSHfOpzTqG/FD6v8PRJO78MpB02PAAAAAElFTkSuQmCC
+</value>
+ </data>
+ <data name="desktop" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAACj1JREFUaEPtmQtQ
+ E3cex9eKr7vO2evUu/Zs72F7147edTrezdmWdmyvnfM8q5718BwRX1WEU4vYIohKtYjhKSQ8E0ICojwl
+ ikAtiqL4FpQozxACBAiEEBIgLIIC3/vvQtLwTBC8a2eOme8kM1l2P9/v7/vf3WymAKB+0H+MgR+yftDw
+ bHu+z+lT1PZn58zZ/dbixd5bV22J4qz2yUz+RHjr1ofRd2pmHinY+D83QABnzJ69a76t7WGHVfahh+0O
+ nT6xQnD96ieJUtmnkqJG+wvlHTultX1u1Rp4qrTgNGvANzTCt1KO6cIq36dugADaTJ/uPG/Roq/sVnwa
+ dNDOMyVmZfiV3GUnCsv+kfZA9a9zZe1OBcpe18omfFHbAi91M47pmwikekwdliswPabaf8IGCOAzRC8v
+ XHjwk6V/9/VY82VC1Cruxexlx+8WrUy9X2eXWdq69WZNj4usCS7VOrjXa+Gj0YBLII06pqnHgfzrcE2N
+ h3uCEPvjwnFYenvQNubbM+89y6sZAwFWGSCAP58/f99fliw5usdul5i3OjA7c5k4X7oiSar89EyJbtO1
+ qkc7itXYqdDBRanrH3WTBr4E1ChOUxM87t3DzrQUfC7mY19cJHziw8A9GYq4U+G4k58GvT4fNC1lFSvh
+ Y883GYP2Yb6/PSVKYqAmaOASsP1Hr766992PPvLZZbeNH2h3NEtCFkrBigRp1SpJsXZ9rqJr+/1GOMt1
+ cFbosVtJRq1qxqGG4XIrKoNTegYco/lwFYbDSxQKX3EIIk9wkXP5JBobr5kgjbCjvebeTIWzKHrE4+x4
+ UEvWgPIYa+A9x3j+unw1HMtbsEXWiu1yPb6saYE7AR1Ju0tq8FlmDjZECeAUEQa3qBB8LQxGkDAQkkwh
+ 5PLzVkNaMiFXXIRjkD++lDcOYtlaWM8YCGYN2O7LEDmUtsKlklTAgrbweIhLDkVh4Wm0thZMGuhYRphq
+ fRHMgePNUhOfQ34DpglrQ/oNeGSI1txvg2Opfkw5RMejsCjriaGb2h/gVrMMSXW1ECsbIarRELUQtcGH
+ 1NPSNIJiebA/ncsyrrmhxrToWp7JwMqCdmyQto6qtSeykH0lyeJBFPpiXGioRHytCnFKNWKVzRDX6Mlr
+ O1LraORrOqFtp9HRMVhiYsSSAeZzSXY81vATsfKKBtMEdQMGSIWW3OiA3e32EbUy+RbiJNFjHuCwrA1x
+ NQZ820CjQtcJwxDAocBPaoAxcfd+FhYHJDIGwkwT+OBKB5bnGYbpb6dl4AhCLKYjJvCWIMf63NoJGAz3
+ cD4pGPZvvo2tz72kXUtR/2TXwDsXaHx8oWOQPjyrhosfxyI8k8rTNnDzjgQhCQI4bFoPLbl9yyNqIIqg
+ qPOsgYVZD/FeZqdJtukG2B/0QXv7vadqwGCg0U4kqh6+BhSKHEQkRsErIR5H7skQ2Qa4+fmjj4D3EgmJ
+ 3CgqlzWwIK0Lf0x9aNIyj0BoNDetgh/vBBhoFpws5rY2Gq1ERgPNzTcRlyaAd4IYB3KustDmCiSL3c1h
+ HQ7MfQ3v/3n13V9T1M8oW/cM0WsJ3VhwvIvVBx4CVFRetBreWgMmaCN4Kw09kbbFAPfUb+B3Uoh9krPg
+ abqGgYeoDPBKSwMvOQZXriVhoWs0poU1CPoXMTHwsqgb8/jd+JOnBNfvnB4X/FgGRoPW62nkXS9AQHwy
+ 3E+mIUChGQYdru/FV+fOIzBJBElWDLlwfnev9OauGNiENkSbDMyJeIzfeN5CSmb8uOGHGjD22rwiTNIM
+ tI4oIycP++NT8XVB2TBopi7eN+7CJzEW4pRIqFR5I/IscBbChtcYYzLwk2M9eH1b7BPBGw0M7XWrGXSL
+ jkZLCwN/FQezh3ebU65iF2t4QgSKijMtcsx3JBMIaRSZDMw42ot5m57cgKja0L8gB3rNJK1joIm0BLxZ
+ SyP928vwzLhoSp3p9b6kdPjFJsPjVLZFaPMr9etbRLA5phabDFAHgV+uOz6unZjvUFhlYOthDq0l0Ay4
+ ppnGEcld7OSlQXA8FTxxMgLjUiBOTEdVjQ715OrNl1t3K2E85m83xMImUB03eQYUBjZpY9oMNKMmDQ11
+ E41L8k48e6IPaSUPoWqkWeh6FY06otp6YqBifAZ+t9HcwN6z4olOILrSwAKbQzcS8EY1jQYCzEAfud2N
+ 2Sf7kFvRyUIzUpIbvJpaGlHjNPD6RrHZBCbBgIAYUA+kzUITMdAqJmkiJuk6AvzXrMd4JbkXBZX94NVK
+ mtSIRqTM+gkUSM/h+c2XzQ2kiyY6AX6FgYU2pm2CHqgImzSRVEHjxcRe2Gb0oIy8V1TTqCSKJN8Grbmd
+ ZrZZvpsLag8m10AUMTC01wy0sSJs0gNpSx48xFtne+F67RFkZBIVxEiElQbSshIxa2vx5BuIlBmG9bra
+ rCIKUhMm6coqGnIibkEX1l7uAb+wC+VyGuFllifQ0VGId7fyWPhJn0B4uYHttHmvGWi2IgPQTNIVJHEm
+ 9dIKGr753eR50CNkFj9EeKllA4H8CDzjpH5KBkoNpooYe80kLWegiRhoJmlGZQS+VEa+XpbRCJN2Q3C/
+ G0ElY38n1mpvY8EGvgl+yATOTHgRhxIDTEWGQsuGQDPgJeU0igl8fimNaGknOA86yFlIPeYidvEOALWr
+ 8ykaKDGYkjamzSY9kPZdApxQRINX1I6IUi2EcjWSa5SoJA8BLJ19Ksmt/SvrEwfBT/oEuMUGUz0KScIM
+ LJfAMotTUNEPK9eXWIQdycwaF29Qrr2WDdg4N2D5jqPk8d/1cR/IqbAdYeU6ckVVI0lZC5nuyWDNDVRX
+ X0SEMAjPb7gwDH7QBN7b278G2NPT7h78fkMEzl1KHbcJS1UY7XPmydv1GynghAZjm9cxLHUJwx828vHC
+ +kxQjg2D4Q/0YYZfV+cs/1bVFH77jv5no+YGBs6xL2y+hP1B3Ek3UVWVg/gUAb44GoQ1e0Px7vZI/Mr+
+ OKZvkoJyefQd7F5gqvfjxzMDOnQzfVvKqED9Kep4zwHqDGypHMw0/1VpRAPMNKY6NWCpMwf19VfHbYRJ
+ Ne9aKry5wfjMi4slLpGYv1GI59Zng3LSDE21b4bfQ3qWX2v9NF/tNSqCDqNSsJGAzrXm569RDbCVIovn
+ DQcBzp5PHtUE8/gjhjyzcT3KxWq3cCzaHo256xIwdVMRqeTj4an6k1Q5LaUk1VSSqieVjncI7AxrYEfa
+ hnp/hAoZL9fG159uzsNefy4u5aXiUAgPm73C8fHnAjC3tT+2vwjKuWV4qr4kVV993TSONo+kyiWpOhDQ
+ Xzwp6Gj/Z5UBxsiUf2sxZXP54FOaW39XZ/l3tMzkaEumBOiTqPgeD5Lq2xNJdTwmrTZAHejrm9Gfai1J
+ 9TIV0RlMUl1PQF8azwEne9vhBvpTfTTLz6AlqRaTVBNJV92ps1hEYKdPNsBE90e9sSfTaWZwm8qGo82l
+ IjsDSarrCOiLE93xf+v/v9e/1FsTwv8NWJPS09zmP/rAGm4g64OPAAAAAElFTkSuQmCC
+</value>
+ </data>
+ <data name="Hue">
+ <value>Farbt</value>
+ </data>
+ <data name="mbox_warn.png" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAABcQwAA
+ XEMBOS4mtwAABLtJREFUaEPtmWtoVEcUx+/efb9ujGAKtoKk1mekUgkV+1KkSH1QlYjUZ7C2FcUiVTAF
+ BQWr9V0q0jaIQbSUBFrFKGpFUPCB+EA/aLW11EdbTW1Sq631k6fn3Oy4s3PP7p3s3phdMPBPZvfeu/P/
+ zTkzZ2bjAwCjpH8IoJT1RMxjhEOdNUidAoCGN6HQs52e9Ku+ZADQ7LiUaTIua1pnQHgaATQcQf2UBaAN
+ 3+/lNYTXAF9mMS8isbtoAdD4ZNX8K6/61TSi1x95CeFJBNBUd9SvMsCQl/xw92EZvDk6wEEM9QrCK4Dt
+ 6ujvPxy3Ac7/kIREImMyE9CJogFAMzNV83VLw7Z5oS31US4Kn3oBUVAE0HhPVKsMMGx4e+qomjYzyEGM
+ KRSiUIAmdfSPnEiwAL+1WtC70lQhfsbn44VA5A2AHX+gml++MsKaF9Fo2h3jotDwxAHQeB/UAxlgxKhA
+ TvMCYuGiMAdRmy9EXhFA483q6J88x6cONx+qX3bUh/v4eZX5QHQYADtaqJpfs4FPnTv3LSCwU+cT0PbA
+ ehwhmidMxd7X6QDYaZXa8Vtj+dRZvT4CZWXp9b9qsAm376YhVq6JcBBLOgrRoQig+UMyQCxm2IVKTZNN
+ m1lzoK5QY8axVXpYRyC0AdB4nTr6n22JOsy3/mtBxTM+x+gGgwZcb0lHgKAvXk1Ct3LHvWc8B0Dj1ar5
+ iTVBdtU5fobNb5hRy99f38BW6Y26EFoRQPPHZYDy7j64/IszdWhUv93jXOsty4Afr/P30zO174a4+fC2
+ DoQrABpfoY7+V9ucqSPmwRdbnSNKE5ZbTsV7f9yz4IW+jip9A/std4PICYAf8LpqfuoMPhWEmeWfZE7g
+ vv1M+POfzNznYHbtZav0zkIBzsoAzz7nc0xE1cz8DzPT4bvmmFaFps9ZXMdW6fdyQWSNABpfq47+9m/c
+ zdRMSe86x47X217IgzDceYp7iD76ZYNgAfCB0ar52e+HtEbyjZHt24RwmK8RueYCXTt2ml3FvtcGwM79
+ qEsyQOXzJrT87Z7HZKD/gPbJSOngZjbb9bUb2UK4lINwRAA736yOPm2Ddc3cvGPZ80Te++g+K983YRJ7
+ AHpNhcgAQOMTVPPzFuilzo7GGNBB3jQN+wy8bEX+ESCQK9eS0KPCUaUvZAVA40nUNRlgUJWpNfKr1vF7
+ n6s3sxcvnag07GSr9OcyxOMIoPGt6ujvOdD+zUIu0dygTZ36LFVr2k67Pe92fc5ctkrXCAgbAH/eUQ0s
+ WqKXAr+3WfaKIz8fChlAKeVmTuf6X/9ZMHCQo0rfwv4qUt6NHviiRTYwtJr/ZiFbh427YkDr94tDTJg+
+ K2gfYnTM6d7TfDDO7ZUaBcDX6ugfOuqeOrqde3Xfx8vYKj2P0scR/mTSABKtJkLxuAFClPNC0agBpEgk
+ LUopIUonIToTCAUCBgj5/QaQaAUT8vkMEFI9Sq8fOQBy3MyFsevfS+VR1xtRMkF7IEsZwPaeAuiGxGUp
+ WfhXiIqbUALbQnFsC8WwTYpKov/UCIWxLRTCtlAQ20IBbJNoHyZkYlvIh21bObcSboeHYrzueqQsRtPs
+ VqLYjWqfB0oN5GkKdXXEnkagqyPwP76kA5sYKmTOAAAAAElFTkSuQmCC
+</value>
+ </data>
+ <data name="monitor-planet" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAD6JJREFUaEPVmXdU
+ VNfaxo/GfBo1GuONuUmMJTHGllhCchV74VOxtxgrKkhVFCkWlEAAEQQB6SoggrRh6EMZemfoAlKkqiBg
+ A0VABH3uew5CBtCgN/pHZq1nTTtzzvPbb9l7n+kHgPlHP1iAf7L+0ea57HnT0S8tLR1cWFi4Li8v74Iw
+ WZRgGO5RrRXk0awf4HffIyg+OzQ03Cc4OPiAv7//mDc957s4rk+AysrKcQXFpS7qwX7PJnvK4XOfORgX
+ NAUTQydhsnAyJgknYYJgGr7ykcTXHqsh6ayF85f5Oa6urmvehcG+zvFagKqqqsGFZcVWOwU27R86zsZI
+ 388xIWQCZkXMwoKYBZCKk8KK+BVYHr8cS2KXYHbUbEwNn4rRwaPx0dWxGGu/E7oOVhm2trYz+jLxd75/
+ JQCZH+eeGVU83GktGPdBGBU4ClPCpmB+zHysTVyL7anbIZsuC4UMBchnyEMmTQabkzdzUBKREhgnGIeB
+ /IFgHMdhkdWhNjMzs23/i8mV50uGTTtwRWLinvN7f1RwsJhxwCVohrpvyiyNwOwZshZJr6wBMj/9ckxR
+ Qz/b6WB4DD7x/wSTwiZhYcxCziRrWuuaFvSu6+F04WkYFBjgZN5JHMo+hN2i3ZBOkOYg2Ej04/UD4zIU
+ X+nJw8DA4ORLiH52SbWjNGzD58qe9pBXNPGyUTIPDFGxjkhRsY3KVrGLLlSxj61QtourOWwf/cDQPemJ
+ e0zBC9GNu7jb2Ib258CLF4CdnV1pLwAy/0V4enXNB7P5YFyHYoDPAIwVjOXSY0PSBihlKkEnXweWNyzh
+ VOGEqzev4krlFdiX2cOk0AR6+frQTD2Og2GaUA/ShXaQOfQEF2Ho6Q8Lj2Q4ByXfdRKk1TgGJt33jkhr
+ jM8ueV5eU4/m1uecKXG1tDxFUVExQkPD4OPD7xKPx4eb21U4Ojreovmrf1cKkfkBafm3M4ctuA5mVBwY
+ q18wzG8YJodNxrK4ZVyaHM89jvMl5+F5yxPCWiES7iUg9m4sknOSkZ6Xhbi0ZCRmiFBYUo6HDY1do9XT
+ HPu+ra0dFRWViI6OAZ/v2yUfn47XQUEC5Obmo7HxSS849nsvL+8aAhjSBUDdRvHn/WVghoSCmV8JRm8/
+ RgaMxHThdKxOXM2ljn6BPpwrnBFeE47chlzcarqFksYSxKXG4TmZ6qnqOzVITEqGr58/fH39OPH5Hc8B
+ AYHIyMjCw4f1vQy+Clj8MxZAIBA8IIDPOAAy/7GFW0kD82EAmO8ywPx/NZgDzvjM7wvMjJjJFa5ypjKX
+ 866Vroipi+GMt7S3oK6lDsL4CLQ8A4SRsfDhk1nWsF8AUlJSUVtb99YG+wLgUZQiY+IbCWAMB1BSUqL6
+ 5TwyzviCmX0DzOoaML/exKdXJbkIrEpYxXWbP67/AcdyR4TWhCLrYRZKG0tR+KgQfKEvqu89hqs7j4tC
+ Xwb+7vee3r6IT8lsI4DvOYCY1OJk5qNgMB/4g1lBo7+hDsy2+xhqK4fvQ7/n+vxO0U6u+5wrPge3SjcI
+ bicg6nYehOUFuBIqRGJ6Ljx9Bbjf0MRF42kb0Ep61k75Tp2D7R7vCs7T2w8p2UUYMmToLIaWB6MOW914
+ wY3+iIiO0d9yF8zuB+h/oByjA2bil8hfuDTan7EfJ/JOwPS6GxySWuCc1ArH2Kew8a+Eu28oYkTXkZJV
+ gPpm4FEL8Pgp0Eh60go0kZoJrAuOwP5XOE+eH9Lyb+KbCROXMrm5uVILD1LasACfRoJZWwtm6z0wex+C
+ UX6EoQ6a+C70O8yLnof1SeuxL30f1DKNoC3yhm5qIHTSXOm1FRzc3FBQ1QQ3nxDUNgJ1pHtPgPukB03A
+ QxIL1kBgr4WjiHGRewnHRe1l3xdPOw8CyKR5YeqPMzcxWVlZu6bJFHcAsCm0hiLQCaDyCMyxWnzqs4DW
+ PhMxJ2oOt3zYkrIFu0S7sDdtL/ak7cG21G0wv2yHG/cAG2cf3KwHbpFuNwBVpOpHQM1joJbEgt3tCUdg
+ r4PrFrWXKXnVyw85lU8w82fJfYxIJNL8Vr6qA4DVgtKuFGIUCOBwI5g/sjDEYxE3qf0Q/gM3sbEzM1sb
+ i2MXc9HRtTuN/BrA8pIPB1JCKr0PlD0AykkVD4FKEgdG6gS78zo4ihgXOTG4xxQ9NiWvePgh985zSMxZ
+ qMYkJSUdmXaUUobx6wCYktVVxMzeejBKLyF0RejvsghDfIdwa6PxgvH4NuRbbt3zeeDnUDE9jKwqwPQC
+ H3kEwsJcrwUK6oBCUtFdoJjEwREYC8eBkViwm51wYlHrBUfpyKalk7s/sqqBOQuXH2fi4uK2LzaitBmT
+ 1AEwlCayldSJNlEhb7/fUQvyDR0gahSdS8u4NVJPbTPYhZSK5zjjwEfGbSCTYFigbLpQDunaHSCXoDg4
+ AuuEKyK4LrDOqPWE65GSF9z8IboJLFy+/ncmMjJyyeZz5WCWi6XRl/EdtcBCsPWw4wHXlRgZgjkSCMbr
+ o14A8/QWgp9QBn07PpIqgORKIIWUShdiL5Z2C0gnsF5wBNYJ1xU1AuwVNTE4e7cgxJU+x9LVvxkyYWFh
+ w/WcU9oYFZoQJoj+rIXJlErSd8Cso660keYFFmYziX22XdALYLzhdJg4BsHIMRQhec2IprViLCmuDIgv
+ BxJIiQTWBUdQHByB9YTrFjUC7JmSl7wjEZzTiOUb95hyE5k3PyBksGorpUo7mJFRHRD9qSamXQMjRZFh
+ J7eVBMMCsc/aR3sBDNfeApXjlnAQFMIhpBChRUBYMS0vWN0AIklRJUA0KYaFI7BecBQxLnJicOkE2DNq
+ lwNT4JFUB+mtCuc5AB6PJ7NMn+YCNgq7msAMolm5syt9QpObBLXZRbfBLCYtukV14dQdwJHW/lL+2KWk
+ B6+MZpyyD4N/PhBwHQgkBRUAwSTi6gAjhb+Ei2DhCIqDI7BecOJRe5mSbmHXcEFYgVU7DtpzAO7u7h9a
+ XuKVDzz4rANiPeX94JA/IfpRRP6dAGZ6AZj/UL3MzQPj0/9PCDUFMJMKsW7bMXhfA9TN/eCVA+41Lxfw
+ IfHzAF+SHwv2Ei6I4FgwClpvOAIThxMWtsLcIx4nLXnQOOsOl6RHWCuj4dS1nKYNwsb1+lQDLACr/W00
+ 8rQ3+IBWqJ3RYJ/7UWp9RHBugzsATKeAGRbEHbd0hQrcsoBDpn64kgG4ZoJ7f5Xkng14kDwJTByOT3Ac
+ GEk8agF57TDzFEHzHA/qZjxoWgbCNqKWO9elhMc4fJZfM1d6x9lue2Ira1v/qVq0J+iEYJ9lmsFMTO8O
+ wYJc+pQgBlFEqB5eAv5nriyc0gEVEz9cFNGFSI5p1LdJzvT5ZZILgV0hMHE4Fswj+wWMiezQWR5UTUg0
+ CKbBt7jfOaW9gK5rZssOTaus5TvUnSf/vESOVqIf99pSWlhYDDEwOZ/z5WFqoeIQnSCr6HNJqpVJmdSJ
+ vgajKN2xAfqa5pDpufh+/kGYR9RD4Yw/rGjLbUOyTab9K8k+BXBIBS6QOuEMvAuhfMYHikY8KJ7hw4BX
+ wh3Dyiz8PmT1rt5cK/9HsMTSXw3+9eX4H151Y6DXXQkjI6PRJ/RMiieqFfWGEIdyWUKbHkozsc8+k7aC
+ mnU0ZE/7wzSOTJDM4wGLBFpikHS8y7Hf0Bf79HmQNfDBiSv5sEoEJ8u4dqhax7cu23uufu46BZdvfpi7
+ jUZ5UF93M155W0VHR2fY8eMnBPPVwjBAhdprz2iw742ce30+aHMM1imbQf5sOHRDmnGMV41d+tSddH2w
+ W88HahcycTbmOQfG6pRP1Yv1Rxwf/bz5bP3XSx3ah60sx7AVJe1k/F99Ge/8/rU3trS0tPqr0WPfQe0H
+ 05SiMED56V9HhKD6y9VDYpUCjnlXY/NxNyhaJcMgog1G0eCkH96KvWdCm1bK6Ves36XRNHqecfvYnS0Y
+ t7u9S6PXF7QSwIi/DdB5AkVFxWFycnK6O2X2VyyUOYtvZCMxUu46hshXY4DSEwyUv4uP9xVh5M5YjF9j
+ jMm/SL3QiwA6pepS8mKzhl37DnXjdo0zlgi7lovrDQ1wdA/Esh22mKHU1k2Tfs15SgDD3xmA+Im2bt06
+ ZdOmTepr1661lZaW9peSkkpdvHixcP78+Zdnz55tICEhsfyriT9VbdHhP910yPSZhukluAqjkPfwIWda
+ XI5egdiv6YhF6s+6SVIuE0rHjqVLrVun8CYQfd7cfZOTdB4zb+nS1crHtOuSKyt7Ge4J4MQPxCkjV2zQ
+ ae2mlarpyKypgfDatfZ1v/3mRNH4v7/y8M4A1mzdetArMupJT6Pi7/Pq65F57x5EtbVwFIRCz+gC9ho/
+ 7abNmimIpQEQ0e2Y1Dt3aHmilPhX3eidANAFPtDUN6h5nflrlEJpdXVIqKpCFJkLLS2DV1YWlFS1oWbV
+ 0k0yJxIQUFCAsLIyRN+8ifCiIkhISmq+LgrvBEBi3rzd8TduvDJt2BFPrK5GJBkXlJSAT+Y8qJCvEIDa
+ UX0o66VAz6m5S4q60XDJzIJnbh78CgsRUlKKrfIKtFp69V9h7wRg8Urpq/mUHj0jwJpnR11YXo4AGknW
+ 1OXMTNinptLElgBDa2fsUbXEea+mLqkZCnE+MREXRCK4EKR3Xj5ktY7R7YD3CDDtx1maTv6B3QByHjxA
+ MuUwO/KBxcWceeeMDNgkJ8M0Nhb6QiGOWzhAWescrgQ96dKJs2EwjIjEubg42KWkcNHYuGsfbTzfIwDV
+ wEClI0ebxCPQOfrhlMu+BYVwy87hRtU8Pp4zqB0sgKLxOWjoWCIwurFL2sY8nAoJgVFkFM4nJOLERWq1
+ S1a6vVcA9uQbN+700je1RjrlOwvSCcAWoziABQGcJoCTAgHkLK2hpK6L8Nga6Fl40sLOGgr2F6ATEooz
+ UVFQt7SB1knj5jFjJkx97wAjRowYvn27Qujps7bwiopBVwrRfwDiKWRLKWQWG0dRiOBGeo+BMRTMraDp
+ 74/jQcH4nf7QOOXnB2UdQxiZXLwnJbXmLye0d1LEXQsraqcbNmy3u+wiaDWzcsYZm4vwIsPhVMT+XBHn
+ ckXsQEXMFioLYhwdzaWLPhlXNjaD1mlzWDt4019SNoWSkguW9DWRvlOAzov99NOc9QoKR9ytrT2qrnoI
+ YWLhiNMWF6FPRatrYQ9tC1ucOGcNbVMbnDKxwe/GNnTMZfrTI6Xt6NEzotWrfzs9bty4f/dlvteG5k1+
+ 8DbHsKtKKan1p1RVT/GOHTOK0dW1yDM3d6nm8WKfOjsHNxga2padOmWapqFhELJnz0HHGTN+WvU253/v
+ AK/cQTHMYAKbSPqC1O9tDfc8/r2k0N819Ta//8cD/Bf1OK6O+/e5egAAAABJRU5ErkJggg==
+</value>
+ </data>
+ <data name="User Colors">
+ <value>Benutzerdefinierte Farben</value>
+ </data>
+ <data name="Sat">
+ <value>Sätt</value>
+ </data>
+ <data name="OK">
+ <value>Ok</value>
+ </data>
+ <data name="Blue">
+ <value>Blau</value>
+ </data>
+ <data name="Base Colours">
+ <value>Grundfarben</value>
+ </data>
+ <data name="back_arrow" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAACTtJREFUaEPVmXls
+ VUUYxVtrLJFUTZTFJUgQgooouEAxGheM/qMREo0b0aCJ0bA0smihRUE0alwQlQfiAu67uOPCYlUoguKK
+ Ii4gsgikaGmLRoz1/B73NNPb+15f+4wJvhzv5c52zvd9M/PNtLCxsbFgj/4PAXsy/jPyBXMLOghHCqXC
+ 2cKFwlUReOcbZdTp8F8ZLS8BInKocI4wVpgpzBYeEh6O8Iiehr9RTl3a0PbQfMS0WYAGLBT6CZMCwpB8
+ VJgj+PeY3uJwGfWoTzsE0Rd9FrZVTM4CEohjUUjwg+jjwhPCk8JTwtMJ4Dvl1KM+7fjRD/21WUhOAtRx
+ R2GUQIiExCFhws/o/VnhOeH5CC/oafgb5dSjvgXRTyiEsTrm4o1WBaij7sJtAq62xU0cK0MGchB9UXg5
+ wjw943AZ9ahPO9rTD4YIhdzO2K2JyCpAHZwipASsTtzicgZiQCwZkn5F/35VeE14XXgjAXynnHrUR5DF
+ 0J+FMA7jzYJDNhEZBaghS96DAXmsg8tt8Zf0joVNGsJvCvOFtyO8o6fhb5RTj/oWQz/0Z48wDuMhAs+X
+ ZhKRKEAN+ggsdawS/Jh0odWxHBbEoiYN0XeF94QFwsIE8J1y6lHfYujHHsGr9gbj8mPu9UkS0UKAKh4u
+ 3C8QNnHyuBtrYTksCAGIQArCi4T3haoIH+hp+Bvl1KM+7SzEHqF/xomLmAG3uIhmAlRhL2FKRB734UZb
+ nk6xEuSxOiFh4osjwh8WzCio7jm+90/9xh2/Qd+qAyzV+xLhI+HDqD7tLIT+6Jf+GScU4XC6GY6hiLiA
+ waqAu1htHPNYwuRx9VuR1QgHLIllIbTkoKmdvqmYMblh09baxrLU+Fp9WxHDcv3740gUYiyEfugPb9C/
+ Q8oiPCfgNThRgApKhHsF4t6rDROWmHTYhOSxHuEBkepjr++/Yd6C+bu2/bazEYxOjduh758H+EzvK4VP
+ I1GhEPqhv1AEnmBcxocHqx+8CO8Si2jygD5eIjDjCR0mDxsNqwIT1mGDhRiEwbDeUi10y8+dMGT7mrUb
+ 08SNUalx9SpfFeBrvX8lfBGJspBl6X529xeKcDgxPjzgAy/4XdpMgD4UCaH1cVkYOkwwx7wtv7RwZuEn
+ l065onZLTX0z8ogYlRrboDbfBVit92+FbwTEIASvfCLgDUTYE8wtxmPccD7Ay14oSp9l0v+bW9BXIPZD
+ 68dDh6WPWE2HTdEDRZ9eecvVdVu3N7Qgj4CRqbE7Ve+nAD/q/QdhjYAYvPNlTAThSP+Mw3iEbBhKoRf6
+ hgKGq6KXTWKNmPPEtfUJHZbAj4rvK1454vay+jBk4u8jU2P+UN31wi/R82c910WCvtcT7+ANi2DCE06s
+ UozDeHEveC6wvF+5+zS5Oz2eLnjy4qYw9rFCk/WLphetGH3H2IZs5CkbkbruT7XbHGCT3llaEbVWwBuI
+ wBOEExOcVcqhFPeC54LD6IE0d/1vfyFcOnGTw4fljM2KmHxfU3zJBeUX1bZGnvIJqZt2nThpwE7jpMqB
+ DUK9UCfUDqgs/X1ARen2ARWDagZWDNo2sOLkLaUTT94sbDxsUjdCDC8wLuPDwysS/FjiWVL3RwA7b3z1
+ iYcPm03VqWWnbd3w6/bEmM9FVK51zrt56BbGExg3HkbhPOiOgH6BgDD+SdJYylg6F/YZ03fd59+u+SdX
+ EvnUO2/qEAQwmRHA+PCAD4b1PGDB6Y+AMyIBTAwLIDNsEnBI5WFfvb5oQdMmlQ+5XNoGApgHoQB4hRP5
+ DAScJsRXoFDAu8eW9/sxvlHlQqS9dWICWEDsgbiA0xFwXGseUPmiiyZfVtNeQm1t1wYPHIeAbrnMgX2m
+ 71M97ckZf7SVTHvqRwI8ibPNgW4IIIlL2oXZwsNNrKr7lB7fvf1B1d+5kNq8bUcjK1Z7cO6U870KxTcz
+ lvdwFSrxRnaPCpxCk/8n7QPpBK7nxF5r36pa3KqIa+4YuatzeZcdQl305L228w1dfhNqhG1dru/6q7Cp
+ y/iuvwjru447eK3wQ8nU/chiGS9pH4Af+8B9QqFzoWH6R7gTk8g5C222E+v70iMm9Fz35uKFWUWMSI2J
+ 78Qb1ZadmJTCO7FzInZistPWdmJ4eSe+PMyFeiesRBlzIdWt7lF+xLqn3ngp49Ia5EKkDsDESerIheIJ
+ HbkQJ7hcc6HeoQDyobtiYZQpH2JykTUuO+DWA1aX3TW+ISmdjrJRyJKROhN1EkdaHc9GSeTol/4z5UEO
+ n2mET5OAKKUeEoRRpoyUmAxPYst0d7HyrBvOqfls1epmu3SW8wDEfbAhgeM8YPLZzgPhqWxo0omsOPJC
+ eJi3F7wrk5f4RObjJIOv6DWx9/o5857+KzhS1uk7BxcD0qTOPsiEJzKfA3wi8wGfcZ2FhtYvbiEg8gKX
+ WfFdOTzYODcKRRCzxO7HHW8rWXXtnWV1LKHRmZgTFysKT5+JsTjx7jMx7eNnYh8n42di0p1B2W4lmAvl
+ AksqRzdmvA83PtiHVyq+B0rfSqSFzC5YfvqEwVsurhwWv5XwjQQeQ7BvJXxP5GNkSN7Jm1eeCrVrdgWf
+ dLHVSZXuFsJQ8vk4LoI8hYwR1zP5sCQWXVI8uQOhwuEkBKRtcerTjvb0E94LMU78XohDV6esF1tNcbU7
+ veDEk0kEscku7WsWCPieCFLh7RxEDb5T7nsgXzHSD/3RbxJ5rjlb3Mo1W4VaKJtbcJQazQpEOJyYE74b
+ 5cBtIVjQ14yIAeH9qL/5OpH6Ju7bOPr1PRDjseNy2Dq6TZe7gSeOUWO2bHuCTn1fhIvjQohfSIU31BA1
+ +E459XwXSs5FP/Tn+x+TJwrStw/tEhCtTAeqk0rBE9s31UxuBrQQXE8IYE3AOTYOlzlUQuL0x1JJ/ywg
+ NwoH5fUHjsATe6uzywRft+NaNjsGZGAmOa5HDIcOiAFEGf5GOfWoTzsTpz/65Udutndr5LPOgaTG6pTJ
+ PVLAG/wYEIvhcsQk/Z3MfxvjacLUoz7taG/ioxgjF+KJG1muDSMhI/T0bQYutxgsCbFMoNykaYdXMUqb
+ iOclIAitfTXwicJwwWcKJrx/EDT8jXKSMdqcJOybq+ESoyKfxglLL5tgT+EE4UxhaATe+UZZi80oHw6t
+ /pk1n87/j7Z7vIB/AbqI4PWoWfWuAAAAAElFTkSuQmCC
+</value>
+ </data>
+ <data name="Color">
+ <value>Farbe</value>
+ </data>
+ <data name="Abort">
+ <value>Abbrechen</value>
+ </data>
+ <data name="folder_arrow_up" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAB6pJREFUaEO9mQtQ
+ lFUUx/+77LJP3o32HMvUIqxMe/hEGlHTMTVSS53M8UFoTWmDItSWGiMWkQgLu6CwmbtLigpJVgrjjFkO
+ A6mlkZQUmNRMNb2cqWzSbucu7bIL34tlF2eu7Hzf/b57fvece8//nk/FGMNA/1NFq25kl1hnSMblAAPZ
+ MBGzkIvvMRuFBBDZ37EH1njAiJdwEmfA8Am159GIB/BgfyAGFmABbDhNhnMAb3PjF8zBdvKGLhiQAQPA
+ BMxALX4PMN4LcZKAMj3emNJXiAEBoNk1wEJB4z/zQr/34Fekoagv3hgYgAUo7RU6YjDcG1lowlikKvFG
+ 2AEodKajRiR0pDxSTd54FFbyhl4KpM8A9EKtVouhd9+Nh1NSsOKmm3AXXVMLDcIHp9Bplg0dMZBT5I1s
+ 8sY4TBODEASggQcnJWHGtGlYt3Qp3sjMhPOVV3B42zacdjjQeewY/m5rA+vsBPvwQ1xJTcVTggALaAZ7
+ 7jpy60Do/n78hnko4Wup5zgegMREjFm5EuUFBThhteLrAwdw6dNPwb77TlnLycG7vV48HlNxgAYOxmD+
+ DIFrDtDfreig3NGADDiQiPm9xiEqVW4uzis1VqjfoUP49frrMdz7ck/o5AQXOje4wZ6qAMvfDbavBmzY
+ MKRIroHbb8e9J07gSn8A+LOvvYYTNBHuwkIcnfAcfgaP3yBmf62t2+vffAM2bhxWSAKMHYsVFy4oCxUl
+ kG9/ABZd62f8cbDBlWBG/2sSYBvKA22ZORPZkgBjxmBea2toAPiMjcwAG0VGpFEYrH8TrKoOjF+3VoFp
+ 6+W98lxZoC2LF+NVSYARI/DgKXK3ktmV6/Pll2BSkzGlSB4gvQfAqlWw+62tG0aP1syfO1dnWb3aYEtO
+ 1i6jTR0jjh7t/xqQg+P391J46Q9JQyy2gn1A/RwONaus1LCsLF3Hli2mY0VF5ra6upg/WlvjabKvYR0d
+ CWzyZG06P1MkVFfjNyUGhKLPJFqkUos7ZZOGNTfHUY5J8Bgq1urrYy/HxqqGcwC13Y7OUBjX8x0tLWB1
+ tAbeektNTcN27dKxaZYISYDZtkhJw71AxcXm8zwFeBLZ9u1oDRagowOMMjNzu9XM6dRQi2S7d+upGdnB
+ g9Hs88+7XO5thU4zowwhCjG9VBlAbq6p3nMc5v+9/jqa5QA++wyspkZFhkZQ01LTMZfLyPbsMbPGxlh2
+ 8aK0y70ALS3xLHaXOEByiVaRB9auNZT7APLycFQI4OxZMLtdz6qqTKy+Poa1tSkzUip2+b17SzSiHrif
+ 7sk9z++npelyfAAbN+KgEMD+/Sraw0NjtL9RC206UYC7rBGyAGfOxLOkpIipPoDsbLiEAHi4KJmNvvbZ
+ VGHyiDWh3WhEsVp2TKcz+kdawCYfwJo1sAsDKFtQfQVobIpl+reFAYYoACgoMDf7khv/kZ6OfGEAg+xs
+ 9NV4b//EIuHtNKlY3usWi7E6AGDhQrzcE4ALvL17TWEDSBZZyJOs8os4PV3v00eebZQU3/M9ARoawE6d
+ igsbwOyySME1MFsmD1y4kMCmTNGuDPDA+PFY9u23gYKOJ6Zgw0PJc09WCO9ES216yXEbGmIvx8WphgYA
+ 0JEyle/5/l7gyUqJIcH2yXDoe3uAkuWLFUbJcW22qPP+8toTQqRIbzt+HFcDAXRhBVi6s7cHzHvBmmiH
+ kpqUrVu7JESAB2hPvaa2NlCRut3SMxHszHufe7y8N4CSLLx+vbFMCCBi585uRcp1z+HD0WH1wBx770W8
+ rFQ6/jn8Y4/pNvQC4BdKSroVaXW1irW3h15C+HstlURbQCYmRevYFyU5aWfPxrNRozQBBWBfLFE1wadI
+ XS75vbi/IXQnJSx/gJspA/NTltR73e7on3oWt3wAVBbxKVKXKzwSwmscF4iD7KpuANJFq2S2T/4sHSub
+ BCtz/CLVdN7x7kIuV/gkBDfk/YYYpnqvWwsNK1UrkuqbN5v2iAJYLHBygPZ2LiHMYV3AWypJjVLp0hNC
+ jWCWSmU73tNPG/JEAdatg40DHDkCdvp0+CQE98AzOwy+8BldqFF0muMSYvr0yOWiAKtXdylSlyu8EoID
+ zPs/B0RQoaukWpm3Gxpirl53nfpmUYAnnoClCyC8EoIDTCzvOlJOLlA+Vnm5+QehCp1vF5ozB2s4gNMZ
+ XgnBAYba1cy0D2z/Eelkee5cPJVlYv4qLY1qz8gwuCQBJk7Esi4AZQsq2DzQ1BTHoqn6tr6ia6fjhQIq
+ GPxTVhZ1kU5aTRs3mmqefdZQMn++7oUJE7Rpej2ulayNem+OHImH6GuLp/oQrHFiz/EF+NFHsVcdjqgf
+ snMMX4xaEPE1lUV2LFqk25SSol0yaJDqVrHPVFLG+87E/IfBgDtKS1X/ymVDMSN5KZCXBKuqoi4VFprP
+ 8cJTZqZx15Il+jw6gKwaMkR9T18+n8oZHqBGPSTAoPx8zd9ys8/1SG1t9GWr1XQxL8/0cVaWsWr5cn0B
+ bXFrExMjkuk9UUoHD0W/bl0NaPLzdX9ygK++SqAKccwVu938c0GBscViMdTRObR41qzIDSSmZnHYUAwe
+ incEfKWcO1f7xiOP6F6+7z7NoshI3BJsXIbCMKXv+A8bjZ++/ZSOlAAAAABJRU5ErkJggg==
+</value>
+ </data>
+ <data name="mbox_question.png" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAABcQwAA
+ XEMBOS4mtwAAA1pJREFUaEPtl11oUmEYx/2aigx30ag2XXURYQwTkiBDMaSrugi61CBidhVaKUF4M6Iy
+ ugga9kHBRqMkKiq6ihYYMYqtj6tiUBch0UAq4oSY0Nbs/4xz4PBybJ4v5wGFP8ej7/ue/+99nvO872tu
+ NBomQ38IwMgytPnl7DHy7HcBOiF63RQSRwHlOAaN9fb2vnW5XN+dTudvfK95vd5v4XD4/ejo6KNqtZpD
+ n4PQdsiqNoqaRACmh6E3EC0q/5Xb7ebS6fRYxwDAcADiVjIu/t9sNjcSicQsIE5DATVRUBUBmLJAH+SY
+ F7fN5XLPYJ6isVcphFqA/UrNUz+8H3WO467wEDuVQKgFuMEC2O32xWQy+XJmZuZmpVK5Vi6XrxeLxfs+
+ n++rFGyhUHjMA5zHtUcuhFqAV6ypeDz+mjd0Edc9UD/kHBkZGUTbRbZ9KpV6wbenVBpuN8BH1tDU1NRt
+ 3tA+psT2oO0ftn0mk3kuAoi2G2BWbGhoaOiHyMwgA3BAKoUmJiYeiPqE2w0QHRgYqGDRqvn9/i+lUumW
+ FACM26E5FqCvr69Wr9cLqwbAz1YWVxLlsKBTzOxfZc1bLJalfD7/hOm3pa0R4B+2GVcSmaZKchRaLxiB
+ 8ROseZvNtoBtxVPG/Fncy95aqKpCK80WjFPe/xUDYH/E3cOHMX8J97Q3ku1HdodWHwLTG6FfYvMOh+Pn
+ 9PT0JGOeyu2OVsdl2+kJcJdNHabi0PtyDtqk1Dz10wUAxtdAC2IA2jZI5PxaNeb1BIiysx8MBj+rrThS
+ sHpFYBsLkM1mS4YBWA6tyXSHIGjvHwqFPtVqtcsiACq3mkyeJoM0M4NqGaQdKTPz9PIeMQQATNJ+SLxC
+ C99l73maAesaAf6hhxiIw7iXveK2FQC53w8dE4SD/EmPx7MLJpxapY4wjuYRgGk6J7+T2DrTqhwwAoBD
+ at/P/3a8C8CUXz1SqGkEIpEIHV6i0AatIqEHgBXpMs+mkdVqXRofH3/IV6QLuHq0gNAcgF+Ft+LQMhmL
+ xeYESZy+dncsAG/M1mQRExazLsBytLUIY5MxLPj9TJMo0BFS9gFe6jl6AtDY66CEhBSdf1cDQO8J0jWF
+ dDev9zvQBWilwLRllloxorRNF0DpzGnVz/AR+AcOBL1o7Kmu0QAAAABJRU5ErkJggg==
+</value>
+ </data>
+ <data name="Yes">
+ <value>Ja</value>
+ </data>
+ <data name="Bri">
+ <value>Hell</value>
+ </data>
+ <data name="Cancel">
+ <value>Abbrechen</value>
+ </data>
+ <data name="window" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAfNJREFUaEPtmk8o
+ REEcxxe7J/9WbvawVxcpBzkhpUi5OLg67EWSFAclxcnJHrW5UFw4iDO2uMiKZ6WltSVa689jd7Nr/6j3
+ NbslntFr9Gqnec3W57avme98f7/vTO9NGQCb0L+CAJEhi49WgiYo4wUBneXlRQGklsTBbi/OeVpcAQ4p
+ gG+52aUDnBu+4mcTO+uQb2oBRKLGiQ+SQqPFFOrqhXpPdjOR6BvAC5l7jxTAyzVrO3AcPMHG4gJFKHrH
+ 1CcrCjCyThPOsvXZEeZwiCkdCpZ0Yxs6cLC/C9/kMEXw+opJgGeNbHJDNEqCTcA26rEJu44ddEkBkA7I
+ EvruIdnERhsY9xS6Sb2hkPm/uc1lmWJ0KwzM79FEcmwxeoZlnMKn4wLb7DHK63jwn3GtfZT4z0rw+q90
+ gNfKf41rcQfSaTzEYhT3uRxTjJbCHUMHEl7vny99VL+fScDE7AJc7laK8yeV6fnGlya4VLeO/uQg+z5g
+ VoBnbIa8Z22gUGKPTAKqn2phe7TpaHvtkALAWkLSAVlCJlOIewm9rq4i39xM8RwIMKUIdwFmN6LIewah
+ eJIiqmlMC3CpJRDS4jrC2ht7jJoVUIrnLX4WEuBVu3SgFHVuNIalHGh3OJCprEJKJMics+QTU7fQFz2K
+ N21EvqlSmPsn8UKYLq/+Q1MAAAAASUVORK5CYII=
+</value>
+ </data>
+ <data name="folder_star" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAACKZJREFUaEPVmg1M
+ lPcdx//3fs9z99yBEJt1WzqTrc2SZmk6a+K2LpvGtGE1jd1qRnWmXRpaK77WicU5GOCqgnIg4AsHihYq
+ xyFUsWoEkbM4DirH+/sd9waKAqIyqw3+f/s9d0B5u+OgGK4kv+S457k/38/v/3v7P4cAAMgP+ocH+CHb
+ vIqvWK3+HZrYmwPxuszb9XkFMIaqMyvXqT//+u8q4VQiq95VLTKuVRv9FuBGmKrUtIGjNVu4zNqPOcFY
+ oTVbuT+ZNnJ91R+qHvktQO02zlq/U0kbditpY7QihRfaFKMQNv1bEdf4L+WT+kglrfsHN+iXAHURSgmK
+ HGreo6Ct+xW07SBL2zRscruGvdyWyNLWBJa2fKqgCDPglwDo6Z/zwtuTWGo+zFBLOkM7M4dNy1DzUYZ2
+ pCDUAbZ3XgGwivwULaTqPdUKUzj3BwyZ36L4JejhDzpSUXAGQ22fyan9tJw68mTUqZdRhw5/z5FT6wk5
+ D9Iz5wDY+KRoCl/6B4pXGNeoG258qKK12zmMdSVtjWdpRxrjEujIldOuQhm9+aWU3rrktpsXpLT7nBuG
+ h7McY+5jeNViuBXWf6I8iMm9CR2yEtdWT1lGUZyYZcnzS5eSNaGhZOeWLUQTHU1yEhJIyeHDpCE7m/To
+ dKR/82ZyDe8dVz2mLIfvqX5p2sTd55OyGeO6/RDrChdePC+0p1hK71yT0DvXJbT3upj2lkvo7VI3iPMM
+ QpzCnTjCuPKCdwBWLIoV7DMsw2IXwEsvkRe3bSOavXvJ+eRkUnn8OLEbDOSxzUagq8uzNTcT+tpr5C++
+ 7ARWnNDGKCVticfYPiJHz6KHv5DCrWIJ3Lkuhv5qEQzUozUI4W6tmPZXiumdMolrZ/jQ4oHbk1nKJz2G
+ obZ6A+fqHYRhyMKsLNLrTai3a1FRJGcsAL97zz5LfrFiBQl9/32yIzKSaPbvJ7kpKaSsNEE60JbEgCVT
+ Do48Kdy8iOK/QvE1IrjfJoRBmwAG7QJ4YBbRe40i2meU0J4SKe36YngXMOxa9ilSGv6pHN11EhJC3p3O
+ 094AjEZyf98+cjotjZzHnTPl5pJbFRXkid0+eeec+J75lBysWTJwFri932sUw71mIfzPIYBHfQQe3yXw
+ 8KaQPugQ0bsm3AWDhHYXyaj9c1dCx0/cbbJmDYmYrfdn+jmbSQgdRxiwnpRBVyECXJFAX5UI7rUK4WG3
+ AL4dJDD0LYFHvQI62CmkAxhKfG7wYYRV6gkm8/JJAKtWkc0zFTKb+61GETTvY6HjEAJMuwMCTzvQgxXs
+ x+NCdvlyEjYbQTP5jOWaCOoiFdAUy0K7hoHO4RzonioHMJQemIWYzCLaWyGht4ql4CyU4a7JoSNVDpgD
+ XzXsUkpGIMjLL5O3LBbv1WYmYife21EshhvrOajdpoTGKAW0JjBgPioHezbmwbgqJMYqhNYggrs1YujD
+ 3LhdJoHuL6WY8DKEZqAtiYXhKpQ4CrBwIfl1dfXTA2i+IoKyoxK4+KkMru5loPIACw0pfCViwJ4rh65z
+ MkxmKdw2YEX677CVS6CnVArdF9D7Z2SAfQCwDwBfgvlSPNwHVo+cJn9SXEwefh8vO50EsBrB6dMCyMoS
+ o0nhJG75iRMs6HQcVFUtAKczGHvKd2a9ogLsxIDNDBNaBt3nsaxechsvnAfDTgy2IhYcTYHQVhkIcX+T
+ R2An/j124mXYiZeOALBY+np8AWhqIlBUJEBhIhQpQZPhawbFKqCkJAAslqBxIscKnvi686IaYxrzIYMB
+ HBcAq4wrVHjROAsBzkIuQOslzrVmQYG6H3tM4KQqxL+Rnk7MUwHk5YlQoBSN96YCF1FBXd0Cn0V6AzCf
+ VQNOo4DTKOA0ChZ0hL1cDZ0nEUrL5wkDOI2CtUTt+nupqarqqTq+a5RITSU1UwMo5kTsVCBtOjXgeYBP
+ SmjXKsHR6naMvQ7D5RCLyc4CngfAWh7oej8uTnnGI4BGQ65NBGhpIXARt9mbF7/PtZasAKxMHLSdUoPT
+ Pj70bF8HQmOMEnD4A5vJDbZxI3PAIwDOKhcmApw7J4TOTt9jeqYwzRmB0H7e7d2prLN8AZi2cOAwB7kK
+ QEiIbINHgNhYopsIkJ8veWre5wU7bdM7x2Jwe7+8PHDomWfIix4Bdu0iGRMB9FgNZurVp3W/VqvqxAo0
+ 5aMXVxLzZ4HJAKzfAMTHK0s9nTlcAGFhJHYsgMNBID/fXX/9wSIj2eNeAfDYuGMsgMEggOrquan3c+GA
+ devkUV4B8Fi4fixAfr7ILzzPw7e0BMGSJdJVXgFeeYX8deypLA+Pe3PhublYIz8/YAATOMArwHPPkd/U
+ 1X03ker1OGD5SfwnJ3O13h4auJIYf35WVkYej4SRXv/0RoiZOiYmRlnoC4AqP9/9ZKKxkcDlywF+swPh
+ 4QrNtAD8DVotsfIAZ88KwWr1j/LpcATDypWyTT4B4GOReh4gL0/sN943GAKfLFok/ZVPAElJ5DoPoNP5
+ zwiRmqrs8zRCjJ6JR17gc89LPIBe7z8jRGwsa/HmfVcBGrlhzx6i55+mFRT4zwixc6f8rM8Au3eTE1ev
+ CqCmZn5GCJstGAyGgG+ys1Xm9HTu6sGD3Km33/bcgSeF0Pbt5BB/Bp5pnZ7J/XxVMRoXDOXkqJzHjnEV
+ Go1SHxWlSAwLYz5etky6Ch/p/2g6j0+8PhpC69eT/+j1czNCmPAYqNer+rVarjYxkSuKjlYe/ugj+a7X
+ X5euDQ4mz2NiimYq1OsowV9cu5Z8otMxPu9AY2MQ9gz1NxkZnCUpSVkSE6M4Hh7Oxr35puyDF16QLEaR
+ Xr+gnnOAN94g4Xl540eI9vYg/mA/lJmpuJ2WpjBhVdBt3apIWL2a2bp4sWwFilTPlZDZrjMaQvgtzR8j
+ IpjOhATWsGMHk/7OO/LIV1+V/nk2cTlbMbP53Lz+q8FsBHtM4rlYbD7W+D9MzRR6eEGuxwAAAABJRU5E
+ rkJggg==
+</value>
+ </data>
+ <data name="errorProvider.ico" type="System.Drawing.Icon, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ AAABAAEAEBAAAAAAAABoAwAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAQAMAAAAAAAAAAAAAAAAAAAAA
+ AAD////////////////////8/v7F/fuc/PiW+/ix/Prt/v3/////////////////////////////////
+ //+a/Pgl+PEP+PAP+PAP+PAP+PAT+PBn+vXp/v3////////////////////6/v5a+vQP+PAP+PAP+PAP
+ +PAP+PAP+PAP+PAP+PAl+PHU/fz///////////////9v+vYP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP
+ +PAP+PAo+PHt/v3////////M/fsP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PBx+vb/
+ //////9p+vUP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAZ+PD2/v7///8t+PEP+PAP
+ +PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PAP+PDD/fv///8V+PAP+PAP+PAP+PAP+PAP+PAA
+ AAAAAAAP+PAP+PAP+PAP+PAP+PAP+PCs/Pn///8f+PEP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP
+ +PAP+PAP+PAP+PC1/Pr///9K+fMP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PAP+PDg
+ /v3///+c/PgP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PBB+fP////////4/v4v+PIP
+ +PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PC+/fr////////////Q/fwc+PAP+PAP+PAP+PAP
+ +PAP+PAP+PAP+PAP+PAP+PCC+/f////////////////////T/fw1+fIP+PAP+PAP+PAP+PAP+PAP+PAX
+ +PCW+/j////////////////////////////7/v6p/Plc+vQy+fIt+PFI+fOH+/fm/v3/////////////
+ //////////////////////////////////////////////////////////////////8AAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+</value>
+ </data>
+</root> \ No newline at end of file
diff --git a/mcs/class/Managed.Windows.Forms/resources/System.Windows.Forms.en.resources.prebuilt b/mcs/class/Managed.Windows.Forms/resources/System.Windows.Forms.en.resources.prebuilt
new file mode 100644
index 00000000000..1419b4dc48d
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/resources/System.Windows.Forms.en.resources.prebuilt
Binary files differ
diff --git a/mcs/class/Managed.Windows.Forms/resources/System.Windows.Forms.en.resx b/mcs/class/Managed.Windows.Forms/resources/System.Windows.Forms.en.resx
new file mode 100644
index 00000000000..6f6e7e4c1f3
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/resources/System.Windows.Forms.en.resx
@@ -0,0 +1,831 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 1.3
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">1.3</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1">this is my long string</data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ [base64 mime encoded serialized .NET Framework object]
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ [base64 mime encoded string representing a byte array form of the .NET Framework object]
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used forserialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>1.3</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="last_open" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAADftJREFUaEPVmntY
+ 1FUax0efbbtaarr12D5bu6WbopZ5SVs1a3fV2rQsUcu8FJqlKCZkF9t1H7VUFBQVCXVFzTIIROU+DJoK
+ iCggKgjC3JgZ5sZlbiAzot993zMMgjLjpT/W5Xk+npnf5Zz3e8573vOeM3YaGG0ddv89nX7fWSLpJKG/
+ zuJf91+nTq3XWq/SffdntHtOfGm91/bdlnrb1t2J/q4CpvT3usiu1XKHn+YkNRwuNV2GN0qMLvjivNEJ
+ X5wzONERX2VZry5IdWwCIPk1SIIyGjKuXr0Kb1y5cgU3o7m5Gd64fPkyOiK+xAGZvOkKiVj1fyuAheVr
+ m5oDUx1L71TE/3QEWICLKDU2XZmb5PjoTkTcVAC71q9xIXYtby7kEWBpdOKIvKF59kGH/+2KuGsElOjt
+ iCu2Xp6e6Bh3OyLuCgHWRop0JEBWVoetefUu/3j78FsVcXcIuORCqYEElNfh+1NGfHu4pum1H+39bkXE
+ XSUgq0VAaFYVlqaaGl+KsT15MxF3rYCQAwp8ctBo/9Nma09fIv5nAgp1jQjKuCxYlOHCwnQXAltYQOWC
+ NDcTfrLuvSsFcAiVKZoFmfLLXnk3wb7zjgV44r+vVMFbnG8b+10uF3zhdDrREY2XmvDefvsOnwIWptmk
+ 3vIVz/U7NcBjVFNTE3xx6dIlNDY23oC9oRHT99u3+xaQapV664HbMcCbEWxYQ0ODTxwOBzrCYm/AjET7
+ Np8CApPrpdw4s7vYgJAs1TVkSoTcAsGZCtyMT9MrMG1DHEbODsbgie/Db9RYPP3cMPiNHIshE6Zj1Owl
+ eC98H/YUqGGz2QS1FjtmHrBH+xQw/1BNpsPRQD3gHbvdAV/YbHZqsGNyc09gypSpeLT7oxj8wmAsXvwp
+ wsPC8eOP+5CeniHK8PANWLIkGEOGDEX3bt0xebI/jh49BlOdDbNuKuBgTaYvA/ie1WrzicViRX19ewoK
+ ivDOO5Px5B+exLrQdSgpKYXRaLoppaUXhKCnnvojJkx8C6+vztzncwQ+OWDOtFhsYOKKqxF6XIV1zDEF
+ wo4rEZ5NcHlcgQ1UbqTvETkqQolNxOZcFSJPEFRupTKK+GD5BvTo+RhWrFyFqiqNMFqvNyA5OQVBixbj
+ r6/+Fc8/9zx69+6N5wY+h1fGvIp5H32M+PgE6HTV4nmtVofVq9egW/eernt/e6/XVFvy8X6jrLbWAqZS
+ V4PzVTU4pzbjLFGsMhFmFClNKFQaUaAw4jRxisiXG3CSyKs0ILfCgJyLBhy9oMXUmXPRt28/nDyZ39rb
+ UVFR8OvXHwEfBiAxMREqlUpEnK+//lpEJ7VajaSkJMz/ZD4G9B+AVatWCcEs5PTpAvR+prf9kYcf2UXb
+ 8d9cPxqSefH6LLO5Hr4wmergC4OhBsycOXMxbux4KJUq0fiZM8UYP+41zJo5i9433bAW8ES9PkTztc9C
+ luKlES8hOztH1KNWV2Hs2HENJOL7GwR89LM+y2isowfroNbVQqGtcaMxQ0WlmkZFrTNDrTWjikptdQ10
+ AjOqqdTra6g0Y+WKbzBo0AvUu2rRaHh4uHCTtLQ0n4tYR2vMkSNHkJCQgBHDR4hRqq7WC1ccOGCg/YH7
+ H1jWVoRkbmx1FhvCbCP//jylDEuJz5LLEJx0AcHJF7DkUCmW0OdPqVx86AKCDpZiEbHwQCkCiSnr4/G7
+ x5/A+XPnhfHr1q2HP0WS+vr62zbeYrHgiSeeQGlpqQjtn1LUWrp0qaiXJ3iPR3vYyZVGeERI5v6kO6yl
+ 3vWFRmOCL14cNgJRUd+JRjhsDnp+EAUFy20bz6MREBCAwMDA1nd5joweNRqpqWmi/pidMXi4y8PnSUQn
+ FiGZs093WK1mP/OOSmUk1+iY6O9iyOAXaA4YRQQZNnQY8vLy7sj42NhY9O/fXyxibV3r4sWLwh0VCqUQ
+ QZHLSgLeFQICftAeVlKEYWRnNEg6VYVk5nQVUgsILok0+pxOZBDSwipkFmqQWaTBsBGjsWf3HlFxMC1G
+ Kyl03ix34vtOpwd3IieXy9GrVy8UFRWJe9fXsWPHDsx4f4ZoJzY2Dt26disSAj78XnNELjdSBUbspTi/
+ RVaJzbIKbCIiiI2ZFQiXXkRYRjnCqFyfXo7QtHKsTS3Hv2Lz0KVLVzHBuHe4l3jIfWeeLnrGiaZLTvJx
+ Ll2UJ7ndZEP4xpZrdJ2euV7Iy6NfRn7+KTHSDz34UCONQk/JB3s0Ry5SDPdFebkeHbF69Ua89eYk0Svb
+ tm3HV19+5dV4NoaNYqMvkdGNtJFvaCAcLiz/1wqMH/+6+MzX+B4/wyKdbYRERkZixYoVor23J73d0LlT
+ 5zmS2bs0v5SVGeCLCxf06Ig5AQsofK4UFU6bOs2r77caT+c/wnAy1G5zwmZxIkuWTVHn96is0MJa777G
+ 9/gZIYTeYeE8qlqtFjwK3N7ataHo+kjXbZJZMZpfSksNFKIM+OGoEttlcuyQKbAzy02MQI5dVO6mUnBY
+ jj3EqL9NxE6KClzh8BeHdxg2Pca7XcVtuJWMLDmvwI7teymdeBY/x6agxuRCrdmFuloXLPUuIcRhJ8H0
+ DovwuFN/v/6iPZ53PXv0lEpm7tQcPXdOD+bHI0r8J5MEENuJbVI5ojPk+C69kpBja1olIoktqRXYQuWz
+ A4aKjJIrpEWmQ/cRbsM932K8hXq5WmfDM0/3xqwZs/GP197CsV/O4vTJSpSc1UEpp1Xf0IR6EsIjwoL5
+ XY8Azp24Pak0kzPcEsmMHVVHi4v18MWZM3pKC25k8ODhrQIoX0FISIjIcTyTWPQ++zy5AvcmG1RX40JB
+ fjlG/WW0iDh+/QYiInw31nwTheX/DMMXS1ciaOEXFO9j3SLESNC5ES1iXD/nSpwnZWRIeVE7L5mxXXOs
+ qMhAlXmnsFAPpqCgug16vDZ+EnbF7BI9MmTwELHrahuBeAJy77M/26xO1Ne5YKbfG/QaJ+bPC4Zf34GI
+ 2Z6M8nNOQUWpE8oK8nWlCwatEzX0rIXesdO7TU3u0Opxod27dqMHu9D70Zpjp08bKOsz4D/pKmxJkiMy
+ WYGodpAb0ffoZHKrFAW2p7p53X8evv12tRAw4Y0JYvlv1/tCAPe+2x3Yx43VTuhULigvuoTRJYUunD1J
+ 5NPxYoETF887oWIRaidMeveI8SjwaPLqzh3F7a1ZsxaU3G2TTP9Oeyw/30Dx1YCYNMrpk5SIJLYwhyjf
+ P6hAxAE5ocDGRDk2EOGJlYQc7y5ahzcmvCUq5Nw9LCysQwF2ch9LHfUoTVQ99WyVwoVK6m02uDDXhbwj
+ Tpz8xYkzeeQqZ2hRK3NBw6Ogc4vmCc0dExcXJ3Ijbm/SpLcdtA58IHlvq/Z4Xp6RQqB3TpwwgMnNbU96
+ ehn1QleR7p49ew5jXh7TsQCaiK0CyH2q5C5UlLh7/3S2C9lSJ3JlbjGlhSTggrOdgAaHW8BU2ppy0ODN
+ zoMPPMgLWQ/Ju5Ha4zk5RvgiO9tAuXnHDH9xjEiwuFfenPim2LB4UgV3BHJPYI4+3Jvs29y78jKn6G12
+ nwISUZBDbnTKhbKzTijKXcLN2N34Pa4vOzsbI/8yUrTD++hu3boXilRi2hZd9vHjJjBrYpVYG6tCKJXr
+ 4mhbSaz/maAyLI62lfQ5PF6FDS1EUBnwWTT6USThZI4jBe+8eMHhRt0rr3vhYjdgf2a/1pF/qytpFMiN
+ yordrlRCPc/Gc+/zCFVXkWByOfZ9Tss5TeE0ggX49fOztSZz0zZXZx89aqZTADMiE6oQuV+DzVRuiid+
+ dpcbqQyPVSOshfVUrv9JjdCfSCyVffxeRETEptbeGT9ufMsouFOHa2sALVZklJF8myepmgxV0GTm0WB4
+ YvP8YIFGEtpIEUyk2LQV9dQfHb3tapeHulxLp6dG6HMOHzbDTU2HZGWZ4YuoKBkef6yX2EJyD334QQBC
+ Q0NF710/ChwWeTKze1TTfNCpKeKQu7DLsOEcYuvI1Xjk2HhOsSdOmCjq5Q0TLV7tNzRTNhpyZLJa+CIz
+ swa+kErNCApaR0M7QGSlvK2cTEcqDGeOIoHjHIjCKbsSpwrsThznTfQ7sonEsGvxd54vbDi7TeCCQIz9
+ +1jK08pFnXRYYL/vvvuD220p/cONOVJpHS3N7cnIqKPVzk16eq1P0tJqae9bC3//QIpEr1JqrhA9tnfv
+ D2Ll5MXOSQsRC2mbD/EEFSutjefJtXyHTyjY5z1uw4cEY8a84qCd2A3npJLJYabctLR6MsA7qan1tKXz
+ TkpKHZikpBpM8Q/C00/3oaiWK0RUVsoxc8ZMcRa0Z8+e1tMJdi+ZTNYadmtra4W7vPP2O3jjH2+IsMzv
+ 5+WdxFNPPmUn46No4na+4VRi8vqa3JQUKxngneRkCx1KeScpqZ6Mt7Ty+ecxlCk+jmXL/tl6SnHs2HH6
+ vkycNLxApxejRo5C32f7ivSY99BD6VgxJDhEJGmeo5Tly/+Nrt0edd7zm3tmeDudk0z9wbpsXrwt8eN4
+ 2wHi4CdMgu0QMz/BlsQsSLAlB+63pbSQunC/LXVhoi2NyvRFTKItPchNxuJEm3TxAZv0/Y0nsvsMHWvq
+ 0fPx5pUrv7laXHxWGOZBoVCIw6+Kisp218/RRF397Rr87rFeV/487O9107+MmOnzaPFmP6L92vs07ANp
+ 47GPVk4LZazWBQsCmzmP4cXv4MFDYn7w98DAhc19+vzZQuc+Vno+lt4bdCtt/6r/KXIrDXie4WMQYght
+ A0Mojm+lcJhC5NNpdCp9j6Lrn9H9YZ7jklut+7/JKVwBwotNkwAAAABJRU5ErkJggg==
+</value>
+ </data>
+ <data name="Red">
+ <value>Red</value>
+ </data>
+ <data name="folder_with_paper" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAALEwAA
+ CxMBAJqcGAAAD0tJREFUaEPFmQlUVFeaxx/IUguKRo12MkmnuxM98cwkJmPapMdsRpOMY5bOMn1cMsak
+ R4OmoygtoJSC7IqyFzsoigIqKEsha0GxF1XUvldRFEUJKGuxC9Q330NRcAFcMqlz/tz77rvvvf/vu+t7
+ WBG/wu8/N26k4m3fHhgYeHkQ/3R3d6vUSqUSywZQll/hkU/vlv9w3kdlHPVezoxP2Oty0DN0j6v3cXdv
+ 5h6v46f/6h92/hM3r7B1+9x93nFjeP7p6T31Kd1pv5u7raev3wpmXPwhoVLVfIlVdvNMZhWcyuRbQhIK
+ bgZEZpo9/KKvM3xOcv1PhHh5+vrORVk/pcc/+W0Q4K3UjMwglaHJ1Dk4NNLc2WPJ4aggIEkKgam9lqPx
+ 6rGUXPEoX6kfUjUZFYHBwQzUs0/+5KdwBzcG44M8NjsSjWk6BgZHe8csYB4dA1VzJ5wv0MAvx4VwmqWB
+ InUraMwD0D4wOCDV6eSJKSm/eAcG/uEpWHi8W7gxjtA9vLw/YBWXxqsajbqO/qGx3lGACXUOjoBY3wGJ
+ uUpIl5sg63oPcPuH4drwKHQMDI/WiiRV6Veydx4+6vv7x3Pw+FdZMY74zA9jxr2fkp55Xtfc1tbZP2Ix
+ DwNMVjcetwyOgbjvJpxp74OEG2bI6OwHXu8wtA9ZoLVnYLSaLy48nZK+3fXgkUWPb+cRrlyyZCmx5bvt
+ 9n6BJ9cnp1zMacUwd/VboHsApqgLj1uwvBYpIlt7IPl6H5y+3gtxbWZIwbzSPAo38Hzzjd6RGr6s2NM7
+ 4Nt9LgdtUFaPYOfRqyKAfcDx0E2sgnKWsaXX3NFjsXSaATp7p8rYMwbF7UOQ1NoLZ1Hx18zjSmwxw6lW
+ TFHKrhFo6x61NDZ3d1VzZUVo/hOU46O7msUVb7+9Zg7KISw88Uc2R8DSNnS0t3cBdJDqvqsbeKzvGANW
+ 6wCcudYLSaZeSEDFN99OTWaIQ53Gc+ev9YGo/Sa03BgZ0zV23Shm87Ijmac+ddrl/MwsLM2+yrp1G2wP
+ HvR9MSrq7LaiYj5bo+3sutEOcK9a2i2guj4KLNMgJDaZIRaVaETz9yjBaIYkLIvB85dN/SBqG4GWtpEx
+ taa972p+bWJsXOrH27btfHot8e033z3j7x/x+eXMUpFe3zfQ1gZA6vokmdosIGtB88ZBCNX3QGIj9ncU
+ sxG7jAEHcBMaNmArYD4JFYnlZ5v6IBrTi8Z+ULWOjt9PIr7WyWJVM48FRq/55uutFNTsI/2wmruc/rk8
+ MiKFIRG3DRubRiwt13CAolonSdI8Chca+8FP1wXp+j4Ib+iB6AbsKo1oVo/9H9NkVKweobA8HeuebOiG
+ U3icSJ5HTdxPwG++fjmDE4PmX0HNfrX+5BNiqZMT8QGDQfzv8ePEfiaT8E5KIiLOnLG9dO7cH4QX0reP
+ iOqlFkPDMJiMANdui9c4Aucb+oGpw2jr+iBI0wNxWow4HkfoeiAey2IbeiFKh90JlYD5EG03JDcgHNaJ
+ QqVgPhHPKZrGoKnh5oiAZ9KmnStkbvvO6aVPP/7Cbtpm2LaNsEGtuHKF8CgvJ7K5XIJbV0eIeDxCzecT
+ xvp6op3Pt+2rrfndWGnJARDV88GgG4UGvQXKdMNwVtsHcRo0qDFDuNoM0epeiMSUicfRWM5ERWM+BtNx
+ IVw8ppHj52+JzCdq+uCKbhBE+lHQqQaH6qqNmqT4bD9fb+aK/3hn7cMhXFwIKmpzZSVRo9MRoyYTAQ9T
+ Tc3LUMnxBBFPChLNKISpelAYRRUCKDGyyh6IwTRCiQBYHo3lEXhM5mPIOigyH4dpONaNwjx5HIb141UY
+ CBRLMwRi7RjoFMPDZUXqhuTEq64+R5ivvvynV+c8sCUCAwkHlLtIRCinMz9xrqryVSgp8IIqQTN4yzsh
+ TtEHEYpeCJbj7IL5QFk3xOBxFCpUgbMRppGYhiMIWRaNOibvHq8bosAA4LlEzAfgdXFyHOSKfriqHAaD
+ CsaVny2WJ0RlO//ixHj+gQBBQYQDioEA6tkANDVZQ13tCsi8cBSUkiE4I+uHBBlGD+WLJpKlfXBSisZk
+ GGk0dFLWAxEy7Dp4PhzTECkObrzGH+vGShEKy/wwf07aD0EkPB4Xy4dBL8c1BaWTjY3lZYqE/l4x+xHg
+ /lYICCDoKFcEUMwGgKyj01GBx30NcjPDoKLWCGniAQgXo2FJHxwX90Ak5iMkZghFg0wsC8d8CIpMmeLe
+ 8ToxYoS7XR4jQQhxNyRg3WLJTRALb4KophtKcmWQlV4yFnwsUPb37WujN2yw+2bVKhs6gtzdcnh5EXTU
+ XgSQzhaguRkhtFSoKFsFZQVxkF+hg1TBAIQK0bQAzQp6IITMC7EbiTDqIiybEFle3wP+FQbwKhTD0bwa
+ 8L9aDgFXi+BsfiHk518FTkEWcApToTSfOZqdccCYmrKxICT495G7d1NdNm+2nzsF4MABgobaIRQSotkC
+ kPVIiIYGKygrXg+c/NNQWN4Msbw+YPIxwrUdEFBhggC2DnzZcvAvlUBQqRCOlfLgWFkNRJVWgm/BZQjK
+ TYbg7CgIzwmGizlBcDXXD4pyD0Nx3gFLWeHu4drKLSZuzepCheLF2MrKBf5eXnRnFNkCd3+7dhFU1FYE
+ 4M8WwGgkoLGRBCBALLaFwrz/grxL53GGaoPAKgOcLFGAT1YpuKWmgVdKPHifDwOf1AA4lnYYQtP/CSGZ
+ P8MFzl7IER8AjuoQSJWHQa88Mq4GBQOUov0j/JqtbTVV/5qj1T4XYTItOlZRseCoiwvtRxT54eDub+tW
+ goL6CgFqZwPQ1ESATEZAaSkBOTkEZGVZQ1rqXEiKXwlxkT/B6WQGxFx2hXNl7sASMiBX4gEsySHIxzRP
+ ehBYUjcolbpDjtwVKuUHQSY/DDo5Gr8tuWAv1Fb+tZNd8kqVXr80tLl58XESoLx8AeOHHyj/jaJMAfjs
+ M8Ie9TEuWJVkt5gMoVAQUFNjBWy2NWrOuEpLbaCqyhYEAjsEsUdRQCKhAp+3CMpLXwdO8fdQXrUP2EI3
+ KJS7Q7HiIJSgilAT+XyFO1TLMfIyBmhkR3CmuSUpfzeI69fjvV5pq65aVGA0LgoizZPicBa44iD+FGU/
+ BWDNGsIW9RauwCV6/VQALtdq3DCXa39HdXUU7DZU7D40hL0rY5MDaLWLQCxYDZL67cAXu0IFmiRNTxYb
+ o16F5TLZYdBI0ThKI0YY3i40vxaU8pdALndsraubdwdAq10YlJ8/3/nNN23eQNlOAVi2jJiDegm3Ebkq
+ FWGZ3ALl5dZQWWk3xehk0/fmjUY6qFXPgETwHpr5O9RjVylTkBDuwEaQUhQZeTWa194x7w6y+p0gqPsQ
+ lIrnwGCYi4Gg3+Dx5rGxBU6Q0edynzmZmjpv1+LFVktQ923wyDnVsaCAuCAWEyNTAeZgd7GfNcAEkFKx
+ GFvhfYTYDQKZB3ButwJX7nEn6mTktTgupPwdUM99FzRqRyADQN4DAToQoGICgMWaHxQc7LBtyvR5z7Js
+ k5VFJOEmrn8qANnfKY8MYDQ6gAqjKeS9B1LBfuDJDoEE+7v6dtRJ86RE3O9BxP8zGl6I0/It87cBuuvr
+ 53InALKzHX18fenfTLcrtbp0iYiqqSG6JuZ4jYYYH6w83qMDkCYMhnkI8SJG9yOQCJ1BLWGMm74VeQYI
+ a7eAVPjvoNU8eyfykwDMCCAwGheOd6HLlx0PubnRNky7rU5LI4Krq4m2CYDaWgLN24JKRX3kFpgwYmic
+ B3LpC7h73QhK4R40fhjUOPeLeVtxsK9E84vR/NTJ4HYL9AsEDjIEOEkCXLzouH/nTsr70wKkpBABVVWE
+ kQQgFyocEyAS2WHT3v+A6Qby/QPbAUTCF0HC/xLk9U4grd8C9bwVoNfPf+i9dTraoFDooCYBmpsXHcMB
+ 7PTFF3arpgVITiY88Z1ANwGQn2+NAI8+gB8GJxL8EaorXkPzy2YMCgLcRAA9CaDXLzyekjJv2+uv2yyb
+ FiAxkXBHgPEdKdkCTxuAHBONGHWDwXHGLolrzKhE4mBC82FFRfNDExLmfrZ0qTW5iXv4LyaGcMa1YHxD
+ dwvABlvg8Qbwo3SxB9VtbKRZlEr6Dbl8QWxa2rwT4eEOax/4LjAZJzyccOJwiDoSwGAgoLDQFlfc3waA
+ HNg6Hb2Lz5+fgtH3DQx0eGfa6JMnT5wgfigrIyrJzRquyMDh2OGS/vgz0JO2gsFA76mtdcxkMh08PDzo
+ b8wI4OdHbMEdJlurvbXTlErtccv8ZDPQk0AggBkBWCEhdOeff6aumBEAvwd9zWYT+WT08/KsQKOhzDhb
+ PInBma5FgF4ud16Rvz9t51df2f9xRoD9+4mNJSVEllJpBbm51uPvvTM95Nc8j63fX1bmUOHjQ/129Wqb
+ JTMC7NhBrCsqIi6qVCSAzW8OgGvBQGYmrS4wkLL2hResaTMC/O1vxJrCQuIcCcBi2f5WAGPYqjdRQ2o1
+ rTMujlIdFUWZeQCTdOvWEatw+5B0C8DutwDAdxG6GdVsMjnI1GoHTlQUNSksjLp8xuiTFVauJJZlZBDh
+ PJ41VFRQcK/yq8xAGF16D8qEJlUGg0O9WOxQVVhIL7l0iZ6Zmko/lZxMD4uLo/kGB9Ncdu+2/+qnn+xn
+ 9/+zpUuJJfHxhH9hofWYUkl94C5xFoMWo0h2AXoP7u/b9Hq6QSSiaaqqaGIOh1bJZtPyioroqVev0mNz
+ cuhBGRl0j3Pn6D/FxNC/PnGCvu7oUfq7rq60Pzs5Ud/YtIny6kcf2T734Ye203+dntQ8DiEhVocyMuaQ
+ fXC6GWi8n6LBPtyzdMvltHaJhGYSi2laNCsWCulV9fX0vLo6emp5OT36yhWaX2IizQUj+qOnJ+1bZ2fa
+ BvyysPbLL+3e+ctfbF5bvnzOv6CHqS/qs+oz91eyCQ21dk5Pt+lDgxbcRo8aDLQR7EpDqAGUGdWFplsa
+ Guga7KO8mhp68eXL1EunTlFjw8OpPp6e1J9x0dmyeTPli/Xr7T7CHeTKBQusFqIe/GX5MY0+9LKwMJt/
+ pKbadWMXGNJo6NcrKmgNWVlUQVoapeDUKUpyWBgFv45R9u7ZY/8/339v9/mmTbZvenjY/y4+nuqIAHMR
+ gIYAVASgIIAdAtiieWvU07b64Pvt22fzHoNh63v6NNUjIYGy48wZyufnz1PeTU6mvMVkUv7N25vy8q5d
+ 9i/gy8XS1attFz7/vDXt2Wet/3+ie4/l/wOchKPj6Tjd4QAAAABJRU5ErkJggg==
+</value>
+ </data>
+ <data name="monitor-computer" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAD31JREFUaEPVmQdY
+ VHe6xvFe9+59dJPsJttMTNas2WQfs4nuborGGzVmLdHYwIKiG0VAI6BIH5A6dJDelCkgRXrvvXcQaYJU
+ UXoRLAgMzHu/cxRkaJZr7j7L87xMOTPnvL//+/2/859zFgGQ+rf+YwD+nfWTm9/p2fTWWk7c5x+f4v+w
+ +ke+7V9VfGLWnA8t/VQrtv5TrbiWT7TiOz7WiO1b/flXx15mIF8KQFDQ958eOb3L9P2KvlKyDVdQtA11
+ UrwYmXDaJaVcyS2jTskts1nBNevOSdesHiWX1AHNS6n3nMKLxyILGlB9ewiDw+MQizGlkZFRrF+/Xuf/
+ DNBzX/Tft++OrsipaNzkF5PxozA81Z0fkZFyJb7omjC+pJYXV9J0Obb0tkdUcbdbWE6fV2TOvcjMClFx
+ zS103h3GqEgsYWzS5NiYCM3NLUhLS4e3tw94PP6UzM0t2O9s3LjR5KUACgoKLlbV3Gi6VlnbVlRe1ZWe
+ W9SbllM4VFJRI2pu68TDR2OYmJjb2KRBZntHRyfy8vLh7x8APl/AijHq5cWHUOiD1NR0FkIkkhx9Hk/A
+ Amzbts3ypQDS09O9Ozq7MD6BBdXXfxclpeUICQkDjzHHGnxsVCAQIi4uAbW1NzA8/GjOFKaXzPTnzPeJ
+ H7t377Z7KYDExESlkrKKMRpoVNc2ICIqjsx5w4svpEcSTwg+GQwLi0B5eQUGB4deyOB8xiffZwZiRATI
+ 7D/o8lIA1dXVq5NS0gfvjQBGxlx0dnW/UoPPArjsJQBz7O+OHLvxmzV/k6Nz0pIXAZFqbGxcmpSS1tP/
+ EHD14OERjQYzIqPjwBhJ9KS0mJifZeZltntRGTLHPukpEKs0d4p3efBavlbXjl2143vz1377u0+eBcO2
+ 0dj4xDud9wB7Vx6GHoEdkfukB6PAQ9IwlRejnwLOi0q0i4592kMg5g5DbENTyInkPjwu1s/Mvy9rZlm6
+ 5aSS4MPPPj9O6bw2E4gFCA4Nb2i7C9g689D7AKz6aFSYkRkYBqhDYpDA5oNj5g+bGolJ7UWS8/bxQ3Pv
+ GFQJwJ6Mu5F4IxD7koJHIY4iJY5BHN3dLzb09m2T5+jH/2PvPsvfv7P8M3YZxPzzueJX1dQH2Ln5oJV2
+ 1j4EdJCYVJjR6b4P9JBYMBILRmLAXhSOuijb7SZITMkFh4SjomUQ590F4ktk2pt0lUyHk+LIeCopRwRx
+ CamSOnCdaEJsLfAZfvvbPb3/9dcNoSyAg5NzakXrfVyJyEBmWRNa+oHWAeAWiUnmNunOINDOaCG450iN
+ LctpJRkVm4jsqg6cd/SEP5kOJcWQksl4FqmQjF8jCVLSRWsOnej6hZx6h5RDygOpbDGkpJUDWABTrplN
+ bNZ1JBa3QBiahvoe4GbvYzVQMo2kJoJqJrUQFAtHUCwcQbFwc4CxyT2jJBNSsxFf2IRT5/RH9x0+cWeX
+ vFIPr7xyPI9Mh1bfEK//56neX8qe7ZAyCRqUyhiDVA4ZnpS0ylUWwMjIaO8l34jholYRuI4+qOwEqkjV
+ XUANqbYbuEGqI7BJuAaCY8FIDNiLwk2WZEp2KYJTq2Bq40UnwiHk5DSAo2fTu2H73p5FWp79Ukn3JU1P
+ B5BRDWQBeDzeO9aOngOFtwADWz5KbwNld4By0rV2oIJ0vQOoJLFgLwg3V0lOJpdZXAthdBGMbXgswKTO
+ apr1SIw2Y5zK5meuWfilggmkMkSQ2n82iAVwdnZexLWy785pBjhWfOS3AgUkBqiIURtQTCohsOeBY1Mj
+ sak9I7ncila4BWXCcAGA/whsxFu6Xlil54UDYfVYa34VUqmPGIDgqeW0nqHZrfRGQMuSjwx6zGwCskjZ
+ BMWA5bYAeaSZcCwYaRKMTY4SY5OjxNjkFijJfKpPa3489KzmTuC36i7Y4p4KxZIJHM8ahEzAtacAB849
+ BVDT1K1PqgfULQRgHpNvAimk1AYgjcTAzQRj4QiKhaPEWDhKjE3uOVJj4Aob78PIJRS6NHBzldAHF4Q4
+ FHETGwx42GTsjb/p8/A7NSdIZU1A6oBayFQCCqeVy6KqxqBh44eI66OIrQXibgDxpIQ6IJERgT0v3Fyp
+ zQVXfGsCWja+0LKYAaDBZefASiqbb1wS8D7nMpaahUAq5eHTSX1Q7fF5gNEB2aMhvKRGmPlkwy22AWFV
+ QDgpohqIJEXVANGkGAKbC44FI7GpPSO5mXDqlj7QsPBGTc3g00n8BODnNnFYFH5n7k508HzYFMD273Zo
+ GLpFit2TboPjmYKr14DACiCIFHwdCCGFVgJhJBaMxIK9BBxTkil1IriFFEDTSggDzyRo2wWirKxzFsCs
+ TkSpLAppfdyFDqmHPwXYvn2dgob5/SulE1A09oFPKXCF5FsG+JH8y4EAEgM2C46gWLgFUoupnoBTWDnO
+ 0Ugrc4VQNveFXXgdu19GGrYhyM9vmQJQfZLAFED8XbxuFICVVEqrFAwhFdnJAERMAUhLSy/d/88z/cIS
+ 4LiBEF5FAI9RMcAnCeh9Zps3QbFwBMXCPTFAzWEWmH1ELc6YXcEpEyGUTHxgGlABQbGY3Q+/aAKGgnyo
+ Gl2GtoknHFyuSpTQJMDP3fOwXOcS1loEQT73AZTomN/SnGABZDWfAjDzYIe0XOelQuAYzXzXPMAtH3An
+ eRQAniRm22XSJBwLRmLBSLZRzVDi+kPeQIATNAgcfiE888bZ7zCyiW2Hipk/1IwuwcDsMqKjiyU6z/Qu
+ pKph2suM/grywpjeH1zFdqKdHin4VO0i/Qbog9ThGQCbtu1pYYwf4Qhhnw04kBxpJ04k51zAhcSCkRgw
+ y+h2KJgG4Zi+AMf0BFBzzYRT5ii7nZEzrcY0XNNwxuAytIw94e4ZTj9Lu+Y1PR/AkdhWbKCy/ojK51cc
+ PhaFtT2e1Ee0oiSuC32xfnMNY/qQjhBW6YB1Bo0ayTbzsUxj+nDCLByyOgLI6gpwyi4JVkkPWNBJ6QU2
+ YI+KGz7ba4Jz2jZITq58LsPTzTPPVdUfJ/CWih1+T2fhxbzS2Z3oiLYkwKrVn2ebRPXh8IWrMIgfgX7U
+ EI6ZxUJaS4D92gL8YB4Nk5i7sCGYSZknDUPOOHx4vazF+AdbbPHG5gy8tncUr22rh7IyR5yUVCGeae55
+ Xk8CzNWFpt47oh0tkcCKlX/2ULRLwVl+DXaqukHWMBSc0G6Yp0FCZ/lVY9sUrdp2HdMe+Pjrkw+XSbdj
+ udyEpPbWIDGxgq4LRcLIyAFcrut4UdHt507juQDkdGIkAN588025bQoWY0bJgPE06UYM4aCe39j3ikYj
+ MkoaY2ZuHhMZdXVw9vKH3Gl78SrFcczUhwcr6EpczZThkpJ22NsLoa9vI3Zx8RdVVfUvCKNy3rRvwdFn
+ 5oCMSpIEwOuvv/7Hv2yQGeLEi3HCsXBit+rFcWVzD1gLA2id04qawUEJCcNioMflY91Z0SytOVIk3rJz
+ d5uRseNAVdWAhFkGzNzcDZqapqLg4MzxuUpqXgD/OqzYp9j3P1v39Ur9+p2tEgDL3n33vZWfrh06Z+GM
+ 0Ny8WYZnAvhEx8HK3hfbdMZmadOpYmTdvAknX9/732zbkX327IXy1NQq0UyzQUEZTCrQ0bEYSU+vm5ov
+ yudNniaQOY5fnLa4t+nQqQ6uhcdARUUPXRGMekBXKVZMAXy2fv1WjpVVw0yT872uHBhAbPk1uhjmCBmD
+ IRwwGZXQTpU8pNfXg/1cSen49n37rnz44SdHDx9WCLe39+6cWUKVlf3w8AjBuXOGYzRfHskraT+UulQ4
+ /mdphW75M5wu6mZP4W+PSAKsWr16h1tg4N1nma/o70dJTw/yOzqQfecO0qisuBau2HkqGidtRiQkcz4L
+ 0ZWV7OcKOjuR1dyMnQcOxDEnzCVLlizbuPE7a+pSxQkJ5aMzUymk9biCsh6+3ys3UF19d9ZcqWoephJ0
+ 76cE3mUTkFNSKlnIPGO8uLsbOazpW0hsakJM/U1E3LgBF14IpOVtoO76SEJHtVPhX1KCGCoj5vPpt27B
+ LzNzfM3atbKTK2AysOijj1btOXhQPsjGxquNKY3pMPLyZ9unvy4t7YCJiXODtPRRwYoVH6xnrwvR36/t
+ +ILR+QDKenvZEWcMJDQ2IZK6T3B1NfwqKuBdVgbry/5QVLeHMX9YQif1E3ApNxf+FdcRQp+PqqtnQbbJ
+ 7E+c63Ih+Xjr66+3mP74o25uTEzRI8b4JEBgYPo9JSWNtC+/3KBJn1s6/ftSixcv/ktAcop4LgDGfB6Z
+ Z0olroF+I9TUsoYEpaW0PiqkJUYu9Fy8oGHoAvurDyV0xjgGF9PS4FlYCGFpGQKuX0d4bS2kj5+gXw0L
+ 35d7//0/bdm//wffr77a3Lxnz2H+8uUrvpjvO0wCSzmW1qKZANepbAqpdjNutSG+sZE9OGOeT2XhSjcy
+ LmZmwjwlFWdsHWFkdQn8yAcSOm8aDm5iIuyzsmjdlE+r2VL4XbuGb7/fS78gXt2NRXYOyMge6ynv6pJo
+ m8zo57a3I6WlBdHUTYKqqtiS8SgoIFPZrHmDuHgouLmDY2SP4MQhhNA1nElpmwfDIDYOlqlpcMzOoZVs
+ IdRt7PHl2k0vdR9g3gSYDevWfeOoY2hOl1KenqxKqdswkzaZukcU1X1gZRVbCu75BTT6WTBLToE+GTwX
+ HEILLyO4C/ORlHMPkcmd0LW6gh/0LVlABpQBVrvoCMUzmv3Llr373itPgLmpICsrn2ls7ojI3Hw2iXKm
+ /imB1JZWtpMwE9envJwdSWZErai+jalEODExOKFvin2yilA2dcRRrjXUQ8OgFxsLk0RaraakQIFjBDsH
+ 7webN+/Qe5Xm2S40raUtoQkT4uDkPcF1cEVUYRGKqKwy29rY7sG0zKvU15kUPNkJnAOb9Aw2CQZENyIC
+ F2jEDeMTWOPGlI6SuRVU9c1ga8vvXLt246lXbV4C4ElPXbR1624HX9+EQf+AZJhau8LUyR3BBBNPXSjy
+ Rh07F67QGZhXXMLOB2dqlQ5UIkxZWSYlQcXBGWcucGFq5Y709Fpa73Br1qz54tufwvwsgMmDvP32u2t2
+ 7TroyeFYVZMJscA7GlZ2l8G1caeO4wyOpQM0zW2hybWFDvci9Kn0jCxcYEcXhpOTr9O94Nh7Cgrn09at
+ 26Qz112VVwkjsZibuWM6+OK//33diePHVYPV1AwzdXUtq8zM3O54e8cNM0YjIwvErq5XBy5csGvS0uKW
+ qKhwEnfuPOD13nt/XP0qTS60rwUB5jlj/ozA3v/DH1Z+98Ybv/qSnv/m/8vsnH7+lQd/Fcf+X104LlAR
+ 5z/iAAAAAElFTkSuQmCC
+</value>
+ </data>
+ <data name="paper" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAACYAAAAmCAYAAACoPemuAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAChxJREFUWEfNmPl3
+ lPUVxmvX32p/6p/gsdqqgCxCIlpwqxU3IgWDtaBAlYTsxEjAEFBCksmiEEDBgBANmx7coIh7gklm35dk
+ 9n3L7DOJTZ4+b0LSOTXIkNPT05zznPedmTfJJ/fe5977zQ0AfvJ/+SWA/afmzll4+4svVB4sKqruKC6m
+ tlR3bCmhSqs7SgSVUeXVHaWCKqo7yiqpquqO8q1X14MPP9w40++62ns/gBIeXLggf63FnIbXA/h8gD8A
+ BIJAMAyEIkA4SsWB4SQQSQHRDBAbBeLfA4kxavyH2lxRO7Z02f3HcoW7Kph5MA2PC/+G82fBDRNwCi6R
+ BTdydbiG/Wewq+3s94uX/nF3LnAzgi2Yn7/WbEzD7cR/Da626TSOXgLKtu9PL1qc//y14K4KNqRPw2UH
+ 3I4sOC/TOhW5EFN7jcjFs9JaVHcKO44DnZ8B6za/Eps3f/6yH4ObEWz+nXmFJm0KLityh4ux5qbSmmbN
+ XUlr/J+T9VZYcRIFTGLtUeDIhXE88XRR6Kabb77puop//ry8QqMmBacZcF4DLpAduRngYjSEALemrBs3
+ M4ErdwE1nUDHxyN4YMUz7l/feONvZoKbOWICmCoFxyDgmIKzZaXVTbdOpVVw7BSc4NgpODo2eiVygmMr
+ 6jvxl9JurC47iU21p1G15wyqXz2Ce5c9NJA72Ny8QoMiBbuJYDnATbSTH4GLMq0T7eRKWrPbyR5RS2/O
+ YHfOWbJGJ03CZgB+KzdgpdqNzboAKg0h1BjCqDYGUWrwY73Rhwe0dtyvc+BBnR3PDvlQbg2h1h5GvSOM
+ bfYgSmx+rDa78SeTfUIFFhc8349N97oGUcvl6wLTipOw6oDfKczYoglgpz6CRkMELcYIRINR7DEN42UC
+ bjB48Te9B88ZPaixhLDXFkG7PYIDzihed0XQ4BpGlT2AjVYv/m7zotThh390fLoR721p/S5nsHmMmGYg
+ CYsGaFVHcVAbxzFDEu9QXaYkTlDHTQm8bY6jfZCw5gjaqKP2BN5zJXHKncJZ6pSbr718zhNDhzuCDm8E
+ b/miCIyMT6aV7aSxra0vd7A7lqxR9yVhVgF5SjueVHvxoiaIrbphbNOFUaMLoVwfxLN6H5ZrHLhbY8cy
+ ar3Jj/KhEHZYwqizMpVMa7E5gKdMbtxncGC50Y7Hh9xwpsama66xtf36wFSXkxhSAu8rUzivGsHn2lF8
+ rhM0gi/0GXxp4pU6P5TGec7VC5Y0vnaM4FvnKHpcGVx2p3HZw6tvFF9507joT+FiIIUvQmkEBcdema8E
+ y92Vc29fslrRk8CgHJgns+BhpQvrlH4Uq4MoZ+TKtUFsZt2tUnsYURsWKC3IU1mxlvX2gokmGQyhajDI
+ awAbhvxYYXAiX2tFnsaCh4wO2GJj08O/sfX16wOTf5OASQpskvtQIw+hURVFuzqGfaoY3tDE0K6L4lWm
+ tlzjR5HOhzKdH3tpiPYh1qQ5hkOWGA5aaQAbn2Nqq5nSlyx+1NmC8MTGp6dEU+sb4pxrbO5tS1bLvkrA
+ yG+ploWwW04nKqOEiuOgJoH9BNyvjaFZG8UObYh1F0SdPox2YxQdQ3G8SVMcpo5Y4uiw8jnLMF6xBFFP
+ 1zbah+GKjE+uTRxhTa37JDmDzSGY9MsEDP0sfpkNTyo82KQIoko5jBpVGC+pQqig1tIUy2iOfJUN96kc
+ WMeolbHXbTOFUUttM4VQxNQWGNw0iA33am0ooBGsobHJtYlToqllH/Pyw2V1xpE05w+LV4kvxaGnX84O
+ pPGxOIML0lF8Jh+Z0CXVKC5qRvCJOo0PtEl8oEvhnJ7FbcrgkmAK8yi+NGfwjYWFb+V79gw+cdBEjiQ+
+ d2fgyZqvzS0dspzB7vj94lUDF+PQsSffKbXiEbkbz8rZCuRhlCtCKFMGsZFmeIqRvFthxwKFFUsZuUIN
+ 2wrTWsW0VhnYXhi9DWwpj+pcWKRm8VOPGVww+8amR1iz6DrB+i/Eoe0BqgZYGwOsMTGLWprAQUkch2QJ
+ dMhiaFNEUa8MYwfTuksdxj7W3WF9nI04ManBBA6ZomgzRVDPtL7K9Lax3py+8cl1nZFrFh1QXFfE+s/H
+ ofkGeF7sQ8VACHUEa5LG0CiJYq+UQLIItjOCRYzkJqUPxaoAdmjC2KPlJKBjRVQrR9geA0cXo/eiwYdS
+ ox/b2EosboJx4RTgmppnA/Y1cJfYisclLH4JUyMdxkvUVmkYm2UBFMo8WCazI09uw3KFA39V8Zezz9Wy
+ jWzXsvg5JV6gIQo0LtwtGERtx0qmdcg1NrE2CQedZtEhtvEci/+OW+8q6D8fg4Zgx3s4+3oz+KB3BB9d
+ HsWHfWl81D+CczTFOUkGp6UpdMuTOM016WP1CD6lLtAYF7UZXOSEOG9g4ZvSeJ/z9dxgCv/ghHByXfdy
+ p/MSrrn5EAffLMAWSGz4s8SN9eIASsVhlFGlYha1JIDVMi/yGbGFjNhSRmwNI1aiDqGS9VapYUth9Naz
+ pazQuHEXI3YPI/ao1gWjbQweHnQEuOamN9WzAnutl2tML5tmbxKdvQkc4ww99l0CR/oTeKs/PmGKvRKa
+ g3X3pjyBE5ytXYoE3lUn8S6bcaeGZqEpWnURvKHnM4YYLNZxuHnQEeBEzW9xh5lFxFb1e7BxIICqfrqv
+ LzKh7f0RbOXrUjr2abEHq6QePCP1oljO+lJG8IpiGDtV3ETo1irO1w1qHwpUbqymNmp9MJjH4BJWdcKJ
+ mg5rcwa7/dZFK/s+jU7U2HKxA0+JvdhMZ1b1sfivqJhQ6+jY+/n5vVIHHpG5sJFgNYTaTtVxSrzMVlKi
+ pElUXjygdOAhpRNPc/DrB8fgtPAExoOOqPEw19EcI5YN1sniP9GTwkka4HRPBmd7RnCG15NUd28anZe5
+ CDKt7/TTJBIaQkpjSDP4UJHBOUGqDE6pUzjBtHZpEzjDKWE2jsMxxBMY4USNb88OLF/iwAqm6jm2iy0D
+ YVT0D6OkP4Tn+7n2MJJLxDYskthxj8yJQva0LRz6lexvldxIShjBDQo/HlO6sZgTQtBjTKfGMDZ50CEc
+ wXiymEXEDnIv62Thd/WyLfSk0f1tGu99ywjw/hijeaAnjgOM2iHqeB+fYRs5Q52WcL2W8cp2cpzt5LAy
+ MaEummJQNz5x0BHgRHs7cwe77ZaFT3z3SWSixnKVllNCGGHCfNXzeCFsJsLaZOJSM8gxPcTBI2zEZjYH
+ C8tdOOgIcKKGTmPOEZsN2MQfcA24wRngRA1HGbccUzlrsFnAifYc45H6fwGWDccz9nRaudkLaTUxrcJZ
+ YiqtBKMFcgS75aZ5jzbUHve1737fK6ht11lPtlrrz3im1LLzlHtKorqT7mnt5P3ObpeovtvVsovX3e+5
+ WgS9JqjLKai1ocu56snn9DmD8Z/FN1C/ytIveZ+tX/D1lH7O+yn9jPfZ+ilfT0n4mRO61j/thM//BR1x
+ NCLR9Yu7AAAAAElFTkSuQmCC
+</value>
+ </data>
+ <data name="mbox_error.png" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAABcQwAA
+ XEMBOS4mtwAABChJREFUaEPVmVuITVEYx5fLmXGdaTSa3Br3mDAeCIlxeRAiRBE6pWQy5dJMETURDZHL
+ FHIrzYuEGCK5ZR4kxIMm5VqIcnkh0ZAs/2/sc2adddl77bP32efMqX9n5uy91/r/1rfWty67A+ectesP
+ AbRntWvzrb0n7NZHd+wHzYaqoO3QPmgvVAuthqZDRWHVGwoADE2BDnZk7Dm+aVDZ6KEDOCoITCAAGIh3
+ YuyRpWE3qGsUtXRA0gJAZTM7M0YtaNPSfu65gDLL/ID4BkAFu7yMTwTYKgidnqPz8z3QFmgFVG4HXWUL
+ YQ0A0z3zGKNQa1t0MX4/D/2gvOChT7h+AprhDnPYBsIKAKZ75zP2WGc+DhNPLUyboJrw7CwzyGkvCE8A
+ mI51YeyBbH4gKr0SwLgMdAxlYVzpotvgBuEJEGPsnGyeWuxziOYTMAgxH6GH2GGCcAWA8RrZ/MIMGBej
+ 8d480OfpIIwAMD5SNl+RYfMJkFeop68aiRe+ANB1kFTa+mQB/n4dEQCBIN3pxkOtDKGNAIxPklv/ZITm
+ E5GoViG+UzoXIbQAWNM0iABRdR05M9GcUqxCVLsCECH0VwRozELrJ2B2qgBPvACWi+aHZ9E8QXzUj4Ux
+ CQilC8H8KRFgc5YBCGKOCrHBCID1zksR4HYOAOxXAc5oAWjZIGcfDPu2xVkRNlLxeDQqKUnWe1cFaDYB
+ DBUBBsitX16O5yL6VFQkAb5o0qkJYIIIMC5HAGgcaBZ6ecqmHuanigDY6Kau7bMUAQJAbpdn5gIdQMoM
+ jHDkDACW9DJAVx1AygJuSI4AfFPNt5jGQA85C/0RIWIxzktLo1F+fjL6tE+QfCVXpspEhnXQW/Hm+zkw
+ DxxXARrdZuKzIkBdDgAsVQG2ugFUigDKQI4Y6Bfq66YCTHYD6C+PA5oJvY5KMnX9qGr+jed+AACXRYgl
+ WQQoUwHqbADmy1G4mgUIHGvrtpWDPQFaJwjGmkQITBD8d4QQzagLGVEGOGK1J3YAcPKXWsDKiABo7qHk
+ IdVP++E+1gAOxAEZgjbamRqwiXIX6LtOpWxeWUpob2DsngyBVy8ZgaAlw1y9eePxoufRIswPgz7IEHS8
+ iK1baCB3UJYm41A3atI1rHEeMERhPArCviK1X2L7xncHhKDNykZ9q5N5OlQuDgzgjIexKOyZDEH/0zHg
+ NggvyKwjAmd8HYQ9uC5V0m/XoUI381ZjICXnojVQKL0GMlXKR+PaGqgewo38FnQDwgKr9W0NZbJBLs87
+ Zdd7GffVhZTU9f8V6lc3kDSvUYQX2Zr3HQEpGr1QGV5/sZ9pmhWj+A5l1PgxHigCEkh3VL4WwhGSr7eW
+ Lbj/IrQsHeOhAUgwhTCEgzS2CcI+hF1ywG46Y+cQvtdD06COQYxnBCAMQ37L8JzI/BYY9f3/AJQMVypF
+ n/EwAAAAAElFTkSuQmCC
+</value>
+ </data>
+ <data name="No">
+ <value>No</value>
+ </data>
+ <data name="folder" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAABMNJREFUaEPtmW1o
+ U1cYx5+mSZPcvHax6GTIGBNfPlUp6FBERIeonTCoyHBWOuyLVKE207UYCY3isszg2iTFpJ2hXW1ybReb
+ tkq0nQhN04rECSW0VavWFtlg3YeBjK3b2TkdnV1y09x7d+dtsIHny3055/87z8t9zkkGQgjS+kcA0tnS
+ WvxM9KTz6i8CLATvvT4hhEutdNkyWLtzJxw4ehQ+PXsWvnS5oKWhAXouXYLwsWPgEMMjjB7AYlWFhVBh
+ s4H74kUINDXBYHs7TEaj8MfEBKDJyUQbHIQXGzfCerYQeA5q1SrIy8+HT8rK4JTJBE4837f19dBfWQmj
+ +L6CzViMABYLhJ49YxbKJH72WnU12GcnxQIyly6Fd7Ztg4JDh+B4VRXYrFb4xuGA3sZGiAUCMHXvHvMc
+ fX0wrdfD27wA8MRZHR3wfD6hye4NDMBPdXVwDYfV3dZWmAyHYfrpU+4LMTwMaMMGeJ8vgD4Ugl/4AAj5
+ zu7dUMQXQNrWBj8KKYbPWCTs5gKQyFi5Upa7ejUY/nWdiRIn7WM+kwrxDsmLQECCSktlvSYTVXf+vCbg
+ dmvv+v26511d+t9WrMhamxIAl8X7QohJNsaDB4Bu3MhAPl8mNhk2OfL7KWxqdOuWHj15sgRXukRratI9
+ xp7ISAngdkPffwUgVSwSAXTligQLlM6I9PmU2FQoGNSioSEDo0gm4bPXnE5tT3zEMJZRpxOusQWIxQB1
+ dUlQa6sUWxY2BTYK0bQG9fdno/Fx5tWcT2iyexaL2s0KwG4HPxOAz0eEyrDJsSmxqdH16zo0MsJ9NfkA
+ FBcrP2MFcO4ceOIB7twBdPu2nrPb+QhleufhQwPavFmezwrg9GmwxwP4/RJBw4ErWDCo+xknsJYVgNEI
+ 5niAy5dloq0+gfV4tFGmks+YxMXFUJkIoBAVwGZTt7EG2LcPDicCUKICGI2qL1gDkA5ybjdKPjwdHVpR
+ AfbulZewBli3Dt4j9X3WC93dEjQ8/GpKJVNyRyLZ0/EtxD9tOyMVwFukJ58FIB8prlVDyOe93sQWIhUA
+ FQzC1EsAuagAtbXq3mStddJNfUsLjL8EUIoKYDarGjgDeL0wRADIHph0iUKGBNexiooU1ZwBPB6IEADS
+ UZKmjOukQj0/OsrcQsybA+QmPjIJEQCazsReEK6j5Ap29SpzC5ES4MIFaCMAZMPBdVIhn3e5NPfn2xsn
+ TWJ8BPI1AfD7xW0hampUIV4AZjN89TeASlQPlJUpfbwATp4Ey8gIoO5ucVqIsTEDunlT/+uuXcwtRMoc
+ OHIETnR2ShDZSAgZ03PHItvNcDh7urlZN4FjfcBqVbdXVVG1hYXKE1u2ZH1IUfBmqrOhpDmwfz+U0rQw
+ LUQ0+safNK2bcrs139vtmk6TSV1fUqI4tWOH7OOcHHgXb1QkqYRy/g5s3w4f0TT7FiIWM+DTBt0Lr1c7
+ 5nBoe86cUTWWl1M1e/YoDq9ZI1uPRcr5iuSVA3l5sJWcLsx1+aNHM3H5e3Oz5gePRx21WlV+o1H5eUGB
+ vDw3V7oVi9T8HyJ5ASxfDksqKuSjTqfqO7OZch08qDy+aZP8Aywy51WL5AWwkEQuAixkb7w+f/ItVC8s
+ ekBsz6S9B/4C+eG8h3vJrfkAAAAASUVORK5CYII=
+</value>
+ </data>
+ <data name="Green">
+ <value>Geen</value>
+ </data>
+ <data name="Define Colours &gt;&gt;">
+ <value>Define Colours &gt;&gt;</value>
+ </data>
+ <data name="Ignore">
+ <value>Ignore</value>
+ </data>
+ <data name="Help">
+ <value>Help</value>
+ </data>
+ <data name="Add Colours">
+ <value>Add Colours</value>
+ </data>
+ <data name="Retry">
+ <value>Retry</value>
+ </data>
+ <data name="mbox_info.png" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAABcQwAA
+ XEMBOS4mtwAABL5JREFUaEPVmX1olVUcx0+3ba6VDmP7w15w+TJ0rJc/EhuytuqP0Gz4UqhoDoLYcOAW
+ TpQFW2KaKFZihbMg/CdCxTeU0VK2P0SdzD9CGlsrfGtg7Y81pFjiPH5/u7vee16fc577aHcXvmz3uec5
+ 5/s5v3N+5zzneYRzzib0hwAmsia0+bHRE3XvYzg+DS2E6qAt0G5oF9QMfQC9Bk2Nqt1IAGCoHPqCsVgf
+ /tKkctHFccDSdGDSAoCBasYe7XY0bINqo6iFAQkFgMbeYCyLetClp33KHEGdJT4g3gBo4NNg46/A9PtQ
+ M7QL2gk1QWugF12A6lwhnAFgejJjORRqg4F3cP0w9M9YarDrT/z+DfS6DeYrFwgnAJguZGzSJb35apj4
+ xcG0CaoT975pAvk+CCIQAKazGcvtUs0XodGTaRiXgVpRV5YO5IANwgEg+5Bqnnrsr0DzM2ZwvnEj5ytW
+ BA2pxO+XUOccHcRWE4QVAMYbVfNLA43T+C8q4nx4GM2Of/budYX4wzTR39ZBGAFgfK5qvsLJPAHU1yfN
+ 039DQ64AVO436Ck5Er96AmQfFgGmoMLfnQEWLxYBurt9AKhsm24oNcsQ2gjAeJna+986m0+k0G3bOB8Y
+ 4Pz8ec5LsWEITq9ymQ0yxC1K56kQBoDYARHAfej4m7SB0ZpSIENssALEFyx2VwQ4FqL3wvS47p5PZICf
+ gwBWi+aL/0fzBHRTNxdeSEAoQwjmvxMBNnsDlJVxXlGhV2FhmMgskiEaLAA5/SLAGS+Aqiox+8jfenvD
+ AHwmA/ygBYhvG+TN2i0vgAULOB8dNUN0dIQBOCsDXDYBzBIBnvUyn8hAxcWcL1/O+eBgEqS1lfPKSs6z
+ ssIADCrp1AQwXwR4ORRAAuTKlSRATU0Y46n3KBu9HIIQJjHMvyoClGcQwGQ5ClN0ANIKPD+DAHJlgMd0
+ ANIGbmaGAAzL5kdMc+AJNQvdCQ0R3Ryg5wQhO97fmWoWstg1sfCFDADYLwMcs63EB0WA7RkAsFIG+MgG
+ UCsChJ/I0Qyh/2A+TwbAchk/lNbthZ5R5wGthP55PBqAfbL5qw7PA+yECPGuM0BuLufTp8d140ZyIWtq
+ il8rKPDtiBIZYLsLQJUahVNOEO3t9s0c7ZNoS+EW0d2yefqOs47kOw3bQ32nCDEXN98ObLinxw5Av65d
+ 6wJwGW3FZICvU81r58D9yYFzPzUK7wUClJdz3tJiVgN28nl5QQC09lDyEHI/PQ9PcwYYo2PscxWCHrSD
+ DKT7+xLd0KmVzVsjkBKJcypE3QOCoC3DWzrzxuNFh6NFNhsAAyoEHS/2RwjSgbqUjEMwnbqeN64D2jAx
+ Ng8VDaoQ2WhgR5oQ9LDyoa7X6RodKiPxmt+kBkYgZSi9hMp6VQiaaHQM+DHU5wHThbLroRyT+R/RVr7N
+ vNMcEHIuegOV0msgU6O4/jxUA+2BjkCnoXboIERvayiTPWe5f6zuPUHGvYaQkrrir1D/toOEen9GEV7m
+ at47AlI0nkRjO6F/IwC5jjoafYynFQEJ5HE0vg464wkygvJHoVVhjEcGIMHkw9AiaBO0Hzo+DvbT+Nz5
+ En/roUoolo7xBwIQhSHfOpzTqG/FD6v8PRJO78MpB02PAAAAAElFTkSuQmCC
+</value>
+ </data>
+ <data name="desktop" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAACj1JREFUaEPtmQtQ
+ E3cex9eKr7vO2evUu/Zs72F7147edTrezdmWdmyvnfM8q5718BwRX1WEU4vYIohKtYjhKSQ8E0ICojwl
+ ikAtiqL4FpQozxACBAiEEBIgLIIC3/vvQtLwTBC8a2eOme8kM1l2P9/v7/vf3WymAKB+0H+MgR+yftDw
+ bHu+z+lT1PZn58zZ/dbixd5bV22J4qz2yUz+RHjr1ofRd2pmHinY+D83QABnzJ69a76t7WGHVfahh+0O
+ nT6xQnD96ieJUtmnkqJG+wvlHTultX1u1Rp4qrTgNGvANzTCt1KO6cIq36dugADaTJ/uPG/Roq/sVnwa
+ dNDOMyVmZfiV3GUnCsv+kfZA9a9zZe1OBcpe18omfFHbAi91M47pmwikekwdliswPabaf8IGCOAzRC8v
+ XHjwk6V/9/VY82VC1Cruxexlx+8WrUy9X2eXWdq69WZNj4usCS7VOrjXa+Gj0YBLII06pqnHgfzrcE2N
+ h3uCEPvjwnFYenvQNubbM+89y6sZAwFWGSCAP58/f99fliw5usdul5i3OjA7c5k4X7oiSar89EyJbtO1
+ qkc7itXYqdDBRanrH3WTBr4E1ChOUxM87t3DzrQUfC7mY19cJHziw8A9GYq4U+G4k58GvT4fNC1lFSvh
+ Y883GYP2Yb6/PSVKYqAmaOASsP1Hr766992PPvLZZbeNH2h3NEtCFkrBigRp1SpJsXZ9rqJr+/1GOMt1
+ cFbosVtJRq1qxqGG4XIrKoNTegYco/lwFYbDSxQKX3EIIk9wkXP5JBobr5kgjbCjvebeTIWzKHrE4+x4
+ UEvWgPIYa+A9x3j+unw1HMtbsEXWiu1yPb6saYE7AR1Ju0tq8FlmDjZECeAUEQa3qBB8LQxGkDAQkkwh
+ 5PLzVkNaMiFXXIRjkD++lDcOYtlaWM8YCGYN2O7LEDmUtsKlklTAgrbweIhLDkVh4Wm0thZMGuhYRphq
+ fRHMgePNUhOfQ34DpglrQ/oNeGSI1txvg2Opfkw5RMejsCjriaGb2h/gVrMMSXW1ECsbIarRELUQtcGH
+ 1NPSNIJiebA/ncsyrrmhxrToWp7JwMqCdmyQto6qtSeykH0lyeJBFPpiXGioRHytCnFKNWKVzRDX6Mlr
+ O1LraORrOqFtp9HRMVhiYsSSAeZzSXY81vATsfKKBtMEdQMGSIWW3OiA3e32EbUy+RbiJNFjHuCwrA1x
+ NQZ820CjQtcJwxDAocBPaoAxcfd+FhYHJDIGwkwT+OBKB5bnGYbpb6dl4AhCLKYjJvCWIMf63NoJGAz3
+ cD4pGPZvvo2tz72kXUtR/2TXwDsXaHx8oWOQPjyrhosfxyI8k8rTNnDzjgQhCQI4bFoPLbl9yyNqIIqg
+ qPOsgYVZD/FeZqdJtukG2B/0QXv7vadqwGCg0U4kqh6+BhSKHEQkRsErIR5H7skQ2Qa4+fmjj4D3EgmJ
+ 3CgqlzWwIK0Lf0x9aNIyj0BoNDetgh/vBBhoFpws5rY2Gq1ERgPNzTcRlyaAd4IYB3KustDmCiSL3c1h
+ HQ7MfQ3v/3n13V9T1M8oW/cM0WsJ3VhwvIvVBx4CVFRetBreWgMmaCN4Kw09kbbFAPfUb+B3Uoh9krPg
+ abqGgYeoDPBKSwMvOQZXriVhoWs0poU1CPoXMTHwsqgb8/jd+JOnBNfvnB4X/FgGRoPW62nkXS9AQHwy
+ 3E+mIUChGQYdru/FV+fOIzBJBElWDLlwfnev9OauGNiENkSbDMyJeIzfeN5CSmb8uOGHGjD22rwiTNIM
+ tI4oIycP++NT8XVB2TBopi7eN+7CJzEW4pRIqFR5I/IscBbChtcYYzLwk2M9eH1b7BPBGw0M7XWrGXSL
+ jkZLCwN/FQezh3ebU65iF2t4QgSKijMtcsx3JBMIaRSZDMw42ot5m57cgKja0L8gB3rNJK1joIm0BLxZ
+ SyP928vwzLhoSp3p9b6kdPjFJsPjVLZFaPMr9etbRLA5phabDFAHgV+uOz6unZjvUFhlYOthDq0l0Ay4
+ ppnGEcld7OSlQXA8FTxxMgLjUiBOTEdVjQ715OrNl1t3K2E85m83xMImUB03eQYUBjZpY9oMNKMmDQ11
+ E41L8k48e6IPaSUPoWqkWeh6FY06otp6YqBifAZ+t9HcwN6z4olOILrSwAKbQzcS8EY1jQYCzEAfud2N
+ 2Sf7kFvRyUIzUpIbvJpaGlHjNPD6RrHZBCbBgIAYUA+kzUITMdAqJmkiJuk6AvzXrMd4JbkXBZX94NVK
+ mtSIRqTM+gkUSM/h+c2XzQ2kiyY6AX6FgYU2pm2CHqgImzSRVEHjxcRe2Gb0oIy8V1TTqCSKJN8Grbmd
+ ZrZZvpsLag8m10AUMTC01wy0sSJs0gNpSx48xFtne+F67RFkZBIVxEiElQbSshIxa2vx5BuIlBmG9bra
+ rCIKUhMm6coqGnIibkEX1l7uAb+wC+VyGuFllifQ0VGId7fyWPhJn0B4uYHttHmvGWi2IgPQTNIVJHEm
+ 9dIKGr753eR50CNkFj9EeKllA4H8CDzjpH5KBkoNpooYe80kLWegiRhoJmlGZQS+VEa+XpbRCJN2Q3C/
+ G0ElY38n1mpvY8EGvgl+yATOTHgRhxIDTEWGQsuGQDPgJeU0igl8fimNaGknOA86yFlIPeYidvEOALWr
+ 8ykaKDGYkjamzSY9kPZdApxQRINX1I6IUi2EcjWSa5SoJA8BLJ19Ksmt/SvrEwfBT/oEuMUGUz0KScIM
+ LJfAMotTUNEPK9eXWIQdycwaF29Qrr2WDdg4N2D5jqPk8d/1cR/IqbAdYeU6ckVVI0lZC5nuyWDNDVRX
+ X0SEMAjPb7gwDH7QBN7b278G2NPT7h78fkMEzl1KHbcJS1UY7XPmydv1GynghAZjm9cxLHUJwx828vHC
+ +kxQjg2D4Q/0YYZfV+cs/1bVFH77jv5no+YGBs6xL2y+hP1B3Ek3UVWVg/gUAb44GoQ1e0Px7vZI/Mr+
+ OKZvkoJyefQd7F5gqvfjxzMDOnQzfVvKqED9Kep4zwHqDGypHMw0/1VpRAPMNKY6NWCpMwf19VfHbYRJ
+ Ne9aKry5wfjMi4slLpGYv1GI59Zng3LSDE21b4bfQ3qWX2v9NF/tNSqCDqNSsJGAzrXm569RDbCVIovn
+ DQcBzp5PHtUE8/gjhjyzcT3KxWq3cCzaHo256xIwdVMRqeTj4an6k1Q5LaUk1VSSqieVjncI7AxrYEfa
+ hnp/hAoZL9fG159uzsNefy4u5aXiUAgPm73C8fHnAjC3tT+2vwjKuWV4qr4kVV993TSONo+kyiWpOhDQ
+ Xzwp6Gj/Z5UBxsiUf2sxZXP54FOaW39XZ/l3tMzkaEumBOiTqPgeD5Lq2xNJdTwmrTZAHejrm9Gfai1J
+ 9TIV0RlMUl1PQF8azwEne9vhBvpTfTTLz6AlqRaTVBNJV92ps1hEYKdPNsBE90e9sSfTaWZwm8qGo82l
+ IjsDSarrCOiLE93xf+v/v9e/1FsTwv8NWJPS09zmP/rAGm4g64OPAAAAAElFTkSuQmCC
+</value>
+ </data>
+ <data name="Hue">
+ <value>Hue</value>
+ </data>
+ <data name="mbox_warn.png" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAABcQwAA
+ XEMBOS4mtwAABLtJREFUaEPtmWtoVEcUx+/efb9ujGAKtoKk1mekUgkV+1KkSH1QlYjUZ7C2FcUiVTAF
+ BQWr9V0q0jaIQbSUBFrFKGpFUPCB+EA/aLW11EdbTW1Sq631k6fn3Oy4s3PP7p3s3phdMPBPZvfeu/P/
+ zTkzZ2bjAwCjpH8IoJT1RMxjhEOdNUidAoCGN6HQs52e9Ku+ZADQ7LiUaTIua1pnQHgaATQcQf2UBaAN
+ 3+/lNYTXAF9mMS8isbtoAdD4ZNX8K6/61TSi1x95CeFJBNBUd9SvMsCQl/xw92EZvDk6wEEM9QrCK4Dt
+ 6ujvPxy3Ac7/kIREImMyE9CJogFAMzNV83VLw7Z5oS31US4Kn3oBUVAE0HhPVKsMMGx4e+qomjYzyEGM
+ KRSiUIAmdfSPnEiwAL+1WtC70lQhfsbn44VA5A2AHX+gml++MsKaF9Fo2h3jotDwxAHQeB/UAxlgxKhA
+ TvMCYuGiMAdRmy9EXhFA483q6J88x6cONx+qX3bUh/v4eZX5QHQYADtaqJpfs4FPnTv3LSCwU+cT0PbA
+ ehwhmidMxd7X6QDYaZXa8Vtj+dRZvT4CZWXp9b9qsAm376YhVq6JcBBLOgrRoQig+UMyQCxm2IVKTZNN
+ m1lzoK5QY8axVXpYRyC0AdB4nTr6n22JOsy3/mtBxTM+x+gGgwZcb0lHgKAvXk1Ct3LHvWc8B0Dj1ar5
+ iTVBdtU5fobNb5hRy99f38BW6Y26EFoRQPPHZYDy7j64/IszdWhUv93jXOsty4Afr/P30zO174a4+fC2
+ DoQrABpfoY7+V9ucqSPmwRdbnSNKE5ZbTsV7f9yz4IW+jip9A/std4PICYAf8LpqfuoMPhWEmeWfZE7g
+ vv1M+POfzNznYHbtZav0zkIBzsoAzz7nc0xE1cz8DzPT4bvmmFaFps9ZXMdW6fdyQWSNABpfq47+9m/c
+ zdRMSe86x47X217IgzDceYp7iD76ZYNgAfCB0ar52e+HtEbyjZHt24RwmK8RueYCXTt2ml3FvtcGwM79
+ qEsyQOXzJrT87Z7HZKD/gPbJSOngZjbb9bUb2UK4lINwRAA736yOPm2Ddc3cvGPZ80Te++g+K983YRJ7
+ AHpNhcgAQOMTVPPzFuilzo7GGNBB3jQN+wy8bEX+ESCQK9eS0KPCUaUvZAVA40nUNRlgUJWpNfKr1vF7
+ n6s3sxcvnag07GSr9OcyxOMIoPGt6ujvOdD+zUIu0dygTZ36LFVr2k67Pe92fc5ctkrXCAgbAH/eUQ0s
+ WqKXAr+3WfaKIz8fChlAKeVmTuf6X/9ZMHCQo0rfwv4qUt6NHviiRTYwtJr/ZiFbh427YkDr94tDTJg+
+ K2gfYnTM6d7TfDDO7ZUaBcDX6ugfOuqeOrqde3Xfx8vYKj2P0scR/mTSABKtJkLxuAFClPNC0agBpEgk
+ LUopIUonIToTCAUCBgj5/QaQaAUT8vkMEFI9Sq8fOQBy3MyFsevfS+VR1xtRMkF7IEsZwPaeAuiGxGUp
+ WfhXiIqbUALbQnFsC8WwTYpKov/UCIWxLRTCtlAQ20IBbJNoHyZkYlvIh21bObcSboeHYrzueqQsRtPs
+ VqLYjWqfB0oN5GkKdXXEnkagqyPwP76kA5sYKmTOAAAAAElFTkSuQmCC
+</value>
+ </data>
+ <data name="monitor-planet" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAD6JJREFUaEPVmXdU
+ VNfaxo/GfBo1GuONuUmMJTHGllhCchV74VOxtxgrKkhVFCkWlEAAEQQB6SoggrRh6EMZemfoAlKkqiBg
+ A0VABH3uew5CBtCgN/pHZq1nTTtzzvPbb9l7n+kHgPlHP1iAf7L+0ea57HnT0S8tLR1cWFi4Li8v74Iw
+ WZRgGO5RrRXk0awf4HffIyg+OzQ03Cc4OPiAv7//mDc957s4rk+AysrKcQXFpS7qwX7PJnvK4XOfORgX
+ NAUTQydhsnAyJgknYYJgGr7ykcTXHqsh6ayF85f5Oa6urmvehcG+zvFagKqqqsGFZcVWOwU27R86zsZI
+ 388xIWQCZkXMwoKYBZCKk8KK+BVYHr8cS2KXYHbUbEwNn4rRwaPx0dWxGGu/E7oOVhm2trYz+jLxd75/
+ JQCZH+eeGVU83GktGPdBGBU4ClPCpmB+zHysTVyL7anbIZsuC4UMBchnyEMmTQabkzdzUBKREhgnGIeB
+ /IFgHMdhkdWhNjMzs23/i8mV50uGTTtwRWLinvN7f1RwsJhxwCVohrpvyiyNwOwZshZJr6wBMj/9ckxR
+ Qz/b6WB4DD7x/wSTwiZhYcxCziRrWuuaFvSu6+F04WkYFBjgZN5JHMo+hN2i3ZBOkOYg2Ej04/UD4zIU
+ X+nJw8DA4ORLiH52SbWjNGzD58qe9pBXNPGyUTIPDFGxjkhRsY3KVrGLLlSxj61QtourOWwf/cDQPemJ
+ e0zBC9GNu7jb2Ib258CLF4CdnV1pLwAy/0V4enXNB7P5YFyHYoDPAIwVjOXSY0PSBihlKkEnXweWNyzh
+ VOGEqzev4krlFdiX2cOk0AR6+frQTD2Og2GaUA/ShXaQOfQEF2Ho6Q8Lj2Q4ByXfdRKk1TgGJt33jkhr
+ jM8ueV5eU4/m1uecKXG1tDxFUVExQkPD4OPD7xKPx4eb21U4Ojreovmrf1cKkfkBafm3M4ctuA5mVBwY
+ q18wzG8YJodNxrK4ZVyaHM89jvMl5+F5yxPCWiES7iUg9m4sknOSkZ6Xhbi0ZCRmiFBYUo6HDY1do9XT
+ HPu+ra0dFRWViI6OAZ/v2yUfn47XQUEC5Obmo7HxSS849nsvL+8aAhjSBUDdRvHn/WVghoSCmV8JRm8/
+ RgaMxHThdKxOXM2ljn6BPpwrnBFeE47chlzcarqFksYSxKXG4TmZ6qnqOzVITEqGr58/fH39OPH5Hc8B
+ AYHIyMjCw4f1vQy+Clj8MxZAIBA8IIDPOAAy/7GFW0kD82EAmO8ywPx/NZgDzvjM7wvMjJjJFa5ypjKX
+ 866Vroipi+GMt7S3oK6lDsL4CLQ8A4SRsfDhk1nWsF8AUlJSUVtb99YG+wLgUZQiY+IbCWAMB1BSUqL6
+ 5TwyzviCmX0DzOoaML/exKdXJbkIrEpYxXWbP67/AcdyR4TWhCLrYRZKG0tR+KgQfKEvqu89hqs7j4tC
+ Xwb+7vee3r6IT8lsI4DvOYCY1OJk5qNgMB/4g1lBo7+hDsy2+xhqK4fvQ7/n+vxO0U6u+5wrPge3SjcI
+ bicg6nYehOUFuBIqRGJ6Ljx9Bbjf0MRF42kb0Ep61k75Tp2D7R7vCs7T2w8p2UUYMmToLIaWB6MOW914
+ wY3+iIiO0d9yF8zuB+h/oByjA2bil8hfuDTan7EfJ/JOwPS6GxySWuCc1ArH2Kew8a+Eu28oYkTXkZJV
+ gPpm4FEL8Pgp0Eh60go0kZoJrAuOwP5XOE+eH9Lyb+KbCROXMrm5uVILD1LasACfRoJZWwtm6z0wex+C
+ UX6EoQ6a+C70O8yLnof1SeuxL30f1DKNoC3yhm5qIHTSXOm1FRzc3FBQ1QQ3nxDUNgJ1pHtPgPukB03A
+ QxIL1kBgr4WjiHGRewnHRe1l3xdPOw8CyKR5YeqPMzcxWVlZu6bJFHcAsCm0hiLQCaDyCMyxWnzqs4DW
+ PhMxJ2oOt3zYkrIFu0S7sDdtL/ak7cG21G0wv2yHG/cAG2cf3KwHbpFuNwBVpOpHQM1joJbEgt3tCUdg
+ r4PrFrWXKXnVyw85lU8w82fJfYxIJNL8Vr6qA4DVgtKuFGIUCOBwI5g/sjDEYxE3qf0Q/gM3sbEzM1sb
+ i2MXc9HRtTuN/BrA8pIPB1JCKr0PlD0AykkVD4FKEgdG6gS78zo4ihgXOTG4xxQ9NiWvePgh985zSMxZ
+ qMYkJSUdmXaUUobx6wCYktVVxMzeejBKLyF0RejvsghDfIdwa6PxgvH4NuRbbt3zeeDnUDE9jKwqwPQC
+ H3kEwsJcrwUK6oBCUtFdoJjEwREYC8eBkViwm51wYlHrBUfpyKalk7s/sqqBOQuXH2fi4uK2LzaitBmT
+ 1AEwlCayldSJNlEhb7/fUQvyDR0gahSdS8u4NVJPbTPYhZSK5zjjwEfGbSCTYFigbLpQDunaHSCXoDg4
+ AuuEKyK4LrDOqPWE65GSF9z8IboJLFy+/ncmMjJyyeZz5WCWi6XRl/EdtcBCsPWw4wHXlRgZgjkSCMbr
+ o14A8/QWgp9QBn07PpIqgORKIIWUShdiL5Z2C0gnsF5wBNYJ1xU1AuwVNTE4e7cgxJU+x9LVvxkyYWFh
+ w/WcU9oYFZoQJoj+rIXJlErSd8Cso660keYFFmYziX22XdALYLzhdJg4BsHIMRQhec2IprViLCmuDIgv
+ BxJIiQTWBUdQHByB9YTrFjUC7JmSl7wjEZzTiOUb95hyE5k3PyBksGorpUo7mJFRHRD9qSamXQMjRZFh
+ J7eVBMMCsc/aR3sBDNfeApXjlnAQFMIhpBChRUBYMS0vWN0AIklRJUA0KYaFI7BecBQxLnJicOkE2DNq
+ lwNT4JFUB+mtCuc5AB6PJ7NMn+YCNgq7msAMolm5syt9QpObBLXZRbfBLCYtukV14dQdwJHW/lL+2KWk
+ B6+MZpyyD4N/PhBwHQgkBRUAwSTi6gAjhb+Ei2DhCIqDI7BecOJRe5mSbmHXcEFYgVU7DtpzAO7u7h9a
+ XuKVDzz4rANiPeX94JA/IfpRRP6dAGZ6AZj/UL3MzQPj0/9PCDUFMJMKsW7bMXhfA9TN/eCVA+41Lxfw
+ IfHzAF+SHwv2Ei6I4FgwClpvOAIThxMWtsLcIx4nLXnQOOsOl6RHWCuj4dS1nKYNwsb1+lQDLACr/W00
+ 8rQ3+IBWqJ3RYJ/7UWp9RHBugzsATKeAGRbEHbd0hQrcsoBDpn64kgG4ZoJ7f5Xkng14kDwJTByOT3Ac
+ GEk8agF57TDzFEHzHA/qZjxoWgbCNqKWO9elhMc4fJZfM1d6x9lue2Ira1v/qVq0J+iEYJ9lmsFMTO8O
+ wYJc+pQgBlFEqB5eAv5nriyc0gEVEz9cFNGFSI5p1LdJzvT5ZZILgV0hMHE4Fswj+wWMiezQWR5UTUg0
+ CKbBt7jfOaW9gK5rZssOTaus5TvUnSf/vESOVqIf99pSWlhYDDEwOZ/z5WFqoeIQnSCr6HNJqpVJmdSJ
+ vgajKN2xAfqa5pDpufh+/kGYR9RD4Yw/rGjLbUOyTab9K8k+BXBIBS6QOuEMvAuhfMYHikY8KJ7hw4BX
+ wh3Dyiz8PmT1rt5cK/9HsMTSXw3+9eX4H151Y6DXXQkjI6PRJ/RMiieqFfWGEIdyWUKbHkozsc8+k7aC
+ mnU0ZE/7wzSOTJDM4wGLBFpikHS8y7Hf0Bf79HmQNfDBiSv5sEoEJ8u4dqhax7cu23uufu46BZdvfpi7
+ jUZ5UF93M155W0VHR2fY8eMnBPPVwjBAhdprz2iw742ce30+aHMM1imbQf5sOHRDmnGMV41d+tSddH2w
+ W88HahcycTbmOQfG6pRP1Yv1Rxwf/bz5bP3XSx3ah60sx7AVJe1k/F99Ge/8/rU3trS0tPqr0WPfQe0H
+ 05SiMED56V9HhKD6y9VDYpUCjnlXY/NxNyhaJcMgog1G0eCkH96KvWdCm1bK6Ves36XRNHqecfvYnS0Y
+ t7u9S6PXF7QSwIi/DdB5AkVFxWFycnK6O2X2VyyUOYtvZCMxUu46hshXY4DSEwyUv4uP9xVh5M5YjF9j
+ jMm/SL3QiwA6pepS8mKzhl37DnXjdo0zlgi7lovrDQ1wdA/Esh22mKHU1k2Tfs15SgDD3xmA+Im2bt06
+ ZdOmTepr1661lZaW9peSkkpdvHixcP78+Zdnz55tICEhsfyriT9VbdHhP910yPSZhukluAqjkPfwIWda
+ XI5egdiv6YhF6s+6SVIuE0rHjqVLrVun8CYQfd7cfZOTdB4zb+nS1crHtOuSKyt7Ge4J4MQPxCkjV2zQ
+ ae2mlarpyKypgfDatfZ1v/3mRNH4v7/y8M4A1mzdetArMupJT6Pi7/Pq65F57x5EtbVwFIRCz+gC9ho/
+ 7abNmimIpQEQ0e2Y1Dt3aHmilPhX3eidANAFPtDUN6h5nflrlEJpdXVIqKpCFJkLLS2DV1YWlFS1oWbV
+ 0k0yJxIQUFCAsLIyRN+8ifCiIkhISmq+LgrvBEBi3rzd8TduvDJt2BFPrK5GJBkXlJSAT+Y8qJCvEIDa
+ UX0o66VAz6m5S4q60XDJzIJnbh78CgsRUlKKrfIKtFp69V9h7wRg8Urpq/mUHj0jwJpnR11YXo4AGknW
+ 1OXMTNinptLElgBDa2fsUbXEea+mLqkZCnE+MREXRCK4EKR3Xj5ktY7R7YD3CDDtx1maTv6B3QByHjxA
+ MuUwO/KBxcWceeeMDNgkJ8M0Nhb6QiGOWzhAWescrgQ96dKJs2EwjIjEubg42KWkcNHYuGsfbTzfIwDV
+ wEClI0ebxCPQOfrhlMu+BYVwy87hRtU8Pp4zqB0sgKLxOWjoWCIwurFL2sY8nAoJgVFkFM4nJOLERWq1
+ S1a6vVcA9uQbN+700je1RjrlOwvSCcAWoziABQGcJoCTAgHkLK2hpK6L8Nga6Fl40sLOGgr2F6ATEooz
+ UVFQt7SB1knj5jFjJkx97wAjRowYvn27Qujps7bwiopBVwrRfwDiKWRLKWQWG0dRiOBGeo+BMRTMraDp
+ 74/jQcH4nf7QOOXnB2UdQxiZXLwnJbXmLye0d1LEXQsraqcbNmy3u+wiaDWzcsYZm4vwIsPhVMT+XBHn
+ ckXsQEXMFioLYhwdzaWLPhlXNjaD1mlzWDt4019SNoWSkguW9DWRvlOAzov99NOc9QoKR9ytrT2qrnoI
+ YWLhiNMWF6FPRatrYQ9tC1ucOGcNbVMbnDKxwe/GNnTMZfrTI6Xt6NEzotWrfzs9bty4f/dlvteG5k1+
+ 8DbHsKtKKan1p1RVT/GOHTOK0dW1yDM3d6nm8WKfOjsHNxga2padOmWapqFhELJnz0HHGTN+WvU253/v
+ AK/cQTHMYAKbSPqC1O9tDfc8/r2k0N819Ta//8cD/Bf1OK6O+/e5egAAAABJRU5ErkJggg==
+</value>
+ </data>
+ <data name="User Colors">
+ <value>User Colors</value>
+ </data>
+ <data name="Sat">
+ <value>Sat</value>
+ </data>
+ <data name="OK">
+ <value>OK</value>
+ </data>
+ <data name="Blue">
+ <value>Blue</value>
+ </data>
+ <data name="Base Colours">
+ <value>Base Colours</value>
+ </data>
+ <data name="back_arrow" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAACTtJREFUaEPVmXls
+ VUUYxVtrLJFUTZTFJUgQgooouEAxGheM/qMREo0b0aCJ0bA0smihRUE0alwQlQfiAu67uOPCYlUoguKK
+ Ii4gsgikaGmLRoz1/B73NNPb+15f+4wJvhzv5c52zvd9M/PNtLCxsbFgj/4PAXsy/jPyBXMLOghHCqXC
+ 2cKFwlUReOcbZdTp8F8ZLS8BInKocI4wVpgpzBYeEh6O8Iiehr9RTl3a0PbQfMS0WYAGLBT6CZMCwpB8
+ VJgj+PeY3uJwGfWoTzsE0Rd9FrZVTM4CEohjUUjwg+jjwhPCk8JTwtMJ4Dvl1KM+7fjRD/21WUhOAtRx
+ R2GUQIiExCFhws/o/VnhOeH5CC/oafgb5dSjvgXRTyiEsTrm4o1WBaij7sJtAq62xU0cK0MGchB9UXg5
+ wjw943AZ9ahPO9rTD4YIhdzO2K2JyCpAHZwipASsTtzicgZiQCwZkn5F/35VeE14XXgjAXynnHrUR5DF
+ 0J+FMA7jzYJDNhEZBaghS96DAXmsg8tt8Zf0joVNGsJvCvOFtyO8o6fhb5RTj/oWQz/0Z48wDuMhAs+X
+ ZhKRKEAN+ggsdawS/Jh0odWxHBbEoiYN0XeF94QFwsIE8J1y6lHfYujHHsGr9gbj8mPu9UkS0UKAKh4u
+ 3C8QNnHyuBtrYTksCAGIQArCi4T3haoIH+hp+Bvl1KM+7SzEHqF/xomLmAG3uIhmAlRhL2FKRB734UZb
+ nk6xEuSxOiFh4osjwh8WzCio7jm+90/9xh2/Qd+qAyzV+xLhI+HDqD7tLIT+6Jf+GScU4XC6GY6hiLiA
+ waqAu1htHPNYwuRx9VuR1QgHLIllIbTkoKmdvqmYMblh09baxrLU+Fp9WxHDcv3740gUYiyEfugPb9C/
+ Q8oiPCfgNThRgApKhHsF4t6rDROWmHTYhOSxHuEBkepjr++/Yd6C+bu2/bazEYxOjduh758H+EzvK4VP
+ I1GhEPqhv1AEnmBcxocHqx+8CO8Si2jygD5eIjDjCR0mDxsNqwIT1mGDhRiEwbDeUi10y8+dMGT7mrUb
+ 08SNUalx9SpfFeBrvX8lfBGJspBl6X529xeKcDgxPjzgAy/4XdpMgD4UCaH1cVkYOkwwx7wtv7RwZuEn
+ l065onZLTX0z8ogYlRrboDbfBVit92+FbwTEIASvfCLgDUTYE8wtxmPccD7Ay14oSp9l0v+bW9BXIPZD
+ 68dDh6WPWE2HTdEDRZ9eecvVdVu3N7Qgj4CRqbE7Ve+nAD/q/QdhjYAYvPNlTAThSP+Mw3iEbBhKoRf6
+ hgKGq6KXTWKNmPPEtfUJHZbAj4rvK1454vay+jBk4u8jU2P+UN31wi/R82c910WCvtcT7+ANi2DCE06s
+ UozDeHEveC6wvF+5+zS5Oz2eLnjy4qYw9rFCk/WLphetGH3H2IZs5CkbkbruT7XbHGCT3llaEbVWwBuI
+ wBOEExOcVcqhFPeC54LD6IE0d/1vfyFcOnGTw4fljM2KmHxfU3zJBeUX1bZGnvIJqZt2nThpwE7jpMqB
+ DUK9UCfUDqgs/X1ARen2ARWDagZWDNo2sOLkLaUTT94sbDxsUjdCDC8wLuPDwysS/FjiWVL3RwA7b3z1
+ iYcPm03VqWWnbd3w6/bEmM9FVK51zrt56BbGExg3HkbhPOiOgH6BgDD+SdJYylg6F/YZ03fd59+u+SdX
+ EvnUO2/qEAQwmRHA+PCAD4b1PGDB6Y+AMyIBTAwLIDNsEnBI5WFfvb5oQdMmlQ+5XNoGApgHoQB4hRP5
+ DAScJsRXoFDAu8eW9/sxvlHlQqS9dWICWEDsgbiA0xFwXGseUPmiiyZfVtNeQm1t1wYPHIeAbrnMgX2m
+ 71M97ckZf7SVTHvqRwI8ibPNgW4IIIlL2oXZwsNNrKr7lB7fvf1B1d+5kNq8bUcjK1Z7cO6U870KxTcz
+ lvdwFSrxRnaPCpxCk/8n7QPpBK7nxF5r36pa3KqIa+4YuatzeZcdQl305L228w1dfhNqhG1dru/6q7Cp
+ y/iuvwjru447eK3wQ8nU/chiGS9pH4Af+8B9QqFzoWH6R7gTk8g5C222E+v70iMm9Fz35uKFWUWMSI2J
+ 78Qb1ZadmJTCO7FzInZistPWdmJ4eSe+PMyFeiesRBlzIdWt7lF+xLqn3ngp49Ia5EKkDsDESerIheIJ
+ HbkQJ7hcc6HeoQDyobtiYZQpH2JykTUuO+DWA1aX3TW+ISmdjrJRyJKROhN1EkdaHc9GSeTol/4z5UEO
+ n2mET5OAKKUeEoRRpoyUmAxPYst0d7HyrBvOqfls1epmu3SW8wDEfbAhgeM8YPLZzgPhqWxo0omsOPJC
+ eJi3F7wrk5f4RObjJIOv6DWx9/o5857+KzhS1uk7BxcD0qTOPsiEJzKfA3wi8wGfcZ2FhtYvbiEg8gKX
+ WfFdOTzYODcKRRCzxO7HHW8rWXXtnWV1LKHRmZgTFysKT5+JsTjx7jMx7eNnYh8n42di0p1B2W4lmAvl
+ AksqRzdmvA83PtiHVyq+B0rfSqSFzC5YfvqEwVsurhwWv5XwjQQeQ7BvJXxP5GNkSN7Jm1eeCrVrdgWf
+ dLHVSZXuFsJQ8vk4LoI8hYwR1zP5sCQWXVI8uQOhwuEkBKRtcerTjvb0E94LMU78XohDV6esF1tNcbU7
+ veDEk0kEscku7WsWCPieCFLh7RxEDb5T7nsgXzHSD/3RbxJ5rjlb3Mo1W4VaKJtbcJQazQpEOJyYE74b
+ 5cBtIVjQ14yIAeH9qL/5OpH6Ju7bOPr1PRDjseNy2Dq6TZe7gSeOUWO2bHuCTn1fhIvjQohfSIU31BA1
+ +E459XwXSs5FP/Tn+x+TJwrStw/tEhCtTAeqk0rBE9s31UxuBrQQXE8IYE3AOTYOlzlUQuL0x1JJ/ywg
+ NwoH5fUHjsATe6uzywRft+NaNjsGZGAmOa5HDIcOiAFEGf5GOfWoTzsTpz/65Udutndr5LPOgaTG6pTJ
+ PVLAG/wYEIvhcsQk/Z3MfxvjacLUoz7taG/ioxgjF+KJG1muDSMhI/T0bQYutxgsCbFMoNykaYdXMUqb
+ iOclIAitfTXwicJwwWcKJrx/EDT8jXKSMdqcJOybq+ESoyKfxglLL5tgT+EE4UxhaATe+UZZi80oHw6t
+ /pk1n87/j7Z7vIB/AbqI4PWoWfWuAAAAAElFTkSuQmCC
+</value>
+ </data>
+ <data name="Color">
+ <value>Color</value>
+ </data>
+ <data name="Abort">
+ <value>Abort</value>
+ </data>
+ <data name="folder_arrow_up" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAB6pJREFUaEO9mQtQ
+ lFUUx/+77LJP3o32HMvUIqxMe/hEGlHTMTVSS53M8UFoTWmDItSWGiMWkQgLu6CwmbtLigpJVgrjjFkO
+ A6mlkZQUmNRMNb2cqWzSbucu7bIL34tlF2eu7Hzf/b57fvece8//nk/FGMNA/1NFq25kl1hnSMblAAPZ
+ MBGzkIvvMRuFBBDZ37EH1njAiJdwEmfA8Am159GIB/BgfyAGFmABbDhNhnMAb3PjF8zBdvKGLhiQAQPA
+ BMxALX4PMN4LcZKAMj3emNJXiAEBoNk1wEJB4z/zQr/34Fekoagv3hgYgAUo7RU6YjDcG1lowlikKvFG
+ 2AEodKajRiR0pDxSTd54FFbyhl4KpM8A9EKtVouhd9+Nh1NSsOKmm3AXXVMLDcIHp9Bplg0dMZBT5I1s
+ 8sY4TBODEASggQcnJWHGtGlYt3Qp3sjMhPOVV3B42zacdjjQeewY/m5rA+vsBPvwQ1xJTcVTggALaAZ7
+ 7jpy60Do/n78hnko4Wup5zgegMREjFm5EuUFBThhteLrAwdw6dNPwb77TlnLycG7vV48HlNxgAYOxmD+
+ DIFrDtDfreig3NGADDiQiPm9xiEqVW4uzis1VqjfoUP49frrMdz7ck/o5AQXOje4wZ6qAMvfDbavBmzY
+ MKRIroHbb8e9J07gSn8A+LOvvYYTNBHuwkIcnfAcfgaP3yBmf62t2+vffAM2bhxWSAKMHYsVFy4oCxUl
+ kG9/ABZd62f8cbDBlWBG/2sSYBvKA22ZORPZkgBjxmBea2toAPiMjcwAG0VGpFEYrH8TrKoOjF+3VoFp
+ 6+W98lxZoC2LF+NVSYARI/DgKXK3ktmV6/Pll2BSkzGlSB4gvQfAqlWw+62tG0aP1syfO1dnWb3aYEtO
+ 1i6jTR0jjh7t/xqQg+P391J46Q9JQyy2gn1A/RwONaus1LCsLF3Hli2mY0VF5ra6upg/WlvjabKvYR0d
+ CWzyZG06P1MkVFfjNyUGhKLPJFqkUos7ZZOGNTfHUY5J8Bgq1urrYy/HxqqGcwC13Y7OUBjX8x0tLWB1
+ tAbeektNTcN27dKxaZYISYDZtkhJw71AxcXm8zwFeBLZ9u1oDRagowOMMjNzu9XM6dRQi2S7d+upGdnB
+ g9Hs88+7XO5thU4zowwhCjG9VBlAbq6p3nMc5v+9/jqa5QA++wyspkZFhkZQ01LTMZfLyPbsMbPGxlh2
+ 8aK0y70ALS3xLHaXOEByiVaRB9auNZT7APLycFQI4OxZMLtdz6qqTKy+Poa1tSkzUip2+b17SzSiHrif
+ 7sk9z++npelyfAAbN+KgEMD+/Sraw0NjtL9RC206UYC7rBGyAGfOxLOkpIipPoDsbLiEAHi4KJmNvvbZ
+ VGHyiDWh3WhEsVp2TKcz+kdawCYfwJo1sAsDKFtQfQVobIpl+reFAYYoACgoMDf7khv/kZ6OfGEAg+xs
+ 9NV4b//EIuHtNKlY3usWi7E6AGDhQrzcE4ALvL17TWEDSBZZyJOs8os4PV3v00eebZQU3/M9ARoawE6d
+ igsbwOyySME1MFsmD1y4kMCmTNGuDPDA+PFY9u23gYKOJ6Zgw0PJc09WCO9ES216yXEbGmIvx8WphgYA
+ 0JEyle/5/l7gyUqJIcH2yXDoe3uAkuWLFUbJcW22qPP+8toTQqRIbzt+HFcDAXRhBVi6s7cHzHvBmmiH
+ kpqUrVu7JESAB2hPvaa2NlCRut3SMxHszHufe7y8N4CSLLx+vbFMCCBi585uRcp1z+HD0WH1wBx770W8
+ rFQ6/jn8Y4/pNvQC4BdKSroVaXW1irW3h15C+HstlURbQCYmRevYFyU5aWfPxrNRozQBBWBfLFE1wadI
+ XS75vbi/IXQnJSx/gJspA/NTltR73e7on3oWt3wAVBbxKVKXKzwSwmscF4iD7KpuANJFq2S2T/4sHSub
+ BCtz/CLVdN7x7kIuV/gkBDfk/YYYpnqvWwsNK1UrkuqbN5v2iAJYLHBygPZ2LiHMYV3AWypJjVLp0hNC
+ jWCWSmU73tNPG/JEAdatg40DHDkCdvp0+CQE98AzOwy+8BldqFF0muMSYvr0yOWiAKtXdylSlyu8EoID
+ zPs/B0RQoaukWpm3Gxpirl53nfpmUYAnnoClCyC8EoIDTCzvOlJOLlA+Vnm5+QehCp1vF5ozB2s4gNMZ
+ XgnBAYba1cy0D2z/Eelkee5cPJVlYv4qLY1qz8gwuCQBJk7Esi4AZQsq2DzQ1BTHoqn6tr6ia6fjhQIq
+ GPxTVhZ1kU5aTRs3mmqefdZQMn++7oUJE7Rpej2ulayNem+OHImH6GuLp/oQrHFiz/EF+NFHsVcdjqgf
+ snMMX4xaEPE1lUV2LFqk25SSol0yaJDqVrHPVFLG+87E/IfBgDtKS1X/ymVDMSN5KZCXBKuqoi4VFprP
+ 8cJTZqZx15Il+jw6gKwaMkR9T18+n8oZHqBGPSTAoPx8zd9ys8/1SG1t9GWr1XQxL8/0cVaWsWr5cn0B
+ bXFrExMjkuk9UUoHD0W/bl0NaPLzdX9ygK++SqAKccwVu938c0GBscViMdTRObR41qzIDSSmZnHYUAwe
+ incEfKWcO1f7xiOP6F6+7z7NoshI3BJsXIbCMKXv+A8bjZ++/ZSOlAAAAABJRU5ErkJggg==
+</value>
+ </data>
+ <data name="mbox_question.png" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAABcQwAA
+ XEMBOS4mtwAAA1pJREFUaEPtl11oUmEYx/2aigx30ag2XXURYQwTkiBDMaSrugi61CBidhVaKUF4M6Iy
+ ugga9kHBRqMkKiq6ihYYMYqtj6tiUBch0UAq4oSY0Nbs/4xz4PBybJ4v5wGFP8ej7/ue/+99nvO872tu
+ NBomQ38IwMgytPnl7DHy7HcBOiF63RQSRwHlOAaN9fb2vnW5XN+dTudvfK95vd5v4XD4/ejo6KNqtZpD
+ n4PQdsiqNoqaRACmh6E3EC0q/5Xb7ebS6fRYxwDAcADiVjIu/t9sNjcSicQsIE5DATVRUBUBmLJAH+SY
+ F7fN5XLPYJ6isVcphFqA/UrNUz+8H3WO467wEDuVQKgFuMEC2O32xWQy+XJmZuZmpVK5Vi6XrxeLxfs+
+ n++rFGyhUHjMA5zHtUcuhFqAV6ypeDz+mjd0Edc9UD/kHBkZGUTbRbZ9KpV6wbenVBpuN8BH1tDU1NRt
+ 3tA+psT2oO0ftn0mk3kuAoi2G2BWbGhoaOiHyMwgA3BAKoUmJiYeiPqE2w0QHRgYqGDRqvn9/i+lUumW
+ FACM26E5FqCvr69Wr9cLqwbAz1YWVxLlsKBTzOxfZc1bLJalfD7/hOm3pa0R4B+2GVcSmaZKchRaLxiB
+ 8ROseZvNtoBtxVPG/Fncy95aqKpCK80WjFPe/xUDYH/E3cOHMX8J97Q3ku1HdodWHwLTG6FfYvMOh+Pn
+ 9PT0JGOeyu2OVsdl2+kJcJdNHabi0PtyDtqk1Dz10wUAxtdAC2IA2jZI5PxaNeb1BIiysx8MBj+rrThS
+ sHpFYBsLkM1mS4YBWA6tyXSHIGjvHwqFPtVqtcsiACq3mkyeJoM0M4NqGaQdKTPz9PIeMQQATNJ+SLxC
+ C99l73maAesaAf6hhxiIw7iXveK2FQC53w8dE4SD/EmPx7MLJpxapY4wjuYRgGk6J7+T2DrTqhwwAoBD
+ at/P/3a8C8CUXz1SqGkEIpEIHV6i0AatIqEHgBXpMs+mkdVqXRofH3/IV6QLuHq0gNAcgF+Ft+LQMhmL
+ xeYESZy+dncsAG/M1mQRExazLsBytLUIY5MxLPj9TJMo0BFS9gFe6jl6AtDY66CEhBSdf1cDQO8J0jWF
+ dDev9zvQBWilwLRllloxorRNF0DpzGnVz/AR+AcOBL1o7Kmu0QAAAABJRU5ErkJggg==
+</value>
+ </data>
+ <data name="Yes">
+ <value>Yes</value>
+ </data>
+ <data name="Bri">
+ <value>Bri</value>
+ </data>
+ <data name="Cancel">
+ <value>Cancel</value>
+ </data>
+ <data name="window" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAfNJREFUaEPtmk8o
+ REEcxxe7J/9WbvawVxcpBzkhpUi5OLg67EWSFAclxcnJHrW5UFw4iDO2uMiKZ6WltSVa689jd7Nr/6j3
+ NbslntFr9Gqnec3W57avme98f7/vTO9NGQCb0L+CAJEhi49WgiYo4wUBneXlRQGklsTBbi/OeVpcAQ4p
+ gG+52aUDnBu+4mcTO+uQb2oBRKLGiQ+SQqPFFOrqhXpPdjOR6BvAC5l7jxTAyzVrO3AcPMHG4gJFKHrH
+ 1CcrCjCyThPOsvXZEeZwiCkdCpZ0Yxs6cLC/C9/kMEXw+opJgGeNbHJDNEqCTcA26rEJu44ddEkBkA7I
+ EvruIdnERhsY9xS6Sb2hkPm/uc1lmWJ0KwzM79FEcmwxeoZlnMKn4wLb7DHK63jwn3GtfZT4z0rw+q90
+ gNfKf41rcQfSaTzEYhT3uRxTjJbCHUMHEl7vny99VL+fScDE7AJc7laK8yeV6fnGlya4VLeO/uQg+z5g
+ VoBnbIa8Z22gUGKPTAKqn2phe7TpaHvtkALAWkLSAVlCJlOIewm9rq4i39xM8RwIMKUIdwFmN6LIewah
+ eJIiqmlMC3CpJRDS4jrC2ht7jJoVUIrnLX4WEuBVu3SgFHVuNIalHGh3OJCprEJKJMics+QTU7fQFz2K
+ N21EvqlSmPsn8UKYLq/+Q1MAAAAASUVORK5CYII=
+</value>
+ </data>
+ <data name="folder_star" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAACKZJREFUaEPVmg1M
+ lPcdx//3fs9z99yBEJt1WzqTrc2SZmk6a+K2LpvGtGE1jd1qRnWmXRpaK77WicU5GOCqgnIg4AsHihYq
+ xyFUsWoEkbM4DirH+/sd9waKAqIyqw3+f/s9d0B5u+OgGK4kv+S457k/38/v/3v7P4cAAMgP+ocH+CHb
+ vIqvWK3+HZrYmwPxuszb9XkFMIaqMyvXqT//+u8q4VQiq95VLTKuVRv9FuBGmKrUtIGjNVu4zNqPOcFY
+ oTVbuT+ZNnJ91R+qHvktQO02zlq/U0kbditpY7QihRfaFKMQNv1bEdf4L+WT+kglrfsHN+iXAHURSgmK
+ HGreo6Ct+xW07SBL2zRscruGvdyWyNLWBJa2fKqgCDPglwDo6Z/zwtuTWGo+zFBLOkM7M4dNy1DzUYZ2
+ pCDUAbZ3XgGwivwULaTqPdUKUzj3BwyZ36L4JejhDzpSUXAGQ22fyan9tJw68mTUqZdRhw5/z5FT6wk5
+ D9Iz5wDY+KRoCl/6B4pXGNeoG258qKK12zmMdSVtjWdpRxrjEujIldOuQhm9+aWU3rrktpsXpLT7nBuG
+ h7McY+5jeNViuBXWf6I8iMm9CR2yEtdWT1lGUZyYZcnzS5eSNaGhZOeWLUQTHU1yEhJIyeHDpCE7m/To
+ dKR/82ZyDe8dVz2mLIfvqX5p2sTd55OyGeO6/RDrChdePC+0p1hK71yT0DvXJbT3upj2lkvo7VI3iPMM
+ QpzCnTjCuPKCdwBWLIoV7DMsw2IXwEsvkRe3bSOavXvJ+eRkUnn8OLEbDOSxzUagq8uzNTcT+tpr5C++
+ 7ARWnNDGKCVticfYPiJHz6KHv5DCrWIJ3Lkuhv5qEQzUozUI4W6tmPZXiumdMolrZ/jQ4oHbk1nKJz2G
+ obZ6A+fqHYRhyMKsLNLrTai3a1FRJGcsAL97zz5LfrFiBQl9/32yIzKSaPbvJ7kpKaSsNEE60JbEgCVT
+ Do48Kdy8iOK/QvE1IrjfJoRBmwAG7QJ4YBbRe40i2meU0J4SKe36YngXMOxa9ilSGv6pHN11EhJC3p3O
+ 094AjEZyf98+cjotjZzHnTPl5pJbFRXkid0+eeec+J75lBysWTJwFri932sUw71mIfzPIYBHfQQe3yXw
+ 8KaQPugQ0bsm3AWDhHYXyaj9c1dCx0/cbbJmDYmYrfdn+jmbSQgdRxiwnpRBVyECXJFAX5UI7rUK4WG3
+ AL4dJDD0LYFHvQI62CmkAxhKfG7wYYRV6gkm8/JJAKtWkc0zFTKb+61GETTvY6HjEAJMuwMCTzvQgxXs
+ x+NCdvlyEjYbQTP5jOWaCOoiFdAUy0K7hoHO4RzonioHMJQemIWYzCLaWyGht4ql4CyU4a7JoSNVDpgD
+ XzXsUkpGIMjLL5O3LBbv1WYmYife21EshhvrOajdpoTGKAW0JjBgPioHezbmwbgqJMYqhNYggrs1YujD
+ 3LhdJoHuL6WY8DKEZqAtiYXhKpQ4CrBwIfl1dfXTA2i+IoKyoxK4+KkMru5loPIACw0pfCViwJ4rh65z
+ MkxmKdw2YEX677CVS6CnVArdF9D7Z2SAfQCwDwBfgvlSPNwHVo+cJn9SXEwefh8vO50EsBrB6dMCyMoS
+ o0nhJG75iRMs6HQcVFUtAKczGHvKd2a9ogLsxIDNDBNaBt3nsaxechsvnAfDTgy2IhYcTYHQVhkIcX+T
+ R2An/j124mXYiZeOALBY+np8AWhqIlBUJEBhIhQpQZPhawbFKqCkJAAslqBxIscKnvi686IaYxrzIYMB
+ HBcAq4wrVHjROAsBzkIuQOslzrVmQYG6H3tM4KQqxL+Rnk7MUwHk5YlQoBSN96YCF1FBXd0Cn0V6AzCf
+ VQNOo4DTKOA0ChZ0hL1cDZ0nEUrL5wkDOI2CtUTt+nupqarqqTq+a5RITSU1UwMo5kTsVCBtOjXgeYBP
+ SmjXKsHR6naMvQ7D5RCLyc4CngfAWh7oej8uTnnGI4BGQ65NBGhpIXARt9mbF7/PtZasAKxMHLSdUoPT
+ Pj70bF8HQmOMEnD4A5vJDbZxI3PAIwDOKhcmApw7J4TOTt9jeqYwzRmB0H7e7d2prLN8AZi2cOAwB7kK
+ QEiIbINHgNhYopsIkJ8veWre5wU7bdM7x2Jwe7+8PHDomWfIix4Bdu0iGRMB9FgNZurVp3W/VqvqxAo0
+ 5aMXVxLzZ4HJAKzfAMTHK0s9nTlcAGFhJHYsgMNBID/fXX/9wSIj2eNeAfDYuGMsgMEggOrquan3c+GA
+ devkUV4B8Fi4fixAfr7ILzzPw7e0BMGSJdJVXgFeeYX8deypLA+Pe3PhublYIz8/YAATOMArwHPPkd/U
+ 1X03ker1OGD5SfwnJ3O13h4auJIYf35WVkYej4SRXv/0RoiZOiYmRlnoC4AqP9/9ZKKxkcDlywF+swPh
+ 4QrNtAD8DVotsfIAZ88KwWr1j/LpcATDypWyTT4B4GOReh4gL0/sN943GAKfLFok/ZVPAElJ5DoPoNP5
+ zwiRmqrs8zRCjJ6JR17gc89LPIBe7z8jRGwsa/HmfVcBGrlhzx6i55+mFRT4zwixc6f8rM8Au3eTE1ev
+ CqCmZn5GCJstGAyGgG+ys1Xm9HTu6sGD3Km33/bcgSeF0Pbt5BB/Bp5pnZ7J/XxVMRoXDOXkqJzHjnEV
+ Go1SHxWlSAwLYz5etky6Ch/p/2g6j0+8PhpC69eT/+j1czNCmPAYqNer+rVarjYxkSuKjlYe/ugj+a7X
+ X5euDQ4mz2NiimYq1OsowV9cu5Z8otMxPu9AY2MQ9gz1NxkZnCUpSVkSE6M4Hh7Oxr35puyDF16QLEaR
+ Xr+gnnOAN94g4Xl540eI9vYg/mA/lJmpuJ2WpjBhVdBt3apIWL2a2bp4sWwFilTPlZDZrjMaQvgtzR8j
+ IpjOhATWsGMHk/7OO/LIV1+V/nk2cTlbMbP53Lz+q8FsBHtM4rlYbD7W+D9MzRR6eEGuxwAAAABJRU5E
+ rkJggg==
+</value>
+ </data>
+ <data name="errorProvider.ico" type="System.Drawing.Icon, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ AAABAAEAEBAAAAAAAABoAwAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAQAMAAAAAAAAAAAAAAAAAAAAA
+ AAD////////////////////8/v7F/fuc/PiW+/ix/Prt/v3/////////////////////////////////
+ //+a/Pgl+PEP+PAP+PAP+PAP+PAT+PBn+vXp/v3////////////////////6/v5a+vQP+PAP+PAP+PAP
+ +PAP+PAP+PAP+PAP+PAl+PHU/fz///////////////9v+vYP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP
+ +PAP+PAo+PHt/v3////////M/fsP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PBx+vb/
+ //////9p+vUP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAZ+PD2/v7///8t+PEP+PAP
+ +PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PAP+PDD/fv///8V+PAP+PAP+PAP+PAP+PAP+PAA
+ AAAAAAAP+PAP+PAP+PAP+PAP+PAP+PCs/Pn///8f+PEP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP
+ +PAP+PAP+PAP+PC1/Pr///9K+fMP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PAP+PDg
+ /v3///+c/PgP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PBB+fP////////4/v4v+PIP
+ +PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PC+/fr////////////Q/fwc+PAP+PAP+PAP+PAP
+ +PAP+PAP+PAP+PAP+PAP+PCC+/f////////////////////T/fw1+fIP+PAP+PAP+PAP+PAP+PAP+PAX
+ +PCW+/j////////////////////////////7/v6p/Plc+vQy+fIt+PFI+fOH+/fm/v3/////////////
+ //////////////////////////////////////////////////////////////////8AAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+</value>
+ </data>
+</root> \ No newline at end of file
diff --git a/mcs/class/Managed.Windows.Forms/resources/System.Windows.Forms.resources.prebuilt b/mcs/class/Managed.Windows.Forms/resources/System.Windows.Forms.resources.prebuilt
new file mode 100644
index 00000000000..b116fd0683a
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/resources/System.Windows.Forms.resources.prebuilt
Binary files differ
diff --git a/mcs/class/Managed.Windows.Forms/resources/System.Windows.Forms.resx b/mcs/class/Managed.Windows.Forms/resources/System.Windows.Forms.resx
new file mode 100644
index 00000000000..3102f93b4cb
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/resources/System.Windows.Forms.resx
@@ -0,0 +1,844 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 1.3
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">1.3</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1">this is my long string</data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ [base64 mime encoded serialized .NET Framework object]
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ [base64 mime encoded string representing a byte array form of the .NET Framework object]
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used forserialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>1.3</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="monitor-planet" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAD6JJREFUaEPVmXdU
+ VNfaxo/GfBo1GuONuUmMJTHGllhCchV74VOxtxgrKkhVFCkWlEAAEQQB6SoggrRh6EMZemfoAlKkqiBg
+ A0VABH3uew5CBtCgN/pHZq1nTTtzzvPbb9l7n+kHgPlHP1iAf7L+0ea57HnT0S8tLR1cWFi4Li8v74Iw
+ WZRgGO5RrRXk0awf4HffIyg+OzQ03Cc4OPiAv7//mDc957s4rk+AysrKcQXFpS7qwX7PJnvK4XOfORgX
+ NAUTQydhsnAyJgknYYJgGr7ykcTXHqsh6ayF85f5Oa6urmvehcG+zvFagKqqqsGFZcVWOwU27R86zsZI
+ 388xIWQCZkXMwoKYBZCKk8KK+BVYHr8cS2KXYHbUbEwNn4rRwaPx0dWxGGu/E7oOVhm2trYz+jLxd75/
+ JQCZH+eeGVU83GktGPdBGBU4ClPCpmB+zHysTVyL7anbIZsuC4UMBchnyEMmTQabkzdzUBKREhgnGIeB
+ /IFgHMdhkdWhNjMzs23/i8mV50uGTTtwRWLinvN7f1RwsJhxwCVohrpvyiyNwOwZshZJr6wBMj/9ckxR
+ Qz/b6WB4DD7x/wSTwiZhYcxCziRrWuuaFvSu6+F04WkYFBjgZN5JHMo+hN2i3ZBOkOYg2Ej04/UD4zIU
+ X+nJw8DA4ORLiH52SbWjNGzD58qe9pBXNPGyUTIPDFGxjkhRsY3KVrGLLlSxj61QtourOWwf/cDQPemJ
+ e0zBC9GNu7jb2Ib258CLF4CdnV1pLwAy/0V4enXNB7P5YFyHYoDPAIwVjOXSY0PSBihlKkEnXweWNyzh
+ VOGEqzev4krlFdiX2cOk0AR6+frQTD2Og2GaUA/ShXaQOfQEF2Ho6Q8Lj2Q4ByXfdRKk1TgGJt33jkhr
+ jM8ueV5eU4/m1uecKXG1tDxFUVExQkPD4OPD7xKPx4eb21U4Ojreovmrf1cKkfkBafm3M4ctuA5mVBwY
+ q18wzG8YJodNxrK4ZVyaHM89jvMl5+F5yxPCWiES7iUg9m4sknOSkZ6Xhbi0ZCRmiFBYUo6HDY1do9XT
+ HPu+ra0dFRWViI6OAZ/v2yUfn47XQUEC5Obmo7HxSS849nsvL+8aAhjSBUDdRvHn/WVghoSCmV8JRm8/
+ RgaMxHThdKxOXM2ljn6BPpwrnBFeE47chlzcarqFksYSxKXG4TmZ6qnqOzVITEqGr58/fH39OPH5Hc8B
+ AYHIyMjCw4f1vQy+Clj8MxZAIBA8IIDPOAAy/7GFW0kD82EAmO8ywPx/NZgDzvjM7wvMjJjJFa5ypjKX
+ 866Vroipi+GMt7S3oK6lDsL4CLQ8A4SRsfDhk1nWsF8AUlJSUVtb99YG+wLgUZQiY+IbCWAMB1BSUqL6
+ 5TwyzviCmX0DzOoaML/exKdXJbkIrEpYxXWbP67/AcdyR4TWhCLrYRZKG0tR+KgQfKEvqu89hqs7j4tC
+ Xwb+7vee3r6IT8lsI4DvOYCY1OJk5qNgMB/4g1lBo7+hDsy2+xhqK4fvQ7/n+vxO0U6u+5wrPge3SjcI
+ bicg6nYehOUFuBIqRGJ6Ljx9Bbjf0MRF42kb0Ep61k75Tp2D7R7vCs7T2w8p2UUYMmToLIaWB6MOW914
+ wY3+iIiO0d9yF8zuB+h/oByjA2bil8hfuDTan7EfJ/JOwPS6GxySWuCc1ArH2Kew8a+Eu28oYkTXkZJV
+ gPpm4FEL8Pgp0Eh60go0kZoJrAuOwP5XOE+eH9Lyb+KbCROXMrm5uVILD1LasACfRoJZWwtm6z0wex+C
+ UX6EoQ6a+C70O8yLnof1SeuxL30f1DKNoC3yhm5qIHTSXOm1FRzc3FBQ1QQ3nxDUNgJ1pHtPgPukB03A
+ QxIL1kBgr4WjiHGRewnHRe1l3xdPOw8CyKR5YeqPMzcxWVlZu6bJFHcAsCm0hiLQCaDyCMyxWnzqs4DW
+ PhMxJ2oOt3zYkrIFu0S7sDdtL/ak7cG21G0wv2yHG/cAG2cf3KwHbpFuNwBVpOpHQM1joJbEgt3tCUdg
+ r4PrFrWXKXnVyw85lU8w82fJfYxIJNL8Vr6qA4DVgtKuFGIUCOBwI5g/sjDEYxE3qf0Q/gM3sbEzM1sb
+ i2MXc9HRtTuN/BrA8pIPB1JCKr0PlD0AykkVD4FKEgdG6gS78zo4ihgXOTG4xxQ9NiWvePgh985zSMxZ
+ qMYkJSUdmXaUUobx6wCYktVVxMzeejBKLyF0RejvsghDfIdwa6PxgvH4NuRbbt3zeeDnUDE9jKwqwPQC
+ H3kEwsJcrwUK6oBCUtFdoJjEwREYC8eBkViwm51wYlHrBUfpyKalk7s/sqqBOQuXH2fi4uK2LzaitBmT
+ 1AEwlCayldSJNlEhb7/fUQvyDR0gahSdS8u4NVJPbTPYhZSK5zjjwEfGbSCTYFigbLpQDunaHSCXoDg4
+ AuuEKyK4LrDOqPWE65GSF9z8IboJLFy+/ncmMjJyyeZz5WCWi6XRl/EdtcBCsPWw4wHXlRgZgjkSCMbr
+ o14A8/QWgp9QBn07PpIqgORKIIWUShdiL5Z2C0gnsF5wBNYJ1xU1AuwVNTE4e7cgxJU+x9LVvxkyYWFh
+ w/WcU9oYFZoQJoj+rIXJlErSd8Cso660keYFFmYziX22XdALYLzhdJg4BsHIMRQhec2IprViLCmuDIgv
+ BxJIiQTWBUdQHByB9YTrFjUC7JmSl7wjEZzTiOUb95hyE5k3PyBksGorpUo7mJFRHRD9qSamXQMjRZFh
+ J7eVBMMCsc/aR3sBDNfeApXjlnAQFMIhpBChRUBYMS0vWN0AIklRJUA0KYaFI7BecBQxLnJicOkE2DNq
+ lwNT4JFUB+mtCuc5AB6PJ7NMn+YCNgq7msAMolm5syt9QpObBLXZRbfBLCYtukV14dQdwJHW/lL+2KWk
+ B6+MZpyyD4N/PhBwHQgkBRUAwSTi6gAjhb+Ei2DhCIqDI7BecOJRe5mSbmHXcEFYgVU7DtpzAO7u7h9a
+ XuKVDzz4rANiPeX94JA/IfpRRP6dAGZ6AZj/UL3MzQPj0/9PCDUFMJMKsW7bMXhfA9TN/eCVA+41Lxfw
+ IfHzAF+SHwv2Ei6I4FgwClpvOAIThxMWtsLcIx4nLXnQOOsOl6RHWCuj4dS1nKYNwsb1+lQDLACr/W00
+ 8rQ3+IBWqJ3RYJ/7UWp9RHBugzsATKeAGRbEHbd0hQrcsoBDpn64kgG4ZoJ7f5Xkng14kDwJTByOT3Ac
+ GEk8agF57TDzFEHzHA/qZjxoWgbCNqKWO9elhMc4fJZfM1d6x9lue2Ira1v/qVq0J+iEYJ9lmsFMTO8O
+ wYJc+pQgBlFEqB5eAv5nriyc0gEVEz9cFNGFSI5p1LdJzvT5ZZILgV0hMHE4Fswj+wWMiezQWR5UTUg0
+ CKbBt7jfOaW9gK5rZssOTaus5TvUnSf/vESOVqIf99pSWlhYDDEwOZ/z5WFqoeIQnSCr6HNJqpVJmdSJ
+ vgajKN2xAfqa5pDpufh+/kGYR9RD4Yw/rGjLbUOyTab9K8k+BXBIBS6QOuEMvAuhfMYHikY8KJ7hw4BX
+ wh3Dyiz8PmT1rt5cK/9HsMTSXw3+9eX4H151Y6DXXQkjI6PRJ/RMiieqFfWGEIdyWUKbHkozsc8+k7aC
+ mnU0ZE/7wzSOTJDM4wGLBFpikHS8y7Hf0Bf79HmQNfDBiSv5sEoEJ8u4dqhax7cu23uufu46BZdvfpi7
+ jUZ5UF93M155W0VHR2fY8eMnBPPVwjBAhdprz2iw742ce30+aHMM1imbQf5sOHRDmnGMV41d+tSddH2w
+ W88HahcycTbmOQfG6pRP1Yv1Rxwf/bz5bP3XSx3ah60sx7AVJe1k/F99Ge/8/rU3trS0tPqr0WPfQe0H
+ 05SiMED56V9HhKD6y9VDYpUCjnlXY/NxNyhaJcMgog1G0eCkH96KvWdCm1bK6Ves36XRNHqecfvYnS0Y
+ t7u9S6PXF7QSwIi/DdB5AkVFxWFycnK6O2X2VyyUOYtvZCMxUu46hshXY4DSEwyUv4uP9xVh5M5YjF9j
+ jMm/SL3QiwA6pepS8mKzhl37DnXjdo0zlgi7lovrDQ1wdA/Esh22mKHU1k2Tfs15SgDD3xmA+Im2bt06
+ ZdOmTepr1661lZaW9peSkkpdvHixcP78+Zdnz55tICEhsfyriT9VbdHhP910yPSZhukluAqjkPfwIWda
+ XI5egdiv6YhF6s+6SVIuE0rHjqVLrVun8CYQfd7cfZOTdB4zb+nS1crHtOuSKyt7Ge4J4MQPxCkjV2zQ
+ ae2mlarpyKypgfDatfZ1v/3mRNH4v7/y8M4A1mzdetArMupJT6Pi7/Pq65F57x5EtbVwFIRCz+gC9ho/
+ 7abNmimIpQEQ0e2Y1Dt3aHmilPhX3eidANAFPtDUN6h5nflrlEJpdXVIqKpCFJkLLS2DV1YWlFS1oWbV
+ 0k0yJxIQUFCAsLIyRN+8ifCiIkhISmq+LgrvBEBi3rzd8TduvDJt2BFPrK5GJBkXlJSAT+Y8qJCvEIDa
+ UX0o66VAz6m5S4q60XDJzIJnbh78CgsRUlKKrfIKtFp69V9h7wRg8Urpq/mUHj0jwJpnR11YXo4AGknW
+ 1OXMTNinptLElgBDa2fsUbXEea+mLqkZCnE+MREXRCK4EKR3Xj5ktY7R7YD3CDDtx1maTv6B3QByHjxA
+ MuUwO/KBxcWceeeMDNgkJ8M0Nhb6QiGOWzhAWescrgQ96dKJs2EwjIjEubg42KWkcNHYuGsfbTzfIwDV
+ wEClI0ebxCPQOfrhlMu+BYVwy87hRtU8Pp4zqB0sgKLxOWjoWCIwurFL2sY8nAoJgVFkFM4nJOLERWq1
+ S1a6vVcA9uQbN+700je1RjrlOwvSCcAWoziABQGcJoCTAgHkLK2hpK6L8Nga6Fl40sLOGgr2F6ATEooz
+ UVFQt7SB1knj5jFjJkx97wAjRowYvn27Qujps7bwiopBVwrRfwDiKWRLKWQWG0dRiOBGeo+BMRTMraDp
+ 74/jQcH4nf7QOOXnB2UdQxiZXLwnJbXmLye0d1LEXQsraqcbNmy3u+wiaDWzcsYZm4vwIsPhVMT+XBHn
+ ckXsQEXMFioLYhwdzaWLPhlXNjaD1mlzWDt4019SNoWSkguW9DWRvlOAzov99NOc9QoKR9ytrT2qrnoI
+ YWLhiNMWF6FPRatrYQ9tC1ucOGcNbVMbnDKxwe/GNnTMZfrTI6Xt6NEzotWrfzs9bty4f/dlvteG5k1+
+ 8DbHsKtKKan1p1RVT/GOHTOK0dW1yDM3d6nm8WKfOjsHNxga2padOmWapqFhELJnz0HHGTN+WvU253/v
+ AK/cQTHMYAKbSPqC1O9tDfc8/r2k0N819Ta//8cD/Bf1OK6O+/e5egAAAABJRU5ErkJggg==
+</value>
+ </data>
+ <data name="folder_arrow_up" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAB6pJREFUaEO9mQtQ
+ lFUUx/+77LJP3o32HMvUIqxMe/hEGlHTMTVSS53M8UFoTWmDItSWGiMWkQgLu6CwmbtLigpJVgrjjFkO
+ A6mlkZQUmNRMNb2cqWzSbucu7bIL34tlF2eu7Hzf/b57fvece8//nk/FGMNA/1NFq25kl1hnSMblAAPZ
+ MBGzkIvvMRuFBBDZ37EH1njAiJdwEmfA8Am159GIB/BgfyAGFmABbDhNhnMAb3PjF8zBdvKGLhiQAQPA
+ BMxALX4PMN4LcZKAMj3emNJXiAEBoNk1wEJB4z/zQr/34Fekoagv3hgYgAUo7RU6YjDcG1lowlikKvFG
+ 2AEodKajRiR0pDxSTd54FFbyhl4KpM8A9EKtVouhd9+Nh1NSsOKmm3AXXVMLDcIHp9Bplg0dMZBT5I1s
+ 8sY4TBODEASggQcnJWHGtGlYt3Qp3sjMhPOVV3B42zacdjjQeewY/m5rA+vsBPvwQ1xJTcVTggALaAZ7
+ 7jpy60Do/n78hnko4Wup5zgegMREjFm5EuUFBThhteLrAwdw6dNPwb77TlnLycG7vV48HlNxgAYOxmD+
+ DIFrDtDfreig3NGADDiQiPm9xiEqVW4uzis1VqjfoUP49frrMdz7ck/o5AQXOje4wZ6qAMvfDbavBmzY
+ MKRIroHbb8e9J07gSn8A+LOvvYYTNBHuwkIcnfAcfgaP3yBmf62t2+vffAM2bhxWSAKMHYsVFy4oCxUl
+ kG9/ABZd62f8cbDBlWBG/2sSYBvKA22ZORPZkgBjxmBea2toAPiMjcwAG0VGpFEYrH8TrKoOjF+3VoFp
+ 6+W98lxZoC2LF+NVSYARI/DgKXK3ktmV6/Pll2BSkzGlSB4gvQfAqlWw+62tG0aP1syfO1dnWb3aYEtO
+ 1i6jTR0jjh7t/xqQg+P391J46Q9JQyy2gn1A/RwONaus1LCsLF3Hli2mY0VF5ra6upg/WlvjabKvYR0d
+ CWzyZG06P1MkVFfjNyUGhKLPJFqkUos7ZZOGNTfHUY5J8Bgq1urrYy/HxqqGcwC13Y7OUBjX8x0tLWB1
+ tAbeektNTcN27dKxaZYISYDZtkhJw71AxcXm8zwFeBLZ9u1oDRagowOMMjNzu9XM6dRQi2S7d+upGdnB
+ g9Hs88+7XO5thU4zowwhCjG9VBlAbq6p3nMc5v+9/jqa5QA++wyspkZFhkZQ01LTMZfLyPbsMbPGxlh2
+ 8aK0y70ALS3xLHaXOEByiVaRB9auNZT7APLycFQI4OxZMLtdz6qqTKy+Poa1tSkzUip2+b17SzSiHrif
+ 7sk9z++npelyfAAbN+KgEMD+/Sraw0NjtL9RC206UYC7rBGyAGfOxLOkpIipPoDsbLiEAHi4KJmNvvbZ
+ VGHyiDWh3WhEsVp2TKcz+kdawCYfwJo1sAsDKFtQfQVobIpl+reFAYYoACgoMDf7khv/kZ6OfGEAg+xs
+ 9NV4b//EIuHtNKlY3usWi7E6AGDhQrzcE4ALvL17TWEDSBZZyJOs8os4PV3v00eebZQU3/M9ARoawE6d
+ igsbwOyySME1MFsmD1y4kMCmTNGuDPDA+PFY9u23gYKOJ6Zgw0PJc09WCO9ES216yXEbGmIvx8WphgYA
+ 0JEyle/5/l7gyUqJIcH2yXDoe3uAkuWLFUbJcW22qPP+8toTQqRIbzt+HFcDAXRhBVi6s7cHzHvBmmiH
+ kpqUrVu7JESAB2hPvaa2NlCRut3SMxHszHufe7y8N4CSLLx+vbFMCCBi585uRcp1z+HD0WH1wBx770W8
+ rFQ6/jn8Y4/pNvQC4BdKSroVaXW1irW3h15C+HstlURbQCYmRevYFyU5aWfPxrNRozQBBWBfLFE1wadI
+ XS75vbi/IXQnJSx/gJspA/NTltR73e7on3oWt3wAVBbxKVKXKzwSwmscF4iD7KpuANJFq2S2T/4sHSub
+ BCtz/CLVdN7x7kIuV/gkBDfk/YYYpnqvWwsNK1UrkuqbN5v2iAJYLHBygPZ2LiHMYV3AWypJjVLp0hNC
+ jWCWSmU73tNPG/JEAdatg40DHDkCdvp0+CQE98AzOwy+8BldqFF0muMSYvr0yOWiAKtXdylSlyu8EoID
+ zPs/B0RQoaukWpm3Gxpirl53nfpmUYAnnoClCyC8EoIDTCzvOlJOLlA+Vnm5+QehCp1vF5ozB2s4gNMZ
+ XgnBAYba1cy0D2z/Eelkee5cPJVlYv4qLY1qz8gwuCQBJk7Esi4AZQsq2DzQ1BTHoqn6tr6ia6fjhQIq
+ GPxTVhZ1kU5aTRs3mmqefdZQMn++7oUJE7Rpej2ulayNem+OHImH6GuLp/oQrHFiz/EF+NFHsVcdjqgf
+ snMMX4xaEPE1lUV2LFqk25SSol0yaJDqVrHPVFLG+87E/IfBgDtKS1X/ymVDMSN5KZCXBKuqoi4VFprP
+ 8cJTZqZx15Il+jw6gKwaMkR9T18+n8oZHqBGPSTAoPx8zd9ys8/1SG1t9GWr1XQxL8/0cVaWsWr5cn0B
+ bXFrExMjkuk9UUoHD0W/bl0NaPLzdX9ygK++SqAKccwVu938c0GBscViMdTRObR41qzIDSSmZnHYUAwe
+ incEfKWcO1f7xiOP6F6+7z7NoshI3BJsXIbCMKXv+A8bjZ++/ZSOlAAAAABJRU5ErkJggg==
+</value>
+ </data>
+ <data name="propertygrid_sort_category" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAIZJREFUOE+tUgkO
+ wCAI237ma3inP2NCwlIRdIuaEA+waQt3rZVLKVe2Wj7NaUIA2say+8jesW4AwE/+LHcLA+kAfMExBkTE
+ Uaj8Yx4g/UirZ9B5gK5KYdSR7E0lbANk9LELUwlSGK1fbTQABDOAT20UAJRi95Wh7xzMGNisTEd524PV
+ IGVSHnpbhD8B8EhyAAAAAElFTkSuQmCC
+</value>
+ </data>
+ <data name="Yes">
+ <value>Yes</value>
+ </data>
+ <data name="folder_with_paper" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAALEwAA
+ CxMBAJqcGAAAD0tJREFUaEPFmQlUVFeaxx/IUguKRo12MkmnuxM98cwkJmPapMdsRpOMY5bOMn1cMsak
+ R4OmoygtoJSC7IqyFzsoigIqKEsha0GxF1XUvldRFEUJKGuxC9Q330NRcAFcMqlz/tz77rvvvf/vu+t7
+ WBG/wu8/N26k4m3fHhgYeHkQ/3R3d6vUSqUSywZQll/hkU/vlv9w3kdlHPVezoxP2Oty0DN0j6v3cXdv
+ 5h6v46f/6h92/hM3r7B1+9x93nFjeP7p6T31Kd1pv5u7raev3wpmXPwhoVLVfIlVdvNMZhWcyuRbQhIK
+ bgZEZpo9/KKvM3xOcv1PhHh5+vrORVk/pcc/+W0Q4K3UjMwglaHJ1Dk4NNLc2WPJ4aggIEkKgam9lqPx
+ 6rGUXPEoX6kfUjUZFYHBwQzUs0/+5KdwBzcG44M8NjsSjWk6BgZHe8csYB4dA1VzJ5wv0MAvx4VwmqWB
+ InUraMwD0D4wOCDV6eSJKSm/eAcG/uEpWHi8W7gxjtA9vLw/YBWXxqsajbqO/qGx3lGACXUOjoBY3wGJ
+ uUpIl5sg63oPcPuH4drwKHQMDI/WiiRV6Veydx4+6vv7x3Pw+FdZMY74zA9jxr2fkp55Xtfc1tbZP2Ix
+ DwNMVjcetwyOgbjvJpxp74OEG2bI6OwHXu8wtA9ZoLVnYLSaLy48nZK+3fXgkUWPb+cRrlyyZCmx5bvt
+ 9n6BJ9cnp1zMacUwd/VboHsApqgLj1uwvBYpIlt7IPl6H5y+3gtxbWZIwbzSPAo38Hzzjd6RGr6s2NM7
+ 4Nt9LgdtUFaPYOfRqyKAfcDx0E2sgnKWsaXX3NFjsXSaATp7p8rYMwbF7UOQ1NoLZ1Hx18zjSmwxw6lW
+ TFHKrhFo6x61NDZ3d1VzZUVo/hOU46O7msUVb7+9Zg7KISw88Uc2R8DSNnS0t3cBdJDqvqsbeKzvGANW
+ 6wCcudYLSaZeSEDFN99OTWaIQ53Gc+ev9YGo/Sa03BgZ0zV23Shm87Ijmac+ddrl/MwsLM2+yrp1G2wP
+ HvR9MSrq7LaiYj5bo+3sutEOcK9a2i2guj4KLNMgJDaZIRaVaETz9yjBaIYkLIvB85dN/SBqG4GWtpEx
+ taa972p+bWJsXOrH27btfHot8e033z3j7x/x+eXMUpFe3zfQ1gZA6vokmdosIGtB88ZBCNX3QGIj9ncU
+ sxG7jAEHcBMaNmArYD4JFYnlZ5v6IBrTi8Z+ULWOjt9PIr7WyWJVM48FRq/55uutFNTsI/2wmruc/rk8
+ MiKFIRG3DRubRiwt13CAolonSdI8Chca+8FP1wXp+j4Ib+iB6AbsKo1oVo/9H9NkVKweobA8HeuebOiG
+ U3icSJ5HTdxPwG++fjmDE4PmX0HNfrX+5BNiqZMT8QGDQfzv8ePEfiaT8E5KIiLOnLG9dO7cH4QX0reP
+ iOqlFkPDMJiMANdui9c4Aucb+oGpw2jr+iBI0wNxWow4HkfoeiAey2IbeiFKh90JlYD5EG03JDcgHNaJ
+ QqVgPhHPKZrGoKnh5oiAZ9KmnStkbvvO6aVPP/7Cbtpm2LaNsEGtuHKF8CgvJ7K5XIJbV0eIeDxCzecT
+ xvp6op3Pt+2rrfndWGnJARDV88GgG4UGvQXKdMNwVtsHcRo0qDFDuNoM0epeiMSUicfRWM5ERWM+BtNx
+ IVw8ppHj52+JzCdq+uCKbhBE+lHQqQaH6qqNmqT4bD9fb+aK/3hn7cMhXFwIKmpzZSVRo9MRoyYTAQ9T
+ Tc3LUMnxBBFPChLNKISpelAYRRUCKDGyyh6IwTRCiQBYHo3lEXhM5mPIOigyH4dpONaNwjx5HIb141UY
+ CBRLMwRi7RjoFMPDZUXqhuTEq64+R5ivvvynV+c8sCUCAwkHlLtIRCinMz9xrqryVSgp8IIqQTN4yzsh
+ TtEHEYpeCJbj7IL5QFk3xOBxFCpUgbMRppGYhiMIWRaNOibvHq8bosAA4LlEzAfgdXFyHOSKfriqHAaD
+ CsaVny2WJ0RlO//ixHj+gQBBQYQDioEA6tkANDVZQ13tCsi8cBSUkiE4I+uHBBlGD+WLJpKlfXBSisZk
+ GGk0dFLWAxEy7Dp4PhzTECkObrzGH+vGShEKy/wwf07aD0EkPB4Xy4dBL8c1BaWTjY3lZYqE/l4x+xHg
+ /lYICCDoKFcEUMwGgKyj01GBx30NcjPDoKLWCGniAQgXo2FJHxwX90Ak5iMkZghFg0wsC8d8CIpMmeLe
+ 8ToxYoS7XR4jQQhxNyRg3WLJTRALb4KophtKcmWQlV4yFnwsUPb37WujN2yw+2bVKhs6gtzdcnh5EXTU
+ XgSQzhaguRkhtFSoKFsFZQVxkF+hg1TBAIQK0bQAzQp6IITMC7EbiTDqIiybEFle3wP+FQbwKhTD0bwa
+ 8L9aDgFXi+BsfiHk518FTkEWcApToTSfOZqdccCYmrKxICT495G7d1NdNm+2nzsF4MABgobaIRQSotkC
+ kPVIiIYGKygrXg+c/NNQWN4Msbw+YPIxwrUdEFBhggC2DnzZcvAvlUBQqRCOlfLgWFkNRJVWgm/BZQjK
+ TYbg7CgIzwmGizlBcDXXD4pyD0Nx3gFLWeHu4drKLSZuzepCheLF2MrKBf5eXnRnFNkCd3+7dhFU1FYE
+ 4M8WwGgkoLGRBCBALLaFwrz/grxL53GGaoPAKgOcLFGAT1YpuKWmgVdKPHifDwOf1AA4lnYYQtP/CSGZ
+ P8MFzl7IER8AjuoQSJWHQa88Mq4GBQOUov0j/JqtbTVV/5qj1T4XYTItOlZRseCoiwvtRxT54eDub+tW
+ goL6CgFqZwPQ1ESATEZAaSkBOTkEZGVZQ1rqXEiKXwlxkT/B6WQGxFx2hXNl7sASMiBX4gEsySHIxzRP
+ ehBYUjcolbpDjtwVKuUHQSY/DDo5Gr8tuWAv1Fb+tZNd8kqVXr80tLl58XESoLx8AeOHHyj/jaJMAfjs
+ M8Ie9TEuWJVkt5gMoVAQUFNjBWy2NWrOuEpLbaCqyhYEAjsEsUdRQCKhAp+3CMpLXwdO8fdQXrUP2EI3
+ KJS7Q7HiIJSgilAT+XyFO1TLMfIyBmhkR3CmuSUpfzeI69fjvV5pq65aVGA0LgoizZPicBa44iD+FGU/
+ BWDNGsIW9RauwCV6/VQALtdq3DCXa39HdXUU7DZU7D40hL0rY5MDaLWLQCxYDZL67cAXu0IFmiRNTxYb
+ o16F5TLZYdBI0ThKI0YY3i40vxaU8pdALndsraubdwdAq10YlJ8/3/nNN23eQNlOAVi2jJiDegm3Ebkq
+ FWGZ3ALl5dZQWWk3xehk0/fmjUY6qFXPgETwHpr5O9RjVylTkBDuwEaQUhQZeTWa194x7w6y+p0gqPsQ
+ lIrnwGCYi4Gg3+Dx5rGxBU6Q0edynzmZmjpv1+LFVktQ923wyDnVsaCAuCAWEyNTAeZgd7GfNcAEkFKx
+ GFvhfYTYDQKZB3ButwJX7nEn6mTktTgupPwdUM99FzRqRyADQN4DAToQoGICgMWaHxQc7LBtyvR5z7Js
+ k5VFJOEmrn8qANnfKY8MYDQ6gAqjKeS9B1LBfuDJDoEE+7v6dtRJ86RE3O9BxP8zGl6I0/It87cBuuvr
+ 53InALKzHX18fenfTLcrtbp0iYiqqSG6JuZ4jYYYH6w83qMDkCYMhnkI8SJG9yOQCJ1BLWGMm74VeQYI
+ a7eAVPjvoNU8eyfykwDMCCAwGheOd6HLlx0PubnRNky7rU5LI4Krq4m2CYDaWgLN24JKRX3kFpgwYmic
+ B3LpC7h73QhK4R40fhjUOPeLeVtxsK9E84vR/NTJ4HYL9AsEDjIEOEkCXLzouH/nTsr70wKkpBABVVWE
+ kQQgFyocEyAS2WHT3v+A6Qby/QPbAUTCF0HC/xLk9U4grd8C9bwVoNfPf+i9dTraoFDooCYBmpsXHcMB
+ 7PTFF3arpgVITiY88Z1ANwGQn2+NAI8+gB8GJxL8EaorXkPzy2YMCgLcRAA9CaDXLzyekjJv2+uv2yyb
+ FiAxkXBHgPEdKdkCTxuAHBONGHWDwXHGLolrzKhE4mBC82FFRfNDExLmfrZ0qTW5iXv4LyaGcMa1YHxD
+ dwvABlvg8Qbwo3SxB9VtbKRZlEr6Dbl8QWxa2rwT4eEOax/4LjAZJzyccOJwiDoSwGAgoLDQFlfc3waA
+ HNg6Hb2Lz5+fgtH3DQx0eGfa6JMnT5wgfigrIyrJzRquyMDh2OGS/vgz0JO2gsFA76mtdcxkMh08PDzo
+ b8wI4OdHbMEdJlurvbXTlErtccv8ZDPQk0AggBkBWCEhdOeff6aumBEAvwd9zWYT+WT08/KsQKOhzDhb
+ PInBma5FgF4ud16Rvz9t51df2f9xRoD9+4mNJSVEllJpBbm51uPvvTM95Nc8j63fX1bmUOHjQ/129Wqb
+ JTMC7NhBrCsqIi6qVCSAzW8OgGvBQGYmrS4wkLL2hResaTMC/O1vxJrCQuIcCcBi2f5WAGPYqjdRQ2o1
+ rTMujlIdFUWZeQCTdOvWEatw+5B0C8DutwDAdxG6GdVsMjnI1GoHTlQUNSksjLp8xuiTFVauJJZlZBDh
+ PJ41VFRQcK/yq8xAGF16D8qEJlUGg0O9WOxQVVhIL7l0iZ6Zmko/lZxMD4uLo/kGB9Ncdu+2/+qnn+xn
+ 9/+zpUuJJfHxhH9hofWYUkl94C5xFoMWo0h2AXoP7u/b9Hq6QSSiaaqqaGIOh1bJZtPyioroqVev0mNz
+ cuhBGRl0j3Pn6D/FxNC/PnGCvu7oUfq7rq60Pzs5Ud/YtIny6kcf2T734Ye203+dntQ8DiEhVocyMuaQ
+ fXC6GWi8n6LBPtyzdMvltHaJhGYSi2laNCsWCulV9fX0vLo6emp5OT36yhWaX2IizQUj+qOnJ+1bZ2fa
+ BvyysPbLL+3e+ctfbF5bvnzOv6CHqS/qs+oz91eyCQ21dk5Pt+lDgxbcRo8aDLQR7EpDqAGUGdWFplsa
+ Guga7KO8mhp68eXL1EunTlFjw8OpPp6e1J9x0dmyeTPli/Xr7T7CHeTKBQusFqIe/GX5MY0+9LKwMJt/
+ pKbadWMXGNJo6NcrKmgNWVlUQVoapeDUKUpyWBgFv45R9u7ZY/8/339v9/mmTbZvenjY/y4+nuqIAHMR
+ gIYAVASgIIAdAtiieWvU07b64Pvt22fzHoNh63v6NNUjIYGy48wZyufnz1PeTU6mvMVkUv7N25vy8q5d
+ 9i/gy8XS1attFz7/vDXt2Wet/3+ie4/l/wOchKPj6Tjd4QAAAABJRU5ErkJggg==
+</value>
+ </data>
+ <data name="propertygrid_tab_properties" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAGVJREFUOE9jPHDg
+ wH8GIoCjoyMjsrL9+/dD9IEMoATDDQCaBTKRaAyzFMUAYl0CsginATBXQMMGw0Uw8VEXIAUiIyMjOCaQ
+ Q5ZQbKDEAroBJMcCVV1AVkqEuYCQv3HJUy8zkesCAKyXZMNS2ukhAAAAAElFTkSuQmCC
+</value>
+ </data>
+ <data name="mbox_warn.png" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAABcQwAA
+ XEMBOS4mtwAABLtJREFUaEPtmWtoVEcUx+/efb9ujGAKtoKk1mekUgkV+1KkSH1QlYjUZ7C2FcUiVTAF
+ BQWr9V0q0jaIQbSUBFrFKGpFUPCB+EA/aLW11EdbTW1Sq631k6fn3Oy4s3PP7p3s3phdMPBPZvfeu/P/
+ zTkzZ2bjAwCjpH8IoJT1RMxjhEOdNUidAoCGN6HQs52e9Ku+ZADQ7LiUaTIua1pnQHgaATQcQf2UBaAN
+ 3+/lNYTXAF9mMS8isbtoAdD4ZNX8K6/61TSi1x95CeFJBNBUd9SvMsCQl/xw92EZvDk6wEEM9QrCK4Dt
+ 6ujvPxy3Ac7/kIREImMyE9CJogFAMzNV83VLw7Z5oS31US4Kn3oBUVAE0HhPVKsMMGx4e+qomjYzyEGM
+ KRSiUIAmdfSPnEiwAL+1WtC70lQhfsbn44VA5A2AHX+gml++MsKaF9Fo2h3jotDwxAHQeB/UAxlgxKhA
+ TvMCYuGiMAdRmy9EXhFA483q6J88x6cONx+qX3bUh/v4eZX5QHQYADtaqJpfs4FPnTv3LSCwU+cT0PbA
+ ehwhmidMxd7X6QDYaZXa8Vtj+dRZvT4CZWXp9b9qsAm376YhVq6JcBBLOgrRoQig+UMyQCxm2IVKTZNN
+ m1lzoK5QY8axVXpYRyC0AdB4nTr6n22JOsy3/mtBxTM+x+gGgwZcb0lHgKAvXk1Ct3LHvWc8B0Dj1ar5
+ iTVBdtU5fobNb5hRy99f38BW6Y26EFoRQPPHZYDy7j64/IszdWhUv93jXOsty4Afr/P30zO174a4+fC2
+ DoQrABpfoY7+V9ucqSPmwRdbnSNKE5ZbTsV7f9yz4IW+jip9A/std4PICYAf8LpqfuoMPhWEmeWfZE7g
+ vv1M+POfzNznYHbtZav0zkIBzsoAzz7nc0xE1cz8DzPT4bvmmFaFps9ZXMdW6fdyQWSNABpfq47+9m/c
+ zdRMSe86x47X217IgzDceYp7iD76ZYNgAfCB0ar52e+HtEbyjZHt24RwmK8RueYCXTt2ml3FvtcGwM79
+ qEsyQOXzJrT87Z7HZKD/gPbJSOngZjbb9bUb2UK4lINwRAA736yOPm2Ddc3cvGPZ80Te++g+K983YRJ7
+ AHpNhcgAQOMTVPPzFuilzo7GGNBB3jQN+wy8bEX+ESCQK9eS0KPCUaUvZAVA40nUNRlgUJWpNfKr1vF7
+ n6s3sxcvnag07GSr9OcyxOMIoPGt6ujvOdD+zUIu0dygTZ36LFVr2k67Pe92fc5ctkrXCAgbAH/eUQ0s
+ WqKXAr+3WfaKIz8fChlAKeVmTuf6X/9ZMHCQo0rfwv4qUt6NHviiRTYwtJr/ZiFbh427YkDr94tDTJg+
+ K2gfYnTM6d7TfDDO7ZUaBcDX6ugfOuqeOrqde3Xfx8vYKj2P0scR/mTSABKtJkLxuAFClPNC0agBpEgk
+ LUopIUonIToTCAUCBgj5/QaQaAUT8vkMEFI9Sq8fOQBy3MyFsevfS+VR1xtRMkF7IEsZwPaeAuiGxGUp
+ WfhXiIqbUALbQnFsC8WwTYpKov/UCIWxLRTCtlAQ20IBbJNoHyZkYlvIh21bObcSboeHYrzueqQsRtPs
+ VqLYjWqfB0oN5GkKdXXEnkagqyPwP76kA5sYKmTOAAAAAElFTkSuQmCC
+</value>
+ </data>
+ <data name="back_arrow" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAACTtJREFUaEPVmXls
+ VUUYxVtrLJFUTZTFJUgQgooouEAxGheM/qMREo0b0aCJ0bA0smihRUE0alwQlQfiAu67uOPCYlUoguKK
+ Ii4gsgikaGmLRoz1/B73NNPb+15f+4wJvhzv5c52zvd9M/PNtLCxsbFgj/4PAXsy/jPyBXMLOghHCqXC
+ 2cKFwlUReOcbZdTp8F8ZLS8BInKocI4wVpgpzBYeEh6O8Iiehr9RTl3a0PbQfMS0WYAGLBT6CZMCwpB8
+ VJgj+PeY3uJwGfWoTzsE0Rd9FrZVTM4CEohjUUjwg+jjwhPCk8JTwtMJ4Dvl1KM+7fjRD/21WUhOAtRx
+ R2GUQIiExCFhws/o/VnhOeH5CC/oafgb5dSjvgXRTyiEsTrm4o1WBaij7sJtAq62xU0cK0MGchB9UXg5
+ wjw943AZ9ahPO9rTD4YIhdzO2K2JyCpAHZwipASsTtzicgZiQCwZkn5F/35VeE14XXgjAXynnHrUR5DF
+ 0J+FMA7jzYJDNhEZBaghS96DAXmsg8tt8Zf0joVNGsJvCvOFtyO8o6fhb5RTj/oWQz/0Z48wDuMhAs+X
+ ZhKRKEAN+ggsdawS/Jh0odWxHBbEoiYN0XeF94QFwsIE8J1y6lHfYujHHsGr9gbj8mPu9UkS0UKAKh4u
+ 3C8QNnHyuBtrYTksCAGIQArCi4T3haoIH+hp+Bvl1KM+7SzEHqF/xomLmAG3uIhmAlRhL2FKRB734UZb
+ nk6xEuSxOiFh4osjwh8WzCio7jm+90/9xh2/Qd+qAyzV+xLhI+HDqD7tLIT+6Jf+GScU4XC6GY6hiLiA
+ waqAu1htHPNYwuRx9VuR1QgHLIllIbTkoKmdvqmYMblh09baxrLU+Fp9WxHDcv3740gUYiyEfugPb9C/
+ Q8oiPCfgNThRgApKhHsF4t6rDROWmHTYhOSxHuEBkepjr++/Yd6C+bu2/bazEYxOjduh758H+EzvK4VP
+ I1GhEPqhv1AEnmBcxocHqx+8CO8Si2jygD5eIjDjCR0mDxsNqwIT1mGDhRiEwbDeUi10y8+dMGT7mrUb
+ 08SNUalx9SpfFeBrvX8lfBGJspBl6X529xeKcDgxPjzgAy/4XdpMgD4UCaH1cVkYOkwwx7wtv7RwZuEn
+ l065onZLTX0z8ogYlRrboDbfBVit92+FbwTEIASvfCLgDUTYE8wtxmPccD7Ay14oSp9l0v+bW9BXIPZD
+ 68dDh6WPWE2HTdEDRZ9eecvVdVu3N7Qgj4CRqbE7Ve+nAD/q/QdhjYAYvPNlTAThSP+Mw3iEbBhKoRf6
+ hgKGq6KXTWKNmPPEtfUJHZbAj4rvK1454vay+jBk4u8jU2P+UN31wi/R82c910WCvtcT7+ANi2DCE06s
+ UozDeHEveC6wvF+5+zS5Oz2eLnjy4qYw9rFCk/WLphetGH3H2IZs5CkbkbruT7XbHGCT3llaEbVWwBuI
+ wBOEExOcVcqhFPeC54LD6IE0d/1vfyFcOnGTw4fljM2KmHxfU3zJBeUX1bZGnvIJqZt2nThpwE7jpMqB
+ DUK9UCfUDqgs/X1ARen2ARWDagZWDNo2sOLkLaUTT94sbDxsUjdCDC8wLuPDwysS/FjiWVL3RwA7b3z1
+ iYcPm03VqWWnbd3w6/bEmM9FVK51zrt56BbGExg3HkbhPOiOgH6BgDD+SdJYylg6F/YZ03fd59+u+SdX
+ EvnUO2/qEAQwmRHA+PCAD4b1PGDB6Y+AMyIBTAwLIDNsEnBI5WFfvb5oQdMmlQ+5XNoGApgHoQB4hRP5
+ DAScJsRXoFDAu8eW9/sxvlHlQqS9dWICWEDsgbiA0xFwXGseUPmiiyZfVtNeQm1t1wYPHIeAbrnMgX2m
+ 71M97ckZf7SVTHvqRwI8ibPNgW4IIIlL2oXZwsNNrKr7lB7fvf1B1d+5kNq8bUcjK1Z7cO6U870KxTcz
+ lvdwFSrxRnaPCpxCk/8n7QPpBK7nxF5r36pa3KqIa+4YuatzeZcdQl305L228w1dfhNqhG1dru/6q7Cp
+ y/iuvwjru447eK3wQ8nU/chiGS9pH4Af+8B9QqFzoWH6R7gTk8g5C222E+v70iMm9Fz35uKFWUWMSI2J
+ 78Qb1ZadmJTCO7FzInZistPWdmJ4eSe+PMyFeiesRBlzIdWt7lF+xLqn3ngp49Ia5EKkDsDESerIheIJ
+ HbkQJ7hcc6HeoQDyobtiYZQpH2JykTUuO+DWA1aX3TW+ISmdjrJRyJKROhN1EkdaHc9GSeTol/4z5UEO
+ n2mET5OAKKUeEoRRpoyUmAxPYst0d7HyrBvOqfls1epmu3SW8wDEfbAhgeM8YPLZzgPhqWxo0omsOPJC
+ eJi3F7wrk5f4RObjJIOv6DWx9/o5857+KzhS1uk7BxcD0qTOPsiEJzKfA3wi8wGfcZ2FhtYvbiEg8gKX
+ WfFdOTzYODcKRRCzxO7HHW8rWXXtnWV1LKHRmZgTFysKT5+JsTjx7jMx7eNnYh8n42di0p1B2W4lmAvl
+ AksqRzdmvA83PtiHVyq+B0rfSqSFzC5YfvqEwVsurhwWv5XwjQQeQ7BvJXxP5GNkSN7Jm1eeCrVrdgWf
+ dLHVSZXuFsJQ8vk4LoI8hYwR1zP5sCQWXVI8uQOhwuEkBKRtcerTjvb0E94LMU78XohDV6esF1tNcbU7
+ veDEk0kEscku7WsWCPieCFLh7RxEDb5T7nsgXzHSD/3RbxJ5rjlb3Mo1W4VaKJtbcJQazQpEOJyYE74b
+ 5cBtIVjQ14yIAeH9qL/5OpH6Ju7bOPr1PRDjseNy2Dq6TZe7gSeOUWO2bHuCTn1fhIvjQohfSIU31BA1
+ +E459XwXSs5FP/Tn+x+TJwrStw/tEhCtTAeqk0rBE9s31UxuBrQQXE8IYE3AOTYOlzlUQuL0x1JJ/ywg
+ NwoH5fUHjsATe6uzywRft+NaNjsGZGAmOa5HDIcOiAFEGf5GOfWoTzsTpz/65Udutndr5LPOgaTG6pTJ
+ PVLAG/wYEIvhcsQk/Z3MfxvjacLUoz7taG/ioxgjF+KJG1muDSMhI/T0bQYutxgsCbFMoNykaYdXMUqb
+ iOclIAitfTXwicJwwWcKJrx/EDT8jXKSMdqcJOybq+ESoyKfxglLL5tgT+EE4UxhaATe+UZZi80oHw6t
+ /pk1n87/j7Z7vIB/AbqI4PWoWfWuAAAAAElFTkSuQmCC
+</value>
+ </data>
+ <data name="mbox_error.png" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAABcQwAA
+ XEMBOS4mtwAABChJREFUaEPVmVuITVEYx5fLmXGdaTSa3Br3mDAeCIlxeRAiRBE6pWQy5dJMETURDZHL
+ FHIrzYuEGCK5ZR4kxIMm5VqIcnkh0ZAs/2/sc2adddl77bP32efMqX9n5uy91/r/1rfWty67A+ectesP
+ AbRntWvzrb0n7NZHd+wHzYaqoO3QPmgvVAuthqZDRWHVGwoADE2BDnZk7Dm+aVDZ6KEDOCoITCAAGIh3
+ YuyRpWE3qGsUtXRA0gJAZTM7M0YtaNPSfu65gDLL/ID4BkAFu7yMTwTYKgidnqPz8z3QFmgFVG4HXWUL
+ YQ0A0z3zGKNQa1t0MX4/D/2gvOChT7h+AprhDnPYBsIKAKZ75zP2WGc+DhNPLUyboJrw7CwzyGkvCE8A
+ mI51YeyBbH4gKr0SwLgMdAxlYVzpotvgBuEJEGPsnGyeWuxziOYTMAgxH6GH2GGCcAWA8RrZ/MIMGBej
+ 8d480OfpIIwAMD5SNl+RYfMJkFeop68aiRe+ANB1kFTa+mQB/n4dEQCBIN3pxkOtDKGNAIxPklv/ZITm
+ E5GoViG+UzoXIbQAWNM0iABRdR05M9GcUqxCVLsCECH0VwRozELrJ2B2qgBPvACWi+aHZ9E8QXzUj4Ux
+ CQilC8H8KRFgc5YBCGKOCrHBCID1zksR4HYOAOxXAc5oAWjZIGcfDPu2xVkRNlLxeDQqKUnWe1cFaDYB
+ DBUBBsitX16O5yL6VFQkAb5o0qkJYIIIMC5HAGgcaBZ6ecqmHuanigDY6Kau7bMUAQJAbpdn5gIdQMoM
+ jHDkDACW9DJAVx1AygJuSI4AfFPNt5jGQA85C/0RIWIxzktLo1F+fjL6tE+QfCVXpspEhnXQW/Hm+zkw
+ DxxXARrdZuKzIkBdDgAsVQG2ugFUigDKQI4Y6Bfq66YCTHYD6C+PA5oJvY5KMnX9qGr+jed+AACXRYgl
+ WQQoUwHqbADmy1G4mgUIHGvrtpWDPQFaJwjGmkQITBD8d4QQzagLGVEGOGK1J3YAcPKXWsDKiABo7qHk
+ IdVP++E+1gAOxAEZgjbamRqwiXIX6LtOpWxeWUpob2DsngyBVy8ZgaAlw1y9eePxoufRIswPgz7IEHS8
+ iK1baCB3UJYm41A3atI1rHEeMERhPArCviK1X2L7xncHhKDNykZ9q5N5OlQuDgzgjIexKOyZDEH/0zHg
+ NggvyKwjAmd8HYQ9uC5V0m/XoUI381ZjICXnojVQKL0GMlXKR+PaGqgewo38FnQDwgKr9W0NZbJBLs87
+ Zdd7GffVhZTU9f8V6lc3kDSvUYQX2Zr3HQEpGr1QGV5/sZ9pmhWj+A5l1PgxHigCEkh3VL4WwhGSr7eW
+ Lbj/IrQsHeOhAUgwhTCEgzS2CcI+hF1ywG46Y+cQvtdD06COQYxnBCAMQ37L8JzI/BYY9f3/AJQMVypF
+ n/EwAAAAAElFTkSuQmCC
+</value>
+ </data>
+ <data name="folder" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAABMNJREFUaEPtmW1o
+ U1cYx5+mSZPcvHax6GTIGBNfPlUp6FBERIeonTCoyHBWOuyLVKE207UYCY3isszg2iTFpJ2hXW1ybReb
+ tkq0nQhN04rECSW0VavWFtlg3YeBjK3b2TkdnV1y09x7d+dtsIHny3055/87z8t9zkkGQgjS+kcA0tnS
+ WvxM9KTz6i8CLATvvT4hhEutdNkyWLtzJxw4ehQ+PXsWvnS5oKWhAXouXYLwsWPgEMMjjB7AYlWFhVBh
+ s4H74kUINDXBYHs7TEaj8MfEBKDJyUQbHIQXGzfCerYQeA5q1SrIy8+HT8rK4JTJBE4837f19dBfWQmj
+ +L6CzViMABYLhJ49YxbKJH72WnU12GcnxQIyly6Fd7Ztg4JDh+B4VRXYrFb4xuGA3sZGiAUCMHXvHvMc
+ fX0wrdfD27wA8MRZHR3wfD6hye4NDMBPdXVwDYfV3dZWmAyHYfrpU+4LMTwMaMMGeJ8vgD4Ugl/4AAj5
+ zu7dUMQXQNrWBj8KKYbPWCTs5gKQyFi5Upa7ejUY/nWdiRIn7WM+kwrxDsmLQECCSktlvSYTVXf+vCbg
+ dmvv+v26511d+t9WrMhamxIAl8X7QohJNsaDB4Bu3MhAPl8mNhk2OfL7KWxqdOuWHj15sgRXukRratI9
+ xp7ISAngdkPffwUgVSwSAXTligQLlM6I9PmU2FQoGNSioSEDo0gm4bPXnE5tT3zEMJZRpxOusQWIxQB1
+ dUlQa6sUWxY2BTYK0bQG9fdno/Fx5tWcT2iyexaL2s0KwG4HPxOAz0eEyrDJsSmxqdH16zo0MsJ9NfkA
+ FBcrP2MFcO4ceOIB7twBdPu2nrPb+QhleufhQwPavFmezwrg9GmwxwP4/RJBw4ErWDCo+xknsJYVgNEI
+ 5niAy5dloq0+gfV4tFGmks+YxMXFUJkIoBAVwGZTt7EG2LcPDicCUKICGI2qL1gDkA5ybjdKPjwdHVpR
+ AfbulZewBli3Dt4j9X3WC93dEjQ8/GpKJVNyRyLZ0/EtxD9tOyMVwFukJ58FIB8prlVDyOe93sQWIhUA
+ FQzC1EsAuagAtbXq3mStddJNfUsLjL8EUIoKYDarGjgDeL0wRADIHph0iUKGBNexiooU1ZwBPB6IEADS
+ UZKmjOukQj0/OsrcQsybA+QmPjIJEQCazsReEK6j5Ap29SpzC5ES4MIFaCMAZMPBdVIhn3e5NPfn2xsn
+ TWJ8BPI1AfD7xW0hampUIV4AZjN89TeASlQPlJUpfbwATp4Ey8gIoO5ucVqIsTEDunlT/+uuXcwtRMoc
+ OHIETnR2ShDZSAgZ03PHItvNcDh7urlZN4FjfcBqVbdXVVG1hYXKE1u2ZH1IUfBmqrOhpDmwfz+U0rQw
+ LUQ0+safNK2bcrs139vtmk6TSV1fUqI4tWOH7OOcHHgXb1QkqYRy/g5s3w4f0TT7FiIWM+DTBt0Lr1c7
+ 5nBoe86cUTWWl1M1e/YoDq9ZI1uPRcr5iuSVA3l5sJWcLsx1+aNHM3H5e3Oz5gePRx21WlV+o1H5eUGB
+ vDw3V7oVi9T8HyJ5ASxfDksqKuSjTqfqO7OZch08qDy+aZP8Aywy51WL5AWwkEQuAixkb7w+f/ItVC8s
+ ekBsz6S9B/4C+eG8h3vJrfkAAAAASUVORK5CYII=
+</value>
+ </data>
+ <data name="Cancel">
+ <value>Cancel</value>
+ </data>
+ <data name="propertygrid_categorized">
+ <value>Categorized</value>
+ </data>
+ <data name="last_open" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAADftJREFUaEPVmntY
+ 1FUax0efbbtaarr12D5bu6WbopZ5SVs1a3fV2rQsUcu8FJqlKCZkF9t1H7VUFBQVCXVFzTIIROU+DJoK
+ iCggKgjC3JgZ5sZlbiAzot993zMMgjLjpT/W5Xk+npnf5Zz3e8573vOeM3YaGG0ddv89nX7fWSLpJKG/
+ zuJf91+nTq3XWq/SffdntHtOfGm91/bdlnrb1t2J/q4CpvT3usiu1XKHn+YkNRwuNV2GN0qMLvjivNEJ
+ X5wzONERX2VZry5IdWwCIPk1SIIyGjKuXr0Kb1y5cgU3o7m5Gd64fPkyOiK+xAGZvOkKiVj1fyuAheVr
+ m5oDUx1L71TE/3QEWICLKDU2XZmb5PjoTkTcVAC71q9xIXYtby7kEWBpdOKIvKF59kGH/+2KuGsElOjt
+ iCu2Xp6e6Bh3OyLuCgHWRop0JEBWVoetefUu/3j78FsVcXcIuORCqYEElNfh+1NGfHu4pum1H+39bkXE
+ XSUgq0VAaFYVlqaaGl+KsT15MxF3rYCQAwp8ctBo/9Nma09fIv5nAgp1jQjKuCxYlOHCwnQXAltYQOWC
+ NDcTfrLuvSsFcAiVKZoFmfLLXnk3wb7zjgV44r+vVMFbnG8b+10uF3zhdDrREY2XmvDefvsOnwIWptmk
+ 3vIVz/U7NcBjVFNTE3xx6dIlNDY23oC9oRHT99u3+xaQapV664HbMcCbEWxYQ0ODTxwOBzrCYm/AjET7
+ Np8CApPrpdw4s7vYgJAs1TVkSoTcAsGZCtyMT9MrMG1DHEbODsbgie/Db9RYPP3cMPiNHIshE6Zj1Owl
+ eC98H/YUqGGz2QS1FjtmHrBH+xQw/1BNpsPRQD3gHbvdAV/YbHZqsGNyc09gypSpeLT7oxj8wmAsXvwp
+ wsPC8eOP+5CeniHK8PANWLIkGEOGDEX3bt0xebI/jh49BlOdDbNuKuBgTaYvA/ie1WrzicViRX19ewoK
+ ivDOO5Px5B+exLrQdSgpKYXRaLoppaUXhKCnnvojJkx8C6+vztzncwQ+OWDOtFhsYOKKqxF6XIV1zDEF
+ wo4rEZ5NcHlcgQ1UbqTvETkqQolNxOZcFSJPEFRupTKK+GD5BvTo+RhWrFyFqiqNMFqvNyA5OQVBixbj
+ r6/+Fc8/9zx69+6N5wY+h1fGvIp5H32M+PgE6HTV4nmtVofVq9egW/eernt/e6/XVFvy8X6jrLbWAqZS
+ V4PzVTU4pzbjLFGsMhFmFClNKFQaUaAw4jRxisiXG3CSyKs0ILfCgJyLBhy9oMXUmXPRt28/nDyZ39rb
+ UVFR8OvXHwEfBiAxMREqlUpEnK+//lpEJ7VajaSkJMz/ZD4G9B+AVatWCcEs5PTpAvR+prf9kYcf2UXb
+ 8d9cPxqSefH6LLO5Hr4wmergC4OhBsycOXMxbux4KJUq0fiZM8UYP+41zJo5i9433bAW8ES9PkTztc9C
+ luKlES8hOztH1KNWV2Hs2HENJOL7GwR89LM+y2isowfroNbVQqGtcaMxQ0WlmkZFrTNDrTWjikptdQ10
+ AjOqqdTra6g0Y+WKbzBo0AvUu2rRaHh4uHCTtLQ0n4tYR2vMkSNHkJCQgBHDR4hRqq7WC1ccOGCg/YH7
+ H1jWVoRkbmx1FhvCbCP//jylDEuJz5LLEJx0AcHJF7DkUCmW0OdPqVx86AKCDpZiEbHwQCkCiSnr4/G7
+ x5/A+XPnhfHr1q2HP0WS+vr62zbeYrHgiSeeQGlpqQjtn1LUWrp0qaiXJ3iPR3vYyZVGeERI5v6kO6yl
+ 3vWFRmOCL14cNgJRUd+JRjhsDnp+EAUFy20bz6MREBCAwMDA1nd5joweNRqpqWmi/pidMXi4y8PnSUQn
+ FiGZs093WK1mP/OOSmUk1+iY6O9iyOAXaA4YRQQZNnQY8vLy7sj42NhY9O/fXyxibV3r4sWLwh0VCqUQ
+ QZHLSgLeFQICftAeVlKEYWRnNEg6VYVk5nQVUgsILok0+pxOZBDSwipkFmqQWaTBsBGjsWf3HlFxMC1G
+ Kyl03ix34vtOpwd3IieXy9GrVy8UFRWJe9fXsWPHDsx4f4ZoJzY2Dt26disSAj78XnNELjdSBUbspTi/
+ RVaJzbIKbCIiiI2ZFQiXXkRYRjnCqFyfXo7QtHKsTS3Hv2Lz0KVLVzHBuHe4l3jIfWeeLnrGiaZLTvJx
+ Ll2UJ7ndZEP4xpZrdJ2euV7Iy6NfRn7+KTHSDz34UCONQk/JB3s0Ry5SDPdFebkeHbF69Ua89eYk0Svb
+ tm3HV19+5dV4NoaNYqMvkdGNtJFvaCAcLiz/1wqMH/+6+MzX+B4/wyKdbYRERkZixYoVor23J73d0LlT
+ 5zmS2bs0v5SVGeCLCxf06Ig5AQsofK4UFU6bOs2r77caT+c/wnAy1G5zwmZxIkuWTVHn96is0MJa777G
+ 9/gZIYTeYeE8qlqtFjwK3N7ataHo+kjXbZJZMZpfSksNFKIM+OGoEttlcuyQKbAzy02MQI5dVO6mUnBY
+ jj3EqL9NxE6KClzh8BeHdxg2Pca7XcVtuJWMLDmvwI7teymdeBY/x6agxuRCrdmFuloXLPUuIcRhJ8H0
+ DovwuFN/v/6iPZ53PXv0lEpm7tQcPXdOD+bHI0r8J5MEENuJbVI5ojPk+C69kpBja1olIoktqRXYQuWz
+ A4aKjJIrpEWmQ/cRbsM932K8hXq5WmfDM0/3xqwZs/GP197CsV/O4vTJSpSc1UEpp1Xf0IR6EsIjwoL5
+ XY8Azp24Pak0kzPcEsmMHVVHi4v18MWZM3pKC25k8ODhrQIoX0FISIjIcTyTWPQ++zy5AvcmG1RX40JB
+ fjlG/WW0iDh+/QYiInw31nwTheX/DMMXS1ciaOEXFO9j3SLESNC5ES1iXD/nSpwnZWRIeVE7L5mxXXOs
+ qMhAlXmnsFAPpqCgug16vDZ+EnbF7BI9MmTwELHrahuBeAJy77M/26xO1Ne5YKbfG/QaJ+bPC4Zf34GI
+ 2Z6M8nNOQUWpE8oK8nWlCwatEzX0rIXesdO7TU3u0Opxod27dqMHu9D70Zpjp08bKOsz4D/pKmxJkiMy
+ WYGodpAb0ffoZHKrFAW2p7p53X8evv12tRAw4Y0JYvlv1/tCAPe+2x3Yx43VTuhULigvuoTRJYUunD1J
+ 5NPxYoETF887oWIRaidMeveI8SjwaPLqzh3F7a1ZsxaU3G2TTP9Oeyw/30Dx1YCYNMrpk5SIJLYwhyjf
+ P6hAxAE5ocDGRDk2EOGJlYQc7y5ahzcmvCUq5Nw9LCysQwF2ch9LHfUoTVQ99WyVwoVK6m02uDDXhbwj
+ Tpz8xYkzeeQqZ2hRK3NBw6Ogc4vmCc0dExcXJ3Ijbm/SpLcdtA58IHlvq/Z4Xp6RQqB3TpwwgMnNbU96
+ ehn1QleR7p49ew5jXh7TsQCaiK0CyH2q5C5UlLh7/3S2C9lSJ3JlbjGlhSTggrOdgAaHW8BU2ppy0ODN
+ zoMPPMgLWQ/Ju5Ha4zk5RvgiO9tAuXnHDH9xjEiwuFfenPim2LB4UgV3BHJPYI4+3Jvs29y78jKn6G12
+ nwISUZBDbnTKhbKzTijKXcLN2N34Pa4vOzsbI/8yUrTD++hu3boXilRi2hZd9vHjJjBrYpVYG6tCKJXr
+ 4mhbSaz/maAyLI62lfQ5PF6FDS1EUBnwWTT6USThZI4jBe+8eMHhRt0rr3vhYjdgf2a/1pF/qytpFMiN
+ yordrlRCPc/Gc+/zCFVXkWByOfZ9Tss5TeE0ggX49fOztSZz0zZXZx89aqZTADMiE6oQuV+DzVRuiid+
+ dpcbqQyPVSOshfVUrv9JjdCfSCyVffxeRETEptbeGT9ufMsouFOHa2sALVZklJF8myepmgxV0GTm0WB4
+ YvP8YIFGEtpIEUyk2LQV9dQfHb3tapeHulxLp6dG6HMOHzbDTU2HZGWZ4YuoKBkef6yX2EJyD334QQBC
+ Q0NF710/ChwWeTKze1TTfNCpKeKQu7DLsOEcYuvI1Xjk2HhOsSdOmCjq5Q0TLV7tNzRTNhpyZLJa+CIz
+ swa+kErNCApaR0M7QGSlvK2cTEcqDGeOIoHjHIjCKbsSpwrsThznTfQ7sonEsGvxd54vbDi7TeCCQIz9
+ +1jK08pFnXRYYL/vvvuD220p/cONOVJpHS3N7cnIqKPVzk16eq1P0tJqae9bC3//QIpEr1JqrhA9tnfv
+ D2Ll5MXOSQsRC2mbD/EEFSutjefJtXyHTyjY5z1uw4cEY8a84qCd2A3npJLJYabctLR6MsA7qan1tKXz
+ TkpKHZikpBpM8Q/C00/3oaiWK0RUVsoxc8ZMcRa0Z8+e1tMJdi+ZTNYadmtra4W7vPP2O3jjH2+IsMzv
+ 5+WdxFNPPmUn46No4na+4VRi8vqa3JQUKxngneRkCx1KeScpqZ6Mt7Ty+ecxlCk+jmXL/tl6SnHs2HH6
+ vkycNLxApxejRo5C32f7ivSY99BD6VgxJDhEJGmeo5Tly/+Nrt0edd7zm3tmeDudk0z9wbpsXrwt8eN4
+ 2wHi4CdMgu0QMz/BlsQsSLAlB+63pbSQunC/LXVhoi2NyvRFTKItPchNxuJEm3TxAZv0/Y0nsvsMHWvq
+ 0fPx5pUrv7laXHxWGOZBoVCIw6+Kisp218/RRF397Rr87rFeV/487O9107+MmOnzaPFmP6L92vs07ANp
+ 47GPVk4LZazWBQsCmzmP4cXv4MFDYn7w98DAhc19+vzZQuc+Vno+lt4bdCtt/6r/KXIrDXie4WMQYght
+ A0Mojm+lcJhC5NNpdCp9j6Lrn9H9YZ7jklut+7/JKVwBwotNkwAAAABJRU5ErkJggg==
+</value>
+ </data>
+ <data name="Abort">
+ <value>Abort</value>
+ </data>
+ <data name="OK">
+ <value>OK</value>
+ </data>
+ <data name="paper" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAACYAAAAmCAYAAACoPemuAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAChxJREFUWEfNmPl3
+ lPUVxmvX32p/6p/gsdqqgCxCIlpwqxU3IgWDtaBAlYTsxEjAEFBCksmiEEDBgBANmx7coIh7gklm35dk
+ 9n3L7DOJTZ4+b0LSOTXIkNPT05zznPedmTfJJ/fe5977zQ0AfvJ/+SWA/afmzll4+4svVB4sKqruKC6m
+ tlR3bCmhSqs7SgSVUeXVHaWCKqo7yiqpquqO8q1X14MPP9w40++62ns/gBIeXLggf63FnIbXA/h8gD8A
+ BIJAMAyEIkA4SsWB4SQQSQHRDBAbBeLfA4kxavyH2lxRO7Z02f3HcoW7Kph5MA2PC/+G82fBDRNwCi6R
+ BTdydbiG/Wewq+3s94uX/nF3LnAzgi2Yn7/WbEzD7cR/Da626TSOXgLKtu9PL1qc//y14K4KNqRPw2UH
+ 3I4sOC/TOhW5EFN7jcjFs9JaVHcKO44DnZ8B6za/Eps3f/6yH4ObEWz+nXmFJm0KLityh4ux5qbSmmbN
+ XUlr/J+T9VZYcRIFTGLtUeDIhXE88XRR6Kabb77puop//ry8QqMmBacZcF4DLpAduRngYjSEALemrBs3
+ M4ErdwE1nUDHxyN4YMUz7l/feONvZoKbOWICmCoFxyDgmIKzZaXVTbdOpVVw7BSc4NgpODo2eiVygmMr
+ 6jvxl9JurC47iU21p1G15wyqXz2Ce5c9NJA72Ny8QoMiBbuJYDnATbSTH4GLMq0T7eRKWrPbyR5RS2/O
+ YHfOWbJGJ03CZgB+KzdgpdqNzboAKg0h1BjCqDYGUWrwY73Rhwe0dtyvc+BBnR3PDvlQbg2h1h5GvSOM
+ bfYgSmx+rDa78SeTfUIFFhc8349N97oGUcvl6wLTipOw6oDfKczYoglgpz6CRkMELcYIRINR7DEN42UC
+ bjB48Te9B88ZPaixhLDXFkG7PYIDzihed0XQ4BpGlT2AjVYv/m7zotThh390fLoR721p/S5nsHmMmGYg
+ CYsGaFVHcVAbxzFDEu9QXaYkTlDHTQm8bY6jfZCw5gjaqKP2BN5zJXHKncJZ6pSbr718zhNDhzuCDm8E
+ b/miCIyMT6aV7aSxra0vd7A7lqxR9yVhVgF5SjueVHvxoiaIrbphbNOFUaMLoVwfxLN6H5ZrHLhbY8cy
+ ar3Jj/KhEHZYwqizMpVMa7E5gKdMbtxncGC50Y7Hh9xwpsama66xtf36wFSXkxhSAu8rUzivGsHn2lF8
+ rhM0gi/0GXxp4pU6P5TGec7VC5Y0vnaM4FvnKHpcGVx2p3HZw6tvFF9507joT+FiIIUvQmkEBcdema8E
+ y92Vc29fslrRk8CgHJgns+BhpQvrlH4Uq4MoZ+TKtUFsZt2tUnsYURsWKC3IU1mxlvX2gokmGQyhajDI
+ awAbhvxYYXAiX2tFnsaCh4wO2GJj08O/sfX16wOTf5OASQpskvtQIw+hURVFuzqGfaoY3tDE0K6L4lWm
+ tlzjR5HOhzKdH3tpiPYh1qQ5hkOWGA5aaQAbn2Nqq5nSlyx+1NmC8MTGp6dEU+sb4pxrbO5tS1bLvkrA
+ yG+ploWwW04nKqOEiuOgJoH9BNyvjaFZG8UObYh1F0SdPox2YxQdQ3G8SVMcpo5Y4uiw8jnLMF6xBFFP
+ 1zbah+GKjE+uTRxhTa37JDmDzSGY9MsEDP0sfpkNTyo82KQIoko5jBpVGC+pQqig1tIUy2iOfJUN96kc
+ WMeolbHXbTOFUUttM4VQxNQWGNw0iA33am0ooBGsobHJtYlToqllH/Pyw2V1xpE05w+LV4kvxaGnX84O
+ pPGxOIML0lF8Jh+Z0CXVKC5qRvCJOo0PtEl8oEvhnJ7FbcrgkmAK8yi+NGfwjYWFb+V79gw+cdBEjiQ+
+ d2fgyZqvzS0dspzB7vj94lUDF+PQsSffKbXiEbkbz8rZCuRhlCtCKFMGsZFmeIqRvFthxwKFFUsZuUIN
+ 2wrTWsW0VhnYXhi9DWwpj+pcWKRm8VOPGVww+8amR1iz6DrB+i/Eoe0BqgZYGwOsMTGLWprAQUkch2QJ
+ dMhiaFNEUa8MYwfTuksdxj7W3WF9nI04ManBBA6ZomgzRVDPtL7K9Lax3py+8cl1nZFrFh1QXFfE+s/H
+ ofkGeF7sQ8VACHUEa5LG0CiJYq+UQLIItjOCRYzkJqUPxaoAdmjC2KPlJKBjRVQrR9geA0cXo/eiwYdS
+ ox/b2EosboJx4RTgmppnA/Y1cJfYisclLH4JUyMdxkvUVmkYm2UBFMo8WCazI09uw3KFA39V8Zezz9Wy
+ jWzXsvg5JV6gIQo0LtwtGERtx0qmdcg1NrE2CQedZtEhtvEci/+OW+8q6D8fg4Zgx3s4+3oz+KB3BB9d
+ HsWHfWl81D+CczTFOUkGp6UpdMuTOM016WP1CD6lLtAYF7UZXOSEOG9g4ZvSeJ/z9dxgCv/ghHByXfdy
+ p/MSrrn5EAffLMAWSGz4s8SN9eIASsVhlFGlYha1JIDVMi/yGbGFjNhSRmwNI1aiDqGS9VapYUth9Naz
+ pazQuHEXI3YPI/ao1gWjbQweHnQEuOamN9WzAnutl2tML5tmbxKdvQkc4ww99l0CR/oTeKs/PmGKvRKa
+ g3X3pjyBE5ytXYoE3lUn8S6bcaeGZqEpWnURvKHnM4YYLNZxuHnQEeBEzW9xh5lFxFb1e7BxIICqfrqv
+ LzKh7f0RbOXrUjr2abEHq6QePCP1oljO+lJG8IpiGDtV3ETo1irO1w1qHwpUbqymNmp9MJjH4BJWdcKJ
+ mg5rcwa7/dZFK/s+jU7U2HKxA0+JvdhMZ1b1sfivqJhQ6+jY+/n5vVIHHpG5sJFgNYTaTtVxSrzMVlKi
+ pElUXjygdOAhpRNPc/DrB8fgtPAExoOOqPEw19EcI5YN1sniP9GTwkka4HRPBmd7RnCG15NUd28anZe5
+ CDKt7/TTJBIaQkpjSDP4UJHBOUGqDE6pUzjBtHZpEzjDKWE2jsMxxBMY4USNb88OLF/iwAqm6jm2iy0D
+ YVT0D6OkP4Tn+7n2MJJLxDYskthxj8yJQva0LRz6lexvldxIShjBDQo/HlO6sZgTQtBjTKfGMDZ50CEc
+ wXiymEXEDnIv62Thd/WyLfSk0f1tGu99ywjw/hijeaAnjgOM2iHqeB+fYRs5Q52WcL2W8cp2cpzt5LAy
+ MaEummJQNz5x0BHgRHs7cwe77ZaFT3z3SWSixnKVllNCGGHCfNXzeCFsJsLaZOJSM8gxPcTBI2zEZjYH
+ C8tdOOgIcKKGTmPOEZsN2MQfcA24wRngRA1HGbccUzlrsFnAifYc45H6fwGWDccz9nRaudkLaTUxrcJZ
+ YiqtBKMFcgS75aZ5jzbUHve1737fK6ht11lPtlrrz3im1LLzlHtKorqT7mnt5P3ObpeovtvVsovX3e+5
+ WgS9JqjLKai1ocu56snn9DmD8Z/FN1C/ytIveZ+tX/D1lH7O+yn9jPfZ+ilfT0n4mRO61j/thM//BR1x
+ NCLR9Yu7AAAAAElFTkSuQmCC
+</value>
+ </data>
+ <data name="monitor-computer" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAD31JREFUaEPVmQdY
+ VHe6xvFe9+59dJPsJttMTNas2WQfs4nuborGGzVmLdHYwIKiG0VAI6BIH5A6dJDelCkgRXrvvXcQaYJU
+ UXoRLAgMzHu/cxRkaJZr7j7L87xMOTPnvL//+/2/859zFgGQ+rf+YwD+nfWTm9/p2fTWWk7c5x+f4v+w
+ +ke+7V9VfGLWnA8t/VQrtv5TrbiWT7TiOz7WiO1b/flXx15mIF8KQFDQ958eOb3L9P2KvlKyDVdQtA11
+ UrwYmXDaJaVcyS2jTskts1nBNevOSdesHiWX1AHNS6n3nMKLxyILGlB9ewiDw+MQizGlkZFRrF+/Xuf/
+ DNBzX/Tft++OrsipaNzkF5PxozA81Z0fkZFyJb7omjC+pJYXV9J0Obb0tkdUcbdbWE6fV2TOvcjMClFx
+ zS103h3GqEgsYWzS5NiYCM3NLUhLS4e3tw94PP6UzM0t2O9s3LjR5KUACgoKLlbV3Gi6VlnbVlRe1ZWe
+ W9SbllM4VFJRI2pu68TDR2OYmJjb2KRBZntHRyfy8vLh7x8APl/AijHq5cWHUOiD1NR0FkIkkhx9Hk/A
+ Amzbts3ypQDS09O9Ozq7MD6BBdXXfxclpeUICQkDjzHHGnxsVCAQIi4uAbW1NzA8/GjOFKaXzPTnzPeJ
+ H7t377Z7KYDExESlkrKKMRpoVNc2ICIqjsx5w4svpEcSTwg+GQwLi0B5eQUGB4deyOB8xiffZwZiRATI
+ 7D/o8lIA1dXVq5NS0gfvjQBGxlx0dnW/UoPPArjsJQBz7O+OHLvxmzV/k6Nz0pIXAZFqbGxcmpSS1tP/
+ EHD14OERjQYzIqPjwBhJ9KS0mJifZeZltntRGTLHPukpEKs0d4p3efBavlbXjl2143vz1377u0+eBcO2
+ 0dj4xDud9wB7Vx6GHoEdkfukB6PAQ9IwlRejnwLOi0q0i4592kMg5g5DbENTyInkPjwu1s/Mvy9rZlm6
+ 5aSS4MPPPj9O6bw2E4gFCA4Nb2i7C9g689D7AKz6aFSYkRkYBqhDYpDA5oNj5g+bGolJ7UWS8/bxQ3Pv
+ GFQJwJ6Mu5F4IxD7koJHIY4iJY5BHN3dLzb09m2T5+jH/2PvPsvfv7P8M3YZxPzzueJX1dQH2Ln5oJV2
+ 1j4EdJCYVJjR6b4P9JBYMBILRmLAXhSOuijb7SZITMkFh4SjomUQ590F4ktk2pt0lUyHk+LIeCopRwRx
+ CamSOnCdaEJsLfAZfvvbPb3/9dcNoSyAg5NzakXrfVyJyEBmWRNa+oHWAeAWiUnmNunOINDOaCG450iN
+ LctpJRkVm4jsqg6cd/SEP5kOJcWQksl4FqmQjF8jCVLSRWsOnej6hZx6h5RDygOpbDGkpJUDWABTrplN
+ bNZ1JBa3QBiahvoe4GbvYzVQMo2kJoJqJrUQFAtHUCwcQbFwc4CxyT2jJBNSsxFf2IRT5/RH9x0+cWeX
+ vFIPr7xyPI9Mh1bfEK//56neX8qe7ZAyCRqUyhiDVA4ZnpS0ylUWwMjIaO8l34jholYRuI4+qOwEqkjV
+ XUANqbYbuEGqI7BJuAaCY8FIDNiLwk2WZEp2KYJTq2Bq40UnwiHk5DSAo2fTu2H73p5FWp79Ukn3JU1P
+ B5BRDWQBeDzeO9aOngOFtwADWz5KbwNld4By0rV2oIJ0vQOoJLFgLwg3V0lOJpdZXAthdBGMbXgswKTO
+ apr1SIw2Y5zK5meuWfilggmkMkSQ2n82iAVwdnZexLWy785pBjhWfOS3AgUkBqiIURtQTCohsOeBY1Mj
+ sak9I7ncila4BWXCcAGA/whsxFu6Xlil54UDYfVYa34VUqmPGIDgqeW0nqHZrfRGQMuSjwx6zGwCskjZ
+ BMWA5bYAeaSZcCwYaRKMTY4SY5OjxNjkFijJfKpPa3489KzmTuC36i7Y4p4KxZIJHM8ahEzAtacAB849
+ BVDT1K1PqgfULQRgHpNvAimk1AYgjcTAzQRj4QiKhaPEWDhKjE3uOVJj4Aob78PIJRS6NHBzldAHF4Q4
+ FHETGwx42GTsjb/p8/A7NSdIZU1A6oBayFQCCqeVy6KqxqBh44eI66OIrQXibgDxpIQ6IJERgT0v3Fyp
+ zQVXfGsCWja+0LKYAaDBZefASiqbb1wS8D7nMpaahUAq5eHTSX1Q7fF5gNEB2aMhvKRGmPlkwy22AWFV
+ QDgpohqIJEXVANGkGAKbC44FI7GpPSO5mXDqlj7QsPBGTc3g00n8BODnNnFYFH5n7k508HzYFMD273Zo
+ GLpFit2TboPjmYKr14DACiCIFHwdCCGFVgJhJBaMxIK9BBxTkil1IriFFEDTSggDzyRo2wWirKxzFsCs
+ TkSpLAppfdyFDqmHPwXYvn2dgob5/SulE1A09oFPKXCF5FsG+JH8y4EAEgM2C46gWLgFUoupnoBTWDnO
+ 0Ugrc4VQNveFXXgdu19GGrYhyM9vmQJQfZLAFED8XbxuFICVVEqrFAwhFdnJAERMAUhLSy/d/88z/cIS
+ 4LiBEF5FAI9RMcAnCeh9Zps3QbFwBMXCPTFAzWEWmH1ELc6YXcEpEyGUTHxgGlABQbGY3Q+/aAKGgnyo
+ Gl2GtoknHFyuSpTQJMDP3fOwXOcS1loEQT73AZTomN/SnGABZDWfAjDzYIe0XOelQuAYzXzXPMAtH3An
+ eRQAniRm22XSJBwLRmLBSLZRzVDi+kPeQIATNAgcfiE888bZ7zCyiW2Hipk/1IwuwcDsMqKjiyU6z/Qu
+ pKph2suM/grywpjeH1zFdqKdHin4VO0i/Qbog9ThGQCbtu1pYYwf4Qhhnw04kBxpJ04k51zAhcSCkRgw
+ y+h2KJgG4Zi+AMf0BFBzzYRT5ii7nZEzrcY0XNNwxuAytIw94e4ZTj9Lu+Y1PR/AkdhWbKCy/ojK51cc
+ PhaFtT2e1Ee0oiSuC32xfnMNY/qQjhBW6YB1Bo0ayTbzsUxj+nDCLByyOgLI6gpwyi4JVkkPWNBJ6QU2
+ YI+KGz7ba4Jz2jZITq58LsPTzTPPVdUfJ/CWih1+T2fhxbzS2Z3oiLYkwKrVn2ebRPXh8IWrMIgfgX7U
+ EI6ZxUJaS4D92gL8YB4Nk5i7sCGYSZknDUPOOHx4vazF+AdbbPHG5gy8tncUr22rh7IyR5yUVCGeae55
+ Xk8CzNWFpt47oh0tkcCKlX/2ULRLwVl+DXaqukHWMBSc0G6Yp0FCZ/lVY9sUrdp2HdMe+Pjrkw+XSbdj
+ udyEpPbWIDGxgq4LRcLIyAFcrut4UdHt507juQDkdGIkAN588025bQoWY0bJgPE06UYM4aCe39j3ikYj
+ MkoaY2ZuHhMZdXVw9vKH3Gl78SrFcczUhwcr6EpczZThkpJ22NsLoa9vI3Zx8RdVVfUvCKNy3rRvwdFn
+ 5oCMSpIEwOuvv/7Hv2yQGeLEi3HCsXBit+rFcWVzD1gLA2id04qawUEJCcNioMflY91Z0SytOVIk3rJz
+ d5uRseNAVdWAhFkGzNzcDZqapqLg4MzxuUpqXgD/OqzYp9j3P1v39Ur9+p2tEgDL3n33vZWfrh06Z+GM
+ 0Ny8WYZnAvhEx8HK3hfbdMZmadOpYmTdvAknX9/732zbkX327IXy1NQq0UyzQUEZTCrQ0bEYSU+vm5ov
+ yudNniaQOY5fnLa4t+nQqQ6uhcdARUUPXRGMekBXKVZMAXy2fv1WjpVVw0yT872uHBhAbPk1uhjmCBmD
+ IRwwGZXQTpU8pNfXg/1cSen49n37rnz44SdHDx9WCLe39+6cWUKVlf3w8AjBuXOGYzRfHskraT+UulQ4
+ /mdphW75M5wu6mZP4W+PSAKsWr16h1tg4N1nma/o70dJTw/yOzqQfecO0qisuBau2HkqGidtRiQkcz4L
+ 0ZWV7OcKOjuR1dyMnQcOxDEnzCVLlizbuPE7a+pSxQkJ5aMzUymk9biCsh6+3ys3UF19d9ZcqWoephJ0
+ 76cE3mUTkFNSKlnIPGO8uLsbOazpW0hsakJM/U1E3LgBF14IpOVtoO76SEJHtVPhX1KCGCoj5vPpt27B
+ LzNzfM3atbKTK2AysOijj1btOXhQPsjGxquNKY3pMPLyZ9unvy4t7YCJiXODtPRRwYoVH6xnrwvR36/t
+ +ILR+QDKenvZEWcMJDQ2IZK6T3B1NfwqKuBdVgbry/5QVLeHMX9YQif1E3ApNxf+FdcRQp+PqqtnQbbJ
+ 7E+c63Ih+Xjr66+3mP74o25uTEzRI8b4JEBgYPo9JSWNtC+/3KBJn1s6/ftSixcv/ktAcop4LgDGfB6Z
+ Z0olroF+I9TUsoYEpaW0PiqkJUYu9Fy8oGHoAvurDyV0xjgGF9PS4FlYCGFpGQKuX0d4bS2kj5+gXw0L
+ 35d7//0/bdm//wffr77a3Lxnz2H+8uUrvpjvO0wCSzmW1qKZANepbAqpdjNutSG+sZE9OGOeT2XhSjcy
+ LmZmwjwlFWdsHWFkdQn8yAcSOm8aDm5iIuyzsmjdlE+r2VL4XbuGb7/fS78gXt2NRXYOyMge6ynv6pJo
+ m8zo57a3I6WlBdHUTYKqqtiS8SgoIFPZrHmDuHgouLmDY2SP4MQhhNA1nElpmwfDIDYOlqlpcMzOoZVs
+ IdRt7PHl2k0vdR9g3gSYDevWfeOoY2hOl1KenqxKqdswkzaZukcU1X1gZRVbCu75BTT6WTBLToE+GTwX
+ HEILLyO4C/ORlHMPkcmd0LW6gh/0LVlABpQBVrvoCMUzmv3Llr373itPgLmpICsrn2ls7ojI3Hw2iXKm
+ /imB1JZWtpMwE9envJwdSWZErai+jalEODExOKFvin2yilA2dcRRrjXUQ8OgFxsLk0RaraakQIFjBDsH
+ 7webN+/Qe5Xm2S40raUtoQkT4uDkPcF1cEVUYRGKqKwy29rY7sG0zKvU15kUPNkJnAOb9Aw2CQZENyIC
+ F2jEDeMTWOPGlI6SuRVU9c1ga8vvXLt246lXbV4C4ElPXbR1624HX9+EQf+AZJhau8LUyR3BBBNPXSjy
+ Rh07F67QGZhXXMLOB2dqlQ5UIkxZWSYlQcXBGWcucGFq5Y709Fpa73Br1qz54tufwvwsgMmDvP32u2t2
+ 7TroyeFYVZMJscA7GlZ2l8G1caeO4wyOpQM0zW2hybWFDvci9Kn0jCxcYEcXhpOTr9O94Nh7Cgrn09at
+ 26Qz112VVwkjsZibuWM6+OK//33diePHVYPV1AwzdXUtq8zM3O54e8cNM0YjIwvErq5XBy5csGvS0uKW
+ qKhwEnfuPOD13nt/XP0qTS60rwUB5jlj/ozA3v/DH1Z+98Ybv/qSnv/m/8vsnH7+lQd/Fcf+X104LlAR
+ 5z/iAAAAAElFTkSuQmCC
+</value>
+ </data>
+ <data name="window" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAfNJREFUaEPtmk8o
+ REEcxxe7J/9WbvawVxcpBzkhpUi5OLg67EWSFAclxcnJHrW5UFw4iDO2uMiKZ6WltSVa689jd7Nr/6j3
+ NbslntFr9Gqnec3W57avme98f7/vTO9NGQCb0L+CAJEhi49WgiYo4wUBneXlRQGklsTBbi/OeVpcAQ4p
+ gG+52aUDnBu+4mcTO+uQb2oBRKLGiQ+SQqPFFOrqhXpPdjOR6BvAC5l7jxTAyzVrO3AcPMHG4gJFKHrH
+ 1CcrCjCyThPOsvXZEeZwiCkdCpZ0Yxs6cLC/C9/kMEXw+opJgGeNbHJDNEqCTcA26rEJu44ddEkBkA7I
+ EvruIdnERhsY9xS6Sb2hkPm/uc1lmWJ0KwzM79FEcmwxeoZlnMKn4wLb7DHK63jwn3GtfZT4z0rw+q90
+ gNfKf41rcQfSaTzEYhT3uRxTjJbCHUMHEl7vny99VL+fScDE7AJc7laK8yeV6fnGlya4VLeO/uQg+z5g
+ VoBnbIa8Z22gUGKPTAKqn2phe7TpaHvtkALAWkLSAVlCJlOIewm9rq4i39xM8RwIMKUIdwFmN6LIewah
+ eJIiqmlMC3CpJRDS4jrC2ht7jJoVUIrnLX4WEuBVu3SgFHVuNIalHGh3OJCprEJKJMics+QTU7fQFz2K
+ N21EvqlSmPsn8UKYLq/+Q1MAAAAASUVORK5CYII=
+</value>
+ </data>
+ <data name="propertygrid_sort_alphabetical" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAI5JREFUOE+tklEO
+ gCAMQ/XfK3j/E/gNN1NLLCljRoeaLGZQXrfBnHPepy8fACmlGieryS8DmHRR9hSgIkKtAdehdQEQaBUe
+ gPsNgO4EqOiuxQ7gCW2LmrsV2DnwAHtWk8cKIOAteLOoAOuq+atrpNPIv7yDSKzL1ujDAJgppACwMBJ1
+ iJEW3AoigF9moIYHlA+UIAsfXwEAAAAASUVORK5CYII=
+</value>
+ </data>
+ <data name="errorProvider.ico" type="System.Drawing.Icon, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ AAABAAEAEBAAAAAAAABoAwAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAQAMAAAAAAAAAAAAAAAAAAAAA
+ AAD////////////////////8/v7F/fuc/PiW+/ix/Prt/v3/////////////////////////////////
+ //+a/Pgl+PEP+PAP+PAP+PAP+PAT+PBn+vXp/v3////////////////////6/v5a+vQP+PAP+PAP+PAP
+ +PAP+PAP+PAP+PAP+PAl+PHU/fz///////////////9v+vYP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP
+ +PAP+PAo+PHt/v3////////M/fsP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PBx+vb/
+ //////9p+vUP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAP+PAZ+PD2/v7///8t+PEP+PAP
+ +PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PAP+PDD/fv///8V+PAP+PAP+PAP+PAP+PAP+PAA
+ AAAAAAAP+PAP+PAP+PAP+PAP+PAP+PCs/Pn///8f+PEP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP
+ +PAP+PAP+PAP+PC1/Pr///9K+fMP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PAP+PDg
+ /v3///+c/PgP+PAP+PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PBB+fP////////4/v4v+PIP
+ +PAP+PAP+PAP+PAAAAAAAAAP+PAP+PAP+PAP+PAP+PC+/fr////////////Q/fwc+PAP+PAP+PAP+PAP
+ +PAP+PAP+PAP+PAP+PAP+PCC+/f////////////////////T/fw1+fIP+PAP+PAP+PAP+PAP+PAP+PAX
+ +PCW+/j////////////////////////////7/v6p/Plc+vQy+fIt+PFI+fOH+/fm/v3/////////////
+ //////////////////////////////////////////////////////////////////8AAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+</value>
+ </data>
+ <data name="propertygrid_alphabetic">
+ <value>Alphabetic</value>
+ </data>
+ <data name="Ignore">
+ <value>Ignore</value>
+ </data>
+ <data name="folder_star" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAACKZJREFUaEPVmg1M
+ lPcdx//3fs9z99yBEJt1WzqTrc2SZmk6a+K2LpvGtGE1jd1qRnWmXRpaK77WicU5GOCqgnIg4AsHihYq
+ xyFUsWoEkbM4DirH+/sd9waKAqIyqw3+f/s9d0B5u+OgGK4kv+S457k/38/v/3v7P4cAAMgP+ocH+CHb
+ vIqvWK3+HZrYmwPxuszb9XkFMIaqMyvXqT//+u8q4VQiq95VLTKuVRv9FuBGmKrUtIGjNVu4zNqPOcFY
+ oTVbuT+ZNnJ91R+qHvktQO02zlq/U0kbditpY7QihRfaFKMQNv1bEdf4L+WT+kglrfsHN+iXAHURSgmK
+ HGreo6Ct+xW07SBL2zRscruGvdyWyNLWBJa2fKqgCDPglwDo6Z/zwtuTWGo+zFBLOkM7M4dNy1DzUYZ2
+ pCDUAbZ3XgGwivwULaTqPdUKUzj3BwyZ36L4JejhDzpSUXAGQ22fyan9tJw68mTUqZdRhw5/z5FT6wk5
+ D9Iz5wDY+KRoCl/6B4pXGNeoG258qKK12zmMdSVtjWdpRxrjEujIldOuQhm9+aWU3rrktpsXpLT7nBuG
+ h7McY+5jeNViuBXWf6I8iMm9CR2yEtdWT1lGUZyYZcnzS5eSNaGhZOeWLUQTHU1yEhJIyeHDpCE7m/To
+ dKR/82ZyDe8dVz2mLIfvqX5p2sTd55OyGeO6/RDrChdePC+0p1hK71yT0DvXJbT3upj2lkvo7VI3iPMM
+ QpzCnTjCuPKCdwBWLIoV7DMsw2IXwEsvkRe3bSOavXvJ+eRkUnn8OLEbDOSxzUagq8uzNTcT+tpr5C++
+ 7ARWnNDGKCVticfYPiJHz6KHv5DCrWIJ3Lkuhv5qEQzUozUI4W6tmPZXiumdMolrZ/jQ4oHbk1nKJz2G
+ obZ6A+fqHYRhyMKsLNLrTai3a1FRJGcsAL97zz5LfrFiBQl9/32yIzKSaPbvJ7kpKaSsNEE60JbEgCVT
+ Do48Kdy8iOK/QvE1IrjfJoRBmwAG7QJ4YBbRe40i2meU0J4SKe36YngXMOxa9ilSGv6pHN11EhJC3p3O
+ 094AjEZyf98+cjotjZzHnTPl5pJbFRXkid0+eeec+J75lBysWTJwFri932sUw71mIfzPIYBHfQQe3yXw
+ 8KaQPugQ0bsm3AWDhHYXyaj9c1dCx0/cbbJmDYmYrfdn+jmbSQgdRxiwnpRBVyECXJFAX5UI7rUK4WG3
+ AL4dJDD0LYFHvQI62CmkAxhKfG7wYYRV6gkm8/JJAKtWkc0zFTKb+61GETTvY6HjEAJMuwMCTzvQgxXs
+ x+NCdvlyEjYbQTP5jOWaCOoiFdAUy0K7hoHO4RzonioHMJQemIWYzCLaWyGht4ql4CyU4a7JoSNVDpgD
+ XzXsUkpGIMjLL5O3LBbv1WYmYife21EshhvrOajdpoTGKAW0JjBgPioHezbmwbgqJMYqhNYggrs1YujD
+ 3LhdJoHuL6WY8DKEZqAtiYXhKpQ4CrBwIfl1dfXTA2i+IoKyoxK4+KkMru5loPIACw0pfCViwJ4rh65z
+ MkxmKdw2YEX677CVS6CnVArdF9D7Z2SAfQCwDwBfgvlSPNwHVo+cJn9SXEwefh8vO50EsBrB6dMCyMoS
+ o0nhJG75iRMs6HQcVFUtAKczGHvKd2a9ogLsxIDNDBNaBt3nsaxechsvnAfDTgy2IhYcTYHQVhkIcX+T
+ R2An/j124mXYiZeOALBY+np8AWhqIlBUJEBhIhQpQZPhawbFKqCkJAAslqBxIscKnvi686IaYxrzIYMB
+ HBcAq4wrVHjROAsBzkIuQOslzrVmQYG6H3tM4KQqxL+Rnk7MUwHk5YlQoBSN96YCF1FBXd0Cn0V6AzCf
+ VQNOo4DTKOA0ChZ0hL1cDZ0nEUrL5wkDOI2CtUTt+nupqarqqTq+a5RITSU1UwMo5kTsVCBtOjXgeYBP
+ SmjXKsHR6naMvQ7D5RCLyc4CngfAWh7oej8uTnnGI4BGQ65NBGhpIXARt9mbF7/PtZasAKxMHLSdUoPT
+ Pj70bF8HQmOMEnD4A5vJDbZxI3PAIwDOKhcmApw7J4TOTt9jeqYwzRmB0H7e7d2prLN8AZi2cOAwB7kK
+ QEiIbINHgNhYopsIkJ8veWre5wU7bdM7x2Jwe7+8PHDomWfIix4Bdu0iGRMB9FgNZurVp3W/VqvqxAo0
+ 5aMXVxLzZ4HJAKzfAMTHK0s9nTlcAGFhJHYsgMNBID/fXX/9wSIj2eNeAfDYuGMsgMEggOrquan3c+GA
+ devkUV4B8Fi4fixAfr7ILzzPw7e0BMGSJdJVXgFeeYX8deypLA+Pe3PhublYIz8/YAATOMArwHPPkd/U
+ 1X03ker1OGD5SfwnJ3O13h4auJIYf35WVkYej4SRXv/0RoiZOiYmRlnoC4AqP9/9ZKKxkcDlywF+swPh
+ 4QrNtAD8DVotsfIAZ88KwWr1j/LpcATDypWyTT4B4GOReh4gL0/sN943GAKfLFok/ZVPAElJ5DoPoNP5
+ zwiRmqrs8zRCjJ6JR17gc89LPIBe7z8jRGwsa/HmfVcBGrlhzx6i55+mFRT4zwixc6f8rM8Au3eTE1ev
+ CqCmZn5GCJstGAyGgG+ys1Xm9HTu6sGD3Km33/bcgSeF0Pbt5BB/Bp5pnZ7J/XxVMRoXDOXkqJzHjnEV
+ Go1SHxWlSAwLYz5etky6Ch/p/2g6j0+8PhpC69eT/+j1czNCmPAYqNer+rVarjYxkSuKjlYe/ugj+a7X
+ X5euDQ4mz2NiimYq1OsowV9cu5Z8otMxPu9AY2MQ9gz1NxkZnCUpSVkSE6M4Hh7Oxr35puyDF16QLEaR
+ Xr+gnnOAN94g4Xl540eI9vYg/mA/lJmpuJ2WpjBhVdBt3apIWL2a2bp4sWwFilTPlZDZrjMaQvgtzR8j
+ IpjOhATWsGMHk/7OO/LIV1+V/nk2cTlbMbP53Lz+q8FsBHtM4rlYbD7W+D9MzRR6eEGuxwAAAABJRU5E
+ rkJggg==
+</value>
+ </data>
+ <data name="mbox_info.png" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAABcQwAA
+ XEMBOS4mtwAABL5JREFUaEPVmX1olVUcx0+3ba6VDmP7w15w+TJ0rJc/EhuytuqP0Gz4UqhoDoLYcOAW
+ TpQFW2KaKFZihbMg/CdCxTeU0VK2P0SdzD9CGlsrfGtg7Y81pFjiPH5/u7vee16fc577aHcXvmz3uec5
+ 5/s5v3N+5zzneYRzzib0hwAmsia0+bHRE3XvYzg+DS2E6qAt0G5oF9QMfQC9Bk2Nqt1IAGCoHPqCsVgf
+ /tKkctHFccDSdGDSAoCBasYe7XY0bINqo6iFAQkFgMbeYCyLetClp33KHEGdJT4g3gBo4NNg46/A9PtQ
+ M7QL2gk1QWugF12A6lwhnAFgejJjORRqg4F3cP0w9M9YarDrT/z+DfS6DeYrFwgnAJguZGzSJb35apj4
+ xcG0CaoT975pAvk+CCIQAKazGcvtUs0XodGTaRiXgVpRV5YO5IANwgEg+5Bqnnrsr0DzM2ZwvnEj5ytW
+ BA2pxO+XUOccHcRWE4QVAMYbVfNLA43T+C8q4nx4GM2Of/budYX4wzTR39ZBGAFgfK5qvsLJPAHU1yfN
+ 039DQ64AVO436Ck5Er96AmQfFgGmoMLfnQEWLxYBurt9AKhsm24oNcsQ2gjAeJna+986m0+k0G3bOB8Y
+ 4Pz8ec5LsWEITq9ymQ0yxC1K56kQBoDYARHAfej4m7SB0ZpSIENssALEFyx2VwQ4FqL3wvS47p5PZICf
+ gwBWi+aL/0fzBHRTNxdeSEAoQwjmvxMBNnsDlJVxXlGhV2FhmMgskiEaLAA5/SLAGS+Aqiox+8jfenvD
+ AHwmA/ygBYhvG+TN2i0vgAULOB8dNUN0dIQBOCsDXDYBzBIBnvUyn8hAxcWcL1/O+eBgEqS1lfPKSs6z
+ ssIADCrp1AQwXwR4ORRAAuTKlSRATU0Y46n3KBu9HIIQJjHMvyoClGcQwGQ5ClN0ANIKPD+DAHJlgMd0
+ ANIGbmaGAAzL5kdMc+AJNQvdCQ0R3Ryg5wQhO97fmWoWstg1sfCFDADYLwMcs63EB0WA7RkAsFIG+MgG
+ UCsChJ/I0Qyh/2A+TwbAchk/lNbthZ5R5wGthP55PBqAfbL5qw7PA+yECPGuM0BuLufTp8d140ZyIWtq
+ il8rKPDtiBIZYLsLQJUahVNOEO3t9s0c7ZNoS+EW0d2yefqOs47kOw3bQ32nCDEXN98ObLinxw5Av65d
+ 6wJwGW3FZICvU81r58D9yYFzPzUK7wUClJdz3tJiVgN28nl5QQC09lDyEHI/PQ9PcwYYo2PscxWCHrSD
+ DKT7+xLd0KmVzVsjkBKJcypE3QOCoC3DWzrzxuNFh6NFNhsAAyoEHS/2RwjSgbqUjEMwnbqeN64D2jAx
+ Ng8VDaoQ2WhgR5oQ9LDyoa7X6RodKiPxmt+kBkYgZSi9hMp6VQiaaHQM+DHU5wHThbLroRyT+R/RVr7N
+ vNMcEHIuegOV0msgU6O4/jxUA+2BjkCnoXboIERvayiTPWe5f6zuPUHGvYaQkrrir1D/toOEen9GEV7m
+ at47AlI0nkRjO6F/IwC5jjoafYynFQEJ5HE0vg464wkygvJHoVVhjEcGIMHkw9AiaBO0Hzo+DvbT+Nz5
+ En/roUoolo7xBwIQhSHfOpzTqG/FD6v8PRJO78MpB02PAAAAAElFTkSuQmCC
+</value>
+ </data>
+ <data name="No">
+ <value>No</value>
+ </data>
+ <data name="mbox_question.png" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAABcQwAA
+ XEMBOS4mtwAAA1pJREFUaEPtl11oUmEYx/2aigx30ag2XXURYQwTkiBDMaSrugi61CBidhVaKUF4M6Iy
+ ugga9kHBRqMkKiq6ihYYMYqtj6tiUBch0UAq4oSY0Nbs/4xz4PBybJ4v5wGFP8ej7/ue/+99nvO872tu
+ NBomQ38IwMgytPnl7DHy7HcBOiF63RQSRwHlOAaN9fb2vnW5XN+dTudvfK95vd5v4XD4/ejo6KNqtZpD
+ n4PQdsiqNoqaRACmh6E3EC0q/5Xb7ebS6fRYxwDAcADiVjIu/t9sNjcSicQsIE5DATVRUBUBmLJAH+SY
+ F7fN5XLPYJ6isVcphFqA/UrNUz+8H3WO467wEDuVQKgFuMEC2O32xWQy+XJmZuZmpVK5Vi6XrxeLxfs+
+ n++rFGyhUHjMA5zHtUcuhFqAV6ypeDz+mjd0Edc9UD/kHBkZGUTbRbZ9KpV6wbenVBpuN8BH1tDU1NRt
+ 3tA+psT2oO0ftn0mk3kuAoi2G2BWbGhoaOiHyMwgA3BAKoUmJiYeiPqE2w0QHRgYqGDRqvn9/i+lUumW
+ FACM26E5FqCvr69Wr9cLqwbAz1YWVxLlsKBTzOxfZc1bLJalfD7/hOm3pa0R4B+2GVcSmaZKchRaLxiB
+ 8ROseZvNtoBtxVPG/Fncy95aqKpCK80WjFPe/xUDYH/E3cOHMX8J97Q3ku1HdodWHwLTG6FfYvMOh+Pn
+ 9PT0JGOeyu2OVsdl2+kJcJdNHabi0PtyDtqk1Dz10wUAxtdAC2IA2jZI5PxaNeb1BIiysx8MBj+rrThS
+ sHpFYBsLkM1mS4YBWA6tyXSHIGjvHwqFPtVqtcsiACq3mkyeJoM0M4NqGaQdKTPz9PIeMQQATNJ+SLxC
+ C99l73maAesaAf6hhxiIw7iXveK2FQC53w8dE4SD/EmPx7MLJpxapY4wjuYRgGk6J7+T2DrTqhwwAoBD
+ at/P/3a8C8CUXz1SqGkEIpEIHV6i0AatIqEHgBXpMs+mkdVqXRofH3/IV6QLuHq0gNAcgF+Ft+LQMhmL
+ xeYESZy+dncsAG/M1mQRExazLsBytLUIY5MxLPj9TJMo0BFS9gFe6jl6AtDY66CEhBSdf1cDQO8J0jWF
+ dDev9zvQBWilwLRllloxorRNF0DpzGnVz/AR+AcOBL1o7Kmu0QAAAABJRU5ErkJggg==
+</value>
+ </data>
+ <data name="Retry">
+ <value>Retry</value>
+ </data>
+ <data name="desktop" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAACj1JREFUaEPtmQtQ
+ E3cex9eKr7vO2evUu/Zs72F7147edTrezdmWdmyvnfM8q5718BwRX1WEU4vYIohKtYjhKSQ8E0ICojwl
+ ikAtiqL4FpQozxACBAiEEBIgLIIC3/vvQtLwTBC8a2eOme8kM1l2P9/v7/vf3WymAKB+0H+MgR+yftDw
+ bHu+z+lT1PZn58zZ/dbixd5bV22J4qz2yUz+RHjr1ofRd2pmHinY+D83QABnzJ69a76t7WGHVfahh+0O
+ nT6xQnD96ieJUtmnkqJG+wvlHTultX1u1Rp4qrTgNGvANzTCt1KO6cIq36dugADaTJ/uPG/Roq/sVnwa
+ dNDOMyVmZfiV3GUnCsv+kfZA9a9zZe1OBcpe18omfFHbAi91M47pmwikekwdliswPabaf8IGCOAzRC8v
+ XHjwk6V/9/VY82VC1Cruxexlx+8WrUy9X2eXWdq69WZNj4usCS7VOrjXa+Gj0YBLII06pqnHgfzrcE2N
+ h3uCEPvjwnFYenvQNubbM+89y6sZAwFWGSCAP58/f99fliw5usdul5i3OjA7c5k4X7oiSar89EyJbtO1
+ qkc7itXYqdDBRanrH3WTBr4E1ChOUxM87t3DzrQUfC7mY19cJHziw8A9GYq4U+G4k58GvT4fNC1lFSvh
+ Y883GYP2Yb6/PSVKYqAmaOASsP1Hr766992PPvLZZbeNH2h3NEtCFkrBigRp1SpJsXZ9rqJr+/1GOMt1
+ cFbosVtJRq1qxqGG4XIrKoNTegYco/lwFYbDSxQKX3EIIk9wkXP5JBobr5kgjbCjvebeTIWzKHrE4+x4
+ UEvWgPIYa+A9x3j+unw1HMtbsEXWiu1yPb6saYE7AR1Ju0tq8FlmDjZECeAUEQa3qBB8LQxGkDAQkkwh
+ 5PLzVkNaMiFXXIRjkD++lDcOYtlaWM8YCGYN2O7LEDmUtsKlklTAgrbweIhLDkVh4Wm0thZMGuhYRphq
+ fRHMgePNUhOfQ34DpglrQ/oNeGSI1txvg2Opfkw5RMejsCjriaGb2h/gVrMMSXW1ECsbIarRELUQtcGH
+ 1NPSNIJiebA/ncsyrrmhxrToWp7JwMqCdmyQto6qtSeykH0lyeJBFPpiXGioRHytCnFKNWKVzRDX6Mlr
+ O1LraORrOqFtp9HRMVhiYsSSAeZzSXY81vATsfKKBtMEdQMGSIWW3OiA3e32EbUy+RbiJNFjHuCwrA1x
+ NQZ820CjQtcJwxDAocBPaoAxcfd+FhYHJDIGwkwT+OBKB5bnGYbpb6dl4AhCLKYjJvCWIMf63NoJGAz3
+ cD4pGPZvvo2tz72kXUtR/2TXwDsXaHx8oWOQPjyrhosfxyI8k8rTNnDzjgQhCQI4bFoPLbl9yyNqIIqg
+ qPOsgYVZD/FeZqdJtukG2B/0QXv7vadqwGCg0U4kqh6+BhSKHEQkRsErIR5H7skQ2Qa4+fmjj4D3EgmJ
+ 3CgqlzWwIK0Lf0x9aNIyj0BoNDetgh/vBBhoFpws5rY2Gq1ERgPNzTcRlyaAd4IYB3KustDmCiSL3c1h
+ HQ7MfQ3v/3n13V9T1M8oW/cM0WsJ3VhwvIvVBx4CVFRetBreWgMmaCN4Kw09kbbFAPfUb+B3Uoh9krPg
+ abqGgYeoDPBKSwMvOQZXriVhoWs0poU1CPoXMTHwsqgb8/jd+JOnBNfvnB4X/FgGRoPW62nkXS9AQHwy
+ 3E+mIUChGQYdru/FV+fOIzBJBElWDLlwfnev9OauGNiENkSbDMyJeIzfeN5CSmb8uOGHGjD22rwiTNIM
+ tI4oIycP++NT8XVB2TBopi7eN+7CJzEW4pRIqFR5I/IscBbChtcYYzLwk2M9eH1b7BPBGw0M7XWrGXSL
+ jkZLCwN/FQezh3ebU65iF2t4QgSKijMtcsx3JBMIaRSZDMw42ot5m57cgKja0L8gB3rNJK1joIm0BLxZ
+ SyP928vwzLhoSp3p9b6kdPjFJsPjVLZFaPMr9etbRLA5phabDFAHgV+uOz6unZjvUFhlYOthDq0l0Ay4
+ ppnGEcld7OSlQXA8FTxxMgLjUiBOTEdVjQ715OrNl1t3K2E85m83xMImUB03eQYUBjZpY9oMNKMmDQ11
+ E41L8k48e6IPaSUPoWqkWeh6FY06otp6YqBifAZ+t9HcwN6z4olOILrSwAKbQzcS8EY1jQYCzEAfud2N
+ 2Sf7kFvRyUIzUpIbvJpaGlHjNPD6RrHZBCbBgIAYUA+kzUITMdAqJmkiJuk6AvzXrMd4JbkXBZX94NVK
+ mtSIRqTM+gkUSM/h+c2XzQ2kiyY6AX6FgYU2pm2CHqgImzSRVEHjxcRe2Gb0oIy8V1TTqCSKJN8Grbmd
+ ZrZZvpsLag8m10AUMTC01wy0sSJs0gNpSx48xFtne+F67RFkZBIVxEiElQbSshIxa2vx5BuIlBmG9bra
+ rCIKUhMm6coqGnIibkEX1l7uAb+wC+VyGuFllifQ0VGId7fyWPhJn0B4uYHttHmvGWi2IgPQTNIVJHEm
+ 9dIKGr753eR50CNkFj9EeKllA4H8CDzjpH5KBkoNpooYe80kLWegiRhoJmlGZQS+VEa+XpbRCJN2Q3C/
+ G0ElY38n1mpvY8EGvgl+yATOTHgRhxIDTEWGQsuGQDPgJeU0igl8fimNaGknOA86yFlIPeYidvEOALWr
+ 8ykaKDGYkjamzSY9kPZdApxQRINX1I6IUi2EcjWSa5SoJA8BLJ19Ksmt/SvrEwfBT/oEuMUGUz0KScIM
+ LJfAMotTUNEPK9eXWIQdycwaF29Qrr2WDdg4N2D5jqPk8d/1cR/IqbAdYeU6ckVVI0lZC5nuyWDNDVRX
+ X0SEMAjPb7gwDH7QBN7b278G2NPT7h78fkMEzl1KHbcJS1UY7XPmydv1GynghAZjm9cxLHUJwx828vHC
+ +kxQjg2D4Q/0YYZfV+cs/1bVFH77jv5no+YGBs6xL2y+hP1B3Ek3UVWVg/gUAb44GoQ1e0Px7vZI/Mr+
+ OKZvkoJyefQd7F5gqvfjxzMDOnQzfVvKqED9Kep4zwHqDGypHMw0/1VpRAPMNKY6NWCpMwf19VfHbYRJ
+ Ne9aKry5wfjMi4slLpGYv1GI59Zng3LSDE21b4bfQ3qWX2v9NF/tNSqCDqNSsJGAzrXm569RDbCVIovn
+ DQcBzp5PHtUE8/gjhjyzcT3KxWq3cCzaHo256xIwdVMRqeTj4an6k1Q5LaUk1VSSqieVjncI7AxrYEfa
+ hnp/hAoZL9fG159uzsNefy4u5aXiUAgPm73C8fHnAjC3tT+2vwjKuWV4qr4kVV993TSONo+kyiWpOhDQ
+ Xzwp6Gj/Z5UBxsiUf2sxZXP54FOaW39XZ/l3tMzkaEumBOiTqPgeD5Lq2xNJdTwmrTZAHejrm9Gfai1J
+ 9TIV0RlMUl1PQF8azwEne9vhBvpTfTTLz6AlqRaTVBNJV92ps1hEYKdPNsBE90e9sSfTaWZwm8qGo82l
+ IjsDSarrCOiLE93xf+v/v9e/1FsTwv8NWJPS09zmP/rAGm4g64OPAAAAAElFTkSuQmCC
+</value>
+ </data>
+ <data name="mono.ico" type="System.Drawing.Icon, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ AAABAAEAICAQAAAAAADoAgAAFgAAACgAAAAgAAAAQAAAAAEABAAAAAAAgAIAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAwMDAAICAgAAAAP8AAP8AAAD//wD/AAAA/wD/AP//
+ AAD///8Ad3gAAAAAAAAAAAAAAAAAAHd3AAAAAAAAAAAAAAAAAAB3d4AAAAAAAAAACIAAAAAAd3d4AAAA
+ AAAACIeAAAAAAHd3d4AAAAAACId3eAAAAAB3d3d4AAAACId3d3cAAAAAd3d3dwAAiHd3d3d3gAAAAHd3
+ d3eAiHd3d3d3eAAAAAB3d3d3eHd3d3d3d4iAAAAAd3d3d3d3d3d3d3iHeAAAAHd3d3d3d3d3d3eId3gA
+ AAB3d3d3d3d3d3d4h3d4AAAAd3d3d3d3d3d3eHd3eAAAAHd3d3d3d3d3d3d3d3gAAAB3d3d3d3d3d3d3
+ d3dwAAAAd3d3d3d3d3d3d3d3gAAAAHd3d3d3d3d3d3d3d4AAAAB3d3d3d3d3d3d3d3eAAAAAd3d3d3d3
+ d3d3d3d4AAAAAIh3d3d4d3d3d3eIiHgAAAAAiIiIh3d3d3d3d3d4AAAAAAAAh3d3d3d3d3d3eAAAAAAA
+ CHd3d3d3d3d3d3gAAAAAAId3d3d3d3d3d3eAAAAAAACHd3d3d3d3d3d3gAAAAAAAh3d3d3d3d3d3d4AA
+ AAAAAId3d3d3d3d3d3gAAAAAAAAIiIiHd3d3d4iAAAAAAAAAAAAAiIiIiAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH////B//5/wP/wP8A/wB/APwAfwBw
+ AD8AQAA/AAAAfwAAAD8AAAAfAAAAHwAAAB8AAAAfAAAAHwAAAB8AAAA/AAAAPwAAAD8AAAAfAAAAHwAA
+ AB/AAAAf4AAAH+AAAB/gAAA/4AAAP+AAAH/wAAD/+AAB///AP////////////w==
+</value>
+ </data>
+</root>
diff --git a/mcs/class/Managed.Windows.Forms/samples/Changelog b/mcs/class/Managed.Windows.Forms/samples/Changelog
new file mode 100644
index 00000000000..3c69c1b55db
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/samples/Changelog
@@ -0,0 +1,6 @@
+2005-10-05 Hisham Mardam Bey <hisham.mardambey@gmail.com>
+
+ * Added mailclient.cs which illustrates boxes, multiline text,
+ scrollbars, labels, single line text and combo boxes.
+ * Added notepad.cs which serves as a visual test and sample for
+ scrollbars, menus, file save dialog, and text area.
diff --git a/mcs/class/Managed.Windows.Forms/samples/mailclient.cs b/mcs/class/Managed.Windows.Forms/samples/mailclient.cs
new file mode 100644
index 00000000000..ef66675e2e3
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/samples/mailclient.cs
@@ -0,0 +1,280 @@
+using System;
+using System.Drawing;
+using System.Collections;
+using System.ComponentModel;
+using System.Windows.Forms;
+using System.Data;
+
+namespace smtp_csharp
+{
+ public class frmMain : System.Windows.Forms.Form
+ {
+ internal System.Windows.Forms.GroupBox GroupBox2;
+ internal System.Windows.Forms.Label LabelAuthType;
+ internal System.Windows.Forms.ComboBox cmbAuth;
+ internal System.Windows.Forms.Label LabelPopServer;
+ internal System.Windows.Forms.TextBox txtPOPServer;
+ internal System.Windows.Forms.Label LabelPasswd;
+ internal System.Windows.Forms.TextBox txtPassword;
+ internal System.Windows.Forms.Label LabelUsername;
+ internal System.Windows.Forms.TextBox txtUsername;
+ internal System.Windows.Forms.Label LabelServer;
+ internal System.Windows.Forms.TextBox txtServer;
+ internal System.Windows.Forms.GroupBox GroupBox1;
+ internal System.Windows.Forms.Button cmdSend;
+ internal System.Windows.Forms.Label LabelMessage;
+ internal System.Windows.Forms.Label LabelSubject;
+ internal System.Windows.Forms.Label LabelSentTo;
+ internal System.Windows.Forms.Label LabelMailFrom;
+ internal System.Windows.Forms.TextBox txtMessageText;
+ internal System.Windows.Forms.TextBox txtMessageSubject;
+ internal System.Windows.Forms.TextBox txtSendTo;
+ internal System.Windows.Forms.TextBox txtMailFrom;
+
+ private System.ComponentModel.Container components = null;
+
+ public frmMain()
+ {
+ InitializeComponent();
+ }
+
+ protected override void Dispose( bool disposing )
+ {
+ if( disposing )
+ {
+ if (components != null)
+ {
+ components.Dispose();
+ }
+ }
+ base.Dispose( disposing );
+ }
+
+ private void InitializeComponent()
+ {
+ this.GroupBox2 = new System.Windows.Forms.GroupBox();
+ this.LabelAuthType = new System.Windows.Forms.Label();
+ this.cmbAuth = new System.Windows.Forms.ComboBox();
+ this.LabelPopServer = new System.Windows.Forms.Label();
+ this.txtPOPServer = new System.Windows.Forms.TextBox();
+ this.LabelPasswd = new System.Windows.Forms.Label();
+ this.txtPassword = new System.Windows.Forms.TextBox();
+ this.LabelUsername = new System.Windows.Forms.Label();
+ this.txtUsername = new System.Windows.Forms.TextBox();
+ this.LabelServer = new System.Windows.Forms.Label();
+ this.txtServer = new System.Windows.Forms.TextBox();
+ this.GroupBox1 = new System.Windows.Forms.GroupBox();
+ this.cmdSend = new System.Windows.Forms.Button();
+ this.LabelMessage = new System.Windows.Forms.Label();
+ this.LabelSubject = new System.Windows.Forms.Label();
+ this.LabelSentTo = new System.Windows.Forms.Label();
+ this.LabelMailFrom = new System.Windows.Forms.Label();
+ this.txtMessageText = new System.Windows.Forms.TextBox();
+ this.txtMessageSubject = new System.Windows.Forms.TextBox();
+ this.txtSendTo = new System.Windows.Forms.TextBox();
+ this.txtMailFrom = new System.Windows.Forms.TextBox();
+ this.GroupBox2.SuspendLayout();
+ this.GroupBox1.SuspendLayout();
+ this.SuspendLayout();
+
+ this.GroupBox2.Controls.Add(this.LabelAuthType);
+ this.GroupBox2.Controls.Add(this.cmbAuth);
+ this.GroupBox2.Controls.Add(this.LabelPopServer);
+ this.GroupBox2.Controls.Add(this.txtPOPServer);
+ this.GroupBox2.Controls.Add(this.LabelPasswd);
+ this.GroupBox2.Controls.Add(this.txtPassword);
+ this.GroupBox2.Controls.Add(this.LabelUsername);
+ this.GroupBox2.Controls.Add(this.txtUsername);
+ this.GroupBox2.Controls.Add(this.LabelServer);
+ this.GroupBox2.Controls.Add(this.txtServer);
+ this.GroupBox2.Location = new System.Drawing.Point(264, 10);
+ this.GroupBox2.Name = "GroupBox2";
+ this.GroupBox2.Size = new System.Drawing.Size(240, 216);
+ this.GroupBox2.TabIndex = 11;
+ this.GroupBox2.TabStop = false;
+ this.GroupBox2.Text = "Connection Settings";
+
+ this.LabelAuthType.AutoSize = true;
+ this.LabelAuthType.Location = new System.Drawing.Point(24, 98);
+ this.LabelAuthType.Name = "LabelAuthType";
+ this.LabelAuthType.Size = new System.Drawing.Size(101, 16);
+ this.LabelAuthType.TabIndex = 14;
+ this.LabelAuthType.Text = "Authentication type";
+ this.LabelAuthType.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+
+ this.cmbAuth.Location = new System.Drawing.Point(128, 96);
+ this.cmbAuth.Name = "cmbAuth";
+ this.cmbAuth.Size = new System.Drawing.Size(96, 21);
+ this.cmbAuth.TabIndex = 13;
+ this.cmbAuth.Text = "ComboBox1";
+
+ this.LabelPopServer.AutoSize = true;
+ this.LabelPopServer.Location = new System.Drawing.Point(24, 122);
+ this.LabelPopServer.Name = "LabelPopServer";
+ this.LabelPopServer.Size = new System.Drawing.Size(71, 16);
+ this.LabelPopServer.TabIndex = 12;
+ this.LabelPopServer.Text = "POP3 Server";
+ this.LabelPopServer.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+
+ this.txtPOPServer.Location = new System.Drawing.Point(104, 120);
+ this.txtPOPServer.Name = "txtPOPServer";
+ this.txtPOPServer.Size = new System.Drawing.Size(120, 20);
+ this.txtPOPServer.TabIndex = 11;
+ this.txtPOPServer.Text = "";
+
+ this.LabelPasswd.AutoSize = true;
+ this.LabelPasswd.Location = new System.Drawing.Point(24, 74);
+ this.LabelPasswd.Name = "LabelPasswd";
+ this.LabelPasswd.Size = new System.Drawing.Size(54, 16);
+ this.LabelPasswd.TabIndex = 10;
+ this.LabelPasswd.Text = "Password";
+ this.LabelPasswd.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+
+ this.txtPassword.Location = new System.Drawing.Point(88, 72);
+ this.txtPassword.Name = "txtPassword";
+ this.txtPassword.Size = new System.Drawing.Size(136, 20);
+ this.txtPassword.TabIndex = 9;
+ this.txtPassword.Text = "";
+
+ this.LabelUsername.AutoSize = true;
+ this.LabelUsername.Location = new System.Drawing.Point(24, 50);
+ this.LabelUsername.Name = "LabelUsername";
+ this.LabelUsername.Size = new System.Drawing.Size(56, 16);
+ this.LabelUsername.TabIndex = 8;
+ this.LabelUsername.Text = "Username";
+ this.LabelUsername.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+
+ this.txtUsername.Location = new System.Drawing.Point(88, 48);
+ this.txtUsername.Name = "txtUsername";
+ this.txtUsername.Size = new System.Drawing.Size(136, 20);
+ this.txtUsername.TabIndex = 7;
+ this.txtUsername.Text = "";
+
+ this.LabelServer.AutoSize = true;
+ this.LabelServer.Location = new System.Drawing.Point(24, 26);
+ this.LabelServer.Name = "LabelServer";
+ this.LabelServer.Size = new System.Drawing.Size(38, 16);
+ this.LabelServer.TabIndex = 6;
+ this.LabelServer.Text = "Server";
+ this.LabelServer.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+
+ this.txtServer.Location = new System.Drawing.Point(88, 24);
+ this.txtServer.Name = "txtServer";
+ this.txtServer.Size = new System.Drawing.Size(136, 20);
+ this.txtServer.TabIndex = 5;
+ this.txtServer.Text = "localhost";
+
+ this.GroupBox1.Controls.Add(this.cmdSend);
+ this.GroupBox1.Controls.Add(this.LabelMessage);
+ this.GroupBox1.Controls.Add(this.LabelSubject);
+ this.GroupBox1.Controls.Add(this.LabelSentTo);
+ this.GroupBox1.Controls.Add(this.LabelMailFrom);
+ this.GroupBox1.Controls.Add(this.txtMessageText);
+ this.GroupBox1.Controls.Add(this.txtMessageSubject);
+ this.GroupBox1.Controls.Add(this.txtSendTo);
+ this.GroupBox1.Controls.Add(this.txtMailFrom);
+ this.GroupBox1.Location = new System.Drawing.Point(8, 10);
+ this.GroupBox1.Name = "GroupBox1";
+ this.GroupBox1.Size = new System.Drawing.Size(240, 216);
+ this.GroupBox1.TabIndex = 10;
+ this.GroupBox1.TabStop = false;
+ this.GroupBox1.Text = "Email Editor";
+
+ this.cmdSend.Location = new System.Drawing.Point(80, 184);
+ this.cmdSend.Name = "cmdSend";
+ this.cmdSend.TabIndex = 8;
+ this.cmdSend.Text = "Send";
+ this.cmdSend.Click += new System.EventHandler(this.cmdSend_Click);
+
+ this.LabelMessage.AutoSize = true;
+ this.LabelMessage.Location = new System.Drawing.Point(16, 104);
+ this.LabelMessage.Name = "LabelMessage";
+ this.LabelMessage.Size = new System.Drawing.Size(50, 16);
+ this.LabelMessage.TabIndex = 7;
+ this.LabelMessage.Text = "Message";
+ this.LabelMessage.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+
+ this.LabelSubject.AutoSize = true;
+ this.LabelSubject.Location = new System.Drawing.Point(16, 74);
+ this.LabelSubject.Name = "LabelSubject";
+ this.LabelSubject.Size = new System.Drawing.Size(42, 16);
+ this.LabelSubject.TabIndex = 6;
+ this.LabelSubject.Text = "Subject";
+ this.LabelSubject.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+
+ this.LabelSentTo.AutoSize = true;
+ this.LabelSentTo.Location = new System.Drawing.Point(16, 50);
+ this.LabelSentTo.Name = "LabelSentTo";
+ this.LabelSentTo.Size = new System.Drawing.Size(43, 16);
+ this.LabelSentTo.TabIndex = 5;
+ this.LabelSentTo.Text = "Send to";
+ this.LabelSentTo.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+
+ this.LabelMailFrom.AutoSize = true;
+ this.LabelMailFrom.Location = new System.Drawing.Point(16, 26);
+ this.LabelMailFrom.Name = "LabelMailFrom";
+ this.LabelMailFrom.Size = new System.Drawing.Size(51, 16);
+ this.LabelMailFrom.TabIndex = 4;
+ this.LabelMailFrom.Text = "Mail from";
+ this.LabelMailFrom.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+
+ this.txtMessageText.Location = new System.Drawing.Point(80, 96);
+ this.txtMessageText.Multiline = true;
+ this.txtMessageText.Name = "txtMessageText";
+ this.txtMessageText.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
+ this.txtMessageText.Size = new System.Drawing.Size(136, 80);
+ this.txtMessageText.TabIndex = 3;
+ this.txtMessageText.Text = "this is the\r\nmulti-line test\r\n";
+
+ this.txtMessageSubject.Location = new System.Drawing.Point(80, 72);
+ this.txtMessageSubject.Name = "txtMessageSubject";
+ this.txtMessageSubject.Size = new System.Drawing.Size(136, 20);
+ this.txtMessageSubject.TabIndex = 2;
+ this.txtMessageSubject.Text = "test message";
+
+ this.txtSendTo.Location = new System.Drawing.Point(80, 48);
+ this.txtSendTo.Name = "txtSendTo";
+ this.txtSendTo.Size = new System.Drawing.Size(136, 20);
+ this.txtSendTo.TabIndex = 1;
+ this.txtSendTo.Text = "info";
+
+ this.txtMailFrom.Location = new System.Drawing.Point(80, 24);
+ this.txtMailFrom.Name = "txtMailFrom";
+ this.txtMailFrom.Size = new System.Drawing.Size(136, 20);
+ this.txtMailFrom.TabIndex = 0;
+ this.txtMailFrom.Text = "test";
+
+ this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
+ this.ClientSize = new System.Drawing.Size(512, 229);
+ this.Controls.Add(this.GroupBox2);
+ this.Controls.Add(this.GroupBox1);
+ this.Name = "frmMain";
+ this.Text = "Send Email";
+ this.Load += new System.EventHandler(this.frmMain_Load);
+ this.GroupBox2.ResumeLayout(false);
+ this.GroupBox1.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ [STAThread]
+ static void Main()
+ {
+ Application.Run(new frmMain());
+ }
+
+ private void cmdSend_Click(object sender, System.EventArgs e)
+ {
+ // send mail
+ }
+
+ private void frmMain_Load(object sender, System.EventArgs e)
+ {
+ cmbAuth.Items.Add("None");
+ cmbAuth.Items.Add("POP3");
+ cmbAuth.Items.Add("Login");
+ cmbAuth.Items.Add("Plain");
+ cmbAuth.SelectedIndex = 0;
+ }
+ }
+}
diff --git a/mcs/class/Managed.Windows.Forms/samples/notepad.cs b/mcs/class/Managed.Windows.Forms/samples/notepad.cs
new file mode 100644
index 00000000000..6ad148aeb6d
--- /dev/null
+++ b/mcs/class/Managed.Windows.Forms/samples/notepad.cs
@@ -0,0 +1,275 @@
+using System;
+using System.Drawing;
+using System.Collections;
+using System.ComponentModel;
+using System.Windows.Forms;
+using System.Data;
+using System.IO;
+
+namespace NotePadExample
+{
+ public class Notepad : System.Windows.Forms.Form
+ {
+ private System.Windows.Forms.MainMenu mainMenu1;
+ private System.Windows.Forms.MenuItem menuItemFile;
+ private System.Windows.Forms.MenuItem menuItemNew;
+ private System.Windows.Forms.MenuItem menuItemOpen;
+ private System.Windows.Forms.MenuItem menuItemSave;
+ private System.Windows.Forms.MenuItem menuItemExit;
+ private System.Windows.Forms.MenuItem menuItemEdit;
+ private System.Windows.Forms.MenuItem menuItemCut;
+ private System.Windows.Forms.MenuItem menuItemCopy;
+ private System.Windows.Forms.MenuItem menuItemPaste;
+ private System.Windows.Forms.MenuItem menuItemSelectAll;
+ private System.Windows.Forms.MenuItem menuItemHelp;
+ private System.Windows.Forms.MenuItem menuItemAbout;
+ private System.Windows.Forms.TextBox textBox1;
+ private System.Windows.Forms.MenuItem menuItemSep2;
+ private System.Windows.Forms.SaveFileDialog saveFileDialog1;
+ private System.Windows.Forms.MenuItem menuItemSep1;
+ private System.Windows.Forms.OpenFileDialog openFileDialog1;
+ private System.Windows.Forms.MenuItem menuItemBlank;
+ private System.Windows.Forms.MenuItem menuItemGeneral;
+
+ private System.ComponentModel.Container components = null;
+
+ public Notepad()
+ {
+ InitializeComponent();
+ }
+
+ protected override void Dispose( bool disposing )
+ {
+ if( disposing )
+ {
+ if (components != null)
+ {
+ components.Dispose();
+ }
+ }
+ base.Dispose( disposing );
+ }
+
+ private void InitializeComponent()
+ {
+ this.mainMenu1 = new System.Windows.Forms.MainMenu();
+ this.menuItemFile = new System.Windows.Forms.MenuItem();
+ this.menuItemNew = new System.Windows.Forms.MenuItem();
+ this.menuItemOpen = new System.Windows.Forms.MenuItem();
+ this.menuItemSep1 = new System.Windows.Forms.MenuItem();
+ this.menuItemSave = new System.Windows.Forms.MenuItem();
+ this.menuItemSep2 = new System.Windows.Forms.MenuItem();
+ this.menuItemExit = new System.Windows.Forms.MenuItem();
+ this.menuItemEdit = new System.Windows.Forms.MenuItem();
+ this.menuItemCut = new System.Windows.Forms.MenuItem();
+ this.menuItemCopy = new System.Windows.Forms.MenuItem();
+ this.menuItemPaste = new System.Windows.Forms.MenuItem();
+ this.menuItemSelectAll = new System.Windows.Forms.MenuItem();
+ this.menuItemHelp = new System.Windows.Forms.MenuItem();
+ this.menuItemAbout = new System.Windows.Forms.MenuItem();
+ this.menuItemBlank = new System.Windows.Forms.MenuItem();
+ this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
+ this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
+ this.textBox1 = new System.Windows.Forms.TextBox();
+ this.menuItemGeneral = new System.Windows.Forms.MenuItem();
+ this.SuspendLayout();
+
+ this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+ this.menuItemFile,
+ this.menuItemEdit,
+ this.menuItemHelp,
+ this.menuItemBlank});
+
+ this.menuItemFile.Index = 0;
+ this.menuItemFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+ this.menuItemNew,
+ this.menuItemOpen,
+ this.menuItemSep1,
+ this.menuItemSave,
+ this.menuItemSep2,
+ this.menuItemExit}
+ );
+ this.menuItemFile.Text = "File";
+
+ this.menuItemNew.Index = 0;
+ this.menuItemNew.Text = "&New";
+ this.menuItemNew.Click += new System.EventHandler(this.menuItemNew_Click);
+
+ this.menuItemOpen.Index = 1;
+ this.menuItemOpen.Text = "&Open";
+ this.menuItemOpen.Click += new System.EventHandler(this.menuItemOpen_Click);
+
+ this.menuItemSep1.Index = 2;
+ this.menuItemSep1.Text = "-";
+
+ this.menuItemSave.Index = 3;
+ this.menuItemSave.Text = "&Save";
+ this.menuItemSave.Click += new System.EventHandler(this.menuItemSave_Click);
+
+ this.menuItemSep2.Index = 4;
+ this.menuItemSep2.Text = "-";
+
+ this.menuItemExit.Index = 5;
+ this.menuItemExit.Text = "Exit";
+ this.menuItemExit.Click += new System.EventHandler(this.menuItemExit_Click_1);
+
+ this.menuItemEdit.Index = 1;
+ this.menuItemEdit.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+ this.menuItemCut,
+ this.menuItemCopy,
+ this.menuItemPaste,
+ this.menuItemSelectAll}
+ );
+ this.menuItemEdit.Text = "Edit";
+
+ this.menuItemCut.Index = 0;
+ this.menuItemCut.Text = "&Cut";
+ this.menuItemCut.Click += new System.EventHandler(this.menuItemCut_Click);
+
+ this.menuItemCopy.Index = 1;
+ this.menuItemCopy.Text = "&Copy";
+ this.menuItemCopy.Click += new System.EventHandler(this.menuItemCopy_Click);
+
+ this.menuItemPaste.Index = 2;
+ this.menuItemPaste.Text = "Paste";
+ this.menuItemPaste.Click += new System.EventHandler(this.menuItemPaste_Click);
+
+ this.menuItemSelectAll.Index = 3;
+ this.menuItemSelectAll.Text = "&Select All";
+ this.menuItemSelectAll.Click += new System.EventHandler(this.menuItemSelectAll_Click);
+
+ this.menuItemHelp.Index = 2;
+ this.menuItemHelp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+ this.menuItemAbout,
+ this.menuItemGeneral}
+ );
+ this.menuItemHelp.Text = "Help";
+
+ this.menuItemAbout.Index = 0;
+ this.menuItemAbout.Text = "About";
+ this.menuItemAbout.Click += new System.EventHandler(this.menuItemAbout_Click);
+
+ this.menuItemBlank.Index = 3;
+ this.menuItemBlank.Text = "";
+
+ this.saveFileDialog1.FileName = "doc1";
+
+ this.textBox1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.textBox1.Multiline = true;
+ this.textBox1.Name = "textBox1";
+ this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
+ this.textBox1.Size = new System.Drawing.Size(544, 321);
+ this.textBox1.TabIndex = 0;
+ this.textBox1.Text = "";
+ this.textBox1.TextChanged += new
+ System.EventHandler(this.textBox1_TextChanged_1);
+
+ this.menuItemGeneral.Index = 1;
+ this.menuItemGeneral.Text = "General";
+ this.menuItemGeneral.Click += new System.EventHandler(this.menuItemGeneral_Click);
+
+ this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
+ this.ClientSize = new System.Drawing.Size(544, 321);
+ this.Controls.AddRange(new System.Windows.Forms.Control[] {
+ this.textBox1}
+ );
+ this.ImeMode = System.Windows.Forms.ImeMode.Off;
+ this.Menu = this.mainMenu1;
+ this.Name = "Notepad";
+ this.Text = "Notepad MWF Example";
+ this.Load += new System.EventHandler(this.Form1_Load);
+ this.ResumeLayout(false);
+ }
+
+ [STAThread]
+ public static void Main()
+ {
+ Application.Run(new Notepad());
+ }
+
+ private void Form1_Load(object sender, System.EventArgs e)
+ {
+
+ }
+
+ private void menuItemOpen_Click(object sender, System.EventArgs e)
+ {
+ openFileDialog1.ShowDialog();
+ StreamReader sr = new StreamReader(openFileDialog1.FileName);
+ textBox1.Text = sr.ReadToEnd();
+ sr.Close();
+ }
+
+ private void menuItemCut_Click(object sender, System.EventArgs e)
+ {
+ Clipboard.SetDataObject(textBox1.SelectedText);
+ textBox1.SelectedText="";
+
+ }
+
+ private void menuItemPaste_Click(object sender, System.EventArgs e)
+ {
+ textBox1.Paste();
+ }
+
+ private void textBox1_TextChanged(object sender, System.EventArgs e)
+ {
+
+ }
+
+ private void menuItemAbout_Click(object sender, System.EventArgs e)
+ {
+ Form helpnew = new Form();
+ helpnew.Show();
+
+ }
+
+ private void textBox1_TextChanged_1(object sender, System.EventArgs e)
+ {
+
+ }
+
+ private void menuItemExit_Click(object sender, System.EventArgs e)
+ {
+
+ }
+
+ private void menuItemExit_Click_1(object sender, System.EventArgs e)
+ {
+ Dispose(true);
+ }
+
+ private void menuItemCopy_Click(object sender, System.EventArgs e)
+ {
+ textBox1.Copy();
+ }
+
+ private void menuItemSelectAll_Click(object sender, System.EventArgs e)
+ {
+ textBox1.SelectAll();
+ }
+
+ private void menuItemNew_Click(object sender, System.EventArgs e)
+ {
+ textBox1.Clear();
+ }
+
+ private void menuItemSave_Click(object sender, System.EventArgs e)
+ {
+ saveFileDialog1.FileName = "*.txt";
+ //saveFileDialog1.FilterIndex ="*.txt";
+ saveFileDialog1.ShowDialog();
+ //MessageBox.Show (saveFileDialog1.FileName);
+ StreamWriter sw = new StreamWriter(saveFileDialog1.FileName);
+ sw.Write (textBox1.Text);
+ sw.Close();
+ }
+
+ private void menuItemGeneral_Click(object sender, System.EventArgs e)
+ {
+ Form gen = new Form ();
+ gen.Show();
+
+ }
+ }
+}